-
Notifications
You must be signed in to change notification settings - Fork 13k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't update entries
in TypedArena
if T does not need drop
#78144
Conversation
Hmm, this makes me wonder whether we could make the This way we don't get into situations like this where we accidentally use a field that is never touched. Maybe this is overkill? But it feels kind of nice to me. What do you think? |
I don't think I want to make TypedArena any more complicated, just to save 4-8 bytes in like 3 (well, the query system makes it actually hard to say, how many) places. I think I've already introduced enough complexity :) But I can try and think of a solution if complexity is not a huge concern. |
The bytes aren't really the issue here, but the uses of the field. Though I guess you're right about complexity. So... I guess leave a comment on that |
b2f66d3
to
2705cae
Compare
@bors r+ rollup Thanks! |
📌 Commit 2705cae has been approved by |
Don't update `entries` in `TypedArena` if T does not need drop As far as I can tell, `entries` is only used when dropping `TypedArenaChunk`s and their contents. It is already ignored there, if T is not `mem::needs_drop`, this PR just skips updating it's value. You can see `TypedArenaChunk` ignoring the entry count in L71. The reasoning is similar to what you can find in `DroplessArena`. r? @oli-obk
…laumeGomez Rollup of 9 pull requests Successful merges: - rust-lang#78046 (Add codegen test for issue rust-lang#73827) - rust-lang#78061 (Optimize const value interning for ZST types) - rust-lang#78070 (we can test std and core panic macros together) - rust-lang#78076 (Move orphan module-name/mod.rs files into module-name.rs files) - rust-lang#78129 (Wrapping intrinsics doc links update.) - rust-lang#78133 (Add some MIR-related regression tests) - rust-lang#78144 (Don't update `entries` in `TypedArena` if T does not need drop) - rust-lang#78145 (Drop unneeded `mut`) - rust-lang#78157 (Remove unused type from librustdoc) Failed merges: r? `@ghost`
As far as I can tell,
entries
is only used when droppingTypedArenaChunk
s and their contents. It is already ignored there, if T is notmem::needs_drop
, this PR just skips updating it's value.You can see
TypedArenaChunk
ignoring the entry count in L71. The reasoning is similar to what you can find inDroplessArena
.r? @oli-obk