diff --git a/tests/ui/README.md b/tests/ui/README.md index b7496a39bcca..7900af9d8c9b 100644 --- a/tests/ui/README.md +++ b/tests/ui/README.md @@ -1125,12 +1125,6 @@ A large category about function and type public/private visibility, and its impa **FIXME**: merge with `tests/ui/privacy/`. -## `tests/ui/qualified/` - -Contains few tests on qualified paths where a type parameter is provided at the end: `type A = ::A::f;`. The tests check if this fails during type checking, not parsing. - -**FIXME**: Should be rehomed to `ui/typeck`. - ## `tests/ui/query-system/` Tests on Rust methods and functions which use the query system, such as `std::mem::size_of`. These compute information about the current runtime and return it. See [Query system | rustc-dev-guide](https://rustc-dev-guide.rust-lang.org/query.html). diff --git a/tests/ui/qualified/qualified-path-params-2.rs b/tests/ui/qualified/qualified-path-params-2.rs deleted file mode 100644 index d0cc1fa3d517..000000000000 --- a/tests/ui/qualified/qualified-path-params-2.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Check that qualified paths with type parameters -// fail during type checking and not during parsing - -struct S; - -trait Tr { - type A; -} - -impl Tr for S { - type A = S; -} - -impl S { - fn f() {} -} - -type A = ::A::f; -//~^ ERROR ambiguous associated type - -fn main() {} diff --git a/tests/ui/qualified/qualified-path-params-2.stderr b/tests/ui/qualified/qualified-path-params-2.stderr deleted file mode 100644 index e70cdbdc3f49..000000000000 --- a/tests/ui/qualified/qualified-path-params-2.stderr +++ /dev/null @@ -1,15 +0,0 @@ -error[E0223]: ambiguous associated type - --> $DIR/qualified-path-params-2.rs:18:10 - | -LL | type A = ::A::f; - | ^^^^^^^^^^^^^^^^^^^ - | -help: if there were a trait named `Example` with associated type `f` implemented for `::A`, you could use the fully-qualified path - | -LL - type A = ::A::f; -LL + type A = <::A as Example>::f; - | - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0223`. diff --git a/tests/ui/qualified/qualified-path-params.stderr b/tests/ui/qualified/qualified-path-params.stderr deleted file mode 100644 index a49ed6c8f607..000000000000 --- a/tests/ui/qualified/qualified-path-params.stderr +++ /dev/null @@ -1,18 +0,0 @@ -error[E0533]: expected unit struct, unit variant or constant, found associated function `<::A>::f` - --> $DIR/qualified-path-params.rs:20:9 - | -LL | ::A::f:: => {} - | ^^^^^^^^^^^^^^^^^^^^^ not a unit struct, unit variant or constant - -error[E0029]: only `char` and numeric types are allowed in range patterns - --> $DIR/qualified-path-params.rs:22:15 - | -LL | 0 ..= ::A::f:: => {} - | - ^^^^^^^^^^^^^^^^^^^^^ this is of type `fn() {S::f::}` but it should be `char` or numeric - | | - | this is of type `{integer}` - -error: aborting due to 2 previous errors - -Some errors have detailed explanations: E0029, E0533. -For more information about an error, try `rustc --explain E0029`. diff --git a/tests/ui/qualified/qualified-path-params.rs b/tests/ui/typeck/qualified-path-params.rs similarity index 80% rename from tests/ui/qualified/qualified-path-params.rs rename to tests/ui/typeck/qualified-path-params.rs index e8a95a46010a..95bfc5d8fb80 100644 --- a/tests/ui/qualified/qualified-path-params.rs +++ b/tests/ui/typeck/qualified-path-params.rs @@ -15,11 +15,14 @@ impl S { fn f() {} } +type A = ::A::f; +//~^ ERROR ambiguous associated type + fn main() { match 10 { ::A::f:: => {} //~^ ERROR expected unit struct, unit variant or constant, found associated function - 0 ..= ::A::f:: => {} + 0..=::A::f:: => {} //~^ ERROR only `char` and numeric types are allowed in range } } diff --git a/tests/ui/typeck/qualified-path-params.stderr b/tests/ui/typeck/qualified-path-params.stderr new file mode 100644 index 000000000000..b79d883394db --- /dev/null +++ b/tests/ui/typeck/qualified-path-params.stderr @@ -0,0 +1,30 @@ +error[E0223]: ambiguous associated type + --> $DIR/qualified-path-params.rs:18:10 + | +LL | type A = ::A::f; + | ^^^^^^^^^^^^^^^^^^^ + | +help: if there were a trait named `Example` with associated type `f` implemented for `::A`, you could use the fully-qualified path + | +LL - type A = ::A::f; +LL + type A = <::A as Example>::f; + | + +error[E0533]: expected unit struct, unit variant or constant, found associated function `<::A>::f` + --> $DIR/qualified-path-params.rs:23:9 + | +LL | ::A::f:: => {} + | ^^^^^^^^^^^^^^^^^^^^^ not a unit struct, unit variant or constant + +error[E0029]: only `char` and numeric types are allowed in range patterns + --> $DIR/qualified-path-params.rs:25:13 + | +LL | 0..=::A::f:: => {} + | - ^^^^^^^^^^^^^^^^^^^^^ this is of type `fn() {S::f::}` but it should be `char` or numeric + | | + | this is of type `{integer}` + +error: aborting due to 3 previous errors + +Some errors have detailed explanations: E0029, E0223, E0533. +For more information about an error, try `rustc --explain E0029`.