// revisions: mir thir
// [thir]compile-flags: -Z thir-unsafeck
+// normalize-stderr-test: "__FastLocalKeyInner::<T>::get" -> "$$LOCALKEYINNER::<T>::get"
+// normalize-stderr-test: "__OsLocalKeyInner::<T>::get" -> "$$LOCALKEYINNER::<T>::get"
#![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)]
#[cfg(not(target_thread_local))]
static __KEY: std::thread::__OsLocalKeyInner<Foo> = std::thread::__OsLocalKeyInner::new();
-fn __getit() -> std::option::Option<&'static Foo> {
- __KEY.get(Default::default) //~ ERROR call to unsafe function is unsafe
+fn __getit(_: Option<&mut Option<RefCell<String>>>) -> std::option::Option<&'static Foo> {
+ __KEY.get(Default::default)
+ //[mir]~^ ERROR call to unsafe function `std::thread::
+ //[thir]~^^ ERROR call to unsafe function `__
}
static FOO: std::thread::LocalKey<Foo> = std::thread::LocalKey::new(__getit);
-//~^ ERROR call to unsafe function is unsafe
+//[mir]~^ ERROR call to unsafe function `std::thread::LocalKey::<T>::new` is unsafe
+//[thir]~^^ ERROR call to unsafe function `LocalKey::<T>::new` is unsafe
fn main() {
FOO.with(|foo| println!("{}", foo.borrow()));