delete UI tests that only check internal implementation details of thread-locals

This commit is contained in:
joboet 2024-03-12 14:02:48 +01:00
parent 085b3d49c9
commit 60bf1ab466
No known key found for this signature in database
GPG Key ID: 704E0149B0194B3C
4 changed files with 0 additions and 83 deletions

View File

@ -3988,8 +3988,6 @@ ui/test-attrs/issue-52557.rs
ui/test-attrs/issue-53675-a-test-called-panic.rs
ui/threads-sendsync/issue-24313.rs
ui/threads-sendsync/issue-29488.rs
ui/threads-sendsync/issue-43733-2.rs
ui/threads-sendsync/issue-43733.rs
ui/threads-sendsync/issue-4446.rs
ui/threads-sendsync/issue-4448.rs
ui/threads-sendsync/issue-8827.rs

View File

@ -1,30 +0,0 @@
//@ needs-threads
//@ dont-check-compiler-stderr
#![feature(cfg_target_thread_local, thread_local_internals)]
// On platforms *without* `#[thread_local]`, use
// a custom non-`Sync` type to fake the same error.
#[cfg(not(target_thread_local))]
struct Key<T> {
_data: std::cell::UnsafeCell<Option<T>>,
_flag: std::cell::Cell<()>,
}
#[cfg(not(target_thread_local))]
impl<T> Key<T> {
const fn new() -> Self {
Key {
_data: std::cell::UnsafeCell::new(None),
_flag: std::cell::Cell::new(()),
}
}
}
#[cfg(target_thread_local)]
use std::thread::local_impl::Key;
static __KEY: Key<()> = Key::new();
//~^ ERROR `UnsafeCell<Option<()>>` cannot be shared between threads
//~| ERROR cannot be shared between threads safely [E0277]
fn main() {}

View File

@ -1,32 +0,0 @@
//@ needs-threads
#![feature(thread_local)]
#![feature(cfg_target_thread_local, thread_local_internals)]
use std::cell::RefCell;
type Foo = std::cell::RefCell<String>;
#[cfg(target_thread_local)]
#[thread_local]
static __KEY: std::thread::local_impl::Key<Foo> = std::thread::local_impl::Key::new();
#[cfg(not(target_thread_local))]
static __KEY: std::thread::local_impl::Key<Foo> = std::thread::local_impl::Key::new();
fn __getit(_: Option<&mut Option<RefCell<String>>>) -> std::option::Option<&'static Foo> {
__KEY.get(Default::default)
//~^ ERROR call to unsafe function `Key::<T>::get` is unsafe
}
static FOO: std::thread::LocalKey<Foo> = std::thread::LocalKey::new(__getit);
//~^ ERROR call to unsafe function `LocalKey::<T>::new` is unsafe
fn main() {
FOO.with(|foo| println!("{}", foo.borrow()));
std::thread::spawn(|| {
FOO.with(|foo| *foo.borrow_mut() += "foo");
})
.join()
.unwrap();
FOO.with(|foo| println!("{}", foo.borrow()));
}

View File

@ -1,19 +0,0 @@
error[E0133]: call to unsafe function `Key::<T>::get` is unsafe and requires unsafe function or block
--> $DIR/issue-43733.rs:17:5
|
LL | __KEY.get(Default::default)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
|
= note: consult the function's documentation for information on how to avoid undefined behavior
error[E0133]: call to unsafe function `LocalKey::<T>::new` is unsafe and requires unsafe function or block
--> $DIR/issue-43733.rs:21:42
|
LL | static FOO: std::thread::LocalKey<Foo> = std::thread::LocalKey::new(__getit);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
|
= note: consult the function's documentation for information on how to avoid undefined behavior
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0133`.