]>
Commit | Line | Data |
---|---|---|
e74abb32 XL |
1 | // run-pass |
2 | ||
3 | #![feature(const_fn, core_intrinsics)] | |
4 | ||
5 | use std::{intrinsics::caller_location, panic::Location}; | |
6 | ||
7 | const LOCATION: &Location = caller_location(); | |
8 | const NESTED: &Location = { | |
9 | const fn nested_location() -> &'static Location<'static> { | |
10 | caller_location() | |
11 | }; | |
12 | nested_location() | |
13 | }; | |
14 | ||
15 | fn main() { | |
16 | assert_eq!(LOCATION.file(), file!()); | |
17 | assert_eq!(LOCATION.line(), 7); | |
18 | assert_eq!(LOCATION.column(), 29); | |
19 | ||
20 | assert_eq!(NESTED.file(), file!()); | |
21 | assert_eq!(NESTED.line(), 10); | |
22 | assert_eq!(NESTED.column(), 9); | |
23 | } |