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