Skip to content

Commit a2aba05

Browse files
committed
Auto merge of rust-lang#138448 - matthiaskrgr:rollup-3onhkse, r=matthiaskrgr
Rollup of 8 pull requests Successful merges: - rust-lang#126856 (remove deprecated tool `rls`) - rust-lang#133981 (rustdoc-json: Refractor and document Id's) - rust-lang#136842 (Add libstd support for Trusty targets) - rust-lang#137355 (Implement `read_buf` and vectored read/write for SGX stdio) - rust-lang#138162 (Update the standard library to Rust 2024) - rust-lang#138273 (metadata: Ignore sysroot when doing the manual native lib search in rustc) - rust-lang#138346 (naked functions: on windows emit `.endef` without the symbol name) - rust-lang#138370 (Simulate OOM for the `try_oom_error` test) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 961351c + 3bfce83 commit a2aba05

File tree

74 files changed

+560
-406
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+560
-406
lines changed

Cargo.lock

-7
Original file line numberDiff line numberDiff line change
@@ -3045,13 +3045,6 @@ dependencies = [
30453045
"serde",
30463046
]
30473047

3048-
[[package]]
3049-
name = "rls"
3050-
version = "2.0.0"
3051-
dependencies = [
3052-
"serde_json",
3053-
]
3054-
30553048
[[package]]
30563049
name = "run_make_support"
30573050
version = "0.2.0"

Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ members = [
2424
"src/tools/remote-test-server",
2525
"src/tools/rust-installer",
2626
"src/tools/rustdoc",
27-
"src/tools/rls",
2827
"src/tools/rustfmt",
2928
"src/tools/miri",
3029
"src/tools/miri/cargo-miri",

compiler/rustc_codegen_ssa/src/back/link.rs

+12-14
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ use rustc_fs_util::{fix_windows_verbatim_for_gcc, try_canonicalize};
2222
use rustc_hir::def_id::{CrateNum, LOCAL_CRATE};
2323
use rustc_macros::LintDiagnostic;
2424
use rustc_metadata::fs::{METADATA_FILENAME, copy_to_stdout, emit_wrapper_file};
25-
use rustc_metadata::{find_native_static_library, walk_native_lib_search_dirs};
25+
use rustc_metadata::{
26+
NativeLibSearchFallback, find_native_static_library, walk_native_lib_search_dirs,
27+
};
2628
use rustc_middle::bug;
2729
use rustc_middle::lint::lint_level;
2830
use rustc_middle::middle::debugger_visualizer::DebuggerVisualizerFile;
@@ -2129,19 +2131,15 @@ fn add_library_search_dirs(
21292131
return;
21302132
}
21312133

2132-
walk_native_lib_search_dirs(
2133-
sess,
2134-
self_contained_components,
2135-
apple_sdk_root,
2136-
|dir, is_framework| {
2137-
if is_framework {
2138-
cmd.framework_path(dir);
2139-
} else {
2140-
cmd.include_path(&fix_windows_verbatim_for_gcc(dir));
2141-
}
2142-
ControlFlow::<()>::Continue(())
2143-
},
2144-
);
2134+
let fallback = Some(NativeLibSearchFallback { self_contained_components, apple_sdk_root });
2135+
walk_native_lib_search_dirs(sess, fallback, |dir, is_framework| {
2136+
if is_framework {
2137+
cmd.framework_path(dir);
2138+
} else {
2139+
cmd.include_path(&fix_windows_verbatim_for_gcc(dir));
2140+
}
2141+
ControlFlow::<()>::Continue(())
2142+
});
21452143
}
21462144

21472145
/// Add options making relocation sections in the produced ELF files read-only

compiler/rustc_codegen_ssa/src/mir/naked_asm.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ fn prefix_and_suffix<'tcx>(
245245
writeln!(begin, ".def {asm_name}").unwrap();
246246
writeln!(begin, ".scl 2").unwrap();
247247
writeln!(begin, ".type 32").unwrap();
248-
writeln!(begin, ".endef {asm_name}").unwrap();
248+
writeln!(begin, ".endef").unwrap();
249249
writeln!(begin, "{asm_name}:").unwrap();
250250

251251
writeln!(end).unwrap();

compiler/rustc_metadata/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ pub mod locator;
3535
pub use creader::{DylibError, load_symbol_from_dylib};
3636
pub use fs::{METADATA_FILENAME, emit_wrapper_file};
3737
pub use native_libs::{
38-
find_native_static_library, try_find_native_dynamic_library, try_find_native_static_library,
39-
walk_native_lib_search_dirs,
38+
NativeLibSearchFallback, find_native_static_library, try_find_native_dynamic_library,
39+
try_find_native_static_library, walk_native_lib_search_dirs,
4040
};
4141
pub use rmeta::{EncodedMetadata, METADATA_HEADER, encode_metadata, rendered_const};
4242

compiler/rustc_metadata/src/native_libs.rs

