Rollup merge of #103586 - compiler-errors:issue-103573, r=jackh726

Process registered region obligation in `resolve_regions_with_wf_tys`

Fixes #103573
This commit is contained in:
Matthias Krüger 2022-10-27 09:25:11 +02:00 committed by GitHub
commit bf53e712c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 40 additions and 0 deletions

View File

@ -713,6 +713,10 @@ fn resolve_regions_with_wf_tys<'tcx>(
add_constraints(&infcx, region_bound_pairs);
infcx.process_registered_region_obligations(
outlives_environment.region_bound_pairs(),
param_env,
);
let errors = infcx.resolve_regions(&outlives_environment);
debug!(?errors, "errors");

View File

@ -0,0 +1,22 @@
trait TraitA {
type TypeA;
}
trait TraitD {
type TypeD;
}
pub trait TraitB {
type TypeB: TraitD;
fn f(_: &<Self::TypeB as TraitD>::TypeD);
}
pub trait TraitC<E> {
type TypeC<'a>: TraitB;
fn g<'a>(_: &<<Self::TypeC<'a> as TraitB>::TypeB as TraitA>::TypeA);
//~^ ERROR the trait bound `<<Self as TraitC<E>>::TypeC<'a> as TraitB>::TypeB: TraitA` is not satisfied
}
fn main() {}

View File

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