3 #![feature(track_caller)]
5 use std
::panic
::Location
;
9 fn rust_track_caller_ffi_test_tracked() -> &'
static Location
<'
static>;
10 fn rust_track_caller_ffi_test_untracked() -> &'
static Location
<'
static>;
13 fn rust_track_caller_ffi_test_nested_tracked() -> &'
static Location
<'
static> {
14 unsafe { rust_track_caller_ffi_test_tracked() }
18 use std
::panic
::Location
;
19 #[track_caller] // UB if we did not have this!
21 fn rust_track_caller_ffi_test_tracked() -> &'
static Location
<'
static> {
25 fn rust_track_caller_ffi_test_untracked() -> &'
static Location
<'
static> {
31 let location
= Location
::caller();
32 assert_eq
!(location
.file(), file
!());
33 assert_eq
!(location
.line(), 31);
34 assert_eq
!(location
.column(), 20);
36 let tracked
= unsafe { rust_track_caller_ffi_test_tracked() }
;
37 assert_eq
!(tracked
.file(), file
!());
38 assert_eq
!(tracked
.line(), 36);
39 assert_eq
!(tracked
.column(), 28);
41 let untracked
= unsafe { rust_track_caller_ffi_test_untracked() }
;
42 assert_eq
!(untracked
.file(), file
!());
43 assert_eq
!(untracked
.line(), 26);
44 assert_eq
!(untracked
.column(), 9);
46 let contained
= rust_track_caller_ffi_test_nested_tracked();
47 assert_eq
!(contained
.file(), file
!());
48 assert_eq
!(contained
.line(), 14);
49 assert_eq
!(contained
.column(), 14);