From 698f8c2f01ea549d77d7dc3338a12e04c11057b9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:02:58 +0200 Subject: Adding upstream version 1.64.0+dfsg1. Signed-off-by: Daniel Baumann --- .../expected-boxed-future-isnt-pinned.stderr | 101 +++++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 src/test/ui/suggestions/expected-boxed-future-isnt-pinned.stderr (limited to 'src/test/ui/suggestions/expected-boxed-future-isnt-pinned.stderr') diff --git a/src/test/ui/suggestions/expected-boxed-future-isnt-pinned.stderr b/src/test/ui/suggestions/expected-boxed-future-isnt-pinned.stderr new file mode 100644 index 000000000..71facf57e --- /dev/null +++ b/src/test/ui/suggestions/expected-boxed-future-isnt-pinned.stderr @@ -0,0 +1,101 @@ +error[E0308]: mismatched types + --> $DIR/expected-boxed-future-isnt-pinned.rs:11:5 + | +LL | fn foo + Send + 'static>(x: F) -> BoxFuture<'static, i32> { + | - this type parameter ----------------------- expected `Pin + Send + 'static)>>` because of return type +LL | // We could instead use an `async` block, but this way we have no std spans. +LL | x + | ^ expected struct `Pin`, found type parameter `F` + | + = note: expected struct `Pin + Send + 'static)>>` + found type parameter `F` +help: you need to pin and box this expression + | +LL | Box::pin(x) + | +++++++++ + + +error[E0308]: mismatched types + --> $DIR/expected-boxed-future-isnt-pinned.rs:15:5 + | +LL | fn bar + Send + 'static>(x: F) -> BoxFuture<'static, i32> { + | ----------------------- expected `Pin + Send + 'static)>>` because of return type +LL | Box::new(x) + | ^^^^^^^^^^^ expected struct `Pin`, found struct `Box` + | + = note: expected struct `Pin + Send + 'static)>>` + found struct `Box` + = help: use `Box::pin` + +error[E0308]: mismatched types + --> $DIR/expected-boxed-future-isnt-pinned.rs:19:14 + | +LL | fn baz + Send + 'static>(x: F) -> BoxFuture<'static, i32> { + | - this type parameter +LL | Pin::new(x) + | -------- ^ expected struct `Box`, found type parameter `F` + | | + | arguments to this function are incorrect + | help: use `Box::pin` to pin and box this expression: `Box::pin` + | + = note: expected struct `Box + Send>` + found type parameter `F` +note: associated function defined here + --> $SRC_DIR/core/src/pin.rs:LL:COL + | +LL | pub const fn new(pointer: P) -> Pin

{ + | ^^^ + +error[E0277]: `dyn Future + Send` cannot be unpinned + --> $DIR/expected-boxed-future-isnt-pinned.rs:19:5 + | +LL | Pin::new(x) + | ^^^^^^^^ the trait `Unpin` is not implemented for `dyn Future + Send` + | + = note: consider using `Box::pin` +note: required by a bound in `Pin::

::new` + --> $SRC_DIR/core/src/pin.rs:LL:COL + | +LL | impl> Pin

{ + | ^^^^^ required by this bound in `Pin::

::new` + +error[E0277]: `dyn Future + Send` cannot be unpinned + --> $DIR/expected-boxed-future-isnt-pinned.rs:24:5 + | +LL | Pin::new(Box::new(x)) + | ^^^^^^^^ the trait `Unpin` is not implemented for `dyn Future + Send` + | + = note: consider using `Box::pin` +note: required by a bound in `Pin::

::new` + --> $SRC_DIR/core/src/pin.rs:LL:COL + | +LL | impl> Pin

{ + | ^^^^^ required by this bound in `Pin::

::new` + +error[E0308]: mismatched types + --> $DIR/expected-boxed-future-isnt-pinned.rs:28:5 + | +LL | fn zap() -> BoxFuture<'static, i32> { + | ----------------------- expected `Pin + Send + 'static)>>` because of return type +LL | / async { +LL | | 42 +LL | | } + | |_____^ expected struct `Pin`, found opaque type + | + ::: $SRC_DIR/core/src/future/mod.rs:LL:COL + | +LL | pub const fn from_generator(gen: T) -> impl Future + | ------------------------------- the found opaque type + | + = note: expected struct `Pin + Send + 'static)>>` + found opaque type `impl Future` +help: you need to pin and box this expression + | +LL ~ Box::pin(async { +LL | 42 +LL ~ }) + | + +error: aborting due to 6 previous errors + +Some errors have detailed explanations: E0277, E0308. +For more information about an error, try `rustc --explain E0277`. -- cgit v1.2.3