Collect fulfillment errors across impls

This commit is contained in:
León Orell Valerian Liehr 2023-02-19 18:28:44 +01:00
parent 569ca2bad0
commit 00b976a138
No known key found for this signature in database
GPG Key ID: D17A07215F68E713
3 changed files with 42 additions and 2 deletions

View File

@ -2261,9 +2261,9 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
ocx.register_obligations(impl_obligations);
let errors = ocx.select_where_possible();
let mut errors = ocx.select_where_possible();
if !errors.is_empty() {
fulfillment_errors = errors;
fulfillment_errors.append(&mut errors);
return None;
}

View File

@ -0,0 +1,20 @@
#![feature(inherent_associated_types)]
#![allow(incomplete_features)]
struct S<A, B>(A, B);
struct Featureless;
trait One {}
trait Two {}
impl<T: One> S<Featureless, T> {
type X = ();
}
impl<T: Two> S<T, Featureless> {
type X = String;
}
fn main() {
let _: S::<Featureless, Featureless>::X; //~ ERROR the associated type `X` exists for `S<Featureless, Featureless>`, but its trait bounds were not satisfied
}

View File

@ -0,0 +1,20 @@
error: the associated type `X` exists for `S<Featureless, Featureless>`, but its trait bounds were not satisfied
--> $DIR/not-found-unsatisfied-bounds-in-multiple-impls.rs:19:43
|
LL | struct S<A, B>(A, B);
| -------------- associated item `X` not found for this struct
LL | struct Featureless;
| ------------------
| |
| doesn't satisfy `Featureless: One`
| doesn't satisfy `Featureless: Two`
...
LL | let _: S::<Featureless, Featureless>::X;
| ^ associated type cannot be referenced on `S<Featureless, Featureless>` due to unsatisfied trait bounds
|
= note: the following trait bounds were not satisfied:
`Featureless: One`
`Featureless: Two`
error: aborting due to previous error