Skip to content

Commit d372ec2

Browse files
committed
Simplify a bit
1 parent 826e22f commit d372ec2

File tree

1 file changed

+6
-16
lines changed
  • compiler/rustc_mir_build/src/builder

1 file changed

+6
-16
lines changed

compiler/rustc_mir_build/src/builder/scope.rs

+6-16
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};
@@ -835,22 +834,13 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
835834
user_ty: None,
836835
const_: Const::Ty(
837836
self.thir[value].ty,
838-
ty::Const::new(
837+
ty::Const::new_value(
839838
self.tcx,
840-
ty::ConstKind::Value(ty::Value {
841-
ty: self.thir[value].ty,
842-
valtree: ValTree::from_branches(
843-
self.tcx,
844-
Some(ValTree::from_scalar_int(
845-
self.tcx,
846-
ty::ScalarInt::try_from_uint(
847-
variant_index.as_u32(),
848-
Size::from_bits(32),
849-
)
850-
.unwrap(),
851-
)),
852-
),
853-
}),
839+
ValTree::from_branches(
840+
self.tcx,
841+
[ValTree::from_scalar_int(self.tcx, variant_index.as_u32().into())],
842+
),
843+
self.thir[value].ty,
854844
),
855845
),
856846
}

0 commit comments

Comments
 (0)