Skip to content

diagnostic: skip wrong loops when explaining borrow errors - #164424

Merged
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
xizheyin:issue-164169
Oct 17, 2026
Merged

rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
xizheyin:issue-164169

Conversation

@xizheyin

@xizheyin xizheyin commented Oct 16, 2026 •

Copy link
Copy Markdown
Member

Adresss #164169
When dealing with loops, restrict the search to the specific loop where the conflict occurs.

r? @estebank

@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 Oct 16, 2026
@estebank

Copy link
Copy Markdown
Contributor

Let's not close the original ticket just yet, even though this change fixes the wrong output, I would like to add an additional check for whether the binding comes from an fn argument and that argument's type has nested borrows with the same lifetime, so that it can mention that is rarely what you want.

@bors r+

@rust-bors

rust-bors Bot commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

📌 Commit ad1fd47 has been approved by estebank

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 Oct 16, 2026
@xizheyin

Copy link
Copy Markdown
Member Author

good idea let me have a try

JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Oct 16, 2026
diagnostic: skip wrong loops when explaining borrow errors

Adresss rust-lang#164169
When dealing with loops, restrict the search to the specific loop where the conflict occurs.

r? @estebank
rust-bors Bot pushed a commit that referenced this pull request Oct 16, 2026
…uwer

Rollup of 4 pull requests

Successful merges:

 - #163731 (Add bootstrap step to build the TPDE plugin)
 - #164060 (Add hightlight to acceptable characters in macro rules)
 - #164424 (diagnostic: skip wrong loops when explaining borrow errors)
 - #162444 (Make `std::fs::{File, ReadDir, DirEntry}` always `needs_drop` even when unsupported.)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Oct 16, 2026
diagnostic: skip wrong loops when explaining borrow errors

Adresss rust-lang#164169
When dealing with loops, restrict the search to the specific loop where the conflict occurs.

r? @estebank
rust-bors Bot pushed a commit that referenced this pull request Oct 16, 2026
…uwer

Rollup of 5 pull requests

Successful merges:

 - #163731 (Add bootstrap step to build the TPDE plugin)
 - #164424 (diagnostic: skip wrong loops when explaining borrow errors)
 - #162444 (Make `std::fs::{File, ReadDir, DirEntry}` always `needs_drop` even when unsupported.)
 - #163862 (Collect all limit attributes during TyCtxt creation)
 - #164374 (core: hint: fix `unlikely`'s example polarity typo)
rust-bors Bot pushed a commit that referenced this pull request Oct 17, 2026
…uwer

Rollup of 5 pull requests

Successful merges:

 - #163731 (Add bootstrap step to build the TPDE plugin)
 - #164424 (diagnostic: skip wrong loops when explaining borrow errors)
 - #162444 (Make `std::fs::{File, ReadDir, DirEntry}` always `needs_drop` even when unsupported.)
 - #163862 (Collect all limit attributes during TyCtxt creation)
 - #164374 (core: hint: fix `unlikely`'s example polarity typo)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Oct 17, 2026
diagnostic: skip wrong loops when explaining borrow errors

Adresss rust-lang#164169
When dealing with loops, restrict the search to the specific loop where the conflict occurs.

r? @estebank
jhpratt added a commit to jhpratt/rust that referenced this pull request Oct 17, 2026
diagnostic: skip wrong loops when explaining borrow errors

Adresss rust-lang#164169
When dealing with loops, restrict the search to the specific loop where the conflict occurs.

r? @estebank
rust-bors Bot pushed a commit that referenced this pull request Oct 17, 2026
Rollup of 10 pull requests

Successful merges:

 - #163731 (Add bootstrap step to build the TPDE plugin)
 - #160404 (fd-views: AsRef<File>&Co. for BorrowedFd)
 - #161698 (Fix rmeta-link metadata not being read on AIX)
 - #164016 (Tighten (absence of) return attribute checks in `some-abis-do-extend-params-to-32-bits.rs`)
 - #164424 (diagnostic: skip wrong loops when explaining borrow errors)
 - #162444 (Make `std::fs::{File, ReadDir, DirEntry}` always `needs_drop` even when unsupported.)
 - #163862 (Collect all limit attributes during TyCtxt creation)
 - #164213 (make the safety documentation consistent in task::LocalWaker)
 - #164356 (Add missing full stop)
 - #164374 (core: hint: fix `unlikely`'s example polarity typo)
