about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--compiler/rustc_typeck/src/check/callee.rs1
-rw-r--r--src/test/ui/typeck/call-block.rs3
-rw-r--r--src/test/ui/typeck/call-block.stderr11
3 files changed, 15 insertions, 0 deletions
diff --git a/compiler/rustc_typeck/src/check/callee.rs b/compiler/rustc_typeck/src/check/callee.rs
index e007d971bb0..4ffb061f7b4 100644
--- a/compiler/rustc_typeck/src/check/callee.rs
+++ b/compiler/rustc_typeck/src/check/callee.rs
@@ -356,6 +356,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
                     }
                 }
 
+                let callee_ty = self.resolve_vars_if_possible(callee_ty);
                 let mut err = type_error_struct!(
                     self.tcx.sess,
                     callee_expr.span,
diff --git a/src/test/ui/typeck/call-block.rs b/src/test/ui/typeck/call-block.rs
new file mode 100644
index 00000000000..0390d7db040
--- /dev/null
+++ b/src/test/ui/typeck/call-block.rs
@@ -0,0 +1,3 @@
+fn main() {
+    let _ = {42}(); //~ ERROR expected function, found `{integer}`
+}
diff --git a/src/test/ui/typeck/call-block.stderr b/src/test/ui/typeck/call-block.stderr
new file mode 100644
index 00000000000..68984bc1c45
--- /dev/null
+++ b/src/test/ui/typeck/call-block.stderr
@@ -0,0 +1,11 @@
+error[E0618]: expected function, found `{integer}`
+  --> $DIR/call-block.rs:2:13
+   |
+LL |     let _ = {42}();
+   |             ^^^^--
+   |             |
+   |             call expression requires function
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0618`.