Skip to content

Non-modules allowed in module positions in use. #38293

Closed

Description

@SergioBenitez

Consider the following piece of code, which compiles:

mod bar {
    pub fn foo() { }
}

use bar::foo::{self};

fn main() {
    foo();
}

The use declaration is allowed to use foo as a module when foo is actually a function. This should not be allowed.

Further, when foo does exist as a module, regardless of visibility, self incorrectly imports items with the same name in that module:

mod bar {
    mod foo { }
    pub fn foo() { }
}

use bar::foo::{self};

fn main() {
    foo();
}

Activity

  1. self-assigned this
    on Dec 11, 2016
  2. jseyfried commented on Dec 11, 2016

    @jseyfried
    Contributor
  3. added
    A-resolveArea: Name/path resolution done by `rustc_resolve` specifically
    on Dec 11, 2016
  4. jseyfried commented on Dec 12, 2016

    @jseyfried
    Contributor

    Fixed in #38313.

  5. added a commit that references this issue on Jan 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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