Skip to content

Commit

Permalink
Move misplaced comment
Browse files Browse the repository at this point in the history
  • Loading branch information
tmandry committed Oct 13, 2021
1 parent 485ae9f commit 156c922
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/test/ui/suggestions/expected-boxed-future-isnt-pinned.rs
Expand Up @@ -11,13 +11,13 @@ fn foo<F: Future<Output=i32> + Send + 'static>(x: F) -> BoxFuture<'static, i32>
x //~ ERROR mismatched types
}

// This case is still subpar:
// `Pin::new(x)`: store this in the heap by calling `Box::new`: `Box::new(x)`
// Should suggest changing the code from `Pin::new` to `Box::pin`.
fn bar<F: Future<Output=i32> + Send + 'static>(x: F) -> BoxFuture<'static, i32> {
Box::new(x) //~ ERROR mismatched types
}

// This case is still subpar:
// `Pin::new(x)`: store this in the heap by calling `Box::new`: `Box::new(x)`
// Should suggest changing the code from `Pin::new` to `Box::pin`.
fn baz<F: Future<Output=i32> + Send + 'static>(x: F) -> BoxFuture<'static, i32> {
Pin::new(x) //~ ERROR mismatched types
//~^ ERROR E0277
Expand Down
Expand Up @@ -15,7 +15,7 @@ LL | Box::pin(x)
| +++++++++ +

error[E0308]: mismatched types
--> $DIR/expected-boxed-future-isnt-pinned.rs:18:5
--> $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
Expand Down

0 comments on commit 156c922

Please sign in to comment.