about summary refs log tree commit diff
path: root/src/librustc
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-08-25 02:45:01 +0200
committerGitHub <noreply@github.com>2019-08-25 02:45:01 +0200
commit3d4b1135f8f6f1210b3831385e55f2d2caf2252f (patch)
treeb04a3d7acba6c84746390bc9851c21833e2065b7 /src/librustc
parented8e13c2cbd7c27aec7666bf3f4a98fe6bc24f2b (diff)
parent3890befa8ea9def7e1c9c57a321c7b8c9f759f1f (diff)
downloadrust-3d4b1135f8f6f1210b3831385e55f2d2caf2252f.tar.gz
rust-3d4b1135f8f6f1210b3831385e55f2d2caf2252f.zip
Rollup merge of #63833 - estebank:suggest-closure-call, r=petrochenkov
Suggest calling closure with resolved return type when appropriate

Follow up to #63337. CC #63100.

```
error[E0308]: mismatched types
  --> $DIR/fn-or-tuple-struct-without-args.rs:46:20
   |
LL |     let closure = || 42;
   |                   -- closure defined here
LL |     let _: usize = closure;
   |                    ^^^^^^^
   |                    |
   |                    expected usize, found closure
   |                    help: use parentheses to call this closure: `closure()`
   |
   = note: expected type `usize`
              found type `[closure@$DIR/fn-or-tuple-struct-without-args.rs:45:19: 45:24]`
```
Diffstat (limited to 'src/librustc')
-rw-r--r--src/librustc/ty/sty.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/librustc/ty/sty.rs b/src/librustc/ty/sty.rs
index da66fdf5b1b..f41fffe507d 100644
--- a/src/librustc/ty/sty.rs
+++ b/src/librustc/ty/sty.rs
@@ -385,7 +385,7 @@ impl<'tcx> ClosureSubsts<'tcx> {
         let ty = self.closure_sig_ty(def_id, tcx);
         match ty.sty {
             ty::FnPtr(sig) => sig,
-            _ => bug!("closure_sig_ty is not a fn-ptr: {:?}", ty),
+            _ => bug!("closure_sig_ty is not a fn-ptr: {:?}", ty.sty),
         }
     }
 }