Skip to content

Confusing error message when importing * from private modules #9571

New issue

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

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

Already on GitHub? # to your account

Closed
zeux opened this issue Sep 27, 2013 · 1 comment
Closed

Confusing error message when importing * from private modules #9571

zeux opened this issue Sep 27, 2013 · 1 comment

Comments

@zeux
Copy link

zeux commented Sep 27, 2013

I have two modules, a.rs and b.rs.

a.rs:

#[crate_type = "lib"];

mod test { pub type I = int; }

b.rs:

#[crate_type = "lib"];

extern mod a;
use a::test::*;

fn foo(i: I) {}

I'm compiling it with rustc:

rustc a.rs
rustc -L . b.rs

It used to work, but it now gives the error message:

b.rs:6:10: 6:11 error: use of undeclared type name `I`

However, the problem here is not with I - the problem is with module (adding pub to test module fixes the error). Is it possible to emit an error at 'use a::test::*' instead?

@alexcrichton
Copy link
Member

Closing this in favor of #8215. In moving privacy out of resolve, this should yield a much better error message of type "I" is private instead of a cryptic undeclared type name.

flip1995 pushed a commit to flip1995/rust that referenced this issue Oct 6, 2022
use `is_integer_literal` more

I noticed that we have the `is_integer_literal` function in our `clippy_utils`, yet almost everywhere people still match int literal expressions manually. So I searched for instances to replace and shorten the code a bit.

---

changelog: none
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants