about summary refs log tree commit diff
path: root/tests/ui/methods/supertrait-shadowing/trivially-false-subtrait.rs
blob: e44c7c18083d0e41f45534b4d7ccbbc3b97c97ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
//@ check-pass

// Make sure we don't prefer a subtrait that we would've otherwise eliminated
// in `consider_probe` during method probing.

#![feature(supertrait_item_shadowing)]
#![allow(dead_code)]

struct W<T>(T);

trait Upstream {
    fn hello(&self) {}
}
impl<T> Upstream for T {}

trait Downstream: Upstream {
    fn hello(&self) {}
}
impl<T> Downstream for W<T> where T: Foo {}

trait Foo {}

fn main() {
    let x = W(1i32);
    x.hello();
}