]> git.lizzy.rs Git - rust.git/blob - src/test/ui/suggestions/suggest-box.stderr
skip if val has ecaping bound vars
[rust.git] / src / test / ui / suggestions / suggest-box.stderr
1 error[E0308]: mismatched types
2   --> $DIR/suggest-box.rs:4:47
3    |
4 LL |       let _x: Box<dyn Fn() -> Result<(), ()>> = || {
5    |  _____________-------------------------------___^
6    | |             |
7    | |             expected due to this
8 LL | |         Err(())?;
9 LL | |         Ok(())
10 LL | |     };
11    | |_____^ expected struct `Box`, found closure
12    |
13    = note: expected struct `Box<dyn Fn() -> Result<(), ()>>`
14              found closure `[closure@$DIR/suggest-box.rs:4:47: 4:49]`
15    = note: for more on the distinction between the stack and the heap, read https://doc.rust-lang.org/book/ch15-01-box.html, https://doc.rust-lang.org/rust-by-example/std/box.html, and https://doc.rust-lang.org/std/boxed/index.html
16 help: store this in the heap by calling `Box::new`
17    |
18 LL ~     let _x: Box<dyn Fn() -> Result<(), ()>> = Box::new(|| {
19 LL |         Err(())?;
20 LL |         Ok(())
21 LL ~     });
22    |
23
24 error: aborting due to previous error
25
26 For more information about this error, try `rustc --explain E0308`.