]> git.proxmox.com Git - rustc.git/blob - src/test/ui/wf/wf-convert-unsafe-trait-obj.rs
Update unsuspicious file list
[rustc.git] / src / test / ui / wf / wf-convert-unsafe-trait-obj.rs
1 // Check that we do not allow casts or coercions
2 // to object unsafe trait objects by ref
3
4 #![feature(object_safe_for_dispatch)]
5
6 trait Trait: Sized {}
7
8 struct S;
9
10 impl Trait for S {}
11
12 fn takes_trait(t: &dyn Trait) {}
13
14 fn main() {
15 &S as &dyn Trait; //~ ERROR E0038
16 let t: &dyn Trait = &S; //~ ERROR E0038
17 takes_trait(&S); //~ ERROR E0038
18 }