diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:20:39 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:20:39 +0000 |
commit | 1376c5a617be5c25655d0d7cb63e3beaa5a6e026 (patch) | |
tree | 3bb8d61aee02bc7a15eab3f36e3b921afc2075d0 /compiler/rustc_ty_utils/src/consts.rs | |
parent | Releasing progress-linux version 1.69.0+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-1376c5a617be5c25655d0d7cb63e3beaa5a6e026.tar.xz rustc-1376c5a617be5c25655d0d7cb63e3beaa5a6e026.zip |
Merging upstream version 1.70.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
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 { |