Skip to content

Commit

Permalink
move variable initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
lcnr committed Dec 5, 2024
1 parent 0e98766 commit 17ed6ea
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions compiler/rustc_borrowck/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ fn do_mir_borrowck<'tcx>(
) -> (BorrowCheckResult<'tcx>, Option<Box<BodyWithBorrowckFacts<'tcx>>>) {
let def = input_body.source.def_id().expect_local();
let infcx = BorrowckInferCtxt::new(tcx, def);
if let Some(e) = input_body.tainted_by_errors {
infcx.set_tainted_by_errors(e);
}

let mut local_names = IndexVec::from_elem(None, &input_body.local_decls);
for var_debug_info in &input_body.var_debug_info {
Expand All @@ -162,13 +165,6 @@ fn do_mir_borrowck<'tcx>(
}
}

let diags = &mut diags::BorrowckDiags::new();

// Gather the upvars of a closure, if any.
if let Some(e) = input_body.tainted_by_errors {
infcx.set_tainted_by_errors(e);
}

// Replace all regions with fresh inference variables. This
// requires first making our own copy of the MIR. This copy will
// be modified (in place) to contain non-lexical lifetimes. It
Expand Down Expand Up @@ -224,6 +220,7 @@ fn do_mir_borrowck<'tcx>(

// We also have a `#[rustc_regions]` annotation that causes us to dump
// information.
let diags = &mut diags::BorrowckDiags::new();
nll::dump_annotation(&infcx, body, &regioncx, &opt_closure_req, &opaque_type_values, diags);

let movable_coroutine =
Expand Down

0 comments on commit 17ed6ea

Please sign in to comment.