From fbe7fbb8900a93cbe080db35e68f35fd515fa87d Mon Sep 17 00:00:00 2001 From: JCTyBlaidd Date: Mon, 7 Dec 2020 21:13:11 +0000 Subject: [PATCH] Add concurrent caller location test --- .../concurrency/concurrent_caller_location.rs | 17 +++++++++++++++++ .../concurrent_caller_location.stderr | 2 ++ 2 files changed, 19 insertions(+) create mode 100644 tests/run-pass/concurrency/concurrent_caller_location.rs create mode 100644 tests/run-pass/concurrency/concurrent_caller_location.stderr diff --git a/tests/run-pass/concurrency/concurrent_caller_location.rs b/tests/run-pass/concurrency/concurrent_caller_location.rs new file mode 100644 index 00000000000..e3e2f9ac60a --- /dev/null +++ b/tests/run-pass/concurrency/concurrent_caller_location.rs @@ -0,0 +1,17 @@ +use std::thread::spawn; +use std::panic::Location; + +fn initialize() { + let _ignore = initialize_inner(); +} + +fn initialize_inner() -> &'static Location<'static> { + Location::caller() +} + +fn main() { + let j1 = spawn(initialize); + let j2 = spawn(initialize); + j1.join().unwrap(); + j2.join().unwrap(); +} diff --git a/tests/run-pass/concurrency/concurrent_caller_location.stderr b/tests/run-pass/concurrency/concurrent_caller_location.stderr new file mode 100644 index 00000000000..03676519d4f --- /dev/null +++ b/tests/run-pass/concurrency/concurrent_caller_location.stderr @@ -0,0 +1,2 @@ +warning: thread support is experimental and incomplete: weak memory effects are not emulated. +