change the type of the argument of drop_in_place lang item to &mut _#154327
change the type of the argument of drop_in_place lang item to &mut _#154327WaffleLapkin wants to merge 10 commits intorust-lang:mainfrom
drop_in_place lang item to &mut _#154327Conversation
|
Oh wow I hadn't expected my wish to be fulfilled before I could even finish my PR that motivated me to express the wish in the first place. :-) ❤️ |
This comment has been minimized.
This comment has been minimized.
281786e to
4842194
Compare
This comment has been minimized.
This comment has been minimized.
794fcf5 to
ea0c913
Compare
This comment has been minimized.
This comment has been minimized.
ea0c913 to
3dda404
Compare
This comment has been minimized.
This comment has been minimized.
3dda404 to
32510c2
Compare
This comment has been minimized.
This comment has been minimized.
|
I like the interpreter changes and renames. Not sure what the status of the rest of the PR is, but if you submit just those as a separate PR I'll r+. |
32510c2 to
487fcc4
Compare
This comment has been minimized.
This comment has been minimized.
487fcc4 to
6e43096
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
…s, r=RalfJung Slightly refactor mplace<->ptr conversions split off of rust-lang#154327 r? RalfJung
9030bb9 to
3bb21d4
Compare
This comment has been minimized.
This comment has been minimized.
…ottmcm Don't try to remove `drop_in_place` calls in `RemoveUnneededDrops` As per my justification in #154327 (comment) r? scottmcm
This comment has been minimized.
This comment has been minimized.
…ottmcm Don't try to remove `drop_in_place` calls in `RemoveUnneededDrops` As per my justification in rust-lang/rust#154327 (comment) r? scottmcm
b8934ff to
e3aaa43
Compare
|
(#155044 is merged, ci is passing, this PR is ready for review again :3) |
Co-authored-by: Ralf Jung <post@ralfj.de>
…ottmcm Don't try to remove `drop_in_place` calls in `RemoveUnneededDrops` As per my justification in rust-lang/rust#154327 (comment) r? scottmcm
|
☔ The latest upstream changes (presumably #155207) made this pull request unmergeable. Please resolve the merge conflicts. |
There was a problem hiding this comment.
Looking over the changes in the async part again -- they seem fairly mechanical, and I assume there's some sort of MIR validation / typeck running which ensures that the types all match. So I'd be happy to sign off on these.
What I really don't know how to review are the gigantic mir-opt test suite diffs. How do you all usually deal with that? @rust-lang/wg-mir-opt @scottmcm @saethlin
| @@ -8,6 +8,8 @@ | |||
| pub fn start(_: isize, _: *const *const u8) -> isize { | |||
| // No item produced for this, it's a no-op drop and so is removed. | |||
| unsafe { | |||
| // FIXME: is not removed on opt-level=0 anymore... | |||
| //~ MONO_ITEM fn std::ptr::drop_in_place::<u32> @@ drop_glue_noop-cgu.0[External] | |||
There was a problem hiding this comment.
So the crucial part that is still tested is that we don't see any drop_glue::<u32>, right? Maybe add a comment explaining that (instead of the FIXME which seems expected with the given mir-opt-level).
| // FIXME: drop_in_place isn't an intrinsic.... | ||
| // This is the interesting thing in this test case: Normally we would | ||
| // not have drop-glue for the unsized [StructWithDtor]. This has to be | ||
| // generated though when the drop_in_place() intrinsic is used. |
There was a problem hiding this comment.
Seems like you can just update the comment then?
| ); | ||
| println!("AsyncUnion::Dropper::poll: {}, {}", unsafe { self.signed }, unsafe { | ||
| self.unsigned | ||
| },); |
There was a problem hiding this comment.
It'd be better to avoid formatting-only changes... and in particular this one here doesn't like it is properly formatted now? This looked a lot better before.
mir-opt diffs look good to me. Most of the diff here is from tests that check that drop-related code is inlined (it is) and then there's a bunch of diff in the specifics of the SourceScope data for PreCodegen tests, and those tests aren't worried about debuginfo. If you can visually exclude those cases, the diff isn't too bad. Also for what it's worth I don't have a lot of patience for these mir-opt diffs for this reason, we have support for FileCheck annotations in mir-opt tests. If something is really that critical, it should be tested for with FileCheck. |
It should, yeah, but is it?^^ Thanks for taking a look. :) @WaffleLapkin looks like we're just one rebase and a few nits away from landing this then. :D |
View all comments
We used to special case
core::ptr::drop_in_placewhen computing LLVM argument attributes with this hack:rust/compiler/rustc_ty_utils/src/abi.rs
Lines 383 to 392 in db5e2dc
This is because even though
drop_in_placetakes a*mut Tit is semantically a&mut T(remember how&mut Selfis passed toDrop::drop). This is apparently relevant for perf.This PR replaces this hack with a simpler solution -- it makes
drop_in_placea thin wrapper around newly addedcore::ptr::drop_glue, which is the actual lang item and takes a&mut T:rust/library/core/src/ptr/mod.rs
Lines 810 to 833 in d2563d5
The rest of the PR is blessing tests and cleaning up things which are not necessary after this change.
One thing that is a bit awkward is that now that
drop_glueis the actual lang item, a lot of the comments referring todrop_in_placeare outdated. Should I try fixing that?I've also changed
async_drop_in_placeto take a&mut T, and it simplified the code handling it a bit. (since it's unstable we don't need to introduce a wrapper)cc @RalfJung
Closes #154274