-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
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-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.L-unreachable_codeLint: unreachable_codeLint: unreachable_codeT-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
I tried this code:
pub fn foo<T>(a: T) -> T {
a
}
pub fn bar<T>() -> T {
foo(todo!())
}I expected to see this happen: it compile with no lints
Instead, this happened: it told me my foo call was unreachable
warning: unreachable call
--> src/lib.rs:6:5
|
6 | foo(todo!())
| ^^^ ------- any code following this expression is unreachable
| |
| unreachable call
|
= note: `#[warn(unreachable_code)]` (part of `#[warn(unused)]`) on by defaultwhile technically true this is not particularly helpful. It's been todo!()'d because I'm in the process of filling out the function arguments.
Meta
playground version:
Nightly channel
Build using the Nightly version: 1.94.0-nightly
(2025-12-27 7b5cde7370b82fecf700)
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-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.L-unreachable_codeLint: unreachable_codeLint: unreachable_codeT-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.