1 error[E0308]: mismatched types
2 --> $DIR/expected-boxed-future-isnt-pinned.rs:11:5
4 LL | fn foo<F: Future<Output=i32> + Send + 'static>(x: F) -> BoxFuture<'static, i32> {
5 | - this type parameter ----------------------- expected `Pin<Box<(dyn Future<Output = i32> + Send + 'static)>>` because of return type
6 LL | // We could instead use an `async` block, but this way we have no std spans.
8 | ^ expected struct `Pin`, found type parameter `F`
10 = note: expected struct `Pin<Box<(dyn Future<Output = i32> + Send + 'static)>>`
11 found type parameter `F`
12 help: you need to pin and box this expression
17 error[E0308]: mismatched types
18 --> $DIR/expected-boxed-future-isnt-pinned.rs:15:5
20 LL | fn bar<F: Future<Output=i32> + Send + 'static>(x: F) -> BoxFuture<'static, i32> {
21 | ----------------------- expected `Pin<Box<(dyn Future<Output = i32> + Send + 'static)>>` because of return type
23 | ^^^^^^^^^^^ expected struct `Pin`, found struct `Box`
25 = note: expected struct `Pin<Box<(dyn Future<Output = i32> + Send + 'static)>>`
27 = help: use `Box::pin`
29 error[E0308]: mismatched types
30 --> $DIR/expected-boxed-future-isnt-pinned.rs:19:14
32 LL | fn baz<F: Future<Output=i32> + Send + 'static>(x: F) -> BoxFuture<'static, i32> {
33 | - this type parameter
35 | -------- ^ expected struct `Box`, found type parameter `F`
37 | arguments to this function are incorrect
38 | help: use `Box::pin` to pin and box this expression: `Box::pin`
40 = note: expected struct `Box<dyn Future<Output = i32> + Send>`
41 found type parameter `F`
42 note: associated function defined here
43 --> $SRC_DIR/core/src/pin.rs:LL:COL
45 LL | pub const fn new(pointer: P) -> Pin<P> {
48 error[E0277]: `dyn Future<Output = i32> + Send` cannot be unpinned
49 --> $DIR/expected-boxed-future-isnt-pinned.rs:19:14
52 | -------- ^ the trait `Unpin` is not implemented for `dyn Future<Output = i32> + Send`
54 | required by a bound introduced by this call
56 = note: consider using `Box::pin`
57 note: required by a bound in `Pin::<P>::new`
58 --> $SRC_DIR/core/src/pin.rs:LL:COL
60 LL | impl<P: Deref<Target: Unpin>> Pin<P> {
61 | ^^^^^ required by this bound in `Pin::<P>::new`
63 error[E0277]: `dyn Future<Output = i32> + Send` cannot be unpinned
64 --> $DIR/expected-boxed-future-isnt-pinned.rs:24:14
66 LL | Pin::new(Box::new(x))
67 | -------- ^^^^^^^^^^^ the trait `Unpin` is not implemented for `dyn Future<Output = i32> + Send`
69 | required by a bound introduced by this call
71 = note: consider using `Box::pin`
72 note: required by a bound in `Pin::<P>::new`
73 --> $SRC_DIR/core/src/pin.rs:LL:COL
75 LL | impl<P: Deref<Target: Unpin>> Pin<P> {
76 | ^^^^^ required by this bound in `Pin::<P>::new`
78 error[E0308]: mismatched types
79 --> $DIR/expected-boxed-future-isnt-pinned.rs:28:5
86 | |_____expected struct `Pin`, found `async` block
87 | arguments to this function are incorrect
89 = note: expected struct `Pin<Box<dyn Future<Output = i32> + Send>>`
90 found `async` block `[async block@$DIR/expected-boxed-future-isnt-pinned.rs:28:5: 30:6]`
91 note: function defined here
92 --> $SRC_DIR/core/src/future/mod.rs:LL:COL
94 LL | pub const fn identity_future<O, Fut: Future<Output = O>>(f: Fut) -> Fut {
96 help: you need to pin and box this expression
103 error: aborting due to 6 previous errors
105 Some errors have detailed explanations: E0277, E0308.
106 For more information about an error, try `rustc --explain E0277`.