Object safety "method references the Self type" check does not normalize.
3aef0a0
Opened by Eduard-Mihai Burtescu at
Example (using an associated type that matches a blanket impl):
trait Foo {
type X;
}
impl<T: ?Sized> Foo for T {
type X = ();
}
trait Bar {
// Note how this is allowed without a bound.
fn foo(&self) -> <Self as Foo>::X;
}
// error: the trait `Bar` cannot be made into an object
fn foo(_: Box<Bar>) {}
fn main() {}
Example (using an associated type that matches a blanket
impl):trait Foo { type X; } impl<T: ?Sized> Foo for T { type X = (); } trait Bar { // Note how this is allowed without a bound. fn foo(&self) -> <Self as Foo>::X; } // error: the trait `Bar` cannot be made into an object fn foo(_: Box<dyn Bar>) {} fn main() {}León Orell Valerian Liehr at 2024-08-29 23:29:18