File tree Expand file tree Collapse file tree 3 files changed +59
-0
lines changed
tests/ui/associated-types Expand file tree Collapse file tree 3 files changed +59
-0
lines changed Original file line number Diff line number Diff line change 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() {}
Original file line number Diff line number Diff line change 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 ( ) { }
Original file line number Diff line number Diff line change 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`.
You can’t perform that action at this time.
0 commit comments