Files
rust/library/std/src
Guillaume Gomez eea8ceed54 Rollup merge of #121596 - ChrisDenton:tls, r=joboet
Use volatile access instead of `#[used]` for `on_tls_callback`

The first commit adds a volatile load of `p_thread_callback` when registering a dtor so that the compiler knows if the callback is used or not. I don't believe the added volatile instruction is otherwise significant in the context. In my testing using the volatile load allowed the compiler to correctly reason about whether `on_tls_callback` is used or not, allowing it to be omitted entirely in some cases. Admittedly it usually is used due to `Thread` but that can be avoided (e.g. in DLLs or with custom entry points that avoid the offending APIs). Ideally this would be something the compiler could help a bit more with so we didn't have to use tricks like `#[used]` or volatile. But alas.

I also used this as an opportunity to clean up the `unused` lints which I don't think serve a purpose any more.

The second commit removes the volatile load of `_tls_used` with `#cfg[target_thread_local]` because `#[thread_local]` already implies it. And if it ever didn't then `#[thread_local]` would be broken when there aren't any dtors.
2024-02-29 17:08:37 +01:00
..
2023-12-10 10:56:22 +08:00
2023-12-10 10:56:22 +08:00
2023-08-13 13:07:53 -06:00
2023-12-22 11:01:42 +01:00
2023-12-10 10:56:22 +08:00
2024-01-11 11:30:12 -05:00
2023-12-10 10:56:22 +08:00
2024-02-29 01:33:02 -05:00
2024-02-24 16:02:17 +03:00
2023-05-03 22:09:33 -07:00
2023-11-26 09:25:07 +08:00
2024-02-29 11:58:13 +01:00
2023-12-12 18:12:23 +08:00
2024-01-27 16:38:57 +01:00
2024-02-28 14:56:36 -08:00
2023-12-15 16:17:28 +00:00