Avoid unnecessary opaque type errors in borrowck
This commit is contained in:
parent
d9b9f00109
commit
edee23ee25
@ -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)
|
||||
|
@ -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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user