about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2025-07-12 10:46:43 +0000
committerbors <bors@rust-lang.org>2025-07-12 10:46:43 +0000
commit915e5352448afb3c24f89117468935283bc7d2cf (patch)
treeac0ac961244ebef72739761db1bc143f29e3e8c6 /src
parent2f9c9cede68be26774ea44efc79d0391f1c58af2 (diff)
parent324bc31c16a69e996064bf40d191d185dd279d2d (diff)
downloadrust-915e5352448afb3c24f89117468935283bc7d2cf.tar.gz
rust-915e5352448afb3c24f89117468935283bc7d2cf.zip
Auto merge of #143810 - matthiaskrgr:rollup-iw7a23z, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - rust-lang/rust#143403 (Port several trait/coherence-related attributes the new attribute system)
 - rust-lang/rust#143633 (fix: correct assertion to check for 'noinline' attribute presence before removal)
 - rust-lang/rust#143647 (Clarify and expand documentation for std::sys_common dependency structure)
 - rust-lang/rust#143716 (compiler: doc/comment some codegen-for-functions interfaces)
 - rust-lang/rust#143747 (Add target maintainer information for aarch64-unknown-linux-musl)
 - rust-lang/rust#143759 (Fix typos in function names in the `target_feature` test)
 - rust-lang/rust#143767 (Bump `src/tools/x` to Edition 2024 and some cleanups)
 - rust-lang/rust#143769 (Remove support for SwitchInt edge effects in backward dataflow)
 - rust-lang/rust#143770 (build-helper: clippy fixes)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'src')
