Skip to content

Commit bf53e71

Browse files
authored
Rollup merge of #103586 - compiler-errors:issue-103573, r=jackh726
Process registered region obligation in `resolve_regions_with_wf_tys` Fixes #103573
2 parents 8a29784 + db3b01d commit bf53e71

File tree

3 files changed

+40
-0
lines changed

3 files changed

+40
-0
lines changed

compiler/rustc_hir_analysis/src/check/wfcheck.rs

+4
Original file line numberDiff line numberDiff line change
@@ -713,6 +713,10 @@ fn resolve_regions_with_wf_tys<'tcx>(
713713

714714
add_constraints(&infcx, region_bound_pairs);
715715

716+
infcx.process_registered_region_obligations(
717+
outlives_environment.region_bound_pairs(),
718+
param_env,
719+
);
716720
let errors = infcx.resolve_regions(&outlives_environment);
717721

718722
debug!(?errors, "errors");

src/test/ui/wf/issue-103573.rs

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
trait TraitA {
2+
type TypeA;
3+
}
4+
5+
trait TraitD {
6+
type TypeD;
7+
}
8+
9+
pub trait TraitB {
10+
type TypeB: TraitD;
11+
12+
fn f(_: &<Self::TypeB as TraitD>::TypeD);
13+
}
14+
15+
pub trait TraitC<E> {
16+
type TypeC<'a>: TraitB;
17+
18+
fn g<'a>(_: &<<Self::TypeC<'a> as TraitB>::TypeB as TraitA>::TypeA);
19+
//~^ ERROR the trait bound `<<Self as TraitC<E>>::TypeC<'a> as TraitB>::TypeB: TraitA` is not satisfied
20+
}
21+
22+
fn main() {}

src/test/ui/wf/issue-103573.stderr

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
error[E0277]: the trait bound `<<Self as TraitC<E>>::TypeC<'a> as TraitB>::TypeB: TraitA` is not satisfied
2+
--> $DIR/issue-103573.rs:18:5
3+
|
4+
LL | fn g<'a>(_: &<<Self::TypeC<'a> as TraitB>::TypeB as TraitA>::TypeA);
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `TraitA` is not implemented for `<<Self as TraitC<E>>::TypeC<'a> as TraitB>::TypeB`
6+
|
7+
help: consider further restricting the associated type
8+
|
9+
LL | fn g<'a>(_: &<<Self::TypeC<'a> as TraitB>::TypeB as TraitA>::TypeA) where <<Self as TraitC<E>>::TypeC<'a> as TraitB>::TypeB: TraitA;
10+
| +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
11+
12+
error: aborting due to previous error
13+
14+
For more information about this error, try `rustc --explain E0277`.

0 commit comments

Comments
 (0)