22
33use std:: panic:: Location ;
44
5- extern "Rust" {
5+ unsafe extern "Rust" {
66 #[ track_caller]
7- fn rust_track_caller_ffi_test_tracked ( ) -> & ' static Location < ' static > ;
8- fn rust_track_caller_ffi_test_untracked ( ) -> & ' static Location < ' static > ;
7+ safe fn rust_track_caller_ffi_test_tracked ( ) -> & ' static Location < ' static > ;
8+ safe fn rust_track_caller_ffi_test_untracked ( ) -> & ' static Location < ' static > ;
99}
1010
1111fn rust_track_caller_ffi_test_nested_tracked ( ) -> & ' static Location < ' static > {
12- unsafe { rust_track_caller_ffi_test_tracked ( ) }
12+ rust_track_caller_ffi_test_tracked ( )
1313}
1414
1515mod provides {
@@ -31,18 +31,23 @@ fn main() {
3131 assert_eq ! ( location. line( ) , 29 ) ;
3232 assert_eq ! ( location. column( ) , 20 ) ;
3333
34- let tracked = unsafe { rust_track_caller_ffi_test_tracked ( ) } ;
34+ let tracked = rust_track_caller_ffi_test_tracked ( ) ;
3535 assert_eq ! ( tracked. file( ) , file!( ) ) ;
3636 assert_eq ! ( tracked. line( ) , 34 ) ;
37- assert_eq ! ( tracked. column( ) , 28 ) ;
37+ assert_eq ! ( tracked. column( ) , 19 ) ;
3838
39- let untracked = unsafe { rust_track_caller_ffi_test_untracked ( ) } ;
39+ let untracked = rust_track_caller_ffi_test_untracked ( ) ;
4040 assert_eq ! ( untracked. file( ) , file!( ) ) ;
4141 assert_eq ! ( untracked. line( ) , 24 ) ;
4242 assert_eq ! ( untracked. column( ) , 9 ) ;
4343
4444 let contained = rust_track_caller_ffi_test_nested_tracked ( ) ;
4545 assert_eq ! ( contained. file( ) , file!( ) ) ;
4646 assert_eq ! ( contained. line( ) , 12 ) ;
47- assert_eq ! ( contained. column( ) , 14 ) ;
47+ assert_eq ! ( contained. column( ) , 5 ) ;
48+
49+ let indirect = ( rust_track_caller_ffi_test_tracked as fn ( ) -> & ' static Location < ' static > ) ( ) ;
50+ assert_eq ! ( indirect. file( ) , file!( ) ) ;
51+ assert_eq ! ( indirect. line( ) , 7 ) ;
52+ assert_eq ! ( indirect. column( ) , 5 ) ;
4853}
0 commit comments