store the HirId of the upvar

This commit is contained in:
Niko Matsakis 2018-07-03 06:47:51 -04:00
parent f03c0366ad
commit 37db94d3f2
3 changed files with 6 additions and 2 deletions

View file

@ -30,7 +30,7 @@ impl_stable_hash_for!(struct mir::LocalDecl<'tcx> {
internal,
is_user_variable
});
impl_stable_hash_for!(struct mir::UpvarDecl { debug_name, by_ref, mutability });
impl_stable_hash_for!(struct mir::UpvarDecl { debug_name, var_hir_id, by_ref, mutability });
impl_stable_hash_for!(struct mir::BasicBlockData<'tcx> { statements, terminator, is_cleanup });
impl_stable_hash_for!(struct mir::UnsafetyViolation { source_info, description, kind });
impl_stable_hash_for!(struct mir::UnsafetyCheckResult { violations, unsafe_blocks });

View file

@ -15,7 +15,7 @@
use graphviz::IntoCow;
use hir::def::CtorKind;
use hir::def_id::DefId;
use hir::{self, InlineAsm};
use hir::{self, HirId, InlineAsm};
use middle::region;
use mir::interpret::{EvalErrorKind, Scalar, Value};
use mir::visit::MirVisitable;
@ -785,6 +785,9 @@ impl<'tcx> LocalDecl<'tcx> {
pub struct UpvarDecl {
pub debug_name: Name,
/// `HirId` of the captured variable
pub var_hir_id: ClearCrossCrate<HirId>,
/// If true, the capture is behind a reference.
pub by_ref: bool,

View file

@ -534,6 +534,7 @@ fn construct_fn<'a, 'gcx, 'tcx, A>(hir: Cx<'a, 'gcx, 'tcx>,
};
let mut decl = UpvarDecl {
debug_name: keywords::Invalid.name(),
var_hir_id: ClearCrossCrate::Set(var_hir_id),
by_ref,
mutability: Mutability::Not,
};