Relocate qualified/qualified-path-params to

typeck/qualified-path-params.rs

merged test removed ui/qualified directory
This commit is contained in:
reddevilmidzy 2025-11-28 15:25:38 +09:00
parent 8e74c6b137
commit aa97acce62
6 changed files with 34 additions and 61 deletions

View file

@ -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 = <S as Tr>::A::f<u8>;`. 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).

View file

@ -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<T>() {}
}
type A = <S as Tr>::A::f<u8>;
//~^ ERROR ambiguous associated type
fn main() {}

View file

@ -1,15 +0,0 @@
error[E0223]: ambiguous associated type
--> $DIR/qualified-path-params-2.rs:18:10
|
LL | type A = <S as Tr>::A::f<u8>;
| ^^^^^^^^^^^^^^^^^^^
|
help: if there were a trait named `Example` with associated type `f` implemented for `<S as Tr>::A`, you could use the fully-qualified path
|
LL - type A = <S as Tr>::A::f<u8>;
LL + type A = <<S as Tr>::A as Example>::f<u8>;
|
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0223`.

View file

@ -1,18 +0,0 @@
error[E0533]: expected unit struct, unit variant or constant, found associated function `<<S as Tr>::A>::f<u8>`
--> $DIR/qualified-path-params.rs:20:9
|
LL | <S as Tr>::A::f::<u8> => {}
| ^^^^^^^^^^^^^^^^^^^^^ 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 ..= <S as Tr>::A::f::<u8> => {}
| - ^^^^^^^^^^^^^^^^^^^^^ this is of type `fn() {S::f::<u8>}` 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`.

View file

@ -15,11 +15,14 @@ impl S {
fn f<T>() {}
}
type A = <S as Tr>::A::f<u8>;
//~^ ERROR ambiguous associated type
fn main() {
match 10 {
<S as Tr>::A::f::<u8> => {}
//~^ ERROR expected unit struct, unit variant or constant, found associated function
0 ..= <S as Tr>::A::f::<u8> => {}
0..=<S as Tr>::A::f::<u8> => {}
//~^ ERROR only `char` and numeric types are allowed in range
}
}

View file

@ -0,0 +1,30 @@
error[E0223]: ambiguous associated type
--> $DIR/qualified-path-params.rs:18:10
|
LL | type A = <S as Tr>::A::f<u8>;
| ^^^^^^^^^^^^^^^^^^^
|
help: if there were a trait named `Example` with associated type `f` implemented for `<S as Tr>::A`, you could use the fully-qualified path
|
LL - type A = <S as Tr>::A::f<u8>;
LL + type A = <<S as Tr>::A as Example>::f<u8>;
|
error[E0533]: expected unit struct, unit variant or constant, found associated function `<<S as Tr>::A>::f<u8>`
--> $DIR/qualified-path-params.rs:23:9
|
LL | <S as Tr>::A::f::<u8> => {}
| ^^^^^^^^^^^^^^^^^^^^^ 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..=<S as Tr>::A::f::<u8> => {}
| - ^^^^^^^^^^^^^^^^^^^^^ this is of type `fn() {S::f::<u8>}` 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`.