diff options
| author | Michael Goulet <michael@errs.io> | 2023-03-11 21:18:45 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2023-03-11 21:29:28 +0000 |
| commit | bd4355500a53ba2b3d82d754d1d669710d4b442c (patch) | |
| tree | 4a64dad397b352a8f7cae7df9727bd10d7e86b3e /compiler | |
| parent | 8a73f50d875840b8077b8ec080fa41881d7ce40d (diff) | |
| download | rust-bd4355500a53ba2b3d82d754d1d669710d4b442c.tar.gz rust-bd4355500a53ba2b3d82d754d1d669710d4b442c.zip | |
Gate all usages of dyn*, even in macros
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_ast_passes/src/feature_gate.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_parse/src/parser/ty.rs | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/compiler/rustc_ast_passes/src/feature_gate.rs b/compiler/rustc_ast_passes/src/feature_gate.rs index 96042ea3078..a33f2bd33f1 100644 --- a/compiler/rustc_ast_passes/src/feature_gate.rs +++ b/compiler/rustc_ast_passes/src/feature_gate.rs @@ -337,9 +337,6 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> { ast::TyKind::Never => { gate_feature_post!(&self, never_type, ty.span, "the `!` type is experimental"); } - ast::TyKind::TraitObject(_, ast::TraitObjectSyntax::DynStar, ..) => { - gate_feature_post!(&self, dyn_star, ty.span, "dyn* trait objects are unstable"); - } _ => {} } visit::walk_ty(self, ty) @@ -594,6 +591,7 @@ pub fn check_crate(krate: &ast::Crate, sess: &Session) { gate_all!(inline_const_pat, "inline-const in pattern position is experimental"); gate_all!(associated_const_equality, "associated const equality is incomplete"); gate_all!(yeet_expr, "`do yeet` expression is experimental"); + gate_all!(dyn_star, "`dyn*` trait objects are experimental"); // All uses of `gate_all!` below this point were added in #65742, // and subsequently disabled (with the non-early gating readded). diff --git a/compiler/rustc_parse/src/parser/ty.rs b/compiler/rustc_parse/src/parser/ty.rs index 6fe4da71f6b..3d9d2cc62e3 100644 --- a/compiler/rustc_parse/src/parser/ty.rs +++ b/compiler/rustc_parse/src/parser/ty.rs @@ -624,10 +624,12 @@ impl<'a> Parser<'a> { /// /// Note that this does *not* parse bare trait objects. fn parse_dyn_ty(&mut self, impl_dyn_multi: &mut bool) -> PResult<'a, TyKind> { + let lo = self.token.span; self.bump(); // `dyn` // parse dyn* types let syntax = if self.eat(&TokenKind::BinOp(token::Star)) { + self.sess.gated_spans.gate(sym::dyn_star, lo.to(self.prev_token.span)); TraitObjectSyntax::DynStar } else { TraitObjectSyntax::Dyn |
