Conversation
|
r? @mati865 rustbot has assigned @mati865. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
Nice, but that requires libs review. r? rust-lang/libs |
|
Hmm, maybe not https://godbolt.org/z/Wzhqh9jre. |
| use std::collections::BTreeMap; | ||
|
|
||
| // CHECK-LABEL: @drop_btree | ||
| // CHECK-NOT: dying_next |
There was a problem hiding this comment.
I personally would rather this check for calls to dealloc rather than dying_next, since think I this test could easily become worthless if this method is renamed.
There was a problem hiding this comment.
I switched to dealloc and then tried it on the old and new code and both passed. So I've switched to just checking that the function is only ret void which does catch this regression
There was a problem hiding this comment.
Thank you, I was actually going to also recommend verifying that it fails the previous code, and you're already ahead of that.
|
@rustbot author |
|
Reminder, once the PR becomes ready for a review, use |
This comment has been minimized.
This comment has been minimized.
e93ed22 to
70ff620
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
and that function only match drop_btree exactly. As the previous dealloc also passed on old code so didn't catch the regression
| // ignore-tidy-undocumented-unsafe | ||
| drop(unsafe { ptr::read(self) }.into_iter()) | ||
| if self.root.is_some() { | ||
| // ignore-tidy-undocumented-unsafe |
There was a problem hiding this comment.
I would also prefer to update any missing safety comments when they're relevant.
There was a problem hiding this comment.
Makes sense! Have added a comment now
|
@rustbot ready |
#161375 (code example) shows that drop of an empty BTree map walks the dying_next path and so is not free. I tracked this down to 7b28036 in 1.56.0 using godbolt’s version comparison.
When the Btree map has no root we use the ManuallyDrop to safely drop the allocator early resulting in a free drop and a
retinstead of thedying_nextpath.Includes codegen test which correctly catches the prior dying_next case, which I based on
uninit-aggregate-field.rs.Fixes #161375