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 default
while 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)
I tried this code:
I expected to see this happen: it compile with no lints
Instead, this happened: it told me my
foocall was unreachablewhile 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: