rust/tests/ui/self/dispatch-dyn-incompatible-that-does-not-deref.rs
2025-05-23 12:20:35 +00:00

19 lines
381 B
Rust

// Regression test for <https://github.com/rust-lang/rust/issues/141419>.
use std::ops::Deref;
struct W;
trait Foo: Deref<Target = W> {
fn method(self: &W) {}
//~^ ERROR invalid `self` parameter type: `&W`
}
fn test(x: &dyn Foo) {
//~^ ERROR the trait `Foo` is not dyn compatible
x.method();
//~^ ERROR the trait `Foo` is not dyn compatible
}
fn main() {}