diff options
| author | Adam Perry <adam.n.perry@gmail.com> | 2020-01-19 14:25:43 -0800 |
|---|---|---|
| committer | Adam Perry <adam.n.perry@gmail.com> | 2020-01-19 14:26:28 -0800 |
| commit | 72dffac6cf170c6c16c043299e35848014aae8d4 (patch) | |
| tree | 83f830b53afdbe1a4aebfa95aae01a055a9e0c33 | |
| parent | 19d8527890b59ed25432fbf5a9f1bd75ac814ae2 (diff) | |
| download | rust-72dffac6cf170c6c16c043299e35848014aae8d4.tar.gz rust-72dffac6cf170c6c16c043299e35848014aae8d4.zip | |
Test that ReifyShim + caller_location return the def site.
| -rw-r--r-- | src/test/ui/rfc-2091-track-caller/tracked-fn-ptr-with-arg.rs | 5 | ||||
| -rw-r--r-- | src/test/ui/rfc-2091-track-caller/tracked-fn-ptr.rs | 5 |
2 files changed, 8 insertions, 2 deletions
diff --git a/src/test/ui/rfc-2091-track-caller/tracked-fn-ptr-with-arg.rs b/src/test/ui/rfc-2091-track-caller/tracked-fn-ptr-with-arg.rs index 210a4f22f09..0407eafbfd4 100644 --- a/src/test/ui/rfc-2091-track-caller/tracked-fn-ptr-with-arg.rs +++ b/src/test/ui/rfc-2091-track-caller/tracked-fn-ptr-with-arg.rs @@ -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() { diff --git a/src/test/ui/rfc-2091-track-caller/tracked-fn-ptr.rs b/src/test/ui/rfc-2091-track-caller/tracked-fn-ptr.rs index 1ce8f678b60..a4baaa26ced 100644 --- a/src/test/ui/rfc-2091-track-caller/tracked-fn-ptr.rs +++ b/src/test/ui/rfc-2091-track-caller/tracked-fn-ptr.rs @@ -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() { |
