diff options
| author | Michael Goulet <michael@errs.io> | 2024-03-20 16:53:50 -0400 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2024-03-21 11:42:49 -0400 |
| commit | 2d633317f30dd02895f167b65dc1feeee0d08265 (patch) | |
| tree | 50b3622db66615853ae53baa9c54d968f01e413b /compiler/rustc_ast_passes/src/feature_gate.rs | |
| parent | 2627e9f3012a97d3136b3e11bf6bd0853c38a534 (diff) | |
| download | rust-2d633317f30dd02895f167b65dc1feeee0d08265.tar.gz rust-2d633317f30dd02895f167b65dc1feeee0d08265.zip | |
Implement macro-based deref!() syntax for deref patterns
Stop using `box PAT` syntax for deref patterns, as it's misleading and also causes their semantics being tangled up.
Diffstat (limited to 'compiler/rustc_ast_passes/src/feature_gate.rs')
| -rw-r--r-- | compiler/rustc_ast_passes/src/feature_gate.rs | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/compiler/rustc_ast_passes/src/feature_gate.rs b/compiler/rustc_ast_passes/src/feature_gate.rs index 277e82b4e53..81065fa3dce 100644 --- a/compiler/rustc_ast_passes/src/feature_gate.rs +++ b/compiler/rustc_ast_passes/src/feature_gate.rs @@ -413,10 +413,7 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> { } } PatKind::Box(..) => { - if !self.features.deref_patterns { - // Allow box patterns under `deref_patterns`. - gate!(&self, box_patterns, pattern.span, "box pattern syntax is experimental"); - } + gate!(&self, box_patterns, pattern.span, "box pattern syntax is experimental"); } PatKind::Range(_, Some(_), Spanned { node: RangeEnd::Excluded, .. }) => { gate!( @@ -610,10 +607,7 @@ pub fn check_crate(krate: &ast::Crate, sess: &Session, features: &Features) { }; } - if !visitor.features.deref_patterns { - // Allow box patterns under `deref_patterns`. - gate_all_legacy_dont_use!(box_patterns, "box pattern syntax is experimental"); - } + gate_all_legacy_dont_use!(box_patterns, "box pattern syntax is experimental"); gate_all_legacy_dont_use!(trait_alias, "trait aliases are experimental"); // Despite being a new feature, `where T: Trait<Assoc(): Sized>`, which is RTN syntax now, // used to be gated under associated_type_bounds, which are right above, so RTN needs to |
