]> git.proxmox.com Git - rustc.git/blob - src/librustc_error_codes/error_codes/E0468.md
New upstream version 1.44.1+dfsg1
[rustc.git] / src / librustc_error_codes / error_codes / E0468.md
1 A non-root module tried to import macros from another crate.
2
3 Example of erroneous code:
4
5 ```compile_fail,E0468
6 mod foo {
7 #[macro_use(debug_assert)] // error: must be at crate root to import
8 extern crate core; // macros from another crate
9 fn run_macro() { debug_assert!(true); }
10 }
11 ```
12
13 Only `extern crate` imports at the crate root level are allowed to import
14 macros.
15
16 Either move the macro import to crate root or do without the foreign macros.
17 This will work:
18
19 ```
20 #[macro_use(debug_assert)] // ok!
21 extern crate core;
22
23 mod foo {
24 fn run_macro() { debug_assert!(true); }
25 }
26 # fn main() {}
27 ```