Skip to content

borrowck: Make ConstraintCategory::CallArgument diagnostics pinpoint specific args#158994

Draft
Enselic wants to merge 2 commits into
rust-lang:mainfrom
Enselic:make-call-argument-specific
Draft

borrowck: Make ConstraintCategory::CallArgument diagnostics pinpoint specific args#158994
Enselic wants to merge 2 commits into
rust-lang:mainfrom
Enselic:make-call-argument-specific

Conversation

@Enselic

@Enselic Enselic commented Jul 9, 2026

Copy link
Copy Markdown
Member

Before this commit, ConstraintCategory::CallArgument diagnostics would point to the entire call expression:

LL |     let b = bar(f, y);
   |             ^^^^^^^^^ argument requires that `'a` must outlive `'b`

This commit changes the diagnostics to point to the specific argument that is causing the lifetime issue:

LL |     let b = bar(f, y);
   |                    ^ argument requires that `'a` must outlive `'b`

Draft

This is just a draft and not ready for review. (Although if someone says "this will never work because of ..." I would like to hear that, of course)

I am currently primarily interested in running perf on this, to get a sense for is this can be made to work. If not, there are hopefully other ways to achieve the same end result.

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jul 9, 2026
@Enselic Enselic force-pushed the make-call-argument-specific branch from 5a8879d to 4259c85 Compare July 9, 2026 04:12
@rust-log-analyzer

This comment has been minimized.

@Enselic Enselic force-pushed the make-call-argument-specific branch from 4259c85 to eb4f057 Compare July 9, 2026 17:14
@rustbot rustbot added the T-clippy Relevant to the Clippy team. label Jul 9, 2026
@Enselic

Enselic commented Jul 9, 2026

Copy link
Copy Markdown
Member Author

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jul 9, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Jul 9, 2026
borrowck: Make `ConstraintCategory::CallArgument` diagnostics pinpoint specific args
@rust-bors

rust-bors Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 59ef33b (59ef33b6576cd200d3050ec6127e05704865762a)
Base parent: 3664b37 (3664b37017c529cad0f0ed259769f15743c21a6a)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (59ef33b): comparison URL.

Overall result: ❌ regressions - please read:

Benchmarking means the PR may be perf-sensitive. It's automatically marked not fit for rolling up. Overriding is possible but disadvised: it risks changing compiler perf.

Next, please: If you can, justify the regressions found in this try perf run in writing along with @rustbot label: +perf-regression-triaged. If not, fix the regressions and do another perf run. Neutral or positive results will clear the label automatically.

@bors rollup=never
@rustbot label: -S-waiting-on-perf +perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
0.2% [0.2%, 0.3%] 6
Regressions ❌
(secondary)
0.1% [0.1%, 0.2%] 6
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.2% [0.2%, 0.3%] 6

Max RSS (memory usage)

This perf run didn't have relevant results for this metric.

Cycles

Results (secondary -4.5%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
2.1% [2.1%, 2.1%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-11.1% [-11.1%, -11.1%] 1
All ❌✅ (primary) - - 0

Binary size

Results (primary 0.1%, secondary 0.1%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
0.1% [0.0%, 0.1%] 59
Regressions ❌
(secondary)
0.1% [0.0%, 0.1%] 22
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.1% [0.0%, 0.1%] 59

Bootstrap: 487.967s -> 489.278s (0.27%)
Artifact size: 388.37 MiB -> 388.89 MiB (0.14%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Jul 10, 2026
@rust-bors

This comment has been minimized.

@Enselic Enselic marked this pull request as ready for review July 10, 2026 14:01
@rustbot

rustbot commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

clippy is developed in its own repository. If possible, consider making this change to rust-lang/rust-clippy instead.

cc @rust-lang/clippy

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 10, 2026
@rustbot

This comment was marked as off-topic.

@Enselic Enselic marked this pull request as draft July 10, 2026 14:02
@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 10, 2026
@Enselic

Enselic commented Jul 10, 2026

Copy link
Copy Markdown
Member Author

Sorry, fat thumbs on a smartphone made me accidentally click the "ready" button...

Enselic added 2 commits July 14, 2026 05:17
…t specific args

Before this commit, `ConstraintCategory::CallArgument` diagnostics would
point to the entire call expression:

    LL |     let b = bar(f, y);
       |             ^^^^^^^^^ argument requires that `'a` must outlive `'b`

This commit changes the diagnostics to point to the specific argument
that is causing the lifetime issue:

    LL |     let b = bar(f, y);
       |                    ^ argument requires that `'a` must outlive `'b`
@Enselic Enselic force-pushed the make-call-argument-specific branch from eb4f057 to a53694c Compare July 14, 2026 03:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

perf-regression Performance regression. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-clippy Relevant to the Clippy team. 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.

5 participants