@@ -2208,15 +2208,15 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
22082208 self . tables . borrow_mut ( ) . field_indices_mut ( ) . insert ( hir_id, index) ;
22092209 }
22102210
2211+ fn write_resolution ( & self , hir_id : hir:: HirId , r : Result < ( DefKind , DefId ) , ErrorReported > ) {
2212+ self . tables . borrow_mut ( ) . type_dependent_defs_mut ( ) . insert ( hir_id, r) ;
2213+ }
2214+
22112215 pub fn write_method_call ( & self ,
22122216 hir_id : hir:: HirId ,
22132217 method : MethodCallee < ' tcx > ) {
22142218 debug ! ( "write_method_call(hir_id={:?}, method={:?})" , hir_id, method) ;
2215- self . tables
2216- . borrow_mut ( )
2217- . type_dependent_defs_mut ( )
2218- . insert ( hir_id, Ok ( ( DefKind :: Method , method. def_id ) ) ) ;
2219-
2219+ self . write_resolution ( hir_id, Ok ( ( DefKind :: Method , method. def_id ) ) ) ;
22202220 self . write_substs ( hir_id, method. substs ) ;
22212221
22222222 // When the method is confirmed, the `method.substs` includes
@@ -4724,7 +4724,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
47244724 let result = result. map ( |( _, kind, def_id) | ( kind, def_id) ) ;
47254725
47264726 // Write back the new resolution.
4727- self . tables . borrow_mut ( ) . type_dependent_defs_mut ( ) . insert ( hir_id, result) ;
4727+ self . write_resolution ( hir_id, result) ;
47284728
47294729 ( result. map ( |( kind, def_id) | Res :: Def ( kind, def_id) ) . unwrap_or ( Res :: Err ) , ty)
47304730 }
@@ -4777,7 +4777,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
47774777 } ) ;
47784778
47794779 // Write back the new resolution.
4780- self . tables . borrow_mut ( ) . type_dependent_defs_mut ( ) . insert ( hir_id, result) ;
4780+ self . write_resolution ( hir_id, result) ;
47814781 (
47824782 result. map ( |( kind, def_id) | Res :: Def ( kind, def_id) ) . unwrap_or ( Res :: Err ) ,
47834783 Some ( ty) ,
0 commit comments