]> git.lizzy.rs Git - rust.git/commitdiff
Move type_alias_enum_variants tests to a folder; Strip feature gates.
authorMazdak Farrokhzad <twingoow@gmail.com>
Sat, 8 Jun 2019 23:04:58 +0000 (01:04 +0200)
committerMazdak Farrokhzad <twingoow@gmail.com>
Sat, 15 Jun 2019 17:18:09 +0000 (19:18 +0200)
37 files changed:
src/test/run-pass/type-alias-enum-variants-2.rs [deleted file]
src/test/run-pass/type-alias-enum-variants.rs [deleted file]
src/test/ui/enum-variant-generic-args.rs [deleted file]
src/test/ui/enum-variant-generic-args.stderr [deleted file]
src/test/ui/issues/issue-57866.rs [deleted file]
src/test/ui/issues/issue-58006.rs [deleted file]
src/test/ui/issues/issue-58006.stderr [deleted file]
src/test/ui/pattern/enum-variant-generic-args.rs [deleted file]
src/test/ui/type-alias-enum-variants-panic.rs [deleted file]
src/test/ui/type-alias-enum-variants-panic.stderr [deleted file]
src/test/ui/type-alias-enum-variants-priority-2.rs [deleted file]
src/test/ui/type-alias-enum-variants-priority-2.stderr [deleted file]
src/test/ui/type-alias-enum-variants-priority-3.rs [deleted file]
src/test/ui/type-alias-enum-variants-priority-3.stderr [deleted file]
src/test/ui/type-alias-enum-variants-priority.rs [deleted file]
src/test/ui/type-alias-enum-variants-priority.stderr [deleted file]
src/test/ui/type-alias-enum-variants.rs [deleted file]
src/test/ui/type-alias-enum-variants.stderr [deleted file]
src/test/ui/type-alias-enum-variants/enum-variant-generic-args-pats-pass.rs [new file with mode: 0644]
src/test/ui/type-alias-enum-variants/enum-variant-generic-args.rs [new file with mode: 0644]
src/test/ui/type-alias-enum-variants/enum-variant-generic-args.stderr [new file with mode: 0644]
src/test/ui/type-alias-enum-variants/issue-57866.rs [new file with mode: 0644]
src/test/ui/type-alias-enum-variants/issue-58006.rs [new file with mode: 0644]
src/test/ui/type-alias-enum-variants/issue-58006.stderr [new file with mode: 0644]
src/test/ui/type-alias-enum-variants/issue-61801-path-pattern-can-infer.rs
src/test/ui/type-alias-enum-variants/type-alias-enum-variants-panic.rs [new file with mode: 0644]
src/test/ui/type-alias-enum-variants/type-alias-enum-variants-panic.stderr [new file with mode: 0644]
src/test/ui/type-alias-enum-variants/type-alias-enum-variants-pass-2.rs [new file with mode: 0644]
src/test/ui/type-alias-enum-variants/type-alias-enum-variants-pass.rs [new file with mode: 0644]
src/test/ui/type-alias-enum-variants/type-alias-enum-variants-priority-2.rs [new file with mode: 0644]
src/test/ui/type-alias-enum-variants/type-alias-enum-variants-priority-2.stderr [new file with mode: 0644]
src/test/ui/type-alias-enum-variants/type-alias-enum-variants-priority-3.rs [new file with mode: 0644]
src/test/ui/type-alias-enum-variants/type-alias-enum-variants-priority-3.stderr [new file with mode: 0644]
src/test/ui/type-alias-enum-variants/type-alias-enum-variants-priority.rs [new file with mode: 0644]
src/test/ui/type-alias-enum-variants/type-alias-enum-variants-priority.stderr [new file with mode: 0644]
src/test/ui/type-alias-enum-variants/type-alias-enum-variants.rs [new file with mode: 0644]
src/test/ui/type-alias-enum-variants/type-alias-enum-variants.stderr [new file with mode: 0644]

