-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Closed
Copy link
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 (playground):
fn main() {
std::process::abort!();
}
The current output is:
error[E0433]: failed to resolve: could not find `abort` in `process`
--> src/main.rs:2:19
|
2 | std::process::abort!();
| ^^^^^ could not find `abort` in `process`
For more information about this error, try `rustc --explain E0433`.
Ideally the output should include:
std::process::abort is not a macro
help: remove `!` to call the function
Motivation
Note that the opposite mistake, trying to use a macro without the !
:
fn main() {
println("Hello")
}
gives:
error[E0423]: expected function, found macro `println`
--> src/main.rs:2:5
|
2 | println("Hello")
| ^^^^^^^ not a function
|
help: use `!` to invoke the macro
|
2 | println!("Hello")
| +
For more information about this error, try `rustc --explain E0423`.
Related issues
This would complement #102601 (suggesting alternative paths when a macro isn't found)
jsha and nyurik
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.