Skip to content

Commit 122e91e

Browse files
committed
do not require lang item
1 parent 8211728 commit 122e91e

File tree

1 file changed

+8
-1
lines changed
  • compiler/rustc_const_eval/src/transform/check_consts

1 file changed

+8
-1
lines changed

compiler/rustc_const_eval/src/transform/check_consts/qualifs.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,15 @@ impl Qualif for NeedsNonConstDrop {
112112
}
113113

114114
fn in_any_value_of_ty(cx: &ConstCx<'_, 'tcx>, ty: Ty<'tcx>) -> bool {
115+
let drop_trait = if let Some(did) = cx.tcx.lang_items().drop_trait() {
116+
did
117+
} else {
118+
// there is no way to define a type that needs non-const drop
119+
// without having the lang item present.
120+
return false;
121+
};
115122
let trait_ref = ty::TraitRef {
116-
def_id: cx.tcx.require_lang_item(hir::LangItem::Drop, None),
123+
def_id: drop_trait,
117124
substs: cx.tcx.mk_substs_trait(ty, &[]),
118125
};
119126
let obligation = Obligation::new(

0 commit comments

Comments
 (0)