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

Rust beta/nightly has a false positive #[warn(unused_imports)] that's not in stable #39225

Closed
pedrocr opened this issue Jan 21, 2017 · 6 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints

Comments

@pedrocr
Copy link

pedrocr commented Jan 21, 2017

When compiling /~https://github.com/pedrocr/rawloader with rust beta or nightly I get an unused_import warning that's a false positive (the compile fails without that import). The import in question is the following:

/~https://github.com/pedrocr/rawloader/blob/rawloader-0.29.0/src/decoders/ljpeg/decompressors.rs#L3

With stable everything works fine. The import is a little too broad (need to break up that code) and changing it to just the two structs that are needed fixes the warning. Still seems like a bug.

@alexcrichton
Copy link
Member

cc @jseyfried

@sfackler sfackler added the A-diagnostics Area: Messages for errors, warnings, and lints label Jan 21, 2017
@Thinkofname
Copy link

Thinkofname commented Jan 21, 2017

Compiles for me on nightly/beta with that line removed. (Edit: fails on stable though)

It seems the use decoders::ljpeg::*; line is also pulling in basics which is a bit surprising to me because that file just use's it not pub use

Example here https://play.rust-lang.org/?gist=c6b422dfbdfa63519ce0e72f597c5a87&version=nightly&backtrace=0

@pedrocr
Copy link
Author

pedrocr commented Jan 21, 2017

Interesting. Removing that line in beta compiles but not in stable where it fails with the BitPump stuff.

@pedrocr
Copy link
Author

pedrocr commented Jan 21, 2017

Could it be something to do with the two modules requiring each other?

@pedrocr
Copy link
Author

pedrocr commented Jan 21, 2017

I've been able to generate a minimal test case for this and it seems you need this specific situation of a submodule and module including each other. Two modules at the same level including each other doesn't work.

test_nightly_unused_imports.tar.gz

@jseyfried
Copy link
Contributor

jseyfried commented Jan 21, 2017

This was caused by stabilizing RFC 1560 (now in beta), specifically this change and this change.
Due to these changes, use decoders::ljpeg::*; imports everything in basics on beta and nightly (as @Thinkofname pointed out).

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

5 participants