mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 01:04:03 +00:00
19 lines
289 B
Rust
19 lines
289 B
Rust
// 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() {}
|