Skip to content

Commit f98f2fc

Browse files
committed
fix rebase
1 parent b182259 commit f98f2fc

File tree

4 files changed

+7
-9
lines changed

4 files changed

+7
-9
lines changed

compiler/rustc_hir_typeck/src/demand.rs

+4-6
Original file line numberDiff line numberDiff line change
@@ -226,12 +226,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
226226
let [hir::PathSegment { ident, args: None, .. }] = p.segments else { return false; };
227227
let hir::def::Res::Local(hir_id) = p.res else { return false; };
228228
let Some(hir::Node::Pat(pat)) = map.find(hir_id) else { return false; };
229-
let parent = map.get_parent_node(pat.hir_id);
230229
let Some(hir::Node::Local(hir::Local {
231230
ty: None,
232231
init: Some(init),
233232
..
234-
})) = map.find(parent) else { return false; };
233+
})) = map.find_parent(pat.hir_id) else { return false; };
235234
let Some(ty) = self.node_ty_opt(init.hir_id) else { return false; };
236235
if ty.is_closure() || init.span.overlaps(expr.span) || pat.span.from_expansion() {
237236
return false;
@@ -285,12 +284,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
285284
// In every expression where the binding is referenced, we will look at that
286285
// expression's type and see if it is where the incorrect found type was fully
287286
// "materialized" and point at it. We will also try to provide a suggestion there.
288-
let parent = map.get_parent_node(binding.hir_id);
289-
if let Some(hir::Node::Expr(expr))
290-
| Some(hir::Node::Stmt(hir::Stmt {
287+
if let Some(hir::Node::Expr(expr)
288+
| hir::Node::Stmt(hir::Stmt {
291289
kind: hir::StmtKind::Expr(expr) | hir::StmtKind::Semi(expr),
292290
..
293-
})) = &map.find(parent)
291+
})) = &map.find_parent(binding.hir_id)
294292
&& let hir::ExprKind::MethodCall(segment, rcvr, args, _span) = expr.kind
295293
&& rcvr.hir_id == binding.hir_id
296294
&& let Some(def_id) = self.typeck_results.borrow().type_dependent_def_id(expr.hir_id)

src/test/ui/type/type-check/point-at-inference-3.fixed

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ fn main() {
66
v.push(0);
77
v.push(1i32); //~ ERROR mismatched types
88
//~^ NOTE expected `i32`, found `u32`
9-
//~| NOTE arguments to this function are incorrect
9+
//~| NOTE arguments to this method are incorrect
1010
//~| NOTE associated function defined here
1111
//~| HELP change the type of the numeric literal from `u32` to `i32`
1212
}

src/test/ui/type/type-check/point-at-inference-3.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ fn main() {
66
v.push(0);
77
v.push(1u32); //~ ERROR mismatched types
88
//~^ NOTE expected `i32`, found `u32`
9-
//~| NOTE arguments to this function are incorrect
9+
//~| NOTE arguments to this method are incorrect
1010
//~| NOTE associated function defined here
1111
//~| HELP change the type of the numeric literal from `u32` to `i32`
1212
}

src/test/ui/type/type-check/point-at-inference-3.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ LL | v.push(0i32);
77
LL | v.push(1u32);
88
| ---- ^^^^ expected `i32`, found `u32`
99
| |
10-
| arguments to this function are incorrect
10+
| arguments to this method are incorrect
1111
|
1212
note: associated function defined here
1313
--> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL

0 commit comments

Comments
 (0)