-
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.
- Loading branch information
1 parent
5e8820c
commit c8b71ef
Showing
4 changed files
with
53 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
//@ edition: 2021 | ||
|
||
struct S { | ||
field: (), | ||
} | ||
|
||
async fn foo() -> S { todo!() } | ||
|
||
fn main() -> Result<(), ()> { | ||
foo().field; | ||
//~^ ERROR no field `field` on type `impl Future<Output = S>` | ||
Ok(()) | ||
} |
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,17 @@ | ||
error[E0609]: no field `field` on type `impl Future<Output = S>` | ||
--> $DIR/field-in-sync.rs:10:11 | ||
| | ||
LL | foo().field; | ||
| ^^^^^ field not available in `impl Future`, but it is available in its `Output` | ||
| | ||
note: this implements `Future` and its output type has the field, but the future cannot be awaited in a synchronous function | ||
--> $DIR/field-in-sync.rs:10:5 | ||
| | ||
LL | fn main() -> Result<(), ()> { | ||
| --------------------------- this is not `async` | ||
LL | foo().field; | ||
| ^^^^^ | ||
|
||
error: aborting due to 1 previous error | ||
|
||
For more information about this error, try `rustc --explain E0609`. |
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