Skip to content

Commit 0440387

Browse files
committed
Leave error reporting of method calls on inference variables to method call checks
1 parent 985c380 commit 0440387

19 files changed

+40
-30
lines changed

compiler/rustc_hir_typeck/src/expr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1567,7 +1567,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
15671567
) -> Ty<'tcx> {
15681568
let rcvr_t = self.check_expr(rcvr);
15691569
// no need to check for bot/err -- callee does that
1570-
let rcvr_t = self.structurally_resolve_type(rcvr.span, rcvr_t);
1570+
let rcvr_t = self.try_structurally_resolve_type(rcvr.span, rcvr_t);
15711571

15721572
let method = match self.lookup_method(rcvr_t, segment, segment.ident.span, expr, rcvr, args)
15731573
{

tests/ui/closures/deduce-signature/obligation-with-leaking-placeholders.next.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | needs_foo(|x| {
55
| ^
66
...
77
LL | x.to_string();
8-
| - type must be known at this point
8+
| --------- type must be known at this point
99
|
1010
help: consider giving this closure parameter an explicit type
1111
|

tests/ui/impl-trait/call_method_ambiguous.next.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | let mut iter = foo(n - 1, m);
55
| ^^^^^^^^
66
LL |
77
LL | assert_eq!(iter.get(), 1);
8-
| ---- type must be known at this point
8+
| --- type must be known at this point
99
|
1010
help: consider giving `iter` an explicit type
1111
|

tests/ui/impl-trait/call_method_on_inherent_impl.next.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | let x = my_foo();
55
| ^
66
LL |
77
LL | x.my_debug();
8-
| - type must be known at this point
8+
| -------- type must be known at this point
99
|
1010
help: consider giving `x` an explicit type
1111
|

tests/ui/impl-trait/call_method_on_inherent_impl_ref.next.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | let x = my_foo();
55
| ^
66
LL |
77
LL | x.my_debug();
8-
| - type must be known at this point
8+
| -------- type must be known at this point
99
|
1010
help: consider giving `x` an explicit type
1111
|

tests/ui/impl-trait/hidden-type-is-opaque-2.default.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | Thunk::new(|mut cont| {
55
| ^^^^^^^^
66
LL |
77
LL | cont.reify_as();
8-
| ---- type must be known at this point
8+
| -------- type must be known at this point
99
|
1010
help: consider giving this closure parameter an explicit type
1111
|
@@ -19,7 +19,7 @@ LL | Thunk::new(|mut cont| {
1919
| ^^^^^^^^
2020
LL |
2121
LL | cont.reify_as();
22-
| ---- type must be known at this point
22+
| -------- type must be known at this point
2323
|
2424
help: consider giving this closure parameter an explicit type
2525
|

tests/ui/impl-trait/hidden-type-is-opaque-2.next.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | Thunk::new(|mut cont| {
55
| ^^^^^^^^
66
LL |
77
LL | cont.reify_as();
8-
| ---- type must be known at this point
8+
| -------- type must be known at this point
99
|
1010
help: consider giving this closure parameter an explicit type
1111
|
@@ -19,7 +19,7 @@ LL | Thunk::new(|mut cont| {
1919
| ^^^^^^^^
2020
LL |
2121
LL | cont.reify_as();
22-
| ---- type must be known at this point
22+
| -------- type must be known at this point
2323
|
2424
help: consider giving this closure parameter an explicit type
2525
|

tests/ui/impl-trait/method-resolution4.next.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
error[E0282]: type annotations needed
2-
--> $DIR/method-resolution4.rs:13:9
2+
--> $DIR/method-resolution4.rs:13:20
33
|
44
LL | foo(false).next().unwrap();
5-
| ^^^^^^^^^^ cannot infer type
5+
| ^^^^ cannot infer type
66

77
error: aborting due to 1 previous error
88

tests/ui/impl-trait/recursive-bound-eval.next.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
error[E0282]: type annotations needed
2-
--> $DIR/recursive-bound-eval.rs:18:13
2+
--> $DIR/recursive-bound-eval.rs:18:28
33
|
44
LL | move || recursive_fn().parse()
5-
| ^^^^^^^^^^^^^^ cannot infer type
5+
| ^^^^^ cannot infer type
66

77
error: aborting due to 1 previous error
88

tests/ui/inference/need_type_info/incompat-call-after-qualified-path-0.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0282]: type annotations needed
22
--> $DIR/incompat-call-after-qualified-path-0.rs:21:6
33
|
44
LL | f(|a, b| a.cmp(b));
5-
| ^ - type must be known at this point
5+
| ^ --- type must be known at this point
66
|
77
help: consider giving this closure parameter an explicit type
88
|

0 commit comments

Comments
 (0)