Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 8 pull requests #138448

Merged
merged 42 commits into from
Mar 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
d577883
metadata: Ignore sysroot when doing the manual native lib search in r…
petrochenkov Mar 9, 2025
b526668
Copy from userspace to MaybeUninit
Feb 28, 2025
8c7a94e
Implement read_buf and vectored read/write for SGX stdio
thaliaarchi Feb 7, 2025
87ca2db
Apply rustc-0023-Add-Trusty-OS-support-to-Rust-std.patch
randomPoison Feb 4, 2025
7f6ee12
Apply rustc-0054-Add-std-os-fd-support-for-Trusty.patch
randomPoison Feb 4, 2025
d633d8e
Format after patches have been applied
randomPoison Feb 4, 2025
22fea97
Disable unsupported tests
randomPoison Feb 4, 2025
5b94113
Update Trusty platform docs
randomPoison Feb 11, 2025
0b1a7ab
Remove custom TLS implementation for Trusty targets
randomPoison Feb 19, 2025
f5dd3d1
Update Trusty support to account for recent libstd reorganization
randomPoison Mar 10, 2025
2b3b0bd
Remove unused file
randomPoison Mar 10, 2025
c0957ef
naked functions: on windows emit `.endef` without the symbol name
folkertdev Mar 10, 2025
590b277
Add a test for new 2024 standard library behavior
ehuss Feb 11, 2025
0e071c2
Migrate core to Rust 2024
ehuss Feb 11, 2025
f505d4e
Migrate alloc to Rust 2024
ehuss Feb 11, 2025
b9454af
Migrate panic_abort to Rust 2024
ehuss Feb 11, 2025
985f66b
Migrate panic_unwind to Rust 2024
ehuss Feb 12, 2025
540ef90
Migrate unwind to Rust 2024
ehuss Feb 12, 2025
993359e
Migrate std to Rust 2024
ehuss Feb 12, 2025
f1a9513
Migrate test to Rust 2024
ehuss Feb 12, 2025
0b2489c
Migrate proc_macro to Rust 2024
ehuss Feb 12, 2025
80311c4
Migrate profiler_builtins to Rust 2024
ehuss Feb 12, 2025
32c61f7
Migrated the rustc-std-workspace crates to Rust 2024
ehuss Feb 12, 2025
ba06ce6
Migrate the sysroot crate to Rust 2024
ehuss Feb 12, 2025
b130747
Migrate windows-targets to Rust 2024
ehuss Feb 12, 2025
d3c55cd
Remove unnecessary parens
randomPoison Mar 11, 2025
53f488a
Simulate OOM for the `try_oom_error` test
cuviper Mar 11, 2025
c62aa0b
Fix `UserRef<[T]>::copy_to_enclave_vec`
thaliaarchi Feb 26, 2025
d3d7a6d
remove rls support from bootstrap
onur-ozkan Mar 10, 2025
ac819aa
remove rls specific parts from tidy and build-manifest
onur-ozkan Mar 10, 2025
56d0b16
remove rls source from the repository
onur-ozkan Mar 10, 2025
707d4b7
add change entry for rls removal
onur-ozkan Mar 12, 2025
0a47792
rustdoc-json: Extract Id handling into its own module
aDotInTheVoid Dec 5, 2024
a05d6ab
rustdoc-json: Clean up & Document id handling
aDotInTheVoid Dec 6, 2024
3b1776d
Rollup merge of #126856 - onur-ozkan:remove-rls, r=clubby789
matthiaskrgr Mar 13, 2025
b3ab695
Rollup merge of #133981 - aDotInTheVoid:document-docs-ids, r=fmease
matthiaskrgr Mar 13, 2025
a488cf8
Rollup merge of #136842 - randomPoison:trusty-libstd-v3, r=ChrisDenton
matthiaskrgr Mar 13, 2025
9527572
Rollup merge of #137355 - thaliaarchi:io-optional-methods/sgx, r=Chri…
matthiaskrgr Mar 13, 2025
448aa30
Rollup merge of #138162 - ehuss:library-2024, r=cuviper
matthiaskrgr Mar 13, 2025
5ae93cf
Rollup merge of #138273 - petrochenkov:nonatroot, r=bjorn3
matthiaskrgr Mar 13, 2025
1827ffd
Rollup merge of #138346 - folkertdev:naked-asm-windows-endef, r=Chris…
matthiaskrgr Mar 13, 2025
3bfce83
Rollup merge of #138370 - cuviper:try_oom_error, r=jhpratt
matthiaskrgr Mar 13, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3045,13 +3045,6 @@ dependencies = [
"serde",
]