+32-31
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,17 @@ use rustc_target::spec::{BinaryFormat, LinkSelfContainedComponents};
2121

2222
use crate::{errors, fluent_generated};
2323

24+
/// The fallback directories are passed to linker, but not used when rustc does the search,
25+
/// because in the latter case the set of fallback directories cannot always be determined
26+
/// consistently at the moment.
27+
pub struct NativeLibSearchFallback<'a> {
28+
pub self_contained_components: LinkSelfContainedComponents,
29+
pub apple_sdk_root: Option<&'a Path>,
30+
}
31+
2432
pub fn walk_native_lib_search_dirs<R>(
2533
sess: &Session,
26-
self_contained_components: LinkSelfContainedComponents,
27-
apple_sdk_root: Option<&Path>,
34+
fallback: Option<NativeLibSearchFallback<'_>>,
2835
mut f: impl FnMut(&Path, bool /*is_framework*/) -> ControlFlow<R>,
2936
) -> ControlFlow<R> {
3037
// Library search paths explicitly supplied by user (`-L` on the command line).
@@ -38,6 +45,11 @@ pub fn walk_native_lib_search_dirs<R>(
3845
}
3946
}
4047

48+
let Some(NativeLibSearchFallback { self_contained_components, apple_sdk_root }) = fallback
49+
else {
50+
return ControlFlow::Continue(());
51+
};
52+
4153
// The toolchain ships some native library components and self-contained linking was enabled.
4254
// Add the self-contained library directory to search paths.
4355
if self_contained_components.intersects(
@@ -93,23 +105,17 @@ pub fn try_find_native_static_library(
93105
if os == unix { vec![os] } else { vec![os, unix] }
94106
};
95107

96-
// FIXME: Account for self-contained linking settings and Apple SDK.
97-
walk_native_lib_search_dirs(
98-
sess,
99-
LinkSelfContainedComponents::empty(),
100-
None,
101-
|dir, is_framework| {
102-
if !is_framework {
103-
for (prefix, suffix) in &formats {
104-
let test = dir.join(format!("{prefix}{name}{suffix}"));
105-
if test.exists() {
106-
return ControlFlow::Break(test);
107-
}
108+
walk_native_lib_search_dirs(sess, None, |dir, is_framework| {
109+
if !is_framework {
110+
for (prefix, suffix) in &formats {
111+
let test = dir.join(format!("{prefix}{name}{suffix}"));
112+
if test.exists() {
113+
return ControlFlow::Break(test);
108114
}
109115
}
110-
ControlFlow::Continue(())
111-
},
112-
)
116+
}
117+
ControlFlow::Continue(())
118+
})
113119
.break_value()
114120
}
115121

@@ -132,22 +138,17 @@ pub fn try_find_native_dynamic_library(
132138
vec![os, meson, mingw]
133139
};
134140

135-
walk_native_lib_search_dirs(
136-
sess,
137-
LinkSelfContainedComponents::empty(),
138-
None,
139-
|dir, is_framework| {
140-
if !is_framework {
141-
for (prefix, suffix) in &formats {
142-
let test = dir.join(format!("{prefix}{name}{suffix}"));
143-
if test.exists() {
144-
return ControlFlow::Break(test);
145-
}
141+
walk_native_lib_search_dirs(sess, None, |dir, is_framework| {
142+
if !is_framework {
143+
for (prefix, suffix) in &formats {
144+
let test = dir.join(format!("{prefix}{name}{suffix}"));
145+
if test.exists() {
146+
return ControlFlow::Break(test);
146147
}
147148
}
148-
ControlFlow::Continue(())
149-
},
150-
)
149+
}
150+
ControlFlow::Continue(())
151+
})
151152
.break_value()
152153
}
153154

library/alloc/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ repository = "https://github.com/rust-lang/rust.git"
88
description = "The Rust core allocation and collections library"
99
autotests = false
1010
autobenches = false
11-
edition = "2021"
11+
edition = "2024"
1212

1313
[lib]
1414
test = false

library/core/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ autobenches = false
99
# If you update this, be sure to update it in a bunch of other places too!
1010
# As of 2024, it was src/tools/opt-dist, the core-no-fp-fmt-parse test and
1111
# the version of the prelude imported in core/lib.rs.
12-
edition = "2021"
12+
edition = "2024"
1313

1414
[lib]
1515
test = false

library/core/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ extern crate self as core;
226226

227227
#[prelude_import]
228228
#[allow(unused)]
229-
use prelude::rust_2021::*;
229+
use prelude::rust_2024::*;
230230

231231
#[cfg(not(test))] // See #65860
232232
#[macro_use]

library/panic_abort/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ version = "0.0.0"
44
license = "MIT OR Apache-2.0"
55
repository = "https://github.com/rust-lang/rust.git"
66
description = "Implementation of Rust panics via process aborts"
7-
edition = "2021"
7+
edition = "2024"
88

99
[lib]
1010
test = false

library/panic_unwind/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ version = "0.0.0"
44
license = "MIT OR Apache-2.0"
55
repository = "https://github.com/rust-lang/rust.git"
66
description = "Implementation of Rust panics via stack unwinding"
7-
edition = "2021"
7+
edition = "2024"
88

99
[lib]
1010
test = false

library/proc_macro/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "proc_macro"
33
version = "0.0.0"
4-
edition = "2021"
4+
edition = "2024"
55

66
[dependencies]
77
std = { path = "../std" }

library/profiler_builtins/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "profiler_builtins"
33
version = "0.0.0"
4-
edition = "2021"
4+
edition = "2024"
55

66
[lib]
77
test = false

library/rustc-std-workspace-alloc/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ license = 'MIT OR Apache-2.0'
55
description = """
66
Hack for the compiler's own build system
77
"""
8-
edition = "2021"
8+
edition = "2024"
99

1010
[lib]
1111
path = "lib.rs"

library/rustc-std-workspace-core/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ license = 'MIT OR Apache-2.0'
55
description = """
66
Hack for the compiler's own build system
77
"""
8-
edition = "2021"
8+
edition = "2024"
99

1010
[lib]
1111
path = "lib.rs"

library/rustc-std-workspace-std/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ license = 'MIT OR Apache-2.0'
55
description = """
66
Hack for the compiler's own build system
77
"""
8-
edition = "2021"
8+
edition = "2024"
99

1010
[lib]
1111
path = "lib.rs"

library/std/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ version = "0.0.0"
66
license = "MIT OR Apache-2.0"
77
repository = "https://github.com/rust-lang/rust.git"
88
description = "The Rust Standard Library"
9-
edition = "2021"
9+
edition = "2024"
1010
autobenches = false
1111

1212
[lib]

library/std/build.rs

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ fn main() {
4242
|| target_os == "fuchsia"
4343
|| (target_vendor == "fortanix" && target_env == "sgx")
4444
|| target_os == "hermit"
45+
|| target_os == "trusty"
4546
|| target_os == "l4re"
4647
|| target_os == "redox"
4748
|| target_os == "haiku"

library/std/src/fs.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
target_os = "emscripten",
1515
target_os = "wasi",
1616
target_env = "sgx",
17-
target_os = "xous"
17+
target_os = "xous",
18+
target_os = "trusty",
1819
))
1920
))]
2021
mod tests;

