diff --git a/src/libsyntax/feature_gate/check.rs b/src/libsyntax/feature_gate/check.rs index a4fc6114b9850..482605971b854 100644 --- a/src/libsyntax/feature_gate/check.rs +++ b/src/libsyntax/feature_gate/check.rs @@ -446,6 +446,15 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> { "auto traits are experimental and possibly buggy"); } + ast::ItemKind::TraitAlias(..) => { + gate_feature_post!( + &self, + trait_alias, + i.span, + "trait aliases are experimental" + ); + } + ast::ItemKind::MacroDef(ast::MacroDef { legacy: false, .. }) => { let msg = "`macro` is experimental"; gate_feature_post!(&self, decl_macro, i.span, msg); diff --git a/src/test/ui/feature-gates/feature-gate-trait-alias.rs b/src/test/ui/feature-gates/feature-gate-trait-alias.rs index 4b94d7d6d3bda..819085adddade 100644 --- a/src/test/ui/feature-gates/feature-gate-trait-alias.rs +++ b/src/test/ui/feature-gates/feature-gate-trait-alias.rs @@ -1,13 +1,4 @@ trait Foo = Default; //~^ ERROR trait aliases are experimental -macro_rules! accept_item { - ($i:item) => {} -} - -accept_item! { - trait Foo = Ord + Eq; - //~^ ERROR trait aliases are experimental -} - fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-trait-alias.stderr b/src/test/ui/feature-gates/feature-gate-trait-alias.stderr index b1bf6ad349129..9250e27d15807 100644 --- a/src/test/ui/feature-gates/feature-gate-trait-alias.stderr +++ b/src/test/ui/feature-gates/feature-gate-trait-alias.stderr @@ -7,15 +7,6 @@ LL | trait Foo = Default; = note: for more information, see https://github.com/rust-lang/rust/issues/41517 = help: add `#![feature(trait_alias)]` to the crate attributes to enable -error[E0658]: trait aliases are experimental - --> $DIR/feature-gate-trait-alias.rs:9:5 - | -LL | trait Foo = Ord + Eq; - | ^^^^^^^^^^^^^^^^^^^^^ - | - = note: for more information, see https://github.com/rust-lang/rust/issues/41517 - = help: add `#![feature(trait_alias)]` to the crate attributes to enable - -error: aborting due to 2 previous errors +error: aborting due to previous error For more information about this error, try `rustc --explain E0658`.