-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Incorrect span for unused import when nested #46576
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
Comments
Confirmed here on 2017-12-17 nightly. |
Run a bisect on this: 91ba8b4 is the first bad commit |
I'll take a shot at fixing this one. Thanks for bisecting the commit @Badel2! |
Hi @petrochenkov - could you try to help @shssoichiro debug this? This looks pretty bad. |
Slightly minimized:
This is a fun issue. "Unused import" warnings are reported either during name resolution (normally) or during type checking (for traits that are potentially implicitly used through method calls). Trait rust/src/librustc/hir/lowering.rs Line 2124 in 4ce6b9a
|
Thanks! I'm attempting to test a fix, however the compiler seems to be taking forever to compile stage1 since I rebased off of master. I'll let everyone know how it goes when (if?) compilation ever finishes. |
Solves incorrect diagnostics for unused or deprecated imports. Closes rust-lang#46576. Deprecated imports had an existing test which asserted the incorrect span. That test has been corrected as part of this commit.
…tebank Pass correct span when lowering grouped imports Solves incorrect diagnostics for unused or deprecated imports. Closes #46576. Deprecated imports had an existing test which asserted the incorrect span. That test has been corrected as part of this commit.
Consider this import:
When BufRead is not used in the code, but BufReader and Read are used, one would expect this error:
Which is what happens on stable. On nighly, however, that does not happen, sometimes we got this error instead:
But sometimes it shows the correct error, and sometimes it shows both errors.
Playground link with minimal example
If you comment out the first function it shows both errors, and if you comment out the second function it shows the stable error.
The text was updated successfully, but these errors were encountered: