2015-01-04 20:39:02 -06:00
|
|
|
pub trait Foo { fn foo<T>(&self, ext_thing: &T); }
|
|
|
|
pub trait Bar: Foo { }
|
2014-11-27 10:28:51 -06:00
|
|
|
impl<T: Foo> Bar for T { }
|
|
|
|
|
|
|
|
pub struct Thing;
|
|
|
|
impl Foo for Thing {
|
|
|
|
fn foo<T>(&self, _: &T) {}
|
|
|
|
}
|
|
|
|
|
2015-02-09 09:44:17 -06:00
|
|
|
#[inline(never)]
|
2019-05-28 13:46:13 -05:00
|
|
|
fn foo(b: &dyn Bar) {
|
2015-12-15 03:31:58 -06:00
|
|
|
//~^ ERROR E0038
|
2015-03-03 02:42:26 -06:00
|
|
|
b.foo(&0)
|
2015-02-09 09:44:17 -06:00
|
|
|
}
|
2014-11-27 10:28:51 -06:00
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let mut thing = Thing;
|
2019-05-28 13:46:13 -05:00
|
|
|
let test: &dyn Bar = &mut thing;
|
2014-11-27 10:28:51 -06:00
|
|
|
foo(test);
|
|
|
|
}
|