about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2025-06-16 00:39:47 +0000
committerbors <bors@rust-lang.org>2025-06-16 00:39:47 +0000
commite314b97ee54091b6bcf33db4770c93d82fded8bc (patch)
tree217c635e957d5248d5c59abcd9bb481454ae3e53 /src
parentf768dc01da9a681716724418ccf64ce55bd396c5 (diff)
parent07048643ddcb2245ba6251fc65403f308e6c38c4 (diff)
downloadrust-e314b97ee54091b6bcf33db4770c93d82fded8bc.tar.gz
rust-e314b97ee54091b6bcf33db4770c93d82fded8bc.zip
Auto merge of #142550 - fmease:rollup-fteyzcv, r=fmease
Rollup of 10 pull requests

Successful merges:

 - rust-lang/rust#133952 (Remove wasm legacy abi)
 - rust-lang/rust#134661 (Reduce precedence of expressions that have an outer attr)
 - rust-lang/rust#141769 (Move metadata object generation for dylibs to the linker code )
 - rust-lang/rust#141937 (Report never type lints in dependencies)
 - rust-lang/rust#142347 (Async drop - fix for StorageLive/StorageDead codegen for pinned future)
 - rust-lang/rust#142389 (Apply ABI attributes on return types in `rustc_codegen_cranelift`)
 - rust-lang/rust#142470 (Add some missing mailmap entries)
 - rust-lang/rust#142481 (Add `f16` inline asm support for LoongArch)
 - rust-lang/rust#142499 (Remove check run bootstrap)
 - rust-lang/rust#142543 (Suggest adding semicolon in user code rather than macro impl details)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'src')
-rw-r--r--src/bootstrap/src/core/config/config.rs32
-rw-r--r--src/bootstrap/src/core/download.rs19
-rw-r--r--src/bootstrap/src/utils/helpers.rs18
-rw-r--r--src/doc/rustc/src/platform-support/wasm32-unknown-unknown.md117
-rw-r--r--src/tools/clippy/clippy_lints/src/casts/unnecessary_cast.rs2
-rw-r--r--src/tools/clippy/clippy_lints/src/dereference.rs10
-rw-r--r--src/tools/clippy/clippy_lints/src/loops/single_element_loop.rs2
-rw-r--r--src/tools/clippy/clippy_lints/src/matches/manual_utils.rs2
-rw-r--r--src/tools/clippy/clippy_lints/src/neg_multiply.rs2
-rw-r--r--src/tools/clippy/clippy_lints/src/redundant_slicing.rs2
-rw-r--r--src/tools/clippy/clippy_lints/src/transmute/transmutes_expressible_as_ptr_casts.rs2
11 files changed, 30 insertions, 178 deletions
diff --git a/src/bootstrap/src/core/config/config.rs b/src/bootstrap/src/core/config/config.rs
index 970a982dae4..f9980ac5fe1 100644
--- a/src/bootstrap/src/core/config/config.rs
+++ b/src/bootstrap/src/core/config/config.rs
@@ -1373,12 +1373,13 @@ impl Config {
         }
 
         println!("Updating submodule {relative_path}");
