Skip to content

borrowck: Keep returned path from best_blame_constraint() consistent#158877

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
Enselic:adjust-best_blame_constraint
Jul 10, 2026
Merged

borrowck: Keep returned path from best_blame_constraint() consistent#158877
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
Enselic:adjust-best_blame_constraint

Conversation

@Enselic

@Enselic Enselic commented Jul 6, 2026

Copy link
Copy Markdown
Member

The function fn best_blame_constraint() returns a Vec<OutlivesConstraint> and a BlameConstraint. The BlameConstraint is really just a slimmed down version of an OutlivesConstraint. So we can remove BlameConstraint entirely and instead return Vec<OutlivesConstraint> and an index into that Vec. (Encapsulated in a struct for nice ergonomics.)

To prepare for that, change the code to adjust Vec<OutlivesConstraint> in-place and return info about the adjusted element, rather than returning info for a newly created "fake" OutlivesConstraint.

It is slightly sad that we make path mut, but I think we can live with that. Diagnostics tests will surely catch if someone messes up because of that.

This takes us one step closer (this is commit 2 of 4) towards the end result illustrated in #158623.

The function `fn best_blame_constraint()` returns a
`Vec<OutlivesConstraint>` and a `BlameConstraint`. The `BlameConstraint`
is really just a slimmed down version of an `OutlivesConstraint`. So we
can remove `BlameConstraint` entirely and instead return
`Vec<OutlivesConstraint>` and an index into that `Vec`. (Encapsulated in
a struct for nice ergonomics.)

To prepare for that, change the code to adjust `Vec<OutlivesConstraint>`
in-place and return info about the adjusted element, rather than
returning info for a newly created "fake" `OutlivesConstraint`.
@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 6, 2026
@rustbot

rustbot commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

r? @fee1-dead

rustbot has assigned @fee1-dead.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: borrowck, compiler
  • borrowck, compiler expanded to 75 candidates
  • Random selection from 20 candidates

@fee1-dead

Copy link
Copy Markdown
Member

@bors r+ rollup

@rust-bors

rust-bors Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 6741efa has been approved by fee1-dead

It is now in the queue for this repository.

@rust-bors rust-bors Bot 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 9, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jul 9, 2026
…nt, r=fee1-dead

borrowck: Keep returned `path` from `best_blame_constraint()` consistent

The function `fn best_blame_constraint()` returns a `Vec<OutlivesConstraint>` and a `BlameConstraint`. The `BlameConstraint` is really just a slimmed down version of an `OutlivesConstraint`. So we can remove `BlameConstraint` entirely and instead return `Vec<OutlivesConstraint>` and an index into that `Vec`. (Encapsulated in a struct for nice ergonomics.)

To prepare for that, change the code to adjust `Vec<OutlivesConstraint>` in-place and return info about the adjusted element, rather than returning info for a newly created "fake" `OutlivesConstraint`.

It is slightly sad that we make `path` `mut`, but I think we can live with that. Diagnostics tests will surely catch if someone messes up because of that.

This takes us one step closer (this is commit 2 of 4) towards the end result illustrated in rust-lang#158623.
rust-bors Bot pushed a commit that referenced this pull request Jul 9, 2026
…uwer

Rollup of 24 pull requests

Successful merges:

 - #150946 (intrinsics: Add a fallback for non-const libm float functions)
 - #158510 (Enable `static_position_independent_executables` on all gnu and musl targets)
 - #158541 (Move `std::io::Write` to `core::io`)
 - #158899 (Fix `unaligned_volatile_store` by removing `MemFlags::UNALIGNED`)
 - #156027 (Consider captured regions for opaque type region liveness.)
 - #156370 (Reject linked dylib EII default overrides)
 - #156508 (Infer all anonymous lifetimes in assoc consts as `'static`)
 - #157561 (rustdoc: do not include extra stuff in span)
 - #158617 (allow mGCA const arguments to fall back to anon consts)
 - #158645 (Fix splat ICEs and ban it in closures)
 - #158859 (Improve `-Zls` diagnostic message on `.rs` files)
 - #158988 (Redo `TokenStreamIter`)
 - #158347 (Improve generic parameters handling for #[diagnostic::on_const])
 - #158384 (Allow BackwardIncompatibleDropHint in polonius legacy)
 - #158722 (delegation: do not always inherit `ConstArgHasType` predicates)
 - #158739 (view-types: HIR lowering)
 - #158877 (borrowck: Keep returned `path` from `best_blame_constraint()` consistent)
 - #158883 (tests: fix enum-match.rs to handle LLVM 23)
 - #158886 (Add documentation for the `no_std` attribute)
 - #158940 (Implement feature `char_to_u32`)
 - #158951 (Merge three `MaxUniverse`s into one)
 - #158961 (Reapply "LLVM 23: Run AssignGUIDPass in some places")
 - #158995 (Use REST API in linkchecker script)
 - #158996 ([compiler] Implement `PartialOrd` via `Ord` for `Span` and newtype_indexes)
jhpratt added a commit to jhpratt/rust that referenced this pull request Jul 9, 2026
…nt, r=fee1-dead

borrowck: Keep returned `path` from `best_blame_constraint()` consistent

