Skip to content

Commit c9995d2

Browse files
Failing test
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
1 parent 015c777 commit c9995d2

File tree

3 files changed

+59
-0
lines changed

3 files changed

+59
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// issue: <https://github.com/rust-lang/rust/issues/142473>
2+
//
3+
//@ run-rustfix
4+
#![allow(unused)]
5+
struct T();
6+
7+
trait Trait {
8+
type Assoc;
9+
10+
fn f();
11+
}
12+
13+
impl Trait for () {
14+
type Assoc = T;
15+
16+
fn f() {
17+
<T();
18+
//~^ ERROR no associated item named `Assoc` found for unit type `()` in the current scope
19+
}
20+
}
21+
22+
fn main() {}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// issue: <https://github.com/rust-lang/rust/issues/142473>
2+
//
3+
//@ run-rustfix
4+
#![allow(unused)]
5+
struct T();
6+
7+
trait Trait {
8+
type Assoc;
9+
10+
fn f();
11+
}
12+
13+
impl Trait for () {
14+
type Assoc = T;
15+
16+
fn f() {
17+
<Self>::Assoc();
18+
//~^ ERROR no associated item named `Assoc` found for unit type `()` in the current scope
19+
}
20+
}
21+
22+
fn main() {}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
error[E0599]: no associated item named `Assoc` found for unit type `()` in the current scope
2+
--> $DIR/associated-type-call.rs:17:17
3+
|
4+
LL | <Self>::Assoc();
5+
| ^^^^^ associated item not found in `()`
6+
|
7+
help: to construct a value of type `T`, use the explicit path
8+
|
9+
LL - <Self>::Assoc();
10+
LL + <T();
11+
|
12+
13+
error: aborting due to 1 previous error
14+
15+
For more information about this error, try `rustc --explain E0599`.

0 commit comments

Comments
 (0)