Skip to content

Commit e652fe1

Browse files
committed
[WIP] Force projection sub-obligations to EvaluatedToOkModuloRegions
1 parent 9044245 commit e652fe1

File tree

1 file changed

+12
-2
lines changed
  • compiler/rustc_trait_selection/src/traits

1 file changed

+12
-2
lines changed

compiler/rustc_trait_selection/src/traits/project.rs

+12-2
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ fn opt_normalize_projection_type<'a, 'b, 'tcx>(
553553

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

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

573-
let cache_value = prune_cache_value_obligations(infcx, &result);
573+
let mut cache_value = prune_cache_value_obligations(infcx, &result);
574+
if !result.obligations.is_empty() {
575+
let dummy_pred =
576+
infcx.tcx.mk_predicate(ty::Binder::dummy(ty::PredicateKind::RegionOutlives(
577+
ty::OutlivesPredicate(&ty::ReStatic, &ty::ReStatic),
578+
)));
579+
let dummy =
580+
Obligation::new(ObligationCause::dummy(), ty::ParamEnv::empty(), dummy_pred);
581+
cache_value.obligations.push(dummy.clone());
582+
result.obligations.push(dummy);
583+
}
574584
infcx.inner.borrow_mut().projection_cache().insert_ty(cache_key, cache_value);
575585
obligations.extend(result.obligations);
576586
Ok(Some(result.value))

0 commit comments

Comments
 (0)