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-07-08 03:09:56 +0200
committerGitHub <noreply@github.com>2025-07-08 03:09:56 +0200
commit40e1ccf458ae48eed859f72bd2172c2eaef41958 (patch)
treee5ff3634c0bef96cfcf3f558a3b4a870a56bac55 /compiler
parentd41f046de52cc578c1f821ceedf45e57ed8b360f (diff)
parent796b4d1fb40d2d4030d53e0f7c9d82cc12b0d3f8 (diff)
downloadrust-40e1ccf458ae48eed859f72bd2172c2eaef41958.tar.gz
rust-40e1ccf458ae48eed859f72bd2172c2eaef41958.zip
Rollup merge of #143567 - xizheyin:143336, r=compiler-errors
Point to correct argument in Func Call when Self type fails trait bound

Fixes rust-lang/rust#143336

When a trait bound fails due to the `Self` type parameter, `adjust_fulfillment_errors` now correctly points to the corresponding function argument instead of incorrectly pointing to other arguments. This is because `Call` may also need to handle the `self` parameter, and not just `MethodCall` needs to be handled, as rust-lang/rust#143336.

r? compiler
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_hir_typeck/src/fn_ctxt/adjust_fulfillment_errors.rs11
1 files changed, 8 insertions, 3 deletions
diff --git a/compiler/rustc_hir_typeck/src/fn_ctxt/adjust_fulfillment_errors.rs b/compiler/rustc_hir_typeck/src/fn_ctxt/adjust_fulfillment_errors.rs
index 2bc007b3ad4..4e4bf8a5562 100644
--- a/compiler/rustc_hir_typeck/src/fn_ctxt/adjust_fulfillment_errors.rs
+++ b/compiler/rustc_hir_typeck/src/fn_ctxt/adjust_fulfillment_errors.rs
@@ -184,9 +184,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
                     return true;
                 }
 
-                for param in [param_to_point_at, fallback_param_to_point_at, self_param_to_point_at]
-                    .into_iter()
-                    .flatten()
+                for param in [
+                    predicate_self_type_to_point_at,
+                    param_to_point_at,
+                    fallback_param_to_point_at,
+                    self_param_to_point_at,
+                ]
+                .into_iter()
+                .flatten()
                 {
                     if self.blame_specific_arg_if_possible(
                         error,