diff options
| author | Jonathan Brouwer <jonathantbrouwer@gmail.com> | 2025-06-14 00:08:02 +0200 |
|---|---|---|
| committer | Jonathan Brouwer <jonathantbrouwer@gmail.com> | 2025-06-14 00:08:02 +0200 |
| commit | c9995d2492dc94ea92ac6639ac8757199da749d0 (patch) | |
| tree | b7cafab29246f1b3044834863ed0d94daa0c6e54 | |
| parent | 015c7770ec0ffdba9ff03f1861144a827497f8ca (diff) | |
| download | rust-c9995d2492dc94ea92ac6639ac8757199da749d0.tar.gz rust-c9995d2492dc94ea92ac6639ac8757199da749d0.zip | |
Failing test
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
| -rw-r--r-- | tests/ui/associated-types/associated-type-call.fixed | 22 | ||||
| -rw-r--r-- | tests/ui/associated-types/associated-type-call.rs | 22 | ||||
| -rw-r--r-- | tests/ui/associated-types/associated-type-call.stderr | 15 |
3 files changed, 59 insertions, 0 deletions
diff --git a/tests/ui/associated-types/associated-type-call.fixed b/tests/ui/associated-types/associated-type-call.fixed new file mode 100644 index 00000000000..a3bc910f611 --- /dev/null +++ b/tests/ui/associated-types/associated-type-call.fixed @@ -0,0 +1,22 @@ +// issue: <https://github.com/rust-lang/rust/issues/142473> +// +//@ run-rustfix +#![allow(unused)] +struct T(); + +trait Trait { + type Assoc; + + fn f(); +} + +impl Trait for () { + type Assoc = T; + + fn f() { + <T(); + //~^ ERROR no associated item named `Assoc` found for unit type `()` in the current scope + } +} + +fn main() {} diff --git a/tests/ui/associated-types/associated-type-call.rs b/tests/ui/associated-types/associated-type-call.rs new file mode 100644 index 00000000000..ffe540c329e --- /dev/null +++ b/tests/ui/associated-types/associated-type-call.rs @@ -0,0 +1,22 @@ +// issue: <https://github.com/rust-lang/rust/issues/142473> +// +//@ run-rustfix +#![allow(unused)] +struct T(); + +trait Trait { + type Assoc; + + fn f(); +} + +impl Trait for () { + type Assoc = T; + + fn f() { + <Self>::Assoc(); + //~^ ERROR no associated item named `Assoc` found for unit type `()` in the current scope + } +} + +fn main() {} diff --git a/tests/ui/associated-types/associated-type-call.stderr b/tests/ui/associated-types/associated-type-call.stderr new file mode 100644 index 00000000000..634009433c8 --- /dev/null +++ b/tests/ui/associated-types/associated-type-call.stderr @@ -0,0 +1,15 @@ +error[E0599]: no associated item named `Assoc` found for unit type `()` in the current scope + --> $DIR/associated-type-call.rs:17:17 + | +LL | <Self>::Assoc(); + | ^^^^^ associated item not found in `()` + | +help: to construct a value of type `T`, use the explicit path + | +LL - <Self>::Assoc(); +LL + <T(); + | + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0599`. |
