Skip to content

Commit

Permalink
Avoid unnecessary opaque type errors in borrowck
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewjasper committed Feb 14, 2020
1 parent d9b9f00 commit edee23e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/librustc_mir/borrow_check/mod.rs
Expand Up @@ -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)
Expand Down
5 changes: 5 additions & 0 deletions src/librustc_mir/borrow_check/nll.rs
Expand Up @@ -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 {
Expand Down

0 comments on commit edee23e

Please sign in to comment.