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

Enum variants are always exported cross-crate #11680

Closed
huonw opened this issue Jan 20, 2014 · 3 comments · Fixed by #14001
Closed

Enum variants are always exported cross-crate #11680

huonw opened this issue Jan 20, 2014 · 3 comments · Fixed by #14001
Labels
A-resolve Area: Path resolution
Milestone

Comments

@huonw
Copy link
Member

huonw commented Jan 20, 2014

// foo.rs
enum Foo {
    Bar(int)
}
extern mod foo;

fn main() {
    println!("{:?}", foo::Bar(1))
}

The above compiles fine, and, adding an explicit priv to Bar emits an error about unnecessary priv.

@huonw
Copy link
Member Author

huonw commented Jan 20, 2014

The above works (i.e. fails to compile) intra-crate, except then we can't make Bar public

mod foo {
    enum Private { pub Public }
}

fn main() { foo::Public; }

complains about Public being inaccessible.

@alexcrichton
Copy link
Member

Nominating, this is a backwards compatibility hazard.

@pnkfelix
Copy link
Member

Assigning 1.0 milestone, P-backcompat-lang.

@pnkfelix pnkfelix added this to the 1.0 milestone Apr 17, 2014
alexcrichton added a commit to alexcrichton/rust that referenced this issue May 6, 2014
The code in resolve erroneously assumed that private enums weren't visited, so
the logic was adjusted to check to see if the enum definition itself was public.

Closes rust-lang#11680
bors added a commit that referenced this issue May 9, 2014
The code in resolve erroneously assumed that private enums weren't visited, so
the logic was adjusted to check to see if the enum definition itself was public.

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

Successfully merging a pull request may close this issue.

3 participants