2014-10-30 02:41:07 +00: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-18 05:12:20 +00:00
|
|
|
trait T {}
|
2014-10-30 02:41:07 +00:00
|
|
|
|
2019-05-28 18:46:13 +00:00
|
|
|
impl<'a> dyn T + 'a {
|
2014-10-30 02:41:07 +00:00
|
|
|
fn foo(&self) {}
|
|
|
|
}
|
|
|
|
|
2015-01-31 16:23:42 +00:00
|
|
|
impl T for i32 {}
|
2014-10-30 02:41:07 +00:00
|
|
|
|
|
|
|
fn main() {
|
2015-01-31 16:23:42 +00:00
|
|
|
let x = &42i32;
|
2020-01-08 16:05:31 +00:00
|
|
|
x.foo(); //~ERROR: no method named `foo` found
|
2014-10-30 02:41:07 +00:00
|
|
|
}
|