-
Notifications
You must be signed in to change notification settings - Fork 13.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add suggestion of similar macro names to macro undefined
error message
#30064
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
|
||
fn main() { | ||
printlx!("oh noes!"); //~ ERROR macro undefined | ||
//~^ HELP did you mean `println`? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion should also include the exclamation. i.e. println!
instead of println
.
Thanks for your feedback! I've implemented your suggestions. |
@bors r+ |
📌 Commit 4bb7cf1 has been approved by |
Fixes #13677 This does the same sort of suggestion for misspelt macros that we already do for misspelt identifiers. Example. Compiling this program: ```rust macro_rules! foo { ($e:expr) => ( $e ) } fn main() { fob!("hello!"); } ``` gives the following error message: ``` /Users/mcp/temp/test.rs:7:5: 7:8 error: macro undefined: 'fob!' /Users/mcp/temp/test.rs:7 fob!("hello!"); ^~~ /Users/mcp/temp/test.rs:7:5: 7:8 help: did you mean `foo`? /Users/mcp/temp/test.rs:7 fob!("hello!"); ``` I had to move the levenshtein distance function into libsyntax for this. Maybe this should live somewhere else (some utility crate?), but I couldn't find a crate to put it in that is imported by libsyntax and the other rustc crates.
⌛ Testing commit 4bb7cf1 with merge 5dc91a7... |
Fixes #13677
This does the same sort of suggestion for misspelt macros that we already do for misspelt identifiers.
Example. Compiling this program:
gives the following error message:
I had to move the levenshtein distance function into libsyntax for this. Maybe this should live somewhere else (some utility crate?), but I couldn't find a crate to put it in that is imported by libsyntax and the other rustc crates.