do not require lang item
This commit is contained in:
parent
82117289f2
commit
122e91e330
1 changed files with 8 additions and 1 deletions
|
@ -112,8 +112,15 @@ impl Qualif for NeedsNonConstDrop {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn in_any_value_of_ty(cx: &ConstCx<'_, 'tcx>, ty: Ty<'tcx>) -> bool {
|
fn in_any_value_of_ty(cx: &ConstCx<'_, 'tcx>, ty: Ty<'tcx>) -> bool {
|
||||||
|
let drop_trait = if let Some(did) = cx.tcx.lang_items().drop_trait() {
|
||||||
|
did
|
||||||
|
} else {
|
||||||
|
// there is no way to define a type that needs non-const drop
|
||||||
|
// without having the lang item present.
|
||||||
|
return false;
|
||||||
|
};
|
||||||
let trait_ref = ty::TraitRef {
|
let trait_ref = ty::TraitRef {
|
||||||
def_id: cx.tcx.require_lang_item(hir::LangItem::Drop, None),
|
def_id: drop_trait,
|
||||||
substs: cx.tcx.mk_substs_trait(ty, &[]),
|
substs: cx.tcx.mk_substs_trait(ty, &[]),
|
||||||
};
|
};
|
||||||
let obligation = Obligation::new(
|
let obligation = Obligation::new(
|
||||||
|
|
Loading…
Add table
Reference in a new issue