diff --git a/src/test/run-pass/type-alias-enum-variants-2.rs b/src/test/run-pass/type-alias-enum-variants-2.rs
deleted file mode 100644 (file)
index 0cf413b..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-#![feature(type_alias_enum_variants)]
-
-#[derive(Debug, PartialEq, Eq)]
-enum Foo {
-    Bar(i32),
-    Baz { i: i32 },
-}
-
-type FooAlias = Foo;
-type OptionAlias = Option<i32>;
-
-impl Foo {
-    fn foo() -> Self {
-        Self::Bar(3)
-    }
-}
-
-fn main() {
-    let t = FooAlias::Bar(1);
-    assert_eq!(t, Foo::Bar(1));
-    let t = FooAlias::Baz { i: 2 };
-    assert_eq!(t, Foo::Baz { i: 2 });
-    match t {
-        FooAlias::Bar(_i) => {}
-        FooAlias::Baz { i } => { assert_eq!(i, 2); }
-    }
-    assert_eq!(Foo::foo(), Foo::Bar(3));
-
-    assert_eq!(OptionAlias::Some(4), Option::Some(4));
-}
diff --git a/src/test/run-pass/type-alias-enum-variants.rs b/src/test/run-pass/type-alias-enum-variants.rs
deleted file mode 100644 (file)
index 0cf413b..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-#![feature(type_alias_enum_variants)]
-
-#[derive(Debug, PartialEq, Eq)]
-enum Foo {
-    Bar(i32),
-    Baz { i: i32 },
-}
-
-type FooAlias = Foo;
-type OptionAlias = Option<i32>;
-
-impl Foo {
-    fn foo() -> Self {
-        Self::Bar(3)
-    }
-}
-
-fn main() {
-    let t = FooAlias::Bar(1);
-    assert_eq!(t, Foo::Bar(1));
-    let t = FooAlias::Baz { i: 2 };
-    assert_eq!(t, Foo::Baz { i: 2 });
-    match t {
-        FooAlias::Bar(_i) => {}
-        FooAlias::Baz { i } => { assert_eq!(i, 2); }
-    }
-    assert_eq!(Foo::foo(), Foo::Bar(3));
-
-    assert_eq!(OptionAlias::Some(4), Option::Some(4));
-}
diff --git a/src/test/ui/enum-variant-generic-args.rs b/src/test/ui/enum-variant-generic-args.rs
deleted file mode 100644 (file)
index dd1f5f3..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-#![feature(type_alias_enum_variants)]
-
-enum Enum<T> { TSVariant(T), SVariant { v: T } }
-type Alias<T> = Enum<T>;
-type AliasFixed = Enum<()>;
-
-impl<T> Enum<T> {
-    fn ts_variant() {
-        Self::TSVariant(());
-        //~^ ERROR mismatched types [E0308]
-        Self::TSVariant::<()>(());
-        //~^ ERROR type arguments are not allowed for this type [E0109]
-        Self::<()>::TSVariant(());
-        //~^ ERROR type arguments are not allowed for this type [E0109]
-        //~^^ ERROR mismatched types [E0308]
-        Self::<()>::TSVariant::<()>(());
-        //~^ ERROR type arguments are not allowed for this type [E0109]
-        //~^^ ERROR type arguments are not allowed for this type [E0109]
-    }
-
-    fn s_variant() {
-        Self::SVariant { v: () };
-        //~^ ERROR mismatched types [E0308]
-        Self::SVariant::<()> { v: () };
-        //~^ ERROR type arguments are not allowed for this type [E0109]
-        //~^^ ERROR mismatched types [E0308]
-        Self::<()>::SVariant { v: () };
-        //~^ ERROR type arguments are not allowed for this type [E0109]
-        //~^^ ERROR mismatched types [E0308]
-        Self::<()>::SVariant::<()> { v: () };
-        //~^ ERROR type arguments are not allowed for this type [E0109]
-        //~^^ ERROR type arguments are not allowed for this type [E0109]
-        //~^^^ ERROR mismatched types [E0308]
-    }
-}
-
-fn main() {
-    // Tuple struct variant
-
-    Enum::<()>::TSVariant::<()>(());
-    //~^ ERROR type arguments are not allowed for this type [E0109]
-
-    Alias::TSVariant::<()>(());
-    //~^ ERROR type arguments are not allowed for this type [E0109]
-    Alias::<()>::TSVariant::<()>(());
-    //~^ ERROR type arguments are not allowed for this type [E0109]
-
-    AliasFixed::TSVariant::<()>(());
-    //~^ ERROR type arguments are not allowed for this type [E0109]
-    AliasFixed::<()>::TSVariant(());
-    //~^ ERROR wrong number of type arguments: expected 0, found 1 [E0107]
-    AliasFixed::<()>::TSVariant::<()>(());
-    //~^ ERROR type arguments are not allowed for this type [E0109]
-    //~^^ ERROR wrong number of type arguments: expected 0, found 1 [E0107]
-
-    // Struct variant
-
-    Enum::<()>::SVariant::<()> { v: () };
-    //~^ ERROR type arguments are not allowed for this type [E0109]
-
-    Alias::SVariant::<()> { v: () };
-    //~^ ERROR type arguments are not allowed for this type [E0109]
-    Alias::<()>::SVariant::<()> { v: () };
-    //~^ ERROR type arguments are not allowed for this type [E0109]
-
-    AliasFixed::SVariant::<()> { v: () };
-    //~^ ERROR type arguments are not allowed for this type [E0109]
-    AliasFixed::<()>::SVariant { v: () };
-    //~^ ERROR wrong number of type arguments: expected 0, found 1 [E0107]
-    AliasFixed::<()>::SVariant::<()> { v: () };
-    //~^ ERROR type arguments are not allowed for this type [E0109]
-    //~^^ ERROR wrong number of type arguments: expected 0, found 1 [E0107]
-}
diff --git a/src/test/ui/enum-variant-generic-args.stderr b/src/test/ui/enum-variant-generic-args.stderr
deleted file mode 100644 (file)
index 97b111a..0000000
+++ /dev/null
@@ -1,190 +0,0 @@
-error[E0308]: mismatched types
-  --> $DIR/enum-variant-generic-args.rs:9:25
-   |
-LL |         Self::TSVariant(());
-   |                         ^^ expected type parameter, found ()
-   |
-   = note: expected type `T`
-              found type `()`
-
-error[E0109]: type arguments are not allowed for this type
-  --> $DIR/enum-variant-generic-args.rs:11:27
-   |
-LL |         Self::TSVariant::<()>(());
-   |                           ^^ type argument not allowed
-
-error[E0109]: type arguments are not allowed for this type
-  --> $DIR/enum-variant-generic-args.rs:13:16
-   |
-LL |         Self::<()>::TSVariant(());
-   |                ^^ type argument not allowed
-
-error[E0308]: mismatched types
-  --> $DIR/enum-variant-generic-args.rs:13:31
-   |
-LL |         Self::<()>::TSVariant(());
-   |                               ^^ expected type parameter, found ()
-   |
-   = note: expected type `T`
-              found type `()`
-
-error[E0109]: type arguments are not allowed for this type
-  --> $DIR/enum-variant-generic-args.rs:16:16
-   |
-LL |         Self::<()>::TSVariant::<()>(());
-   |                ^^ type argument not allowed
-
-error[E0109]: type arguments are not allowed for this type
-  --> $DIR/enum-variant-generic-args.rs:16:33
-   |
-LL |         Self::<()>::TSVariant::<()>(());
-   |                                 ^^ type argument not allowed
-
-error[E0308]: mismatched types
-  --> $DIR/enum-variant-generic-args.rs:22:29
-   |
-LL |         Self::SVariant { v: () };
-   |                             ^^ expected type parameter, found ()
-   |
-   = note: expected type `T`
-              found type `()`
-
-error[E0109]: type arguments are not allowed for this type
-  --> $DIR/enum-variant-generic-args.rs:24:26
-   |
-LL |         Self::SVariant::<()> { v: () };
-   |                          ^^ type argument not allowed
-
-error[E0308]: mismatched types
-  --> $DIR/enum-variant-generic-args.rs:24:35
-   |
-LL |         Self::SVariant::<()> { v: () };
-   |                                   ^^ expected type parameter, found ()
-   |
-   = note: expected type `T`
-              found type `()`
-
-error[E0109]: type arguments are not allowed for this type
-  --> $DIR/enum-variant-generic-args.rs:27:16
-   |
-LL |         Self::<()>::SVariant { v: () };
-   |                ^^ type argument not allowed
-
-error[E0308]: mismatched types
-  --> $DIR/enum-variant-generic-args.rs:27:35
-   |
-LL |         Self::<()>::SVariant { v: () };
-   |                                   ^^ expected type parameter, found ()
-   |
-   = note: expected type `T`
-              found type `()`
-
-error[E0109]: type arguments are not allowed for this type
-  --> $DIR/enum-variant-generic-args.rs:30:16
-   |
-LL |         Self::<()>::SVariant::<()> { v: () };
-   |                ^^ type argument not allowed
-
-error[E0109]: type arguments are not allowed for this type
-  --> $DIR/enum-variant-generic-args.rs:30:32
-   |
-LL |         Self::<()>::SVariant::<()> { v: () };
-   |                                ^^ type argument not allowed
-
-error[E0308]: mismatched types
-  --> $DIR/enum-variant-generic-args.rs:30:41
-   |
-LL |         Self::<()>::SVariant::<()> { v: () };
-   |                                         ^^ expected type parameter, found ()
-   |
-   = note: expected type `T`
-              found type `()`
-
-error[E0109]: type arguments are not allowed for this type
-  --> $DIR/enum-variant-generic-args.rs:40:29
-   |
-LL |     Enum::<()>::TSVariant::<()>(());
-   |                             ^^ type argument not allowed
-
-error[E0109]: type arguments are not allowed for this type
-  --> $DIR/enum-variant-generic-args.rs:43:24
-   |
-LL |     Alias::TSVariant::<()>(());
-   |                        ^^ type argument not allowed
-
-error[E0109]: type arguments are not allowed for this type
-  --> $DIR/enum-variant-generic-args.rs:45:30
-   |
-LL |     Alias::<()>::TSVariant::<()>(());
-   |                              ^^ type argument not allowed
-
-error[E0109]: type arguments are not allowed for this type
-  --> $DIR/enum-variant-generic-args.rs:48:29
-   |
-LL |     AliasFixed::TSVariant::<()>(());
-   |                             ^^ type argument not allowed
-
-error[E0107]: wrong number of type arguments: expected 0, found 1
-  --> $DIR/enum-variant-generic-args.rs:50:18
-   |
-LL |     AliasFixed::<()>::TSVariant(());
-   |                  ^^ unexpected type argument
-
-error[E0107]: wrong number of type arguments: expected 0, found 1
-  --> $DIR/enum-variant-generic-args.rs:52:18
-   |
-LL |     AliasFixed::<()>::TSVariant::<()>(());
-   |                  ^^ unexpected type argument
-
-error[E0109]: type arguments are not allowed for this type
-  --> $DIR/enum-variant-generic-args.rs:52:35
-   |
-LL |     AliasFixed::<()>::TSVariant::<()>(());
-   |                                   ^^ type argument not allowed
-
-error[E0109]: type arguments are not allowed for this type
-  --> $DIR/enum-variant-generic-args.rs:58:28
-   |
-LL |     Enum::<()>::SVariant::<()> { v: () };
-   |                            ^^ type argument not allowed
-
-error[E0109]: type arguments are not allowed for this type
-  --> $DIR/enum-variant-generic-args.rs:61:23
-   |
-LL |     Alias::SVariant::<()> { v: () };
-   |                       ^^ type argument not allowed
-
-error[E0109]: type arguments are not allowed for this type
-  --> $DIR/enum-variant-generic-args.rs:63:29
-   |
-LL |     Alias::<()>::SVariant::<()> { v: () };
-   |                             ^^ type argument not allowed
-
-error[E0109]: type arguments are not allowed for this type
-  --> $DIR/enum-variant-generic-args.rs:66:28
-   |
-LL |     AliasFixed::SVariant::<()> { v: () };
-   |                            ^^ type argument not allowed
-
-error[E0107]: wrong number of type arguments: expected 0, found 1
-  --> $DIR/enum-variant-generic-args.rs:68:18
-   |
-LL |     AliasFixed::<()>::SVariant { v: () };
-   |                  ^^ unexpected type argument
-
-error[E0107]: wrong number of type arguments: expected 0, found 1
-  --> $DIR/enum-variant-generic-args.rs:70:18
-   |
-LL |     AliasFixed::<()>::SVariant::<()> { v: () };
-   |                  ^^ unexpected type argument
-
-error[E0109]: type arguments are not allowed for this type
-  --> $DIR/enum-variant-generic-args.rs:70:34
-   |
-LL |     AliasFixed::<()>::SVariant::<()> { v: () };
-   |                                  ^^ type argument not allowed
-
-error: aborting due to 28 previous errors
-
-Some errors have detailed explanations: E0107, E0109, E0308.
-For more information about an error, try `rustc --explain E0107`.
diff --git a/src/test/ui/issues/issue-57866.rs b/src/test/ui/issues/issue-57866.rs
deleted file mode 100644 (file)
index 77c50e5..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-// compile-pass
-
-#![feature(type_alias_enum_variants)]
-
-enum Outer<T> {
-    A(T)
-}
-
-enum Inner {
-    A(i32)
-}
-
-type OuterAlias = Outer<Inner>;
-
-fn ice(x: OuterAlias) {
-    // Fine
-    match x {
-        OuterAlias::A(Inner::A(_)) => (),
-    }
-    // Not fine
-    match x {
-        OuterAlias::A(Inner::A(y)) => (),
-    }
-}
-
-fn main() {}
diff --git a/src/test/ui/issues/issue-58006.rs b/src/test/ui/issues/issue-58006.rs
deleted file mode 100644 (file)
index 1fb5fef..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-#![feature(type_alias_enum_variants)]
-pub enum Enum {
-    A(usize),
-}
-
-impl Enum {
-    fn foo(&self) -> () {
-        match self {
-            Self::A => (),
-            //~^ ERROR expected unit struct/variant or constant, found tuple variant
-        }
-    }
-}
-
-fn main() {}
diff --git a/src/test/ui/issues/issue-58006.stderr b/src/test/ui/issues/issue-58006.stderr
deleted file mode 100644 (file)
index c34e133..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error[E0533]: expected unit struct/variant or constant, found tuple variant `<Self>::A`
-  --> $DIR/issue-58006.rs:9:13
-   |
-LL |             Self::A => (),
-   |             ^^^^^^^
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/pattern/enum-variant-generic-args.rs b/src/test/ui/pattern/enum-variant-generic-args.rs
deleted file mode 100644 (file)
index 8559953..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-// run-pass
-
-#![feature(type_alias_enum_variants)]
-
-#![allow(irrefutable_let_patterns)]
-
-#[allow(dead_code)]
-enum Enum<T> { TSVariant(T), SVariant { v: T } }
-type Alias<T> = Enum<T>;
-type AliasFixed = Enum<()>;
-
-macro_rules! is_variant {
-    (TSVariant, $expr:expr) => (is_variant!(@check TSVariant, (_), $expr));
-    (SVariant, $expr:expr) => (is_variant!(@check SVariant, { v: _ }, $expr));
-    (@check $variant:ident, $matcher:tt, $expr:expr) => (
-        assert!(if let Enum::$variant::<()> $matcher = $expr { true } else { false },
-                "expr does not have correct type");
-    );
-}
-
-fn main() {
-    // Tuple struct variant
-
-    is_variant!(TSVariant, Enum::TSVariant(()));
-    is_variant!(TSVariant, Enum::TSVariant::<()>(()));
-    is_variant!(TSVariant, Enum::<()>::TSVariant(()));
-
-    is_variant!(TSVariant, Alias::TSVariant(()));
-    is_variant!(TSVariant, Alias::<()>::TSVariant(()));
-
-    is_variant!(TSVariant, AliasFixed::TSVariant(()));
-
-    // Struct variant
-
-    is_variant!(SVariant, Enum::SVariant { v: () });
-    is_variant!(SVariant, Enum::SVariant::<()> { v: () });
-    is_variant!(SVariant, Enum::<()>::SVariant { v: () });
-
-    is_variant!(SVariant, Alias::SVariant { v: () });
-    is_variant!(SVariant, Alias::<()>::SVariant { v: () });
-
-    is_variant!(SVariant, AliasFixed::SVariant { v: () });
-}
diff --git a/src/test/ui/type-alias-enum-variants-panic.rs b/src/test/ui/type-alias-enum-variants-panic.rs
deleted file mode 100644 (file)
index f97592f..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-// ignore-tidy-linelength
-
-#![feature(type_alias_enum_variants)]
-
-#![allow(unreachable_code)]
-
-enum Enum { Variant {} }
-type Alias = Enum;
-
-fn main() {
-    Alias::Variant;
-    //~^ ERROR expected unit struct/variant or constant, found struct variant `<Alias>::Variant` [E0533]
-    let Alias::Variant = panic!();
-    //~^ ERROR expected unit struct/variant or constant, found struct variant `<Alias>::Variant` [E0533]
-    let Alias::Variant(..) = panic!();
-    //~^ ERROR expected tuple struct/variant, found struct variant `<Alias>::Variant` [E0164]
-}
diff --git a/src/test/ui/type-alias-enum-variants-panic.stderr b/src/test/ui/type-alias-enum-variants-panic.stderr
deleted file mode 100644 (file)
index 24cf85f..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-error[E0533]: expected unit struct/variant or constant, found struct variant `<Alias>::Variant`
-  --> $DIR/type-alias-enum-variants-panic.rs:11:5
-   |
-LL |     Alias::Variant;
-   |     ^^^^^^^^^^^^^^
-
-error[E0533]: expected unit struct/variant or constant, found struct variant `<Alias>::Variant`
-  --> $DIR/type-alias-enum-variants-panic.rs:13:9
-   |
-LL |     let Alias::Variant = panic!();
-   |         ^^^^^^^^^^^^^^
-
-error[E0164]: expected tuple struct/variant, found struct variant `<Alias>::Variant`
-  --> $DIR/type-alias-enum-variants-panic.rs:15:9
-   |
-LL |     let Alias::Variant(..) = panic!();
-   |         ^^^^^^^^^^^^^^^^^^ not a tuple variant or struct
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0164`.
diff --git a/src/test/ui/type-alias-enum-variants-priority-2.rs b/src/test/ui/type-alias-enum-variants-priority-2.rs
deleted file mode 100644 (file)
index 295f8ac..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-#![feature(type_alias_enum_variants)]
-
-enum E {
-    V(u8)
-}
-
-impl E {
-    fn V() {}
-}
-
-fn main() {
-    <E>::V(); //~ ERROR this function takes 1 parameter but 0 parameters were supplied
-}
diff --git a/src/test/ui/type-alias-enum-variants-priority-2.stderr b/src/test/ui/type-alias-enum-variants-priority-2.stderr
deleted file mode 100644 (file)
index 10a4b44..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0061]: this function takes 1 parameter but 0 parameters were supplied
-  --> $DIR/type-alias-enum-variants-priority-2.rs:12:5
-   |
-LL |     V(u8)
-   |     ----- defined here
-...
-LL |     <E>::V();
-   |     ^^^^^^^^ expected 1 parameter
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0061`.
diff --git a/src/test/ui/type-alias-enum-variants-priority-3.rs b/src/test/ui/type-alias-enum-variants-priority-3.rs
deleted file mode 100644 (file)
index 33f9655..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-#![feature(type_alias_enum_variants)]
-
-enum E {
-    V
-}
-
-fn check() -> <E>::V {}
-//~^ ERROR expected type, found variant `V`
-
-fn main() {}
diff --git a/src/test/ui/type-alias-enum-variants-priority-3.stderr b/src/test/ui/type-alias-enum-variants-priority-3.stderr
deleted file mode 100644 (file)
index b345154..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-error: expected type, found variant `V`
-  --> $DIR/type-alias-enum-variants-priority-3.rs:7:15
-   |
-LL | fn check() -> <E>::V {}
-   |               ^^^^^^
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/type-alias-enum-variants-priority.rs b/src/test/ui/type-alias-enum-variants-priority.rs
deleted file mode 100644 (file)
index 82cd21b..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-#![feature(type_alias_enum_variants)]
-
-enum E {
-    V
-}
-
-trait Tr {
-    type V;
-    fn f() -> Self::V;
-}
-
-impl Tr for E {
-    type V = u8;
-    fn f() -> Self::V { 0 }
-    //~^ ERROR ambiguous associated item
-    //~| WARN this was previously accepted
-}
-
-fn main() {}
diff --git a/src/test/ui/type-alias-enum-variants-priority.stderr b/src/test/ui/type-alias-enum-variants-priority.stderr
deleted file mode 100644 (file)
index b827180..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-error: ambiguous associated item
-  --> $DIR/type-alias-enum-variants-priority.rs:14:15
-   |
-LL |     fn f() -> Self::V { 0 }
-   |               ^^^^^^^ help: use fully-qualified syntax: `<E as Trait>::V`
-   |
-   = note: #[deny(ambiguous_associated_items)] on by default
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #57644 <https://github.com/rust-lang/rust/issues/57644>
-note: `V` could refer to variant defined here
-  --> $DIR/type-alias-enum-variants-priority.rs:4:5
-   |
-LL |     V
-   |     ^
-note: `V` could also refer to associated type defined here
-  --> $DIR/type-alias-enum-variants-priority.rs:8:5
-   |
-LL |     type V;
-   |     ^^^^^^^
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/type-alias-enum-variants.rs b/src/test/ui/type-alias-enum-variants.rs
deleted file mode 100644 (file)
index c5974e5..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-#![feature(type_alias_enum_variants)]
-
-type Alias<T> = Option<T>;
-
-fn main() {
-    let _ = Option::<u8>::None; // OK
-    let _ = Option::None::<u8>; // OK (Lint in future!)
-    let _ = Alias::<u8>::None; // OK
-    let _ = Alias::None::<u8>; // Error
-    //~^ type arguments are not allowed for this type
-}
diff --git a/src/test/ui/type-alias-enum-variants.stderr b/src/test/ui/type-alias-enum-variants.stderr
deleted file mode 100644 (file)
index 55f250f..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-error[E0109]: type arguments are not allowed for this type
-  --> $DIR/type-alias-enum-variants.rs:9:27
-   |
-LL |     let _ = Alias::None::<u8>; // Error
-   |                           ^^ type argument not allowed
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0109`.
diff --git a/src/test/ui/type-alias-enum-variants/enum-variant-generic-args-pats-pass.rs b/src/test/ui/type-alias-enum-variants/enum-variant-generic-args-pats-pass.rs
new file mode 100644 (file)
index 0000000..faef1fa
--- /dev/null
@@ -0,0 +1,41 @@
+// run-pass
+
+#![allow(irrefutable_let_patterns)]
+
+#[allow(dead_code)]
+enum Enum<T> { TSVariant(T), SVariant { v: T } }
+type Alias<T> = Enum<T>;
+type AliasFixed = Enum<()>;
+
+macro_rules! is_variant {
+    (TSVariant, $expr:expr) => (is_variant!(@check TSVariant, (_), $expr));
+    (SVariant, $expr:expr) => (is_variant!(@check SVariant, { v: _ }, $expr));
+    (@check $variant:ident, $matcher:tt, $expr:expr) => (
+        assert!(if let Enum::$variant::<()> $matcher = $expr { true } else { false },
+                "expr does not have correct type");
+    );
+}
+
+fn main() {
+    // Tuple struct variant
+
+    is_variant!(TSVariant, Enum::TSVariant(()));
+    is_variant!(TSVariant, Enum::TSVariant::<()>(()));
+    is_variant!(TSVariant, Enum::<()>::TSVariant(()));
+
+    is_variant!(TSVariant, Alias::TSVariant(()));
+    is_variant!(TSVariant, Alias::<()>::TSVariant(()));
+
+    is_variant!(TSVariant, AliasFixed::TSVariant(()));
+
+    // Struct variant
+
+    is_variant!(SVariant, Enum::SVariant { v: () });
+    is_variant!(SVariant, Enum::SVariant::<()> { v: () });
+    is_variant!(SVariant, Enum::<()>::SVariant { v: () });
+
+    is_variant!(SVariant, Alias::SVariant { v: () });
+    is_variant!(SVariant, Alias::<()>::SVariant { v: () });
+
+    is_variant!(SVariant, AliasFixed::SVariant { v: () });
+}
diff --git a/src/test/ui/type-alias-enum-variants/enum-variant-generic-args.rs b/src/test/ui/type-alias-enum-variants/enum-variant-generic-args.rs
new file mode 100644 (file)
index 0000000..c22a9c4
--- /dev/null
@@ -0,0 +1,71 @@
+enum Enum<T> { TSVariant(T), SVariant { v: T } }
+type Alias<T> = Enum<T>;
+type AliasFixed = Enum<()>;
+
+impl<T> Enum<T> {
+    fn ts_variant() {
+        Self::TSVariant(());
+        //~^ ERROR mismatched types [E0308]
+        Self::TSVariant::<()>(());
+        //~^ ERROR type arguments are not allowed for this type [E0109]
+        Self::<()>::TSVariant(());
+        //~^ ERROR type arguments are not allowed for this type [E0109]
+        //~^^ ERROR mismatched types [E0308]
+        Self::<()>::TSVariant::<()>(());
+        //~^ ERROR type arguments are not allowed for this type [E0109]
+        //~^^ ERROR type arguments are not allowed for this type [E0109]
+    }
+
+    fn s_variant() {
+        Self::SVariant { v: () };
+        //~^ ERROR mismatched types [E0308]
+        Self::SVariant::<()> { v: () };
+        //~^ ERROR type arguments are not allowed for this type [E0109]
+        //~^^ ERROR mismatched types [E0308]
+        Self::<()>::SVariant { v: () };
+        //~^ ERROR type arguments are not allowed for this type [E0109]
+        //~^^ ERROR mismatched types [E0308]
+        Self::<()>::SVariant::<()> { v: () };
+        //~^ ERROR type arguments are not allowed for this type [E0109]
+        //~^^ ERROR type arguments are not allowed for this type [E0109]
+        //~^^^ ERROR mismatched types [E0308]
+    }
+}
+
+fn main() {
+    // Tuple struct variant
+
+    Enum::<()>::TSVariant::<()>(());
+    //~^ ERROR type arguments are not allowed for this type [E0109]
+
+    Alias::TSVariant::<()>(());
+    //~^ ERROR type arguments are not allowed for this type [E0109]
+    Alias::<()>::TSVariant::<()>(());
+    //~^ ERROR type arguments are not allowed for this type [E0109]
+
+    AliasFixed::TSVariant::<()>(());
+    //~^ ERROR type arguments are not allowed for this type [E0109]
+    AliasFixed::<()>::TSVariant(());
+    //~^ ERROR wrong number of type arguments: expected 0, found 1 [E0107]
+    AliasFixed::<()>::TSVariant::<()>(());
+    //~^ ERROR type arguments are not allowed for this type [E0109]
+    //~^^ ERROR wrong number of type arguments: expected 0, found 1 [E0107]
+
+    // Struct variant
+
+    Enum::<()>::SVariant::<()> { v: () };
+    //~^ ERROR type arguments are not allowed for this type [E0109]
+
+    Alias::SVariant::<()> { v: () };
+    //~^ ERROR type arguments are not allowed for this type [E0109]
+    Alias::<()>::SVariant::<()> { v: () };
+    //~^ ERROR type arguments are not allowed for this type [E0109]
+
+    AliasFixed::SVariant::<()> { v: () };
+    //~^ ERROR type arguments are not allowed for this type [E0109]
+    AliasFixed::<()>::SVariant { v: () };
+    //~^ ERROR wrong number of type arguments: expected 0, found 1 [E0107]
+    AliasFixed::<()>::SVariant::<()> { v: () };
+    //~^ ERROR type arguments are not allowed for this type [E0109]
+    //~^^ ERROR wrong number of type arguments: expected 0, found 1 [E0107]
+}
diff --git a/src/test/ui/type-alias-enum-variants/enum-variant-generic-args.stderr b/src/test/ui/type-alias-enum-variants/enum-variant-generic-args.stderr
new file mode 100644 (file)
index 0000000..d3a2e86
--- /dev/null
@@ -0,0 +1,190 @@
+error[E0308]: mismatched types
+  --> $DIR/enum-variant-generic-args.rs:7:25
+   |
+LL |         Self::TSVariant(());
+   |                         ^^ expected type parameter, found ()
+   |
+   = note: expected type `T`
+              found type `()`
+
+error[E0109]: type arguments are not allowed for this type
+  --> $DIR/enum-variant-generic-args.rs:9:27
+   |
+LL |         Self::TSVariant::<()>(());
+   |                           ^^ type argument not allowed
+
+error[E0109]: type arguments are not allowed for this type
+  --> $DIR/enum-variant-generic-args.rs:11:16
+   |
+LL |         Self::<()>::TSVariant(());
+   |                ^^ type argument not allowed
+
+error[E0308]: mismatched types
+  --> $DIR/enum-variant-generic-args.rs:11:31
+   |
+LL |         Self::<()>::TSVariant(());
+   |                               ^^ expected type parameter, found ()
+   |
+   = note: expected type `T`
+              found type `()`
+
+error[E0109]: type arguments are not allowed for this type
+  --> $DIR/enum-variant-generic-args.rs:14:16
+   |
+LL |         Self::<()>::TSVariant::<()>(());
+   |                ^^ type argument not allowed
+
+error[E0109]: type arguments are not allowed for this type
+  --> $DIR/enum-variant-generic-args.rs:14:33
+   |
+LL |         Self::<()>::TSVariant::<()>(());
+   |                                 ^^ type argument not allowed
+
+error[E0308]: mismatched types
+  --> $DIR/enum-variant-generic-args.rs:20:29
+   |
+LL |         Self::SVariant { v: () };
+   |                             ^^ expected type parameter, found ()
+   |
+   = note: expected type `T`
+              found type `()`
+
+error[E0109]: type arguments are not allowed for this type
+  --> $DIR/enum-variant-generic-args.rs:22:26
+   |
+LL |         Self::SVariant::<()> { v: () };
+   |                          ^^ type argument not allowed
+
+error[E0308]: mismatched types
+  --> $DIR/enum-variant-generic-args.rs:22:35
+   |
+LL |         Self::SVariant::<()> { v: () };
+   |                                   ^^ expected type parameter, found ()
+   |
+   = note: expected type `T`
+              found type `()`
+
+error[E0109]: type arguments are not allowed for this type
+  --> $DIR/enum-variant-generic-args.rs:25:16
+   |
+LL |         Self::<()>::SVariant { v: () };
+   |                ^^ type argument not allowed
+
+error[E0308]: mismatched types
+  --> $DIR/enum-variant-generic-args.rs:25:35
+   |
+LL |         Self::<()>::SVariant { v: () };
+   |                                   ^^ expected type parameter, found ()
+   |
+   = note: expected type `T`
+              found type `()`
+
+error[E0109]: type arguments are not allowed for this type
+  --> $DIR/enum-variant-generic-args.rs:28:16
+   |
+LL |         Self::<()>::SVariant::<()> { v: () };
+   |                ^^ type argument not allowed
+
+error[E0109]: type arguments are not allowed for this type
+  --> $DIR/enum-variant-generic-args.rs:28:32
+   |
+LL |         Self::<()>::SVariant::<()> { v: () };
+   |                                ^^ type argument not allowed
+
+error[E0308]: mismatched types
+  --> $DIR/enum-variant-generic-args.rs:28:41
+   |
+LL |         Self::<()>::SVariant::<()> { v: () };
+   |                                         ^^ expected type parameter, found ()
+   |
+   = note: expected type `T`
+              found type `()`
+
+error[E0109]: type arguments are not allowed for this type
+  --> $DIR/enum-variant-generic-args.rs:38:29
+   |
+LL |     Enum::<()>::TSVariant::<()>(());
+   |                             ^^ type argument not allowed
+
+error[E0109]: type arguments are not allowed for this type
+  --> $DIR/enum-variant-generic-args.rs:41:24
+   |
+LL |     Alias::TSVariant::<()>(());
+   |                        ^^ type argument not allowed
+
+error[E0109]: type arguments are not allowed for this type
+  --> $DIR/enum-variant-generic-args.rs:43:30
+   |
+LL |     Alias::<()>::TSVariant::<()>(());
+   |                              ^^ type argument not allowed
+
+error[E0109]: type arguments are not allowed for this type
+  --> $DIR/enum-variant-generic-args.rs:46:29
+   |
+LL |     AliasFixed::TSVariant::<()>(());
+   |                             ^^ type argument not allowed
+
+error[E0107]: wrong number of type arguments: expected 0, found 1
+  --> $DIR/enum-variant-generic-args.rs:48:18
+   |
+LL |     AliasFixed::<()>::TSVariant(());
+   |                  ^^ unexpected type argument
+
+error[E0107]: wrong number of type arguments: expected 0, found 1
+  --> $DIR/enum-variant-generic-args.rs:50:18
+   |
+LL |     AliasFixed::<()>::TSVariant::<()>(());
+   |                  ^^ unexpected type argument
+
+error[E0109]: type arguments are not allowed for this type
+  --> $DIR/enum-variant-generic-args.rs:50:35
+   |
+LL |     AliasFixed::<()>::TSVariant::<()>(());
+   |                                   ^^ type argument not allowed
+
+error[E0109]: type arguments are not allowed for this type
+  --> $DIR/enum-variant-generic-args.rs:56:28
+   |
+LL |     Enum::<()>::SVariant::<()> { v: () };
+   |                            ^^ type argument not allowed
+
+error[E0109]: type arguments are not allowed for this type
+  --> $DIR/enum-variant-generic-args.rs:59:23
+   |
+LL |     Alias::SVariant::<()> { v: () };
+   |                       ^^ type argument not allowed
+
+error[E0109]: type arguments are not allowed for this type
+  --> $DIR/enum-variant-generic-args.rs:61:29
+   |
+LL |     Alias::<()>::SVariant::<()> { v: () };
+   |                             ^^ type argument not allowed
+
+error[E0109]: type arguments are not allowed for this type
+  --> $DIR/enum-variant-generic-args.rs:64:28
+   |
+LL |     AliasFixed::SVariant::<()> { v: () };
+   |                            ^^ type argument not allowed
+
+error[E0107]: wrong number of type arguments: expected 0, found 1
+  --> $DIR/enum-variant-generic-args.rs:66:18
+   |
+LL |     AliasFixed::<()>::SVariant { v: () };
+   |                  ^^ unexpected type argument
+
+error[E0107]: wrong number of type arguments: expected 0, found 1
+  --> $DIR/enum-variant-generic-args.rs:68:18
+   |
+LL |     AliasFixed::<()>::SVariant::<()> { v: () };
+   |                  ^^ unexpected type argument
+
+error[E0109]: type arguments are not allowed for this type
+  --> $DIR/enum-variant-generic-args.rs:68:34
+   |
+LL |     AliasFixed::<()>::SVariant::<()> { v: () };
+   |                                  ^^ type argument not allowed
+
+error: aborting due to 28 previous errors
+
+Some errors have detailed explanations: E0107, E0109, E0308.
+For more information about an error, try `rustc --explain E0107`.
diff --git a/src/test/ui/type-alias-enum-variants/issue-57866.rs b/src/test/ui/type-alias-enum-variants/issue-57866.rs
new file mode 100644 (file)
index 0000000..fa351ed
--- /dev/null
@@ -0,0 +1,24 @@
+// compile-pass
+
+enum Outer<T> {
+    A(T)
+}
+
+enum Inner {
+    A(i32)
+}
+
+type OuterAlias = Outer<Inner>;
+
+fn ice(x: OuterAlias) {
+    // Fine
+    match x {
+        OuterAlias::A(Inner::A(_)) => (),
+    }
+    // Not fine
+    match x {
+        OuterAlias::A(Inner::A(y)) => (),
+    }
+}
+
+fn main() {}
diff --git a/src/test/ui/type-alias-enum-variants/issue-58006.rs b/src/test/ui/type-alias-enum-variants/issue-58006.rs
new file mode 100644 (file)
index 0000000..c1e56fc
--- /dev/null
@@ -0,0 +1,14 @@
+pub enum Enum {
+    A(usize),
+}
+
+impl Enum {
+    fn foo(&self) -> () {
+        match self {
+            Self::A => (),
+            //~^ ERROR expected unit struct/variant or constant, found tuple variant
+        }
+    }
+}
+
+fn main() {}
diff --git a/src/test/ui/type-alias-enum-variants/issue-58006.stderr b/src/test/ui/type-alias-enum-variants/issue-58006.stderr
new file mode 100644 (file)
index 0000000..dc60695
--- /dev/null
@@ -0,0 +1,8 @@
+error[E0533]: expected unit struct/variant or constant, found tuple variant `<Self>::A`
+  --> $DIR/issue-58006.rs:8:13
+   |
+LL |             Self::A => (),
+   |             ^^^^^^^
+
+error: aborting due to previous error
+
index 21be61acb0c61cbbea3f4965fda79dc08793c561..dfc618b164902c35befd4c646cf1a75788231add 100644 (file)
@@ -3,8 +3,6 @@
 
 // compile-pass
 
-#![feature(type_alias_enum_variants)]
-
 enum Opt<T> {
     N,
     S(T),
diff --git a/src/test/ui/type-alias-enum-variants/type-alias-enum-variants-panic.rs b/src/test/ui/type-alias-enum-variants/type-alias-enum-variants-panic.rs
new file mode 100644 (file)
index 0000000..c75fe6a
--- /dev/null
@@ -0,0 +1,15 @@
+// ignore-tidy-linelength
+
+#![allow(unreachable_code)]
+
+enum Enum { Variant {} }
+type Alias = Enum;
+
+fn main() {
+    Alias::Variant;
+    //~^ ERROR expected unit struct/variant or constant, found struct variant `<Alias>::Variant` [E0533]
+    let Alias::Variant = panic!();
+    //~^ ERROR expected unit struct/variant or constant, found struct variant `<Alias>::Variant` [E0533]
+    let Alias::Variant(..) = panic!();
+    //~^ ERROR expected tuple struct/variant, found struct variant `<Alias>::Variant` [E0164]
+}
diff --git a/src/test/ui/type-alias-enum-variants/type-alias-enum-variants-panic.stderr b/src/test/ui/type-alias-enum-variants/type-alias-enum-variants-panic.stderr
new file mode 100644 (file)
index 0000000..7a17596
--- /dev/null
@@ -0,0 +1,21 @@
+error[E0533]: expected unit struct/variant or constant, found struct variant `<Alias>::Variant`
+  --> $DIR/type-alias-enum-variants-panic.rs:9:5
+   |
+LL |     Alias::Variant;
+   |     ^^^^^^^^^^^^^^
+
+error[E0533]: expected unit struct/variant or constant, found struct variant `<Alias>::Variant`
+  --> $DIR/type-alias-enum-variants-panic.rs:11:9
+   |
+LL |     let Alias::Variant = panic!();
+   |         ^^^^^^^^^^^^^^
+
+error[E0164]: expected tuple struct/variant, found struct variant `<Alias>::Variant`
+  --> $DIR/type-alias-enum-variants-panic.rs:13:9
+   |
+LL |     let Alias::Variant(..) = panic!();
+   |         ^^^^^^^^^^^^^^^^^^ not a tuple variant or struct
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0164`.
diff --git a/src/test/ui/type-alias-enum-variants/type-alias-enum-variants-pass-2.rs b/src/test/ui/type-alias-enum-variants/type-alias-enum-variants-pass-2.rs
new file mode 100644 (file)
index 0000000..00b787b
--- /dev/null
@@ -0,0 +1,30 @@
+// run-pass
+
+#[derive(Debug, PartialEq, Eq)]
+enum Foo {
+    Bar(i32),
+    Baz { i: i32 },
+}
+
+type FooAlias = Foo;
+type OptionAlias = Option<i32>;
+
+impl Foo {
+    fn foo() -> Self {
+        Self::Bar(3)
+    }
+}
+
+fn main() {
+    let t = FooAlias::Bar(1);
+    assert_eq!(t, Foo::Bar(1));
+    let t = FooAlias::Baz { i: 2 };
+    assert_eq!(t, Foo::Baz { i: 2 });
+    match t {
+        FooAlias::Bar(_i) => {}
+        FooAlias::Baz { i } => { assert_eq!(i, 2); }
+    }
+    assert_eq!(Foo::foo(), Foo::Bar(3));
+
+    assert_eq!(OptionAlias::Some(4), Option::Some(4));
+}
diff --git a/src/test/ui/type-alias-enum-variants/type-alias-enum-variants-pass.rs b/src/test/ui/type-alias-enum-variants/type-alias-enum-variants-pass.rs
new file mode 100644 (file)
index 0000000..00b787b
--- /dev/null
@@ -0,0 +1,30 @@
+// run-pass
+
+#[derive(Debug, PartialEq, Eq)]
+enum Foo {
+    Bar(i32),
+    Baz { i: i32 },
+}
+
+type FooAlias = Foo;
+type OptionAlias = Option<i32>;
+
+impl Foo {
+    fn foo() -> Self {
+        Self::Bar(3)
+    }
+}
+
+fn main() {
+    let t = FooAlias::Bar(1);
+    assert_eq!(t, Foo::Bar(1));
+    let t = FooAlias::Baz { i: 2 };
+    assert_eq!(t, Foo::Baz { i: 2 });
+    match t {
+        FooAlias::Bar(_i) => {}
+        FooAlias::Baz { i } => { assert_eq!(i, 2); }
+    }
+    assert_eq!(Foo::foo(), Foo::Bar(3));
+
+    assert_eq!(OptionAlias::Some(4), Option::Some(4));
+}
diff --git a/src/test/ui/type-alias-enum-variants/type-alias-enum-variants-priority-2.rs b/src/test/ui/type-alias-enum-variants/type-alias-enum-variants-priority-2.rs
new file mode 100644 (file)
index 0000000..e7719dc
--- /dev/null
@@ -0,0 +1,11 @@
+enum E {
+    V(u8)
+}
+
+impl E {
+    fn V() {}
+}
+
+fn main() {
+    <E>::V(); //~ ERROR this function takes 1 parameter but 0 parameters were supplied
+}
diff --git a/src/test/ui/type-alias-enum-variants/type-alias-enum-variants-priority-2.stderr b/src/test/ui/type-alias-enum-variants/type-alias-enum-variants-priority-2.stderr
new file mode 100644 (file)
index 0000000..a6300a3
--- /dev/null
@@ -0,0 +1,12 @@
+error[E0061]: this function takes 1 parameter but 0 parameters were supplied
+  --> $DIR/type-alias-enum-variants-priority-2.rs:10:5
+   |
+LL |     V(u8)
+   |     ----- defined here
+...
+LL |     <E>::V();
+   |     ^^^^^^^^ expected 1 parameter
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0061`.
diff --git a/src/test/ui/type-alias-enum-variants/type-alias-enum-variants-priority-3.rs b/src/test/ui/type-alias-enum-variants/type-alias-enum-variants-priority-3.rs
new file mode 100644 (file)
index 0000000..ff0bfee
--- /dev/null
@@ -0,0 +1,8 @@
+enum E {
+    V
+}
+
+fn check() -> <E>::V {}
+//~^ ERROR expected type, found variant `V`
+
+fn main() {}
diff --git a/src/test/ui/type-alias-enum-variants/type-alias-enum-variants-priority-3.stderr b/src/test/ui/type-alias-enum-variants/type-alias-enum-variants-priority-3.stderr
new file mode 100644 (file)
index 0000000..f179fd8
--- /dev/null
@@ -0,0 +1,8 @@
+error: expected type, found variant `V`
+  --> $DIR/type-alias-enum-variants-priority-3.rs:5:15
+   |
+LL | fn check() -> <E>::V {}
+   |               ^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/type-alias-enum-variants/type-alias-enum-variants-priority.rs b/src/test/ui/type-alias-enum-variants/type-alias-enum-variants-priority.rs
new file mode 100644 (file)
index 0000000..229046c
--- /dev/null
@@ -0,0 +1,17 @@
+enum E {
+    V
+}
+
+trait Tr {
+    type V;
+    fn f() -> Self::V;
+}
+
+impl Tr for E {
+    type V = u8;
+    fn f() -> Self::V { 0 }
+    //~^ ERROR ambiguous associated item
+    //~| WARN this was previously accepted
+}
+
+fn main() {}
diff --git a/src/test/ui/type-alias-enum-variants/type-alias-enum-variants-priority.stderr b/src/test/ui/type-alias-enum-variants/type-alias-enum-variants-priority.stderr
new file mode 100644 (file)
index 0000000..df75cbc
--- /dev/null
@@ -0,0 +1,22 @@
+error: ambiguous associated item
+  --> $DIR/type-alias-enum-variants-priority.rs:12:15
+   |
+LL |     fn f() -> Self::V { 0 }
+   |               ^^^^^^^ help: use fully-qualified syntax: `<E as Trait>::V`
+   |
+   = note: #[deny(ambiguous_associated_items)] on by default
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+   = note: for more information, see issue #57644 <https://github.com/rust-lang/rust/issues/57644>
+note: `V` could refer to variant defined here
+  --> $DIR/type-alias-enum-variants-priority.rs:2:5
+   |
+LL |     V
+   |     ^
+note: `V` could also refer to associated type defined here
+  --> $DIR/type-alias-enum-variants-priority.rs:6:5
+   |
+LL |     type V;
+   |     ^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/type-alias-enum-variants/type-alias-enum-variants.rs b/src/test/ui/type-alias-enum-variants/type-alias-enum-variants.rs
new file mode 100644 (file)
index 0000000..8fe9695
--- /dev/null
@@ -0,0 +1,9 @@
+type Alias<T> = Option<T>;
+
+fn main() {
+    let _ = Option::<u8>::None; // OK
+    let _ = Option::None::<u8>; // OK (Lint in future!)
+    let _ = Alias::<u8>::None; // OK
+    let _ = Alias::None::<u8>; // Error
+    //~^ type arguments are not allowed for this type
+}
diff --git a/src/test/ui/type-alias-enum-variants/type-alias-enum-variants.stderr b/src/test/ui/type-alias-enum-variants/type-alias-enum-variants.stderr
new file mode 100644 (file)
index 0000000..0a03166
--- /dev/null
@@ -0,0 +1,9 @@
+error[E0109]: type arguments are not allowed for this type
+  --> $DIR/type-alias-enum-variants.rs:7:27
+   |
+LL |     let _ = Alias::None::<u8>; // Error
+   |                           ^^ type argument not allowed
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0109`.