diff --git a/src/librustc_typeck/lib.rs b/src/librustc_typeck/lib.rs index 4950ea319271..8c0913a56b51 100644 --- a/src/librustc_typeck/lib.rs +++ b/src/librustc_typeck/lib.rs @@ -141,7 +141,7 @@ fn allow_type_alias_enum_variants<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>, if let Def::TyAlias(_) = path.def { let mut err = tcx.sess.struct_span_err( span, - "type alias enum variants are not yet allowed" + "enum variants on type aliases are experimental" ); if nightly_options::is_nightly_build() { help!(&mut err, diff --git a/src/test/ui/feature-gates/feature-gate-type_alias_enum_variants.rs b/src/test/ui/feature-gates/feature-gate-type_alias_enum_variants.rs index 39472af43fdb..2dcd0dcd2438 100644 --- a/src/test/ui/feature-gates/feature-gate-type_alias_enum_variants.rs +++ b/src/test/ui/feature-gates/feature-gate-type_alias_enum_variants.rs @@ -17,9 +17,17 @@ type Alias = Foo; fn main() { let t = Alias::Bar(0); + //~^ ERROR enum variants on type aliases are experimental + //~^^ ERROR no variant named `Bar` found for type `Foo` in the current scope let t = Alias::Baz { i: 0 }; + //~^ ERROR enum variants on type aliases are experimental + //~^^ ERROR ambiguous associated type match t { Alias::Bar(_i) => {} + //~^ ERROR enum variants on type aliases are experimental + //~^^ ERROR no variant named `Bar` found for type `Foo` in the current scope Alias::Baz { i: _i } => {} + //~^ ERROR enum variants on type aliases are experimental + //~^^ ERROR ambiguous associated type } } diff --git a/src/test/ui/feature-gates/feature-gate-type_alias_enum_variants.stderr b/src/test/ui/feature-gates/feature-gate-type_alias_enum_variants.stderr index 7dce09e483f9..7a49770d97a2 100644 --- a/src/test/ui/feature-gates/feature-gate-type_alias_enum_variants.stderr +++ b/src/test/ui/feature-gates/feature-gate-type_alias_enum_variants.stderr @@ -1,4 +1,4 @@ -error: type alias enum variants are not yet allowed +error: enum variants on type aliases are experimental --> $DIR/feature-gate-type_alias_enum_variants.rs:19:13 | LL | let t = Alias::Bar(0); @@ -19,8 +19,8 @@ LL | let t = Alias::Bar(0); | = help: did you mean `Bar`? -error: type alias enum variants are not yet allowed - --> $DIR/feature-gate-type_alias_enum_variants.rs:20:13 +error: enum variants on type aliases are experimental + --> $DIR/feature-gate-type_alias_enum_variants.rs:22:13 | LL | let t = Alias::Baz { i: 0 }; | ^^^^^^^^^^ @@ -28,13 +28,13 @@ LL | let t = Alias::Baz { i: 0 }; = help: add `#![feature(type_alias_enum_variants)]` to the crate attributes to enable error[E0223]: ambiguous associated type - --> $DIR/feature-gate-type_alias_enum_variants.rs:20:13 + --> $DIR/feature-gate-type_alias_enum_variants.rs:22:13 | LL | let t = Alias::Baz { i: 0 }; | ^^^^^^^^^^ help: use fully-qualified syntax: `::Baz` -error: type alias enum variants are not yet allowed - --> $DIR/feature-gate-type_alias_enum_variants.rs:22:9 +error: enum variants on type aliases are experimental + --> $DIR/feature-gate-type_alias_enum_variants.rs:26:9 | LL | Alias::Bar(_i) => {} | ^^^^^^^^^^^^^^ @@ -42,7 +42,7 @@ LL | Alias::Bar(_i) => {} = help: add `#![feature(type_alias_enum_variants)]` to the crate attributes to enable error[E0599]: no variant named `Bar` found for type `Foo` in the current scope - --> $DIR/feature-gate-type_alias_enum_variants.rs:22:16 + --> $DIR/feature-gate-type_alias_enum_variants.rs:26:16 | LL | enum Foo { | -------- variant `Bar` not found here @@ -52,8 +52,8 @@ LL | Alias::Bar(_i) => {} | = help: did you mean `Bar`? -error: type alias enum variants are not yet allowed - --> $DIR/feature-gate-type_alias_enum_variants.rs:23:9 +error: enum variants on type aliases are experimental + --> $DIR/feature-gate-type_alias_enum_variants.rs:29:9 | LL | Alias::Baz { i: _i } => {} | ^^^^^^^^^^ @@ -61,7 +61,7 @@ LL | Alias::Baz { i: _i } => {} = help: add `#![feature(type_alias_enum_variants)]` to the crate attributes to enable error[E0223]: ambiguous associated type - --> $DIR/feature-gate-type_alias_enum_variants.rs:23:9 + --> $DIR/feature-gate-type_alias_enum_variants.rs:29:9 | LL | Alias::Baz { i: _i } => {} | ^^^^^^^^^^ help: use fully-qualified syntax: `::Baz` diff --git a/src/test/ui/type-alias-enum-variants.rs b/src/test/ui/type-alias-enum-variants.rs index 8e5aaae0a932..73395e6a9798 100644 --- a/src/test/ui/type-alias-enum-variants.rs +++ b/src/test/ui/type-alias-enum-variants.rs @@ -7,4 +7,5 @@ fn main() { let _ = Option::None::; // OK (Lint in future!) let _ = Alias::::None; // OK let _ = Alias::None::; // Error + //~^ type parameters are not allowed on this type }