Const dropping

This commit is contained in:
Deadbeef 2021-09-01 11:06:15 +00:00
parent d9797d23d5
commit 104e40fb74
No known key found for this signature in database
GPG key ID: 027DF9338862ADDD
9 changed files with 141 additions and 28 deletions

View file

@ -1077,6 +1077,10 @@ rustc_queries! {
query needs_drop_raw(env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool {
desc { "computing whether `{}` needs drop", env.value }
}
/// Query backing `Tys::needs_non_const_drop`.
query needs_non_const_drop_raw(env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool {
desc { "computing whether `{}` needs non-const drop", env.value }
}
/// Query backing `TyS::has_significant_drop_raw`.
query has_significant_drop_raw(env: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool {
desc { "computing whether `{}` has a significant drop", env.value }
@ -1101,6 +1105,14 @@ rustc_queries! {
cache_on_disk_if { true }
}
/// A list of types where the ADT requires drop if and only if any of
/// those types require non-const drop. If the ADT is known to always need
/// non-const drop then `Err(AlwaysRequiresDrop)` is returned.
query adt_drop_tys_non_const(def_id: DefId) -> Result<&'tcx ty::List<Ty<'tcx>>, AlwaysRequiresDrop> {
desc { |tcx| "computing when `{}` needs non-const drop", tcx.def_path_str(def_id) }
cache_on_disk_if { true }
}
/// A list of types where the ADT requires drop if and only if any of those types
/// has significant drop. A type marked with the attribute `rustc_insignificant_dtor`
/// is considered to not be significant. A drop is significant if it is implemented