rust/tests/ui/coherence/coherence-unsafe-trait-object-impl.rs

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

19 lines
289 B
Rust
Raw Normal View History

// Check that unsafe trait object do not implement themselves
// automatically
#![feature(object_safe_for_dispatch)]
trait Trait: Sized {
fn call(&self);
}
fn takes_t<S: Trait>(s: S) {
s.call();
}
fn takes_t_obj(t: &dyn Trait) {
takes_t(t); //~ ERROR E0277
}
fn main() {}