rust/library/std/src/sys_common
bors 223d16ebbd Auto merge of #100201 - RalfJung:thread-local-key, r=thomcc
std: use realstd fast key when building tests

Under `cfg(test)`, the `std` crate is not the actual standard library, just any old crate we are testing. It imports the real standard library as `realstd`, and then does some careful `cfg` magic so that the crate built for testing uses the `realstd` global state rather than having its own copy of that.

However, this was not done for all global state hidden in std: the 'fast' version of thread-local keys, at least on some platforms, also involves some global state. Specifically its macOS version has this [`static REGISTERED`](bc63d5a26a/library/std/src/sys/unix/thread_local_dtor.rs (L62)) that would get duplicated. So this PR imports the 'fast' key type from `realstd` rather than using the local copy, to ensure its internal state (and that of the functions it calls) does not get duplicated.

I also noticed that the `__OsLocalKeyInner` is unused under `cfg(target_thread_local)`, so I removed it for that configuration. There was a comment saying macOS picks between `__OsLocalKeyInner` and `__FastLocalKeyInner` at runtime, but I think that comment is outdated -- I found no trace of such a runtime switching mechanism, and the library still check-builds on apple targets with this PR. (I don't have a Mac so I cannot actually run it.)
2022-08-28 15:12:31 +00:00
..
condvar Lazily allocate+initialize locks. 2022-06-03 17:04:14 +02:00
memchr Move std::memchr to sys_common 2021-05-14 03:54:46 +02:00
net Use implicit capture syntax in format_args 2022-03-10 10:23:40 -05:00
remutex Fix more “a”/“an” typos 2021-08-22 16:35:29 +02:00
thread_local_key avoid some int2ptr casts in thread_local_key tests 2022-08-11 09:39:25 -04:00
thread_parker Rollup merge of #97140 - joboet:solid_parker, r=m-ou-se 2022-06-26 19:46:59 +02:00
wtf8 Remove is_known_utf8 checks from more tests where it's no longer set. 2022-06-23 13:10:47 -07:00
backtrace.rs Use implicit capture syntax in format_args 2022-03-10 10:23:40 -05:00
condvar.rs Make all {Mutex, Condvar, RwLock}::new #[inline]. 2022-06-06 13:49:23 +02:00
fs.rs Hide Repr details from io::Error, and rework io::Error::new_const. 2022-02-04 18:47:29 -08:00
io.rs Avoid double panics when using TempDir in tests 2022-01-25 10:36:10 +00:00
lazy_box.rs Leak pthreax_mutex_t when it's dropped while locked. 2022-06-16 12:09:12 +02:00
memchr.rs Move std::memchr to sys_common 2021-05-14 03:54:46 +02:00
mod.rs Lazily allocate+initialize locks. 2022-06-03 17:04:14 +02:00
mutex.rs Remove lies in comments. 2022-06-20 23:02:21 +02:00
net.rs created tcpstream quickack trait 2022-08-13 17:38:01 +02:00
process.rs Remove CommandEnv::apply 2021-12-29 10:07:44 +01:00
remutex.rs Use Drop instead of destroy() for locks. 2022-06-03 16:45:47 +02:00
rwlock.rs Remove lies in comments. 2022-06-20 23:02:21 +02:00
tests.rs std: move "mod tests/benches" to separate files 2020-08-31 02:56:59 +00:00
thread.rs Relax memory ordering used in min_stack 2022-05-01 15:55:54 -07:00
thread_info.rs Merge two THREAD_INFO.with and following RefCell borrow 2021-09-16 15:24:53 +02:00
thread_local_dtor.rs Remove "sys isn't exported yet" phrase 2022-05-30 12:07:43 +02:00
thread_local_key.rs update and extend some comments, and cfg-out some unused code 2022-08-22 09:14:33 -04:00
wtf8.rs Auto merge of #96869 - sunfishcode:main, r=joshtriplett 2022-08-24 01:17:52 +00:00