Skip to content

Tracking issue for inaccessible_extern_crate compatibility lint #36886

Closed
@petrochenkov

Description

@petrochenkov

What is this lint about

Private items cannot be used outside of their module

mod m {
    struct S;
}

use m::S; // <- attempt to access a private item, privacy error is reported

, however, older versions of the compiler erroneously ignored privacy on extern crate items and accepted code like this without errors:

mod m {
    extern crate c;
}

use m::c; // <- attempt to access a private item, privacy error was not reported in earlier compiler versions

#31362 fixed this oversight.

How to fix this warning/error

Mark the extern crate as pub if it's intended to be used from outside of the module it's defined in.

Current status

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.B-unstableBlocker: Implemented in the nightly compiler and unstable.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions