Files
rust/library/core/src
bors 4ddd4538a8 Auto merge of #154327 - WaffleLapkin:drop_in_place_ref, r=RalfJung,scottmcm,saethlin
change the type of the argument of `drop_in_place` lang item to `&mut _`



We used to special case `core::ptr::drop_in_place` when computing LLVM argument attributes with this hack:

https://github.com/rust-lang/rust/blob/db5e2dc248fe5bb26f70d7baec46a3bca9fa3e1d/compiler/rustc_ty_utils/src/abi.rs#L383-L392

This is because even though `drop_in_place` takes a `*mut T` it is semantically a `&mut T` (remember how `&mut Self` is passed to `Drop::drop`). This is apparently relevant for perf.

This PR replaces this hack with a simpler solution -- it makes `drop_in_place` a thin wrapper around newly added `core::ptr::drop_glue`, which is the actual lang item and takes a `&mut T`:

https://github.com/rust-lang/rust/blob/d2563d5003bbecff1efc40c1f5673ceec603825b/library/core/src/ptr/mod.rs#L810-L833

------

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_glue` is the actual lang item, a lot of the comments referring to `drop_in_place` are outdated. Should I try fixing that?

I've also changed `async_drop_in_place` to 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 https://github.com/rust-lang/rust/issues/154274
2026-05-07 00:52:53 +00:00
..
2026-04-13 15:08:04 +07:00
2026-04-14 18:09:15 -04:00
fix
2025-11-27 17:55:34 +07:00
2026-04-24 18:18:08 +06:00
2026-04-28 16:59:56 -03:00
2026-04-22 19:28:44 +08:00
2026-05-05 11:35:29 +02:00
2026-01-26 17:08:00 +00:00
2026-04-14 18:09:15 -04:00
2025-09-01 21:38:26 -04:00
2026-04-14 18:09:15 -04:00
2026-04-27 03:28:16 +00:00
2025-10-20 12:20:15 -06:00
2026-04-04 19:20:32 +02:00
2026-01-23 15:12:47 +07:00
2026-03-25 11:40:27 +07:00
2025-09-07 21:16:35 -07:00
2026-05-05 11:35:29 +02:00
2026-04-28 12:00:48 +02:00
2025-11-12 14:33:41 +01:00
2026-04-23 19:55:51 -07:00
2026-04-14 18:09:15 -04:00
2026-03-10 21:03:30 -06:00