blob: 143b854ed6b2d344a8b2c73c56d55086264fad01 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
// Check that we do not allow casts or coercions
// to object unsafe trait objects by ref
#![feature(object_safe_for_dispatch)]
trait Trait: Sized {}
struct S;
impl Trait for S {}
fn takes_trait(t: &dyn Trait) {}
fn main() {
&S as &dyn Trait; //~ ERROR E0038
let t: &dyn Trait = &S; //~ ERROR E0038
takes_trait(&S); //~ ERROR E0038
}
|