-        self.check_run(
-            helpers::git(Some(&self.src))
-                .run_always()
-                .args(["submodule", "-q", "sync"])
-                .arg(relative_path),
-        );
+
+        helpers::git(Some(&self.src))
+            .allow_failure()
+            .run_always()
+            .args(["submodule", "-q", "sync"])
+            .arg(relative_path)
+            .run(self);
 
         // Try passing `--progress` to start, then run git again without if that fails.
         let update = |progress: bool| {
@@ -1407,26 +1408,23 @@ impl Config {
             git.arg(relative_path);
             git
         };
-        if !self.check_run(&mut update(true)) {
-            self.check_run(&mut update(false));
+        if !update(true).allow_failure().run(self) {
+            update(false).allow_failure().run(self);
         }
 
         // Save any local changes, but avoid running `git stash pop` if there are none (since it will exit with an error).
         // diff-index reports the modifications through the exit status
-        let has_local_modifications = !self.check_run(submodule_git().allow_failure().args([
-            "diff-index",
-            "--quiet",
-            "HEAD",
-        ]));
+        let has_local_modifications =
+            !submodule_git().allow_failure().args(["diff-index", "--quiet", "HEAD"]).run(self);
         if has_local_modifications {
-            self.check_run(submodule_git().args(["stash", "push"]));
+            submodule_git().allow_failure().args(["stash", "push"]).run(self);
         }
 
-        self.check_run(submodule_git().args(["reset", "-q", "--hard"]));
-        self.check_run(submodule_git().args(["clean", "-qdfx"]));
+        submodule_git().allow_failure().args(["reset", "-q", "--hard"]).run(self);
+        submodule_git().allow_failure().args(["clean", "-qdfx"]).run(self);
 
         if has_local_modifications {
-            self.check_run(submodule_git().args(["stash", "pop"]));
+            submodule_git().allow_failure().args(["stash", "pop"]).run(self);
         }
     }
 
diff --git a/src/bootstrap/src/core/download.rs b/src/bootstrap/src/core/download.rs
index 88a58e580e6..d7c6d8dbcc3 100644
--- a/src/bootstrap/src/core/download.rs
+++ b/src/bootstrap/src/core/download.rs
@@ -9,8 +9,8 @@ use xz2::bufread::XzDecoder;
 
 use crate::core::config::BUILDER_CONFIG_FILENAME;
 use crate::utils::build_stamp::BuildStamp;
-use crate::utils::exec::{BootstrapCommand, command};
-use crate::utils::helpers::{check_run, exe, hex_encode, move_file};
+use crate::utils::exec::command;
+use crate::utils::helpers::{exe, hex_encode, move_file};
 use crate::{Config, t};
 
 static SHOULD_FIX_BINS_AND_DYLIBS: OnceLock<bool> = OnceLock::new();
@@ -65,17 +65,6 @@ impl Config {
         tmp
     }
 
-    /// Runs a command, printing out nice contextual information if it fails.
-    /// Returns false if do not execute at all, otherwise returns its
-    /// `status.success()`.
-    pub(crate) fn check_run(&self, cmd: &mut BootstrapCommand) -> bool {
-        if self.dry_run() && !cmd.run_always {
-            return true;
-        }
-        self.verbose(|| println!("running: {cmd:?}"));
-        check_run(cmd, self.is_verbose())
-    }
-
     /// Whether or not `fix_bin_or_dylib` needs to be run; can only be true
     /// on NixOS
     fn should_fix_bins_and_dylibs(&self) -> bool {
@@ -214,7 +203,7 @@ impl Config {
         // options should be kept in sync with
         // src/bootstrap/src/core/download.rs
         // for consistency
-        let mut curl = command("curl");
+        let mut curl = command("curl").allow_failure();
         curl.args([
             // follow redirect
             "--location",
@@ -255,7 +244,7 @@ impl Config {
             curl.arg("--retry-all-errors");
         }
         curl.arg(url);
-        if !self.check_run(&mut curl) {
+        if !curl.run(self) {
             if self.host_target.contains("windows-msvc") {
                 eprintln!("Fallback to PowerShell");
                 for _ in 0..3 {
diff --git a/src/bootstrap/src/utils/helpers.rs b/src/bootstrap/src/utils/helpers.rs
index 3e04e046844..8b2f2dd431e 100644
--- a/src/bootstrap/src/utils/helpers.rs
+++ b/src/bootstrap/src/utils/helpers.rs
@@ -270,24 +270,6 @@ pub fn is_valid_test_suite_arg<'a, P: AsRef<Path>>(
     }
 }
 
-// FIXME: get rid of this function
-pub fn check_run(cmd: &mut BootstrapCommand, print_cmd_on_fail: bool) -> bool {
-    let status = match cmd.as_command_mut().status() {
-        Ok(status) => status,
-        Err(e) => {
-            println!("failed to execute command: {cmd:?}\nERROR: {e}");
-            return false;
-        }
-    };
-    if !status.success() && print_cmd_on_fail {
-        println!(
-            "\n\ncommand did not execute successfully: {cmd:?}\n\
-             expected success, got: {status}\n\n"
-        );
-    }
-    status.success()
-}
-
 pub fn make(host: &str) -> PathBuf {
     if host.contains("dragonfly")
         || host.contains("freebsd")
diff --git a/src/doc/rustc/src/platform-support/wasm32-unknown-unknown.md b/src/doc/rustc/src/platform-support/wasm32-unknown-unknown.md
index b67f49c3a38..1e74c47221c 100644
--- a/src/doc/rustc/src/platform-support/wasm32-unknown-unknown.md
+++ b/src/doc/rustc/src/platform-support/wasm32-unknown-unknown.md
@@ -207,120 +207,3 @@ conditionally compile code instead. This is notably different to the way native
 platforms such as x86\_64 work, and this is due to the fact that WebAssembly
 binaries must only contain code the engine understands. Native binaries work so
 long as the CPU doesn't execute unknown code dynamically at runtime.
-
-## Broken `extern "C"` ABI
-
-This target has what is considered a broken `extern "C"` ABI implementation at
-this time. Notably the same signature in Rust and C will compile to different
-WebAssembly functions and be incompatible. This is considered a bug and it will
-be fixed in a future version of Rust.
-
-For example this Rust code:
-
-```rust,ignore (does-not-link)
-#[repr(C)]
-struct MyPair {
-    a: u32,
-    b: u32,
-}
-
-extern "C" {
-    fn take_my_pair(pair: MyPair) -> u32;
-}
-
-#[no_mangle]
-pub unsafe extern "C" fn call_c() -> u32 {
-    take_my_pair(MyPair { a: 1, b: 2 })
-}
-```
-
-compiles to a WebAssembly module that looks like:
-
-```wasm
-(module
-  (import "env" "take_my_pair" (func $take_my_pair (param i32 i32) (result i32)))
-  (func $call_c
-    i32.const 1
-    i32.const 2
-    call $take_my_pair
-  )
-)
-```
-
-The function when defined in C, however, looks like
-
-```c
-struct my_pair {
-    unsigned a;
-    unsigned b;
-};
-
-unsigned take_my_pair(struct my_pair pair) {
-    return pair.a + pair.b;
-}
-```
-
-```wasm
-(module
-  (import "env" "__linear_memory" (memory 0))
-  (func $take_my_pair (param i32) (result i32)
-    local.get 0
-    i32.load offset=4
-    local.get 0
-    i32.load
-    i32.add
-  )
-)
-```
-
-Notice how Rust thinks `take_my_pair` takes two `i32` parameters but C thinks it
-only takes one.
-
-The correct definition of the `extern "C"` ABI for WebAssembly is located in the
-[WebAssembly/tool-conventions](https://github.com/WebAssembly/tool-conventions/blob/main/BasicCABI.md)
-repository. The `wasm32-unknown-unknown` target (and only this target, not other
-WebAssembly targets Rust support) does not correctly follow this document.
-
-Example issues in the Rust repository about this bug are:
-
-* [#115666](https://github.com/rust-lang/rust/issues/115666)
-* [#129486](https://github.com/rust-lang/rust/issues/129486)
-
-This current state of the `wasm32-unknown-unknown` backend is due to an
-unfortunate accident which got relied on. The `wasm-bindgen` project prior to
-0.2.89 was incompatible with the "correct" definition of `extern "C"` and it was
-seen as not worth the tradeoff of breaking `wasm-bindgen` historically to fix
-this issue in the compiler.
-
-Thanks to the heroic efforts of many involved in this, however, `wasm-bindgen`
-0.2.89 and later are compatible with the correct definition of `extern "C"` and
-the nightly compiler currently supports a `-Zwasm-c-abi` implemented in
-[#117919](https://github.com/rust-lang/rust/pull/117919). This nightly-only flag
-can be used to indicate whether the spec-defined version of `extern "C"` should
-be used instead of the "legacy" version of
-whatever-the-Rust-target-originally-implemented. For example using the above
-code you can see (lightly edited for clarity):
-
-```shell
-$ rustc +nightly -Zwasm-c-abi=spec foo.rs --target wasm32-unknown-unknown --crate-type lib --emit obj -O
-$ wasm-tools print foo.o
-(module
-  (import "env" "take_my_pair" (func $take_my_pair (param i32) (result i32)))
-  (func $call_c (result i32)
-    ;; ...
-  )
-  ;; ...
-)
-```
-
-which shows that the C and Rust definitions of the same function now agree like
-they should.
-
-The `-Zwasm-c-abi` compiler flag is tracked in
-[#122532](https://github.com/rust-lang/rust/issues/122532) and a lint was
-implemented in [#117918](https://github.com/rust-lang/rust/issues/117918) to
-help warn users about the transition if they're using `wasm-bindgen` 0.2.88 or
-prior. The current plan is to, in the future, switch `-Zwasm-c-api=spec` to
-being the default. Some time after that the `-Zwasm-c-abi` flag and the
-"legacy" implementation will all be removed. During this process users on a
-sufficiently updated version of `wasm-bindgen` should not experience breakage.
diff --git a/src/tools/clippy/clippy_lints/src/casts/unnecessary_cast.rs b/src/tools/clippy/clippy_lints/src/casts/unnecessary_cast.rs
index 8e8c55cf383..010f09d4c1d 100644
--- a/src/tools/clippy/clippy_lints/src/casts/unnecessary_cast.rs
+++ b/src/tools/clippy/clippy_lints/src/casts/unnecessary_cast.rs
@@ -185,7 +185,7 @@ pub(super) fn check<'tcx>(
             Node::Expr(parent) if is_borrow_expr(cx, parent) && !is_in_allowed_macro(cx, parent) => {
                 MaybeParenOrBlock::Block
             },
-            Node::Expr(parent) if cast_expr.precedence() < parent.precedence() => MaybeParenOrBlock::Paren,
+            Node::Expr(parent) if cx.precedence(cast_expr) < cx.precedence(parent) => MaybeParenOrBlock::Paren,
             _ => MaybeParenOrBlock::Nothing,
         };
 
diff --git a/src/tools/clippy/clippy_lints/src/dereference.rs b/src/tools/clippy/clippy_lints/src/dereference.rs
index cde9528cd87..7463d7b5c3b 100644
--- a/src/tools/clippy/clippy_lints/src/dereference.rs
+++ b/src/tools/clippy/clippy_lints/src/dereference.rs
@@ -972,7 +972,7 @@ fn report<'tcx>(
                 "&"
             };
 
-            let expr_str = if !expr_is_macro_call && is_ufcs && expr.precedence() < ExprPrecedence::Prefix {
+            let expr_str = if !expr_is_macro_call && is_ufcs && cx.precedence(expr) < ExprPrecedence::Prefix {
                 Cow::Owned(format!("({expr_str})"))
             } else {
                 expr_str
@@ -1015,10 +1015,10 @@ fn report<'tcx>(
                         Node::Expr(e) => match e.kind {
                             ExprKind::Call(callee, _) if callee.hir_id != data.first_expr.hir_id => false,
                             ExprKind::Call(..) => {
-                                expr.precedence() < ExprPrecedence::Unambiguous
+                                cx.precedence(expr) < ExprPrecedence::Unambiguous
                                     || matches!(expr.kind, ExprKind::Field(..))
                             },
-                            _ => expr.precedence() < e.precedence(),
+                            _ => cx.precedence(expr) < cx.precedence(e),
                         },
                         _ => false,
                     };
@@ -1066,7 +1066,7 @@ fn report<'tcx>(
                         Mutability::Not => "&",
                         Mutability::Mut => "&mut ",
                     };
-                    (prefix, expr.precedence() < ExprPrecedence::Prefix)
+                    (prefix, cx.precedence(expr) < ExprPrecedence::Prefix)
                 },
                 None if !ty.is_ref() && data.adjusted_ty.is_ref() => ("&", false),
                 _ => ("", false),
@@ -1172,7 +1172,7 @@ impl<'tcx> Dereferencing<'tcx> {
                 },
                 Some(parent) if !parent.span.from_expansion() => {
                     // Double reference might be needed at this point.
-                    if parent.precedence() == ExprPrecedence::Unambiguous {
+                    if cx.precedence(parent) == ExprPrecedence::Unambiguous {
                         // Parentheses would be needed here, don't lint.
                         *outer_pat = None;
                     } else {
diff --git a/src/tools/clippy/clippy_lints/src/loops/single_element_loop.rs b/src/tools/clippy/clippy_lints/src/loops/single_element_loop.rs
index 12719c4f94b..d66771a8b5b 100644
--- a/src/tools/clippy/clippy_lints/src/loops/single_element_loop.rs
+++ b/src/tools/clippy/clippy_lints/src/loops/single_element_loop.rs
@@ -84,7 +84,7 @@ pub(super) fn check<'tcx>(
         if !prefix.is_empty()
             && (
                 // Precedence of internal expression is less than or equal to precedence of `&expr`.
-                arg_expression.precedence() <= ExprPrecedence::Prefix || is_range_literal(arg_expression)
+                cx.precedence(arg_expression) <= ExprPrecedence::Prefix || is_range_literal(arg_expression)
             )
         {
             arg_snip = format!("({arg_snip})").into();
diff --git a/src/tools/clippy/clippy_lints/src/matches/manual_utils.rs b/src/tools/clippy/clippy_lints/src/matches/manual_utils.rs
index d0905733ab5..dbae71bbb1b 100644
--- a/src/tools/clippy/clippy_lints/src/matches/manual_utils.rs
+++ b/src/tools/clippy/clippy_lints/src/matches/manual_utils.rs
@@ -117,7 +117,7 @@ where
     // it's being passed by value.
     let scrutinee = peel_hir_expr_refs(scrutinee).0;
     let (scrutinee_str, _) = snippet_with_context(cx, scrutinee.span, expr_ctxt, "..", &mut app);
-    let scrutinee_str = if scrutinee.span.eq_ctxt(expr.span) && scrutinee.precedence() < ExprPrecedence::Unambiguous {
+    let scrutinee_str = if scrutinee.span.eq_ctxt(expr.span) && cx.precedence(scrutinee) < ExprPrecedence::Unambiguous {
         format!("({scrutinee_str})")
     } else {
         scrutinee_str.into()
diff --git a/src/tools/clippy/clippy_lints/src/neg_multiply.rs b/src/tools/clippy/clippy_lints/src/neg_multiply.rs
index 74c8142787e..442280f9998 100644
--- a/src/tools/clippy/clippy_lints/src/neg_multiply.rs
+++ b/src/tools/clippy/clippy_lints/src/neg_multiply.rs
@@ -64,7 +64,7 @@ fn check_mul(cx: &LateContext<'_>, span: Span, lit: &Expr<'_>, exp: &Expr<'_>) {
     {
         let mut applicability = Applicability::MachineApplicable;
         let (snip, from_macro) = snippet_with_context(cx, exp.span, span.ctxt(), "..", &mut applicability);
-        let suggestion = if !from_macro && exp.precedence() < ExprPrecedence::Prefix && !has_enclosing_paren(&snip) {
+        let suggestion = if !from_macro && cx.precedence(exp) < ExprPrecedence::Prefix && !has_enclosing_paren(&snip) {
             format!("-({snip})")
         } else {
             format!("-{snip}")
diff --git a/src/tools/clippy/clippy_lints/src/redundant_slicing.rs b/src/tools/clippy/clippy_lints/src/redundant_slicing.rs
index 1117dea703c..324a05cdcc0 100644
--- a/src/tools/clippy/clippy_lints/src/redundant_slicing.rs
+++ b/src/tools/clippy/clippy_lints/src/redundant_slicing.rs
@@ -86,7 +86,7 @@ impl<'tcx> LateLintPass<'tcx> for RedundantSlicing {
             let (indexed_ty, indexed_ref_count) = peel_middle_ty_refs(cx.typeck_results().expr_ty(indexed));
             let parent_expr = get_parent_expr(cx, expr);
             let needs_parens_for_prefix =
-                parent_expr.is_some_and(|parent| parent.precedence() > ExprPrecedence::Prefix);
+                parent_expr.is_some_and(|parent| cx.precedence(parent) > ExprPrecedence::Prefix);
 
             if expr_ty == indexed_ty {
                 if expr_ref_count > indexed_ref_count {
diff --git a/src/tools/clippy/clippy_lints/src/transmute/transmutes_expressible_as_ptr_casts.rs b/src/tools/clippy/clippy_lints/src/transmute/transmutes_expressible_as_ptr_casts.rs
index 0d5cf45a5e6..18897fbb5b8 100644
--- a/src/tools/clippy/clippy_lints/src/transmute/transmutes_expressible_as_ptr_casts.rs
+++ b/src/tools/clippy/clippy_lints/src/transmute/transmutes_expressible_as_ptr_casts.rs
@@ -44,7 +44,7 @@ pub(super) fn check<'tcx>(
     };
 
     if let Node::Expr(parent) = cx.tcx.parent_hir_node(e.hir_id)
-        && parent.precedence() > ExprPrecedence::Cast
+        && cx.precedence(parent) > ExprPrecedence::Cast
     {
         sugg = format!("({sugg})");
     }