You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
try bikeshed $ty { … } is not pre-expansion gated (affects beta+nightly) #152501
The following code compiles even though it shouldn't:
fnmain(){#[cfg(false)]
try bikeshed(){}}
Contrary to try { … } it does not even issue a pre-expansion gate warning. For context, try blocks and some other ancient features are notoriously post-expansion gated which we can't change without breaking a large amount of crates in the ecosystem (which use the #[cfg(feature = "nightly")] pattern). For new syntactic forms however we require a pre-expansion feature gate nowadays for forward compatibility reasons. try bikeshed $ty { … }is a new syntactic form and thus should be pre-expansion gated by try_blockstry_block_heterogeneous.
Can you point me at instructions for the right way to do this? (Or if someone who knows what they're doing wants to just fix it that would be good too.)
Ah, now I see that it's to be gated separately anyway, namely behind try_blocks_heterogeneous. That makes it even simpler.
Oops, absolutely agreed. My bad for copying try.
No worries!
Can you point me at instructions for the right way to do this? (Or if someone who knows what they're doing wants to just fix it that would be good too.)
In compiler/rustc_ast_passes/src/feature_gate.rs you add a gate_all!(try_block_heterogeneous, "… … …"); where all the other gate_all!(…)s are. Then, you remove the branch you've added to the PostExpansionVisitor in PR #149489.
Activity
scottmcm commentedon Feb 11, 2026
Oops, absolutely agreed. My bad for copying
try.Can you point me at instructions for the right way to do this? (Or if someone who knows what they're doing wants to just fix it that would be good too.)
fmease commentedon Feb 12, 2026
fmease commentedon Feb 12, 2026
Feel free to r? me
fmease commentedon Feb 12, 2026
Resolved
Ah, now I see that it's to be gated separately anyway, namely behind
try_blocks_heterogeneous. That makes it even simpler.No worries!
In
compiler/rustc_ast_passes/src/feature_gate.rsyou add agate_all!(try_block_heterogeneous, "… … …");where all the othergate_all!(…)s are. Then, you remove the branch you've added to thePostExpansionVisitorin PR #149489.Rollup merge of rust-lang#152519 - scottmcm:fix-152501, r=fmease
Rollup merge of rust-lang#152519 - scottmcm:fix-152501, r=fmease
Unrolled build for #152519
zhanglin2603 commentedon Feb 17, 2026
fmease commentedon Feb 17, 2026
@rust-lang/mods
Rollup merge of rust-lang#153624 - fmease:ping-me-on-parser-changes, …
Rollup merge of rust-lang#153624 - fmease:ping-me-on-parser-changes, …
Rollup merge of rust-lang#153624 - fmease:ping-me-on-parser-changes, …
Unrolled build for #153624