Open
Description
Code
According to
//! ```standalone_crate
//! let location = std::panic::Location::caller();
//! assert_eq!(location.line(), 4);
//! ```
not sure where 4 comes from its always 3
for me, however i propose it should be 1
This example can be solved without a standalone crate by using include!
inc.rs
{
let location = std::panic::Location::caller();
assert_eq!(location.line(), 3);
}
{let location = std::panic::Location::caller();
assert_eq!(location.line(), 1);}
fn main() {
include!("inc.rs")
}
Running this passes since it seems that the include!
macro forwards panic info to the right file.
Version
rustdoc 1.88.0 (6b00bc388 2025-06-23)
binary: rustdoc
commit-hash: 6b00bc3880198600130e1cf62b8f8a93494488cc
commit-date: 2025-06-23
host: x86_64-unknown-linux-gnu
release: 1.88.0
LLVM version: 20.1.5