fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #71365 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum4fb7144ed15

1.43.0
1.0 KiB26 linesraw
1error[E0308]: mismatched types
2  --> $DIR/suggest-box.rs:4:47
3   |
4LL |       let _x: Box<dyn Fn() -> Result<(), ()>> = || {
5   |  _____________-------------------------------___^
6   | |             |
7   | |             expected due to this
8LL | |         Err(())?;
9LL | |         Ok(())
10LL | |     };
11   | |_____^ expected struct `std::boxed::Box`, found closure
12   |
13   = note: expected struct `std::boxed::Box<dyn std::ops::Fn() -> std::result::Result<(), ()>>`
14             found closure `[closure@$DIR/suggest-box.rs:4:47: 7:6]`
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
16help: store this in the heap by calling `Box::new`
17   |
18LL |     let _x: Box<dyn Fn() -> Result<(), ()>> = Box::new(|| {
19LL |         Err(())?;
20LL |         Ok(())
21LL |     });
22   |
23
24error: aborting due to previous error
25
26For more information about this error, try `rustc --explain E0308`.