Error code E0466

Macro import declaration was malformed.

Erroneous code examples:

#[macro_use(a_macro(another_macro))] // error: invalid import declaration
extern crate core as some_crate;

#[macro_use(i_want = "some_macros")] // error: invalid import declaration
extern crate core as another_crate;
Run

This is a syntax error at the level of attribute declarations. The proper syntax for macro imports is the following:

// In some_crate:
#[macro_export]
macro_rules! get_tacos {
    ...
}

#[macro_export]
macro_rules! get_pimientos {
    ...
}

// In your crate:
#[macro_use(get_tacos, get_pimientos)] // It imports `get_tacos` and
extern crate some_crate;               // `get_pimientos` macros from some_crate
Run

If you would like to import all exported macros, write macro_use with no arguments.

Back to list of error codes