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

E0308 Expected private type instead of public reexported #33077

Closed
KalitaAlexey opened this issue Apr 18, 2016 · 1 comment
Closed

E0308 Expected private type instead of public reexported #33077

KalitaAlexey opened this issue Apr 18, 2016 · 1 comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints

Comments

@KalitaAlexey
Copy link
Contributor

KalitaAlexey commented Apr 18, 2016

pub mod public_module {
    pub use self::private_module::Value;

    mod private_module {
        pub struct Value {}
    }   

    pub fn accept_value(value: &Value) {
    }   
}

pub struct Value {}

fn main() {
    // main.rs:15:39: 15:48 error: mismatched types:
    // expected `&public_module::private_module::Value`,
    //    found `&Value`
    // (expected struct `public_module::private_module::Value`,
    //     found struct `Value`) [E0308]
    // main.rs:15     self::public_module::accept_value(&Value {});
    self::public_module::accept_value(&Value {});
}

I expect that compiler say one of variants:

expected struct `public_module::Value`

or

expected struct `public_module::private_module::Value`.
note: `public_module::private_module::Value is accessible via public_module::Value

If private entry reexported is available from different places then

expected struct `public_module::private_module::Value`.
note: `public_module::private_module::Value is accessible via:
    * public_module::Value
    * another place

EDIT:
It also relevant for extern crate private types

@Mark-Simulacrum
Copy link
Member

Closing in favor of #21934.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints
Projects
None yet
Development

No branches or pull requests

3 participants