Skip to content

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

Closed

Description

@dignifiedquire

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

Activity

  1. added
    I-prioritizeIssue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Oct 24, 2023
  2. dignifiedquire commented on Oct 24, 2023

    @dignifiedquire
    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)
    
  3. dignifiedquire commented on Oct 24, 2023

    @dignifiedquire
    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

  4. bvanjoi commented on Oct 24, 2023

    @bvanjoi
    Contributor

    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

  5. Teapot4195 commented on Oct 24, 2023

    @Teapot4195
    Contributor

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

  6. dignifiedquire commented on Oct 24, 2023

    @dignifiedquire
    Author

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

  7. dignifiedquire commented on Oct 24, 2023

    @dignifiedquire
    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.

  8. removed
    I-prioritizeIssue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Oct 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.regression-untriagedUntriaged performance or correctness regression.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions