Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"A non-empty glob must import something with the glob's visibility" regression from stable/beta to nightly? #37995

Closed
utkarshkukreti opened this issue Nov 25, 2016 · 4 comments
Labels
A-resolve Area: Name resolution

Comments

@utkarshkukreti
Copy link
Contributor

The following program compiles on:

  • rustc 1.13.0 (2c6933a 2016-11-07)
  • rustc 1.14.0-beta.2 (e627a2e 2016-11-16)

but does not compile on:

  • rustc 1.15.0-nightly (3bf2be9 2016-11-22)
mod foo {
  mod bar {
    pub use super::*;
  }
}

fn main() {}

Error:

rustc 1.15.0-nightly (3bf2be9ce 2016-11-22)
error: A non-empty glob must import something with the glob's visibility
 --> <anon>:3:13
  |
3 |     pub use super::*;
  |             ^^^^^^^^^

error: aborting due to previous error

Tested both locally and on https://play.rust-lang.org/.

I could not find any mention of this here or here.

@utkarshkukreti
Copy link
Contributor Author

Found this while trying to fix https://github.com/utkarshkukreti/speculate.rs for the latest nightly (it only works on nightly). The library adds pub use super::*; to every generated module which probably triggered this.

@sfackler sfackler added the A-resolve Area: Name resolution label Nov 25, 2016
@jseyfried
Copy link
Contributor

@utkarshkukreti Thanks for the report!

This was intentional -- it was caused by #37127, which stabilized RFC 1560 (the error is described in the last paragraph of this section).

This error can always be fixed by removing the pub (i.e. pub use super::*; -> use super::*;).

We would have phased this in with a warning, but we found no breakage on crates.io when we measured it ~1 month ago. The pub use super::*; were probably added after we tested for breakage but before #37127 landed.

@utkarshkukreti
Copy link
Contributor Author

Ah, I had used pub with use super::*; because the following code failed to compile previously (and still fails on Stable):

struct A;
mod foo {
    use super::*;
    mod bar {
        use super::*;
        fn a() -> A {
            A
        }
    }
}

But it looks like it does compile on the new Nightly now, so I'll just use that. Thanks @jseyfried!

@utkarshkukreti
Copy link
Contributor Author

The pub use super::*; were probably added after we tested for breakage but before #37127 landed.

It's been there since January 2015 in my crate but my crate only works on nightly as it's a compiler plugin so it probably isn't tested by Crater.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-resolve Area: Name resolution
Projects
None yet
Development

No branches or pull requests

3 participants