Skip to content

Commit c38569d

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

File tree

3 files changed

+55
-0
lines changed

3 files changed

+55
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
//@ run-rustfix
2+
#![allow(unused)]
3+
struct T();
4+
5+
trait Trait {
6+
type Assoc;
7+
8+
fn f();
9+
}
10+
11+
impl Trait for () {
12+
type Assoc = T;
13+
14+
fn f() {
15+
<T();
16+
//~^ ERROR no associated item named `Assoc` found for unit type `()` in the current scope
17+
}
18+
}
19+
20+
fn main() {}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
//@ run-rustfix
2+
#![allow(unused)]
3+
struct T();
4+
5+
trait Trait {
6+
type Assoc;
7+
8+
fn f();
9+
}
10+
11+
impl Trait for () {
12+
type Assoc = T;
13+
14+
fn f() {
15+
<Self>::Assoc();
16+
//~^ ERROR no associated item named `Assoc` found for unit type `()` in the current scope
17+
}
18+
}
19+
20+
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-suggestion-142473.rs:15: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)