diff --git a/src/07_workarounds/02_return_type.md b/src/07_workarounds/02_return_type.md index 1d97b1a3..8404dccf 100644 --- a/src/07_workarounds/02_return_type.md +++ b/src/07_workarounds/02_return_type.md @@ -42,31 +42,3 @@ function signature with the message "expected `SomeType`, found `OtherType`" usually indicate that one or more return sites are incorrect. A fix to this issue is being tracked in [this bug](https://github.com/rust-lang/rust/issues/54326). - -## `Box` - -Similarly, because the return type from the function signature is not -propagated down correctly, values returned from `async fn` aren't correctly -coerced to their expected type. - -In practice, this means that returning `Box` objects from an -`async fn` requires manually `as`-casting from `Box` to -`Box`. - -This code will result in an error: - -```rust,edition2018,ignore -async fn x() -> Box { - Box::new("foo") -} -``` - -This issue can be worked around by manually casting using `as`: - -```rust,edition2018 -async fn x() -> Box { - Box::new("foo") as Box -} -``` - -A fix to this issue is being tracked in [this bug](https://github.com/rust-lang/rust/issues/60424).