Skip to content

try bikeshed $ty { … } is not pre-expansion gated (affects beta+nightly) #152501

@fmease

Description

@fmease

The following code compiles even though it shouldn't:

fn main() {
    #[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_blocks try_block_heterogeneous.

Metadata

Metadata

Assignees

Labels

A-parserArea: The lexing & parsing of Rust source code to an ASTC-bugCategory: This is a bug.P-highHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-betaPerformance or correctness regression from stable to beta.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions