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 `()`
10 //~^ ERROR mismatched types
11 //~| NOTE expected associated type, found `()`
12 //~| NOTE expected associated type `<Self as Tr>::A`
13 //~| NOTE consider constraining the associated type
14 //~| NOTE for more information, visit
18 // An impl that doesn't override the type *can* assume the default.
36 // Assoc. consts also cannot assume that default types hold
37 const C: Self::Ty = 0u8;
38 //~^ ERROR mismatched types
39 //~| NOTE expected associated type, found `u8`
40 //~| NOTE expected associated type `<Self as AssocConst>::Ty`
41 //~| NOTE consider constraining the associated type
42 //~| NOTE for more information, visit
45 // An impl can, however
46 impl AssocConst for () {
47 const C: Self::Ty = 0u8;