about summary refs log tree commit diff
path: root/tests/ui/traits/non_lifetime_binders/supertrait-dyn-compatibility.rs
blob: aab5479334e4ecf7022facc2d91e5744660bff9d (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
#![feature(sized_hierarchy)]
#![feature(non_lifetime_binders)]
//~^ WARN the feature `non_lifetime_binders` is incomplete

use std::marker::PointeeSized;

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

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

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

impl Foo for () {}

impl<T: PointeeSized> Bar<T> for () {}

fn main() {
    let x: &dyn Foo = &();
    //~^ ERROR the trait `Foo` is not dyn compatible
    needs_bar(x);
}