Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 4c49420

Browse files
authoredJan 25, 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 9622211 + 49c3aaa commit 4c49420

11 files changed

+55
-54
lines changed
 

‎compiler/rustc_lint/messages.ftl

-3
Original file line numberDiff line numberDiff line change
@@ -976,6 +976,3 @@ lint_uses_power_alignment = repr(C) does not follow the power alignment rule. Th
976976
977977
lint_variant_size_differences =
978978
enum variant is more than three times larger ({$largest} bytes) than the next largest
979-
980-
lint_wasm_c_abi =
981-
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
@@ -2566,10 +2566,6 @@ pub(crate) struct UnusedCrateDependency {
25662566
pub local_crate: Symbol,
25672567
}
25682568

2569-
#[derive(LintDiagnostic)]
2570-
#[diag(lint_wasm_c_abi)]
2571-
pub(crate) struct WasmCAbi;
2572-
25732569
#[derive(LintDiagnostic)]
25742570
#[diag(lint_ill_formed_attribute_input)]
25752571
pub(crate) struct IllFormedAttributeInput {

‎compiler/rustc_lint_defs/src/builtin.rs

-39
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,6 @@ declare_lint_pass! {
143143
UNUSED_VARIABLES,
144144
USELESS_DEPRECATED,
145145
WARNINGS,
146-
WASM_C_ABI,
147146
// tidy-alphabetical-end
148147
]
149148
}
@@ -4647,44 +4646,6 @@ declare_lint! {
46474646
};
46484647
}
46494648

4650-
declare_lint! {
4651-
/// The `wasm_c_abi` lint detects crate dependencies that are incompatible
4652-
/// with future versions of Rust that will emit spec-compliant C ABI.
4653-
///
4654-
/// ### Example
4655-
///
4656-
/// ```rust,ignore (needs extern crate)
4657-
/// #![deny(wasm_c_abi)]
4658-
/// ```
4659-
///
4660-
/// This will produce:
4661-
///
4662-
/// ```text
4663-
/// error: the following packages contain code that will be rejected by a future version of Rust: wasm-bindgen v0.2.87
4664-
/// |
4665-
/// note: the lint level is defined here
4666-
/// --> src/lib.rs:1:9
4667-
/// |
4668-
/// 1 | #![deny(wasm_c_abi)]
4669-
/// | ^^^^^^^^^^
4670-
/// ```
4671-
///
4672-
/// ### Explanation
4673-
///
4674-
/// Rust has historically emitted non-spec-compliant C ABI. This has caused
4675-
/// incompatibilities between other compilers and Wasm targets. In a future
4676-
/// version of Rust this will be fixed and therefore dependencies relying
4677-
/// on the non-spec-compliant C ABI will stop functioning.
4678-
pub WASM_C_ABI,
4679-
Deny,
4680-
"detects dependencies that are incompatible with the Wasm C ABI",
4681-
@future_incompatible = FutureIncompatibleInfo {
4682-
reason: FutureIncompatibilityReason::FutureReleaseErrorReportInDeps,
4683-
reference: "issue #71871 <https://github.com/rust-lang/rust/issues/71871>",
4684-
};
4685-
crate_level_only
4686-
}
4687-
46884649
declare_lint! {
46894650
/// The `uncovered_param_in_projection` lint detects a violation of one of Rust's orphan rules for
46904651
/// 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
@@ -783,7 +783,6 @@ pub enum BuiltinLintDiag {
783783
extern_crate: Symbol,
784784
local_crate: Symbol,
785785
},
786-
WasmCAbi,
787786
IllFormedAttributeInput {
788787
suggestions: Vec<String>,
789788
},

‎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.