diff options
| author | daxpedda <daxpedda@gmail.com> | 2023-11-14 23:04:22 +0100 |
|---|---|---|
| committer | daxpedda <daxpedda@gmail.com> | 2024-03-16 09:57:15 +0100 |
| commit | 873a0f264e15f92af37f57d3bd3edf3d82faf34e (patch) | |
| tree | 527912795eedf06a0cf37b71f6d3df907dfc4149 /compiler/rustc_lint_defs/src | |
| parent | c5b571310dc60c6a58c6505cce2fb7e2f3f9aa68 (diff) | |
| download | rust-873a0f264e15f92af37f57d3bd3edf3d82faf34e.tar.gz rust-873a0f264e15f92af37f57d3bd3edf3d82faf34e.zip | |
Add `wasm_c_abi` `future-incompat` lint
Diffstat (limited to 'compiler/rustc_lint_defs/src')
| -rw-r--r-- | compiler/rustc_lint_defs/src/builtin.rs | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/compiler/rustc_lint_defs/src/builtin.rs b/compiler/rustc_lint_defs/src/builtin.rs index 6506aa33431..3391cd8e40a 100644 --- a/compiler/rustc_lint_defs/src/builtin.rs +++ b/compiler/rustc_lint_defs/src/builtin.rs @@ -130,6 +130,7 @@ declare_lint_pass! { UNUSED_VARIABLES, USELESS_DEPRECATED, WARNINGS, + WASM_C_ABI, WHERE_CLAUSES_OBJECT_SAFETY, WRITES_THROUGH_IMMUTABLE_POINTER, // tidy-alphabetical-end @@ -4564,3 +4565,41 @@ declare_lint! { reference: "issue #120192 <https://github.com/rust-lang/rust/issues/120192>", }; } + +declare_lint! { + /// The `wasm_c_abi` lint detects crate dependencies that are incompatible + /// with future versions of Rust that will emit spec-compliant C ABI. + /// + /// ### Example + /// + /// ```rust,ignore (needs extern crate) + /// #![deny(wasm_c_abi)] + /// ``` + /// + /// This will produce: + /// + /// ```text + /// error: the following packages contain code that will be rejected by a future version of Rust: wasm-bindgen v0.2.87 + /// | + /// note: the lint level is defined here + /// --> src/lib.rs:1:9 + /// | + /// 1 | #![deny(wasm_c_abi)] + /// | ^^^^^^^^^^ + /// ``` + /// + /// ### Explanation + /// + /// Rust has historically emitted non-spec-compliant C ABI. This has caused + /// incompatibilities between other compilers and Wasm targets. In a future + /// version of Rust this will be fixed and therefore dependencies relying + /// on the non-spec-compliant C ABI will stop functioning. + pub WASM_C_ABI, + Warn, + "detects dependencies that are incompatible with the Wasm C ABI", + @future_incompatible = FutureIncompatibleInfo { + reason: FutureIncompatibilityReason::FutureReleaseErrorReportInDeps, + reference: "issue #71871 <https://github.com/rust-lang/rust/issues/71871>", + }; + crate_level_only +} |
