diff options
| author | Matthew Jasper <mjjasper1@gmail.com> | 2019-12-28 15:50:06 +0000 |
|---|---|---|
| committer | Matthew Jasper <mjjasper1@gmail.com> | 2020-02-14 22:40:03 +0000 |
| commit | edee23ee25d813547587fdd6bcd3677606839fad (patch) | |
| tree | 32484844ab7390f7a481594ca7e9ff4f1267974a | |
| parent | d9b9f00109aefcaf565c9da3c6fdf9e446f4876c (diff) | |
| download | rust-edee23ee25d813547587fdd6bcd3677606839fad.tar.gz rust-edee23ee25d813547587fdd6bcd3677606839fad.zip | |
Avoid unnecessary opaque type errors in borrowck
| -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 { |
