1
Fork 0

implied bounds byebye nested hir ids

This commit is contained in:
lcnr 2022-06-29 18:04:58 +02:00
parent e78e0e2ad0
commit a0d2d9f315
7 changed files with 28 additions and 129 deletions

View file

@ -737,8 +737,7 @@ fn check_opaque_meets_bounds<'tcx>(
hir::OpaqueTyOrigin::FnReturn(..) | hir::OpaqueTyOrigin::AsyncFn(..) => {}
// Can have different predicates to their defining use
hir::OpaqueTyOrigin::TyAlias => {
let mut outlives_environment = OutlivesEnvironment::new(param_env);
outlives_environment.save_implied_bounds(hir_id);
let outlives_environment = OutlivesEnvironment::new(param_env);
infcx.check_region_obligations_and_report_errors(&outlives_environment);
}
}

View file

@ -403,7 +403,6 @@ fn compare_predicate_entailment<'tcx>(
// lifetime parameters.
let mut outlives_environment = OutlivesEnvironment::new(param_env);
outlives_environment.add_implied_bounds(infcx, wf_tys, impl_m_hir_id);
outlives_environment.save_implied_bounds(impl_m_hir_id);
infcx.check_region_obligations_and_report_errors(&outlives_environment);
Ok(())
@ -1159,8 +1158,7 @@ pub(crate) fn compare_const_impl<'tcx>(
return;
}
let mut outlives_environment = OutlivesEnvironment::new(param_env);
outlives_environment.save_implied_bounds(impl_c_hir_id);
let outlives_environment = OutlivesEnvironment::new(param_env);
infcx.resolve_regions_and_report_errors(&outlives_environment);
});
}
@ -1279,8 +1277,7 @@ fn compare_type_predicate_entailment<'tcx>(
// Finally, resolve all regions. This catches wily misuses of
// lifetime parameters.
let mut outlives_environment = OutlivesEnvironment::new(param_env);
outlives_environment.save_implied_bounds(impl_ty_hir_id);
let outlives_environment = OutlivesEnvironment::new(param_env);
infcx.check_region_obligations_and_report_errors(&outlives_environment);
Ok(())
@ -1514,7 +1511,6 @@ pub fn check_type_bounds<'tcx>(
};
let mut outlives_environment = OutlivesEnvironment::new(param_env);
outlives_environment.add_implied_bounds(infcx, implied_bounds, impl_ty_hir_id);
outlives_environment.save_implied_bounds(impl_ty_hir_id);
infcx.check_region_obligations_and_report_errors(&outlives_environment);
Ok(())

View file

@ -65,7 +65,6 @@ impl<'tcx> CheckWfFcxBuilder<'tcx> {
let mut outlives_environment = OutlivesEnvironment::new(param_env);
outlives_environment.add_implied_bounds(&fcx.infcx, wf_tys, id);
outlives_environment.save_implied_bounds(id);
fcx.infcx.check_region_obligations_and_report_errors(&outlives_environment);
});
}
@ -660,8 +659,7 @@ fn resolve_regions_with_wf_tys<'tcx>(
tcx.infer_ctxt().enter(|infcx| {
let mut outlives_environment = OutlivesEnvironment::new(param_env);
outlives_environment.add_implied_bounds(&infcx, wf_tys.clone(), id);
outlives_environment.save_implied_bounds(id);
let region_bound_pairs = outlives_environment.region_bound_pairs_map().get(&id).unwrap();
let region_bound_pairs = outlives_environment.region_bound_pairs();
add_constraints(&infcx, region_bound_pairs);