Skip to content

Commit 00b976a

Browse files
committed
Collect fulfillment errors across impls
1 parent 569ca2b commit 00b976a

File tree

3 files changed

+42
-2
lines changed

3 files changed

+42
-2
lines changed

compiler/rustc_hir_analysis/src/astconv/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2261,9 +2261,9 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
22612261

22622262
ocx.register_obligations(impl_obligations);
22632263

2264-
let errors = ocx.select_where_possible();
2264+
let mut errors = ocx.select_where_possible();
22652265
if !errors.is_empty() {
2266-
fulfillment_errors = errors;
2266+
fulfillment_errors.append(&mut errors);
22672267
return None;
22682268
}
22692269

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#![feature(inherent_associated_types)]
2+
#![allow(incomplete_features)]
3+
4+
struct S<A, B>(A, B);
5+
struct Featureless;
6+
7+
trait One {}
8+
trait Two {}
9+
10+
impl<T: One> S<Featureless, T> {
11+
type X = ();
12+
}
13+
14+
impl<T: Two> S<T, Featureless> {
15+
type X = String;
16+
}
17+
18+
fn main() {
19+
let _: S::<Featureless, Featureless>::X; //~ ERROR the associated type `X` exists for `S<Featureless, Featureless>`, but its trait bounds were not satisfied
20+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
error: the associated type `X` exists for `S<Featureless, Featureless>`, but its trait bounds were not satisfied
2+
--> $DIR/not-found-unsatisfied-bounds-in-multiple-impls.rs:19:43
3+
|
4+
LL | struct S<A, B>(A, B);
5+
| -------------- associated item `X` not found for this struct
6+
LL | struct Featureless;
7+
| ------------------
8+
| |
9+
| doesn't satisfy `Featureless: One`
10+
| doesn't satisfy `Featureless: Two`
11+
...
12+
LL | let _: S::<Featureless, Featureless>::X;
13+
| ^ associated type cannot be referenced on `S<Featureless, Featureless>` due to unsatisfied trait bounds
14+
|
15+
= note: the following trait bounds were not satisfied:
16+
`Featureless: One`
17+
`Featureless: Two`
18+
19+
error: aborting due to previous error
20+

0 commit comments

Comments
 (0)