Access upvars through a query.
This commit is contained in:
@@ -202,14 +202,14 @@ fn do_mir_borrowck<'tcx>(
|
||||
let mut errors = error::BorrowckErrors::new(infcx.tcx);
|
||||
|
||||
// Gather the upvars of a closure, if any.
|
||||
let tables = tcx.typeck_opt_const_arg(def);
|
||||
if let Some(e) = tables.tainted_by_errors {
|
||||
if let Some(e) = input_body.tainted_by_errors {
|
||||
infcx.set_tainted_by_errors(e);
|
||||
errors.set_tainted_by_errors(e);
|
||||
}
|
||||
let upvars: Vec<_> = tables
|
||||
.closure_min_captures_flattened(def.did)
|
||||
.map(|captured_place| {
|
||||
let upvars: Vec<_> = tcx
|
||||
.closure_captures(def.did)
|
||||
.iter()
|
||||
.map(|&captured_place| {
|
||||
let capture = captured_place.info.capture_kind;
|
||||
let by_ref = match capture {
|
||||
ty::UpvarCapture::ByValue => false,
|
||||
|
||||
Reference in New Issue
Block a user