]> git.lizzy.rs Git - rust.git/commitdiff
fix rebase
authorEsteban Küber <esteban@kuber.com.ar>
Thu, 5 Jan 2023 17:06:34 +0000 (17:06 +0000)
committerEsteban Küber <esteban@kuber.com.ar>
Thu, 5 Jan 2023 17:09:41 +0000 (17:09 +0000)
compiler/rustc_hir_typeck/src/demand.rs
src/test/ui/type/type-check/point-at-inference-3.fixed
src/test/ui/type/type-check/point-at-inference-3.rs
src/test/ui/type/type-check/point-at-inference-3.stderr

index 6cf515cbb0adc2d15cb34e12cefef55970133c08..cf070eb962f09bf46d0def52c36913a839a8116c 100644 (file)
@@ -226,12 +226,11 @@ pub fn point_at_expr_source_of_inferred_type(
         let [hir::PathSegment { ident, args: None, .. }] = p.segments else { return false; };
         let hir::def::Res::Local(hir_id) = p.res else { return false; };
         let Some(hir::Node::Pat(pat)) = map.find(hir_id) else { return false; };
-        let parent = map.get_parent_node(pat.hir_id);
         let Some(hir::Node::Local(hir::Local {
             ty: None,
             init: Some(init),
             ..
-        })) = map.find(parent) else { return false; };
+        })) = map.find_parent(pat.hir_id) else { return false; };
         let Some(ty) = self.node_ty_opt(init.hir_id) else { return false; };
         if ty.is_closure() || init.span.overlaps(expr.span) || pat.span.from_expansion() {
             return false;
@@ -285,12 +284,11 @@ fn visit_expr(&mut self, ex: &'v hir::Expr<'v>) {
             // In every expression where the binding is referenced, we will look at that
             // expression's type and see if it is where the incorrect found type was fully
             // "materialized" and point at it. We will also try to provide a suggestion there.
-            let parent = map.get_parent_node(binding.hir_id);
-            if let Some(hir::Node::Expr(expr))
-            | Some(hir::Node::Stmt(hir::Stmt {
+            if let Some(hir::Node::Expr(expr)
+            | hir::Node::Stmt(hir::Stmt {
                 kind: hir::StmtKind::Expr(expr) | hir::StmtKind::Semi(expr),
                 ..
-            })) = &map.find(parent)
+            })) = &map.find_parent(binding.hir_id)
                 && let hir::ExprKind::MethodCall(segment, rcvr, args, _span) = expr.kind
                 && rcvr.hir_id == binding.hir_id
                 && let Some(def_id) = self.typeck_results.borrow().type_dependent_def_id(expr.hir_id)
index 870f2779b8c481611fa061e7918762f4565fa2cc..1a960133ceba9ab2f858ed0e099c792b91cb24c0 100644 (file)
@@ -6,7 +6,7 @@ fn main() {
     v.push(0);
     v.push(1i32); //~ ERROR mismatched types
     //~^ NOTE expected `i32`, found `u32`
-    //~| NOTE arguments to this function are incorrect
+    //~| NOTE arguments to this method are incorrect
     //~| NOTE associated function defined here
     //~| HELP change the type of the numeric literal from `u32` to `i32`
 }
index a4471e12fc2af33f81779be74eb114ef82bacc67..92910ae1a31141e82618bda673ae8ae6f55e1ae0 100644 (file)
@@ -6,7 +6,7 @@ fn main() {
     v.push(0);
     v.push(1u32); //~ ERROR mismatched types
     //~^ NOTE expected `i32`, found `u32`
-    //~| NOTE arguments to this function are incorrect
+    //~| NOTE arguments to this method are incorrect
     //~| NOTE associated function defined here
     //~| HELP change the type of the numeric literal from `u32` to `i32`
 }
index c373c6722fdd7f97d2a9a0839aeba0b99c8e18fd..999c3148362f615873293e4869fc2cea0682dd8c 100644 (file)
@@ -7,7 +7,7 @@ LL |     v.push(0i32);
 LL |     v.push(1u32);
    |       ---- ^^^^ expected `i32`, found `u32`
    |       |
-   |       arguments to this function are incorrect
+   |       arguments to this method are incorrect
    |
 note: associated function defined here
   --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL