Skip to content

Commit 19289db

Browse files
author
gitbot
committed
Merge from df35ff6 with conflicts
2 parents 75bf5ce + 563e49d commit 19289db

File tree

13 files changed

+50
-12
lines changed

13 files changed

+50
-12
lines changed

library/Cargo.lock

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

library/alloc/Cargo.toml

+4
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,12 @@ bench = false
1616

1717
[dependencies]
1818
core = { path = "../core", public = true }
19+
<<<<<<< HEAD
1920
compiler_builtins = { version = "=0.1.155", features = ['rustc-dep-of-std'] }
2021
safety = { path = "../contracts/safety" }
22+
=======
23+
compiler_builtins = { version = "=0.1.156", features = ['rustc-dep-of-std'] }
24+
>>>>>>> subtree/library
2125

2226
[features]
2327
compiler-builtins-mem = ['compiler_builtins/mem']

library/core/src/num/f128.rs

+3
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,9 @@ impl f128 {
151151
pub const RADIX: u32 = 2;
152152

153153
/// Number of significant digits in base 2.
154+
///
155+
/// Note that the size of the mantissa in the bitwise representation is one
156+
/// smaller than this since the leading 1 is not stored explicitly.
154157
#[unstable(feature = "f128", issue = "116909")]
155158
pub const MANTISSA_DIGITS: u32 = 113;
156159

library/core/src/num/f16.rs

+3
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,9 @@ impl f16 {
146146
pub const RADIX: u32 = 2;
147147

148148
/// Number of significant digits in base 2.
149+
///
150+
/// Note that the size of the mantissa in the bitwise representation is one
151+
/// smaller than this since the leading 1 is not stored explicitly.
149152
#[unstable(feature = "f16", issue = "116909")]
150153
pub const MANTISSA_DIGITS: u32 = 11;
151154

library/core/src/num/f32.rs

+3
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,9 @@ impl f32 {
396396
pub const RADIX: u32 = 2;
397397

398398
/// Number of significant digits in base 2.
399+
///
400+
/// Note that the size of the mantissa in the bitwise representation is one
401+
/// smaller than this since the leading 1 is not stored explicitly.
399402
#[stable(feature = "assoc_int_consts", since = "1.43.0")]
400403
pub const MANTISSA_DIGITS: u32 = 24;
401404

library/core/src/num/f64.rs

+3
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,9 @@ impl f64 {
396396
pub const RADIX: u32 = 2;
397397

398398
/// Number of significant digits in base 2.
399+
///
400+
/// Note that the size of the mantissa in the bitwise representation is one
401+
/// smaller than this since the leading 1 is not stored explicitly.
399402
#[stable(feature = "assoc_int_consts", since = "1.43.0")]
400403
pub const MANTISSA_DIGITS: u32 = 53;
401404
/// Approximate number of significant digits in base 10.

library/std/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ cfg-if = { version = "1.0", features = ['rustc-dep-of-std'] }
1818
panic_unwind = { path = "../panic_unwind", optional = true }
1919
panic_abort = { path = "../panic_abort" }
2020
core = { path = "../core", public = true }
21-
compiler_builtins = { version = "=0.1.155" }
21+
compiler_builtins = { version = "=0.1.156" }
2222
unwind = { path = "../unwind" }
2323
hashbrown = { version = "0.15", default-features = false, features = [
2424
'rustc-dep-of-std',

library/std/src/path.rs

+17-7
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,15 @@ fn split_file_at_dot(file: &OsStr) -> (&OsStr, Option<&OsStr>) {
353353
}
354354
}
355355

356+
/// Checks whether the string is valid as a file extension, or panics otherwise.
357+
fn validate_extension(extension: &OsStr) {
358+
for &b in extension.as_encoded_bytes() {
359+
if is_sep_byte(b) {
360+
panic!("extension cannot contain path separators: {extension:?}");
361+
}
362+
}
363+
}
364+
356365
////////////////////////////////////////////////////////////////////////////////
357366
// The core iterators
358367
////////////////////////////////////////////////////////////////////////////////
@@ -1507,13 +1516,7 @@ impl PathBuf {
15071516
}
15081517

15091518
fn _set_extension(&mut self, extension: &OsStr) -> bool {
1510-
for &b in extension.as_encoded_bytes() {
1511-
if b < 128 {
1512-
if is_separator(b as char) {
1513-
panic!("extension cannot contain path separators: {:?}", extension);
1514-
}
1515-
}
1516-
}
1519+
validate_extension(extension);
15171520

15181521
let file_stem = match self.file_stem() {
15191522
None => return false,
@@ -1541,6 +1544,11 @@ impl PathBuf {
15411544
/// Returns `false` and does nothing if [`self.file_name`] is [`None`],
15421545
/// returns `true` and updates the extension otherwise.
15431546
///
1547+
/// # Panics
1548+
///
1549+
/// Panics if the passed extension contains a path separator (see
1550+
/// [`is_separator`]).
1551+
///
15441552
/// # Caveats
15451553
///
15461554
/// The appended `extension` may contain dots and will be used in its entirety,
@@ -1582,6 +1590,8 @@ impl PathBuf {
15821590
}
15831591

15841592
fn _add_extension(&mut self, extension: &OsStr) -> bool {
1593+
validate_extension(extension);
1594+
15851595
let file_name = match self.file_name() {
15861596
None => return false,
15871597
Some(f) => f.as_encoded_bytes(),

library/std/src/sys/process/unix/unix.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,7 @@ impl Command {
415415
all(target_os = "linux", target_env = "musl"),
416416
target_os = "nto",
417417
target_vendor = "apple",
418+
target_os = "cygwin",
418419
)))]
419420
fn posix_spawn(
420421
&mut self,
@@ -433,6 +434,7 @@ impl Command {
433434
all(target_os = "linux", target_env = "musl"),
434435
target_os = "nto",
435436
target_vendor = "apple",
437+
target_os = "cygwin",
436438
))]
437439
fn posix_spawn(
438440
&mut self,
@@ -584,7 +586,7 @@ impl Command {
584586
/// Some platforms can set a new working directory for a spawned process in the
585587
/// `posix_spawn` path. This function looks up the function pointer for adding
586588
/// such an action to a `posix_spawn_file_actions_t` struct.
587-
#[cfg(not(all(target_os = "linux", target_env = "musl")))]
589+
#[cfg(not(any(all(target_os = "linux", target_env = "musl"), target_os = "cygwin")))]
588590
fn get_posix_spawn_addchdir() -> Option<PosixSpawnAddChdirFn> {
589591
use crate::sys::weak::weak;
590592

@@ -618,7 +620,9 @@ impl Command {
618620
/// Weak symbol lookup doesn't work with statically linked libcs, so in cases
619621
/// where static linking is possible we need to either check for the presence
620622
/// of the symbol at compile time or know about it upfront.
621-
#[cfg(all(target_os = "linux", target_env = "musl"))]
623+
///
624+
/// Cygwin doesn't support weak symbol, so just link it.
625+
#[cfg(any(all(target_os = "linux", target_env = "musl"), target_os = "cygwin"))]
622626
fn get_posix_spawn_addchdir() -> Option<PosixSpawnAddChdirFn> {
623627
// Our minimum required musl supports this function, so we can just use it.
624628
Some(libc::posix_spawn_file_actions_addchdir_np)

library/std/tests/floats/f128.rs

+2
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ fn test_nan() {
112112
assert!(!nan.is_sign_negative());
113113
assert!(!nan.is_normal());
114114
assert_eq!(Fp::Nan, nan.classify());
115+
// Ensure the quiet bit is set.
116+
assert!(nan.to_bits() & (1 << (f128::MANTISSA_DIGITS - 2)) != 0);
115117
}
116118

117119
#[test]

library/std/tests/floats/f16.rs

+2
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ fn test_nan() {
9595
assert!(!nan.is_sign_negative());
9696
assert!(!nan.is_normal());
9797
assert_eq!(Fp::Nan, nan.classify());
98+
// Ensure the quiet bit is set.
99+
assert!(nan.to_bits() & (1 << (f16::MANTISSA_DIGITS - 2)) != 0);
98100
}
99101

100102
#[test]

library/std/tests/floats/f32.rs

+2
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ fn test_nan() {
7272
assert!(nan.is_sign_positive());
7373
assert!(!nan.is_sign_negative());
7474
assert_eq!(Fp::Nan, nan.classify());
75+
// Ensure the quiet bit is set.
76+
assert!(nan.to_bits() & (1 << (f32::MANTISSA_DIGITS - 2)) != 0);
7577
}
7678

7779
#[test]

library/std/tests/floats/f64.rs

+2
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ fn test_nan() {
6060
assert!(nan.is_sign_positive());
6161
assert!(!nan.is_sign_negative());
6262
assert_eq!(Fp::Nan, nan.classify());
63+
// Ensure the quiet bit is set.
64+
assert!(nan.to_bits() & (1 << (f64::MANTISSA_DIGITS - 2)) != 0);
6365
}
6466

6567
#[test]

0 commit comments

Comments
 (0)