-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #71948 - csmoe:issue-61076, r=oli-obk
- Loading branch information
Showing
13 changed files
with
246 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// edition:2018 | ||
|
||
use core::future::Future; | ||
use core::pin::Pin; | ||
use core::task::{Context, Poll}; | ||
|
||
struct T; | ||
|
||
impl Future for T { | ||
type Output = Result<(), ()>; | ||
|
||
fn poll(self: Pin<&mut Self>, _: &mut Context<'_>) -> Poll<Self::Output> { | ||
Poll::Pending | ||
} | ||
} | ||
|
||
async fn foo() -> Result<(), ()> { | ||
Ok(()) | ||
} | ||
|
||
async fn bar() -> Result<(), ()> { | ||
foo()?; //~ ERROR the `?` operator can only be applied to values that implement `std::ops::Try` | ||
Ok(()) | ||
} | ||
|
||
async fn baz() -> Result<(), ()> { | ||
let t = T; | ||
t?; //~ ERROR the `?` operator can only be applied to values that implement `std::ops::Try` | ||
Ok(()) | ||
} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
error[E0277]: the `?` operator can only be applied to values that implement `std::ops::Try` | ||
--> $DIR/issue-61076.rs:22:5 | ||
| | ||
LL | foo()?; | ||
| ^^^^^^ | ||
| | | ||
| the `?` operator cannot be applied to type `impl std::future::Future` | ||
| help: consider using `.await` here: `foo().await?` | ||
| | ||
= help: the trait `std::ops::Try` is not implemented for `impl std::future::Future` | ||
= note: required by `std::ops::Try::into_result` | ||
|
||
error[E0277]: the `?` operator can only be applied to values that implement `std::ops::Try` | ||
--> $DIR/issue-61076.rs:28:5 | ||
| | ||
LL | t?; | ||
| ^^ | ||
| | | ||
| the `?` operator cannot be applied to type `T` | ||
| help: consider using `.await` here: `t.await?` | ||
| | ||
= help: the trait `std::ops::Try` is not implemented for `T` | ||
= note: required by `std::ops::Try::into_result` | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0277`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.