summaryrefslogtreecommitdiffstats
path: root/src/test/ui/associated-types/associated-types-projection-bound-in-supertraits.rs
blob: 107e6b4ce0ca01651efa9e6a9c39f978ab564cfb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// run-pass
#![allow(unused_variables)]
// Test that we correctly handle projection bounds appearing in the
// supertrait list (and in conjunction with overloaded operators). In
// this case, the `Result=Self` binding in the supertrait listing of
// `Int` was being ignored.

trait Not {
    type Result;

    fn not(self) -> Self::Result;
}

trait Int: Not<Result=Self> + Sized {
    fn count_ones(self) -> usize;
    fn count_zeros(self) -> usize {
        // neither works
        let x: Self = self.not();
        0
    }
}

fn main() { }