1
Fork 0

Rollup merge of #134639 - compiler-errors:negative-ambiguity-causes, r=oli-obk

Make sure we note ambiguity causes on positive/negative impl conflicts

Fixes https://github.com/rust-lang/rust/issues/134632 by explaining why the error must be
This commit is contained in:
Matthias Krüger 2024-12-22 09:12:14 +01:00 committed by GitHub
commit 4d166cc369
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 54 additions and 9 deletions

View file

@ -483,15 +483,19 @@ fn report_negative_positive_conflict<'tcx>(
negative_impl_def_id: DefId,
positive_impl_def_id: DefId,
) -> ErrorGuaranteed {
tcx.dcx()
.create_err(NegativePositiveConflict {
impl_span: tcx.def_span(local_impl_def_id),
trait_desc: overlap.trait_ref,
self_ty: overlap.self_ty,
negative_impl_span: tcx.span_of_impl(negative_impl_def_id),
positive_impl_span: tcx.span_of_impl(positive_impl_def_id),
})
.emit()
let mut diag = tcx.dcx().create_err(NegativePositiveConflict {
impl_span: tcx.def_span(local_impl_def_id),
trait_desc: overlap.trait_ref,
self_ty: overlap.self_ty,
negative_impl_span: tcx.span_of_impl(negative_impl_def_id),
positive_impl_span: tcx.span_of_impl(positive_impl_def_id),
});
for cause in &overlap.intercrate_ambiguity_causes {
cause.add_intercrate_ambiguity_hint(&mut diag);
}
diag.emit()
}
fn report_conflicting_impls<'tcx>(