PRIVATE_MACRO_USE in rustc_lint_defs::builtin - Rust
Description: The `private_macro_use` lint detects private macros that are imported with `#[macro_use]`.

Skip to main content

## PRIVATE_MACRO_USE

# Static PRIVATE_MACRO_USE

Source

    pub static PRIVATE_MACRO_USE: &Lint

Expand description

The `private_macro_use` lint detects private macros that are imported with `#[macro_use]`.

#### §Example

ⓘ

    // extern_macro.rs
    macro_rules! foo_ { () => {}; }
    use foo_ as foo;

    // code.rs

    #![deny(private_macro_use)]

    #[macro_use]
    extern crate extern_macro;

    fn main() {
        foo!();
    }

This will produce:

    error: cannot find macro `foo` in this scope

#### §Explanation

This lint arises from overlooking visibility checks for macros in an external crate.

This is a future-incompatible lint to transition this to a hard error in the future.