Skip to content

Commit d1c55a3

Browse files
committed
Use IndexVec::from_raw to construct a const IndexVec.
1 parent 51e1c39 commit d1c55a3

File tree

1 file changed

+2
-3
lines changed
  • compiler/rustc_mir_transform/src

1 file changed

+2
-3
lines changed

compiler/rustc_mir_transform/src/shim.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -404,8 +404,7 @@ fn build_thread_local_shim<'tcx>(
404404
let span = tcx.def_span(def_id);
405405
let source_info = SourceInfo::outermost(span);
406406

407-
let mut blocks = IndexVec::with_capacity(1);
408-
blocks.push(BasicBlockData {
407+
let blocks = IndexVec::from_raw(vec![BasicBlockData {
409408
statements: vec![Statement {
410409
source_info,
411410
kind: StatementKind::Assign(Box::new((
@@ -415,7 +414,7 @@ fn build_thread_local_shim<'tcx>(
415414
}],
416415
terminator: Some(Terminator { source_info, kind: TerminatorKind::Return }),
417416
is_cleanup: false,
418-
});
417+
}]);
419418

420419
new_body(
421420
MirSource::from_instance(instance),

0 commit comments

Comments
 (0)