diff options
| -rw-r--r-- | compiler/rustc_middle/src/ty/adt.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_middle/src/ty/mod.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_middle/src/ty/util.rs | 8 | ||||
| -rw-r--r-- | compiler/rustc_trait_selection/src/traits/effects.rs | 2 |
4 files changed, 6 insertions, 8 deletions
diff --git a/compiler/rustc_middle/src/ty/adt.rs b/compiler/rustc_middle/src/ty/adt.rs index cb245c0aec4..00fe5cb0c5d 100644 --- a/compiler/rustc_middle/src/ty/adt.rs +++ b/compiler/rustc_middle/src/ty/adt.rs @@ -236,7 +236,7 @@ impl<'tcx> rustc_type_ir::inherent::AdtDef<TyCtxt<'tcx>> for AdtDef<'tcx> { } fn destructor(self, tcx: TyCtxt<'tcx>) -> Option<AdtDestructorKind> { - Some(match self.destructor(tcx)?.constness { + Some(match tcx.constness(self.destructor(tcx)?.did) { hir::Constness::Const => AdtDestructorKind::Const, hir::Constness::NotConst => AdtDestructorKind::NotConst, }) diff --git a/compiler/rustc_middle/src/ty/mod.rs b/compiler/rustc_middle/src/ty/mod.rs index 0ffaef82f1c..255d464d265 100644 --- a/compiler/rustc_middle/src/ty/mod.rs +++ b/compiler/rustc_middle/src/ty/mod.rs @@ -1119,8 +1119,6 @@ pub struct PseudoCanonicalInput<'tcx, T> { pub struct Destructor { /// The `DefId` of the destructor method pub did: DefId, - /// The constness of the destructor method - pub constness: hir::Constness, } // FIXME: consider combining this definition with regular `Destructor` diff --git a/compiler/rustc_middle/src/ty/util.rs b/compiler/rustc_middle/src/ty/util.rs index 45a7635087e..7743e202aae 100644 --- a/compiler/rustc_middle/src/ty/util.rs +++ b/compiler/rustc_middle/src/ty/util.rs @@ -414,18 +414,18 @@ impl<'tcx> TyCtxt<'tcx> { continue; }; - if let Some((old_item_id, _)) = dtor_candidate { + if let Some(old_item_id) = dtor_candidate { self.dcx() .struct_span_err(self.def_span(item_id), "multiple drop impls found") .with_span_note(self.def_span(old_item_id), "other impl here") .delay_as_bug(); } - dtor_candidate = Some((*item_id, self.impl_trait_header(impl_did).unwrap().constness)); + dtor_candidate = Some(*item_id); } - let (did, constness) = dtor_candidate?; - Some(ty::Destructor { did, constness }) + let did = dtor_candidate?; + Some(ty::Destructor { did }) } /// Calculate the async destructor of a given type. diff --git a/compiler/rustc_trait_selection/src/traits/effects.rs b/compiler/rustc_trait_selection/src/traits/effects.rs index 3c127416cbf..bcb51ff8d01 100644 --- a/compiler/rustc_trait_selection/src/traits/effects.rs +++ b/compiler/rustc_trait_selection/src/traits/effects.rs @@ -263,7 +263,7 @@ fn evaluate_host_effect_for_destruct_goal<'tcx>( .all_fields() .map(|field| ty::TraitRef::new(tcx, destruct_def_id, [field.ty(tcx, args)])) .collect(); - match adt_def.destructor(tcx).map(|dtor| dtor.constness) { + match adt_def.destructor(tcx).map(|dtor| tcx.constness(dtor.did)) { // `Drop` impl exists, but it's not const. Type cannot be `~const Destruct`. Some(hir::Constness::NotConst) => return Err(EvaluationFailure::NoSolution), // `Drop` impl exists, and it's const. Require `Ty: ~const Drop` to hold. |
