@@ -16,6 +16,7 @@ declare_lint_pass! {
1616 /// that are used by other parts of the compiler.
1717 HardwiredLints => [
1818 // tidy-alphabetical-start
19+ AARCH64_SOFTFLOAT_NEON ,
1920 ABSOLUTE_PATHS_NOT_STARTING_WITH_CRATE ,
2021 AMBIGUOUS_ASSOCIATED_ITEMS ,
2122 AMBIGUOUS_GLOB_IMPORTS ,
@@ -5069,14 +5070,14 @@ declare_lint! {
50695070 ///
50705071 /// ```text
50715072 /// error: this function function definition is affected by the wasm ABI transition: it passes an argument of non-scalar type `MyType`
5072- /// --> $DIR/wasm_c_abi_transition.rs:17:1
5073- /// |
5074- /// | pub extern "C" fn my_fun(_x: MyType) {}
5075- /// | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
5076- /// |
5077- /// = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
5078- /// = note: for more information, see issue #138762 <https://github.com/rust-lang/rust/issues/138762>
5079- /// = help: the "C" ABI Rust uses on wasm32-unknown-unknown will change to align with the standard "C" ABI for this target
5073+ /// --> $DIR/wasm_c_abi_transition.rs:17:1
5074+ /// |
5075+ /// | pub extern "C" fn my_fun(_x: MyType) {}
5076+ /// | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
5077+ /// |
5078+ /// = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
5079+ /// = note: for more information, see issue #138762 <https://github.com/rust-lang/rust/issues/138762>
5080+ /// = help: the "C" ABI Rust uses on wasm32-unknown-unknown will change to align with the standard "C" ABI for this target
50805081 /// ```
50815082 ///
50825083 /// ### Explanation
@@ -5093,3 +5094,44 @@ declare_lint! {
50935094 reference: "issue #138762 <https://github.com/rust-lang/rust/issues/138762>" ,
50945095 } ;
50955096}
5097+
5098+ declare_lint ! {
5099+ /// The `aarch64_softfloat_neon` lint detects usage of `#[target_feature(enable = "neon")]` on
5100+ /// softfloat aarch64 targets. Enabling this target feature causes LLVM to alter the ABI of
5101+ /// function calls, making this attribute unsound to use.
5102+ ///
5103+ /// ### Example
5104+ ///
5105+ /// ```rust,ignore (needs aarch64-unknown-none-softfloat)
5106+ /// #[target_feature(enable = "neon")]
5107+ /// fn with_neon() {}
5108+ /// ```
5109+ ///
5110+ /// This will produce:
5111+ ///
5112+ /// ```text
5113+ /// error: enabling the `neon` target feature on the current target is unsound due to ABI issues
5114+ /// --> $DIR/abi-incompatible-target-feature-attribute-fcw.rs:11:18
5115+ /// |
5116+ /// | #[target_feature(enable = "neon")]
5117+ /// | ^^^^^^^^^^^^^^^
5118+ /// |
5119+ /// = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
5120+ /// = note: for more information, see issue #134375 <https://github.com/rust-lang/rust/issues/134375>
5121+ /// ```
5122+ ///
5123+ /// ### Explanation
5124+ ///
5125+ /// If a function like `with_neon` above ends up containing calls to LLVM builtins, those will
5126+ /// not use the correct ABI. This is caused by a lack of support in LLVM for mixing code with
5127+ /// and without the `neon` target feature. The target feature should never have been stabilized
5128+ /// on this target due to this issue, but the problem was not known at the time of
5129+ /// stabilization.
5130+ pub AARCH64_SOFTFLOAT_NEON ,
5131+ Warn ,
5132+ "detects code that could be affected by ABI issues on aarch64 softfloat targets" ,
5133+ @future_incompatible = FutureIncompatibleInfo {
5134+ reason: FutureIncompatibilityReason :: FutureReleaseErrorReportInDeps ,
5135+ reference: "issue #134375 <https://github.com/rust-lang/rust/issues/134375>" ,
5136+ } ;
5137+ }
0 commit comments