]> git.lizzy.rs Git - rust.git/blob - src/test/ui/associated-types/associated-types-projection-bound-in-supertraits.rs
Rollup merge of #76468 - SNCPlay42:lifetime-names, r=Mark-Simulacrum
[rust.git] / src / test / ui / associated-types / associated-types-projection-bound-in-supertraits.rs
1 // run-pass
2 #![allow(unused_variables)]
3 // Test that we correctly handle projection bounds appearing in the
4 // supertrait list (and in conjunction with overloaded operators). In
5 // this case, the `Result=Self` binding in the supertrait listing of
6 // `Int` was being ignored.
7
8 trait Not {
9     type Result;
10
11     fn not(self) -> Self::Result;
12 }
13
14 trait Int: Not<Result=Self> + Sized {
15     fn count_ones(self) -> usize;
16     fn count_zeros(self) -> usize {
17         // neither works
18         let x: Self = self.not();
19         0
20     }
21 }
22
23 fn main() { }