authorbors <bors@rust-lang.org> 2026-01-24 10:18:04 UTC
committerbors <bors@rust-lang.org> 2026-01-24 10:18:04 UTC
loga18e6d9d1473d9b25581dd04bef6c7577999631c
tree1ffdeb3495137653fd12cfedcbba2b4e3c558d05
parent87b272187129343c0efc8f92d253c16958aeac0b
parent85430dfc909d9b95c1423e24f3bcc9b811b52d95

Auto merge of #151575 - JonathanBrouwer:rollup-hPBbNPJ, r=JonathanBrouwer

Rollup of 8 pull requests Successful merges: - rust-lang/rust#150556 (Add Tier 3 Thumb-mode targets for Armv7-A, Armv7-R and Armv8-R) - rust-lang/rust#151259 (Fix is_ascii performance regression on AVX-512 CPUs when compiling with -C target-cpu=native) - rust-lang/rust#151500 (hexagon: Add HVX target features) - rust-lang/rust#151517 (Enable reproducible binary builds with debuginfo on Linux) - rust-lang/rust#151482 (Add "Skip to main content" link for keyboard navigation in rustdoc) - rust-lang/rust#151489 (constify boolean methods) - rust-lang/rust#151551 (Don't use default build-script fingerprinting in `test`) - rust-lang/rust#151555 (Fix compilation of std/src/sys/pal/uefi/tests.rs) r? @ghost

32 files changed, 472 insertions(+), 206 deletions(-)

