Skip to content

pub use path then use path silently cancels the reexport #14386

Closed
@tomjakubowski

Description

@tomjakubowski
mod foo {
    pub use self::bar::X;
    #[cfg(bug)]
    use self::bar::X;

    mod bar {
        pub struct X;
    }
}
fn main() {
    let _ = foo::X;
}

Just rustc 14386.rs compiles fine, but rustc --cfg bug 14386.rs fails with:

14386.rs:11:13: 11:19 error: unresolved name `foo::X`.
14386.rs:11     let _ = foo::X;
                        ^~~~~~
error: aborting due to previous error

Original report:

Re-using a re-exported item confuses the visible_private_types lint
pub use sub::Foo;
use sub::Foo;

mod sub {
    pub struct Foo;
}

pub fn blah() -> Foo {
    Foo
}

gives a warning:

private type in exported type signature, #[warn(visible_private_types)] on by default (rust)

Removing the use sub::Foo; line resolves this warning.

Metadata

Metadata

Assignees

No one assigned

    Labels

    E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions