Skip to content

Commit b75478b

Browse files
author
Alexander Regueiro
committed
Fixed tests.
1 parent b5b2716 commit b75478b

File tree

4 files changed

+20
-11
lines changed

4 files changed

+20
-11
lines changed

src/librustc_typeck/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ fn allow_type_alias_enum_variants<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>,
150150
if let Def::TyAlias(_) = path.def {
151151
let mut err = tcx.sess.struct_span_err(
152152
span,
153-
"type alias enum variants are not yet allowed"
153+
"enum variants on type aliases are experimental"
154154
);
155155
if nightly_options::is_nightly_build() {
156156
help!(&mut err,

src/test/ui/feature-gates/feature-gate-type_alias_enum_variants.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,17 @@ type Alias = Foo;
1717

1818
fn main() {
1919
let t = Alias::Bar(0);
20+
//~^ ERROR enum variants on type aliases are experimental
21+
//~^^ ERROR no variant named `Bar` found for type `Foo` in the current scope
2022
let t = Alias::Baz { i: 0 };
23+
//~^ ERROR enum variants on type aliases are experimental
24+
//~^^ ERROR ambiguous associated type
2125
match t {
2226
Alias::Bar(_i) => {}
27+
//~^ ERROR enum variants on type aliases are experimental
28+
//~^^ ERROR no variant named `Bar` found for type `Foo` in the current scope
2329
Alias::Baz { i: _i } => {}
30+
//~^ ERROR enum variants on type aliases are experimental
31+
//~^^ ERROR ambiguous associated type
2432
}
2533
}

src/test/ui/feature-gates/feature-gate-type_alias_enum_variants.stderr

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: type alias enum variants are not yet allowed
1+
error: enum variants on type aliases are experimental
22
--> $DIR/feature-gate-type_alias_enum_variants.rs:19:13
33
|
44
LL | let t = Alias::Bar(0);
@@ -19,30 +19,30 @@ LL | let t = Alias::Bar(0);
1919
|
2020
= help: did you mean `Bar`?
2121

22-
error: type alias enum variants are not yet allowed
23-
--> $DIR/feature-gate-type_alias_enum_variants.rs:20:13
22+
error: enum variants on type aliases are experimental
23+
--> $DIR/feature-gate-type_alias_enum_variants.rs:22:13
2424
|
2525
LL | let t = Alias::Baz { i: 0 };
2626
| ^^^^^^^^^^
2727
|
2828
= help: add `#![feature(type_alias_enum_variants)]` to the crate attributes to enable
2929

3030
error[E0223]: ambiguous associated type
31-
--> $DIR/feature-gate-type_alias_enum_variants.rs:20:13
31+
--> $DIR/feature-gate-type_alias_enum_variants.rs:22:13
3232
|
3333
LL | let t = Alias::Baz { i: 0 };
3434
| ^^^^^^^^^^ help: use fully-qualified syntax: `<Foo as Trait>::Baz`
3535

36-
error: type alias enum variants are not yet allowed
37-
--> $DIR/feature-gate-type_alias_enum_variants.rs:22:9
36+
error: enum variants on type aliases are experimental
37+
--> $DIR/feature-gate-type_alias_enum_variants.rs:26:9
3838
|
3939
LL | Alias::Bar(_i) => {}
4040
| ^^^^^^^^^^^^^^
4141
|
4242
= help: add `#![feature(type_alias_enum_variants)]` to the crate attributes to enable
4343

4444
error[E0599]: no variant named `Bar` found for type `Foo` in the current scope
45-
--> $DIR/feature-gate-type_alias_enum_variants.rs:22:16
45+
--> $DIR/feature-gate-type_alias_enum_variants.rs:26:16
4646
|
4747
LL | enum Foo {
4848
| -------- variant `Bar` not found here
@@ -52,16 +52,16 @@ LL | Alias::Bar(_i) => {}
5252
|
5353
= help: did you mean `Bar`?
5454

55-
error: type alias enum variants are not yet allowed
56-
--> $DIR/feature-gate-type_alias_enum_variants.rs:23:9
55+
error: enum variants on type aliases are experimental
56+
--> $DIR/feature-gate-type_alias_enum_variants.rs:29:9
5757
|
5858
LL | Alias::Baz { i: _i } => {}
5959
| ^^^^^^^^^^
6060
|
6161
= help: add `#![feature(type_alias_enum_variants)]` to the crate attributes to enable
6262

6363
error[E0223]: ambiguous associated type
64-
--> $DIR/feature-gate-type_alias_enum_variants.rs:23:9
64+
--> $DIR/feature-gate-type_alias_enum_variants.rs:29:9
6565
|
6666
LL | Alias::Baz { i: _i } => {}
6767
| ^^^^^^^^^^ help: use fully-qualified syntax: `<Foo as Trait>::Baz`

src/test/ui/type-alias-enum-variants.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ fn main() {
77
let _ = Option::None::<u8>; // OK (Lint in future!)
88
let _ = Alias::<u8>::None; // OK
99
let _ = Alias::None::<u8>; // Error
10+
//~^ type parameters are not allowed on this type
1011
}

0 commit comments

Comments
 (0)