compiler/rustc_target/src/spec/mod.rs+5
......@@ -1596,8 +1596,11 @@ supported_targets! {
15961596 ("armebv7r-none-eabi", armebv7r_none_eabi),
15971597 ("armebv7r-none-eabihf", armebv7r_none_eabihf),
15981598 ("armv7r-none-eabi", armv7r_none_eabi),
1599 ("thumbv7r-none-eabi", thumbv7r_none_eabi),
15991600 ("armv7r-none-eabihf", armv7r_none_eabihf),
1601 ("thumbv7r-none-eabihf", thumbv7r_none_eabihf),
16001602 ("armv8r-none-eabihf", armv8r_none_eabihf),
1603 ("thumbv8r-none-eabihf", thumbv8r_none_eabihf),
16011604
16021605 ("armv7-rtems-eabihf", armv7_rtems_eabihf),
16031606
......@@ -1649,7 +1652,9 @@ supported_targets! {
16491652 ("thumbv8m.main-none-eabihf", thumbv8m_main_none_eabihf),
16501653
16511654 ("armv7a-none-eabi", armv7a_none_eabi),
1655 ("thumbv7a-none-eabi", thumbv7a_none_eabi),
16521656 ("armv7a-none-eabihf", armv7a_none_eabihf),
1657 ("thumbv7a-none-eabihf", thumbv7a_none_eabihf),
16531658 ("armv7a-nuttx-eabi", armv7a_nuttx_eabi),
16541659 ("armv7a-nuttx-eabihf", armv7a_nuttx_eabihf),
16551660 ("armv7a-vex-v5", armv7a_vex_v5),
compiler/rustc_target/src/spec/targets/armv7a_none_eabi.rs+10-35
......@@ -1,40 +1,8 @@
1// Generic ARMv7-A target for bare-metal code - floating point disabled
2//
3// This is basically the `armv7-unknown-linux-gnueabi` target with some changes
4// (listed below) to bring it closer to the bare-metal `thumb` & `aarch64`
5// targets:
6//
7// - `TargetOptions.features`: added `+strict-align`. rationale: unaligned
8// memory access is disabled on boot on these cores
9// - linker changed to LLD. rationale: C is not strictly needed to build
10// bare-metal binaries (the `gcc` linker has the advantage that it knows where C
11// libraries and crt*.o are but it's not much of an advantage here); LLD is also
12// faster
13// - `panic_strategy` set to `abort`. rationale: matches `thumb` targets
14// - `relocation-model` set to `static`; also no PIE, no relro and no dynamic
15// linking. rationale: matches `thumb` targets
1// Targets the Little-endian Cortex-A8 (and similar) processors (ARMv7-A)
162
17use crate::spec::{
18 Abi, Arch, Cc, FloatAbi, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetMetadata,
19 TargetOptions,
20};
3use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
214
225pub(crate) fn target() -> Target {
23 let opts = TargetOptions {
24 abi: Abi::Eabi,
25 llvm_floatabi: Some(FloatAbi::Soft),
26 linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
27 linker: Some("rust-lld".into()),
28 features: "+v7,+thumb2,+soft-float,-neon,+strict-align".into(),
29 relocation_model: RelocModel::Static,
30 disable_redzone: true,
31 max_atomic_width: Some(64),
32 panic_strategy: PanicStrategy::Abort,
33 emit_debug_gdb_scripts: false,
34 c_enum_min_bits: Some(8),
35 has_thumb_interworking: true,
36 ..Default::default()
37 };
386 Target {
397 llvm_target: "armv7a-none-eabi".into(),
408 metadata: TargetMetadata {
......@@ -46,6 +14,13 @@ pub(crate) fn target() -> Target {
4614 pointer_width: 32,
4715 data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
4816 arch: Arch::Arm,
49 options: opts,
17 options: TargetOptions {
18 abi: Abi::Eabi,
19 llvm_floatabi: Some(FloatAbi::Soft),
20 features: "+soft-float,-neon,+strict-align".into(),
21 max_atomic_width: Some(64),
22 has_thumb_interworking: true,
23 ..base::arm_none::opts()
24 },
5025 }
5126}
compiler/rustc_target/src/spec/targets/armv7a_none_eabihf.rs+10-27
......@@ -1,32 +1,8 @@
1// Generic ARMv7-A target for bare-metal code - floating point enabled (assumes
2// FPU is present and emits FPU instructions)
3//
4// This is basically the `armv7-unknown-linux-gnueabihf` target with some
5// changes (list in `armv7a_none_eabi.rs`) to bring it closer to the bare-metal
6// `thumb` & `aarch64` targets.
1// Targets the Little-endian Cortex-A8 (and similar) processors (ARMv7-A)
72
8use crate::spec::{
9 Abi, Arch, Cc, FloatAbi, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetMetadata,
10 TargetOptions,
11};
3use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
124
135pub(crate) fn target() -> Target {
14 let opts = TargetOptions {
15 abi: Abi::EabiHf,
16 llvm_floatabi: Some(FloatAbi::Hard),
17 linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
18 linker: Some("rust-lld".into()),
19 features: "+v7,+vfp3d16,+thumb2,-neon,+strict-align".into(),
20 relocation_model: RelocModel::Static,
21 disable_redzone: true,
22 max_atomic_width: Some(64),
23 panic_strategy: PanicStrategy::Abort,
24 emit_debug_gdb_scripts: false,
25 // GCC defaults to 8 for arm-none here.
26 c_enum_min_bits: Some(8),
27 has_thumb_interworking: true,
28 ..Default::default()
29 };
306 Target {
317 llvm_target: "armv7a-none-eabihf".into(),
328 metadata: TargetMetadata {
......@@ -38,6 +14,13 @@ pub(crate) fn target() -> Target {
3814 pointer_width: 32,
3915 data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
4016 arch: Arch::Arm,
41 options: opts,
17 options: TargetOptions {
18 abi: Abi::EabiHf,
19 llvm_floatabi: Some(FloatAbi::Hard),
20 features: "+vfp3d16,-neon,+strict-align".into(),
21 max_atomic_width: Some(64),
22 has_thumb_interworking: true,
23 ..base::arm_none::opts()
24 },
4225 }
4326}
compiler/rustc_target/src/spec/targets/armv7r_none_eabi.rs+3-14
......@@ -1,15 +1,12 @@
11// Targets the Little-endian Cortex-R4/R5 processor (ARMv7-R)
22
3use crate::spec::{
4 Abi, Arch, Cc, FloatAbi, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetMetadata,
5 TargetOptions,
6};
3use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
74
85pub(crate) fn target() -> Target {
96 Target {
107 llvm_target: "armv7r-none-eabi".into(),
118 metadata: TargetMetadata {
12 description: Some("Armv7-R".into()),
9 description: Some("Bare Armv7-R".into()),
1310 tier: Some(2),
1411 host_tools: Some(false),
1512 std: Some(false),
......@@ -17,20 +14,12 @@ pub(crate) fn target() -> Target {
1714 pointer_width: 32,
1815 data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
1916 arch: Arch::Arm,
20
2117 options: TargetOptions {
2218 abi: Abi::Eabi,
2319 llvm_floatabi: Some(FloatAbi::Soft),
24 linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
25 linker: Some("rust-lld".into()),
26 relocation_model: RelocModel::Static,
27 panic_strategy: PanicStrategy::Abort,
2820 max_atomic_width: Some(64),
29 emit_debug_gdb_scripts: false,
30 // GCC defaults to 8 for arm-none here.
31 c_enum_min_bits: Some(8),
3221 has_thumb_interworking: true,
33 ..Default::default()
22 ..base::arm_none::opts()
3423 },
3524 }
3625}
compiler/rustc_target/src/spec/targets/armv7r_none_eabihf.rs+3-14
......@@ -1,15 +1,12 @@
11// Targets the Little-endian Cortex-R4F/R5F processor (ARMv7-R)
22
3use crate::spec::{
4 Abi, Arch, Cc, FloatAbi, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetMetadata,
5 TargetOptions,
6};
3use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
74
85pub(crate) fn target() -> Target {
96 Target {
107 llvm_target: "armv7r-none-eabihf".into(),
118 metadata: TargetMetadata {
12 description: Some("Armv7-R, hardfloat".into()),
9 description: Some("Bare Armv7-R, hardfloat".into()),
1310 tier: Some(2),
1411 host_tools: Some(false),
1512 std: Some(false),
......@@ -17,21 +14,13 @@ pub(crate) fn target() -> Target {
1714 pointer_width: 32,
1815 data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
1916 arch: Arch::Arm,
20
2117 options: TargetOptions {
2218 abi: Abi::EabiHf,
2319 llvm_floatabi: Some(FloatAbi::Hard),
24 linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
25 linker: Some("rust-lld".into()),
26 relocation_model: RelocModel::Static,
27 panic_strategy: PanicStrategy::Abort,
2820 features: "+vfp3d16".into(),
2921 max_atomic_width: Some(64),
30 emit_debug_gdb_scripts: false,
31 // GCC defaults to 8 for arm-none here.
32 c_enum_min_bits: Some(8),
3322 has_thumb_interworking: true,
34 ..Default::default()
23 ..base::arm_none::opts()
3524 },
3625 }
3726}
compiler/rustc_target/src/spec/targets/armv8r_none_eabihf.rs+2-12
......@@ -1,9 +1,6 @@
11// Targets the Little-endian Cortex-R52 processor (ARMv8-R)
22
3use crate::spec::{
4 Abi, Arch, Cc, FloatAbi, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetMetadata,
5 TargetOptions,
6};
3use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
74
85pub(crate) fn target() -> Target {
96 Target {
......@@ -21,10 +18,6 @@ pub(crate) fn target() -> Target {
2118 options: TargetOptions {
2219 abi: Abi::EabiHf,
2320 llvm_floatabi: Some(FloatAbi::Hard),
24 linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
25 linker: Some("rust-lld".into()),
26 relocation_model: RelocModel::Static,
27 panic_strategy: PanicStrategy::Abort,
2821 // Armv8-R requires a minimum set of floating-point features equivalent to:
2922 // fp-armv8, SP-only, with 16 DP (32 SP) registers
3023 // LLVM defines Armv8-R to include these features automatically.
......@@ -36,11 +29,8 @@ pub(crate) fn target() -> Target {
3629 // Arm Cortex-R52 Processor Technical Reference Manual
3730 // - Chapter 15 Advanced SIMD and floating-point support
3831 max_atomic_width: Some(64),
39 emit_debug_gdb_scripts: false,
40 // GCC defaults to 8 for arm-none here.
41 c_enum_min_bits: Some(8),
4232 has_thumb_interworking: true,
43 ..Default::default()
33 ..base::arm_none::opts()
4434 },
4535 }
4636}
compiler/rustc_target/src/spec/targets/thumbv7a_none_eabi.rs created+26
......@@ -0,0 +1,26 @@
1// Targets the Little-endian Cortex-A8 (and similar) processors (ARMv7-A)
2
3use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
4
5pub(crate) fn target() -> Target {
6 Target {
7 llvm_target: "thumbv7a-none-eabi".into(),
8 metadata: TargetMetadata {
9 description: Some("Thumb-mode Bare Armv7-A".into()),
10 tier: Some(2),
11 host_tools: Some(false),
12 std: Some(false),
13 },
14 pointer_width: 32,
15 data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
16 arch: Arch::Arm,
17 options: TargetOptions {
18 abi: Abi::Eabi,
19 llvm_floatabi: Some(FloatAbi::Soft),
20 features: "+soft-float,-neon,+strict-align".into(),
21 max_atomic_width: Some(64),
22 has_thumb_interworking: true,
23 ..base::arm_none::opts()
24 },
25 }
26}
compiler/rustc_target/src/spec/targets/thumbv7a_none_eabihf.rs created+26
......@@ -0,0 +1,26 @@
1// Targets the Little-endian Cortex-A8 (and similar) processors (ARMv7-A)
2
3use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
4
5pub(crate) fn target() -> Target {
6 Target {
7 llvm_target: "thumbv7a-none-eabihf".into(),
8 metadata: TargetMetadata {
9 description: Some("Thumb-mode Bare Armv7-A, hardfloat".into()),
10 tier: Some(2),
11 host_tools: Some(false),
12 std: Some(false),
13 },
14 pointer_width: 32,
15 data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
16 arch: Arch::Arm,
17 options: TargetOptions {
18 abi: Abi::EabiHf,
19 llvm_floatabi: Some(FloatAbi::Hard),
20 features: "+vfp3d16,-neon,+strict-align".into(),
21 max_atomic_width: Some(64),
22 has_thumb_interworking: true,
23 ..base::arm_none::opts()
24 },
25 }
26}
compiler/rustc_target/src/spec/targets/thumbv7r_none_eabi.rs created+25
......@@ -0,0 +1,25 @@
1// Targets the Little-endian Cortex-R4/R5 processor (ARMv7-R)
2
3use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
4
5pub(crate) fn target() -> Target {
6 Target {
7 llvm_target: "thumbv7r-none-eabi".into(),
8 metadata: TargetMetadata {
9 description: Some("Thumb-mode Bare Armv7-R".into()),
10 tier: Some(2),
11 host_tools: Some(false),
12 std: Some(false),
13 },
14 pointer_width: 32,
15 data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
16 arch: Arch::Arm,
17 options: TargetOptions {
18 abi: Abi::Eabi,
19 llvm_floatabi: Some(FloatAbi::Soft),
20 max_atomic_width: Some(64),
21 has_thumb_interworking: true,
22 ..base::arm_none::opts()
23 },
24 }
25}
compiler/rustc_target/src/spec/targets/thumbv7r_none_eabihf.rs created+26
......@@ -0,0 +1,26 @@
1// Targets the Little-endian Cortex-R4F/R5F processor (ARMv7-R)
2
3use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
4
5pub(crate) fn target() -> Target {
6 Target {
7 llvm_target: "thumbv7r-none-eabihf".into(),
8 metadata: TargetMetadata {
9 description: Some("Thumb-mode Bare Armv7-R, hardfloat".into()),
10 tier: Some(2),
11 host_tools: Some(false),
12 std: Some(false),
13 },
14 pointer_width: 32,
15 data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
16 arch: Arch::Arm,
17 options: TargetOptions {
18 abi: Abi::EabiHf,
19 llvm_floatabi: Some(FloatAbi::Hard),
20 features: "+vfp3d16".into(),
21 max_atomic_width: Some(64),
22 has_thumb_interworking: true,
23 ..base::arm_none::opts()
24 },
25 }
26}
compiler/rustc_target/src/spec/targets/thumbv8r_none_eabihf.rs created+36
......@@ -0,0 +1,36 @@
1// Targets the Little-endian Cortex-R52 processor (ARMv8-R)
2
3use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
4
5pub(crate) fn target() -> Target {
6 Target {
7 llvm_target: "thumbv8r-none-eabihf".into(),
8 metadata: TargetMetadata {
9 description: Some("Thumb-mode Bare Armv8-R, hardfloat".into()),
10 tier: Some(2),
11 host_tools: Some(false),
12 std: Some(false),
13 },
14 pointer_width: 32,
15 data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
16 arch: Arch::Arm,
17
18 options: TargetOptions {
19 abi: Abi::EabiHf,
20 llvm_floatabi: Some(FloatAbi::Hard),
21 // Armv8-R requires a minimum set of floating-point features equivalent to:
22 // fp-armv8, SP-only, with 16 DP (32 SP) registers
23 // LLVM defines Armv8-R to include these features automatically.
24 //
25 // The Cortex-R52 supports these default features and optionally includes:
26 // neon-fp-armv8, SP+DP, with 32 DP registers
27 //
28 // Reference:
29 // Arm Cortex-R52 Processor Technical Reference Manual
30 // - Chapter 15 Advanced SIMD and floating-point support
31 max_atomic_width: Some(64),
32 has_thumb_interworking: true,
33 ..base::arm_none::opts()
34 },
35 }
36}
compiler/rustc_target/src/target_features.rs+16-1
......@@ -492,7 +492,22 @@ static X86_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
492492const HEXAGON_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
493493 // tidy-alphabetical-start
494494 ("hvx", Unstable(sym::hexagon_target_feature), &[]),
495 ("hvx-ieee-fp", Unstable(sym::hexagon_target_feature), &["hvx"]),
496 ("hvx-length64b", Unstable(sym::hexagon_target_feature), &["hvx"]),
495497 ("hvx-length128b", Unstable(sym::hexagon_target_feature), &["hvx"]),
498 ("hvx-qfloat", Unstable(sym::hexagon_target_feature), &["hvx"]),
499 ("hvxv60", Unstable(sym::hexagon_target_feature), &["hvx"]),
500 ("hvxv62", Unstable(sym::hexagon_target_feature), &["hvxv60"]),
501 ("hvxv65", Unstable(sym::hexagon_target_feature), &["hvxv62"]),
502 ("hvxv66", Unstable(sym::hexagon_target_feature), &["hvxv65", "zreg"]),
503 ("hvxv67", Unstable(sym::hexagon_target_feature), &["hvxv66"]),
504 ("hvxv68", Unstable(sym::hexagon_target_feature), &["hvxv67"]),
505 ("hvxv69", Unstable(sym::hexagon_target_feature), &["hvxv68"]),
506 ("hvxv71", Unstable(sym::hexagon_target_feature), &["hvxv69"]),
507 ("hvxv73", Unstable(sym::hexagon_target_feature), &["hvxv71"]),
508 ("hvxv75", Unstable(sym::hexagon_target_feature), &["hvxv73"]),
509 ("hvxv79", Unstable(sym::hexagon_target_feature), &["hvxv75"]),
510 ("zreg", Unstable(sym::hexagon_target_feature), &[]),
496511 // tidy-alphabetical-end
497512];
498513
......@@ -949,7 +964,7 @@ const SPARC_FEATURES_FOR_CORRECT_FIXED_LENGTH_VECTOR_ABI: &'static [(u64, &'stat
949964 &[/*(64, "vis")*/];
950965
951966const HEXAGON_FEATURES_FOR_CORRECT_FIXED_LENGTH_VECTOR_ABI: &'static [(u64, &'static str)] =
952 &[/*(512, "hvx-length64b"),*/ (1024, "hvx-length128b")];
967 &[(512, "hvx-length64b"), (1024, "hvx-length128b")];
953968const MIPS_FEATURES_FOR_CORRECT_FIXED_LENGTH_VECTOR_ABI: &'static [(u64, &'static str)] =
954969 &[(128, "msa")];
955970const CSKY_FEATURES_FOR_CORRECT_FIXED_LENGTH_VECTOR_ABI: &'static [(u64, &'static str)] =
library/core/src/bool.rs+13-4
......@@ -1,5 +1,7 @@
11//! impl bool {}
22
3use crate::marker::Destruct;
4
35impl bool {
46 /// Returns `Some(t)` if the `bool` is [`true`](../std/keyword.true.html),
57 /// or `None` otherwise.
......@@ -29,8 +31,9 @@ impl bool {
2931 /// assert_eq!(a, 2);
3032 /// ```
3133 #[stable(feature = "bool_to_option", since = "1.62.0")]
34 #[rustc_const_unstable(feature = "const_bool", issue = "151531")]
3235 #[inline]
33 pub fn then_some<T>(self, t: T) -> Option<T> {
36 pub const fn then_some<T: [const] Destruct>(self, t: T) -> Option<T> {
3437 if self { Some(t) } else { None }
3538 }
3639
......@@ -57,8 +60,9 @@ impl bool {
5760 #[doc(alias = "then_with")]
5861 #[stable(feature = "lazy_bool_to_option", since = "1.50.0")]
5962 #[rustc_diagnostic_item = "bool_then"]
63 #[rustc_const_unstable(feature = "const_bool", issue = "151531")]
6064 #[inline]
61 pub fn then<T, F: FnOnce() -> T>(self, f: F) -> Option<T> {
65 pub const fn then<T, F: [const] FnOnce() -> T + [const] Destruct>(self, f: F) -> Option<T> {
6266 if self { Some(f()) } else { None }
6367 }
6468
......@@ -94,8 +98,9 @@ impl bool {
9498 /// assert_eq!(a, 2);
9599 /// ```
96100 #[unstable(feature = "bool_to_result", issue = "142748")]
101 #[rustc_const_unstable(feature = "const_bool", issue = "151531")]
97102 #[inline]
98 pub fn ok_or<E>(self, err: E) -> Result<(), E> {
103 pub const fn ok_or<E: [const] Destruct>(self, err: E) -> Result<(), E> {
99104 if self { Ok(()) } else { Err(err) }
100105 }
101106
......@@ -124,8 +129,12 @@ impl bool {
124129 /// assert_eq!(a, 1);
125130 /// ```
126131 #[unstable(feature = "bool_to_result", issue = "142748")]
132 #[rustc_const_unstable(feature = "const_bool", issue = "151531")]
127133 #[inline]
128 pub fn ok_or_else<E, F: FnOnce() -> E>(self, f: F) -> Result<(), E> {
134 pub const fn ok_or_else<E, F: [const] FnOnce() -> E + [const] Destruct>(
135 self,
136 f: F,
137 ) -> Result<(), E> {
129138 if self { Ok(()) } else { Err(f()) }
130139 }
131140}
library/core/src/slice/ascii.rs+91-12
......@@ -3,10 +3,7 @@
33use core::ascii::EscapeDefault;
44
55use crate::fmt::{self, Write};
6#[cfg(not(any(
7 all(target_arch = "x86_64", target_feature = "sse2"),
8 all(target_arch = "loongarch64", target_feature = "lsx")
9)))]
6#[cfg(not(all(target_arch = "loongarch64", target_feature = "lsx")))]
107use crate::intrinsics::const_eval_select;
118use crate::{ascii, iter, ops};
129
......@@ -463,19 +460,101 @@ const fn is_ascii(s: &[u8]) -> bool {
463460 )
464461}
465462
466/// ASCII test optimized to use the `pmovmskb` instruction on `x86-64` and the
467/// `vmskltz.b` instruction on `loongarch64`.
463/// Chunk size for vectorized ASCII checking (two 16-byte SSE registers).
464#[cfg(all(target_arch = "x86_64", target_feature = "sse2"))]
465const CHUNK_SIZE: usize = 32;
466
467/// SSE2 implementation using `_mm_movemask_epi8` (compiles to `pmovmskb`) to
468/// avoid LLVM's broken AVX-512 auto-vectorization of counting loops.
469///
470/// FIXME(llvm#176906): Remove this workaround once LLVM generates efficient code.
471#[cfg(all(target_arch = "x86_64", target_feature = "sse2"))]
472fn is_ascii_sse2(bytes: &[u8]) -> bool {
473 use crate::arch::x86_64::{__m128i, _mm_loadu_si128, _mm_movemask_epi8, _mm_or_si128};
474
475 let mut i = 0;
476
477 while i + CHUNK_SIZE <= bytes.len() {
478 // SAFETY: We have verified that `i + CHUNK_SIZE <= bytes.len()`.
479 let ptr = unsafe { bytes.as_ptr().add(i) };
480
481 // Load two 16-byte chunks and combine them.
482 // SAFETY: We verified `i + 32 <= len`, so ptr is valid for 32 bytes.
483 // `_mm_loadu_si128` allows unaligned loads.
484 let chunk1 = unsafe { _mm_loadu_si128(ptr as *const __m128i) };
485 // SAFETY: Same as above - ptr.add(16) is within the valid 32-byte range.
486 let chunk2 = unsafe { _mm_loadu_si128(ptr.add(16) as *const __m128i) };
487
488 // OR them together - if any byte has the high bit set, the result will too.
489 // SAFETY: SSE2 is guaranteed by the cfg predicate.
490 let combined = unsafe { _mm_or_si128(chunk1, chunk2) };
491
492 // Create a mask from the MSBs of each byte.
493 // If any byte is >= 128, its MSB is 1, so the mask will be non-zero.
494 // SAFETY: SSE2 is guaranteed by the cfg predicate.
495 let mask = unsafe { _mm_movemask_epi8(combined) };
496
497 if mask != 0 {
498 return false;
499 }
500
501 i += CHUNK_SIZE;
502 }
503
504 // Handle remaining bytes with simple loop
505 while i < bytes.len() {
506 if !bytes[i].is_ascii() {
507 return false;
508 }
509 i += 1;
510 }
511
512 true
513}
514
515/// ASCII test optimized to use the `pmovmskb` instruction on `x86-64`.
516///
517/// Uses explicit SSE2 intrinsics to prevent LLVM from auto-vectorizing with
518/// broken AVX-512 code that extracts mask bits one-by-one.
519#[cfg(all(target_arch = "x86_64", target_feature = "sse2"))]
520#[inline]
521#[rustc_allow_const_fn_unstable(const_eval_select)]
522const fn is_ascii(bytes: &[u8]) -> bool {
523 const USIZE_SIZE: usize = size_of::<usize>();
524 const NONASCII_MASK: usize = usize::MAX / 255 * 0x80;
525
526 const_eval_select!(
527 @capture { bytes: &[u8] } -> bool:
528 if const {
529 is_ascii_simple(bytes)
530 } else {
531 // For small inputs, use usize-at-a-time processing to avoid SSE2 call overhead.
532 if bytes.len() < CHUNK_SIZE {
533 let chunks = bytes.chunks_exact(USIZE_SIZE);
534 let remainder = chunks.remainder();
535 for chunk in chunks {
536 let word = usize::from_ne_bytes(chunk.try_into().unwrap());
537 if (word & NONASCII_MASK) != 0 {
538 return false;
539 }
540 }
541 return remainder.iter().all(|b| b.is_ascii());
542 }
543
544 is_ascii_sse2(bytes)
545 }
546 )
547}
548
549/// ASCII test optimized to use the `vmskltz.b` instruction on `loongarch64`.
468550///
469551/// Other platforms are not likely to benefit from this code structure, so they
470552/// use SWAR techniques to test for ASCII in `usize`-sized chunks.
471#[cfg(any(
472 all(target_arch = "x86_64", target_feature = "sse2"),
473 all(target_arch = "loongarch64", target_feature = "lsx")
474))]
553#[cfg(all(target_arch = "loongarch64", target_feature = "lsx"))]
475554#[inline]
476555const fn is_ascii(bytes: &[u8]) -> bool {
477556 // Process chunks of 32 bytes at a time in the fast path to enable
478 // auto-vectorization and use of `pmovmskb`. Two 128-bit vector registers
557 // auto-vectorization and use of `vmskltz.b`. Two 128-bit vector registers
479558 // can be OR'd together and then the resulting vector can be tested for
480559 // non-ASCII bytes.
481560 const CHUNK_SIZE: usize = 32;
......@@ -485,7 +564,7 @@ const fn is_ascii(bytes: &[u8]) -> bool {
485564 while i + CHUNK_SIZE <= bytes.len() {
486565 let chunk_end = i + CHUNK_SIZE;
487566
488 // Get LLVM to produce a `pmovmskb` instruction on x86-64 which
567 // Get LLVM to produce a `vmskltz.b` instruction on loongarch64 which
489568 // creates a mask from the most significant bit of each byte.
490569 // ASCII bytes are less than 128 (0x80), so their most significant
491570 // bit is unset.
library/coretests/tests/bool.rs+14-6
......@@ -82,6 +82,10 @@ pub fn test_bool_not() {
8282 }
8383}
8484
85const fn zero() -> i32 {
86 0
87}
88
8589#[test]
8690fn test_bool_to_option() {
8791 assert_eq!(false.then_some(0), None);
......@@ -89,11 +93,6 @@ fn test_bool_to_option() {
8993 assert_eq!(false.then(|| 0), None);
9094 assert_eq!(true.then(|| 0), Some(0));
9195
92 /* FIXME(#110395)
93 const fn zero() -> i32 {
94 0
95 }
96
9796 const A: Option<i32> = false.then_some(0);
9897 const B: Option<i32> = true.then_some(0);
9998 const C: Option<i32> = false.then(zero);
......@@ -103,7 +102,6 @@ fn test_bool_to_option() {
103102 assert_eq!(B, Some(0));
104103 assert_eq!(C, None);
105104 assert_eq!(D, Some(0));
106 */
107105}
108106
109107#[test]
......@@ -112,4 +110,14 @@ fn test_bool_to_result() {
112110 assert_eq!(true.ok_or(0), Ok(()));
113111 assert_eq!(false.ok_or_else(|| 0), Err(0));
114112 assert_eq!(true.ok_or_else(|| 0), Ok(()));
113
114 const A: Result<(), i32> = false.ok_or(0);
115 const B: Result<(), i32> = true.ok_or(0);
116 const C: Result<(), i32> = false.ok_or_else(zero);
117 const D: Result<(), i32> = true.ok_or_else(zero);
118
119 assert_eq!(A, Err(0));
120 assert_eq!(B, Ok(()));
121 assert_eq!(C, Err(0));
122 assert_eq!(D, Ok(()));
115123}
library/coretests/tests/lib.rs+1
......@@ -17,6 +17,7 @@
1717#![feature(clamp_magnitude)]
1818#![feature(clone_to_uninit)]
1919#![feature(const_array)]
20#![feature(const_bool)]
2021#![feature(const_cell_traits)]
2122#![feature(const_clone)]
2223#![feature(const_cmp)]
library/std/src/sys/pal/uefi/tests.rs+17-36
......@@ -1,14 +1,14 @@
11//! These tests are not run automatically right now. Please run these tests manually by copying them
22//! to a separate project when modifying any related code.
33
4use super::alloc::*;
54use super::time::system_time_internal::{from_uefi, to_uefi};
65use crate::io::{IoSlice, IoSliceMut};
6use crate::ops::{Deref, DerefMut};
77use crate::time::Duration;
88
99const SECS_IN_MINUTE: u64 = 60;
1010
11const MAX_UEFI_TIME: Duration = from_uefi(r_efi::efi::Time {
11const MAX_UEFI_TIME: Duration = from_uefi(&r_efi::efi::Time {
1212 year: 9999,
1313 month: 12,
1414 day: 31,
......@@ -20,27 +20,8 @@ const MAX_UEFI_TIME: Duration = from_uefi(r_efi::efi::Time {
2020 daylight: 0,
2121 pad1: 0,
2222 pad2: 0,
23});
24
25#[test]
26fn align() {
27 // UEFI ABI specifies that allocation alignment minimum is always 8. So this can be
28 // statically verified.
29 assert_eq!(POOL_ALIGNMENT, 8);
30
31 // Loop over allocation-request sizes from 0-256 and alignments from 1-128, and verify
32 // that in case of overalignment there is at least space for one additional pointer to
33 // store in the allocation.
34 for i in 0..256 {
35 for j in &[1, 2, 4, 8, 16, 32, 64, 128] {
36 if *j <= 8 {
37 assert_eq!(align_size(i, *j), i);
38 } else {
39 assert!(align_size(i, *j) > i + size_of::<*mut ()>());
40 }
41 }
42 }
43}
23})
24.unwrap();
4425
4526// UEFI Time cannot implement Eq due to uninitilaized pad1 and pad2
4627fn uefi_time_cmp(t1: r_efi::efi::Time, t2: r_efi::efi::Time) -> bool {
......@@ -70,9 +51,9 @@ fn systemtime_start() {
7051 daylight: 0,
7152 pad2: 0,
7253 };
73 assert_eq!(from_uefi(&t), Duration::new(0, 0));
74 assert!(uefi_time_cmp(t, to_uefi(&from_uefi(&t), -1440, 0).unwrap()));
75 assert!(to_uefi(&from_uefi(&t), 0, 0).is_err());
54 assert_eq!(from_uefi(&t).unwrap(), Duration::new(0, 0));
55 assert!(uefi_time_cmp(t, to_uefi(&from_uefi(&t).unwrap(), -1440, 0).unwrap()));
56 assert!(to_uefi(&from_uefi(&t).unwrap(), 0, 0).is_err());
7657}
7758
7859#[test]
......@@ -90,9 +71,9 @@ fn systemtime_utc_start() {
9071 daylight: 0,
9172 pad2: 0,
9273 };
93 assert_eq!(from_uefi(&t), Duration::new(1440 * SECS_IN_MINUTE, 0));
94 assert!(uefi_time_cmp(t, to_uefi(&from_uefi(&t), 0, 0).unwrap()));
95 assert!(to_uefi(&from_uefi(&t), -1440, 0).is_ok());
74 assert_eq!(from_uefi(&t).unwrap(), Duration::new(1440 * SECS_IN_MINUTE, 0));
75 assert!(uefi_time_cmp(t, to_uefi(&from_uefi(&t).unwrap(), 0, 0).unwrap()));
76 assert!(to_uefi(&from_uefi(&t).unwrap(), -1440, 0).is_ok());
9677}
9778
9879#[test]
......@@ -110,8 +91,8 @@ fn systemtime_end() {
11091 daylight: 0,
11192 pad2: 0,
11293 };
113 assert!(to_uefi(&from_uefi(&t), 1440, 0).is_ok());
114 assert!(to_uefi(&from_uefi(&t), 1439, 0).is_err());
94 assert!(to_uefi(&from_uefi(&t).unwrap(), 1440, 0).is_ok());
95 assert!(to_uefi(&from_uefi(&t).unwrap(), 1439, 0).is_err());
11596}
11697
11798#[test]
......@@ -139,17 +120,17 @@ fn min_time() {
139120
140121#[test]
141122fn max_time() {
142 let inp = MAX_UEFI_TIME.0;
123 let inp = MAX_UEFI_TIME;
143124 let new_tz = to_uefi(&inp, -1440, 0).err().unwrap();
144125 assert_eq!(new_tz, 1440);
145126 assert!(to_uefi(&inp, new_tz, 0).is_ok());
146127
147 let inp = MAX_UEFI_TIME.0 - Duration::from_secs(1440 * SECS_IN_MINUTE);
128 let inp = MAX_UEFI_TIME - Duration::from_secs(1440 * SECS_IN_MINUTE);
148129 let new_tz = to_uefi(&inp, -1440, 0).err().unwrap();
149130 assert_eq!(new_tz, 0);
150131 assert!(to_uefi(&inp, new_tz, 0).is_ok());
151132
152 let inp = MAX_UEFI_TIME.0 - Duration::from_secs(1440 * SECS_IN_MINUTE + 10);
133 let inp = MAX_UEFI_TIME - Duration::from_secs(1440 * SECS_IN_MINUTE + 10);
153134 let new_tz = to_uefi(&inp, -1440, 0).err().unwrap();
154135 assert_eq!(new_tz, 0);
155136 assert!(to_uefi(&inp, new_tz, 0).is_ok());
......@@ -266,8 +247,8 @@ fn io_slice_mut_basic() {
266247 let mut data_clone = [0, 1, 2, 3, 4];
267248 let mut io_slice_mut = IoSliceMut::new(&mut data_clone);
268249
269 assert_eq!(data, io_slice_mut.as_slice());
270 assert_eq!(data, io_slice_mut.as_mut_slice());
250 assert_eq!(data, io_slice_mut.deref());
251 assert_eq!(data, io_slice_mut.deref_mut());
271252
272253 io_slice_mut.advance(2);
273254 assert_eq!(&data[2..], io_slice_mut.into_slice());
library/test/build.rs+1
......@@ -1,4 +1,5 @@
11fn main() {
2 println!("cargo:rerun-if-changed=build.rs");
23 println!("cargo:rustc-check-cfg=cfg(enable_unstable_features)");
34
45 let rustc = std::env::var("RUSTC").unwrap_or_else(|_| "rustc".into());
src/bootstrap/src/core/sanity.rs+5
......@@ -38,6 +38,11 @@ pub struct Finder {
3838const STAGE0_MISSING_TARGETS: &[&str] = &[
3939 // just a dummy comment so the list doesn't get onelined
4040 "x86_64-unknown-linux-gnuasan",
41 "thumbv7a-none-eabi",
42 "thumbv7a-none-eabihf",
43 "thumbv7r-none-eabi",
44 "thumbv7r-none-eabihf",
45 "thumbv8r-none-eabihf",
4146];
4247
4348/// Minimum version threshold for libstdc++ required when using prebuilt LLVM
src/doc/rustc/src/SUMMARY.md+4-4
......@@ -56,15 +56,15 @@
5656 - [arm-none-eabi](platform-support/arm-none-eabi.md)
5757 - [{arm,thumb}v4t-none-eabi](platform-support/armv4t-none-eabi.md)
5858 - [{arm,thumb}v5te-none-eabi](platform-support/armv5te-none-eabi.md)
59 - [armv7a-none-eabi{,hf}](platform-support/armv7a-none-eabi.md)
60 - [armv7r-none-eabi{,hf}](platform-support/armv7r-none-eabi.md)
61 - [armebv7r-none-eabi{,hf}](platform-support/armebv7r-none-eabi.md)
62 - [armv8r-none-eabihf](platform-support/armv8r-none-eabihf.md)
59 - [{arm,thumb}v7a-none-eabi{,hf}](platform-support/armv7a-none-eabi.md)
60 - [{arm,thumb}v7r-none-eabi{,hf}](platform-support/armv7r-none-eabi.md)
61 - [{arm,thumb}v8r-none-eabihf](platform-support/armv8r-none-eabihf.md)
6362 - [thumbv6m-none-eabi](./platform-support/thumbv6m-none-eabi.md)
6463 - [thumbv7em-none-eabi\*](./platform-support/thumbv7em-none-eabi.md)
6564 - [thumbv7m-none-eabi](./platform-support/thumbv7m-none-eabi.md)
6665 - [thumbv8m.base-none-eabi](./platform-support/thumbv8m.base-none-eabi.md)
6766 - [thumbv8m.main-none-eabi\*](./platform-support/thumbv8m.main-none-eabi.md)
67 - [armebv7r-none-eabi{,hf}](platform-support/armebv7r-none-eabi.md)
6868 - [arm\*-unknown-linux-\*](./platform-support/arm-linux.md)
6969 - [armeb-unknown-linux-gnueabi](platform-support/armeb-unknown-linux-gnueabi.md)
7070 - [armv5te-unknown-linux-gnueabi](platform-support/armv5te-unknown-linux-gnueabi.md)
src/doc/rustc/src/platform-support.md+7-2
......@@ -411,17 +411,22 @@ target | std | host | notes
411411[`thumbv4t-none-eabi`](platform-support/armv4t-none-eabi.md) | * | | Thumb-mode Bare Armv4T
412412[`thumbv5te-none-eabi`](platform-support/armv5te-none-eabi.md) | * | | Thumb-mode Bare Armv5TE
413413[`thumbv6m-nuttx-eabi`](platform-support/nuttx.md) | ✓ | | ARMv6M with NuttX
414`thumbv7a-pc-windows-msvc` | | |
415[`thumbv7a-uwp-windows-msvc`](platform-support/uwp-windows-msvc.md) | | |
414[`thumbv7a-none-eabi`](platform-support/armv7a-none-eabi.md) | * | | Thumb-mode Bare Armv7-A
415[`thumbv7a-none-eabihf`](platform-support/armv7a-none-eabi.md) | * | | Thumb-mode Bare Armv7-A, hardfloat
416416[`thumbv7a-nuttx-eabi`](platform-support/nuttx.md) | ✓ | | ARMv7-A with NuttX
417417[`thumbv7a-nuttx-eabihf`](platform-support/nuttx.md) | ✓ | | ARMv7-A with NuttX, hardfloat
418`thumbv7a-pc-windows-msvc` | | |
419[`thumbv7a-uwp-windows-msvc`](platform-support/uwp-windows-msvc.md) | | |
418420[`thumbv7em-nuttx-eabi`](platform-support/nuttx.md) | ✓ | | ARMv7EM with NuttX
419421[`thumbv7em-nuttx-eabihf`](platform-support/nuttx.md) | ✓ | | ARMv7EM with NuttX, hardfloat
420422[`thumbv7m-nuttx-eabi`](platform-support/nuttx.md) | ✓ | | ARMv7M with NuttX
421423`thumbv7neon-unknown-linux-musleabihf` | ? | | Thumb2-mode Armv7-A Linux with NEON, musl 1.2.5
424[`thumbv7r-none-eabi`](platform-support/armv7r-none-eabi.md) | * | | Thumb-mode Bare Armv7-R
425[`thumbv7r-none-eabihf`](platform-support/armv7r-none-eabi.md) | * | | Thumb-mode Bare Armv7-R, hardfloat
422426[`thumbv8m.base-nuttx-eabi`](platform-support/nuttx.md) | ✓ | | ARMv8M Baseline with NuttX
423427[`thumbv8m.main-nuttx-eabi`](platform-support/nuttx.md) | ✓ | | ARMv8M Mainline with NuttX
424428[`thumbv8m.main-nuttx-eabihf`](platform-support/nuttx.md) | ✓ | | ARMv8M Mainline with NuttX, hardfloat
429[`thumbv8r-none-eabihf`](platform-support/armv8r-none-eabihf.md) | * | | Thumb-mode Bare Armv8-R, hardfloat
425430[`wasm64-unknown-unknown`](platform-support/wasm64-unknown-unknown.md) | ? | | WebAssembly
426431[`wasm32-wali-linux-musl`](platform-support/wasm32-wali-linux.md) | ? | | WebAssembly with [WALI](https://github.com/arjunr2/WALI)
427432[`wasm32-wasip3`](platform-support/wasm32-wasip3.md) | ✓ | | WebAssembly with WASIp3
src/doc/rustc/src/platform-support/armv7a-none-eabi.md+8-4
......@@ -1,10 +1,14 @@
1# `armv7a-none-eabi` and `armv7a-none-eabihf`
1# `armv7a-none-eabi*` and `thumbv7a-none-eabi*`
22
3* **Tier: 2**
3* **Tier: 2** (`armv7a-none-eabi` and `armv7a-none-eabihf`)
4* **Tier: 3** (`thumbv7a-none-eabi` and `thumbv7a-none-eabihf`)
45* **Library Support:** core and alloc (bare-metal, `#![no_std]`)
56
6Bare-metal target for CPUs in the Armv7-A architecture family, supporting
7dual ARM/Thumb mode, with ARM mode as the default.
7Bare-metal target for CPUs in the Armv7-A architecture family, supporting dual
8ARM/Thumb mode. The `armv7a-none-eabi*` targets use Arm mode by default and the
9`thumbv7a-none-eabi` targets use Thumb mode by default. The `-eabi` targets use
10a soft-float ABI and do not require an FPU, while the `-eabihf` targets use a
11hard-float ABI and do require an FPU.
812
913Note, this is for processors running in AArch32 mode. For the AArch64 mode
1014added in Armv8-A, see [`aarch64-unknown-none`](aarch64-unknown-none.md) instead.
src/doc/rustc/src/platform-support/armv7r-none-eabi.md+13-9
......@@ -1,10 +1,14 @@
1# `armv7r-none-eabi` and `armv7r-none-eabihf`
1# `armv7r-none-eabi*` and `thumbv7r-none-eabi*`
22
3* **Tier: 2**
3* **Tier: 2** (`armv7r-none-eabi` and `armv7r-none-eabihf`)
4* **Tier: 3** (`thumbv7r-none-eabi` and `thumbv7r-none-eabihf`)
45* **Library Support:** core and alloc (bare-metal, `#![no_std]`)
56
6Bare-metal target for CPUs in the Armv7-R architecture family, supporting
7dual ARM/Thumb mode, with ARM mode as the default.
7Bare-metal target for CPUs in the Armv7-R architecture family, supporting dual
8ARM/Thumb mode. The `armv7r-none-eabi*` targets use Arm mode by default and the
9`thumbv7r-none-eabi*` targets use Thumb mode by default. The `-eabi` targets use
10a soft-float ABI and do not require an FPU, while the `-eabihf` targets use a
11hard-float ABI and do require an FPU.
812
913Processors in this family include the [Arm Cortex-R4, 5, 7, and 8][cortex-r].
1014
......@@ -25,11 +29,11 @@ See [`arm-none-eabi`](arm-none-eabi.md) for information applicable to all
2529
2630## Requirements
2731
28When using the hardfloat targets, the minimum floating-point features assumed
29are those of the `vfpv3-d16`, which includes single- and double-precision, with
3016 double-precision registers. This floating-point unit appears in Cortex-R4F
31and Cortex-R5F processors. See [VFP in the Cortex-R processors][vfp]
32for more details on the possible FPU variants.
32When using the hardfloat (`-eabibf`) targets, the minimum floating-point
33features assumed are those of the `vfpv3-d16`, which includes single- and
34double-precision, with 16 double-precision registers. This floating-point unit
35appears in Cortex-R4F and Cortex-R5F processors. See [VFP in the Cortex-R
36processors][vfp] for more details on the possible FPU variants.
3337
3438If your processor supports a different set of floating-point features than the
3539default expectations of `vfpv3-d16`, then these should also be enabled or
src/doc/rustc/src/platform-support/armv8r-none-eabihf.md+7-4
......@@ -1,10 +1,13 @@
1# `armv8r-none-eabihf`
1# `armv8r-none-eabihf` and `thumbv8r-none-eabihf`
22
3* **Tier: 2**
3* **Tier: 2**: `armv8r-none-eabihf`
4* **Tier: 3**: `thumbv8r-none-eabihf`
45* **Library Support:** core and alloc (bare-metal, `#![no_std]`)
56
6Bare-metal target for CPUs in the Armv8-R architecture family, supporting
7dual ARM/Thumb mode, with ARM mode as the default.
7Bare-metal target for CPUs in the Armv8-R architecture family, supporting dual
8ARM/Thumb mode. The `armv8r-none-eabihf` target uses Arm mode by default and
9the `thumbv8r-none-eabihf` target uses Thumb mode by default. Both targets
10use a hard-float ABI and require an FPU.
811
912Processors in this family include the Arm [Cortex-R52][cortex-r52]
1013and [Cortex-R52+][cortex-r52-plus].
src/librustdoc/html/static/css/rustdoc.css+19
......@@ -210,6 +210,24 @@ body {
210210 color: var(--main-color);
211211}
212212
213/* Skip navigation link for keyboard users (WCAG 2.4.1) */
214.skip-main-content {
215 position: absolute;
216 left: 0;
217 top: -100%;
218 z-index: 1000;
219 padding: 0.5rem 1rem;
220 background-color: var(--main-background-color);
221 color: var(--main-color);
222 text-decoration: none;
223 font-weight: 500;
224 border-bottom-right-radius: 4px;
225 outline: 2px solid var(--search-input-focused-border-color);
226}
227.skip-main-content:focus {
228 top: 0;
229}
230
213231h1 {
214232 font-size: 1.5rem; /* 24px */
215233}
......@@ -1114,6 +1132,7 @@ pre, .rustdoc.src .example-wrap, .example-wrap .src-line-numbers {
11141132
11151133#main-content {
11161134 position: relative;
1135 outline: none;
11171136}
11181137
11191138.docblock table {
src/librustdoc/html/templates/page.html+2-1
......@@ -66,6 +66,7 @@
6666 {{ layout.external_html.in_header|safe }}
6767</head> {# #}
6868<body class="rustdoc {{+page.css_class}}"> {# #}
69 <a class="skip-main-content" href="#main-content">Skip to main content</a> {# #}
6970 <!--[if lte IE 11]> {# #}
7071 <div class="warning"> {# #}
7172 This old browser is unsupported and will most likely display funky things. {# #}
......@@ -109,7 +110,7 @@
109110 <div class="sidebar-resizer" title="Drag to resize sidebar"></div> {# #}
110111 <main>
111112 {% if page.css_class != "src" %}<div class="width-limiter">{% endif %}
112 <section id="main-content" class="content">{{ content|safe }}</section>
113 <section id="main-content" class="content" tabindex="-1">{{ content|safe }}</section>
113114 {% if page.css_class != "src" %}</div>{% endif %}
114115 </main>
115116 {{ layout.external_html.after_content|safe }}
tests/assembly-llvm/slice-is-ascii.rs created+32
......@@ -0,0 +1,32 @@
1//@ revisions: X86_64 LA64
2//@ assembly-output: emit-asm
3//@ compile-flags: -C opt-level=3
4//
5//@ [X86_64] only-x86_64
6//@ [X86_64] compile-flags: -C target-cpu=znver4
7//@ [X86_64] compile-flags: -C llvm-args=-x86-asm-syntax=intel
8//
9//@ [LA64] only-loongarch64
10
11#![crate_type = "lib"]
12
13/// Verify `is_ascii` generates efficient code on different architectures:
14///
15/// - x86_64: Must NOT use `kshiftrd`/`kshiftrq` (broken AVX-512 auto-vectorization).
16/// The fix uses explicit SSE2 intrinsics (`pmovmskb`/`vpmovmskb`).
17/// See: https://github.com/llvm/llvm-project/issues/176906
18///
19/// - loongarch64: Should use `vmskltz.b` instruction for the fast-path.
20/// This architecture still relies on LLVM auto-vectorization.
21
22// X86_64-LABEL: test_is_ascii
23// X86_64-NOT: kshiftrd
24// X86_64-NOT: kshiftrq
25
26// LA64-LABEL: test_is_ascii
27// LA64: vmskltz.b
28
29#[no_mangle]
30pub fn test_is_ascii(s: &[u8]) -> bool {
31 s.is_ascii()
32}
tests/assembly-llvm/targets/targets-elf.rs+15
......@@ -559,6 +559,21 @@
559559//@ revisions: thumbv5te_none_eabi
560560//@ [thumbv5te_none_eabi] compile-flags: --target thumbv5te-none-eabi
561561//@ [thumbv5te_none_eabi] needs-llvm-components: arm
562//@ revisions: thumbv7a_none_eabi
563//@ [thumbv7a_none_eabi] compile-flags: --target thumbv7a-none-eabi
564//@ [thumbv7a_none_eabi] needs-llvm-components: arm
565//@ revisions: thumbv7a_none_eabihf
566//@ [thumbv7a_none_eabihf] compile-flags: --target thumbv7a-none-eabihf
567//@ [thumbv7a_none_eabihf] needs-llvm-components: arm
568//@ revisions: thumbv7r_none_eabi
569//@ [thumbv7r_none_eabi] compile-flags: --target thumbv7r-none-eabi
570//@ [thumbv7r_none_eabi] needs-llvm-components: arm
571//@ revisions: thumbv7r_none_eabihf
572//@ [thumbv7r_none_eabihf] compile-flags: --target thumbv7r-none-eabihf
573//@ [thumbv7r_none_eabihf] needs-llvm-components: arm
574//@ revisions: thumbv8r_none_eabihf
575//@ [thumbv8r_none_eabihf] compile-flags: --target thumbv8r-none-eabihf
576//@ [thumbv8r_none_eabihf] needs-llvm-components: arm
562577//@ revisions: thumbv6m_none_eabi
563578//@ [thumbv6m_none_eabi] compile-flags: --target thumbv6m-none-eabi
564579//@ [thumbv6m_none_eabi] needs-llvm-components: arm
tests/codegen-llvm/slice-is-ascii.rs deleted-16
......@@ -1,16 +0,0 @@
1//@ only-x86_64
2//@ compile-flags: -C opt-level=3 -C target-cpu=x86-64
3#![crate_type = "lib"]
4
5/// Check that the fast-path of `is_ascii` uses a `pmovmskb` instruction.
6/// Platforms lacking an equivalent instruction use other techniques for
7/// optimizing `is_ascii`.
8// CHECK-LABEL: @is_ascii_autovectorized
9#[no_mangle]
10pub fn is_ascii_autovectorized(s: &[u8]) -> bool {
11 // CHECK: load <32 x i8>
12 // CHECK-NEXT: icmp slt <32 x i8>
13 // CHECK-NEXT: bitcast <32 x i1>
14 // CHECK-NEXT: icmp eq i32
15 s.is_ascii()
16}
tests/run-make/reproducible-build/rmake.rs+1-5
......@@ -199,13 +199,9 @@ fn diff_dir_test(crate_type: CrateType, remap_type: RemapType) {
199199 .arg(format!("--remap-path-prefix={}=/b", base_dir.join("test").display()));
200200 }
201201 RemapType::Cwd { is_empty } => {
202 // FIXME(Oneirical): Building with crate type set to `bin` AND having -Cdebuginfo=2
203 // (or `-g`, the shorthand form) enabled will cause reproducibility failures
204 // for multiple platforms.
205 // See https://github.com/rust-lang/rust/issues/89911
206202 // FIXME(#129117): Windows rlib + `-Cdebuginfo=2` + `-Z remap-cwd-prefix=.` seems
207203 // to be unreproducible.
208 if !matches!(crate_type, CrateType::Bin) && !is_windows() {
204 if !is_windows() {
209205 compiler1.arg("-Cdebuginfo=2");
210206 compiler2.arg("-Cdebuginfo=2");
211207 }
tests/rustdoc-gui/skip-navigation.goml created+19
......@@ -0,0 +1,19 @@
1// This test ensures that the "Skip to main content" link works correctly
2// for keyboard navigation (WCAG 2.4.1 compliance).
3go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
4
5// The skip link should be hidden initially (positioned off-screen above viewport)
6store-position: (".skip-main-content", {"y": y_before})
7store-size: (".skip-main-content", {"height": height_before})
8assert: |y_before| + |height_before| < 0
9
10// The skip link should be the first focusable element when pressing Tab
11press-key: "Tab"
12wait-for: ".skip-main-content:focus"
13
14// When focused, the link should be visible (top: 0px)
15assert-css: (".skip-main-content:focus", {"top": "0px"})
16
17// Pressing Enter on the skip link should move focus to main content
18press-key: "Enter"
19wait-for: "#main-content:focus"
tests/ui/check-cfg/target_feature.stderr+15
......@@ -131,7 +131,21 @@ LL | cfg!(target_feature = "_UNEXPECTED_VALUE");
131131`high-registers`
132132`high-word`
133133`hvx`
134`hvx-ieee-fp`
134135`hvx-length128b`
136`hvx-length64b`
137`hvx-qfloat`
138`hvxv60`
139`hvxv62`
140`hvxv65`
141`hvxv66`
142`hvxv67`
143`hvxv68`
144`hvxv69`
145`hvxv71`
146`hvxv73`
147`hvxv75`
148`hvxv79`
135149`hwdiv`
136150`i8mm`
137151`isa-68000`
......@@ -431,6 +445,7 @@ LL | cfg!(target_feature = "_UNEXPECTED_VALUE");
431445`zksed`
432446`zksh`
433447`zkt`
448`zreg`
434449`ztso`
435450`zvbb`
436451`zvbc`