about summary refs log tree commit diff
path: root/compiler/rustc_infer
diff options
context:
space:
mode:
authorOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2023-06-15 14:34:32 +0000
committerOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2023-06-22 15:00:12 +0000
commit12243ec41586bd5b68c032ef456a369fb0350469 (patch)
tree12f24ff27bf7aceb56b85f559c479ebf380e63f1 /compiler/rustc_infer
parentbae645451e5bc3e5cec77a92b4888915356c28ba (diff)
downloadrust-12243ec41586bd5b68c032ef456a369fb0350469.tar.gz
rust-12243ec41586bd5b68c032ef456a369fb0350469.zip
Point to argument/return type instead of the whole function header
Diffstat (limited to 'compiler/rustc_infer')
-rw-r--r--compiler/rustc_infer/src/infer/error_reporting/note_and_explain.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/rustc_infer/src/infer/error_reporting/note_and_explain.rs b/compiler/rustc_infer/src/infer/error_reporting/note_and_explain.rs
index a723dc3f079..2a32f0b5047 100644
--- a/compiler/rustc_infer/src/infer/error_reporting/note_and_explain.rs
+++ b/compiler/rustc_infer/src/infer/error_reporting/note_and_explain.rs
@@ -260,7 +260,8 @@ impl<T> Trait<T> for X {
                     (ty::Alias(ty::Opaque, alias), _) | (_, ty::Alias(ty::Opaque, alias)) if alias.def_id.is_local() && matches!(tcx.def_kind(body_owner_def_id), DefKind::AssocFn | DefKind::AssocConst) => {
                         if tcx.is_type_alias_impl_trait(alias.def_id) {
                             if !tcx.opaque_types_defined_by(body_owner_def_id.expect_local()).contains(&alias.def_id.expect_local()) {
-                                diag.span_note(tcx.def_span(body_owner_def_id), "\
+                                let sp = tcx.def_ident_span(body_owner_def_id).unwrap_or_else(|| tcx.def_span(body_owner_def_id));
+                                diag.span_note(sp, "\
                                     this item must have the opaque type in its signature \
                                     in order to be able to register hidden types");
                             }