Move misplaced comment
This commit is contained in:
parent
485ae9f2c0
commit
156c9222f5
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user