]> git.lizzy.rs Git - rust.git/blob - src/test/ui/associated-types/issue-41868.rs
Rollup merge of #105567 - TimNN:kcfi16, r=nikic
[rust.git] / src / test / ui / associated-types / issue-41868.rs
1 // check-pass
2
3 // Defaulted assoc. types should normalize properly in impls that don't
4 // override them.
5
6 #![feature(associated_type_defaults)]
7
8 pub struct Foo;
9
10 pub trait CanDecode: Sized {
11     type Output = Self;
12     fn read(rdr: &mut Foo) -> Option<Self::Output>;
13 }
14
15 impl CanDecode for u8 {
16     fn read(rdr: &mut Foo) -> Option<Self::Output> { Some(42) }
17 }
18
19 impl CanDecode for u16 {
20     fn read(rdr: &mut Foo) -> Option<u16> { Some(17) }
21 }
22
23 fn main() {}