fork/rust

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

borsAuto merge of #67350 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum73528e339aa

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