rust/tests/ui/specialization/issue-68830-spurious-diagnostics.rs
Gurinder Singh c30e15aded Fail candidate assembly for erroneous types
Trait predicates for types which have errors may still
evaluate to OK leading to downstream ICEs. Now we return
a selection error for such types in candidate assembly and
thereby prevent such issues
2024-04-16 12:42:48 +05:30

25 lines
512 B
Rust

// A regression test for #68830. This checks we don't emit
// a verbose `conflicting implementations` error.
#![feature(specialization)]
#![allow(incomplete_features)]
struct BadStruct {
err: MissingType //~ ERROR: cannot find type `MissingType` in this scope
}
trait MyTrait<T> {
fn foo();
}
impl<T, D> MyTrait<T> for D {
default fn foo() {}
}
impl<T> MyTrait<T> for BadStruct {
//~^ ERROR: conflicting implementations of trait `MyTrait<_>` for type `BadStruct`
fn foo() {}
}
fn main() {}