rust/tests/ui/issues/issue-18959.rs

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

25 lines
429 B
Rust
Raw Normal View History

2015-01-05 02:39:02 +00:00
pub trait Foo { fn foo<T>(&self, ext_thing: &T); }
pub trait Bar: Foo { }
impl<T: Foo> Bar for T { }
pub struct Thing;
impl Foo for Thing {
fn foo<T>(&self, _: &T) {}
}
#[inline(never)]
2019-05-28 18:46:13 +00:00
fn foo(b: &dyn Bar) {
//~^ ERROR E0038
b.foo(&0)
//~^ ERROR E0038
}
fn main() {
let mut thing = Thing;
2019-05-28 18:46:13 +00:00
let test: &dyn Bar = &mut thing;
//~^ ERROR E0038
//~| ERROR E0038
foo(test);
//~^ ERROR E0038
}