summaryrefslogtreecommitdiffstats
path: root/tests/ui/traits/inheritance/visibility.rs
blob: 6ad8649267481d06d98334f2f14234cff80dca2f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// run-pass

mod traits {
    pub trait Foo { fn f(&self) -> isize; }

    impl Foo for isize { fn f(&self) -> isize { 10 } }
}

trait Quux: traits::Foo { }
impl<T:traits::Foo> Quux for T { }

// Foo is not in scope but because Quux is we can still access
// Foo's methods on a Quux bound typaram
fn f<T:Quux>(x: &T) {
    assert_eq!(x.f(), 10);
}

pub fn main() {
    f(&0)
}