Report nicer lifetime errors for specialization

Add an obligation cause for these error so that the error points to the
implementations that caused the error.
This commit is contained in:
Matthew Jasper
2023-05-05 15:52:53 +01:00
parent fafe9e71d5
commit f46eabb9e5
7 changed files with 132 additions and 10 deletions

View File

@@ -322,7 +322,9 @@ fn negative_impl(tcx: TyCtxt<'_>, impl1_def_id: DefId, impl2_def_id: DefId) -> b
let selcx = &mut SelectionContext::new(&infcx);
let impl2_substs = infcx.fresh_substs_for_item(DUMMY_SP, impl2_def_id);
let (subject2, obligations) =
impl_subject_and_oblig(selcx, impl_env, impl2_def_id, impl2_substs);
impl_subject_and_oblig(selcx, impl_env, impl2_def_id, impl2_substs, |_, _| {
ObligationCause::dummy()
});
!equate(&infcx, impl_env, subject1, subject2, obligations, impl1_def_id)
}