diff options
| author | Ralf Jung <post@ralfj.de> | 2025-03-17 22:59:56 +0100 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2025-03-25 08:22:35 +0100 |
| commit | 072ccce553dd83ebfdf0aaf99eb24f65133c368b (patch) | |
| tree | af93c57ceb3717b0ded53c8a4fc7d9e4695e5bba /compiler/rustc_monomorphize/src | |
| parent | c961d123d2df8d9fec6d997a6725b88eabe8d5de (diff) | |
make -Zwasm-c-abi=legacy suppress the lint
Diffstat (limited to 'compiler/rustc_monomorphize/src')
| -rw-r--r-- | compiler/rustc_monomorphize/src/mono_checks/abi_check.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/compiler/rustc_monomorphize/src/mono_checks/abi_check.rs b/compiler/rustc_monomorphize/src/mono_checks/abi_check.rs index f17f7261df5..40740c3fdf6 100644 --- a/compiler/rustc_monomorphize/src/mono_checks/abi_check.rs +++ b/compiler/rustc_monomorphize/src/mono_checks/abi_check.rs @@ -92,6 +92,7 @@ fn do_check_simd_vector_abi<'tcx>( } } +/// Determines whether the given argument is passed the same way on the old and new wasm ABIs. fn wasm_abi_safe<'tcx>(tcx: TyCtxt<'tcx>, arg: &ArgAbi<'tcx, Ty<'tcx>>) -> bool { if matches!(arg.layout.backend_repr, BackendRepr::Scalar(_)) { return true; @@ -120,16 +121,16 @@ fn do_check_wasm_abi<'tcx>( is_call: bool, span: impl Fn() -> Span, ) { - // Only proceed for `extern "C" fn` on wasm32-unknown-unknown (same check as what `adjust_for_foreign_abi` uses to call `compute_wasm_abi_info`). + // Only proceed for `extern "C" fn` on wasm32-unknown-unknown (same check as what `adjust_for_foreign_abi` uses to call `compute_wasm_abi_info`), + // and only proceed if `wasm_c_abi_opt` indicates we should emit the lint. if !(tcx.sess.target.arch == "wasm32" && tcx.sess.target.os == "unknown" - && tcx.wasm_c_abi_opt() == WasmCAbi::Legacy + && tcx.wasm_c_abi_opt() == WasmCAbi::Legacy { with_lint: true } && abi.conv == Conv::C) { return; } - // Warn against all types whose ABI will change. That's all arguments except for things passed as scalars. - // Return values are not affected by this change. + // Warn against all types whose ABI will change. Return values are not affected by this change. for arg_abi in abi.args.iter() { if wasm_abi_safe(tcx, arg_abi) { continue; |
