Skip to content

Commit

Permalink
[WIP] Force projection sub-obligations to EvaluatedToOkModuloRegions
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaron1011 committed Jul 4, 2021
1 parent 9044245 commit e652fe1
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions compiler/rustc_trait_selection/src/traits/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ fn opt_normalize_projection_type<'a, 'b, 'tcx>(

debug!(?projected_ty, ?depth, ?projected_obligations);

let result = if projected_ty.has_projections() {
let mut result = if projected_ty.has_projections() {
let mut normalizer = AssocTypeNormalizer::new(
selcx,
param_env,
Expand All @@ -570,7 +570,17 @@ fn opt_normalize_projection_type<'a, 'b, 'tcx>(
Normalized { value: projected_ty, obligations: projected_obligations }
};

let cache_value = prune_cache_value_obligations(infcx, &result);
let mut cache_value = prune_cache_value_obligations(infcx, &result);
if !result.obligations.is_empty() {
let dummy_pred =
infcx.tcx.mk_predicate(ty::Binder::dummy(ty::PredicateKind::RegionOutlives(
ty::OutlivesPredicate(&ty::ReStatic, &ty::ReStatic),
)));
let dummy =
Obligation::new(ObligationCause::dummy(), ty::ParamEnv::empty(), dummy_pred);
cache_value.obligations.push(dummy.clone());
result.obligations.push(dummy);
}
infcx.inner.borrow_mut().projection_cache().insert_ty(cache_key, cache_value);
obligations.extend(result.obligations);
Ok(Some(result.value))
Expand Down

0 comments on commit e652fe1

Please sign in to comment.