-rw-r--r--src/build_helper/src/ci.rs2
-rw-r--r--src/build_helper/src/git.rs32
-rw-r--r--src/build_helper/src/metrics.rs2
-rw-r--r--src/build_helper/src/util.rs15
-rw-r--r--src/doc/rustc/src/SUMMARY.md1
-rw-r--r--src/doc/rustc/src/platform-support.md2
-rw-r--r--src/doc/rustc/src/platform-support/aarch64-unknown-linux-musl.md49
-rw-r--r--src/tools/x/Cargo.toml2
-rw-r--r--src/tools/x/src/main.rs22
9 files changed, 86 insertions, 41 deletions
diff --git a/src/build_helper/src/ci.rs b/src/build_helper/src/ci.rs
index 9d114c70a67..b5e70eb84cc 100644
--- a/src/build_helper/src/ci.rs
+++ b/src/build_helper/src/ci.rs
@@ -9,7 +9,7 @@ pub enum CiEnv {
 impl CiEnv {
     /// Obtains the current CI environment.
     pub fn current() -> CiEnv {
-        if std::env::var("GITHUB_ACTIONS").map_or(false, |e| e == "true") {
+        if std::env::var("GITHUB_ACTIONS").is_ok_and(|e| e == "true") {
             CiEnv::GitHubActions
         } else {
             CiEnv::None
diff --git a/src/build_helper/src/git.rs b/src/build_helper/src/git.rs
index 9d1195aadf8..cbefb836c00 100644
--- a/src/build_helper/src/git.rs
+++ b/src/build_helper/src/git.rs
@@ -13,7 +13,7 @@ pub struct GitConfig<'a> {
 pub fn output_result(cmd: &mut Command) -> Result<String, String> {
     let output = match cmd.stderr(Stdio::inherit()).output() {
         Ok(status) => status,
-        Err(e) => return Err(format!("failed to run command: {:?}: {}", cmd, e)),
+        Err(e) => return Err(format!("failed to run command: {cmd:?}: {e}")),
     };
     if !output.status.success() {
         return Err(format!(
@@ -62,22 +62,22 @@ pub enum PathFreshness {
 /// The function behaves differently in CI and outside CI.
 ///
 /// - Outside CI, we want to find out if `target_paths` were modified in some local commit on
-/// top of the latest upstream commit that is available in local git history.
-/// If not, we try to find the most recent upstream commit (which we assume are commits
-/// made by bors) that modified `target_paths`.
-/// We don't want to simply take the latest master commit to avoid changing the output of
-/// this function frequently after rebasing on the latest master branch even if `target_paths`
-/// were not modified upstream in the meantime. In that case we would be redownloading CI
-/// artifacts unnecessarily.
+///   top of the latest upstream commit that is available in local git history.
+///   If not, we try to find the most recent upstream commit (which we assume are commits
+///   made by bors) that modified `target_paths`.
+///   We don't want to simply take the latest master commit to avoid changing the output of
+///   this function frequently after rebasing on the latest master branch even if `target_paths`
+///   were not modified upstream in the meantime. In that case we would be redownloading CI
+///   artifacts unnecessarily.
 ///
 /// - In CI, we use a shallow clone of depth 2, i.e., we fetch only a single parent commit
-/// (which will be the most recent bors merge commit) and do not have access
-/// to the full git history. Luckily, we only need to distinguish between two situations:
-/// 1) The current PR made modifications to `target_paths`.
-/// In that case, a build is typically necessary.
-/// 2) The current PR did not make modifications to `target_paths`.
-/// In that case we simply take the latest upstream commit, because on CI there is no need to avoid
-/// redownloading.
+///   (which will be the most recent bors merge commit) and do not have access
+///   to the full git history. Luckily, we only need to distinguish between two situations:
+///   1) The current PR made modifications to `target_paths`.
+///      In that case, a build is typically necessary.
+///   2) The current PR did not make modifications to `target_paths`.
+///      In that case we simply take the latest upstream commit, because on CI there is no need to avoid
+///      redownloading.
 pub fn check_path_modifications(
     git_dir: &Path,
     config: &GitConfig<'_>,
@@ -232,7 +232,7 @@ pub fn get_closest_upstream_commit(
         "--author-date-order",
         &format!("--author={}", config.git_merge_commit_email),
         "-n1",
-        &base,
+        base,
     ]);
 
     let output = output_result(&mut git)?.trim().to_owned();
diff --git a/src/build_helper/src/metrics.rs b/src/build_helper/src/metrics.rs
index 8b82e62a327..07157e36415 100644
--- a/src/build_helper/src/metrics.rs
+++ b/src/build_helper/src/metrics.rs
@@ -141,7 +141,7 @@ impl BuildStep {
                 } => {
                     let full_name = format!("{parent_name}-{kind}");
                     let children: Vec<_> =
-                        children.into_iter().filter_map(|s| parse(s, &full_name)).collect();
+                        children.iter().filter_map(|s| parse(s, &full_name)).collect();
                     let children_duration = children.iter().map(|c| c.duration).sum::<Duration>();
                     Some(BuildStep {
                         r#type: kind.to_string(),
diff --git a/src/build_helper/src/util.rs b/src/build_helper/src/util.rs
index 80dd6813d13..a8355f774e9 100644
--- a/src/build_helper/src/util.rs
+++ b/src/build_helper/src/util.rs
@@ -18,29 +18,28 @@ macro_rules! exit {
 pub fn detail_exit(code: i32, is_test: bool) -> ! {
     // if in test and code is an error code, panic with status code provided
     if is_test {
-        panic!("status code: {}", code);
+        panic!("status code: {code}");
     } else {
-        // otherwise,exit with provided status code
+        // otherwise, exit with provided status code
         std::process::exit(code);
     }
 }
 
 pub fn fail(s: &str) -> ! {
-    eprintln!("\n\n{}\n\n", s);
+    eprintln!("\n\n{s}\n\n");
     detail_exit(1, cfg!(test));
 }
 
 pub fn try_run(cmd: &mut Command, print_cmd_on_fail: bool) -> Result<(), ()> {
     let status = match cmd.status() {
         Ok(status) => status,
-        Err(e) => fail(&format!("failed to execute command: {:?}\nerror: {}", cmd, e)),
+        Err(e) => fail(&format!("failed to execute command: {cmd:?}\nerror: {e}")),
     };
     if !status.success() {
         if print_cmd_on_fail {
             println!(
-                "\n\ncommand did not execute successfully: {:?}\n\
-                 expected success, got: {}\n\n",
-                cmd, status
+                "\n\ncommand did not execute successfully: {cmd:?}\n\
+                 expected success, got: {status}\n\n"
             );
         }
         Err(())
@@ -60,7 +59,7 @@ pub fn parse_gitmodules(target_dir: &Path) -> Vec<String> {
     for line in BufReader::new(file).lines().map_while(Result::ok) {
         let line = line.trim();
         if line.starts_with("path") {
-            let actual_path = line.split(' ').last().expect("Couldn't get value of path");
+            let actual_path = line.split(' ').next_back().expect("Couldn't get value of path");
             submodules_paths.push(actual_path.to_owned());
         }
     }
diff --git a/src/doc/rustc/src/SUMMARY.md b/src/doc/rustc/src/SUMMARY.md
index e1742631f63..7c688e32bc0 100644
--- a/src/doc/rustc/src/SUMMARY.md
+++ b/src/doc/rustc/src/SUMMARY.md
@@ -46,6 +46,7 @@
     - [\*-apple-watchos](platform-support/apple-watchos.md)
     - [\*-apple-visionos](platform-support/apple-visionos.md)
     - [aarch64-nintendo-switch-freestanding](platform-support/aarch64-nintendo-switch-freestanding.md)
+    - [aarch64-unknown-linux-musl](platform-support/aarch64-unknown-linux-musl.md)
     - [amdgcn-amd-amdhsa](platform-support/amdgcn-amd-amdhsa.md)
     - [armeb-unknown-linux-gnueabi](platform-support/armeb-unknown-linux-gnueabi.md)
     - [arm-none-eabi](platform-support/arm-none-eabi.md)
diff --git a/src/doc/rustc/src/platform-support.md b/src/doc/rustc/src/platform-support.md
index ed01de4c1c3..65b70630153 100644
--- a/src/doc/rustc/src/platform-support.md
+++ b/src/doc/rustc/src/platform-support.md
@@ -90,7 +90,7 @@ target | notes
 -------|-------
 [`aarch64-pc-windows-gnullvm`](platform-support/windows-gnullvm.md) | ARM64 MinGW (Windows 10+), LLVM ABI
 [`aarch64-pc-windows-msvc`](platform-support/windows-msvc.md) | ARM64 Windows MSVC
-`aarch64-unknown-linux-musl` | ARM64 Linux with musl 1.2.3
+[`aarch64-unknown-linux-musl`](platform-support/aarch64-unknown-linux-musl.md) | ARM64 Linux with musl 1.2.3
 [`aarch64-unknown-linux-ohos`](platform-support/openharmony.md) | ARM64 OpenHarmony
 `arm-unknown-linux-gnueabi` | Armv6 Linux (kernel 3.2+, glibc 2.17)
 `arm-unknown-linux-gnueabihf` | Armv6 Linux, hardfloat (kernel 3.2+, glibc 2.17)
diff --git a/src/doc/rustc/src/platform-support/aarch64-unknown-linux-musl.md b/src/doc/rustc/src/platform-support/aarch64-unknown-linux-musl.md
new file mode 100644
index 00000000000..5d9a552e460
--- /dev/null
+++ b/src/doc/rustc/src/platform-support/aarch64-unknown-linux-musl.md
@@ -0,0 +1,49 @@
+# aarch64-unknown-linux-musl
+
+**Tier: 2**
+
+Target for 64-bit little endian ARMv8-A Linux programs using musl libc.
+
+## Target maintainers
+
+[@Gelbpunkt](https://github.com/Gelbpunkt)
+[@famfo](https://github.com/famfo)
+
+## Requirements
+
+Building the target itself requires a 64-bit little endian ARMv8-A compiler
+that is supported by `cc-rs`.
+
+## Building the target
+
+The target can be built by enabling it for a `rustc` build.
+
+```toml
+[build]
+target = ["aarch64-unknown-linux-musl"]
+```
+
+Make sure your C compiler is included in `$PATH`, then add it to the
+`bootstrap.toml`:
+
+```toml
+[target.aarch64-unknown-linux-musl]
+cc = "aarch64-linux-musl-gcc"
+cxx = "aarch64-linux-musl-g++"
+ar = "aarch64-linux-musl-ar"
+linker = "aarch64-linux-musl-gcc"
+```
+
+## Building Rust programs
+
+This target is distributed through `rustup`, and otherwise requires no
+special configuration.
+
+## Cross-compilation
+
+This target can be cross-compiled from any host.
+
+## Testing
+
+This target can be tested as normal with `x.py` on a 64-bit little endian
+ARMv8-A host or via QEMU emulation.
diff --git a/src/tools/x/Cargo.toml b/src/tools/x/Cargo.toml
index 84a42ca36ef..c59f5ff52a0 100644
--- a/src/tools/x/Cargo.toml
+++ b/src/tools/x/Cargo.toml
@@ -2,5 +2,5 @@
 name = "x"
 version = "0.1.1"
 description = "Run x.py slightly more conveniently"
-edition = "2021"
+edition = "2024"
 publish = false
diff --git a/src/tools/x/src/main.rs b/src/tools/x/src/main.rs
index b288cfcd5be..93167141d34 100644
--- a/src/tools/x/src/main.rs
+++ b/src/tools/x/src/main.rs
@@ -19,15 +19,14 @@ const PYTHON2: &str = "python2";
 const PYTHON3: &str = "python3";
 
 fn python() -> &'static str {
-    let val = match env::var_os("PATH") {
-        Some(val) => val,
-        None => return PYTHON,
+    let Some(path) = env::var_os("PATH") else {
+        return PYTHON;
     };
 
     let mut python2 = false;
     let mut python3 = false;
 
-    for dir in env::split_paths(&val) {
+    for dir in env::split_paths(&path) {
         // `python` should always take precedence over python2 / python3 if it exists
         if dir.join(PYTHON).with_extension(EXE_EXTENSION).exists() {
             return PYTHON;
@@ -89,7 +88,7 @@ fn exec_or_status(command: &mut Command) -> io::Result<ExitStatus> {
 fn handle_result(result: io::Result<ExitStatus>, cmd: Command) {
     match result {
         Err(error) => {
-            eprintln!("Failed to invoke `{:?}`: {}", cmd, error);
+            eprintln!("Failed to invoke `{cmd:?}`: {error}");
         }
         Ok(status) => {
             process::exit(status.code().unwrap_or(1));
@@ -98,14 +97,12 @@ fn handle_result(result: io::Result<ExitStatus>, cmd: Command) {
 }
 
 fn main() {
-    match env::args().skip(1).next().as_deref() {
-        Some("--wrapper-version") => {
-            let version = env!("CARGO_PKG_VERSION");
-            println!("{}", version);
-            return;
-        }
-        _ => {}
+    if env::args().nth(1).is_some_and(|s| s == "--wrapper-version") {
+        let version = env!("CARGO_PKG_VERSION");
+        println!("{version}");
+        return;
     }
+
     let current = match env::current_dir() {
         Ok(dir) => dir,
         Err(err) => {
@@ -113,7 +110,6 @@ fn main() {
             process::exit(1);
         }
     };
-
     for dir in current.ancestors() {
         let candidate = dir.join("x.py");
         if candidate.exists() {