Skip to content
/ rust Public
forked from rust-lang/rust
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit dc202df

Browse files
authoredJan 26, 2025
Rollup merge of rust-lang#133951 - bjorn3:wasm_c_abi_lint_hard_error, r=workingjubilee
Make the wasm_c_abi future compat warning a hard error This is the next step in getting rid of the broken C abi for wasm32-unknown-unknown. The lint was made deny-by-default in rust-lang#129534 3 months ago. This still keeps the `-Zwasm-c-abi` flag set to `legacy` by default. It will be flipped in a future PR. cc rust-lang#122532
2 parents 2f0ad2a + 49c3aaa commit dc202df

11 files changed

+55
-54
lines changed
 

‎compiler/rustc_lint/messages.ftl

-3
Original file line numberDiff line numberDiff line change
@@ -974,6 +974,3 @@ lint_uses_power_alignment = repr(C) does not follow the power alignment rule. Th
974974
975975
lint_variant_size_differences =
976976
enum variant is more than three times larger ({$largest} bytes) than the next largest
977-
978-
lint_wasm_c_abi =
979-
older versions of the `wasm-bindgen` crate will be incompatible with future versions of Rust; please update to `wasm-bindgen` v0.2.88

‎compiler/rustc_lint/src/early/diagnostics.rs

