Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d0bcd14

Browse filesBrowse files
committed
make -Zwasm-c-abi=legacy suppress the lint
1 parent 7c01ac5 commit d0bcd14
Copy full SHA for d0bcd14

File tree

Expand file treeCollapse file tree

5 files changed

+13
-8
lines changed
Filter options
Expand file treeCollapse file tree

5 files changed

+13
-8
lines changed

‎compiler/rustc_codegen_ssa/src/mir/naked_asm.rs

Copy file name to clipboardExpand all lines: compiler/rustc_codegen_ssa/src/mir/naked_asm.rs
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ fn wasm_functype<'tcx>(tcx: TyCtxt<'tcx>, fn_abi: &FnAbi<'tcx, Ty<'tcx>>, def_id
332332
// please also add `wasm32-unknown-unknown` back in `tests/assembly/wasm32-naked-fn.rs`
333333
// basically the commit introducing this comment should be reverted
334334
if let PassMode::Pair { .. } = fn_abi.ret.mode {
335-
let _ = WasmCAbi::Legacy;
335+
let _ = WasmCAbi::Legacy { with_lint: true };
336336
span_bug!(
337337
tcx.def_span(def_id),
338338
"cannot return a pair (the wasm32-unknown-unknown ABI is broken, see https://github.com/rust-lang/rust/issues/115666"
@@ -384,7 +384,7 @@ fn wasm_type<'tcx>(
384384
BackendRepr::SimdVector { .. } => "v128",
385385
BackendRepr::Memory { .. } => {
386386
// FIXME: remove this branch once the wasm32-unknown-unknown ABI is fixed
387-
let _ = WasmCAbi::Legacy;
387+
let _ = WasmCAbi::Legacy { with_lint: true };
388388
span_bug!(
389389
tcx.def_span(def_id),
390390
"cannot use memory args (the wasm32-unknown-unknown ABI is broken, see https://github.com/rust-lang/rust/issues/115666"

‎compiler/rustc_monomorphize/src/mono_checks/abi_check.rs

Copy file name to clipboardExpand all lines: compiler/rustc_monomorphize/src/mono_checks/abi_check.rs
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,11 @@ fn do_check_wasm_abi<'tcx>(
120120
is_call: bool,
121121
span: impl Fn() -> Span,
122122
) {
123-
// 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`).
123+
// 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`),
124+
// and only proceed if `wasm_c_abi_opt` indicates we should emit the lint.
124125
if !(tcx.sess.target.arch == "wasm32"
125126
&& tcx.sess.target.os == "unknown"
126-
&& tcx.wasm_c_abi_opt() == WasmCAbi::Legacy
127+
&& tcx.wasm_c_abi_opt() == WasmCAbi::Legacy { with_lint: true }
127128
&& abi.conv == Conv::C)
128129
{
129130
return;

‎compiler/rustc_session/src/options.rs

Copy file name to clipboardExpand all lines: compiler/rustc_session/src/options.rs
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1886,7 +1886,8 @@ pub mod parse {
18861886
pub(crate) fn parse_wasm_c_abi(slot: &mut WasmCAbi, v: Option<&str>) -> bool {
18871887
match v {
18881888
Some("spec") => *slot = WasmCAbi::Spec,
1889-
Some("legacy") => *slot = WasmCAbi::Legacy,
1889+
// Explicitly setting the `-Z` flag suppresses the lint.
1890+
Some("legacy") => *slot = WasmCAbi::Legacy { with_lint: false },
18901891
_ => return false,
18911892
}
18921893
true
@@ -2599,7 +2600,7 @@ written to standard error output)"),
25992600
Requires `-Clto[=[fat,yes]]`"),
26002601
wasi_exec_model: Option<WasiExecModel> = (None, parse_wasi_exec_model, [TRACKED],
26012602
"whether to build a wasi command or reactor"),
2602-
wasm_c_abi: WasmCAbi = (WasmCAbi::Legacy, parse_wasm_c_abi, [TRACKED],
2603+
wasm_c_abi: WasmCAbi = (WasmCAbi::Legacy { with_lint: true }, parse_wasm_c_abi, [TRACKED],
26032604
"use spec-compliant C ABI for `wasm32-unknown-unknown` (default: legacy)"),
26042605
write_long_types_to_disk: bool = (true, parse_bool, [UNTRACKED],
26052606
"whether long type names should be written to files instead of being printed in errors"),

‎compiler/rustc_target/src/callconv/mod.rs

Copy file name to clipboardExpand all lines: compiler/rustc_target/src/callconv/mod.rs
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -705,7 +705,7 @@ impl<'a, Ty> FnAbi<'a, Ty> {
705705
"xtensa" => xtensa::compute_abi_info(cx, self),
706706
"riscv32" | "riscv64" => riscv::compute_abi_info(cx, self),
707707
"wasm32" => {
708-
if spec.os == "unknown" && cx.wasm_c_abi_opt() == WasmCAbi::Legacy {
708+
if spec.os == "unknown" && matches!(cx.wasm_c_abi_opt(), WasmCAbi::Legacy { .. }) {
709709
wasm::compute_wasm_abi_info(self)
710710
} else {
711711
wasm::compute_c_abi_info(cx, self)

‎compiler/rustc_target/src/spec/mod.rs

Copy file name to clipboardExpand all lines: compiler/rustc_target/src/spec/mod.rs
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2234,7 +2234,10 @@ pub enum WasmCAbi {
22342234
/// Spec-compliant C ABI.
22352235
Spec,
22362236
/// Legacy ABI. Which is non-spec-compliant.
2237-
Legacy,
2237+
Legacy {
2238+
/// Indicates whether the `wasm_c_abi` lint should be emitted.
2239+
with_lint: bool,
2240+
},
22382241
}
22392242

22402243
pub trait HasWasmCAbiOpt {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.