summaryrefslogtreecommitdiffstats
path: root/src/test/ui/object-safety/object-safety-supertrait-mentions-Self.rs
blob: 2445b33c814472cba1924c81573ceb9edd7bc0f9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Check that we correctly prevent users from making trait objects
// form traits that make use of `Self` in an argument or return position.

trait Bar<T> {
    fn bar(&self, x: &T);
}

trait Baz : Bar<Self> {
}

fn make_bar<T:Bar<u32>>(t: &T) -> &dyn Bar<u32> {
    t
}

fn make_baz<T:Baz>(t: &T) -> &dyn Baz {
    //~^ ERROR E0038
    t
}

fn main() {
}