Skip to content

Commit 07a646c

Browse files
committed
Leave error reporting of method calls on inference variables to method call checks
1 parent 0379e54 commit 07a646c

15 files changed

+9455
-23
lines changed

compiler/rustc_hir_typeck/src/expr.rs

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

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

log.log

Lines changed: 9414 additions & 0 deletions
Large diffs are not rendered by default.

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/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/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:19:13
2+
--> $DIR/recursive-bound-eval.rs:19: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/issues/issue-2151.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0282]: type annotations needed
44
LL | let x = panic!();
55
| ^
66
LL | x.clone();
7-
| - type must be known at this point
7+
| ----- type must be known at this point
88
|
99
help: consider giving `x` an explicit type
1010
|

tests/ui/issues/issue-7092.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ fn foo(x: Whatever) {
99
//~| expected enum `Whatever`
1010
//~| found enum `Option<_>`
1111
field.access(),
12+
//~^ ERROR: type annotations needed
1213
}
1314
}
1415

tests/ui/issues/issue-7092.stderr

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@ LL | Some(field) =>
99
= note: expected enum `Whatever`
1010
found enum `Option<_>`
1111

12-
error: aborting due to 1 previous error
12+
error[E0282]: type annotations needed
13+
--> $DIR/issue-7092.rs:11:19
14+
|
15+
LL | field.access(),
16+
| ^^^^^^ cannot infer type
17+
18+
error: aborting due to 2 previous errors
1319

14-
For more information about this error, try `rustc --explain E0308`.
20+
Some errors have detailed explanations: E0282, E0308.
21+
For more information about an error, try `rustc --explain E0282`.

tests/ui/lazy-type-alias-impl-trait/branches3.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0282]: type annotations needed
22
--> $DIR/branches3.rs:8:10
33
|
44
LL | |s| s.len()
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
|
@@ -13,7 +13,7 @@ error[E0282]: type annotations needed
1313
--> $DIR/branches3.rs:15:10
1414
|
1515
LL | |s| s.len()
16-
| ^ - type must be known at this point
16+
| ^ --- type must be known at this point
1717
|
1818
help: consider giving this closure parameter an explicit type
1919
|
@@ -24,7 +24,7 @@ error[E0282]: type annotations needed
2424
--> $DIR/branches3.rs:23:10
2525
|
2626
LL | |s| s.len()
27-
| ^ - type must be known at this point
27+
| ^ --- type must be known at this point
2828
|
2929
help: consider giving this closure parameter an explicit type
3030
|
@@ -35,7 +35,7 @@ error[E0282]: type annotations needed
3535
--> $DIR/branches3.rs:30:10
3636
|
3737
LL | |s| s.len()
38-
| ^ - type must be known at this point
38+
| ^ --- type must be known at this point
3939
|
4040
help: consider giving this closure parameter an explicit type
4141
|

0 commit comments

Comments
 (0)