rust/tests/ui/coherence/coherence-unsafe-trait-object-impl.rs
2024-10-10 00:57:59 +02:00

19 lines
292 B
Rust

// Check that unsafe trait object do not implement themselves
// automatically
#![feature(dyn_compatible_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() {}