rust-lang / rust-lang/rust-clippy

disallowed methods unreachable warning doesn't fail with -D warnings

Open
#17,007 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-bug
Dominant language
Rust
Stars
13.5k
Forks
2.2k
Avg merge
2d 10h
Merged PRs (30d)
32

Description

Summary

The warning "does not refer to a reachable function" does not cause a nonzero exit status even with -D warnings

Reproducer
Steps
git clone https://gitlab.torproject.org/tpo/core/arti
cd arti
git checkout f7b6a9d27408d07fafce9c90530177abe7b751ab
cargo clippy --locked --all-features --workspace --all-targets -- -D warnings
echo $?
Expected results with #17006 unfixed
warning: `rand::RngExt::random_range` does not refer to a reachable function
 --> /volatile/rustcargo/d/arti/clippy.toml:7:5
  |
7 |     { path = "rand::RngExt::r...fallible if applicable" },
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^...^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = help: add `allow-invalid = true` to the entry to suppress this warning
 
warning: `tor-geoip` (lib test) generated 1 warning

Plus a nonzero exit status.

Actual results
warning: `rand::RngExt::random_range` does not refer to a reachable function
 --> /volatile/rustcargo/d/arti/clippy.toml:7:5
  |
7 |     { path = "rand::RngExt::r...fallible if applicable" },
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^...^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = help: add `allow-invalid = true` to the entry to suppress this warning
 
warning: `tor-geoip` (lib test) generated 1 warning
...
0
Notes

After #17006 is fixed, this repro won't work any more. Presumably an actually-unknown function would cause the same issue, but I haven't checked.

Version
rustc 1.96.0-beta.5 (a5a9a5438 2026-05-01)
binary: rustc
commit-hash: a5a9a5438ba8f6b83523031de99b15c12b44cea4
commit-date: 2026-05-01
host: x86_64-unknown-linux-gnu
release: 1.96.0-beta.5
LLVM version: 22.1.2
Additional Labels

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

Start with the cargo clippy command in the reproducer and the disallowed-method entry in clippy.toml. Trace how the unreachable-function warning is reported and how -D warnings affects the process status, then rerun the supplied workspace command to verify that the warning produces a nonzero exit status.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.