]> git.lizzy.rs Git - rust.git/blob - tests/ui/traits/object/safety.rs
Auto merge of #107843 - bjorn3:sync_cg_clif-2023-02-09, r=bjorn3
[rust.git] / tests / ui / traits / object / safety.rs
1 // Check that static methods are not object-safe.
2
3 trait Tr {
4     fn foo();
5     fn bar(&self) { }
6 }
7
8 struct St;
9
10 impl Tr for St {
11     fn foo() {}
12 }
13
14 fn main() {
15     let _: &dyn Tr = &St; //~ ERROR E0038
16     //~^ ERROR E0038
17 }