2018-05-30 07:06:08 -05:00
|
|
|
#![deny(where_clauses_object_safety)]
|
|
|
|
|
2018-05-22 10:09:35 -05:00
|
|
|
trait Trait {}
|
|
|
|
|
|
|
|
trait X {
|
2018-05-30 07:06:08 -05:00
|
|
|
fn foo(&self) where Self: Trait; //~ ERROR the trait `X` cannot be made into an object
|
|
|
|
//~^ WARN this was previously accepted by the compiler but is being phased out
|
2018-05-22 10:09:35 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
impl X for () {
|
|
|
|
fn foo(&self) {}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Trait for dyn X {}
|
|
|
|
|
|
|
|
pub fn main() {
|
|
|
|
// Check that this does not segfault.
|
2019-05-28 13:46:13 -05:00
|
|
|
<dyn X as X>::foo(&());
|
2018-05-22 10:09:35 -05:00
|
|
|
}
|