Test that ReifyShim + caller_location return the def site.
This commit is contained in:
parent
19d8527890
commit
72dffac6cf
2 changed files with 8 additions and 2 deletions
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue