rust/tests/ui/traits/object/safety.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

18 lines
226 B
Rust
Raw Normal View History

2014-12-30 00:03:51 -06:00
// Check that static methods are not object-safe.
trait Tr {
fn foo();
fn bar(&self) { }
2014-12-30 00:03:51 -06:00
}
struct St;
impl Tr for St {
fn foo() {}
}
fn main() {
2019-05-28 13:46:13 -05:00
let _: &dyn Tr = &St; //~ ERROR E0038
//~^ ERROR E0038
2014-12-30 00:03:51 -06:00
}