Skip to content

Use Vec::push_mut when adding a chunk to arenas#155161

Merged
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
saethlin:push_mut_saves
Apr 12, 2026
Merged

Use Vec::push_mut when adding a chunk to arenas#155161
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
saethlin:push_mut_saves

Conversation

@saethlin
Copy link
Copy Markdown
Member

This fixes #155148, which may or may not be worth fixing on its own merits, but I think Vec::push_mut also makes the code nicer.

@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 Apr 11, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 11, 2026

r? @nnethercote

rustbot has assigned @nnethercote.
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: arena, compiler
  • arena, compiler expanded to 69 candidates
  • Random selection from 11 candidates

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@Kivooeo
Copy link
Copy Markdown
Member

Kivooeo commented Apr 12, 2026

should we add a test for this?

@saethlin
Copy link
Copy Markdown
Member Author

The arena in the compiler already has tests, the trick is that you can only get a test failure if you run the test code with Miri.

The copy+paste into proc_macro does not have any tests. I could also copy+paste the tests from the compiler into it, then also expand https://github.com/rust-lang/miri-test-libstd/ to run its new tests.

The original report is based on misuse of the API so we'd be checking that the test panics and doesn't report UB when run with Miri, but if someone just moves the panicking check around that will make the test always pass even if the UB comes back.

I'd rather not balloon the effort here.

@Kivooeo
Copy link
Copy Markdown
Member

Kivooeo commented Apr 12, 2026

ohhhh, ok cool then

r? me @bors r+ rollup

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented Apr 12, 2026

📌 Commit ff61915 has been approved by Kivooeo

It is now in the queue for this repository.

@rust-bors rust-bors Bot added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Apr 12, 2026
@rust-bors rust-bors Bot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 12, 2026
rust-bors Bot pushed a commit that referenced this pull request Apr 12, 2026
…uwer

Rollup of 5 pull requests

Successful merges:

 - #155197 (miri subtree update)
 - #154804 (Fix ICE when reporting host-effect errors for const Fn HRTBs in next trait solver)
 - #155014 (Hexagon: add scalar arch-version target features (v60-v79, audio))
 - #155068 (Fix ICE in `span_extend_prev_while` with multibyte characters)
 - #155161 (Use Vec::push_mut when adding a chunk to arenas)
@rust-bors rust-bors Bot merged commit bf4d385 into rust-lang:main Apr 12, 2026
11 checks passed
rust-timer added a commit that referenced this pull request Apr 12, 2026
Rollup merge of #155161 - saethlin:push_mut_saves, r=Kivooeo

Use Vec::push_mut when adding a chunk to arenas

This fixes #155148, which may or may not be worth fixing on its own merits, but I think `Vec::push_mut` also makes the code nicer.
@rustbot rustbot added this to the 1.97.0 milestone Apr 12, 2026
Copy link
Copy Markdown
Contributor

@nnethercote nnethercote left a comment

Choose a reason for hiding this comment

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

Yeah, this seems fine.

View changes since this review

@saethlin saethlin deleted the push_mut_saves branch April 13, 2026 00:59
github-actions Bot pushed a commit to rust-lang/miri that referenced this pull request Apr 19, 2026
…uwer

Rollup of 5 pull requests

Successful merges:

 - rust-lang/rust#155197 (miri subtree update)
 - rust-lang/rust#154804 (Fix ICE when reporting host-effect errors for const Fn HRTBs in next trait solver)
 - rust-lang/rust#155014 (Hexagon: add scalar arch-version target features (v60-v79, audio))
 - rust-lang/rust#155068 (Fix ICE in `span_extend_prev_while` with multibyte characters)
 - rust-lang/rust#155161 (Use Vec::push_mut when adding a chunk to arenas)
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

5 participants