Skip to content

Glob imports ignore extern crate items of parent modules #22146

Closed
@crumblingstatue

Description

@crumblingstatue

It doesn't matter if the extern crate item is public or private, it's ignored in both cases.

Example:

#![feature(libc)]

pub mod foo {
    pub extern crate libc;
    pub mod bar {
        // use foo::libc; // Direct import works
        use foo::*; // Glob import doesn't work
        pub fn bar_fn() {
            let _: libc::c_int;
        }
    }
}

fn main() {
    foo::bar::bar_fn();
}

This gives the error:

<anon>:9:20: 9:31 error: failed to resolve. Use of undeclared type or module `libc`
<anon>:9             let _: libc::c_int;
                            ^~~~~~~~~~~
<anon>:9:20: 9:31 error: use of undeclared type name `libc::c_int`
<anon>:9             let _: libc::c_int;
                            ^~~~~~~~~~~

Note that this is not the same issue as #22145, as it doesn't matter whether the item is public or private.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-resolveArea: Name/path resolution done by `rustc_resolve` specifically

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions