1
Fork 0

Rollup merge of #113419 - spastorino:new-rpitit-28, r=compiler-errors

Avoid calling item_name for RPITIT

Fixes #113405

r? `@compiler-errors`
This commit is contained in:
Michael Goulet 2023-07-06 20:11:41 -07:00 committed by GitHub
commit 901c863644
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 102 additions and 3 deletions

View file

@ -25,9 +25,11 @@ impl<'tcx> InferCtxt<'tcx> {
"impl has stricter requirements than trait"
);
if let Some(span) = self.tcx.hir().span_if_local(trait_item_def_id) {
let item_name = self.tcx.item_name(impl_item_def_id.to_def_id());
err.span_label(span, format!("definition of `{}` from trait", item_name));
if !self.tcx.is_impl_trait_in_trait(trait_item_def_id) {
if let Some(span) = self.tcx.hir().span_if_local(trait_item_def_id) {
let item_name = self.tcx.item_name(impl_item_def_id.to_def_id());
err.span_label(span, format!("definition of `{}` from trait", item_name));
}
}
err.span_label(error_span, format!("impl has extra requirement {}", requirement));