Avoid unnecessary opaque type errors in borrowck

This commit is contained in:
Matthew Jasper 2019-12-28 15:50:06 +00:00
parent d9b9f00109
commit edee23ee25
2 changed files with 8 additions and 0 deletions

View File

@ -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)

View File

@ -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 {