library/std/src/io/tests.rs

+10-6
Original file line numberDiff line numberDiff line change
@@ -811,13 +811,17 @@ fn read_to_end_error() {
811811
}
812812

813813
#[test]
814-
// Miri does not support signalling OOM
815-
#[cfg_attr(miri, ignore)]
816-
// 64-bit only to be sure the allocator will fail fast on an impossible to satisfy size
817-
#[cfg(target_pointer_width = "64")]
818814
fn try_oom_error() {
819-
let mut v = Vec::<u8>::new();
820-
let reserve_err = v.try_reserve(isize::MAX as usize - 1).unwrap_err();
815+
use alloc::alloc::Layout;
816+
use alloc::collections::{TryReserveError, TryReserveErrorKind};
817+
818+
// We simulate a `Vec::try_reserve` error rather than attempting a huge size for real. This way
819+
// we're not subject to the whims of optimization that might skip the actual allocation, and it
820+
// also works for 32-bit targets and miri that might not OOM at all.
821+
let layout = Layout::new::<u8>();
822+
let kind = TryReserveErrorKind::AllocError { layout, non_exhaustive: () };
823+
let reserve_err = TryReserveError::from(kind);
824+
821825
let io_err = io::Error::from(reserve_err);
822826
assert_eq!(io::ErrorKind::OutOfMemory, io_err.kind());
823827
}

library/std/src/keyword_docs.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1064,7 +1064,7 @@ mod move_keyword {}
10641064
/// ```rust,compile_fail,E0502
10651065
/// let mut v = vec![0, 1];
10661066
/// let mut_ref_v = &mut v;
1067-
/// ##[allow(unused)]
1067+
/// # #[allow(unused)]
10681068
/// let ref_v = &v;
10691069
/// mut_ref_v.push(2);
10701070
/// ```

library/std/src/net/tcp.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
not(any(
66
target_os = "emscripten",
77
all(target_os = "wasi", target_env = "p1"),
8-
target_os = "xous"
8+
target_os = "xous",
9+
target_os = "trusty",
910
))
1011
))]
1112
mod tests;

library/std/src/net/udp.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
target_os = "emscripten",
55
all(target_os = "wasi", target_env = "p1"),
66
target_env = "sgx",
7-
target_os = "xous"
7+
target_os = "xous",
8+
target_os = "trusty",
89
))
910
))]
1011
mod tests;

library/std/src/os/fd/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ mod raw;
1313
mod owned;
1414

1515
// Implementations for `AsRawFd` etc. for network types.
16+
#[cfg(not(target_os = "trusty"))]
1617
mod net;
1718

1819
#[cfg(test)]

0 commit comments

Comments
 (0)