-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
rustc_interface: Add a new query pre_configure
#108221
Conversation
(rustbot has picked a reviewer for you, use r? to override) |
@bjorn3 There are 10 attributes that are used as early as
, i.e. before the crate root is actually expanded by the main expansion pass ( I don't think it's feasible to delay use of all (*) of these attributes to post-expansion. However, we need to produce an error if any of these attributes appears after expansion of a crate-level procedural macro attribute. (*) Some of them could potentially be delayed though. It would be nice, because in that case they would work even if produced by crate-level procedural macros. |
crate_name and crate_type affect what the output files are and as such need to be known by the driver. This for example results in us having to modify the Session after it was constructed. If we push back incr comp much further this is going to hurt I think. Disallowing incr comp allows us to scan for crate_type amd crate_name attributes before creating the Session. All other attributes you listed only affect the content of the compilation and not what files are produced or the Session. Another reason is gccrs which can't really support conditional crate_name and crate_type because as I understand it to the driver needs to know these things before invoking the actual compiler executable (which does macro expansion) to pass the right arguments. Even ignoring this I think rustc itself benefits from it. |
This should probably be run through crater. |
⌛ Trying commit 13a91c09c660eba2434e10b49b8cc99795d085cb with merge 8df314f433990f5163039edae8245e89581f72ca... |
☀️ Try build successful - checks-actions |
@craterbot check |
👌 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
🚧 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
Thanks for the PR, @petrochenkov! I'll take a closer look shortly. |
🎉 Experiment
|
@rust-lang/infra |
Quite a few regressions from 4cf92c4 (i.e. the fix for #104633). It's mostly the "unknown feature" errors on fully unconfigured crates. The second source of regressions is that fully unconfigured crates with So, in practice the attributes from the list in #108221 (comment) aren't supposed to be accounted for in fully-unconfigured crates, I guess. |
|
13a91c0
to
fc0c116
Compare
@bors try |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
@bors retry |
This comment was marked as resolved.
This comment was marked as resolved.
Also some more attributes are passed by reference.
It partially expands crate attributes before the main expansion pass (without modifying the crate), and the produced preliminary crate attribute list is used for querying a few attributes that are required very early. Crate-level cfg attributes are then expanded normally during the main expansion pass, like attributes on any other nodes.
This comment was marked as resolved.
This comment was marked as resolved.
@bors r=michaelwoerister |
☀️ Test successful - checks-actions |
Finished benchmarking commit (df7fd99): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
|
It partially expands crate attributes before the main expansion pass (without modifying the crate), and the produced preliminary crate attribute list is used for querying a few attributes that are required very early.
Crate-level cfg attributes on the crate itself are then expanded normally during the main expansion pass, like attributes on any other nodes.
This is a continuation of #92473 and one more step to very unstable crate-level proc macro attributes maybe actually working.
Previously crate attributes were pre-configured simultaneously with feature extraction, and then written directly into
ast::Crate
.