@@ -335,7 +335,7 @@ pub trait TypeErrCtxtExt<'tcx> {
335
335
err : & mut Diagnostic ,
336
336
trait_pred : ty:: PolyTraitPredicate < ' tcx > ,
337
337
) ;
338
- fn function_argument_obligation (
338
+ fn note_function_argument_obligation (
339
339
& self ,
340
340
arg_hir_id : HirId ,
341
341
err : & mut Diagnostic ,
@@ -2909,7 +2909,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
2909
2909
ref parent_code,
2910
2910
..
2911
2911
} => {
2912
- self . function_argument_obligation (
2912
+ self . note_function_argument_obligation (
2913
2913
arg_hir_id,
2914
2914
err,
2915
2915
parent_code,
@@ -3141,7 +3141,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
3141
3141
) ;
3142
3142
}
3143
3143
}
3144
- fn function_argument_obligation (
3144
+ fn note_function_argument_obligation (
3145
3145
& self ,
3146
3146
arg_hir_id : HirId ,
3147
3147
err : & mut Diagnostic ,
@@ -3152,12 +3152,9 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
3152
3152
) {
3153
3153
let tcx = self . tcx ;
3154
3154
let hir = tcx. hir ( ) ;
3155
- if let Some ( Node :: Expr ( expr) ) = hir. find ( arg_hir_id) {
3156
- let parent_id = hir. get_parent_item ( arg_hir_id) ;
3157
- let typeck_results: & TypeckResults < ' tcx > = match & self . typeck_results {
3158
- Some ( t) if t. hir_owner == parent_id => t,
3159
- _ => self . tcx . typeck ( parent_id. def_id ) ,
3160
- } ;
3155
+ if let Some ( Node :: Expr ( expr) ) = hir. find ( arg_hir_id)
3156
+ && let Some ( typeck_results) = & self . typeck_results
3157
+ {
3161
3158
if let hir:: Expr { kind : hir:: ExprKind :: Block ( ..) , .. } = expr {
3162
3159
let expr = expr. peel_blocks ( ) ;
3163
3160
let ty = typeck_results. expr_ty_adjusted_opt ( expr) . unwrap_or ( tcx. ty_error ( ) ) ;
@@ -3219,9 +3216,9 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
3219
3216
// If the expression we're calling on is a binding, we want to point at the
3220
3217
// `let` when talking about the type. Otherwise we'll point at every part
3221
3218
// of the method chain with the type.
3222
- self . point_at_chain ( binding_expr, typeck_results, type_diffs, param_env, err) ;
3219
+ self . point_at_chain ( binding_expr, & typeck_results, type_diffs, param_env, err) ;
3223
3220
} else {
3224
- self . point_at_chain ( expr, typeck_results, type_diffs, param_env, err) ;
3221
+ self . point_at_chain ( expr, & typeck_results, type_diffs, param_env, err) ;
3225
3222
}
3226
3223
}
3227
3224
let call_node = hir. find ( call_hir_id) ;
0 commit comments