rust-lang / rust-lang/rust

Consider splitting unused_import's glob re-export visibility warning into its own lint

Open
#123,210 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-diagnostics A-lints C-bug L-unused_imports T-compiler T-lang
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

Code
mod foo {
    pub use bar::*;
    mod bar {
        pub(crate) fn baz() {}
    }
}

fn main() {
    foo::baz();
}
Current output
warning: glob import doesn't reexport anything because no candidate is public enough
 --> src/main.rs:2:13
  |
2 |     pub use bar::*;
  |             ^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default
Desired output

No response

Rationale and extra context

An unused import lint feels wrong to be because i am using baz.

Other cases

No response

Rust Version
rustc 1.75.0 (82e1608df 2023-12-21)
binary: rustc
commit-hash: 82e1608dfa6e0b5569232559e3d385fea5a93112
commit-date: 2023-12-21
host: aarch64-apple-darwin
release: 1.75.0
LLVM version: 17.0.6
Anything else?

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue provides a Rust reproducer but names no source file or test. Start by compiling the example and confirming the unused_import warning, then trace the compiler lint handling for glob re-export visibility. Done means deciding and implementing whether this warning belongs in a separate lint, with coverage for the shown case.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.