]> git.lizzy.rs Git - rust.git/commitdiff
Rollup merge of #101425 - compiler-errors:point-at-ty-param, r=spastorino
authorYuki Okushi <jtitor@2k36.org>
Mon, 5 Sep 2022 23:36:08 +0000 (08:36 +0900)
committerGitHub <noreply@github.com>
Mon, 5 Sep 2022 23:36:08 +0000 (08:36 +0900)
Point at type parameter in plain path expr

Slightly better error message for a kinda unique use case.

1  2 
compiler/rustc_typeck/src/check/fn_ctxt/checks.rs

index 9157b83330dd6ba54a4016cbb02c6c7f68ccd683,2f6d0b19368635e796140e85e73d0388e934c424..311fcaadaa98b3b7bc815f879660f627efc6aaea
@@@ -1812,19 -1780,19 +1812,19 @@@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> 
                              return true;
                          }
                      }
-                     // Notably, we only point to params that are local to the
-                     // item we're checking, since those are the ones we are able
-                     // to look in the final `hir::PathSegment` for. Everything else
-                     // would require a deeper search into the `qpath` than I think
-                     // is worthwhile.
-                     if let Some(param_to_point_at) = param_to_point_at
-                         && self.point_at_path_if_possible(error, def_id, param_to_point_at, qpath)
-                     {
-                         return true;
-                     }
+                 }
+                 // Notably, we only point to params that are local to the
+                 // item we're checking, since those are the ones we are able
+                 // to look in the final `hir::PathSegment` for. Everything else
+                 // would require a deeper search into the `qpath` than I think
+                 // is worthwhile.
+                 if let Some(param_to_point_at) = param_to_point_at
+                     && self.point_at_path_if_possible(error, def_id, param_to_point_at, qpath)
+                 {
+                     return true;
                  }
              }
 -            hir::ExprKind::MethodCall(segment, args, ..) => {
 +            hir::ExprKind::MethodCall(segment, receiver, args, ..) => {
                  for param in [param_to_point_at, fallback_param_to_point_at, self_param_to_point_at]
                      .into_iter()
                      .flatten()