[[package]]
name = "rls"
version = "2.0.0"
dependencies = [
"serde_json",
]

[[package]]
name = "run_make_support"
version = "0.2.0"
Expand Down
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ members = [
"src/tools/remote-test-server",
"src/tools/rust-installer",
"src/tools/rustdoc",
"src/tools/rls",
"src/tools/rustfmt",
"src/tools/miri",
"src/tools/miri/cargo-miri",
Expand Down
26 changes: 12 additions & 14 deletions compiler/rustc_codegen_ssa/src/back/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ use rustc_fs_util::{fix_windows_verbatim_for_gcc, try_canonicalize};
use rustc_hir::def_id::{CrateNum, LOCAL_CRATE};
use rustc_macros::LintDiagnostic;
use rustc_metadata::fs::{METADATA_FILENAME, copy_to_stdout, emit_wrapper_file};
use rustc_metadata::{find_native_static_library, walk_native_lib_search_dirs};
use rustc_metadata::{
NativeLibSearchFallback, find_native_static_library, walk_native_lib_search_dirs,
};
use rustc_middle::bug;
use rustc_middle::lint::lint_level;
use rustc_middle::middle::debugger_visualizer::DebuggerVisualizerFile;
Expand Down Expand Up @@ -2129,19 +2131,15 @@ fn add_library_search_dirs(
return;
}

walk_native_lib_search_dirs(
sess,
self_contained_components,
apple_sdk_root,
|dir, is_framework| {
if is_framework {
cmd.framework_path(dir);
} else {
cmd.include_path(&fix_windows_verbatim_for_gcc(dir));
}
ControlFlow::<()>::Continue(())
},
);
let fallback = Some(NativeLibSearchFallback { self_contained_components, apple_sdk_root });
walk_native_lib_search_dirs(sess, fallback, |dir, is_framework| {
if is_framework {
cmd.framework_path(dir);
} else {
cmd.include_path(&fix_windows_verbatim_for_gcc(dir));
}
ControlFlow::<()>::Continue(())
});
}

/// Add options making relocation sections in the produced ELF files read-only
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_ssa/src/mir/naked_asm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ fn prefix_and_suffix<'tcx>(
writeln!(begin, ".def {asm_name}").unwrap();
writeln!(begin, ".scl 2").unwrap();
writeln!(begin, ".type 32").unwrap();
writeln!(begin, ".endef {asm_name}").unwrap();
writeln!(begin, ".endef").unwrap();
writeln!(begin, "{asm_name}:").unwrap();

writeln!(end).unwrap();
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_metadata/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ pub mod locator;
pub use creader::{DylibError, load_symbol_from_dylib};
pub use fs::{METADATA_FILENAME, emit_wrapper_file};
pub use native_libs::{
find_native_static_library, try_find_native_dynamic_library, try_find_native_static_library,
walk_native_lib_search_dirs,
NativeLibSearchFallback, find_native_static_library, try_find_native_dynamic_library,
try_find_native_static_library, walk_native_lib_search_dirs,
};
pub use rmeta::{EncodedMetadata, METADATA_HEADER, encode_metadata, rendered_const};

Expand Down
63 changes: 32 additions & 31 deletions compiler/rustc_metadata/src/native_libs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,17 @@ use rustc_target::spec::{BinaryFormat, LinkSelfContainedComponents};

use crate::{errors, fluent_generated};

/// The fallback directories are passed to linker, but not used when rustc does the search,
/// because in the latter case the set of fallback directories cannot always be determined
/// consistently at the moment.
pub struct NativeLibSearchFallback<'a> {
pub self_contained_components: LinkSelfContainedComponents,
pub apple_sdk_root: Option<&'a Path>,
}

