@@ -91,6 +91,43 @@ You need to link your code to the relevant crate in order to be able to use it
9191well, and you link to them the same way.
9292"## ,
9393
94+ E0466 : r##"
95+ Macro import declarations were malformed.
96+
97+ Erroneous code examples:
98+
99+ ```compile_fail,E0466
100+ #[macro_use(a_macro(another_macro))] // error: invalid import declaration
101+ extern crate some_crate;
102+
103+ #[macro_use(i_want = "some_macros")] // error: invalid import declaration
104+ extern crate another_crate;
105+ ```
106+
107+ This is a syntax error at the level of attribute declarations. The proper
108+ syntax for macro imports is the following:
109+
110+ ```ignore
111+ // In some_crate:
112+ #[macro_export]
113+ macro_rules! get_tacos {
114+ ...
115+ }
116+
117+ #[macro_export]
118+ macro_rules! get_pimientos {
119+ ...
120+ }
121+
122+ // In your crate:
123+ #[macro_use(get_tacos, get_pimientos)] // It imports `get_tacos` and
124+ extern crate some_crate; // `get_pimientos` macros from some_crate.
125+ ```
126+
127+ If you would like to import all exported macros, write `macro_use` with no
128+ arguments.
129+ "## ,
130+
94131}
95132
96133register_diagnostics ! {
@@ -102,7 +139,6 @@ register_diagnostics! {
102139 E0462 , // found staticlib `..` instead of rlib or dylib
103140 E0464 , // multiple matching crates for `..`
104141 E0465 , // multiple .. candidates for `..` found
105- E0466 , // bad macro import
106142 E0467 , // bad macro reexport
107143 E0468 , // an `extern crate` loading macros must be at the crate root
108144 E0469 , // imported macro not found
0 commit comments