diff options
| author | ggomez <ggomez@ggo.ifr.lan> | 2016-02-16 14:47:37 +0100 |
|---|---|---|
| committer | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2016-02-16 22:30:08 +0100 |
| commit | eca0ab25d867dd493b9a36ceaa7c79d9cb73d088 (patch) | |
| tree | eda9a76e218b8066f394d314901a8f1d615dcfb1 /src/libsyntax/ext | |
| parent | 0bf6394801c9699d1e699f99d3ac62a019d4b1ad (diff) | |
| download | rust-eca0ab25d867dd493b9a36ceaa7c79d9cb73d088.tar.gz rust-eca0ab25d867dd493b9a36ceaa7c79d9cb73d088.zip | |
Add check on find_best_match_for_name and improve help message for undefined macro
Diffstat (limited to 'src/libsyntax/ext')
| -rw-r--r-- | src/libsyntax/ext/base.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index 8fc72418eb0..2a9d96fa861 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -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?")); + } } } } |
