2018-02-07 19:35:35 -08:00
|
|
|
// compile-flags: -Z teach
|
2016-05-17 15:01:31 +02:00
|
|
|
trait SomeTrait {
|
2022-12-27 17:57:39 -08:00
|
|
|
fn foo(&self);
|
|
|
|
}
|
|
|
|
struct S;
|
|
|
|
impl SomeTrait for S {
|
|
|
|
fn foo(&self) {}
|
2016-05-17 15:01:31 +02:00
|
|
|
}
|
|
|
|
fn main() {
|
2022-12-27 17:57:39 -08:00
|
|
|
let trait_obj: &dyn SomeTrait = &S;
|
2016-08-08 16:37:44 -04:00
|
|
|
|
|
|
|
let &invalid = trait_obj;
|
|
|
|
//~^ ERROR E0033
|
2016-05-17 15:01:31 +02:00
|
|
|
}
|