1 #![feature(associated_type_defaults)]
3 // Associated type defaults may not be assumed inside the trait defining them.
4 // ie. they only resolve to `<Self as Tr>::A`, not the actual type `()`
6 type A = (); //~ NOTE associated type defaults can't be assumed inside the trait defining them
10 //~^ ERROR mismatched types
11 //~| NOTE expected associated type, found `()`
12 //~| NOTE expected associated type `<Self as Tr>::A`
16 // An impl that doesn't override the type *can* assume the default.
32 type Ty = u8; //~ NOTE associated type defaults can't be assumed inside the trait defining them
34 // Assoc. consts also cannot assume that default types hold
35 const C: Self::Ty = 0u8;
36 //~^ ERROR mismatched types
37 //~| NOTE expected associated type, found `u8`
38 //~| NOTE expected associated type `<Self as AssocConst>::Ty`
41 // An impl can, however
42 impl AssocConst for () {
43 const C: Self::Ty = 0u8;