pub fn walk_native_lib_search_dirs<R>(
sess: &Session,
self_contained_components: LinkSelfContainedComponents,
apple_sdk_root: Option<&Path>,
fallback: Option<NativeLibSearchFallback<'_>>,
mut f: impl FnMut(&Path, bool /*is_framework*/) -> ControlFlow<R>,
) -> ControlFlow<R> {
// Library search paths explicitly supplied by user (`-L` on the command line).
Expand All @@ -38,6 +45,11 @@ pub fn walk_native_lib_search_dirs<R>(
}
}

let Some(NativeLibSearchFallback { self_contained_components, apple_sdk_root }) = fallback
else {
return ControlFlow::Continue(());
};

// The toolchain ships some native library components and self-contained linking was enabled.
// Add the self-contained library directory to search paths.
if self_contained_components.intersects(
Expand Down Expand Up @@ -93,23 +105,17 @@ pub fn try_find_native_static_library(
if os == unix { vec![os] } else { vec![os, unix] }
};

// FIXME: Account for self-contained linking settings and Apple SDK.
walk_native_lib_search_dirs(
sess,
LinkSelfContainedComponents::empty(),
None,
|dir, is_framework| {
if !is_framework {
for (prefix, suffix) in &formats {
let test = dir.join(format!("{prefix}{name}{suffix}"));
if test.exists() {
return ControlFlow::Break(test);
}
walk_native_lib_search_dirs(sess, None, |dir, is_framework| {
if !is_framework {
for (prefix, suffix) in &formats {
let test = dir.join(format!("{prefix}{name}{suffix}"));
if test.exists() {
return ControlFlow::Break(test);
}
}
ControlFlow::Continue(())
},
)
}
ControlFlow::Continue(())
})
.break_value()
}

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

walk_native_lib_search_dirs(
sess,
LinkSelfContainedComponents::empty(),
None,
|dir, is_framework| {
if !is_framework {
for (prefix, suffix) in &formats {
let test = dir.join(format!("{prefix}{name}{suffix}"));
if test.exists() {
return ControlFlow::Break(test);
}
walk_native_lib_search_dirs(sess, None, |dir, is_framework| {
if !is_framework {
for (prefix, suffix) in &formats {
let test = dir.join(format!("{prefix}{name}{suffix}"));
if test.exists() {
return ControlFlow::Break(test);
}
}
ControlFlow::Continue(())
},
)
}
ControlFlow::Continue(())
})
.break_value()
}

Expand Down
2 changes: 1 addition & 1 deletion library/alloc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ repository = "https://github.com/rust-lang/rust.git"
description = "The Rust core allocation and collections library"
autotests = false
autobenches = false
edition = "2021"
edition = "2024"

[lib]
test = false
Expand Down
2 changes: 1 addition & 1 deletion library/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ autobenches = false
# If you update this, be sure to update it in a bunch of other places too!
# As of 2024, it was src/tools/opt-dist, the core-no-fp-fmt-parse test and
# the version of the prelude imported in core/lib.rs.
edition = "2021"
edition = "2024"

[lib]
test = false
Expand Down
2 changes: 1 addition & 1 deletion library/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ extern crate self as core;

#[prelude_import]
#[allow(unused)]
use prelude::rust_2021::*;
use prelude::rust_2024::*;

#[cfg(not(test))] // See #65860
#[macro_use]
Expand Down
2 changes: 1 addition & 1 deletion library/panic_abort/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = "0.0.0"
license = "MIT OR Apache-2.0"
repository = "https://github.com/rust-lang/rust.git"
description = "Implementation of Rust panics via process aborts"
edition = "2021"
edition = "2024"

[lib]
test = false
Expand Down
2 changes: 1 addition & 1 deletion library/panic_unwind/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = "0.0.0"
license = "MIT OR Apache-2.0"
repository = "https://github.com/rust-lang/rust.git"
description = "Implementation of Rust panics via stack unwinding"
edition = "2021"
edition = "2024"

[lib]
test = false
Expand Down
2 changes: 1 addition & 1 deletion library/proc_macro/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "proc_macro"
version = "0.0.0"
edition = "2021"
edition = "2024"

[dependencies]
std = { path = "../std" }
Expand Down
2 changes: 1 addition & 1 deletion library/profiler_builtins/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "profiler_builtins"
version = "0.0.0"
edition = "2021"
edition = "2024"

[lib]
test = false
Expand Down
2 changes: 1 addition & 1 deletion library/rustc-std-workspace-alloc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ license = 'MIT OR Apache-2.0'
description = """
Hack for the compiler's own build system
"""
edition = "2021"
edition = "2024"

[lib]
path = "lib.rs"
Expand Down
2 changes: 1 addition & 1 deletion library/rustc-std-workspace-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ license = 'MIT OR Apache-2.0'
description = """
Hack for the compiler's own build system
"""
edition = "2021"
edition = "2024"

[lib]
path = "lib.rs"
Expand Down
2 changes: 1 addition & 1 deletion library/rustc-std-workspace-std/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ license = 'MIT OR Apache-2.0'
description = """
Hack for the compiler's own build system
"""
edition = "2021"
edition = "2024"

[lib]
path = "lib.rs"
Expand Down
2 changes: 1 addition & 1 deletion library/std/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ version = "0.0.0"
license = "MIT OR Apache-2.0"
repository = "https://github.com/rust-lang/rust.git"
description = "The Rust Standard Library"
edition = "2021"
edition = "2024"
autobenches = false

[lib]
Expand Down
1 change: 1 addition & 0 deletions library/std/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ fn main() {
|| target_os == "fuchsia"
|| (target_vendor == "fortanix" && target_env == "sgx")
|| target_os == "hermit"
|| target_os == "trusty"
|| target_os == "l4re"
|| target_os == "redox"
|| target_os == "haiku"
Expand Down
3 changes: 2 additions & 1 deletion library/std/src/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
target_os = "emscripten",
target_os = "wasi",
target_env = "sgx",
target_os = "xous"
target_os = "xous",
target_os = "trusty",
))
))]
mod tests;
Expand Down
16 changes: 10 additions & 6 deletions library/std/src/io/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -811,13 +811,17 @@ fn read_to_end_error() {
}

