-
Notifications
You must be signed in to change notification settings - Fork 521
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clarify eager macro explanation #1872
base: master
Are you sure you want to change the base?
Clarify eager macro explanation #1872
Conversation
Signed-off-by: Yuki Okushi <[email protected]>
Signed-off-by: Yuki Okushi <[email protected]>
Signed-off-by: Yuki Okushi <[email protected]>
Signed-off-by: Yuki Okushi <[email protected]>
This file was moved in rust-lang/rust#108618
…e stage1 compiler (rust-lang#1840)
Enabling the profiler runtime is an essential part of being able to properly work on the coverage instrumentation code. There's already a mention of it on this page, but it's made in passing and is easy to miss. This patch adds a much more prominent section containing recommended `config.toml` settings, including `profiler = true`.
The current link provides a link to two versions of the book, both redirecting to the "current version", which is the link this PR uses
Signed-off-by: onur-ozkan <[email protected]>
This flag was removed by <rust-lang/rust#119566>.
Co-authored-by: Yuki Okushi <[email protected]>
…#1849) * add some explain for rustbot commands * add more details about shortcuts * fix words on `r=someone` Co-authored-by: Yuki Okushi <[email protected]> --------- Co-authored-by: Yuki Okushi <[email protected]>
Co-authored-by: Yuki Okushi <[email protected]>
This CL tries to improve the text around the order in which macro are expanded in various related way. 1. Remove duplication of "smoother". Its first occurrence is > a smoother user experience. As an example It seems that we'll have an example of a smooth user experience. It is not the case, we have an example of macro expansion. Removing this occurrence of "smooth" help understand this won't be considered in the following example. As the same "smooth" explanation is given below, nothing is lost. 2. Use an actual example of where eager expansion is needed This example comes, modified, from https://doc.rust-lang.org/std/macro.compile_error.html . It uses cfg to cause a compile error if something is not as expected. As far as my understanding of rust goes, this could not be done with call-by-name evaluation. At the same time, this example shows the steps of rewritting. (Approximatively. I still use code represented as strings instead of a list of token/an AST, for the sake of the readability) 3. Not all macros are in the queue According to the way step 1 of the algorithm is currently written, it seems that, in `foo!(bar!(baz));`, both `foo!(bar!(baz))` and `bar!(baz)` should be in the queue. This is false, as `bar!` should not be evaluated until `foo!` is. So the rewritting state that the traversal does not enter unevaluated macros. It also add a note about the exception of non-eager macros. Technically, it should state that, for non-eager macro, the macro itself should not be evaluated until all of its argument containing macros are evaluated. But I guess it's already fit in the case "macro expansion is not resolved".
Sorry, due to me messing up a git operation, we sadly had to force-push the whole commit history of rustc-dev-guide :( If you'd like to update this pull request, you will have to rebase it in a special way onto the new commit history (the new
More context can be found here. |
@Kobzol to be frank, it's been opened for a year, without reivew. So, unless anyone tell me they expect to be reviewed and merged (with or without correction first), I don't intend to spend more time on it |
This CL tries to improve the text around the order in which macro are expanded in various related way.
Its first occurrence is
It seems that we'll have an example of a smooth user experience. It is not the case, we have an example of macro expansion. Removing this occurrence of "smooth" help understand this won't be considered in the following example.
As the same "smooth" explanation is given below, nothing is lost.
This example comes, modified, from
https://doc.rust-lang.org/std/macro.compile_error.html . It uses cfg to cause a compile error if something is not as expected.
As far as my understanding of rust goes, this could not be done with call-by-name evaluation.
At the same time, this example shows the steps of
rewritting. (Approximatively. I still use code represented as strings instead of a list of token/an AST, for the sake of the readability)
According to the way step 1 of the algorithm is currently written, it seems that, in
foo!(bar!(baz));
, bothfoo!(bar!(baz))
andbar!(baz)
should be in the queue. This is false, asbar!
should not be evaluated untilfoo!
is.So the rewritting state that the traversal does not enter unevaluated macros. It also add a note about the exception of non-eager macros.
Technically, it should state that, for non-eager macro, the macro itself should not be evaluated until all of its argument containing macros are evaluated. But I guess it's already fit in the case "macro expansion is not resolved".