-
Notifications
You must be signed in to change notification settings - Fork 14k
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.D-invalid-suggestionDiagnostics: A structured suggestion resulting in incorrect code.Diagnostics: A structured suggestion resulting in incorrect code.L-false-positiveLint: False positive (should not have fired).Lint: False positive (should not have fired).L-unused_extern_cratesLint: unused_extern_cratesLint: unused_extern_cratesT-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
Using the following flags
--force-warn unused-extern-crates
this code:
// No error, panic handler is supplied by libstd linked though the empty library.
//@ check-pass
//@ aux-build: cfg_false_lib.rs
#![no_std]
extern crate proc_macro;
fn main() {
panic!()
}caused the following diagnostics:
Checking _5ba66f8e62a4839c0ab39d6e4a771d7ada6b5b40 v0.1.0 (/tmp/icemaker_global_tempdir.ZzRBF4urpxex/icemaker_clippyfix_tempdir.aeQgi7GJI5WY/_5ba66f8e62a4839c0ab39d6e4a771d7ada6b5b40)
warning: unused extern crate
--> src/main.rs:8:1
|
8 | extern crate proc_macro;
| ^^^^^^^^^^^^^^^^^^^^^^^^ unused
|
= note: requested on the command line with `--force-warn unused-extern-crates`
help: remove the unused `extern crate`
|
8 - extern crate proc_macro;
|
warning: `_5ba66f8e62a4839c0ab39d6e4a771d7ada6b5b40` (bin "_5ba66f8e62a4839c0ab39d6e4a771d7ada6b5b40") generated 1 warning (run `cargo clippy --fix --bin "_5ba66f8e62a4839c0ab39d6e4a771d7ada6b5b40" -p _5ba66f8e62a4839c0ab39d6e4a771d7ada6b5b40` to apply 1 suggestion)
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.21s
However after applying these diagnostics, the resulting code:
// No error, panic handler is supplied by libstd linked though the empty library.
//@ check-pass
//@ aux-build: cfg_false_lib.rs
#![no_std]
fn main() {
panic!()
}no longer compiled:
Checking _5ba66f8e62a4839c0ab39d6e4a771d7ada6b5b40 v0.1.0 (/tmp/icemaker_global_tempdir.ZzRBF4urpxex/icemaker_clippyfix_tempdir.aeQgi7GJI5WY/_5ba66f8e62a4839c0ab39d6e4a771d7ada6b5b40)
error: `#[panic_handler]` function required, but not found
error: unwinding panics are not supported without std
|
= help: using nightly cargo, use -Zbuild-std with panic="abort" to avoid unwinding
= note: since the core library is usually precompiled with panic="unwind", rebuilding your crate with panic="abort" may not be enough to fix the problem
error: could not compile `_5ba66f8e62a4839c0ab39d6e4a771d7ada6b5b40` (bin "_5ba66f8e62a4839c0ab39d6e4a771d7ada6b5b40") due to 2 previous errors
warning: build failed, waiting for other jobs to finish...
Version:
rustc 1.93.0-nightly (a8664a153 2025-10-26)
binary: rustc
commit-hash: a8664a1534913ccff491937ec2dc7ec5d973c2bd
commit-date: 2025-10-26
host: x86_64-unknown-linux-gnu
release: 1.93.0-nightly
LLVM version: 21.1.3
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.D-invalid-suggestionDiagnostics: A structured suggestion resulting in incorrect code.Diagnostics: A structured suggestion resulting in incorrect code.L-false-positiveLint: False positive (should not have fired).Lint: False positive (should not have fired).L-unused_extern_cratesLint: unused_extern_cratesLint: unused_extern_cratesT-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.