diff --git a/rust-version b/rust-version index 46567849e0..29fc4efbea 100644 --- a/rust-version +++ b/rust-version @@ -1 +1 @@ -3833636446b670ee905fba5f8d18881b1739814e +b2c20b51ed838368d3f2bdccb63f401bcddb7e1c diff --git a/tests/run-pass/concurrency/tls_lib_drop.rs b/tests/run-pass/concurrency/tls_lib_drop.rs index 46f59ef620..00a12599ce 100644 --- a/tests/run-pass/concurrency/tls_lib_drop.rs +++ b/tests/run-pass/concurrency/tls_lib_drop.rs @@ -1,4 +1,5 @@ // ignore-windows: Concurrency on Windows is not supported yet. +#![feature(thread_local_const_init)] use std::cell::RefCell; use std::thread; @@ -16,6 +17,7 @@ impl Drop for TestCell { thread_local! { static A: TestCell = TestCell { value: RefCell::new(0) }; + static A_CONST: TestCell = const { TestCell { value: RefCell::new(10) } }; } /// Check that destructors of the library thread locals are executed immediately @@ -26,6 +28,10 @@ fn check_destructors() { assert_eq!(*f.value.borrow(), 0); *f.value.borrow_mut() = 5; }); + A_CONST.with(|f| { + assert_eq!(*f.value.borrow(), 10); + *f.value.borrow_mut() = 15; + }); }) .join() .unwrap(); diff --git a/tests/run-pass/concurrency/tls_lib_drop.stdout b/tests/run-pass/concurrency/tls_lib_drop.stdout index 484979b04c..9cd7e049d1 100644 --- a/tests/run-pass/concurrency/tls_lib_drop.stdout +++ b/tests/run-pass/concurrency/tls_lib_drop.stdout @@ -1,4 +1,5 @@ Dropping: 5 (should be before 'Continue main 1'). +Dropping: 15 (should be before 'Continue main 1'). Continue main 1. Joining: 7 (should be before 'Continue main 2'). Continue main 2. diff --git a/tests/run-pass/concurrency/tls_lib_drop_single_thread.rs b/tests/run-pass/concurrency/tls_lib_drop_single_thread.rs index f232cee5bd..cd1bd6480b 100644 --- a/tests/run-pass/concurrency/tls_lib_drop_single_thread.rs +++ b/tests/run-pass/concurrency/tls_lib_drop_single_thread.rs @@ -1,4 +1,6 @@ +// compile-flags: -Zmiri-track-raw-pointers //! Check that destructors of the thread locals are executed on all OSes. +#![feature(thread_local_const_init)] use std::cell::RefCell; @@ -14,6 +16,7 @@ impl Drop for TestCell { thread_local! { static A: TestCell = TestCell { value: RefCell::new(0) }; + static A_CONST: TestCell = const { TestCell { value: RefCell::new(10) } }; } fn main() { @@ -21,5 +24,9 @@ fn main() { assert_eq!(*f.value.borrow(), 0); *f.value.borrow_mut() = 5; }); + A_CONST.with(|f| { + assert_eq!(*f.value.borrow(), 10); + *f.value.borrow_mut() = 5; // Same value as above since the drop order is different on different platforms + }); eprintln!("Continue main.") } diff --git a/tests/run-pass/concurrency/tls_lib_drop_single_thread.stderr b/tests/run-pass/concurrency/tls_lib_drop_single_thread.stderr index a9d705e5b9..09ec1c3c2c 100644 --- a/tests/run-pass/concurrency/tls_lib_drop_single_thread.stderr +++ b/tests/run-pass/concurrency/tls_lib_drop_single_thread.stderr @@ -1,2 +1,3 @@ Continue main. Dropping: 5 +Dropping: 5 diff --git a/tests/run-pass/thread-local.rs b/tests/run-pass/concurrency/tls_pthread_drop_order.rs similarity index 100% rename from tests/run-pass/thread-local.rs rename to tests/run-pass/concurrency/tls_pthread_drop_order.rs