We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8211728 commit 122e91eCopy full SHA for 122e91e
compiler/rustc_const_eval/src/transform/check_consts/qualifs.rs
@@ -112,8 +112,15 @@ impl Qualif for NeedsNonConstDrop {
112
}
113
114
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
+ };
122
let trait_ref = ty::TraitRef {
- def_id: cx.tcx.require_lang_item(hir::LangItem::Drop, None),
123
+ def_id: drop_trait,
124
substs: cx.tcx.mk_substs_trait(ty, &[]),
125
};
126
let obligation = Obligation::new(
0 commit comments