Skip to content
/ rust Public
forked from rust-lang/rust

Commit a1b38aa

Browse files
committed
move variable initialization
1 parent 978c659 commit a1b38aa

File tree

1 file changed

+4
-7
lines changed
  • compiler/rustc_borrowck/src

1 file changed

+4
-7
lines changed

compiler/rustc_borrowck/src/lib.rs

+4-7
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,9 @@ fn do_mir_borrowck<'tcx>(
141141
) -> (BorrowCheckResult<'tcx>, Option<Box<BodyWithBorrowckFacts<'tcx>>>) {
142142
let def = input_body.source.def_id().expect_local();
143143
let infcx = BorrowckInferCtxt::new(tcx, def);
144+
if let Some(e) = input_body.tainted_by_errors {
145+
infcx.set_tainted_by_errors(e);
146+
}
144147

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

165-
let diags = &mut diags::BorrowckDiags::new();
166-
167-
// Gather the upvars of a closure, if any.
168-
if let Some(e) = input_body.tainted_by_errors {
169-
infcx.set_tainted_by_errors(e);
170-
}
171-
172168
// Replace all regions with fresh inference variables. This
173169
// requires first making our own copy of the MIR. This copy will
174170
// be modified (in place) to contain non-lexical lifetimes. It
@@ -224,6 +220,7 @@ fn do_mir_borrowck<'tcx>(
224220

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

229226
let movable_coroutine =

0 commit comments

Comments
 (0)