File tree 2 files changed +31
-1
lines changed
2 files changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -760,7 +760,12 @@ impl<'a> ExtCtxt<'a> {
760
760
err : & mut DiagnosticBuilder < ' a > ) {
761
761
let names = & self . syntax_env . names ;
762
762
if let Some ( suggestion) = find_best_match_for_name ( names. iter ( ) , name, None ) {
763
- err. fileline_help ( span, & format ! ( "did you mean `{}!`?" , suggestion) ) ;
763
+ if suggestion != name {
764
+ err. fileline_help ( span, & format ! ( "did you mean `{}!`?" , suggestion) ) ;
765
+ } else {
766
+ err. fileline_help ( span, & format ! ( "have you added the `#[macro_use]` on the \
767
+ module/import?") ) ;
768
+ }
764
769
}
765
770
}
766
771
}
Original file line number Diff line number Diff line change
1
+ // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2
+ // file at the top-level directory of this distribution and at
3
+ // http://rust-lang.org/COPYRIGHT.
4
+ //
5
+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6
+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7
+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8
+ // option. This file may not be copied, modified, or distributed
9
+ // except according to those terms.
10
+
11
+ // Test macro_undefined issue
12
+
13
+ mod m {
14
+ #[ macro_export]
15
+ macro_rules! kl {
16
+ ( ) => ( )
17
+ }
18
+ }
19
+
20
+ fn main ( ) {
21
+ k ! ( ) ; //~ ERROR macro undefined: 'k!'
22
+ //~^ HELP did you mean `kl!`?
23
+ kl ! ( ) ; //~ ERROR macro undefined: 'kl!'
24
+ //~^ HELP have you added the `#[macro_use]` on the module/import?
25
+ }
You can’t perform that action at this time.
0 commit comments