@@ -2208,15 +2208,15 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
2208
2208
self . tables . borrow_mut ( ) . field_indices_mut ( ) . insert ( hir_id, index) ;
2209
2209
}
2210
2210
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
+
2211
2215
pub fn write_method_call ( & self ,
2212
2216
hir_id : hir:: HirId ,
2213
2217
method : MethodCallee < ' tcx > ) {
2214
2218
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 ) ) ) ;
2220
2220
self . write_substs ( hir_id, method. substs ) ;
2221
2221
2222
2222
// When the method is confirmed, the `method.substs` includes
@@ -4724,7 +4724,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
4724
4724
let result = result. map ( |( _, kind, def_id) | ( kind, def_id) ) ;
4725
4725
4726
4726
// 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) ;
4728
4728
4729
4729
( result. map ( |( kind, def_id) | Res :: Def ( kind, def_id) ) . unwrap_or ( Res :: Err ) , ty)
4730
4730
}
@@ -4777,7 +4777,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
4777
4777
} ) ;
4778
4778
4779
4779
// 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) ;
4781
4781
(
4782
4782
result. map ( |( kind, def_id) | Res :: Def ( kind, def_id) ) . unwrap_or ( Res :: Err ) ,
4783
4783
Some ( ty) ,
0 commit comments