jhpratt added a commit to jhpratt/rust that referenced this pull request Oct 17, 2026
diagnostic: skip wrong loops when explaining borrow errors

Adresss rust-lang#164169
When dealing with loops, restrict the search to the specific loop where the conflict occurs.

r? @estebank
rust-bors Bot pushed a commit that referenced this pull request Oct 17, 2026
Rollup of 10 pull requests

Successful merges:

 - #161698 (Fix rmeta-link metadata not being read on AIX)
 - #163373 (Canonicalize operands for commutative binary ops)
 - #164016 (Tighten (absence of) return attribute checks in `some-abis-do-extend-params-to-32-bits.rs`)
 - #164424 (diagnostic: skip wrong loops when explaining borrow errors)
 - #138744 (Add methods to TCP and UDP sockets to modify hop limit)
 - #162444 (Make `std::fs::{File, ReadDir, DirEntry}` always `needs_drop` even when unsupported.)
 - #163862 (Collect all limit attributes during TyCtxt creation)
 - #164213 (make the safety documentation consistent in task::LocalWaker)
 - #164356 (Add missing full stop)
 - #164374 (core: hint: fix `unlikely`'s example polarity typo)
rust-bors Bot pushed a commit that referenced this pull request Oct 17, 2026
Rollup of 10 pull requests

Successful merges:

 - #161698 (Fix rmeta-link metadata not being read on AIX)
 - #163373 (Canonicalize operands for commutative binary ops)
 - #164016 (Tighten (absence of) return attribute checks in `some-abis-do-extend-params-to-32-bits.rs`)
 - #164424 (diagnostic: skip wrong loops when explaining borrow errors)
 - #138744 (Add methods to TCP and UDP sockets to modify hop limit)
 - #162444 (Make `std::fs::{File, ReadDir, DirEntry}` always `needs_drop` even when unsupported.)
 - #163862 (Collect all limit attributes during TyCtxt creation)
 - #164213 (make the safety documentation consistent in task::LocalWaker)
 - #164356 (Add missing full stop)
 - #164374 (core: hint: fix `unlikely`'s example polarity typo)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Oct 17, 2026
diagnostic: skip wrong loops when explaining borrow errors

Adresss rust-lang#164169
When dealing with loops, restrict the search to the specific loop where the conflict occurs.

r? @estebank
rust-bors Bot pushed a commit that referenced this pull request Oct 17, 2026
…uwer

Rollup of 11 pull requests

Successful merges:

 - #162809 (Remap local def ids for deterministic metadata encoding)
 - #163373 (Canonicalize operands for commutative binary ops)
 - #164016 (Tighten (absence of) return attribute checks in `some-abis-do-extend-params-to-32-bits.rs`)
 - #164259 (std: make SOLID `sockaddr_storage` large enough for IPv6)
 - #164424 (diagnostic: skip wrong loops when explaining borrow errors)
 - #138744 (Add methods to TCP and UDP sockets to modify hop limit)
 - #162444 (Make `std::fs::{File, ReadDir, DirEntry}` always `needs_drop` even when unsupported.)
 - #163862 (Collect all limit attributes during TyCtxt creation)
 - #164213 (make the safety documentation consistent in task::LocalWaker)
 - #164356 (Add missing full stop)
 - #164374 (core: hint: fix `unlikely`'s example polarity typo)
@rust-bors
rust-bors Bot merged commit ff3ab52 into rust-lang:main Oct 17, 2026
14 checks passed
@rustbot rustbot added this to the 1.101.0 milestone Oct 17, 2026
rust-bors Bot pushed a commit that referenced this pull request Oct 17, 2026
Rollup merge of #164424 - xizheyin:issue-164169, r=estebank

diagnostic: skip wrong loops when explaining borrow errors

Adresss #164169
When dealing with loops, restrict the search to the specific loop where the conflict occurs.

r? @estebank
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.

3 participants