Skip to content

Commit 5629f7e

Browse files
Add E0470 error explanation
1 parent 980402c commit 5629f7e

File tree

1 file changed

+43
-2
lines changed

1 file changed

+43
-2
lines changed

src/librustc_metadata/diagnostics.rs

+43-2
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ in question exports them.
211211
A working version would be:
212212
213213
```ignore
214-
// In some_crate:
214+
// In some_crate crate:
215215
#[macro_export]
216216
macro_rules! eat {
217217
...
@@ -228,6 +228,48 @@ extern crate some_crate; //ok!
228228
```
229229
"##,
230230

231+
E0470: r##"
232+
A macro listed for reexport was not found.
233+
234+
Erroneous code example:
235+
236+
```compile_fail,E0470
237+
#[macro_reexport(drink, be_merry)]
238+
extern crate collections;
239+
240+
fn main() {
241+
// ...
242+
}
243+
```
244+
245+
Either the listed macro is not contained in the imported crate, or it is not
246+
exported from the given crate.
247+
248+
This could be caused by a typo. Did you misspell the macro's name?
249+
250+
Double-check the names of the macros listed for reexport, and that the crate
251+
in question exports them.
252+
253+
A working version:
254+
255+
```ignore
256+
// In some_crate crate:
257+
#[macro_export]
258+
macro_rules! eat {
259+
...
260+
}
261+
262+
#[macro_export]
263+
macro_rules! drink {
264+
...
265+
}
266+
267+
// In your_crate:
268+
#[macro_reexport(eat, drink)]
269+
extern crate some_crate;
270+
```
271+
"##,
272+
231273
}
232274

233275
register_diagnostics! {
@@ -239,7 +281,6 @@ register_diagnostics! {
239281
E0462, // found staticlib `..` instead of rlib or dylib
240282
E0464, // multiple matching crates for `..`
241283
E0465, // multiple .. candidates for `..` found
242-
E0470, // reexported macro not found
243284
E0519, // local crate and dependency have same (crate-name, disambiguator)
244285
E0523, // two dependencies have same (crate-name, disambiguator) but different SVH
245286
}

0 commit comments

Comments
 (0)