Skip to content

Commit 9a53cee

Browse files
committed
Replace an unnecessary mk_ty call with mk_array.
1 parent a4d3c9a commit 9a53cee

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

compiler/rustc_mir_transform/src/large_enums.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use crate::MirPass;
33
use rustc_data_structures::fx::FxHashMap;
44
use rustc_middle::mir::interpret::AllocId;
55
use rustc_middle::mir::*;
6-
use rustc_middle::ty::{self, AdtDef, Const, ParamEnv, Ty, TyCtxt};
6+
use rustc_middle::ty::{self, AdtDef, ParamEnv, Ty, TyCtxt};
77
use rustc_session::Session;
88
use rustc_target::abi::{HasDataLayout, Size, TagEncoding, Variants};
99

@@ -141,10 +141,7 @@ impl EnumSizeOpt {
141141
self.candidate(tcx, param_env, ty, &mut alloc_cache)?;
142142
let alloc = tcx.global_alloc(alloc_id).unwrap_memory();
143143

144-
let tmp_ty = tcx.mk_ty(ty::Array(
145-
tcx.types.usize,
146-
Const::from_target_usize(tcx, num_variants as u64),
147-
));
144+
let tmp_ty = tcx.mk_array(tcx.types.usize, num_variants as u64);
148145

149146
let size_array_local = local_decls.push(LocalDecl::new(tmp_ty, span));
150147
let store_live = Statement {

0 commit comments

Comments
 (0)