rust/tests/ui/traits/trait-upcasting/multiple-occurrence-ambiguousity.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

22 lines
324 B
Rust
Raw Normal View History

// check-fail
#![feature(trait_upcasting)]
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
}