mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-01 06:51:58 +00:00
24 lines
391 B
Rust
24 lines
391 B
Rust
// run-pass
|
|
// revisions: default mir-opt
|
|
//[default] compile-flags: -Zinline-mir=no
|
|
//[mir-opt] compile-flags: -Zmir-opt-level=4
|
|
|
|
use std::panic::Location;
|
|
|
|
macro_rules! f {
|
|
() => {
|
|
Location::caller()
|
|
};
|
|
}
|
|
|
|
#[inline(always)]
|
|
fn g() -> &'static Location<'static> {
|
|
f!()
|
|
}
|
|
|
|
fn main() {
|
|
let loc = g();
|
|
assert_eq!(loc.line(), 16);
|
|
assert_eq!(loc.column(), 5);
|
|
}
|