The function `fn best_blame_constraint()` returns a `Vec<OutlivesConstraint>` and a `BlameConstraint`. The `BlameConstraint` is really just a slimmed down version of an `OutlivesConstraint`. So we can remove `BlameConstraint` entirely and instead return `Vec<OutlivesConstraint>` and an index into that `Vec`. (Encapsulated in a struct for nice ergonomics.)

To prepare for that, change the code to adjust `Vec<OutlivesConstraint>` in-place and return info about the adjusted element, rather than returning info for a newly created "fake" `OutlivesConstraint`.

It is slightly sad that we make `path` `mut`, but I think we can live with that. Diagnostics tests will surely catch if someone messes up because of that.

This takes us one step closer (this is commit 2 of 4) towards the end result illustrated in rust-lang#158623.
rust-bors Bot pushed a commit that referenced this pull request Jul 10, 2026
Rollup of 24 pull requests

Successful merges:

 - #150946 (intrinsics: Add a fallback for non-const libm float functions)
 - #158541 (Move `std::io::Write` to `core::io`)
 - #156027 (Consider captured regions for opaque type region liveness.)
 - #156370 (Reject linked dylib EII default overrides)
 - #156508 (Infer all anonymous lifetimes in assoc consts as `'static`)
 - #157561 (rustdoc: do not include extra stuff in span)
 - #158617 (allow mGCA const arguments to fall back to anon consts)
 - #158645 (Fix splat ICEs and ban it in closures)
 - #158859 (Improve `-Zls` diagnostic message on `.rs` files)
 - #158988 (Redo `TokenStreamIter`)
 - #158347 (Improve generic parameters handling for #[diagnostic::on_const])
 - #158384 (Allow BackwardIncompatibleDropHint in polonius legacy)
 - #158722 (delegation: do not always inherit `ConstArgHasType` predicates)
 - #158739 (view-types: HIR lowering)
 - #158877 (borrowck: Keep returned `path` from `best_blame_constraint()` consistent)
 - #158883 (tests: fix enum-match.rs to handle LLVM 23)
 - #158886 (Add documentation for the `no_std` attribute)
 - #158940 (Implement feature `char_to_u32`)
 - #158951 (Merge three `MaxUniverse`s into one)
 - #158960 (Fix bootstrap submodule path prefix matching)
 - #158961 (Reapply "LLVM 23: Run AssignGUIDPass in some places")
 - #158995 (Use REST API in linkchecker script)
 - #158996 ([compiler] Implement `PartialOrd` via `Ord` for `Span` and newtype_indexes)
 - #159036 (bootstrap: expand '@argfile' arguments to rustc shim)
@rust-bors rust-bors Bot merged commit fb6879d into rust-lang:main Jul 10, 2026
13 checks passed
@rustbot rustbot added this to the 1.99.0 milestone Jul 10, 2026
rust-timer added a commit that referenced this pull request Jul 10, 2026
Rollup merge of #158877 - Enselic:adjust-best_blame_constraint, r=fee1-dead

borrowck: Keep returned `path` from `best_blame_constraint()` consistent

The function `fn best_blame_constraint()` returns a `Vec<OutlivesConstraint>` and a `BlameConstraint`. The `BlameConstraint` is really just a slimmed down version of an `OutlivesConstraint`. So we can remove `BlameConstraint` entirely and instead return `Vec<OutlivesConstraint>` and an index into that `Vec`. (Encapsulated in a struct for nice ergonomics.)

To prepare for that, change the code to adjust `Vec<OutlivesConstraint>` in-place and return info about the adjusted element, rather than returning info for a newly created "fake" `OutlivesConstraint`.

It is slightly sad that we make `path` `mut`, but I think we can live with that. Diagnostics tests will surely catch if someone messes up because of that.

This takes us one step closer (this is commit 2 of 4) towards the end result illustrated in #158623.
@JonathanBrouwer

Copy link
Copy Markdown
Contributor

@rust-timer build a98949b

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (a98949b): comparison URL.

Overall result: ❌✅ regressions and improvements - 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.3% [0.3%, 0.3%] 2
Regressions ❌
(secondary)
0.1% [0.0%, 0.2%] 8
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.0% [-0.1%, -0.0%] 3
All ❌✅ (primary) 0.3% [0.3%, 0.3%] 2

Max RSS (memory usage)

Results (primary -3.6%, secondary -2.0%)

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)
- - 0
Improvements ✅
(primary)
-3.6% [-3.6%, -3.6%] 1
Improvements ✅
(secondary)
-2.0% [-3.4%, -1.3%] 3
All ❌✅ (primary) -3.6% [-3.6%, -3.6%] 1

Cycles

Results (secondary -0.0%)

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)
4.1% [2.3%, 9.1%] 6
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.5% [-9.0%, -1.5%] 7
All ❌✅ (primary) - - 0

Binary size

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

Bootstrap: 490.768s -> 492.209s (0.29%)
Artifact size: 389.74 MiB -> 389.13 MiB (-0.16%)

@rustbot rustbot added the perf-regression Performance regression. label Jul 10, 2026
@JonathanBrouwer

Copy link
Copy Markdown
Contributor

@rustbot label: +perf-regression-triaged
Noise

@rustbot rustbot added the perf-regression-triaged The performance regression has been triaged. label Jul 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

perf-regression Performance regression. perf-regression-triaged The performance regression has been triaged. 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.

5 participants