1
Fork 0

Add helper for when we want to know if an item has a host param

This commit is contained in:
Michael Goulet 2024-01-08 01:00:31 +00:00
parent fde0e98247
commit e651f6f029
4 changed files with 13 additions and 10 deletions

View file

@ -157,9 +157,7 @@ impl Qualif for NeedsNonConstDrop {
// FIXME(effects): If `destruct` is not a `const_trait`,
// or effects are disabled in this crate, then give up.
let destruct_def_id = cx.tcx.require_lang_item(LangItem::Destruct, Some(cx.body.span));
if cx.tcx.generics_of(destruct_def_id).host_effect_index.is_none()
|| !cx.tcx.features().effects
{
if !cx.tcx.has_host_param(destruct_def_id) || !cx.tcx.features().effects {
return NeedsDrop::in_any_value_of_ty(cx, ty);
}