Test that ReifyShim + caller_location return the def site.

This commit is contained in:
Adam Perry 2020-01-19 14:25:43 -08:00
parent 19d8527890
commit 72dffac6cf
2 changed files with 8 additions and 2 deletions

View file

@ -8,7 +8,10 @@ fn pass_to_ptr_call<T>(f: fn(T), x: T) {
#[track_caller]
fn tracked_unit(_: ()) {
assert_eq!(std::panic::Location::caller().file(), file!());
let expected_line = line!() - 1;
let location = std::panic::Location::caller();
assert_eq!(location.file(), file!());
assert_eq!(location.line(), expected_line, "call shims report location as fn definition");
}
fn main() {

View file

@ -8,7 +8,10 @@ fn ptr_call(f: fn()) {
#[track_caller]
fn tracked() {
assert_eq!(std::panic::Location::caller().file(), file!());
let expected_line = line!() - 1;
let location = std::panic::Location::caller();
assert_eq!(location.file(), file!());
assert_eq!(location.line(), expected_line, "call shims report location as fn definition");
}
fn main() {