#[test]
// Miri does not support signalling OOM
#[cfg_attr(miri, ignore)]
// 64-bit only to be sure the allocator will fail fast on an impossible to satisfy size
#[cfg(target_pointer_width = "64")]
fn try_oom_error() {
let mut v = Vec::<u8>::new();
let reserve_err = v.try_reserve(isize::MAX as usize - 1).unwrap_err();
use alloc::alloc::Layout;
use alloc::collections::{TryReserveError, TryReserveErrorKind};

// We simulate a `Vec::try_reserve` error rather than attempting a huge size for real. This way
// we're not subject to the whims of optimization that might skip the actual allocation, and it
// also works for 32-bit targets and miri that might not OOM at all.
let layout = Layout::new::<u8>();
let kind = TryReserveErrorKind::AllocError { layout, non_exhaustive: () };
let reserve_err = TryReserveError::from(kind);

let io_err = io::Error::from(reserve_err);
assert_eq!(io::ErrorKind::OutOfMemory, io_err.kind());
}
2 changes: 1 addition & 1 deletion library/std/src/keyword_docs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1064,7 +1064,7 @@ mod move_keyword {}
/// ```rust,compile_fail,E0502
/// let mut v = vec![0, 1];
/// let mut_ref_v = &mut v;
/// ##[allow(unused)]
/// # #[allow(unused)]
/// let ref_v = &v;
/// mut_ref_v.push(2);
/// ```
Expand Down
3 changes: 2 additions & 1 deletion library/std/src/net/tcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
not(any(
target_os = "emscripten",
all(target_os = "wasi", target_env = "p1"),
target_os = "xous"
target_os = "xous",
target_os = "trusty",
))
))]
mod tests;
Expand Down
3 changes: 2 additions & 1 deletion library/std/src/net/udp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
target_os = "emscripten",
all(target_os = "wasi", target_env = "p1"),
target_env = "sgx",
target_os = "xous"
target_os = "xous",
target_os = "trusty",
))
))]
mod tests;
Expand Down
1 change: 1 addition & 0 deletions library/std/src/os/fd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ mod raw;
mod owned;

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

#[cfg(test)]
Expand Down
Loading
Loading