rust/tests/ui/traits/non_lifetime_binders/supertrait-object-safety.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

25 lines
533 B
Rust
Raw Normal View History

#![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
}