2014-10-30 15:41:07 +13:00
|
|
|
// Test calling methods on an impl for a bare trait. This test checks that the
|
|
|
|
// trait impl is only applied to a trait object, not concrete types which implement
|
|
|
|
// the trait.
|
|
|
|
|
2015-04-17 22:12:20 -07:00
|
|
|
trait T {}
|
2014-10-30 15:41:07 +13:00
|
|
|
|
2019-05-28 14:46:13 -04:00
|
|
|
impl<'a> dyn T + 'a {
|
2014-10-30 15:41:07 +13:00
|
|
|
fn foo(&self) {}
|
|
|
|
}
|
|
|
|
|
2015-01-31 17:23:42 +01:00
|
|
|
impl T for i32 {}
|
2014-10-30 15:41:07 +13:00
|
|
|
|
|
|
|
fn main() {
|
2015-01-31 17:23:42 +01:00
|
|
|
let x = &42i32;
|
2020-01-08 08:05:31 -08:00
|
|
|
x.foo(); //~ERROR: no method named `foo` found
|
2014-10-30 15:41:07 +13:00
|
|
|
}
|