E0773 - Error codes index
Description: Book listing all Rust error codes

# Error code E0773

A builtin-macro was defined more than once.

Erroneous code example:

    #![allow(unused)]
    #![feature(decl_macro)]
    #![feature(rustc_attrs)]

    fn main() {
    #[rustc_builtin_macro]
    pub macro test($item:item) {
        /* compiler built-in */
    }

    mod inner {
        #[rustc_builtin_macro]
        pub macro test($item:item) {
            /* compiler built-in */
        }
    }
    }

To fix the issue, remove the duplicate declaration:

    #![allow(unused)]
    #![feature(decl_macro)]
    #![feature(rustc_attrs)]

    fn main() {
    #[rustc_builtin_macro]
    pub macro test($item:item) {
        /* compiler built-in */
    }
    }

In very rare edge cases, this may happen when loading `core` or `std` twice, once with `check` metadata and once with `build` metadata. For more information, see #75176.