Skip to content

Commit

Permalink
Use IndexVec::from_raw to construct a const IndexVec.
Browse files Browse the repository at this point in the history
  • Loading branch information
nnethercote committed Sep 9, 2024
1 parent 51e1c39 commit d1c55a3
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions compiler/rustc_mir_transform/src/shim.rs
Original file line number Diff line number Diff line change
Expand Up @@ -404,8 +404,7 @@ fn build_thread_local_shim<'tcx>(
let span = tcx.def_span(def_id);
let source_info = SourceInfo::outermost(span);

let mut blocks = IndexVec::with_capacity(1);
blocks.push(BasicBlockData {
let blocks = IndexVec::from_raw(vec![BasicBlockData {
statements: vec![Statement {
source_info,
kind: StatementKind::Assign(Box::new((
Expand All @@ -415,7 +414,7 @@ fn build_thread_local_shim<'tcx>(
}],
terminator: Some(Terminator { source_info, kind: TerminatorKind::Return }),
is_cleanup: false,
});
}]);

new_body(
MirSource::from_instance(instance),
Expand Down

0 comments on commit d1c55a3

Please sign in to comment.