Add check on find_best_match_for_name and improve help message for undefined macro
This commit is contained in:
@@ -760,7 +760,12 @@ impl<'a> ExtCtxt<'a> {
|
||||
err: &mut DiagnosticBuilder<'a>) {
|
||||
let names = &self.syntax_env.names;
|
||||
if let Some(suggestion) = find_best_match_for_name(names.iter(), name, None) {
|
||||
err.fileline_help(span, &format!("did you mean `{}!`?", suggestion));
|
||||
if suggestion != name {
|
||||
err.fileline_help(span, &format!("did you mean `{}!`?", suggestion));
|
||||
} else {
|
||||
err.fileline_help(span, &format!("have you added the `#[macro_use]` on the \
|
||||
module/import?"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user