Skip to content

Commit 337bf45

Browse files
committed
Simplify a bit
1 parent bb7d71b commit 337bf45

File tree

1 file changed

+8
-15
lines changed
  • compiler/rustc_mir_build/src/builder

1 file changed

+8
-15
lines changed

compiler/rustc_mir_build/src/builder/scope.rs

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ that contains only loops and breakable blocks. It tracks where a `break`,
8383

8484
use std::mem;
8585

86-
use rustc_abi::Size;
8786
use rustc_data_structures::fx::FxHashMap;
8887
use rustc_hir::HirId;
8988
use rustc_index::{IndexSlice, IndexVec};
@@ -772,22 +771,16 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
772771
user_ty: None,
773772
const_: Const::Ty(
774773
self.thir[value].ty,
775-
ty::Const::new(
774+
ty::Const::new_value(
776775
self.tcx,
777-
ty::ConstKind::Value(ty::Value {
778-
ty: self.thir[value].ty,
779-
valtree: ValTree::from_branches(
776+
ValTree::from_branches(
777+
self.tcx,
778+
Some(ValTree::from_scalar_int(
780779
self.tcx,
781-
Some(ValTree::from_scalar_int(
782-
self.tcx,
783-
ty::ScalarInt::try_from_uint(
784-
variant_index.as_u32(),
785-
Size::from_bits(32),
786-
)
787-
.unwrap(),
788-
)),
789-
),
790-
}),
780+
variant_index.as_u32().into(),
781+
)),
782+
),
783+
self.thir[value].ty,
791784
),
792785
),
793786
}

0 commit comments

Comments
 (0)