rust/tests/ui/traits/trait-upcasting/multiple-occurrence-ambiguousity.rs
Urgau 4c2d6de70e Stabilize RFC3324 dyn upcasting coercion
Aka trait_upcasting feature.

And also adjust the `deref_into_dyn_supertrait` lint.
2023-11-22 13:56:36 +01:00

21 lines
295 B
Rust

// check-fail
trait Bar<T> {
fn bar(&self, _: T) {}
}
trait Foo: Bar<i32> + Bar<u32> {
fn foo(&self, _: ()) {}
}
struct S;
impl Bar<i32> for S {}
impl Bar<u32> for S {}
impl Foo for S {}
fn main() {
let s: &dyn Foo = &S;
let t: &dyn Bar<_> = s; //~ ERROR mismatched types
}