@@ -703,20 +703,20 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
703
703
704
704
// Get type of value and span where it was previously
705
705
// moved.
706
- let node_id = self . tcx . hir ( ) . hir_to_node_id ( hir:: HirId {
706
+ let hir_id = hir:: HirId {
707
707
owner : self . body . value . hir_id . owner ,
708
708
local_id : the_move. id
709
- } ) ;
709
+ } ;
710
710
let ( move_span, move_note) = match the_move. kind {
711
711
move_data:: Declared => {
712
712
unreachable ! ( ) ;
713
713
}
714
714
715
715
move_data:: MoveExpr |
716
- move_data:: MovePat => ( self . tcx . hir ( ) . span ( node_id ) , "" ) ,
716
+ move_data:: MovePat => ( self . tcx . hir ( ) . span_by_hir_id ( hir_id ) , "" ) ,
717
717
718
718
move_data:: Captured =>
719
- ( match self . tcx . hir ( ) . expect_expr ( node_id ) . node {
719
+ ( match self . tcx . hir ( ) . expect_expr_by_hir_id ( hir_id ) . node {
720
720
hir:: ExprKind :: Closure ( .., fn_decl_span, _) => fn_decl_span,
721
721
ref r => bug ! ( "Captured({:?}) maps to non-closure: {:?}" ,
722
722
the_move. id, r) ,
@@ -828,8 +828,8 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
828
828
MutabilityViolation => {
829
829
let mut db = self . cannot_assign ( error_span, & descr, Origin :: Ast ) ;
830
830
if let mc:: NoteClosureEnv ( upvar_id) = err. cmt . note {
831
- let node_id = self . tcx . hir ( ) . hir_to_node_id ( upvar_id. var_path . hir_id ) ;
832
- let sp = self . tcx . hir ( ) . span ( node_id ) ;
831
+ let hir_id = upvar_id. var_path . hir_id ;
832
+ let sp = self . tcx . hir ( ) . span_by_hir_id ( hir_id ) ;
833
833
let fn_closure_msg = "`Fn` closures cannot capture their enclosing \
834
834
environment for modifications";
835
835
match ( self . tcx . sess . source_map ( ) . span_to_snippet ( sp) , & err. cmt . cat ) {
@@ -1120,8 +1120,8 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
1120
1120
} else {
1121
1121
"consider changing this closure to take self by mutable reference"
1122
1122
} ;
1123
- let node_id = self . tcx . hir ( ) . local_def_id_to_node_id ( id) ;
1124
- let help_span = self . tcx . hir ( ) . span ( node_id ) ;
1123
+ let hir_id = self . tcx . hir ( ) . local_def_id_to_hir_id ( id) ;
1124
+ let help_span = self . tcx . hir ( ) . span_by_hir_id ( hir_id ) ;
1125
1125
self . cannot_act_on_capture_in_sharable_fn ( span,
1126
1126
prefix,
1127
1127
( help_span, help_msg) ,
@@ -1362,9 +1362,9 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
1362
1362
_ => bug ! ( )
1363
1363
} ;
1364
1364
if * kind == ty:: ClosureKind :: Fn {
1365
- let closure_node_id =
1366
- self . tcx . hir ( ) . local_def_id_to_node_id ( upvar_id. closure_expr_id ) ;
1367
- db. span_help ( self . tcx . hir ( ) . span ( closure_node_id ) ,
1365
+ let closure_hir_id =
1366
+ self . tcx . hir ( ) . local_def_id_to_hir_id ( upvar_id. closure_expr_id ) ;
1367
+ db. span_help ( self . tcx . hir ( ) . span_by_hir_id ( closure_hir_id ) ,
1368
1368
"consider changing this closure to take \
1369
1369
self by mutable reference") ;
1370
1370
}
@@ -1397,8 +1397,8 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
1397
1397
loan_path : & LoanPath < ' tcx > ,
1398
1398
out : & mut String ) {
1399
1399
match loan_path. kind {
1400
- LpUpvar ( ty:: UpvarId { var_path : ty:: UpvarPath { hir_id : id} , closure_expr_id : _ } ) => {
1401
- out. push_str ( & self . tcx . hir ( ) . name ( self . tcx . hir ( ) . hir_to_node_id ( id ) ) . as_str ( ) ) ;
1400
+ LpUpvar ( ty:: UpvarId { var_path : ty:: UpvarPath { hir_id : id } , closure_expr_id : _ } ) => {
1401
+ out. push_str ( & self . tcx . hir ( ) . name_by_hir_id ( id ) . as_str ( ) ) ;
1402
1402
}
1403
1403
LpVar ( id) => {
1404
1404
out. push_str ( & self . tcx . hir ( ) . name ( id) . as_str ( ) ) ;
0 commit comments