]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_error_codes/src/error_codes/E0773.md
Rollup merge of #92310 - ehuss:rustdoc-ice, r=estebank
[rust.git] / compiler / rustc_error_codes / src / error_codes / E0773.md
1 A builtin-macro was defined more than once.
2
3 Erroneous code example:
4
5 ```compile_fail,E0773
6 #![feature(decl_macro)]
7 #![feature(rustc_attrs)]
8
9 #[rustc_builtin_macro]
10 pub macro test($item:item) {
11     /* compiler built-in */
12 }
13
14 mod inner {
15     #[rustc_builtin_macro]
16     pub macro test($item:item) {
17         /* compiler built-in */
18     }
19 }
20 ```
21
22 To fix the issue, remove the duplicate declaration:
23
24 ```
25 #![feature(decl_macro)]
26 #![feature(rustc_attrs)]
27
28 #[rustc_builtin_macro]
29 pub macro test($item:item) {
30     /* compiler built-in */
31 }
32 ```
33
34 In very rare edge cases, this may happen when loading `core` or `std` twice,
35 once with `check` metadata and once with `build` metadata.
36 For more information, see [#75176].
37
38 [#75176]: https://github.com/rust-lang/rust/pull/75176#issuecomment-683234468