summaryrefslogtreecommitdiffstats
path: root/tests/ui/traits/non_lifetime_binders/supertrait-object-safety.rs
blob: a635edb4485bd94425a6b5a481c7593b72e99a19 (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
#![feature(non_lifetime_binders)]
//~^ WARN the feature `non_lifetime_binders` is incomplete

trait Foo: for<T> Bar<T> {}

trait Bar<T: ?Sized> {
    fn method(&self) {}
}

fn needs_bar(x: &(impl Bar<i32> + ?Sized)) {
    x.method();
}

impl Foo for () {}

impl<T: ?Sized> Bar<T> for () {}

fn main() {
    let x: &dyn Foo = &();
    //~^ ERROR the trait `Foo` cannot be made into an object
    //~| ERROR the trait `Foo` cannot be made into an object
    needs_bar(x);
    //~^ ERROR the trait `Foo` cannot be made into an object
}