Skip to content

use foo::self should only give one error #42559

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
nrc opened this issue Jun 9, 2017 · 2 comments
Closed

use foo::self should only give one error #42559

nrc opened this issue Jun 9, 2017 · 2 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-resolve Area: Name/path resolution done by `rustc_resolve` specifically E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

Comments

@nrc
Copy link
Member

nrc commented Jun 9, 2017

It currently gives two - one for self outside {} and one for an unknown import. The latter should be silenced.

e.g.,

error[E0429]: `self` imports are only allowed within a { } list
  --> src/librustc_save_analysis/external_data.rs:19:5
   |
19 | use data::self;
   |     ^^^^^^^^^^

error[E0432]: unresolved import `data::self`
  --> src/librustc_save_analysis/external_data.rs:19:5
   |
19 | use data::self;
   |     ^^^^^^^^^^ no `self` in `data`

@nrc nrc added A-diagnostics Area: Messages for errors, warnings, and lints E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. labels Jun 9, 2017
@nrc nrc changed the title use foo::self should only give one error use foo::self should only give one error Jun 9, 2017
@petrochenkov petrochenkov added the A-resolve Area: Name/path resolution done by `rustc_resolve` specifically label Jun 9, 2017
@tommyip
Copy link
Contributor

tommyip commented Jun 9, 2017

I will work on this

@tommyip
Copy link
Contributor

tommyip commented Jun 9, 2017

On an related note, shouldn't there be a lint for use foo::{self}. Maybe say "you can just use use foo."

tommyip added a commit to tommyip/rust that referenced this issue Jun 10, 2017
Currently `use foo::self;` would emit both E0429 and E0432. This
commit silence the latter one (assuming `foo` is a valid module).

Fixes rust-lang#42559
bors added a commit that referenced this issue Jun 10, 2017
Only emit one error for `use foo::self;`

Currently `use foo::self;` would emit both E0429 and E0432. This commit silence the latter one (assuming `foo` is a valid module).

Fixes #42559
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 A-resolve Area: Name/path resolution done by `rustc_resolve` specifically E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
Projects
None yet
Development

No branches or pull requests

3 participants