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

Confusing error relating to publicity of tuple struct fields (E0603) #46407

Closed
Restioson opened this issue Nov 30, 2017 · 2 comments
Closed

Confusing error relating to publicity of tuple struct fields (E0603) #46407

Restioson opened this issue Nov 30, 2017 · 2 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-enhancement Category: An issue proposing an enhancement or a PR with one.

Comments

@Restioson
Copy link

Restioson commented Nov 30, 2017

I was struggling with a bit of code I wrote:

// mod_a
pub struct Foo(u64);

// some_other_mod
fn bar() -> ::mod_a::Foo {
    ::mod_a::Foo(10)
}

The error I got was:

error[E0603]: tuple struct `Foo` is private

Playground.

I was tearing my hair out about this -- why do I get this error? It is public?!. SuperCuber on the Rust discord helped me out by suggesting I make the field public, which solved my problem.

However, this error is misleading -- it suggests that the struct itself is private, not the field. There should perhaps be a clarifying note suggesting that the field(s) of the struct might need to be made public. It is worth noting that this error changes when you add a use ::A::Foo: playground

Meta

Affects rust playground nightly, which I assume is using the latest version.

@kennytm kennytm added A-diagnostics Area: Messages for errors, warnings, and lints C-enhancement Category: An issue proposing an enhancement or a PR with one. labels Nov 30, 2017
@petrochenkov
Copy link
Contributor

Same as #39703

@Restioson
Copy link
Author

Restioson commented Nov 30, 2017

Sorry! Right, closing.

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 C-enhancement Category: An issue proposing an enhancement or a PR with one.
Projects
None yet
Development

No branches or pull requests

3 participants