Add simple async drop glue generation

Explainer: https://zetanumbers.github.io/book/async-drop-design.html

https://github.com/rust-lang/rust/pull/121801
This commit is contained in:
zetanumbers 2024-02-13 12:31:41 +03:00 committed by Daria Sukhonina
parent 1dea922ea6
commit 24a24ec6ba
40 changed files with 1921 additions and 20 deletions

View file

@ -973,6 +973,7 @@ fn visit_instance_use<'tcx>(
}
}
ty::InstanceDef::DropGlue(_, Some(_))
| ty::InstanceDef::AsyncDropGlueCtorShim(..)
| ty::InstanceDef::VTableShim(..)
| ty::InstanceDef::ReifyShim(..)
| ty::InstanceDef::ClosureOnceShim { .. }

View file

@ -625,7 +625,8 @@ fn characteristic_def_id_of_mono_item<'tcx>(
| ty::InstanceDef::Virtual(..)
| ty::InstanceDef::CloneShim(..)
| ty::InstanceDef::ThreadLocalShim(..)
| ty::InstanceDef::FnPtrAddrShim(..) => return None,
| ty::InstanceDef::FnPtrAddrShim(..)
| ty::InstanceDef::AsyncDropGlueCtorShim(..) => return None,
};
// If this is a method, we want to put it into the same module as
@ -769,7 +770,9 @@ fn mono_item_visibility<'tcx>(
};
let def_id = match instance.def {
InstanceDef::Item(def_id) | InstanceDef::DropGlue(def_id, Some(_)) => def_id,
InstanceDef::Item(def_id)
| InstanceDef::DropGlue(def_id, Some(_))
| InstanceDef::AsyncDropGlueCtorShim(def_id, _) => def_id,
// We match the visibility of statics here
InstanceDef::ThreadLocalShim(def_id) => {