Rollup merge of #139483 - RalfJung:nan, r=tgross35

f*::NAN: guarantee that this is a quiet NaN

I think we should guarantee that this is a quiet NaN. This then implies that programs not using `f*::from_bits` (or unsafe type conversions) are guaranteed to only work with quiet NaNs. It would be awkward if people start to write `0.0 / 0.0` instead of using the constant just because they want to get a guaranteed-quiet NaN.

This is a `@rust-lang/libs-api` change. The definition of this constant currently is `0.0 / 0.0`, which is already guaranteed to be a quiet NaN. So all this does is forward that guarantee to our users.
This commit is contained in:
Matthias Krüger 2025-04-17 21:53:24 +02:00 committed by GitHub
commit b6e48d3850
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 41 additions and 33 deletions

View file

@ -13,7 +13,7 @@ pub fn main() {
TLS.set(Some(Box::leak(Box::new(123))));
// We can only ignore leaks on targets that use `#[thread_local]` statics to implement
// `thread_local!`. Ignore the test on targest that don't.
// `thread_local!`. Ignore the test on targets that don't.
if cfg!(target_thread_local) {
thread_local! {
static TLS_KEY: Cell<Option<&'static i32>> = Cell::new(None);