Skip to content

BufWriter: Note non-obvious safety assumption in BorrowedBuf::set_init usage.#155315

Open
briansmith wants to merge 1 commit intorust-lang:mainfrom
briansmith:b/bufwriter-realloc-comment
Open

BufWriter: Note non-obvious safety assumption in BorrowedBuf::set_init usage.#155315
briansmith wants to merge 1 commit intorust-lang:mainfrom
briansmith:b/bufwriter-realloc-comment

Conversation

@briansmith
Copy link
Copy Markdown
Contributor

@briansmith briansmith commented Apr 14, 2026

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Apr 14, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 14, 2026

r? @Mark-Simulacrum

rustbot has assigned @Mark-Simulacrum.
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: @ChrisDenton, libs
  • @ChrisDenton, libs expanded to 8 candidates

@rustbot

This comment has been minimized.

@briansmith briansmith force-pushed the b/bufwriter-realloc-comment branch from d2dc330 to f28483b Compare April 14, 2026 22:00
Comment thread library/std/src/io/copy.rs
@briansmith
Copy link
Copy Markdown
Contributor Author

PR #155321 is an alternative that makes the logic obviously sound, with some performance risk.

@briansmith briansmith force-pushed the b/bufwriter-realloc-comment branch 2 times, most recently from 2f20b86 to 5bd2ff3 Compare April 15, 2026 01:29
@briansmith
Copy link
Copy Markdown
Contributor Author

PR #155321 is an alternative that makes the logic obviously sound, with some performance risk.

I updated this PR to document the safety conditions more clearly, and to add comments to flush_buf so that people maintaining are aware of the guarantees that it is (has been) making.

I think if PR #155321 can be merged, that is a better alternative.

@briansmith briansmith force-pushed the b/bufwriter-realloc-comment branch from 5bd2ff3 to f579d23 Compare April 15, 2026 02:20
@briansmith briansmith force-pushed the b/bufwriter-realloc-comment branch from f579d23 to 45459a3 Compare April 15, 2026 02:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library 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