- 
                Notifications
    You must be signed in to change notification settings 
- Fork 13.9k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
Given the following code:
#[tokio::main]
async fn main() {
    let _: PathBuf = todo!();
}The current output is:
   Compiling playground v0.0.1 (/playground)
error[E0412]: cannot find type `PathBuf` in this scope
 --> src/main.rs:3:12
  |
3 |     let _: PathBuf = todo!();
  |            ^^^^^^^ not found in this scope
  |
help: consider importing this struct
  |
2 | async use std::path::PathBuf;
  |       +++++++++++++++++++++++
For more information about this error, try `rustc --explain E0412`.
error: could not compile `playground` due to previous error
async imports look cool tbh, but that's not valid Rust.
This happens on stable, beta and nightly.
Ideally the use std::path::PathBuf should be placed in line 1 and before the async keyword.
I tried to keep the issue title and description super specific to this situation as I don't have time to investigate with other macros. Feel free to report similar problems so that I can make it more general.
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.