-
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
Stabilize #[cfg_eval]
and feature(macro_attributes_in_derive_output)
#83824
Conversation
☔ The latest upstream changes (presumably #83530) made this pull request unmergeable. Please resolve the merge conflicts. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. 👍
I'm going to delay this stabilization a bit and try two more things first:
|
I am not completely sure about the code and internals, would love if you could help explain a bit of why this is a blocker for stabilising this feature.
Why do we need the original unconfigured item? |
If input is eagerly fully configured for all attributes, then
So you can place attributes requiring the original unconfigured input after |
One potential issue with doing this - a macro might want to do addtional processing of |
Yeah, not expanding cfgs eagerly gives proc macro authors a choice, so we'll probably need some kind of opt-out. |
As a pyO3 maintainer the evidence downstream (in pyO3 at least) is that having cfg-stripping be opt-out would be slightly more convenient for our users, who are often first-time Rustaceans coming from Python. That said, once we've got a mechanism in the language (whether opt-in or opt-out) then it's quite plausible with pyO3's current design to conditionally compile python bindings for Rust crates just by slapping We would write documentation for this regardless of whether it would need to explain My thanks to you folks for implementing this! 🚀 |
Blocked on #85073. |
Blocked on #86057. |
parser: Ensure that all nonterminals have tokens after parsing `parse_nonterminal` should always result in something with tokens. This requirement wasn't satisfied in two cases: - `stmt` nonterminal with expression statements (e.g. `0`, or `{}`, or `path + 1`) because `fn parse_stmt_without_recovery` forgot to propagate `force_collect` in some cases. - `expr` nonterminal with expressions with built-in attributes (e.g. `#[allow(warnings)] 0`) due to an incorrect optimization in `fn parse_expr_force_collect`, it assumed that all expressions starting with `#` have their tokens collected during parsing, but that's not true if all the attributes on that expression are built-in and inert. (Discovered when trying to implement eager `cfg` expansion for all attributes rust-lang#83824 (comment).) r? `@Aaron1011`
Blocked on #87220. |
TODO: Stabilization report.
Closes #82679
Closes #81119
r? @Aaron1011