fork/rust

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

borsAuto merge of #71868 - Mark-Simulacrum:stable-1.43.1, r=pietroalbini8d69840ab92

1.43.1
1.1 KiB20 linesraw
1error[E0308]: mismatched types
2  --> $DIR/expected-boxed-future-isnt-pinned.rs:11:5
3   |
4LL | fn foo<F: Future<Output=i32> + Send + 'static>(x: F) -> BoxFuture<'static, i32> {
5   |        - this type parameter                            ----------------------- expected `std::pin::Pin<std::boxed::Box<(dyn std::future::Future<Output = i32> + std::marker::Send + 'static)>>` because of return type
6LL |     // We could instead use an `async` block, but this way we have no std spans.
7LL |     x
8   |     ^
9   |     |
10   |     expected struct `std::pin::Pin`, found type parameter `F`
11   |     help: you need to pin and box this expression: `Box::pin(x)`
12   |
13   = note:      expected struct `std::pin::Pin<std::boxed::Box<(dyn std::future::Future<Output = i32> + std::marker::Send + 'static)>>`
14           found type parameter `F`
15   = help: type parameters must be constrained to match other types
16   = note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters
17
18error: aborting due to previous error
19
20For more information about this error, try `rustc --explain E0308`.