Skip to content

Commit 37db94d

Browse files
committed
store the HirId of the upvar
1 parent f03c036 commit 37db94d

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

src/librustc/ich/impls_mir.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ impl_stable_hash_for!(struct mir::LocalDecl<'tcx> {
3030
internal,
3131
is_user_variable
3232
});
33-
impl_stable_hash_for!(struct mir::UpvarDecl { debug_name, by_ref, mutability });
33+
impl_stable_hash_for!(struct mir::UpvarDecl { debug_name, var_hir_id, by_ref, mutability });
3434
impl_stable_hash_for!(struct mir::BasicBlockData<'tcx> { statements, terminator, is_cleanup });
3535
impl_stable_hash_for!(struct mir::UnsafetyViolation { source_info, description, kind });
3636
impl_stable_hash_for!(struct mir::UnsafetyCheckResult { violations, unsafe_blocks });

src/librustc/mir/mod.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
use graphviz::IntoCow;
1616
use hir::def::CtorKind;
1717
use hir::def_id::DefId;
18-
use hir::{self, InlineAsm};
18+
use hir::{self, HirId, InlineAsm};
1919
use middle::region;
2020
use mir::interpret::{EvalErrorKind, Scalar, Value};
2121
use mir::visit::MirVisitable;
@@ -785,6 +785,9 @@ impl<'tcx> LocalDecl<'tcx> {
785785
pub struct UpvarDecl {
786786
pub debug_name: Name,
787787

788+
/// `HirId` of the captured variable
789+
pub var_hir_id: ClearCrossCrate<HirId>,
790+
788791
/// If true, the capture is behind a reference.
789792
pub by_ref: bool,
790793

src/librustc_mir/build/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,7 @@ fn construct_fn<'a, 'gcx, 'tcx, A>(hir: Cx<'a, 'gcx, 'tcx>,
534534
};
535535
let mut decl = UpvarDecl {
536536
debug_name: keywords::Invalid.name(),
537+
var_hir_id: ClearCrossCrate::Set(var_hir_id),
537538
by_ref,
538539
mutability: Mutability::Not,
539540
};

0 commit comments

Comments
 (0)