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

Invalid unused export warning on 1.75.0-nightly (cd674d617 2023-10-24) #117120

Closed
dignifiedquire opened this issue Oct 24, 2023 · 6 comments
Closed
Labels
C-bug Category: This is a bug. regression-untriaged Untriaged performance or correctness regression.

Comments

@dignifiedquire
Copy link

CI started failing for us, without code changes in this area today with nightly

The code is sth like this

mod keys;
pub use keys::*;

and produces

error: unused import: `keys::*`
  --> iroh-sync/src/lib.rs:44:9
   |
44 | pub use keys::*;
   |         ^^^^^^^
   |
   = note: `-D unused-imports` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(unused_imports)]`

but it should not, given that this is a public export in src/lib.rs.

Version with regression

latest update on 2023-10-24, rust version 1.75.0-nightly (cd674d617 2023-10-24)

Logs

CI logs: https://github.com/n0-computer/iroh/actions/runs/6624632107/job/17994903346?pr=1708

@dignifiedquire dignifiedquire added C-bug Category: This is a bug. regression-untriaged Untriaged performance or correctness regression. labels Oct 24, 2023
@rustbot rustbot added I-prioritize Issue: Indicates that prioritization has been requested for this issue. needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Oct 24, 2023
@dignifiedquire
Copy link
Author

Okay, I am very confused, now this got triggered on stable as well: https://github.com/n0-computer/iroh/actions/runs/6625039736/job/17995549252

stable-aarch64-apple-darwin unchanged - rustc 1.73.0 (cc66ad468 2023-10-03)

@dignifiedquire
Copy link
Author

Can reproduce the warning on my local machine using

cargo +nightly --version
cargo 1.75.0-nightly (d2f6a0485 2023-10-20)

but

cargo --version
cargo 1.73.0 (9c4383fb5 2023-08-26)

does not trigger it

@bvanjoi
Copy link
Contributor

bvanjoi commented Oct 24, 2023

This behavior introduced through #116033.

And I think this behavior is indeed expected because iroh-sync::keys::* has been re-exported in iroh-sync::sync so pub use keys::* is not used: https://github.com/n0-computer/iroh/blob/main/iroh-sync/src/sync.rs#L28

@Teapot4195
Copy link
Contributor

Behavior seems correct, just not very obvious why. Maybe the warning should print out why the symbol might be unused?

@dignifiedquire
Copy link
Author

I see, thanks a lot, that was definitely on the confusing side, but glad the compiler catches it now :)

@dignifiedquire
Copy link
Author

Behavior seems correct, just not very obvious why. Maybe the warning should print out why the symbol might be unused?

Agreed, I wonder if it could print out a warning about the shadowing of the reexport.

github-merge-queue bot pushed a commit to n0-computer/iroh that referenced this issue Oct 24, 2023
Actual issue was a double reexport which went unnoticed in older rustc
versions.

Thanks to @bvanjoi in
rust-lang/rust#117120 (comment)
for pointing out the problem
@apiraino apiraino removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Oct 24, 2023
rklaehn pushed a commit to n0-computer/iroh-blobs that referenced this issue Oct 22, 2024
Actual issue was a double reexport which went unnoticed in older rustc
versions.

Thanks to @bvanjoi in
rust-lang/rust#117120 (comment)
for pointing out the problem
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. regression-untriaged Untriaged performance or correctness regression.
Projects
None yet
Development

No branches or pull requests

5 participants