diff options
| -rw-r--r-- | src/librustc_mir/borrow_check/mod.rs | 3 | ||||
| -rw-r--r-- | src/librustc_mir/borrow_check/nll.rs | 5 |
2 files changed, 8 insertions, 0 deletions
diff --git a/src/librustc_mir/borrow_check/mod.rs b/src/librustc_mir/borrow_check/mod.rs index 1843d4bf72d..da9bdc8b4b0 100644 --- a/src/librustc_mir/borrow_check/mod.rs +++ b/src/librustc_mir/borrow_check/mod.rs @@ -136,6 +136,9 @@ fn do_mir_borrowck<'a, 'tcx>( // Gather the upvars of a closure, if any. let tables = tcx.typeck_tables_of(def_id); + if tables.tainted_by_errors { + infcx.set_tainted_by_errors(); + } let upvars: Vec<_> = tables .upvar_list .get(&def_id) diff --git a/src/librustc_mir/borrow_check/nll.rs b/src/librustc_mir/borrow_check/nll.rs index e4e5fe35d7f..4c1ee9582c1 100644 --- a/src/librustc_mir/borrow_check/nll.rs +++ b/src/librustc_mir/borrow_check/nll.rs @@ -282,6 +282,11 @@ pub(in crate::borrow_check) fn compute_regions<'cx, 'tcx>( let (closure_region_requirements, nll_errors) = regioncx.solve(infcx, &body, def_id, polonius_output.clone()); + if !nll_errors.is_empty() { + // Suppress unhelpful extra errors in `infer_opaque_types`. + infcx.set_tainted_by_errors(); + } + let remapped_opaque_tys = regioncx.infer_opaque_types(&infcx, opaque_type_values, body.span); NllOutput { |