-1
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,6 @@ pub(super) fn decorate_lint(
430430
BuiltinLintDiag::UnusedCrateDependency { extern_crate, local_crate } => {
431431
lints::UnusedCrateDependency { extern_crate, local_crate }.decorate_lint(diag)
432432
}
433-
BuiltinLintDiag::WasmCAbi => lints::WasmCAbi.decorate_lint(diag),
434433
BuiltinLintDiag::IllFormedAttributeInput { suggestions } => {
435434
lints::IllFormedAttributeInput {
436435
num_suggestions: suggestions.len(),

‎compiler/rustc_lint/src/lints.rs

-4
Original file line numberDiff line numberDiff line change
@@ -2553,10 +2553,6 @@ pub(crate) struct UnusedCrateDependency {
25532553
pub local_crate: Symbol,
25542554
}
25552555

2556-
#[derive(LintDiagnostic)]
2557-
#[diag(lint_wasm_c_abi)]
2558-
pub(crate) struct WasmCAbi;
2559-
25602556
#[derive(LintDiagnostic)]
25612557
#[diag(lint_ill_formed_attribute_input)]
25622558
pub(crate) struct IllFormedAttributeInput {

‎compiler/rustc_lint_defs/src/builtin.rs

-39
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@ declare_lint_pass! {
144144
UNUSED_VARIABLES,
145145
USELESS_DEPRECATED,
146146
WARNINGS,
147-
WASM_C_ABI,
148147
// tidy-alphabetical-end
149148
]
150149
}
@@ -4681,44 +4680,6 @@ declare_lint! {
46814680
};
46824681
}
46834682

4684-
declare_lint! {
4685-
/// The `wasm_c_abi` lint detects crate dependencies that are incompatible
4686-
/// with future versions of Rust that will emit spec-compliant C ABI.
4687-
///
4688-
/// ### Example
4689-
///
4690-
/// ```rust,ignore (needs extern crate)
4691-
/// #![deny(wasm_c_abi)]
4692-
/// ```
4693-
///
4694-
/// This will produce:
4695-
///
4696-
/// ```text
4697-
/// error: the following packages contain code that will be rejected by a future version of Rust: wasm-bindgen v0.2.87
4698-
/// |
4699-
/// note: the lint level is defined here
4700-
/// --> src/lib.rs:1:9
4701-
/// |
4702-
/// 1 | #![deny(wasm_c_abi)]
4703-
/// | ^^^^^^^^^^
4704-
/// ```
4705-
///
4706-
/// ### Explanation
4707-
///
4708-
/// Rust has historically emitted non-spec-compliant C ABI. This has caused
4709-
/// incompatibilities between other compilers and Wasm targets. In a future
4710-
/// version of Rust this will be fixed and therefore dependencies relying
4711-
/// on the non-spec-compliant C ABI will stop functioning.
4712-
pub WASM_C_ABI,
4713-
Deny,
4714-
"detects dependencies that are incompatible with the Wasm C ABI",
4715-
@future_incompatible = FutureIncompatibleInfo {
4716-
reason: FutureIncompatibilityReason::FutureReleaseErrorReportInDeps,
4717-
reference: "issue #71871 <https://github.com/rust-lang/rust/issues/71871>",
4718-
};
4719-
crate_level_only
4720-
}
4721-
47224683
declare_lint! {
47234684
/// The `uncovered_param_in_projection` lint detects a violation of one of Rust's orphan rules for
47244685
/// foreign trait implementations that concerns the use of type parameters inside trait associated

‎compiler/rustc_lint_defs/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -795,7 +795,6 @@ pub enum BuiltinLintDiag {
795795
extern_crate: Symbol,
796796
local_crate: Symbol,
797797
},
798-
WasmCAbi,
799798
IllFormedAttributeInput {
800799
suggestions: Vec<String>,
801800
},

‎compiler/rustc_metadata/messages.ftl

+3
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,9 @@ metadata_unsupported_abi =
290290
metadata_unsupported_abi_i686 =
291291
ABI not supported by `#[link(kind = "raw-dylib")]` on i686
292292
293+
metadata_wasm_c_abi =
294+
older versions of the `wasm-bindgen` crate are incompatible with current versions of Rust; please update to `wasm-bindgen` v0.2.88
295+
293296
metadata_wasm_import_form =
294297
wasm import module must be of the form `wasm_import_module = "string"`
295298

‎compiler/rustc_metadata/src/creader.rs

+1-6
Original file line numberDiff line numberDiff line change
@@ -1076,12 +1076,7 @@ impl<'a, 'tcx> CrateLoader<'a, 'tcx> {
10761076
// Make a point span rather than covering the whole file
10771077
let span = krate.spans.inner_span.shrink_to_lo();
10781078

1079-
self.sess.psess.buffer_lint(
1080-
lint::builtin::WASM_C_ABI,
1081-
span,
1082-
ast::CRATE_NODE_ID,
1083-
BuiltinLintDiag::WasmCAbi,
1084-
);
1079+
self.sess.dcx().emit_err(errors::WasmCAbi { span });
10851080
}
10861081
}
10871082

‎compiler/rustc_metadata/src/errors.rs

+7
Original file line numberDiff line numberDiff line change
@@ -732,3 +732,10 @@ pub struct ImportNameTypeRaw {
732732
#[primary_span]
733733
pub span: Span,
734734
}
735+
736+
#[derive(Diagnostic)]
737+
#[diag(metadata_wasm_c_abi)]
738+
pub(crate) struct WasmCAbi {
739+
#[primary_span]
740+
pub span: Span,
741+
}
+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
//@ only-wasm32
2+
//@ revisions: v0_1_0 v0_2_87 v0_2_88 v0_3_0 v1_0_0
3+
//@[v0_1_0] check-fail
4+
//@[v0_1_0] rustc-env:CARGO_PKG_VERSION_MAJOR=0
5+
//@[v0_1_0] rustc-env:CARGO_PKG_VERSION_MINOR=1
6+
//@[v0_1_0] rustc-env:CARGO_PKG_VERSION_PATCH=0
7+
//@[v0_2_87] check-fail
8+
//@[v0_2_87] rustc-env:CARGO_PKG_VERSION_MAJOR=0
9+
//@[v0_2_87] rustc-env:CARGO_PKG_VERSION_MINOR=2
10+
//@[v0_2_87] rustc-env:CARGO_PKG_VERSION_PATCH=87
11+
//@[v0_2_88] check-pass
12+
//@[v0_2_88] rustc-env:CARGO_PKG_VERSION_MAJOR=0
13+
//@[v0_2_88] rustc-env:CARGO_PKG_VERSION_MINOR=2
14+
//@[v0_2_88] rustc-env:CARGO_PKG_VERSION_PATCH=88
15+
//@[v0_3_0] check-pass
16+
//@[v0_3_0] rustc-env:CARGO_PKG_VERSION_MAJOR=0
17+
//@[v0_3_0] rustc-env:CARGO_PKG_VERSION_MINOR=3
18+
//@[v0_3_0] rustc-env:CARGO_PKG_VERSION_PATCH=0
19+
//@[v1_0_0] check-pass
20+
//@[v1_0_0] rustc-env:CARGO_PKG_VERSION_MAJOR=1
21+
//@[v1_0_0] rustc-env:CARGO_PKG_VERSION_MINOR=0
22+
//@[v1_0_0] rustc-env:CARGO_PKG_VERSION_PATCH=0
23+
24+
#![crate_name = "wasm_bindgen"]
25+
//[v0_1_0]~^ ERROR: older versions of the `wasm-bindgen` crate
26+
//[v0_2_87]~^^ ERROR: older versions of the `wasm-bindgen` crate
27+
28+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error: older versions of the `wasm-bindgen` crate are incompatible with current versions of Rust; please update to `wasm-bindgen` v0.2.88
2+
--> $DIR/wasm-bindgen-broken-error.rs:24:1
3+
|
4+
LL | #![crate_name = "wasm_bindgen"]
5+
| ^
6+
7+
error: aborting due to 1 previous error
8+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error: older versions of the `wasm-bindgen` crate are incompatible with current versions of Rust; please update to `wasm-bindgen` v0.2.88
2+
--> $DIR/wasm-bindgen-broken-error.rs:24:1
3+
|
4+
LL | #![crate_name = "wasm_bindgen"]
5+
| ^
6+
7+
error: aborting due to 1 previous error
8+

0 commit comments

Comments
 (0)
Failed to load comments.