Fixed tests.
This commit is contained in:
parent
767ffced91
commit
b9326f75fb
4 changed files with 20 additions and 11 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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: `<Foo as Trait>::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: `<Foo as Trait>::Baz`
|
||||
|
|
|
|||
|
|
@ -7,4 +7,5 @@ fn main() {
|
|||
let _ = Option::None::<u8>; // OK (Lint in future!)
|
||||
let _ = Alias::<u8>::None; // OK
|
||||
let _ = Alias::None::<u8>; // Error
|
||||
//~^ type parameters are not allowed on this type
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue