Skip to content

Wildcard imports from super omit non-public constants and statics. #37434

Closed
@koute

Description

@koute

Please consider the following code:

const CONSTANT: usize = 0;

mod ok {
    use super::CONSTANT;
    fn foobar() -> usize {
        CONSTANT
    }
}

mod error {
    use super::*;
    fn foobar() -> usize {
        CONSTANT
    }
}

The ok::foobar compiles fine while error::foobar generates the following error:

error[E0425]: unresolved name `CONSTANT`
  --> test.rs:13:9
   |
13 |         CONSTANT
   |         ^^^^^^^^ unresolved name

This also affects static.

Marking the constant pub makes it compile as expected.

Meta

rustc 1.14.0-nightly (c59cb71d9 2016-10-26)
binary: rustc
commit-hash: c59cb71d976ceabf00c7da0224a795fab530601e
commit-date: 2016-10-26
host: x86_64-unknown-linux-gnu
release: 1.14.0-nightly
LLVM version: 3.9

1.12.1 is also affected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions