Skip to content

Conversation

@JohnTitor
Copy link
Member

@JohnTitor JohnTitor commented Oct 22, 2025

Addresses #147694

I'm not sure the current note wording is the best so I appreciate any feedback.

@rustbot
Copy link
Collaborator

rustbot commented Oct 22, 2025

This PR modifies tests/ui/issues/. If this PR is adding new tests to tests/ui/issues/,
please refrain from doing so, and instead add it to more descriptive subdirectories.

@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 22, 2025
@rustbot
Copy link
Collaborator

rustbot commented Oct 22, 2025

r? @jackh726

rustbot has assigned @jackh726.
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

@JohnTitor
Copy link
Member Author

r? @estebank

@rustbot rustbot assigned estebank and unassigned jackh726 Oct 22, 2025
)
);
err.help(
"buffer reuse with borrowed references requires unsafe code or restructuring"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't mention recycle_vec as I'm not sure if using that crate is the most common solution here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's an RFC to bring that into std, so we can change this once we have that.

Comment on lines +27 to +28
LL | buffer.clear();
| ------ borrow later used here
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is specifically (one of) the pattern(s) that we should detect in order to suggest recycling in the future.

@estebank
Copy link
Contributor

@bors r+

Leaving the ticket open to not forget to come back to this and provide structured suggestions when possible.

Thank you for taking a look at this!

@bors
Copy link
Collaborator

bors commented Nov 11, 2025

📌 Commit 61b26f9 has been approved by estebank

It is now in the queue for this repository.

@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 Nov 11, 2025
Zalathar added a commit to Zalathar/rust that referenced this pull request Nov 11, 2025
…ttern, r=estebank

Improve diagnostics for buffer reuse with borrowed references

Addresses rust-lang#147694

I'm not sure the current note wording is the best so I appreciate any feedback.
Zalathar added a commit to Zalathar/rust that referenced this pull request Nov 11, 2025
…ttern, r=estebank

Improve diagnostics for buffer reuse with borrowed references

Addresses rust-lang#147694

I'm not sure the current note wording is the best so I appreciate any feedback.
bors added a commit that referenced this pull request Nov 12, 2025
Rollup of 12 pull requests

Successful merges:

 - #146627 (Simplify `jemalloc` setup)
 - #147753 (Suggest add bounding value for RangeTo)
 - #147974 (Improve diagnostics for buffer reuse with borrowed references)
 - #148080 ([rustdoc] Fix invalid jump to def macro link generation)
 - #148424 (bootstrap: Add snapshot tests for path-to-step handling)
 - #148500 (Update git index before running diff-index)
 - #148536 (cmse: add test for `async` and `const` functions)
 - #148770 (implement `feature(c_variadic_naked_functions)`)
 - #148819 (Remove specialized warning for removed target)
 - #148830 (miri subtree update)
 - #148833 (Update rustbook dependencies)
 - #148841 (Remove more `#[must_use]` from portable-simd)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors
Copy link
Collaborator

bors commented Nov 12, 2025

⌛ Testing commit 61b26f9 with merge ad650e3...

bors added a commit that referenced this pull request Nov 12, 2025
…tebank

Improve diagnostics for buffer reuse with borrowed references

Addresses #147694

I'm not sure the current note wording is the best so I appreciate any feedback.
@Zalathar
Copy link
Member

Yielding to enclosing rollup.

@bors retry

bors added a commit that referenced this pull request Nov 12, 2025
Rollup of 16 pull requests

Successful merges:

 - #146627 (Simplify `jemalloc` setup)
 - #147753 (Suggest add bounding value for RangeTo)
 - #147832 (rustdoc: Don't pass `RenderOptions` to `DocContext`)
 - #147974 (Improve diagnostics for buffer reuse with borrowed references)
 - #148080 ([rustdoc] Fix invalid jump to def macro link generation)
 - #148465 (Adjust spans into the `for` loops context before creating the new desugaring spans.)
 - #148500 (Update git index before running diff-index)
 - #148531 (rustc_target: introduce Abi, Env, Os)
 - #148536 (cmse: add test for `async` and `const` functions)
 - #148770 (implement `feature(c_variadic_naked_functions)`)
 - #148780 (fix filecheck typos in tests)
 - #148819 (Remove specialized warning for removed target)
 - #148830 (miri subtree update)
 - #148833 (Update rustbook dependencies)
 - #148834 (fix(rustdoc): Color doctest errors)
 - #148841 (Remove more `#[must_use]` from portable-simd)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit b98d127 into rust-lang:main Nov 12, 2025
11 of 12 checks passed
@rustbot rustbot added this to the 1.93.0 milestone Nov 12, 2025
@bors
Copy link
Collaborator

bors commented Nov 12, 2025

⌛ Testing commit 61b26f9 with merge 0b329f8...

rust-timer added a commit that referenced this pull request Nov 12, 2025
Rollup merge of #147974 - JohnTitor:diag-detect-buf-reuse-pattern, r=estebank

Improve diagnostics for buffer reuse with borrowed references

Addresses #147694

I'm not sure the current note wording is the best so I appreciate any feedback.
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Nov 12, 2025
Rollup of 16 pull requests

Successful merges:

 - rust-lang/rust#146627 (Simplify `jemalloc` setup)
 - rust-lang/rust#147753 (Suggest add bounding value for RangeTo)
 - rust-lang/rust#147832 (rustdoc: Don't pass `RenderOptions` to `DocContext`)
 - rust-lang/rust#147974 (Improve diagnostics for buffer reuse with borrowed references)
 - rust-lang/rust#148080 ([rustdoc] Fix invalid jump to def macro link generation)
 - rust-lang/rust#148465 (Adjust spans into the `for` loops context before creating the new desugaring spans.)
 - rust-lang/rust#148500 (Update git index before running diff-index)
 - rust-lang/rust#148531 (rustc_target: introduce Abi, Env, Os)
 - rust-lang/rust#148536 (cmse: add test for `async` and `const` functions)
 - rust-lang/rust#148770 (implement `feature(c_variadic_naked_functions)`)
 - rust-lang/rust#148780 (fix filecheck typos in tests)
 - rust-lang/rust#148819 (Remove specialized warning for removed target)
 - rust-lang/rust#148830 (miri subtree update)
 - rust-lang/rust#148833 (Update rustbook dependencies)
 - rust-lang/rust#148834 (fix(rustdoc): Color doctest errors)
 - rust-lang/rust#148841 (Remove more `#[must_use]` from portable-simd)

r? `@ghost`
`@rustbot` modify labels: rollup
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.

6 participants