@@ -703,20 +703,20 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
703703
704704 // Get type of value and span where it was previously
705705 // moved.
706- let node_id = self . tcx . hir ( ) . hir_to_node_id ( hir:: HirId {
706+ let hir_id = hir:: HirId {
707707 owner : self . body . value . hir_id . owner ,
708708 local_id : the_move. id
709- } ) ;
709+ } ;
710710 let ( move_span, move_note) = match the_move. kind {
711711 move_data:: Declared => {
712712 unreachable ! ( ) ;
713713 }
714714
715715 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 ) , "" ) ,
717717
718718 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 {
720720 hir:: ExprKind :: Closure ( .., fn_decl_span, _) => fn_decl_span,
721721 ref r => bug ! ( "Captured({:?}) maps to non-closure: {:?}" ,
722722 the_move. id, r) ,
@@ -828,8 +828,8 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
828828 MutabilityViolation => {
829829 let mut db = self . cannot_assign ( error_span, & descr, Origin :: Ast ) ;
830830 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 ) ;
833833 let fn_closure_msg = "`Fn` closures cannot capture their enclosing \
834834 environment for modifications";
835835 match ( self . tcx . sess . source_map ( ) . span_to_snippet ( sp) , & err. cmt . cat ) {
@@ -1120,8 +1120,8 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
11201120 } else {
11211121 "consider changing this closure to take self by mutable reference"
11221122 } ;
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 ) ;
11251125 self . cannot_act_on_capture_in_sharable_fn ( span,
11261126 prefix,
11271127 ( help_span, help_msg) ,
@@ -1362,9 +1362,9 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
13621362 _ => bug ! ( )
13631363 } ;
13641364 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 ) ,
13681368 "consider changing this closure to take \
13691369 self by mutable reference") ;
13701370 }
@@ -1397,8 +1397,8 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
13971397 loan_path : & LoanPath < ' tcx > ,
13981398 out : & mut String ) {
13991399 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 ( ) ) ;
14021402 }
14031403 LpVar ( id) => {
14041404 out. push_str ( & self . tcx . hir ( ) . name ( id) . as_str ( ) ) ;
0 commit comments