about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorMatthias Krüger <476013+matthiaskrgr@users.noreply.github.com>2025-06-14 11:27:12 +0200
committerGitHub <noreply@github.com>2025-06-14 11:27:12 +0200
commit4bf7765388da436dc952ac7300ffc114cff37676 (patch)
tree4e15c4c8b4edb689fc58cadc722af98fa0a52202 /compiler
parentfe54c3a5eba611dd9b7f875931f484a7ceef4df2 (diff)
parent1d036f408efa6e12b2fcd35588b4595fde5b0af2 (diff)
downloadrust-4bf7765388da436dc952ac7300ffc114cff37676.tar.gz
rust-4bf7765388da436dc952ac7300ffc114cff37676.zip
Rollup merge of #142477 - JonathanBrouwer:associated-type-suggestion, r=WaffleLapkin
Fix incorrect suggestion when calling an associated type with a type anchor

`sugg_span` here is the span of the call expression.
That span here is the `<Self>::Assoc`, which is exactly what we need here (even though I would expect it to include the arguments, but I guess it doesn't)

r? ``@WaffleLapkin``
One commit with failing tests and one that fixes it for reviewability

closes rust-lang/rust#142473
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_hir_typeck/src/method/suggest.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_hir_typeck/src/method/suggest.rs b/compiler/rustc_hir_typeck/src/method/suggest.rs
index 6cb53bbd745..288d915e85c 100644
--- a/compiler/rustc_hir_typeck/src/method/suggest.rs
+++ b/compiler/rustc_hir_typeck/src/method/suggest.rs
@@ -724,7 +724,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
             {
                 let def_path = tcx.def_path_str(adt_def.did());
                 err.span_suggestion(
-                    ty.span.to(item_ident.span),
+                    sugg_span,
                     format!("to construct a value of type `{}`, use the explicit path", def_path),
                     def_path,
                     Applicability::MachineApplicable,