This commit is contained in:
Boxy 2022-10-06 07:00:38 +01:00
parent 611db1d3f3
commit 25ed5d5db2
2 changed files with 43 additions and 43 deletions

View File

@ -1044,7 +1044,6 @@ fn check_impl_items_against_trait<'tcx>(
let impl_item_full = tcx.hir().impl_item(impl_item.id);
match impl_item_full.kind {
hir::ImplItemKind::Const(..) => {
// Find associated const definition.
let _ = tcx.compare_assoc_const_impl_item_with_trait_item((
impl_item.id.def_id.def_id,
ty_impl_item.trait_item_def_id.unwrap(),

View File

@ -1349,11 +1349,12 @@ pub(crate) fn raw_compare_const_impl<'tcx>(
debug!("compare_const_impl: trait_ty={:?}", trait_ty);
let maybe_error_reported = infcx
let err = infcx
.at(&cause, param_env)
.sup(trait_ty, impl_ty)
.map(|ok| ocx.register_infer_ok_obligations(ok))
.map_err(|terr| {
.map(|ok| ocx.register_infer_ok_obligations(ok));
if let Err(terr) = err {
debug!(
"checking associated const for compatibility: impl ty {:?}, trait ty {:?}",
impl_ty, trait_ty
@ -1393,8 +1394,8 @@ pub(crate) fn raw_compare_const_impl<'tcx>(
false,
false,
);
diag.emit()
});
return Err(diag.emit());
};
// Check that all obligations are satisfied by the implementation's
// version.
@ -1407,7 +1408,7 @@ pub(crate) fn raw_compare_const_impl<'tcx>(
let outlives_environment = OutlivesEnvironment::new(param_env);
infcx
.check_region_obligations_and_report_errors(impl_const_item_def, &outlives_environment);
maybe_error_reported
Ok(())
})
}