about summary refs log tree commit diff
path: root/tests/rustdoc-ui/target-feature-stability.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2025-03-03 19:34:25 +0000
committerbors <bors@rust-lang.org>2025-03-03 19:34:25 +0000
commite16a049adbf94d610787430b6efdf31d896dc5b6 (patch)
tree4909ade923f6869ee52593a6627c2a8fd78b692f /tests/rustdoc-ui/target-feature-stability.rs
parentd4916623403bc29927f467ccb1a80ba836a04139 (diff)
parent15e97bd45eb83bc4114149702899bba97072bbb6 (diff)
downloadrust-e16a049adbf94d610787430b6efdf31d896dc5b6.tar.gz
rust-e16a049adbf94d610787430b6efdf31d896dc5b6.zip
Auto merge of #137914 - matthiaskrgr:rollup-phaxe6f, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #137103 ({json|html}docck: catch and error on deprecated syntax)
 - #137632 (rustdoc: when merging target features, keep the highest stability)
 - #137684 (Add rustdoc support for `--emit=dep-info[=path]`)
 - #137794 (make qnx pass a test)
 - #137801 (tests: Unignore target modifier tests on all platforms)
 - #137826 (test(codegen): add looping_over_ne_bytes test for #133528)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'tests/rustdoc-ui/target-feature-stability.rs')
-rw-r--r--tests/rustdoc-ui/target-feature-stability.rs28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/rustdoc-ui/target-feature-stability.rs b/tests/rustdoc-ui/target-feature-stability.rs
new file mode 100644
index 00000000000..17fa3ccfe3e
--- /dev/null
+++ b/tests/rustdoc-ui/target-feature-stability.rs
@@ -0,0 +1,28 @@
+//! This is a regression test for <https://github.com/rust-lang/rust/issues/137366>, ensuring
+//! that we can use the `neon` target feature on ARM32 targets in rustdoc despite there
+//! being a "forbidden" feature of the same name for aarch64, and rustdoc merging the
+//! target features of all targets.
+//@ check-pass
+//@ revisions: arm aarch64
+//@[arm] compile-flags: --target armv7-unknown-linux-gnueabihf
+//@[arm] needs-llvm-components: arm
+//@[aarch64] compile-flags: --target aarch64-unknown-none-softfloat
+//@[aarch64] needs-llvm-components: aarch64
+
+#![crate_type = "lib"]
+#![feature(no_core, lang_items)]
+#![feature(arm_target_feature)]
+#![no_core]
+
+#[lang = "sized"]
+pub trait Sized {}
+
+// `fp-armv8` is "forbidden" on aarch64 as we tie it to `neon`.
+#[target_feature(enable = "fp-armv8")]
+pub fn fun1() {}
+
+// This would usually be rejected as it changes the ABI.
+// But we disable that check in rustdoc since we are building "for all targets" and the
+// check can't really handle that.
+#[target_feature(enable = "soft-float")]
+pub fn fun2() {}