Skip to content

Commit fd90e56

Browse files
committedJan 19, 2020
Add failing #[track_caller] test with fn pointers.
1 parent c0e02ad commit fd90e56

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// run-pass
2+
3+
#![feature(track_caller)]
4+
5+
fn pass_to_ptr_call<T>(f: fn(T), x: T) {
6+
f(x);
7+
}
8+
9+
#[track_caller]
10+
fn tracked_unit(_: ()) {
11+
assert_eq!(std::panic::Location::caller().file(), file!());
12+
}
13+
14+
fn main() {
15+
pass_to_ptr_call(tracked_unit, ());
16+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// run-pass
2+
3+
#![feature(track_caller)]
4+
5+
fn ptr_call(f: fn()) {
6+
f();
7+
}
8+
9+
#[track_caller]
10+
fn tracked() {
11+
assert_eq!(std::panic::Location::caller().file(), file!());
12+
}
13+
14+
fn main() {
15+
ptr_call(tracked);
16+
}

0 commit comments

Comments
 (0)
Please sign in to comment.