Stabilize #[cfg_eval] and feature(macro_attributes_in_derive_output)#83824
Stabilize #[cfg_eval] and feature(macro_attributes_in_derive_output)#83824petrochenkov wants to merge 1 commit intorust-lang:masterfrom
#[cfg_eval] and feature(macro_attributes_in_derive_output)#83824Conversation
|
☔ The latest upstream changes (presumably #83530) made this pull request unmergeable. Please resolve the merge conflicts. |
|
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