diff options
| author | lcnr <rust@lcnr.de> | 2024-12-05 14:59:08 +0100 |
|---|---|---|
| committer | lcnr <rust@lcnr.de> | 2024-12-17 09:00:28 +0100 |
| commit | a1b38aa4374ef4f25be91723467075aa46f00dcb (patch) | |
| tree | f1bea2be375e074be9038d914ecf03e49727e720 | |
| parent | 978c659b72ed7520332a74321dc8accf48b06d94 (diff) | |
move variable initialization
| -rw-r--r-- | compiler/rustc_borrowck/src/lib.rs | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/compiler/rustc_borrowck/src/lib.rs b/compiler/rustc_borrowck/src/lib.rs index 18b7984e90d..63e20b16f7a 100644 --- a/compiler/rustc_borrowck/src/lib.rs +++ b/compiler/rustc_borrowck/src/lib.rs @@ -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 { @@ -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 @@ -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, ®ioncx, &opt_closure_req, &opaque_type_values, diags); let movable_coroutine = |
