2019-08-13 03:22:58 +00:00
error[E0308]: mismatched types
--> $DIR/suggest-box.rs:4:47
|
LL | let _x: Box<dyn Fn() -> Result<(), ()>> = || {
2019-11-19 05:00:24 +00:00
| _____________-------------------------------___^
| | |
| | expected due to this
2019-08-13 03:22:58 +00:00
LL | | Err(())?;
LL | | Ok(())
LL | | };
2023-01-03 02:00:33 +00:00
| |_____^ expected `Box<dyn Fn() -> Result<(), ()>>`, found closure
2019-08-13 03:22:58 +00:00
|
2021-01-28 16:01:36 +00:00
= note: expected struct `Box<dyn Fn() -> Result<(), ()>>`
2023-09-09 06:36:50 +00:00
found closure `{closure@$DIR/suggest-box.rs:4:47: 4:49}`
2019-08-13 18:24:08 +00:00
= 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
help: store this in the heap by calling `Box::new`
2019-08-13 03:22:58 +00:00
|
2021-06-22 02:07:19 +00:00
LL ~ let _x: Box<dyn Fn() -> Result<(), ()>> = Box::new(|| {
2019-08-13 03:22:58 +00:00
LL | Err(())?;
LL | Ok(())
2021-06-22 02:07:19 +00:00
LL ~ });
2019-08-13 03:22:58 +00:00
|
2023-11-21 15:44:16 +00:00
error: aborting due to 1 previous error
2019-08-13 03:22:58 +00:00
For more information about this error, try `rustc --explain E0308`.