Skip to content

Commit

Permalink
Replace an unnecessary mk_ty call with mk_array.
Browse files Browse the repository at this point in the history
  • Loading branch information
nnethercote committed Feb 14, 2023
1 parent a4d3c9a commit 9a53cee
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions compiler/rustc_mir_transform/src/large_enums.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::MirPass;
use rustc_data_structures::fx::FxHashMap;
use rustc_middle::mir::interpret::AllocId;
use rustc_middle::mir::*;
use rustc_middle::ty::{self, AdtDef, Const, ParamEnv, Ty, TyCtxt};
use rustc_middle::ty::{self, AdtDef, ParamEnv, Ty, TyCtxt};
use rustc_session::Session;
use rustc_target::abi::{HasDataLayout, Size, TagEncoding, Variants};

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

let tmp_ty = tcx.mk_ty(ty::Array(
tcx.types.usize,
Const::from_target_usize(tcx, num_variants as u64),
));
let tmp_ty = tcx.mk_array(tcx.types.usize, num_variants as u64);

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

0 comments on commit 9a53cee

Please sign in to comment.