Skip to content

Drop Order glue #371

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

Open
philberty opened this issue Apr 13, 2021 · 3 comments
Open

Drop Order glue #371

philberty opened this issue Apr 13, 2021 · 3 comments

Comments

@philberty
Copy link
Member

https://doc.rust-lang.org/std/ops/trait.Drop.html

@bjorn3
Copy link

bjorn3 commented Apr 13, 2021

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

@philberty
Copy link
Member Author

Thanks that's really helpful, this might make me want to bring MIR in for this and #144

@bjorn3
Copy link

bjorn3 commented Apr 13, 2021

The main shim is manually implemented. There is no MIR generated for it. Left a comment on #144.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants