]> git.lizzy.rs Git - rust.git/commitdiff
Delete a duplicate test.
authorVytautas Astrauskas <astrauv@amazon.com>
Sun, 26 Apr 2020 21:44:59 +0000 (14:44 -0700)
committerVytautas Astrauskas <astrauv@amazon.com>
Mon, 27 Apr 2020 21:26:36 +0000 (14:26 -0700)
tests/compile-fail/concurrency/dangling_tls_lib.rs [deleted file]

diff --git a/tests/compile-fail/concurrency/dangling_tls_lib.rs b/tests/compile-fail/concurrency/dangling_tls_lib.rs
deleted file mode 100644 (file)
index 6be5538..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-// ignore-windows: Concurrency on Windows is not supported yet.
-
-//! Check that we catch if a thread local is accessed after the thread has
-//! terminated.
-
-#![feature(thread_local_internals)]
-
-use std::cell::RefCell;
-use std::thread;
-
-static A: std::thread::LocalKey<RefCell<u8>> = {
-    #[inline]
-    fn __init() -> RefCell<u8> {
-        RefCell::new(0)
-    }
-
-    unsafe fn __getit() -> Option<&'static RefCell<u8>> {
-        static __KEY: std::thread::__OsLocalKeyInner<RefCell<u8>> =
-            std::thread::__OsLocalKeyInner::new();
-        __KEY.get(__init)
-    }
-
-    unsafe { std::thread::LocalKey::new(__getit) }
-};
-
-struct Sender(*mut u8);
-
-unsafe impl Send for Sender {}
-
-fn main() {
-    A.with(|f| {
-        assert_eq!(*f.borrow(), 0);
-        *f.borrow_mut() = 4;
-    });
-
-    let handle = thread::spawn(|| {
-        let ptr = A.with(|f| {
-            assert_eq!(*f.borrow(), 0);
-            *f.borrow_mut() = 5;
-            &mut *f.borrow_mut() as *mut u8
-        });
-        Sender(ptr)
-    });
-    let ptr = handle.join().unwrap().0;
-    A.with(|f| {
-        assert_eq!(*f.borrow(), 4);
-    });
-    let _x = unsafe { *ptr }; //~ ERROR Undefined Behavior
-}