2018-05-30 09:06:08 -03:00
|
|
|
#![deny(where_clauses_object_safety)]
|
|
|
|
|
2018-05-22 12:09:35 -03:00
|
|
|
trait Trait {}
|
|
|
|
|
|
|
|
trait X {
|
2018-05-30 09:06:08 -03: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 12:09:35 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
impl X for () {
|
|
|
|
fn foo(&self) {}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Trait for dyn X {}
|
|
|
|
|
|
|
|
pub fn main() {
|
|
|
|
// Check that this does not segfault.
|
2019-05-28 14:46:13 -04:00
|
|
|
<dyn X as X>::foo(&());
|
2018-05-22 12:09:35 -03:00
|
|
|
}
|