Skip to content

Commit 4f7be40

Browse files
authored
Unrolled build for rust-lang#139483
Rollup merge of rust-lang#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.
2 parents a15cce2 + 0da46d1 commit 4f7be40

File tree

5 files changed

+41
-33
lines changed

5 files changed

+41
-33
lines changed

library/core/src/num/f128.rs

+10-8
Original file line numberDiff line numberDiff line change
@@ -224,14 +224,16 @@ impl f128 {
224224

225225
/// Not a Number (NaN).
226226
///
227-
/// Note that IEEE 754 doesn't define just a single NaN value;
228-
/// a plethora of bit patterns are considered to be NaN.
229-
/// Furthermore, the standard makes a difference
230-
/// between a "signaling" and a "quiet" NaN,
231-
/// and allows inspecting its "payload" (the unspecified bits in the bit pattern).
232-
/// This constant isn't guaranteed to equal to any specific NaN bitpattern,
233-
/// and the stability of its representation over Rust versions
234-
/// and target platforms isn't guaranteed.
227+
/// Note that IEEE 754 doesn't define just a single NaN value; a plethora of bit patterns are
228+
/// considered to be NaN. Furthermore, the standard makes a difference between a "signaling" and
229+
/// a "quiet" NaN, and allows inspecting its "payload" (the unspecified bits in the bit pattern)
230+
/// and its sign. See the [specification of NaN bit patterns](f32#nan-bit-patterns) for more
231+
/// info.
232+
///
233+
/// This constant is guaranteed to be a quiet NaN (on targets that follow the Rust assumptions
234+
/// that the quiet/signaling bit being set to 1 indicates a quiet NaN). Beyond that, nothing is
235+
/// guaranteed about the specific bit pattern chosen here: both payload and sign are arbitrary.
236+
/// The concrete bit pattern may change across Rust versions and target platforms.
235237
#[allow(clippy::eq_op)]
236238
#[rustc_diagnostic_item = "f128_nan"]
237239
#[unstable(feature = "f128", issue = "116909")]

library/core/src/num/f16.rs

+10-8
Original file line numberDiff line numberDiff line change
@@ -219,14 +219,16 @@ impl f16 {
219219

220220
/// Not a Number (NaN).
221221
///
222-
/// Note that IEEE 754 doesn't define just a single NaN value;
223-
/// a plethora of bit patterns are considered to be NaN.
224-
/// Furthermore, the standard makes a difference
225-
/// between a "signaling" and a "quiet" NaN,
226-
/// and allows inspecting its "payload" (the unspecified bits in the bit pattern).
227-
/// This constant isn't guaranteed to equal to any specific NaN bitpattern,
228-
/// and the stability of its representation over Rust versions
229-
/// and target platforms isn't guaranteed.
222+
/// Note that IEEE 754 doesn't define just a single NaN value; a plethora of bit patterns are
223+
/// considered to be NaN. Furthermore, the standard makes a difference between a "signaling" and
224+
/// a "quiet" NaN, and allows inspecting its "payload" (the unspecified bits in the bit pattern)
225+
/// and its sign. See the [specification of NaN bit patterns](f32#nan-bit-patterns) for more
226+
/// info.
227+
///
228+
/// This constant is guaranteed to be a quiet NaN (on targets that follow the Rust assumptions
229+
/// that the quiet/signaling bit being set to 1 indicates a quiet NaN). Beyond that, nothing is
230+
/// guaranteed about the specific bit pattern chosen here: both payload and sign are arbitrary.
231+
/// The concrete bit pattern may change across Rust versions and target platforms.
230232
#[allow(clippy::eq_op)]
231233
#[rustc_diagnostic_item = "f16_nan"]
232234
#[unstable(feature = "f16", issue = "116909")]

library/core/src/num/f32.rs

+10-8
Original file line numberDiff line numberDiff line change
@@ -470,14 +470,16 @@ impl f32 {
470470

471471
/// Not a Number (NaN).
472472
///
473-
/// Note that IEEE 754 doesn't define just a single NaN value;
474-
/// a plethora of bit patterns are considered to be NaN.
475-
/// Furthermore, the standard makes a difference
476-
/// between a "signaling" and a "quiet" NaN,
477-
/// and allows inspecting its "payload" (the unspecified bits in the bit pattern).
478-
/// This constant isn't guaranteed to equal to any specific NaN bitpattern,
479-
/// and the stability of its representation over Rust versions
480-
/// and target platforms isn't guaranteed.
473+
/// Note that IEEE 754 doesn't define just a single NaN value; a plethora of bit patterns are
474+
/// considered to be NaN. Furthermore, the standard makes a difference between a "signaling" and
475+
/// a "quiet" NaN, and allows inspecting its "payload" (the unspecified bits in the bit pattern)
476+
/// and its sign. See the [specification of NaN bit patterns](f32#nan-bit-patterns) for more
477+
/// info.
478+
///
479+
/// This constant is guaranteed to be a quiet NaN (on targets that follow the Rust assumptions
480+
/// that the quiet/signaling bit being set to 1 indicates a quiet NaN). Beyond that, nothing is
481+
/// guaranteed about the specific bit pattern chosen here: both payload and sign are arbitrary.
482+
/// The concrete bit pattern may change across Rust versions and target platforms.
481483
#[stable(feature = "assoc_int_consts", since = "1.43.0")]
482484
#[rustc_diagnostic_item = "f32_nan"]
483485
#[allow(clippy::eq_op)]

library/core/src/num/f64.rs

+10-8
Original file line numberDiff line numberDiff line change
@@ -469,14 +469,16 @@ impl f64 {
469469

470470
/// Not a Number (NaN).
471471
///
472-
/// Note that IEEE 754 doesn't define just a single NaN value;
473-
/// a plethora of bit patterns are considered to be NaN.
474-
/// Furthermore, the standard makes a difference
475-
/// between a "signaling" and a "quiet" NaN,
476-
/// and allows inspecting its "payload" (the unspecified bits in the bit pattern).
477-
/// This constant isn't guaranteed to equal to any specific NaN bitpattern,
478-
/// and the stability of its representation over Rust versions
479-
/// and target platforms isn't guaranteed.
472+
/// Note that IEEE 754 doesn't define just a single NaN value; a plethora of bit patterns are
473+
/// considered to be NaN. Furthermore, the standard makes a difference between a "signaling" and
474+
/// a "quiet" NaN, and allows inspecting its "payload" (the unspecified bits in the bit pattern)
475+
/// and its sign. See the [specification of NaN bit patterns](f32#nan-bit-patterns) for more
476+
/// info.
477+
///
478+
/// This constant is guaranteed to be a quiet NaN (on targets that follow the Rust assumptions
479+
/// that the quiet/signaling bit being set to 1 indicates a quiet NaN). Beyond that, nothing is
480+
/// guaranteed about the specific bit pattern chosen here: both payload and sign are arbitrary.
481+
/// The concrete bit pattern may change across Rust versions and target platforms.
480482
#[rustc_diagnostic_item = "f64_nan"]
481483
#[stable(feature = "assoc_int_consts", since = "1.43.0")]
482484
#[allow(clippy::eq_op)]

src/tools/miri/tests/pass/tls/tls_leak_main_thread_allowed.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ pub fn main() {
1313
TLS.set(Some(Box::leak(Box::new(123))));
1414

1515
// We can only ignore leaks on targets that use `#[thread_local]` statics to implement
16-
// `thread_local!`. Ignore the test on targest that don't.
16+
// `thread_local!`. Ignore the test on targets that don't.
1717
if cfg!(target_thread_local) {
1818
thread_local! {
1919
static TLS_KEY: Cell<Option<&'static i32>> = Cell::new(None);

0 commit comments

Comments
 (0)