Skip to content

Commit ff7b1c2

Browse files
authored
Rollup merge of rust-lang#89202 - estebank:infer-call-type, r=oli-obk
Resolve infered types when complaining about unexpected call type ``` error[E0618]: expected function, found `{integer}` --> $DIR/call-block.rs:2:13 | LL | let _ = {42}(); | ^^^^-- | | | call expression requires function ``` instead of ``` error[E0618]: expected function, found `_` --> $DIR/call-block.rs:2:13 | LL | let _ = {42}(); | ^^^^-- | | | call expression requires function ```
2 parents 57897da + 072d107 commit ff7b1c2

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

compiler/rustc_typeck/src/check/callee.rs

+1
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
356356
}
357357
}
358358

359+
let callee_ty = self.resolve_vars_if_possible(callee_ty);
359360
let mut err = type_error_struct!(
360361
self.tcx.sess,
361362
callee_expr.span,

src/test/ui/typeck/call-block.rs

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
fn main() {
2+
let _ = {42}(); //~ ERROR expected function, found `{integer}`
3+
}

src/test/ui/typeck/call-block.stderr

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
error[E0618]: expected function, found `{integer}`
2+
--> $DIR/call-block.rs:2:13
3+
|
4+
LL | let _ = {42}();
5+
| ^^^^--
6+
| |
7+
| call expression requires function
8+
9+
error: aborting due to previous error
10+
11+
For more information about this error, try `rustc --explain E0618`.

0 commit comments

Comments
 (0)