Skip to content

Point to correct argument in Func Call when Self type fails trait bound #143567

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 8, 2025

Conversation

xizheyin
Copy link
Contributor

@xizheyin xizheyin commented Jul 7, 2025

Fixes #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 #143336.

r? compiler

xizheyin added 2 commits July 7, 2025 16:30
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
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.

Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jul 7, 2025
@compiler-errors
Copy link
Member

r? compiler-errors @bors r+ rollup

@bors
Copy link
Collaborator

bors commented Jul 7, 2025

📌 Commit 796b4d1 has been approved by compiler-errors

It is now in the queue for this repository.

@rustbot rustbot assigned compiler-errors and unassigned lcnr Jul 7, 2025
@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 7, 2025
bors added a commit that referenced this pull request Jul 8, 2025
Rollup of 7 pull requests

Successful merges:

 - #142098 (Implement `int_format_into` feature)
 - #143567 (Point to correct argument in Func Call when Self type fails trait bound)
 - #143570 (consider nested cases for duplicate RPITIT)
 - #143571 (remove `has_nested` from builtin candidates)
 - #143586 (Fix wrong cache event query key)
 - #143589 (const-block-as-pattern: do not refer to no-longer-existing nightly feature)
 - #143608 (Fix in std::String docs)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 40e1ccf into rust-lang:master Jul 8, 2025
11 checks passed
@rustbot rustbot added this to the 1.90.0 milestone Jul 8, 2025
rust-timer added a commit that referenced this pull request Jul 8, 2025
Rollup merge of #143567 - xizheyin:143336, r=compiler-errors

Point to correct argument in Func Call when Self type fails trait bound

Fixes #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 #143336.

r? compiler
@purplesyringa
Copy link
Contributor

Thank you! :3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Misleading span in trait bound error with generic parameters
6 participants