summaryrefslogtreecommitdiffstats
path: root/tests/ui/suggestions/expected-boxed-future-isnt-pinned.stderr
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:03 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:03 +0000
commit64d98f8ee037282c35007b64c2649055c56af1db (patch)
tree5492bcf97fce41ee1c0b1cc2add283f3e66cdab0 /tests/ui/suggestions/expected-boxed-future-isnt-pinned.stderr
parentAdding debian version 1.67.1+dfsg1-1. (diff)
downloadrustc-64d98f8ee037282c35007b64c2649055c56af1db.tar.xz
rustc-64d98f8ee037282c35007b64c2649055c56af1db.zip
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/suggestions/expected-boxed-future-isnt-pinned.stderr')
-rw-r--r--tests/ui/suggestions/expected-boxed-future-isnt-pinned.stderr94
1 files changed, 94 insertions, 0 deletions
diff --git a/tests/ui/suggestions/expected-boxed-future-isnt-pinned.stderr b/tests/ui/suggestions/expected-boxed-future-isnt-pinned.stderr
new file mode 100644
index 000000000..b1e04dab8
--- /dev/null
+++ b/tests/ui/suggestions/expected-boxed-future-isnt-pinned.stderr
@@ -0,0 +1,94 @@
+error[E0308]: mismatched types
+ --> $DIR/expected-boxed-future-isnt-pinned.rs:11:5
+ |
+LL | fn foo<F: Future<Output=i32> + Send + 'static>(x: F) -> BoxFuture<'static, i32> {
+ | - this type parameter ----------------------- expected `Pin<Box<(dyn Future<Output = i32> + 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<Box<(dyn Future<Output = i32> + 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<F: Future<Output=i32> + Send + 'static>(x: F) -> BoxFuture<'static, i32> {
+ | ----------------------- expected `Pin<Box<(dyn Future<Output = i32> + Send + 'static)>>` because of return type
+LL | Box::new(x)
+ | ^^^^^^^^^^^ expected struct `Pin`, found struct `Box`
+ |
+ = note: expected struct `Pin<Box<(dyn Future<Output = i32> + Send + 'static)>>`
+ found struct `Box<F>`
+ = help: use `Box::pin`
+
+error[E0308]: mismatched types
+ --> $DIR/expected-boxed-future-isnt-pinned.rs:19:14
+ |
+LL | fn baz<F: Future<Output=i32> + 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<dyn Future<Output = i32> + Send>`
+ found type parameter `F`
+note: associated function defined here
+ --> $SRC_DIR/core/src/pin.rs:LL:COL
+
+error[E0277]: `dyn Future<Output = i32> + Send` cannot be unpinned
+ --> $DIR/expected-boxed-future-isnt-pinned.rs:19:14
+ |
+LL | Pin::new(x)
+ | -------- ^ the trait `Unpin` is not implemented for `dyn Future<Output = i32> + Send`
+ | |
+ | required by a bound introduced by this call
+ |
+ = note: consider using `Box::pin`
+note: required by a bound in `Pin::<P>::new`
+ --> $SRC_DIR/core/src/pin.rs:LL:COL
+
+error[E0277]: `dyn Future<Output = i32> + Send` cannot be unpinned
+ --> $DIR/expected-boxed-future-isnt-pinned.rs:24:14
+ |
+LL | Pin::new(Box::new(x))
+ | -------- ^^^^^^^^^^^ the trait `Unpin` is not implemented for `dyn Future<Output = i32> + Send`
+ | |
+ | required by a bound introduced by this call
+ |
+ = note: consider using `Box::pin`
+note: required by a bound in `Pin::<P>::new`
+ --> $SRC_DIR/core/src/pin.rs:LL:COL
+
+error[E0308]: mismatched types
+ --> $DIR/expected-boxed-future-isnt-pinned.rs:28:5
+ |
+LL | / async {
+LL | | 42
+LL | | }
+ | | ^
+ | | |
+ | |_____expected struct `Pin`, found `async` block
+ | arguments to this function are incorrect
+ |
+ = note: expected struct `Pin<Box<dyn Future<Output = i32> + Send>>`
+ found `async` block `[async block@$DIR/expected-boxed-future-isnt-pinned.rs:28:5: 30:6]`
+note: function defined here
+ --> $SRC_DIR/core/src/future/mod.rs:LL:COL
+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`.