- Notifications
You must be signed in to change notification settings - Fork 13.9k
Open
Labels
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.Category: This is a bug.L-dead_codeLint: dead_codeLint: dead_codeL-false-positiveLint: False positive (should not have fired).Lint: False positive (should not have fired).S-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueStatus: A Minimal Complete and Verifiable Example has been found for this issueT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
Code
git clone https://salsa.debian.org/dgit-team/tag2upload-service-manager.git -b 2025-10-26-unused-false-positive # commitid a52ede5c5ed44708c53e509ba26cfa8cd1c5eaee cd tag2upload-service-manager/ env -u http_proxy cargo +stable test --locked --all-features --all-targets --workspace -- t_comprehensive # Note, there will be a *great deal* of output; you'll maybe want: env -u http_proxy cargo +stable test --locked --all-features --all-targets --workspace -- t_comprehensive >log 2>&1Current output
warning: struct `Earlier` is never constructed --> src/db_workflow.rs:463:12 | 463 | struct Earlier { | ^^^^^^^ | = note: `#[warn(dead_code)]` on by default [ much other output ] thread 'test::t_comprehensive::comprehensive' panicked at src/db_workflow.rs:526:9: Earlier *was* constructed Earlier { jid: JobId(1), status: Uploaded } note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace [ much other output ]Desired output
It shouldn't print the compiler warning.
Rationale and extra context
This struct very definitely is constructed, as demonstrated by the deliberate crash.
Other cases
Rust Version
rustc 1.90.0 (1159e78c4 2025-09-14) binary: rustc commit-hash: 1159e78c4747b02ef996e55082b704c09b970588 commit-date: 2025-09-14 host: x86_64-unknown-linux-gnu release: 1.90.0 LLVM version: 20.1.8Anything else?
1.88.0 correctly omits this warning. I haven't bisected it.
The bug is still present in today's beta and nightly
(bookworm)rustcargo@zealot:/volatile/rustcargo/d/tag2upload-service-manager$ rustc +beta -vV rustc 1.91.0-beta.10 (f2f881bb9 2025-10-25) binary: rustc commit-hash: f2f881bb99cf03bca0c54b4a0b1209b40b8cc383 commit-date: 2025-10-25 host: x86_64-unknown-linux-gnu release: 1.91.0-beta.10 LLVM version: 21.1.2 (bookworm)rustcargo@zealot:/volatile/rustcargo/d/tag2upload-service-manager$ rustc +nightly -vV rustc 1.93.0-nightly (34f954f9b 2025-10-25) binary: rustc commit-hash: 34f954f9b7cbdb5e9b408bac1c4ff1e88b5f2719 commit-date: 2025-10-25 host: x86_64-unknown-linux-gnu release: 1.93.0-nightly LLVM version: 21.1.3 (bookworm)rustcargo@zealot:/volatile/rustcargo/d/tag2upload-service-manager$ Metadata
Metadata
Assignees
Labels
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.Category: This is a bug.L-dead_codeLint: dead_codeLint: dead_codeL-false-positiveLint: False positive (should not have fired).Lint: False positive (should not have fired).S-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueStatus: A Minimal Complete and Verifiable Example has been found for this issueT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.