Skip to content

Incorrect "error: private type in exported type signature" #25260

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

Closed
Diggsey opened this issue May 10, 2015 · 2 comments
Closed

Incorrect "error: private type in exported type signature" #25260

Diggsey opened this issue May 10, 2015 · 2 comments

Comments

@Diggsey
Copy link
Contributor

Diggsey commented May 10, 2015

The following code will fail to compile:

pub trait Test {
    type Result;
}

mod Foo {
    pub struct Ty;
}

struct Bar;

impl Test for Foo::Ty {
    type Result = Bar;
}

fn main() {
}

When in fact no private types are exported.

@alexcrichton
Copy link
Member

This is actually currently working as intended I believe. The definition of a "public signature" is that the type Ty is marked pub, so it's considered a public type subject to the privacy rules. You can find more details in the associated RFC

@Diggsey
Copy link
Contributor Author

Diggsey commented May 10, 2015

If so, that's disappointing. It seriously hinders the ability to make some patterns modular.

In the example, there's no way to access Foo::Ty from the outer scope without making it public, and yet to do so forces other types to be exported from that scope!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants