1
Fork 0

Bubble up ErrorGuaranteed from region constraints in method item compare

This commit is contained in:
Michael Goulet 2022-12-24 21:26:14 +00:00
parent 6161758b6d
commit 8973b3e3cc
9 changed files with 24 additions and 40 deletions

View file

@ -468,7 +468,7 @@ fn check_opaque_meets_bounds<'tcx>(
// Can have different predicates to their defining use
hir::OpaqueTyOrigin::TyAlias => {
let outlives_environment = OutlivesEnvironment::new(param_env);
infcx.check_region_obligations_and_report_errors(
let _ = infcx.check_region_obligations_and_report_errors(
defining_use_anchor,
&outlives_environment,
);

View file

@ -589,7 +589,7 @@ pub fn collect_trait_impl_trait_tys<'tcx>(
infcx.check_region_obligations_and_report_errors(
impl_m.def_id.expect_local(),
&outlives_environment,
);
)?;
let mut collected_tys = FxHashMap::default();
for (def_id, (ty, substs)) in collector.types {
@ -1617,9 +1617,9 @@ pub(crate) fn compare_impl_const_raw(
return Err(infcx.err_ctxt().report_fulfillment_errors(&errors, None));
}
// FIXME return `ErrorReported` if region obligations error?
let outlives_environment = OutlivesEnvironment::new(param_env);
infcx.check_region_obligations_and_report_errors(impl_const_item_def, &outlives_environment);
infcx.check_region_obligations_and_report_errors(impl_const_item_def, &outlives_environment)?;
Ok(())
}
@ -1730,7 +1730,7 @@ fn compare_type_predicate_entailment<'tcx>(
infcx.check_region_obligations_and_report_errors(
impl_ty.def_id.expect_local(),
&outlives_environment,
);
)?;
Ok(())
}
@ -1944,7 +1944,7 @@ pub fn check_type_bounds<'tcx>(
infcx.check_region_obligations_and_report_errors(
impl_ty.def_id.expect_local(),
&outlives_environment,
);
)?;
let constraints = infcx.inner.borrow_mut().opaque_type_storage.take_opaque_types();
for (key, value) in constraints {

View file

@ -115,7 +115,7 @@ pub(super) fn enter_wf_checking_ctxt<'tcx, F>(
let outlives_environment =
OutlivesEnvironment::with_bounds(param_env, Some(infcx), implied_bounds);
infcx.check_region_obligations_and_report_errors(body_def_id, &outlives_environment);
let _ = infcx.check_region_obligations_and_report_errors(body_def_id, &outlives_environment);
}
fn check_well_formed(tcx: TyCtxt<'_>, def_id: hir::OwnerId) {

View file

@ -325,7 +325,7 @@ fn visit_implementation_of_dispatch_from_dyn(tcx: TyCtxt<'_>, impl_did: LocalDef
// Finally, resolve all regions.
let outlives_env = OutlivesEnvironment::new(param_env);
infcx.check_region_obligations_and_report_errors(impl_did, &outlives_env);
let _ = infcx.check_region_obligations_and_report_errors(impl_did, &outlives_env);
}
}
_ => {
@ -565,7 +565,7 @@ pub fn coerce_unsized_info<'tcx>(tcx: TyCtxt<'tcx>, impl_did: DefId) -> CoerceUn
// Finally, resolve all regions.
let outlives_env = OutlivesEnvironment::new(param_env);
infcx.check_region_obligations_and_report_errors(impl_did, &outlives_env);
let _ = infcx.check_region_obligations_and_report_errors(impl_did, &outlives_env);
CoerceUnsizedInfo { custom_kind: kind }
}

View file

@ -182,7 +182,7 @@ fn get_impl_substs(
let implied_bounds = infcx.implied_bounds_tys(param_env, impl1_hir_id, assumed_wf_types);
let outlives_env = OutlivesEnvironment::with_bounds(param_env, Some(infcx), implied_bounds);
infcx.check_region_obligations_and_report_errors(impl1_def_id, &outlives_env);
let _ = infcx.check_region_obligations_and_report_errors(impl1_def_id, &outlives_env);
let Ok(impl2_substs) = infcx.fully_resolve(impl2_substs) else {
let span = tcx.def_span(impl1_def_id);
tcx.sess.emit_err(SubstsOnOverriddenImpl { span });