File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed
src/test/ui/associated-types Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change 1+ #![ feature( associated_type_defaults) ]
2+
3+ // This is a partial regression test for #26681, which used to fail to resolve
4+ // `Self` in the assoc. constant, and now fails with a type mismatch because
5+ // `Self::Fv` cannot be assumed to equal `u8` inside the trait.
6+
7+ trait Foo {
8+ type Bar ;
9+ }
10+
11+ impl Foo for u8 {
12+ type Bar = ( ) ;
13+ }
14+
15+ trait Baz {
16+ type Fv : Foo = u8 ;
17+ const C : <Self :: Fv as Foo >:: Bar = 6665 ; //~ error: mismatched types
18+ }
19+
20+ fn main ( ) { }
Original file line number Diff line number Diff line change 1+ error[E0308]: mismatched types
2+ --> $DIR/issue-26681.rs:17:39
3+ |
4+ LL | const C: <Self::Fv as Foo>::Bar = 6665;
5+ | ^^^^ expected associated type, found integer
6+ |
7+ = note: expected type `<<Self as Baz>::Fv as Foo>::Bar`
8+ found type `{integer}`
9+
10+ error: aborting due to previous error
11+
12+ For more information about this error, try `rustc --explain E0308`.
You can’t perform that action at this time.
0 commit comments