Open philberty opened 3 years ago
In rustc the ptr::drop_in_place
function is annotated with #[lang = "drop_in_place"]
such that any attempt at getting the MIR of this function results in the drop glue for the respective type being generated and returned. Automatically inserted drops call this function.
ptr::drop_in_place
: https://github.com/rust-lang/rust/blob/5258a74c887f8ae14717e1f98b652b470877ce4e/library/core/src/ptr/mod.rs#L190-L198
drop glue generation: https://github.com/rust-lang/rust/blob/5258a74c887f8ae14717e1f98b652b470877ce4e/compiler/rustc_mir/src/shim.rs#L132-L202
Thanks that's really helpful, this might make me want to bring MIR in for this and #144
The main shim is manually implemented. There is no MIR generated for it. Left a comment on #144.
https://doc.rust-lang.org/std/ops/trait.Drop.html