Merge from rustc

This commit is contained in:
Ralf Jung 2025-04-24 10:57:54 +02:00
commit 6496974882
906 changed files with 16696 additions and 9370 deletions

View file

@ -67,9 +67,9 @@ dependencies = [
[[package]]
name = "compiler_builtins"
version = "0.1.155"
version = "0.1.156"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "341e0830ca6170a4fcf02e92e57daf4b6f10142d48da32a547023867a6c8b35e"
checksum = "c1ffbd2789fe5bb95b96a2e22cbe3128239dc46ff0374e0d38e9f102062d7055"
dependencies = [
"cc",
"rustc-std-workspace-core",

View file

@ -16,7 +16,7 @@ bench = false
[dependencies]
core = { path = "../core", public = true }
compiler_builtins = { version = "=0.1.155", features = ['rustc-dep-of-std'] }
compiler_builtins = { version = "=0.1.156", features = ['rustc-dep-of-std'] }
[features]
compiler-builtins-mem = ['compiler_builtins/mem']

View file

@ -18,7 +18,7 @@ cfg-if = { version = "1.0", features = ['rustc-dep-of-std'] }
panic_unwind = { path = "../panic_unwind", optional = true }
panic_abort = { path = "../panic_abort" }
core = { path = "../core", public = true }
compiler_builtins = { version = "=0.1.155" }
compiler_builtins = { version = "=0.1.156" }
unwind = { path = "../unwind" }
hashbrown = { version = "0.15", default-features = false, features = [
'rustc-dep-of-std',

View file

@ -353,6 +353,15 @@ fn split_file_at_dot(file: &OsStr) -> (&OsStr, Option<&OsStr>) {
}
}
/// Checks whether the string is valid as a file extension, or panics otherwise.
fn validate_extension(extension: &OsStr) {
for &b in extension.as_encoded_bytes() {
if is_sep_byte(b) {
panic!("extension cannot contain path separators: {extension:?}");
}
}
}
////////////////////////////////////////////////////////////////////////////////
// The core iterators
////////////////////////////////////////////////////////////////////////////////
@ -1507,13 +1516,7 @@ impl PathBuf {
}
fn _set_extension(&mut self, extension: &OsStr) -> bool {
for &b in extension.as_encoded_bytes() {
if b < 128 {
if is_separator(b as char) {
panic!("extension cannot contain path separators: {:?}", extension);
}
}
}
validate_extension(extension);
let file_stem = match self.file_stem() {
None => return false,
@ -1541,6 +1544,11 @@ impl PathBuf {
/// Returns `false` and does nothing if [`self.file_name`] is [`None`],
/// returns `true` and updates the extension otherwise.
///
/// # Panics
///
/// Panics if the passed extension contains a path separator (see
/// [`is_separator`]).
///
/// # Caveats
///
/// The appended `extension` may contain dots and will be used in its entirety,
@ -1582,6 +1590,8 @@ impl PathBuf {
}
fn _add_extension(&mut self, extension: &OsStr) -> bool {
validate_extension(extension);
let file_name = match self.file_name() {
None => return false,
Some(f) => f.as_encoded_bytes(),