diff options
Diffstat (limited to 'compiler/rustc_ty_utils/src/consts.rs')
-rw-r--r-- | compiler/rustc_ty_utils/src/consts.rs | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/compiler/rustc_ty_utils/src/consts.rs b/compiler/rustc_ty_utils/src/consts.rs index f26352716..b67607a4d 100644 --- a/compiler/rustc_ty_utils/src/consts.rs +++ b/compiler/rustc_ty_utils/src/consts.rs @@ -8,7 +8,7 @@ use rustc_middle::ty::abstract_const::CastKind; use rustc_middle::ty::{self, Expr, TyCtxt, TypeVisitableExt}; use rustc_middle::{mir, thir}; use rustc_span::Span; -use rustc_target::abi::VariantIdx; +use rustc_target::abi::{VariantIdx, FIRST_VARIANT}; use std::iter; @@ -44,7 +44,7 @@ pub(crate) fn destructure_const<'tcx>( let (head, rest) = branches.split_first().unwrap(); (VariantIdx::from_u32(head.unwrap_leaf().try_to_u32().unwrap()), rest) } else { - (VariantIdx::from_u32(0), branches) + (FIRST_VARIANT, branches) }; let fields = &def.variant(variant_idx).fields; let mut field_consts = Vec::with_capacity(fields.len()); @@ -425,7 +425,6 @@ pub fn provide(providers: &mut ty::query::Providers) { *providers = ty::query::Providers { destructure_const, thir_abstract_const: |tcx, def_id| { - let def_id = def_id.expect_local(); if let Some(def) = ty::WithOptConstParam::try_lookup(def_id, tcx) { tcx.thir_abstract_const_of_const_arg(def) } else { |