From 00feedcb312228532460cd8f197b518ec74a8911 Mon Sep 17 00:00:00 2001 From: Tom Vijlbrief Date: Fri, 13 Jun 2025 10:49:00 +0200 Subject: [PATCH 001/139] Add modern AVR mcus like avr128db28 and attiny3224 --- compiler/rustc_target/src/spec/base/avr.rs | 46 ++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/compiler/rustc_target/src/spec/base/avr.rs b/compiler/rustc_target/src/spec/base/avr.rs index 85b73e61e52c..d2e4453d9570 100644 --- a/compiler/rustc_target/src/spec/base/avr.rs +++ b/compiler/rustc_target/src/spec/base/avr.rs @@ -322,6 +322,9 @@ pub fn ef_avr_arch(target_cpu: &str) -> u32 { "attiny1624" => elf::EF_AVR_ARCH_XMEGA3, "attiny1626" => elf::EF_AVR_ARCH_XMEGA3, "attiny1627" => elf::EF_AVR_ARCH_XMEGA3, + "attiny3224" => elf::EF_AVR_ARCH_XMEGA3, + "attiny3226" => elf::EF_AVR_ARCH_XMEGA3, + "attiny3227" => elf::EF_AVR_ARCH_XMEGA3, "atmega808" => elf::EF_AVR_ARCH_XMEGA3, "atmega809" => elf::EF_AVR_ARCH_XMEGA3, "atmega1608" => elf::EF_AVR_ARCH_XMEGA3, @@ -331,6 +334,49 @@ pub fn ef_avr_arch(target_cpu: &str) -> u32 { "atmega4808" => elf::EF_AVR_ARCH_XMEGA3, "atmega4809" => elf::EF_AVR_ARCH_XMEGA3, + "avr16dd20" => elf::EF_AVR_ARCH_XMEGA3, + "avr16dd28" => elf::EF_AVR_ARCH_XMEGA3, + "avr16dd32" => elf::EF_AVR_ARCH_XMEGA3, + "avr16du14" => elf::EF_AVR_ARCH_XMEGA3, + "avr16du20" => elf::EF_AVR_ARCH_XMEGA3, + "avr16du28" => elf::EF_AVR_ARCH_XMEGA3, + "avr16du32" => elf::EF_AVR_ARCH_XMEGA3, + "avr32da28" => elf::EF_AVR_ARCH_XMEGA3, + "avr32da32" => elf::EF_AVR_ARCH_XMEGA3, + "avr32da48" => elf::EF_AVR_ARCH_XMEGA3, + "avr32db28" => elf::EF_AVR_ARCH_XMEGA3, + "avr32db32" => elf::EF_AVR_ARCH_XMEGA3, + "avr32db48" => elf::EF_AVR_ARCH_XMEGA3, + "avr32dd14" => elf::EF_AVR_ARCH_XMEGA3, + "avr32dd20" => elf::EF_AVR_ARCH_XMEGA3, + "avr32dd28" => elf::EF_AVR_ARCH_XMEGA3, + "avr32dd32" => elf::EF_AVR_ARCH_XMEGA3, + "avr32du14" => elf::EF_AVR_ARCH_XMEGA3, + "avr32du20" => elf::EF_AVR_ARCH_XMEGA3, + "avr32du28" => elf::EF_AVR_ARCH_XMEGA3, + "avr32du32" => elf::EF_AVR_ARCH_XMEGA3, + "avr16eb14" => elf::EF_AVR_ARCH_XMEGA3, + "avr16eb20" => elf::EF_AVR_ARCH_XMEGA3, + "avr16eb28" => elf::EF_AVR_ARCH_XMEGA3, + "avr16eb32" => elf::EF_AVR_ARCH_XMEGA3, + "avr16ea28" => elf::EF_AVR_ARCH_XMEGA3, + "avr16ea32" => elf::EF_AVR_ARCH_XMEGA3, + "avr16ea48" => elf::EF_AVR_ARCH_XMEGA3, + "avr32ea28" => elf::EF_AVR_ARCH_XMEGA3, + "avr32ea32" => elf::EF_AVR_ARCH_XMEGA3, + "avr32ea48" => elf::EF_AVR_ARCH_XMEGA3, + "avr32sd20" => elf::EF_AVR_ARCH_XMEGA3, + "avr32sd28" => elf::EF_AVR_ARCH_XMEGA3, + "avr32sd32" => elf::EF_AVR_ARCH_XMEGA3, + "avr128da28" => elf::EF_AVR_ARCH_XMEGA4, + "avr128da32" => elf::EF_AVR_ARCH_XMEGA4, + "avr128da48" => elf::EF_AVR_ARCH_XMEGA4, + "avr128da64" => elf::EF_AVR_ARCH_XMEGA4, + "avr128db28" => elf::EF_AVR_ARCH_XMEGA4, + "avr128db32" => elf::EF_AVR_ARCH_XMEGA4, + "avr128db48" => elf::EF_AVR_ARCH_XMEGA4, + "avr128db64" => elf::EF_AVR_ARCH_XMEGA4, + // Unknown target CPU => Unspecified/generic code _ => 0, } From 1323fd6f73ffbd427bcb81e9766f68eccf1f531e Mon Sep 17 00:00:00 2001 From: Tom Vijlbrief Date: Fri, 13 Jun 2025 16:03:57 +0200 Subject: [PATCH 002/139] Add missing avr64* series --- compiler/rustc_target/src/spec/base/avr.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/compiler/rustc_target/src/spec/base/avr.rs b/compiler/rustc_target/src/spec/base/avr.rs index d2e4453d9570..fb3ebb509ad7 100644 --- a/compiler/rustc_target/src/spec/base/avr.rs +++ b/compiler/rustc_target/src/spec/base/avr.rs @@ -334,6 +334,27 @@ pub fn ef_avr_arch(target_cpu: &str) -> u32 { "atmega4808" => elf::EF_AVR_ARCH_XMEGA3, "atmega4809" => elf::EF_AVR_ARCH_XMEGA3, + "avr64da28" => elf::EF_AVR_ARCH_XMEGA2, + "avr64da32" => elf::EF_AVR_ARCH_XMEGA2, + "avr64da48" => elf::EF_AVR_ARCH_XMEGA2, + "avr64da64" => elf::EF_AVR_ARCH_XMEGA2, + "avr64db28" => elf::EF_AVR_ARCH_XMEGA2, + "avr64db32" => elf::EF_AVR_ARCH_XMEGA2, + "avr64db48" => elf::EF_AVR_ARCH_XMEGA2, + "avr64db64" => elf::EF_AVR_ARCH_XMEGA2, + "avr64dd14" => elf::EF_AVR_ARCH_XMEGA2, + "avr64dd20" => elf::EF_AVR_ARCH_XMEGA2, + "avr64dd28" => elf::EF_AVR_ARCH_XMEGA2, + "avr64dd32" => elf::EF_AVR_ARCH_XMEGA2, + "avr64du28" => elf::EF_AVR_ARCH_XMEGA2, + "avr64du32" => elf::EF_AVR_ARCH_XMEGA2, + "avr64ea28" => elf::EF_AVR_ARCH_XMEGA2, + "avr64ea32" => elf::EF_AVR_ARCH_XMEGA2, + "avr64ea48" => elf::EF_AVR_ARCH_XMEGA2, + "avr64sd28" => elf::EF_AVR_ARCH_XMEGA2, + "avr64sd32" => elf::EF_AVR_ARCH_XMEGA2, + "avr64sd48" => elf::EF_AVR_ARCH_XMEGA2, + "avr16dd20" => elf::EF_AVR_ARCH_XMEGA3, "avr16dd28" => elf::EF_AVR_ARCH_XMEGA3, "avr16dd32" => elf::EF_AVR_ARCH_XMEGA3, From 02dac5cd78ff36663facc7863e6b4ed4b8df92b2 Mon Sep 17 00:00:00 2001 From: xizheyin Date: Tue, 17 Jun 2025 23:42:57 +0800 Subject: [PATCH 003/139] add test suggest-clone-in-macro-issue-139253.rs Signed-off-by: xizheyin --- .../suggest-clone-in-macro-issue-139253.rs | 19 +++++++++ ...suggest-clone-in-macro-issue-139253.stderr | 41 +++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 tests/ui/typeck/suggestions/suggest-clone-in-macro-issue-139253.rs create mode 100644 tests/ui/typeck/suggestions/suggest-clone-in-macro-issue-139253.stderr diff --git a/tests/ui/typeck/suggestions/suggest-clone-in-macro-issue-139253.rs b/tests/ui/typeck/suggestions/suggest-clone-in-macro-issue-139253.rs new file mode 100644 index 000000000000..3b3ea0586304 --- /dev/null +++ b/tests/ui/typeck/suggestions/suggest-clone-in-macro-issue-139253.rs @@ -0,0 +1,19 @@ +#[derive(Debug, Clone)] +struct Struct { field: S } + +#[derive(Debug, Clone)] +struct S; + +macro_rules! expand { + ($ident:ident) => { Struct { $ident } } +} + +fn test1() { + let field = &S; + let a: Struct = dbg!(expand!(field)); //~ ERROR mismatched types [E0308] + let b: Struct = dbg!(Struct { field }); //~ ERROR mismatched types [E0308] + let c: S = dbg!(field); //~ ERROR mismatched types [E0308] + let c: S = dbg!(dbg!(field)); //~ ERROR mismatched types [E0308] +} + +fn main() {} diff --git a/tests/ui/typeck/suggestions/suggest-clone-in-macro-issue-139253.stderr b/tests/ui/typeck/suggestions/suggest-clone-in-macro-issue-139253.stderr new file mode 100644 index 000000000000..e615cecb3654 --- /dev/null +++ b/tests/ui/typeck/suggestions/suggest-clone-in-macro-issue-139253.stderr @@ -0,0 +1,41 @@ +error[E0308]: mismatched types + --> $DIR/suggest-clone-in-macro-issue-139253.rs:13:34 + | +LL | let a: Struct = dbg!(expand!(field)); + | ^^^^^ expected `S`, found `&S` + | +help: consider using clone here + | +LL | let a: Struct = dbg!(expand!(field: field.clone())); + | +++++++++++++++ + +error[E0308]: mismatched types + --> $DIR/suggest-clone-in-macro-issue-139253.rs:14:35 + | +LL | let b: Struct = dbg!(Struct { field }); + | ^^^^^ expected `S`, found `&S` + | +help: consider using clone here + | +LL | let b: Struct = dbg!(Struct { field: field.clone() }); + | +++++++++++++++ + +error[E0308]: mismatched types + --> $DIR/suggest-clone-in-macro-issue-139253.rs:15:16 + | +LL | let c: S = dbg!(field); + | ^^^^^^^^^^^ expected `S`, found `&S` + | + = note: this error originates in the macro `dbg` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0308]: mismatched types + --> $DIR/suggest-clone-in-macro-issue-139253.rs:16:16 + | +LL | let c: S = dbg!(dbg!(field)); + | ^^^^^^^^^^^^^^^^^ expected `S`, found `&S` + | + = note: this error originates in the macro `dbg` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0308`. From fd9c1b962ae29ff928c2c6310a227b56b9db19bd Mon Sep 17 00:00:00 2001 From: xizheyin Date: Tue, 17 Jun 2025 23:48:03 +0800 Subject: [PATCH 004/139] Find correct span when suggesting using clone Signed-off-by: xizheyin --- compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs | 4 +++- .../suggest-clone-in-macro-issue-139253.stderr | 8 ++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs b/compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs index 7e5f1d97a8bf..1154cc26c59a 100644 --- a/compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs +++ b/compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs @@ -1302,8 +1302,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { None => ".clone()".to_string(), }; + let span = expr.span.find_oldest_ancestor_in_same_ctxt().shrink_to_hi(); + diag.span_suggestion_verbose( - expr.span.shrink_to_hi(), + span, "consider using clone here", suggestion, Applicability::MachineApplicable, diff --git a/tests/ui/typeck/suggestions/suggest-clone-in-macro-issue-139253.stderr b/tests/ui/typeck/suggestions/suggest-clone-in-macro-issue-139253.stderr index e615cecb3654..59e56f672374 100644 --- a/tests/ui/typeck/suggestions/suggest-clone-in-macro-issue-139253.stderr +++ b/tests/ui/typeck/suggestions/suggest-clone-in-macro-issue-139253.stderr @@ -27,6 +27,10 @@ LL | let c: S = dbg!(field); | ^^^^^^^^^^^ expected `S`, found `&S` | = note: this error originates in the macro `dbg` (in Nightly builds, run with -Z macro-backtrace for more info) +help: consider using clone here + | +LL | let c: S = dbg!(field).clone(); + | ++++++++ error[E0308]: mismatched types --> $DIR/suggest-clone-in-macro-issue-139253.rs:16:16 @@ -35,6 +39,10 @@ LL | let c: S = dbg!(dbg!(field)); | ^^^^^^^^^^^^^^^^^ expected `S`, found `&S` | = note: this error originates in the macro `dbg` (in Nightly builds, run with -Z macro-backtrace for more info) +help: consider using clone here + | +LL | let c: S = dbg!(dbg!(field)).clone(); + | ++++++++ error: aborting due to 4 previous errors From d63e865a958a4e75e20b9b043c22b70094b9f0e1 Mon Sep 17 00:00:00 2001 From: WANG Rui Date: Sat, 28 Jun 2025 11:16:39 +0800 Subject: [PATCH 005/139] loongarch: Add basic support for LoongArch32 --- .../crates/core_arch/src/core_arch_docs.md | 2 + .../crates/core_arch/src/loongarch32/mod.rs | 47 ++++ .../crates/core_arch/src/loongarch64/mod.rs | 239 +---------------- .../core_arch/src/loongarch_shared/mod.rs | 244 ++++++++++++++++++ library/stdarch/crates/core_arch/src/mod.rs | 21 +- .../stdarch/crates/simd-test-macro/src/lib.rs | 2 +- library/stdarch/crates/std_detect/README.md | 2 +- .../std_detect/src/detect/arch/loongarch.rs | 2 +- .../crates/std_detect/src/detect/arch/mod.rs | 2 +- .../crates/std_detect/src/detect/mod.rs | 1 + .../std_detect/src/detect/os/linux/auxvec.rs | 2 + .../std_detect/src/detect/os/linux/mod.rs | 2 +- .../std_detect/tests/macro_trailing_commas.rs | 8 +- 13 files changed, 327 insertions(+), 247 deletions(-) create mode 100644 library/stdarch/crates/core_arch/src/loongarch32/mod.rs create mode 100644 library/stdarch/crates/core_arch/src/loongarch_shared/mod.rs diff --git a/library/stdarch/crates/core_arch/src/core_arch_docs.md b/library/stdarch/crates/core_arch/src/core_arch_docs.md index bfa1b7228860..6aea2b461846 100644 --- a/library/stdarch/crates/core_arch/src/core_arch_docs.md +++ b/library/stdarch/crates/core_arch/src/core_arch_docs.md @@ -193,6 +193,7 @@ others at: * [`powerpc64`] * [`nvptx`] * [`wasm32`] +* [`loongarch32`] * [`loongarch64`] * [`s390x`] @@ -208,6 +209,7 @@ others at: [`powerpc64`]: ../../core/arch/powerpc64/index.html [`nvptx`]: ../../core/arch/nvptx/index.html [`wasm32`]: ../../core/arch/wasm32/index.html +[`loongarch32`]: ../../core/arch/loongarch32/index.html [`loongarch64`]: ../../core/arch/loongarch64/index.html [`s390x`]: ../../core/arch/s390x/index.html diff --git a/library/stdarch/crates/core_arch/src/loongarch32/mod.rs b/library/stdarch/crates/core_arch/src/loongarch32/mod.rs new file mode 100644 index 000000000000..fb05450373c2 --- /dev/null +++ b/library/stdarch/crates/core_arch/src/loongarch32/mod.rs @@ -0,0 +1,47 @@ +//! `LoongArch32` intrinsics + +use crate::arch::asm; + +#[allow(improper_ctypes)] +unsafe extern "unadjusted" { + #[link_name = "llvm.loongarch.cacop.w"] + fn __cacop(a: i32, b: i32, c: i32); + #[link_name = "llvm.loongarch.csrrd.w"] + fn __csrrd(a: i32) -> i32; + #[link_name = "llvm.loongarch.csrwr.w"] + fn __csrwr(a: i32, b: i32) -> i32; + #[link_name = "llvm.loongarch.csrxchg.w"] + fn __csrxchg(a: i32, b: i32, c: i32) -> i32; +} + +/// Generates the cache operation instruction +#[inline] +#[unstable(feature = "stdarch_loongarch", issue = "117427")] +pub unsafe fn cacop(a: i32, b: i32) { + static_assert_simm_bits!(IMM12, 12); + __cacop(a, b, IMM12); +} + +/// Reads the CSR +#[inline] +#[unstable(feature = "stdarch_loongarch", issue = "117427")] +pub unsafe fn csrrd() -> i32 { + static_assert_uimm_bits!(IMM14, 14); + __csrrd(IMM14) +} + +/// Writes the CSR +#[inline] +#[unstable(feature = "stdarch_loongarch", issue = "117427")] +pub unsafe fn csrwr(a: i32) -> i32 { + static_assert_uimm_bits!(IMM14, 14); + __csrwr(a, IMM14) +} + +/// Exchanges the CSR +#[inline] +#[unstable(feature = "stdarch_loongarch", issue = "117427")] +pub unsafe fn csrxchg(a: i32, b: i32) -> i32 { + static_assert_uimm_bits!(IMM14, 14); + __csrxchg(a, b, IMM14) +} diff --git a/library/stdarch/crates/core_arch/src/loongarch64/mod.rs b/library/stdarch/crates/core_arch/src/loongarch64/mod.rs index b1704bbb48d4..3f1bfbcd0e1e 100644 --- a/library/stdarch/crates/core_arch/src/loongarch64/mod.rs +++ b/library/stdarch/crates/core_arch/src/loongarch64/mod.rs @@ -1,4 +1,4 @@ -//! `LoongArch` intrinsics +//! `LoongArch64` intrinsics mod lasx; mod lsx; @@ -20,82 +20,24 @@ pub unsafe fn rdtime_d() -> (i64, isize) { (val, tid) } -/// Reads the lower 32-bit stable counter value and the counter ID -#[inline] -#[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn rdtimel_w() -> (i32, isize) { - let val: i32; - let tid: isize; - asm!("rdtimel.w {}, {}", out(reg) val, out(reg) tid, options(readonly, nostack)); - (val, tid) -} - -/// Reads the upper 32-bit stable counter value and the counter ID -#[inline] -#[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn rdtimeh_w() -> (i32, isize) { - let val: i32; - let tid: isize; - asm!("rdtimeh.w {}, {}", out(reg) val, out(reg) tid, options(readonly, nostack)); - (val, tid) -} - #[allow(improper_ctypes)] unsafe extern "unadjusted" { - #[link_name = "llvm.loongarch.crc.w.b.w"] - fn __crc_w_b_w(a: i32, b: i32) -> i32; - #[link_name = "llvm.loongarch.crc.w.h.w"] - fn __crc_w_h_w(a: i32, b: i32) -> i32; - #[link_name = "llvm.loongarch.crc.w.w.w"] - fn __crc_w_w_w(a: i32, b: i32) -> i32; #[link_name = "llvm.loongarch.crc.w.d.w"] fn __crc_w_d_w(a: i64, b: i32) -> i32; - #[link_name = "llvm.loongarch.crcc.w.b.w"] - fn __crcc_w_b_w(a: i32, b: i32) -> i32; - #[link_name = "llvm.loongarch.crcc.w.h.w"] - fn __crcc_w_h_w(a: i32, b: i32) -> i32; - #[link_name = "llvm.loongarch.crcc.w.w.w"] - fn __crcc_w_w_w(a: i32, b: i32) -> i32; #[link_name = "llvm.loongarch.crcc.w.d.w"] fn __crcc_w_d_w(a: i64, b: i32) -> i32; #[link_name = "llvm.loongarch.cacop.d"] fn __cacop(a: i64, b: i64, c: i64); - #[link_name = "llvm.loongarch.dbar"] - fn __dbar(a: i32); - #[link_name = "llvm.loongarch.ibar"] - fn __ibar(a: i32); - #[link_name = "llvm.loongarch.movgr2fcsr"] - fn __movgr2fcsr(a: i32, b: i32); - #[link_name = "llvm.loongarch.movfcsr2gr"] - fn __movfcsr2gr(a: i32) -> i32; #[link_name = "llvm.loongarch.csrrd.d"] fn __csrrd(a: i32) -> i64; #[link_name = "llvm.loongarch.csrwr.d"] fn __csrwr(a: i64, b: i32) -> i64; #[link_name = "llvm.loongarch.csrxchg.d"] fn __csrxchg(a: i64, b: i64, c: i32) -> i64; - #[link_name = "llvm.loongarch.iocsrrd.b"] - fn __iocsrrd_b(a: i32) -> i32; - #[link_name = "llvm.loongarch.iocsrrd.h"] - fn __iocsrrd_h(a: i32) -> i32; - #[link_name = "llvm.loongarch.iocsrrd.w"] - fn __iocsrrd_w(a: i32) -> i32; #[link_name = "llvm.loongarch.iocsrrd.d"] fn __iocsrrd_d(a: i32) -> i64; - #[link_name = "llvm.loongarch.iocsrwr.b"] - fn __iocsrwr_b(a: i32, b: i32); - #[link_name = "llvm.loongarch.iocsrwr.h"] - fn __iocsrwr_h(a: i32, b: i32); - #[link_name = "llvm.loongarch.iocsrwr.w"] - fn __iocsrwr_w(a: i32, b: i32); #[link_name = "llvm.loongarch.iocsrwr.d"] fn __iocsrwr_d(a: i64, b: i32); - #[link_name = "llvm.loongarch.break"] - fn __break(a: i32); - #[link_name = "llvm.loongarch.cpucfg"] - fn __cpucfg(a: i32) -> i32; - #[link_name = "llvm.loongarch.syscall"] - fn __syscall(a: i32); #[link_name = "llvm.loongarch.asrtle.d"] fn __asrtle(a: i64, b: i64); #[link_name = "llvm.loongarch.asrtgt.d"] @@ -104,35 +46,6 @@ unsafe extern "unadjusted" { fn __lddir(a: i64, b: i64) -> i64; #[link_name = "llvm.loongarch.ldpte.d"] fn __ldpte(a: i64, b: i64); - #[link_name = "llvm.loongarch.frecipe.s"] - fn __frecipe_s(a: f32) -> f32; - #[link_name = "llvm.loongarch.frecipe.d"] - fn __frecipe_d(a: f64) -> f64; - #[link_name = "llvm.loongarch.frsqrte.s"] - fn __frsqrte_s(a: f32) -> f32; - #[link_name = "llvm.loongarch.frsqrte.d"] - fn __frsqrte_d(a: f64) -> f64; -} - -/// Calculate the CRC value using the IEEE 802.3 polynomial (0xEDB88320) -#[inline] -#[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn crc_w_b_w(a: i32, b: i32) -> i32 { - __crc_w_b_w(a, b) -} - -/// Calculate the CRC value using the IEEE 802.3 polynomial (0xEDB88320) -#[inline] -#[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn crc_w_h_w(a: i32, b: i32) -> i32 { - __crc_w_h_w(a, b) -} - -/// Calculate the CRC value using the IEEE 802.3 polynomial (0xEDB88320) -#[inline] -#[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn crc_w_w_w(a: i32, b: i32) -> i32 { - __crc_w_w_w(a, b) } /// Calculate the CRC value using the IEEE 802.3 polynomial (0xEDB88320) @@ -142,27 +55,6 @@ pub unsafe fn crc_w_d_w(a: i64, b: i32) -> i32 { __crc_w_d_w(a, b) } -/// Calculate the CRC value using the Castagnoli polynomial (0x82F63B78) -#[inline] -#[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn crcc_w_b_w(a: i32, b: i32) -> i32 { - __crcc_w_b_w(a, b) -} - -/// Calculate the CRC value using the Castagnoli polynomial (0x82F63B78) -#[inline] -#[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn crcc_w_h_w(a: i32, b: i32) -> i32 { - __crcc_w_h_w(a, b) -} - -/// Calculate the CRC value using the Castagnoli polynomial (0x82F63B78) -#[inline] -#[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn crcc_w_w_w(a: i32, b: i32) -> i32 { - __crcc_w_w_w(a, b) -} - /// Calculate the CRC value using the Castagnoli polynomial (0x82F63B78) #[inline] #[unstable(feature = "stdarch_loongarch", issue = "117427")] @@ -178,38 +70,6 @@ pub unsafe fn cacop(a: i64, b: i64) { __cacop(a, b, IMM12); } -/// Generates the memory barrier instruction -#[inline] -#[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn dbar() { - static_assert_uimm_bits!(IMM15, 15); - __dbar(IMM15); -} - -/// Generates the instruction-fetch barrier instruction -#[inline] -#[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn ibar() { - static_assert_uimm_bits!(IMM15, 15); - __ibar(IMM15); -} - -/// Moves data from a GPR to the FCSR -#[inline] -#[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn movgr2fcsr(a: i32) { - static_assert_uimm_bits!(IMM5, 5); - __movgr2fcsr(IMM5, a); -} - -/// Moves data from a FCSR to the GPR -#[inline] -#[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn movfcsr2gr() -> i32 { - static_assert_uimm_bits!(IMM5, 5); - __movfcsr2gr(IMM5) -} - /// Reads the CSR #[inline] #[unstable(feature = "stdarch_loongarch", issue = "117427")] @@ -234,27 +94,6 @@ pub unsafe fn csrxchg(a: i64, b: i64) -> i64 { __csrxchg(a, b, IMM14) } -/// Reads the 8-bit IO-CSR -#[inline] -#[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn iocsrrd_b(a: i32) -> i32 { - __iocsrrd_b(a) -} - -/// Reads the 16-bit IO-CSR -#[inline] -#[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn iocsrrd_h(a: i32) -> i32 { - __iocsrrd_h(a) -} - -/// Reads the 32-bit IO-CSR -#[inline] -#[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn iocsrrd_w(a: i32) -> i32 { - __iocsrrd_w(a) -} - /// Reads the 64-bit IO-CSR #[inline] #[unstable(feature = "stdarch_loongarch", issue = "117427")] @@ -262,27 +101,6 @@ pub unsafe fn iocsrrd_d(a: i32) -> i64 { __iocsrrd_d(a) } -/// Writes the 8-bit IO-CSR -#[inline] -#[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn iocsrwr_b(a: i32, b: i32) { - __iocsrwr_b(a, b) -} - -/// Writes the 16-bit IO-CSR -#[inline] -#[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn iocsrwr_h(a: i32, b: i32) { - __iocsrwr_h(a, b) -} - -/// Writes the 32-bit IO-CSR -#[inline] -#[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn iocsrwr_w(a: i32, b: i32) { - __iocsrwr_w(a, b) -} - /// Writes the 64-bit IO-CSR #[inline] #[unstable(feature = "stdarch_loongarch", issue = "117427")] @@ -290,29 +108,6 @@ pub unsafe fn iocsrwr_d(a: i64, b: i32) { __iocsrwr_d(a, b) } -/// Generates the breakpoint instruction -#[inline] -#[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn brk() { - static_assert_uimm_bits!(IMM15, 15); - __break(IMM15); -} - -/// Reads the CPU configuration register -#[inline] -#[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn cpucfg(a: i32) -> i32 { - __cpucfg(a) -} - -/// Generates the syscall instruction -#[inline] -#[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn syscall() { - static_assert_uimm_bits!(IMM15, 15); - __syscall(IMM15); -} - /// Generates the less-than-or-equal asseration instruction #[inline] #[unstable(feature = "stdarch_loongarch", issue = "117427")] @@ -342,35 +137,3 @@ pub unsafe fn lddir(a: i64) -> i64 { pub unsafe fn ldpte(a: i64) { __ldpte(a, B) } - -/// Calculate the approximate single-precision result of 1.0 divided -#[inline] -#[target_feature(enable = "frecipe")] -#[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn frecipe_s(a: f32) -> f32 { - __frecipe_s(a) -} - -/// Calculate the approximate double-precision result of 1.0 divided -#[inline] -#[target_feature(enable = "frecipe")] -#[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn frecipe_d(a: f64) -> f64 { - __frecipe_d(a) -} - -/// Calculate the approximate single-precision result of dividing 1.0 by the square root -#[inline] -#[target_feature(enable = "frecipe")] -#[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn frsqrte_s(a: f32) -> f32 { - __frsqrte_s(a) -} - -/// Calculate the approximate double-precision result of dividing 1.0 by the square root -#[inline] -#[target_feature(enable = "frecipe")] -#[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn frsqrte_d(a: f64) -> f64 { - __frsqrte_d(a) -} diff --git a/library/stdarch/crates/core_arch/src/loongarch_shared/mod.rs b/library/stdarch/crates/core_arch/src/loongarch_shared/mod.rs new file mode 100644 index 000000000000..da716ffd279e --- /dev/null +++ b/library/stdarch/crates/core_arch/src/loongarch_shared/mod.rs @@ -0,0 +1,244 @@ +//! `Shared LoongArch` intrinsics + +use crate::arch::asm; + +/// Reads the lower 32-bit stable counter value and the counter ID +#[inline] +#[unstable(feature = "stdarch_loongarch", issue = "117427")] +pub unsafe fn rdtimel_w() -> (i32, isize) { + let val: i32; + let tid: isize; + asm!("rdtimel.w {}, {}", out(reg) val, out(reg) tid, options(readonly, nostack)); + (val, tid) +} + +/// Reads the upper 32-bit stable counter value and the counter ID +#[inline] +#[unstable(feature = "stdarch_loongarch", issue = "117427")] +pub unsafe fn rdtimeh_w() -> (i32, isize) { + let val: i32; + let tid: isize; + asm!("rdtimeh.w {}, {}", out(reg) val, out(reg) tid, options(readonly, nostack)); + (val, tid) +} + +#[allow(improper_ctypes)] +unsafe extern "unadjusted" { + #[link_name = "llvm.loongarch.crc.w.b.w"] + fn __crc_w_b_w(a: i32, b: i32) -> i32; + #[link_name = "llvm.loongarch.crc.w.h.w"] + fn __crc_w_h_w(a: i32, b: i32) -> i32; + #[link_name = "llvm.loongarch.crc.w.w.w"] + fn __crc_w_w_w(a: i32, b: i32) -> i32; + #[link_name = "llvm.loongarch.crcc.w.b.w"] + fn __crcc_w_b_w(a: i32, b: i32) -> i32; + #[link_name = "llvm.loongarch.crcc.w.h.w"] + fn __crcc_w_h_w(a: i32, b: i32) -> i32; + #[link_name = "llvm.loongarch.crcc.w.w.w"] + fn __crcc_w_w_w(a: i32, b: i32) -> i32; + #[link_name = "llvm.loongarch.dbar"] + fn __dbar(a: i32); + #[link_name = "llvm.loongarch.ibar"] + fn __ibar(a: i32); + #[link_name = "llvm.loongarch.movgr2fcsr"] + fn __movgr2fcsr(a: i32, b: i32); + #[link_name = "llvm.loongarch.movfcsr2gr"] + fn __movfcsr2gr(a: i32) -> i32; + #[link_name = "llvm.loongarch.iocsrrd.b"] + fn __iocsrrd_b(a: i32) -> i32; + #[link_name = "llvm.loongarch.iocsrrd.h"] + fn __iocsrrd_h(a: i32) -> i32; + #[link_name = "llvm.loongarch.iocsrrd.w"] + fn __iocsrrd_w(a: i32) -> i32; + #[link_name = "llvm.loongarch.iocsrwr.b"] + fn __iocsrwr_b(a: i32, b: i32); + #[link_name = "llvm.loongarch.iocsrwr.h"] + fn __iocsrwr_h(a: i32, b: i32); + #[link_name = "llvm.loongarch.iocsrwr.w"] + fn __iocsrwr_w(a: i32, b: i32); + #[link_name = "llvm.loongarch.break"] + fn __break(a: i32); + #[link_name = "llvm.loongarch.cpucfg"] + fn __cpucfg(a: i32) -> i32; + #[link_name = "llvm.loongarch.syscall"] + fn __syscall(a: i32); + #[link_name = "llvm.loongarch.frecipe.s"] + fn __frecipe_s(a: f32) -> f32; + #[link_name = "llvm.loongarch.frecipe.d"] + fn __frecipe_d(a: f64) -> f64; + #[link_name = "llvm.loongarch.frsqrte.s"] + fn __frsqrte_s(a: f32) -> f32; + #[link_name = "llvm.loongarch.frsqrte.d"] + fn __frsqrte_d(a: f64) -> f64; +} + +/// Calculate the CRC value using the IEEE 802.3 polynomial (0xEDB88320) +#[inline] +#[unstable(feature = "stdarch_loongarch", issue = "117427")] +pub unsafe fn crc_w_b_w(a: i32, b: i32) -> i32 { + __crc_w_b_w(a, b) +} + +/// Calculate the CRC value using the IEEE 802.3 polynomial (0xEDB88320) +#[inline] +#[unstable(feature = "stdarch_loongarch", issue = "117427")] +pub unsafe fn crc_w_h_w(a: i32, b: i32) -> i32 { + __crc_w_h_w(a, b) +} + +/// Calculate the CRC value using the IEEE 802.3 polynomial (0xEDB88320) +#[inline] +#[unstable(feature = "stdarch_loongarch", issue = "117427")] +pub unsafe fn crc_w_w_w(a: i32, b: i32) -> i32 { + __crc_w_w_w(a, b) +} + +/// Calculate the CRC value using the Castagnoli polynomial (0x82F63B78) +#[inline] +#[unstable(feature = "stdarch_loongarch", issue = "117427")] +pub unsafe fn crcc_w_b_w(a: i32, b: i32) -> i32 { + __crcc_w_b_w(a, b) +} + +/// Calculate the CRC value using the Castagnoli polynomial (0x82F63B78) +#[inline] +#[unstable(feature = "stdarch_loongarch", issue = "117427")] +pub unsafe fn crcc_w_h_w(a: i32, b: i32) -> i32 { + __crcc_w_h_w(a, b) +} + +/// Calculate the CRC value using the Castagnoli polynomial (0x82F63B78) +#[inline] +#[unstable(feature = "stdarch_loongarch", issue = "117427")] +pub unsafe fn crcc_w_w_w(a: i32, b: i32) -> i32 { + __crcc_w_w_w(a, b) +} + +/// Generates the memory barrier instruction +#[inline] +#[unstable(feature = "stdarch_loongarch", issue = "117427")] +pub unsafe fn dbar() { + static_assert_uimm_bits!(IMM15, 15); + __dbar(IMM15); +} + +/// Generates the instruction-fetch barrier instruction +#[inline] +#[unstable(feature = "stdarch_loongarch", issue = "117427")] +pub unsafe fn ibar() { + static_assert_uimm_bits!(IMM15, 15); + __ibar(IMM15); +} + +/// Moves data from a GPR to the FCSR +#[inline] +#[unstable(feature = "stdarch_loongarch", issue = "117427")] +pub unsafe fn movgr2fcsr(a: i32) { + static_assert_uimm_bits!(IMM5, 5); + __movgr2fcsr(IMM5, a); +} + +/// Moves data from a FCSR to the GPR +#[inline] +#[unstable(feature = "stdarch_loongarch", issue = "117427")] +pub unsafe fn movfcsr2gr() -> i32 { + static_assert_uimm_bits!(IMM5, 5); + __movfcsr2gr(IMM5) +} + +/// Reads the 8-bit IO-CSR +#[inline] +#[unstable(feature = "stdarch_loongarch", issue = "117427")] +pub unsafe fn iocsrrd_b(a: i32) -> i32 { + __iocsrrd_b(a) +} + +/// Reads the 16-bit IO-CSR +#[inline] +#[unstable(feature = "stdarch_loongarch", issue = "117427")] +pub unsafe fn iocsrrd_h(a: i32) -> i32 { + __iocsrrd_h(a) +} + +/// Reads the 32-bit IO-CSR +#[inline] +#[unstable(feature = "stdarch_loongarch", issue = "117427")] +pub unsafe fn iocsrrd_w(a: i32) -> i32 { + __iocsrrd_w(a) +} + +/// Writes the 8-bit IO-CSR +#[inline] +#[unstable(feature = "stdarch_loongarch", issue = "117427")] +pub unsafe fn iocsrwr_b(a: i32, b: i32) { + __iocsrwr_b(a, b) +} + +/// Writes the 16-bit IO-CSR +#[inline] +#[unstable(feature = "stdarch_loongarch", issue = "117427")] +pub unsafe fn iocsrwr_h(a: i32, b: i32) { + __iocsrwr_h(a, b) +} + +/// Writes the 32-bit IO-CSR +#[inline] +#[unstable(feature = "stdarch_loongarch", issue = "117427")] +pub unsafe fn iocsrwr_w(a: i32, b: i32) { + __iocsrwr_w(a, b) +} + +/// Generates the breakpoint instruction +#[inline] +#[unstable(feature = "stdarch_loongarch", issue = "117427")] +pub unsafe fn brk() { + static_assert_uimm_bits!(IMM15, 15); + __break(IMM15); +} + +/// Reads the CPU configuration register +#[inline] +#[unstable(feature = "stdarch_loongarch", issue = "117427")] +pub unsafe fn cpucfg(a: i32) -> i32 { + __cpucfg(a) +} + +/// Generates the syscall instruction +#[inline] +#[unstable(feature = "stdarch_loongarch", issue = "117427")] +pub unsafe fn syscall() { + static_assert_uimm_bits!(IMM15, 15); + __syscall(IMM15); +} + +/// Calculate the approximate single-precision result of 1.0 divided +#[inline] +#[target_feature(enable = "frecipe")] +#[unstable(feature = "stdarch_loongarch", issue = "117427")] +pub unsafe fn frecipe_s(a: f32) -> f32 { + __frecipe_s(a) +} + +/// Calculate the approximate double-precision result of 1.0 divided +#[inline] +#[target_feature(enable = "frecipe")] +#[unstable(feature = "stdarch_loongarch", issue = "117427")] +pub unsafe fn frecipe_d(a: f64) -> f64 { + __frecipe_d(a) +} + +/// Calculate the approximate single-precision result of dividing 1.0 by the square root +#[inline] +#[target_feature(enable = "frecipe")] +#[unstable(feature = "stdarch_loongarch", issue = "117427")] +pub unsafe fn frsqrte_s(a: f32) -> f32 { + __frsqrte_s(a) +} + +/// Calculate the approximate double-precision result of dividing 1.0 by the square root +#[inline] +#[target_feature(enable = "frecipe")] +#[unstable(feature = "stdarch_loongarch", issue = "117427")] +pub unsafe fn frsqrte_d(a: f64) -> f64 { + __frsqrte_d(a) +} diff --git a/library/stdarch/crates/core_arch/src/mod.rs b/library/stdarch/crates/core_arch/src/mod.rs index f6e959efd47c..2105cca1b438 100644 --- a/library/stdarch/crates/core_arch/src/mod.rs +++ b/library/stdarch/crates/core_arch/src/mod.rs @@ -16,6 +16,9 @@ mod riscv_shared; ))] mod arm_shared; +#[cfg(any(target_arch = "loongarch32", target_arch = "loongarch64", doc))] +mod loongarch_shared; + mod simd; #[doc = include_str!("core_arch_docs.md")] @@ -271,13 +274,25 @@ pub mod arch { pub use crate::core_arch::nvptx::*; } - /// Platform-specific intrinsics for the `loongarch` platform. + /// Platform-specific intrinsics for the `loongarch32` platform. + /// + /// See the [module documentation](../index.html) for more details. + #[cfg(any(target_arch = "loongarch32", doc))] + #[doc(cfg(target_arch = "loongarch32"))] + #[unstable(feature = "stdarch_loongarch", issue = "117427")] + pub mod loongarch32 { + pub use crate::core_arch::loongarch_shared::*; + pub use crate::core_arch::loongarch32::*; + } + + /// Platform-specific intrinsics for the `loongarch64` platform. /// /// See the [module documentation](../index.html) for more details. #[cfg(any(target_arch = "loongarch64", doc))] #[doc(cfg(target_arch = "loongarch64"))] #[unstable(feature = "stdarch_loongarch", issue = "117427")] pub mod loongarch64 { + pub use crate::core_arch::loongarch_shared::*; pub use crate::core_arch::loongarch64::*; } @@ -334,6 +349,10 @@ mod powerpc64; #[doc(cfg(target_arch = "nvptx64"))] mod nvptx; +#[cfg(any(target_arch = "loongarch32", doc))] +#[doc(cfg(target_arch = "loongarch32"))] +mod loongarch32; + #[cfg(any(target_arch = "loongarch64", doc))] #[doc(cfg(target_arch = "loongarch64"))] mod loongarch64; diff --git a/library/stdarch/crates/simd-test-macro/src/lib.rs b/library/stdarch/crates/simd-test-macro/src/lib.rs index 18e4747d94d9..ae7849f298a9 100644 --- a/library/stdarch/crates/simd-test-macro/src/lib.rs +++ b/library/stdarch/crates/simd-test-macro/src/lib.rs @@ -62,7 +62,7 @@ pub fn simd_test( maybe_riscv if maybe_riscv.starts_with("riscv") => "is_riscv_feature_detected", "powerpc" | "powerpcle" => "is_powerpc_feature_detected", "powerpc64" | "powerpc64le" => "is_powerpc64_feature_detected", - "loongarch64" => "is_loongarch_feature_detected", + "loongarch32" | "loongarch64" => "is_loongarch_feature_detected", "s390x" => "is_s390x_feature_detected", t => panic!("unknown target: {t}"), }; diff --git a/library/stdarch/crates/std_detect/README.md b/library/stdarch/crates/std_detect/README.md index 091f5542e0e8..edc90d319a1d 100644 --- a/library/stdarch/crates/std_detect/README.md +++ b/library/stdarch/crates/std_detect/README.md @@ -55,7 +55,7 @@ crate from working on applications in which `std` is not available. application. * Linux/Android: - * `arm{32, 64}`, `mips{32,64}{,el}`, `powerpc{32,64}{,le}`, `loongarch64`, `s390x`: + * `arm{32, 64}`, `mips{32,64}{,el}`, `powerpc{32,64}{,le}`, `loongarch{32,64}`, `s390x`: `std_detect` supports these on Linux by querying ELF auxiliary vectors (using `getauxval` when available), and if that fails, by querying `/proc/self/auxv`. * `arm64`: partial support for doing run-time feature detection by directly diff --git a/library/stdarch/crates/std_detect/src/detect/arch/loongarch.rs b/library/stdarch/crates/std_detect/src/detect/arch/loongarch.rs index e9d68f6a9bf7..68fc600fa8e7 100644 --- a/library/stdarch/crates/std_detect/src/detect/arch/loongarch.rs +++ b/library/stdarch/crates/std_detect/src/detect/arch/loongarch.rs @@ -2,7 +2,7 @@ features! { @TARGET: loongarch; - @CFG: target_arch = "loongarch64"; + @CFG: any(target_arch = "loongarch32", target_arch = "loongarch64"); @MACRO_NAME: is_loongarch_feature_detected; @MACRO_ATTRS: /// Checks if `loongarch` feature is enabled. diff --git a/library/stdarch/crates/std_detect/src/detect/arch/mod.rs b/library/stdarch/crates/std_detect/src/detect/arch/mod.rs index d5a13acc0282..b0be554ed898 100644 --- a/library/stdarch/crates/std_detect/src/detect/arch/mod.rs +++ b/library/stdarch/crates/std_detect/src/detect/arch/mod.rs @@ -49,7 +49,7 @@ cfg_if! { } else if #[cfg(target_arch = "mips64")] { #[unstable(feature = "stdarch_mips_feature_detection", issue = "111188")] pub use mips64::*; - } else if #[cfg(target_arch = "loongarch64")] { + } else if #[cfg(any(target_arch = "loongarch32", target_arch = "loongarch64"))] { #[stable(feature = "stdarch_loongarch_feature", since = "1.89.0")] pub use loongarch::*; } else if #[cfg(target_arch = "s390x")] { diff --git a/library/stdarch/crates/std_detect/src/detect/mod.rs b/library/stdarch/crates/std_detect/src/detect/mod.rs index 8fd3d9579328..a9e9709c1f67 100644 --- a/library/stdarch/crates/std_detect/src/detect/mod.rs +++ b/library/stdarch/crates/std_detect/src/detect/mod.rs @@ -103,6 +103,7 @@ pub fn features() -> impl Iterator { target_arch = "powerpc64", target_arch = "mips", target_arch = "mips64", + target_arch = "loongarch32", target_arch = "loongarch64", target_arch = "s390x", ))] { diff --git a/library/stdarch/crates/std_detect/src/detect/os/linux/auxvec.rs b/library/stdarch/crates/std_detect/src/detect/os/linux/auxvec.rs index c30379ff0655..54f52aa75330 100644 --- a/library/stdarch/crates/std_detect/src/detect/os/linux/auxvec.rs +++ b/library/stdarch/crates/std_detect/src/detect/os/linux/auxvec.rs @@ -80,6 +80,7 @@ pub(crate) fn auxv() -> Result { target_arch = "riscv64", target_arch = "mips", target_arch = "mips64", + target_arch = "loongarch32", target_arch = "loongarch64", ))] { @@ -182,6 +183,7 @@ fn auxv_from_buf(buf: &[usize]) -> Result { target_arch = "riscv64", target_arch = "mips", target_arch = "mips64", + target_arch = "loongarch32", target_arch = "loongarch64", ))] { diff --git a/library/stdarch/crates/std_detect/src/detect/os/linux/mod.rs b/library/stdarch/crates/std_detect/src/detect/os/linux/mod.rs index 8c689d0b1f0e..9accd41717b9 100644 --- a/library/stdarch/crates/std_detect/src/detect/os/linux/mod.rs +++ b/library/stdarch/crates/std_detect/src/detect/os/linux/mod.rs @@ -51,7 +51,7 @@ cfg_if::cfg_if! { } else if #[cfg(any(target_arch = "powerpc", target_arch = "powerpc64"))] { mod powerpc; pub(crate) use self::powerpc::detect_features; - } else if #[cfg(target_arch = "loongarch64")] { + } else if #[cfg(any(target_arch = "loongarch32", target_arch = "loongarch64"))] { mod loongarch; pub(crate) use self::loongarch::detect_features; } else if #[cfg(target_arch = "s390x")] { diff --git a/library/stdarch/crates/std_detect/tests/macro_trailing_commas.rs b/library/stdarch/crates/std_detect/tests/macro_trailing_commas.rs index fa3a23c79681..2fee0abdd575 100644 --- a/library/stdarch/crates/std_detect/tests/macro_trailing_commas.rs +++ b/library/stdarch/crates/std_detect/tests/macro_trailing_commas.rs @@ -11,6 +11,7 @@ target_arch = "s390x", target_arch = "riscv32", target_arch = "riscv64", + target_arch = "loongarch32", target_arch = "loongarch64" ), feature(stdarch_internal) @@ -30,7 +31,7 @@ feature(stdarch_riscv_feature_detection) )] #![cfg_attr( - target_arch = "loongarch64", + any(target_arch = "loongarch32", target_arch = "loongarch64"), feature(stdarch_loongarch_feature_detection) )] @@ -45,6 +46,7 @@ target_arch = "s390x", target_arch = "riscv32", target_arch = "riscv64", + target_arch = "loongarch32", target_arch = "loongarch64" ))] #[macro_use] @@ -65,8 +67,8 @@ fn aarch64() { } #[test] -#[cfg(target_arch = "loongarch64")] -fn loongarch64() { +#[cfg(any(target_arch = "loongarch32", target_arch = "loongarch64"))] +fn loongarch() { let _ = is_loongarch_feature_detected!("lsx"); let _ = is_loongarch_feature_detected!("lsx",); } From b315e9a2ceb341e07983f028347beafaa60cda0a Mon Sep 17 00:00:00 2001 From: Marijn Schouten Date: Fri, 4 Jul 2025 11:27:13 +0000 Subject: [PATCH 006/139] clippy fix: rely on autoderef --- library/core/src/borrow.rs | 6 +++--- library/core/src/clone.rs | 2 +- library/core/src/ops/deref.rs | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/library/core/src/borrow.rs b/library/core/src/borrow.rs index ccb1cc4e974d..da05f236d2fe 100644 --- a/library/core/src/borrow.rs +++ b/library/core/src/borrow.rs @@ -223,20 +223,20 @@ impl BorrowMut for T { #[stable(feature = "rust1", since = "1.0.0")] impl Borrow for &T { fn borrow(&self) -> &T { - &**self + self } } #[stable(feature = "rust1", since = "1.0.0")] impl Borrow for &mut T { fn borrow(&self) -> &T { - &**self + self } } #[stable(feature = "rust1", since = "1.0.0")] impl BorrowMut for &mut T { fn borrow_mut(&mut self) -> &mut T { - &mut **self + self } } diff --git a/library/core/src/clone.rs b/library/core/src/clone.rs index a34d1b4a0649..51d037ddfd2c 100644 --- a/library/core/src/clone.rs +++ b/library/core/src/clone.rs @@ -590,7 +590,7 @@ mod impls { #[inline(always)] #[rustc_diagnostic_item = "noop_method_clone"] fn clone(&self) -> Self { - *self + self } } diff --git a/library/core/src/ops/deref.rs b/library/core/src/ops/deref.rs index 9d9d18095bc6..c2dede9fa088 100644 --- a/library/core/src/ops/deref.rs +++ b/library/core/src/ops/deref.rs @@ -158,7 +158,7 @@ impl const Deref for &T { #[rustc_diagnostic_item = "noop_method_deref"] fn deref(&self) -> &T { - *self + self } } @@ -171,7 +171,7 @@ impl const Deref for &mut T { type Target = T; fn deref(&self) -> &T { - *self + self } } @@ -280,7 +280,7 @@ pub trait DerefMut: ~const Deref + PointeeSized { #[rustc_const_unstable(feature = "const_deref", issue = "88955")] impl const DerefMut for &mut T { fn deref_mut(&mut self) -> &mut T { - *self + self } } From 7fa999f9d2acb9cfb7dc10810817fe6746eb6835 Mon Sep 17 00:00:00 2001 From: Folkert de Vries Date: Tue, 8 Jul 2025 10:20:54 +0200 Subject: [PATCH 007/139] add extra log messages to track setup --- library/stdarch/crates/intrinsic-test/src/main.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/library/stdarch/crates/intrinsic-test/src/main.rs b/library/stdarch/crates/intrinsic-test/src/main.rs index 054138a0dba1..538f317a2978 100644 --- a/library/stdarch/crates/intrinsic-test/src/main.rs +++ b/library/stdarch/crates/intrinsic-test/src/main.rs @@ -30,12 +30,15 @@ fn main() { let test_environment = test_environment_result.unwrap(); + info!("building C binaries"); if !test_environment.build_c_file() { std::process::exit(2); } + info!("building Rust binaries"); if !test_environment.build_rust_file() { std::process::exit(3); } + info!("comaparing outputs"); if !test_environment.compare_outputs() { std::process::exit(1); } From 54cc45d5b4a949fa29813253efc7897e27f48fe2 Mon Sep 17 00:00:00 2001 From: Martin Nordholts Date: Thu, 3 Jul 2025 23:24:14 +0200 Subject: [PATCH 008/139] tests: Don't check for self-printed output in std-backtrace.rs test The `Display` implementation for `Backtrace` used to print stack backtrace: but that print was later removed. To make the existing test pass, the print was added to the existing test. But it doesn't make sense to check for something that the test itself does since that will not detect any regressions in the implementation of `Backtrace`. Fully remove the checks. --- tests/ui/backtrace/std-backtrace.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/tests/ui/backtrace/std-backtrace.rs b/tests/ui/backtrace/std-backtrace.rs index 7ccbd46152bb..b81bdee44e48 100644 --- a/tests/ui/backtrace/std-backtrace.rs +++ b/tests/ui/backtrace/std-backtrace.rs @@ -13,9 +13,9 @@ use std::str; fn main() { let args: Vec = env::args().collect(); if args.len() >= 2 && args[1] == "force" { - println!("stack backtrace:\n{}", std::backtrace::Backtrace::force_capture()); + println!("{}", std::backtrace::Backtrace::force_capture()); } else if args.len() >= 2 { - println!("stack backtrace:\n{}", std::backtrace::Backtrace::capture()); + println!("{}", std::backtrace::Backtrace::capture()); } else { runtest(&args[0]); println!("test ok"); @@ -28,7 +28,6 @@ fn runtest(me: &str) { let p = Command::new(me).arg("a").env("RUST_BACKTRACE", "1").output().unwrap(); assert!(p.status.success()); - assert!(String::from_utf8_lossy(&p.stdout).contains("stack backtrace:\n")); assert!(String::from_utf8_lossy(&p.stdout).contains("backtrace::main")); let p = Command::new(me).arg("a").env("RUST_BACKTRACE", "0").output().unwrap(); @@ -46,7 +45,6 @@ fn runtest(me: &str) { .output() .unwrap(); assert!(p.status.success()); - assert!(String::from_utf8_lossy(&p.stdout).contains("stack backtrace:\n")); let p = Command::new(me) .arg("a") @@ -64,9 +62,7 @@ fn runtest(me: &str) { .output() .unwrap(); assert!(p.status.success()); - assert!(String::from_utf8_lossy(&p.stdout).contains("stack backtrace:\n")); let p = Command::new(me).arg("force").output().unwrap(); assert!(p.status.success()); - assert!(String::from_utf8_lossy(&p.stdout).contains("stack backtrace:\n")); } From 689cb5a4675a76c2ec19f4247d4f569550bec5a3 Mon Sep 17 00:00:00 2001 From: Amanieu d'Antras Date: Wed, 9 Jul 2025 11:27:59 +0100 Subject: [PATCH 009/139] Add sayantn and folkertdev as reviewers --- library/stdarch/triagebot.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/stdarch/triagebot.toml b/library/stdarch/triagebot.toml index 75eb642e9963..2c281c8f7d42 100644 --- a/library/stdarch/triagebot.toml +++ b/library/stdarch/triagebot.toml @@ -1,7 +1,7 @@ [assign] [assign.owners] -"*" = ["@Amanieu"] +"*" = ["@Amanieu", "@folkertdev", "@sayantn"] [ping.windows] message = """\ From a90e00172b652366a269d3f2261d9d9340f612d0 Mon Sep 17 00:00:00 2001 From: Folkert de Vries Date: Tue, 8 Jul 2025 09:59:03 +0200 Subject: [PATCH 010/139] run rust programs with the runner --- library/stdarch/Cargo.lock | 42 ++++---- .../crates/intrinsic-test/src/arm/config.rs | 1 - .../crates/intrinsic-test/src/arm/mod.rs | 5 +- .../crates/intrinsic-test/src/common/cli.rs | 6 +- .../intrinsic-test/src/common/compare.rs | 32 +++--- .../intrinsic-test/src/common/gen_rust.rs | 99 +++++++++---------- 6 files changed, 90 insertions(+), 95 deletions(-) diff --git a/library/stdarch/Cargo.lock b/library/stdarch/Cargo.lock index 80f424dfdd8d..7d9cd1bf8f13 100644 --- a/library/stdarch/Cargo.lock +++ b/library/stdarch/Cargo.lock @@ -73,20 +73,20 @@ version = "0.1.0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.102", + "syn 2.0.104", ] [[package]] name = "autocfg" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" +checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" [[package]] name = "cc" -version = "1.2.26" +version = "1.2.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "956a5e21988b87f372569b66183b78babf23ebc2e744b733e4350a752c4dafac" +checksum = "5c1599538de2394445747c8cf7935946e3cc27e9625f889d979bfb2aaf569362" dependencies = [ "shlex", ] @@ -128,7 +128,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.102", + "syn 2.0.104", ] [[package]] @@ -338,9 +338,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.9.0" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cea70ddb795996207ad57735b50c5982d8844f38ba9ee5f1aedcfb708a2aa11e" +checksum = "fe4cd85333e22411419a0bcae1297d25e58c9443848b11dc6a86fefe8c78a661" dependencies = [ "equivalent", "hashbrown 0.15.4", @@ -403,9 +403,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.172" +version = "0.2.174" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d750af042f7ef4f724306de029d18836c26c1765a54a6a3f094cbd23a7267ffa" +checksum = "1171693293099992e19cddea4e8b849964e9846f4acee11b3948bcc337be8776" [[package]] name = "linked-hash-map" @@ -624,7 +624,7 @@ checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" dependencies = [ "proc-macro2", "quote", - "syn 2.0.102", + "syn 2.0.104", ] [[package]] @@ -685,7 +685,7 @@ version = "0.1.0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.102", + "syn 2.0.104", ] [[package]] @@ -742,7 +742,7 @@ dependencies = [ "quote", "serde", "serde_json", - "syn 2.0.102", + "syn 2.0.104", ] [[package]] @@ -780,9 +780,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.102" +version = "2.0.104" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6397daf94fa90f058bd0fd88429dd9e5738999cca8d701813c80723add80462" +checksum = "17b6f705963418cdb9927482fa304bc562ece2fdd4f616084c50b7023b435a40" dependencies = [ "proc-macro2", "quote", @@ -838,7 +838,7 @@ version = "0.113.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "286049849b5a5bd09a8773171be96824afabffc7cc3df6caaf33a38db6cd07ae" dependencies = [ - "indexmap 2.9.0", + "indexmap 2.10.0", "semver", ] @@ -945,20 +945,20 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.8.25" +version = "0.8.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1702d9583232ddb9174e01bb7c15a2ab8fb1bc6f227aa1233858c351a3ba0cb" +checksum = "1039dd0d3c310cf05de012d8a39ff557cb0d23087fd44cad61df08fc31907a2f" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.8.25" +version = "0.8.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28a6e20d751156648aa063f3800b706ee209a32c0b4d9f24be3d980b01be55ef" +checksum = "9ecf5b4cc5364572d7f4c329661bcc82724222973f2cab6f050a4e5c22f75181" dependencies = [ "proc-macro2", "quote", - "syn 2.0.102", + "syn 2.0.104", ] diff --git a/library/stdarch/crates/intrinsic-test/src/arm/config.rs b/library/stdarch/crates/intrinsic-test/src/arm/config.rs index cee80374ae9d..9a7b37253d1c 100644 --- a/library/stdarch/crates/intrinsic-test/src/arm/config.rs +++ b/library/stdarch/crates/intrinsic-test/src/arm/config.rs @@ -114,7 +114,6 @@ pub const AARCH_CONFIGURATIONS: &str = r#" #![cfg_attr(any(target_arch = "aarch64", target_arch = "arm64ec"), feature(stdarch_neon_fcma))] #![cfg_attr(any(target_arch = "aarch64", target_arch = "arm64ec"), feature(stdarch_neon_dotprod))] #![cfg_attr(any(target_arch = "aarch64", target_arch = "arm64ec"), feature(stdarch_neon_i8mm))] -#![cfg_attr(any(target_arch = "aarch64", target_arch = "arm64ec"), feature(stdarch_neon_sha3))] #![cfg_attr(any(target_arch = "aarch64", target_arch = "arm64ec"), feature(stdarch_neon_sm4))] #![cfg_attr(any(target_arch = "aarch64", target_arch = "arm64ec"), feature(stdarch_neon_ftts))] #![feature(fmt_helpers_for_derive)] diff --git a/library/stdarch/crates/intrinsic-test/src/arm/mod.rs b/library/stdarch/crates/intrinsic-test/src/arm/mod.rs index 6aaa49ff97f9..1a66ed4268da 100644 --- a/library/stdarch/crates/intrinsic-test/src/arm/mod.rs +++ b/library/stdarch/crates/intrinsic-test/src/arm/mod.rs @@ -104,7 +104,7 @@ impl SupportedArchitectureTest for ArmArchitectureTest { } fn compare_outputs(&self) -> bool { - if let Some(ref toolchain) = self.cli_options.toolchain { + if self.cli_options.toolchain.is_some() { let intrinsics_name_list = self .intrinsics .iter() @@ -113,8 +113,7 @@ impl SupportedArchitectureTest for ArmArchitectureTest { compare_outputs( &intrinsics_name_list, - toolchain, - &self.cli_options.c_runner, + &self.cli_options.runner, &self.cli_options.target, ) } else { diff --git a/library/stdarch/crates/intrinsic-test/src/common/cli.rs b/library/stdarch/crates/intrinsic-test/src/common/cli.rs index 1d572723008d..beae6a4b044d 100644 --- a/library/stdarch/crates/intrinsic-test/src/common/cli.rs +++ b/library/stdarch/crates/intrinsic-test/src/common/cli.rs @@ -60,7 +60,7 @@ pub struct ProcessedCli { pub filename: PathBuf, pub toolchain: Option, pub cpp_compiler: Option, - pub c_runner: String, + pub runner: String, pub target: String, pub linker: Option, pub cxx_toolchain_dir: Option, @@ -70,7 +70,7 @@ pub struct ProcessedCli { impl ProcessedCli { pub fn new(cli_options: Cli) -> Self { let filename = cli_options.input; - let c_runner = cli_options.runner.unwrap_or_default(); + let runner = cli_options.runner.unwrap_or_default(); let target = cli_options.target; let linker = cli_options.linker; let cxx_toolchain_dir = cli_options.cxx_toolchain_dir; @@ -102,7 +102,7 @@ impl ProcessedCli { Self { toolchain, cpp_compiler, - c_runner, + runner, target, linker, cxx_toolchain_dir, diff --git a/library/stdarch/crates/intrinsic-test/src/common/compare.rs b/library/stdarch/crates/intrinsic-test/src/common/compare.rs index 9e0cbe8cd6ab..f16d83b0264b 100644 --- a/library/stdarch/crates/intrinsic-test/src/common/compare.rs +++ b/library/stdarch/crates/intrinsic-test/src/common/compare.rs @@ -2,26 +2,24 @@ use super::cli::FailureReason; use rayon::prelude::*; use std::process::Command; -pub fn compare_outputs( - intrinsic_name_list: &Vec, - toolchain: &str, - runner: &str, - target: &str, -) -> bool { +pub fn compare_outputs(intrinsic_name_list: &Vec, runner: &str, target: &str) -> bool { + fn runner_command(runner: &str) -> Command { + let mut it = runner.split_whitespace(); + let mut cmd = Command::new(it.next().unwrap()); + cmd.args(it); + + cmd + } + let intrinsics = intrinsic_name_list .par_iter() .filter_map(|intrinsic_name| { - let c = Command::new("sh") - .arg("-c") - .arg(format!("{runner} ./c_programs/{intrinsic_name}")) + let c = runner_command(runner) + .arg(format!("./c_programs/{intrinsic_name}")) .output(); - let rust = Command::new("sh") - .current_dir("rust_programs") - .arg("-c") - .arg(format!( - "cargo {toolchain} run --target {target} --bin {intrinsic_name} --release", - )) + let rust = runner_command(runner) + .arg(format!("target/{target}/release/{intrinsic_name}")) .env("RUSTFLAGS", "-Cdebuginfo=0") .output(); @@ -42,8 +40,8 @@ pub fn compare_outputs( if !rust.status.success() { error!( "Failed to run Rust program for intrinsic {intrinsic_name}\nstdout: {stdout}\nstderr: {stderr}", - stdout = std::str::from_utf8(&rust.stdout).unwrap_or(""), - stderr = std::str::from_utf8(&rust.stderr).unwrap_or(""), + stdout = String::from_utf8_lossy(&rust.stdout), + stderr = String::from_utf8_lossy(&rust.stderr), ); return Some(FailureReason::RunRust(intrinsic_name.clone())); } diff --git a/library/stdarch/crates/intrinsic-test/src/common/gen_rust.rs b/library/stdarch/crates/intrinsic-test/src/common/gen_rust.rs index 52bccaf905c5..0e4a95ab528a 100644 --- a/library/stdarch/crates/intrinsic-test/src/common/gen_rust.rs +++ b/library/stdarch/crates/intrinsic-test/src/common/gen_rust.rs @@ -2,7 +2,6 @@ use itertools::Itertools; use rayon::prelude::*; use std::collections::BTreeMap; use std::fs::File; -use std::io::Write; use std::process::Command; use super::argument::Argument; @@ -23,8 +22,8 @@ pub fn format_rust_main_template( ) -> String { format!( r#"{notices}#![feature(simd_ffi)] -#![feature(link_llvm_intrinsics)] #![feature(f16)] +#![allow(unused)] {configurations} {definitions} @@ -38,6 +37,42 @@ fn main() {{ ) } +fn write_cargo_toml(w: &mut impl std::io::Write, binaries: &[String]) -> std::io::Result<()> { + writeln!( + w, + concat!( + "[package]\n", + "name = \"intrinsic-test-programs\"\n", + "version = \"{version}\"\n", + "authors = [{authors}]\n", + "license = \"{license}\"\n", + "edition = \"2018\"\n", + "[workspace]\n", + "[dependencies]\n", + "core_arch = {{ path = \"../crates/core_arch\" }}", + ), + version = env!("CARGO_PKG_VERSION"), + authors = env!("CARGO_PKG_AUTHORS") + .split(":") + .format_with(", ", |author, fmt| fmt(&format_args!("\"{author}\""))), + license = env!("CARGO_PKG_LICENSE"), + )?; + + for binary in binaries { + writeln!( + w, + concat!( + "[[bin]]\n", + "name = \"{binary}\"\n", + "path = \"{binary}/main.rs\"\n", + ), + binary = binary, + )?; + } + + Ok(()) +} + pub fn compile_rust_programs( binaries: Vec, toolchain: Option<&str>, @@ -45,56 +80,20 @@ pub fn compile_rust_programs( linker: Option<&str>, ) -> bool { let mut cargo = File::create("rust_programs/Cargo.toml").unwrap(); - cargo - .write_all( - format!( - r#"[package] -name = "intrinsic-test-programs" -version = "{version}" -authors = [{authors}] -license = "{license}" -edition = "2018" -[workspace] -[dependencies] -core_arch = {{ path = "../crates/core_arch" }} -{binaries}"#, - version = env!("CARGO_PKG_VERSION"), - authors = env!("CARGO_PKG_AUTHORS") - .split(":") - .format_with(", ", |author, fmt| fmt(&format_args!("\"{author}\""))), - license = env!("CARGO_PKG_LICENSE"), - binaries = binaries - .iter() - .map(|binary| { - format!( - r#"[[bin]] -name = "{binary}" -path = "{binary}/main.rs""#, - ) - }) - .collect::>() - .join("\n") - ) - .into_bytes() - .as_slice(), - ) - .unwrap(); - - let toolchain = match toolchain { - None => return true, - Some(t) => t, - }; + write_cargo_toml(&mut cargo, &binaries).unwrap(); /* If there has been a linker explicitly set from the command line then * we want to set it via setting it in the RUSTFLAGS*/ - let cargo_command = format!("cargo {toolchain} build --target {target} --release"); + let mut cargo_command = Command::new("cargo"); + cargo_command.current_dir("rust_programs"); - let mut command = Command::new("sh"); - command - .current_dir("rust_programs") - .arg("-c") - .arg(cargo_command); + if let Some(toolchain) = toolchain { + if !toolchain.is_empty() { + cargo_command.arg(toolchain); + } + } + cargo_command.args(["build", "--target", target, "--release"]); let mut rust_flags = "-Cdebuginfo=0".to_string(); if let Some(linker) = linker { @@ -102,11 +101,11 @@ path = "{binary}/main.rs""#, rust_flags.push_str(linker); rust_flags.push_str(" -C link-args=-static"); - command.env("CPPFLAGS", "-fuse-ld=lld"); + cargo_command.env("CPPFLAGS", "-fuse-ld=lld"); } - command.env("RUSTFLAGS", rust_flags); - let output = command.output(); + cargo_command.env("RUSTFLAGS", rust_flags); + let output = cargo_command.output(); if let Ok(output) = output { if output.status.success() { From ef048d98ce4b66aec25b1cc1dd12c0b5b288f589 Mon Sep 17 00:00:00 2001 From: Folkert de Vries Date: Thu, 10 Jul 2025 12:07:53 +0200 Subject: [PATCH 011/139] use `splat` for the aarch64/arm dup intrinsics --- .../src/arm_shared/neon/generated.rs | 60 +++++++------------ .../spec/neon/arm_shared.spec.yml | 51 ++++++++-------- 2 files changed, 44 insertions(+), 67 deletions(-) diff --git a/library/stdarch/crates/core_arch/src/arm_shared/neon/generated.rs b/library/stdarch/crates/core_arch/src/arm_shared/neon/generated.rs index 286f1868852a..81e659ef7278 100644 --- a/library/stdarch/crates/core_arch/src/arm_shared/neon/generated.rs +++ b/library/stdarch/crates/core_arch/src/arm_shared/neon/generated.rs @@ -14322,8 +14322,7 @@ pub unsafe fn vld1q_dup_f16(ptr: *const f16) -> float16x8_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vld1_dup_f32(ptr: *const f32) -> float32x2_t { - let x = vld1_lane_f32::<0>(ptr, transmute(f32x2::splat(0.0))); - simd_shuffle!(x, x, [0, 0]) + transmute(f32x2::splat(*ptr)) } #[doc = "Load one single-element structure and Replicate to all lanes (of one register)."] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vld1_dup_p16)"] @@ -14346,8 +14345,7 @@ pub unsafe fn vld1_dup_f32(ptr: *const f32) -> float32x2_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vld1_dup_p16(ptr: *const p16) -> poly16x4_t { - let x = vld1_lane_p16::<0>(ptr, transmute(u16x4::splat(0))); - simd_shuffle!(x, x, [0, 0, 0, 0]) + transmute(u16x4::splat(*ptr)) } #[doc = "Load one single-element structure and Replicate to all lanes (of one register)."] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vld1_dup_p8)"] @@ -14370,8 +14368,7 @@ pub unsafe fn vld1_dup_p16(ptr: *const p16) -> poly16x4_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vld1_dup_p8(ptr: *const p8) -> poly8x8_t { - let x = vld1_lane_p8::<0>(ptr, transmute(u8x8::splat(0))); - simd_shuffle!(x, x, [0, 0, 0, 0, 0, 0, 0, 0]) + transmute(u8x8::splat(*ptr)) } #[doc = "Load one single-element structure and Replicate to all lanes (of one register)."] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vld1_dup_s16)"] @@ -14394,8 +14391,7 @@ pub unsafe fn vld1_dup_p8(ptr: *const p8) -> poly8x8_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vld1_dup_s16(ptr: *const i16) -> int16x4_t { - let x = vld1_lane_s16::<0>(ptr, transmute(i16x4::splat(0))); - simd_shuffle!(x, x, [0, 0, 0, 0]) + transmute(i16x4::splat(*ptr)) } #[doc = "Load one single-element structure and Replicate to all lanes (of one register)."] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vld1_dup_s32)"] @@ -14418,8 +14414,7 @@ pub unsafe fn vld1_dup_s16(ptr: *const i16) -> int16x4_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vld1_dup_s32(ptr: *const i32) -> int32x2_t { - let x = vld1_lane_s32::<0>(ptr, transmute(i32x2::splat(0))); - simd_shuffle!(x, x, [0, 0]) + transmute(i32x2::splat(*ptr)) } #[doc = "Load one single-element structure and Replicate to all lanes (of one register)."] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vld1_dup_s8)"] @@ -14442,8 +14437,7 @@ pub unsafe fn vld1_dup_s32(ptr: *const i32) -> int32x2_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vld1_dup_s8(ptr: *const i8) -> int8x8_t { - let x = vld1_lane_s8::<0>(ptr, transmute(i8x8::splat(0))); - simd_shuffle!(x, x, [0, 0, 0, 0, 0, 0, 0, 0]) + transmute(i8x8::splat(*ptr)) } #[doc = "Load one single-element structure and Replicate to all lanes (of one register)."] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vld1_dup_u16)"] @@ -14466,8 +14460,7 @@ pub unsafe fn vld1_dup_s8(ptr: *const i8) -> int8x8_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vld1_dup_u16(ptr: *const u16) -> uint16x4_t { - let x = vld1_lane_u16::<0>(ptr, transmute(u16x4::splat(0))); - simd_shuffle!(x, x, [0, 0, 0, 0]) + transmute(u16x4::splat(*ptr)) } #[doc = "Load one single-element structure and Replicate to all lanes (of one register)."] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vld1_dup_u32)"] @@ -14490,8 +14483,7 @@ pub unsafe fn vld1_dup_u16(ptr: *const u16) -> uint16x4_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vld1_dup_u32(ptr: *const u32) -> uint32x2_t { - let x = vld1_lane_u32::<0>(ptr, transmute(u32x2::splat(0))); - simd_shuffle!(x, x, [0, 0]) + transmute(u32x2::splat(*ptr)) } #[doc = "Load one single-element structure and Replicate to all lanes (of one register)."] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vld1_dup_u8)"] @@ -14514,8 +14506,7 @@ pub unsafe fn vld1_dup_u32(ptr: *const u32) -> uint32x2_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vld1_dup_u8(ptr: *const u8) -> uint8x8_t { - let x = vld1_lane_u8::<0>(ptr, transmute(u8x8::splat(0))); - simd_shuffle!(x, x, [0, 0, 0, 0, 0, 0, 0, 0]) + transmute(u8x8::splat(*ptr)) } #[doc = "Load one single-element structure and Replicate to all lanes (of one register)."] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vld1q_dup_f32)"] @@ -14538,8 +14529,7 @@ pub unsafe fn vld1_dup_u8(ptr: *const u8) -> uint8x8_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vld1q_dup_f32(ptr: *const f32) -> float32x4_t { - let x = vld1q_lane_f32::<0>(ptr, transmute(f32x4::splat(0.0))); - simd_shuffle!(x, x, [0, 0, 0, 0]) + transmute(f32x4::splat(*ptr)) } #[doc = "Load one single-element structure and Replicate to all lanes (of one register)."] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vld1q_dup_p16)"] @@ -14562,8 +14552,7 @@ pub unsafe fn vld1q_dup_f32(ptr: *const f32) -> float32x4_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vld1q_dup_p16(ptr: *const p16) -> poly16x8_t { - let x = vld1q_lane_p16::<0>(ptr, transmute(u16x8::splat(0))); - simd_shuffle!(x, x, [0, 0, 0, 0, 0, 0, 0, 0]) + transmute(u16x8::splat(*ptr)) } #[doc = "Load one single-element structure and Replicate to all lanes (of one register)."] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vld1q_dup_p8)"] @@ -14586,8 +14575,7 @@ pub unsafe fn vld1q_dup_p16(ptr: *const p16) -> poly16x8_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vld1q_dup_p8(ptr: *const p8) -> poly8x16_t { - let x = vld1q_lane_p8::<0>(ptr, transmute(u8x16::splat(0))); - simd_shuffle!(x, x, [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) + transmute(u8x16::splat(*ptr)) } #[doc = "Load one single-element structure and Replicate to all lanes (of one register)."] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vld1q_dup_s16)"] @@ -14610,8 +14598,7 @@ pub unsafe fn vld1q_dup_p8(ptr: *const p8) -> poly8x16_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vld1q_dup_s16(ptr: *const i16) -> int16x8_t { - let x = vld1q_lane_s16::<0>(ptr, transmute(i16x8::splat(0))); - simd_shuffle!(x, x, [0, 0, 0, 0, 0, 0, 0, 0]) + transmute(i16x8::splat(*ptr)) } #[doc = "Load one single-element structure and Replicate to all lanes (of one register)."] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vld1q_dup_s32)"] @@ -14634,8 +14621,7 @@ pub unsafe fn vld1q_dup_s16(ptr: *const i16) -> int16x8_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vld1q_dup_s32(ptr: *const i32) -> int32x4_t { - let x = vld1q_lane_s32::<0>(ptr, transmute(i32x4::splat(0))); - simd_shuffle!(x, x, [0, 0, 0, 0]) + transmute(i32x4::splat(*ptr)) } #[doc = "Load one single-element structure and Replicate to all lanes (of one register)."] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vld1q_dup_s64)"] @@ -14658,8 +14644,7 @@ pub unsafe fn vld1q_dup_s32(ptr: *const i32) -> int32x4_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vld1q_dup_s64(ptr: *const i64) -> int64x2_t { - let x = vld1q_lane_s64::<0>(ptr, transmute(i64x2::splat(0))); - simd_shuffle!(x, x, [0, 0]) + transmute(i64x2::splat(*ptr)) } #[doc = "Load one single-element structure and Replicate to all lanes (of one register)."] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vld1q_dup_s8)"] @@ -14682,8 +14667,7 @@ pub unsafe fn vld1q_dup_s64(ptr: *const i64) -> int64x2_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vld1q_dup_s8(ptr: *const i8) -> int8x16_t { - let x = vld1q_lane_s8::<0>(ptr, transmute(i8x16::splat(0))); - simd_shuffle!(x, x, [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) + transmute(i8x16::splat(*ptr)) } #[doc = "Load one single-element structure and Replicate to all lanes (of one register)."] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vld1q_dup_u16)"] @@ -14706,8 +14690,7 @@ pub unsafe fn vld1q_dup_s8(ptr: *const i8) -> int8x16_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vld1q_dup_u16(ptr: *const u16) -> uint16x8_t { - let x = vld1q_lane_u16::<0>(ptr, transmute(u16x8::splat(0))); - simd_shuffle!(x, x, [0, 0, 0, 0, 0, 0, 0, 0]) + transmute(u16x8::splat(*ptr)) } #[doc = "Load one single-element structure and Replicate to all lanes (of one register)."] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vld1q_dup_u32)"] @@ -14730,8 +14713,7 @@ pub unsafe fn vld1q_dup_u16(ptr: *const u16) -> uint16x8_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vld1q_dup_u32(ptr: *const u32) -> uint32x4_t { - let x = vld1q_lane_u32::<0>(ptr, transmute(u32x4::splat(0))); - simd_shuffle!(x, x, [0, 0, 0, 0]) + transmute(u32x4::splat(*ptr)) } #[doc = "Load one single-element structure and Replicate to all lanes (of one register)."] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vld1q_dup_u64)"] @@ -14754,8 +14736,7 @@ pub unsafe fn vld1q_dup_u32(ptr: *const u32) -> uint32x4_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vld1q_dup_u64(ptr: *const u64) -> uint64x2_t { - let x = vld1q_lane_u64::<0>(ptr, transmute(u64x2::splat(0))); - simd_shuffle!(x, x, [0, 0]) + transmute(u64x2::splat(*ptr)) } #[doc = "Load one single-element structure and Replicate to all lanes (of one register)."] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vld1q_dup_u8)"] @@ -14778,8 +14759,7 @@ pub unsafe fn vld1q_dup_u64(ptr: *const u64) -> uint64x2_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub unsafe fn vld1q_dup_u8(ptr: *const u8) -> uint8x16_t { - let x = vld1q_lane_u8::<0>(ptr, transmute(u8x16::splat(0))); - simd_shuffle!(x, x, [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) + transmute(u8x16::splat(*ptr)) } #[doc = "Load one single-element structure and Replicate to all lanes (of one register)."] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vld1_dup_p64)"] diff --git a/library/stdarch/crates/stdarch-gen-arm/spec/neon/arm_shared.spec.yml b/library/stdarch/crates/stdarch-gen-arm/spec/neon/arm_shared.spec.yml index 118f5808f758..1daa76531117 100644 --- a/library/stdarch/crates/stdarch-gen-arm/spec/neon/arm_shared.spec.yml +++ b/library/stdarch/crates/stdarch-gen-arm/spec/neon/arm_shared.spec.yml @@ -14138,6 +14138,7 @@ intrinsics: doc: "Load one single-element structure and Replicate to all lanes (of one register)." arguments: ["ptr: {type[1]}"] return_type: "{neon_type[2]}" + big_endian_inverse: false attr: - *neon-v7 - FnCall: [cfg_attr, [*test-is-arm, { FnCall: [assert_instr, ['"{type[3]}"']] } ]] @@ -14147,40 +14148,36 @@ intrinsics: safety: unsafe: [neon] types: - - ['vld1_dup_s8', '*const i8', 'int8x8_t', 'vld1.8', 'ld1r', 'vld1_lane_s8::<0>', 'i8x8::splat(0)', '[0, 0, 0, 0, 0, 0, 0, 0]'] - - ['vld1_dup_u8', '*const u8', 'uint8x8_t', 'vld1.8', 'ld1r', 'vld1_lane_u8::<0>', 'u8x8::splat(0)', '[0, 0, 0, 0, 0, 0, 0, 0]'] - - ['vld1_dup_p8', '*const p8', 'poly8x8_t', 'vld1.8', 'ld1r', 'vld1_lane_p8::<0>', 'u8x8::splat(0)', '[0, 0, 0, 0, 0, 0, 0, 0]'] + - ['vld1_dup_s8', '*const i8', 'int8x8_t', 'vld1.8', 'ld1r', 'i8x8::splat'] + - ['vld1_dup_u8', '*const u8', 'uint8x8_t', 'vld1.8', 'ld1r', 'u8x8::splat'] + - ['vld1_dup_p8', '*const p8', 'poly8x8_t', 'vld1.8', 'ld1r', 'u8x8::splat'] - - ['vld1q_dup_s8', '*const i8', 'int8x16_t', 'vld1.8', 'ld1r', 'vld1q_lane_s8::<0>', 'i8x16::splat(0)', '[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]'] - - ['vld1q_dup_u8', '*const u8', 'uint8x16_t', 'vld1.8', 'ld1r', 'vld1q_lane_u8::<0>', 'u8x16::splat(0)', '[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]'] - - ['vld1q_dup_p8', '*const p8', 'poly8x16_t', 'vld1.8', 'ld1r', 'vld1q_lane_p8::<0>', 'u8x16::splat(0)', '[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]'] + - ['vld1q_dup_s8', '*const i8', 'int8x16_t', 'vld1.8', 'ld1r', 'i8x16::splat'] + - ['vld1q_dup_u8', '*const u8', 'uint8x16_t', 'vld1.8', 'ld1r', 'u8x16::splat'] + - ['vld1q_dup_p8', '*const p8', 'poly8x16_t', 'vld1.8', 'ld1r', 'u8x16::splat'] - - ['vld1_dup_s16', '*const i16', 'int16x4_t', 'vld1.16', 'ld1r', 'vld1_lane_s16::<0>', 'i16x4::splat(0)', '[0, 0, 0, 0]'] - - ['vld1_dup_u16', '*const u16', 'uint16x4_t', 'vld1.16', 'ld1r', 'vld1_lane_u16::<0>', 'u16x4::splat(0)', '[0, 0, 0, 0]'] - - ['vld1_dup_p16', '*const p16', 'poly16x4_t', 'vld1.16', 'ld1r', 'vld1_lane_p16::<0>', 'u16x4::splat(0)', '[0, 0, 0, 0]'] + - ['vld1_dup_s16', '*const i16', 'int16x4_t', 'vld1.16', 'ld1r', 'i16x4::splat'] + - ['vld1_dup_u16', '*const u16', 'uint16x4_t', 'vld1.16', 'ld1r', 'u16x4::splat'] + - ['vld1_dup_p16', '*const p16', 'poly16x4_t', 'vld1.16', 'ld1r', 'u16x4::splat'] - - ['vld1q_dup_s16', '*const i16', 'int16x8_t', 'vld1.16', 'ld1r', 'vld1q_lane_s16::<0>', 'i16x8::splat(0)', '[0, 0, 0, 0, 0, 0, 0, 0]'] - - ['vld1q_dup_u16', '*const u16', 'uint16x8_t', 'vld1.16', 'ld1r', 'vld1q_lane_u16::<0>', 'u16x8::splat(0)', '[0, 0, 0, 0, 0, 0, 0, 0]'] - - ['vld1q_dup_p16', '*const p16', 'poly16x8_t', 'vld1.16', 'ld1r', 'vld1q_lane_p16::<0>', 'u16x8::splat(0)', '[0, 0, 0, 0, 0, 0, 0, 0]'] + - ['vld1q_dup_s16', '*const i16', 'int16x8_t', 'vld1.16', 'ld1r', 'i16x8::splat'] + - ['vld1q_dup_u16', '*const u16', 'uint16x8_t', 'vld1.16', 'ld1r', 'u16x8::splat'] + - ['vld1q_dup_p16', '*const p16', 'poly16x8_t', 'vld1.16', 'ld1r', 'u16x8::splat'] - - ['vld1_dup_s32', '*const i32', 'int32x2_t', 'vld1.32', 'ld1r', 'vld1_lane_s32::<0>', 'i32x2::splat(0)', '[0, 0]'] - - ['vld1_dup_u32', '*const u32', 'uint32x2_t', 'vld1.32', 'ld1r', 'vld1_lane_u32::<0>', 'u32x2::splat(0)', '[0, 0]'] - - ['vld1_dup_f32', '*const f32', 'float32x2_t', 'vld1.32', 'ld1r', 'vld1_lane_f32::<0>', 'f32x2::splat(0.0)', '[0, 0]'] + - ['vld1_dup_s32', '*const i32', 'int32x2_t', 'vld1.32', 'ld1r', 'i32x2::splat'] + - ['vld1_dup_u32', '*const u32', 'uint32x2_t', 'vld1.32', 'ld1r', 'u32x2::splat'] + - ['vld1_dup_f32', '*const f32', 'float32x2_t', 'vld1.32', 'ld1r', 'f32x2::splat'] - - ['vld1q_dup_s32', '*const i32', 'int32x4_t', 'vld1.32', 'ld1r', 'vld1q_lane_s32::<0>', 'i32x4::splat(0)', '[0, 0, 0, 0]'] - - ['vld1q_dup_u32', '*const u32', 'uint32x4_t', 'vld1.32', 'ld1r', 'vld1q_lane_u32::<0>', 'u32x4::splat(0)', '[0, 0, 0, 0]'] - - ['vld1q_dup_f32', '*const f32', 'float32x4_t', 'vld1.32', 'ld1r', 'vld1q_lane_f32::<0>', 'f32x4::splat(0.0)', '[0, 0, 0, 0]'] + - ['vld1q_dup_s32', '*const i32', 'int32x4_t', 'vld1.32', 'ld1r', 'i32x4::splat'] + - ['vld1q_dup_u32', '*const u32', 'uint32x4_t', 'vld1.32', 'ld1r', 'u32x4::splat'] + - ['vld1q_dup_f32', '*const f32', 'float32x4_t', 'vld1.32', 'ld1r', 'f32x4::splat'] - - ['vld1q_dup_s64', '*const i64', 'int64x2_t', 'vldr', 'ld1', 'vld1q_lane_s64::<0>', 'i64x2::splat(0)', '[0, 0]'] - - ['vld1q_dup_u64', '*const u64', 'uint64x2_t', 'vldr', 'ld1', 'vld1q_lane_u64::<0>', 'u64x2::splat(0)', '[0, 0]'] + - ['vld1q_dup_s64', '*const i64', 'int64x2_t', 'vldr', 'ld1', 'i64x2::splat'] + - ['vld1q_dup_u64', '*const u64', 'uint64x2_t', 'vldr', 'ld1', 'u64x2::splat'] compose: - - Let: - - x - - FnCall: - - '{type[5]}' - - - ptr - - FnCall: [transmute, ['{type[6]}']] - - FnCall: ['simd_shuffle!', [x, x, '{type[7]}']] + - FnCall: + - transmute + - - FnCall: ['{type[5]}', ["*ptr"]] - name: "{type[0]}" doc: "Absolute difference and accumulate (64-bit)" From 6d1f9552bd4c750b99cb7db7848762017c48465d Mon Sep 17 00:00:00 2001 From: Folkert de Vries Date: Thu, 10 Jul 2025 15:04:13 +0200 Subject: [PATCH 012/139] use `intrinsics::simd` for integer max/min --- .../src/arm_shared/neon/generated.rs | 264 +++++------------- .../spec/neon/arm_shared.spec.yml | 36 +-- 2 files changed, 80 insertions(+), 220 deletions(-) diff --git a/library/stdarch/crates/core_arch/src/arm_shared/neon/generated.rs b/library/stdarch/crates/core_arch/src/arm_shared/neon/generated.rs index 286f1868852a..16366d5e2bd5 100644 --- a/library/stdarch/crates/core_arch/src/arm_shared/neon/generated.rs +++ b/library/stdarch/crates/core_arch/src/arm_shared/neon/generated.rs @@ -27681,15 +27681,10 @@ pub fn vmaxq_f32(a: float32x4_t, b: float32x4_t) -> float32x4_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub fn vmax_s8(a: int8x8_t, b: int8x8_t) -> int8x8_t { - unsafe extern "unadjusted" { - #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vmaxs.v8i8")] - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.smax.v8i8" - )] - fn _vmax_s8(a: int8x8_t, b: int8x8_t) -> int8x8_t; + unsafe { + let mask: int8x8_t = simd_ge(a, b); + simd_select(mask, a, b) } - unsafe { _vmax_s8(a, b) } } #[doc = "Maximum (vector)"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vmaxq_s8)"] @@ -27710,15 +27705,10 @@ pub fn vmax_s8(a: int8x8_t, b: int8x8_t) -> int8x8_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub fn vmaxq_s8(a: int8x16_t, b: int8x16_t) -> int8x16_t { - unsafe extern "unadjusted" { - #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vmaxs.v16i8")] - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.smax.v16i8" - )] - fn _vmaxq_s8(a: int8x16_t, b: int8x16_t) -> int8x16_t; + unsafe { + let mask: int8x16_t = simd_ge(a, b); + simd_select(mask, a, b) } - unsafe { _vmaxq_s8(a, b) } } #[doc = "Maximum (vector)"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vmax_s16)"] @@ -27739,15 +27729,10 @@ pub fn vmaxq_s8(a: int8x16_t, b: int8x16_t) -> int8x16_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub fn vmax_s16(a: int16x4_t, b: int16x4_t) -> int16x4_t { - unsafe extern "unadjusted" { - #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vmaxs.v4i16")] - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.smax.v4i16" - )] - fn _vmax_s16(a: int16x4_t, b: int16x4_t) -> int16x4_t; + unsafe { + let mask: int16x4_t = simd_ge(a, b); + simd_select(mask, a, b) } - unsafe { _vmax_s16(a, b) } } #[doc = "Maximum (vector)"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vmaxq_s16)"] @@ -27768,15 +27753,10 @@ pub fn vmax_s16(a: int16x4_t, b: int16x4_t) -> int16x4_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub fn vmaxq_s16(a: int16x8_t, b: int16x8_t) -> int16x8_t { - unsafe extern "unadjusted" { - #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vmaxs.v8i16")] - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.smax.v8i16" - )] - fn _vmaxq_s16(a: int16x8_t, b: int16x8_t) -> int16x8_t; + unsafe { + let mask: int16x8_t = simd_ge(a, b); + simd_select(mask, a, b) } - unsafe { _vmaxq_s16(a, b) } } #[doc = "Maximum (vector)"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vmax_s32)"] @@ -27797,15 +27777,10 @@ pub fn vmaxq_s16(a: int16x8_t, b: int16x8_t) -> int16x8_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub fn vmax_s32(a: int32x2_t, b: int32x2_t) -> int32x2_t { - unsafe extern "unadjusted" { - #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vmaxs.v2i32")] - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.smax.v2i32" - )] - fn _vmax_s32(a: int32x2_t, b: int32x2_t) -> int32x2_t; + unsafe { + let mask: int32x2_t = simd_ge(a, b); + simd_select(mask, a, b) } - unsafe { _vmax_s32(a, b) } } #[doc = "Maximum (vector)"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vmaxq_s32)"] @@ -27826,15 +27801,10 @@ pub fn vmax_s32(a: int32x2_t, b: int32x2_t) -> int32x2_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub fn vmaxq_s32(a: int32x4_t, b: int32x4_t) -> int32x4_t { - unsafe extern "unadjusted" { - #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vmaxs.v4i32")] - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.smax.v4i32" - )] - fn _vmaxq_s32(a: int32x4_t, b: int32x4_t) -> int32x4_t; + unsafe { + let mask: int32x4_t = simd_ge(a, b); + simd_select(mask, a, b) } - unsafe { _vmaxq_s32(a, b) } } #[doc = "Maximum (vector)"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vmax_u8)"] @@ -27855,15 +27825,10 @@ pub fn vmaxq_s32(a: int32x4_t, b: int32x4_t) -> int32x4_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub fn vmax_u8(a: uint8x8_t, b: uint8x8_t) -> uint8x8_t { - unsafe extern "unadjusted" { - #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vmaxu.v8i8")] - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.umax.v8i8" - )] - fn _vmax_u8(a: uint8x8_t, b: uint8x8_t) -> uint8x8_t; + unsafe { + let mask: uint8x8_t = simd_ge(a, b); + simd_select(mask, a, b) } - unsafe { _vmax_u8(a, b) } } #[doc = "Maximum (vector)"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vmaxq_u8)"] @@ -27884,15 +27849,10 @@ pub fn vmax_u8(a: uint8x8_t, b: uint8x8_t) -> uint8x8_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub fn vmaxq_u8(a: uint8x16_t, b: uint8x16_t) -> uint8x16_t { - unsafe extern "unadjusted" { - #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vmaxu.v16i8")] - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.umax.v16i8" - )] - fn _vmaxq_u8(a: uint8x16_t, b: uint8x16_t) -> uint8x16_t; + unsafe { + let mask: uint8x16_t = simd_ge(a, b); + simd_select(mask, a, b) } - unsafe { _vmaxq_u8(a, b) } } #[doc = "Maximum (vector)"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vmax_u16)"] @@ -27913,15 +27873,10 @@ pub fn vmaxq_u8(a: uint8x16_t, b: uint8x16_t) -> uint8x16_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub fn vmax_u16(a: uint16x4_t, b: uint16x4_t) -> uint16x4_t { - unsafe extern "unadjusted" { - #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vmaxu.v4i16")] - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.umax.v4i16" - )] - fn _vmax_u16(a: uint16x4_t, b: uint16x4_t) -> uint16x4_t; + unsafe { + let mask: uint16x4_t = simd_ge(a, b); + simd_select(mask, a, b) } - unsafe { _vmax_u16(a, b) } } #[doc = "Maximum (vector)"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vmaxq_u16)"] @@ -27942,15 +27897,10 @@ pub fn vmax_u16(a: uint16x4_t, b: uint16x4_t) -> uint16x4_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub fn vmaxq_u16(a: uint16x8_t, b: uint16x8_t) -> uint16x8_t { - unsafe extern "unadjusted" { - #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vmaxu.v8i16")] - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.umax.v8i16" - )] - fn _vmaxq_u16(a: uint16x8_t, b: uint16x8_t) -> uint16x8_t; + unsafe { + let mask: uint16x8_t = simd_ge(a, b); + simd_select(mask, a, b) } - unsafe { _vmaxq_u16(a, b) } } #[doc = "Maximum (vector)"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vmax_u32)"] @@ -27971,15 +27921,10 @@ pub fn vmaxq_u16(a: uint16x8_t, b: uint16x8_t) -> uint16x8_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub fn vmax_u32(a: uint32x2_t, b: uint32x2_t) -> uint32x2_t { - unsafe extern "unadjusted" { - #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vmaxu.v2i32")] - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.umax.v2i32" - )] - fn _vmax_u32(a: uint32x2_t, b: uint32x2_t) -> uint32x2_t; + unsafe { + let mask: uint32x2_t = simd_ge(a, b); + simd_select(mask, a, b) } - unsafe { _vmax_u32(a, b) } } #[doc = "Maximum (vector)"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vmaxq_u32)"] @@ -28000,15 +27945,10 @@ pub fn vmax_u32(a: uint32x2_t, b: uint32x2_t) -> uint32x2_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub fn vmaxq_u32(a: uint32x4_t, b: uint32x4_t) -> uint32x4_t { - unsafe extern "unadjusted" { - #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vmaxu.v4i32")] - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.umax.v4i32" - )] - fn _vmaxq_u32(a: uint32x4_t, b: uint32x4_t) -> uint32x4_t; + unsafe { + let mask: uint32x4_t = simd_ge(a, b); + simd_select(mask, a, b) } - unsafe { _vmaxq_u32(a, b) } } #[doc = "Floating-point Maximum Number (vector)"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vmaxnm_f16)"] @@ -28233,15 +28173,10 @@ pub fn vminq_f32(a: float32x4_t, b: float32x4_t) -> float32x4_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub fn vmin_s8(a: int8x8_t, b: int8x8_t) -> int8x8_t { - unsafe extern "unadjusted" { - #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vmins.v8i8")] - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.smin.v8i8" - )] - fn _vmin_s8(a: int8x8_t, b: int8x8_t) -> int8x8_t; + unsafe { + let mask: int8x8_t = simd_le(a, b); + simd_select(mask, a, b) } - unsafe { _vmin_s8(a, b) } } #[doc = "Minimum (vector)"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vminq_s8)"] @@ -28262,15 +28197,10 @@ pub fn vmin_s8(a: int8x8_t, b: int8x8_t) -> int8x8_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub fn vminq_s8(a: int8x16_t, b: int8x16_t) -> int8x16_t { - unsafe extern "unadjusted" { - #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vmins.v16i8")] - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.smin.v16i8" - )] - fn _vminq_s8(a: int8x16_t, b: int8x16_t) -> int8x16_t; + unsafe { + let mask: int8x16_t = simd_le(a, b); + simd_select(mask, a, b) } - unsafe { _vminq_s8(a, b) } } #[doc = "Minimum (vector)"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vmin_s16)"] @@ -28291,15 +28221,10 @@ pub fn vminq_s8(a: int8x16_t, b: int8x16_t) -> int8x16_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub fn vmin_s16(a: int16x4_t, b: int16x4_t) -> int16x4_t { - unsafe extern "unadjusted" { - #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vmins.v4i16")] - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.smin.v4i16" - )] - fn _vmin_s16(a: int16x4_t, b: int16x4_t) -> int16x4_t; + unsafe { + let mask: int16x4_t = simd_le(a, b); + simd_select(mask, a, b) } - unsafe { _vmin_s16(a, b) } } #[doc = "Minimum (vector)"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vminq_s16)"] @@ -28320,15 +28245,10 @@ pub fn vmin_s16(a: int16x4_t, b: int16x4_t) -> int16x4_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub fn vminq_s16(a: int16x8_t, b: int16x8_t) -> int16x8_t { - unsafe extern "unadjusted" { - #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vmins.v8i16")] - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.smin.v8i16" - )] - fn _vminq_s16(a: int16x8_t, b: int16x8_t) -> int16x8_t; + unsafe { + let mask: int16x8_t = simd_le(a, b); + simd_select(mask, a, b) } - unsafe { _vminq_s16(a, b) } } #[doc = "Minimum (vector)"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vmin_s32)"] @@ -28349,15 +28269,10 @@ pub fn vminq_s16(a: int16x8_t, b: int16x8_t) -> int16x8_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub fn vmin_s32(a: int32x2_t, b: int32x2_t) -> int32x2_t { - unsafe extern "unadjusted" { - #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vmins.v2i32")] - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.smin.v2i32" - )] - fn _vmin_s32(a: int32x2_t, b: int32x2_t) -> int32x2_t; + unsafe { + let mask: int32x2_t = simd_le(a, b); + simd_select(mask, a, b) } - unsafe { _vmin_s32(a, b) } } #[doc = "Minimum (vector)"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vminq_s32)"] @@ -28378,15 +28293,10 @@ pub fn vmin_s32(a: int32x2_t, b: int32x2_t) -> int32x2_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub fn vminq_s32(a: int32x4_t, b: int32x4_t) -> int32x4_t { - unsafe extern "unadjusted" { - #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vmins.v4i32")] - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.smin.v4i32" - )] - fn _vminq_s32(a: int32x4_t, b: int32x4_t) -> int32x4_t; + unsafe { + let mask: int32x4_t = simd_le(a, b); + simd_select(mask, a, b) } - unsafe { _vminq_s32(a, b) } } #[doc = "Minimum (vector)"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vmin_u8)"] @@ -28407,15 +28317,10 @@ pub fn vminq_s32(a: int32x4_t, b: int32x4_t) -> int32x4_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub fn vmin_u8(a: uint8x8_t, b: uint8x8_t) -> uint8x8_t { - unsafe extern "unadjusted" { - #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vminu.v8i8")] - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.umin.v8i8" - )] - fn _vmin_u8(a: uint8x8_t, b: uint8x8_t) -> uint8x8_t; + unsafe { + let mask: uint8x8_t = simd_le(a, b); + simd_select(mask, a, b) } - unsafe { _vmin_u8(a, b) } } #[doc = "Minimum (vector)"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vminq_u8)"] @@ -28436,15 +28341,10 @@ pub fn vmin_u8(a: uint8x8_t, b: uint8x8_t) -> uint8x8_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub fn vminq_u8(a: uint8x16_t, b: uint8x16_t) -> uint8x16_t { - unsafe extern "unadjusted" { - #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vminu.v16i8")] - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.umin.v16i8" - )] - fn _vminq_u8(a: uint8x16_t, b: uint8x16_t) -> uint8x16_t; + unsafe { + let mask: uint8x16_t = simd_le(a, b); + simd_select(mask, a, b) } - unsafe { _vminq_u8(a, b) } } #[doc = "Minimum (vector)"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vmin_u16)"] @@ -28465,15 +28365,10 @@ pub fn vminq_u8(a: uint8x16_t, b: uint8x16_t) -> uint8x16_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub fn vmin_u16(a: uint16x4_t, b: uint16x4_t) -> uint16x4_t { - unsafe extern "unadjusted" { - #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vminu.v4i16")] - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.umin.v4i16" - )] - fn _vmin_u16(a: uint16x4_t, b: uint16x4_t) -> uint16x4_t; + unsafe { + let mask: uint16x4_t = simd_le(a, b); + simd_select(mask, a, b) } - unsafe { _vmin_u16(a, b) } } #[doc = "Minimum (vector)"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vminq_u16)"] @@ -28494,15 +28389,10 @@ pub fn vmin_u16(a: uint16x4_t, b: uint16x4_t) -> uint16x4_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub fn vminq_u16(a: uint16x8_t, b: uint16x8_t) -> uint16x8_t { - unsafe extern "unadjusted" { - #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vminu.v8i16")] - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.umin.v8i16" - )] - fn _vminq_u16(a: uint16x8_t, b: uint16x8_t) -> uint16x8_t; + unsafe { + let mask: uint16x8_t = simd_le(a, b); + simd_select(mask, a, b) } - unsafe { _vminq_u16(a, b) } } #[doc = "Minimum (vector)"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vmin_u32)"] @@ -28523,15 +28413,10 @@ pub fn vminq_u16(a: uint16x8_t, b: uint16x8_t) -> uint16x8_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub fn vmin_u32(a: uint32x2_t, b: uint32x2_t) -> uint32x2_t { - unsafe extern "unadjusted" { - #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vminu.v2i32")] - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.umin.v2i32" - )] - fn _vmin_u32(a: uint32x2_t, b: uint32x2_t) -> uint32x2_t; + unsafe { + let mask: uint32x2_t = simd_le(a, b); + simd_select(mask, a, b) } - unsafe { _vmin_u32(a, b) } } #[doc = "Minimum (vector)"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vminq_u32)"] @@ -28552,15 +28437,10 @@ pub fn vmin_u32(a: uint32x2_t, b: uint32x2_t) -> uint32x2_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub fn vminq_u32(a: uint32x4_t, b: uint32x4_t) -> uint32x4_t { - unsafe extern "unadjusted" { - #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vminu.v4i32")] - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.umin.v4i32" - )] - fn _vminq_u32(a: uint32x4_t, b: uint32x4_t) -> uint32x4_t; + unsafe { + let mask: uint32x4_t = simd_le(a, b); + simd_select(mask, a, b) } - unsafe { _vminq_u32(a, b) } } #[doc = "Floating-point Minimum Number (vector)"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vminnm_f16)"] diff --git a/library/stdarch/crates/stdarch-gen-arm/spec/neon/arm_shared.spec.yml b/library/stdarch/crates/stdarch-gen-arm/spec/neon/arm_shared.spec.yml index 118f5808f758..20caff2202bc 100644 --- a/library/stdarch/crates/stdarch-gen-arm/spec/neon/arm_shared.spec.yml +++ b/library/stdarch/crates/stdarch-gen-arm/spec/neon/arm_shared.spec.yml @@ -7135,13 +7135,8 @@ intrinsics: - int32x2_t - int32x4_t compose: - - LLVMLink: - name: "smax.{neon_type}" - links: - - link: "llvm.arm.neon.vmaxs.{neon_type}" - arch: arm - - link: "llvm.aarch64.neon.smax.{neon_type}" - arch: aarch64,arm64ec + - Let: [mask, "{neon_type}", {FnCall: [simd_ge, [a, b]]}] + - FnCall: [simd_select, [mask, a, b]] - name: "vmax{neon_type.no}" doc: Maximum (vector) @@ -7162,13 +7157,8 @@ intrinsics: - uint32x2_t - uint32x4_t compose: - - LLVMLink: - name: "smax.{neon_type}" - links: - - link: "llvm.arm.neon.vmaxu.{neon_type}" - arch: arm - - link: "llvm.aarch64.neon.umax.{neon_type}" - arch: aarch64,arm64ec + - Let: [mask, "{neon_type}", {FnCall: [simd_ge, [a, b]]}] + - FnCall: [simd_select, [mask, a, b]] - name: "vmax{neon_type.no}" doc: Maximum (vector) @@ -7309,13 +7299,8 @@ intrinsics: - int32x2_t - int32x4_t compose: - - LLVMLink: - name: "smin.{neon_type}" - links: - - link: "llvm.arm.neon.vmins.{neon_type}" - arch: arm - - link: "llvm.aarch64.neon.smin.{neon_type}" - arch: aarch64,arm64ec + - Let: [mask, "{neon_type}", {FnCall: [simd_le, [a, b]]}] + - FnCall: [simd_select, [mask, a, b]] - name: "vmin{neon_type.no}" doc: "Minimum (vector)" @@ -7336,13 +7321,8 @@ intrinsics: - uint32x2_t - uint32x4_t compose: - - LLVMLink: - name: "umin.{neon_type}" - links: - - link: "llvm.arm.neon.vminu.{neon_type}" - arch: arm - - link: "llvm.aarch64.neon.umin.{neon_type}" - arch: aarch64,arm64ec + - Let: [mask, "{neon_type}", {FnCall: [simd_le, [a, b]]}] + - FnCall: [simd_select, [mask, a, b]] - name: "vmin{neon_type.no}" doc: "Minimum (vector)" From a8110072ff086711d105141a4c072af5077c0fab Mon Sep 17 00:00:00 2001 From: Marijn Schouten Date: Fri, 11 Jul 2025 11:13:13 +0000 Subject: [PATCH 013/139] thumbv7neon-unknown-linux-gnueabihf clippy fixes --- .../src/arm_shared/neon/generated.rs | 113 +++--------------- .../spec/neon/arm_shared.spec.yml | 38 +++--- 2 files changed, 38 insertions(+), 113 deletions(-) diff --git a/library/stdarch/crates/core_arch/src/arm_shared/neon/generated.rs b/library/stdarch/crates/core_arch/src/arm_shared/neon/generated.rs index b55d2383851d..088377c13fc3 100644 --- a/library/stdarch/crates/core_arch/src/arm_shared/neon/generated.rs +++ b/library/stdarch/crates/core_arch/src/arm_shared/neon/generated.rs @@ -39546,17 +39546,7 @@ pub fn vqrshrn_n_s16(a: int16x8_t) -> int8x8_t { #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vqrshiftns.v8i8")] fn _vqrshrn_n_s16(a: int16x8_t, n: int16x8_t) -> int8x8_t; } - unsafe { - _vqrshrn_n_s16( - a, - const { - int16x8_t([ - -N as i16, -N as i16, -N as i16, -N as i16, -N as i16, -N as i16, -N as i16, - -N as i16, - ]) - }, - ) - } + unsafe { _vqrshrn_n_s16(a, const { int16x8_t([-N as i16; 8]) }) } } #[doc = "Signed saturating rounded shift right narrow"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vqrshrn_n_s32)"] @@ -39572,12 +39562,7 @@ pub fn vqrshrn_n_s32(a: int32x4_t) -> int16x4_t { #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vqrshiftns.v4i16")] fn _vqrshrn_n_s32(a: int32x4_t, n: int32x4_t) -> int16x4_t; } - unsafe { - _vqrshrn_n_s32( - a, - const { int32x4_t([-N as i32, -N as i32, -N as i32, -N as i32]) }, - ) - } + unsafe { _vqrshrn_n_s32(a, const { int32x4_t([-N; 4]) }) } } #[doc = "Signed saturating rounded shift right narrow"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vqrshrn_n_s64)"] @@ -39593,7 +39578,7 @@ pub fn vqrshrn_n_s64(a: int64x2_t) -> int32x2_t { #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vqrshiftns.v2i32")] fn _vqrshrn_n_s64(a: int64x2_t, n: int64x2_t) -> int32x2_t; } - unsafe { _vqrshrn_n_s64(a, const { int64x2_t([-N as i64, -N as i64]) }) } + unsafe { _vqrshrn_n_s64(a, const { int64x2_t([-N as i64; 2]) }) } } #[doc = "Signed saturating rounded shift right narrow"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vqrshrn_n_s16)"] @@ -39786,17 +39771,7 @@ pub fn vqrshrun_n_s16(a: int16x8_t) -> uint8x8_t { #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vqrshiftnsu.v8i8")] fn _vqrshrun_n_s16(a: int16x8_t, n: int16x8_t) -> uint8x8_t; } - unsafe { - _vqrshrun_n_s16( - a, - const { - int16x8_t([ - -N as i16, -N as i16, -N as i16, -N as i16, -N as i16, -N as i16, -N as i16, - -N as i16, - ]) - }, - ) - } + unsafe { _vqrshrun_n_s16(a, const { int16x8_t([-N as i16; 8]) }) } } #[doc = "Signed saturating rounded shift right unsigned narrow"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vqrshrun_n_s32)"] @@ -39812,12 +39787,7 @@ pub fn vqrshrun_n_s32(a: int32x4_t) -> uint16x4_t { #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vqrshiftnsu.v4i16")] fn _vqrshrun_n_s32(a: int32x4_t, n: int32x4_t) -> uint16x4_t; } - unsafe { - _vqrshrun_n_s32( - a, - const { int32x4_t([-N as i32, -N as i32, -N as i32, -N as i32]) }, - ) - } + unsafe { _vqrshrun_n_s32(a, const { int32x4_t([-N; 4]) }) } } #[doc = "Signed saturating rounded shift right unsigned narrow"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vqrshrun_n_s64)"] @@ -39833,7 +39803,7 @@ pub fn vqrshrun_n_s64(a: int64x2_t) -> uint32x2_t { #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vqrshiftnsu.v2i32")] fn _vqrshrun_n_s64(a: int64x2_t, n: int64x2_t) -> uint32x2_t; } - unsafe { _vqrshrun_n_s64(a, const { int64x2_t([-N as i64, -N as i64]) }) } + unsafe { _vqrshrun_n_s64(a, const { int64x2_t([-N as i64; 2]) }) } } #[doc = "Signed saturating rounded shift right unsigned narrow"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vqrshrun_n_s16)"] @@ -41018,17 +40988,7 @@ pub fn vqshrn_n_s16(a: int16x8_t) -> int8x8_t { #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vqshiftns.v8i8")] fn _vqshrn_n_s16(a: int16x8_t, n: int16x8_t) -> int8x8_t; } - unsafe { - _vqshrn_n_s16( - a, - const { - int16x8_t([ - -N as i16, -N as i16, -N as i16, -N as i16, -N as i16, -N as i16, -N as i16, - -N as i16, - ]) - }, - ) - } + unsafe { _vqshrn_n_s16(a, const { int16x8_t([-N as i16; 8]) }) } } #[doc = "Signed saturating shift right narrow"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vqshrn_n_s32)"] @@ -41044,12 +41004,7 @@ pub fn vqshrn_n_s32(a: int32x4_t) -> int16x4_t { #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vqshiftns.v4i16")] fn _vqshrn_n_s32(a: int32x4_t, n: int32x4_t) -> int16x4_t; } - unsafe { - _vqshrn_n_s32( - a, - const { int32x4_t([-N as i32, -N as i32, -N as i32, -N as i32]) }, - ) - } + unsafe { _vqshrn_n_s32(a, const { int32x4_t([-N; 4]) }) } } #[doc = "Signed saturating shift right narrow"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vqshrn_n_s64)"] @@ -41065,7 +41020,7 @@ pub fn vqshrn_n_s64(a: int64x2_t) -> int32x2_t { #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vqshiftns.v2i32")] fn _vqshrn_n_s64(a: int64x2_t, n: int64x2_t) -> int32x2_t; } - unsafe { _vqshrn_n_s64(a, const { int64x2_t([-N as i64, -N as i64]) }) } + unsafe { _vqshrn_n_s64(a, const { int64x2_t([-N as i64; 2]) }) } } #[doc = "Signed saturating shift right narrow"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vqshrn_n_s16)"] @@ -41258,17 +41213,7 @@ pub fn vqshrun_n_s16(a: int16x8_t) -> uint8x8_t { #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vqshiftnsu.v8i8")] fn _vqshrun_n_s16(a: int16x8_t, n: int16x8_t) -> uint8x8_t; } - unsafe { - _vqshrun_n_s16( - a, - const { - int16x8_t([ - -N as i16, -N as i16, -N as i16, -N as i16, -N as i16, -N as i16, -N as i16, - -N as i16, - ]) - }, - ) - } + unsafe { _vqshrun_n_s16(a, const { int16x8_t([-N as i16; 8]) }) } } #[doc = "Signed saturating shift right unsigned narrow"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vqshrun_n_s32)"] @@ -41284,12 +41229,7 @@ pub fn vqshrun_n_s32(a: int32x4_t) -> uint16x4_t { #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vqshiftnsu.v4i16")] fn _vqshrun_n_s32(a: int32x4_t, n: int32x4_t) -> uint16x4_t; } - unsafe { - _vqshrun_n_s32( - a, - const { int32x4_t([-N as i32, -N as i32, -N as i32, -N as i32]) }, - ) - } + unsafe { _vqshrun_n_s32(a, const { int32x4_t([-N; 4]) }) } } #[doc = "Signed saturating shift right unsigned narrow"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vqshrun_n_s64)"] @@ -41305,7 +41245,7 @@ pub fn vqshrun_n_s64(a: int64x2_t) -> uint32x2_t { #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vqshiftnsu.v2i32")] fn _vqshrun_n_s64(a: int64x2_t, n: int64x2_t) -> uint32x2_t; } - unsafe { _vqshrun_n_s64(a, const { int64x2_t([-N as i64, -N as i64]) }) } + unsafe { _vqshrun_n_s64(a, const { int64x2_t([-N as i64; 2]) }) } } #[doc = "Signed saturating shift right unsigned narrow"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vqshrun_n_s16)"] @@ -59463,17 +59403,7 @@ pub fn vrshrn_n_s16(a: int16x8_t) -> int8x8_t { #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vrshiftn.v8i8")] fn _vrshrn_n_s16(a: int16x8_t, n: int16x8_t) -> int8x8_t; } - unsafe { - _vrshrn_n_s16( - a, - const { - int16x8_t([ - -N as i16, -N as i16, -N as i16, -N as i16, -N as i16, -N as i16, -N as i16, - -N as i16, - ]) - }, - ) - } + unsafe { _vrshrn_n_s16(a, const { int16x8_t([-N as i16; 8]) }) } } #[doc = "Rounding shift right narrow"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vrshrn_n_s32)"] @@ -59489,12 +59419,7 @@ pub fn vrshrn_n_s32(a: int32x4_t) -> int16x4_t { #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vrshiftn.v4i16")] fn _vrshrn_n_s32(a: int32x4_t, n: int32x4_t) -> int16x4_t; } - unsafe { - _vrshrn_n_s32( - a, - const { int32x4_t([-N as i32, -N as i32, -N as i32, -N as i32]) }, - ) - } + unsafe { _vrshrn_n_s32(a, const { int32x4_t([-N; 4]) }) } } #[doc = "Rounding shift right narrow"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vrshrn_n_s64)"] @@ -59510,7 +59435,7 @@ pub fn vrshrn_n_s64(a: int64x2_t) -> int32x2_t { #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vrshiftn.v2i32")] fn _vrshrn_n_s64(a: int64x2_t, n: int64x2_t) -> int32x2_t; } - unsafe { _vrshrn_n_s64(a, const { int64x2_t([-N as i64, -N as i64]) }) } + unsafe { _vrshrn_n_s64(a, const { int64x2_t([-N as i64; 2]) }) } } #[doc = "Rounding shift right narrow"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vrshrn_n_s16)"] @@ -63163,7 +63088,7 @@ pub fn vsli_n_u32(a: uint32x2_t, b: uint32x2_t) -> uint32x2_t { transmute(vshiftins_v2i32( transmute(a), transmute(b), - int32x2_t::splat(N as i32), + int32x2_t::splat(N), )) } } @@ -63181,7 +63106,7 @@ pub fn vsliq_n_u32(a: uint32x4_t, b: uint32x4_t) -> uint32x4_t { transmute(vshiftins_v4i32( transmute(a), transmute(b), - int32x4_t::splat(N as i32), + int32x4_t::splat(N), )) } } @@ -63719,7 +63644,7 @@ pub fn vsriq_n_s16(a: int16x8_t, b: int16x8_t) -> int16x8_t { #[rustc_legacy_const_generics(2)] pub fn vsri_n_s32(a: int32x2_t, b: int32x2_t) -> int32x2_t { static_assert!(1 <= N && N <= 32); - vshiftins_v2i32(a, b, int32x2_t::splat(-N as i32)) + vshiftins_v2i32(a, b, int32x2_t::splat(-N)) } #[doc = "Shift Right and Insert (immediate)"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vsriq_n_s32)"] @@ -63731,7 +63656,7 @@ pub fn vsri_n_s32(a: int32x2_t, b: int32x2_t) -> int32x2_t { #[rustc_legacy_const_generics(2)] pub fn vsriq_n_s32(a: int32x4_t, b: int32x4_t) -> int32x4_t { static_assert!(1 <= N && N <= 32); - vshiftins_v4i32(a, b, int32x4_t::splat(-N as i32)) + vshiftins_v4i32(a, b, int32x4_t::splat(-N)) } #[doc = "Shift Right and Insert (immediate)"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vsri_n_s64)"] diff --git a/library/stdarch/crates/stdarch-gen-arm/spec/neon/arm_shared.spec.yml b/library/stdarch/crates/stdarch-gen-arm/spec/neon/arm_shared.spec.yml index f6d9103f055b..0264bb938d98 100644 --- a/library/stdarch/crates/stdarch-gen-arm/spec/neon/arm_shared.spec.yml +++ b/library/stdarch/crates/stdarch-gen-arm/spec/neon/arm_shared.spec.yml @@ -7874,9 +7874,9 @@ intrinsics: static_defs: ['const N: i32'] safety: safe types: - - [int16x8_t, int8x8_t, 'N >= 1 && N <= 8', 'const { int16x8_t([-N as i16, -N as i16, -N as i16, -N as i16, -N as i16, -N as i16, -N as i16, -N as i16]) }'] - - [int32x4_t, int16x4_t, 'N >= 1 && N <= 16', 'const { int32x4_t([-N as i32, -N as i32, -N as i32, -N as i32]) }'] - - [int64x2_t, int32x2_t, 'N >= 1 && N <= 32', 'const { int64x2_t([-N as i64, -N as i64]) }'] + - [int16x8_t, int8x8_t, 'N >= 1 && N <= 8', 'const { int16x8_t([-N as i16; 8]) }'] + - [int32x4_t, int16x4_t, 'N >= 1 && N <= 16', 'const { int32x4_t([-N; 4]) }'] + - [int64x2_t, int32x2_t, 'N >= 1 && N <= 32', 'const { int64x2_t([-N as i64; 2]) }'] compose: - FnCall: [static_assert!, ["{type[2]}"]] - LLVMLink: @@ -7929,9 +7929,9 @@ intrinsics: static_defs: ['const N: i32'] safety: safe types: - - [int16x8_t, uint8x8_t, 'N >= 1 && N <= 8', 'const { int16x8_t([-N as i16, -N as i16, -N as i16, -N as i16, -N as i16, -N as i16, -N as i16, -N as i16]) }'] - - [int32x4_t, uint16x4_t, 'N >= 1 && N <= 16', 'const { int32x4_t([-N as i32, -N as i32, -N as i32, -N as i32]) }'] - - [int64x2_t, uint32x2_t, 'N >= 1 && N <= 32', 'const { int64x2_t([-N as i64, -N as i64]) }'] + - [int16x8_t, uint8x8_t, 'N >= 1 && N <= 8', 'const { int16x8_t([-N as i16; 8]) }'] + - [int32x4_t, uint16x4_t, 'N >= 1 && N <= 16', 'const { int32x4_t([-N; 4]) }'] + - [int64x2_t, uint32x2_t, 'N >= 1 && N <= 32', 'const { int64x2_t([-N as i64; 2]) }'] compose: - FnCall: [static_assert!, ["{type[2]}"]] - LLVMLink: @@ -8105,9 +8105,9 @@ intrinsics: static_defs: ['const N: i32'] safety: safe types: - - [int16x8_t, int8x8_t, 'N >= 1 && N <= 8', 'const { int16x8_t([-N as i16, -N as i16, -N as i16, -N as i16, -N as i16, -N as i16, -N as i16, -N as i16]) }'] - - [int32x4_t, int16x4_t, 'N >= 1 && N <= 16', 'const { int32x4_t([-N as i32, -N as i32, -N as i32, -N as i32]) }'] - - [int64x2_t, int32x2_t, 'N >= 1 && N <= 32', 'const { int64x2_t([-N as i64, -N as i64]) }'] + - [int16x8_t, int8x8_t, 'N >= 1 && N <= 8', 'const { int16x8_t([-N as i16; 8]) }'] + - [int32x4_t, int16x4_t, 'N >= 1 && N <= 16', 'const { int32x4_t([-N; 4]) }'] + - [int64x2_t, int32x2_t, 'N >= 1 && N <= 32', 'const { int64x2_t([-N as i64; 2]) }'] compose: - FnCall: [static_assert!, ["{type[2]}"]] - LLVMLink: @@ -8215,9 +8215,9 @@ intrinsics: static_defs: ['const N: i32'] safety: safe types: - - [int16x8_t, uint8x8_t, 'N >= 1 && N <= 8', 'const { int16x8_t([-N as i16, -N as i16, -N as i16, -N as i16, -N as i16, -N as i16, -N as i16, -N as i16]) }'] - - [int32x4_t, uint16x4_t, 'N >= 1 && N <= 16', 'const { int32x4_t([-N as i32, -N as i32, -N as i32, -N as i32]) }'] - - [int64x2_t, uint32x2_t, 'N >= 1 && N <= 32', 'const { int64x2_t([-N as i64, -N as i64]) }'] + - [int16x8_t, uint8x8_t, 'N >= 1 && N <= 8', 'const { int16x8_t([-N as i16; 8]) }'] + - [int32x4_t, uint16x4_t, 'N >= 1 && N <= 16', 'const { int32x4_t([-N; 4]) }'] + - [int64x2_t, uint32x2_t, 'N >= 1 && N <= 32', 'const { int64x2_t([-N as i64; 2]) }'] compose: - FnCall: [static_assert!, ["{type[2]}"]] - LLVMLink: @@ -8939,9 +8939,9 @@ intrinsics: static_defs: ['const N: i32'] safety: safe types: - - [int16x8_t, int8x8_t, 'N >= 1 && N <= 8', 'const { int16x8_t([-N as i16, -N as i16, -N as i16, -N as i16, -N as i16, -N as i16, -N as i16, -N as i16]) }'] - - [int32x4_t, int16x4_t, 'N >= 1 && N <= 16', 'const { int32x4_t([-N as i32, -N as i32, -N as i32, -N as i32]) }'] - - [int64x2_t, int32x2_t, 'N >= 1 && N <= 32', 'const { int64x2_t([-N as i64, -N as i64]) }'] + - [int16x8_t, int8x8_t, 'N >= 1 && N <= 8', 'const { int16x8_t([-N as i16; 8]) }'] + - [int32x4_t, int16x4_t, 'N >= 1 && N <= 16', 'const { int32x4_t([-N; 4]) }'] + - [int64x2_t, int32x2_t, 'N >= 1 && N <= 32', 'const { int64x2_t([-N as i64; 2]) }'] compose: - FnCall: [static_assert!, ["{type[2]}"]] - LLVMLink: @@ -13862,8 +13862,8 @@ intrinsics: - [int8x16_t, '8', '1 <= N && N <= 8', 'v16i8', 'int8x16_t::splat', '-N as i8'] - [int16x4_t, '16', '1 <= N && N <= 16', 'v4i16', 'int16x4_t::splat', '-N as i16'] - [int16x8_t, '16', '1 <= N && N <= 16', 'v8i16', 'int16x8_t::splat', '-N as i16'] - - [int32x2_t, '32', '1 <= N && N <= 32', 'v2i32', 'int32x2_t::splat', '-N as i32'] - - [int32x4_t, '32', '1 <= N && N <= 32', 'v4i32', 'int32x4_t::splat', '-N as i32'] + - [int32x2_t, '32', '1 <= N && N <= 32', 'v2i32', 'int32x2_t::splat', '-N'] + - [int32x4_t, '32', '1 <= N && N <= 32', 'v4i32', 'int32x4_t::splat', '-N'] - [int64x1_t, '64', '1 <= N && N <= 64', 'v1i64', 'int64x1_t::splat', '-N as i64'] - [int64x2_t, '64', '1 <= N && N <= 64', 'v2i64', 'int64x2_t::splat', '-N as i64'] compose: @@ -13891,8 +13891,8 @@ intrinsics: - [uint8x16_t, "neon,v7", '8', 'static_assert_uimm_bits!', 'N, 3', 'v16i8', 'int8x16_t::splat', 'N as i8'] - [uint16x4_t, "neon,v7", '16', 'static_assert_uimm_bits!', 'N, 4', 'v4i16', 'int16x4_t::splat', 'N as i16'] - [uint16x8_t, "neon,v7", '16', 'static_assert_uimm_bits!', 'N, 4', 'v8i16', 'int16x8_t::splat', 'N as i16'] - - [uint32x2_t, "neon,v7", '32', 'static_assert!', 'N >= 0 && N <= 31', 'v2i32', 'int32x2_t::splat', 'N as i32'] - - [uint32x4_t, "neon,v7", '32', 'static_assert!', 'N >= 0 && N <= 31', 'v4i32', 'int32x4_t::splat', 'N as i32'] + - [uint32x2_t, "neon,v7", '32', 'static_assert!', 'N >= 0 && N <= 31', 'v2i32', 'int32x2_t::splat', 'N'] + - [uint32x4_t, "neon,v7", '32', 'static_assert!', 'N >= 0 && N <= 31', 'v4i32', 'int32x4_t::splat', 'N'] - [uint64x1_t, "neon,v7", '64', 'static_assert!', 'N >= 0 && N <= 63', 'v1i64', 'int64x1_t::splat', 'N as i64'] - [uint64x2_t, "neon,v7", '64', 'static_assert!', 'N >= 0 && N <= 63', 'v2i64', 'int64x2_t::splat', 'N as i64'] - [poly8x8_t, "neon,v7", '8', 'static_assert_uimm_bits!', 'N, 3', 'v8i8', 'int8x8_t::splat', 'N as i8'] From beb1b7d1a8db453d31f324a6e3d036a7624fba55 Mon Sep 17 00:00:00 2001 From: Marijn Schouten Date: Fri, 11 Jul 2025 13:07:52 +0000 Subject: [PATCH 014/139] connect5: clippy fixes --- library/stdarch/examples/connect5.rs | 37 +++++++++------------------- 1 file changed, 12 insertions(+), 25 deletions(-) diff --git a/library/stdarch/examples/connect5.rs b/library/stdarch/examples/connect5.rs index 2b451f45d71c..1d8e0f0990a6 100644 --- a/library/stdarch/examples/connect5.rs +++ b/library/stdarch/examples/connect5.rs @@ -558,7 +558,8 @@ fn search(pos: &Pos, alpha: i32, beta: i32, depth: i32, _ply: i32) -> i32 { assert_ne!(bm, MOVE_NONE); assert!(bs >= -EVAL_INF && bs <= EVAL_INF); - if _ply == 0 { bm } else { bs } //best move at the root node, best score elsewhere + // best move at the root node, best score elsewhere + if _ply == 0 { bm } else { bs } } /// Evaluation function: give different scores to different patterns after a fixed depth. @@ -570,15 +571,11 @@ fn eval(pos: &Pos, _ply: i32) -> i32 { #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] { if check_x86_avx512_features() { - unsafe { - if check_patternlive4_avx512(pos, def) { - return -4096; - } - } - } else { - if check_patternlive4(pos, def) { + if unsafe { check_patternlive4_avx512(pos, def) } { return -4096; } + } else if check_patternlive4(pos, def) { + return -4096; } } @@ -593,15 +590,11 @@ fn eval(pos: &Pos, _ply: i32) -> i32 { #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] { if check_x86_avx512_features() { - unsafe { - if check_patternlive4_avx512(pos, atk) { - return 2560; - } - } - } else { - if check_patternlive4(pos, atk) { + if unsafe { check_patternlive4_avx512(pos, atk) } { return 2560; } + } else if check_patternlive4(pos, atk) { + return 2560; } } @@ -616,15 +609,11 @@ fn eval(pos: &Pos, _ply: i32) -> i32 { #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] { if check_x86_avx512_features() { - unsafe { - if check_patterndead4_avx512(pos, atk) > 0 { - return 2560; - } - } - } else { - if check_patterndead4(pos, atk) > 0 { + if unsafe { check_patterndead4_avx512(pos, atk) > 0 } { return 2560; } + } else if check_patterndead4(pos, atk) > 0 { + return 2560; } } @@ -909,9 +898,7 @@ fn pos_is_winner_avx512(pos: &Pos) -> bool { 0b00_10_10_10_10_11_10_10_10_10_11_11_11_11_11_10]; let mut count_match: i32 = 0; - for dir in 0..2 { - // direction 0 and 1 - let mut board0 = board0org[dir]; + for mut board0 in board0org { let boardf = _mm512_and_si512(answer, board0); let temp_mask = _mm512_mask_cmpeq_epi16_mask(answer_mask[0], answer, boardf); count_match += _popcnt32(temp_mask as i32); From 30556edc579a80ce1f206db0559c758c520b9e83 Mon Sep 17 00:00:00 2001 From: Marijn Schouten Date: Fri, 11 Jul 2025 17:57:11 +0000 Subject: [PATCH 015/139] tests: neon is arm --- library/stdarch/crates/simd-test-macro/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/stdarch/crates/simd-test-macro/src/lib.rs b/library/stdarch/crates/simd-test-macro/src/lib.rs index 855e969e1eb7..aa36cb928a41 100644 --- a/library/stdarch/crates/simd-test-macro/src/lib.rs +++ b/library/stdarch/crates/simd-test-macro/src/lib.rs @@ -57,7 +57,7 @@ pub fn simd_test( .unwrap_or_else(|| panic!("target triple contained no \"-\": {target}")) { "i686" | "x86_64" | "i586" => "is_x86_feature_detected", - "arm" | "armv7" => "is_arm_feature_detected", + "arm" | "armv7" | "thumbv7neon" => "is_arm_feature_detected", "aarch64" | "arm64ec" | "aarch64_be" => "is_aarch64_feature_detected", maybe_riscv if maybe_riscv.starts_with("riscv") => "is_riscv_feature_detected", "powerpc" | "powerpcle" => "is_powerpc_feature_detected", From d6feec7735f78f1d87e103ff25806d9147afc4a9 Mon Sep 17 00:00:00 2001 From: Folkert de Vries Date: Sat, 12 Jul 2025 00:49:36 +0200 Subject: [PATCH 016/139] `stdarch-gen-arm`: remove `lazy_static`, use `LazyLock` instead --- library/stdarch/Cargo.lock | 1 - .../stdarch/crates/stdarch-gen-arm/Cargo.toml | 1 - .../crates/stdarch-gen-arm/src/expression.rs | 8 +++----- .../stdarch-gen-arm/src/load_store_tests.rs | 20 ++++++++----------- .../crates/stdarch-gen-arm/src/typekinds.rs | 13 ++++++------ .../crates/stdarch-gen-arm/src/wildcards.rs | 9 ++++----- 6 files changed, 21 insertions(+), 31 deletions(-) diff --git a/library/stdarch/Cargo.lock b/library/stdarch/Cargo.lock index 80f424dfdd8d..4bdd423270c8 100644 --- a/library/stdarch/Cargo.lock +++ b/library/stdarch/Cargo.lock @@ -703,7 +703,6 @@ name = "stdarch-gen-arm" version = "0.1.0" dependencies = [ "itertools", - "lazy_static", "proc-macro2", "quote", "regex", diff --git a/library/stdarch/crates/stdarch-gen-arm/Cargo.toml b/library/stdarch/crates/stdarch-gen-arm/Cargo.toml index 899296d25ea7..312019f454cb 100644 --- a/library/stdarch/crates/stdarch-gen-arm/Cargo.toml +++ b/library/stdarch/crates/stdarch-gen-arm/Cargo.toml @@ -13,7 +13,6 @@ edition = "2024" [dependencies] itertools = "0.14.0" -lazy_static = "1.4.0" proc-macro2 = "1.0" quote = "1.0" regex = "1.5" diff --git a/library/stdarch/crates/stdarch-gen-arm/src/expression.rs b/library/stdarch/crates/stdarch-gen-arm/src/expression.rs index 56c94602fff9..d5644ef27d4b 100644 --- a/library/stdarch/crates/stdarch-gen-arm/src/expression.rs +++ b/library/stdarch/crates/stdarch-gen-arm/src/expression.rs @@ -1,5 +1,4 @@ use itertools::Itertools; -use lazy_static::lazy_static; use proc_macro2::{Literal, Punct, Spacing, TokenStream}; use quote::{ToTokens, TokenStreamExt, format_ident, quote}; use regex::Regex; @@ -7,6 +6,7 @@ use serde::de::{self, MapAccess, Visitor}; use serde::{Deserialize, Deserializer, Serialize}; use std::fmt; use std::str::FromStr; +use std::sync::LazyLock; use crate::intrinsic::Intrinsic; use crate::wildstring::WildStringPart; @@ -374,10 +374,8 @@ impl FromStr for Expression { type Err = String; fn from_str(s: &str) -> Result { - lazy_static! { - static ref MACRO_RE: Regex = - Regex::new(r"^(?P[\w\d_]+)!\((?P.*?)\);?$").unwrap(); - } + static MACRO_RE: LazyLock = + LazyLock::new(|| Regex::new(r"^(?P[\w\d_]+)!\((?P.*?)\);?$").unwrap()); if s == "SvUndef" { Ok(Expression::SvUndef) diff --git a/library/stdarch/crates/stdarch-gen-arm/src/load_store_tests.rs b/library/stdarch/crates/stdarch-gen-arm/src/load_store_tests.rs index 5cf39b2e11ae..3f3bfed132c7 100644 --- a/library/stdarch/crates/stdarch-gen-arm/src/load_store_tests.rs +++ b/library/stdarch/crates/stdarch-gen-arm/src/load_store_tests.rs @@ -2,6 +2,7 @@ use std::fs::File; use std::io::Write; use std::path::PathBuf; use std::str::FromStr; +use std::sync::LazyLock; use crate::format_code; use crate::input::InputType; @@ -10,7 +11,6 @@ use crate::typekinds::BaseType; use crate::typekinds::{ToRepr, TypeKind}; use itertools::Itertools; -use lazy_static::lazy_static; use proc_macro2::TokenStream; use quote::{format_ident, quote}; @@ -639,8 +639,8 @@ impl LdIntrCharacteristics { } } -lazy_static! { - static ref PREAMBLE: String = format!( +static PREAMBLE: LazyLock = LazyLock::new(|| { + format!( r#"#![allow(unused)] use super::*; @@ -801,13 +801,11 @@ fn assert_vector_matches_u64(vector: svuint64_t, expected: svuint64_t) {{ assert!(!svptest_any(defined, cmp)) }} "# - ); -} + ) +}); -lazy_static! { - static ref MANUAL_TESTS: String = format!( - "#[simd_test(enable = \"sve\")] -unsafe fn test_ffr() {{ +const MANUAL_TESTS: &str = "#[simd_test(enable = \"sve\")] +unsafe fn test_ffr() { svsetffr(); let ffr = svrdffr(); assert_vector_matches_u8(svdup_n_u8_z(ffr, 1), svindex_u8(1, 0)); @@ -816,7 +814,5 @@ unsafe fn test_ffr() {{ svwrffr(pred); let ffr = svrdffr_z(svptrue_b8()); assert_vector_matches_u8(svdup_n_u8_z(ffr, 1), svdup_n_u8_z(pred, 1)); -}} -" - ); } +"; diff --git a/library/stdarch/crates/stdarch-gen-arm/src/typekinds.rs b/library/stdarch/crates/stdarch-gen-arm/src/typekinds.rs index 7c697cb7c0c4..bd47ff2bd155 100644 --- a/library/stdarch/crates/stdarch-gen-arm/src/typekinds.rs +++ b/library/stdarch/crates/stdarch-gen-arm/src/typekinds.rs @@ -1,10 +1,10 @@ -use lazy_static::lazy_static; use proc_macro2::TokenStream; use quote::{ToTokens, TokenStreamExt, quote}; use regex::Regex; use serde_with::{DeserializeFromStr, SerializeDisplay}; use std::fmt; use std::str::FromStr; +use std::sync::LazyLock; use crate::context; use crate::expression::{Expression, FnCall}; @@ -496,9 +496,9 @@ impl FromStr for VectorType { type Err = String; fn from_str(s: &str) -> Result { - lazy_static! { - static ref RE: Regex = Regex::new(r"^(?:(?:sv(?P(?:uint|int|bool|float)(?:\d+)?))|(?:(?P(?:uint|int|bool|poly|float)(?:\d+)?)x(?P(?:\d+)?)))(?:x(?P2|3|4))?_t$").unwrap(); - } + static RE: LazyLock = LazyLock::new(|| { + Regex::new(r"^(?:(?:sv(?P(?:uint|int|bool|float)(?:\d+)?))|(?:(?P(?:uint|int|bool|poly|float)(?:\d+)?)x(?P(?:\d+)?)))(?:x(?P2|3|4))?_t$").unwrap() + }); if let Some(c) = RE.captures(s) { let (base_type, lanes) = Self::sanitise_lanes( @@ -698,9 +698,8 @@ impl FromStr for BaseType { type Err = String; fn from_str(s: &str) -> Result { - lazy_static! { - static ref RE: Regex = Regex::new(r"^(?P[a-zA-Z]+)(?P\d+)?(_t)?$").unwrap(); - } + static RE: LazyLock = + LazyLock::new(|| Regex::new(r"^(?P[a-zA-Z]+)(?P\d+)?(_t)?$").unwrap()); if let Some(c) = RE.captures(s) { let kind = c["kind"].parse()?; diff --git a/library/stdarch/crates/stdarch-gen-arm/src/wildcards.rs b/library/stdarch/crates/stdarch-gen-arm/src/wildcards.rs index 25aa80348927..6c40d88df45f 100644 --- a/library/stdarch/crates/stdarch-gen-arm/src/wildcards.rs +++ b/library/stdarch/crates/stdarch-gen-arm/src/wildcards.rs @@ -1,8 +1,7 @@ -use lazy_static::lazy_static; use regex::Regex; use serde_with::{DeserializeFromStr, SerializeDisplay}; -use std::fmt; use std::str::FromStr; +use std::{fmt, sync::LazyLock}; use crate::{ fn_suffix::SuffixKind, @@ -66,9 +65,9 @@ impl FromStr for Wildcard { type Err = String; fn from_str(s: &str) -> Result { - lazy_static! { - static ref RE: Regex = Regex::new(r"^(?P\w+?)(?:_x(?P[2-4]))?(?:\[(?P\d+)\])?(?:\.(?P\w+))?(?:\s+as\s+(?P.*?))?$").unwrap(); - } + static RE: LazyLock = LazyLock::new(|| { + Regex::new(r"^(?P\w+?)(?:_x(?P[2-4]))?(?:\[(?P\d+)\])?(?:\.(?P\w+))?(?:\s+as\s+(?P.*?))?$").unwrap() + }); if let Some(c) = RE.captures(s) { let wildcard_name = &c["wildcard"]; From 9de6e2c5477f56031b5737257f2213ba96e794ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Sat, 12 Jul 2025 16:21:32 +0200 Subject: [PATCH 017/139] Add rustc-pull CI automation --- .../stdarch/.github/workflows/rustc-pull.yml | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 library/stdarch/.github/workflows/rustc-pull.yml diff --git a/library/stdarch/.github/workflows/rustc-pull.yml b/library/stdarch/.github/workflows/rustc-pull.yml new file mode 100644 index 000000000000..6b90d8a500f0 --- /dev/null +++ b/library/stdarch/.github/workflows/rustc-pull.yml @@ -0,0 +1,22 @@ +# Perform a subtree sync (pull) using the josh-sync tool once every few days (or on demand). +name: rustc-pull + +on: + workflow_dispatch: + schedule: + # Run at 04:00 UTC every Monday and Thursday + - cron: '0 4 * * 1,4' + +jobs: + pull: + if: github.repository == 'rust-lang/stdarch' + uses: rust-lang/josh-sync/.github/workflows/rustc-pull.yml@main + with: + # https://rust-lang.zulipchat.com/#narrow/channel/208962-t-libs.2Fstdarch/topic/Subtree.20sync.20automation/with/528461782 + zulip-stream-id: 208962 + zulip-bot-email: "stdarch-ci-bot@rust-lang.zulipchat.com" + pr-base-branch: master + branch-name: rustc-pull + secrets: + zulip-api-token: ${{ secrets.ZULIP_API_TOKEN }} + token: ${{ secrets.GITHUB_TOKEN }} From ca70466fa37bbd5233ea154d81cc51e7f8ceb3c9 Mon Sep 17 00:00:00 2001 From: Folkert de Vries Date: Sat, 12 Jul 2025 16:42:12 +0200 Subject: [PATCH 018/139] `aarch64`: use `f16::min` and `f16::max` --- .../core_arch/src/aarch64/neon/generated.rs | 18 ++---------------- .../stdarch-gen-arm/spec/neon/aarch64.spec.yml | 12 ++---------- 2 files changed, 4 insertions(+), 26 deletions(-) diff --git a/library/stdarch/crates/core_arch/src/aarch64/neon/generated.rs b/library/stdarch/crates/core_arch/src/aarch64/neon/generated.rs index 32f144bc7adc..052e5762297a 100644 --- a/library/stdarch/crates/core_arch/src/aarch64/neon/generated.rs +++ b/library/stdarch/crates/core_arch/src/aarch64/neon/generated.rs @@ -13261,14 +13261,7 @@ pub fn vmaxnmq_f64(a: float64x2_t, b: float64x2_t) -> float64x2_t { #[unstable(feature = "stdarch_neon_f16", issue = "136306")] #[cfg_attr(test, assert_instr(fmaxnm))] pub fn vmaxnmh_f16(a: f16, b: f16) -> f16 { - unsafe extern "unadjusted" { - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.fmaxnm.f16" - )] - fn _vmaxnmh_f16(a: f16, b: f16) -> f16; - } - unsafe { _vmaxnmh_f16(a, b) } + f16::max(a, b) } #[doc = "Floating-point maximum number across vector"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vmaxnmv_f16)"] @@ -13709,14 +13702,7 @@ pub fn vminnmq_f64(a: float64x2_t, b: float64x2_t) -> float64x2_t { #[unstable(feature = "stdarch_neon_f16", issue = "136306")] #[cfg_attr(test, assert_instr(fminnm))] pub fn vminnmh_f16(a: f16, b: f16) -> f16 { - unsafe extern "unadjusted" { - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.fminnm.f16" - )] - fn _vminnmh_f16(a: f16, b: f16) -> f16; - } - unsafe { _vminnmh_f16(a, b) } + f16::min(a, b) } #[doc = "Floating-point minimum number across vector"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vminnmv_f16)"] diff --git a/library/stdarch/crates/stdarch-gen-arm/spec/neon/aarch64.spec.yml b/library/stdarch/crates/stdarch-gen-arm/spec/neon/aarch64.spec.yml index f0dce681d9c3..2f9bf587872b 100644 --- a/library/stdarch/crates/stdarch-gen-arm/spec/neon/aarch64.spec.yml +++ b/library/stdarch/crates/stdarch-gen-arm/spec/neon/aarch64.spec.yml @@ -6611,11 +6611,7 @@ intrinsics: types: - f16 compose: - - LLVMLink: - name: "vmaxh.{neon_type}" - links: - - link: "llvm.aarch64.neon.fmaxnm.{type}" - arch: aarch64,arm64ec + - FnCall: ["f16::max", [a, b]] - name: "vminnmh_{type}" @@ -6630,11 +6626,7 @@ intrinsics: types: - f16 compose: - - LLVMLink: - name: "vminh.{neon_type}" - links: - - link: "llvm.aarch64.neon.fminnm.{type}" - arch: aarch64,arm64ec + - FnCall: ["f16::min", [a, b]] - name: "vmaxnmv{neon_type[0].no}" From 441824cfcad6c42069577c599e51707812b27a6c Mon Sep 17 00:00:00 2001 From: Folkert de Vries Date: Sat, 12 Jul 2025 16:45:51 +0200 Subject: [PATCH 019/139] `aarch64`: use `simd_fmin` and `simd_fmax` --- .../core_arch/src/aarch64/neon/generated.rs | 36 +++---------------- .../spec/neon/aarch64.spec.yml | 13 ++----- 2 files changed, 6 insertions(+), 43 deletions(-) diff --git a/library/stdarch/crates/core_arch/src/aarch64/neon/generated.rs b/library/stdarch/crates/core_arch/src/aarch64/neon/generated.rs index 052e5762297a..e888346a0818 100644 --- a/library/stdarch/crates/core_arch/src/aarch64/neon/generated.rs +++ b/library/stdarch/crates/core_arch/src/aarch64/neon/generated.rs @@ -13229,14 +13229,7 @@ pub fn vmaxh_f16(a: f16, b: f16) -> f16 { #[stable(feature = "neon_intrinsics", since = "1.59.0")] #[cfg_attr(test, assert_instr(fmaxnm))] pub fn vmaxnm_f64(a: float64x1_t, b: float64x1_t) -> float64x1_t { - unsafe extern "unadjusted" { - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.fmaxnm.v1f64" - )] - fn _vmaxnm_f64(a: float64x1_t, b: float64x1_t) -> float64x1_t; - } - unsafe { _vmaxnm_f64(a, b) } + unsafe { simd_fmax(a, b) } } #[doc = "Floating-point Maximum Number (vector)"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vmaxnmq_f64)"] @@ -13245,14 +13238,7 @@ pub fn vmaxnm_f64(a: float64x1_t, b: float64x1_t) -> float64x1_t { #[stable(feature = "neon_intrinsics", since = "1.59.0")] #[cfg_attr(test, assert_instr(fmaxnm))] pub fn vmaxnmq_f64(a: float64x2_t, b: float64x2_t) -> float64x2_t { - unsafe extern "unadjusted" { - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.fmaxnm.v2f64" - )] - fn _vmaxnmq_f64(a: float64x2_t, b: float64x2_t) -> float64x2_t; - } - unsafe { _vmaxnmq_f64(a, b) } + unsafe { simd_fmax(a, b) } } #[doc = "Floating-point Maximum Number"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vmaxnmh_f16)"] @@ -13670,14 +13656,7 @@ pub fn vminh_f16(a: f16, b: f16) -> f16 { #[stable(feature = "neon_intrinsics", since = "1.59.0")] #[cfg_attr(test, assert_instr(fminnm))] pub fn vminnm_f64(a: float64x1_t, b: float64x1_t) -> float64x1_t { - unsafe extern "unadjusted" { - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.fminnm.v1f64" - )] - fn _vminnm_f64(a: float64x1_t, b: float64x1_t) -> float64x1_t; - } - unsafe { _vminnm_f64(a, b) } + unsafe { simd_fmin(a, b) } } #[doc = "Floating-point Minimum Number (vector)"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vminnmq_f64)"] @@ -13686,14 +13665,7 @@ pub fn vminnm_f64(a: float64x1_t, b: float64x1_t) -> float64x1_t { #[stable(feature = "neon_intrinsics", since = "1.59.0")] #[cfg_attr(test, assert_instr(fminnm))] pub fn vminnmq_f64(a: float64x2_t, b: float64x2_t) -> float64x2_t { - unsafe extern "unadjusted" { - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.fminnm.v2f64" - )] - fn _vminnmq_f64(a: float64x2_t, b: float64x2_t) -> float64x2_t; - } - unsafe { _vminnmq_f64(a, b) } + unsafe { simd_fmin(a, b) } } #[doc = "Floating-point Minimum Number"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vminnmh_f16)"] diff --git a/library/stdarch/crates/stdarch-gen-arm/spec/neon/aarch64.spec.yml b/library/stdarch/crates/stdarch-gen-arm/spec/neon/aarch64.spec.yml index 2f9bf587872b..821dc52bf37d 100644 --- a/library/stdarch/crates/stdarch-gen-arm/spec/neon/aarch64.spec.yml +++ b/library/stdarch/crates/stdarch-gen-arm/spec/neon/aarch64.spec.yml @@ -6580,7 +6580,6 @@ intrinsics: arch: aarch64,arm64ec - - name: "vmaxnm{neon_type.no}" doc: Floating-point Maximum Number (vector) arguments: ["a: {neon_type}", "b: {neon_type}"] @@ -6592,11 +6591,7 @@ intrinsics: - float64x1_t - float64x2_t compose: - - LLVMLink: - name: "fmaxnm.{neon_type}" - links: - - link: "llvm.aarch64.neon.fmaxnm.{neon_type}" - arch: aarch64,arm64ec + - FnCall: [simd_fmax, [a, b]] - name: "vmaxnmh_{type}" @@ -6806,11 +6801,7 @@ intrinsics: - float64x1_t - float64x2_t compose: - - LLVMLink: - name: "fminnm.{neon_type}" - links: - - link: "llvm.aarch64.neon.fminnm.{neon_type}" - arch: aarch64,arm64ec + - FnCall: [simd_fmin, [a, b]] - name: "vminnmv{neon_type[0].no}" doc: "Floating-point minimum number across vector" From 72afae5fd640b84d64462ade413f4077db9c01b4 Mon Sep 17 00:00:00 2001 From: Folkert de Vries Date: Sat, 12 Jul 2025 16:49:52 +0200 Subject: [PATCH 020/139] `arm`: use `simd_fmin` and `simd_fmax` --- .../src/arm_shared/neon/generated.rs | 80 ++----------------- .../spec/neon/arm_shared.spec.yml | 32 +------- 2 files changed, 12 insertions(+), 100 deletions(-) diff --git a/library/stdarch/crates/core_arch/src/arm_shared/neon/generated.rs b/library/stdarch/crates/core_arch/src/arm_shared/neon/generated.rs index b61d57777783..40ccd7eb727d 100644 --- a/library/stdarch/crates/core_arch/src/arm_shared/neon/generated.rs +++ b/library/stdarch/crates/core_arch/src/arm_shared/neon/generated.rs @@ -27942,15 +27942,7 @@ pub fn vmaxq_u32(a: uint32x4_t, b: uint32x4_t) -> uint32x4_t { #[target_feature(enable = "neon,fp16")] #[unstable(feature = "stdarch_neon_f16", issue = "136306")] pub fn vmaxnm_f16(a: float16x4_t, b: float16x4_t) -> float16x4_t { - unsafe extern "unadjusted" { - #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vmaxnm.v4f16")] - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.fmaxnm.v4f16" - )] - fn _vmaxnm_f16(a: float16x4_t, b: float16x4_t) -> float16x4_t; - } - unsafe { _vmaxnm_f16(a, b) } + unsafe { simd_fmax(a, b) } } #[doc = "Floating-point Maximum Number (vector)"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vmaxnmq_f16)"] @@ -27964,15 +27956,7 @@ pub fn vmaxnm_f16(a: float16x4_t, b: float16x4_t) -> float16x4_t { #[target_feature(enable = "neon,fp16")] #[unstable(feature = "stdarch_neon_f16", issue = "136306")] pub fn vmaxnmq_f16(a: float16x8_t, b: float16x8_t) -> float16x8_t { - unsafe extern "unadjusted" { - #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vmaxnm.v8f16")] - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.fmaxnm.v8f16" - )] - fn _vmaxnmq_f16(a: float16x8_t, b: float16x8_t) -> float16x8_t; - } - unsafe { _vmaxnmq_f16(a, b) } + unsafe { simd_fmax(a, b) } } #[doc = "Floating-point Maximum Number (vector)"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vmaxnm_f32)"] @@ -27993,15 +27977,7 @@ pub fn vmaxnmq_f16(a: float16x8_t, b: float16x8_t) -> float16x8_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub fn vmaxnm_f32(a: float32x2_t, b: float32x2_t) -> float32x2_t { - unsafe extern "unadjusted" { - #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vmaxnm.v2f32")] - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.fmaxnm.v2f32" - )] - fn _vmaxnm_f32(a: float32x2_t, b: float32x2_t) -> float32x2_t; - } - unsafe { _vmaxnm_f32(a, b) } + unsafe { simd_fmax(a, b) } } #[doc = "Floating-point Maximum Number (vector)"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vmaxnmq_f32)"] @@ -28022,15 +27998,7 @@ pub fn vmaxnm_f32(a: float32x2_t, b: float32x2_t) -> float32x2_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub fn vmaxnmq_f32(a: float32x4_t, b: float32x4_t) -> float32x4_t { - unsafe extern "unadjusted" { - #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vmaxnm.v4f32")] - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.fmaxnm.v4f32" - )] - fn _vmaxnmq_f32(a: float32x4_t, b: float32x4_t) -> float32x4_t; - } - unsafe { _vmaxnmq_f32(a, b) } + unsafe { simd_fmax(a, b) } } #[doc = "Minimum (vector)"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vmin_f16)"] @@ -28434,15 +28402,7 @@ pub fn vminq_u32(a: uint32x4_t, b: uint32x4_t) -> uint32x4_t { #[target_feature(enable = "neon,fp16")] #[unstable(feature = "stdarch_neon_f16", issue = "136306")] pub fn vminnm_f16(a: float16x4_t, b: float16x4_t) -> float16x4_t { - unsafe extern "unadjusted" { - #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vminnm.v4f16")] - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.fminnm.v4f16" - )] - fn _vminnm_f16(a: float16x4_t, b: float16x4_t) -> float16x4_t; - } - unsafe { _vminnm_f16(a, b) } + unsafe { simd_fmin(a, b) } } #[doc = "Floating-point Minimum Number (vector)"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vminnmq_f16)"] @@ -28456,15 +28416,7 @@ pub fn vminnm_f16(a: float16x4_t, b: float16x4_t) -> float16x4_t { #[target_feature(enable = "neon,fp16")] #[unstable(feature = "stdarch_neon_f16", issue = "136306")] pub fn vminnmq_f16(a: float16x8_t, b: float16x8_t) -> float16x8_t { - unsafe extern "unadjusted" { - #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vminnm.v8f16")] - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.fminnm.v8f16" - )] - fn _vminnmq_f16(a: float16x8_t, b: float16x8_t) -> float16x8_t; - } - unsafe { _vminnmq_f16(a, b) } + unsafe { simd_fmin(a, b) } } #[doc = "Floating-point Minimum Number (vector)"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vminnm_f32)"] @@ -28485,15 +28437,7 @@ pub fn vminnmq_f16(a: float16x8_t, b: float16x8_t) -> float16x8_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub fn vminnm_f32(a: float32x2_t, b: float32x2_t) -> float32x2_t { - unsafe extern "unadjusted" { - #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vminnm.v2f32")] - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.fminnm.v2f32" - )] - fn _vminnm_f32(a: float32x2_t, b: float32x2_t) -> float32x2_t; - } - unsafe { _vminnm_f32(a, b) } + unsafe { simd_fmin(a, b) } } #[doc = "Floating-point Minimum Number (vector)"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vminnmq_f32)"] @@ -28514,15 +28458,7 @@ pub fn vminnm_f32(a: float32x2_t, b: float32x2_t) -> float32x2_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub fn vminnmq_f32(a: float32x4_t, b: float32x4_t) -> float32x4_t { - unsafe extern "unadjusted" { - #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vminnm.v4f32")] - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.fminnm.v4f32" - )] - fn _vminnmq_f32(a: float32x4_t, b: float32x4_t) -> float32x4_t; - } - unsafe { _vminnmq_f32(a, b) } + unsafe { simd_fmin(a, b) } } #[doc = "Floating-point multiply-add to accumulator"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vmla_f32)"] diff --git a/library/stdarch/crates/stdarch-gen-arm/spec/neon/arm_shared.spec.yml b/library/stdarch/crates/stdarch-gen-arm/spec/neon/arm_shared.spec.yml index c836a47a7409..814d4d998402 100644 --- a/library/stdarch/crates/stdarch-gen-arm/spec/neon/arm_shared.spec.yml +++ b/library/stdarch/crates/stdarch-gen-arm/spec/neon/arm_shared.spec.yml @@ -7223,13 +7223,7 @@ intrinsics: - float32x2_t - float32x4_t compose: - - LLVMLink: - name: "fmaxnm.{neon_type}" - links: - - link: "llvm.arm.neon.vmaxnm.{neon_type}" - arch: arm - - link: "llvm.aarch64.neon.fmaxnm.{neon_type}" - arch: aarch64,arm64ec + - FnCall: [simd_fmax, [a, b]] - name: "vmaxnm{neon_type.no}" @@ -7247,13 +7241,7 @@ intrinsics: - float16x4_t - float16x8_t compose: - - LLVMLink: - name: "fmaxnm.{neon_type}" - links: - - link: "llvm.arm.neon.vmaxnm.{neon_type}" - arch: arm - - link: "llvm.aarch64.neon.fmaxnm.{neon_type}" - arch: aarch64,arm64ec + - FnCall: [simd_fmax, [a, b]] - name: "vminnm{neon_type.no}" @@ -7271,13 +7259,7 @@ intrinsics: - float16x4_t - float16x8_t compose: - - LLVMLink: - name: "fminnm.{neon_type}" - links: - - link: "llvm.arm.neon.vminnm.{neon_type}" - arch: arm - - link: "llvm.aarch64.neon.fminnm.{neon_type}" - arch: aarch64,arm64ec + - FnCall: [simd_fmin, [a, b]] - name: "vmin{neon_type.no}" @@ -7388,13 +7370,7 @@ intrinsics: - float32x2_t - float32x4_t compose: - - LLVMLink: - name: "fminnm.{neon_type}" - links: - - link: "llvm.arm.neon.vminnm.{neon_type}" - arch: arm - - link: "llvm.aarch64.neon.fminnm.{neon_type}" - arch: aarch64,arm64ec + - FnCall: [simd_fmin, [a, b]] - name: "vpadd{neon_type.no}" doc: Floating-point add pairwise From 750ddfd8d34bada5b07f32eb22cb9aef8a6556eb Mon Sep 17 00:00:00 2001 From: Folkert de Vries Date: Sat, 12 Jul 2025 17:22:46 +0200 Subject: [PATCH 021/139] `aarch64`: use `simd_reduce_min` and `simd_reduce_max` for floats --- .../core_arch/src/aarch64/neon/generated.rs | 90 +++---------------- .../spec/neon/aarch64.spec.yml | 36 ++------ 2 files changed, 16 insertions(+), 110 deletions(-) diff --git a/library/stdarch/crates/core_arch/src/aarch64/neon/generated.rs b/library/stdarch/crates/core_arch/src/aarch64/neon/generated.rs index e888346a0818..0be902dbf2aa 100644 --- a/library/stdarch/crates/core_arch/src/aarch64/neon/generated.rs +++ b/library/stdarch/crates/core_arch/src/aarch64/neon/generated.rs @@ -13256,14 +13256,7 @@ pub fn vmaxnmh_f16(a: f16, b: f16) -> f16 { #[unstable(feature = "stdarch_neon_f16", issue = "136306")] #[cfg_attr(test, assert_instr(fmaxnmv))] pub fn vmaxnmv_f16(a: float16x4_t) -> f16 { - unsafe extern "unadjusted" { - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.fmaxnmv.f16.v4f16" - )] - fn _vmaxnmv_f16(a: float16x4_t) -> f16; - } - unsafe { _vmaxnmv_f16(a) } + unsafe { simd_reduce_max(a) } } #[doc = "Floating-point maximum number across vector"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vmaxnmvq_f16)"] @@ -13272,14 +13265,7 @@ pub fn vmaxnmv_f16(a: float16x4_t) -> f16 { #[unstable(feature = "stdarch_neon_f16", issue = "136306")] #[cfg_attr(test, assert_instr(fmaxnmv))] pub fn vmaxnmvq_f16(a: float16x8_t) -> f16 { - unsafe extern "unadjusted" { - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.fmaxnmv.f16.v8f16" - )] - fn _vmaxnmvq_f16(a: float16x8_t) -> f16; - } - unsafe { _vmaxnmvq_f16(a) } + unsafe { simd_reduce_max(a) } } #[doc = "Floating-point maximum number across vector"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vmaxnmv_f32)"] @@ -13288,14 +13274,7 @@ pub fn vmaxnmvq_f16(a: float16x8_t) -> f16 { #[stable(feature = "neon_intrinsics", since = "1.59.0")] #[cfg_attr(test, assert_instr(fmaxnmp))] pub fn vmaxnmv_f32(a: float32x2_t) -> f32 { - unsafe extern "unadjusted" { - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.fmaxnmv.f32.v2f32" - )] - fn _vmaxnmv_f32(a: float32x2_t) -> f32; - } - unsafe { _vmaxnmv_f32(a) } + unsafe { simd_reduce_max(a) } } #[doc = "Floating-point maximum number across vector"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vmaxnmvq_f64)"] @@ -13304,14 +13283,7 @@ pub fn vmaxnmv_f32(a: float32x2_t) -> f32 { #[stable(feature = "neon_intrinsics", since = "1.59.0")] #[cfg_attr(test, assert_instr(fmaxnmp))] pub fn vmaxnmvq_f64(a: float64x2_t) -> f64 { - unsafe extern "unadjusted" { - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.fmaxnmv.f64.v2f64" - )] - fn _vmaxnmvq_f64(a: float64x2_t) -> f64; - } - unsafe { _vmaxnmvq_f64(a) } + unsafe { simd_reduce_max(a) } } #[doc = "Floating-point maximum number across vector"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vmaxnmvq_f32)"] @@ -13320,14 +13292,7 @@ pub fn vmaxnmvq_f64(a: float64x2_t) -> f64 { #[stable(feature = "neon_intrinsics", since = "1.59.0")] #[cfg_attr(test, assert_instr(fmaxnmv))] pub fn vmaxnmvq_f32(a: float32x4_t) -> f32 { - unsafe extern "unadjusted" { - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.fmaxnmv.f32.v4f32" - )] - fn _vmaxnmvq_f32(a: float32x4_t) -> f32; - } - unsafe { _vmaxnmvq_f32(a) } + unsafe { simd_reduce_max(a) } } #[doc = "Floating-point maximum number across vector"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vmaxv_f16)"] @@ -13683,14 +13648,7 @@ pub fn vminnmh_f16(a: f16, b: f16) -> f16 { #[unstable(feature = "stdarch_neon_f16", issue = "136306")] #[cfg_attr(test, assert_instr(fminnmv))] pub fn vminnmv_f16(a: float16x4_t) -> f16 { - unsafe extern "unadjusted" { - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.fminnmv.f16.v4f16" - )] - fn _vminnmv_f16(a: float16x4_t) -> f16; - } - unsafe { _vminnmv_f16(a) } + unsafe { simd_reduce_min(a) } } #[doc = "Floating-point minimum number across vector"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vminnmvq_f16)"] @@ -13699,14 +13657,7 @@ pub fn vminnmv_f16(a: float16x4_t) -> f16 { #[unstable(feature = "stdarch_neon_f16", issue = "136306")] #[cfg_attr(test, assert_instr(fminnmv))] pub fn vminnmvq_f16(a: float16x8_t) -> f16 { - unsafe extern "unadjusted" { - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.fminnmv.f16.v8f16" - )] - fn _vminnmvq_f16(a: float16x8_t) -> f16; - } - unsafe { _vminnmvq_f16(a) } + unsafe { simd_reduce_min(a) } } #[doc = "Floating-point minimum number across vector"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vminnmv_f32)"] @@ -13715,14 +13666,7 @@ pub fn vminnmvq_f16(a: float16x8_t) -> f16 { #[cfg_attr(test, assert_instr(fminnmp))] #[stable(feature = "neon_intrinsics", since = "1.59.0")] pub fn vminnmv_f32(a: float32x2_t) -> f32 { - unsafe extern "unadjusted" { - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.fminnmv.f32.v2f32" - )] - fn _vminnmv_f32(a: float32x2_t) -> f32; - } - unsafe { _vminnmv_f32(a) } + unsafe { simd_reduce_min(a) } } #[doc = "Floating-point minimum number across vector"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vminnmvq_f64)"] @@ -13731,14 +13675,7 @@ pub fn vminnmv_f32(a: float32x2_t) -> f32 { #[cfg_attr(test, assert_instr(fminnmp))] #[stable(feature = "neon_intrinsics", since = "1.59.0")] pub fn vminnmvq_f64(a: float64x2_t) -> f64 { - unsafe extern "unadjusted" { - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.fminnmv.f64.v2f64" - )] - fn _vminnmvq_f64(a: float64x2_t) -> f64; - } - unsafe { _vminnmvq_f64(a) } + unsafe { simd_reduce_min(a) } } #[doc = "Floating-point minimum number across vector"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vminnmvq_f32)"] @@ -13747,14 +13684,7 @@ pub fn vminnmvq_f64(a: float64x2_t) -> f64 { #[cfg_attr(test, assert_instr(fminnmv))] #[stable(feature = "neon_intrinsics", since = "1.59.0")] pub fn vminnmvq_f32(a: float32x4_t) -> f32 { - unsafe extern "unadjusted" { - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.fminnmv.f32.v4f32" - )] - fn _vminnmvq_f32(a: float32x4_t) -> f32; - } - unsafe { _vminnmvq_f32(a) } + unsafe { simd_reduce_min(a) } } #[doc = "Floating-point minimum number across vector"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vminv_f16)"] diff --git a/library/stdarch/crates/stdarch-gen-arm/spec/neon/aarch64.spec.yml b/library/stdarch/crates/stdarch-gen-arm/spec/neon/aarch64.spec.yml index 821dc52bf37d..298583bbfba8 100644 --- a/library/stdarch/crates/stdarch-gen-arm/spec/neon/aarch64.spec.yml +++ b/library/stdarch/crates/stdarch-gen-arm/spec/neon/aarch64.spec.yml @@ -6635,11 +6635,7 @@ intrinsics: - [float32x2_t, f32] - [float64x2_t, f64] compose: - - LLVMLink: - name: "fmaxnmv.{neon_type[0]}" - links: - - link: "llvm.aarch64.neon.fmaxnmv.{type[1]}.{neon_type[0]}" - arch: aarch64,arm64ec + - FnCall: [simd_reduce_max, [a]] - name: "vmaxnmv{neon_type[0].no}" doc: Floating-point maximum number across vector @@ -6651,11 +6647,7 @@ intrinsics: types: - [float32x4_t, f32] compose: - - LLVMLink: - name: "fmaxnmv.{neon_type[0]}" - links: - - link: "llvm.aarch64.neon.fmaxnmv.{type[1]}.{neon_type[0]}" - arch: aarch64,arm64ec + - FnCall: [simd_reduce_max, [a]] - name: "vmaxnmv{neon_type[0].no}" @@ -6671,11 +6663,7 @@ intrinsics: - [float16x4_t, f16] - [float16x8_t, f16] compose: - - LLVMLink: - name: "fmaxnmv.{neon_type[0]}" - links: - - link: "llvm.aarch64.neon.fmaxnmv.{type[1]}.{neon_type[0]}" - arch: aarch64,arm64ec + - FnCall: [simd_reduce_max, [a]] - name: "vminnmv{neon_type[0].no}" @@ -6691,11 +6679,7 @@ intrinsics: - [float16x4_t, f16] - [float16x8_t, f16] compose: - - LLVMLink: - name: "fminnmv.{neon_type[0]}" - links: - - link: "llvm.aarch64.neon.fminnmv.{type[1]}.{neon_type[0]}" - arch: aarch64,arm64ec + - FnCall: [simd_reduce_min, [a]] - name: "vmaxv{neon_type[0].no}" @@ -6815,11 +6799,7 @@ intrinsics: - [float32x2_t, "f32"] - [float64x2_t, "f64"] compose: - - LLVMLink: - name: "vminnmv.{neon_type[0]}" - links: - - link: "llvm.aarch64.neon.fminnmv.{type[1]}.{neon_type[0]}" - arch: aarch64,arm64ec + - FnCall: [simd_reduce_min, [a]] - name: "vminnmv{neon_type[0].no}" doc: "Floating-point minimum number across vector" @@ -6832,11 +6812,7 @@ intrinsics: types: - [float32x4_t, "f32"] compose: - - LLVMLink: - name: "vminnmv.{neon_type[0]}" - links: - - link: "llvm.aarch64.neon.fminnmv.{type[1]}.{neon_type[0]}" - arch: aarch64,arm64ec + - FnCall: [simd_reduce_min, [a]] - name: "vmovl_high{neon_type[0].noq}" doc: Vector move From 17b8fc938d86092674c8e72e0d66702e6fd05e5b Mon Sep 17 00:00:00 2001 From: Folkert de Vries Date: Sat, 12 Jul 2025 17:35:14 +0200 Subject: [PATCH 022/139] `aarch64`: use `simd_reduce_min` and `simd_reduce_max` for integers --- .../core_arch/src/aarch64/neon/generated.rs | 216 ++---------------- .../spec/neon/aarch64.spec.yml | 24 +- 2 files changed, 28 insertions(+), 212 deletions(-) diff --git a/library/stdarch/crates/core_arch/src/aarch64/neon/generated.rs b/library/stdarch/crates/core_arch/src/aarch64/neon/generated.rs index 0be902dbf2aa..5724f6d112f8 100644 --- a/library/stdarch/crates/core_arch/src/aarch64/neon/generated.rs +++ b/library/stdarch/crates/core_arch/src/aarch64/neon/generated.rs @@ -13381,14 +13381,7 @@ pub fn vmaxvq_f64(a: float64x2_t) -> f64 { #[stable(feature = "neon_intrinsics", since = "1.59.0")] #[cfg_attr(test, assert_instr(smaxv))] pub fn vmaxv_s8(a: int8x8_t) -> i8 { - unsafe extern "unadjusted" { - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.smaxv.i8.v8i8" - )] - fn _vmaxv_s8(a: int8x8_t) -> i8; - } - unsafe { _vmaxv_s8(a) } + unsafe { simd_reduce_max(a) } } #[doc = "Horizontal vector max."] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vmaxvq_s8)"] @@ -13397,14 +13390,7 @@ pub fn vmaxv_s8(a: int8x8_t) -> i8 { #[stable(feature = "neon_intrinsics", since = "1.59.0")] #[cfg_attr(test, assert_instr(smaxv))] pub fn vmaxvq_s8(a: int8x16_t) -> i8 { - unsafe extern "unadjusted" { - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.smaxv.i8.v16i8" - )] - fn _vmaxvq_s8(a: int8x16_t) -> i8; - } - unsafe { _vmaxvq_s8(a) } + unsafe { simd_reduce_max(a) } } #[doc = "Horizontal vector max."] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vmaxv_s16)"] @@ -13413,14 +13399,7 @@ pub fn vmaxvq_s8(a: int8x16_t) -> i8 { #[stable(feature = "neon_intrinsics", since = "1.59.0")] #[cfg_attr(test, assert_instr(smaxv))] pub fn vmaxv_s16(a: int16x4_t) -> i16 { - unsafe extern "unadjusted" { - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.smaxv.i16.v4i16" - )] - fn _vmaxv_s16(a: int16x4_t) -> i16; - } - unsafe { _vmaxv_s16(a) } + unsafe { simd_reduce_max(a) } } #[doc = "Horizontal vector max."] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vmaxvq_s16)"] @@ -13429,14 +13408,7 @@ pub fn vmaxv_s16(a: int16x4_t) -> i16 { #[stable(feature = "neon_intrinsics", since = "1.59.0")] #[cfg_attr(test, assert_instr(smaxv))] pub fn vmaxvq_s16(a: int16x8_t) -> i16 { - unsafe extern "unadjusted" { - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.smaxv.i16.v8i16" - )] - fn _vmaxvq_s16(a: int16x8_t) -> i16; - } - unsafe { _vmaxvq_s16(a) } + unsafe { simd_reduce_max(a) } } #[doc = "Horizontal vector max."] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vmaxv_s32)"] @@ -13445,14 +13417,7 @@ pub fn vmaxvq_s16(a: int16x8_t) -> i16 { #[stable(feature = "neon_intrinsics", since = "1.59.0")] #[cfg_attr(test, assert_instr(smaxp))] pub fn vmaxv_s32(a: int32x2_t) -> i32 { - unsafe extern "unadjusted" { - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.smaxv.i32.v2i32" - )] - fn _vmaxv_s32(a: int32x2_t) -> i32; - } - unsafe { _vmaxv_s32(a) } + unsafe { simd_reduce_max(a) } } #[doc = "Horizontal vector max."] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vmaxvq_s32)"] @@ -13461,14 +13426,7 @@ pub fn vmaxv_s32(a: int32x2_t) -> i32 { #[stable(feature = "neon_intrinsics", since = "1.59.0")] #[cfg_attr(test, assert_instr(smaxv))] pub fn vmaxvq_s32(a: int32x4_t) -> i32 { - unsafe extern "unadjusted" { - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.smaxv.i32.v4i32" - )] - fn _vmaxvq_s32(a: int32x4_t) -> i32; - } - unsafe { _vmaxvq_s32(a) } + unsafe { simd_reduce_max(a) } } #[doc = "Horizontal vector max."] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vmaxv_u8)"] @@ -13477,14 +13435,7 @@ pub fn vmaxvq_s32(a: int32x4_t) -> i32 { #[stable(feature = "neon_intrinsics", since = "1.59.0")] #[cfg_attr(test, assert_instr(umaxv))] pub fn vmaxv_u8(a: uint8x8_t) -> u8 { - unsafe extern "unadjusted" { - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.umaxv.i8.v8i8" - )] - fn _vmaxv_u8(a: uint8x8_t) -> u8; - } - unsafe { _vmaxv_u8(a) } + unsafe { simd_reduce_max(a) } } #[doc = "Horizontal vector max."] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vmaxvq_u8)"] @@ -13493,14 +13444,7 @@ pub fn vmaxv_u8(a: uint8x8_t) -> u8 { #[stable(feature = "neon_intrinsics", since = "1.59.0")] #[cfg_attr(test, assert_instr(umaxv))] pub fn vmaxvq_u8(a: uint8x16_t) -> u8 { - unsafe extern "unadjusted" { - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.umaxv.i8.v16i8" - )] - fn _vmaxvq_u8(a: uint8x16_t) -> u8; - } - unsafe { _vmaxvq_u8(a) } + unsafe { simd_reduce_max(a) } } #[doc = "Horizontal vector max."] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vmaxv_u16)"] @@ -13509,14 +13453,7 @@ pub fn vmaxvq_u8(a: uint8x16_t) -> u8 { #[stable(feature = "neon_intrinsics", since = "1.59.0")] #[cfg_attr(test, assert_instr(umaxv))] pub fn vmaxv_u16(a: uint16x4_t) -> u16 { - unsafe extern "unadjusted" { - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.umaxv.i16.v4i16" - )] - fn _vmaxv_u16(a: uint16x4_t) -> u16; - } - unsafe { _vmaxv_u16(a) } + unsafe { simd_reduce_max(a) } } #[doc = "Horizontal vector max."] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vmaxvq_u16)"] @@ -13525,14 +13462,7 @@ pub fn vmaxv_u16(a: uint16x4_t) -> u16 { #[stable(feature = "neon_intrinsics", since = "1.59.0")] #[cfg_attr(test, assert_instr(umaxv))] pub fn vmaxvq_u16(a: uint16x8_t) -> u16 { - unsafe extern "unadjusted" { - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.umaxv.i16.v8i16" - )] - fn _vmaxvq_u16(a: uint16x8_t) -> u16; - } - unsafe { _vmaxvq_u16(a) } + unsafe { simd_reduce_max(a) } } #[doc = "Horizontal vector max."] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vmaxv_u32)"] @@ -13541,14 +13471,7 @@ pub fn vmaxvq_u16(a: uint16x8_t) -> u16 { #[stable(feature = "neon_intrinsics", since = "1.59.0")] #[cfg_attr(test, assert_instr(umaxp))] pub fn vmaxv_u32(a: uint32x2_t) -> u32 { - unsafe extern "unadjusted" { - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.umaxv.i32.v2i32" - )] - fn _vmaxv_u32(a: uint32x2_t) -> u32; - } - unsafe { _vmaxv_u32(a) } + unsafe { simd_reduce_max(a) } } #[doc = "Horizontal vector max."] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vmaxvq_u32)"] @@ -13557,14 +13480,7 @@ pub fn vmaxv_u32(a: uint32x2_t) -> u32 { #[stable(feature = "neon_intrinsics", since = "1.59.0")] #[cfg_attr(test, assert_instr(umaxv))] pub fn vmaxvq_u32(a: uint32x4_t) -> u32 { - unsafe extern "unadjusted" { - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.umaxv.i32.v4i32" - )] - fn _vmaxvq_u32(a: uint32x4_t) -> u32; - } - unsafe { _vmaxvq_u32(a) } + unsafe { simd_reduce_max(a) } } #[doc = "Minimum (vector)"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vmin_f64)"] @@ -13773,14 +13689,7 @@ pub fn vminvq_f64(a: float64x2_t) -> f64 { #[stable(feature = "neon_intrinsics", since = "1.59.0")] #[cfg_attr(test, assert_instr(sminv))] pub fn vminv_s8(a: int8x8_t) -> i8 { - unsafe extern "unadjusted" { - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.sminv.i8.v8i8" - )] - fn _vminv_s8(a: int8x8_t) -> i8; - } - unsafe { _vminv_s8(a) } + unsafe { simd_reduce_min(a) } } #[doc = "Horizontal vector min."] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vminvq_s8)"] @@ -13789,14 +13698,7 @@ pub fn vminv_s8(a: int8x8_t) -> i8 { #[stable(feature = "neon_intrinsics", since = "1.59.0")] #[cfg_attr(test, assert_instr(sminv))] pub fn vminvq_s8(a: int8x16_t) -> i8 { - unsafe extern "unadjusted" { - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.sminv.i8.v16i8" - )] - fn _vminvq_s8(a: int8x16_t) -> i8; - } - unsafe { _vminvq_s8(a) } + unsafe { simd_reduce_min(a) } } #[doc = "Horizontal vector min."] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vminv_s16)"] @@ -13805,14 +13707,7 @@ pub fn vminvq_s8(a: int8x16_t) -> i8 { #[stable(feature = "neon_intrinsics", since = "1.59.0")] #[cfg_attr(test, assert_instr(sminv))] pub fn vminv_s16(a: int16x4_t) -> i16 { - unsafe extern "unadjusted" { - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.sminv.i16.v4i16" - )] - fn _vminv_s16(a: int16x4_t) -> i16; - } - unsafe { _vminv_s16(a) } + unsafe { simd_reduce_min(a) } } #[doc = "Horizontal vector min."] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vminvq_s16)"] @@ -13821,14 +13716,7 @@ pub fn vminv_s16(a: int16x4_t) -> i16 { #[stable(feature = "neon_intrinsics", since = "1.59.0")] #[cfg_attr(test, assert_instr(sminv))] pub fn vminvq_s16(a: int16x8_t) -> i16 { - unsafe extern "unadjusted" { - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.sminv.i16.v8i16" - )] - fn _vminvq_s16(a: int16x8_t) -> i16; - } - unsafe { _vminvq_s16(a) } + unsafe { simd_reduce_min(a) } } #[doc = "Horizontal vector min."] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vminv_s32)"] @@ -13837,14 +13725,7 @@ pub fn vminvq_s16(a: int16x8_t) -> i16 { #[stable(feature = "neon_intrinsics", since = "1.59.0")] #[cfg_attr(test, assert_instr(sminp))] pub fn vminv_s32(a: int32x2_t) -> i32 { - unsafe extern "unadjusted" { - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.sminv.i32.v2i32" - )] - fn _vminv_s32(a: int32x2_t) -> i32; - } - unsafe { _vminv_s32(a) } + unsafe { simd_reduce_min(a) } } #[doc = "Horizontal vector min."] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vminvq_s32)"] @@ -13853,14 +13734,7 @@ pub fn vminv_s32(a: int32x2_t) -> i32 { #[stable(feature = "neon_intrinsics", since = "1.59.0")] #[cfg_attr(test, assert_instr(sminv))] pub fn vminvq_s32(a: int32x4_t) -> i32 { - unsafe extern "unadjusted" { - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.sminv.i32.v4i32" - )] - fn _vminvq_s32(a: int32x4_t) -> i32; - } - unsafe { _vminvq_s32(a) } + unsafe { simd_reduce_min(a) } } #[doc = "Horizontal vector min."] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vminv_u8)"] @@ -13869,14 +13743,7 @@ pub fn vminvq_s32(a: int32x4_t) -> i32 { #[stable(feature = "neon_intrinsics", since = "1.59.0")] #[cfg_attr(test, assert_instr(uminv))] pub fn vminv_u8(a: uint8x8_t) -> u8 { - unsafe extern "unadjusted" { - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.uminv.i8.v8i8" - )] - fn _vminv_u8(a: uint8x8_t) -> u8; - } - unsafe { _vminv_u8(a) } + unsafe { simd_reduce_min(a) } } #[doc = "Horizontal vector min."] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vminvq_u8)"] @@ -13885,14 +13752,7 @@ pub fn vminv_u8(a: uint8x8_t) -> u8 { #[stable(feature = "neon_intrinsics", since = "1.59.0")] #[cfg_attr(test, assert_instr(uminv))] pub fn vminvq_u8(a: uint8x16_t) -> u8 { - unsafe extern "unadjusted" { - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.uminv.i8.v16i8" - )] - fn _vminvq_u8(a: uint8x16_t) -> u8; - } - unsafe { _vminvq_u8(a) } + unsafe { simd_reduce_min(a) } } #[doc = "Horizontal vector min."] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vminv_u16)"] @@ -13901,14 +13761,7 @@ pub fn vminvq_u8(a: uint8x16_t) -> u8 { #[stable(feature = "neon_intrinsics", since = "1.59.0")] #[cfg_attr(test, assert_instr(uminv))] pub fn vminv_u16(a: uint16x4_t) -> u16 { - unsafe extern "unadjusted" { - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.uminv.i16.v4i16" - )] - fn _vminv_u16(a: uint16x4_t) -> u16; - } - unsafe { _vminv_u16(a) } + unsafe { simd_reduce_min(a) } } #[doc = "Horizontal vector min."] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vminvq_u16)"] @@ -13917,14 +13770,7 @@ pub fn vminv_u16(a: uint16x4_t) -> u16 { #[stable(feature = "neon_intrinsics", since = "1.59.0")] #[cfg_attr(test, assert_instr(uminv))] pub fn vminvq_u16(a: uint16x8_t) -> u16 { - unsafe extern "unadjusted" { - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.uminv.i16.v8i16" - )] - fn _vminvq_u16(a: uint16x8_t) -> u16; - } - unsafe { _vminvq_u16(a) } + unsafe { simd_reduce_min(a) } } #[doc = "Horizontal vector min."] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vminv_u32)"] @@ -13933,14 +13779,7 @@ pub fn vminvq_u16(a: uint16x8_t) -> u16 { #[stable(feature = "neon_intrinsics", since = "1.59.0")] #[cfg_attr(test, assert_instr(uminp))] pub fn vminv_u32(a: uint32x2_t) -> u32 { - unsafe extern "unadjusted" { - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.uminv.i32.v2i32" - )] - fn _vminv_u32(a: uint32x2_t) -> u32; - } - unsafe { _vminv_u32(a) } + unsafe { simd_reduce_min(a) } } #[doc = "Horizontal vector min."] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vminvq_u32)"] @@ -13949,14 +13788,7 @@ pub fn vminv_u32(a: uint32x2_t) -> u32 { #[stable(feature = "neon_intrinsics", since = "1.59.0")] #[cfg_attr(test, assert_instr(uminv))] pub fn vminvq_u32(a: uint32x4_t) -> u32 { - unsafe extern "unadjusted" { - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.uminv.i32.v4i32" - )] - fn _vminvq_u32(a: uint32x4_t) -> u32; - } - unsafe { _vminvq_u32(a) } + unsafe { simd_reduce_min(a) } } #[doc = "Floating-point multiply-add to accumulator"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vmla_f64)"] diff --git a/library/stdarch/crates/stdarch-gen-arm/spec/neon/aarch64.spec.yml b/library/stdarch/crates/stdarch-gen-arm/spec/neon/aarch64.spec.yml index 298583bbfba8..92a2666a3695 100644 --- a/library/stdarch/crates/stdarch-gen-arm/spec/neon/aarch64.spec.yml +++ b/library/stdarch/crates/stdarch-gen-arm/spec/neon/aarch64.spec.yml @@ -13286,11 +13286,7 @@ intrinsics: - [int16x8_t, i16, 'smaxv'] - [int32x4_t, i32, 'smaxv'] compose: - - LLVMLink: - name: "vmaxv{neon_type[0].no}" - links: - - link: "llvm.aarch64.neon.smaxv.{type[1]}.{neon_type[0]}" - arch: aarch64,arm64ec + - FnCall: [simd_reduce_max, [a]] - name: "vmaxv{neon_type[0].no}" doc: "Horizontal vector max." @@ -13308,11 +13304,7 @@ intrinsics: - [uint16x8_t, u16, 'umaxv'] - [uint32x4_t, u32, 'umaxv'] compose: - - LLVMLink: - name: "vmaxv{neon_type[0].no}" - links: - - link: "llvm.aarch64.neon.umaxv.{type[1]}.{neon_type[0]}" - arch: aarch64,arm64ec + - FnCall: [simd_reduce_max, [a]] - name: "vmaxv{neon_type[0].no}" doc: "Horizontal vector max." @@ -13349,11 +13341,7 @@ intrinsics: - [int16x8_t, i16, 'sminv'] - [int32x4_t, i32, 'sminv'] compose: - - LLVMLink: - name: "vminv{neon_type[0].no}" - links: - - link: "llvm.aarch64.neon.sminv.{type[1]}.{neon_type[0]}" - arch: aarch64,arm64ec + - FnCall: [simd_reduce_min, [a]] - name: "vminv{neon_type[0].no}" doc: "Horizontal vector min." @@ -13371,11 +13359,7 @@ intrinsics: - [uint16x8_t, u16, 'uminv'] - [uint32x4_t, u32, 'uminv'] compose: - - LLVMLink: - name: "vminv{neon_type[0].no}" - links: - - link: "llvm.aarch64.neon.uminv.{type[1]}.{neon_type[0]}" - arch: aarch64,arm64ec + - FnCall: [simd_reduce_min, [a]] - name: "vminv{neon_type[0].no}" doc: "Horizontal vector min." From 42bcb0668ec27b7ee2af17649c185f09f0491872 Mon Sep 17 00:00:00 2001 From: Folkert de Vries Date: Sat, 12 Jul 2025 19:15:51 +0200 Subject: [PATCH 023/139] `aarch64`: use `simd_reduce_add_unordered` --- .../core_arch/src/aarch64/neon/generated.rs | 142 ++---------------- .../src/arm_shared/neon/generated.rs | 72 +++------ .../spec/neon/aarch64.spec.yml | 44 +----- .../spec/neon/arm_shared.spec.yml | 17 ++- 4 files changed, 58 insertions(+), 217 deletions(-) diff --git a/library/stdarch/crates/core_arch/src/aarch64/neon/generated.rs b/library/stdarch/crates/core_arch/src/aarch64/neon/generated.rs index 32f144bc7adc..9595b30789e8 100644 --- a/library/stdarch/crates/core_arch/src/aarch64/neon/generated.rs +++ b/library/stdarch/crates/core_arch/src/aarch64/neon/generated.rs @@ -604,14 +604,7 @@ pub fn vaddvq_f64(a: float64x2_t) -> f64 { #[stable(feature = "neon_intrinsics", since = "1.59.0")] #[cfg_attr(test, assert_instr(addp))] pub fn vaddv_s32(a: int32x2_t) -> i32 { - unsafe extern "unadjusted" { - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.saddv.i32.v2i32" - )] - fn _vaddv_s32(a: int32x2_t) -> i32; - } - unsafe { _vaddv_s32(a) } + unsafe { simd_reduce_add_unordered(a) } } #[doc = "Add across vector"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vaddv_s8)"] @@ -620,14 +613,7 @@ pub fn vaddv_s32(a: int32x2_t) -> i32 { #[stable(feature = "neon_intrinsics", since = "1.59.0")] #[cfg_attr(test, assert_instr(addv))] pub fn vaddv_s8(a: int8x8_t) -> i8 { - unsafe extern "unadjusted" { - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.saddv.i8.v8i8" - )] - fn _vaddv_s8(a: int8x8_t) -> i8; - } - unsafe { _vaddv_s8(a) } + unsafe { simd_reduce_add_unordered(a) } } #[doc = "Add across vector"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vaddvq_s8)"] @@ -636,14 +622,7 @@ pub fn vaddv_s8(a: int8x8_t) -> i8 { #[stable(feature = "neon_intrinsics", since = "1.59.0")] #[cfg_attr(test, assert_instr(addv))] pub fn vaddvq_s8(a: int8x16_t) -> i8 { - unsafe extern "unadjusted" { - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.saddv.i8.v16i8" - )] - fn _vaddvq_s8(a: int8x16_t) -> i8; - } - unsafe { _vaddvq_s8(a) } + unsafe { simd_reduce_add_unordered(a) } } #[doc = "Add across vector"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vaddv_s16)"] @@ -652,14 +631,7 @@ pub fn vaddvq_s8(a: int8x16_t) -> i8 { #[stable(feature = "neon_intrinsics", since = "1.59.0")] #[cfg_attr(test, assert_instr(addv))] pub fn vaddv_s16(a: int16x4_t) -> i16 { - unsafe extern "unadjusted" { - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.saddv.i16.v4i16" - )] - fn _vaddv_s16(a: int16x4_t) -> i16; - } - unsafe { _vaddv_s16(a) } + unsafe { simd_reduce_add_unordered(a) } } #[doc = "Add across vector"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vaddvq_s16)"] @@ -668,14 +640,7 @@ pub fn vaddv_s16(a: int16x4_t) -> i16 { #[stable(feature = "neon_intrinsics", since = "1.59.0")] #[cfg_attr(test, assert_instr(addv))] pub fn vaddvq_s16(a: int16x8_t) -> i16 { - unsafe extern "unadjusted" { - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.saddv.i16.v8i16" - )] - fn _vaddvq_s16(a: int16x8_t) -> i16; - } - unsafe { _vaddvq_s16(a) } + unsafe { simd_reduce_add_unordered(a) } } #[doc = "Add across vector"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vaddvq_s32)"] @@ -684,14 +649,7 @@ pub fn vaddvq_s16(a: int16x8_t) -> i16 { #[stable(feature = "neon_intrinsics", since = "1.59.0")] #[cfg_attr(test, assert_instr(addv))] pub fn vaddvq_s32(a: int32x4_t) -> i32 { - unsafe extern "unadjusted" { - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.saddv.i32.v4i32" - )] - fn _vaddvq_s32(a: int32x4_t) -> i32; - } - unsafe { _vaddvq_s32(a) } + unsafe { simd_reduce_add_unordered(a) } } #[doc = "Add across vector"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vaddv_u32)"] @@ -700,14 +658,7 @@ pub fn vaddvq_s32(a: int32x4_t) -> i32 { #[stable(feature = "neon_intrinsics", since = "1.59.0")] #[cfg_attr(test, assert_instr(addp))] pub fn vaddv_u32(a: uint32x2_t) -> u32 { - unsafe extern "unadjusted" { - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.uaddv.i32.v2i32" - )] - fn _vaddv_u32(a: uint32x2_t) -> u32; - } - unsafe { _vaddv_u32(a) } + unsafe { simd_reduce_add_unordered(a) } } #[doc = "Add across vector"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vaddv_u8)"] @@ -716,14 +667,7 @@ pub fn vaddv_u32(a: uint32x2_t) -> u32 { #[stable(feature = "neon_intrinsics", since = "1.59.0")] #[cfg_attr(test, assert_instr(addv))] pub fn vaddv_u8(a: uint8x8_t) -> u8 { - unsafe extern "unadjusted" { - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.uaddv.i8.v8i8" - )] - fn _vaddv_u8(a: uint8x8_t) -> u8; - } - unsafe { _vaddv_u8(a) } + unsafe { simd_reduce_add_unordered(a) } } #[doc = "Add across vector"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vaddvq_u8)"] @@ -732,14 +676,7 @@ pub fn vaddv_u8(a: uint8x8_t) -> u8 { #[stable(feature = "neon_intrinsics", since = "1.59.0")] #[cfg_attr(test, assert_instr(addv))] pub fn vaddvq_u8(a: uint8x16_t) -> u8 { - unsafe extern "unadjusted" { - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.uaddv.i8.v16i8" - )] - fn _vaddvq_u8(a: uint8x16_t) -> u8; - } - unsafe { _vaddvq_u8(a) } + unsafe { simd_reduce_add_unordered(a) } } #[doc = "Add across vector"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vaddv_u16)"] @@ -748,14 +685,7 @@ pub fn vaddvq_u8(a: uint8x16_t) -> u8 { #[stable(feature = "neon_intrinsics", since = "1.59.0")] #[cfg_attr(test, assert_instr(addv))] pub fn vaddv_u16(a: uint16x4_t) -> u16 { - unsafe extern "unadjusted" { - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.uaddv.i16.v4i16" - )] - fn _vaddv_u16(a: uint16x4_t) -> u16; - } - unsafe { _vaddv_u16(a) } + unsafe { simd_reduce_add_unordered(a) } } #[doc = "Add across vector"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vaddvq_u16)"] @@ -764,14 +694,7 @@ pub fn vaddv_u16(a: uint16x4_t) -> u16 { #[stable(feature = "neon_intrinsics", since = "1.59.0")] #[cfg_attr(test, assert_instr(addv))] pub fn vaddvq_u16(a: uint16x8_t) -> u16 { - unsafe extern "unadjusted" { - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.uaddv.i16.v8i16" - )] - fn _vaddvq_u16(a: uint16x8_t) -> u16; - } - unsafe { _vaddvq_u16(a) } + unsafe { simd_reduce_add_unordered(a) } } #[doc = "Add across vector"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vaddvq_u32)"] @@ -780,14 +703,7 @@ pub fn vaddvq_u16(a: uint16x8_t) -> u16 { #[stable(feature = "neon_intrinsics", since = "1.59.0")] #[cfg_attr(test, assert_instr(addv))] pub fn vaddvq_u32(a: uint32x4_t) -> u32 { - unsafe extern "unadjusted" { - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.uaddv.i32.v4i32" - )] - fn _vaddvq_u32(a: uint32x4_t) -> u32; - } - unsafe { _vaddvq_u32(a) } + unsafe { simd_reduce_add_unordered(a) } } #[doc = "Add across vector"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vaddvq_s64)"] @@ -796,14 +712,7 @@ pub fn vaddvq_u32(a: uint32x4_t) -> u32 { #[stable(feature = "neon_intrinsics", since = "1.59.0")] #[cfg_attr(test, assert_instr(addp))] pub fn vaddvq_s64(a: int64x2_t) -> i64 { - unsafe extern "unadjusted" { - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.saddv.i64.v2i64" - )] - fn _vaddvq_s64(a: int64x2_t) -> i64; - } - unsafe { _vaddvq_s64(a) } + unsafe { simd_reduce_add_unordered(a) } } #[doc = "Add across vector"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vaddvq_u64)"] @@ -812,14 +721,7 @@ pub fn vaddvq_s64(a: int64x2_t) -> i64 { #[stable(feature = "neon_intrinsics", since = "1.59.0")] #[cfg_attr(test, assert_instr(addp))] pub fn vaddvq_u64(a: uint64x2_t) -> u64 { - unsafe extern "unadjusted" { - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.uaddv.i64.v2i64" - )] - fn _vaddvq_u64(a: uint64x2_t) -> u64; - } - unsafe { _vaddvq_u64(a) } + unsafe { simd_reduce_add_unordered(a) } } #[doc = "Multi-vector floating-point absolute maximum"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vamax_f32)"] @@ -15951,23 +15853,11 @@ pub fn vpadds_f32(a: float32x2_t) -> f32 { #[doc = "Add pairwise"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vpaddd_s64)"] #[inline] -#[cfg(target_endian = "little")] #[target_feature(enable = "neon")] #[stable(feature = "neon_intrinsics", since = "1.59.0")] #[cfg_attr(test, assert_instr(addp))] pub fn vpaddd_s64(a: int64x2_t) -> i64 { - unsafe { transmute(vaddvq_u64(transmute(a))) } -} -#[doc = "Add pairwise"] -#[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vpaddd_s64)"] -#[inline] -#[cfg(target_endian = "big")] -#[target_feature(enable = "neon")] -#[stable(feature = "neon_intrinsics", since = "1.59.0")] -#[cfg_attr(test, assert_instr(addp))] -pub fn vpaddd_s64(a: int64x2_t) -> i64 { - let a: int64x2_t = unsafe { simd_shuffle!(a, a, [1, 0]) }; - unsafe { transmute(vaddvq_u64(transmute(a))) } + unsafe { simd_reduce_add_unordered(a) } } #[doc = "Add pairwise"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vpaddd_u64)"] @@ -15976,7 +15866,7 @@ pub fn vpaddd_s64(a: int64x2_t) -> i64 { #[stable(feature = "neon_intrinsics", since = "1.59.0")] #[cfg_attr(test, assert_instr(addp))] pub fn vpaddd_u64(a: uint64x2_t) -> u64 { - vaddvq_u64(a) + unsafe { simd_reduce_add_unordered(a) } } #[doc = "Floating-point add pairwise"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vpaddq_f16)"] diff --git a/library/stdarch/crates/core_arch/src/arm_shared/neon/generated.rs b/library/stdarch/crates/core_arch/src/arm_shared/neon/generated.rs index b61d57777783..4bf926c3569b 100644 --- a/library/stdarch/crates/core_arch/src/arm_shared/neon/generated.rs +++ b/library/stdarch/crates/core_arch/src/arm_shared/neon/generated.rs @@ -1483,15 +1483,11 @@ pub fn vabsq_f32(a: float32x4_t) -> float32x4_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub fn vabs_s8(a: int8x8_t) -> int8x8_t { - unsafe extern "unadjusted" { - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.abs.v8i8" - )] - #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vabs.v8i8")] - fn _vabs_s8(a: int8x8_t) -> int8x8_t; + unsafe { + let neg: int8x8_t = simd_neg(a); + let mask: int8x8_t = simd_ge(a, neg); + simd_select(mask, a, neg) } - unsafe { _vabs_s8(a) } } #[doc = "Absolute value (wrapping)."] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vabsq_s8)"] @@ -1512,15 +1508,11 @@ pub fn vabs_s8(a: int8x8_t) -> int8x8_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub fn vabsq_s8(a: int8x16_t) -> int8x16_t { - unsafe extern "unadjusted" { - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.abs.v16i8" - )] - #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vabs.v16i8")] - fn _vabsq_s8(a: int8x16_t) -> int8x16_t; + unsafe { + let neg: int8x16_t = simd_neg(a); + let mask: int8x16_t = simd_ge(a, neg); + simd_select(mask, a, neg) } - unsafe { _vabsq_s8(a) } } #[doc = "Absolute value (wrapping)."] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vabs_s16)"] @@ -1541,15 +1533,11 @@ pub fn vabsq_s8(a: int8x16_t) -> int8x16_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub fn vabs_s16(a: int16x4_t) -> int16x4_t { - unsafe extern "unadjusted" { - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.abs.v4i16" - )] - #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vabs.v4i16")] - fn _vabs_s16(a: int16x4_t) -> int16x4_t; + unsafe { + let neg: int16x4_t = simd_neg(a); + let mask: int16x4_t = simd_ge(a, neg); + simd_select(mask, a, neg) } - unsafe { _vabs_s16(a) } } #[doc = "Absolute value (wrapping)."] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vabsq_s16)"] @@ -1570,15 +1558,11 @@ pub fn vabs_s16(a: int16x4_t) -> int16x4_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub fn vabsq_s16(a: int16x8_t) -> int16x8_t { - unsafe extern "unadjusted" { - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.abs.v8i16" - )] - #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vabs.v8i16")] - fn _vabsq_s16(a: int16x8_t) -> int16x8_t; + unsafe { + let neg: int16x8_t = simd_neg(a); + let mask: int16x8_t = simd_ge(a, neg); + simd_select(mask, a, neg) } - unsafe { _vabsq_s16(a) } } #[doc = "Absolute value (wrapping)."] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vabs_s32)"] @@ -1599,15 +1583,11 @@ pub fn vabsq_s16(a: int16x8_t) -> int16x8_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub fn vabs_s32(a: int32x2_t) -> int32x2_t { - unsafe extern "unadjusted" { - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.abs.v2i32" - )] - #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vabs.v2i32")] - fn _vabs_s32(a: int32x2_t) -> int32x2_t; + unsafe { + let neg: int32x2_t = simd_neg(a); + let mask: int32x2_t = simd_ge(a, neg); + simd_select(mask, a, neg) } - unsafe { _vabs_s32(a) } } #[doc = "Absolute value (wrapping)."] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vabsq_s32)"] @@ -1628,15 +1608,11 @@ pub fn vabs_s32(a: int32x2_t) -> int32x2_t { unstable(feature = "stdarch_arm_neon_intrinsics", issue = "111800") )] pub fn vabsq_s32(a: int32x4_t) -> int32x4_t { - unsafe extern "unadjusted" { - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.abs.v4i32" - )] - #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vabs.v4i32")] - fn _vabsq_s32(a: int32x4_t) -> int32x4_t; + unsafe { + let neg: int32x4_t = simd_neg(a); + let mask: int32x4_t = simd_ge(a, neg); + simd_select(mask, a, neg) } - unsafe { _vabsq_s32(a) } } #[doc = "Floating-point absolute value"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vabsh_f16)"] diff --git a/library/stdarch/crates/stdarch-gen-arm/spec/neon/aarch64.spec.yml b/library/stdarch/crates/stdarch-gen-arm/spec/neon/aarch64.spec.yml index f0dce681d9c3..2b5aab3e7f50 100644 --- a/library/stdarch/crates/stdarch-gen-arm/spec/neon/aarch64.spec.yml +++ b/library/stdarch/crates/stdarch-gen-arm/spec/neon/aarch64.spec.yml @@ -13142,11 +13142,7 @@ intrinsics: types: - [int64x2_t, i64] compose: - - FnCall: - - transmute - - - FnCall: - - "vaddvq_u64" - - - FnCall: [transmute, [a]] + - FnCall: [simd_reduce_add_unordered, [a]] - name: "vpaddd_u64" doc: "Add pairwise" @@ -13159,7 +13155,7 @@ intrinsics: types: - [uint64x2_t, u64] compose: - - FnCall: [vaddvq_u64, [a]] + - FnCall: [simd_reduce_add_unordered, [a]] - name: "vaddv{neon_type[0].no}" doc: "Add across vector" @@ -13176,11 +13172,7 @@ intrinsics: - [int16x8_t, i16] - [int32x4_t, i32] compose: - - LLVMLink: - name: "vaddv{neon_type[0].no}" - links: - - link: "llvm.aarch64.neon.saddv.{type[1]}.{neon_type[0]}" - arch: aarch64,arm64ec + - FnCall: [simd_reduce_add_unordered, [a]] - name: "vaddv{neon_type[0].no}" doc: "Add across vector" @@ -13193,11 +13185,7 @@ intrinsics: types: - [int32x2_t, i32] compose: - - LLVMLink: - name: "vaddv{neon_type[0].no}" - links: - - link: "llvm.aarch64.neon.saddv.i32.{neon_type[0]}" - arch: aarch64,arm64ec + - FnCall: [simd_reduce_add_unordered, [a]] - name: "vaddv{neon_type[0].no}" doc: "Add across vector" @@ -13210,11 +13198,7 @@ intrinsics: types: - [int64x2_t, i64] compose: - - LLVMLink: - name: "vaddv{neon_type[0].no}" - links: - - link: "llvm.aarch64.neon.saddv.i64.{neon_type[0]}" - arch: aarch64,arm64ec + - FnCall: [simd_reduce_add_unordered, [a]] - name: "vaddv{neon_type[0].no}" doc: "Add across vector" @@ -13231,11 +13215,7 @@ intrinsics: - [uint16x8_t, u16] - [uint32x4_t, u32] compose: - - LLVMLink: - name: "vaddv{neon_type[0].no}" - links: - - link: "llvm.aarch64.neon.uaddv.{type[1]}.{neon_type[0]}" - arch: aarch64,arm64ec + - FnCall: [simd_reduce_add_unordered, [a]] - name: "vaddv{neon_type[0].no}" doc: "Add across vector" @@ -13248,11 +13228,7 @@ intrinsics: types: - [uint32x2_t, u32, i32] compose: - - LLVMLink: - name: "vaddv{neon_type[0].no}" - links: - - link: "llvm.aarch64.neon.uaddv.{type[2]}.{neon_type[0]}" - arch: aarch64,arm64ec + - FnCall: [simd_reduce_add_unordered, [a]] - name: "vaddv{neon_type[0].no}" doc: "Add across vector" @@ -13265,11 +13241,7 @@ intrinsics: types: - [uint64x2_t, u64, i64] compose: - - LLVMLink: - name: "vaddv{neon_type[0].no}" - links: - - link: "llvm.aarch64.neon.uaddv.{type[2]}.{neon_type[0]}" - arch: aarch64,arm64ec + - FnCall: [simd_reduce_add_unordered, [a]] - name: "vaddlv{neon_type[0].no}" doc: "Signed Add Long across Vector" diff --git a/library/stdarch/crates/stdarch-gen-arm/spec/neon/arm_shared.spec.yml b/library/stdarch/crates/stdarch-gen-arm/spec/neon/arm_shared.spec.yml index c836a47a7409..58c26ae4f80d 100644 --- a/library/stdarch/crates/stdarch-gen-arm/spec/neon/arm_shared.spec.yml +++ b/library/stdarch/crates/stdarch-gen-arm/spec/neon/arm_shared.spec.yml @@ -12861,13 +12861,16 @@ intrinsics: - int16x8_t - int32x4_t compose: - - LLVMLink: - name: "vabs{neon_type.no}" - links: - - link: "llvm.aarch64.neon.abs.{neon_type}" - arch: aarch64,arm64ec - - link: "llvm.arm.neon.vabs.{neon_type}" - arch: arm + - Let: + - neg + - "{neon_type}" + - FnCall: [simd_neg, [a]] + - Let: + - mask + - "{neon_type}" + - FnCall: [simd_ge, [a, neg]] + - FnCall: [simd_select, [mask, a, neg]] + - name: "vpmin{neon_type.no}" doc: "Folding minimum of adjacent pairs" From d77c38727298ee442db4d927c13bc8b2de1db448 Mon Sep 17 00:00:00 2001 From: Daniel Paoliello Date: Sun, 13 Jul 2025 15:01:48 -0700 Subject: [PATCH 024/139] Fixes for Arm64EC --- tests/ui/cfg/conditional-compile-arch.rs | 3 +++ tests/ui/linkage-attr/incompatible-flavor.rs | 2 +- tests/ui/runtime/backtrace-debuginfo.rs | 3 ++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/ui/cfg/conditional-compile-arch.rs b/tests/ui/cfg/conditional-compile-arch.rs index 594d9344561c..f16805474074 100644 --- a/tests/ui/cfg/conditional-compile-arch.rs +++ b/tests/ui/cfg/conditional-compile-arch.rs @@ -38,3 +38,6 @@ pub fn main() { } #[cfg(target_arch = "loongarch64")] pub fn main() { } + +#[cfg(target_arch = "arm64ec")] +pub fn main() { } diff --git a/tests/ui/linkage-attr/incompatible-flavor.rs b/tests/ui/linkage-attr/incompatible-flavor.rs index 7f583f47e2f5..4711343f9c9d 100644 --- a/tests/ui/linkage-attr/incompatible-flavor.rs +++ b/tests/ui/linkage-attr/incompatible-flavor.rs @@ -1,5 +1,5 @@ //@ compile-flags: --target=x86_64-unknown-linux-gnu -C linker-flavor=msvc --crate-type=rlib -//@ needs-llvm-components: +//@ needs-llvm-components: x86 #![feature(no_core)] #![no_core] diff --git a/tests/ui/runtime/backtrace-debuginfo.rs b/tests/ui/runtime/backtrace-debuginfo.rs index 37fce2788b7f..5fb9943d6c3c 100644 --- a/tests/ui/runtime/backtrace-debuginfo.rs +++ b/tests/ui/runtime/backtrace-debuginfo.rs @@ -43,12 +43,13 @@ macro_rules! dump_and_die { // rust-lang/rust to test it as well, but sometimes we just gotta keep // landing PRs. // - // aarch64-msvc is broken as its backtraces are truncated. + // aarch64-msvc/arm64ec-msvc is broken as its backtraces are truncated. // See https://github.com/rust-lang/rust/issues/140489 if cfg!(any(target_os = "android", all(target_os = "linux", target_arch = "arm"), all(target_env = "msvc", target_arch = "x86"), all(target_env = "msvc", target_arch = "aarch64"), + all(target_env = "msvc", target_arch = "arm64ec"), target_os = "freebsd", target_os = "dragonfly", target_os = "openbsd")) { From 74e2cb12d1732525a52df845072132e9431f27b0 Mon Sep 17 00:00:00 2001 From: Folkert de Vries Date: Mon, 14 Jul 2025 17:22:38 +0200 Subject: [PATCH 025/139] `s390x`: document the different rounding flavors --- .../crates/core_arch/src/s390x/vector.rs | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/library/stdarch/crates/core_arch/src/s390x/vector.rs b/library/stdarch/crates/core_arch/src/s390x/vector.rs index 1cd33c3554bd..63205f13ccc6 100644 --- a/library/stdarch/crates/core_arch/src/s390x/vector.rs +++ b/library/stdarch/crates/core_arch/src/s390x/vector.rs @@ -1181,6 +1181,20 @@ mod sealed { impl_vec_trait! { [VectorOrc vec_orc]+ 2c (orc) } + // Z vector intrinsic C23 math.h LLVM IR ISO/IEC 60559 operation inexact vfidb parameters + // + // vec_rint rint llvm.rint roundToIntegralExact yes 0, 0 + // vec_roundc nearbyint llvm.nearbyint n/a no 4, 0 + // vec_floor / vec_roundm floor llvm.floor roundToIntegralTowardNegative no 4, 7 + // vec_ceil / vec_roundp ceil llvm.ceil roundToIntegralTowardPositive no 4, 6 + // vec_trunc / vec_roundz trunc llvm.trunc roundToIntegralTowardZero no 4, 5 + // vec_round roundeven llvm.roundeven roundToIntegralTiesToEven no 4, 4 + // n/a round llvm.round roundToIntegralTiesAway no 4, 1 + + // `simd_round_ties_even` is implemented as `llvm.rint`. + test_impl! { vec_rint_f32 (a: vector_float) -> vector_float [simd_round_ties_even, "vector-enhancements-1" vfisb] } + test_impl! { vec_rint_f64 (a: vector_double) -> vector_double [simd_round_ties_even, vfidb] } + test_impl! { vec_roundc_f32 (a: vector_float) -> vector_float [nearbyint_v4f32, "vector-enhancements-1" vfisb] } test_impl! { vec_roundc_f64 (a: vector_double) -> vector_double [nearbyint_v2f64, vfidb] } @@ -1189,9 +1203,6 @@ mod sealed { test_impl! { vec_round_f32 (a: vector_float) -> vector_float [roundeven_v4f32, _] } test_impl! { vec_round_f64 (a: vector_double) -> vector_double [roundeven_v2f64, _] } - test_impl! { vec_rint_f32 (a: vector_float) -> vector_float [simd_round_ties_even, "vector-enhancements-1" vfisb] } - test_impl! { vec_rint_f64 (a: vector_double) -> vector_double [simd_round_ties_even, vfidb] } - #[unstable(feature = "stdarch_s390x", issue = "135681")] pub trait VectorRoundc { unsafe fn vec_roundc(self) -> Self; From 48c33b774825c92c9aa3a3d01424ed62e62c3174 Mon Sep 17 00:00:00 2001 From: Folkert de Vries Date: Sat, 12 Jul 2025 21:54:23 +0200 Subject: [PATCH 026/139] `aarch64`: implement `vabs` using `instrinsics::simd` --- .../core_arch/src/aarch64/neon/generated.rs | 40 ++++++++----------- .../spec/neon/aarch64.spec.yml | 35 +++++++++++++--- 2 files changed, 46 insertions(+), 29 deletions(-) diff --git a/library/stdarch/crates/core_arch/src/aarch64/neon/generated.rs b/library/stdarch/crates/core_arch/src/aarch64/neon/generated.rs index 9595b30789e8..319cef2b1a1c 100644 --- a/library/stdarch/crates/core_arch/src/aarch64/neon/generated.rs +++ b/library/stdarch/crates/core_arch/src/aarch64/neon/generated.rs @@ -298,14 +298,24 @@ pub fn vabsq_f64(a: float64x2_t) -> float64x2_t { #[stable(feature = "neon_intrinsics", since = "1.59.0")] #[cfg_attr(test, assert_instr(abs))] pub fn vabs_s64(a: int64x1_t) -> int64x1_t { - unsafe extern "unadjusted" { - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.abs.v1i64" - )] - fn _vabs_s64(a: int64x1_t) -> int64x1_t; + unsafe { + let neg: int64x1_t = simd_neg(a); + let mask: int64x1_t = simd_ge(a, neg); + simd_select(mask, a, neg) + } +} +#[doc = "Absolute Value (wrapping)."] +#[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vabsq_s64)"] +#[inline] +#[target_feature(enable = "neon")] +#[stable(feature = "neon_intrinsics", since = "1.59.0")] +#[cfg_attr(test, assert_instr(abs))] +pub fn vabsq_s64(a: int64x2_t) -> int64x2_t { + unsafe { + let neg: int64x2_t = simd_neg(a); + let mask: int64x2_t = simd_ge(a, neg); + simd_select(mask, a, neg) } - unsafe { _vabs_s64(a) } } #[doc = "Absolute Value (wrapping)."] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vabsd_s64)"] @@ -323,22 +333,6 @@ pub fn vabsd_s64(a: i64) -> i64 { } unsafe { _vabsd_s64(a) } } -#[doc = "Absolute Value (wrapping)."] -#[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vabsq_s64)"] -#[inline] -#[target_feature(enable = "neon")] -#[stable(feature = "neon_intrinsics", since = "1.59.0")] -#[cfg_attr(test, assert_instr(abs))] -pub fn vabsq_s64(a: int64x2_t) -> int64x2_t { - unsafe extern "unadjusted" { - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.neon.abs.v2i64" - )] - fn _vabsq_s64(a: int64x2_t) -> int64x2_t; - } - unsafe { _vabsq_s64(a) } -} #[doc = "Add"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vaddd_s64)"] #[inline] diff --git a/library/stdarch/crates/stdarch-gen-arm/spec/neon/aarch64.spec.yml b/library/stdarch/crates/stdarch-gen-arm/spec/neon/aarch64.spec.yml index 2b5aab3e7f50..8fa33e5bb332 100644 --- a/library/stdarch/crates/stdarch-gen-arm/spec/neon/aarch64.spec.yml +++ b/library/stdarch/crates/stdarch-gen-arm/spec/neon/aarch64.spec.yml @@ -13023,6 +13023,26 @@ intrinsics: - link: "llvm.aarch64.crc32cx" arch: aarch64,arm64ec + - name: "vabsd_s64" + doc: "Absolute Value (wrapping)." + arguments: ["a: {type[1]}"] + return_type: "{type[1]}" + attr: + - *neon-stable + assert_instr: [abs] + safety: safe + types: + - [i64, i64] + compose: + # This is behaviorally equivalent to `i64::wrapping_abs`, but keeps the value in a SIMD + # register. That can be beneficial when combined with other instructions. This LLVM + # issue provides some extra context https://github.com/llvm/llvm-project/issues/148388. + - LLVMLink: + name: "vabsd_s64" + links: + - link: "llvm.aarch64.neon.abs.i64" + arch: aarch64,arm64ec + - name: "{type[0]}" doc: "Absolute Value (wrapping)." arguments: ["a: {type[1]}"] @@ -13032,15 +13052,18 @@ intrinsics: assert_instr: [abs] safety: safe types: - - ['vabsd_s64', i64, i64] - ['vabs_s64', int64x1_t, v1i64] - ['vabsq_s64', int64x2_t, v2i64] compose: - - LLVMLink: - name: "{type[0]}" - links: - - link: "llvm.aarch64.neon.abs.{type[2]}" - arch: aarch64,arm64ec + - Let: + - neg + - "{type[1]}" + - FnCall: [simd_neg, [a]] + - Let: + - mask + - "{type[1]}" + - FnCall: [simd_ge, [a, neg]] + - FnCall: [simd_select, [mask, a, neg]] - name: "vuqadd{neon_type[0].no}" doc: "Signed saturating Accumulate of Unsigned value." From 05154af3e857f23b41072793e401a78a5aa952d9 Mon Sep 17 00:00:00 2001 From: SunkenPotato <3.14radius02@gmail.com> Date: Tue, 15 Jul 2025 16:26:24 +0200 Subject: [PATCH 027/139] docs: update documentation of core::mem::copy to include const on the fn signature --- library/core/src/mem/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/core/src/mem/mod.rs b/library/core/src/mem/mod.rs index 1bd12d818cfe..164fcdad5c40 100644 --- a/library/core/src/mem/mod.rs +++ b/library/core/src/mem/mod.rs @@ -960,7 +960,7 @@ pub fn drop(_x: T) {} /// /// This function is not magic; it is literally defined as /// ``` -/// pub fn copy(x: &T) -> T { *x } +/// pub const fn copy(x: &T) -> T { *x } /// ``` /// /// It is useful when you want to pass a function pointer to a combinator, rather than defining a new closure. From 5cb1e01a94a51b0ad9d67e913c866fef4f78df14 Mon Sep 17 00:00:00 2001 From: Folkert de Vries Date: Thu, 10 Jul 2025 15:48:57 +0200 Subject: [PATCH 028/139] update `Cargo.lock` --- library/stdarch/Cargo.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/library/stdarch/Cargo.lock b/library/stdarch/Cargo.lock index a30743925d92..ff0d83ac96e0 100644 --- a/library/stdarch/Cargo.lock +++ b/library/stdarch/Cargo.lock @@ -99,9 +99,9 @@ checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268" [[package]] name = "clap" -version = "4.5.40" +version = "4.5.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40b6887a1d8685cebccf115538db5c0efe625ccac9696ad45c409d96566e910f" +checksum = "be92d32e80243a54711e5d7ce823c35c41c9d929dc4ab58e1276f625841aadf9" dependencies = [ "clap_builder", "clap_derive", @@ -109,9 +109,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.40" +version = "4.5.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0c66c08ce9f0c698cbce5c0279d0bb6ac936d8674174fe48f736533b964f59e" +checksum = "707eab41e9622f9139419d573eca0900137718000c517d47da73045f54331c3d" dependencies = [ "anstream", "anstyle", @@ -121,9 +121,9 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.40" +version = "4.5.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2c7947ae4cc3d851207c1adb5b5e260ff0cca11446b1d6d1423788e442257ce" +checksum = "ef4f52386a59ca4c860f7393bcf8abd8dfd91ecccc0f774635ff68e92eeef491" dependencies = [ "heck", "proc-macro2", From 7ff9bcfd1ea1d03ccbff9e4fcc93298fd54840e5 Mon Sep 17 00:00:00 2001 From: Folkert de Vries Date: Thu, 10 Jul 2025 15:48:41 +0200 Subject: [PATCH 029/139] `stdarch-test`: use `std::sync::LazyLock` instead of `lazy_static!` --- library/stdarch/Cargo.lock | 1 - library/stdarch/crates/stdarch-test/Cargo.toml | 1 - library/stdarch/crates/stdarch-test/src/lib.rs | 8 ++------ 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/library/stdarch/Cargo.lock b/library/stdarch/Cargo.lock index ff0d83ac96e0..4e01eb450e21 100644 --- a/library/stdarch/Cargo.lock +++ b/library/stdarch/Cargo.lock @@ -726,7 +726,6 @@ dependencies = [ "assert-instr-macro", "cc", "cfg-if", - "lazy_static", "rustc-demangle", "simd-test-macro", "wasmprinter", diff --git a/library/stdarch/crates/stdarch-test/Cargo.toml b/library/stdarch/crates/stdarch-test/Cargo.toml index e4791e4ec525..5d1171ee285e 100644 --- a/library/stdarch/crates/stdarch-test/Cargo.toml +++ b/library/stdarch/crates/stdarch-test/Cargo.toml @@ -7,7 +7,6 @@ edition = "2024" [dependencies] assert-instr-macro = { path = "../assert-instr-macro" } simd-test-macro = { path = "../simd-test-macro" } -lazy_static = "1.0" rustc-demangle = "0.1.8" cfg-if = "1.0" diff --git a/library/stdarch/crates/stdarch-test/src/lib.rs b/library/stdarch/crates/stdarch-test/src/lib.rs index f6614f6d51c9..f6732cd15cee 100644 --- a/library/stdarch/crates/stdarch-test/src/lib.rs +++ b/library/stdarch/crates/stdarch-test/src/lib.rs @@ -6,14 +6,12 @@ #![deny(rust_2018_idioms)] #![allow(clippy::missing_docs_in_private_items, clippy::print_stdout)] -#[macro_use] -extern crate lazy_static; #[macro_use] extern crate cfg_if; pub use assert_instr_macro::*; pub use simd_test_macro::*; -use std::{cmp, collections::HashSet, env, hash, hint::black_box, str}; +use std::{cmp, collections::HashSet, env, hash, hint::black_box, str, sync::LazyLock}; cfg_if! { if #[cfg(target_arch = "wasm32")] { @@ -25,9 +23,7 @@ cfg_if! { } } -lazy_static! { - static ref DISASSEMBLY: HashSet = disassemble_myself(); -} +static DISASSEMBLY: LazyLock> = LazyLock::new(disassemble_myself); #[derive(Debug)] struct Function { From 36340cd77453b783f22139a64ff008cc1b71034a Mon Sep 17 00:00:00 2001 From: Folkert de Vries Date: Thu, 10 Jul 2025 16:09:29 +0200 Subject: [PATCH 030/139] `stdarch-test`: misc cleanups --- .../stdarch/crates/stdarch-test/src/lib.rs | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/library/stdarch/crates/stdarch-test/src/lib.rs b/library/stdarch/crates/stdarch-test/src/lib.rs index f6732cd15cee..98f44f745fd5 100644 --- a/library/stdarch/crates/stdarch-test/src/lib.rs +++ b/library/stdarch/crates/stdarch-test/src/lib.rs @@ -61,11 +61,12 @@ pub fn assert(shim_addr: usize, fnname: &str, expected: &str) { black_box(shim_addr); //eprintln!("shim name: {fnname}"); - let function = &DISASSEMBLY - .get(&Function::new(fnname)) - .unwrap_or_else(|| panic!("function \"{fnname}\" not found in the disassembly")); + let Some(function) = &DISASSEMBLY.get(&Function::new(fnname)) else { + panic!("function `{fnname}` not found in the disassembly") + }; //eprintln!(" function: {:?}", function); + // Trim any filler instructions. let mut instrs = &function.instrs[..]; while instrs.last().is_some_and(|s| s == "nop" || s == "int3") { instrs = &instrs[..instrs.len() - 1]; @@ -80,11 +81,17 @@ pub fn assert(shim_addr: usize, fnname: &str, expected: &str) { // 2. It is a mark, indicating that the instruction will be // compiled into other instructions - mainly because of llvm // optimization. - let expected = if expected == "unknown" { - "" // Workaround for rust-lang/stdarch#1674, todo: remove when the issue is fixed - } else { - expected + let expected = match expected { + // `` is what LLVM will generate for unknown instructions. We use this to fail + // loudly when LLVM does start supporting these instructions. + // + // This was introduced in https://github.com/rust-lang/stdarch/pull/1674 to work around the + // RISC-V P extension not yet being supported. + "unknown" => "", + _ => expected, }; + + // Check whether the given instruction is part of the disassemblied body. let found = expected == "nop" || instrs.iter().any(|s| s.starts_with(expected)); // Look for subroutine call instructions in the disassembly to detect whether From f8de93acbe41241d6a17c6ba9cba663f9588fe43 Mon Sep 17 00:00:00 2001 From: Folkert de Vries Date: Thu, 10 Jul 2025 16:12:05 +0200 Subject: [PATCH 031/139] `stdarch-test`: error if only part of an instruction matched --- library/stdarch/crates/stdarch-test/src/lib.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/library/stdarch/crates/stdarch-test/src/lib.rs b/library/stdarch/crates/stdarch-test/src/lib.rs index 98f44f745fd5..317b46410596 100644 --- a/library/stdarch/crates/stdarch-test/src/lib.rs +++ b/library/stdarch/crates/stdarch-test/src/lib.rs @@ -92,7 +92,13 @@ pub fn assert(shim_addr: usize, fnname: &str, expected: &str) { }; // Check whether the given instruction is part of the disassemblied body. - let found = expected == "nop" || instrs.iter().any(|s| s.starts_with(expected)); + let found = expected == "nop" + || instrs.iter().any(|instruction| { + // Check that the next character is non-alphabetic. This prevents false negatives + // when e.g. `fminnm` was used but `fmin` was expected. + instruction.starts_with(expected) + && !instruction[expected.len()..].starts_with(|c: char| c.is_ascii_alphabetic()) + }); // Look for subroutine call instructions in the disassembly to detect whether // inlining failed: all intrinsics are `#[inline(always)]`, so calling one From f6f6715990a8cb49fbbaf83e65fd884e0d63d17d Mon Sep 17 00:00:00 2001 From: Folkert de Vries Date: Thu, 10 Jul 2025 16:17:07 +0200 Subject: [PATCH 032/139] s390x: fix tests that matched on prefix of instruction --- library/stdarch/crates/core_arch/src/s390x/vector.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/library/stdarch/crates/core_arch/src/s390x/vector.rs b/library/stdarch/crates/core_arch/src/s390x/vector.rs index 63205f13ccc6..a09a27a029c1 100644 --- a/library/stdarch/crates/core_arch/src/s390x/vector.rs +++ b/library/stdarch/crates/core_arch/src/s390x/vector.rs @@ -2265,14 +2265,14 @@ mod sealed { #[inline] #[target_feature(enable = "vector")] - #[cfg_attr(test, assert_instr("vlbb"))] + #[cfg_attr(test, assert_instr(vlbb))] unsafe fn test_vec_load_bndry(ptr: *const i32) -> MaybeUninit { vector_signed_int::vec_load_bndry::<512>(ptr) } #[inline] #[target_feature(enable = "vector")] - #[cfg_attr(test, assert_instr(vst))] + #[cfg_attr(test, assert_instr(vstl))] unsafe fn test_vec_store_len(vector: vector_signed_int, ptr: *mut i32, byte_count: u32) { vector.vec_store_len(ptr, byte_count) } @@ -2798,11 +2798,11 @@ mod sealed { } test_impl! { vec_vmal_ib(a: vector_signed_char, b: vector_signed_char, c: vector_signed_char) -> vector_signed_char [simd_mladd, vmalb ] } - test_impl! { vec_vmal_ih(a: vector_signed_short, b: vector_signed_short, c: vector_signed_short) -> vector_signed_short[simd_mladd, vmalh ] } + test_impl! { vec_vmal_ih(a: vector_signed_short, b: vector_signed_short, c: vector_signed_short) -> vector_signed_short[simd_mladd, vmalhw ] } test_impl! { vec_vmal_if(a: vector_signed_int, b: vector_signed_int, c: vector_signed_int) -> vector_signed_int [simd_mladd, vmalf ] } test_impl! { vec_vmal_ub(a: vector_unsigned_char, b: vector_unsigned_char, c: vector_unsigned_char) -> vector_unsigned_char [simd_mladd, vmalb ] } - test_impl! { vec_vmal_uh(a: vector_unsigned_short, b: vector_unsigned_short, c: vector_unsigned_short) -> vector_unsigned_short[simd_mladd, vmalh ] } + test_impl! { vec_vmal_uh(a: vector_unsigned_short, b: vector_unsigned_short, c: vector_unsigned_short) -> vector_unsigned_short[simd_mladd, vmalhw ] } test_impl! { vec_vmal_uf(a: vector_unsigned_int, b: vector_unsigned_int, c: vector_unsigned_int) -> vector_unsigned_int [simd_mladd, vmalf ] } impl_mul!([VectorMladd vec_mladd] vec_vmal_ib (vector_signed_char, vector_signed_char, vector_signed_char) -> vector_signed_char ); From 6444994556eb1f15aa2e19f7c175799d22d137c2 Mon Sep 17 00:00:00 2001 From: Folkert de Vries Date: Thu, 10 Jul 2025 16:25:27 +0200 Subject: [PATCH 033/139] aarch64/arm: fix tests that matched on prefix of instruction --- .../crates/stdarch-gen-arm/spec/neon/arm_shared.spec.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/stdarch/crates/stdarch-gen-arm/spec/neon/arm_shared.spec.yml b/library/stdarch/crates/stdarch-gen-arm/spec/neon/arm_shared.spec.yml index e0667228d2e7..b2b4fd2f8551 100644 --- a/library/stdarch/crates/stdarch-gen-arm/spec/neon/arm_shared.spec.yml +++ b/library/stdarch/crates/stdarch-gen-arm/spec/neon/arm_shared.spec.yml @@ -14131,8 +14131,8 @@ intrinsics: - ['vld1q_dup_u32', '*const u32', 'uint32x4_t', 'vld1.32', 'ld1r', 'u32x4::splat'] - ['vld1q_dup_f32', '*const f32', 'float32x4_t', 'vld1.32', 'ld1r', 'f32x4::splat'] - - ['vld1q_dup_s64', '*const i64', 'int64x2_t', 'vldr', 'ld1', 'i64x2::splat'] - - ['vld1q_dup_u64', '*const u64', 'uint64x2_t', 'vldr', 'ld1', 'u64x2::splat'] + - ['vld1q_dup_s64', '*const i64', 'int64x2_t', 'vldr', 'ld1r', 'i64x2::splat'] + - ['vld1q_dup_u64', '*const u64', 'uint64x2_t', 'vldr', 'ld1r', 'u64x2::splat'] compose: - FnCall: - transmute From ce3eabfd70a11a90947954030c76040fb19ad96f Mon Sep 17 00:00:00 2001 From: Folkert de Vries Date: Tue, 15 Jul 2025 22:09:43 +0200 Subject: [PATCH 034/139] `aarch64`: check for `zip1` and `zip2` --- .../src/arm_shared/neon/generated.rs | 160 +++++++++++++++--- .../spec/neon/arm_shared.spec.yml | 18 +- 2 files changed, 144 insertions(+), 34 deletions(-) diff --git a/library/stdarch/crates/core_arch/src/arm_shared/neon/generated.rs b/library/stdarch/crates/core_arch/src/arm_shared/neon/generated.rs index 03d140860707..e6c69bebb358 100644 --- a/library/stdarch/crates/core_arch/src/arm_shared/neon/generated.rs +++ b/library/stdarch/crates/core_arch/src/arm_shared/neon/generated.rs @@ -14609,7 +14609,7 @@ pub unsafe fn vld1q_dup_s32(ptr: *const i32) -> int32x4_t { #[cfg_attr(all(test, target_arch = "arm"), assert_instr("vldr"))] #[cfg_attr( all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), - assert_instr(ld1) + assert_instr(ld1r) )] #[cfg_attr( not(target_arch = "arm"), @@ -14701,7 +14701,7 @@ pub unsafe fn vld1q_dup_u32(ptr: *const u32) -> uint32x4_t { #[cfg_attr(all(test, target_arch = "arm"), assert_instr("vldr"))] #[cfg_attr( all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), - assert_instr(ld1) + assert_instr(ld1r) )] #[cfg_attr( not(target_arch = "arm"), @@ -73031,7 +73031,11 @@ pub fn vtrnq_f16(a: float16x8_t, b: float16x8_t) -> float16x8x2_t { #[cfg_attr(all(test, target_arch = "arm"), assert_instr(vtrn))] #[cfg_attr( all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), - assert_instr(zip) + assert_instr(zip1) +)] +#[cfg_attr( + all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), + assert_instr(zip2) )] #[cfg_attr( not(target_arch = "arm"), @@ -73056,7 +73060,11 @@ pub fn vtrn_f32(a: float32x2_t, b: float32x2_t) -> float32x2x2_t { #[cfg_attr(all(test, target_arch = "arm"), assert_instr(vtrn))] #[cfg_attr( all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), - assert_instr(zip) + assert_instr(zip1) +)] +#[cfg_attr( + all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), + assert_instr(zip2) )] #[cfg_attr( not(target_arch = "arm"), @@ -73081,7 +73089,11 @@ pub fn vtrn_s32(a: int32x2_t, b: int32x2_t) -> int32x2x2_t { #[cfg_attr(all(test, target_arch = "arm"), assert_instr(vtrn))] #[cfg_attr( all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), - assert_instr(zip) + assert_instr(zip1) +)] +#[cfg_attr( + all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), + assert_instr(zip2) )] #[cfg_attr( not(target_arch = "arm"), @@ -74083,7 +74095,11 @@ pub fn vuzpq_f16(a: float16x8_t, b: float16x8_t) -> float16x8x2_t { #[cfg_attr(all(test, target_arch = "arm"), assert_instr(vtrn))] #[cfg_attr( all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), - assert_instr(zip) + assert_instr(zip1) +)] +#[cfg_attr( + all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), + assert_instr(zip2) )] #[cfg_attr( not(target_arch = "arm"), @@ -74108,7 +74124,11 @@ pub fn vuzp_f32(a: float32x2_t, b: float32x2_t) -> float32x2x2_t { #[cfg_attr(all(test, target_arch = "arm"), assert_instr(vtrn))] #[cfg_attr( all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), - assert_instr(zip) + assert_instr(zip1) +)] +#[cfg_attr( + all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), + assert_instr(zip2) )] #[cfg_attr( not(target_arch = "arm"), @@ -74133,7 +74153,11 @@ pub fn vuzp_s32(a: int32x2_t, b: int32x2_t) -> int32x2x2_t { #[cfg_attr(all(test, target_arch = "arm"), assert_instr(vtrn))] #[cfg_attr( all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), - assert_instr(zip) + assert_instr(zip1) +)] +#[cfg_attr( + all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), + assert_instr(zip2) )] #[cfg_attr( not(target_arch = "arm"), @@ -74556,7 +74580,11 @@ pub fn vuzpq_p16(a: poly16x8_t, b: poly16x8_t) -> poly16x8x2_t { #[cfg_attr(all(test, target_arch = "arm"), assert_instr("vzip.16"))] #[cfg_attr( all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), - assert_instr(zip) + assert_instr(zip1) +)] +#[cfg_attr( + all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), + assert_instr(zip2) )] #[target_feature(enable = "neon,fp16")] #[unstable(feature = "stdarch_neon_f16", issue = "136306")] @@ -74574,7 +74602,11 @@ pub fn vzip_f16(a: float16x4_t, b: float16x4_t) -> float16x4x2_t { #[cfg_attr(all(test, target_arch = "arm"), assert_instr("vzip.16"))] #[cfg_attr( all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), - assert_instr(zip) + assert_instr(zip1) +)] +#[cfg_attr( + all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), + assert_instr(zip2) )] #[target_feature(enable = "neon,fp16")] #[unstable(feature = "stdarch_neon_f16", issue = "136306")] @@ -74593,7 +74625,11 @@ pub fn vzipq_f16(a: float16x8_t, b: float16x8_t) -> float16x8x2_t { #[cfg_attr(all(test, target_arch = "arm"), assert_instr(vtrn))] #[cfg_attr( all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), - assert_instr(zip) + assert_instr(zip1) +)] +#[cfg_attr( + all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), + assert_instr(zip2) )] #[cfg_attr( not(target_arch = "arm"), @@ -74618,7 +74654,11 @@ pub fn vzip_f32(a: float32x2_t, b: float32x2_t) -> float32x2x2_t { #[cfg_attr(all(test, target_arch = "arm"), assert_instr(vtrn))] #[cfg_attr( all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), - assert_instr(zip) + assert_instr(zip1) +)] +#[cfg_attr( + all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), + assert_instr(zip2) )] #[cfg_attr( not(target_arch = "arm"), @@ -74643,7 +74683,11 @@ pub fn vzip_s32(a: int32x2_t, b: int32x2_t) -> int32x2x2_t { #[cfg_attr(all(test, target_arch = "arm"), assert_instr(vtrn))] #[cfg_attr( all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), - assert_instr(zip) + assert_instr(zip1) +)] +#[cfg_attr( + all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), + assert_instr(zip2) )] #[cfg_attr( not(target_arch = "arm"), @@ -74668,7 +74712,11 @@ pub fn vzip_u32(a: uint32x2_t, b: uint32x2_t) -> uint32x2x2_t { #[cfg_attr(all(test, target_arch = "arm"), assert_instr(vzip))] #[cfg_attr( all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), - assert_instr(zip) + assert_instr(zip1) +)] +#[cfg_attr( + all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), + assert_instr(zip2) )] #[cfg_attr( not(target_arch = "arm"), @@ -74693,7 +74741,11 @@ pub fn vzip_s8(a: int8x8_t, b: int8x8_t) -> int8x8x2_t { #[cfg_attr(all(test, target_arch = "arm"), assert_instr(vzip))] #[cfg_attr( all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), - assert_instr(zip) + assert_instr(zip1) +)] +#[cfg_attr( + all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), + assert_instr(zip2) )] #[cfg_attr( not(target_arch = "arm"), @@ -74718,7 +74770,11 @@ pub fn vzip_s16(a: int16x4_t, b: int16x4_t) -> int16x4x2_t { #[cfg_attr(all(test, target_arch = "arm"), assert_instr(vzip))] #[cfg_attr( all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), - assert_instr(zip) + assert_instr(zip1) +)] +#[cfg_attr( + all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), + assert_instr(zip2) )] #[cfg_attr( not(target_arch = "arm"), @@ -74743,7 +74799,11 @@ pub fn vzip_u8(a: uint8x8_t, b: uint8x8_t) -> uint8x8x2_t { #[cfg_attr(all(test, target_arch = "arm"), assert_instr(vzip))] #[cfg_attr( all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), - assert_instr(zip) + assert_instr(zip1) +)] +#[cfg_attr( + all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), + assert_instr(zip2) )] #[cfg_attr( not(target_arch = "arm"), @@ -74768,7 +74828,11 @@ pub fn vzip_u16(a: uint16x4_t, b: uint16x4_t) -> uint16x4x2_t { #[cfg_attr(all(test, target_arch = "arm"), assert_instr(vzip))] #[cfg_attr( all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), - assert_instr(zip) + assert_instr(zip1) +)] +#[cfg_attr( + all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), + assert_instr(zip2) )] #[cfg_attr( not(target_arch = "arm"), @@ -74793,7 +74857,11 @@ pub fn vzip_p8(a: poly8x8_t, b: poly8x8_t) -> poly8x8x2_t { #[cfg_attr(all(test, target_arch = "arm"), assert_instr(vzip))] #[cfg_attr( all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), - assert_instr(zip) + assert_instr(zip1) +)] +#[cfg_attr( + all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), + assert_instr(zip2) )] #[cfg_attr( not(target_arch = "arm"), @@ -74818,7 +74886,11 @@ pub fn vzip_p16(a: poly16x4_t, b: poly16x4_t) -> poly16x4x2_t { #[cfg_attr(all(test, target_arch = "arm"), assert_instr(vorr))] #[cfg_attr( all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), - assert_instr(zip) + assert_instr(zip1) +)] +#[cfg_attr( + all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), + assert_instr(zip2) )] #[cfg_attr( not(target_arch = "arm"), @@ -74843,7 +74915,11 @@ pub fn vzipq_f32(a: float32x4_t, b: float32x4_t) -> float32x4x2_t { #[cfg_attr(all(test, target_arch = "arm"), assert_instr(vorr))] #[cfg_attr( all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), - assert_instr(zip) + assert_instr(zip1) +)] +#[cfg_attr( + all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), + assert_instr(zip2) )] #[cfg_attr( not(target_arch = "arm"), @@ -74876,7 +74952,11 @@ pub fn vzipq_s8(a: int8x16_t, b: int8x16_t) -> int8x16x2_t { #[cfg_attr(all(test, target_arch = "arm"), assert_instr(vorr))] #[cfg_attr( all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), - assert_instr(zip) + assert_instr(zip1) +)] +#[cfg_attr( + all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), + assert_instr(zip2) )] #[cfg_attr( not(target_arch = "arm"), @@ -74901,7 +74981,11 @@ pub fn vzipq_s16(a: int16x8_t, b: int16x8_t) -> int16x8x2_t { #[cfg_attr(all(test, target_arch = "arm"), assert_instr(vorr))] #[cfg_attr( all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), - assert_instr(zip) + assert_instr(zip1) +)] +#[cfg_attr( + all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), + assert_instr(zip2) )] #[cfg_attr( not(target_arch = "arm"), @@ -74926,7 +75010,11 @@ pub fn vzipq_s32(a: int32x4_t, b: int32x4_t) -> int32x4x2_t { #[cfg_attr(all(test, target_arch = "arm"), assert_instr(vorr))] #[cfg_attr( all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), - assert_instr(zip) + assert_instr(zip1) +)] +#[cfg_attr( + all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), + assert_instr(zip2) )] #[cfg_attr( not(target_arch = "arm"), @@ -74959,7 +75047,11 @@ pub fn vzipq_u8(a: uint8x16_t, b: uint8x16_t) -> uint8x16x2_t { #[cfg_attr(all(test, target_arch = "arm"), assert_instr(vorr))] #[cfg_attr( all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), - assert_instr(zip) + assert_instr(zip1) +)] +#[cfg_attr( + all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), + assert_instr(zip2) )] #[cfg_attr( not(target_arch = "arm"), @@ -74984,7 +75076,11 @@ pub fn vzipq_u16(a: uint16x8_t, b: uint16x8_t) -> uint16x8x2_t { #[cfg_attr(all(test, target_arch = "arm"), assert_instr(vorr))] #[cfg_attr( all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), - assert_instr(zip) + assert_instr(zip1) +)] +#[cfg_attr( + all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), + assert_instr(zip2) )] #[cfg_attr( not(target_arch = "arm"), @@ -75009,7 +75105,11 @@ pub fn vzipq_u32(a: uint32x4_t, b: uint32x4_t) -> uint32x4x2_t { #[cfg_attr(all(test, target_arch = "arm"), assert_instr(vorr))] #[cfg_attr( all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), - assert_instr(zip) + assert_instr(zip1) +)] +#[cfg_attr( + all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), + assert_instr(zip2) )] #[cfg_attr( not(target_arch = "arm"), @@ -75042,7 +75142,11 @@ pub fn vzipq_p8(a: poly8x16_t, b: poly8x16_t) -> poly8x16x2_t { #[cfg_attr(all(test, target_arch = "arm"), assert_instr(vorr))] #[cfg_attr( all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), - assert_instr(zip) + assert_instr(zip1) +)] +#[cfg_attr( + all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), + assert_instr(zip2) )] #[cfg_attr( not(target_arch = "arm"), diff --git a/library/stdarch/crates/stdarch-gen-arm/spec/neon/arm_shared.spec.yml b/library/stdarch/crates/stdarch-gen-arm/spec/neon/arm_shared.spec.yml index b2b4fd2f8551..8c6acd4fc55d 100644 --- a/library/stdarch/crates/stdarch-gen-arm/spec/neon/arm_shared.spec.yml +++ b/library/stdarch/crates/stdarch-gen-arm/spec/neon/arm_shared.spec.yml @@ -9601,7 +9601,8 @@ intrinsics: attr: - *neon-v7 - FnCall: [cfg_attr, [*test-is-arm, {FnCall: [assert_instr, [vtrn]]}]] - - FnCall: [cfg_attr, [*neon-target-aarch64-arm64ec, {FnCall: [assert_instr, [zip]]}]] + - FnCall: [cfg_attr, [*neon-target-aarch64-arm64ec, {FnCall: [assert_instr, [zip1]]}]] + - FnCall: [cfg_attr, [*neon-target-aarch64-arm64ec, {FnCall: [assert_instr, [zip2]]}]] - *neon-not-arm-stable - *neon-cfg-arm-unstable safety: safe @@ -9629,7 +9630,8 @@ intrinsics: attr: - *neon-v7 - FnCall: [cfg_attr, [*test-is-arm, {FnCall: [assert_instr, [vorr]]}]] - - FnCall: [cfg_attr, [*neon-target-aarch64-arm64ec, {FnCall: [assert_instr, [zip]]}]] + - FnCall: [cfg_attr, [*neon-target-aarch64-arm64ec, {FnCall: [assert_instr, [zip1]]}]] + - FnCall: [cfg_attr, [*neon-target-aarch64-arm64ec, {FnCall: [assert_instr, [zip2]]}]] - *neon-not-arm-stable - *neon-cfg-arm-unstable safety: safe @@ -9663,7 +9665,8 @@ intrinsics: attr: - *neon-v7 - FnCall: [cfg_attr, [*test-is-arm, {FnCall: [assert_instr, [vtrn]]}]] - - FnCall: [cfg_attr, [*neon-target-aarch64-arm64ec, {FnCall: [assert_instr, [zip]]}]] + - FnCall: [cfg_attr, [*neon-target-aarch64-arm64ec, {FnCall: [assert_instr, [zip1]]}]] + - FnCall: [cfg_attr, [*neon-target-aarch64-arm64ec, {FnCall: [assert_instr, [zip2]]}]] - *neon-not-arm-stable - *neon-cfg-arm-unstable safety: safe @@ -9691,7 +9694,8 @@ intrinsics: attr: - *neon-v7 - FnCall: [cfg_attr, [*test-is-arm, {FnCall: [assert_instr, [vzip]]}]] - - FnCall: [cfg_attr, [*neon-target-aarch64-arm64ec, {FnCall: [assert_instr, [zip]]}]] + - FnCall: [cfg_attr, [*neon-target-aarch64-arm64ec, {FnCall: [assert_instr, [zip1]]}]] + - FnCall: [cfg_attr, [*neon-target-aarch64-arm64ec, {FnCall: [assert_instr, [zip2]]}]] - *neon-not-arm-stable - *neon-cfg-arm-unstable safety: safe @@ -9723,7 +9727,8 @@ intrinsics: attr: - *neon-v7 - FnCall: [cfg_attr, [*test-is-arm, {FnCall: [assert_instr, ['"vzip.16"']]}]] - - FnCall: [cfg_attr, [*neon-target-aarch64-arm64ec, {FnCall: [assert_instr, [zip]]}]] + - FnCall: [cfg_attr, [*neon-target-aarch64-arm64ec, {FnCall: [assert_instr, [zip1]]}]] + - FnCall: [cfg_attr, [*neon-target-aarch64-arm64ec, {FnCall: [assert_instr, [zip2]]}]] - *neon-fp16 - *neon-unstable-f16 safety: safe @@ -9819,7 +9824,8 @@ intrinsics: attr: - *neon-v7 - FnCall: [cfg_attr, [*test-is-arm, {FnCall: [assert_instr, [vtrn]]}]] - - FnCall: [cfg_attr, [*neon-target-aarch64-arm64ec, {FnCall: [assert_instr, [zip]]}]] + - FnCall: [cfg_attr, [*neon-target-aarch64-arm64ec, {FnCall: [assert_instr, [zip1]]}]] + - FnCall: [cfg_attr, [*neon-target-aarch64-arm64ec, {FnCall: [assert_instr, [zip2]]}]] - *neon-not-arm-stable - *neon-cfg-arm-unstable safety: safe From c13e3aa6b4be163bb3c84f479b4f424023337b89 Mon Sep 17 00:00:00 2001 From: Folkert de Vries Date: Tue, 15 Jul 2025 22:12:12 +0200 Subject: [PATCH 035/139] `aarch64`: check for `uzp1` and `uzp2` --- .../src/arm_shared/neon/generated.rs | 102 +++++++++++++++--- .../spec/neon/arm_shared.spec.yml | 6 +- 2 files changed, 89 insertions(+), 19 deletions(-) diff --git a/library/stdarch/crates/core_arch/src/arm_shared/neon/generated.rs b/library/stdarch/crates/core_arch/src/arm_shared/neon/generated.rs index e6c69bebb358..8e369915868a 100644 --- a/library/stdarch/crates/core_arch/src/arm_shared/neon/generated.rs +++ b/library/stdarch/crates/core_arch/src/arm_shared/neon/generated.rs @@ -74058,7 +74058,11 @@ pub fn vusmmlaq_s32(a: int32x4_t, b: uint8x16_t, c: int8x16_t) -> int32x4_t { #[cfg_attr(all(test, target_arch = "arm"), assert_instr(vuzp))] #[cfg_attr( all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), - assert_instr(uzp) + assert_instr(uzp1) +)] +#[cfg_attr( + all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), + assert_instr(uzp2) )] #[target_feature(enable = "neon,fp16")] #[unstable(feature = "stdarch_neon_f16", issue = "136306")] @@ -74076,7 +74080,11 @@ pub fn vuzp_f16(a: float16x4_t, b: float16x4_t) -> float16x4x2_t { #[cfg_attr(all(test, target_arch = "arm"), assert_instr(vuzp))] #[cfg_attr( all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), - assert_instr(uzp) + assert_instr(uzp1) +)] +#[cfg_attr( + all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), + assert_instr(uzp2) )] #[target_feature(enable = "neon,fp16")] #[unstable(feature = "stdarch_neon_f16", issue = "136306")] @@ -74182,7 +74190,11 @@ pub fn vuzp_u32(a: uint32x2_t, b: uint32x2_t) -> uint32x2x2_t { #[cfg_attr(all(test, target_arch = "arm"), assert_instr(vuzp))] #[cfg_attr( all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), - assert_instr(uzp) + assert_instr(uzp1) +)] +#[cfg_attr( + all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), + assert_instr(uzp2) )] #[cfg_attr( not(target_arch = "arm"), @@ -74207,7 +74219,11 @@ pub fn vuzpq_f32(a: float32x4_t, b: float32x4_t) -> float32x4x2_t { #[cfg_attr(all(test, target_arch = "arm"), assert_instr(vuzp))] #[cfg_attr( all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), - assert_instr(uzp) + assert_instr(uzp1) +)] +#[cfg_attr( + all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), + assert_instr(uzp2) )] #[cfg_attr( not(target_arch = "arm"), @@ -74232,7 +74248,11 @@ pub fn vuzp_s8(a: int8x8_t, b: int8x8_t) -> int8x8x2_t { #[cfg_attr(all(test, target_arch = "arm"), assert_instr(vuzp))] #[cfg_attr( all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), - assert_instr(uzp) + assert_instr(uzp1) +)] +#[cfg_attr( + all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), + assert_instr(uzp2) )] #[cfg_attr( not(target_arch = "arm"), @@ -74265,7 +74285,11 @@ pub fn vuzpq_s8(a: int8x16_t, b: int8x16_t) -> int8x16x2_t { #[cfg_attr(all(test, target_arch = "arm"), assert_instr(vuzp))] #[cfg_attr( all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), - assert_instr(uzp) + assert_instr(uzp1) +)] +#[cfg_attr( + all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), + assert_instr(uzp2) )] #[cfg_attr( not(target_arch = "arm"), @@ -74290,7 +74314,11 @@ pub fn vuzp_s16(a: int16x4_t, b: int16x4_t) -> int16x4x2_t { #[cfg_attr(all(test, target_arch = "arm"), assert_instr(vuzp))] #[cfg_attr( all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), - assert_instr(uzp) + assert_instr(uzp1) +)] +#[cfg_attr( + all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), + assert_instr(uzp2) )] #[cfg_attr( not(target_arch = "arm"), @@ -74315,7 +74343,11 @@ pub fn vuzpq_s16(a: int16x8_t, b: int16x8_t) -> int16x8x2_t { #[cfg_attr(all(test, target_arch = "arm"), assert_instr(vuzp))] #[cfg_attr( all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), - assert_instr(uzp) + assert_instr(uzp1) +)] +#[cfg_attr( + all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), + assert_instr(uzp2) )] #[cfg_attr( not(target_arch = "arm"), @@ -74340,7 +74372,11 @@ pub fn vuzpq_s32(a: int32x4_t, b: int32x4_t) -> int32x4x2_t { #[cfg_attr(all(test, target_arch = "arm"), assert_instr(vuzp))] #[cfg_attr( all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), - assert_instr(uzp) + assert_instr(uzp1) +)] +#[cfg_attr( + all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), + assert_instr(uzp2) )] #[cfg_attr( not(target_arch = "arm"), @@ -74365,7 +74401,11 @@ pub fn vuzp_u8(a: uint8x8_t, b: uint8x8_t) -> uint8x8x2_t { #[cfg_attr(all(test, target_arch = "arm"), assert_instr(vuzp))] #[cfg_attr( all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), - assert_instr(uzp) + assert_instr(uzp1) +)] +#[cfg_attr( + all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), + assert_instr(uzp2) )] #[cfg_attr( not(target_arch = "arm"), @@ -74398,7 +74438,11 @@ pub fn vuzpq_u8(a: uint8x16_t, b: uint8x16_t) -> uint8x16x2_t { #[cfg_attr(all(test, target_arch = "arm"), assert_instr(vuzp))] #[cfg_attr( all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), - assert_instr(uzp) + assert_instr(uzp1) +)] +#[cfg_attr( + all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), + assert_instr(uzp2) )] #[cfg_attr( not(target_arch = "arm"), @@ -74423,7 +74467,11 @@ pub fn vuzp_u16(a: uint16x4_t, b: uint16x4_t) -> uint16x4x2_t { #[cfg_attr(all(test, target_arch = "arm"), assert_instr(vuzp))] #[cfg_attr( all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), - assert_instr(uzp) + assert_instr(uzp1) +)] +#[cfg_attr( + all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), + assert_instr(uzp2) )] #[cfg_attr( not(target_arch = "arm"), @@ -74448,7 +74496,11 @@ pub fn vuzpq_u16(a: uint16x8_t, b: uint16x8_t) -> uint16x8x2_t { #[cfg_attr(all(test, target_arch = "arm"), assert_instr(vuzp))] #[cfg_attr( all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), - assert_instr(uzp) + assert_instr(uzp1) +)] +#[cfg_attr( + all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), + assert_instr(uzp2) )] #[cfg_attr( not(target_arch = "arm"), @@ -74473,7 +74525,11 @@ pub fn vuzpq_u32(a: uint32x4_t, b: uint32x4_t) -> uint32x4x2_t { #[cfg_attr(all(test, target_arch = "arm"), assert_instr(vuzp))] #[cfg_attr( all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), - assert_instr(uzp) + assert_instr(uzp1) +)] +#[cfg_attr( + all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), + assert_instr(uzp2) )] #[cfg_attr( not(target_arch = "arm"), @@ -74498,7 +74554,11 @@ pub fn vuzp_p8(a: poly8x8_t, b: poly8x8_t) -> poly8x8x2_t { #[cfg_attr(all(test, target_arch = "arm"), assert_instr(vuzp))] #[cfg_attr( all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), - assert_instr(uzp) + assert_instr(uzp1) +)] +#[cfg_attr( + all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), + assert_instr(uzp2) )] #[cfg_attr( not(target_arch = "arm"), @@ -74531,7 +74591,11 @@ pub fn vuzpq_p8(a: poly8x16_t, b: poly8x16_t) -> poly8x16x2_t { #[cfg_attr(all(test, target_arch = "arm"), assert_instr(vuzp))] #[cfg_attr( all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), - assert_instr(uzp) + assert_instr(uzp1) +)] +#[cfg_attr( + all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), + assert_instr(uzp2) )] #[cfg_attr( not(target_arch = "arm"), @@ -74556,7 +74620,11 @@ pub fn vuzp_p16(a: poly16x4_t, b: poly16x4_t) -> poly16x4x2_t { #[cfg_attr(all(test, target_arch = "arm"), assert_instr(vuzp))] #[cfg_attr( all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), - assert_instr(uzp) + assert_instr(uzp1) +)] +#[cfg_attr( + all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), + assert_instr(uzp2) )] #[cfg_attr( not(target_arch = "arm"), diff --git a/library/stdarch/crates/stdarch-gen-arm/spec/neon/arm_shared.spec.yml b/library/stdarch/crates/stdarch-gen-arm/spec/neon/arm_shared.spec.yml index 8c6acd4fc55d..3bf8bc1f4360 100644 --- a/library/stdarch/crates/stdarch-gen-arm/spec/neon/arm_shared.spec.yml +++ b/library/stdarch/crates/stdarch-gen-arm/spec/neon/arm_shared.spec.yml @@ -9755,7 +9755,8 @@ intrinsics: attr: - *neon-v7 - FnCall: [cfg_attr, [*test-is-arm, {FnCall: [assert_instr, [vuzp]]}]] - - FnCall: [cfg_attr, [*neon-target-aarch64-arm64ec, {FnCall: [assert_instr, [uzp]]}]] + - FnCall: [cfg_attr, [*neon-target-aarch64-arm64ec, {FnCall: [assert_instr, [uzp1]]}]] + - FnCall: [cfg_attr, [*neon-target-aarch64-arm64ec, {FnCall: [assert_instr, [uzp2]]}]] - *neon-not-arm-stable - *neon-cfg-arm-unstable safety: safe @@ -9796,7 +9797,8 @@ intrinsics: attr: - *neon-v7 - FnCall: [cfg_attr, [*test-is-arm, {FnCall: [assert_instr, [vuzp]]}]] - - FnCall: [cfg_attr, [*neon-target-aarch64-arm64ec, {FnCall: [assert_instr, [uzp]]}]] + - FnCall: [cfg_attr, [*neon-target-aarch64-arm64ec, {FnCall: [assert_instr, [uzp1]]}]] + - FnCall: [cfg_attr, [*neon-target-aarch64-arm64ec, {FnCall: [assert_instr, [uzp2]]}]] - *neon-fp16 - *neon-unstable-f16 safety: safe From bdd1ca1eeaf9ad3348aaa8039b98188bcd3bea6d Mon Sep 17 00:00:00 2001 From: Folkert de Vries Date: Tue, 15 Jul 2025 22:14:21 +0200 Subject: [PATCH 036/139] `aarch64`: check for `trn1` and `trn2` --- .../src/arm_shared/neon/generated.rs | 102 +++++++++++++++--- .../spec/neon/arm_shared.spec.yml | 6 +- 2 files changed, 89 insertions(+), 19 deletions(-) diff --git a/library/stdarch/crates/core_arch/src/arm_shared/neon/generated.rs b/library/stdarch/crates/core_arch/src/arm_shared/neon/generated.rs index 8e369915868a..32531c7da135 100644 --- a/library/stdarch/crates/core_arch/src/arm_shared/neon/generated.rs +++ b/library/stdarch/crates/core_arch/src/arm_shared/neon/generated.rs @@ -72994,7 +72994,11 @@ pub fn vtbx4_p8(a: poly8x8_t, b: poly8x8x4_t, c: uint8x8_t) -> poly8x8_t { #[cfg_attr(all(test, target_arch = "arm"), assert_instr(vtrn))] #[cfg_attr( all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), - assert_instr(trn) + assert_instr(trn1) +)] +#[cfg_attr( + all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), + assert_instr(trn2) )] #[target_feature(enable = "neon,fp16")] #[unstable(feature = "stdarch_neon_f16", issue = "136306")] @@ -73012,7 +73016,11 @@ pub fn vtrn_f16(a: float16x4_t, b: float16x4_t) -> float16x4x2_t { #[cfg_attr(all(test, target_arch = "arm"), assert_instr(vtrn))] #[cfg_attr( all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), - assert_instr(trn) + assert_instr(trn1) +)] +#[cfg_attr( + all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), + assert_instr(trn2) )] #[target_feature(enable = "neon,fp16")] #[unstable(feature = "stdarch_neon_f16", issue = "136306")] @@ -73118,7 +73126,11 @@ pub fn vtrn_u32(a: uint32x2_t, b: uint32x2_t) -> uint32x2x2_t { #[cfg_attr(all(test, target_arch = "arm"), assert_instr(vtrn))] #[cfg_attr( all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), - assert_instr(trn) + assert_instr(trn1) +)] +#[cfg_attr( + all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), + assert_instr(trn2) )] #[cfg_attr( not(target_arch = "arm"), @@ -73143,7 +73155,11 @@ pub fn vtrnq_f32(a: float32x4_t, b: float32x4_t) -> float32x4x2_t { #[cfg_attr(all(test, target_arch = "arm"), assert_instr(vtrn))] #[cfg_attr( all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), - assert_instr(trn) + assert_instr(trn1) +)] +#[cfg_attr( + all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), + assert_instr(trn2) )] #[cfg_attr( not(target_arch = "arm"), @@ -73168,7 +73184,11 @@ pub fn vtrn_s8(a: int8x8_t, b: int8x8_t) -> int8x8x2_t { #[cfg_attr(all(test, target_arch = "arm"), assert_instr(vtrn))] #[cfg_attr( all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), - assert_instr(trn) + assert_instr(trn1) +)] +#[cfg_attr( + all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), + assert_instr(trn2) )] #[cfg_attr( not(target_arch = "arm"), @@ -73201,7 +73221,11 @@ pub fn vtrnq_s8(a: int8x16_t, b: int8x16_t) -> int8x16x2_t { #[cfg_attr(all(test, target_arch = "arm"), assert_instr(vtrn))] #[cfg_attr( all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), - assert_instr(trn) + assert_instr(trn1) +)] +#[cfg_attr( + all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), + assert_instr(trn2) )] #[cfg_attr( not(target_arch = "arm"), @@ -73226,7 +73250,11 @@ pub fn vtrn_s16(a: int16x4_t, b: int16x4_t) -> int16x4x2_t { #[cfg_attr(all(test, target_arch = "arm"), assert_instr(vtrn))] #[cfg_attr( all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), - assert_instr(trn) + assert_instr(trn1) +)] +#[cfg_attr( + all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), + assert_instr(trn2) )] #[cfg_attr( not(target_arch = "arm"), @@ -73251,7 +73279,11 @@ pub fn vtrnq_s16(a: int16x8_t, b: int16x8_t) -> int16x8x2_t { #[cfg_attr(all(test, target_arch = "arm"), assert_instr(vtrn))] #[cfg_attr( all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), - assert_instr(trn) + assert_instr(trn1) +)] +#[cfg_attr( + all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), + assert_instr(trn2) )] #[cfg_attr( not(target_arch = "arm"), @@ -73276,7 +73308,11 @@ pub fn vtrnq_s32(a: int32x4_t, b: int32x4_t) -> int32x4x2_t { #[cfg_attr(all(test, target_arch = "arm"), assert_instr(vtrn))] #[cfg_attr( all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), - assert_instr(trn) + assert_instr(trn1) +)] +#[cfg_attr( + all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), + assert_instr(trn2) )] #[cfg_attr( not(target_arch = "arm"), @@ -73301,7 +73337,11 @@ pub fn vtrn_u8(a: uint8x8_t, b: uint8x8_t) -> uint8x8x2_t { #[cfg_attr(all(test, target_arch = "arm"), assert_instr(vtrn))] #[cfg_attr( all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), - assert_instr(trn) + assert_instr(trn1) +)] +#[cfg_attr( + all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), + assert_instr(trn2) )] #[cfg_attr( not(target_arch = "arm"), @@ -73334,7 +73374,11 @@ pub fn vtrnq_u8(a: uint8x16_t, b: uint8x16_t) -> uint8x16x2_t { #[cfg_attr(all(test, target_arch = "arm"), assert_instr(vtrn))] #[cfg_attr( all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), - assert_instr(trn) + assert_instr(trn1) +)] +#[cfg_attr( + all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), + assert_instr(trn2) )] #[cfg_attr( not(target_arch = "arm"), @@ -73359,7 +73403,11 @@ pub fn vtrn_u16(a: uint16x4_t, b: uint16x4_t) -> uint16x4x2_t { #[cfg_attr(all(test, target_arch = "arm"), assert_instr(vtrn))] #[cfg_attr( all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), - assert_instr(trn) + assert_instr(trn1) +)] +#[cfg_attr( + all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), + assert_instr(trn2) )] #[cfg_attr( not(target_arch = "arm"), @@ -73384,7 +73432,11 @@ pub fn vtrnq_u16(a: uint16x8_t, b: uint16x8_t) -> uint16x8x2_t { #[cfg_attr(all(test, target_arch = "arm"), assert_instr(vtrn))] #[cfg_attr( all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), - assert_instr(trn) + assert_instr(trn1) +)] +#[cfg_attr( + all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), + assert_instr(trn2) )] #[cfg_attr( not(target_arch = "arm"), @@ -73409,7 +73461,11 @@ pub fn vtrnq_u32(a: uint32x4_t, b: uint32x4_t) -> uint32x4x2_t { #[cfg_attr(all(test, target_arch = "arm"), assert_instr(vtrn))] #[cfg_attr( all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), - assert_instr(trn) + assert_instr(trn1) +)] +#[cfg_attr( + all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), + assert_instr(trn2) )] #[cfg_attr( not(target_arch = "arm"), @@ -73434,7 +73490,11 @@ pub fn vtrn_p8(a: poly8x8_t, b: poly8x8_t) -> poly8x8x2_t { #[cfg_attr(all(test, target_arch = "arm"), assert_instr(vtrn))] #[cfg_attr( all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), - assert_instr(trn) + assert_instr(trn1) +)] +#[cfg_attr( + all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), + assert_instr(trn2) )] #[cfg_attr( not(target_arch = "arm"), @@ -73467,7 +73527,11 @@ pub fn vtrnq_p8(a: poly8x16_t, b: poly8x16_t) -> poly8x16x2_t { #[cfg_attr(all(test, target_arch = "arm"), assert_instr(vtrn))] #[cfg_attr( all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), - assert_instr(trn) + assert_instr(trn1) +)] +#[cfg_attr( + all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), + assert_instr(trn2) )] #[cfg_attr( not(target_arch = "arm"), @@ -73492,7 +73556,11 @@ pub fn vtrn_p16(a: poly16x4_t, b: poly16x4_t) -> poly16x4x2_t { #[cfg_attr(all(test, target_arch = "arm"), assert_instr(vtrn))] #[cfg_attr( all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), - assert_instr(trn) + assert_instr(trn1) +)] +#[cfg_attr( + all(test, any(target_arch = "aarch64", target_arch = "arm64ec")), + assert_instr(trn2) )] #[cfg_attr( not(target_arch = "arm"), diff --git a/library/stdarch/crates/stdarch-gen-arm/spec/neon/arm_shared.spec.yml b/library/stdarch/crates/stdarch-gen-arm/spec/neon/arm_shared.spec.yml index 3bf8bc1f4360..c96c6e2a0c0b 100644 --- a/library/stdarch/crates/stdarch-gen-arm/spec/neon/arm_shared.spec.yml +++ b/library/stdarch/crates/stdarch-gen-arm/spec/neon/arm_shared.spec.yml @@ -9532,7 +9532,8 @@ intrinsics: attr: - *neon-v7 - FnCall: [cfg_attr, [*test-is-arm, {FnCall: [assert_instr, [vtrn]]}]] - - FnCall: [cfg_attr, [*neon-target-aarch64-arm64ec, {FnCall: [assert_instr, [trn]]}]] + - FnCall: [cfg_attr, [*neon-target-aarch64-arm64ec, {FnCall: [assert_instr, [trn1]]}]] + - FnCall: [cfg_attr, [*neon-target-aarch64-arm64ec, {FnCall: [assert_instr, [trn2]]}]] - *neon-not-arm-stable - *neon-cfg-arm-unstable safety: safe @@ -9573,7 +9574,8 @@ intrinsics: attr: - *neon-v7 - FnCall: [cfg_attr, [*test-is-arm, {FnCall: [assert_instr, [vtrn]]}]] - - FnCall: [cfg_attr, [*neon-target-aarch64-arm64ec, {FnCall: [assert_instr, [trn]]}]] + - FnCall: [cfg_attr, [*neon-target-aarch64-arm64ec, {FnCall: [assert_instr, [trn1]]}]] + - FnCall: [cfg_attr, [*neon-target-aarch64-arm64ec, {FnCall: [assert_instr, [trn2]]}]] - *neon-fp16 - *neon-unstable-f16 safety: safe From 41e6f767b64cebd08e1a25b18dfea7c13bf36a6a Mon Sep 17 00:00:00 2001 From: dianne Date: Wed, 16 Jul 2025 01:44:02 -0700 Subject: [PATCH 037/139] future-incompat lints: don't link to the nightly edition-guide version --- compiler/rustc_hir_typeck/src/upvar.rs | 2 +- compiler/rustc_lint/messages.ftl | 2 +- compiler/rustc_lint/src/builtin.rs | 4 +- compiler/rustc_lint/src/if_let_rescope.rs | 2 +- .../rustc_lint/src/impl_trait_overcaptures.rs | 2 +- ..._expr_fragment_specifier_2024_migration.rs | 4 +- compiler/rustc_lint/src/shadowed_into_iter.rs | 4 +- compiler/rustc_lint/src/static_mut_refs.rs | 2 +- compiler/rustc_lint_defs/src/builtin.rs | 26 +++++----- .../checked_unwrap/simple_conditionals.stderr | 2 +- ...rowck-unsafe-static-mutable-borrows.stderr | 2 +- .../2229_closure_analysis/issue-90465.stderr | 2 +- .../migrations/auto_traits.stderr | 6 +-- .../closure-body-macro-fragment.stderr | 2 +- .../insignificant_drop_attr_migrations.stderr | 4 +- .../migrations/macro.stderr | 2 +- .../migrations/migrations_rustfix.stderr | 4 +- .../migrations/mir_calls_to_shims.stderr | 2 +- .../migrations/multi_diagnostics.stderr | 10 ++-- .../migrations/precise.stderr | 4 +- .../migrations/significant_drop.stderr | 20 +++---- .../const_panic_stability.e2018.stderr | 2 +- tests/ui/consts/const_let_assign2.stderr | 2 +- .../const_refs_to_static-ice-121413.stderr | 2 +- .../bad-assoc-ty.edition2015.stderr | 2 +- .../drop/drop-order-comparisons.e2021.stderr | 30 +++++------ ...nt-if-let-rescope-gated.edition2021.stderr | 2 +- .../lint-if-let-rescope-with-macro.stderr | 2 +- tests/ui/drop/lint-if-let-rescope.stderr | 16 +++--- .../lint-tail-expr-drop-order-borrowck.stderr | 8 +-- .../ui/drop/lint-tail-expr-drop-order.stderr | 16 +++--- ...expr_drop_order-on-coroutine-unwind.stderr | 2 +- .../avoid-ice-on-warning-2.old.stderr | 4 +- .../avoid-ice-on-warning-3.old.stderr | 12 ++--- .../avoid-ice-on-warning.old.stderr | 2 +- .../bare-trait-dont-suggest-dyn.old.stderr | 2 +- .../dyn-keyword/dyn-2018-edition-lint.stderr | 6 +-- .../ui/dyn-keyword/dyn-angle-brackets.stderr | 2 +- .../never-type-fallback-breaking.e2021.stderr | 20 +++---- .../closure/rfc2229-migration.stderr | 2 +- ...dynless-turbofish-e0191-issue-91997.stderr | 2 +- ...lifetime-from-bare-trait-obj-114664.stderr | 4 +- ...vercaptures-2024-machine-applicable.stderr | 2 +- .../overcaptures-2024.stderr | 16 +++--- tests/ui/issues/issue-28344.stderr | 4 +- tests/ui/issues/issue-39367.stderr | 2 +- tests/ui/issues/issue-58734.stderr | 2 +- tests/ui/issues/issue-86756.stderr | 2 +- .../iterators/into-iter-on-arrays-2018.stderr | 10 ++-- .../iterators/into-iter-on-arrays-lint.stderr | 24 ++++----- .../into-iter-on-boxed-slices-2021.stderr | 10 ++-- .../into-iter-on-boxed-slices-lint.stderr | 6 +-- tests/ui/lint/bare-trait-objects-path.stderr | 8 +-- .../allowed-group-warn-by-default-lint.stderr | 2 +- .../ui/lint/force-warn/cap-lints-allow.stderr | 2 +- ...s-warn-allowed-warn-by-default-lint.stderr | 2 +- ...up-allowed-cli-warn-by-default-lint.stderr | 2 +- .../lint-group-allowed-lint-group.stderr | 2 +- ...-group-allowed-warn-by-default-lint.stderr | 2 +- .../inclusive-range-pattern-syntax.stderr | 4 +- .../ui/lint/lint-attr-everywhere-early.stderr | 4 +- tests/ui/lint/static-mut-refs.e2021.stderr | 24 ++++----- tests/ui/lint/static-mut-refs.e2024.stderr | 24 ++++----- .../macros/expr_2021_cargo_fix_edition.stderr | 4 +- .../macro-or-patterns-back-compat.stderr | 8 +-- tests/ui/macros/non-fmt-panic.stderr | 52 +++++++++---------- .../defaulted-never-note.nofallback.stderr | 4 +- .../dependency-on-fallback-to-unit.stderr | 8 +-- ...ng-fallback-control-flow.nofallback.stderr | 8 +-- ...verging-fallback-no-leak.nofallback.stderr | 4 +- ...ack-unconstrained-return.nofallback.stderr | 4 +- ...nt-suggest-turbofish-from-expansion.stderr | 4 +- .../fallback-closure-ret.nofallback.stderr | 4 +- .../ui/never_type/impl_trait_fallback.stderr | 4 +- ...int-breaking-2024-assign-underscore.stderr | 4 +- ...-fallback-flowing-into-unsafe.e2015.stderr | 40 +++++++------- ...-fallback-flowing-into-unsafe.e2024.stderr | 40 +++++++------- ...local-static-mut-borrow-outlives-fn.stderr | 2 +- .../parser/recover/recover-pat-ranges.stderr | 2 +- .../parser/recover/recover-range-pats.stderr | 18 +++---- .../parser/trait-object-trait-parens.stderr | 6 +-- .../range-inclusive-pattern-precedence.stderr | 2 +- ...range-inclusive-pattern-precedence2.stderr | 2 +- .../safe-calls.stderr | 2 +- .../array-into-iter-ambiguous.stderr | 2 +- ...ure-prelude-collision-generic-trait.stderr | 2 +- .../future-prelude-collision-generic.stderr | 6 +-- .../future-prelude-collision-imported.stderr | 8 +-- .../future-prelude-collision-macros.stderr | 4 +- .../future-prelude-collision-turbofish.stderr | 4 +- .../rust-2021/future-prelude-collision.stderr | 16 +++--- .../rust-2021/generic-type-collision.stderr | 2 +- .../rust-2021/inherent-dyn-collision.stderr | 2 +- .../reserved-prefixes-migration.stderr | 10 ++-- .../box-slice-into-iter-ambiguous.stderr | 2 +- tests/ui/rust-2024/gen-kw.e2015.stderr | 16 +++--- tests/ui/rust-2024/gen-kw.e2018.stderr | 16 +++--- .../future-poll-async-block.e2021.stderr | 2 +- ...future-poll-not-future-pinned.e2021.stderr | 2 +- .../in_2024_compatibility.stderr | 2 +- .../into-future-adt.e2021.stderr | 2 +- .../into-future-not-into-future.e2021.stderr | 2 +- .../reserved-guarded-strings-lexing.stderr | 36 ++++++------- .../reserved-guarded-strings-migration.stderr | 44 ++++++++-------- .../in_2024_compatibility.stderr | 2 +- .../unsafe-attributes-fix.stderr | 14 ++--- .../ui/rust-2024/unsafe-env-suggestion.stderr | 4 +- tests/ui/rust-2024/unsafe-env.e2021.stderr | 2 +- tests/ui/rust-2024/unsafe-env.e2024.stderr | 6 +-- .../unsafe-extern-suggestion.stderr | 2 +- tests/ui/statics/issue-15261.stderr | 2 +- .../statics/static-mut-shared-parens.stderr | 4 +- tests/ui/statics/static-mut-xc.stderr | 14 ++--- tests/ui/statics/static-recursive.stderr | 4 +- tests/ui/suggestions/issue-116434-2015.stderr | 8 +-- tests/ui/suggestions/issue-61963.stderr | 4 +- .../suggest-swapping-self-ty-and-trait.stderr | 6 +-- .../ui/traits/bound/not-on-bare-trait.stderr | 2 +- .../missing-for-type-in-impl.e2015.stderr | 4 +- .../unspecified-self-in-trait-ref.stderr | 10 ++-- ...edition-2024-unsafe_op_in_unsafe_fn.stderr | 2 +- .../edition_2024_default.stderr | 2 +- .../in_2024_compatibility.stderr | 2 +- .../rfc-2585-unsafe_op_in_unsafe_fn.stderr | 12 ++--- .../wrapping-unsafe-block-sugg.stderr | 16 +++--- ...ir-wf-check-anon-const-issue-122989.stderr | 4 +- 126 files changed, 465 insertions(+), 465 deletions(-) diff --git a/compiler/rustc_hir_typeck/src/upvar.rs b/compiler/rustc_hir_typeck/src/upvar.rs index be774106abf8..df38c3a12143 100644 --- a/compiler/rustc_hir_typeck/src/upvar.rs +++ b/compiler/rustc_hir_typeck/src/upvar.rs @@ -1047,7 +1047,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } } } - lint.note("for more information, see "); + lint.note("for more information, see "); let diagnostic_msg = format!( "add a dummy let to cause {migrated_variables_concat} to be fully captured" diff --git a/compiler/rustc_lint/messages.ftl b/compiler/rustc_lint/messages.ftl index 8d9f2385b710..1ff253a20210 100644 --- a/compiler/rustc_lint/messages.ftl +++ b/compiler/rustc_lint/messages.ftl @@ -569,7 +569,7 @@ lint_non_camel_case_type = {$sort} `{$name}` should have an upper camel case nam lint_non_fmt_panic = panic message is not a string literal .note = this usage of `{$name}!()` is deprecated; it will be a hard error in Rust 2021 - .more_info_note = for more information, see + .more_info_note = for more information, see .supports_fmt_note = the `{$name}!()` macro supports formatting, so there's no need for the `format!()` macro here .supports_fmt_suggestion = remove the `format!(..)` macro call .display_suggestion = add a "{"{"}{"}"}" format string to `Display` the message diff --git a/compiler/rustc_lint/src/builtin.rs b/compiler/rustc_lint/src/builtin.rs index 255ff56f62b1..c736775d7f83 100644 --- a/compiler/rustc_lint/src/builtin.rs +++ b/compiler/rustc_lint/src/builtin.rs @@ -1651,7 +1651,7 @@ declare_lint! { "`...` range patterns are deprecated", @future_incompatible = FutureIncompatibleInfo { reason: FutureIncompatibilityReason::EditionError(Edition::Edition2021), - reference: "", + reference: "", }; } @@ -1832,7 +1832,7 @@ declare_lint! { "detects edition keywords being used as an identifier", @future_incompatible = FutureIncompatibleInfo { reason: FutureIncompatibilityReason::EditionError(Edition::Edition2024), - reference: "", + reference: "", }; } diff --git a/compiler/rustc_lint/src/if_let_rescope.rs b/compiler/rustc_lint/src/if_let_rescope.rs index 263ea6fa0708..ff67ed1bc553 100644 --- a/compiler/rustc_lint/src/if_let_rescope.rs +++ b/compiler/rustc_lint/src/if_let_rescope.rs @@ -87,7 +87,7 @@ declare_lint! { rewriting in `match` is an option to preserve the semantics up to Edition 2021", @future_incompatible = FutureIncompatibleInfo { reason: FutureIncompatibilityReason::EditionSemanticsChange(Edition::Edition2024), - reference: "", + reference: "", }; } diff --git a/compiler/rustc_lint/src/impl_trait_overcaptures.rs b/compiler/rustc_lint/src/impl_trait_overcaptures.rs index c17281deff4e..b9afb62cf1c6 100644 --- a/compiler/rustc_lint/src/impl_trait_overcaptures.rs +++ b/compiler/rustc_lint/src/impl_trait_overcaptures.rs @@ -71,7 +71,7 @@ declare_lint! { "`impl Trait` will capture more lifetimes than possibly intended in edition 2024", @future_incompatible = FutureIncompatibleInfo { reason: FutureIncompatibilityReason::EditionSemanticsChange(Edition::Edition2024), - reference: "", + reference: "", }; } diff --git a/compiler/rustc_lint/src/macro_expr_fragment_specifier_2024_migration.rs b/compiler/rustc_lint/src/macro_expr_fragment_specifier_2024_migration.rs index ce280fef8b62..7de6fbd941b4 100644 --- a/compiler/rustc_lint/src/macro_expr_fragment_specifier_2024_migration.rs +++ b/compiler/rustc_lint/src/macro_expr_fragment_specifier_2024_migration.rs @@ -65,7 +65,7 @@ declare_lint! { /// to ensure the macros implement the desired behavior. /// /// [editions]: https://doc.rust-lang.org/edition-guide/ - /// [macro matcher fragment specifiers]: https://doc.rust-lang.org/nightly/edition-guide/rust-2024/macro-fragment-specifiers.html + /// [macro matcher fragment specifiers]: https://doc.rust-lang.org/edition-guide/rust-2024/macro-fragment-specifiers.html /// [`cargo fix`]: https://doc.rust-lang.org/cargo/commands/cargo-fix.html pub EDITION_2024_EXPR_FRAGMENT_SPECIFIER, Allow, @@ -73,7 +73,7 @@ declare_lint! { To keep the existing behavior, use the `expr_2021` fragment specifier.", @future_incompatible = FutureIncompatibleInfo { reason: FutureIncompatibilityReason::EditionSemanticsChange(Edition::Edition2024), - reference: "Migration Guide ", + reference: "Migration Guide ", }; } diff --git a/compiler/rustc_lint/src/shadowed_into_iter.rs b/compiler/rustc_lint/src/shadowed_into_iter.rs index 00fa0499556c..d296ae46f43e 100644 --- a/compiler/rustc_lint/src/shadowed_into_iter.rs +++ b/compiler/rustc_lint/src/shadowed_into_iter.rs @@ -32,7 +32,7 @@ declare_lint! { "detects calling `into_iter` on arrays in Rust 2015 and 2018", @future_incompatible = FutureIncompatibleInfo { reason: FutureIncompatibilityReason::EditionSemanticsChange(Edition::Edition2021), - reference: "", + reference: "", }; } @@ -61,7 +61,7 @@ declare_lint! { "detects calling `into_iter` on boxed slices in Rust 2015, 2018, and 2021", @future_incompatible = FutureIncompatibleInfo { reason: FutureIncompatibilityReason::EditionSemanticsChange(Edition::Edition2024), - reference: "" + reference: "" }; } diff --git a/compiler/rustc_lint/src/static_mut_refs.rs b/compiler/rustc_lint/src/static_mut_refs.rs index 4dda3c7951b8..16e1fb0192b3 100644 --- a/compiler/rustc_lint/src/static_mut_refs.rs +++ b/compiler/rustc_lint/src/static_mut_refs.rs @@ -54,7 +54,7 @@ declare_lint! { "creating a shared reference to mutable static", @future_incompatible = FutureIncompatibleInfo { reason: FutureIncompatibilityReason::EditionError(Edition::Edition2024), - reference: "", + reference: "", explain_reason: false, }; @edition Edition2024 => Deny; diff --git a/compiler/rustc_lint_defs/src/builtin.rs b/compiler/rustc_lint_defs/src/builtin.rs index a08d68e2d153..b1edb5c30442 100644 --- a/compiler/rustc_lint_defs/src/builtin.rs +++ b/compiler/rustc_lint_defs/src/builtin.rs @@ -1814,7 +1814,7 @@ declare_lint! { "suggest using `dyn Trait` for trait objects", @future_incompatible = FutureIncompatibleInfo { reason: FutureIncompatibilityReason::EditionError(Edition::Edition2021), - reference: "", + reference: "", }; } @@ -2472,7 +2472,7 @@ declare_lint! { "unsafe operations in unsafe functions without an explicit unsafe block are deprecated", @future_incompatible = FutureIncompatibleInfo { reason: FutureIncompatibilityReason::EditionSemanticsChange(Edition::Edition2024), - reference: "", + reference: "", explain_reason: false }; @edition Edition2024 => Warn; @@ -3445,7 +3445,7 @@ declare_lint! { "detects usage of old versions of or-patterns", @future_incompatible = FutureIncompatibleInfo { reason: FutureIncompatibilityReason::EditionError(Edition::Edition2021), - reference: "", + reference: "", }; } @@ -3494,7 +3494,7 @@ declare_lint! { prelude in future editions", @future_incompatible = FutureIncompatibleInfo { reason: FutureIncompatibilityReason::EditionError(Edition::Edition2021), - reference: "", + reference: "", }; } @@ -3534,7 +3534,7 @@ declare_lint! { prelude in future editions", @future_incompatible = FutureIncompatibleInfo { reason: FutureIncompatibilityReason::EditionError(Edition::Edition2024), - reference: "", + reference: "", }; } @@ -3571,7 +3571,7 @@ declare_lint! { "identifiers that will be parsed as a prefix in Rust 2021", @future_incompatible = FutureIncompatibleInfo { reason: FutureIncompatibilityReason::EditionError(Edition::Edition2021), - reference: "", + reference: "", }; crate_level_only } @@ -4100,7 +4100,7 @@ declare_lint! { "never type fallback affecting unsafe function calls", @future_incompatible = FutureIncompatibleInfo { reason: FutureIncompatibilityReason::EditionAndFutureReleaseSemanticsChange(Edition::Edition2024), - reference: "", + reference: "", report_in_deps: true, }; @edition Edition2024 => Deny; @@ -4155,7 +4155,7 @@ declare_lint! { "never type fallback affecting unsafe function calls", @future_incompatible = FutureIncompatibleInfo { reason: FutureIncompatibilityReason::EditionAndFutureReleaseError(Edition::Edition2024), - reference: "", + reference: "", report_in_deps: true, }; report_in_external_macro @@ -4740,7 +4740,7 @@ declare_lint! { "detects unsafe functions being used as safe functions", @future_incompatible = FutureIncompatibleInfo { reason: FutureIncompatibilityReason::EditionError(Edition::Edition2024), - reference: "", + reference: "", }; } @@ -4776,7 +4776,7 @@ declare_lint! { "detects missing unsafe keyword on extern declarations", @future_incompatible = FutureIncompatibleInfo { reason: FutureIncompatibilityReason::EditionError(Edition::Edition2024), - reference: "", + reference: "", }; } @@ -4817,7 +4817,7 @@ declare_lint! { "detects unsafe attributes outside of unsafe", @future_incompatible = FutureIncompatibleInfo { reason: FutureIncompatibilityReason::EditionError(Edition::Edition2024), - reference: "", + reference: "", }; } @@ -5014,7 +5014,7 @@ declare_lint! { "Detect and warn on significant change in drop order in tail expression location", @future_incompatible = FutureIncompatibleInfo { reason: FutureIncompatibilityReason::EditionSemanticsChange(Edition::Edition2024), - reference: "", + reference: "", }; } @@ -5053,7 +5053,7 @@ declare_lint! { "will be parsed as a guarded string in Rust 2024", @future_incompatible = FutureIncompatibleInfo { reason: FutureIncompatibilityReason::EditionError(Edition::Edition2024), - reference: "", + reference: "", }; crate_level_only } diff --git a/src/tools/clippy/tests/ui/checked_unwrap/simple_conditionals.stderr b/src/tools/clippy/tests/ui/checked_unwrap/simple_conditionals.stderr index a4bf00992445..26e360112b6b 100644 --- a/src/tools/clippy/tests/ui/checked_unwrap/simple_conditionals.stderr +++ b/src/tools/clippy/tests/ui/checked_unwrap/simple_conditionals.stderr @@ -328,7 +328,7 @@ error: creating a shared reference to mutable static LL | if X.is_some() { | ^^^^^^^^^^^ shared reference to mutable static | - = note: for more information, see + = note: for more information, see = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives = note: `#[deny(static_mut_refs)]` on by default diff --git a/tests/ui/borrowck/borrowck-unsafe-static-mutable-borrows.stderr b/tests/ui/borrowck/borrowck-unsafe-static-mutable-borrows.stderr index 4e19fd81735e..c55923097fcd 100644 --- a/tests/ui/borrowck/borrowck-unsafe-static-mutable-borrows.stderr +++ b/tests/ui/borrowck/borrowck-unsafe-static-mutable-borrows.stderr @@ -4,7 +4,7 @@ warning: creating a mutable reference to mutable static LL | let sfoo: *mut Foo = &mut SFOO; | ^^^^^^^^^ mutable reference to mutable static | - = note: for more information, see + = note: for more information, see = note: mutable references to mutable statics are dangerous; it's undefined behavior if any other pointer to the static is used or if any other reference is created for the static while the mutable reference lives = note: `#[warn(static_mut_refs)]` on by default help: use `&raw mut` instead to create a raw pointer diff --git a/tests/ui/closures/2229_closure_analysis/issue-90465.stderr b/tests/ui/closures/2229_closure_analysis/issue-90465.stderr index ccca24764e42..94bbd79cbb4f 100644 --- a/tests/ui/closures/2229_closure_analysis/issue-90465.stderr +++ b/tests/ui/closures/2229_closure_analysis/issue-90465.stderr @@ -10,7 +10,7 @@ LL | let _ = f0; LL | } | - in Rust 2018, `f0` is dropped here along with the closure, but in Rust 2021 `f0` is not part of the closure | - = note: for more information, see + = note: for more information, see note: the lint level is defined here --> $DIR/issue-90465.rs:3:9 | diff --git a/tests/ui/closures/2229_closure_analysis/migrations/auto_traits.stderr b/tests/ui/closures/2229_closure_analysis/migrations/auto_traits.stderr index fdcada468e09..b981ef69b4fa 100644 --- a/tests/ui/closures/2229_closure_analysis/migrations/auto_traits.stderr +++ b/tests/ui/closures/2229_closure_analysis/migrations/auto_traits.stderr @@ -7,7 +7,7 @@ LL | thread::spawn(move || unsafe { LL | *fptr.0 = 20; | ------- in Rust 2018, this closure captures all of `fptr`, but in Rust 2021, it will only capture `fptr.0` | - = note: for more information, see + = note: for more information, see note: the lint level is defined here --> $DIR/auto_traits.rs:2:9 | @@ -34,7 +34,7 @@ LL | thread::spawn(move || unsafe { LL | *fptr.0.0 = 20; | --------- in Rust 2018, this closure captures all of `fptr`, but in Rust 2021, it will only capture `fptr.0.0` | - = note: for more information, see + = note: for more information, see help: add a dummy let to cause `fptr` to be fully captured | LL ~ thread::spawn(move || { let _ = &fptr; unsafe { @@ -56,7 +56,7 @@ LL | let f_1 = f.1; LL | } | - in Rust 2018, `f` is dropped here, but in Rust 2021, only `f.1` will be dropped here as part of the closure | - = note: for more information, see + = note: for more information, see help: add a dummy let to cause `f` to be fully captured | LL ~ let c = || { diff --git a/tests/ui/closures/2229_closure_analysis/migrations/closure-body-macro-fragment.stderr b/tests/ui/closures/2229_closure_analysis/migrations/closure-body-macro-fragment.stderr index bb17e3a34af6..c49b1d2d0e06 100644 --- a/tests/ui/closures/2229_closure_analysis/migrations/closure-body-macro-fragment.stderr +++ b/tests/ui/closures/2229_closure_analysis/migrations/closure-body-macro-fragment.stderr @@ -15,7 +15,7 @@ LL | | println!("{:?}", x); LL | | }); | |______- in this macro invocation | - = note: for more information, see + = note: for more information, see note: the lint level is defined here --> $DIR/closure-body-macro-fragment.rs:4:9 | diff --git a/tests/ui/closures/2229_closure_analysis/migrations/insignificant_drop_attr_migrations.stderr b/tests/ui/closures/2229_closure_analysis/migrations/insignificant_drop_attr_migrations.stderr index a0795c12928f..3381b9e334b4 100644 --- a/tests/ui/closures/2229_closure_analysis/migrations/insignificant_drop_attr_migrations.stderr +++ b/tests/ui/closures/2229_closure_analysis/migrations/insignificant_drop_attr_migrations.stderr @@ -10,7 +10,7 @@ LL | let _t = t.0; LL | } | - in Rust 2018, `t` is dropped here, but in Rust 2021, only `t.0` will be dropped here as part of the closure | - = note: for more information, see + = note: for more information, see note: the lint level is defined here --> $DIR/insignificant_drop_attr_migrations.rs:3:9 | @@ -34,7 +34,7 @@ LL | let _t = t.1; LL | } | - in Rust 2018, `t` is dropped here, but in Rust 2021, only `t.1` will be dropped here as part of the closure | - = note: for more information, see + = note: for more information, see help: add a dummy let to cause `t` to be fully captured | LL ~ let c = move || { diff --git a/tests/ui/closures/2229_closure_analysis/migrations/macro.stderr b/tests/ui/closures/2229_closure_analysis/migrations/macro.stderr index 7ea5136d1191..7d90b7bf72bd 100644 --- a/tests/ui/closures/2229_closure_analysis/migrations/macro.stderr +++ b/tests/ui/closures/2229_closure_analysis/migrations/macro.stderr @@ -7,7 +7,7 @@ LL | let _ = || dbg!(a.0); LL | } | - in Rust 2018, `a` is dropped here, but in Rust 2021, only `a.0` will be dropped here as part of the closure | - = note: for more information, see + = note: for more information, see note: the lint level is defined here --> $DIR/macro.rs:5:9 | diff --git a/tests/ui/closures/2229_closure_analysis/migrations/migrations_rustfix.stderr b/tests/ui/closures/2229_closure_analysis/migrations/migrations_rustfix.stderr index 94526487e679..7d937f512493 100644 --- a/tests/ui/closures/2229_closure_analysis/migrations/migrations_rustfix.stderr +++ b/tests/ui/closures/2229_closure_analysis/migrations/migrations_rustfix.stderr @@ -10,7 +10,7 @@ LL | let _t = t.0; LL | } | - in Rust 2018, `t` is dropped here, but in Rust 2021, only `t.0` will be dropped here as part of the closure | - = note: for more information, see + = note: for more information, see note: the lint level is defined here --> $DIR/migrations_rustfix.rs:2:9 | @@ -31,7 +31,7 @@ LL | let c = || t.0; LL | } | - in Rust 2018, `t` is dropped here, but in Rust 2021, only `t.0` will be dropped here as part of the closure | - = note: for more information, see + = note: for more information, see help: add a dummy let to cause `t` to be fully captured | LL | let c = || { let _ = &t; t.0 }; diff --git a/tests/ui/closures/2229_closure_analysis/migrations/mir_calls_to_shims.stderr b/tests/ui/closures/2229_closure_analysis/migrations/mir_calls_to_shims.stderr index 2b76deca3770..6a9266ecc544 100644 --- a/tests/ui/closures/2229_closure_analysis/migrations/mir_calls_to_shims.stderr +++ b/tests/ui/closures/2229_closure_analysis/migrations/mir_calls_to_shims.stderr @@ -10,7 +10,7 @@ LL | let result = panic::catch_unwind(move || { LL | f.0() | --- in Rust 2018, this closure captures all of `f`, but in Rust 2021, it will only capture `f.0` | - = note: for more information, see + = note: for more information, see note: the lint level is defined here --> $DIR/mir_calls_to_shims.rs:4:9 | diff --git a/tests/ui/closures/2229_closure_analysis/migrations/multi_diagnostics.stderr b/tests/ui/closures/2229_closure_analysis/migrations/multi_diagnostics.stderr index 138778ff5d72..81ffe866c837 100644 --- a/tests/ui/closures/2229_closure_analysis/migrations/multi_diagnostics.stderr +++ b/tests/ui/closures/2229_closure_analysis/migrations/multi_diagnostics.stderr @@ -13,7 +13,7 @@ LL | let _f_2 = f2.1; LL | } | - in Rust 2018, `f2` is dropped here, but in Rust 2021, only `f2.1` will be dropped here as part of the closure | - = note: for more information, see + = note: for more information, see note: the lint level is defined here --> $DIR/multi_diagnostics.rs:2:9 | @@ -34,7 +34,7 @@ LL | let c = || { LL | let _f_1 = f1.0; | ---- in Rust 2018, this closure captures all of `f1`, but in Rust 2021, it will only capture `f1.0` | - = note: for more information, see + = note: for more information, see help: add a dummy let to cause `f1` to be fully captured | LL ~ let c = || { @@ -56,7 +56,7 @@ LL | LL | let _f_2 = f1.2; | ---- in Rust 2018, this closure captures all of `f1`, but in Rust 2021, it will only capture `f1.2` | - = note: for more information, see + = note: for more information, see help: add a dummy let to cause `f1` to be fully captured | LL ~ let c = || { @@ -81,7 +81,7 @@ LL | } | in Rust 2018, `f1` is dropped here, but in Rust 2021, only `f1.0` will be dropped here as part of the closure | in Rust 2018, `f1` is dropped here, but in Rust 2021, only `f1.1` will be dropped here as part of the closure | - = note: for more information, see + = note: for more information, see help: add a dummy let to cause `f1` to be fully captured | LL ~ let c = || { @@ -104,7 +104,7 @@ LL | LL | *fptr2.0 = 20; | -------- in Rust 2018, this closure captures all of `fptr2`, but in Rust 2021, it will only capture `fptr2.0` | - = note: for more information, see + = note: for more information, see help: add a dummy let to cause `fptr1`, `fptr2` to be fully captured | LL ~ thread::spawn(move || { let _ = (&fptr1, &fptr2); unsafe { diff --git a/tests/ui/closures/2229_closure_analysis/migrations/precise.stderr b/tests/ui/closures/2229_closure_analysis/migrations/precise.stderr index eff26a4d6f5f..5fb7675207f4 100644 --- a/tests/ui/closures/2229_closure_analysis/migrations/precise.stderr +++ b/tests/ui/closures/2229_closure_analysis/migrations/precise.stderr @@ -10,7 +10,7 @@ LL | let _t = t.0; LL | } | - in Rust 2018, `t` is dropped here, but in Rust 2021, only `t.0` will be dropped here as part of the closure | - = note: for more information, see + = note: for more information, see note: the lint level is defined here --> $DIR/precise.rs:3:9 | @@ -44,7 +44,7 @@ LL | } | in Rust 2018, `u` is dropped here, but in Rust 2021, only `u.0.1` will be dropped here as part of the closure | in Rust 2018, `u` is dropped here, but in Rust 2021, only `u.1.0` will be dropped here as part of the closure | - = note: for more information, see + = note: for more information, see help: add a dummy let to cause `u` to be fully captured | LL ~ let c = || { diff --git a/tests/ui/closures/2229_closure_analysis/migrations/significant_drop.stderr b/tests/ui/closures/2229_closure_analysis/migrations/significant_drop.stderr index 54ad20f89833..3f4d38aefe7a 100644 --- a/tests/ui/closures/2229_closure_analysis/migrations/significant_drop.stderr +++ b/tests/ui/closures/2229_closure_analysis/migrations/significant_drop.stderr @@ -20,7 +20,7 @@ LL | } | in Rust 2018, `t1` is dropped here, but in Rust 2021, only `t1.0` will be dropped here as part of the closure | in Rust 2018, `t2` is dropped here, but in Rust 2021, only `t2.0` will be dropped here as part of the closure | - = note: for more information, see + = note: for more information, see note: the lint level is defined here --> $DIR/significant_drop.rs:2:9 | @@ -50,7 +50,7 @@ LL | } | in Rust 2018, `t` is dropped here, but in Rust 2021, only `t.0` will be dropped here as part of the closure | in Rust 2018, `t1` is dropped here, but in Rust 2021, only `t1.0` will be dropped here as part of the closure | - = note: for more information, see + = note: for more information, see help: add a dummy let to cause `t`, `t1` to be fully captured | LL ~ let c = || { @@ -69,7 +69,7 @@ LL | let _t = t.0; LL | } | - in Rust 2018, `t` is dropped here, but in Rust 2021, only `t.0` will be dropped here as part of the closure | - = note: for more information, see + = note: for more information, see help: add a dummy let to cause `t` to be fully captured | LL ~ let c = || { @@ -88,7 +88,7 @@ LL | let _t = t.0; LL | } | - in Rust 2018, `t` is dropped here, but in Rust 2021, only `t.0` will be dropped here as part of the closure | - = note: for more information, see + = note: for more information, see help: add a dummy let to cause `t` to be fully captured | LL ~ let c = || { @@ -107,7 +107,7 @@ LL | let _t = t.0; LL | } | - in Rust 2018, `t` is dropped here, but in Rust 2021, only `t.0` will be dropped here as part of the closure | - = note: for more information, see + = note: for more information, see help: add a dummy let to cause `t` to be fully captured | LL ~ let c = || { @@ -126,7 +126,7 @@ LL | let _t = t.1; LL | } | - in Rust 2018, `t` is dropped here, but in Rust 2021, only `t.1` will be dropped here as part of the closure | - = note: for more information, see + = note: for more information, see help: add a dummy let to cause `t` to be fully captured | LL ~ let c = || { @@ -150,7 +150,7 @@ LL | } | in Rust 2018, `t1` is dropped here, but in Rust 2021, only `t1.1` will be dropped here as part of the closure | in Rust 2018, `t` is dropped here, but in Rust 2021, only `t.1` will be dropped here as part of the closure | - = note: for more information, see + = note: for more information, see help: add a dummy let to cause `t1`, `t` to be fully captured | LL ~ let c = move || { @@ -169,7 +169,7 @@ LL | tuple.0; LL | } | - in Rust 2018, `tuple` is dropped here, but in Rust 2021, only `tuple.0` will be dropped here as part of the closure | - = note: for more information, see + = note: for more information, see help: add a dummy let to cause `tuple` to be fully captured | LL ~ let c = || { @@ -188,7 +188,7 @@ LL | tuple.0; LL | }; | - in Rust 2018, `tuple` is dropped here, but in Rust 2021, only `tuple.0` will be dropped here as part of the closure | - = note: for more information, see + = note: for more information, see help: add a dummy let to cause `tuple` to be fully captured | LL ~ let c = || { @@ -204,7 +204,7 @@ LL | let _c = || tup.0; LL | } | - in Rust 2018, `tup` is dropped here, but in Rust 2021, only `tup.0` will be dropped here as part of the closure | - = note: for more information, see + = note: for more information, see help: add a dummy let to cause `tup` to be fully captured | LL | let _c = || { let _ = &tup; tup.0 }; diff --git a/tests/ui/consts/const-eval/const_panic_stability.e2018.stderr b/tests/ui/consts/const-eval/const_panic_stability.e2018.stderr index 3553a18d3883..b3ccd2459aac 100644 --- a/tests/ui/consts/const-eval/const_panic_stability.e2018.stderr +++ b/tests/ui/consts/const-eval/const_panic_stability.e2018.stderr @@ -5,7 +5,7 @@ LL | panic!({ "foo" }); | ^^^^^^^^^ | = note: this usage of `panic!()` is deprecated; it will be a hard error in Rust 2021 - = note: for more information, see + = note: for more information, see = note: `#[warn(non_fmt_panics)]` on by default help: add a "{}" format string to `Display` the message | diff --git a/tests/ui/consts/const_let_assign2.stderr b/tests/ui/consts/const_let_assign2.stderr index 1bb560437b60..e8bed6d07246 100644 --- a/tests/ui/consts/const_let_assign2.stderr +++ b/tests/ui/consts/const_let_assign2.stderr @@ -4,7 +4,7 @@ warning: creating a mutable reference to mutable static LL | let ptr = unsafe { &mut BB }; | ^^^^^^^ mutable reference to mutable static | - = note: for more information, see + = note: for more information, see = note: mutable references to mutable statics are dangerous; it's undefined behavior if any other pointer to the static is used or if any other reference is created for the static while the mutable reference lives = note: `#[warn(static_mut_refs)]` on by default help: use `&raw mut` instead to create a raw pointer diff --git a/tests/ui/consts/const_refs_to_static-ice-121413.stderr b/tests/ui/consts/const_refs_to_static-ice-121413.stderr index 1263deebf76d..e354110f2930 100644 --- a/tests/ui/consts/const_refs_to_static-ice-121413.stderr +++ b/tests/ui/consts/const_refs_to_static-ice-121413.stderr @@ -16,7 +16,7 @@ LL | static FOO: Sync = AtomicUsize::new(0); | ^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see = note: `#[warn(bare_trait_objects)]` on by default help: if this is a dyn-compatible trait, use `dyn` | diff --git a/tests/ui/did_you_mean/bad-assoc-ty.edition2015.stderr b/tests/ui/did_you_mean/bad-assoc-ty.edition2015.stderr index ed6e5c3e0c01..416ff358d538 100644 --- a/tests/ui/did_you_mean/bad-assoc-ty.edition2015.stderr +++ b/tests/ui/did_you_mean/bad-assoc-ty.edition2015.stderr @@ -186,7 +186,7 @@ LL | type H = Fn(u8) -> (u8)::Output; | ^^^^^^^^^^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see = note: `#[warn(bare_trait_objects)]` on by default help: if this is a dyn-compatible trait, use `dyn` | diff --git a/tests/ui/drop/drop-order-comparisons.e2021.stderr b/tests/ui/drop/drop-order-comparisons.e2021.stderr index 15a3f2745143..d928403d2e34 100644 --- a/tests/ui/drop/drop-order-comparisons.e2021.stderr +++ b/tests/ui/drop/drop-order-comparisons.e2021.stderr @@ -27,7 +27,7 @@ LL | | }, e.mark(3), e.ok(4)); | `#1` will be dropped later as of Edition 2024 | = warning: this changes meaning in Rust 2024 - = note: for more information, see + = note: for more information, see note: `#3` invokes this custom destructor --> $DIR/drop-order-comparisons.rs:504:1 | @@ -75,7 +75,7 @@ LL | | }, e.mark(1), e.ok(4)); | `#1` will be dropped later as of Edition 2024 | = warning: this changes meaning in Rust 2024 - = note: for more information, see + = note: for more information, see note: `#2` invokes this custom destructor --> $DIR/drop-order-comparisons.rs:504:1 | @@ -107,7 +107,7 @@ LL | | }, e.mark(1), e.ok(4)); | `#1` will be dropped later as of Edition 2024 | = warning: this changes meaning in Rust 2024 - = note: for more information, see + = note: for more information, see note: `#2` invokes this custom destructor --> $DIR/drop-order-comparisons.rs:504:1 | @@ -139,7 +139,7 @@ LL | | }, e.mark(2), e.ok(3)); | `#1` will be dropped later as of Edition 2024 | = warning: this changes meaning in Rust 2024 - = note: for more information, see + = note: for more information, see note: `#2` invokes this custom destructor --> $DIR/drop-order-comparisons.rs:504:1 | @@ -171,7 +171,7 @@ LL | | }, e.mark(2), e.ok(3)); | `#1` will be dropped later as of Edition 2024 | = warning: this changes meaning in Rust 2024 - = note: for more information, see + = note: for more information, see note: `#2` invokes this custom destructor --> $DIR/drop-order-comparisons.rs:504:1 | @@ -193,7 +193,7 @@ LL | _ = (if let Ok(_) = e.ok(4).as_ref() { | this value has a significant drop implementation which may observe a major change in drop order and requires your discretion | = warning: this changes meaning in Rust 2024 - = note: for more information, see + = note: for more information, see note: value invokes this custom destructor --> $DIR/drop-order-comparisons.rs:504:1 | @@ -223,7 +223,7 @@ LL | _ = (if let Ok(_) = e.err(4).as_ref() {} else { | this value has a significant drop implementation which may observe a major change in drop order and requires your discretion | = warning: this changes meaning in Rust 2024 - = note: for more information, see + = note: for more information, see note: value invokes this custom destructor --> $DIR/drop-order-comparisons.rs:504:1 | @@ -252,7 +252,7 @@ LL | if let Ok(_) = e.err(4).as_ref() {} else { | this value has a significant drop implementation which may observe a major change in drop order and requires your discretion | = warning: this changes meaning in Rust 2024 - = note: for more information, see + = note: for more information, see note: value invokes this custom destructor --> $DIR/drop-order-comparisons.rs:504:1 | @@ -281,7 +281,7 @@ LL | if let true = e.err(9).is_ok() {} else { | this value has a significant drop implementation which may observe a major change in drop order and requires your discretion | = warning: this changes meaning in Rust 2024 - = note: for more information, see + = note: for more information, see note: value invokes this custom destructor --> $DIR/drop-order-comparisons.rs:504:1 | @@ -310,7 +310,7 @@ LL | if let Ok(_v) = e.err(8) {} else { | this value has a significant drop implementation which may observe a major change in drop order and requires your discretion | = warning: this changes meaning in Rust 2024 - = note: for more information, see + = note: for more information, see note: value invokes this custom destructor --> $DIR/drop-order-comparisons.rs:504:1 | @@ -339,7 +339,7 @@ LL | if let Ok(_) = e.err(7) {} else { | this value has a significant drop implementation which may observe a major change in drop order and requires your discretion | = warning: this changes meaning in Rust 2024 - = note: for more information, see + = note: for more information, see note: value invokes this custom destructor --> $DIR/drop-order-comparisons.rs:504:1 | @@ -368,7 +368,7 @@ LL | if let Ok(_) = e.err(6).as_ref() {} else { | this value has a significant drop implementation which may observe a major change in drop order and requires your discretion | = warning: this changes meaning in Rust 2024 - = note: for more information, see + = note: for more information, see note: value invokes this custom destructor --> $DIR/drop-order-comparisons.rs:504:1 | @@ -397,7 +397,7 @@ LL | if let Ok(_v) = e.err(5) {} else { | this value has a significant drop implementation which may observe a major change in drop order and requires your discretion | = warning: this changes meaning in Rust 2024 - = note: for more information, see + = note: for more information, see note: value invokes this custom destructor --> $DIR/drop-order-comparisons.rs:504:1 | @@ -426,7 +426,7 @@ LL | if let Ok(_) = e.err(4) {} else { | this value has a significant drop implementation which may observe a major change in drop order and requires your discretion | = warning: this changes meaning in Rust 2024 - = note: for more information, see + = note: for more information, see note: value invokes this custom destructor --> $DIR/drop-order-comparisons.rs:504:1 | @@ -455,7 +455,7 @@ LL | if let Ok(_) = e.err(4).as_ref() {} else { | this value has a significant drop implementation which may observe a major change in drop order and requires your discretion | = warning: this changes meaning in Rust 2024 - = note: for more information, see + = note: for more information, see note: value invokes this custom destructor --> $DIR/drop-order-comparisons.rs:504:1 | diff --git a/tests/ui/drop/lint-if-let-rescope-gated.edition2021.stderr b/tests/ui/drop/lint-if-let-rescope-gated.edition2021.stderr index 0d6974d516b6..5f04273d336d 100644 --- a/tests/ui/drop/lint-if-let-rescope-gated.edition2021.stderr +++ b/tests/ui/drop/lint-if-let-rescope-gated.edition2021.stderr @@ -7,7 +7,7 @@ LL | if let Some(_value) = Droppy.get() { | this value has a significant drop implementation which may observe a major change in drop order and requires your discretion | = warning: this changes meaning in Rust 2024 - = note: for more information, see + = note: for more information, see note: value invokes this custom destructor --> $DIR/lint-if-let-rescope-gated.rs:14:1 | diff --git a/tests/ui/drop/lint-if-let-rescope-with-macro.stderr b/tests/ui/drop/lint-if-let-rescope-with-macro.stderr index a0afb8eddb53..63e30f1ab92e 100644 --- a/tests/ui/drop/lint-if-let-rescope-with-macro.stderr +++ b/tests/ui/drop/lint-if-let-rescope-with-macro.stderr @@ -14,7 +14,7 @@ LL | | }; | |_____- in this macro invocation | = warning: this changes meaning in Rust 2024 - = note: for more information, see + = note: for more information, see note: value invokes this custom destructor --> $DIR/lint-if-let-rescope-with-macro.rs:22:1 | diff --git a/tests/ui/drop/lint-if-let-rescope.stderr b/tests/ui/drop/lint-if-let-rescope.stderr index ca2416efcb1a..7cab7339fe1e 100644 --- a/tests/ui/drop/lint-if-let-rescope.stderr +++ b/tests/ui/drop/lint-if-let-rescope.stderr @@ -7,7 +7,7 @@ LL | if let Some(_value) = droppy().get() { | this value has a significant drop implementation which may observe a major change in drop order and requires your discretion | = warning: this changes meaning in Rust 2024 - = note: for more information, see + = note: for more information, see note: value invokes this custom destructor --> $DIR/lint-if-let-rescope.rs:11:1 | @@ -47,7 +47,7 @@ LL | } else if let Some(_value) = droppy().get() { | -------- this value has a significant drop implementation which may observe a major change in drop order and requires your discretion | = warning: this changes meaning in Rust 2024 - = note: for more information, see + = note: for more information, see note: value invokes this custom destructor --> $DIR/lint-if-let-rescope.rs:11:1 | @@ -89,7 +89,7 @@ LL | } else if let Some(_value) = droppy().get() { | this value has a significant drop implementation which may observe a major change in drop order and requires your discretion | = warning: this changes meaning in Rust 2024 - = note: for more information, see + = note: for more information, see note: value invokes this custom destructor --> $DIR/lint-if-let-rescope.rs:11:1 | @@ -120,7 +120,7 @@ LL | if let Some(1) = { if let Some(_value) = Droppy.get() { Some(1) } else | this value has a significant drop implementation which may observe a major change in drop order and requires your discretion | = warning: this changes meaning in Rust 2024 - = note: for more information, see + = note: for more information, see note: value invokes this custom destructor --> $DIR/lint-if-let-rescope.rs:11:1 | @@ -146,7 +146,7 @@ LL | if (if let Some(_value) = droppy().get() { true } else { false }) { | this value has a significant drop implementation which may observe a major change in drop order and requires your discretion | = warning: this changes meaning in Rust 2024 - = note: for more information, see + = note: for more information, see note: value invokes this custom destructor --> $DIR/lint-if-let-rescope.rs:11:1 | @@ -172,7 +172,7 @@ LL | } else if (((if let Some(_value) = droppy().get() { true } else { false | this value has a significant drop implementation which may observe a major change in drop order and requires your discretion | = warning: this changes meaning in Rust 2024 - = note: for more information, see + = note: for more information, see note: value invokes this custom destructor --> $DIR/lint-if-let-rescope.rs:11:1 | @@ -198,7 +198,7 @@ LL | while (if let Some(_value) = droppy().get() { false } else { true }) { | this value has a significant drop implementation which may observe a major change in drop order and requires your discretion | = warning: this changes meaning in Rust 2024 - = note: for more information, see + = note: for more information, see note: value invokes this custom destructor --> $DIR/lint-if-let-rescope.rs:11:1 | @@ -224,7 +224,7 @@ LL | if let Some(_value) = Some((droppy(), ()).1) {} else {} | this value has a significant drop implementation which may observe a major change in drop order and requires your discretion | = warning: this changes meaning in Rust 2024 - = note: for more information, see + = note: for more information, see help: the value is now dropped here in Edition 2024 --> $DIR/lint-if-let-rescope.rs:97:51 | diff --git a/tests/ui/drop/lint-tail-expr-drop-order-borrowck.stderr b/tests/ui/drop/lint-tail-expr-drop-order-borrowck.stderr index a55e366dd0be..2eeda8ac387f 100644 --- a/tests/ui/drop/lint-tail-expr-drop-order-borrowck.stderr +++ b/tests/ui/drop/lint-tail-expr-drop-order-borrowck.stderr @@ -7,7 +7,7 @@ LL | let _ = { String::new().as_str() }.len(); | this temporary value will be dropped at the end of the block | = warning: this changes meaning in Rust 2024 - = note: for more information, see + = note: for more information, see note: the lint level is defined here --> $DIR/lint-tail-expr-drop-order-borrowck.rs:6:9 | @@ -23,7 +23,7 @@ LL | f(unsafe { String::new().as_str() }.len()); | this temporary value will be dropped at the end of the block | = warning: this changes meaning in Rust 2024 - = note: for more information, see + = note: for more information, see error: relative drop order changing in Rust 2024 --> $DIR/lint-tail-expr-drop-order-borrowck.rs:31:9 @@ -35,7 +35,7 @@ LL | &mut || 0 | borrow later used here | = warning: this changes meaning in Rust 2024 - = note: for more information, see + = note: for more information, see error: relative drop order changing in Rust 2024 --> $DIR/lint-tail-expr-drop-order-borrowck.rs:43:9 @@ -46,7 +46,7 @@ LL | g({ &f() }); | borrow later used by call | = warning: this changes meaning in Rust 2024 - = note: for more information, see + = note: for more information, see error: aborting due to 4 previous errors diff --git a/tests/ui/drop/lint-tail-expr-drop-order.stderr b/tests/ui/drop/lint-tail-expr-drop-order.stderr index e124e9874d0b..c69c58aa1ab7 100644 --- a/tests/ui/drop/lint-tail-expr-drop-order.stderr +++ b/tests/ui/drop/lint-tail-expr-drop-order.stderr @@ -17,7 +17,7 @@ LL | } | - now the temporary value is dropped here, before the local variables in the block or statement | = warning: this changes meaning in Rust 2024 - = note: for more information, see + = note: for more information, see note: `#1` invokes this custom destructor --> $DIR/lint-tail-expr-drop-order.rs:10:1 | @@ -54,7 +54,7 @@ LL | } | - now the temporary value is dropped here, before the local variables in the block or statement | = warning: this changes meaning in Rust 2024 - = note: for more information, see + = note: for more information, see note: `#1` invokes this custom destructor --> $DIR/lint-tail-expr-drop-order.rs:10:1 | @@ -86,7 +86,7 @@ LL | } | - now the temporary value is dropped here, before the local variables in the block or statement | = warning: this changes meaning in Rust 2024 - = note: for more information, see + = note: for more information, see note: `#1` invokes this custom destructor --> $DIR/lint-tail-expr-drop-order.rs:10:1 | @@ -118,7 +118,7 @@ LL | } | - now the temporary value is dropped here, before the local variables in the block or statement | = warning: this changes meaning in Rust 2024 - = note: for more information, see + = note: for more information, see note: `#1` invokes this custom destructor --> $DIR/lint-tail-expr-drop-order.rs:10:1 | @@ -145,7 +145,7 @@ LL | } | - now the temporary value is dropped here, before the local variables in the block or statement | = warning: this changes meaning in Rust 2024 - = note: for more information, see + = note: for more information, see = note: most of the time, changing drop order is harmless; inspect the `impl Drop`s for side effects like releasing locks or sending messages error: relative drop order changing in Rust 2024 @@ -167,7 +167,7 @@ LL | } | - now the temporary value is dropped here, before the local variables in the block or statement | = warning: this changes meaning in Rust 2024 - = note: for more information, see + = note: for more information, see note: `#1` invokes this custom destructor --> $DIR/lint-tail-expr-drop-order.rs:10:1 | @@ -199,7 +199,7 @@ LL | } | - now the temporary value is dropped here, before the local variables in the block or statement | = warning: this changes meaning in Rust 2024 - = note: for more information, see + = note: for more information, see note: `#1` invokes this custom destructor --> $DIR/lint-tail-expr-drop-order.rs:193:5 | @@ -231,7 +231,7 @@ LL | )); | - now the temporary value is dropped here, before the local variables in the block or statement | = warning: this changes meaning in Rust 2024 - = note: for more information, see + = note: for more information, see note: `#1` invokes this custom destructor --> $DIR/lint-tail-expr-drop-order.rs:10:1 | diff --git a/tests/ui/drop/tail_expr_drop_order-on-coroutine-unwind.stderr b/tests/ui/drop/tail_expr_drop_order-on-coroutine-unwind.stderr index 7bf452e2496c..94977185ced8 100644 --- a/tests/ui/drop/tail_expr_drop_order-on-coroutine-unwind.stderr +++ b/tests/ui/drop/tail_expr_drop_order-on-coroutine-unwind.stderr @@ -23,7 +23,7 @@ LL | } | - now the temporary value is dropped here, before the local variables in the block or statement | = warning: this changes meaning in Rust 2024 - = note: for more information, see + = note: for more information, see note: `#2` invokes this custom destructor --> $DIR/tail_expr_drop_order-on-coroutine-unwind.rs:9:1 | diff --git a/tests/ui/dyn-compatibility/avoid-ice-on-warning-2.old.stderr b/tests/ui/dyn-compatibility/avoid-ice-on-warning-2.old.stderr index b811ef40c26b..687799c66883 100644 --- a/tests/ui/dyn-compatibility/avoid-ice-on-warning-2.old.stderr +++ b/tests/ui/dyn-compatibility/avoid-ice-on-warning-2.old.stderr @@ -5,7 +5,7 @@ LL | fn id(f: Copy) -> usize { | ^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see = note: `#[warn(bare_trait_objects)]` on by default help: if this is a dyn-compatible trait, use `dyn` | @@ -19,7 +19,7 @@ LL | fn id(f: Copy) -> usize { | ^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` help: if this is a dyn-compatible trait, use `dyn` | diff --git a/tests/ui/dyn-compatibility/avoid-ice-on-warning-3.old.stderr b/tests/ui/dyn-compatibility/avoid-ice-on-warning-3.old.stderr index 8b4f3f52ee93..4cfac9433753 100644 --- a/tests/ui/dyn-compatibility/avoid-ice-on-warning-3.old.stderr +++ b/tests/ui/dyn-compatibility/avoid-ice-on-warning-3.old.stderr @@ -5,7 +5,7 @@ LL | trait B { fn f(a: A) -> A; } | ^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see = note: `#[warn(bare_trait_objects)]` on by default help: if this is a dyn-compatible trait, use `dyn` | @@ -19,7 +19,7 @@ LL | trait B { fn f(a: A) -> A; } | ^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see help: if this is a dyn-compatible trait, use `dyn` | LL | trait B { fn f(a: A) -> dyn A; } @@ -32,7 +32,7 @@ LL | trait A { fn g(b: B) -> B; } | ^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see help: if this is a dyn-compatible trait, use `dyn` | LL | trait A { fn g(b: dyn B) -> B; } @@ -45,7 +45,7 @@ LL | trait A { fn g(b: B) -> B; } | ^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see help: if this is a dyn-compatible trait, use `dyn` | LL | trait A { fn g(b: B) -> dyn B; } @@ -58,7 +58,7 @@ LL | trait B { fn f(a: A) -> A; } | ^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` help: if this is a dyn-compatible trait, use `dyn` | @@ -100,7 +100,7 @@ LL | trait A { fn g(b: B) -> B; } | ^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` help: if this is a dyn-compatible trait, use `dyn` | diff --git a/tests/ui/dyn-compatibility/avoid-ice-on-warning.old.stderr b/tests/ui/dyn-compatibility/avoid-ice-on-warning.old.stderr index dbfe91e18114..4645b35f8f15 100644 --- a/tests/ui/dyn-compatibility/avoid-ice-on-warning.old.stderr +++ b/tests/ui/dyn-compatibility/avoid-ice-on-warning.old.stderr @@ -23,7 +23,7 @@ LL | fn call_this(f: F) : Fn(&str) + call_that {} | ^^^^^^^^^^^^^^^^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see = note: `#[warn(bare_trait_objects)]` on by default help: if this is a dyn-compatible trait, use `dyn` | diff --git a/tests/ui/dyn-compatibility/bare-trait-dont-suggest-dyn.old.stderr b/tests/ui/dyn-compatibility/bare-trait-dont-suggest-dyn.old.stderr index 7be6cb0d03bb..3cbdd19111d6 100644 --- a/tests/ui/dyn-compatibility/bare-trait-dont-suggest-dyn.old.stderr +++ b/tests/ui/dyn-compatibility/bare-trait-dont-suggest-dyn.old.stderr @@ -5,7 +5,7 @@ LL | fn ord_prefer_dot(s: String) -> Ord { | ^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see note: the lint level is defined here --> $DIR/bare-trait-dont-suggest-dyn.rs:5:9 | diff --git a/tests/ui/dyn-keyword/dyn-2018-edition-lint.stderr b/tests/ui/dyn-keyword/dyn-2018-edition-lint.stderr index b930815d13bb..b034c5dac16a 100644 --- a/tests/ui/dyn-keyword/dyn-2018-edition-lint.stderr +++ b/tests/ui/dyn-keyword/dyn-2018-edition-lint.stderr @@ -5,7 +5,7 @@ LL | fn function(x: &SomeTrait, y: Box) { | ^^^^^^^^^ | = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see note: the lint level is defined here --> $DIR/dyn-2018-edition-lint.rs:2:8 | @@ -23,7 +23,7 @@ LL | fn function(x: &SomeTrait, y: Box) { | ^^^^^^^^^ | = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see help: if this is a dyn-compatible trait, use `dyn` | LL | fn function(x: &SomeTrait, y: Box) { @@ -36,7 +36,7 @@ LL | let _x: &SomeTrait = todo!(); | ^^^^^^^^^ | = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see help: if this is a dyn-compatible trait, use `dyn` | LL | let _x: &dyn SomeTrait = todo!(); diff --git a/tests/ui/dyn-keyword/dyn-angle-brackets.stderr b/tests/ui/dyn-keyword/dyn-angle-brackets.stderr index 6a29dab04868..30069633cf5f 100644 --- a/tests/ui/dyn-keyword/dyn-angle-brackets.stderr +++ b/tests/ui/dyn-keyword/dyn-angle-brackets.stderr @@ -5,7 +5,7 @@ LL | ::fmt(self, f) | ^^^^^^^^^^ | = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see note: the lint level is defined here --> $DIR/dyn-angle-brackets.rs:4:9 | diff --git a/tests/ui/editions/never-type-fallback-breaking.e2021.stderr b/tests/ui/editions/never-type-fallback-breaking.e2021.stderr index 6b84a64fffe2..e30c0adb79df 100644 --- a/tests/ui/editions/never-type-fallback-breaking.e2021.stderr +++ b/tests/ui/editions/never-type-fallback-breaking.e2021.stderr @@ -5,7 +5,7 @@ LL | fn m() { | ^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! - = note: for more information, see + = note: for more information, see = help: specify the types explicitly note: in edition 2024, the requirement `!: Default` will fail --> $DIR/never-type-fallback-breaking.rs:22:17 @@ -25,7 +25,7 @@ LL | fn q() -> Option<()> { | ^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! - = note: for more information, see + = note: for more information, see = help: specify the types explicitly note: in edition 2024, the requirement `!: Default` will fail --> $DIR/never-type-fallback-breaking.rs:37:5 @@ -44,7 +44,7 @@ LL | fn meow() -> Result<(), ()> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! - = note: for more information, see + = note: for more information, see = help: specify the types explicitly note: in edition 2024, the requirement `(): From` will fail --> $DIR/never-type-fallback-breaking.rs:50:5 @@ -63,7 +63,7 @@ LL | pub fn fallback_return() -> Result<(), ()> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! - = note: for more information, see + = note: for more information, see = help: specify the types explicitly note: in edition 2024, the requirement `!: Default` will fail --> $DIR/never-type-fallback-breaking.rs:62:19 @@ -82,7 +82,7 @@ LL | fn fully_apit() -> Result<(), ()> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! - = note: for more information, see + = note: for more information, see = help: specify the types explicitly note: in edition 2024, the requirement `!: Default` will fail --> $DIR/never-type-fallback-breaking.rs:76:17 @@ -104,7 +104,7 @@ LL | fn m() { | ^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! - = note: for more information, see + = note: for more information, see = help: specify the types explicitly note: in edition 2024, the requirement `!: Default` will fail --> $DIR/never-type-fallback-breaking.rs:22:17 @@ -125,7 +125,7 @@ LL | fn q() -> Option<()> { | ^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! - = note: for more information, see + = note: for more information, see = help: specify the types explicitly note: in edition 2024, the requirement `!: Default` will fail --> $DIR/never-type-fallback-breaking.rs:37:5 @@ -146,7 +146,7 @@ LL | fn meow() -> Result<(), ()> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! - = note: for more information, see + = note: for more information, see = help: specify the types explicitly note: in edition 2024, the requirement `(): From` will fail --> $DIR/never-type-fallback-breaking.rs:50:5 @@ -167,7 +167,7 @@ LL | pub fn fallback_return() -> Result<(), ()> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! - = note: for more information, see + = note: for more information, see = help: specify the types explicitly note: in edition 2024, the requirement `!: Default` will fail --> $DIR/never-type-fallback-breaking.rs:62:19 @@ -188,7 +188,7 @@ LL | fn fully_apit() -> Result<(), ()> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! - = note: for more information, see + = note: for more information, see = help: specify the types explicitly note: in edition 2024, the requirement `!: Default` will fail --> $DIR/never-type-fallback-breaking.rs:76:17 diff --git a/tests/ui/ergonomic-clones/closure/rfc2229-migration.stderr b/tests/ui/ergonomic-clones/closure/rfc2229-migration.stderr index b980be6cb86b..f4f3e518014b 100644 --- a/tests/ui/ergonomic-clones/closure/rfc2229-migration.stderr +++ b/tests/ui/ergonomic-clones/closure/rfc2229-migration.stderr @@ -10,7 +10,7 @@ LL | let x = a.0; LL | } | - in Rust 2018, `a` is dropped here, but in Rust 2021, only `a.0` will be dropped here as part of the closure | - = note: for more information, see + = note: for more information, see note: the lint level is defined here --> $DIR/rfc2229-migration.rs:5:9 | diff --git a/tests/ui/errors/dynless-turbofish-e0191-issue-91997.stderr b/tests/ui/errors/dynless-turbofish-e0191-issue-91997.stderr index 7f3022c29233..0004ea82facc 100644 --- a/tests/ui/errors/dynless-turbofish-e0191-issue-91997.stderr +++ b/tests/ui/errors/dynless-turbofish-e0191-issue-91997.stderr @@ -5,7 +5,7 @@ LL | let _ = MyIterator::next; | ^^^^^^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see = note: `#[warn(bare_trait_objects)]` on by default help: if this is a dyn-compatible trait, use `dyn` | diff --git a/tests/ui/impl-trait/fresh-lifetime-from-bare-trait-obj-114664.stderr b/tests/ui/impl-trait/fresh-lifetime-from-bare-trait-obj-114664.stderr index 418f9acf5899..46b677202efa 100644 --- a/tests/ui/impl-trait/fresh-lifetime-from-bare-trait-obj-114664.stderr +++ b/tests/ui/impl-trait/fresh-lifetime-from-bare-trait-obj-114664.stderr @@ -5,7 +5,7 @@ LL | fn ice() -> impl AsRef { | ^^^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see = note: `#[warn(bare_trait_objects)]` on by default help: if this is a dyn-compatible trait, use `dyn` | @@ -19,7 +19,7 @@ LL | fn ice() -> impl AsRef { | ^^^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` help: if this is a dyn-compatible trait, use `dyn` | diff --git a/tests/ui/impl-trait/precise-capturing/overcaptures-2024-machine-applicable.stderr b/tests/ui/impl-trait/precise-capturing/overcaptures-2024-machine-applicable.stderr index 35fff9ef170e..980ddedc255b 100644 --- a/tests/ui/impl-trait/precise-capturing/overcaptures-2024-machine-applicable.stderr +++ b/tests/ui/impl-trait/precise-capturing/overcaptures-2024-machine-applicable.stderr @@ -5,7 +5,7 @@ LL | fn named<'a>(x: &'a i32) -> impl Sized { *x } | ^^^^^^^^^^ | = warning: this changes meaning in Rust 2024 - = note: for more information, see + = note: for more information, see note: specifically, this lifetime is in scope but not mentioned in the type's bounds --> $DIR/overcaptures-2024-machine-applicable.rs:9:10 | diff --git a/tests/ui/impl-trait/precise-capturing/overcaptures-2024.stderr b/tests/ui/impl-trait/precise-capturing/overcaptures-2024.stderr index 3f8511a21a06..dc9f1c218d9f 100644 --- a/tests/ui/impl-trait/precise-capturing/overcaptures-2024.stderr +++ b/tests/ui/impl-trait/precise-capturing/overcaptures-2024.stderr @@ -5,7 +5,7 @@ LL | fn named<'a>(x: &'a i32) -> impl Sized { *x } | ^^^^^^^^^^ | = warning: this changes meaning in Rust 2024 - = note: for more information, see + = note: for more information, see note: specifically, this lifetime is in scope but not mentioned in the type's bounds --> $DIR/overcaptures-2024.rs:7:10 | @@ -29,7 +29,7 @@ LL | fn implicit(x: &i32) -> impl Sized { *x } | ^^^^^^^^^^ | = warning: this changes meaning in Rust 2024 - = note: for more information, see + = note: for more information, see note: specifically, this lifetime is in scope but not mentioned in the type's bounds --> $DIR/overcaptures-2024.rs:11:16 | @@ -48,7 +48,7 @@ LL | fn hello(&self, x: &i32) -> impl Sized + '_ { self } | ^^^^^^^^^^^^^^^ | = warning: this changes meaning in Rust 2024 - = note: for more information, see + = note: for more information, see note: specifically, this lifetime is in scope but not mentioned in the type's bounds --> $DIR/overcaptures-2024.rs:17:24 | @@ -67,7 +67,7 @@ LL | fn hrtb() -> impl for<'a> Higher<'a, Output = impl Sized> {} | ^^^^^^^^^^ | = warning: this changes meaning in Rust 2024 - = note: for more information, see + = note: for more information, see note: specifically, this lifetime is in scope but not mentioned in the type's bounds --> $DIR/overcaptures-2024.rs:29:23 | @@ -86,7 +86,7 @@ LL | fn apit(_: &impl Sized) -> impl Sized {} | ^^^^^^^^^^ | = warning: this changes meaning in Rust 2024 - = note: for more information, see + = note: for more information, see note: specifically, this lifetime is in scope but not mentioned in the type's bounds --> $DIR/overcaptures-2024.rs:33:12 | @@ -111,7 +111,7 @@ LL | fn apit2(_: &impl Sized, _: U) -> impl Sized {} | ^^^^^^^^^^ | = warning: this changes meaning in Rust 2024 - = note: for more information, see + = note: for more information, see note: specifically, this lifetime is in scope but not mentioned in the type's bounds --> $DIR/overcaptures-2024.rs:37:16 | @@ -136,7 +136,7 @@ LL | async fn async_fn<'a>(x: &'a ()) -> impl Sized {} | ^^^^^^^^^^ | = warning: this changes meaning in Rust 2024 - = note: for more information, see + = note: for more information, see note: specifically, this lifetime is in scope but not mentioned in the type's bounds --> $DIR/overcaptures-2024.rs:41:19 | @@ -155,7 +155,7 @@ LL | pub fn parens(x: &i32) -> &impl Clone { x } | ^^^^^^^^^^ | = warning: this changes meaning in Rust 2024 - = note: for more information, see + = note: for more information, see note: specifically, this lifetime is in scope but not mentioned in the type's bounds --> $DIR/overcaptures-2024.rs:45:18 | diff --git a/tests/ui/issues/issue-28344.stderr b/tests/ui/issues/issue-28344.stderr index 7bc965536e9a..dfd4951f172c 100644 --- a/tests/ui/issues/issue-28344.stderr +++ b/tests/ui/issues/issue-28344.stderr @@ -5,7 +5,7 @@ LL | let x: u8 = BitXor::bitor(0 as u8, 0 as u8); | ^^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see = note: `#[warn(bare_trait_objects)]` on by default help: if this is a dyn-compatible trait, use `dyn` | @@ -25,7 +25,7 @@ LL | let g = BitXor::bitor; | ^^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see help: if this is a dyn-compatible trait, use `dyn` | LL | let g = ::bitor; diff --git a/tests/ui/issues/issue-39367.stderr b/tests/ui/issues/issue-39367.stderr index df21c09983e2..65076375e96e 100644 --- a/tests/ui/issues/issue-39367.stderr +++ b/tests/ui/issues/issue-39367.stderr @@ -9,7 +9,7 @@ LL | | (Box::new(__static_ref_initialize())); LL | | }); | |______________^ shared reference to mutable static | - = note: for more information, see + = note: for more information, see = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives = note: `#[warn(static_mut_refs)]` on by default diff --git a/tests/ui/issues/issue-58734.stderr b/tests/ui/issues/issue-58734.stderr index e5dad000b510..c246d1fc1111 100644 --- a/tests/ui/issues/issue-58734.stderr +++ b/tests/ui/issues/issue-58734.stderr @@ -5,7 +5,7 @@ LL | Trait::nonexistent(()); | ^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see = note: `#[warn(bare_trait_objects)]` on by default help: if this is a dyn-compatible trait, use `dyn` | diff --git a/tests/ui/issues/issue-86756.stderr b/tests/ui/issues/issue-86756.stderr index 0f68b7648503..b650b32c2a36 100644 --- a/tests/ui/issues/issue-86756.stderr +++ b/tests/ui/issues/issue-86756.stderr @@ -19,7 +19,7 @@ LL | eq:: | ^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see = note: `#[warn(bare_trait_objects)]` on by default help: if this is a dyn-compatible trait, use `dyn` | diff --git a/tests/ui/iterators/into-iter-on-arrays-2018.stderr b/tests/ui/iterators/into-iter-on-arrays-2018.stderr index d4055c74f7ce..8818ef80f76e 100644 --- a/tests/ui/iterators/into-iter-on-arrays-2018.stderr +++ b/tests/ui/iterators/into-iter-on-arrays-2018.stderr @@ -5,7 +5,7 @@ LL | let _: Iter<'_, i32> = array.into_iter(); | ^^^^^^^^^ | = warning: this changes meaning in Rust 2021 - = note: for more information, see + = note: for more information, see = note: `#[warn(array_into_iter)]` on by default help: use `.iter()` instead of `.into_iter()` to avoid ambiguity | @@ -25,7 +25,7 @@ LL | let _: Iter<'_, i32> = Box::new(array).into_iter(); | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` | = warning: this changes meaning in Rust 2021 - = note: for more information, see + = note: for more information, see warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to `<[T; N] as IntoIterator>::into_iter` in Rust 2021 --> $DIR/into-iter-on-arrays-2018.rs:22:43 @@ -34,7 +34,7 @@ LL | let _: Iter<'_, i32> = Rc::new(array).into_iter(); | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` | = warning: this changes meaning in Rust 2021 - = note: for more information, see + = note: for more information, see warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to `<[T; N] as IntoIterator>::into_iter` in Rust 2021 --> $DIR/into-iter-on-arrays-2018.rs:25:41 @@ -43,7 +43,7 @@ LL | let _: Iter<'_, i32> = Array(array).into_iter(); | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` | = warning: this changes meaning in Rust 2021 - = note: for more information, see + = note: for more information, see warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to `<[T; N] as IntoIterator>::into_iter` in Rust 2021 --> $DIR/into-iter-on-arrays-2018.rs:32:24 @@ -52,7 +52,7 @@ LL | for _ in [1, 2, 3].into_iter() {} | ^^^^^^^^^ | = warning: this changes meaning in Rust 2021 - = note: for more information, see + = note: for more information, see help: use `.iter()` instead of `.into_iter()` to avoid ambiguity | LL - for _ in [1, 2, 3].into_iter() {} diff --git a/tests/ui/iterators/into-iter-on-arrays-lint.stderr b/tests/ui/iterators/into-iter-on-arrays-lint.stderr index fb8fe79c7c96..a9dfa5819c14 100644 --- a/tests/ui/iterators/into-iter-on-arrays-lint.stderr +++ b/tests/ui/iterators/into-iter-on-arrays-lint.stderr @@ -5,7 +5,7 @@ LL | small.into_iter(); | ^^^^^^^^^ | = warning: this changes meaning in Rust 2021 - = note: for more information, see + = note: for more information, see = note: `#[warn(array_into_iter)]` on by default help: use `.iter()` instead of `.into_iter()` to avoid ambiguity | @@ -25,7 +25,7 @@ LL | [1, 2].into_iter(); | ^^^^^^^^^ | = warning: this changes meaning in Rust 2021 - = note: for more information, see + = note: for more information, see help: use `.iter()` instead of `.into_iter()` to avoid ambiguity | LL - [1, 2].into_iter(); @@ -44,7 +44,7 @@ LL | big.into_iter(); | ^^^^^^^^^ | = warning: this changes meaning in Rust 2021 - = note: for more information, see + = note: for more information, see help: use `.iter()` instead of `.into_iter()` to avoid ambiguity | LL - big.into_iter(); @@ -63,7 +63,7 @@ LL | [0u8; 33].into_iter(); | ^^^^^^^^^ | = warning: this changes meaning in Rust 2021 - = note: for more information, see + = note: for more information, see help: use `.iter()` instead of `.into_iter()` to avoid ambiguity | LL - [0u8; 33].into_iter(); @@ -82,7 +82,7 @@ LL | Box::new(small).into_iter(); | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` | = warning: this changes meaning in Rust 2021 - = note: for more information, see + = note: for more information, see warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to `<[T; N] as IntoIterator>::into_iter` in Rust 2021 --> $DIR/into-iter-on-arrays-lint.rs:27:22 @@ -91,7 +91,7 @@ LL | Box::new([1, 2]).into_iter(); | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` | = warning: this changes meaning in Rust 2021 - = note: for more information, see + = note: for more information, see warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to `<[T; N] as IntoIterator>::into_iter` in Rust 2021 --> $DIR/into-iter-on-arrays-lint.rs:30:19 @@ -100,7 +100,7 @@ LL | Box::new(big).into_iter(); | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` | = warning: this changes meaning in Rust 2021 - = note: for more information, see + = note: for more information, see warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to `<[T; N] as IntoIterator>::into_iter` in Rust 2021 --> $DIR/into-iter-on-arrays-lint.rs:33:25 @@ -109,7 +109,7 @@ LL | Box::new([0u8; 33]).into_iter(); | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` | = warning: this changes meaning in Rust 2021 - = note: for more information, see + = note: for more information, see warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to `<[T; N] as IntoIterator>::into_iter` in Rust 2021 --> $DIR/into-iter-on-arrays-lint.rs:37:31 @@ -118,7 +118,7 @@ LL | Box::new(Box::new(small)).into_iter(); | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` | = warning: this changes meaning in Rust 2021 - = note: for more information, see + = note: for more information, see warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to `<[T; N] as IntoIterator>::into_iter` in Rust 2021 --> $DIR/into-iter-on-arrays-lint.rs:40:32 @@ -127,7 +127,7 @@ LL | Box::new(Box::new([1, 2])).into_iter(); | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` | = warning: this changes meaning in Rust 2021 - = note: for more information, see + = note: for more information, see warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to `<[T; N] as IntoIterator>::into_iter` in Rust 2021 --> $DIR/into-iter-on-arrays-lint.rs:43:29 @@ -136,7 +136,7 @@ LL | Box::new(Box::new(big)).into_iter(); | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` | = warning: this changes meaning in Rust 2021 - = note: for more information, see + = note: for more information, see warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to `<[T; N] as IntoIterator>::into_iter` in Rust 2021 --> $DIR/into-iter-on-arrays-lint.rs:46:35 @@ -145,7 +145,7 @@ LL | Box::new(Box::new([0u8; 33])).into_iter(); | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` | = warning: this changes meaning in Rust 2021 - = note: for more information, see + = note: for more information, see warning: 12 warnings emitted diff --git a/tests/ui/iterators/into-iter-on-boxed-slices-2021.stderr b/tests/ui/iterators/into-iter-on-boxed-slices-2021.stderr index 7a5a2be5ef06..a0c1432756d4 100644 --- a/tests/ui/iterators/into-iter-on-boxed-slices-2021.stderr +++ b/tests/ui/iterators/into-iter-on-boxed-slices-2021.stderr @@ -5,7 +5,7 @@ LL | let _: Iter<'_, i32> = boxed_slice.into_iter(); | ^^^^^^^^^ | = warning: this changes meaning in Rust 2024 - = note: for more information, see + = note: for more information, see = note: `#[warn(boxed_slice_into_iter)]` on by default help: use `.iter()` instead of `.into_iter()` to avoid ambiguity | @@ -25,7 +25,7 @@ LL | let _: Iter<'_, i32> = Box::new(boxed_slice.clone()).into_iter(); | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` | = warning: this changes meaning in Rust 2024 - = note: for more information, see + = note: for more information, see warning: this method call resolves to `<&Box<[T]> as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to ` as IntoIterator>::into_iter` in Rust 2024 --> $DIR/into-iter-on-boxed-slices-2021.rs:22:57 @@ -34,7 +34,7 @@ LL | let _: Iter<'_, i32> = Rc::new(boxed_slice.clone()).into_iter(); | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` | = warning: this changes meaning in Rust 2024 - = note: for more information, see + = note: for more information, see warning: this method call resolves to `<&Box<[T]> as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to ` as IntoIterator>::into_iter` in Rust 2024 --> $DIR/into-iter-on-boxed-slices-2021.rs:25:55 @@ -43,7 +43,7 @@ LL | let _: Iter<'_, i32> = Array(boxed_slice.clone()).into_iter(); | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` | = warning: this changes meaning in Rust 2024 - = note: for more information, see + = note: for more information, see warning: this method call resolves to `<&Box<[T]> as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to ` as IntoIterator>::into_iter` in Rust 2024 --> $DIR/into-iter-on-boxed-slices-2021.rs:32:48 @@ -52,7 +52,7 @@ LL | for _ in (Box::new([1, 2, 3]) as Box<[_]>).into_iter() {} | ^^^^^^^^^ | = warning: this changes meaning in Rust 2024 - = note: for more information, see + = note: for more information, see help: use `.iter()` instead of `.into_iter()` to avoid ambiguity | LL - for _ in (Box::new([1, 2, 3]) as Box<[_]>).into_iter() {} diff --git a/tests/ui/iterators/into-iter-on-boxed-slices-lint.stderr b/tests/ui/iterators/into-iter-on-boxed-slices-lint.stderr index 6762ed28d368..377455d6a260 100644 --- a/tests/ui/iterators/into-iter-on-boxed-slices-lint.stderr +++ b/tests/ui/iterators/into-iter-on-boxed-slices-lint.stderr @@ -5,7 +5,7 @@ LL | boxed.into_iter(); | ^^^^^^^^^ | = warning: this changes meaning in Rust 2024 - = note: for more information, see + = note: for more information, see = note: `#[warn(boxed_slice_into_iter)]` on by default help: use `.iter()` instead of `.into_iter()` to avoid ambiguity | @@ -25,7 +25,7 @@ LL | Box::new(boxed.clone()).into_iter(); | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` | = warning: this changes meaning in Rust 2024 - = note: for more information, see + = note: for more information, see warning: this method call resolves to `<&Box<[T]> as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to ` as IntoIterator>::into_iter` in Rust 2024 --> $DIR/into-iter-on-boxed-slices-lint.rs:16:39 @@ -34,7 +34,7 @@ LL | Box::new(Box::new(boxed.clone())).into_iter(); | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` | = warning: this changes meaning in Rust 2024 - = note: for more information, see + = note: for more information, see warning: 3 warnings emitted diff --git a/tests/ui/lint/bare-trait-objects-path.stderr b/tests/ui/lint/bare-trait-objects-path.stderr index 25f3e857806f..8da63a9c546f 100644 --- a/tests/ui/lint/bare-trait-objects-path.stderr +++ b/tests/ui/lint/bare-trait-objects-path.stderr @@ -5,7 +5,7 @@ LL | Dyn::func(); | ^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see = note: `#[warn(bare_trait_objects)]` on by default help: if this is a dyn-compatible trait, use `dyn` | @@ -19,7 +19,7 @@ LL | ::Dyn::func(); | ^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see help: if this is a dyn-compatible trait, use `dyn` | LL | ::func(); @@ -32,7 +32,7 @@ LL | Dyn::CONST; | ^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see help: if this is a dyn-compatible trait, use `dyn` | LL | ::CONST; @@ -45,7 +45,7 @@ LL | let _: Dyn::Ty; | ^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see help: if this is a dyn-compatible trait, use `dyn` | LL | let _: ::Ty; diff --git a/tests/ui/lint/force-warn/allowed-group-warn-by-default-lint.stderr b/tests/ui/lint/force-warn/allowed-group-warn-by-default-lint.stderr index a1aa29dd6977..2be7416711e0 100644 --- a/tests/ui/lint/force-warn/allowed-group-warn-by-default-lint.stderr +++ b/tests/ui/lint/force-warn/allowed-group-warn-by-default-lint.stderr @@ -5,7 +5,7 @@ LL | pub fn function(_x: Box) {} | ^^^^^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see = note: requested on the command line with `--force-warn bare-trait-objects` help: if this is a dyn-compatible trait, use `dyn` | diff --git a/tests/ui/lint/force-warn/cap-lints-allow.stderr b/tests/ui/lint/force-warn/cap-lints-allow.stderr index 0d10a43a14d7..92bcde11415f 100644 --- a/tests/ui/lint/force-warn/cap-lints-allow.stderr +++ b/tests/ui/lint/force-warn/cap-lints-allow.stderr @@ -5,7 +5,7 @@ LL | pub fn function(_x: Box) {} | ^^^^^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see = note: requested on the command line with `--force-warn bare-trait-objects` help: if this is a dyn-compatible trait, use `dyn` | diff --git a/tests/ui/lint/force-warn/cap-lints-warn-allowed-warn-by-default-lint.stderr b/tests/ui/lint/force-warn/cap-lints-warn-allowed-warn-by-default-lint.stderr index d1b764b34143..74b34de90f17 100644 --- a/tests/ui/lint/force-warn/cap-lints-warn-allowed-warn-by-default-lint.stderr +++ b/tests/ui/lint/force-warn/cap-lints-warn-allowed-warn-by-default-lint.stderr @@ -5,7 +5,7 @@ LL | 0...100 => true, | ^^^ help: use `..=` for an inclusive range | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see = note: `--force-warn ellipsis-inclusive-range-patterns` implied by `--force-warn rust-2021-compatibility` warning: 1 warning emitted diff --git a/tests/ui/lint/force-warn/lint-group-allowed-cli-warn-by-default-lint.stderr b/tests/ui/lint/force-warn/lint-group-allowed-cli-warn-by-default-lint.stderr index d52bd67e36af..5bfbc9599bc3 100644 --- a/tests/ui/lint/force-warn/lint-group-allowed-cli-warn-by-default-lint.stderr +++ b/tests/ui/lint/force-warn/lint-group-allowed-cli-warn-by-default-lint.stderr @@ -5,7 +5,7 @@ LL | pub fn function(_x: Box) {} | ^^^^^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see = note: `--force-warn bare-trait-objects` implied by `--force-warn rust-2018-idioms` help: if this is a dyn-compatible trait, use `dyn` | diff --git a/tests/ui/lint/force-warn/lint-group-allowed-lint-group.stderr b/tests/ui/lint/force-warn/lint-group-allowed-lint-group.stderr index 22483a3d874d..dabf12be5ff7 100644 --- a/tests/ui/lint/force-warn/lint-group-allowed-lint-group.stderr +++ b/tests/ui/lint/force-warn/lint-group-allowed-lint-group.stderr @@ -5,7 +5,7 @@ LL | pub fn function(_x: Box) {} | ^^^^^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see = note: `--force-warn bare-trait-objects` implied by `--force-warn rust-2018-idioms` help: if this is a dyn-compatible trait, use `dyn` | diff --git a/tests/ui/lint/force-warn/lint-group-allowed-warn-by-default-lint.stderr b/tests/ui/lint/force-warn/lint-group-allowed-warn-by-default-lint.stderr index aa183b9ba54c..23a3a9107a13 100644 --- a/tests/ui/lint/force-warn/lint-group-allowed-warn-by-default-lint.stderr +++ b/tests/ui/lint/force-warn/lint-group-allowed-warn-by-default-lint.stderr @@ -5,7 +5,7 @@ LL | pub fn function(_x: Box) {} | ^^^^^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see = note: `--force-warn bare-trait-objects` implied by `--force-warn rust-2018-idioms` help: if this is a dyn-compatible trait, use `dyn` | diff --git a/tests/ui/lint/inclusive-range-pattern-syntax.stderr b/tests/ui/lint/inclusive-range-pattern-syntax.stderr index ed9fa0d4101b..a41082bb13b1 100644 --- a/tests/ui/lint/inclusive-range-pattern-syntax.stderr +++ b/tests/ui/lint/inclusive-range-pattern-syntax.stderr @@ -5,7 +5,7 @@ LL | 1...2 => {} | ^^^ help: use `..=` for an inclusive range | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see note: the lint level is defined here --> $DIR/inclusive-range-pattern-syntax.rs:4:9 | @@ -19,7 +19,7 @@ LL | &1...2 => {} | ^^^^^^ help: use `..=` for an inclusive range: `&(1..=2)` | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see warning: 2 warnings emitted diff --git a/tests/ui/lint/lint-attr-everywhere-early.stderr b/tests/ui/lint/lint-attr-everywhere-early.stderr index fac0eb4faff8..2389b698c83c 100644 --- a/tests/ui/lint/lint-attr-everywhere-early.stderr +++ b/tests/ui/lint/lint-attr-everywhere-early.stderr @@ -391,7 +391,7 @@ LL | Match{f1: 0...100} => {} | ^^^ help: use `..=` for an inclusive range | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see note: the lint level is defined here --> $DIR/lint-attr-everywhere-early.rs:138:16 | @@ -489,7 +489,7 @@ LL | f1: 0...100, | ^^^ help: use `..=` for an inclusive range | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see note: the lint level is defined here --> $DIR/lint-attr-everywhere-early.rs:174:20 | diff --git a/tests/ui/lint/static-mut-refs.e2021.stderr b/tests/ui/lint/static-mut-refs.e2021.stderr index 320e0cee8e8b..75a7e60690cf 100644 --- a/tests/ui/lint/static-mut-refs.e2021.stderr +++ b/tests/ui/lint/static-mut-refs.e2021.stderr @@ -4,7 +4,7 @@ warning: creating a shared reference to mutable static LL | let _y = &X; | ^^ shared reference to mutable static | - = note: for more information, see + = note: for more information, see = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives = note: `#[warn(static_mut_refs)]` on by default help: use `&raw const` instead to create a raw pointer @@ -18,7 +18,7 @@ warning: creating a mutable reference to mutable static LL | let _y = &mut X; | ^^^^^^ mutable reference to mutable static | - = note: for more information, see + = note: for more information, see = note: mutable references to mutable statics are dangerous; it's undefined behavior if any other pointer to the static is used or if any other reference is created for the static while the mutable reference lives help: use `&raw mut` instead to create a raw pointer | @@ -31,7 +31,7 @@ warning: creating a shared reference to mutable static LL | let ref _a = X; | ^ shared reference to mutable static | - = note: for more information, see + = note: for more information, see = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives warning: creating a shared reference to mutable static @@ -40,7 +40,7 @@ warning: creating a shared reference to mutable static LL | let (_b, _c) = (&X, &Y); | ^^ shared reference to mutable static | - = note: for more information, see + = note: for more information, see = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives help: use `&raw const` instead to create a raw pointer | @@ -53,7 +53,7 @@ warning: creating a shared reference to mutable static LL | let (_b, _c) = (&X, &Y); | ^^ shared reference to mutable static | - = note: for more information, see + = note: for more information, see = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives help: use `&raw const` instead to create a raw pointer | @@ -66,7 +66,7 @@ warning: creating a shared reference to mutable static LL | foo(&X); | ^^ shared reference to mutable static | - = note: for more information, see + = note: for more information, see = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives help: use `&raw const` instead to create a raw pointer | @@ -79,7 +79,7 @@ warning: creating a shared reference to mutable static LL | let _ = Z.len(); | ^^^^^^^ shared reference to mutable static | - = note: for more information, see + = note: for more information, see = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives warning: creating a shared reference to mutable static @@ -88,7 +88,7 @@ warning: creating a shared reference to mutable static LL | let _ = format!("{:?}", Z); | ^ shared reference to mutable static | - = note: for more information, see + = note: for more information, see = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives warning: creating a shared reference to mutable static @@ -97,7 +97,7 @@ warning: creating a shared reference to mutable static LL | let _v = &A.value; | ^^^^^^^^ shared reference to mutable static | - = note: for more information, see + = note: for more information, see = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives help: use `&raw const` instead to create a raw pointer | @@ -110,7 +110,7 @@ warning: creating a shared reference to mutable static LL | let _s = &A.s.value; | ^^^^^^^^^^ shared reference to mutable static | - = note: for more information, see + = note: for more information, see = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives help: use `&raw const` instead to create a raw pointer | @@ -123,7 +123,7 @@ warning: creating a shared reference to mutable static LL | let ref _v = A.value; | ^^^^^^^ shared reference to mutable static | - = note: for more information, see + = note: for more information, see = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives warning: creating a mutable reference to mutable static @@ -135,7 +135,7 @@ LL | &mut ($x.0) LL | let _x = bar!(FOO); | --------- in this macro invocation | - = note: for more information, see + = note: for more information, see = note: mutable references to mutable statics are dangerous; it's undefined behavior if any other pointer to the static is used or if any other reference is created for the static while the mutable reference lives = note: this warning originates in the macro `bar` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/lint/static-mut-refs.e2024.stderr b/tests/ui/lint/static-mut-refs.e2024.stderr index bf7ffc62ce17..42a96bafc882 100644 --- a/tests/ui/lint/static-mut-refs.e2024.stderr +++ b/tests/ui/lint/static-mut-refs.e2024.stderr @@ -4,7 +4,7 @@ error: creating a shared reference to mutable static LL | let _y = &X; | ^^ shared reference to mutable static | - = note: for more information, see + = note: for more information, see = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives = note: `#[deny(static_mut_refs)]` on by default help: use `&raw const` instead to create a raw pointer @@ -18,7 +18,7 @@ error: creating a mutable reference to mutable static LL | let _y = &mut X; | ^^^^^^ mutable reference to mutable static | - = note: for more information, see + = note: for more information, see = note: mutable references to mutable statics are dangerous; it's undefined behavior if any other pointer to the static is used or if any other reference is created for the static while the mutable reference lives help: use `&raw mut` instead to create a raw pointer | @@ -31,7 +31,7 @@ error: creating a shared reference to mutable static LL | let ref _a = X; | ^ shared reference to mutable static | - = note: for more information, see + = note: for more information, see = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives error: creating a shared reference to mutable static @@ -40,7 +40,7 @@ error: creating a shared reference to mutable static LL | let (_b, _c) = (&X, &Y); | ^^ shared reference to mutable static | - = note: for more information, see + = note: for more information, see = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives help: use `&raw const` instead to create a raw pointer | @@ -53,7 +53,7 @@ error: creating a shared reference to mutable static LL | let (_b, _c) = (&X, &Y); | ^^ shared reference to mutable static | - = note: for more information, see + = note: for more information, see = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives help: use `&raw const` instead to create a raw pointer | @@ -66,7 +66,7 @@ error: creating a shared reference to mutable static LL | foo(&X); | ^^ shared reference to mutable static | - = note: for more information, see + = note: for more information, see = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives help: use `&raw const` instead to create a raw pointer | @@ -79,7 +79,7 @@ error: creating a shared reference to mutable static LL | let _ = Z.len(); | ^^^^^^^ shared reference to mutable static | - = note: for more information, see + = note: for more information, see = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives error: creating a shared reference to mutable static @@ -88,7 +88,7 @@ error: creating a shared reference to mutable static LL | let _ = format!("{:?}", Z); | ^ shared reference to mutable static | - = note: for more information, see + = note: for more information, see = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives error: creating a shared reference to mutable static @@ -97,7 +97,7 @@ error: creating a shared reference to mutable static LL | let _v = &A.value; | ^^^^^^^^ shared reference to mutable static | - = note: for more information, see + = note: for more information, see = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives help: use `&raw const` instead to create a raw pointer | @@ -110,7 +110,7 @@ error: creating a shared reference to mutable static LL | let _s = &A.s.value; | ^^^^^^^^^^ shared reference to mutable static | - = note: for more information, see + = note: for more information, see = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives help: use `&raw const` instead to create a raw pointer | @@ -123,7 +123,7 @@ error: creating a shared reference to mutable static LL | let ref _v = A.value; | ^^^^^^^ shared reference to mutable static | - = note: for more information, see + = note: for more information, see = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives error: creating a mutable reference to mutable static @@ -135,7 +135,7 @@ LL | &mut ($x.0) LL | let _x = bar!(FOO); | --------- in this macro invocation | - = note: for more information, see + = note: for more information, see = note: mutable references to mutable statics are dangerous; it's undefined behavior if any other pointer to the static is used or if any other reference is created for the static while the mutable reference lives = note: this error originates in the macro `bar` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/macros/expr_2021_cargo_fix_edition.stderr b/tests/ui/macros/expr_2021_cargo_fix_edition.stderr index a2c281d9c0a1..795d99449c26 100644 --- a/tests/ui/macros/expr_2021_cargo_fix_edition.stderr +++ b/tests/ui/macros/expr_2021_cargo_fix_edition.stderr @@ -5,7 +5,7 @@ LL | ($e:expr) => { | ^^^^ | = warning: this changes meaning in Rust 2024 - = note: for more information, see Migration Guide + = note: for more information, see Migration Guide note: the lint level is defined here --> $DIR/expr_2021_cargo_fix_edition.rs:4:9 | @@ -23,7 +23,7 @@ LL | ($($i:expr)*) => { }; | ^^^^ | = warning: this changes meaning in Rust 2024 - = note: for more information, see Migration Guide + = note: for more information, see Migration Guide help: to keep the existing behavior, use the `expr_2021` fragment specifier | LL | ($($i:expr_2021)*) => { }; diff --git a/tests/ui/macros/macro-or-patterns-back-compat.stderr b/tests/ui/macros/macro-or-patterns-back-compat.stderr index e04dfefa4e8e..67794f0a8b23 100644 --- a/tests/ui/macros/macro-or-patterns-back-compat.stderr +++ b/tests/ui/macros/macro-or-patterns-back-compat.stderr @@ -5,7 +5,7 @@ LL | macro_rules! foo { ($x:pat | $y:pat) => {} } | ^^^^^^ help: use pat_param to preserve semantics: `$x:pat_param` | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see note: the lint level is defined here --> $DIR/macro-or-patterns-back-compat.rs:4:9 | @@ -19,7 +19,7 @@ LL | macro_rules! bar { ($($x:pat)+ | $($y:pat)+) => {} } | ^^^^^^ help: use pat_param to preserve semantics: `$x:pat_param` | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see error: the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro --> $DIR/macro-or-patterns-back-compat.rs:19:21 @@ -28,7 +28,7 @@ LL | macro_rules! ogg { ($x:pat | $y:pat_param) => {} } | ^^^^^^ help: use pat_param to preserve semantics: `$x:pat_param` | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see error: the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro --> $DIR/macro-or-patterns-back-compat.rs:23:26 @@ -37,7 +37,7 @@ LL | ( $expr:expr , $( $( $pat:pat )|+ => $expr_arm:expr ),+ ) => { | ^^^^^^^^ help: use pat_param to preserve semantics: `$pat:pat_param` | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see error: aborting due to 4 previous errors diff --git a/tests/ui/macros/non-fmt-panic.stderr b/tests/ui/macros/non-fmt-panic.stderr index 30b63cb46e22..83410d365864 100644 --- a/tests/ui/macros/non-fmt-panic.stderr +++ b/tests/ui/macros/non-fmt-panic.stderr @@ -74,7 +74,7 @@ LL | assert!(false, S); | ^ | = note: this usage of `assert!()` is deprecated; it will be a hard error in Rust 2021 - = note: for more information, see + = note: for more information, see help: add a "{}" format string to `Display` the message | LL | assert!(false, "{}", S); @@ -87,7 +87,7 @@ LL | assert!(false, 123); | ^^^ | = note: this usage of `assert!()` is deprecated; it will be a hard error in Rust 2021 - = note: for more information, see + = note: for more information, see help: add a "{}" format string to `Display` the message | LL | assert!(false, "{}", 123); @@ -100,7 +100,7 @@ LL | assert!(false, Some(123)); | ^^^^^^^^^ | = note: this usage of `assert!()` is deprecated; it will be a hard error in Rust 2021 - = note: for more information, see + = note: for more information, see help: add a "{:?}" format string to use the `Debug` implementation of `Option` | LL | assert!(false, "{:?}", Some(123)); @@ -125,7 +125,7 @@ LL | panic!(C); | ^ | = note: this usage of `panic!()` is deprecated; it will be a hard error in Rust 2021 - = note: for more information, see + = note: for more information, see help: add a "{}" format string to `Display` the message | LL | panic!("{}", C); @@ -138,7 +138,7 @@ LL | panic!(S); | ^ | = note: this usage of `panic!()` is deprecated; it will be a hard error in Rust 2021 - = note: for more information, see + = note: for more information, see help: add a "{}" format string to `Display` the message | LL | panic!("{}", S); @@ -151,7 +151,7 @@ LL | unreachable!(S); | ^ | = note: this usage of `unreachable!()` is deprecated; it will be a hard error in Rust 2021 - = note: for more information, see + = note: for more information, see help: add a "{}" format string to `Display` the message | LL | unreachable!("{}", S); @@ -164,7 +164,7 @@ LL | unreachable!(S); | ^ | = note: this usage of `unreachable!()` is deprecated; it will be a hard error in Rust 2021 - = note: for more information, see + = note: for more information, see help: add a "{}" format string to `Display` the message | LL | unreachable!("{}", S); @@ -177,7 +177,7 @@ LL | std::panic!(123); | ^^^ | = note: this usage of `std::panic!()` is deprecated; it will be a hard error in Rust 2021 - = note: for more information, see + = note: for more information, see help: add a "{}" format string to `Display` the message | LL | std::panic!("{}", 123); @@ -195,7 +195,7 @@ LL | core::panic!(&*"abc"); | ^^^^^^^ | = note: this usage of `core::panic!()` is deprecated; it will be a hard error in Rust 2021 - = note: for more information, see + = note: for more information, see help: add a "{}" format string to `Display` the message | LL | core::panic!("{}", &*"abc"); @@ -208,7 +208,7 @@ LL | panic!(Some(123)); | ^^^^^^^^^ | = note: this usage of `panic!()` is deprecated; it will be a hard error in Rust 2021 - = note: for more information, see + = note: for more information, see help: add a "{:?}" format string to use the `Debug` implementation of `Option` | LL | panic!("{:?}", Some(123)); @@ -262,7 +262,7 @@ LL | panic!(a!()); | ^^^^ | = note: this usage of `panic!()` is deprecated; it will be a hard error in Rust 2021 - = note: for more information, see + = note: for more information, see help: add a "{}" format string to `Display` the message | LL | panic!("{}", a!()); @@ -280,7 +280,7 @@ LL | unreachable!(a!()); | ^^^^ | = note: this usage of `unreachable!()` is deprecated; it will be a hard error in Rust 2021 - = note: for more information, see + = note: for more information, see help: add a "{}" format string to `Display` the message | LL | unreachable!("{}", a!()); @@ -293,7 +293,7 @@ LL | panic!(format!("{}", 1)); | ^^^^^^^^^^^^^^^^ | = note: this usage of `panic!()` is deprecated; it will be a hard error in Rust 2021 - = note: for more information, see + = note: for more information, see = note: the `panic!()` macro supports formatting, so there's no need for the `format!()` macro here help: remove the `format!(..)` macro call | @@ -308,7 +308,7 @@ LL | unreachable!(format!("{}", 1)); | ^^^^^^^^^^^^^^^^ | = note: this usage of `unreachable!()` is deprecated; it will be a hard error in Rust 2021 - = note: for more information, see + = note: for more information, see = note: the `unreachable!()` macro supports formatting, so there's no need for the `format!()` macro here help: remove the `format!(..)` macro call | @@ -323,7 +323,7 @@ LL | assert!(false, format!("{}", 1)); | ^^^^^^^^^^^^^^^^ | = note: this usage of `assert!()` is deprecated; it will be a hard error in Rust 2021 - = note: for more information, see + = note: for more information, see = note: the `assert!()` macro supports formatting, so there's no need for the `format!()` macro here help: remove the `format!(..)` macro call | @@ -338,7 +338,7 @@ LL | debug_assert!(false, format!("{}", 1)); | ^^^^^^^^^^^^^^^^ | = note: this usage of `debug_assert!()` is deprecated; it will be a hard error in Rust 2021 - = note: for more information, see + = note: for more information, see = note: the `debug_assert!()` macro supports formatting, so there's no need for the `format!()` macro here help: remove the `format!(..)` macro call | @@ -353,7 +353,7 @@ LL | panic![123]; | ^^^ | = note: this usage of `panic!()` is deprecated; it will be a hard error in Rust 2021 - = note: for more information, see + = note: for more information, see help: add a "{}" format string to `Display` the message | LL | panic!["{}", 123]; @@ -371,7 +371,7 @@ LL | panic!{123}; | ^^^ | = note: this usage of `panic!()` is deprecated; it will be a hard error in Rust 2021 - = note: for more information, see + = note: for more information, see help: add a "{}" format string to `Display` the message | LL | panic!{"{}", 123}; @@ -391,7 +391,7 @@ LL | panic!(v); | help: use std::panic::panic_any instead: `std::panic::panic_any` | = note: this usage of `panic!()` is deprecated; it will be a hard error in Rust 2021 - = note: for more information, see + = note: for more information, see warning: panic message is not a string literal --> $DIR/non-fmt-panic.rs:79:20 @@ -400,7 +400,7 @@ LL | assert!(false, v); | ^ | = note: this usage of `assert!()` is deprecated; it will be a hard error in Rust 2021 - = note: for more information, see + = note: for more information, see warning: panic message is not a string literal --> $DIR/non-fmt-panic.rs:83:12 @@ -409,7 +409,7 @@ LL | panic!(v); | ^ | = note: this usage of `panic!()` is deprecated; it will be a hard error in Rust 2021 - = note: for more information, see + = note: for more information, see help: add a "{:?}" format string to use the `Debug` implementation of `T` | LL | panic!("{:?}", v); @@ -427,7 +427,7 @@ LL | assert!(false, v); | ^ | = note: this usage of `assert!()` is deprecated; it will be a hard error in Rust 2021 - = note: for more information, see + = note: for more information, see help: add a "{:?}" format string to use the `Debug` implementation of `T` | LL | assert!(false, "{:?}", v); @@ -440,7 +440,7 @@ LL | panic!(v); | ^ | = note: this usage of `panic!()` is deprecated; it will be a hard error in Rust 2021 - = note: for more information, see + = note: for more information, see help: add a "{}" format string to `Display` the message | LL | panic!("{}", v); @@ -458,7 +458,7 @@ LL | assert!(false, v); | ^ | = note: this usage of `assert!()` is deprecated; it will be a hard error in Rust 2021 - = note: for more information, see + = note: for more information, see help: add a "{}" format string to `Display` the message | LL | assert!(false, "{}", v); @@ -471,7 +471,7 @@ LL | panic!(v); | ^ | = note: this usage of `panic!()` is deprecated; it will be a hard error in Rust 2021 - = note: for more information, see + = note: for more information, see help: add a "{}" format string to `Display` the message | LL | panic!("{}", v); @@ -489,7 +489,7 @@ LL | assert!(false, v); | ^ | = note: this usage of `assert!()` is deprecated; it will be a hard error in Rust 2021 - = note: for more information, see + = note: for more information, see help: add a "{}" format string to `Display` the message | LL | assert!(false, "{}", v); diff --git a/tests/ui/never_type/defaulted-never-note.nofallback.stderr b/tests/ui/never_type/defaulted-never-note.nofallback.stderr index 6de323ad12c2..b7df6fb7a67a 100644 --- a/tests/ui/never_type/defaulted-never-note.nofallback.stderr +++ b/tests/ui/never_type/defaulted-never-note.nofallback.stderr @@ -5,7 +5,7 @@ LL | fn smeg() { | ^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! - = note: for more information, see + = note: for more information, see = help: specify the types explicitly note: in edition 2024, the requirement `!: ImplementedForUnitButNotNever` will fail --> $DIR/defaulted-never-note.rs:32:9 @@ -28,7 +28,7 @@ LL | fn smeg() { | ^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! - = note: for more information, see + = note: for more information, see = help: specify the types explicitly note: in edition 2024, the requirement `!: ImplementedForUnitButNotNever` will fail --> $DIR/defaulted-never-note.rs:32:9 diff --git a/tests/ui/never_type/dependency-on-fallback-to-unit.stderr b/tests/ui/never_type/dependency-on-fallback-to-unit.stderr index be8075662e0c..6ee57d531fb2 100644 --- a/tests/ui/never_type/dependency-on-fallback-to-unit.stderr +++ b/tests/ui/never_type/dependency-on-fallback-to-unit.stderr @@ -5,7 +5,7 @@ LL | fn def() { | ^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! - = note: for more information, see + = note: for more information, see = help: specify the types explicitly note: in edition 2024, the requirement `!: Default` will fail --> $DIR/dependency-on-fallback-to-unit.rs:12:19 @@ -26,7 +26,7 @@ LL | fn question_mark() -> Result<(), ()> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! - = note: for more information, see + = note: for more information, see = help: specify the types explicitly note: in edition 2024, the requirement `!: Default` will fail --> $DIR/dependency-on-fallback-to-unit.rs:22:5 @@ -48,7 +48,7 @@ LL | fn def() { | ^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! - = note: for more information, see + = note: for more information, see = help: specify the types explicitly note: in edition 2024, the requirement `!: Default` will fail --> $DIR/dependency-on-fallback-to-unit.rs:12:19 @@ -70,7 +70,7 @@ LL | fn question_mark() -> Result<(), ()> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! - = note: for more information, see + = note: for more information, see = help: specify the types explicitly note: in edition 2024, the requirement `!: Default` will fail --> $DIR/dependency-on-fallback-to-unit.rs:22:5 diff --git a/tests/ui/never_type/diverging-fallback-control-flow.nofallback.stderr b/tests/ui/never_type/diverging-fallback-control-flow.nofallback.stderr index 44ebdb435104..64a8ecdf5464 100644 --- a/tests/ui/never_type/diverging-fallback-control-flow.nofallback.stderr +++ b/tests/ui/never_type/diverging-fallback-control-flow.nofallback.stderr @@ -5,7 +5,7 @@ LL | fn assignment() { | ^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! - = note: for more information, see + = note: for more information, see = help: specify the types explicitly note: in edition 2024, the requirement `!: UnitDefault` will fail --> $DIR/diverging-fallback-control-flow.rs:36:13 @@ -25,7 +25,7 @@ LL | fn assignment_rev() { | ^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! - = note: for more information, see + = note: for more information, see = help: specify the types explicitly note: in edition 2024, the requirement `!: UnitDefault` will fail --> $DIR/diverging-fallback-control-flow.rs:50:13 @@ -47,7 +47,7 @@ LL | fn assignment() { | ^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! - = note: for more information, see + = note: for more information, see = help: specify the types explicitly note: in edition 2024, the requirement `!: UnitDefault` will fail --> $DIR/diverging-fallback-control-flow.rs:36:13 @@ -68,7 +68,7 @@ LL | fn assignment_rev() { | ^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! - = note: for more information, see + = note: for more information, see = help: specify the types explicitly note: in edition 2024, the requirement `!: UnitDefault` will fail --> $DIR/diverging-fallback-control-flow.rs:50:13 diff --git a/tests/ui/never_type/diverging-fallback-no-leak.nofallback.stderr b/tests/ui/never_type/diverging-fallback-no-leak.nofallback.stderr index 4a8dea42a4d6..ec48c38b6d76 100644 --- a/tests/ui/never_type/diverging-fallback-no-leak.nofallback.stderr +++ b/tests/ui/never_type/diverging-fallback-no-leak.nofallback.stderr @@ -5,7 +5,7 @@ LL | fn main() { | ^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! - = note: for more information, see + = note: for more information, see = help: specify the types explicitly note: in edition 2024, the requirement `!: Test` will fail --> $DIR/diverging-fallback-no-leak.rs:20:23 @@ -28,7 +28,7 @@ LL | fn main() { | ^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! - = note: for more information, see + = note: for more information, see = help: specify the types explicitly note: in edition 2024, the requirement `!: Test` will fail --> $DIR/diverging-fallback-no-leak.rs:20:23 diff --git a/tests/ui/never_type/diverging-fallback-unconstrained-return.nofallback.stderr b/tests/ui/never_type/diverging-fallback-unconstrained-return.nofallback.stderr index 803af39fd86f..48debdd61c84 100644 --- a/tests/ui/never_type/diverging-fallback-unconstrained-return.nofallback.stderr +++ b/tests/ui/never_type/diverging-fallback-unconstrained-return.nofallback.stderr @@ -5,7 +5,7 @@ LL | fn main() { | ^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! - = note: for more information, see + = note: for more information, see = help: specify the types explicitly note: in edition 2024, the requirement `!: UnitReturn` will fail --> $DIR/diverging-fallback-unconstrained-return.rs:39:23 @@ -28,7 +28,7 @@ LL | fn main() { | ^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! - = note: for more information, see + = note: for more information, see = help: specify the types explicitly note: in edition 2024, the requirement `!: UnitReturn` will fail --> $DIR/diverging-fallback-unconstrained-return.rs:39:23 diff --git a/tests/ui/never_type/dont-suggest-turbofish-from-expansion.stderr b/tests/ui/never_type/dont-suggest-turbofish-from-expansion.stderr index 365e8869897c..d2d108edb4db 100644 --- a/tests/ui/never_type/dont-suggest-turbofish-from-expansion.stderr +++ b/tests/ui/never_type/dont-suggest-turbofish-from-expansion.stderr @@ -5,7 +5,7 @@ LL | fn main() -> Result<(), ()> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! - = note: for more information, see + = note: for more information, see = help: specify the types explicitly note: in edition 2024, the requirement `!: Default` will fail --> $DIR/dont-suggest-turbofish-from-expansion.rs:14:23 @@ -32,7 +32,7 @@ LL | fn main() -> Result<(), ()> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! - = note: for more information, see + = note: for more information, see = help: specify the types explicitly note: in edition 2024, the requirement `!: Default` will fail --> $DIR/dont-suggest-turbofish-from-expansion.rs:14:23 diff --git a/tests/ui/never_type/fallback-closure-ret.nofallback.stderr b/tests/ui/never_type/fallback-closure-ret.nofallback.stderr index cf19363a7d8b..5651a2658885 100644 --- a/tests/ui/never_type/fallback-closure-ret.nofallback.stderr +++ b/tests/ui/never_type/fallback-closure-ret.nofallback.stderr @@ -5,7 +5,7 @@ LL | fn main() { | ^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! - = note: for more information, see + = note: for more information, see = help: specify the types explicitly note: in edition 2024, the requirement `!: Bar` will fail --> $DIR/fallback-closure-ret.rs:24:5 @@ -28,7 +28,7 @@ LL | fn main() { | ^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! - = note: for more information, see + = note: for more information, see = help: specify the types explicitly note: in edition 2024, the requirement `!: Bar` will fail --> $DIR/fallback-closure-ret.rs:24:5 diff --git a/tests/ui/never_type/impl_trait_fallback.stderr b/tests/ui/never_type/impl_trait_fallback.stderr index 7250db127cd6..36d2eae1df24 100644 --- a/tests/ui/never_type/impl_trait_fallback.stderr +++ b/tests/ui/never_type/impl_trait_fallback.stderr @@ -5,7 +5,7 @@ LL | fn should_ret_unit() -> impl T { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! - = note: for more information, see + = note: for more information, see = help: specify the types explicitly note: in edition 2024, the requirement `!: T` will fail --> $DIR/impl_trait_fallback.rs:8:25 @@ -24,7 +24,7 @@ LL | fn should_ret_unit() -> impl T { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! - = note: for more information, see + = note: for more information, see = help: specify the types explicitly note: in edition 2024, the requirement `!: T` will fail --> $DIR/impl_trait_fallback.rs:8:25 diff --git a/tests/ui/never_type/lint-breaking-2024-assign-underscore.stderr b/tests/ui/never_type/lint-breaking-2024-assign-underscore.stderr index 945db40782ec..6a85b9923d3e 100644 --- a/tests/ui/never_type/lint-breaking-2024-assign-underscore.stderr +++ b/tests/ui/never_type/lint-breaking-2024-assign-underscore.stderr @@ -5,7 +5,7 @@ LL | fn test() -> Result<(), ()> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! - = note: for more information, see + = note: for more information, see = help: specify the types explicitly note: in edition 2024, the requirement `!: Default` will fail --> $DIR/lint-breaking-2024-assign-underscore.rs:13:9 @@ -32,7 +32,7 @@ LL | fn test() -> Result<(), ()> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in Rust 2024 and in a future release in all editions! - = note: for more information, see + = note: for more information, see = help: specify the types explicitly note: in edition 2024, the requirement `!: Default` will fail --> $DIR/lint-breaking-2024-assign-underscore.rs:13:9 diff --git a/tests/ui/never_type/lint-never-type-fallback-flowing-into-unsafe.e2015.stderr b/tests/ui/never_type/lint-never-type-fallback-flowing-into-unsafe.e2015.stderr index c90efd277845..48734f3b3f8b 100644 --- a/tests/ui/never_type/lint-never-type-fallback-flowing-into-unsafe.e2015.stderr +++ b/tests/ui/never_type/lint-never-type-fallback-flowing-into-unsafe.e2015.stderr @@ -5,7 +5,7 @@ LL | unsafe { mem::zeroed() } | ^^^^^^^^^^^^^ | = warning: this changes meaning in Rust 2024 and in a future release in all editions! - = note: for more information, see + = note: for more information, see = help: specify the type explicitly = note: `#[warn(never_type_fallback_flowing_into_unsafe)]` on by default help: use `()` annotations to avoid fallback changes @@ -20,7 +20,7 @@ LL | core::mem::transmute(Zst) | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this changes meaning in Rust 2024 and in a future release in all editions! - = note: for more information, see + = note: for more information, see = help: specify the type explicitly help: use `()` annotations to avoid fallback changes | @@ -34,7 +34,7 @@ LL | unsafe { Union { a: () }.b } | ^^^^^^^^^^^^^^^^^ | = warning: this changes meaning in Rust 2024 and in a future release in all editions! - = note: for more information, see + = note: for more information, see = help: specify the type explicitly warning: never type fallback affects this raw pointer dereference @@ -44,7 +44,7 @@ LL | unsafe { *ptr::from_ref(&()).cast() } | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this changes meaning in Rust 2024 and in a future release in all editions! - = note: for more information, see + = note: for more information, see = help: specify the type explicitly help: use `()` annotations to avoid fallback changes | @@ -58,7 +58,7 @@ LL | unsafe { internally_create(x) } | ^^^^^^^^^^^^^^^^^^^^ | = warning: this changes meaning in Rust 2024 and in a future release in all editions! - = note: for more information, see + = note: for more information, see = help: specify the type explicitly help: use `()` annotations to avoid fallback changes | @@ -72,7 +72,7 @@ LL | unsafe { zeroed() } | ^^^^^^^^ | = warning: this changes meaning in Rust 2024 and in a future release in all editions! - = note: for more information, see + = note: for more information, see = help: specify the type explicitly help: use `()` annotations to avoid fallback changes | @@ -86,7 +86,7 @@ LL | let zeroed = mem::zeroed; | ^^^^^^^^^^^ | = warning: this changes meaning in Rust 2024 and in a future release in all editions! - = note: for more information, see + = note: for more information, see = help: specify the type explicitly help: use `()` annotations to avoid fallback changes | @@ -100,7 +100,7 @@ LL | let f = internally_create; | ^^^^^^^^^^^^^^^^^ | = warning: this changes meaning in Rust 2024 and in a future release in all editions! - = note: for more information, see + = note: for more information, see = help: specify the type explicitly help: use `()` annotations to avoid fallback changes | @@ -114,7 +114,7 @@ LL | S(marker::PhantomData).create_out_of_thin_air() | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this changes meaning in Rust 2024 and in a future release in all editions! - = note: for more information, see + = note: for more information, see = help: specify the type explicitly warning: never type fallback affects this call to an `unsafe` function @@ -127,7 +127,7 @@ LL | msg_send!(); | ----------- in this macro invocation | = warning: this changes meaning in Rust 2024 and in a future release in all editions! - = note: for more information, see + = note: for more information, see = help: specify the type explicitly = note: this warning originates in the macro `msg_send` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -141,7 +141,7 @@ LL | unsafe { mem::zeroed() } | ^^^^^^^^^^^^^ | = warning: this changes meaning in Rust 2024 and in a future release in all editions! - = note: for more information, see + = note: for more information, see = help: specify the type explicitly = note: `#[warn(never_type_fallback_flowing_into_unsafe)]` on by default help: use `()` annotations to avoid fallback changes @@ -157,7 +157,7 @@ LL | core::mem::transmute(Zst) | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this changes meaning in Rust 2024 and in a future release in all editions! - = note: for more information, see + = note: for more information, see = help: specify the type explicitly = note: `#[warn(never_type_fallback_flowing_into_unsafe)]` on by default help: use `()` annotations to avoid fallback changes @@ -173,7 +173,7 @@ LL | unsafe { Union { a: () }.b } | ^^^^^^^^^^^^^^^^^ | = warning: this changes meaning in Rust 2024 and in a future release in all editions! - = note: for more information, see + = note: for more information, see = help: specify the type explicitly = note: `#[warn(never_type_fallback_flowing_into_unsafe)]` on by default @@ -185,7 +185,7 @@ LL | unsafe { *ptr::from_ref(&()).cast() } | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this changes meaning in Rust 2024 and in a future release in all editions! - = note: for more information, see + = note: for more information, see = help: specify the type explicitly = note: `#[warn(never_type_fallback_flowing_into_unsafe)]` on by default help: use `()` annotations to avoid fallback changes @@ -201,7 +201,7 @@ LL | unsafe { internally_create(x) } | ^^^^^^^^^^^^^^^^^^^^ | = warning: this changes meaning in Rust 2024 and in a future release in all editions! - = note: for more information, see + = note: for more information, see = help: specify the type explicitly = note: `#[warn(never_type_fallback_flowing_into_unsafe)]` on by default help: use `()` annotations to avoid fallback changes @@ -217,7 +217,7 @@ LL | unsafe { zeroed() } | ^^^^^^^^ | = warning: this changes meaning in Rust 2024 and in a future release in all editions! - = note: for more information, see + = note: for more information, see = help: specify the type explicitly = note: `#[warn(never_type_fallback_flowing_into_unsafe)]` on by default help: use `()` annotations to avoid fallback changes @@ -233,7 +233,7 @@ LL | let zeroed = mem::zeroed; | ^^^^^^^^^^^ | = warning: this changes meaning in Rust 2024 and in a future release in all editions! - = note: for more information, see + = note: for more information, see = help: specify the type explicitly = note: `#[warn(never_type_fallback_flowing_into_unsafe)]` on by default help: use `()` annotations to avoid fallback changes @@ -249,7 +249,7 @@ LL | let f = internally_create; | ^^^^^^^^^^^^^^^^^ | = warning: this changes meaning in Rust 2024 and in a future release in all editions! - = note: for more information, see + = note: for more information, see = help: specify the type explicitly = note: `#[warn(never_type_fallback_flowing_into_unsafe)]` on by default help: use `()` annotations to avoid fallback changes @@ -265,7 +265,7 @@ LL | S(marker::PhantomData).create_out_of_thin_air() | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this changes meaning in Rust 2024 and in a future release in all editions! - = note: for more information, see + = note: for more information, see = help: specify the type explicitly = note: `#[warn(never_type_fallback_flowing_into_unsafe)]` on by default @@ -280,7 +280,7 @@ LL | msg_send!(); | ----------- in this macro invocation | = warning: this changes meaning in Rust 2024 and in a future release in all editions! - = note: for more information, see + = note: for more information, see = help: specify the type explicitly = note: `#[warn(never_type_fallback_flowing_into_unsafe)]` on by default = note: this warning originates in the macro `msg_send` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/never_type/lint-never-type-fallback-flowing-into-unsafe.e2024.stderr b/tests/ui/never_type/lint-never-type-fallback-flowing-into-unsafe.e2024.stderr index 858d7381eeda..8039ef427c19 100644 --- a/tests/ui/never_type/lint-never-type-fallback-flowing-into-unsafe.e2024.stderr +++ b/tests/ui/never_type/lint-never-type-fallback-flowing-into-unsafe.e2024.stderr @@ -5,7 +5,7 @@ LL | unsafe { mem::zeroed() } | ^^^^^^^^^^^^^ | = warning: this changes meaning in Rust 2024 and in a future release in all editions! - = note: for more information, see + = note: for more information, see = help: specify the type explicitly = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` on by default help: use `()` annotations to avoid fallback changes @@ -20,7 +20,7 @@ LL | core::mem::transmute(Zst) | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this changes meaning in Rust 2024 and in a future release in all editions! - = note: for more information, see + = note: for more information, see = help: specify the type explicitly help: use `()` annotations to avoid fallback changes | @@ -34,7 +34,7 @@ LL | unsafe { Union { a: () }.b } | ^^^^^^^^^^^^^^^^^ | = warning: this changes meaning in Rust 2024 and in a future release in all editions! - = note: for more information, see + = note: for more information, see = help: specify the type explicitly error: never type fallback affects this raw pointer dereference @@ -44,7 +44,7 @@ LL | unsafe { *ptr::from_ref(&()).cast() } | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this changes meaning in Rust 2024 and in a future release in all editions! - = note: for more information, see + = note: for more information, see = help: specify the type explicitly help: use `()` annotations to avoid fallback changes | @@ -58,7 +58,7 @@ LL | unsafe { internally_create(x) } | ^^^^^^^^^^^^^^^^^^^^ | = warning: this changes meaning in Rust 2024 and in a future release in all editions! - = note: for more information, see + = note: for more information, see = help: specify the type explicitly help: use `()` annotations to avoid fallback changes | @@ -72,7 +72,7 @@ LL | unsafe { zeroed() } | ^^^^^^^^ | = warning: this changes meaning in Rust 2024 and in a future release in all editions! - = note: for more information, see + = note: for more information, see = help: specify the type explicitly help: use `()` annotations to avoid fallback changes | @@ -86,7 +86,7 @@ LL | let zeroed = mem::zeroed; | ^^^^^^^^^^^ | = warning: this changes meaning in Rust 2024 and in a future release in all editions! - = note: for more information, see + = note: for more information, see = help: specify the type explicitly help: use `()` annotations to avoid fallback changes | @@ -100,7 +100,7 @@ LL | let f = internally_create; | ^^^^^^^^^^^^^^^^^ | = warning: this changes meaning in Rust 2024 and in a future release in all editions! - = note: for more information, see + = note: for more information, see = help: specify the type explicitly help: use `()` annotations to avoid fallback changes | @@ -114,7 +114,7 @@ LL | S(marker::PhantomData).create_out_of_thin_air() | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this changes meaning in Rust 2024 and in a future release in all editions! - = note: for more information, see + = note: for more information, see = help: specify the type explicitly error: never type fallback affects this call to an `unsafe` function @@ -127,7 +127,7 @@ LL | msg_send!(); | ----------- in this macro invocation | = warning: this changes meaning in Rust 2024 and in a future release in all editions! - = note: for more information, see + = note: for more information, see = help: specify the type explicitly = note: this error originates in the macro `msg_send` (in Nightly builds, run with -Z macro-backtrace for more info) @@ -150,7 +150,7 @@ LL | unsafe { mem::zeroed() } | ^^^^^^^^^^^^^ | = warning: this changes meaning in Rust 2024 and in a future release in all editions! - = note: for more information, see + = note: for more information, see = help: specify the type explicitly = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` on by default help: use `()` annotations to avoid fallback changes @@ -166,7 +166,7 @@ LL | core::mem::transmute(Zst) | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this changes meaning in Rust 2024 and in a future release in all editions! - = note: for more information, see + = note: for more information, see = help: specify the type explicitly = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` on by default help: use `()` annotations to avoid fallback changes @@ -182,7 +182,7 @@ LL | unsafe { Union { a: () }.b } | ^^^^^^^^^^^^^^^^^ | = warning: this changes meaning in Rust 2024 and in a future release in all editions! - = note: for more information, see + = note: for more information, see = help: specify the type explicitly = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` on by default @@ -194,7 +194,7 @@ LL | unsafe { *ptr::from_ref(&()).cast() } | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this changes meaning in Rust 2024 and in a future release in all editions! - = note: for more information, see + = note: for more information, see = help: specify the type explicitly = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` on by default help: use `()` annotations to avoid fallback changes @@ -210,7 +210,7 @@ LL | unsafe { internally_create(x) } | ^^^^^^^^^^^^^^^^^^^^ | = warning: this changes meaning in Rust 2024 and in a future release in all editions! - = note: for more information, see + = note: for more information, see = help: specify the type explicitly = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` on by default help: use `()` annotations to avoid fallback changes @@ -226,7 +226,7 @@ LL | unsafe { zeroed() } | ^^^^^^^^ | = warning: this changes meaning in Rust 2024 and in a future release in all editions! - = note: for more information, see + = note: for more information, see = help: specify the type explicitly = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` on by default help: use `()` annotations to avoid fallback changes @@ -242,7 +242,7 @@ LL | let zeroed = mem::zeroed; | ^^^^^^^^^^^ | = warning: this changes meaning in Rust 2024 and in a future release in all editions! - = note: for more information, see + = note: for more information, see = help: specify the type explicitly = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` on by default help: use `()` annotations to avoid fallback changes @@ -258,7 +258,7 @@ LL | let f = internally_create; | ^^^^^^^^^^^^^^^^^ | = warning: this changes meaning in Rust 2024 and in a future release in all editions! - = note: for more information, see + = note: for more information, see = help: specify the type explicitly = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` on by default help: use `()` annotations to avoid fallback changes @@ -274,7 +274,7 @@ LL | S(marker::PhantomData).create_out_of_thin_air() | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this changes meaning in Rust 2024 and in a future release in all editions! - = note: for more information, see + = note: for more information, see = help: specify the type explicitly = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` on by default @@ -289,7 +289,7 @@ LL | msg_send!(); | ----------- in this macro invocation | = warning: this changes meaning in Rust 2024 and in a future release in all editions! - = note: for more information, see + = note: for more information, see = help: specify the type explicitly = note: `#[deny(never_type_fallback_flowing_into_unsafe)]` on by default = note: this error originates in the macro `msg_send` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/nll/borrowck-thread-local-static-mut-borrow-outlives-fn.stderr b/tests/ui/nll/borrowck-thread-local-static-mut-borrow-outlives-fn.stderr index 8268f5df2365..331c6510ce73 100644 --- a/tests/ui/nll/borrowck-thread-local-static-mut-borrow-outlives-fn.stderr +++ b/tests/ui/nll/borrowck-thread-local-static-mut-borrow-outlives-fn.stderr @@ -4,7 +4,7 @@ warning: creating a mutable reference to mutable static LL | S1 { a: unsafe { &mut X1 } } | ^^^^^^^ mutable reference to mutable static | - = note: for more information, see + = note: for more information, see = note: mutable references to mutable statics are dangerous; it's undefined behavior if any other pointer to the static is used or if any other reference is created for the static while the mutable reference lives = note: `#[warn(static_mut_refs)]` on by default help: use `&raw mut` instead to create a raw pointer diff --git a/tests/ui/parser/recover/recover-pat-ranges.stderr b/tests/ui/parser/recover/recover-pat-ranges.stderr index 6c17182618b5..246c704d53fa 100644 --- a/tests/ui/parser/recover/recover-pat-ranges.stderr +++ b/tests/ui/parser/recover/recover-pat-ranges.stderr @@ -191,7 +191,7 @@ LL | (1 + 4)...1 * 2 => (), | ^^^ help: use `..=` for an inclusive range | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see = note: `#[warn(ellipsis_inclusive_range_patterns)]` on by default error: aborting due to 13 previous errors; 1 warning emitted diff --git a/tests/ui/parser/recover/recover-range-pats.stderr b/tests/ui/parser/recover/recover-range-pats.stderr index a2f3ba4dd94f..1570475a0989 100644 --- a/tests/ui/parser/recover/recover-range-pats.stderr +++ b/tests/ui/parser/recover/recover-range-pats.stderr @@ -339,7 +339,7 @@ LL | if let 0...3 = 0 {} | ^^^ help: use `..=` for an inclusive range | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see note: the lint level is defined here --> $DIR/recover-range-pats.rs:6:9 | @@ -353,7 +353,7 @@ LL | if let 0...Y = 0 {} | ^^^ help: use `..=` for an inclusive range | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see error: `...` range patterns are deprecated --> $DIR/recover-range-pats.rs:46:13 @@ -362,7 +362,7 @@ LL | if let X...3 = 0 {} | ^^^ help: use `..=` for an inclusive range | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see error: `...` range patterns are deprecated --> $DIR/recover-range-pats.rs:49:13 @@ -371,7 +371,7 @@ LL | if let X...Y = 0 {} | ^^^ help: use `..=` for an inclusive range | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see error: `...` range patterns are deprecated --> $DIR/recover-range-pats.rs:52:16 @@ -380,7 +380,7 @@ LL | if let true...Y = 0 {} | ^^^ help: use `..=` for an inclusive range | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see error: `...` range patterns are deprecated --> $DIR/recover-range-pats.rs:55:13 @@ -389,7 +389,7 @@ LL | if let X...true = 0 {} | ^^^ help: use `..=` for an inclusive range | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see error: `...` range patterns are deprecated --> $DIR/recover-range-pats.rs:58:14 @@ -398,7 +398,7 @@ LL | if let .0...Y = 0 {} | ^^^ help: use `..=` for an inclusive range | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see error: `...` range patterns are deprecated --> $DIR/recover-range-pats.rs:62:13 @@ -407,7 +407,7 @@ LL | if let X... .0 = 0 {} | ^^^ help: use `..=` for an inclusive range | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see error: `...` range patterns are deprecated --> $DIR/recover-range-pats.rs:137:20 @@ -419,7 +419,7 @@ LL | mac2!(0, 1); | ----------- in this macro invocation | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see = note: this error originates in the macro `mac2` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0029]: only `char` and numeric types are allowed in range patterns diff --git a/tests/ui/parser/trait-object-trait-parens.stderr b/tests/ui/parser/trait-object-trait-parens.stderr index d75352b6811e..671fd2705204 100644 --- a/tests/ui/parser/trait-object-trait-parens.stderr +++ b/tests/ui/parser/trait-object-trait-parens.stderr @@ -32,7 +32,7 @@ LL | let _: Box<(Obj) + (?Sized) + (for<'a> Trait<'a>)>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see = note: `#[warn(bare_trait_objects)]` on by default help: if this is a dyn-compatible trait, use `dyn` | @@ -57,7 +57,7 @@ LL | let _: Box Trait<'a>) + (Obj)>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see help: if this is a dyn-compatible trait, use `dyn` | LL | let _: Box Trait<'a>) + (Obj)>; @@ -81,7 +81,7 @@ LL | let _: Box Trait<'a> + (Obj) + (?Sized)>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see help: if this is a dyn-compatible trait, use `dyn` | LL | let _: Box Trait<'a> + (Obj) + (?Sized)>; diff --git a/tests/ui/range/range-inclusive-pattern-precedence.stderr b/tests/ui/range/range-inclusive-pattern-precedence.stderr index 9df20fc45456..15237b0a499c 100644 --- a/tests/ui/range/range-inclusive-pattern-precedence.stderr +++ b/tests/ui/range/range-inclusive-pattern-precedence.stderr @@ -16,7 +16,7 @@ LL | &0...9 => {} | ^^^^^^ help: use `..=` for an inclusive range: `&(0..=9)` | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see note: the lint level is defined here --> $DIR/range-inclusive-pattern-precedence.rs:7:9 | diff --git a/tests/ui/range/range-inclusive-pattern-precedence2.stderr b/tests/ui/range/range-inclusive-pattern-precedence2.stderr index fd2fa78e92b5..4c5016b8ae45 100644 --- a/tests/ui/range/range-inclusive-pattern-precedence2.stderr +++ b/tests/ui/range/range-inclusive-pattern-precedence2.stderr @@ -16,7 +16,7 @@ LL | box 0...9 => {} | ^^^ help: use `..=` for an inclusive range | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see note: the lint level is defined here --> $DIR/range-inclusive-pattern-precedence2.rs:5:9 | diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.stderr b/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.stderr index ea4626092340..e16841b369db 100644 --- a/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.stderr +++ b/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.stderr @@ -79,7 +79,7 @@ error[E0133]: call to function `sse2` with `#[target_feature]` is unsafe and req LL | sse2(); | ^^^^^^ call to function with `#[target_feature]` | - = note: for more information, see + = note: for more information, see = help: in order for the call to be safe, the context requires the following additional target feature: sse2 = note: the sse2 target feature being enabled in the build configuration does not remove the requirement to list it in `#[target_feature]` note: an unsafe function restricts its caller, but its body is safe by default diff --git a/tests/ui/rust-2021/array-into-iter-ambiguous.stderr b/tests/ui/rust-2021/array-into-iter-ambiguous.stderr index 2a724bd30720..6e510df027ca 100644 --- a/tests/ui/rust-2021/array-into-iter-ambiguous.stderr +++ b/tests/ui/rust-2021/array-into-iter-ambiguous.stderr @@ -5,7 +5,7 @@ LL | let y = points.into_iter(); | ^^^^^^^^^^^^^^^^^^ help: disambiguate the associated function: `MyIntoIter::into_iter(points)` | = warning: this changes meaning in Rust 2021 - = note: for more information, see + = note: for more information, see note: the lint level is defined here --> $DIR/array-into-iter-ambiguous.rs:5:9 | diff --git a/tests/ui/rust-2021/future-prelude-collision-generic-trait.stderr b/tests/ui/rust-2021/future-prelude-collision-generic-trait.stderr index f38da132b5e8..bbc85d5bf45e 100644 --- a/tests/ui/rust-2021/future-prelude-collision-generic-trait.stderr +++ b/tests/ui/rust-2021/future-prelude-collision-generic-trait.stderr @@ -5,7 +5,7 @@ LL | U::try_from(self) | ^^^^^^^^^^^ help: disambiguate the associated function: `>::try_from` | = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see note: the lint level is defined here --> $DIR/future-prelude-collision-generic-trait.rs:5:9 | diff --git a/tests/ui/rust-2021/future-prelude-collision-generic.stderr b/tests/ui/rust-2021/future-prelude-collision-generic.stderr index 9893b3ebaa65..06ee6b40f115 100644 --- a/tests/ui/rust-2021/future-prelude-collision-generic.stderr +++ b/tests/ui/rust-2021/future-prelude-collision-generic.stderr @@ -5,7 +5,7 @@ LL | Generic::from_iter(1); | ^^^^^^^^^^^^^^^^^^ help: disambiguate the associated function: ` as MyFromIter>::from_iter` | = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see note: the lint level is defined here --> $DIR/future-prelude-collision-generic.rs:5:9 | @@ -19,7 +19,7 @@ LL | Generic::<'static, i32>::from_iter(1); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: disambiguate the associated function: ` as MyFromIter>::from_iter` | = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see warning: trait-associated function `from_iter` will become ambiguous in Rust 2021 --> $DIR/future-prelude-collision-generic.rs:34:5 @@ -28,7 +28,7 @@ LL | Generic::<'_, _>::from_iter(1); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: disambiguate the associated function: ` as MyFromIter>::from_iter` | = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see warning: 3 warnings emitted diff --git a/tests/ui/rust-2021/future-prelude-collision-imported.stderr b/tests/ui/rust-2021/future-prelude-collision-imported.stderr index c1d72d0df218..8f650e9ee519 100644 --- a/tests/ui/rust-2021/future-prelude-collision-imported.stderr +++ b/tests/ui/rust-2021/future-prelude-collision-imported.stderr @@ -5,7 +5,7 @@ LL | let _: u32 = 3u8.try_into().unwrap(); | ^^^^^^^^^^^^^^ help: disambiguate the associated function: `TryIntoU32::try_into(3u8)` | = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see note: the lint level is defined here --> $DIR/future-prelude-collision-imported.rs:4:9 | @@ -19,7 +19,7 @@ LL | let _: u32 = 3u8.try_into().unwrap(); | ^^^^^^^^^^^^^^ help: disambiguate the associated function: `crate::m::TryIntoU32::try_into(3u8)` | = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see warning: trait method `try_into` will become ambiguous in Rust 2021 --> $DIR/future-prelude-collision-imported.rs:53:22 @@ -28,7 +28,7 @@ LL | let _: u32 = 3u8.try_into().unwrap(); | ^^^^^^^^^^^^^^ help: disambiguate the associated function: `super::m::TryIntoU32::try_into(3u8)` | = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see warning: trait method `try_into` will become ambiguous in Rust 2021 --> $DIR/future-prelude-collision-imported.rs:64:22 @@ -37,7 +37,7 @@ LL | let _: u32 = 3u8.try_into().unwrap(); | ^^^^^^^^^^^^^^ help: disambiguate the associated function: `TryIntoU32::try_into(3u8)` | = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see warning: 4 warnings emitted diff --git a/tests/ui/rust-2021/future-prelude-collision-macros.stderr b/tests/ui/rust-2021/future-prelude-collision-macros.stderr index 4d4a07699580..c2d8c8540ad8 100644 --- a/tests/ui/rust-2021/future-prelude-collision-macros.stderr +++ b/tests/ui/rust-2021/future-prelude-collision-macros.stderr @@ -5,7 +5,7 @@ LL | foo!().try_into(todo!()); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: disambiguate the associated function: `MyTry::try_into(foo!(), todo!())` | = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see note: the lint level is defined here --> $DIR/future-prelude-collision-macros.rs:4:9 | @@ -19,7 +19,7 @@ LL | ::try_from(0); | ^^^^^^^^^^^^^^^^^^ help: disambiguate the associated function: `::try_from` | = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see warning: 2 warnings emitted diff --git a/tests/ui/rust-2021/future-prelude-collision-turbofish.stderr b/tests/ui/rust-2021/future-prelude-collision-turbofish.stderr index c0ef80fd8415..73ed238e5f7d 100644 --- a/tests/ui/rust-2021/future-prelude-collision-turbofish.stderr +++ b/tests/ui/rust-2021/future-prelude-collision-turbofish.stderr @@ -5,7 +5,7 @@ LL | x.try_into::().or(Err("foo"))?.checked_sub(1); | ^^^^^^^^^^^^^^^^^^^^^ help: disambiguate the associated function: `AnnotatableTryInto::try_into::(x)` | = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see note: the lint level is defined here --> $DIR/future-prelude-collision-turbofish.rs:6:9 | @@ -19,7 +19,7 @@ LL | x.try_into::().or(Err("foo"))?; | ^^^^^^^^^^^^^^^^^^^^^ help: disambiguate the associated function: `AnnotatableTryInto::try_into::(x)` | = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see warning: 2 warnings emitted diff --git a/tests/ui/rust-2021/future-prelude-collision.stderr b/tests/ui/rust-2021/future-prelude-collision.stderr index cae113ff7113..0b2514547563 100644 --- a/tests/ui/rust-2021/future-prelude-collision.stderr +++ b/tests/ui/rust-2021/future-prelude-collision.stderr @@ -5,7 +5,7 @@ LL | let _: u32 = 3u8.try_into().unwrap(); | ^^^^^^^^^^^^^^ help: disambiguate the associated function: `TryIntoU32::try_into(3u8)` | = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see note: the lint level is defined here --> $DIR/future-prelude-collision.rs:4:9 | @@ -19,7 +19,7 @@ LL | let _ = u32::try_from(3u8).unwrap(); | ^^^^^^^^^^^^^ help: disambiguate the associated function: `::try_from` | = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see warning: trait-associated function `from_iter` will become ambiguous in Rust 2021 --> $DIR/future-prelude-collision.rs:66:13 @@ -28,7 +28,7 @@ LL | let _ = >::from_iter(vec![1u8, 2, 3, 4, 5, 6].into_iter()); | ^^^^^^^^^^^^^^^^^^^^ help: disambiguate the associated function: ` as FromByteIterator>::from_iter` | = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see warning: trait-associated function `try_from` will become ambiguous in Rust 2021 --> $DIR/future-prelude-collision.rs:74:18 @@ -37,7 +37,7 @@ LL | let _: u32 = <_>::try_from(3u8).unwrap(); | ^^^^^^^^^^^^^ help: disambiguate the associated function: `<_ as TryFromU8>::try_from` | = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see warning: trait method `try_into` will become ambiguous in Rust 2021 --> $DIR/future-prelude-collision.rs:79:18 @@ -46,7 +46,7 @@ LL | let _: u32 = (&3u8).try_into().unwrap(); | ^^^^^^^^^^^^^^^^^ help: disambiguate the associated function: `TryIntoU32::try_into(*(&3u8))` | = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see warning: trait method `try_into` will become ambiguous in Rust 2021 --> $DIR/future-prelude-collision.rs:84:18 @@ -55,7 +55,7 @@ LL | let _: u32 = 3.0.try_into().unwrap(); | ^^^^^^^^^^^^^^ help: disambiguate the associated function: `TryIntoU32::try_into(&3.0)` | = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see warning: trait method `try_into` will become ambiguous in Rust 2021 --> $DIR/future-prelude-collision.rs:90:18 @@ -64,7 +64,7 @@ LL | let _: u32 = mut_ptr.try_into().unwrap(); | ^^^^^^^^^^^^^^^^^^ help: disambiguate the associated function: `TryIntoU32::try_into(mut_ptr as *const _)` | = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see warning: trait-associated function `try_from` will become ambiguous in Rust 2021 --> $DIR/future-prelude-collision.rs:95:13 @@ -73,7 +73,7 @@ LL | let _ = U32Alias::try_from(3u8).unwrap(); | ^^^^^^^^^^^^^^^^^^ help: disambiguate the associated function: `::try_from` | = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see warning: 8 warnings emitted diff --git a/tests/ui/rust-2021/generic-type-collision.stderr b/tests/ui/rust-2021/generic-type-collision.stderr index 1ec61044f4a5..c2d296822c04 100644 --- a/tests/ui/rust-2021/generic-type-collision.stderr +++ b/tests/ui/rust-2021/generic-type-collision.stderr @@ -5,7 +5,7 @@ LL | >::from_iter(None); | ^^^^^^^^^^^^^^^^^^^^^ help: disambiguate the associated function: ` as MyTrait<_>>::from_iter` | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see note: the lint level is defined here --> $DIR/generic-type-collision.rs:4:9 | diff --git a/tests/ui/rust-2021/inherent-dyn-collision.stderr b/tests/ui/rust-2021/inherent-dyn-collision.stderr index d9e720dd9af8..d582e4aedcb9 100644 --- a/tests/ui/rust-2021/inherent-dyn-collision.stderr +++ b/tests/ui/rust-2021/inherent-dyn-collision.stderr @@ -5,7 +5,7 @@ LL | get_dyn_trait().try_into().unwrap() | ^^^^^^^^^^^^^^^ help: disambiguate the method call: `(&*get_dyn_trait())` | = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see note: the lint level is defined here --> $DIR/inherent-dyn-collision.rs:8:9 | diff --git a/tests/ui/rust-2021/reserved-prefixes-migration.stderr b/tests/ui/rust-2021/reserved-prefixes-migration.stderr index 20914d1b9d14..8092c6368778 100644 --- a/tests/ui/rust-2021/reserved-prefixes-migration.stderr +++ b/tests/ui/rust-2021/reserved-prefixes-migration.stderr @@ -5,7 +5,7 @@ LL | m2!(z"hey"); | ^ unknown prefix | = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see note: the lint level is defined here --> $DIR/reserved-prefixes-migration.rs:5:9 | @@ -23,7 +23,7 @@ LL | m2!(prefix"hey"); | ^^^^^^ unknown prefix | = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see help: insert whitespace here to avoid this being parsed as a prefix in Rust 2021 | LL | m2!(prefix "hey"); @@ -36,7 +36,7 @@ LL | m3!(hey#123); | ^^^ unknown prefix | = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see help: insert whitespace here to avoid this being parsed as a prefix in Rust 2021 | LL | m3!(hey #123); @@ -49,7 +49,7 @@ LL | m3!(hey#hey); | ^^^ unknown prefix | = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see help: insert whitespace here to avoid this being parsed as a prefix in Rust 2021 | LL | m3!(hey #hey); @@ -62,7 +62,7 @@ LL | #name = #kind#value | ^^^^ unknown prefix | = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see help: insert whitespace here to avoid this being parsed as a prefix in Rust 2021 | LL | #name = #kind #value diff --git a/tests/ui/rust-2024/box-slice-into-iter-ambiguous.stderr b/tests/ui/rust-2024/box-slice-into-iter-ambiguous.stderr index 0735be266529..6da2cb97082c 100644 --- a/tests/ui/rust-2024/box-slice-into-iter-ambiguous.stderr +++ b/tests/ui/rust-2024/box-slice-into-iter-ambiguous.stderr @@ -5,7 +5,7 @@ LL | let y = points.into_iter(); | ^^^^^^^^^^^^^^^^^^ help: disambiguate the associated function: `MyIntoIter::into_iter(points)` | = warning: this changes meaning in Rust 2024 - = note: for more information, see + = note: for more information, see note: the lint level is defined here --> $DIR/box-slice-into-iter-ambiguous.rs:5:9 | diff --git a/tests/ui/rust-2024/gen-kw.e2015.stderr b/tests/ui/rust-2024/gen-kw.e2015.stderr index 3fca7b41ad27..ebb80cf22176 100644 --- a/tests/ui/rust-2024/gen-kw.e2015.stderr +++ b/tests/ui/rust-2024/gen-kw.e2015.stderr @@ -5,7 +5,7 @@ LL | fn gen() {} | ^^^ help: you can use a raw identifier to stay compatible: `r#gen` | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2024! - = note: for more information, see + = note: for more information, see note: the lint level is defined here --> $DIR/gen-kw.rs:4:9 | @@ -20,7 +20,7 @@ LL | let gen = r#gen; | ^^^ help: you can use a raw identifier to stay compatible: `r#gen` | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2024! - = note: for more information, see + = note: for more information, see error: `gen` is a keyword in the 2024 edition --> $DIR/gen-kw.rs:19:27 @@ -29,7 +29,7 @@ LL | () => { mod test { fn gen() {} } } | ^^^ help: you can use a raw identifier to stay compatible: `r#gen` | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2024! - = note: for more information, see + = note: for more information, see error: `gen` is a keyword in the 2024 edition --> $DIR/gen-kw.rs:25:9 @@ -38,7 +38,7 @@ LL | fn test<'gen>(_: &'gen i32) {} | ^^^^ help: you can use a raw identifier to stay compatible: `'r#gen` | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2024! - = note: for more information, see + = note: for more information, see error: `gen` is a keyword in the 2024 edition --> $DIR/gen-kw.rs:25:19 @@ -47,7 +47,7 @@ LL | fn test<'gen>(_: &'gen i32) {} | ^^^^ help: you can use a raw identifier to stay compatible: `'r#gen` | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2024! - = note: for more information, see + = note: for more information, see error: `gen` is a keyword in the 2024 edition --> $DIR/gen-kw.rs:33:13 @@ -56,7 +56,7 @@ LL | struct Test<'gen>(Box>, &'gen ()); | ^^^^ help: you can use a raw identifier to stay compatible: `'r#gen` | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2024! - = note: for more information, see + = note: for more information, see error: `gen` is a keyword in the 2024 edition --> $DIR/gen-kw.rs:33:28 @@ -65,7 +65,7 @@ LL | struct Test<'gen>(Box>, &'gen ()); | ^^^^ help: you can use a raw identifier to stay compatible: `'r#gen` | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2024! - = note: for more information, see + = note: for more information, see error: `gen` is a keyword in the 2024 edition --> $DIR/gen-kw.rs:33:37 @@ -74,7 +74,7 @@ LL | struct Test<'gen>(Box>, &'gen ()); | ^^^^ help: you can use a raw identifier to stay compatible: `'r#gen` | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2024! - = note: for more information, see + = note: for more information, see error: aborting due to 8 previous errors diff --git a/tests/ui/rust-2024/gen-kw.e2018.stderr b/tests/ui/rust-2024/gen-kw.e2018.stderr index b7f2c887536c..e491454d2a6f 100644 --- a/tests/ui/rust-2024/gen-kw.e2018.stderr +++ b/tests/ui/rust-2024/gen-kw.e2018.stderr @@ -5,7 +5,7 @@ LL | fn gen() {} | ^^^ help: you can use a raw identifier to stay compatible: `r#gen` | = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2024! - = note: for more information, see + = note: for more information, see note: the lint level is defined here --> $DIR/gen-kw.rs:4:9 | @@ -20,7 +20,7 @@ LL | let gen = r#gen; | ^^^ help: you can use a raw identifier to stay compatible: `r#gen` | = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2024! - = note: for more information, see + = note: for more information, see error: `gen` is a keyword in the 2024 edition --> $DIR/gen-kw.rs:19:27 @@ -29,7 +29,7 @@ LL | () => { mod test { fn gen() {} } } | ^^^ help: you can use a raw identifier to stay compatible: `r#gen` | = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2024! - = note: for more information, see + = note: for more information, see error: `gen` is a keyword in the 2024 edition --> $DIR/gen-kw.rs:25:9 @@ -38,7 +38,7 @@ LL | fn test<'gen>(_: &'gen i32) {} | ^^^^ help: you can use a raw identifier to stay compatible: `'r#gen` | = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2024! - = note: for more information, see + = note: for more information, see error: `gen` is a keyword in the 2024 edition --> $DIR/gen-kw.rs:25:19 @@ -47,7 +47,7 @@ LL | fn test<'gen>(_: &'gen i32) {} | ^^^^ help: you can use a raw identifier to stay compatible: `'r#gen` | = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2024! - = note: for more information, see + = note: for more information, see error: `gen` is a keyword in the 2024 edition --> $DIR/gen-kw.rs:33:13 @@ -56,7 +56,7 @@ LL | struct Test<'gen>(Box>, &'gen ()); | ^^^^ help: you can use a raw identifier to stay compatible: `'r#gen` | = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2024! - = note: for more information, see + = note: for more information, see error: `gen` is a keyword in the 2024 edition --> $DIR/gen-kw.rs:33:28 @@ -65,7 +65,7 @@ LL | struct Test<'gen>(Box>, &'gen ()); | ^^^^ help: you can use a raw identifier to stay compatible: `'r#gen` | = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2024! - = note: for more information, see + = note: for more information, see error: `gen` is a keyword in the 2024 edition --> $DIR/gen-kw.rs:33:37 @@ -74,7 +74,7 @@ LL | struct Test<'gen>(Box>, &'gen ()); | ^^^^ help: you can use a raw identifier to stay compatible: `'r#gen` | = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2024! - = note: for more information, see + = note: for more information, see error: aborting due to 8 previous errors diff --git a/tests/ui/rust-2024/prelude-migration/future-poll-async-block.e2021.stderr b/tests/ui/rust-2024/prelude-migration/future-poll-async-block.e2021.stderr index 15a3fa114147..8e5c3f4eb1de 100644 --- a/tests/ui/rust-2024/prelude-migration/future-poll-async-block.e2021.stderr +++ b/tests/ui/rust-2024/prelude-migration/future-poll-async-block.e2021.stderr @@ -5,7 +5,7 @@ LL | core::pin::pin!(async {}).poll(&mut context()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: disambiguate the associated function: `Meow::poll(&core::pin::pin!(async {}), &mut context())` | = warning: this is accepted in the current edition (Rust 2021) but is a hard error in Rust 2024! - = note: for more information, see + = note: for more information, see note: the lint level is defined here --> $DIR/future-poll-async-block.rs:7:9 | diff --git a/tests/ui/rust-2024/prelude-migration/future-poll-not-future-pinned.e2021.stderr b/tests/ui/rust-2024/prelude-migration/future-poll-not-future-pinned.e2021.stderr index 633731c2a5a5..70769524d2df 100644 --- a/tests/ui/rust-2024/prelude-migration/future-poll-not-future-pinned.e2021.stderr +++ b/tests/ui/rust-2024/prelude-migration/future-poll-not-future-pinned.e2021.stderr @@ -5,7 +5,7 @@ LL | core::pin::pin!(()).poll(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: disambiguate the associated function: `Meow::poll(&core::pin::pin!(()))` | = warning: this is accepted in the current edition (Rust 2021) but is a hard error in Rust 2024! - = note: for more information, see + = note: for more information, see note: the lint level is defined here --> $DIR/future-poll-not-future-pinned.rs:7:9 | diff --git a/tests/ui/rust-2024/prelude-migration/in_2024_compatibility.stderr b/tests/ui/rust-2024/prelude-migration/in_2024_compatibility.stderr index 5865029d65de..2e88751cd8a8 100644 --- a/tests/ui/rust-2024/prelude-migration/in_2024_compatibility.stderr +++ b/tests/ui/rust-2024/prelude-migration/in_2024_compatibility.stderr @@ -5,7 +5,7 @@ LL | core::pin::pin!(async {}).poll(&mut context()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: disambiguate the associated function: `Meow::poll(&core::pin::pin!(async {}), &mut context())` | = warning: this is accepted in the current edition (Rust 2021) but is a hard error in Rust 2024! - = note: for more information, see + = note: for more information, see note: the lint level is defined here --> $DIR/in_2024_compatibility.rs:3:9 | diff --git a/tests/ui/rust-2024/prelude-migration/into-future-adt.e2021.stderr b/tests/ui/rust-2024/prelude-migration/into-future-adt.e2021.stderr index e67f07b4e465..690c58f85b90 100644 --- a/tests/ui/rust-2024/prelude-migration/into-future-adt.e2021.stderr +++ b/tests/ui/rust-2024/prelude-migration/into-future-adt.e2021.stderr @@ -5,7 +5,7 @@ LL | Cat.into_future(); | ^^^^^^^^^^^^^^^^^ help: disambiguate the associated function: `Meow::into_future(&Cat)` | = warning: this is accepted in the current edition (Rust 2021) but is a hard error in Rust 2024! - = note: for more information, see + = note: for more information, see note: the lint level is defined here --> $DIR/into-future-adt.rs:7:9 | diff --git a/tests/ui/rust-2024/prelude-migration/into-future-not-into-future.e2021.stderr b/tests/ui/rust-2024/prelude-migration/into-future-not-into-future.e2021.stderr index 0588f5bf3f55..4423e1272e81 100644 --- a/tests/ui/rust-2024/prelude-migration/into-future-not-into-future.e2021.stderr +++ b/tests/ui/rust-2024/prelude-migration/into-future-not-into-future.e2021.stderr @@ -5,7 +5,7 @@ LL | Cat.into_future(); | ^^^^^^^^^^^^^^^^^ help: disambiguate the associated function: `Meow::into_future(&Cat)` | = warning: this is accepted in the current edition (Rust 2021) but is a hard error in Rust 2024! - = note: for more information, see + = note: for more information, see note: the lint level is defined here --> $DIR/into-future-not-into-future.rs:7:9 | diff --git a/tests/ui/rust-2024/reserved-guarded-strings-lexing.stderr b/tests/ui/rust-2024/reserved-guarded-strings-lexing.stderr index bf74f6eff998..488f66bb01d3 100644 --- a/tests/ui/rust-2024/reserved-guarded-strings-lexing.stderr +++ b/tests/ui/rust-2024/reserved-guarded-strings-lexing.stderr @@ -35,7 +35,7 @@ LL | demo3!(## "foo"); | ^^ | = warning: this is accepted in the current edition (Rust 2021) but is a hard error in Rust 2024! - = note: for more information, see + = note: for more information, see note: the lint level is defined here --> $DIR/reserved-guarded-strings-lexing.rs:4:9 | @@ -53,7 +53,7 @@ LL | demo4!(### "foo"); | ^^ | = warning: this is accepted in the current edition (Rust 2021) but is a hard error in Rust 2024! - = note: for more information, see + = note: for more information, see help: insert whitespace here to avoid this being parsed as a forbidden token in Rust 2024 | LL | demo4!(# ## "foo"); @@ -66,7 +66,7 @@ LL | demo4!(### "foo"); | ^^ | = warning: this is accepted in the current edition (Rust 2021) but is a hard error in Rust 2024! - = note: for more information, see + = note: for more information, see help: insert whitespace here to avoid this being parsed as a forbidden token in Rust 2024 | LL | demo4!(## # "foo"); @@ -79,7 +79,7 @@ LL | demo4!(## "foo"#); | ^^ | = warning: this is accepted in the current edition (Rust 2021) but is a hard error in Rust 2024! - = note: for more information, see + = note: for more information, see help: insert whitespace here to avoid this being parsed as a forbidden token in Rust 2024 | LL | demo4!(# # "foo"#); @@ -92,7 +92,7 @@ LL | demo7!(### "foo"###); | ^^ | = warning: this is accepted in the current edition (Rust 2021) but is a hard error in Rust 2024! - = note: for more information, see + = note: for more information, see help: insert whitespace here to avoid this being parsed as a forbidden token in Rust 2024 | LL | demo7!(# ## "foo"###); @@ -105,7 +105,7 @@ LL | demo7!(### "foo"###); | ^^ | = warning: this is accepted in the current edition (Rust 2021) but is a hard error in Rust 2024! - = note: for more information, see + = note: for more information, see help: insert whitespace here to avoid this being parsed as a forbidden token in Rust 2024 | LL | demo7!(## # "foo"###); @@ -118,7 +118,7 @@ LL | demo7!(### "foo"###); | ^^ | = warning: this is accepted in the current edition (Rust 2021) but is a hard error in Rust 2024! - = note: for more information, see + = note: for more information, see help: insert whitespace here to avoid this being parsed as a forbidden token in Rust 2024 | LL | demo7!(### "foo"# ##); @@ -131,7 +131,7 @@ LL | demo7!(### "foo"###); | ^^ | = warning: this is accepted in the current edition (Rust 2021) but is a hard error in Rust 2024! - = note: for more information, see + = note: for more information, see help: insert whitespace here to avoid this being parsed as a forbidden token in Rust 2024 | LL | demo7!(### "foo"## #); @@ -144,7 +144,7 @@ LL | demo5!(###"foo"#); | ^^^^^^^^^ | = warning: this is accepted in the current edition (Rust 2021) but is a hard error in Rust 2024! - = note: for more information, see + = note: for more information, see help: insert whitespace here to avoid this being parsed as a guarded string in Rust 2024 | LL | demo5!(# ##"foo"#); @@ -157,7 +157,7 @@ LL | demo5!(###"foo"#); | ^^^^^^^^ | = warning: this is accepted in the current edition (Rust 2021) but is a hard error in Rust 2024! - = note: for more information, see + = note: for more information, see help: insert whitespace here to avoid this being parsed as a guarded string in Rust 2024 | LL | demo5!(## #"foo"#); @@ -170,7 +170,7 @@ LL | demo5!(###"foo"#); | ^^^^^^^ | = warning: this is accepted in the current edition (Rust 2021) but is a hard error in Rust 2024! - = note: for more information, see + = note: for more information, see help: insert whitespace here to avoid this being parsed as a guarded string in Rust 2024 | LL | demo5!(### "foo"#); @@ -183,7 +183,7 @@ LL | demo5!(#"foo"###); | ^^^^^^^ | = warning: this is accepted in the current edition (Rust 2021) but is a hard error in Rust 2024! - = note: for more information, see + = note: for more information, see help: insert whitespace here to avoid this being parsed as a guarded string in Rust 2024 | LL | demo5!(# "foo"###); @@ -196,7 +196,7 @@ LL | demo5!(#"foo"###); | ^^ | = warning: this is accepted in the current edition (Rust 2021) but is a hard error in Rust 2024! - = note: for more information, see + = note: for more information, see help: insert whitespace here to avoid this being parsed as a forbidden token in Rust 2024 | LL | demo5!(#"foo"# ##); @@ -209,7 +209,7 @@ LL | demo5!(#"foo"###); | ^^ | = warning: this is accepted in the current edition (Rust 2021) but is a hard error in Rust 2024! - = note: for more information, see + = note: for more information, see help: insert whitespace here to avoid this being parsed as a forbidden token in Rust 2024 | LL | demo5!(#"foo"## #); @@ -222,7 +222,7 @@ LL | demo4!("foo"###); | ^^ | = warning: this is accepted in the current edition (Rust 2021) but is a hard error in Rust 2024! - = note: for more information, see + = note: for more information, see help: insert whitespace here to avoid this being parsed as a forbidden token in Rust 2024 | LL | demo4!("foo"# ##); @@ -235,7 +235,7 @@ LL | demo4!("foo"###); | ^^ | = warning: this is accepted in the current edition (Rust 2021) but is a hard error in Rust 2024! - = note: for more information, see + = note: for more information, see help: insert whitespace here to avoid this being parsed as a forbidden token in Rust 2024 | LL | demo4!("foo"## #); @@ -248,7 +248,7 @@ LL | demo4!(Ñ#""#); | ^^^^ | = warning: this is accepted in the current edition (Rust 2021) but is a hard error in Rust 2024! - = note: for more information, see + = note: for more information, see help: insert whitespace here to avoid this being parsed as a guarded string in Rust 2024 | LL | demo4!(Ñ# ""#); @@ -261,7 +261,7 @@ LL | demo3!(🙃#""); | ^^^ | = warning: this is accepted in the current edition (Rust 2021) but is a hard error in Rust 2024! - = note: for more information, see + = note: for more information, see help: insert whitespace here to avoid this being parsed as a guarded string in Rust 2024 | LL | demo3!(🙃# ""); diff --git a/tests/ui/rust-2024/reserved-guarded-strings-migration.stderr b/tests/ui/rust-2024/reserved-guarded-strings-migration.stderr index 59f920caa957..9e6c4554281b 100644 --- a/tests/ui/rust-2024/reserved-guarded-strings-migration.stderr +++ b/tests/ui/rust-2024/reserved-guarded-strings-migration.stderr @@ -5,7 +5,7 @@ LL | demo3!(## "foo"); | ^^ | = warning: this is accepted in the current edition (Rust 2021) but is a hard error in Rust 2024! - = note: for more information, see + = note: for more information, see note: the lint level is defined here --> $DIR/reserved-guarded-strings-migration.rs:5:9 | @@ -23,7 +23,7 @@ LL | demo4!(### "foo"); | ^^ | = warning: this is accepted in the current edition (Rust 2021) but is a hard error in Rust 2024! - = note: for more information, see + = note: for more information, see help: insert whitespace here to avoid this being parsed as a forbidden token in Rust 2024 | LL | demo4!(# ## "foo"); @@ -36,7 +36,7 @@ LL | demo4!(### "foo"); | ^^ | = warning: this is accepted in the current edition (Rust 2021) but is a hard error in Rust 2024! - = note: for more information, see + = note: for more information, see help: insert whitespace here to avoid this being parsed as a forbidden token in Rust 2024 | LL | demo4!(## # "foo"); @@ -49,7 +49,7 @@ LL | demo4!(## "foo"#); | ^^ | = warning: this is accepted in the current edition (Rust 2021) but is a hard error in Rust 2024! - = note: for more information, see + = note: for more information, see help: insert whitespace here to avoid this being parsed as a forbidden token in Rust 2024 | LL | demo4!(# # "foo"#); @@ -62,7 +62,7 @@ LL | demo6!(### "foo"##); | ^^ | = warning: this is accepted in the current edition (Rust 2021) but is a hard error in Rust 2024! - = note: for more information, see + = note: for more information, see help: insert whitespace here to avoid this being parsed as a forbidden token in Rust 2024 | LL | demo6!(# ## "foo"##); @@ -75,7 +75,7 @@ LL | demo6!(### "foo"##); | ^^ | = warning: this is accepted in the current edition (Rust 2021) but is a hard error in Rust 2024! - = note: for more information, see + = note: for more information, see help: insert whitespace here to avoid this being parsed as a forbidden token in Rust 2024 | LL | demo6!(## # "foo"##); @@ -88,7 +88,7 @@ LL | demo6!(### "foo"##); | ^^ | = warning: this is accepted in the current edition (Rust 2021) but is a hard error in Rust 2024! - = note: for more information, see + = note: for more information, see help: insert whitespace here to avoid this being parsed as a forbidden token in Rust 2024 | LL | demo6!(### "foo"# #); @@ -101,7 +101,7 @@ LL | demo4!("foo"###); | ^^ | = warning: this is accepted in the current edition (Rust 2021) but is a hard error in Rust 2024! - = note: for more information, see + = note: for more information, see help: insert whitespace here to avoid this being parsed as a forbidden token in Rust 2024 | LL | demo4!("foo"# ##); @@ -114,7 +114,7 @@ LL | demo4!("foo"###); | ^^ | = warning: this is accepted in the current edition (Rust 2021) but is a hard error in Rust 2024! - = note: for more information, see + = note: for more information, see help: insert whitespace here to avoid this being parsed as a forbidden token in Rust 2024 | LL | demo4!("foo"## #); @@ -127,7 +127,7 @@ LL | demo2!(#""); | ^^^ | = warning: this is accepted in the current edition (Rust 2021) but is a hard error in Rust 2024! - = note: for more information, see + = note: for more information, see help: insert whitespace here to avoid this being parsed as a guarded string in Rust 2024 | LL | demo2!(# ""); @@ -140,7 +140,7 @@ LL | demo3!(#""#); | ^^^^ | = warning: this is accepted in the current edition (Rust 2021) but is a hard error in Rust 2024! - = note: for more information, see + = note: for more information, see help: insert whitespace here to avoid this being parsed as a guarded string in Rust 2024 | LL | demo3!(# ""#); @@ -153,7 +153,7 @@ LL | demo3!(##""); | ^^^^ | = warning: this is accepted in the current edition (Rust 2021) but is a hard error in Rust 2024! - = note: for more information, see + = note: for more information, see help: insert whitespace here to avoid this being parsed as a guarded string in Rust 2024 | LL | demo3!(# #""); @@ -166,7 +166,7 @@ LL | demo3!(##""); | ^^^ | = warning: this is accepted in the current edition (Rust 2021) but is a hard error in Rust 2024! - = note: for more information, see + = note: for more information, see help: insert whitespace here to avoid this being parsed as a guarded string in Rust 2024 | LL | demo3!(## ""); @@ -179,7 +179,7 @@ LL | demo2!(#"foo"); | ^^^^^^ | = warning: this is accepted in the current edition (Rust 2021) but is a hard error in Rust 2024! - = note: for more information, see + = note: for more information, see help: insert whitespace here to avoid this being parsed as a guarded string in Rust 2024 | LL | demo2!(# "foo"); @@ -192,7 +192,7 @@ LL | demo3!(##"foo"); | ^^^^^^^ | = warning: this is accepted in the current edition (Rust 2021) but is a hard error in Rust 2024! - = note: for more information, see + = note: for more information, see help: insert whitespace here to avoid this being parsed as a guarded string in Rust 2024 | LL | demo3!(# #"foo"); @@ -205,7 +205,7 @@ LL | demo3!(##"foo"); | ^^^^^^ | = warning: this is accepted in the current edition (Rust 2021) but is a hard error in Rust 2024! - = note: for more information, see + = note: for more information, see help: insert whitespace here to avoid this being parsed as a guarded string in Rust 2024 | LL | demo3!(## "foo"); @@ -218,7 +218,7 @@ LL | demo3!(#"foo"#); | ^^^^^^^ | = warning: this is accepted in the current edition (Rust 2021) but is a hard error in Rust 2024! - = note: for more information, see + = note: for more information, see help: insert whitespace here to avoid this being parsed as a guarded string in Rust 2024 | LL | demo3!(# "foo"#); @@ -231,7 +231,7 @@ LL | demo4!(##"foo"#); | ^^^^^^^^ | = warning: this is accepted in the current edition (Rust 2021) but is a hard error in Rust 2024! - = note: for more information, see + = note: for more information, see help: insert whitespace here to avoid this being parsed as a guarded string in Rust 2024 | LL | demo4!(# #"foo"#); @@ -244,7 +244,7 @@ LL | demo4!(##"foo"#); | ^^^^^^^ | = warning: this is accepted in the current edition (Rust 2021) but is a hard error in Rust 2024! - = note: for more information, see + = note: for more information, see help: insert whitespace here to avoid this being parsed as a guarded string in Rust 2024 | LL | demo4!(## "foo"#); @@ -257,7 +257,7 @@ LL | demo5!(##"foo"##); | ^^^^^^^^^ | = warning: this is accepted in the current edition (Rust 2021) but is a hard error in Rust 2024! - = note: for more information, see + = note: for more information, see help: insert whitespace here to avoid this being parsed as a guarded string in Rust 2024 | LL | demo5!(# #"foo"##); @@ -270,7 +270,7 @@ LL | demo5!(##"foo"##); | ^^^^^^^ | = warning: this is accepted in the current edition (Rust 2021) but is a hard error in Rust 2024! - = note: for more information, see + = note: for more information, see help: insert whitespace here to avoid this being parsed as a guarded string in Rust 2024 | LL | demo5!(## "foo"##); @@ -283,7 +283,7 @@ LL | demo5!(##"foo"##); | ^^ | = warning: this is accepted in the current edition (Rust 2021) but is a hard error in Rust 2024! - = note: for more information, see + = note: for more information, see help: insert whitespace here to avoid this being parsed as a forbidden token in Rust 2024 | LL | demo5!(##"foo"# #); diff --git a/tests/ui/rust-2024/unsafe-attributes/in_2024_compatibility.stderr b/tests/ui/rust-2024/unsafe-attributes/in_2024_compatibility.stderr index f0a49f5bd794..2b77f6e8e52d 100644 --- a/tests/ui/rust-2024/unsafe-attributes/in_2024_compatibility.stderr +++ b/tests/ui/rust-2024/unsafe-attributes/in_2024_compatibility.stderr @@ -5,7 +5,7 @@ LL | #[no_mangle] | ^^^^^^^^^ usage of unsafe attribute | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2024! - = note: for more information, see + = note: for more information, see note: the lint level is defined here --> $DIR/in_2024_compatibility.rs:1:9 | diff --git a/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-fix.stderr b/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-fix.stderr index 15a48fb71594..b97176f5e0d3 100644 --- a/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-fix.stderr +++ b/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-fix.stderr @@ -5,7 +5,7 @@ LL | tt!([no_mangle]); | ^^^^^^^^^ usage of unsafe attribute | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2024! - = note: for more information, see + = note: for more information, see note: the lint level is defined here --> $DIR/unsafe-attributes-fix.rs:2:9 | @@ -26,7 +26,7 @@ LL | ident!(no_mangle); | ----------------- in this macro invocation | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2024! - = note: for more information, see + = note: for more information, see = note: this error originates in the macro `ident` (in Nightly builds, run with -Z macro-backtrace for more info) help: wrap the attribute in `unsafe(...)` | @@ -40,7 +40,7 @@ LL | meta!(no_mangle); | ^^^^^^^^^ usage of unsafe attribute | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2024! - = note: for more information, see + = note: for more information, see help: wrap the attribute in `unsafe(...)` | LL | meta!(unsafe(no_mangle)); @@ -53,7 +53,7 @@ LL | meta2!(export_name = "baw"); | ^^^^^^^^^^^ usage of unsafe attribute | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2024! - = note: for more information, see + = note: for more information, see help: wrap the attribute in `unsafe(...)` | LL | meta2!(unsafe(export_name = "baw")); @@ -69,7 +69,7 @@ LL | ident2!(export_name, "bars"); | ---------------------------- in this macro invocation | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2024! - = note: for more information, see + = note: for more information, see = note: this error originates in the macro `ident2` (in Nightly builds, run with -Z macro-backtrace for more info) help: wrap the attribute in `unsafe(...)` | @@ -86,7 +86,7 @@ LL | with_cfg_attr!(); | ---------------- in this macro invocation | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2024! - = note: for more information, see + = note: for more information, see = note: this error originates in the macro `with_cfg_attr` (in Nightly builds, run with -Z macro-backtrace for more info) help: wrap the attribute in `unsafe(...)` | @@ -100,7 +100,7 @@ LL | #[no_mangle] | ^^^^^^^^^ usage of unsafe attribute | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2024! - = note: for more information, see + = note: for more information, see help: wrap the attribute in `unsafe(...)` | LL | #[unsafe(no_mangle)] diff --git a/tests/ui/rust-2024/unsafe-env-suggestion.stderr b/tests/ui/rust-2024/unsafe-env-suggestion.stderr index 6c95d50f3932..3c5ceaaaf425 100644 --- a/tests/ui/rust-2024/unsafe-env-suggestion.stderr +++ b/tests/ui/rust-2024/unsafe-env-suggestion.stderr @@ -5,7 +5,7 @@ LL | env::set_var("FOO", "BAR"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2024! - = note: for more information, see + = note: for more information, see note: the lint level is defined here --> $DIR/unsafe-env-suggestion.rs:3:9 | @@ -24,7 +24,7 @@ LL | env::remove_var("FOO"); | ^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2024! - = note: for more information, see + = note: for more information, see help: you can wrap the call in an `unsafe` block if you can guarantee that the environment access only happens in single-threaded code | LL + // TODO: Audit that the environment access only happens in single-threaded code. diff --git a/tests/ui/rust-2024/unsafe-env.e2021.stderr b/tests/ui/rust-2024/unsafe-env.e2021.stderr index 4a441cf43ffa..a73db9fd60c7 100644 --- a/tests/ui/rust-2024/unsafe-env.e2021.stderr +++ b/tests/ui/rust-2024/unsafe-env.e2021.stderr @@ -4,7 +4,7 @@ error[E0133]: call to unsafe function `unsafe_fn` is unsafe and requires unsafe LL | unsafe_fn(); | ^^^^^^^^^^^ call to unsafe function | - = note: for more information, see + = note: for more information, see = note: consult the function's documentation for information on how to avoid undefined behavior note: an unsafe function restricts its caller, but its body is safe by default --> $DIR/unsafe-env.rs:8:1 diff --git a/tests/ui/rust-2024/unsafe-env.e2024.stderr b/tests/ui/rust-2024/unsafe-env.e2024.stderr index 0ee7e042946b..cb48ae231f27 100644 --- a/tests/ui/rust-2024/unsafe-env.e2024.stderr +++ b/tests/ui/rust-2024/unsafe-env.e2024.stderr @@ -4,7 +4,7 @@ error[E0133]: call to unsafe function `std::env::set_var` is unsafe and requires LL | env::set_var("FOO", "BAR"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function | - = note: for more information, see + = note: for more information, see = note: consult the function's documentation for information on how to avoid undefined behavior note: an unsafe function restricts its caller, but its body is safe by default --> $DIR/unsafe-env.rs:8:1 @@ -23,7 +23,7 @@ error[E0133]: call to unsafe function `std::env::remove_var` is unsafe and requi LL | env::remove_var("FOO"); | ^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function | - = note: for more information, see + = note: for more information, see = note: consult the function's documentation for information on how to avoid undefined behavior error[E0133]: call to unsafe function `unsafe_fn` is unsafe and requires unsafe block @@ -32,7 +32,7 @@ error[E0133]: call to unsafe function `unsafe_fn` is unsafe and requires unsafe LL | unsafe_fn(); | ^^^^^^^^^^^ call to unsafe function | - = note: for more information, see + = note: for more information, see = note: consult the function's documentation for information on how to avoid undefined behavior error[E0133]: call to unsafe function `set_var` is unsafe and requires unsafe block diff --git a/tests/ui/rust-2024/unsafe-extern-blocks/unsafe-extern-suggestion.stderr b/tests/ui/rust-2024/unsafe-extern-blocks/unsafe-extern-suggestion.stderr index ab12da0c416e..9a535fbbaf5e 100644 --- a/tests/ui/rust-2024/unsafe-extern-blocks/unsafe-extern-suggestion.stderr +++ b/tests/ui/rust-2024/unsafe-extern-blocks/unsafe-extern-suggestion.stderr @@ -14,7 +14,7 @@ LL | | } | |_^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2024! - = note: for more information, see + = note: for more information, see note: the lint level is defined here --> $DIR/unsafe-extern-suggestion.rs:3:9 | diff --git a/tests/ui/statics/issue-15261.stderr b/tests/ui/statics/issue-15261.stderr index d2dd762aa66e..60c5fb93dbaf 100644 --- a/tests/ui/statics/issue-15261.stderr +++ b/tests/ui/statics/issue-15261.stderr @@ -4,7 +4,7 @@ warning: creating a shared reference to mutable static LL | static n: &'static usize = unsafe { &n_mut }; | ^^^^^^ shared reference to mutable static | - = note: for more information, see + = note: for more information, see = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives = note: `#[warn(static_mut_refs)]` on by default help: use `&raw const` instead to create a raw pointer diff --git a/tests/ui/statics/static-mut-shared-parens.stderr b/tests/ui/statics/static-mut-shared-parens.stderr index 3825e8efc427..16daee091a80 100644 --- a/tests/ui/statics/static-mut-shared-parens.stderr +++ b/tests/ui/statics/static-mut-shared-parens.stderr @@ -4,7 +4,7 @@ warning: creating a shared reference to mutable static LL | let _ = unsafe { (&TEST) as *const usize }; | ^^^^^^^ shared reference to mutable static | - = note: for more information, see + = note: for more information, see = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives = note: `#[warn(static_mut_refs)]` on by default help: use `&raw const` instead to create a raw pointer @@ -18,7 +18,7 @@ warning: creating a mutable reference to mutable static LL | let _ = unsafe { (&mut TEST) as *const usize }; | ^^^^^^^^^^^ mutable reference to mutable static | - = note: for more information, see + = note: for more information, see = note: mutable references to mutable statics are dangerous; it's undefined behavior if any other pointer to the static is used or if any other reference is created for the static while the mutable reference lives help: use `&raw mut` instead to create a raw pointer | diff --git a/tests/ui/statics/static-mut-xc.stderr b/tests/ui/statics/static-mut-xc.stderr index 2d7a0553e925..2e5aa1b26453 100644 --- a/tests/ui/statics/static-mut-xc.stderr +++ b/tests/ui/statics/static-mut-xc.stderr @@ -4,7 +4,7 @@ warning: creating a shared reference to mutable static LL | assert_eq!(static_mut_xc::a, 3); | ^^^^^^^^^^^^^^^^ shared reference to mutable static | - = note: for more information, see + = note: for more information, see = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives = note: `#[warn(static_mut_refs)]` on by default @@ -14,7 +14,7 @@ warning: creating a shared reference to mutable static LL | assert_eq!(static_mut_xc::a, 4); | ^^^^^^^^^^^^^^^^ shared reference to mutable static | - = note: for more information, see + = note: for more information, see = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives warning: creating a shared reference to mutable static @@ -23,7 +23,7 @@ warning: creating a shared reference to mutable static LL | assert_eq!(static_mut_xc::a, 5); | ^^^^^^^^^^^^^^^^ shared reference to mutable static | - = note: for more information, see + = note: for more information, see = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives warning: creating a shared reference to mutable static @@ -32,7 +32,7 @@ warning: creating a shared reference to mutable static LL | assert_eq!(static_mut_xc::a, 15); | ^^^^^^^^^^^^^^^^ shared reference to mutable static | - = note: for more information, see + = note: for more information, see = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives warning: creating a shared reference to mutable static @@ -41,7 +41,7 @@ warning: creating a shared reference to mutable static LL | assert_eq!(static_mut_xc::a, -3); | ^^^^^^^^^^^^^^^^ shared reference to mutable static | - = note: for more information, see + = note: for more information, see = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives warning: creating a shared reference to mutable static @@ -50,7 +50,7 @@ warning: creating a shared reference to mutable static LL | static_bound(&static_mut_xc::a); | ^^^^^^^^^^^^^^^^^ shared reference to mutable static | - = note: for more information, see + = note: for more information, see = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives help: use `&raw const` instead to create a raw pointer | @@ -63,7 +63,7 @@ warning: creating a mutable reference to mutable static LL | static_bound_set(&mut static_mut_xc::a); | ^^^^^^^^^^^^^^^^^^^^^ mutable reference to mutable static | - = note: for more information, see + = note: for more information, see = note: mutable references to mutable statics are dangerous; it's undefined behavior if any other pointer to the static is used or if any other reference is created for the static while the mutable reference lives help: use `&raw mut` instead to create a raw pointer | diff --git a/tests/ui/statics/static-recursive.stderr b/tests/ui/statics/static-recursive.stderr index 252807e2e5de..0c3f961372b7 100644 --- a/tests/ui/statics/static-recursive.stderr +++ b/tests/ui/statics/static-recursive.stderr @@ -4,7 +4,7 @@ warning: creating a shared reference to mutable static LL | static mut S: *const u8 = unsafe { &S as *const *const u8 as *const u8 }; | ^^ shared reference to mutable static | - = note: for more information, see + = note: for more information, see = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives = note: `#[warn(static_mut_refs)]` on by default help: use `&raw const` instead to create a raw pointer @@ -18,7 +18,7 @@ warning: creating a shared reference to mutable static LL | assert_eq!(S, *(S as *const *const u8)); | ^ shared reference to mutable static | - = note: for more information, see + = note: for more information, see = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives warning: 2 warnings emitted diff --git a/tests/ui/suggestions/issue-116434-2015.stderr b/tests/ui/suggestions/issue-116434-2015.stderr index cad5812da663..e7173d91438a 100644 --- a/tests/ui/suggestions/issue-116434-2015.stderr +++ b/tests/ui/suggestions/issue-116434-2015.stderr @@ -5,7 +5,7 @@ LL | fn foo() -> Clone; | ^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see = note: `#[warn(bare_trait_objects)]` on by default help: if this is a dyn-compatible trait, use `dyn` | @@ -19,7 +19,7 @@ LL | fn foo() -> Clone; | ^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` help: if this is a dyn-compatible trait, use `dyn` | @@ -52,7 +52,7 @@ LL | fn handle() -> DbHandle; | ^^^^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see help: if this is a dyn-compatible trait, use `dyn` | LL | fn handle() -> dyn DbHandle; @@ -65,7 +65,7 @@ LL | fn handle() -> DbHandle; | ^^^^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` help: if this is a dyn-compatible trait, use `dyn` | diff --git a/tests/ui/suggestions/issue-61963.stderr b/tests/ui/suggestions/issue-61963.stderr index ef11efe5c74d..ffdeef12bb7f 100644 --- a/tests/ui/suggestions/issue-61963.stderr +++ b/tests/ui/suggestions/issue-61963.stderr @@ -5,7 +5,7 @@ LL | bar: Box, | ^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see note: the lint level is defined here --> $DIR/issue-61963.rs:4:9 | @@ -23,7 +23,7 @@ LL | pub struct Foo { | ^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see help: if this is a dyn-compatible trait, use `dyn` | LL | dyn pub struct Foo { diff --git a/tests/ui/suggestions/suggest-swapping-self-ty-and-trait.stderr b/tests/ui/suggestions/suggest-swapping-self-ty-and-trait.stderr index 929f893e34f5..d90dd201bcfb 100644 --- a/tests/ui/suggestions/suggest-swapping-self-ty-and-trait.stderr +++ b/tests/ui/suggestions/suggest-swapping-self-ty-and-trait.stderr @@ -68,7 +68,7 @@ LL | impl<'a, T> Struct for Trait<'a, T> {} | ^^^^^^^^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see = note: `#[warn(bare_trait_objects)]` on by default help: if this is a dyn-compatible trait, use `dyn` | @@ -82,7 +82,7 @@ LL | impl<'a, T> Enum for Trait<'a, T> {} | ^^^^^^^^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see help: if this is a dyn-compatible trait, use `dyn` | LL | impl<'a, T> Enum for dyn Trait<'a, T> {} @@ -95,7 +95,7 @@ LL | impl<'a, T> Union for Trait<'a, T> {} | ^^^^^^^^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see help: if this is a dyn-compatible trait, use `dyn` | LL | impl<'a, T> Union for dyn Trait<'a, T> {} diff --git a/tests/ui/traits/bound/not-on-bare-trait.stderr b/tests/ui/traits/bound/not-on-bare-trait.stderr index 9028e66fa020..69413ca96cda 100644 --- a/tests/ui/traits/bound/not-on-bare-trait.stderr +++ b/tests/ui/traits/bound/not-on-bare-trait.stderr @@ -5,7 +5,7 @@ LL | fn foo(_x: Foo + Send) { | ^^^^^^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see = note: `#[warn(bare_trait_objects)]` on by default help: if this is a dyn-compatible trait, use `dyn` | diff --git a/tests/ui/traits/missing-for-type-in-impl.e2015.stderr b/tests/ui/traits/missing-for-type-in-impl.e2015.stderr index c8a1329e3d0f..a0bfc524252f 100644 --- a/tests/ui/traits/missing-for-type-in-impl.e2015.stderr +++ b/tests/ui/traits/missing-for-type-in-impl.e2015.stderr @@ -5,7 +5,7 @@ LL | impl Foo { | ^^^^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see = note: `#[warn(bare_trait_objects)]` on by default help: if this is a dyn-compatible trait, use `dyn` | @@ -23,7 +23,7 @@ LL | impl Foo { | ^^^^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` help: if this is a dyn-compatible trait, use `dyn` | diff --git a/tests/ui/traits/unspecified-self-in-trait-ref.stderr b/tests/ui/traits/unspecified-self-in-trait-ref.stderr index 6f5ae786de6b..2e872453184f 100644 --- a/tests/ui/traits/unspecified-self-in-trait-ref.stderr +++ b/tests/ui/traits/unspecified-self-in-trait-ref.stderr @@ -5,7 +5,7 @@ LL | let a = Foo::lol(); | ^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see = note: `#[warn(bare_trait_objects)]` on by default help: if this is a dyn-compatible trait, use `dyn` | @@ -25,7 +25,7 @@ LL | let b = Foo::<_>::lol(); | ^^^^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see help: if this is a dyn-compatible trait, use `dyn` | LL | let b = >::lol(); @@ -44,7 +44,7 @@ LL | let c = Bar::lol(); | ^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see help: if this is a dyn-compatible trait, use `dyn` | LL | let c = ::lol(); @@ -63,7 +63,7 @@ LL | let d = Bar::::lol(); | ^^^^^^^^^^^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see help: if this is a dyn-compatible trait, use `dyn` | LL | let d = >::lol(); @@ -82,7 +82,7 @@ LL | let e = Bar::::lol(); | ^^^^^^^^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see help: if this is a dyn-compatible trait, use `dyn` | LL | let e = >::lol(); diff --git a/tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.stderr b/tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.stderr index a02c6041e45f..8a26b45117cd 100644 --- a/tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.stderr +++ b/tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.stderr @@ -4,7 +4,7 @@ warning[E0133]: call to unsafe function `unsf` is unsafe and requires unsafe blo LL | unsf(); | ^^^^^^ call to unsafe function | - = note: for more information, see + = note: for more information, see = note: consult the function's documentation for information on how to avoid undefined behavior note: an unsafe function restricts its caller, but its body is safe by default --> $DIR/edition-2024-unsafe_op_in_unsafe_fn.rs:8:1 diff --git a/tests/ui/unsafe/unsafe_op_in_unsafe_fn/edition_2024_default.stderr b/tests/ui/unsafe/unsafe_op_in_unsafe_fn/edition_2024_default.stderr index 2ad1de5102d9..458a2180a82b 100644 --- a/tests/ui/unsafe/unsafe_op_in_unsafe_fn/edition_2024_default.stderr +++ b/tests/ui/unsafe/unsafe_op_in_unsafe_fn/edition_2024_default.stderr @@ -4,7 +4,7 @@ warning[E0133]: call to unsafe function `unsf` is unsafe and requires unsafe blo LL | unsf(); | ^^^^^^ call to unsafe function | - = note: for more information, see + = note: for more information, see = note: consult the function's documentation for information on how to avoid undefined behavior note: an unsafe function restricts its caller, but its body is safe by default --> $DIR/edition_2024_default.rs:11:1 diff --git a/tests/ui/unsafe/unsafe_op_in_unsafe_fn/in_2024_compatibility.stderr b/tests/ui/unsafe/unsafe_op_in_unsafe_fn/in_2024_compatibility.stderr index 54447fbc5282..0c4070068d0b 100644 --- a/tests/ui/unsafe/unsafe_op_in_unsafe_fn/in_2024_compatibility.stderr +++ b/tests/ui/unsafe/unsafe_op_in_unsafe_fn/in_2024_compatibility.stderr @@ -4,7 +4,7 @@ error[E0133]: call to unsafe function `unsf` is unsafe and requires unsafe block LL | unsf(); | ^^^^^^ call to unsafe function | - = note: for more information, see + = note: for more information, see = note: consult the function's documentation for information on how to avoid undefined behavior note: an unsafe function restricts its caller, but its body is safe by default --> $DIR/in_2024_compatibility.rs:6:1 diff --git a/tests/ui/unsafe/unsafe_op_in_unsafe_fn/rfc-2585-unsafe_op_in_unsafe_fn.stderr b/tests/ui/unsafe/unsafe_op_in_unsafe_fn/rfc-2585-unsafe_op_in_unsafe_fn.stderr index 5465c225b7e9..3e43840cf6cb 100644 --- a/tests/ui/unsafe/unsafe_op_in_unsafe_fn/rfc-2585-unsafe_op_in_unsafe_fn.stderr +++ b/tests/ui/unsafe/unsafe_op_in_unsafe_fn/rfc-2585-unsafe_op_in_unsafe_fn.stderr @@ -4,7 +4,7 @@ error[E0133]: call to unsafe function `unsf` is unsafe and requires unsafe block LL | unsf(); | ^^^^^^ call to unsafe function | - = note: for more information, see + = note: for more information, see = note: consult the function's documentation for information on how to avoid undefined behavior note: an unsafe function restricts its caller, but its body is safe by default --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:8:1 @@ -23,7 +23,7 @@ error[E0133]: dereference of raw pointer is unsafe and requires unsafe block LL | *PTR; | ^^^^ dereference of raw pointer | - = note: for more information, see + = note: for more information, see = note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior error[E0133]: use of mutable static is unsafe and requires unsafe block @@ -32,7 +32,7 @@ error[E0133]: use of mutable static is unsafe and requires unsafe block LL | VOID = (); | ^^^^ use of mutable static | - = note: for more information, see + = note: for more information, see = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior error: unnecessary `unsafe` block @@ -53,7 +53,7 @@ error[E0133]: call to unsafe function `unsf` is unsafe and requires unsafe block LL | unsf(); | ^^^^^^ call to unsafe function | - = note: for more information, see + = note: for more information, see = note: consult the function's documentation for information on how to avoid undefined behavior note: an unsafe function restricts its caller, but its body is safe by default --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:23:1 @@ -73,7 +73,7 @@ error[E0133]: dereference of raw pointer is unsafe and requires unsafe block LL | *PTR; | ^^^^ dereference of raw pointer | - = note: for more information, see + = note: for more information, see = note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior error[E0133]: use of mutable static is unsafe and requires unsafe block @@ -82,7 +82,7 @@ error[E0133]: use of mutable static is unsafe and requires unsafe block LL | VOID = (); | ^^^^ use of mutable static | - = note: for more information, see + = note: for more information, see = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior error: unnecessary `unsafe` block diff --git a/tests/ui/unsafe/unsafe_op_in_unsafe_fn/wrapping-unsafe-block-sugg.stderr b/tests/ui/unsafe/unsafe_op_in_unsafe_fn/wrapping-unsafe-block-sugg.stderr index b48e607c53b6..f7dbf39e6f26 100644 --- a/tests/ui/unsafe/unsafe_op_in_unsafe_fn/wrapping-unsafe-block-sugg.stderr +++ b/tests/ui/unsafe/unsafe_op_in_unsafe_fn/wrapping-unsafe-block-sugg.stderr @@ -4,7 +4,7 @@ error[E0133]: call to unsafe function `unsf` is unsafe and requires unsafe block LL | unsf(); | ^^^^^^ call to unsafe function | - = note: for more information, see + = note: for more information, see = note: consult the function's documentation for information on how to avoid undefined behavior note: an unsafe function restricts its caller, but its body is safe by default --> $DIR/wrapping-unsafe-block-sugg.rs:11:1 @@ -23,7 +23,7 @@ error[E0133]: call to unsafe function `unsf` is unsafe and requires unsafe block LL | unsf(); | ^^^^^^ call to unsafe function | - = note: for more information, see + = note: for more information, see = note: consult the function's documentation for information on how to avoid undefined behavior error[E0133]: dereference of raw pointer is unsafe and requires unsafe block @@ -32,7 +32,7 @@ error[E0133]: dereference of raw pointer is unsafe and requires unsafe block LL | let y = *x; | ^^ dereference of raw pointer | - = note: for more information, see + = note: for more information, see = note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior note: an unsafe function restricts its caller, but its body is safe by default --> $DIR/wrapping-unsafe-block-sugg.rs:23:1 @@ -46,7 +46,7 @@ error[E0133]: dereference of raw pointer is unsafe and requires unsafe block LL | y + *x | ^^ dereference of raw pointer | - = note: for more information, see + = note: for more information, see = note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior error[E0133]: use of mutable static is unsafe and requires unsafe block @@ -55,7 +55,7 @@ error[E0133]: use of mutable static is unsafe and requires unsafe block LL | let y = BAZ; | ^^^ use of mutable static | - = note: for more information, see + = note: for more information, see = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior note: an unsafe function restricts its caller, but its body is safe by default --> $DIR/wrapping-unsafe-block-sugg.rs:36:1 @@ -69,7 +69,7 @@ error[E0133]: use of mutable static is unsafe and requires unsafe block LL | y + BAZ | ^^^ use of mutable static | - = note: for more information, see + = note: for more information, see = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior error[E0133]: call to unsafe function `unsf` is unsafe and requires unsafe block @@ -81,7 +81,7 @@ LL | macro_rules! unsafe_macro { () => (unsf()) } LL | unsafe_macro!(); | --------------- in this macro invocation | - = note: for more information, see + = note: for more information, see = note: consult the function's documentation for information on how to avoid undefined behavior note: an unsafe function restricts its caller, but its body is safe by default --> $DIR/wrapping-unsafe-block-sugg.rs:58:1 @@ -99,7 +99,7 @@ LL | macro_rules! unsafe_macro { () => (unsf()) } LL | unsafe_macro!(); | --------------- in this macro invocation | - = note: for more information, see + = note: for more information, see = note: consult the function's documentation for information on how to avoid undefined behavior = note: this error originates in the macro `unsafe_macro` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122989.stderr b/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122989.stderr index a99728f4b669..26872f60fd35 100644 --- a/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122989.stderr +++ b/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122989.stderr @@ -5,7 +5,7 @@ LL | trait Foo> { | ^^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see = note: `#[warn(bare_trait_objects)]` on by default help: if this is a dyn-compatible trait, use `dyn` | @@ -19,7 +19,7 @@ LL | trait Bar> {} | ^^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see + = note: for more information, see help: if this is a dyn-compatible trait, use `dyn` | LL | trait Bar> {} From 959d191a25165ab64baeb4de46b2561d11d4a18e Mon Sep 17 00:00:00 2001 From: Madhav Madhusoodanan Date: Wed, 16 Jul 2025 17:12:12 +0530 Subject: [PATCH 038/139] Modified Typekind to group the Signed and Unsigned version of types. --- .../intrinsic-test/src/arm/intrinsic.rs | 7 +- .../crates/intrinsic-test/src/arm/types.rs | 12 +-- .../src/common/intrinsic_helpers.rs | 84 ++++++++++++++----- 3 files changed, 72 insertions(+), 31 deletions(-) diff --git a/library/stdarch/crates/intrinsic-test/src/arm/intrinsic.rs b/library/stdarch/crates/intrinsic-test/src/arm/intrinsic.rs index 773dabf4d75b..8c17856b829e 100644 --- a/library/stdarch/crates/intrinsic-test/src/arm/intrinsic.rs +++ b/library/stdarch/crates/intrinsic-test/src/arm/intrinsic.rs @@ -1,7 +1,7 @@ use crate::common::argument::ArgumentList; use crate::common::indentation::Indentation; use crate::common::intrinsic::{Intrinsic, IntrinsicDefinition}; -use crate::common::intrinsic_helpers::{IntrinsicType, IntrinsicTypeDefinition, TypeKind}; +use crate::common::intrinsic_helpers::{IntrinsicType, IntrinsicTypeDefinition, Sign, TypeKind}; use std::ops::Deref; #[derive(Debug, Clone, PartialEq)] @@ -73,8 +73,9 @@ impl IntrinsicDefinition for Intrinsic { TypeKind::Float if self.results().inner_size() == 16 => "float16_t".to_string(), TypeKind::Float if self.results().inner_size() == 32 => "float".to_string(), TypeKind::Float if self.results().inner_size() == 64 => "double".to_string(), - TypeKind::Int => format!("int{}_t", self.results().inner_size()), - TypeKind::UInt => format!("uint{}_t", self.results().inner_size()), + TypeKind::Int(Sign::Signed) => format!("int{}_t", self.results().inner_size()), + TypeKind::Int(Sign::Unsigned) => + format!("uint{}_t", self.results().inner_size()), TypeKind::Poly => format!("poly{}_t", self.results().inner_size()), ty => todo!("print_result_c - Unknown type: {:#?}", ty), }, diff --git a/library/stdarch/crates/intrinsic-test/src/arm/types.rs b/library/stdarch/crates/intrinsic-test/src/arm/types.rs index 9f3d6302f460..05db8b738eda 100644 --- a/library/stdarch/crates/intrinsic-test/src/arm/types.rs +++ b/library/stdarch/crates/intrinsic-test/src/arm/types.rs @@ -1,6 +1,6 @@ use super::intrinsic::ArmIntrinsicType; use crate::common::cli::Language; -use crate::common::intrinsic_helpers::{IntrinsicType, IntrinsicTypeDefinition, TypeKind}; +use crate::common::intrinsic_helpers::{IntrinsicType, IntrinsicTypeDefinition, Sign, TypeKind}; impl IntrinsicTypeDefinition for ArmIntrinsicType { /// Gets a string containing the typename for this type in C format. @@ -73,8 +73,8 @@ impl IntrinsicTypeDefinition for ArmIntrinsicType { format!( "vld{len}{quad}_{type}{size}", type = match k { - TypeKind::UInt => "u", - TypeKind::Int => "s", + TypeKind::Int(Sign::Unsigned) => "u", + TypeKind::Int(Sign::Signed) => "s", TypeKind::Float => "f", // The ACLE doesn't support 64-bit polynomial loads on Armv7 // if armv7 and bl == 64, use "s", else "p" @@ -107,8 +107,8 @@ impl IntrinsicTypeDefinition for ArmIntrinsicType { format!( "vget{quad}_lane_{type}{size}", type = match k { - TypeKind::UInt => "u", - TypeKind::Int => "s", + TypeKind::Int(Sign::Unsigned) => "u", + TypeKind::Int(Sign::Signed) => "s", TypeKind::Float => "f", TypeKind::Poly => "p", x => todo!("get_load_function TypeKind: {:#?}", x), @@ -176,7 +176,7 @@ impl IntrinsicTypeDefinition for ArmIntrinsicType { } else { let kind = start.parse::()?; let bit_len = match kind { - TypeKind::Int => Some(32), + TypeKind::Int(_) => Some(32), _ => None, }; Ok(Box::new(ArmIntrinsicType(IntrinsicType { diff --git a/library/stdarch/crates/intrinsic-test/src/common/intrinsic_helpers.rs b/library/stdarch/crates/intrinsic-test/src/common/intrinsic_helpers.rs index 3d200b19461e..ea210c78bda7 100644 --- a/library/stdarch/crates/intrinsic-test/src/common/intrinsic_helpers.rs +++ b/library/stdarch/crates/intrinsic-test/src/common/intrinsic_helpers.rs @@ -8,14 +8,22 @@ use super::cli::Language; use super::indentation::Indentation; use super::values::value_for_array; +#[derive(Debug, PartialEq, Copy, Clone)] +pub enum Sign { + Signed, + Unsigned, +} + #[derive(Debug, PartialEq, Copy, Clone)] pub enum TypeKind { BFloat, Float, - Int, - UInt, + Int(Sign), + Char(Sign), Poly, Void, + Mask, + Vector, } impl FromStr for TypeKind { @@ -23,12 +31,17 @@ impl FromStr for TypeKind { fn from_str(s: &str) -> Result { match s { - "bfloat" => Ok(Self::BFloat), - "float" => Ok(Self::Float), - "int" => Ok(Self::Int), + "bfloat" | "BF16" => Ok(Self::BFloat), + "float" | "double" | "FP16" | "FP32" | "FP64" => Ok(Self::Float), + "int" | "long" | "short" | "SI8" | "SI16" | "SI32" | "SI64" => { + Ok(Self::Int(Sign::Signed)) + } "poly" => Ok(Self::Poly), - "uint" | "unsigned" => Ok(Self::UInt), + "char" => Ok(Self::Char(Sign::Signed)), + "uint" | "unsigned" | "UI8" | "UI16" | "UI32" | "UI64" => Ok(Self::Int(Sign::Unsigned)), "void" => Ok(Self::Void), + "MASK" => Ok(Self::Mask), + "M64" | "M128" | "M256" | "M512" => Ok(Self::Vector), _ => Err(format!("Impossible to parse argument kind {s}")), } } @@ -42,10 +55,14 @@ impl fmt::Display for TypeKind { match self { Self::BFloat => "bfloat", Self::Float => "float", - Self::Int => "int", - Self::UInt => "uint", + Self::Int(Sign::Signed) => "int", + Self::Int(Sign::Unsigned) => "uint", Self::Poly => "poly", Self::Void => "void", + Self::Char(Sign::Signed) => "char", + Self::Char(Sign::Unsigned) => "unsigned char", + Self::Mask => "mask", + Self::Vector => "vector", } ) } @@ -56,9 +73,10 @@ impl TypeKind { pub fn c_prefix(&self) -> &str { match self { Self::Float => "float", - Self::Int => "int", - Self::UInt => "uint", + Self::Int(Sign::Signed) => "int", + Self::Int(Sign::Unsigned) => "uint", Self::Poly => "poly", + Self::Char(Sign::Signed) => "char", _ => unreachable!("Not used: {:#?}", self), } } @@ -66,10 +84,13 @@ impl TypeKind { /// Gets the rust prefix for the type kind i.e. i, u, f. pub fn rust_prefix(&self) -> &str { match self { + Self::BFloat => "bf", Self::Float => "f", - Self::Int => "i", - Self::UInt => "u", + Self::Int(Sign::Signed) => "i", + Self::Int(Sign::Unsigned) => "u", Self::Poly => "u", + Self::Char(Sign::Unsigned) => "u", + Self::Char(Sign::Signed) => "i", _ => unreachable!("Unused type kind: {:#?}", self), } } @@ -133,11 +154,14 @@ impl IntrinsicType { } pub fn c_scalar_type(&self) -> String { - format!( - "{prefix}{bits}_t", - prefix = self.kind().c_prefix(), - bits = self.inner_size() - ) + match self.kind() { + TypeKind::Char(_) => String::from("char"), + _ => format!( + "{prefix}{bits}_t", + prefix = self.kind().c_prefix(), + bits = self.inner_size() + ), + } } pub fn rust_scalar_type(&self) -> String { @@ -155,8 +179,8 @@ impl IntrinsicType { bit_len: Some(8), .. } => match kind { - TypeKind::Int => "(int)", - TypeKind::UInt => "(unsigned int)", + TypeKind::Int(Sign::Signed) => "(int)", + TypeKind::Int(Sign::Unsigned) => "(unsigned int)", TypeKind::Poly => "(unsigned int)(uint8_t)", _ => "", }, @@ -172,6 +196,21 @@ impl IntrinsicType { 128 => "", _ => panic!("invalid bit_len"), }, + IntrinsicType { + kind: TypeKind::Float, + bit_len: Some(bit_len), + .. + } => match bit_len { + 16 => "(float16_t)", + 32 => "(float)", + 64 => "(double)", + 128 => "", + _ => panic!("invalid bit_len"), + }, + IntrinsicType { + kind: TypeKind::Char(_), + .. + } => "(char)", _ => "", } } @@ -185,7 +224,7 @@ impl IntrinsicType { match self { IntrinsicType { bit_len: Some(bit_len @ (8 | 16 | 32 | 64)), - kind: kind @ (TypeKind::Int | TypeKind::UInt | TypeKind::Poly), + kind: kind @ (TypeKind::Int(_) | TypeKind::Poly | TypeKind::Char(_)), simd_len, vec_len, .. @@ -201,7 +240,8 @@ impl IntrinsicType { .format_with(",\n", |i, fmt| { let src = value_for_array(*bit_len, i); assert!(src == 0 || src.ilog2() < *bit_len); - if *kind == TypeKind::Int && (src >> (*bit_len - 1)) != 0 { + if *kind == TypeKind::Int(Sign::Signed) && (src >> (*bit_len - 1)) != 0 + { // `src` is a two's complement representation of a negative value. let mask = !0u64 >> (64 - *bit_len); let ones_compl = src ^ mask; @@ -257,7 +297,7 @@ impl IntrinsicType { .. } => false, IntrinsicType { - kind: TypeKind::Int | TypeKind::UInt | TypeKind::Poly, + kind: TypeKind::Int(_) | TypeKind::Poly, .. } => true, _ => unimplemented!(), From d8a783dab57b9d427cc4147e746a35576d7256c0 Mon Sep 17 00:00:00 2001 From: sayantn Date: Tue, 15 Jul 2025 16:46:37 +0530 Subject: [PATCH 039/139] Update SDE to v9.58.0 --- .../x86_64-unknown-linux-gnu/Dockerfile | 2 +- .../docker/x86_64-unknown-linux-gnu/cpuid.def | 36 ++++++++----------- 2 files changed, 15 insertions(+), 23 deletions(-) diff --git a/library/stdarch/ci/docker/x86_64-unknown-linux-gnu/Dockerfile b/library/stdarch/ci/docker/x86_64-unknown-linux-gnu/Dockerfile index acde432794e5..b13050cdc66e 100644 --- a/library/stdarch/ci/docker/x86_64-unknown-linux-gnu/Dockerfile +++ b/library/stdarch/ci/docker/x86_64-unknown-linux-gnu/Dockerfile @@ -8,7 +8,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ wget \ xz-utils -RUN wget http://ci-mirrors.rust-lang.org/stdarch/sde-external-9.53.0-2025-03-16-lin.tar.xz -O sde.tar.xz +RUN wget http://ci-mirrors.rust-lang.org/stdarch/sde-external-9.58.0-2025-06-16-lin.tar.xz -O sde.tar.xz RUN mkdir intel-sde RUN tar -xJf sde.tar.xz --strip-components=1 -C intel-sde ENV CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER="/intel-sde/sde64 \ diff --git a/library/stdarch/ci/docker/x86_64-unknown-linux-gnu/cpuid.def b/library/stdarch/ci/docker/x86_64-unknown-linux-gnu/cpuid.def index 4cce9d7a3c00..95cef6199311 100644 --- a/library/stdarch/ci/docker/x86_64-unknown-linux-gnu/cpuid.def +++ b/library/stdarch/ci/docker/x86_64-unknown-linux-gnu/cpuid.def @@ -1,41 +1,35 @@ -# Copyright (C) 2024-2024 Intel Corporation. -# +# Copyright (C) 2017-2025 Intel Corporation. +# # This software and the related documents are Intel copyrighted materials, and your # use of them is governed by the express license under which they were provided to # you ("License"). Unless the License provides otherwise, you may not use, modify, # copy, publish, distribute, disclose or transmit this software or the related # documents without Intel's prior written permission. -# +# # This software and the related documents are provided as is, with no express or # implied warranties, other than those that are expressly stated in the License. # -# The CPUID information in this file is for software enabling purposes only and -# it is not a full and accurate representation of the CPU under development which -# it represents. -# The CPUID information in this file is not a guarantee of the availability of -# features or characteristics in the final released CPU. -# # CPUID_VERSION = 1.0 # Input => Output # EAX ECX => EAX EBX ECX EDX 00000000 ******** => 00000024 68747541 444d4163 69746e65 -00000001 ******** => 000d06f0 00100800 7ffaf3ff bfebfbff +00000001 ******** => 00400f10 00100800 7ffaf3ff bfebfbff 00000002 ******** => 76035a01 00f0b6ff 00000000 00c10000 00000003 ******** => 00000000 00000000 00000000 00000000 -00000004 00000000 => 7c004121 02c0003f 0000003f 00000000 #Deterministic Cache +00000004 00000000 => 7c004121 01c0003f 0000003f 00000000 #Deterministic Cache 00000004 00000001 => 7c004122 01c0003f 0000003f 00000000 -00000004 00000002 => 7c004143 03c0003f 000007ff 00000000 -00000004 00000003 => 7c0fc163 04c0003f 0005ffff 00000004 +00000004 00000002 => 7c004143 03c0003f 000003ff 00000000 +00000004 00000003 => 7c0fc163 0280003f 0000dfff 00000004 00000004 00000004 => 00000000 00000000 00000000 00000000 00000005 ******** => 00000040 00000040 00000003 00042120 #MONITOR/MWAIT 00000006 ******** => 00000077 00000002 00000001 00000000 #Thermal and Power -00000007 00000000 => 00000001 f3bfbfbf bbc05ffe 03d55130 #Extended Features -00000007 00000001 => 88ee00bf 00000002 00000000 1d29cd3e +00000007 00000000 => 00000001 f3bfbfbf bac05ffe 03d54130 #Extended Features +00000007 00000001 => 98ee00bf 00000002 00000020 1d29cd3e 00000008 ******** => 00000000 00000000 00000000 00000000 00000009 ******** => 00000000 00000000 00000000 00000000 #Direct Cache 0000000a ******** => 07300403 00000000 00000000 00000603 -0000000b 00000000 => 00000001 00000002 00000100 0000001e #Extended Topology -0000000b 00000001 => 00000004 00000002 00000201 0000001e +0000000b 00000000 => 00000001 00000002 00000100 00000000 #Extended Topology +0000000b 00000001 => 00000004 00000002 00000201 00000000 0000000c ******** => 00000000 00000000 00000000 00000000 0000000d 00000000 => 000e02e7 00002b00 00002b00 00000000 #xcr0 0000000d 00000001 => 0000001f 00000240 00000100 00000000 @@ -52,10 +46,8 @@ 0000001d 00000001 => 04002000 00080040 00000010 00000000 #AMX Palette1 0000001e 00000000 => 00000001 00004010 00000000 00000000 #AMX Tmul 0000001e 00000001 => 000001ff 00000000 00000000 00000000 -0000001f 00000000 => 00000001 00000002 00000100 0000001e -0000001f 00000001 => 00000007 00000070 00000201 0000001e -0000001f 00000002 => 00000000 00000000 00000002 0000001e -00000024 00000000 => 00000000 00070002 00000000 00000000 #AVX10 +00000024 00000000 => 00000001 00070002 00000000 00000000 #AVX10 +00000024 00000001 => 00000000 00000000 00000004 00000000 80000000 ******** => 80000008 00000000 00000000 00000000 80000001 ******** => 00000000 00000000 00200961 2c100000 80000002 ******** => 00000000 00000000 00000000 00000000 @@ -66,6 +58,6 @@ 80000007 ******** => 00000000 00000000 00000000 00000100 80000008 ******** => 00003028 00000200 00000200 00000000 -# This file was copied from intel-sde/misc/cpuid/dmr/cpuid.def, and modified to +# This file was copied from intel-sde/misc/cpuid/future/cpuid.def, and modified to # use "AuthenticAMD" as the vendor and the support for `XOP`, `SSE4a`, `TBM`, # `AVX512_VP2INTERSECT` and the VEX variants of AVX512 was added in the CPUID. From a2486a5138477739a6101aae9403c92c1df5c3d0 Mon Sep 17 00:00:00 2001 From: sayantn Date: Tue, 15 Jul 2025 16:55:32 +0530 Subject: [PATCH 040/139] Update Docker OS to Ubuntu-25.10 --- library/stdarch/ci/docker/aarch64-unknown-linux-gnu/Dockerfile | 2 +- .../stdarch/ci/docker/aarch64_be-unknown-linux-gnu/Dockerfile | 2 +- .../stdarch/ci/docker/arm-unknown-linux-gnueabihf/Dockerfile | 2 +- library/stdarch/ci/docker/i586-unknown-linux-gnu/Dockerfile | 2 +- library/stdarch/ci/docker/i686-unknown-linux-gnu/Dockerfile | 2 +- .../stdarch/ci/docker/loongarch64-unknown-linux-gnu/Dockerfile | 2 +- library/stdarch/ci/docker/mips-unknown-linux-gnu/Dockerfile | 2 +- .../stdarch/ci/docker/mips64-unknown-linux-gnuabi64/Dockerfile | 2 +- .../ci/docker/mips64el-unknown-linux-gnuabi64/Dockerfile | 2 +- library/stdarch/ci/docker/mipsel-unknown-linux-musl/Dockerfile | 2 +- library/stdarch/ci/docker/nvptx64-nvidia-cuda/Dockerfile | 2 +- library/stdarch/ci/docker/powerpc-unknown-linux-gnu/Dockerfile | 2 +- .../stdarch/ci/docker/powerpc64-unknown-linux-gnu/Dockerfile | 2 +- .../stdarch/ci/docker/powerpc64le-unknown-linux-gnu/Dockerfile | 2 +- .../stdarch/ci/docker/riscv32gc-unknown-linux-gnu/Dockerfile | 2 +- .../stdarch/ci/docker/riscv64gc-unknown-linux-gnu/Dockerfile | 2 +- library/stdarch/ci/docker/s390x-unknown-linux-gnu/Dockerfile | 2 +- library/stdarch/ci/docker/wasm32-wasip1/Dockerfile | 2 +- library/stdarch/ci/docker/x86_64-unknown-linux-gnu/Dockerfile | 2 +- 19 files changed, 19 insertions(+), 19 deletions(-) diff --git a/library/stdarch/ci/docker/aarch64-unknown-linux-gnu/Dockerfile b/library/stdarch/ci/docker/aarch64-unknown-linux-gnu/Dockerfile index 17025efffea6..e09f77d73959 100644 --- a/library/stdarch/ci/docker/aarch64-unknown-linux-gnu/Dockerfile +++ b/library/stdarch/ci/docker/aarch64-unknown-linux-gnu/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:25.04 +FROM ubuntu:25.10 RUN apt-get update && apt-get install -y --no-install-recommends \ gcc \ g++ \ diff --git a/library/stdarch/ci/docker/aarch64_be-unknown-linux-gnu/Dockerfile b/library/stdarch/ci/docker/aarch64_be-unknown-linux-gnu/Dockerfile index 74f770556dbe..e424e92656e9 100644 --- a/library/stdarch/ci/docker/aarch64_be-unknown-linux-gnu/Dockerfile +++ b/library/stdarch/ci/docker/aarch64_be-unknown-linux-gnu/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:25.04 +FROM ubuntu:25.10 RUN apt-get update && apt-get install -y --no-install-recommends \ gcc \ diff --git a/library/stdarch/ci/docker/arm-unknown-linux-gnueabihf/Dockerfile b/library/stdarch/ci/docker/arm-unknown-linux-gnueabihf/Dockerfile index 14eaf9f9eef0..6d4ff2482867 100644 --- a/library/stdarch/ci/docker/arm-unknown-linux-gnueabihf/Dockerfile +++ b/library/stdarch/ci/docker/arm-unknown-linux-gnueabihf/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:25.04 +FROM ubuntu:25.10 RUN apt-get update && apt-get install -y --no-install-recommends \ gcc \ ca-certificates \ diff --git a/library/stdarch/ci/docker/i586-unknown-linux-gnu/Dockerfile b/library/stdarch/ci/docker/i586-unknown-linux-gnu/Dockerfile index 5a4a22369a80..49d5cecc71ea 100644 --- a/library/stdarch/ci/docker/i586-unknown-linux-gnu/Dockerfile +++ b/library/stdarch/ci/docker/i586-unknown-linux-gnu/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:25.04 +FROM ubuntu:25.10 RUN apt-get update && apt-get install -y --no-install-recommends \ gcc-multilib \ libc6-dev \ diff --git a/library/stdarch/ci/docker/i686-unknown-linux-gnu/Dockerfile b/library/stdarch/ci/docker/i686-unknown-linux-gnu/Dockerfile index 5a4a22369a80..49d5cecc71ea 100644 --- a/library/stdarch/ci/docker/i686-unknown-linux-gnu/Dockerfile +++ b/library/stdarch/ci/docker/i686-unknown-linux-gnu/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:25.04 +FROM ubuntu:25.10 RUN apt-get update && apt-get install -y --no-install-recommends \ gcc-multilib \ libc6-dev \ diff --git a/library/stdarch/ci/docker/loongarch64-unknown-linux-gnu/Dockerfile b/library/stdarch/ci/docker/loongarch64-unknown-linux-gnu/Dockerfile index 99ccf286f36d..ec7ed5846d9d 100644 --- a/library/stdarch/ci/docker/loongarch64-unknown-linux-gnu/Dockerfile +++ b/library/stdarch/ci/docker/loongarch64-unknown-linux-gnu/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:25.04 +FROM ubuntu:25.10 RUN apt-get update && \ apt-get install -y --no-install-recommends \ diff --git a/library/stdarch/ci/docker/mips-unknown-linux-gnu/Dockerfile b/library/stdarch/ci/docker/mips-unknown-linux-gnu/Dockerfile index f43a3c966331..f521ba317937 100644 --- a/library/stdarch/ci/docker/mips-unknown-linux-gnu/Dockerfile +++ b/library/stdarch/ci/docker/mips-unknown-linux-gnu/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:25.04 +FROM ubuntu:25.10 RUN apt-get update && apt-get install -y --no-install-recommends \ gcc libc6-dev qemu-user ca-certificates \ diff --git a/library/stdarch/ci/docker/mips64-unknown-linux-gnuabi64/Dockerfile b/library/stdarch/ci/docker/mips64-unknown-linux-gnuabi64/Dockerfile index 235ac0997b1e..a8b352881e81 100644 --- a/library/stdarch/ci/docker/mips64-unknown-linux-gnuabi64/Dockerfile +++ b/library/stdarch/ci/docker/mips64-unknown-linux-gnuabi64/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:25.04 +FROM ubuntu:25.10 RUN apt-get update && apt-get install -y --no-install-recommends \ gcc libc6-dev qemu-user ca-certificates \ diff --git a/library/stdarch/ci/docker/mips64el-unknown-linux-gnuabi64/Dockerfile b/library/stdarch/ci/docker/mips64el-unknown-linux-gnuabi64/Dockerfile index 6041d8911749..147a3df61455 100644 --- a/library/stdarch/ci/docker/mips64el-unknown-linux-gnuabi64/Dockerfile +++ b/library/stdarch/ci/docker/mips64el-unknown-linux-gnuabi64/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:25.04 +FROM ubuntu:25.10 RUN apt-get update && apt-get install -y --no-install-recommends \ gcc libc6-dev qemu-user ca-certificates \ diff --git a/library/stdarch/ci/docker/mipsel-unknown-linux-musl/Dockerfile b/library/stdarch/ci/docker/mipsel-unknown-linux-musl/Dockerfile index cd38348eeb5c..ed57511de7b9 100644 --- a/library/stdarch/ci/docker/mipsel-unknown-linux-musl/Dockerfile +++ b/library/stdarch/ci/docker/mipsel-unknown-linux-musl/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:25.04 +FROM ubuntu:25.10 RUN apt-get update && \ apt-get install -y --no-install-recommends \ diff --git a/library/stdarch/ci/docker/nvptx64-nvidia-cuda/Dockerfile b/library/stdarch/ci/docker/nvptx64-nvidia-cuda/Dockerfile index 5b4869863c70..65cf281b1477 100644 --- a/library/stdarch/ci/docker/nvptx64-nvidia-cuda/Dockerfile +++ b/library/stdarch/ci/docker/nvptx64-nvidia-cuda/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:25.04 +FROM ubuntu:25.10 RUN apt-get update && apt-get install -y --no-install-recommends \ gcc \ libc6-dev \ diff --git a/library/stdarch/ci/docker/powerpc-unknown-linux-gnu/Dockerfile b/library/stdarch/ci/docker/powerpc-unknown-linux-gnu/Dockerfile index baad95d57843..82d05f0b25d1 100644 --- a/library/stdarch/ci/docker/powerpc-unknown-linux-gnu/Dockerfile +++ b/library/stdarch/ci/docker/powerpc-unknown-linux-gnu/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:25.04 +FROM ubuntu:25.10 RUN apt-get update && apt-get install -y --no-install-recommends \ gcc libc6-dev qemu-user ca-certificates \ diff --git a/library/stdarch/ci/docker/powerpc64-unknown-linux-gnu/Dockerfile b/library/stdarch/ci/docker/powerpc64-unknown-linux-gnu/Dockerfile index dcbcb43513ee..c5460e1544fa 100644 --- a/library/stdarch/ci/docker/powerpc64-unknown-linux-gnu/Dockerfile +++ b/library/stdarch/ci/docker/powerpc64-unknown-linux-gnu/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:25.04 +FROM ubuntu:25.10 RUN apt-get update && apt-get install -y --no-install-recommends \ gcc libc6-dev qemu-user ca-certificates \ diff --git a/library/stdarch/ci/docker/powerpc64le-unknown-linux-gnu/Dockerfile b/library/stdarch/ci/docker/powerpc64le-unknown-linux-gnu/Dockerfile index 8dfac0ec1e41..3d3eb8c6f34e 100644 --- a/library/stdarch/ci/docker/powerpc64le-unknown-linux-gnu/Dockerfile +++ b/library/stdarch/ci/docker/powerpc64le-unknown-linux-gnu/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:25.04 +FROM ubuntu:25.10 RUN apt-get update && apt-get install -y --no-install-recommends \ gcc libc6-dev qemu-user ca-certificates \ diff --git a/library/stdarch/ci/docker/riscv32gc-unknown-linux-gnu/Dockerfile b/library/stdarch/ci/docker/riscv32gc-unknown-linux-gnu/Dockerfile index 81f7b6239af5..dbe74914f2c2 100644 --- a/library/stdarch/ci/docker/riscv32gc-unknown-linux-gnu/Dockerfile +++ b/library/stdarch/ci/docker/riscv32gc-unknown-linux-gnu/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:25.04 +FROM ubuntu:25.10 RUN apt-get update && apt-get install -y --no-install-recommends \ gcc libc6-dev qemu-user ca-certificates \ diff --git a/library/stdarch/ci/docker/riscv64gc-unknown-linux-gnu/Dockerfile b/library/stdarch/ci/docker/riscv64gc-unknown-linux-gnu/Dockerfile index 7ee69e46e2e5..10316cae6c29 100644 --- a/library/stdarch/ci/docker/riscv64gc-unknown-linux-gnu/Dockerfile +++ b/library/stdarch/ci/docker/riscv64gc-unknown-linux-gnu/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:25.04 +FROM ubuntu:25.10 RUN apt-get update && apt-get install -y --no-install-recommends \ gcc libc6-dev qemu-user ca-certificates \ diff --git a/library/stdarch/ci/docker/s390x-unknown-linux-gnu/Dockerfile b/library/stdarch/ci/docker/s390x-unknown-linux-gnu/Dockerfile index af02ebcbd169..04e5464b9c92 100644 --- a/library/stdarch/ci/docker/s390x-unknown-linux-gnu/Dockerfile +++ b/library/stdarch/ci/docker/s390x-unknown-linux-gnu/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:25.04 +FROM ubuntu:25.10 RUN apt-get update && apt-get install -y --no-install-recommends \ curl ca-certificates \ diff --git a/library/stdarch/ci/docker/wasm32-wasip1/Dockerfile b/library/stdarch/ci/docker/wasm32-wasip1/Dockerfile index eeafde79733e..76b69592bcfe 100644 --- a/library/stdarch/ci/docker/wasm32-wasip1/Dockerfile +++ b/library/stdarch/ci/docker/wasm32-wasip1/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:25.04 +FROM ubuntu:25.10 ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update -y && apt-get install -y --no-install-recommends \ diff --git a/library/stdarch/ci/docker/x86_64-unknown-linux-gnu/Dockerfile b/library/stdarch/ci/docker/x86_64-unknown-linux-gnu/Dockerfile index b13050cdc66e..99bfd056fb44 100644 --- a/library/stdarch/ci/docker/x86_64-unknown-linux-gnu/Dockerfile +++ b/library/stdarch/ci/docker/x86_64-unknown-linux-gnu/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:25.04 +FROM ubuntu:25.10 RUN apt-get update && apt-get install -y --no-install-recommends \ gcc \ libc6-dev \ From ed2918988b6ac1fb76de343fa05ed737554b17de Mon Sep 17 00:00:00 2001 From: sayantn Date: Tue, 15 Jul 2025 17:21:17 +0530 Subject: [PATCH 041/139] Bump versions in CI - `clang-19` -> `clang-20` in ARM - `gcc-14.2` -> `gcc-14.3` in AArch64-BE - `gcc-14` ->`gcc-15` in LA64 - `riscv-gnu-v2025.01.20` -> `riscv-gnu-v2025.07.03` in Risc-V 32 - `wasmtime-v18.0.2` -> `wasmtime-v34.0.1` --- .../stdarch/ci/docker/aarch64-unknown-linux-gnu/Dockerfile | 2 +- .../ci/docker/aarch64_be-unknown-linux-gnu/Dockerfile | 6 +++--- .../ci/docker/armv7-unknown-linux-gnueabihf/Dockerfile | 2 +- .../ci/docker/loongarch64-unknown-linux-gnu/Dockerfile | 2 +- .../ci/docker/riscv32gc-unknown-linux-gnu/Dockerfile | 2 +- library/stdarch/ci/docker/wasm32-wasip1/Dockerfile | 6 ++++-- library/stdarch/ci/run.sh | 6 +++--- library/stdarch/crates/intrinsic-test/src/arm/compile.rs | 6 +++--- 8 files changed, 17 insertions(+), 15 deletions(-) diff --git a/library/stdarch/ci/docker/aarch64-unknown-linux-gnu/Dockerfile b/library/stdarch/ci/docker/aarch64-unknown-linux-gnu/Dockerfile index e09f77d73959..70c06509755c 100644 --- a/library/stdarch/ci/docker/aarch64-unknown-linux-gnu/Dockerfile +++ b/library/stdarch/ci/docker/aarch64-unknown-linux-gnu/Dockerfile @@ -10,7 +10,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ qemu-user \ make \ file \ - clang-19 \ + clang \ lld ENV CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc \ diff --git a/library/stdarch/ci/docker/aarch64_be-unknown-linux-gnu/Dockerfile b/library/stdarch/ci/docker/aarch64_be-unknown-linux-gnu/Dockerfile index e424e92656e9..56ddbd990b18 100644 --- a/library/stdarch/ci/docker/aarch64_be-unknown-linux-gnu/Dockerfile +++ b/library/stdarch/ci/docker/aarch64_be-unknown-linux-gnu/Dockerfile @@ -9,15 +9,15 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ qemu-user \ make \ file \ - clang-19 \ + clang \ curl \ xz-utils \ lld -ENV TOOLCHAIN="arm-gnu-toolchain-14.2.rel1-x86_64-aarch64_be-none-linux-gnu" +ENV TOOLCHAIN="arm-gnu-toolchain-14.3.rel1-x86_64-aarch64_be-none-linux-gnu" # Download the aarch64_be gcc toolchain -RUN curl -L "https://developer.arm.com/-/media/Files/downloads/gnu/14.2.rel1/binrel/${TOOLCHAIN}.tar.xz" -o "${TOOLCHAIN}.tar.xz" +RUN curl -L "https://developer.arm.com/-/media/Files/downloads/gnu/14.3.rel1/binrel/${TOOLCHAIN}.tar.xz" -o "${TOOLCHAIN}.tar.xz" RUN tar -xvf "${TOOLCHAIN}.tar.xz" RUN mkdir /toolchains && mv "./${TOOLCHAIN}" /toolchains diff --git a/library/stdarch/ci/docker/armv7-unknown-linux-gnueabihf/Dockerfile b/library/stdarch/ci/docker/armv7-unknown-linux-gnueabihf/Dockerfile index 2086e117d92b..602249c0ece5 100644 --- a/library/stdarch/ci/docker/armv7-unknown-linux-gnueabihf/Dockerfile +++ b/library/stdarch/ci/docker/armv7-unknown-linux-gnueabihf/Dockerfile @@ -10,7 +10,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ qemu-user \ make \ file \ - clang-19 \ + clang \ lld ENV CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc \ CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_RUNNER="qemu-arm -cpu max -L /usr/arm-linux-gnueabihf" \ diff --git a/library/stdarch/ci/docker/loongarch64-unknown-linux-gnu/Dockerfile b/library/stdarch/ci/docker/loongarch64-unknown-linux-gnu/Dockerfile index ec7ed5846d9d..5ab3431ba272 100644 --- a/library/stdarch/ci/docker/loongarch64-unknown-linux-gnu/Dockerfile +++ b/library/stdarch/ci/docker/loongarch64-unknown-linux-gnu/Dockerfile @@ -3,7 +3,7 @@ FROM ubuntu:25.10 RUN apt-get update && \ apt-get install -y --no-install-recommends \ gcc libc6-dev qemu-user-static ca-certificates \ - gcc-14-loongarch64-linux-gnu libc6-dev-loong64-cross + gcc-loongarch64-linux-gnu libc6-dev-loong64-cross ENV CARGO_TARGET_LOONGARCH64_UNKNOWN_LINUX_GNU_LINKER=loongarch64-linux-gnu-gcc-14 \ diff --git a/library/stdarch/ci/docker/riscv32gc-unknown-linux-gnu/Dockerfile b/library/stdarch/ci/docker/riscv32gc-unknown-linux-gnu/Dockerfile index dbe74914f2c2..fb1718b338f8 100644 --- a/library/stdarch/ci/docker/riscv32gc-unknown-linux-gnu/Dockerfile +++ b/library/stdarch/ci/docker/riscv32gc-unknown-linux-gnu/Dockerfile @@ -4,7 +4,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ gcc libc6-dev qemu-user ca-certificates \ wget xz-utils make file llvm -ENV VERSION=2025.01.20 +ENV VERSION=2025.07.03 RUN wget "https://github.com/riscv-collab/riscv-gnu-toolchain/releases/download/${VERSION}/riscv32-glibc-ubuntu-24.04-gcc-nightly-${VERSION}-nightly.tar.xz" \ -O riscv-toolchain.tar.xz diff --git a/library/stdarch/ci/docker/wasm32-wasip1/Dockerfile b/library/stdarch/ci/docker/wasm32-wasip1/Dockerfile index 76b69592bcfe..f618b94291f5 100644 --- a/library/stdarch/ci/docker/wasm32-wasip1/Dockerfile +++ b/library/stdarch/ci/docker/wasm32-wasip1/Dockerfile @@ -7,7 +7,9 @@ RUN apt-get update -y && apt-get install -y --no-install-recommends \ xz-utils \ clang -RUN curl -L https://github.com/bytecodealliance/wasmtime/releases/download/v18.0.2/wasmtime-v18.0.2-x86_64-linux.tar.xz | tar xJf - -ENV PATH=$PATH:/wasmtime-v18.0.2-x86_64-linux +ENV VERSION=v34.0.1 + +RUN curl -L https://github.com/bytecodealliance/wasmtime/releases/download/${VERSION}/wasmtime-${VERSION}-x86_64-linux.tar.xz | tar xJf - +ENV PATH=$PATH:/wasmtime-${VERSION}-x86_64-linux ENV CARGO_TARGET_WASM32_WASIP1_RUNNER="wasmtime --dir /checkout/target/wasm32-wasip1/release/deps::." diff --git a/library/stdarch/ci/run.sh b/library/stdarch/ci/run.sh index 8eadb9285c99..78a808b46a04 100755 --- a/library/stdarch/ci/run.sh +++ b/library/stdarch/ci/run.sh @@ -144,21 +144,21 @@ case ${TARGET} in aarch64-unknown-linux-gnu*) TEST_CPPFLAGS="-fuse-ld=lld -I/usr/aarch64-linux-gnu/include/ -I/usr/aarch64-linux-gnu/include/c++/9/aarch64-linux-gnu/" TEST_SKIP_INTRINSICS=crates/intrinsic-test/missing_aarch64.txt - TEST_CXX_COMPILER="clang++-19" + TEST_CXX_COMPILER="clang++" TEST_RUNNER="${CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_RUNNER}" ;; aarch64_be-unknown-linux-gnu*) TEST_CPPFLAGS="-fuse-ld=lld" TEST_SKIP_INTRINSICS=crates/intrinsic-test/missing_aarch64.txt - TEST_CXX_COMPILER="clang++-19" + TEST_CXX_COMPILER="clang++" TEST_RUNNER="${CARGO_TARGET_AARCH64_BE_UNKNOWN_LINUX_GNU_RUNNER}" ;; armv7-unknown-linux-gnueabihf*) TEST_CPPFLAGS="-fuse-ld=lld -I/usr/arm-linux-gnueabihf/include/ -I/usr/arm-linux-gnueabihf/include/c++/9/arm-linux-gnueabihf/" TEST_SKIP_INTRINSICS=crates/intrinsic-test/missing_arm.txt - TEST_CXX_COMPILER="clang++-19" + TEST_CXX_COMPILER="clang++" TEST_RUNNER="${CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_RUNNER}" ;; *) diff --git a/library/stdarch/crates/intrinsic-test/src/arm/compile.rs b/library/stdarch/crates/intrinsic-test/src/arm/compile.rs index 8276cd87c1cb..79cd32dedc5f 100644 --- a/library/stdarch/crates/intrinsic-test/src/arm/compile.rs +++ b/library/stdarch/crates/intrinsic-test/src/arm/compile.rs @@ -38,9 +38,9 @@ pub fn compile_c_arm( .set_include_paths(vec![ "/include", "/aarch64_be-none-linux-gnu/include", - "/aarch64_be-none-linux-gnu/include/c++/14.2.1", - "/aarch64_be-none-linux-gnu/include/c++/14.2.1/aarch64_be-none-linux-gnu", - "/aarch64_be-none-linux-gnu/include/c++/14.2.1/backward", + "/aarch64_be-none-linux-gnu/include/c++/14.3.1", + "/aarch64_be-none-linux-gnu/include/c++/14.3.1/aarch64_be-none-linux-gnu", + "/aarch64_be-none-linux-gnu/include/c++/14.3.1/backward", "/aarch64_be-none-linux-gnu/libc/usr/include", ]); } From 08ef07171754b6cdd0949395a225eab6ba7e6b48 Mon Sep 17 00:00:00 2001 From: sayantn Date: Wed, 16 Jul 2025 17:17:33 +0530 Subject: [PATCH 042/139] Update `wasmprinter` to latest --- library/stdarch/Cargo.lock | 28 ++++++++++++------- .../stdarch/crates/stdarch-test/Cargo.toml | 2 +- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/library/stdarch/Cargo.lock b/library/stdarch/Cargo.lock index a30743925d92..122b3057b2f6 100644 --- a/library/stdarch/Cargo.lock +++ b/library/stdarch/Cargo.lock @@ -82,6 +82,12 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" +[[package]] +name = "bitflags" +version = "2.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967" + [[package]] name = "cc" version = "1.2.29" @@ -99,9 +105,9 @@ checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268" [[package]] name = "clap" -version = "4.5.40" +version = "4.5.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40b6887a1d8685cebccf115538db5c0efe625ccac9696ad45c409d96566e910f" +checksum = "be92d32e80243a54711e5d7ce823c35c41c9d929dc4ab58e1276f625841aadf9" dependencies = [ "clap_builder", "clap_derive", @@ -109,9 +115,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.40" +version = "4.5.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0c66c08ce9f0c698cbce5c0279d0bb6ac936d8674174fe48f736533b964f59e" +checksum = "707eab41e9622f9139419d573eca0900137718000c517d47da73045f54331c3d" dependencies = [ "anstream", "anstyle", @@ -121,9 +127,9 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.40" +version = "4.5.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2c7947ae4cc3d851207c1adb5b5e260ff0cca11446b1d6d1423788e442257ce" +checksum = "ef4f52386a59ca4c860f7393bcf8abd8dfd91ecccc0f774635ff68e92eeef491" dependencies = [ "heck", "proc-macro2", @@ -833,21 +839,23 @@ checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" [[package]] name = "wasmparser" -version = "0.113.3" +version = "0.235.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "286049849b5a5bd09a8773171be96824afabffc7cc3df6caaf33a38db6cd07ae" +checksum = "161296c618fa2d63f6ed5fffd1112937e803cb9ec71b32b01a76321555660917" dependencies = [ + "bitflags", "indexmap 2.10.0", "semver", ] [[package]] name = "wasmprinter" -version = "0.2.67" +version = "0.235.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6615a5587149e753bf4b93f90fa3c3f41c88597a7a2da72879afcabeda9648f" +checksum = "75aa8e9076de6b9544e6dab4badada518cca0bf4966d35b131bbd057aed8fa0a" dependencies = [ "anyhow", + "termcolor", "wasmparser", ] diff --git a/library/stdarch/crates/stdarch-test/Cargo.toml b/library/stdarch/crates/stdarch-test/Cargo.toml index e4791e4ec525..299bc8c63bf2 100644 --- a/library/stdarch/crates/stdarch-test/Cargo.toml +++ b/library/stdarch/crates/stdarch-test/Cargo.toml @@ -20,7 +20,7 @@ cc = "1.0" # time, and we want to make updates to this explicit rather than automatically # picking up updates which might break CI with new instruction names. [target.'cfg(target_arch = "wasm32")'.dependencies] -wasmprinter = "=0.2.67" +wasmprinter = "=0.235" [features] default = [] From 0d9d2094178fcaa1cae5b71d18198859bdaa40bf Mon Sep 17 00:00:00 2001 From: Folkert de Vries Date: Wed, 16 Jul 2025 16:27:51 +0200 Subject: [PATCH 043/139] fix space in generated loongarch --- library/stdarch/crates/stdarch-gen-loongarch/src/main.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/stdarch/crates/stdarch-gen-loongarch/src/main.rs b/library/stdarch/crates/stdarch-gen-loongarch/src/main.rs index aa9990b6ccd1..9e10a4c3f031 100644 --- a/library/stdarch/crates/stdarch-gen-loongarch/src/main.rs +++ b/library/stdarch/crates/stdarch-gen-loongarch/src/main.rs @@ -280,7 +280,7 @@ fn gen_bind_body( let fn_output = if out_t.to_lowercase() == "void" { String::new() } else { - format!("-> {}", type_to_rst(out_t, is_store)) + format!(" -> {}", type_to_rst(out_t, is_store)) }; let fn_inputs = match para_num { 1 => format!("(a: {})", type_to_rst(in_t[0], is_store)), @@ -304,7 +304,7 @@ fn gen_bind_body( ), _ => panic!("unsupported parameter number"), }; - format!("fn __{current_name}{fn_inputs} {fn_output};") + format!("fn __{current_name}{fn_inputs}{fn_output};") }; let function = format!( r#" #[link_name = "llvm.loongarch.{}"] From 10d7b7b6767368f940eec85cec8543ce1c9a6989 Mon Sep 17 00:00:00 2001 From: Madhav Madhusoodanan Date: Wed, 16 Jul 2025 23:49:04 +0530 Subject: [PATCH 044/139] Implemented DerefMut for ArmIntrinsicTest More details: 1. Moved the return type of IntrinsicType::from_c to Rust from Result, String> --- .../crates/intrinsic-test/src/arm/intrinsic.rs | 8 +++++++- .../crates/intrinsic-test/src/arm/json_parser.rs | 2 +- .../crates/intrinsic-test/src/arm/types.rs | 15 +++++++-------- .../crates/intrinsic-test/src/common/argument.rs | 2 +- .../src/common/intrinsic_helpers.rs | 4 +++- 5 files changed, 19 insertions(+), 12 deletions(-) diff --git a/library/stdarch/crates/intrinsic-test/src/arm/intrinsic.rs b/library/stdarch/crates/intrinsic-test/src/arm/intrinsic.rs index 8c17856b829e..16572b2c03f1 100644 --- a/library/stdarch/crates/intrinsic-test/src/arm/intrinsic.rs +++ b/library/stdarch/crates/intrinsic-test/src/arm/intrinsic.rs @@ -2,7 +2,7 @@ use crate::common::argument::ArgumentList; use crate::common::indentation::Indentation; use crate::common::intrinsic::{Intrinsic, IntrinsicDefinition}; use crate::common::intrinsic_helpers::{IntrinsicType, IntrinsicTypeDefinition, Sign, TypeKind}; -use std::ops::Deref; +use std::ops::{Deref, DerefMut}; #[derive(Debug, Clone, PartialEq)] pub struct ArmIntrinsicType(pub IntrinsicType); @@ -15,6 +15,12 @@ impl Deref for ArmIntrinsicType { } } +impl DerefMut for ArmIntrinsicType { + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.0 + } +} + impl IntrinsicDefinition for Intrinsic { fn arguments(&self) -> ArgumentList { self.arguments.clone() diff --git a/library/stdarch/crates/intrinsic-test/src/arm/json_parser.rs b/library/stdarch/crates/intrinsic-test/src/arm/json_parser.rs index 0ac47484b019..58d366c86a93 100644 --- a/library/stdarch/crates/intrinsic-test/src/arm/json_parser.rs +++ b/library/stdarch/crates/intrinsic-test/src/arm/json_parser.rs @@ -110,7 +110,7 @@ fn json_to_intrinsic( Ok(Intrinsic { name, arguments, - results: *results, + results: results, arch_tags: intr.architectures, }) } diff --git a/library/stdarch/crates/intrinsic-test/src/arm/types.rs b/library/stdarch/crates/intrinsic-test/src/arm/types.rs index 05db8b738eda..77f5e8d0e560 100644 --- a/library/stdarch/crates/intrinsic-test/src/arm/types.rs +++ b/library/stdarch/crates/intrinsic-test/src/arm/types.rs @@ -121,7 +121,7 @@ impl IntrinsicTypeDefinition for ArmIntrinsicType { } } - fn from_c(s: &str, target: &str) -> Result, String> { + fn from_c(s: &str, target: &str) -> Result { const CONST_STR: &str = "const"; if let Some(s) = s.strip_suffix('*') { let (s, constant) = match s.trim().strip_suffix(CONST_STR) { @@ -131,9 +131,8 @@ impl IntrinsicTypeDefinition for ArmIntrinsicType { let s = s.trim_end(); let temp_return = ArmIntrinsicType::from_c(s, target); temp_return.map(|mut op| { - let edited = op.as_mut(); - edited.0.ptr = true; - edited.0.ptr_constant = constant; + op.ptr = true; + op.ptr_constant = constant; op }) } else { @@ -163,7 +162,7 @@ impl IntrinsicTypeDefinition for ArmIntrinsicType { ), None => None, }; - Ok(Box::new(ArmIntrinsicType(IntrinsicType { + Ok(ArmIntrinsicType(IntrinsicType { ptr: false, ptr_constant: false, constant, @@ -172,14 +171,14 @@ impl IntrinsicTypeDefinition for ArmIntrinsicType { simd_len, vec_len, target: target.to_string(), - }))) + })) } else { let kind = start.parse::()?; let bit_len = match kind { TypeKind::Int(_) => Some(32), _ => None, }; - Ok(Box::new(ArmIntrinsicType(IntrinsicType { + Ok(ArmIntrinsicType(IntrinsicType { ptr: false, ptr_constant: false, constant, @@ -188,7 +187,7 @@ impl IntrinsicTypeDefinition for ArmIntrinsicType { simd_len: None, vec_len: None, target: target.to_string(), - }))) + })) } } } diff --git a/library/stdarch/crates/intrinsic-test/src/common/argument.rs b/library/stdarch/crates/intrinsic-test/src/common/argument.rs index 443ccb919f46..e0c93651918a 100644 --- a/library/stdarch/crates/intrinsic-test/src/common/argument.rs +++ b/library/stdarch/crates/intrinsic-test/src/common/argument.rs @@ -76,7 +76,7 @@ where Argument { pos, name: String::from(var_name), - ty: *ty, + ty: ty, constraint, } } diff --git a/library/stdarch/crates/intrinsic-test/src/common/intrinsic_helpers.rs b/library/stdarch/crates/intrinsic-test/src/common/intrinsic_helpers.rs index ea210c78bda7..697f9c8754da 100644 --- a/library/stdarch/crates/intrinsic-test/src/common/intrinsic_helpers.rs +++ b/library/stdarch/crates/intrinsic-test/src/common/intrinsic_helpers.rs @@ -322,7 +322,9 @@ pub trait IntrinsicTypeDefinition: Deref { fn get_lane_function(&self) -> String; /// can be implemented in an `impl` block - fn from_c(_s: &str, _target: &str) -> Result, String>; + fn from_c(_s: &str, _target: &str) -> Result + where + Self: Sized; /// Gets a string containing the typename for this type in C format. /// can be directly defined in `impl` blocks From b74c4825cbb4d86995362e02025cc999005e6fd8 Mon Sep 17 00:00:00 2001 From: Folkert de Vries Date: Thu, 17 Jul 2025 02:00:42 +0200 Subject: [PATCH 045/139] test for the high version of a number of instructions --- .../core_arch/src/aarch64/neon/generated.rs | 58 +++++++++---------- .../spec/neon/aarch64.spec.yml | 30 +++++----- 2 files changed, 44 insertions(+), 44 deletions(-) diff --git a/library/stdarch/crates/core_arch/src/aarch64/neon/generated.rs b/library/stdarch/crates/core_arch/src/aarch64/neon/generated.rs index 31618d39b947..bc4c438038dc 100644 --- a/library/stdarch/crates/core_arch/src/aarch64/neon/generated.rs +++ b/library/stdarch/crates/core_arch/src/aarch64/neon/generated.rs @@ -51,7 +51,7 @@ pub fn __crc32d(crc: u32, data: u64) -> u32 { #[inline] #[target_feature(enable = "neon")] #[stable(feature = "neon_intrinsics", since = "1.59.0")] -#[cfg_attr(all(test, not(target_env = "msvc")), assert_instr(sabal))] +#[cfg_attr(all(test, not(target_env = "msvc")), assert_instr(sabal2))] pub fn vabal_high_s8(a: int16x8_t, b: int8x16_t, c: int8x16_t) -> int16x8_t { unsafe { let d: int8x8_t = simd_shuffle!(b, b, [8, 9, 10, 11, 12, 13, 14, 15]); @@ -66,7 +66,7 @@ pub fn vabal_high_s8(a: int16x8_t, b: int8x16_t, c: int8x16_t) -> int16x8_t { #[inline] #[target_feature(enable = "neon")] #[stable(feature = "neon_intrinsics", since = "1.59.0")] -#[cfg_attr(all(test, not(target_env = "msvc")), assert_instr(sabal))] +#[cfg_attr(all(test, not(target_env = "msvc")), assert_instr(sabal2))] pub fn vabal_high_s16(a: int32x4_t, b: int16x8_t, c: int16x8_t) -> int32x4_t { unsafe { let d: int16x4_t = simd_shuffle!(b, b, [4, 5, 6, 7]); @@ -81,7 +81,7 @@ pub fn vabal_high_s16(a: int32x4_t, b: int16x8_t, c: int16x8_t) -> int32x4_t { #[inline] #[target_feature(enable = "neon")] #[stable(feature = "neon_intrinsics", since = "1.59.0")] -#[cfg_attr(all(test, not(target_env = "msvc")), assert_instr(sabal))] +#[cfg_attr(all(test, not(target_env = "msvc")), assert_instr(sabal2))] pub fn vabal_high_s32(a: int64x2_t, b: int32x4_t, c: int32x4_t) -> int64x2_t { unsafe { let d: int32x2_t = simd_shuffle!(b, b, [2, 3]); @@ -96,7 +96,7 @@ pub fn vabal_high_s32(a: int64x2_t, b: int32x4_t, c: int32x4_t) -> int64x2_t { #[inline] #[target_feature(enable = "neon")] #[stable(feature = "neon_intrinsics", since = "1.59.0")] -#[cfg_attr(all(test, not(target_env = "msvc")), assert_instr(uabal))] +#[cfg_attr(all(test, not(target_env = "msvc")), assert_instr(uabal2))] pub fn vabal_high_u8(a: uint16x8_t, b: uint8x16_t, c: uint8x16_t) -> uint16x8_t { unsafe { let d: uint8x8_t = simd_shuffle!(b, b, [8, 9, 10, 11, 12, 13, 14, 15]); @@ -110,7 +110,7 @@ pub fn vabal_high_u8(a: uint16x8_t, b: uint8x16_t, c: uint8x16_t) -> uint16x8_t #[inline] #[target_feature(enable = "neon")] #[stable(feature = "neon_intrinsics", since = "1.59.0")] -#[cfg_attr(all(test, not(target_env = "msvc")), assert_instr(uabal))] +#[cfg_attr(all(test, not(target_env = "msvc")), assert_instr(uabal2))] pub fn vabal_high_u16(a: uint32x4_t, b: uint16x8_t, c: uint16x8_t) -> uint32x4_t { unsafe { let d: uint16x4_t = simd_shuffle!(b, b, [4, 5, 6, 7]); @@ -124,7 +124,7 @@ pub fn vabal_high_u16(a: uint32x4_t, b: uint16x8_t, c: uint16x8_t) -> uint32x4_t #[inline] #[target_feature(enable = "neon")] #[stable(feature = "neon_intrinsics", since = "1.59.0")] -#[cfg_attr(all(test, not(target_env = "msvc")), assert_instr(uabal))] +#[cfg_attr(all(test, not(target_env = "msvc")), assert_instr(uabal2))] pub fn vabal_high_u32(a: uint64x2_t, b: uint32x4_t, c: uint32x4_t) -> uint64x2_t { unsafe { let d: uint32x2_t = simd_shuffle!(b, b, [2, 3]); @@ -197,7 +197,7 @@ pub fn vabdh_f16(a: f16, b: f16) -> f16 { #[inline] #[target_feature(enable = "neon")] #[stable(feature = "neon_intrinsics", since = "1.59.0")] -#[cfg_attr(test, assert_instr(sabdl))] +#[cfg_attr(test, assert_instr(sabdl2))] pub fn vabdl_high_s16(a: int16x8_t, b: int16x8_t) -> int32x4_t { unsafe { let c: int16x4_t = simd_shuffle!(a, a, [4, 5, 6, 7]); @@ -211,7 +211,7 @@ pub fn vabdl_high_s16(a: int16x8_t, b: int16x8_t) -> int32x4_t { #[inline] #[target_feature(enable = "neon")] #[stable(feature = "neon_intrinsics", since = "1.59.0")] -#[cfg_attr(test, assert_instr(sabdl))] +#[cfg_attr(test, assert_instr(sabdl2))] pub fn vabdl_high_s32(a: int32x4_t, b: int32x4_t) -> int64x2_t { unsafe { let c: int32x2_t = simd_shuffle!(a, a, [2, 3]); @@ -225,7 +225,7 @@ pub fn vabdl_high_s32(a: int32x4_t, b: int32x4_t) -> int64x2_t { #[inline] #[target_feature(enable = "neon")] #[stable(feature = "neon_intrinsics", since = "1.59.0")] -#[cfg_attr(test, assert_instr(sabdl))] +#[cfg_attr(test, assert_instr(sabdl2))] pub fn vabdl_high_s8(a: int8x16_t, b: int8x16_t) -> int16x8_t { unsafe { let c: int8x8_t = simd_shuffle!(a, a, [8, 9, 10, 11, 12, 13, 14, 15]); @@ -238,7 +238,7 @@ pub fn vabdl_high_s8(a: int8x16_t, b: int8x16_t) -> int16x8_t { #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vabdl_high_u8)"] #[inline] #[target_feature(enable = "neon")] -#[cfg_attr(test, assert_instr(uabdl))] +#[cfg_attr(test, assert_instr(uabdl2))] #[stable(feature = "neon_intrinsics", since = "1.59.0")] pub fn vabdl_high_u8(a: uint8x16_t, b: uint8x16_t) -> uint16x8_t { unsafe { @@ -251,7 +251,7 @@ pub fn vabdl_high_u8(a: uint8x16_t, b: uint8x16_t) -> uint16x8_t { #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vabdl_high_u16)"] #[inline] #[target_feature(enable = "neon")] -#[cfg_attr(test, assert_instr(uabdl))] +#[cfg_attr(test, assert_instr(uabdl2))] #[stable(feature = "neon_intrinsics", since = "1.59.0")] pub fn vabdl_high_u16(a: uint16x8_t, b: uint16x8_t) -> uint32x4_t { unsafe { @@ -264,7 +264,7 @@ pub fn vabdl_high_u16(a: uint16x8_t, b: uint16x8_t) -> uint32x4_t { #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vabdl_high_u32)"] #[inline] #[target_feature(enable = "neon")] -#[cfg_attr(test, assert_instr(uabdl))] +#[cfg_attr(test, assert_instr(uabdl2))] #[stable(feature = "neon_intrinsics", since = "1.59.0")] pub fn vabdl_high_u32(a: uint32x4_t, b: uint32x4_t) -> uint64x2_t { unsafe { @@ -7177,7 +7177,7 @@ pub fn vcvt_high_f32_f16(a: float16x8_t) -> float32x4_t { #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vcvt_high_f32_f64)"] #[inline] #[target_feature(enable = "neon")] -#[cfg_attr(test, assert_instr(fcvtn))] +#[cfg_attr(test, assert_instr(fcvtn2))] #[stable(feature = "neon_intrinsics", since = "1.59.0")] pub fn vcvt_high_f32_f64(a: float32x2_t, b: float64x2_t) -> float32x4_t { unsafe { simd_shuffle!(a, simd_cast(b), [0, 1, 2, 3]) } @@ -7186,7 +7186,7 @@ pub fn vcvt_high_f32_f64(a: float32x2_t, b: float64x2_t) -> float32x4_t { #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vcvt_high_f64_f32)"] #[inline] #[target_feature(enable = "neon")] -#[cfg_attr(test, assert_instr(fcvtl))] +#[cfg_attr(test, assert_instr(fcvtl2))] #[stable(feature = "neon_intrinsics", since = "1.59.0")] pub fn vcvt_high_f64_f32(a: float32x4_t) -> float64x2_t { unsafe { @@ -9286,7 +9286,7 @@ pub fn vcvtx_f32_f64(a: float64x2_t) -> float32x2_t { #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vcvtx_high_f32_f64)"] #[inline] #[target_feature(enable = "neon")] -#[cfg_attr(test, assert_instr(fcvtxn))] +#[cfg_attr(test, assert_instr(fcvtxn2))] #[stable(feature = "neon_intrinsics", since = "1.59.0")] pub fn vcvtx_high_f32_f64(a: float32x2_t, b: float64x2_t) -> float32x4_t { unsafe { simd_shuffle!(a, vcvtx_f32_f64(b), [0, 1, 2, 3]) } @@ -14893,7 +14893,7 @@ pub fn vmull_high_n_u32(a: uint32x4_t, b: u32) -> uint64x2_t { #[inline] #[target_feature(enable = "neon,aes")] #[stable(feature = "neon_intrinsics", since = "1.59.0")] -#[cfg_attr(test, assert_instr(pmull))] +#[cfg_attr(test, assert_instr(pmull2))] pub fn vmull_high_p64(a: poly64x2_t, b: poly64x2_t) -> p128 { unsafe { vmull_p64(simd_extract!(a, 1), simd_extract!(b, 1)) } } @@ -14902,7 +14902,7 @@ pub fn vmull_high_p64(a: poly64x2_t, b: poly64x2_t) -> p128 { #[inline] #[target_feature(enable = "neon")] #[stable(feature = "neon_intrinsics", since = "1.59.0")] -#[cfg_attr(test, assert_instr(pmull))] +#[cfg_attr(test, assert_instr(pmull2))] pub fn vmull_high_p8(a: poly8x16_t, b: poly8x16_t) -> poly16x8_t { unsafe { let a: poly8x8_t = simd_shuffle!(a, a, [8, 9, 10, 11, 12, 13, 14, 15]); @@ -26497,7 +26497,7 @@ pub fn vsubh_f16(a: f16, b: f16) -> f16 { #[inline] #[target_feature(enable = "neon")] #[stable(feature = "neon_intrinsics", since = "1.59.0")] -#[cfg_attr(test, assert_instr(ssubl))] +#[cfg_attr(test, assert_instr(ssubl2))] pub fn vsubl_high_s8(a: int8x16_t, b: int8x16_t) -> int16x8_t { unsafe { let c: int8x8_t = simd_shuffle!(a, a, [8, 9, 10, 11, 12, 13, 14, 15]); @@ -26512,7 +26512,7 @@ pub fn vsubl_high_s8(a: int8x16_t, b: int8x16_t) -> int16x8_t { #[inline] #[target_feature(enable = "neon")] #[stable(feature = "neon_intrinsics", since = "1.59.0")] -#[cfg_attr(test, assert_instr(ssubl))] +#[cfg_attr(test, assert_instr(ssubl2))] pub fn vsubl_high_s16(a: int16x8_t, b: int16x8_t) -> int32x4_t { unsafe { let c: int16x4_t = simd_shuffle!(a, a, [4, 5, 6, 7]); @@ -26527,7 +26527,7 @@ pub fn vsubl_high_s16(a: int16x8_t, b: int16x8_t) -> int32x4_t { #[inline] #[target_feature(enable = "neon")] #[stable(feature = "neon_intrinsics", since = "1.59.0")] -#[cfg_attr(test, assert_instr(ssubl))] +#[cfg_attr(test, assert_instr(ssubl2))] pub fn vsubl_high_s32(a: int32x4_t, b: int32x4_t) -> int64x2_t { unsafe { let c: int32x2_t = simd_shuffle!(a, a, [2, 3]); @@ -26542,7 +26542,7 @@ pub fn vsubl_high_s32(a: int32x4_t, b: int32x4_t) -> int64x2_t { #[inline] #[target_feature(enable = "neon")] #[stable(feature = "neon_intrinsics", since = "1.59.0")] -#[cfg_attr(test, assert_instr(usubl))] +#[cfg_attr(test, assert_instr(usubl2))] pub fn vsubl_high_u8(a: uint8x16_t, b: uint8x16_t) -> uint16x8_t { unsafe { let c: uint8x8_t = simd_shuffle!(a, a, [8, 9, 10, 11, 12, 13, 14, 15]); @@ -26557,7 +26557,7 @@ pub fn vsubl_high_u8(a: uint8x16_t, b: uint8x16_t) -> uint16x8_t { #[inline] #[target_feature(enable = "neon")] #[stable(feature = "neon_intrinsics", since = "1.59.0")] -#[cfg_attr(test, assert_instr(usubl))] +#[cfg_attr(test, assert_instr(usubl2))] pub fn vsubl_high_u16(a: uint16x8_t, b: uint16x8_t) -> uint32x4_t { unsafe { let c: uint16x4_t = simd_shuffle!(a, a, [4, 5, 6, 7]); @@ -26572,7 +26572,7 @@ pub fn vsubl_high_u16(a: uint16x8_t, b: uint16x8_t) -> uint32x4_t { #[inline] #[target_feature(enable = "neon")] #[stable(feature = "neon_intrinsics", since = "1.59.0")] -#[cfg_attr(test, assert_instr(usubl))] +#[cfg_attr(test, assert_instr(usubl2))] pub fn vsubl_high_u32(a: uint32x4_t, b: uint32x4_t) -> uint64x2_t { unsafe { let c: uint32x2_t = simd_shuffle!(a, a, [2, 3]); @@ -26587,7 +26587,7 @@ pub fn vsubl_high_u32(a: uint32x4_t, b: uint32x4_t) -> uint64x2_t { #[inline] #[target_feature(enable = "neon")] #[stable(feature = "neon_intrinsics", since = "1.59.0")] -#[cfg_attr(test, assert_instr(ssubw))] +#[cfg_attr(test, assert_instr(ssubw2))] pub fn vsubw_high_s8(a: int16x8_t, b: int8x16_t) -> int16x8_t { unsafe { let c: int8x8_t = simd_shuffle!(b, b, [8, 9, 10, 11, 12, 13, 14, 15]); @@ -26599,7 +26599,7 @@ pub fn vsubw_high_s8(a: int16x8_t, b: int8x16_t) -> int16x8_t { #[inline] #[target_feature(enable = "neon")] #[stable(feature = "neon_intrinsics", since = "1.59.0")] -#[cfg_attr(test, assert_instr(ssubw))] +#[cfg_attr(test, assert_instr(ssubw2))] pub fn vsubw_high_s16(a: int32x4_t, b: int16x8_t) -> int32x4_t { unsafe { let c: int16x4_t = simd_shuffle!(b, b, [4, 5, 6, 7]); @@ -26611,7 +26611,7 @@ pub fn vsubw_high_s16(a: int32x4_t, b: int16x8_t) -> int32x4_t { #[inline] #[target_feature(enable = "neon")] #[stable(feature = "neon_intrinsics", since = "1.59.0")] -#[cfg_attr(test, assert_instr(ssubw))] +#[cfg_attr(test, assert_instr(ssubw2))] pub fn vsubw_high_s32(a: int64x2_t, b: int32x4_t) -> int64x2_t { unsafe { let c: int32x2_t = simd_shuffle!(b, b, [2, 3]); @@ -26623,7 +26623,7 @@ pub fn vsubw_high_s32(a: int64x2_t, b: int32x4_t) -> int64x2_t { #[inline] #[target_feature(enable = "neon")] #[stable(feature = "neon_intrinsics", since = "1.59.0")] -#[cfg_attr(test, assert_instr(usubw))] +#[cfg_attr(test, assert_instr(usubw2))] pub fn vsubw_high_u8(a: uint16x8_t, b: uint8x16_t) -> uint16x8_t { unsafe { let c: uint8x8_t = simd_shuffle!(b, b, [8, 9, 10, 11, 12, 13, 14, 15]); @@ -26635,7 +26635,7 @@ pub fn vsubw_high_u8(a: uint16x8_t, b: uint8x16_t) -> uint16x8_t { #[inline] #[target_feature(enable = "neon")] #[stable(feature = "neon_intrinsics", since = "1.59.0")] -#[cfg_attr(test, assert_instr(usubw))] +#[cfg_attr(test, assert_instr(usubw2))] pub fn vsubw_high_u16(a: uint32x4_t, b: uint16x8_t) -> uint32x4_t { unsafe { let c: uint16x4_t = simd_shuffle!(b, b, [4, 5, 6, 7]); @@ -26647,7 +26647,7 @@ pub fn vsubw_high_u16(a: uint32x4_t, b: uint16x8_t) -> uint32x4_t { #[inline] #[target_feature(enable = "neon")] #[stable(feature = "neon_intrinsics", since = "1.59.0")] -#[cfg_attr(test, assert_instr(usubw))] +#[cfg_attr(test, assert_instr(usubw2))] pub fn vsubw_high_u32(a: uint64x2_t, b: uint32x4_t) -> uint64x2_t { unsafe { let c: uint32x2_t = simd_shuffle!(b, b, [2, 3]); diff --git a/library/stdarch/crates/stdarch-gen-arm/spec/neon/aarch64.spec.yml b/library/stdarch/crates/stdarch-gen-arm/spec/neon/aarch64.spec.yml index b20c1b3c36bb..a31613e6b1ae 100644 --- a/library/stdarch/crates/stdarch-gen-arm/spec/neon/aarch64.spec.yml +++ b/library/stdarch/crates/stdarch-gen-arm/spec/neon/aarch64.spec.yml @@ -187,7 +187,7 @@ intrinsics: arguments: ["a: {neon_type[0]}", "b: {neon_type[0]}"] return_type: "{neon_type[1]}" attr: [*neon-stable] - assert_instr: [sabdl] + assert_instr: [sabdl2] safety: safe types: - [int8x16_t, int16x8_t, int8x8_t, uint8x8_t] @@ -230,7 +230,7 @@ intrinsics: - stable - - 'feature = "neon_intrinsics"' - 'since = "1.59.0"' - assert_instr: [sabdl] + assert_instr: [sabdl2] safety: safe types: - [int16x8_t, int32x4_t, int16x4_t, uint16x4_t] @@ -273,7 +273,7 @@ intrinsics: - stable - - 'feature = "neon_intrinsics"' - 'since = "1.59.0"' - assert_instr: [sabdl] + assert_instr: [sabdl2] safety: safe types: - [int32x4_t, int64x2_t, int32x2_t, uint32x2_t] @@ -1462,7 +1462,7 @@ intrinsics: arguments: ["a: {neon_type[0]}"] return_type: "{neon_type[1]}" attr: - - FnCall: [cfg_attr, [test, {FnCall: [assert_instr, [fcvtl]]}]] + - FnCall: [cfg_attr, [test, {FnCall: [assert_instr, [fcvtl2]]}]] - FnCall: [stable, ['feature = "neon_intrinsics"', 'since = "1.59.0"']] safety: safe types: @@ -1530,7 +1530,7 @@ intrinsics: arguments: ["a: {neon_type[0]}", "b: {neon_type[1]}"] return_type: "{neon_type[2]}" attr: - - FnCall: [cfg_attr, [test, {FnCall: [assert_instr, [fcvtn]]}]] + - FnCall: [cfg_attr, [test, {FnCall: [assert_instr, [fcvtn2]]}]] - FnCall: [stable, ['feature = "neon_intrinsics"', 'since = "1.59.0"']] safety: safe types: @@ -1582,7 +1582,7 @@ intrinsics: arguments: ["a: {type[0]}", "b: {neon_type[1]}"] return_type: "{type[2]}" attr: - - FnCall: [cfg_attr, [test, {FnCall: [assert_instr, [fcvtxn]]}]] + - FnCall: [cfg_attr, [test, {FnCall: [assert_instr, [fcvtxn2]]}]] - FnCall: [stable, ['feature = "neon_intrinsics"', 'since = "1.59.0"']] safety: safe types: @@ -5147,7 +5147,7 @@ intrinsics: attr: - *neon-stable safety: safe - assert_instr: [pmull] + assert_instr: [pmull2] types: - [poly8x16_t, poly8x8_t, '[8, 9, 10, 11, 12, 13, 14, 15]', poly16x8_t] compose: @@ -5169,7 +5169,7 @@ intrinsics: - *neon-aes - *neon-stable safety: safe - assert_instr: [pmull] + assert_instr: [pmull2] types: - [poly64x2_t, "p128"] compose: @@ -5741,7 +5741,7 @@ intrinsics: arguments: ["a: {neon_type[0]}", "b: {neon_type[1]}"] return_type: "{neon_type[0]}" attr: [*neon-stable] - assert_instr: [ssubw] + assert_instr: [ssubw2] safety: safe types: - [int16x8_t, int8x16_t, int8x8_t, '[8, 9, 10, 11, 12, 13, 14, 15]'] @@ -5762,7 +5762,7 @@ intrinsics: arguments: ["a: {neon_type[0]}", "b: {neon_type[1]}"] return_type: "{neon_type[0]}" attr: [*neon-stable] - assert_instr: [usubw] + assert_instr: [usubw2] safety: safe types: - [uint16x8_t, uint8x16_t, uint8x8_t, '[8, 9, 10, 11, 12, 13, 14, 15]'] @@ -5783,7 +5783,7 @@ intrinsics: arguments: ["a: {neon_type[0]}", "b: {neon_type[0]}"] return_type: "{neon_type[1]}" attr: [*neon-stable] - assert_instr: [ssubl] + assert_instr: [ssubl2] safety: safe types: - [int8x16_t, int16x8_t, '[8, 9, 10, 11, 12, 13, 14, 15]', int8x8_t] @@ -5813,7 +5813,7 @@ intrinsics: arguments: ["a: {neon_type[0]}", "b: {neon_type[0]}"] return_type: "{neon_type[1]}" attr: [*neon-stable] - assert_instr: [usubl] + assert_instr: [usubl2] safety: safe types: - [uint8x16_t, uint16x8_t, '[8, 9, 10, 11, 12, 13, 14, 15]', uint8x8_t] @@ -9909,7 +9909,7 @@ intrinsics: return_type: "{neon_type[0]}" attr: - FnCall: [stable, ['feature = "neon_intrinsics"', 'since = "1.59.0"']] - - FnCall: [cfg_attr, [{FnCall: [all, [test, {FnCall: [not, ['target_env = "msvc"']]}]]}, {FnCall: [assert_instr, [uabal]]}]] + - FnCall: [cfg_attr, [{FnCall: [all, [test, {FnCall: [not, ['target_env = "msvc"']]}]]}, {FnCall: [assert_instr, [uabal2]]}]] safety: safe types: - [uint16x8_t, uint8x16_t, uint8x8_t, '[8, 9, 10, 11, 12, 13, 14, 15]', '[8, 9, 10, 11, 12, 13, 14, 15]'] @@ -9936,7 +9936,7 @@ intrinsics: return_type: "{neon_type[0]}" attr: - *neon-stable - - FnCall: [cfg_attr, [{FnCall: [all, [test, {FnCall: [not, ['target_env = "msvc"']]}]]}, {FnCall: [assert_instr, [sabal]]}]] + - FnCall: [cfg_attr, [{FnCall: [all, [test, {FnCall: [not, ['target_env = "msvc"']]}]]}, {FnCall: [assert_instr, [sabal2]]}]] safety: safe types: - [int16x8_t, int8x16_t, int8x16_t, '[8, 9, 10, 11, 12, 13, 14, 15]', int8x8_t, uint8x8_t] @@ -11345,7 +11345,7 @@ intrinsics: arguments: ["a: {neon_type[0]}", "b: {neon_type[0]}"] return_type: "{neon_type[1]}" attr: - - FnCall: [cfg_attr, [test, {FnCall: [assert_instr, [uabdl]]}]] + - FnCall: [cfg_attr, [test, {FnCall: [assert_instr, [uabdl2]]}]] - FnCall: [stable, ['feature = "neon_intrinsics"', 'since = "1.59.0"']] safety: safe types: From 5438a7c110127ec66002d6a15d168858a20a802c Mon Sep 17 00:00:00 2001 From: Folkert de Vries Date: Thu, 10 Jul 2025 17:10:46 +0200 Subject: [PATCH 046/139] `stdarch-test`: for now, allow if only part of an instruction matched --- library/stdarch/crates/stdarch-test/src/lib.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/library/stdarch/crates/stdarch-test/src/lib.rs b/library/stdarch/crates/stdarch-test/src/lib.rs index 317b46410596..ecaf95f61766 100644 --- a/library/stdarch/crates/stdarch-test/src/lib.rs +++ b/library/stdarch/crates/stdarch-test/src/lib.rs @@ -94,10 +94,12 @@ pub fn assert(shim_addr: usize, fnname: &str, expected: &str) { // Check whether the given instruction is part of the disassemblied body. let found = expected == "nop" || instrs.iter().any(|instruction| { - // Check that the next character is non-alphabetic. This prevents false negatives - // when e.g. `fminnm` was used but `fmin` was expected. instruction.starts_with(expected) - && !instruction[expected.len()..].starts_with(|c: char| c.is_ascii_alphabetic()) + // Check that the next character is non-alphanumeric. This prevents false negatives + // when e.g. `fminnm` was used but `fmin` was expected. + // + // TODO: resolve the conflicts (x86_64 and aarch64 have a bunch, probably others) + // && !instruction[expected.len()..].starts_with(|c: char| c.is_ascii_alphanumeric()) }); // Look for subroutine call instructions in the disassembly to detect whether From b57ff35641496006a13cc709923e4e59a0e93054 Mon Sep 17 00:00:00 2001 From: WANG Rui Date: Sat, 28 Jun 2025 12:13:15 +0800 Subject: [PATCH 047/139] loongarch: Mark partial basic intrinsics as safe --- .../crates/core_arch/src/loongarch64/mod.rs | 15 ++-- .../core_arch/src/loongarch_shared/mod.rs | 70 +++++++++---------- 2 files changed, 41 insertions(+), 44 deletions(-) diff --git a/library/stdarch/crates/core_arch/src/loongarch64/mod.rs b/library/stdarch/crates/core_arch/src/loongarch64/mod.rs index 3f1bfbcd0e1e..e8249805eae2 100644 --- a/library/stdarch/crates/core_arch/src/loongarch64/mod.rs +++ b/library/stdarch/crates/core_arch/src/loongarch64/mod.rs @@ -13,10 +13,9 @@ use crate::arch::asm; /// Reads the 64-bit stable counter value and the counter ID #[inline] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn rdtime_d() -> (i64, isize) { - let val: i64; - let tid: isize; - asm!("rdtime.d {}, {}", out(reg) val, out(reg) tid, options(readonly, nostack)); +pub fn rdtime_d() -> (i64, isize) { + let (val, tid): (i64, isize); + unsafe { asm!("rdtime.d {}, {}", out(reg) val, out(reg) tid, options(readonly, nostack)) }; (val, tid) } @@ -51,15 +50,15 @@ unsafe extern "unadjusted" { /// Calculate the CRC value using the IEEE 802.3 polynomial (0xEDB88320) #[inline] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn crc_w_d_w(a: i64, b: i32) -> i32 { - __crc_w_d_w(a, b) +pub fn crc_w_d_w(a: i64, b: i32) -> i32 { + unsafe { __crc_w_d_w(a, b) } } /// Calculate the CRC value using the Castagnoli polynomial (0x82F63B78) #[inline] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn crcc_w_d_w(a: i64, b: i32) -> i32 { - __crcc_w_d_w(a, b) +pub fn crcc_w_d_w(a: i64, b: i32) -> i32 { + unsafe { __crcc_w_d_w(a, b) } } /// Generates the cache operation instruction diff --git a/library/stdarch/crates/core_arch/src/loongarch_shared/mod.rs b/library/stdarch/crates/core_arch/src/loongarch_shared/mod.rs index da716ffd279e..710b926f8df4 100644 --- a/library/stdarch/crates/core_arch/src/loongarch_shared/mod.rs +++ b/library/stdarch/crates/core_arch/src/loongarch_shared/mod.rs @@ -5,20 +5,18 @@ use crate::arch::asm; /// Reads the lower 32-bit stable counter value and the counter ID #[inline] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn rdtimel_w() -> (i32, isize) { - let val: i32; - let tid: isize; - asm!("rdtimel.w {}, {}", out(reg) val, out(reg) tid, options(readonly, nostack)); +pub fn rdtimel_w() -> (i32, isize) { + let (val, tid): (i32, isize); + unsafe { asm!("rdtimel.w {}, {}", out(reg) val, out(reg) tid, options(readonly, nostack)) }; (val, tid) } /// Reads the upper 32-bit stable counter value and the counter ID #[inline] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn rdtimeh_w() -> (i32, isize) { - let val: i32; - let tid: isize; - asm!("rdtimeh.w {}, {}", out(reg) val, out(reg) tid, options(readonly, nostack)); +pub fn rdtimeh_w() -> (i32, isize) { + let (val, tid): (i32, isize); + unsafe { asm!("rdtimeh.w {}, {}", out(reg) val, out(reg) tid, options(readonly, nostack)) }; (val, tid) } @@ -75,59 +73,59 @@ unsafe extern "unadjusted" { /// Calculate the CRC value using the IEEE 802.3 polynomial (0xEDB88320) #[inline] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn crc_w_b_w(a: i32, b: i32) -> i32 { - __crc_w_b_w(a, b) +pub fn crc_w_b_w(a: i32, b: i32) -> i32 { + unsafe { __crc_w_b_w(a, b) } } /// Calculate the CRC value using the IEEE 802.3 polynomial (0xEDB88320) #[inline] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn crc_w_h_w(a: i32, b: i32) -> i32 { - __crc_w_h_w(a, b) +pub fn crc_w_h_w(a: i32, b: i32) -> i32 { + unsafe { __crc_w_h_w(a, b) } } /// Calculate the CRC value using the IEEE 802.3 polynomial (0xEDB88320) #[inline] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn crc_w_w_w(a: i32, b: i32) -> i32 { - __crc_w_w_w(a, b) +pub fn crc_w_w_w(a: i32, b: i32) -> i32 { + unsafe { __crc_w_w_w(a, b) } } /// Calculate the CRC value using the Castagnoli polynomial (0x82F63B78) #[inline] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn crcc_w_b_w(a: i32, b: i32) -> i32 { - __crcc_w_b_w(a, b) +pub fn crcc_w_b_w(a: i32, b: i32) -> i32 { + unsafe { __crcc_w_b_w(a, b) } } /// Calculate the CRC value using the Castagnoli polynomial (0x82F63B78) #[inline] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn crcc_w_h_w(a: i32, b: i32) -> i32 { - __crcc_w_h_w(a, b) +pub fn crcc_w_h_w(a: i32, b: i32) -> i32 { + unsafe { __crcc_w_h_w(a, b) } } /// Calculate the CRC value using the Castagnoli polynomial (0x82F63B78) #[inline] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn crcc_w_w_w(a: i32, b: i32) -> i32 { - __crcc_w_w_w(a, b) +pub fn crcc_w_w_w(a: i32, b: i32) -> i32 { + unsafe { __crcc_w_w_w(a, b) } } /// Generates the memory barrier instruction #[inline] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn dbar() { +pub fn dbar() { static_assert_uimm_bits!(IMM15, 15); - __dbar(IMM15); + unsafe { __dbar(IMM15) }; } /// Generates the instruction-fetch barrier instruction #[inline] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn ibar() { +pub fn ibar() { static_assert_uimm_bits!(IMM15, 15); - __ibar(IMM15); + unsafe { __ibar(IMM15) }; } /// Moves data from a GPR to the FCSR @@ -141,9 +139,9 @@ pub unsafe fn movgr2fcsr(a: i32) { /// Moves data from a FCSR to the GPR #[inline] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn movfcsr2gr() -> i32 { +pub fn movfcsr2gr() -> i32 { static_assert_uimm_bits!(IMM5, 5); - __movfcsr2gr(IMM5) + unsafe { __movfcsr2gr(IMM5) } } /// Reads the 8-bit IO-CSR @@ -199,8 +197,8 @@ pub unsafe fn brk() { /// Reads the CPU configuration register #[inline] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn cpucfg(a: i32) -> i32 { - __cpucfg(a) +pub fn cpucfg(a: i32) -> i32 { + unsafe { __cpucfg(a) } } /// Generates the syscall instruction @@ -215,30 +213,30 @@ pub unsafe fn syscall() { #[inline] #[target_feature(enable = "frecipe")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn frecipe_s(a: f32) -> f32 { - __frecipe_s(a) +pub fn frecipe_s(a: f32) -> f32 { + unsafe { __frecipe_s(a) } } /// Calculate the approximate double-precision result of 1.0 divided #[inline] #[target_feature(enable = "frecipe")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn frecipe_d(a: f64) -> f64 { - __frecipe_d(a) +pub fn frecipe_d(a: f64) -> f64 { + unsafe { __frecipe_d(a) } } /// Calculate the approximate single-precision result of dividing 1.0 by the square root #[inline] #[target_feature(enable = "frecipe")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn frsqrte_s(a: f32) -> f32 { - __frsqrte_s(a) +pub fn frsqrte_s(a: f32) -> f32 { + unsafe { __frsqrte_s(a) } } /// Calculate the approximate double-precision result of dividing 1.0 by the square root #[inline] #[target_feature(enable = "frecipe")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn frsqrte_d(a: f64) -> f64 { - __frsqrte_d(a) +pub fn frsqrte_d(a: f64) -> f64 { + unsafe { __frsqrte_d(a) } } From 194aa89fdd2e627b7842e2f0b7a0db3263613e40 Mon Sep 17 00:00:00 2001 From: Folkert de Vries Date: Wed, 16 Jul 2025 16:50:34 +0200 Subject: [PATCH 048/139] add CI action to check that generated files are correctly checked in --- library/stdarch/.github/workflows/main.yml | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/library/stdarch/.github/workflows/main.yml b/library/stdarch/.github/workflows/main.yml index 8c6dee16fb61..59aad0b5d014 100644 --- a/library/stdarch/.github/workflows/main.yml +++ b/library/stdarch/.github/workflows/main.yml @@ -255,6 +255,28 @@ jobs: env: TARGET: ${{ matrix.target.tuple }} + # Check that the generated files agree with the checked-in versions. + check-stdarch-gen: + needs: [style] + name: Check stdarch-gen-{arm, loongarch} output + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install Rust + run: rustup update nightly && rustup default nightly && rustup component add rustfmt + - name: Check arm spec + run: | + cargo run --bin=stdarch-gen-arm --release -- crates/stdarch-gen-arm/spec + git diff --exit-code + - name: Check lsx.spec + run: | + cargo run --bin=stdarch-gen-loongarch --release -- crates/stdarch-gen-loongarch/lsx.spec + git diff --exit-code + - name: Check lasx.spec + run: | + cargo run --bin=stdarch-gen-loongarch --release -- crates/stdarch-gen-loongarch/lasx.spec + git diff --exit-code + build-std-detect: needs: [style] name: Build std_detect @@ -271,6 +293,7 @@ jobs: - verify - test - build-std-detect + - check-stdarch-gen runs-on: ubuntu-latest # We need to ensure this job does *not* get skipped if its dependencies fail, # because a skipped job is considered a success by GitHub. So we have to From 668fdbe41edba8bda2100a71fe412ab62322b8d5 Mon Sep 17 00:00:00 2001 From: Folkert de Vries Date: Thu, 10 Jul 2025 20:09:46 +0200 Subject: [PATCH 049/139] pass the whole config to C compiler construction --- library/stdarch/Cargo.lock | 4 +- .../crates/intrinsic-test/src/arm/compile.rs | 45 ++++++++++++------- .../crates/intrinsic-test/src/arm/mod.rs | 13 +----- 3 files changed, 31 insertions(+), 31 deletions(-) diff --git a/library/stdarch/Cargo.lock b/library/stdarch/Cargo.lock index 122b3057b2f6..f287ed6e3b73 100644 --- a/library/stdarch/Cargo.lock +++ b/library/stdarch/Cargo.lock @@ -90,9 +90,9 @@ checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967" [[package]] name = "cc" -version = "1.2.29" +version = "1.2.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c1599538de2394445747c8cf7935946e3cc27e9625f889d979bfb2aaf569362" +checksum = "deec109607ca693028562ed836a5f1c4b8bd77755c4e132fc5ce11b0b6211ae7" dependencies = [ "shlex", ] diff --git a/library/stdarch/crates/intrinsic-test/src/arm/compile.rs b/library/stdarch/crates/intrinsic-test/src/arm/compile.rs index 79cd32dedc5f..a90caf367ca6 100644 --- a/library/stdarch/crates/intrinsic-test/src/arm/compile.rs +++ b/library/stdarch/crates/intrinsic-test/src/arm/compile.rs @@ -1,23 +1,23 @@ +use crate::common::cli::ProcessedCli; use crate::common::compile_c::CompilationCommandBuilder; use crate::common::gen_c::compile_c_programs; -pub fn compile_c_arm( - intrinsics_name_list: &[String], - compiler: &str, - target: &str, - cxx_toolchain_dir: Option<&str>, -) -> bool { +pub fn compile_c_arm(config: &ProcessedCli, intrinsics_name_list: &[String]) -> bool { + let Some(ref cpp_compiler) = config.cpp_compiler else { + return true; + }; + // -ffp-contract=off emulates Rust's approach of not fusing separate mul-add operations let mut command = CompilationCommandBuilder::new() .add_arch_flags(vec!["armv8.6-a", "crypto", "crc", "dotprod", "fp16"]) - .set_compiler(compiler) - .set_target(target) + .set_compiler(cpp_compiler) + .set_target(&config.target) .set_opt_level("2") - .set_cxx_toolchain_dir(cxx_toolchain_dir) + .set_cxx_toolchain_dir(config.cxx_toolchain_dir.as_deref()) .set_project_root("c_programs") .add_extra_flags(vec!["-ffp-contract=off", "-Wno-narrowing"]); - if !target.contains("v7") { + if !config.target.contains("v7") { command = command.add_arch_flags(vec!["faminmax", "lut", "sha3"]); } @@ -30,22 +30,33 @@ pub fn compile_c_arm( * does not work as it gets caught up with `#include_next ` * not existing... */ - if target.contains("aarch64_be") { - command = command - .set_linker( - cxx_toolchain_dir.unwrap_or("").to_string() + "/bin/aarch64_be-none-linux-gnu-g++", + if config.target.contains("aarch64_be") { + let Some(ref cxx_toolchain_dir) = config.cxx_toolchain_dir else { + panic!( + "target `{}` must specify `cxx_toolchain_dir`", + config.target ) - .set_include_paths(vec![ + }; + + let linker = if let Some(ref linker) = config.linker { + linker.to_owned() + } else { + format!("{cxx_toolchain_dir}/bin/aarch64_be-none-linux-gnu-g++") + }; + + trace!("using linker: {linker}"); + + command = command.set_linker(linker).set_include_paths(vec![ "/include", "/aarch64_be-none-linux-gnu/include", "/aarch64_be-none-linux-gnu/include/c++/14.3.1", "/aarch64_be-none-linux-gnu/include/c++/14.3.1/aarch64_be-none-linux-gnu", "/aarch64_be-none-linux-gnu/include/c++/14.3.1/backward", "/aarch64_be-none-linux-gnu/libc/usr/include", - ]); + ]); } - if !compiler.contains("clang") { + if !cpp_compiler.contains("clang") { command = command.add_extra_flag("-flax-vector-conversions"); } diff --git a/library/stdarch/crates/intrinsic-test/src/arm/mod.rs b/library/stdarch/crates/intrinsic-test/src/arm/mod.rs index 1a66ed4268da..a2535dc6a7a9 100644 --- a/library/stdarch/crates/intrinsic-test/src/arm/mod.rs +++ b/library/stdarch/crates/intrinsic-test/src/arm/mod.rs @@ -11,7 +11,6 @@ use crate::common::gen_rust::compile_rust_programs; use crate::common::intrinsic::{Intrinsic, IntrinsicDefinition}; use crate::common::intrinsic_helpers::TypeKind; use crate::common::write_file::{write_c_testfiles, write_rust_testfiles}; -use compile::compile_c_arm; use config::{AARCH_CONFIGURATIONS, F16_FORMATTING_DEF, POLY128_OSTREAM_DEF, build_notices}; use intrinsic::ArmIntrinsicType; use json_parser::get_neon_intrinsics; @@ -51,9 +50,7 @@ impl SupportedArchitectureTest for ArmArchitectureTest { } fn build_c_file(&self) -> bool { - let compiler = self.cli_options.cpp_compiler.as_deref(); let target = &self.cli_options.target; - let cxx_toolchain_dir = self.cli_options.cxx_toolchain_dir.as_deref(); let c_target = "aarch64"; let intrinsics_name_list = write_c_testfiles( @@ -69,15 +66,7 @@ impl SupportedArchitectureTest for ArmArchitectureTest { &[POLY128_OSTREAM_DEF], ); - match compiler { - None => true, - Some(compiler) => compile_c_arm( - intrinsics_name_list.as_slice(), - compiler, - target, - cxx_toolchain_dir, - ), - } + compile::compile_c_arm(&self.cli_options, intrinsics_name_list.as_slice()) } fn build_rust_file(&self) -> bool { From 75887cf99557c84ebb64077a1b3f96ad8a597c22 Mon Sep 17 00:00:00 2001 From: Folkert de Vries Date: Thu, 10 Jul 2025 20:30:36 +0200 Subject: [PATCH 050/139] improve cpp compiler execution --- .../crates/intrinsic-test/src/arm/compile.rs | 68 ++++------ .../crates/intrinsic-test/src/arm/mod.rs | 4 +- .../intrinsic-test/src/common/compile_c.rs | 124 +++++++----------- .../crates/intrinsic-test/src/common/gen_c.rs | 40 +++--- 4 files changed, 92 insertions(+), 144 deletions(-) diff --git a/library/stdarch/crates/intrinsic-test/src/arm/compile.rs b/library/stdarch/crates/intrinsic-test/src/arm/compile.rs index a90caf367ca6..48a8ed950e3d 100644 --- a/library/stdarch/crates/intrinsic-test/src/arm/compile.rs +++ b/library/stdarch/crates/intrinsic-test/src/arm/compile.rs @@ -1,11 +1,8 @@ use crate::common::cli::ProcessedCli; -use crate::common::compile_c::CompilationCommandBuilder; -use crate::common::gen_c::compile_c_programs; +use crate::common::compile_c::{CompilationCommandBuilder, CppCompilation}; -pub fn compile_c_arm(config: &ProcessedCli, intrinsics_name_list: &[String]) -> bool { - let Some(ref cpp_compiler) = config.cpp_compiler else { - return true; - }; +pub fn build_cpp_compilation(config: &ProcessedCli) -> Option { + let cpp_compiler = config.cpp_compiler.as_ref()?; // -ffp-contract=off emulates Rust's approach of not fusing separate mul-add operations let mut command = CompilationCommandBuilder::new() @@ -21,15 +18,12 @@ pub fn compile_c_arm(config: &ProcessedCli, intrinsics_name_list: &[String]) -> command = command.add_arch_flags(vec!["faminmax", "lut", "sha3"]); } - /* - * clang++ cannot link an aarch64_be object file, so we invoke - * aarch64_be-unknown-linux-gnu's C++ linker. This ensures that we - * are testing the intrinsics against LLVM. - * - * Note: setting `--sysroot=<...>` which is the obvious thing to do - * does not work as it gets caught up with `#include_next ` - * not existing... - */ + if !cpp_compiler.contains("clang") { + command = command.add_extra_flag("-flax-vector-conversions"); + } + + let mut cpp_compiler = command.into_cpp_compilation(); + if config.target.contains("aarch64_be") { let Some(ref cxx_toolchain_dir) = config.cxx_toolchain_dir else { panic!( @@ -38,38 +32,20 @@ pub fn compile_c_arm(config: &ProcessedCli, intrinsics_name_list: &[String]) -> ) }; - let linker = if let Some(ref linker) = config.linker { - linker.to_owned() - } else { - format!("{cxx_toolchain_dir}/bin/aarch64_be-none-linux-gnu-g++") - }; - - trace!("using linker: {linker}"); - - command = command.set_linker(linker).set_include_paths(vec![ - "/include", - "/aarch64_be-none-linux-gnu/include", - "/aarch64_be-none-linux-gnu/include/c++/14.3.1", - "/aarch64_be-none-linux-gnu/include/c++/14.3.1/aarch64_be-none-linux-gnu", - "/aarch64_be-none-linux-gnu/include/c++/14.3.1/backward", - "/aarch64_be-none-linux-gnu/libc/usr/include", + cpp_compiler.command_mut().args([ + &format!("--sysroot={cxx_toolchain_dir}/aarch64_be-none-linux-gnu/libc"), + "--include-directory", + &format!("{cxx_toolchain_dir}/aarch64_be-none-linux-gnu/include/c++/14.3.1"), + "--include-directory", + &format!("{cxx_toolchain_dir}/aarch64_be-none-linux-gnu/include/c++/14.3.1/aarch64_be-none-linux-gnu"), + "-L", + &format!("{cxx_toolchain_dir}/lib/gcc/aarch64_be-none-linux-gnu/14.3.1"), + "-L", + &format!("{cxx_toolchain_dir}/aarch64_be-none-linux-gnu/libc/usr/lib"), + "-B", + &format!("{cxx_toolchain_dir}/lib/gcc/aarch64_be-none-linux-gnu/14.3.1"), ]); } - if !cpp_compiler.contains("clang") { - command = command.add_extra_flag("-flax-vector-conversions"); - } - - let compiler_commands = intrinsics_name_list - .iter() - .map(|intrinsic_name| { - command - .clone() - .set_input_name(intrinsic_name) - .set_output_name(intrinsic_name) - .make_string() - }) - .collect::>(); - - compile_c_programs(&compiler_commands) + Some(cpp_compiler) } diff --git a/library/stdarch/crates/intrinsic-test/src/arm/mod.rs b/library/stdarch/crates/intrinsic-test/src/arm/mod.rs index a2535dc6a7a9..18530e7e6bd2 100644 --- a/library/stdarch/crates/intrinsic-test/src/arm/mod.rs +++ b/library/stdarch/crates/intrinsic-test/src/arm/mod.rs @@ -7,6 +7,7 @@ mod types; use crate::common::SupportedArchitectureTest; use crate::common::cli::ProcessedCli; use crate::common::compare::compare_outputs; +use crate::common::gen_c::compile_c_programs; use crate::common::gen_rust::compile_rust_programs; use crate::common::intrinsic::{Intrinsic, IntrinsicDefinition}; use crate::common::intrinsic_helpers::TypeKind; @@ -66,7 +67,8 @@ impl SupportedArchitectureTest for ArmArchitectureTest { &[POLY128_OSTREAM_DEF], ); - compile::compile_c_arm(&self.cli_options, intrinsics_name_list.as_slice()) + let pipeline = compile::build_cpp_compilation(&self.cli_options).unwrap(); + compile_c_programs(&pipeline, &intrinsics_name_list) } fn build_rust_file(&self) -> bool { diff --git a/library/stdarch/crates/intrinsic-test/src/common/compile_c.rs b/library/stdarch/crates/intrinsic-test/src/common/compile_c.rs index aebb7b111e28..8e2eb8e0f408 100644 --- a/library/stdarch/crates/intrinsic-test/src/common/compile_c.rs +++ b/library/stdarch/crates/intrinsic-test/src/common/compile_c.rs @@ -5,11 +5,7 @@ pub struct CompilationCommandBuilder { cxx_toolchain_dir: Option, arch_flags: Vec, optimization: String, - include_paths: Vec, project_root: Option, - output: String, - input: String, - linker: Option, extra_flags: Vec, } @@ -21,11 +17,7 @@ impl CompilationCommandBuilder { cxx_toolchain_dir: None, arch_flags: Vec::new(), optimization: "2".to_string(), - include_paths: Vec::new(), project_root: None, - output: String::new(), - input: String::new(), - linker: None, extra_flags: Vec::new(), } } @@ -57,37 +49,12 @@ impl CompilationCommandBuilder { self } - /// Sets a list of include paths for compilation. - /// The paths that are passed must be relative to the - /// "cxx_toolchain_dir" directory path. - pub fn set_include_paths(mut self, paths: Vec<&str>) -> Self { - self.include_paths = paths.into_iter().map(|path| path.to_string()).collect(); - self - } - /// Sets the root path of all the generated test files. pub fn set_project_root(mut self, path: &str) -> Self { self.project_root = Some(path.to_string()); self } - /// The name of the output executable, without any suffixes - pub fn set_output_name(mut self, path: &str) -> Self { - self.output = path.to_string(); - self - } - - /// The name of the input C file, without any suffixes - pub fn set_input_name(mut self, path: &str) -> Self { - self.input = path.to_string(); - self - } - - pub fn set_linker(mut self, linker: String) -> Self { - self.linker = Some(linker); - self - } - pub fn add_extra_flags(mut self, flags: Vec<&str>) -> Self { let mut flags: Vec = flags.into_iter().map(|f| f.to_string()).collect(); self.extra_flags.append(&mut flags); @@ -100,55 +67,56 @@ impl CompilationCommandBuilder { } impl CompilationCommandBuilder { - pub fn make_string(self) -> String { - let arch_flags = self.arch_flags.join("+"); - let flags = std::env::var("CPPFLAGS").unwrap_or("".into()); - let project_root = self.project_root.unwrap_or_default(); - let project_root_str = project_root.as_str(); - let mut output = self.output.clone(); - if self.linker.is_some() { - output += ".o" - }; - let mut command = format!( - "{} {flags} -march={arch_flags} \ - -O{} \ - -o {project_root}/{} \ - {project_root}/{}.cpp", - self.compiler, self.optimization, output, self.input, - ); + pub fn into_cpp_compilation(self) -> CppCompilation { + let mut cpp_compiler = std::process::Command::new(self.compiler); - command = command + " " + self.extra_flags.join(" ").as_str(); + if let Some(project_root) = self.project_root { + cpp_compiler.current_dir(project_root); + } + + let flags = std::env::var("CPPFLAGS").unwrap_or("".into()); + cpp_compiler.args(flags.split_whitespace()); + + cpp_compiler.arg(format!("-march={}", self.arch_flags.join("+"))); + + cpp_compiler.arg(format!("-O{}", self.optimization)); + + cpp_compiler.args(self.extra_flags); if let Some(target) = &self.target { - command = command + " --target=" + target; + cpp_compiler.arg(format!("--target={target}")); } - if let (Some(linker), Some(cxx_toolchain_dir)) = (&self.linker, &self.cxx_toolchain_dir) { - let include_args = self - .include_paths - .iter() - .map(|path| "--include-directory=".to_string() + cxx_toolchain_dir + path) - .collect::>() - .join(" "); - - command = command - + " -c " - + include_args.as_str() - + " && " - + linker - + " " - + project_root_str - + "/" - + &output - + " -o " - + project_root_str - + "/" - + &self.output - + " && rm " - + project_root_str - + "/" - + &output; - } - command + CppCompilation(cpp_compiler) + } +} + +pub struct CppCompilation(std::process::Command); + +fn clone_command(command: &std::process::Command) -> std::process::Command { + let mut cmd = std::process::Command::new(command.get_program()); + if let Some(current_dir) = command.get_current_dir() { + cmd.current_dir(current_dir); + } + cmd.args(command.get_args()); + + for (key, val) in command.get_envs() { + cmd.env(key, val.unwrap_or_default()); + } + + cmd +} + +impl CppCompilation { + pub fn command_mut(&mut self) -> &mut std::process::Command { + &mut self.0 + } + + pub fn run(&self, inputs: &[String], output: &str) -> std::io::Result { + let mut cmd = clone_command(&self.0); + cmd.args(inputs); + cmd.args(["-o", output]); + + cmd.output() } } diff --git a/library/stdarch/crates/intrinsic-test/src/common/gen_c.rs b/library/stdarch/crates/intrinsic-test/src/common/gen_c.rs index 1cfb66c39b90..84167f2f4aef 100644 --- a/library/stdarch/crates/intrinsic-test/src/common/gen_c.rs +++ b/library/stdarch/crates/intrinsic-test/src/common/gen_c.rs @@ -1,7 +1,8 @@ use itertools::Itertools; use rayon::prelude::*; use std::collections::BTreeMap; -use std::process::Command; + +use crate::common::compile_c::CppCompilation; use super::argument::Argument; use super::indentation::Indentation; @@ -62,29 +63,30 @@ int main(int argc, char **argv) {{ ) } -pub fn compile_c_programs(compiler_commands: &[String]) -> bool { - compiler_commands +pub fn compile_c_programs(pipeline: &CppCompilation, intrinsics: &[String]) -> bool { + intrinsics .par_iter() - .map(|compiler_command| { - let output = Command::new("sh").arg("-c").arg(compiler_command).output(); - if let Ok(output) = output { - if output.status.success() { - true - } else { - error!( - "Failed to compile code for intrinsics: \n\nstdout:\n{}\n\nstderr:\n{}", + .map( + |intrinsic| match pipeline.run(&[format!("{intrinsic}.cpp")], intrinsic) { + Ok(output) if output.status.success() => Ok(()), + Ok(output) => { + let msg = format!( + "Failed to compile code for intrinsic `{intrinsic}`: \n\nstdout:\n{}\n\nstderr:\n{}", std::str::from_utf8(&output.stdout).unwrap_or(""), std::str::from_utf8(&output.stderr).unwrap_or("") ); - false + error!("{msg}"); + + Err(msg) } - } else { - error!("Command failed: {output:#?}"); - false - } - }) - .find_any(|x| !x) - .is_none() + Err(e) => { + error!("command for `{intrinsic}` failed with IO error: {e:?}"); + Err(e.to_string()) + } + }, + ) + .collect::>() + .is_ok() } // Creates directory structure and file path mappings From 4e53043395b747b267bee975080896fb781fe19f Mon Sep 17 00:00:00 2001 From: bit-aloo Date: Fri, 18 Jul 2025 15:46:00 +0530 Subject: [PATCH 051/139] populate the target_config now before its usage and update the test accordingly --- src/bootstrap/src/core/builder/tests.rs | 2 ++ src/bootstrap/src/core/config/config.rs | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/bootstrap/src/core/builder/tests.rs b/src/bootstrap/src/core/builder/tests.rs index 51a906496923..7f0c6fbd8545 100644 --- a/src/bootstrap/src/core/builder/tests.rs +++ b/src/bootstrap/src/core/builder/tests.rs @@ -1638,6 +1638,7 @@ mod snapshot { .render_steps(), @r" [build] llvm [build] rustc 0 -> rustc 1 + [build] rustc 0 -> LldWrapper 1 [build] rustdoc 0 [doc] std 1 crates=[core] "); @@ -1653,6 +1654,7 @@ mod snapshot { .render_steps(), @r" [build] llvm [build] rustc 0 -> rustc 1 + [build] rustc 0 -> LldWrapper 1 [build] rustdoc 0 [doc] std 1 crates=[alloc,core] "); diff --git a/src/bootstrap/src/core/config/config.rs b/src/bootstrap/src/core/config/config.rs index 22a75183404f..6e04f1154243 100644 --- a/src/bootstrap/src/core/config/config.rs +++ b/src/bootstrap/src/core/config/config.rs @@ -942,6 +942,7 @@ impl Config { config.rust_profile_use = flags_rust_profile_use; config.rust_profile_generate = flags_rust_profile_generate; + config.apply_target_config(toml.target); config.apply_rust_config(toml.rust, flags_warnings); config.reproducible_artifacts = flags_reproducible_artifact; @@ -967,8 +968,6 @@ impl Config { config.apply_gcc_config(toml.gcc); - config.apply_target_config(toml.target); - match ccache { Some(StringOrBool::String(ref s)) => config.ccache = Some(s.to_string()), Some(StringOrBool::Bool(true)) => { From 6ed7ee36e6839036b3e6d8b3a2d2f30310ddbfc6 Mon Sep 17 00:00:00 2001 From: Folkert de Vries Date: Fri, 11 Jul 2025 01:25:52 +0200 Subject: [PATCH 052/139] exclude generated rust programs from the workspace --- library/stdarch/Cargo.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/library/stdarch/Cargo.toml b/library/stdarch/Cargo.toml index 0db26f31a2d3..597909643911 100644 --- a/library/stdarch/Cargo.toml +++ b/library/stdarch/Cargo.toml @@ -5,7 +5,8 @@ members = [ "examples", ] exclude = [ - "crates/wasm-assert-instr-tests" + "crates/wasm-assert-instr-tests", + "rust_programs", ] [profile.release] From 846c591bf60c551fc779ab8a489e9d7a74dab446 Mon Sep 17 00:00:00 2001 From: Folkert de Vries Date: Fri, 11 Jul 2025 01:26:34 +0200 Subject: [PATCH 053/139] `intrinsic-test`: combine C files for more efficient compilation --- .../crates/intrinsic-test/src/arm/mod.rs | 80 ++++- .../intrinsic-test/src/common/argument.rs | 30 +- .../intrinsic-test/src/common/compare.rs | 4 +- .../intrinsic-test/src/common/compile_c.rs | 17 +- .../crates/intrinsic-test/src/common/gen_c.rs | 325 +++++++++--------- .../intrinsic-test/src/common/write_file.rs | 33 -- 6 files changed, 259 insertions(+), 230 deletions(-) diff --git a/library/stdarch/crates/intrinsic-test/src/arm/mod.rs b/library/stdarch/crates/intrinsic-test/src/arm/mod.rs index 18530e7e6bd2..0a64a24e7313 100644 --- a/library/stdarch/crates/intrinsic-test/src/arm/mod.rs +++ b/library/stdarch/crates/intrinsic-test/src/arm/mod.rs @@ -4,15 +4,20 @@ mod intrinsic; mod json_parser; mod types; +use std::fs::File; + +use rayon::prelude::*; + +use crate::arm::config::POLY128_OSTREAM_DEF; use crate::common::SupportedArchitectureTest; use crate::common::cli::ProcessedCli; use crate::common::compare::compare_outputs; -use crate::common::gen_c::compile_c_programs; +use crate::common::gen_c::{write_main_cpp, write_mod_cpp}; use crate::common::gen_rust::compile_rust_programs; use crate::common::intrinsic::{Intrinsic, IntrinsicDefinition}; use crate::common::intrinsic_helpers::TypeKind; -use crate::common::write_file::{write_c_testfiles, write_rust_testfiles}; -use config::{AARCH_CONFIGURATIONS, F16_FORMATTING_DEF, POLY128_OSTREAM_DEF, build_notices}; +use crate::common::write_file::write_rust_testfiles; +use config::{AARCH_CONFIGURATIONS, F16_FORMATTING_DEF, build_notices}; use intrinsic::ArmIntrinsicType; use json_parser::get_neon_intrinsics; @@ -21,6 +26,13 @@ pub struct ArmArchitectureTest { cli_options: ProcessedCli, } +fn chunk_info(intrinsic_count: usize) -> (usize, usize) { + let available_parallelism = std::thread::available_parallelism().unwrap().get(); + let chunk_size = intrinsic_count.div_ceil(Ord::min(available_parallelism, intrinsic_count)); + + (chunk_size, intrinsic_count.div_ceil(chunk_size)) +} + impl SupportedArchitectureTest for ArmArchitectureTest { fn create(cli_options: ProcessedCli) -> Box { let a32 = cli_options.target.contains("v7"); @@ -51,24 +63,58 @@ impl SupportedArchitectureTest for ArmArchitectureTest { } fn build_c_file(&self) -> bool { - let target = &self.cli_options.target; let c_target = "aarch64"; + let platform_headers = &["arm_neon.h", "arm_acle.h", "arm_fp16.h"]; - let intrinsics_name_list = write_c_testfiles( - &self - .intrinsics - .iter() - .map(|i| i as &dyn IntrinsicDefinition<_>) - .collect::>(), - target, + let (chunk_size, chunk_count) = chunk_info(self.intrinsics.len()); + + let cpp_compiler = compile::build_cpp_compilation(&self.cli_options).unwrap(); + + let notice = &build_notices("// "); + self.intrinsics + .par_chunks(chunk_size) + .enumerate() + .map(|(i, chunk)| { + let c_filename = format!("c_programs/mod_{i}.cpp"); + let mut file = File::create(&c_filename).unwrap(); + write_mod_cpp(&mut file, notice, c_target, platform_headers, chunk).unwrap(); + + // compile this cpp file into a .o file + let output = cpp_compiler + .compile_object_file(&format!("mod_{i}.cpp"), &format!("mod_{i}.o"))?; + assert!(output.status.success(), "{output:?}"); + + Ok(()) + }) + .collect::>() + .unwrap(); + + let mut file = File::create("c_programs/main.cpp").unwrap(); + write_main_cpp( + &mut file, c_target, - &["arm_neon.h", "arm_acle.h", "arm_fp16.h"], - &build_notices("// "), - &[POLY128_OSTREAM_DEF], - ); + POLY128_OSTREAM_DEF, + self.intrinsics.iter().map(|i| i.name.as_str()), + ) + .unwrap(); - let pipeline = compile::build_cpp_compilation(&self.cli_options).unwrap(); - compile_c_programs(&pipeline, &intrinsics_name_list) + // compile this cpp file into a .o file + info!("compiling main.cpp"); + let output = cpp_compiler + .compile_object_file("main.cpp", "intrinsic-test-programs.o") + .unwrap(); + assert!(output.status.success(), "{output:?}"); + + let object_files = (0..chunk_count) + .map(|i| format!("mod_{i}.o")) + .chain(["intrinsic-test-programs.o".to_owned()]); + + let output = cpp_compiler + .link_executable(object_files, "intrinsic-test-programs") + .unwrap(); + assert!(output.status.success(), "{output:?}"); + + true } fn build_rust_file(&self) -> bool { diff --git a/library/stdarch/crates/intrinsic-test/src/common/argument.rs b/library/stdarch/crates/intrinsic-test/src/common/argument.rs index 443ccb919f46..338f0d344a7d 100644 --- a/library/stdarch/crates/intrinsic-test/src/common/argument.rs +++ b/library/stdarch/crates/intrinsic-test/src/common/argument.rs @@ -125,19 +125,23 @@ where /// Creates a line for each argument that initializes an array for C from which `loads` argument /// values can be loaded as a sliding window. /// e.g `const int32x2_t a_vals = {0x3effffff, 0x3effffff, 0x3f7fffff}`, if loads=2. - pub fn gen_arglists_c(&self, indentation: Indentation, loads: u32) -> String { - self.iter() - .filter(|&arg| !arg.has_constraint()) - .map(|arg| { - format!( - "{indentation}const {ty} {name}_vals[] = {values};", - ty = arg.ty.c_scalar_type(), - name = arg.name, - values = arg.ty.populate_random(indentation, loads, &Language::C) - ) - }) - .collect::>() - .join("\n") + pub fn gen_arglists_c( + &self, + w: &mut impl std::io::Write, + indentation: Indentation, + loads: u32, + ) -> std::io::Result<()> { + for arg in self.iter().filter(|&arg| !arg.has_constraint()) { + writeln!( + w, + "{indentation}const {ty} {name}_vals[] = {values};", + ty = arg.ty.c_scalar_type(), + name = arg.name, + values = arg.ty.populate_random(indentation, loads, &Language::C) + )? + } + + Ok(()) } /// Creates a line for each argument that initializes an array for Rust from which `loads` argument diff --git a/library/stdarch/crates/intrinsic-test/src/common/compare.rs b/library/stdarch/crates/intrinsic-test/src/common/compare.rs index f16d83b0264b..cb55922eb199 100644 --- a/library/stdarch/crates/intrinsic-test/src/common/compare.rs +++ b/library/stdarch/crates/intrinsic-test/src/common/compare.rs @@ -15,12 +15,12 @@ pub fn compare_outputs(intrinsic_name_list: &Vec, runner: &str, target: .par_iter() .filter_map(|intrinsic_name| { let c = runner_command(runner) - .arg(format!("./c_programs/{intrinsic_name}")) + .arg("./c_programs/intrinsic-test-programs") + .arg(intrinsic_name) .output(); let rust = runner_command(runner) .arg(format!("target/{target}/release/{intrinsic_name}")) - .env("RUSTFLAGS", "-Cdebuginfo=0") .output(); let (c, rust) = match (c, rust) { diff --git a/library/stdarch/crates/intrinsic-test/src/common/compile_c.rs b/library/stdarch/crates/intrinsic-test/src/common/compile_c.rs index 8e2eb8e0f408..0c905a149e48 100644 --- a/library/stdarch/crates/intrinsic-test/src/common/compile_c.rs +++ b/library/stdarch/crates/intrinsic-test/src/common/compile_c.rs @@ -112,11 +112,24 @@ impl CppCompilation { &mut self.0 } - pub fn run(&self, inputs: &[String], output: &str) -> std::io::Result { + pub fn compile_object_file( + &self, + input: &str, + output: &str, + ) -> std::io::Result { + let mut cmd = clone_command(&self.0); + cmd.args([input, "-c", "-o", output]); + cmd.output() + } + + pub fn link_executable( + &self, + inputs: impl Iterator, + output: &str, + ) -> std::io::Result { let mut cmd = clone_command(&self.0); cmd.args(inputs); cmd.args(["-o", output]); - cmd.output() } } diff --git a/library/stdarch/crates/intrinsic-test/src/common/gen_c.rs b/library/stdarch/crates/intrinsic-test/src/common/gen_c.rs index 84167f2f4aef..905efb6d8909 100644 --- a/library/stdarch/crates/intrinsic-test/src/common/gen_c.rs +++ b/library/stdarch/crates/intrinsic-test/src/common/gen_c.rs @@ -1,9 +1,3 @@ -use itertools::Itertools; -use rayon::prelude::*; -use std::collections::BTreeMap; - -use crate::common::compile_c::CppCompilation; - use super::argument::Argument; use super::indentation::Indentation; use super::intrinsic::IntrinsicDefinition; @@ -12,105 +6,16 @@ use super::intrinsic_helpers::IntrinsicTypeDefinition; // The number of times each intrinsic will be called. const PASSES: u32 = 20; -// Formats the main C program template with placeholders -pub fn format_c_main_template( - notices: &str, - header_files: &[&str], - arch_identifier: &str, - arch_specific_definitions: &[&str], - arglists: &str, - passes: &str, -) -> String { - format!( - r#"{notices}{header_files} -#include -#include -#include -#include - -template T1 cast(T2 x) {{ - static_assert(sizeof(T1) == sizeof(T2), "sizeof T1 and T2 must be the same"); - T1 ret{{}}; - memcpy(&ret, &x, sizeof(T1)); - return ret; -}} - -std::ostream& operator<<(std::ostream& os, float16_t value) {{ - uint16_t temp = 0; - memcpy(&temp, &value, sizeof(float16_t)); - std::stringstream ss; - ss << "0x" << std::setfill('0') << std::setw(4) << std::hex << temp; - os << ss.str(); - return os; -}} - -#ifdef __{arch_identifier}__ -{arch_specific_definitions} -#endif - -{arglists} - -int main(int argc, char **argv) {{ -{passes} - return 0; -}}"#, - header_files = header_files - .iter() - .map(|header| format!("#include <{header}>")) - .collect::>() - .join("\n"), - arch_specific_definitions = arch_specific_definitions.join("\n"), - ) -} - -pub fn compile_c_programs(pipeline: &CppCompilation, intrinsics: &[String]) -> bool { - intrinsics - .par_iter() - .map( - |intrinsic| match pipeline.run(&[format!("{intrinsic}.cpp")], intrinsic) { - Ok(output) if output.status.success() => Ok(()), - Ok(output) => { - let msg = format!( - "Failed to compile code for intrinsic `{intrinsic}`: \n\nstdout:\n{}\n\nstderr:\n{}", - std::str::from_utf8(&output.stdout).unwrap_or(""), - std::str::from_utf8(&output.stderr).unwrap_or("") - ); - error!("{msg}"); - - Err(msg) - } - Err(e) => { - error!("command for `{intrinsic}` failed with IO error: {e:?}"); - Err(e.to_string()) - } - }, - ) - .collect::>() - .is_ok() -} - -// Creates directory structure and file path mappings -pub fn setup_c_file_paths(identifiers: &Vec) -> BTreeMap<&String, String> { - let _ = std::fs::create_dir("c_programs"); - identifiers - .par_iter() - .map(|identifier| { - let c_filename = format!(r#"c_programs/{identifier}.cpp"#); - - (identifier, c_filename) - }) - .collect::>() -} - pub fn generate_c_test_loop( + w: &mut impl std::io::Write, intrinsic: &dyn IntrinsicDefinition, indentation: Indentation, additional: &str, passes: u32, - _target: &str, -) -> String { +) -> std::io::Result<()> { let body_indentation = indentation.nested(); - format!( + writeln!( + w, "{indentation}for (int i=0; i<{passes}; i++) {{\n\ {loaded_args}\ {body_indentation}auto __return_value = {intrinsic_call}({args});\n\ @@ -123,78 +28,172 @@ pub fn generate_c_test_loop( ) } -pub fn generate_c_constraint_blocks( +pub fn generate_c_constraint_blocks<'a, T: IntrinsicTypeDefinition + 'a>( + w: &mut impl std::io::Write, intrinsic: &dyn IntrinsicDefinition, indentation: Indentation, - constraints: &[&Argument], + constraints: &mut (impl Iterator> + Clone), name: String, - target: &str, -) -> String { - if let Some((current, constraints)) = constraints.split_last() { - let range = current - .constraint - .iter() - .map(|c| c.to_range()) - .flat_map(|r| r.into_iter()); +) -> std::io::Result<()> { + let Some(current) = constraints.next() else { + return generate_c_test_loop(w, intrinsic, indentation, &name, PASSES); + }; - let body_indentation = indentation.nested(); - range - .map(|i| { - format!( - "{indentation}{{\n\ - {body_indentation}{ty} {name} = {val};\n\ - {pass}\n\ - {indentation}}}", - name = current.name, - ty = current.ty.c_type(), - val = i, - pass = generate_c_constraint_blocks( - intrinsic, - body_indentation, - constraints, - format!("{name}-{i}"), - target, - ) - ) - }) - .join("\n") - } else { - generate_c_test_loop(intrinsic, indentation, &name, PASSES, target) + let body_indentation = indentation.nested(); + for i in current.constraint.iter().flat_map(|c| c.to_range()) { + let ty = current.ty.c_type(); + + writeln!(w, "{indentation}{{")?; + writeln!(w, "{body_indentation}{ty} {} = {i};", current.name)?; + + generate_c_constraint_blocks( + w, + intrinsic, + body_indentation, + &mut constraints.clone(), + format!("{name}-{i}"), + )?; + + writeln!(w, "{indentation}}}")?; } + + Ok(()) } // Compiles C test programs using specified compiler -pub fn create_c_test_program( +pub fn create_c_test_function( + w: &mut impl std::io::Write, intrinsic: &dyn IntrinsicDefinition, - header_files: &[&str], - target: &str, - c_target: &str, - notices: &str, - arch_specific_definitions: &[&str], -) -> String { - let arguments = intrinsic.arguments(); - let constraints = arguments - .iter() - .filter(|&i| i.has_constraint()) - .collect_vec(); - +) -> std::io::Result<()> { let indentation = Indentation::default(); - format_c_main_template( - notices, - header_files, - c_target, - arch_specific_definitions, - intrinsic - .arguments() - .gen_arglists_c(indentation, PASSES) - .as_str(), - generate_c_constraint_blocks( - intrinsic, - indentation.nested(), - constraints.as_slice(), - Default::default(), - target, - ) - .as_str(), - ) + + writeln!(w, "int run_{}() {{", intrinsic.name())?; + + // Define the arrays of arguments. + let arguments = intrinsic.arguments(); + arguments.gen_arglists_c(w, indentation.nested(), PASSES)?; + + generate_c_constraint_blocks( + w, + intrinsic, + indentation.nested(), + &mut arguments.iter().rev().filter(|&i| i.has_constraint()), + Default::default(), + )?; + + writeln!(w, " return 0;")?; + writeln!(w, "}}")?; + + Ok(()) +} + +pub fn write_mod_cpp( + w: &mut impl std::io::Write, + notice: &str, + architecture: &str, + platform_headers: &[&str], + intrinsics: &[impl IntrinsicDefinition], +) -> std::io::Result<()> { + write!(w, "{notice}")?; + + for header in platform_headers { + writeln!(w, "#include <{header}>")?; + } + + writeln!( + w, + r#" +#include +#include +#include +#include + +template T1 cast(T2 x) {{ + static_assert(sizeof(T1) == sizeof(T2), "sizeof T1 and T2 must be the same"); + T1 ret{{}}; + memcpy(&ret, &x, sizeof(T1)); + return ret; +}} + +std::ostream& operator<<(std::ostream& os, float16_t value); + + + +"# + )?; + + writeln!(w, "#ifdef __{architecture}__")?; + writeln!( + w, + "std::ostream& operator<<(std::ostream& os, poly128_t value);" + )?; + writeln!(w, "#endif")?; + + for intrinsic in intrinsics { + create_c_test_function(w, intrinsic)?; + } + + Ok(()) +} + +pub fn write_main_cpp<'a>( + w: &mut impl std::io::Write, + architecture: &str, + arch_specific_definitions: &str, + intrinsics: impl Iterator + Clone, +) -> std::io::Result<()> { + writeln!(w, "#include ")?; + writeln!(w, "#include ")?; + + for header in ["arm_neon.h", "arm_acle.h", "arm_fp16.h"] { + writeln!(w, "#include <{header}>")?; + } + + writeln!( + w, + r#" +#include +#include +#include + +std::ostream& operator<<(std::ostream& os, float16_t value) {{ + uint16_t temp = 0; + memcpy(&temp, &value, sizeof(float16_t)); + std::stringstream ss; + ss << "0x" << std::setfill('0') << std::setw(4) << std::hex << temp; + os << ss.str(); + return os; +}} +"# + )?; + + writeln!(w, "#ifdef __{architecture}__")?; + writeln!(w, "{arch_specific_definitions }")?; + writeln!(w, "#endif")?; + + for intrinsic in intrinsics.clone() { + writeln!(w, "extern int run_{intrinsic}(void);")?; + } + + writeln!(w, "int main(int argc, char **argv) {{")?; + writeln!(w, " std::string intrinsic_name = argv[1];")?; + + writeln!(w, " if (false) {{")?; + + for intrinsic in intrinsics { + writeln!(w, " }} else if (intrinsic_name == \"{intrinsic}\") {{")?; + writeln!(w, " return run_{intrinsic}();")?; + } + + writeln!(w, " }} else {{")?; + writeln!( + w, + " std::cerr << \"Unknown command: \" << intrinsic_name << \"\\n\";" + )?; + writeln!(w, " return -1;")?; + writeln!(w, " }}")?; + + writeln!(w, "}}")?; + + Ok(()) } diff --git a/library/stdarch/crates/intrinsic-test/src/common/write_file.rs b/library/stdarch/crates/intrinsic-test/src/common/write_file.rs index 0ba3e829a6b8..92dd70b7c578 100644 --- a/library/stdarch/crates/intrinsic-test/src/common/write_file.rs +++ b/library/stdarch/crates/intrinsic-test/src/common/write_file.rs @@ -1,5 +1,3 @@ -use super::gen_c::create_c_test_program; -use super::gen_c::setup_c_file_paths; use super::gen_rust::{create_rust_test_program, setup_rust_file_paths}; use super::intrinsic::IntrinsicDefinition; use super::intrinsic_helpers::IntrinsicTypeDefinition; @@ -11,37 +9,6 @@ pub fn write_file(filename: &String, code: String) { file.write_all(code.into_bytes().as_slice()).unwrap(); } -pub fn write_c_testfiles( - intrinsics: &Vec<&dyn IntrinsicDefinition>, - target: &str, - c_target: &str, - headers: &[&str], - notice: &str, - arch_specific_definitions: &[&str], -) -> Vec { - let intrinsics_name_list = intrinsics - .iter() - .map(|i| i.name().clone()) - .collect::>(); - let filename_mapping = setup_c_file_paths(&intrinsics_name_list); - - intrinsics.iter().for_each(|&i| { - let c_code = create_c_test_program( - i, - headers, - target, - c_target, - notice, - arch_specific_definitions, - ); - if let Some(filename) = filename_mapping.get(&i.name()) { - write_file(filename, c_code) - }; - }); - - intrinsics_name_list -} - pub fn write_rust_testfiles( intrinsics: Vec<&dyn IntrinsicDefinition>, rust_target: &str, From da892b54be8ad0998e0003aaf9ae2dbb85ea11b4 Mon Sep 17 00:00:00 2001 From: WANG Rui Date: Sat, 28 Jun 2025 13:37:41 +0800 Subject: [PATCH 054/139] loongarch: Mark SIMD intrinsics without memory access as safe --- .../src/loongarch64/lasx/generated.rs | 2912 ++++++++--------- .../src/loongarch64/lsx/generated.rs | 2832 ++++++++-------- .../crates/stdarch-gen-loongarch/README.md | 2 - .../crates/stdarch-gen-loongarch/src/main.rs | 46 +- 4 files changed, 2901 insertions(+), 2891 deletions(-) diff --git a/library/stdarch/crates/core_arch/src/loongarch64/lasx/generated.rs b/library/stdarch/crates/core_arch/src/loongarch64/lasx/generated.rs index 2e56d8fb9b83..4361acdc1fcc 100644 --- a/library/stdarch/crates/core_arch/src/loongarch64/lasx/generated.rs +++ b/library/stdarch/crates/core_arch/src/loongarch64/lasx/generated.rs @@ -1495,3501 +1495,3501 @@ unsafe extern "unadjusted" { #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsll_b(a: v32i8, b: v32i8) -> v32i8 { - __lasx_xvsll_b(a, b) +pub fn lasx_xvsll_b(a: v32i8, b: v32i8) -> v32i8 { + unsafe { __lasx_xvsll_b(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsll_h(a: v16i16, b: v16i16) -> v16i16 { - __lasx_xvsll_h(a, b) +pub fn lasx_xvsll_h(a: v16i16, b: v16i16) -> v16i16 { + unsafe { __lasx_xvsll_h(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsll_w(a: v8i32, b: v8i32) -> v8i32 { - __lasx_xvsll_w(a, b) +pub fn lasx_xvsll_w(a: v8i32, b: v8i32) -> v8i32 { + unsafe { __lasx_xvsll_w(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsll_d(a: v4i64, b: v4i64) -> v4i64 { - __lasx_xvsll_d(a, b) +pub fn lasx_xvsll_d(a: v4i64, b: v4i64) -> v4i64 { + unsafe { __lasx_xvsll_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvslli_b(a: v32i8) -> v32i8 { +pub fn lasx_xvslli_b(a: v32i8) -> v32i8 { static_assert_uimm_bits!(IMM3, 3); - __lasx_xvslli_b(a, IMM3) + unsafe { __lasx_xvslli_b(a, IMM3) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvslli_h(a: v16i16) -> v16i16 { +pub fn lasx_xvslli_h(a: v16i16) -> v16i16 { static_assert_uimm_bits!(IMM4, 4); - __lasx_xvslli_h(a, IMM4) + unsafe { __lasx_xvslli_h(a, IMM4) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvslli_w(a: v8i32) -> v8i32 { +pub fn lasx_xvslli_w(a: v8i32) -> v8i32 { static_assert_uimm_bits!(IMM5, 5); - __lasx_xvslli_w(a, IMM5) + unsafe { __lasx_xvslli_w(a, IMM5) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvslli_d(a: v4i64) -> v4i64 { +pub fn lasx_xvslli_d(a: v4i64) -> v4i64 { static_assert_uimm_bits!(IMM6, 6); - __lasx_xvslli_d(a, IMM6) + unsafe { __lasx_xvslli_d(a, IMM6) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsra_b(a: v32i8, b: v32i8) -> v32i8 { - __lasx_xvsra_b(a, b) +pub fn lasx_xvsra_b(a: v32i8, b: v32i8) -> v32i8 { + unsafe { __lasx_xvsra_b(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsra_h(a: v16i16, b: v16i16) -> v16i16 { - __lasx_xvsra_h(a, b) +pub fn lasx_xvsra_h(a: v16i16, b: v16i16) -> v16i16 { + unsafe { __lasx_xvsra_h(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsra_w(a: v8i32, b: v8i32) -> v8i32 { - __lasx_xvsra_w(a, b) +pub fn lasx_xvsra_w(a: v8i32, b: v8i32) -> v8i32 { + unsafe { __lasx_xvsra_w(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsra_d(a: v4i64, b: v4i64) -> v4i64 { - __lasx_xvsra_d(a, b) +pub fn lasx_xvsra_d(a: v4i64, b: v4i64) -> v4i64 { + unsafe { __lasx_xvsra_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsrai_b(a: v32i8) -> v32i8 { +pub fn lasx_xvsrai_b(a: v32i8) -> v32i8 { static_assert_uimm_bits!(IMM3, 3); - __lasx_xvsrai_b(a, IMM3) + unsafe { __lasx_xvsrai_b(a, IMM3) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsrai_h(a: v16i16) -> v16i16 { +pub fn lasx_xvsrai_h(a: v16i16) -> v16i16 { static_assert_uimm_bits!(IMM4, 4); - __lasx_xvsrai_h(a, IMM4) + unsafe { __lasx_xvsrai_h(a, IMM4) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsrai_w(a: v8i32) -> v8i32 { +pub fn lasx_xvsrai_w(a: v8i32) -> v8i32 { static_assert_uimm_bits!(IMM5, 5); - __lasx_xvsrai_w(a, IMM5) + unsafe { __lasx_xvsrai_w(a, IMM5) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsrai_d(a: v4i64) -> v4i64 { +pub fn lasx_xvsrai_d(a: v4i64) -> v4i64 { static_assert_uimm_bits!(IMM6, 6); - __lasx_xvsrai_d(a, IMM6) + unsafe { __lasx_xvsrai_d(a, IMM6) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsrar_b(a: v32i8, b: v32i8) -> v32i8 { - __lasx_xvsrar_b(a, b) +pub fn lasx_xvsrar_b(a: v32i8, b: v32i8) -> v32i8 { + unsafe { __lasx_xvsrar_b(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsrar_h(a: v16i16, b: v16i16) -> v16i16 { - __lasx_xvsrar_h(a, b) +pub fn lasx_xvsrar_h(a: v16i16, b: v16i16) -> v16i16 { + unsafe { __lasx_xvsrar_h(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsrar_w(a: v8i32, b: v8i32) -> v8i32 { - __lasx_xvsrar_w(a, b) +pub fn lasx_xvsrar_w(a: v8i32, b: v8i32) -> v8i32 { + unsafe { __lasx_xvsrar_w(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsrar_d(a: v4i64, b: v4i64) -> v4i64 { - __lasx_xvsrar_d(a, b) +pub fn lasx_xvsrar_d(a: v4i64, b: v4i64) -> v4i64 { + unsafe { __lasx_xvsrar_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsrari_b(a: v32i8) -> v32i8 { +pub fn lasx_xvsrari_b(a: v32i8) -> v32i8 { static_assert_uimm_bits!(IMM3, 3); - __lasx_xvsrari_b(a, IMM3) + unsafe { __lasx_xvsrari_b(a, IMM3) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsrari_h(a: v16i16) -> v16i16 { +pub fn lasx_xvsrari_h(a: v16i16) -> v16i16 { static_assert_uimm_bits!(IMM4, 4); - __lasx_xvsrari_h(a, IMM4) + unsafe { __lasx_xvsrari_h(a, IMM4) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsrari_w(a: v8i32) -> v8i32 { +pub fn lasx_xvsrari_w(a: v8i32) -> v8i32 { static_assert_uimm_bits!(IMM5, 5); - __lasx_xvsrari_w(a, IMM5) + unsafe { __lasx_xvsrari_w(a, IMM5) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsrari_d(a: v4i64) -> v4i64 { +pub fn lasx_xvsrari_d(a: v4i64) -> v4i64 { static_assert_uimm_bits!(IMM6, 6); - __lasx_xvsrari_d(a, IMM6) + unsafe { __lasx_xvsrari_d(a, IMM6) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsrl_b(a: v32i8, b: v32i8) -> v32i8 { - __lasx_xvsrl_b(a, b) +pub fn lasx_xvsrl_b(a: v32i8, b: v32i8) -> v32i8 { + unsafe { __lasx_xvsrl_b(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsrl_h(a: v16i16, b: v16i16) -> v16i16 { - __lasx_xvsrl_h(a, b) +pub fn lasx_xvsrl_h(a: v16i16, b: v16i16) -> v16i16 { + unsafe { __lasx_xvsrl_h(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsrl_w(a: v8i32, b: v8i32) -> v8i32 { - __lasx_xvsrl_w(a, b) +pub fn lasx_xvsrl_w(a: v8i32, b: v8i32) -> v8i32 { + unsafe { __lasx_xvsrl_w(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsrl_d(a: v4i64, b: v4i64) -> v4i64 { - __lasx_xvsrl_d(a, b) +pub fn lasx_xvsrl_d(a: v4i64, b: v4i64) -> v4i64 { + unsafe { __lasx_xvsrl_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsrli_b(a: v32i8) -> v32i8 { +pub fn lasx_xvsrli_b(a: v32i8) -> v32i8 { static_assert_uimm_bits!(IMM3, 3); - __lasx_xvsrli_b(a, IMM3) + unsafe { __lasx_xvsrli_b(a, IMM3) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsrli_h(a: v16i16) -> v16i16 { +pub fn lasx_xvsrli_h(a: v16i16) -> v16i16 { static_assert_uimm_bits!(IMM4, 4); - __lasx_xvsrli_h(a, IMM4) + unsafe { __lasx_xvsrli_h(a, IMM4) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsrli_w(a: v8i32) -> v8i32 { +pub fn lasx_xvsrli_w(a: v8i32) -> v8i32 { static_assert_uimm_bits!(IMM5, 5); - __lasx_xvsrli_w(a, IMM5) + unsafe { __lasx_xvsrli_w(a, IMM5) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsrli_d(a: v4i64) -> v4i64 { +pub fn lasx_xvsrli_d(a: v4i64) -> v4i64 { static_assert_uimm_bits!(IMM6, 6); - __lasx_xvsrli_d(a, IMM6) + unsafe { __lasx_xvsrli_d(a, IMM6) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsrlr_b(a: v32i8, b: v32i8) -> v32i8 { - __lasx_xvsrlr_b(a, b) +pub fn lasx_xvsrlr_b(a: v32i8, b: v32i8) -> v32i8 { + unsafe { __lasx_xvsrlr_b(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsrlr_h(a: v16i16, b: v16i16) -> v16i16 { - __lasx_xvsrlr_h(a, b) +pub fn lasx_xvsrlr_h(a: v16i16, b: v16i16) -> v16i16 { + unsafe { __lasx_xvsrlr_h(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsrlr_w(a: v8i32, b: v8i32) -> v8i32 { - __lasx_xvsrlr_w(a, b) +pub fn lasx_xvsrlr_w(a: v8i32, b: v8i32) -> v8i32 { + unsafe { __lasx_xvsrlr_w(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsrlr_d(a: v4i64, b: v4i64) -> v4i64 { - __lasx_xvsrlr_d(a, b) +pub fn lasx_xvsrlr_d(a: v4i64, b: v4i64) -> v4i64 { + unsafe { __lasx_xvsrlr_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsrlri_b(a: v32i8) -> v32i8 { +pub fn lasx_xvsrlri_b(a: v32i8) -> v32i8 { static_assert_uimm_bits!(IMM3, 3); - __lasx_xvsrlri_b(a, IMM3) + unsafe { __lasx_xvsrlri_b(a, IMM3) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsrlri_h(a: v16i16) -> v16i16 { +pub fn lasx_xvsrlri_h(a: v16i16) -> v16i16 { static_assert_uimm_bits!(IMM4, 4); - __lasx_xvsrlri_h(a, IMM4) + unsafe { __lasx_xvsrlri_h(a, IMM4) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsrlri_w(a: v8i32) -> v8i32 { +pub fn lasx_xvsrlri_w(a: v8i32) -> v8i32 { static_assert_uimm_bits!(IMM5, 5); - __lasx_xvsrlri_w(a, IMM5) + unsafe { __lasx_xvsrlri_w(a, IMM5) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsrlri_d(a: v4i64) -> v4i64 { +pub fn lasx_xvsrlri_d(a: v4i64) -> v4i64 { static_assert_uimm_bits!(IMM6, 6); - __lasx_xvsrlri_d(a, IMM6) + unsafe { __lasx_xvsrlri_d(a, IMM6) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvbitclr_b(a: v32u8, b: v32u8) -> v32u8 { - __lasx_xvbitclr_b(a, b) +pub fn lasx_xvbitclr_b(a: v32u8, b: v32u8) -> v32u8 { + unsafe { __lasx_xvbitclr_b(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvbitclr_h(a: v16u16, b: v16u16) -> v16u16 { - __lasx_xvbitclr_h(a, b) +pub fn lasx_xvbitclr_h(a: v16u16, b: v16u16) -> v16u16 { + unsafe { __lasx_xvbitclr_h(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvbitclr_w(a: v8u32, b: v8u32) -> v8u32 { - __lasx_xvbitclr_w(a, b) +pub fn lasx_xvbitclr_w(a: v8u32, b: v8u32) -> v8u32 { + unsafe { __lasx_xvbitclr_w(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvbitclr_d(a: v4u64, b: v4u64) -> v4u64 { - __lasx_xvbitclr_d(a, b) +pub fn lasx_xvbitclr_d(a: v4u64, b: v4u64) -> v4u64 { + unsafe { __lasx_xvbitclr_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvbitclri_b(a: v32u8) -> v32u8 { +pub fn lasx_xvbitclri_b(a: v32u8) -> v32u8 { static_assert_uimm_bits!(IMM3, 3); - __lasx_xvbitclri_b(a, IMM3) + unsafe { __lasx_xvbitclri_b(a, IMM3) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvbitclri_h(a: v16u16) -> v16u16 { +pub fn lasx_xvbitclri_h(a: v16u16) -> v16u16 { static_assert_uimm_bits!(IMM4, 4); - __lasx_xvbitclri_h(a, IMM4) + unsafe { __lasx_xvbitclri_h(a, IMM4) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvbitclri_w(a: v8u32) -> v8u32 { +pub fn lasx_xvbitclri_w(a: v8u32) -> v8u32 { static_assert_uimm_bits!(IMM5, 5); - __lasx_xvbitclri_w(a, IMM5) + unsafe { __lasx_xvbitclri_w(a, IMM5) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvbitclri_d(a: v4u64) -> v4u64 { +pub fn lasx_xvbitclri_d(a: v4u64) -> v4u64 { static_assert_uimm_bits!(IMM6, 6); - __lasx_xvbitclri_d(a, IMM6) + unsafe { __lasx_xvbitclri_d(a, IMM6) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvbitset_b(a: v32u8, b: v32u8) -> v32u8 { - __lasx_xvbitset_b(a, b) +pub fn lasx_xvbitset_b(a: v32u8, b: v32u8) -> v32u8 { + unsafe { __lasx_xvbitset_b(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvbitset_h(a: v16u16, b: v16u16) -> v16u16 { - __lasx_xvbitset_h(a, b) +pub fn lasx_xvbitset_h(a: v16u16, b: v16u16) -> v16u16 { + unsafe { __lasx_xvbitset_h(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvbitset_w(a: v8u32, b: v8u32) -> v8u32 { - __lasx_xvbitset_w(a, b) +pub fn lasx_xvbitset_w(a: v8u32, b: v8u32) -> v8u32 { + unsafe { __lasx_xvbitset_w(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvbitset_d(a: v4u64, b: v4u64) -> v4u64 { - __lasx_xvbitset_d(a, b) +pub fn lasx_xvbitset_d(a: v4u64, b: v4u64) -> v4u64 { + unsafe { __lasx_xvbitset_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvbitseti_b(a: v32u8) -> v32u8 { +pub fn lasx_xvbitseti_b(a: v32u8) -> v32u8 { static_assert_uimm_bits!(IMM3, 3); - __lasx_xvbitseti_b(a, IMM3) + unsafe { __lasx_xvbitseti_b(a, IMM3) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvbitseti_h(a: v16u16) -> v16u16 { +pub fn lasx_xvbitseti_h(a: v16u16) -> v16u16 { static_assert_uimm_bits!(IMM4, 4); - __lasx_xvbitseti_h(a, IMM4) + unsafe { __lasx_xvbitseti_h(a, IMM4) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvbitseti_w(a: v8u32) -> v8u32 { +pub fn lasx_xvbitseti_w(a: v8u32) -> v8u32 { static_assert_uimm_bits!(IMM5, 5); - __lasx_xvbitseti_w(a, IMM5) + unsafe { __lasx_xvbitseti_w(a, IMM5) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvbitseti_d(a: v4u64) -> v4u64 { +pub fn lasx_xvbitseti_d(a: v4u64) -> v4u64 { static_assert_uimm_bits!(IMM6, 6); - __lasx_xvbitseti_d(a, IMM6) + unsafe { __lasx_xvbitseti_d(a, IMM6) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvbitrev_b(a: v32u8, b: v32u8) -> v32u8 { - __lasx_xvbitrev_b(a, b) +pub fn lasx_xvbitrev_b(a: v32u8, b: v32u8) -> v32u8 { + unsafe { __lasx_xvbitrev_b(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvbitrev_h(a: v16u16, b: v16u16) -> v16u16 { - __lasx_xvbitrev_h(a, b) +pub fn lasx_xvbitrev_h(a: v16u16, b: v16u16) -> v16u16 { + unsafe { __lasx_xvbitrev_h(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvbitrev_w(a: v8u32, b: v8u32) -> v8u32 { - __lasx_xvbitrev_w(a, b) +pub fn lasx_xvbitrev_w(a: v8u32, b: v8u32) -> v8u32 { + unsafe { __lasx_xvbitrev_w(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvbitrev_d(a: v4u64, b: v4u64) -> v4u64 { - __lasx_xvbitrev_d(a, b) +pub fn lasx_xvbitrev_d(a: v4u64, b: v4u64) -> v4u64 { + unsafe { __lasx_xvbitrev_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvbitrevi_b(a: v32u8) -> v32u8 { +pub fn lasx_xvbitrevi_b(a: v32u8) -> v32u8 { static_assert_uimm_bits!(IMM3, 3); - __lasx_xvbitrevi_b(a, IMM3) + unsafe { __lasx_xvbitrevi_b(a, IMM3) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvbitrevi_h(a: v16u16) -> v16u16 { +pub fn lasx_xvbitrevi_h(a: v16u16) -> v16u16 { static_assert_uimm_bits!(IMM4, 4); - __lasx_xvbitrevi_h(a, IMM4) + unsafe { __lasx_xvbitrevi_h(a, IMM4) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvbitrevi_w(a: v8u32) -> v8u32 { +pub fn lasx_xvbitrevi_w(a: v8u32) -> v8u32 { static_assert_uimm_bits!(IMM5, 5); - __lasx_xvbitrevi_w(a, IMM5) + unsafe { __lasx_xvbitrevi_w(a, IMM5) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvbitrevi_d(a: v4u64) -> v4u64 { +pub fn lasx_xvbitrevi_d(a: v4u64) -> v4u64 { static_assert_uimm_bits!(IMM6, 6); - __lasx_xvbitrevi_d(a, IMM6) + unsafe { __lasx_xvbitrevi_d(a, IMM6) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvadd_b(a: v32i8, b: v32i8) -> v32i8 { - __lasx_xvadd_b(a, b) +pub fn lasx_xvadd_b(a: v32i8, b: v32i8) -> v32i8 { + unsafe { __lasx_xvadd_b(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvadd_h(a: v16i16, b: v16i16) -> v16i16 { - __lasx_xvadd_h(a, b) +pub fn lasx_xvadd_h(a: v16i16, b: v16i16) -> v16i16 { + unsafe { __lasx_xvadd_h(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvadd_w(a: v8i32, b: v8i32) -> v8i32 { - __lasx_xvadd_w(a, b) +pub fn lasx_xvadd_w(a: v8i32, b: v8i32) -> v8i32 { + unsafe { __lasx_xvadd_w(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvadd_d(a: v4i64, b: v4i64) -> v4i64 { - __lasx_xvadd_d(a, b) +pub fn lasx_xvadd_d(a: v4i64, b: v4i64) -> v4i64 { + unsafe { __lasx_xvadd_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvaddi_bu(a: v32i8) -> v32i8 { +pub fn lasx_xvaddi_bu(a: v32i8) -> v32i8 { static_assert_uimm_bits!(IMM5, 5); - __lasx_xvaddi_bu(a, IMM5) + unsafe { __lasx_xvaddi_bu(a, IMM5) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvaddi_hu(a: v16i16) -> v16i16 { +pub fn lasx_xvaddi_hu(a: v16i16) -> v16i16 { static_assert_uimm_bits!(IMM5, 5); - __lasx_xvaddi_hu(a, IMM5) + unsafe { __lasx_xvaddi_hu(a, IMM5) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvaddi_wu(a: v8i32) -> v8i32 { +pub fn lasx_xvaddi_wu(a: v8i32) -> v8i32 { static_assert_uimm_bits!(IMM5, 5); - __lasx_xvaddi_wu(a, IMM5) + unsafe { __lasx_xvaddi_wu(a, IMM5) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvaddi_du(a: v4i64) -> v4i64 { +pub fn lasx_xvaddi_du(a: v4i64) -> v4i64 { static_assert_uimm_bits!(IMM5, 5); - __lasx_xvaddi_du(a, IMM5) + unsafe { __lasx_xvaddi_du(a, IMM5) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsub_b(a: v32i8, b: v32i8) -> v32i8 { - __lasx_xvsub_b(a, b) +pub fn lasx_xvsub_b(a: v32i8, b: v32i8) -> v32i8 { + unsafe { __lasx_xvsub_b(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsub_h(a: v16i16, b: v16i16) -> v16i16 { - __lasx_xvsub_h(a, b) +pub fn lasx_xvsub_h(a: v16i16, b: v16i16) -> v16i16 { + unsafe { __lasx_xvsub_h(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsub_w(a: v8i32, b: v8i32) -> v8i32 { - __lasx_xvsub_w(a, b) +pub fn lasx_xvsub_w(a: v8i32, b: v8i32) -> v8i32 { + unsafe { __lasx_xvsub_w(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsub_d(a: v4i64, b: v4i64) -> v4i64 { - __lasx_xvsub_d(a, b) +pub fn lasx_xvsub_d(a: v4i64, b: v4i64) -> v4i64 { + unsafe { __lasx_xvsub_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsubi_bu(a: v32i8) -> v32i8 { +pub fn lasx_xvsubi_bu(a: v32i8) -> v32i8 { static_assert_uimm_bits!(IMM5, 5); - __lasx_xvsubi_bu(a, IMM5) + unsafe { __lasx_xvsubi_bu(a, IMM5) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsubi_hu(a: v16i16) -> v16i16 { +pub fn lasx_xvsubi_hu(a: v16i16) -> v16i16 { static_assert_uimm_bits!(IMM5, 5); - __lasx_xvsubi_hu(a, IMM5) + unsafe { __lasx_xvsubi_hu(a, IMM5) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsubi_wu(a: v8i32) -> v8i32 { +pub fn lasx_xvsubi_wu(a: v8i32) -> v8i32 { static_assert_uimm_bits!(IMM5, 5); - __lasx_xvsubi_wu(a, IMM5) + unsafe { __lasx_xvsubi_wu(a, IMM5) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsubi_du(a: v4i64) -> v4i64 { +pub fn lasx_xvsubi_du(a: v4i64) -> v4i64 { static_assert_uimm_bits!(IMM5, 5); - __lasx_xvsubi_du(a, IMM5) + unsafe { __lasx_xvsubi_du(a, IMM5) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmax_b(a: v32i8, b: v32i8) -> v32i8 { - __lasx_xvmax_b(a, b) +pub fn lasx_xvmax_b(a: v32i8, b: v32i8) -> v32i8 { + unsafe { __lasx_xvmax_b(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmax_h(a: v16i16, b: v16i16) -> v16i16 { - __lasx_xvmax_h(a, b) +pub fn lasx_xvmax_h(a: v16i16, b: v16i16) -> v16i16 { + unsafe { __lasx_xvmax_h(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmax_w(a: v8i32, b: v8i32) -> v8i32 { - __lasx_xvmax_w(a, b) +pub fn lasx_xvmax_w(a: v8i32, b: v8i32) -> v8i32 { + unsafe { __lasx_xvmax_w(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmax_d(a: v4i64, b: v4i64) -> v4i64 { - __lasx_xvmax_d(a, b) +pub fn lasx_xvmax_d(a: v4i64, b: v4i64) -> v4i64 { + unsafe { __lasx_xvmax_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmaxi_b(a: v32i8) -> v32i8 { +pub fn lasx_xvmaxi_b(a: v32i8) -> v32i8 { static_assert_simm_bits!(IMM_S5, 5); - __lasx_xvmaxi_b(a, IMM_S5) + unsafe { __lasx_xvmaxi_b(a, IMM_S5) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmaxi_h(a: v16i16) -> v16i16 { +pub fn lasx_xvmaxi_h(a: v16i16) -> v16i16 { static_assert_simm_bits!(IMM_S5, 5); - __lasx_xvmaxi_h(a, IMM_S5) + unsafe { __lasx_xvmaxi_h(a, IMM_S5) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmaxi_w(a: v8i32) -> v8i32 { +pub fn lasx_xvmaxi_w(a: v8i32) -> v8i32 { static_assert_simm_bits!(IMM_S5, 5); - __lasx_xvmaxi_w(a, IMM_S5) + unsafe { __lasx_xvmaxi_w(a, IMM_S5) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmaxi_d(a: v4i64) -> v4i64 { +pub fn lasx_xvmaxi_d(a: v4i64) -> v4i64 { static_assert_simm_bits!(IMM_S5, 5); - __lasx_xvmaxi_d(a, IMM_S5) + unsafe { __lasx_xvmaxi_d(a, IMM_S5) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmax_bu(a: v32u8, b: v32u8) -> v32u8 { - __lasx_xvmax_bu(a, b) +pub fn lasx_xvmax_bu(a: v32u8, b: v32u8) -> v32u8 { + unsafe { __lasx_xvmax_bu(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmax_hu(a: v16u16, b: v16u16) -> v16u16 { - __lasx_xvmax_hu(a, b) +pub fn lasx_xvmax_hu(a: v16u16, b: v16u16) -> v16u16 { + unsafe { __lasx_xvmax_hu(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmax_wu(a: v8u32, b: v8u32) -> v8u32 { - __lasx_xvmax_wu(a, b) +pub fn lasx_xvmax_wu(a: v8u32, b: v8u32) -> v8u32 { + unsafe { __lasx_xvmax_wu(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmax_du(a: v4u64, b: v4u64) -> v4u64 { - __lasx_xvmax_du(a, b) +pub fn lasx_xvmax_du(a: v4u64, b: v4u64) -> v4u64 { + unsafe { __lasx_xvmax_du(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmaxi_bu(a: v32u8) -> v32u8 { +pub fn lasx_xvmaxi_bu(a: v32u8) -> v32u8 { static_assert_uimm_bits!(IMM5, 5); - __lasx_xvmaxi_bu(a, IMM5) + unsafe { __lasx_xvmaxi_bu(a, IMM5) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmaxi_hu(a: v16u16) -> v16u16 { +pub fn lasx_xvmaxi_hu(a: v16u16) -> v16u16 { static_assert_uimm_bits!(IMM5, 5); - __lasx_xvmaxi_hu(a, IMM5) + unsafe { __lasx_xvmaxi_hu(a, IMM5) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmaxi_wu(a: v8u32) -> v8u32 { +pub fn lasx_xvmaxi_wu(a: v8u32) -> v8u32 { static_assert_uimm_bits!(IMM5, 5); - __lasx_xvmaxi_wu(a, IMM5) + unsafe { __lasx_xvmaxi_wu(a, IMM5) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmaxi_du(a: v4u64) -> v4u64 { +pub fn lasx_xvmaxi_du(a: v4u64) -> v4u64 { static_assert_uimm_bits!(IMM5, 5); - __lasx_xvmaxi_du(a, IMM5) + unsafe { __lasx_xvmaxi_du(a, IMM5) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmin_b(a: v32i8, b: v32i8) -> v32i8 { - __lasx_xvmin_b(a, b) +pub fn lasx_xvmin_b(a: v32i8, b: v32i8) -> v32i8 { + unsafe { __lasx_xvmin_b(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmin_h(a: v16i16, b: v16i16) -> v16i16 { - __lasx_xvmin_h(a, b) +pub fn lasx_xvmin_h(a: v16i16, b: v16i16) -> v16i16 { + unsafe { __lasx_xvmin_h(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmin_w(a: v8i32, b: v8i32) -> v8i32 { - __lasx_xvmin_w(a, b) +pub fn lasx_xvmin_w(a: v8i32, b: v8i32) -> v8i32 { + unsafe { __lasx_xvmin_w(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmin_d(a: v4i64, b: v4i64) -> v4i64 { - __lasx_xvmin_d(a, b) +pub fn lasx_xvmin_d(a: v4i64, b: v4i64) -> v4i64 { + unsafe { __lasx_xvmin_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmini_b(a: v32i8) -> v32i8 { +pub fn lasx_xvmini_b(a: v32i8) -> v32i8 { static_assert_simm_bits!(IMM_S5, 5); - __lasx_xvmini_b(a, IMM_S5) + unsafe { __lasx_xvmini_b(a, IMM_S5) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmini_h(a: v16i16) -> v16i16 { +pub fn lasx_xvmini_h(a: v16i16) -> v16i16 { static_assert_simm_bits!(IMM_S5, 5); - __lasx_xvmini_h(a, IMM_S5) + unsafe { __lasx_xvmini_h(a, IMM_S5) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmini_w(a: v8i32) -> v8i32 { +pub fn lasx_xvmini_w(a: v8i32) -> v8i32 { static_assert_simm_bits!(IMM_S5, 5); - __lasx_xvmini_w(a, IMM_S5) + unsafe { __lasx_xvmini_w(a, IMM_S5) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmini_d(a: v4i64) -> v4i64 { +pub fn lasx_xvmini_d(a: v4i64) -> v4i64 { static_assert_simm_bits!(IMM_S5, 5); - __lasx_xvmini_d(a, IMM_S5) + unsafe { __lasx_xvmini_d(a, IMM_S5) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmin_bu(a: v32u8, b: v32u8) -> v32u8 { - __lasx_xvmin_bu(a, b) +pub fn lasx_xvmin_bu(a: v32u8, b: v32u8) -> v32u8 { + unsafe { __lasx_xvmin_bu(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmin_hu(a: v16u16, b: v16u16) -> v16u16 { - __lasx_xvmin_hu(a, b) +pub fn lasx_xvmin_hu(a: v16u16, b: v16u16) -> v16u16 { + unsafe { __lasx_xvmin_hu(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmin_wu(a: v8u32, b: v8u32) -> v8u32 { - __lasx_xvmin_wu(a, b) +pub fn lasx_xvmin_wu(a: v8u32, b: v8u32) -> v8u32 { + unsafe { __lasx_xvmin_wu(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmin_du(a: v4u64, b: v4u64) -> v4u64 { - __lasx_xvmin_du(a, b) +pub fn lasx_xvmin_du(a: v4u64, b: v4u64) -> v4u64 { + unsafe { __lasx_xvmin_du(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmini_bu(a: v32u8) -> v32u8 { +pub fn lasx_xvmini_bu(a: v32u8) -> v32u8 { static_assert_uimm_bits!(IMM5, 5); - __lasx_xvmini_bu(a, IMM5) + unsafe { __lasx_xvmini_bu(a, IMM5) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmini_hu(a: v16u16) -> v16u16 { +pub fn lasx_xvmini_hu(a: v16u16) -> v16u16 { static_assert_uimm_bits!(IMM5, 5); - __lasx_xvmini_hu(a, IMM5) + unsafe { __lasx_xvmini_hu(a, IMM5) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmini_wu(a: v8u32) -> v8u32 { +pub fn lasx_xvmini_wu(a: v8u32) -> v8u32 { static_assert_uimm_bits!(IMM5, 5); - __lasx_xvmini_wu(a, IMM5) + unsafe { __lasx_xvmini_wu(a, IMM5) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmini_du(a: v4u64) -> v4u64 { +pub fn lasx_xvmini_du(a: v4u64) -> v4u64 { static_assert_uimm_bits!(IMM5, 5); - __lasx_xvmini_du(a, IMM5) + unsafe { __lasx_xvmini_du(a, IMM5) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvseq_b(a: v32i8, b: v32i8) -> v32i8 { - __lasx_xvseq_b(a, b) +pub fn lasx_xvseq_b(a: v32i8, b: v32i8) -> v32i8 { + unsafe { __lasx_xvseq_b(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvseq_h(a: v16i16, b: v16i16) -> v16i16 { - __lasx_xvseq_h(a, b) +pub fn lasx_xvseq_h(a: v16i16, b: v16i16) -> v16i16 { + unsafe { __lasx_xvseq_h(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvseq_w(a: v8i32, b: v8i32) -> v8i32 { - __lasx_xvseq_w(a, b) +pub fn lasx_xvseq_w(a: v8i32, b: v8i32) -> v8i32 { + unsafe { __lasx_xvseq_w(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvseq_d(a: v4i64, b: v4i64) -> v4i64 { - __lasx_xvseq_d(a, b) +pub fn lasx_xvseq_d(a: v4i64, b: v4i64) -> v4i64 { + unsafe { __lasx_xvseq_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvseqi_b(a: v32i8) -> v32i8 { +pub fn lasx_xvseqi_b(a: v32i8) -> v32i8 { static_assert_simm_bits!(IMM_S5, 5); - __lasx_xvseqi_b(a, IMM_S5) + unsafe { __lasx_xvseqi_b(a, IMM_S5) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvseqi_h(a: v16i16) -> v16i16 { +pub fn lasx_xvseqi_h(a: v16i16) -> v16i16 { static_assert_simm_bits!(IMM_S5, 5); - __lasx_xvseqi_h(a, IMM_S5) + unsafe { __lasx_xvseqi_h(a, IMM_S5) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvseqi_w(a: v8i32) -> v8i32 { +pub fn lasx_xvseqi_w(a: v8i32) -> v8i32 { static_assert_simm_bits!(IMM_S5, 5); - __lasx_xvseqi_w(a, IMM_S5) + unsafe { __lasx_xvseqi_w(a, IMM_S5) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvseqi_d(a: v4i64) -> v4i64 { +pub fn lasx_xvseqi_d(a: v4i64) -> v4i64 { static_assert_simm_bits!(IMM_S5, 5); - __lasx_xvseqi_d(a, IMM_S5) + unsafe { __lasx_xvseqi_d(a, IMM_S5) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvslt_b(a: v32i8, b: v32i8) -> v32i8 { - __lasx_xvslt_b(a, b) +pub fn lasx_xvslt_b(a: v32i8, b: v32i8) -> v32i8 { + unsafe { __lasx_xvslt_b(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvslt_h(a: v16i16, b: v16i16) -> v16i16 { - __lasx_xvslt_h(a, b) +pub fn lasx_xvslt_h(a: v16i16, b: v16i16) -> v16i16 { + unsafe { __lasx_xvslt_h(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvslt_w(a: v8i32, b: v8i32) -> v8i32 { - __lasx_xvslt_w(a, b) +pub fn lasx_xvslt_w(a: v8i32, b: v8i32) -> v8i32 { + unsafe { __lasx_xvslt_w(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvslt_d(a: v4i64, b: v4i64) -> v4i64 { - __lasx_xvslt_d(a, b) +pub fn lasx_xvslt_d(a: v4i64, b: v4i64) -> v4i64 { + unsafe { __lasx_xvslt_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvslti_b(a: v32i8) -> v32i8 { +pub fn lasx_xvslti_b(a: v32i8) -> v32i8 { static_assert_simm_bits!(IMM_S5, 5); - __lasx_xvslti_b(a, IMM_S5) + unsafe { __lasx_xvslti_b(a, IMM_S5) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvslti_h(a: v16i16) -> v16i16 { +pub fn lasx_xvslti_h(a: v16i16) -> v16i16 { static_assert_simm_bits!(IMM_S5, 5); - __lasx_xvslti_h(a, IMM_S5) + unsafe { __lasx_xvslti_h(a, IMM_S5) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvslti_w(a: v8i32) -> v8i32 { +pub fn lasx_xvslti_w(a: v8i32) -> v8i32 { static_assert_simm_bits!(IMM_S5, 5); - __lasx_xvslti_w(a, IMM_S5) + unsafe { __lasx_xvslti_w(a, IMM_S5) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvslti_d(a: v4i64) -> v4i64 { +pub fn lasx_xvslti_d(a: v4i64) -> v4i64 { static_assert_simm_bits!(IMM_S5, 5); - __lasx_xvslti_d(a, IMM_S5) + unsafe { __lasx_xvslti_d(a, IMM_S5) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvslt_bu(a: v32u8, b: v32u8) -> v32i8 { - __lasx_xvslt_bu(a, b) +pub fn lasx_xvslt_bu(a: v32u8, b: v32u8) -> v32i8 { + unsafe { __lasx_xvslt_bu(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvslt_hu(a: v16u16, b: v16u16) -> v16i16 { - __lasx_xvslt_hu(a, b) +pub fn lasx_xvslt_hu(a: v16u16, b: v16u16) -> v16i16 { + unsafe { __lasx_xvslt_hu(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvslt_wu(a: v8u32, b: v8u32) -> v8i32 { - __lasx_xvslt_wu(a, b) +pub fn lasx_xvslt_wu(a: v8u32, b: v8u32) -> v8i32 { + unsafe { __lasx_xvslt_wu(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvslt_du(a: v4u64, b: v4u64) -> v4i64 { - __lasx_xvslt_du(a, b) +pub fn lasx_xvslt_du(a: v4u64, b: v4u64) -> v4i64 { + unsafe { __lasx_xvslt_du(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvslti_bu(a: v32u8) -> v32i8 { +pub fn lasx_xvslti_bu(a: v32u8) -> v32i8 { static_assert_uimm_bits!(IMM5, 5); - __lasx_xvslti_bu(a, IMM5) + unsafe { __lasx_xvslti_bu(a, IMM5) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvslti_hu(a: v16u16) -> v16i16 { +pub fn lasx_xvslti_hu(a: v16u16) -> v16i16 { static_assert_uimm_bits!(IMM5, 5); - __lasx_xvslti_hu(a, IMM5) + unsafe { __lasx_xvslti_hu(a, IMM5) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvslti_wu(a: v8u32) -> v8i32 { +pub fn lasx_xvslti_wu(a: v8u32) -> v8i32 { static_assert_uimm_bits!(IMM5, 5); - __lasx_xvslti_wu(a, IMM5) + unsafe { __lasx_xvslti_wu(a, IMM5) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvslti_du(a: v4u64) -> v4i64 { +pub fn lasx_xvslti_du(a: v4u64) -> v4i64 { static_assert_uimm_bits!(IMM5, 5); - __lasx_xvslti_du(a, IMM5) + unsafe { __lasx_xvslti_du(a, IMM5) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsle_b(a: v32i8, b: v32i8) -> v32i8 { - __lasx_xvsle_b(a, b) +pub fn lasx_xvsle_b(a: v32i8, b: v32i8) -> v32i8 { + unsafe { __lasx_xvsle_b(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsle_h(a: v16i16, b: v16i16) -> v16i16 { - __lasx_xvsle_h(a, b) +pub fn lasx_xvsle_h(a: v16i16, b: v16i16) -> v16i16 { + unsafe { __lasx_xvsle_h(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsle_w(a: v8i32, b: v8i32) -> v8i32 { - __lasx_xvsle_w(a, b) +pub fn lasx_xvsle_w(a: v8i32, b: v8i32) -> v8i32 { + unsafe { __lasx_xvsle_w(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsle_d(a: v4i64, b: v4i64) -> v4i64 { - __lasx_xvsle_d(a, b) +pub fn lasx_xvsle_d(a: v4i64, b: v4i64) -> v4i64 { + unsafe { __lasx_xvsle_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvslei_b(a: v32i8) -> v32i8 { +pub fn lasx_xvslei_b(a: v32i8) -> v32i8 { static_assert_simm_bits!(IMM_S5, 5); - __lasx_xvslei_b(a, IMM_S5) + unsafe { __lasx_xvslei_b(a, IMM_S5) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvslei_h(a: v16i16) -> v16i16 { +pub fn lasx_xvslei_h(a: v16i16) -> v16i16 { static_assert_simm_bits!(IMM_S5, 5); - __lasx_xvslei_h(a, IMM_S5) + unsafe { __lasx_xvslei_h(a, IMM_S5) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvslei_w(a: v8i32) -> v8i32 { +pub fn lasx_xvslei_w(a: v8i32) -> v8i32 { static_assert_simm_bits!(IMM_S5, 5); - __lasx_xvslei_w(a, IMM_S5) + unsafe { __lasx_xvslei_w(a, IMM_S5) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvslei_d(a: v4i64) -> v4i64 { +pub fn lasx_xvslei_d(a: v4i64) -> v4i64 { static_assert_simm_bits!(IMM_S5, 5); - __lasx_xvslei_d(a, IMM_S5) + unsafe { __lasx_xvslei_d(a, IMM_S5) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsle_bu(a: v32u8, b: v32u8) -> v32i8 { - __lasx_xvsle_bu(a, b) +pub fn lasx_xvsle_bu(a: v32u8, b: v32u8) -> v32i8 { + unsafe { __lasx_xvsle_bu(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsle_hu(a: v16u16, b: v16u16) -> v16i16 { - __lasx_xvsle_hu(a, b) +pub fn lasx_xvsle_hu(a: v16u16, b: v16u16) -> v16i16 { + unsafe { __lasx_xvsle_hu(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsle_wu(a: v8u32, b: v8u32) -> v8i32 { - __lasx_xvsle_wu(a, b) +pub fn lasx_xvsle_wu(a: v8u32, b: v8u32) -> v8i32 { + unsafe { __lasx_xvsle_wu(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsle_du(a: v4u64, b: v4u64) -> v4i64 { - __lasx_xvsle_du(a, b) +pub fn lasx_xvsle_du(a: v4u64, b: v4u64) -> v4i64 { + unsafe { __lasx_xvsle_du(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvslei_bu(a: v32u8) -> v32i8 { +pub fn lasx_xvslei_bu(a: v32u8) -> v32i8 { static_assert_uimm_bits!(IMM5, 5); - __lasx_xvslei_bu(a, IMM5) + unsafe { __lasx_xvslei_bu(a, IMM5) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvslei_hu(a: v16u16) -> v16i16 { +pub fn lasx_xvslei_hu(a: v16u16) -> v16i16 { static_assert_uimm_bits!(IMM5, 5); - __lasx_xvslei_hu(a, IMM5) + unsafe { __lasx_xvslei_hu(a, IMM5) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvslei_wu(a: v8u32) -> v8i32 { +pub fn lasx_xvslei_wu(a: v8u32) -> v8i32 { static_assert_uimm_bits!(IMM5, 5); - __lasx_xvslei_wu(a, IMM5) + unsafe { __lasx_xvslei_wu(a, IMM5) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvslei_du(a: v4u64) -> v4i64 { +pub fn lasx_xvslei_du(a: v4u64) -> v4i64 { static_assert_uimm_bits!(IMM5, 5); - __lasx_xvslei_du(a, IMM5) + unsafe { __lasx_xvslei_du(a, IMM5) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsat_b(a: v32i8) -> v32i8 { +pub fn lasx_xvsat_b(a: v32i8) -> v32i8 { static_assert_uimm_bits!(IMM3, 3); - __lasx_xvsat_b(a, IMM3) + unsafe { __lasx_xvsat_b(a, IMM3) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsat_h(a: v16i16) -> v16i16 { +pub fn lasx_xvsat_h(a: v16i16) -> v16i16 { static_assert_uimm_bits!(IMM4, 4); - __lasx_xvsat_h(a, IMM4) + unsafe { __lasx_xvsat_h(a, IMM4) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsat_w(a: v8i32) -> v8i32 { +pub fn lasx_xvsat_w(a: v8i32) -> v8i32 { static_assert_uimm_bits!(IMM5, 5); - __lasx_xvsat_w(a, IMM5) + unsafe { __lasx_xvsat_w(a, IMM5) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsat_d(a: v4i64) -> v4i64 { +pub fn lasx_xvsat_d(a: v4i64) -> v4i64 { static_assert_uimm_bits!(IMM6, 6); - __lasx_xvsat_d(a, IMM6) + unsafe { __lasx_xvsat_d(a, IMM6) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsat_bu(a: v32u8) -> v32u8 { +pub fn lasx_xvsat_bu(a: v32u8) -> v32u8 { static_assert_uimm_bits!(IMM3, 3); - __lasx_xvsat_bu(a, IMM3) + unsafe { __lasx_xvsat_bu(a, IMM3) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsat_hu(a: v16u16) -> v16u16 { +pub fn lasx_xvsat_hu(a: v16u16) -> v16u16 { static_assert_uimm_bits!(IMM4, 4); - __lasx_xvsat_hu(a, IMM4) + unsafe { __lasx_xvsat_hu(a, IMM4) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsat_wu(a: v8u32) -> v8u32 { +pub fn lasx_xvsat_wu(a: v8u32) -> v8u32 { static_assert_uimm_bits!(IMM5, 5); - __lasx_xvsat_wu(a, IMM5) + unsafe { __lasx_xvsat_wu(a, IMM5) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsat_du(a: v4u64) -> v4u64 { +pub fn lasx_xvsat_du(a: v4u64) -> v4u64 { static_assert_uimm_bits!(IMM6, 6); - __lasx_xvsat_du(a, IMM6) + unsafe { __lasx_xvsat_du(a, IMM6) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvadda_b(a: v32i8, b: v32i8) -> v32i8 { - __lasx_xvadda_b(a, b) +pub fn lasx_xvadda_b(a: v32i8, b: v32i8) -> v32i8 { + unsafe { __lasx_xvadda_b(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvadda_h(a: v16i16, b: v16i16) -> v16i16 { - __lasx_xvadda_h(a, b) +pub fn lasx_xvadda_h(a: v16i16, b: v16i16) -> v16i16 { + unsafe { __lasx_xvadda_h(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvadda_w(a: v8i32, b: v8i32) -> v8i32 { - __lasx_xvadda_w(a, b) +pub fn lasx_xvadda_w(a: v8i32, b: v8i32) -> v8i32 { + unsafe { __lasx_xvadda_w(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvadda_d(a: v4i64, b: v4i64) -> v4i64 { - __lasx_xvadda_d(a, b) +pub fn lasx_xvadda_d(a: v4i64, b: v4i64) -> v4i64 { + unsafe { __lasx_xvadda_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsadd_b(a: v32i8, b: v32i8) -> v32i8 { - __lasx_xvsadd_b(a, b) +pub fn lasx_xvsadd_b(a: v32i8, b: v32i8) -> v32i8 { + unsafe { __lasx_xvsadd_b(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsadd_h(a: v16i16, b: v16i16) -> v16i16 { - __lasx_xvsadd_h(a, b) +pub fn lasx_xvsadd_h(a: v16i16, b: v16i16) -> v16i16 { + unsafe { __lasx_xvsadd_h(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsadd_w(a: v8i32, b: v8i32) -> v8i32 { - __lasx_xvsadd_w(a, b) +pub fn lasx_xvsadd_w(a: v8i32, b: v8i32) -> v8i32 { + unsafe { __lasx_xvsadd_w(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsadd_d(a: v4i64, b: v4i64) -> v4i64 { - __lasx_xvsadd_d(a, b) +pub fn lasx_xvsadd_d(a: v4i64, b: v4i64) -> v4i64 { + unsafe { __lasx_xvsadd_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsadd_bu(a: v32u8, b: v32u8) -> v32u8 { - __lasx_xvsadd_bu(a, b) +pub fn lasx_xvsadd_bu(a: v32u8, b: v32u8) -> v32u8 { + unsafe { __lasx_xvsadd_bu(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsadd_hu(a: v16u16, b: v16u16) -> v16u16 { - __lasx_xvsadd_hu(a, b) +pub fn lasx_xvsadd_hu(a: v16u16, b: v16u16) -> v16u16 { + unsafe { __lasx_xvsadd_hu(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsadd_wu(a: v8u32, b: v8u32) -> v8u32 { - __lasx_xvsadd_wu(a, b) +pub fn lasx_xvsadd_wu(a: v8u32, b: v8u32) -> v8u32 { + unsafe { __lasx_xvsadd_wu(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsadd_du(a: v4u64, b: v4u64) -> v4u64 { - __lasx_xvsadd_du(a, b) +pub fn lasx_xvsadd_du(a: v4u64, b: v4u64) -> v4u64 { + unsafe { __lasx_xvsadd_du(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvavg_b(a: v32i8, b: v32i8) -> v32i8 { - __lasx_xvavg_b(a, b) +pub fn lasx_xvavg_b(a: v32i8, b: v32i8) -> v32i8 { + unsafe { __lasx_xvavg_b(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvavg_h(a: v16i16, b: v16i16) -> v16i16 { - __lasx_xvavg_h(a, b) +pub fn lasx_xvavg_h(a: v16i16, b: v16i16) -> v16i16 { + unsafe { __lasx_xvavg_h(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvavg_w(a: v8i32, b: v8i32) -> v8i32 { - __lasx_xvavg_w(a, b) +pub fn lasx_xvavg_w(a: v8i32, b: v8i32) -> v8i32 { + unsafe { __lasx_xvavg_w(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvavg_d(a: v4i64, b: v4i64) -> v4i64 { - __lasx_xvavg_d(a, b) +pub fn lasx_xvavg_d(a: v4i64, b: v4i64) -> v4i64 { + unsafe { __lasx_xvavg_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvavg_bu(a: v32u8, b: v32u8) -> v32u8 { - __lasx_xvavg_bu(a, b) +pub fn lasx_xvavg_bu(a: v32u8, b: v32u8) -> v32u8 { + unsafe { __lasx_xvavg_bu(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvavg_hu(a: v16u16, b: v16u16) -> v16u16 { - __lasx_xvavg_hu(a, b) +pub fn lasx_xvavg_hu(a: v16u16, b: v16u16) -> v16u16 { + unsafe { __lasx_xvavg_hu(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvavg_wu(a: v8u32, b: v8u32) -> v8u32 { - __lasx_xvavg_wu(a, b) +pub fn lasx_xvavg_wu(a: v8u32, b: v8u32) -> v8u32 { + unsafe { __lasx_xvavg_wu(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvavg_du(a: v4u64, b: v4u64) -> v4u64 { - __lasx_xvavg_du(a, b) +pub fn lasx_xvavg_du(a: v4u64, b: v4u64) -> v4u64 { + unsafe { __lasx_xvavg_du(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvavgr_b(a: v32i8, b: v32i8) -> v32i8 { - __lasx_xvavgr_b(a, b) +pub fn lasx_xvavgr_b(a: v32i8, b: v32i8) -> v32i8 { + unsafe { __lasx_xvavgr_b(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvavgr_h(a: v16i16, b: v16i16) -> v16i16 { - __lasx_xvavgr_h(a, b) +pub fn lasx_xvavgr_h(a: v16i16, b: v16i16) -> v16i16 { + unsafe { __lasx_xvavgr_h(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvavgr_w(a: v8i32, b: v8i32) -> v8i32 { - __lasx_xvavgr_w(a, b) +pub fn lasx_xvavgr_w(a: v8i32, b: v8i32) -> v8i32 { + unsafe { __lasx_xvavgr_w(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvavgr_d(a: v4i64, b: v4i64) -> v4i64 { - __lasx_xvavgr_d(a, b) +pub fn lasx_xvavgr_d(a: v4i64, b: v4i64) -> v4i64 { + unsafe { __lasx_xvavgr_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvavgr_bu(a: v32u8, b: v32u8) -> v32u8 { - __lasx_xvavgr_bu(a, b) +pub fn lasx_xvavgr_bu(a: v32u8, b: v32u8) -> v32u8 { + unsafe { __lasx_xvavgr_bu(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvavgr_hu(a: v16u16, b: v16u16) -> v16u16 { - __lasx_xvavgr_hu(a, b) +pub fn lasx_xvavgr_hu(a: v16u16, b: v16u16) -> v16u16 { + unsafe { __lasx_xvavgr_hu(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvavgr_wu(a: v8u32, b: v8u32) -> v8u32 { - __lasx_xvavgr_wu(a, b) +pub fn lasx_xvavgr_wu(a: v8u32, b: v8u32) -> v8u32 { + unsafe { __lasx_xvavgr_wu(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvavgr_du(a: v4u64, b: v4u64) -> v4u64 { - __lasx_xvavgr_du(a, b) +pub fn lasx_xvavgr_du(a: v4u64, b: v4u64) -> v4u64 { + unsafe { __lasx_xvavgr_du(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvssub_b(a: v32i8, b: v32i8) -> v32i8 { - __lasx_xvssub_b(a, b) +pub fn lasx_xvssub_b(a: v32i8, b: v32i8) -> v32i8 { + unsafe { __lasx_xvssub_b(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvssub_h(a: v16i16, b: v16i16) -> v16i16 { - __lasx_xvssub_h(a, b) +pub fn lasx_xvssub_h(a: v16i16, b: v16i16) -> v16i16 { + unsafe { __lasx_xvssub_h(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvssub_w(a: v8i32, b: v8i32) -> v8i32 { - __lasx_xvssub_w(a, b) +pub fn lasx_xvssub_w(a: v8i32, b: v8i32) -> v8i32 { + unsafe { __lasx_xvssub_w(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvssub_d(a: v4i64, b: v4i64) -> v4i64 { - __lasx_xvssub_d(a, b) +pub fn lasx_xvssub_d(a: v4i64, b: v4i64) -> v4i64 { + unsafe { __lasx_xvssub_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvssub_bu(a: v32u8, b: v32u8) -> v32u8 { - __lasx_xvssub_bu(a, b) +pub fn lasx_xvssub_bu(a: v32u8, b: v32u8) -> v32u8 { + unsafe { __lasx_xvssub_bu(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvssub_hu(a: v16u16, b: v16u16) -> v16u16 { - __lasx_xvssub_hu(a, b) +pub fn lasx_xvssub_hu(a: v16u16, b: v16u16) -> v16u16 { + unsafe { __lasx_xvssub_hu(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvssub_wu(a: v8u32, b: v8u32) -> v8u32 { - __lasx_xvssub_wu(a, b) +pub fn lasx_xvssub_wu(a: v8u32, b: v8u32) -> v8u32 { + unsafe { __lasx_xvssub_wu(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvssub_du(a: v4u64, b: v4u64) -> v4u64 { - __lasx_xvssub_du(a, b) +pub fn lasx_xvssub_du(a: v4u64, b: v4u64) -> v4u64 { + unsafe { __lasx_xvssub_du(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvabsd_b(a: v32i8, b: v32i8) -> v32i8 { - __lasx_xvabsd_b(a, b) +pub fn lasx_xvabsd_b(a: v32i8, b: v32i8) -> v32i8 { + unsafe { __lasx_xvabsd_b(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvabsd_h(a: v16i16, b: v16i16) -> v16i16 { - __lasx_xvabsd_h(a, b) +pub fn lasx_xvabsd_h(a: v16i16, b: v16i16) -> v16i16 { + unsafe { __lasx_xvabsd_h(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvabsd_w(a: v8i32, b: v8i32) -> v8i32 { - __lasx_xvabsd_w(a, b) +pub fn lasx_xvabsd_w(a: v8i32, b: v8i32) -> v8i32 { + unsafe { __lasx_xvabsd_w(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvabsd_d(a: v4i64, b: v4i64) -> v4i64 { - __lasx_xvabsd_d(a, b) +pub fn lasx_xvabsd_d(a: v4i64, b: v4i64) -> v4i64 { + unsafe { __lasx_xvabsd_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvabsd_bu(a: v32u8, b: v32u8) -> v32u8 { - __lasx_xvabsd_bu(a, b) +pub fn lasx_xvabsd_bu(a: v32u8, b: v32u8) -> v32u8 { + unsafe { __lasx_xvabsd_bu(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvabsd_hu(a: v16u16, b: v16u16) -> v16u16 { - __lasx_xvabsd_hu(a, b) +pub fn lasx_xvabsd_hu(a: v16u16, b: v16u16) -> v16u16 { + unsafe { __lasx_xvabsd_hu(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvabsd_wu(a: v8u32, b: v8u32) -> v8u32 { - __lasx_xvabsd_wu(a, b) +pub fn lasx_xvabsd_wu(a: v8u32, b: v8u32) -> v8u32 { + unsafe { __lasx_xvabsd_wu(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvabsd_du(a: v4u64, b: v4u64) -> v4u64 { - __lasx_xvabsd_du(a, b) +pub fn lasx_xvabsd_du(a: v4u64, b: v4u64) -> v4u64 { + unsafe { __lasx_xvabsd_du(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmul_b(a: v32i8, b: v32i8) -> v32i8 { - __lasx_xvmul_b(a, b) +pub fn lasx_xvmul_b(a: v32i8, b: v32i8) -> v32i8 { + unsafe { __lasx_xvmul_b(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmul_h(a: v16i16, b: v16i16) -> v16i16 { - __lasx_xvmul_h(a, b) +pub fn lasx_xvmul_h(a: v16i16, b: v16i16) -> v16i16 { + unsafe { __lasx_xvmul_h(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmul_w(a: v8i32, b: v8i32) -> v8i32 { - __lasx_xvmul_w(a, b) +pub fn lasx_xvmul_w(a: v8i32, b: v8i32) -> v8i32 { + unsafe { __lasx_xvmul_w(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmul_d(a: v4i64, b: v4i64) -> v4i64 { - __lasx_xvmul_d(a, b) +pub fn lasx_xvmul_d(a: v4i64, b: v4i64) -> v4i64 { + unsafe { __lasx_xvmul_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmadd_b(a: v32i8, b: v32i8, c: v32i8) -> v32i8 { - __lasx_xvmadd_b(a, b, c) +pub fn lasx_xvmadd_b(a: v32i8, b: v32i8, c: v32i8) -> v32i8 { + unsafe { __lasx_xvmadd_b(a, b, c) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmadd_h(a: v16i16, b: v16i16, c: v16i16) -> v16i16 { - __lasx_xvmadd_h(a, b, c) +pub fn lasx_xvmadd_h(a: v16i16, b: v16i16, c: v16i16) -> v16i16 { + unsafe { __lasx_xvmadd_h(a, b, c) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmadd_w(a: v8i32, b: v8i32, c: v8i32) -> v8i32 { - __lasx_xvmadd_w(a, b, c) +pub fn lasx_xvmadd_w(a: v8i32, b: v8i32, c: v8i32) -> v8i32 { + unsafe { __lasx_xvmadd_w(a, b, c) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmadd_d(a: v4i64, b: v4i64, c: v4i64) -> v4i64 { - __lasx_xvmadd_d(a, b, c) +pub fn lasx_xvmadd_d(a: v4i64, b: v4i64, c: v4i64) -> v4i64 { + unsafe { __lasx_xvmadd_d(a, b, c) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmsub_b(a: v32i8, b: v32i8, c: v32i8) -> v32i8 { - __lasx_xvmsub_b(a, b, c) +pub fn lasx_xvmsub_b(a: v32i8, b: v32i8, c: v32i8) -> v32i8 { + unsafe { __lasx_xvmsub_b(a, b, c) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmsub_h(a: v16i16, b: v16i16, c: v16i16) -> v16i16 { - __lasx_xvmsub_h(a, b, c) +pub fn lasx_xvmsub_h(a: v16i16, b: v16i16, c: v16i16) -> v16i16 { + unsafe { __lasx_xvmsub_h(a, b, c) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmsub_w(a: v8i32, b: v8i32, c: v8i32) -> v8i32 { - __lasx_xvmsub_w(a, b, c) +pub fn lasx_xvmsub_w(a: v8i32, b: v8i32, c: v8i32) -> v8i32 { + unsafe { __lasx_xvmsub_w(a, b, c) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmsub_d(a: v4i64, b: v4i64, c: v4i64) -> v4i64 { - __lasx_xvmsub_d(a, b, c) +pub fn lasx_xvmsub_d(a: v4i64, b: v4i64, c: v4i64) -> v4i64 { + unsafe { __lasx_xvmsub_d(a, b, c) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvdiv_b(a: v32i8, b: v32i8) -> v32i8 { - __lasx_xvdiv_b(a, b) +pub fn lasx_xvdiv_b(a: v32i8, b: v32i8) -> v32i8 { + unsafe { __lasx_xvdiv_b(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvdiv_h(a: v16i16, b: v16i16) -> v16i16 { - __lasx_xvdiv_h(a, b) +pub fn lasx_xvdiv_h(a: v16i16, b: v16i16) -> v16i16 { + unsafe { __lasx_xvdiv_h(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvdiv_w(a: v8i32, b: v8i32) -> v8i32 { - __lasx_xvdiv_w(a, b) +pub fn lasx_xvdiv_w(a: v8i32, b: v8i32) -> v8i32 { + unsafe { __lasx_xvdiv_w(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvdiv_d(a: v4i64, b: v4i64) -> v4i64 { - __lasx_xvdiv_d(a, b) +pub fn lasx_xvdiv_d(a: v4i64, b: v4i64) -> v4i64 { + unsafe { __lasx_xvdiv_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvdiv_bu(a: v32u8, b: v32u8) -> v32u8 { - __lasx_xvdiv_bu(a, b) +pub fn lasx_xvdiv_bu(a: v32u8, b: v32u8) -> v32u8 { + unsafe { __lasx_xvdiv_bu(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvdiv_hu(a: v16u16, b: v16u16) -> v16u16 { - __lasx_xvdiv_hu(a, b) +pub fn lasx_xvdiv_hu(a: v16u16, b: v16u16) -> v16u16 { + unsafe { __lasx_xvdiv_hu(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvdiv_wu(a: v8u32, b: v8u32) -> v8u32 { - __lasx_xvdiv_wu(a, b) +pub fn lasx_xvdiv_wu(a: v8u32, b: v8u32) -> v8u32 { + unsafe { __lasx_xvdiv_wu(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvdiv_du(a: v4u64, b: v4u64) -> v4u64 { - __lasx_xvdiv_du(a, b) +pub fn lasx_xvdiv_du(a: v4u64, b: v4u64) -> v4u64 { + unsafe { __lasx_xvdiv_du(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvhaddw_h_b(a: v32i8, b: v32i8) -> v16i16 { - __lasx_xvhaddw_h_b(a, b) +pub fn lasx_xvhaddw_h_b(a: v32i8, b: v32i8) -> v16i16 { + unsafe { __lasx_xvhaddw_h_b(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvhaddw_w_h(a: v16i16, b: v16i16) -> v8i32 { - __lasx_xvhaddw_w_h(a, b) +pub fn lasx_xvhaddw_w_h(a: v16i16, b: v16i16) -> v8i32 { + unsafe { __lasx_xvhaddw_w_h(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvhaddw_d_w(a: v8i32, b: v8i32) -> v4i64 { - __lasx_xvhaddw_d_w(a, b) +pub fn lasx_xvhaddw_d_w(a: v8i32, b: v8i32) -> v4i64 { + unsafe { __lasx_xvhaddw_d_w(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvhaddw_hu_bu(a: v32u8, b: v32u8) -> v16u16 { - __lasx_xvhaddw_hu_bu(a, b) +pub fn lasx_xvhaddw_hu_bu(a: v32u8, b: v32u8) -> v16u16 { + unsafe { __lasx_xvhaddw_hu_bu(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvhaddw_wu_hu(a: v16u16, b: v16u16) -> v8u32 { - __lasx_xvhaddw_wu_hu(a, b) +pub fn lasx_xvhaddw_wu_hu(a: v16u16, b: v16u16) -> v8u32 { + unsafe { __lasx_xvhaddw_wu_hu(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvhaddw_du_wu(a: v8u32, b: v8u32) -> v4u64 { - __lasx_xvhaddw_du_wu(a, b) +pub fn lasx_xvhaddw_du_wu(a: v8u32, b: v8u32) -> v4u64 { + unsafe { __lasx_xvhaddw_du_wu(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvhsubw_h_b(a: v32i8, b: v32i8) -> v16i16 { - __lasx_xvhsubw_h_b(a, b) +pub fn lasx_xvhsubw_h_b(a: v32i8, b: v32i8) -> v16i16 { + unsafe { __lasx_xvhsubw_h_b(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvhsubw_w_h(a: v16i16, b: v16i16) -> v8i32 { - __lasx_xvhsubw_w_h(a, b) +pub fn lasx_xvhsubw_w_h(a: v16i16, b: v16i16) -> v8i32 { + unsafe { __lasx_xvhsubw_w_h(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvhsubw_d_w(a: v8i32, b: v8i32) -> v4i64 { - __lasx_xvhsubw_d_w(a, b) +pub fn lasx_xvhsubw_d_w(a: v8i32, b: v8i32) -> v4i64 { + unsafe { __lasx_xvhsubw_d_w(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvhsubw_hu_bu(a: v32u8, b: v32u8) -> v16i16 { - __lasx_xvhsubw_hu_bu(a, b) +pub fn lasx_xvhsubw_hu_bu(a: v32u8, b: v32u8) -> v16i16 { + unsafe { __lasx_xvhsubw_hu_bu(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvhsubw_wu_hu(a: v16u16, b: v16u16) -> v8i32 { - __lasx_xvhsubw_wu_hu(a, b) +pub fn lasx_xvhsubw_wu_hu(a: v16u16, b: v16u16) -> v8i32 { + unsafe { __lasx_xvhsubw_wu_hu(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvhsubw_du_wu(a: v8u32, b: v8u32) -> v4i64 { - __lasx_xvhsubw_du_wu(a, b) +pub fn lasx_xvhsubw_du_wu(a: v8u32, b: v8u32) -> v4i64 { + unsafe { __lasx_xvhsubw_du_wu(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmod_b(a: v32i8, b: v32i8) -> v32i8 { - __lasx_xvmod_b(a, b) +pub fn lasx_xvmod_b(a: v32i8, b: v32i8) -> v32i8 { + unsafe { __lasx_xvmod_b(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmod_h(a: v16i16, b: v16i16) -> v16i16 { - __lasx_xvmod_h(a, b) +pub fn lasx_xvmod_h(a: v16i16, b: v16i16) -> v16i16 { + unsafe { __lasx_xvmod_h(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmod_w(a: v8i32, b: v8i32) -> v8i32 { - __lasx_xvmod_w(a, b) +pub fn lasx_xvmod_w(a: v8i32, b: v8i32) -> v8i32 { + unsafe { __lasx_xvmod_w(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmod_d(a: v4i64, b: v4i64) -> v4i64 { - __lasx_xvmod_d(a, b) +pub fn lasx_xvmod_d(a: v4i64, b: v4i64) -> v4i64 { + unsafe { __lasx_xvmod_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmod_bu(a: v32u8, b: v32u8) -> v32u8 { - __lasx_xvmod_bu(a, b) +pub fn lasx_xvmod_bu(a: v32u8, b: v32u8) -> v32u8 { + unsafe { __lasx_xvmod_bu(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmod_hu(a: v16u16, b: v16u16) -> v16u16 { - __lasx_xvmod_hu(a, b) +pub fn lasx_xvmod_hu(a: v16u16, b: v16u16) -> v16u16 { + unsafe { __lasx_xvmod_hu(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmod_wu(a: v8u32, b: v8u32) -> v8u32 { - __lasx_xvmod_wu(a, b) +pub fn lasx_xvmod_wu(a: v8u32, b: v8u32) -> v8u32 { + unsafe { __lasx_xvmod_wu(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmod_du(a: v4u64, b: v4u64) -> v4u64 { - __lasx_xvmod_du(a, b) +pub fn lasx_xvmod_du(a: v4u64, b: v4u64) -> v4u64 { + unsafe { __lasx_xvmod_du(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvrepl128vei_b(a: v32i8) -> v32i8 { +pub fn lasx_xvrepl128vei_b(a: v32i8) -> v32i8 { static_assert_uimm_bits!(IMM4, 4); - __lasx_xvrepl128vei_b(a, IMM4) + unsafe { __lasx_xvrepl128vei_b(a, IMM4) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvrepl128vei_h(a: v16i16) -> v16i16 { +pub fn lasx_xvrepl128vei_h(a: v16i16) -> v16i16 { static_assert_uimm_bits!(IMM3, 3); - __lasx_xvrepl128vei_h(a, IMM3) + unsafe { __lasx_xvrepl128vei_h(a, IMM3) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvrepl128vei_w(a: v8i32) -> v8i32 { +pub fn lasx_xvrepl128vei_w(a: v8i32) -> v8i32 { static_assert_uimm_bits!(IMM2, 2); - __lasx_xvrepl128vei_w(a, IMM2) + unsafe { __lasx_xvrepl128vei_w(a, IMM2) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvrepl128vei_d(a: v4i64) -> v4i64 { +pub fn lasx_xvrepl128vei_d(a: v4i64) -> v4i64 { static_assert_uimm_bits!(IMM1, 1); - __lasx_xvrepl128vei_d(a, IMM1) + unsafe { __lasx_xvrepl128vei_d(a, IMM1) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvpickev_b(a: v32i8, b: v32i8) -> v32i8 { - __lasx_xvpickev_b(a, b) +pub fn lasx_xvpickev_b(a: v32i8, b: v32i8) -> v32i8 { + unsafe { __lasx_xvpickev_b(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvpickev_h(a: v16i16, b: v16i16) -> v16i16 { - __lasx_xvpickev_h(a, b) +pub fn lasx_xvpickev_h(a: v16i16, b: v16i16) -> v16i16 { + unsafe { __lasx_xvpickev_h(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvpickev_w(a: v8i32, b: v8i32) -> v8i32 { - __lasx_xvpickev_w(a, b) +pub fn lasx_xvpickev_w(a: v8i32, b: v8i32) -> v8i32 { + unsafe { __lasx_xvpickev_w(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvpickev_d(a: v4i64, b: v4i64) -> v4i64 { - __lasx_xvpickev_d(a, b) +pub fn lasx_xvpickev_d(a: v4i64, b: v4i64) -> v4i64 { + unsafe { __lasx_xvpickev_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvpickod_b(a: v32i8, b: v32i8) -> v32i8 { - __lasx_xvpickod_b(a, b) +pub fn lasx_xvpickod_b(a: v32i8, b: v32i8) -> v32i8 { + unsafe { __lasx_xvpickod_b(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvpickod_h(a: v16i16, b: v16i16) -> v16i16 { - __lasx_xvpickod_h(a, b) +pub fn lasx_xvpickod_h(a: v16i16, b: v16i16) -> v16i16 { + unsafe { __lasx_xvpickod_h(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvpickod_w(a: v8i32, b: v8i32) -> v8i32 { - __lasx_xvpickod_w(a, b) +pub fn lasx_xvpickod_w(a: v8i32, b: v8i32) -> v8i32 { + unsafe { __lasx_xvpickod_w(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvpickod_d(a: v4i64, b: v4i64) -> v4i64 { - __lasx_xvpickod_d(a, b) +pub fn lasx_xvpickod_d(a: v4i64, b: v4i64) -> v4i64 { + unsafe { __lasx_xvpickod_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvilvh_b(a: v32i8, b: v32i8) -> v32i8 { - __lasx_xvilvh_b(a, b) +pub fn lasx_xvilvh_b(a: v32i8, b: v32i8) -> v32i8 { + unsafe { __lasx_xvilvh_b(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvilvh_h(a: v16i16, b: v16i16) -> v16i16 { - __lasx_xvilvh_h(a, b) +pub fn lasx_xvilvh_h(a: v16i16, b: v16i16) -> v16i16 { + unsafe { __lasx_xvilvh_h(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvilvh_w(a: v8i32, b: v8i32) -> v8i32 { - __lasx_xvilvh_w(a, b) +pub fn lasx_xvilvh_w(a: v8i32, b: v8i32) -> v8i32 { + unsafe { __lasx_xvilvh_w(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvilvh_d(a: v4i64, b: v4i64) -> v4i64 { - __lasx_xvilvh_d(a, b) +pub fn lasx_xvilvh_d(a: v4i64, b: v4i64) -> v4i64 { + unsafe { __lasx_xvilvh_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvilvl_b(a: v32i8, b: v32i8) -> v32i8 { - __lasx_xvilvl_b(a, b) +pub fn lasx_xvilvl_b(a: v32i8, b: v32i8) -> v32i8 { + unsafe { __lasx_xvilvl_b(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvilvl_h(a: v16i16, b: v16i16) -> v16i16 { - __lasx_xvilvl_h(a, b) +pub fn lasx_xvilvl_h(a: v16i16, b: v16i16) -> v16i16 { + unsafe { __lasx_xvilvl_h(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvilvl_w(a: v8i32, b: v8i32) -> v8i32 { - __lasx_xvilvl_w(a, b) +pub fn lasx_xvilvl_w(a: v8i32, b: v8i32) -> v8i32 { + unsafe { __lasx_xvilvl_w(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvilvl_d(a: v4i64, b: v4i64) -> v4i64 { - __lasx_xvilvl_d(a, b) +pub fn lasx_xvilvl_d(a: v4i64, b: v4i64) -> v4i64 { + unsafe { __lasx_xvilvl_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvpackev_b(a: v32i8, b: v32i8) -> v32i8 { - __lasx_xvpackev_b(a, b) +pub fn lasx_xvpackev_b(a: v32i8, b: v32i8) -> v32i8 { + unsafe { __lasx_xvpackev_b(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvpackev_h(a: v16i16, b: v16i16) -> v16i16 { - __lasx_xvpackev_h(a, b) +pub fn lasx_xvpackev_h(a: v16i16, b: v16i16) -> v16i16 { + unsafe { __lasx_xvpackev_h(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvpackev_w(a: v8i32, b: v8i32) -> v8i32 { - __lasx_xvpackev_w(a, b) +pub fn lasx_xvpackev_w(a: v8i32, b: v8i32) -> v8i32 { + unsafe { __lasx_xvpackev_w(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvpackev_d(a: v4i64, b: v4i64) -> v4i64 { - __lasx_xvpackev_d(a, b) +pub fn lasx_xvpackev_d(a: v4i64, b: v4i64) -> v4i64 { + unsafe { __lasx_xvpackev_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvpackod_b(a: v32i8, b: v32i8) -> v32i8 { - __lasx_xvpackod_b(a, b) +pub fn lasx_xvpackod_b(a: v32i8, b: v32i8) -> v32i8 { + unsafe { __lasx_xvpackod_b(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvpackod_h(a: v16i16, b: v16i16) -> v16i16 { - __lasx_xvpackod_h(a, b) +pub fn lasx_xvpackod_h(a: v16i16, b: v16i16) -> v16i16 { + unsafe { __lasx_xvpackod_h(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvpackod_w(a: v8i32, b: v8i32) -> v8i32 { - __lasx_xvpackod_w(a, b) +pub fn lasx_xvpackod_w(a: v8i32, b: v8i32) -> v8i32 { + unsafe { __lasx_xvpackod_w(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvpackod_d(a: v4i64, b: v4i64) -> v4i64 { - __lasx_xvpackod_d(a, b) +pub fn lasx_xvpackod_d(a: v4i64, b: v4i64) -> v4i64 { + unsafe { __lasx_xvpackod_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvshuf_b(a: v32i8, b: v32i8, c: v32i8) -> v32i8 { - __lasx_xvshuf_b(a, b, c) +pub fn lasx_xvshuf_b(a: v32i8, b: v32i8, c: v32i8) -> v32i8 { + unsafe { __lasx_xvshuf_b(a, b, c) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvshuf_h(a: v16i16, b: v16i16, c: v16i16) -> v16i16 { - __lasx_xvshuf_h(a, b, c) +pub fn lasx_xvshuf_h(a: v16i16, b: v16i16, c: v16i16) -> v16i16 { + unsafe { __lasx_xvshuf_h(a, b, c) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvshuf_w(a: v8i32, b: v8i32, c: v8i32) -> v8i32 { - __lasx_xvshuf_w(a, b, c) +pub fn lasx_xvshuf_w(a: v8i32, b: v8i32, c: v8i32) -> v8i32 { + unsafe { __lasx_xvshuf_w(a, b, c) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvshuf_d(a: v4i64, b: v4i64, c: v4i64) -> v4i64 { - __lasx_xvshuf_d(a, b, c) +pub fn lasx_xvshuf_d(a: v4i64, b: v4i64, c: v4i64) -> v4i64 { + unsafe { __lasx_xvshuf_d(a, b, c) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvand_v(a: v32u8, b: v32u8) -> v32u8 { - __lasx_xvand_v(a, b) +pub fn lasx_xvand_v(a: v32u8, b: v32u8) -> v32u8 { + unsafe { __lasx_xvand_v(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvandi_b(a: v32u8) -> v32u8 { +pub fn lasx_xvandi_b(a: v32u8) -> v32u8 { static_assert_uimm_bits!(IMM8, 8); - __lasx_xvandi_b(a, IMM8) + unsafe { __lasx_xvandi_b(a, IMM8) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvor_v(a: v32u8, b: v32u8) -> v32u8 { - __lasx_xvor_v(a, b) +pub fn lasx_xvor_v(a: v32u8, b: v32u8) -> v32u8 { + unsafe { __lasx_xvor_v(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvori_b(a: v32u8) -> v32u8 { +pub fn lasx_xvori_b(a: v32u8) -> v32u8 { static_assert_uimm_bits!(IMM8, 8); - __lasx_xvori_b(a, IMM8) + unsafe { __lasx_xvori_b(a, IMM8) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvnor_v(a: v32u8, b: v32u8) -> v32u8 { - __lasx_xvnor_v(a, b) +pub fn lasx_xvnor_v(a: v32u8, b: v32u8) -> v32u8 { + unsafe { __lasx_xvnor_v(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvnori_b(a: v32u8) -> v32u8 { +pub fn lasx_xvnori_b(a: v32u8) -> v32u8 { static_assert_uimm_bits!(IMM8, 8); - __lasx_xvnori_b(a, IMM8) + unsafe { __lasx_xvnori_b(a, IMM8) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvxor_v(a: v32u8, b: v32u8) -> v32u8 { - __lasx_xvxor_v(a, b) +pub fn lasx_xvxor_v(a: v32u8, b: v32u8) -> v32u8 { + unsafe { __lasx_xvxor_v(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvxori_b(a: v32u8) -> v32u8 { +pub fn lasx_xvxori_b(a: v32u8) -> v32u8 { static_assert_uimm_bits!(IMM8, 8); - __lasx_xvxori_b(a, IMM8) + unsafe { __lasx_xvxori_b(a, IMM8) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvbitsel_v(a: v32u8, b: v32u8, c: v32u8) -> v32u8 { - __lasx_xvbitsel_v(a, b, c) +pub fn lasx_xvbitsel_v(a: v32u8, b: v32u8, c: v32u8) -> v32u8 { + unsafe { __lasx_xvbitsel_v(a, b, c) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvbitseli_b(a: v32u8, b: v32u8) -> v32u8 { +pub fn lasx_xvbitseli_b(a: v32u8, b: v32u8) -> v32u8 { static_assert_uimm_bits!(IMM8, 8); - __lasx_xvbitseli_b(a, b, IMM8) + unsafe { __lasx_xvbitseli_b(a, b, IMM8) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvshuf4i_b(a: v32i8) -> v32i8 { +pub fn lasx_xvshuf4i_b(a: v32i8) -> v32i8 { static_assert_uimm_bits!(IMM8, 8); - __lasx_xvshuf4i_b(a, IMM8) + unsafe { __lasx_xvshuf4i_b(a, IMM8) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvshuf4i_h(a: v16i16) -> v16i16 { +pub fn lasx_xvshuf4i_h(a: v16i16) -> v16i16 { static_assert_uimm_bits!(IMM8, 8); - __lasx_xvshuf4i_h(a, IMM8) + unsafe { __lasx_xvshuf4i_h(a, IMM8) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvshuf4i_w(a: v8i32) -> v8i32 { +pub fn lasx_xvshuf4i_w(a: v8i32) -> v8i32 { static_assert_uimm_bits!(IMM8, 8); - __lasx_xvshuf4i_w(a, IMM8) + unsafe { __lasx_xvshuf4i_w(a, IMM8) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvreplgr2vr_b(a: i32) -> v32i8 { - __lasx_xvreplgr2vr_b(a) +pub fn lasx_xvreplgr2vr_b(a: i32) -> v32i8 { + unsafe { __lasx_xvreplgr2vr_b(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvreplgr2vr_h(a: i32) -> v16i16 { - __lasx_xvreplgr2vr_h(a) +pub fn lasx_xvreplgr2vr_h(a: i32) -> v16i16 { + unsafe { __lasx_xvreplgr2vr_h(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvreplgr2vr_w(a: i32) -> v8i32 { - __lasx_xvreplgr2vr_w(a) +pub fn lasx_xvreplgr2vr_w(a: i32) -> v8i32 { + unsafe { __lasx_xvreplgr2vr_w(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvreplgr2vr_d(a: i64) -> v4i64 { - __lasx_xvreplgr2vr_d(a) +pub fn lasx_xvreplgr2vr_d(a: i64) -> v4i64 { + unsafe { __lasx_xvreplgr2vr_d(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvpcnt_b(a: v32i8) -> v32i8 { - __lasx_xvpcnt_b(a) +pub fn lasx_xvpcnt_b(a: v32i8) -> v32i8 { + unsafe { __lasx_xvpcnt_b(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvpcnt_h(a: v16i16) -> v16i16 { - __lasx_xvpcnt_h(a) +pub fn lasx_xvpcnt_h(a: v16i16) -> v16i16 { + unsafe { __lasx_xvpcnt_h(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvpcnt_w(a: v8i32) -> v8i32 { - __lasx_xvpcnt_w(a) +pub fn lasx_xvpcnt_w(a: v8i32) -> v8i32 { + unsafe { __lasx_xvpcnt_w(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvpcnt_d(a: v4i64) -> v4i64 { - __lasx_xvpcnt_d(a) +pub fn lasx_xvpcnt_d(a: v4i64) -> v4i64 { + unsafe { __lasx_xvpcnt_d(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvclo_b(a: v32i8) -> v32i8 { - __lasx_xvclo_b(a) +pub fn lasx_xvclo_b(a: v32i8) -> v32i8 { + unsafe { __lasx_xvclo_b(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvclo_h(a: v16i16) -> v16i16 { - __lasx_xvclo_h(a) +pub fn lasx_xvclo_h(a: v16i16) -> v16i16 { + unsafe { __lasx_xvclo_h(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvclo_w(a: v8i32) -> v8i32 { - __lasx_xvclo_w(a) +pub fn lasx_xvclo_w(a: v8i32) -> v8i32 { + unsafe { __lasx_xvclo_w(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvclo_d(a: v4i64) -> v4i64 { - __lasx_xvclo_d(a) +pub fn lasx_xvclo_d(a: v4i64) -> v4i64 { + unsafe { __lasx_xvclo_d(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvclz_b(a: v32i8) -> v32i8 { - __lasx_xvclz_b(a) +pub fn lasx_xvclz_b(a: v32i8) -> v32i8 { + unsafe { __lasx_xvclz_b(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvclz_h(a: v16i16) -> v16i16 { - __lasx_xvclz_h(a) +pub fn lasx_xvclz_h(a: v16i16) -> v16i16 { + unsafe { __lasx_xvclz_h(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvclz_w(a: v8i32) -> v8i32 { - __lasx_xvclz_w(a) +pub fn lasx_xvclz_w(a: v8i32) -> v8i32 { + unsafe { __lasx_xvclz_w(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvclz_d(a: v4i64) -> v4i64 { - __lasx_xvclz_d(a) +pub fn lasx_xvclz_d(a: v4i64) -> v4i64 { + unsafe { __lasx_xvclz_d(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfadd_s(a: v8f32, b: v8f32) -> v8f32 { - __lasx_xvfadd_s(a, b) +pub fn lasx_xvfadd_s(a: v8f32, b: v8f32) -> v8f32 { + unsafe { __lasx_xvfadd_s(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfadd_d(a: v4f64, b: v4f64) -> v4f64 { - __lasx_xvfadd_d(a, b) +pub fn lasx_xvfadd_d(a: v4f64, b: v4f64) -> v4f64 { + unsafe { __lasx_xvfadd_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfsub_s(a: v8f32, b: v8f32) -> v8f32 { - __lasx_xvfsub_s(a, b) +pub fn lasx_xvfsub_s(a: v8f32, b: v8f32) -> v8f32 { + unsafe { __lasx_xvfsub_s(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfsub_d(a: v4f64, b: v4f64) -> v4f64 { - __lasx_xvfsub_d(a, b) +pub fn lasx_xvfsub_d(a: v4f64, b: v4f64) -> v4f64 { + unsafe { __lasx_xvfsub_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfmul_s(a: v8f32, b: v8f32) -> v8f32 { - __lasx_xvfmul_s(a, b) +pub fn lasx_xvfmul_s(a: v8f32, b: v8f32) -> v8f32 { + unsafe { __lasx_xvfmul_s(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfmul_d(a: v4f64, b: v4f64) -> v4f64 { - __lasx_xvfmul_d(a, b) +pub fn lasx_xvfmul_d(a: v4f64, b: v4f64) -> v4f64 { + unsafe { __lasx_xvfmul_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfdiv_s(a: v8f32, b: v8f32) -> v8f32 { - __lasx_xvfdiv_s(a, b) +pub fn lasx_xvfdiv_s(a: v8f32, b: v8f32) -> v8f32 { + unsafe { __lasx_xvfdiv_s(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfdiv_d(a: v4f64, b: v4f64) -> v4f64 { - __lasx_xvfdiv_d(a, b) +pub fn lasx_xvfdiv_d(a: v4f64, b: v4f64) -> v4f64 { + unsafe { __lasx_xvfdiv_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfcvt_h_s(a: v8f32, b: v8f32) -> v16i16 { - __lasx_xvfcvt_h_s(a, b) +pub fn lasx_xvfcvt_h_s(a: v8f32, b: v8f32) -> v16i16 { + unsafe { __lasx_xvfcvt_h_s(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfcvt_s_d(a: v4f64, b: v4f64) -> v8f32 { - __lasx_xvfcvt_s_d(a, b) +pub fn lasx_xvfcvt_s_d(a: v4f64, b: v4f64) -> v8f32 { + unsafe { __lasx_xvfcvt_s_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfmin_s(a: v8f32, b: v8f32) -> v8f32 { - __lasx_xvfmin_s(a, b) +pub fn lasx_xvfmin_s(a: v8f32, b: v8f32) -> v8f32 { + unsafe { __lasx_xvfmin_s(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfmin_d(a: v4f64, b: v4f64) -> v4f64 { - __lasx_xvfmin_d(a, b) +pub fn lasx_xvfmin_d(a: v4f64, b: v4f64) -> v4f64 { + unsafe { __lasx_xvfmin_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfmina_s(a: v8f32, b: v8f32) -> v8f32 { - __lasx_xvfmina_s(a, b) +pub fn lasx_xvfmina_s(a: v8f32, b: v8f32) -> v8f32 { + unsafe { __lasx_xvfmina_s(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfmina_d(a: v4f64, b: v4f64) -> v4f64 { - __lasx_xvfmina_d(a, b) +pub fn lasx_xvfmina_d(a: v4f64, b: v4f64) -> v4f64 { + unsafe { __lasx_xvfmina_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfmax_s(a: v8f32, b: v8f32) -> v8f32 { - __lasx_xvfmax_s(a, b) +pub fn lasx_xvfmax_s(a: v8f32, b: v8f32) -> v8f32 { + unsafe { __lasx_xvfmax_s(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfmax_d(a: v4f64, b: v4f64) -> v4f64 { - __lasx_xvfmax_d(a, b) +pub fn lasx_xvfmax_d(a: v4f64, b: v4f64) -> v4f64 { + unsafe { __lasx_xvfmax_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfmaxa_s(a: v8f32, b: v8f32) -> v8f32 { - __lasx_xvfmaxa_s(a, b) +pub fn lasx_xvfmaxa_s(a: v8f32, b: v8f32) -> v8f32 { + unsafe { __lasx_xvfmaxa_s(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfmaxa_d(a: v4f64, b: v4f64) -> v4f64 { - __lasx_xvfmaxa_d(a, b) +pub fn lasx_xvfmaxa_d(a: v4f64, b: v4f64) -> v4f64 { + unsafe { __lasx_xvfmaxa_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfclass_s(a: v8f32) -> v8i32 { - __lasx_xvfclass_s(a) +pub fn lasx_xvfclass_s(a: v8f32) -> v8i32 { + unsafe { __lasx_xvfclass_s(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfclass_d(a: v4f64) -> v4i64 { - __lasx_xvfclass_d(a) +pub fn lasx_xvfclass_d(a: v4f64) -> v4i64 { + unsafe { __lasx_xvfclass_d(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfsqrt_s(a: v8f32) -> v8f32 { - __lasx_xvfsqrt_s(a) +pub fn lasx_xvfsqrt_s(a: v8f32) -> v8f32 { + unsafe { __lasx_xvfsqrt_s(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfsqrt_d(a: v4f64) -> v4f64 { - __lasx_xvfsqrt_d(a) +pub fn lasx_xvfsqrt_d(a: v4f64) -> v4f64 { + unsafe { __lasx_xvfsqrt_d(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfrecip_s(a: v8f32) -> v8f32 { - __lasx_xvfrecip_s(a) +pub fn lasx_xvfrecip_s(a: v8f32) -> v8f32 { + unsafe { __lasx_xvfrecip_s(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfrecip_d(a: v4f64) -> v4f64 { - __lasx_xvfrecip_d(a) +pub fn lasx_xvfrecip_d(a: v4f64) -> v4f64 { + unsafe { __lasx_xvfrecip_d(a) } } #[inline] #[target_feature(enable = "lasx,frecipe")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfrecipe_s(a: v8f32) -> v8f32 { - __lasx_xvfrecipe_s(a) +pub fn lasx_xvfrecipe_s(a: v8f32) -> v8f32 { + unsafe { __lasx_xvfrecipe_s(a) } } #[inline] #[target_feature(enable = "lasx,frecipe")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfrecipe_d(a: v4f64) -> v4f64 { - __lasx_xvfrecipe_d(a) +pub fn lasx_xvfrecipe_d(a: v4f64) -> v4f64 { + unsafe { __lasx_xvfrecipe_d(a) } } #[inline] #[target_feature(enable = "lasx,frecipe")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfrsqrte_s(a: v8f32) -> v8f32 { - __lasx_xvfrsqrte_s(a) +pub fn lasx_xvfrsqrte_s(a: v8f32) -> v8f32 { + unsafe { __lasx_xvfrsqrte_s(a) } } #[inline] #[target_feature(enable = "lasx,frecipe")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfrsqrte_d(a: v4f64) -> v4f64 { - __lasx_xvfrsqrte_d(a) +pub fn lasx_xvfrsqrte_d(a: v4f64) -> v4f64 { + unsafe { __lasx_xvfrsqrte_d(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfrint_s(a: v8f32) -> v8f32 { - __lasx_xvfrint_s(a) +pub fn lasx_xvfrint_s(a: v8f32) -> v8f32 { + unsafe { __lasx_xvfrint_s(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfrint_d(a: v4f64) -> v4f64 { - __lasx_xvfrint_d(a) +pub fn lasx_xvfrint_d(a: v4f64) -> v4f64 { + unsafe { __lasx_xvfrint_d(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfrsqrt_s(a: v8f32) -> v8f32 { - __lasx_xvfrsqrt_s(a) +pub fn lasx_xvfrsqrt_s(a: v8f32) -> v8f32 { + unsafe { __lasx_xvfrsqrt_s(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfrsqrt_d(a: v4f64) -> v4f64 { - __lasx_xvfrsqrt_d(a) +pub fn lasx_xvfrsqrt_d(a: v4f64) -> v4f64 { + unsafe { __lasx_xvfrsqrt_d(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvflogb_s(a: v8f32) -> v8f32 { - __lasx_xvflogb_s(a) +pub fn lasx_xvflogb_s(a: v8f32) -> v8f32 { + unsafe { __lasx_xvflogb_s(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvflogb_d(a: v4f64) -> v4f64 { - __lasx_xvflogb_d(a) +pub fn lasx_xvflogb_d(a: v4f64) -> v4f64 { + unsafe { __lasx_xvflogb_d(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfcvth_s_h(a: v16i16) -> v8f32 { - __lasx_xvfcvth_s_h(a) +pub fn lasx_xvfcvth_s_h(a: v16i16) -> v8f32 { + unsafe { __lasx_xvfcvth_s_h(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfcvth_d_s(a: v8f32) -> v4f64 { - __lasx_xvfcvth_d_s(a) +pub fn lasx_xvfcvth_d_s(a: v8f32) -> v4f64 { + unsafe { __lasx_xvfcvth_d_s(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfcvtl_s_h(a: v16i16) -> v8f32 { - __lasx_xvfcvtl_s_h(a) +pub fn lasx_xvfcvtl_s_h(a: v16i16) -> v8f32 { + unsafe { __lasx_xvfcvtl_s_h(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfcvtl_d_s(a: v8f32) -> v4f64 { - __lasx_xvfcvtl_d_s(a) +pub fn lasx_xvfcvtl_d_s(a: v8f32) -> v4f64 { + unsafe { __lasx_xvfcvtl_d_s(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvftint_w_s(a: v8f32) -> v8i32 { - __lasx_xvftint_w_s(a) +pub fn lasx_xvftint_w_s(a: v8f32) -> v8i32 { + unsafe { __lasx_xvftint_w_s(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvftint_l_d(a: v4f64) -> v4i64 { - __lasx_xvftint_l_d(a) +pub fn lasx_xvftint_l_d(a: v4f64) -> v4i64 { + unsafe { __lasx_xvftint_l_d(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvftint_wu_s(a: v8f32) -> v8u32 { - __lasx_xvftint_wu_s(a) +pub fn lasx_xvftint_wu_s(a: v8f32) -> v8u32 { + unsafe { __lasx_xvftint_wu_s(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvftint_lu_d(a: v4f64) -> v4u64 { - __lasx_xvftint_lu_d(a) +pub fn lasx_xvftint_lu_d(a: v4f64) -> v4u64 { + unsafe { __lasx_xvftint_lu_d(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvftintrz_w_s(a: v8f32) -> v8i32 { - __lasx_xvftintrz_w_s(a) +pub fn lasx_xvftintrz_w_s(a: v8f32) -> v8i32 { + unsafe { __lasx_xvftintrz_w_s(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvftintrz_l_d(a: v4f64) -> v4i64 { - __lasx_xvftintrz_l_d(a) +pub fn lasx_xvftintrz_l_d(a: v4f64) -> v4i64 { + unsafe { __lasx_xvftintrz_l_d(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvftintrz_wu_s(a: v8f32) -> v8u32 { - __lasx_xvftintrz_wu_s(a) +pub fn lasx_xvftintrz_wu_s(a: v8f32) -> v8u32 { + unsafe { __lasx_xvftintrz_wu_s(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvftintrz_lu_d(a: v4f64) -> v4u64 { - __lasx_xvftintrz_lu_d(a) +pub fn lasx_xvftintrz_lu_d(a: v4f64) -> v4u64 { + unsafe { __lasx_xvftintrz_lu_d(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvffint_s_w(a: v8i32) -> v8f32 { - __lasx_xvffint_s_w(a) +pub fn lasx_xvffint_s_w(a: v8i32) -> v8f32 { + unsafe { __lasx_xvffint_s_w(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvffint_d_l(a: v4i64) -> v4f64 { - __lasx_xvffint_d_l(a) +pub fn lasx_xvffint_d_l(a: v4i64) -> v4f64 { + unsafe { __lasx_xvffint_d_l(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvffint_s_wu(a: v8u32) -> v8f32 { - __lasx_xvffint_s_wu(a) +pub fn lasx_xvffint_s_wu(a: v8u32) -> v8f32 { + unsafe { __lasx_xvffint_s_wu(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvffint_d_lu(a: v4u64) -> v4f64 { - __lasx_xvffint_d_lu(a) +pub fn lasx_xvffint_d_lu(a: v4u64) -> v4f64 { + unsafe { __lasx_xvffint_d_lu(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvreplve_b(a: v32i8, b: i32) -> v32i8 { - __lasx_xvreplve_b(a, b) +pub fn lasx_xvreplve_b(a: v32i8, b: i32) -> v32i8 { + unsafe { __lasx_xvreplve_b(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvreplve_h(a: v16i16, b: i32) -> v16i16 { - __lasx_xvreplve_h(a, b) +pub fn lasx_xvreplve_h(a: v16i16, b: i32) -> v16i16 { + unsafe { __lasx_xvreplve_h(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvreplve_w(a: v8i32, b: i32) -> v8i32 { - __lasx_xvreplve_w(a, b) +pub fn lasx_xvreplve_w(a: v8i32, b: i32) -> v8i32 { + unsafe { __lasx_xvreplve_w(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvreplve_d(a: v4i64, b: i32) -> v4i64 { - __lasx_xvreplve_d(a, b) +pub fn lasx_xvreplve_d(a: v4i64, b: i32) -> v4i64 { + unsafe { __lasx_xvreplve_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvpermi_w(a: v8i32, b: v8i32) -> v8i32 { +pub fn lasx_xvpermi_w(a: v8i32, b: v8i32) -> v8i32 { static_assert_uimm_bits!(IMM8, 8); - __lasx_xvpermi_w(a, b, IMM8) + unsafe { __lasx_xvpermi_w(a, b, IMM8) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvandn_v(a: v32u8, b: v32u8) -> v32u8 { - __lasx_xvandn_v(a, b) +pub fn lasx_xvandn_v(a: v32u8, b: v32u8) -> v32u8 { + unsafe { __lasx_xvandn_v(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvneg_b(a: v32i8) -> v32i8 { - __lasx_xvneg_b(a) +pub fn lasx_xvneg_b(a: v32i8) -> v32i8 { + unsafe { __lasx_xvneg_b(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvneg_h(a: v16i16) -> v16i16 { - __lasx_xvneg_h(a) +pub fn lasx_xvneg_h(a: v16i16) -> v16i16 { + unsafe { __lasx_xvneg_h(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvneg_w(a: v8i32) -> v8i32 { - __lasx_xvneg_w(a) +pub fn lasx_xvneg_w(a: v8i32) -> v8i32 { + unsafe { __lasx_xvneg_w(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvneg_d(a: v4i64) -> v4i64 { - __lasx_xvneg_d(a) +pub fn lasx_xvneg_d(a: v4i64) -> v4i64 { + unsafe { __lasx_xvneg_d(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmuh_b(a: v32i8, b: v32i8) -> v32i8 { - __lasx_xvmuh_b(a, b) +pub fn lasx_xvmuh_b(a: v32i8, b: v32i8) -> v32i8 { + unsafe { __lasx_xvmuh_b(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmuh_h(a: v16i16, b: v16i16) -> v16i16 { - __lasx_xvmuh_h(a, b) +pub fn lasx_xvmuh_h(a: v16i16, b: v16i16) -> v16i16 { + unsafe { __lasx_xvmuh_h(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmuh_w(a: v8i32, b: v8i32) -> v8i32 { - __lasx_xvmuh_w(a, b) +pub fn lasx_xvmuh_w(a: v8i32, b: v8i32) -> v8i32 { + unsafe { __lasx_xvmuh_w(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmuh_d(a: v4i64, b: v4i64) -> v4i64 { - __lasx_xvmuh_d(a, b) +pub fn lasx_xvmuh_d(a: v4i64, b: v4i64) -> v4i64 { + unsafe { __lasx_xvmuh_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmuh_bu(a: v32u8, b: v32u8) -> v32u8 { - __lasx_xvmuh_bu(a, b) +pub fn lasx_xvmuh_bu(a: v32u8, b: v32u8) -> v32u8 { + unsafe { __lasx_xvmuh_bu(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmuh_hu(a: v16u16, b: v16u16) -> v16u16 { - __lasx_xvmuh_hu(a, b) +pub fn lasx_xvmuh_hu(a: v16u16, b: v16u16) -> v16u16 { + unsafe { __lasx_xvmuh_hu(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmuh_wu(a: v8u32, b: v8u32) -> v8u32 { - __lasx_xvmuh_wu(a, b) +pub fn lasx_xvmuh_wu(a: v8u32, b: v8u32) -> v8u32 { + unsafe { __lasx_xvmuh_wu(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmuh_du(a: v4u64, b: v4u64) -> v4u64 { - __lasx_xvmuh_du(a, b) +pub fn lasx_xvmuh_du(a: v4u64, b: v4u64) -> v4u64 { + unsafe { __lasx_xvmuh_du(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsllwil_h_b(a: v32i8) -> v16i16 { +pub fn lasx_xvsllwil_h_b(a: v32i8) -> v16i16 { static_assert_uimm_bits!(IMM3, 3); - __lasx_xvsllwil_h_b(a, IMM3) + unsafe { __lasx_xvsllwil_h_b(a, IMM3) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsllwil_w_h(a: v16i16) -> v8i32 { +pub fn lasx_xvsllwil_w_h(a: v16i16) -> v8i32 { static_assert_uimm_bits!(IMM4, 4); - __lasx_xvsllwil_w_h(a, IMM4) + unsafe { __lasx_xvsllwil_w_h(a, IMM4) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsllwil_d_w(a: v8i32) -> v4i64 { +pub fn lasx_xvsllwil_d_w(a: v8i32) -> v4i64 { static_assert_uimm_bits!(IMM5, 5); - __lasx_xvsllwil_d_w(a, IMM5) + unsafe { __lasx_xvsllwil_d_w(a, IMM5) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsllwil_hu_bu(a: v32u8) -> v16u16 { +pub fn lasx_xvsllwil_hu_bu(a: v32u8) -> v16u16 { static_assert_uimm_bits!(IMM3, 3); - __lasx_xvsllwil_hu_bu(a, IMM3) + unsafe { __lasx_xvsllwil_hu_bu(a, IMM3) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsllwil_wu_hu(a: v16u16) -> v8u32 { +pub fn lasx_xvsllwil_wu_hu(a: v16u16) -> v8u32 { static_assert_uimm_bits!(IMM4, 4); - __lasx_xvsllwil_wu_hu(a, IMM4) + unsafe { __lasx_xvsllwil_wu_hu(a, IMM4) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsllwil_du_wu(a: v8u32) -> v4u64 { +pub fn lasx_xvsllwil_du_wu(a: v8u32) -> v4u64 { static_assert_uimm_bits!(IMM5, 5); - __lasx_xvsllwil_du_wu(a, IMM5) + unsafe { __lasx_xvsllwil_du_wu(a, IMM5) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsran_b_h(a: v16i16, b: v16i16) -> v32i8 { - __lasx_xvsran_b_h(a, b) +pub fn lasx_xvsran_b_h(a: v16i16, b: v16i16) -> v32i8 { + unsafe { __lasx_xvsran_b_h(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsran_h_w(a: v8i32, b: v8i32) -> v16i16 { - __lasx_xvsran_h_w(a, b) +pub fn lasx_xvsran_h_w(a: v8i32, b: v8i32) -> v16i16 { + unsafe { __lasx_xvsran_h_w(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsran_w_d(a: v4i64, b: v4i64) -> v8i32 { - __lasx_xvsran_w_d(a, b) +pub fn lasx_xvsran_w_d(a: v4i64, b: v4i64) -> v8i32 { + unsafe { __lasx_xvsran_w_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvssran_b_h(a: v16i16, b: v16i16) -> v32i8 { - __lasx_xvssran_b_h(a, b) +pub fn lasx_xvssran_b_h(a: v16i16, b: v16i16) -> v32i8 { + unsafe { __lasx_xvssran_b_h(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvssran_h_w(a: v8i32, b: v8i32) -> v16i16 { - __lasx_xvssran_h_w(a, b) +pub fn lasx_xvssran_h_w(a: v8i32, b: v8i32) -> v16i16 { + unsafe { __lasx_xvssran_h_w(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvssran_w_d(a: v4i64, b: v4i64) -> v8i32 { - __lasx_xvssran_w_d(a, b) +pub fn lasx_xvssran_w_d(a: v4i64, b: v4i64) -> v8i32 { + unsafe { __lasx_xvssran_w_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvssran_bu_h(a: v16u16, b: v16u16) -> v32u8 { - __lasx_xvssran_bu_h(a, b) +pub fn lasx_xvssran_bu_h(a: v16u16, b: v16u16) -> v32u8 { + unsafe { __lasx_xvssran_bu_h(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvssran_hu_w(a: v8u32, b: v8u32) -> v16u16 { - __lasx_xvssran_hu_w(a, b) +pub fn lasx_xvssran_hu_w(a: v8u32, b: v8u32) -> v16u16 { + unsafe { __lasx_xvssran_hu_w(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvssran_wu_d(a: v4u64, b: v4u64) -> v8u32 { - __lasx_xvssran_wu_d(a, b) +pub fn lasx_xvssran_wu_d(a: v4u64, b: v4u64) -> v8u32 { + unsafe { __lasx_xvssran_wu_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsrarn_b_h(a: v16i16, b: v16i16) -> v32i8 { - __lasx_xvsrarn_b_h(a, b) +pub fn lasx_xvsrarn_b_h(a: v16i16, b: v16i16) -> v32i8 { + unsafe { __lasx_xvsrarn_b_h(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsrarn_h_w(a: v8i32, b: v8i32) -> v16i16 { - __lasx_xvsrarn_h_w(a, b) +pub fn lasx_xvsrarn_h_w(a: v8i32, b: v8i32) -> v16i16 { + unsafe { __lasx_xvsrarn_h_w(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsrarn_w_d(a: v4i64, b: v4i64) -> v8i32 { - __lasx_xvsrarn_w_d(a, b) +pub fn lasx_xvsrarn_w_d(a: v4i64, b: v4i64) -> v8i32 { + unsafe { __lasx_xvsrarn_w_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvssrarn_b_h(a: v16i16, b: v16i16) -> v32i8 { - __lasx_xvssrarn_b_h(a, b) +pub fn lasx_xvssrarn_b_h(a: v16i16, b: v16i16) -> v32i8 { + unsafe { __lasx_xvssrarn_b_h(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvssrarn_h_w(a: v8i32, b: v8i32) -> v16i16 { - __lasx_xvssrarn_h_w(a, b) +pub fn lasx_xvssrarn_h_w(a: v8i32, b: v8i32) -> v16i16 { + unsafe { __lasx_xvssrarn_h_w(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvssrarn_w_d(a: v4i64, b: v4i64) -> v8i32 { - __lasx_xvssrarn_w_d(a, b) +pub fn lasx_xvssrarn_w_d(a: v4i64, b: v4i64) -> v8i32 { + unsafe { __lasx_xvssrarn_w_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvssrarn_bu_h(a: v16u16, b: v16u16) -> v32u8 { - __lasx_xvssrarn_bu_h(a, b) +pub fn lasx_xvssrarn_bu_h(a: v16u16, b: v16u16) -> v32u8 { + unsafe { __lasx_xvssrarn_bu_h(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvssrarn_hu_w(a: v8u32, b: v8u32) -> v16u16 { - __lasx_xvssrarn_hu_w(a, b) +pub fn lasx_xvssrarn_hu_w(a: v8u32, b: v8u32) -> v16u16 { + unsafe { __lasx_xvssrarn_hu_w(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvssrarn_wu_d(a: v4u64, b: v4u64) -> v8u32 { - __lasx_xvssrarn_wu_d(a, b) +pub fn lasx_xvssrarn_wu_d(a: v4u64, b: v4u64) -> v8u32 { + unsafe { __lasx_xvssrarn_wu_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsrln_b_h(a: v16i16, b: v16i16) -> v32i8 { - __lasx_xvsrln_b_h(a, b) +pub fn lasx_xvsrln_b_h(a: v16i16, b: v16i16) -> v32i8 { + unsafe { __lasx_xvsrln_b_h(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsrln_h_w(a: v8i32, b: v8i32) -> v16i16 { - __lasx_xvsrln_h_w(a, b) +pub fn lasx_xvsrln_h_w(a: v8i32, b: v8i32) -> v16i16 { + unsafe { __lasx_xvsrln_h_w(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsrln_w_d(a: v4i64, b: v4i64) -> v8i32 { - __lasx_xvsrln_w_d(a, b) +pub fn lasx_xvsrln_w_d(a: v4i64, b: v4i64) -> v8i32 { + unsafe { __lasx_xvsrln_w_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvssrln_bu_h(a: v16u16, b: v16u16) -> v32u8 { - __lasx_xvssrln_bu_h(a, b) +pub fn lasx_xvssrln_bu_h(a: v16u16, b: v16u16) -> v32u8 { + unsafe { __lasx_xvssrln_bu_h(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvssrln_hu_w(a: v8u32, b: v8u32) -> v16u16 { - __lasx_xvssrln_hu_w(a, b) +pub fn lasx_xvssrln_hu_w(a: v8u32, b: v8u32) -> v16u16 { + unsafe { __lasx_xvssrln_hu_w(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvssrln_wu_d(a: v4u64, b: v4u64) -> v8u32 { - __lasx_xvssrln_wu_d(a, b) +pub fn lasx_xvssrln_wu_d(a: v4u64, b: v4u64) -> v8u32 { + unsafe { __lasx_xvssrln_wu_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsrlrn_b_h(a: v16i16, b: v16i16) -> v32i8 { - __lasx_xvsrlrn_b_h(a, b) +pub fn lasx_xvsrlrn_b_h(a: v16i16, b: v16i16) -> v32i8 { + unsafe { __lasx_xvsrlrn_b_h(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsrlrn_h_w(a: v8i32, b: v8i32) -> v16i16 { - __lasx_xvsrlrn_h_w(a, b) +pub fn lasx_xvsrlrn_h_w(a: v8i32, b: v8i32) -> v16i16 { + unsafe { __lasx_xvsrlrn_h_w(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsrlrn_w_d(a: v4i64, b: v4i64) -> v8i32 { - __lasx_xvsrlrn_w_d(a, b) +pub fn lasx_xvsrlrn_w_d(a: v4i64, b: v4i64) -> v8i32 { + unsafe { __lasx_xvsrlrn_w_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvssrlrn_bu_h(a: v16u16, b: v16u16) -> v32u8 { - __lasx_xvssrlrn_bu_h(a, b) +pub fn lasx_xvssrlrn_bu_h(a: v16u16, b: v16u16) -> v32u8 { + unsafe { __lasx_xvssrlrn_bu_h(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvssrlrn_hu_w(a: v8u32, b: v8u32) -> v16u16 { - __lasx_xvssrlrn_hu_w(a, b) +pub fn lasx_xvssrlrn_hu_w(a: v8u32, b: v8u32) -> v16u16 { + unsafe { __lasx_xvssrlrn_hu_w(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvssrlrn_wu_d(a: v4u64, b: v4u64) -> v8u32 { - __lasx_xvssrlrn_wu_d(a, b) +pub fn lasx_xvssrlrn_wu_d(a: v4u64, b: v4u64) -> v8u32 { + unsafe { __lasx_xvssrlrn_wu_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfrstpi_b(a: v32i8, b: v32i8) -> v32i8 { +pub fn lasx_xvfrstpi_b(a: v32i8, b: v32i8) -> v32i8 { static_assert_uimm_bits!(IMM5, 5); - __lasx_xvfrstpi_b(a, b, IMM5) + unsafe { __lasx_xvfrstpi_b(a, b, IMM5) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfrstpi_h(a: v16i16, b: v16i16) -> v16i16 { +pub fn lasx_xvfrstpi_h(a: v16i16, b: v16i16) -> v16i16 { static_assert_uimm_bits!(IMM5, 5); - __lasx_xvfrstpi_h(a, b, IMM5) + unsafe { __lasx_xvfrstpi_h(a, b, IMM5) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfrstp_b(a: v32i8, b: v32i8, c: v32i8) -> v32i8 { - __lasx_xvfrstp_b(a, b, c) +pub fn lasx_xvfrstp_b(a: v32i8, b: v32i8, c: v32i8) -> v32i8 { + unsafe { __lasx_xvfrstp_b(a, b, c) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfrstp_h(a: v16i16, b: v16i16, c: v16i16) -> v16i16 { - __lasx_xvfrstp_h(a, b, c) +pub fn lasx_xvfrstp_h(a: v16i16, b: v16i16, c: v16i16) -> v16i16 { + unsafe { __lasx_xvfrstp_h(a, b, c) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvshuf4i_d(a: v4i64, b: v4i64) -> v4i64 { +pub fn lasx_xvshuf4i_d(a: v4i64, b: v4i64) -> v4i64 { static_assert_uimm_bits!(IMM8, 8); - __lasx_xvshuf4i_d(a, b, IMM8) + unsafe { __lasx_xvshuf4i_d(a, b, IMM8) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvbsrl_v(a: v32i8) -> v32i8 { +pub fn lasx_xvbsrl_v(a: v32i8) -> v32i8 { static_assert_uimm_bits!(IMM5, 5); - __lasx_xvbsrl_v(a, IMM5) + unsafe { __lasx_xvbsrl_v(a, IMM5) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvbsll_v(a: v32i8) -> v32i8 { +pub fn lasx_xvbsll_v(a: v32i8) -> v32i8 { static_assert_uimm_bits!(IMM5, 5); - __lasx_xvbsll_v(a, IMM5) + unsafe { __lasx_xvbsll_v(a, IMM5) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvextrins_b(a: v32i8, b: v32i8) -> v32i8 { +pub fn lasx_xvextrins_b(a: v32i8, b: v32i8) -> v32i8 { static_assert_uimm_bits!(IMM8, 8); - __lasx_xvextrins_b(a, b, IMM8) + unsafe { __lasx_xvextrins_b(a, b, IMM8) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvextrins_h(a: v16i16, b: v16i16) -> v16i16 { +pub fn lasx_xvextrins_h(a: v16i16, b: v16i16) -> v16i16 { static_assert_uimm_bits!(IMM8, 8); - __lasx_xvextrins_h(a, b, IMM8) + unsafe { __lasx_xvextrins_h(a, b, IMM8) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvextrins_w(a: v8i32, b: v8i32) -> v8i32 { +pub fn lasx_xvextrins_w(a: v8i32, b: v8i32) -> v8i32 { static_assert_uimm_bits!(IMM8, 8); - __lasx_xvextrins_w(a, b, IMM8) + unsafe { __lasx_xvextrins_w(a, b, IMM8) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvextrins_d(a: v4i64, b: v4i64) -> v4i64 { +pub fn lasx_xvextrins_d(a: v4i64, b: v4i64) -> v4i64 { static_assert_uimm_bits!(IMM8, 8); - __lasx_xvextrins_d(a, b, IMM8) + unsafe { __lasx_xvextrins_d(a, b, IMM8) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmskltz_b(a: v32i8) -> v32i8 { - __lasx_xvmskltz_b(a) +pub fn lasx_xvmskltz_b(a: v32i8) -> v32i8 { + unsafe { __lasx_xvmskltz_b(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmskltz_h(a: v16i16) -> v16i16 { - __lasx_xvmskltz_h(a) +pub fn lasx_xvmskltz_h(a: v16i16) -> v16i16 { + unsafe { __lasx_xvmskltz_h(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmskltz_w(a: v8i32) -> v8i32 { - __lasx_xvmskltz_w(a) +pub fn lasx_xvmskltz_w(a: v8i32) -> v8i32 { + unsafe { __lasx_xvmskltz_w(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmskltz_d(a: v4i64) -> v4i64 { - __lasx_xvmskltz_d(a) +pub fn lasx_xvmskltz_d(a: v4i64) -> v4i64 { + unsafe { __lasx_xvmskltz_d(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsigncov_b(a: v32i8, b: v32i8) -> v32i8 { - __lasx_xvsigncov_b(a, b) +pub fn lasx_xvsigncov_b(a: v32i8, b: v32i8) -> v32i8 { + unsafe { __lasx_xvsigncov_b(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsigncov_h(a: v16i16, b: v16i16) -> v16i16 { - __lasx_xvsigncov_h(a, b) +pub fn lasx_xvsigncov_h(a: v16i16, b: v16i16) -> v16i16 { + unsafe { __lasx_xvsigncov_h(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsigncov_w(a: v8i32, b: v8i32) -> v8i32 { - __lasx_xvsigncov_w(a, b) +pub fn lasx_xvsigncov_w(a: v8i32, b: v8i32) -> v8i32 { + unsafe { __lasx_xvsigncov_w(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsigncov_d(a: v4i64, b: v4i64) -> v4i64 { - __lasx_xvsigncov_d(a, b) +pub fn lasx_xvsigncov_d(a: v4i64, b: v4i64) -> v4i64 { + unsafe { __lasx_xvsigncov_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfmadd_s(a: v8f32, b: v8f32, c: v8f32) -> v8f32 { - __lasx_xvfmadd_s(a, b, c) +pub fn lasx_xvfmadd_s(a: v8f32, b: v8f32, c: v8f32) -> v8f32 { + unsafe { __lasx_xvfmadd_s(a, b, c) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfmadd_d(a: v4f64, b: v4f64, c: v4f64) -> v4f64 { - __lasx_xvfmadd_d(a, b, c) +pub fn lasx_xvfmadd_d(a: v4f64, b: v4f64, c: v4f64) -> v4f64 { + unsafe { __lasx_xvfmadd_d(a, b, c) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfmsub_s(a: v8f32, b: v8f32, c: v8f32) -> v8f32 { - __lasx_xvfmsub_s(a, b, c) +pub fn lasx_xvfmsub_s(a: v8f32, b: v8f32, c: v8f32) -> v8f32 { + unsafe { __lasx_xvfmsub_s(a, b, c) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfmsub_d(a: v4f64, b: v4f64, c: v4f64) -> v4f64 { - __lasx_xvfmsub_d(a, b, c) +pub fn lasx_xvfmsub_d(a: v4f64, b: v4f64, c: v4f64) -> v4f64 { + unsafe { __lasx_xvfmsub_d(a, b, c) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfnmadd_s(a: v8f32, b: v8f32, c: v8f32) -> v8f32 { - __lasx_xvfnmadd_s(a, b, c) +pub fn lasx_xvfnmadd_s(a: v8f32, b: v8f32, c: v8f32) -> v8f32 { + unsafe { __lasx_xvfnmadd_s(a, b, c) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfnmadd_d(a: v4f64, b: v4f64, c: v4f64) -> v4f64 { - __lasx_xvfnmadd_d(a, b, c) +pub fn lasx_xvfnmadd_d(a: v4f64, b: v4f64, c: v4f64) -> v4f64 { + unsafe { __lasx_xvfnmadd_d(a, b, c) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfnmsub_s(a: v8f32, b: v8f32, c: v8f32) -> v8f32 { - __lasx_xvfnmsub_s(a, b, c) +pub fn lasx_xvfnmsub_s(a: v8f32, b: v8f32, c: v8f32) -> v8f32 { + unsafe { __lasx_xvfnmsub_s(a, b, c) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfnmsub_d(a: v4f64, b: v4f64, c: v4f64) -> v4f64 { - __lasx_xvfnmsub_d(a, b, c) +pub fn lasx_xvfnmsub_d(a: v4f64, b: v4f64, c: v4f64) -> v4f64 { + unsafe { __lasx_xvfnmsub_d(a, b, c) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvftintrne_w_s(a: v8f32) -> v8i32 { - __lasx_xvftintrne_w_s(a) +pub fn lasx_xvftintrne_w_s(a: v8f32) -> v8i32 { + unsafe { __lasx_xvftintrne_w_s(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvftintrne_l_d(a: v4f64) -> v4i64 { - __lasx_xvftintrne_l_d(a) +pub fn lasx_xvftintrne_l_d(a: v4f64) -> v4i64 { + unsafe { __lasx_xvftintrne_l_d(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvftintrp_w_s(a: v8f32) -> v8i32 { - __lasx_xvftintrp_w_s(a) +pub fn lasx_xvftintrp_w_s(a: v8f32) -> v8i32 { + unsafe { __lasx_xvftintrp_w_s(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvftintrp_l_d(a: v4f64) -> v4i64 { - __lasx_xvftintrp_l_d(a) +pub fn lasx_xvftintrp_l_d(a: v4f64) -> v4i64 { + unsafe { __lasx_xvftintrp_l_d(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvftintrm_w_s(a: v8f32) -> v8i32 { - __lasx_xvftintrm_w_s(a) +pub fn lasx_xvftintrm_w_s(a: v8f32) -> v8i32 { + unsafe { __lasx_xvftintrm_w_s(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvftintrm_l_d(a: v4f64) -> v4i64 { - __lasx_xvftintrm_l_d(a) +pub fn lasx_xvftintrm_l_d(a: v4f64) -> v4i64 { + unsafe { __lasx_xvftintrm_l_d(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvftint_w_d(a: v4f64, b: v4f64) -> v8i32 { - __lasx_xvftint_w_d(a, b) +pub fn lasx_xvftint_w_d(a: v4f64, b: v4f64) -> v8i32 { + unsafe { __lasx_xvftint_w_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvffint_s_l(a: v4i64, b: v4i64) -> v8f32 { - __lasx_xvffint_s_l(a, b) +pub fn lasx_xvffint_s_l(a: v4i64, b: v4i64) -> v8f32 { + unsafe { __lasx_xvffint_s_l(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvftintrz_w_d(a: v4f64, b: v4f64) -> v8i32 { - __lasx_xvftintrz_w_d(a, b) +pub fn lasx_xvftintrz_w_d(a: v4f64, b: v4f64) -> v8i32 { + unsafe { __lasx_xvftintrz_w_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvftintrp_w_d(a: v4f64, b: v4f64) -> v8i32 { - __lasx_xvftintrp_w_d(a, b) +pub fn lasx_xvftintrp_w_d(a: v4f64, b: v4f64) -> v8i32 { + unsafe { __lasx_xvftintrp_w_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvftintrm_w_d(a: v4f64, b: v4f64) -> v8i32 { - __lasx_xvftintrm_w_d(a, b) +pub fn lasx_xvftintrm_w_d(a: v4f64, b: v4f64) -> v8i32 { + unsafe { __lasx_xvftintrm_w_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvftintrne_w_d(a: v4f64, b: v4f64) -> v8i32 { - __lasx_xvftintrne_w_d(a, b) +pub fn lasx_xvftintrne_w_d(a: v4f64, b: v4f64) -> v8i32 { + unsafe { __lasx_xvftintrne_w_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvftinth_l_s(a: v8f32) -> v4i64 { - __lasx_xvftinth_l_s(a) +pub fn lasx_xvftinth_l_s(a: v8f32) -> v4i64 { + unsafe { __lasx_xvftinth_l_s(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvftintl_l_s(a: v8f32) -> v4i64 { - __lasx_xvftintl_l_s(a) +pub fn lasx_xvftintl_l_s(a: v8f32) -> v4i64 { + unsafe { __lasx_xvftintl_l_s(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvffinth_d_w(a: v8i32) -> v4f64 { - __lasx_xvffinth_d_w(a) +pub fn lasx_xvffinth_d_w(a: v8i32) -> v4f64 { + unsafe { __lasx_xvffinth_d_w(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvffintl_d_w(a: v8i32) -> v4f64 { - __lasx_xvffintl_d_w(a) +pub fn lasx_xvffintl_d_w(a: v8i32) -> v4f64 { + unsafe { __lasx_xvffintl_d_w(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvftintrzh_l_s(a: v8f32) -> v4i64 { - __lasx_xvftintrzh_l_s(a) +pub fn lasx_xvftintrzh_l_s(a: v8f32) -> v4i64 { + unsafe { __lasx_xvftintrzh_l_s(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvftintrzl_l_s(a: v8f32) -> v4i64 { - __lasx_xvftintrzl_l_s(a) +pub fn lasx_xvftintrzl_l_s(a: v8f32) -> v4i64 { + unsafe { __lasx_xvftintrzl_l_s(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvftintrph_l_s(a: v8f32) -> v4i64 { - __lasx_xvftintrph_l_s(a) +pub fn lasx_xvftintrph_l_s(a: v8f32) -> v4i64 { + unsafe { __lasx_xvftintrph_l_s(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvftintrpl_l_s(a: v8f32) -> v4i64 { - __lasx_xvftintrpl_l_s(a) +pub fn lasx_xvftintrpl_l_s(a: v8f32) -> v4i64 { + unsafe { __lasx_xvftintrpl_l_s(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvftintrmh_l_s(a: v8f32) -> v4i64 { - __lasx_xvftintrmh_l_s(a) +pub fn lasx_xvftintrmh_l_s(a: v8f32) -> v4i64 { + unsafe { __lasx_xvftintrmh_l_s(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvftintrml_l_s(a: v8f32) -> v4i64 { - __lasx_xvftintrml_l_s(a) +pub fn lasx_xvftintrml_l_s(a: v8f32) -> v4i64 { + unsafe { __lasx_xvftintrml_l_s(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvftintrneh_l_s(a: v8f32) -> v4i64 { - __lasx_xvftintrneh_l_s(a) +pub fn lasx_xvftintrneh_l_s(a: v8f32) -> v4i64 { + unsafe { __lasx_xvftintrneh_l_s(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvftintrnel_l_s(a: v8f32) -> v4i64 { - __lasx_xvftintrnel_l_s(a) +pub fn lasx_xvftintrnel_l_s(a: v8f32) -> v4i64 { + unsafe { __lasx_xvftintrnel_l_s(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfrintrne_s(a: v8f32) -> v8f32 { - __lasx_xvfrintrne_s(a) +pub fn lasx_xvfrintrne_s(a: v8f32) -> v8f32 { + unsafe { __lasx_xvfrintrne_s(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfrintrne_d(a: v4f64) -> v4f64 { - __lasx_xvfrintrne_d(a) +pub fn lasx_xvfrintrne_d(a: v4f64) -> v4f64 { + unsafe { __lasx_xvfrintrne_d(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfrintrz_s(a: v8f32) -> v8f32 { - __lasx_xvfrintrz_s(a) +pub fn lasx_xvfrintrz_s(a: v8f32) -> v8f32 { + unsafe { __lasx_xvfrintrz_s(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfrintrz_d(a: v4f64) -> v4f64 { - __lasx_xvfrintrz_d(a) +pub fn lasx_xvfrintrz_d(a: v4f64) -> v4f64 { + unsafe { __lasx_xvfrintrz_d(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfrintrp_s(a: v8f32) -> v8f32 { - __lasx_xvfrintrp_s(a) +pub fn lasx_xvfrintrp_s(a: v8f32) -> v8f32 { + unsafe { __lasx_xvfrintrp_s(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfrintrp_d(a: v4f64) -> v4f64 { - __lasx_xvfrintrp_d(a) +pub fn lasx_xvfrintrp_d(a: v4f64) -> v4f64 { + unsafe { __lasx_xvfrintrp_d(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfrintrm_s(a: v8f32) -> v8f32 { - __lasx_xvfrintrm_s(a) +pub fn lasx_xvfrintrm_s(a: v8f32) -> v8f32 { + unsafe { __lasx_xvfrintrm_s(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfrintrm_d(a: v4f64) -> v4f64 { - __lasx_xvfrintrm_d(a) +pub fn lasx_xvfrintrm_d(a: v4f64) -> v4f64 { + unsafe { __lasx_xvfrintrm_d(a) } } #[inline] @@ -5054,94 +5054,94 @@ pub unsafe fn lasx_xvstelm_d(a: v4i64, mem_a #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvinsve0_w(a: v8i32, b: v8i32) -> v8i32 { +pub fn lasx_xvinsve0_w(a: v8i32, b: v8i32) -> v8i32 { static_assert_uimm_bits!(IMM3, 3); - __lasx_xvinsve0_w(a, b, IMM3) + unsafe { __lasx_xvinsve0_w(a, b, IMM3) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvinsve0_d(a: v4i64, b: v4i64) -> v4i64 { +pub fn lasx_xvinsve0_d(a: v4i64, b: v4i64) -> v4i64 { static_assert_uimm_bits!(IMM2, 2); - __lasx_xvinsve0_d(a, b, IMM2) + unsafe { __lasx_xvinsve0_d(a, b, IMM2) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvpickve_w(a: v8i32) -> v8i32 { +pub fn lasx_xvpickve_w(a: v8i32) -> v8i32 { static_assert_uimm_bits!(IMM3, 3); - __lasx_xvpickve_w(a, IMM3) + unsafe { __lasx_xvpickve_w(a, IMM3) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvpickve_d(a: v4i64) -> v4i64 { +pub fn lasx_xvpickve_d(a: v4i64) -> v4i64 { static_assert_uimm_bits!(IMM2, 2); - __lasx_xvpickve_d(a, IMM2) + unsafe { __lasx_xvpickve_d(a, IMM2) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvssrlrn_b_h(a: v16i16, b: v16i16) -> v32i8 { - __lasx_xvssrlrn_b_h(a, b) +pub fn lasx_xvssrlrn_b_h(a: v16i16, b: v16i16) -> v32i8 { + unsafe { __lasx_xvssrlrn_b_h(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvssrlrn_h_w(a: v8i32, b: v8i32) -> v16i16 { - __lasx_xvssrlrn_h_w(a, b) +pub fn lasx_xvssrlrn_h_w(a: v8i32, b: v8i32) -> v16i16 { + unsafe { __lasx_xvssrlrn_h_w(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvssrlrn_w_d(a: v4i64, b: v4i64) -> v8i32 { - __lasx_xvssrlrn_w_d(a, b) +pub fn lasx_xvssrlrn_w_d(a: v4i64, b: v4i64) -> v8i32 { + unsafe { __lasx_xvssrlrn_w_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvssrln_b_h(a: v16i16, b: v16i16) -> v32i8 { - __lasx_xvssrln_b_h(a, b) +pub fn lasx_xvssrln_b_h(a: v16i16, b: v16i16) -> v32i8 { + unsafe { __lasx_xvssrln_b_h(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvssrln_h_w(a: v8i32, b: v8i32) -> v16i16 { - __lasx_xvssrln_h_w(a, b) +pub fn lasx_xvssrln_h_w(a: v8i32, b: v8i32) -> v16i16 { + unsafe { __lasx_xvssrln_h_w(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvssrln_w_d(a: v4i64, b: v4i64) -> v8i32 { - __lasx_xvssrln_w_d(a, b) +pub fn lasx_xvssrln_w_d(a: v4i64, b: v4i64) -> v8i32 { + unsafe { __lasx_xvssrln_w_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvorn_v(a: v32i8, b: v32i8) -> v32i8 { - __lasx_xvorn_v(a, b) +pub fn lasx_xvorn_v(a: v32i8, b: v32i8) -> v32i8 { + unsafe { __lasx_xvorn_v(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(0)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvldi() -> v4i64 { +pub fn lasx_xvldi() -> v4i64 { static_assert_simm_bits!(IMM_S13, 13); - __lasx_xvldi(IMM_S13) + unsafe { __lasx_xvldi(IMM_S13) } } #[inline] @@ -5161,170 +5161,170 @@ pub unsafe fn lasx_xvstx(a: v32i8, mem_addr: *mut i8, b: i64) { #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvextl_qu_du(a: v4u64) -> v4u64 { - __lasx_xvextl_qu_du(a) +pub fn lasx_xvextl_qu_du(a: v4u64) -> v4u64 { + unsafe { __lasx_xvextl_qu_du(a) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvinsgr2vr_w(a: v8i32, b: i32) -> v8i32 { +pub fn lasx_xvinsgr2vr_w(a: v8i32, b: i32) -> v8i32 { static_assert_uimm_bits!(IMM3, 3); - __lasx_xvinsgr2vr_w(a, b, IMM3) + unsafe { __lasx_xvinsgr2vr_w(a, b, IMM3) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvinsgr2vr_d(a: v4i64, b: i64) -> v4i64 { +pub fn lasx_xvinsgr2vr_d(a: v4i64, b: i64) -> v4i64 { static_assert_uimm_bits!(IMM2, 2); - __lasx_xvinsgr2vr_d(a, b, IMM2) + unsafe { __lasx_xvinsgr2vr_d(a, b, IMM2) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvreplve0_b(a: v32i8) -> v32i8 { - __lasx_xvreplve0_b(a) +pub fn lasx_xvreplve0_b(a: v32i8) -> v32i8 { + unsafe { __lasx_xvreplve0_b(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvreplve0_h(a: v16i16) -> v16i16 { - __lasx_xvreplve0_h(a) +pub fn lasx_xvreplve0_h(a: v16i16) -> v16i16 { + unsafe { __lasx_xvreplve0_h(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvreplve0_w(a: v8i32) -> v8i32 { - __lasx_xvreplve0_w(a) +pub fn lasx_xvreplve0_w(a: v8i32) -> v8i32 { + unsafe { __lasx_xvreplve0_w(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvreplve0_d(a: v4i64) -> v4i64 { - __lasx_xvreplve0_d(a) +pub fn lasx_xvreplve0_d(a: v4i64) -> v4i64 { + unsafe { __lasx_xvreplve0_d(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvreplve0_q(a: v32i8) -> v32i8 { - __lasx_xvreplve0_q(a) +pub fn lasx_xvreplve0_q(a: v32i8) -> v32i8 { + unsafe { __lasx_xvreplve0_q(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_vext2xv_h_b(a: v32i8) -> v16i16 { - __lasx_vext2xv_h_b(a) +pub fn lasx_vext2xv_h_b(a: v32i8) -> v16i16 { + unsafe { __lasx_vext2xv_h_b(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_vext2xv_w_h(a: v16i16) -> v8i32 { - __lasx_vext2xv_w_h(a) +pub fn lasx_vext2xv_w_h(a: v16i16) -> v8i32 { + unsafe { __lasx_vext2xv_w_h(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_vext2xv_d_w(a: v8i32) -> v4i64 { - __lasx_vext2xv_d_w(a) +pub fn lasx_vext2xv_d_w(a: v8i32) -> v4i64 { + unsafe { __lasx_vext2xv_d_w(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_vext2xv_w_b(a: v32i8) -> v8i32 { - __lasx_vext2xv_w_b(a) +pub fn lasx_vext2xv_w_b(a: v32i8) -> v8i32 { + unsafe { __lasx_vext2xv_w_b(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_vext2xv_d_h(a: v16i16) -> v4i64 { - __lasx_vext2xv_d_h(a) +pub fn lasx_vext2xv_d_h(a: v16i16) -> v4i64 { + unsafe { __lasx_vext2xv_d_h(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_vext2xv_d_b(a: v32i8) -> v4i64 { - __lasx_vext2xv_d_b(a) +pub fn lasx_vext2xv_d_b(a: v32i8) -> v4i64 { + unsafe { __lasx_vext2xv_d_b(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_vext2xv_hu_bu(a: v32i8) -> v16i16 { - __lasx_vext2xv_hu_bu(a) +pub fn lasx_vext2xv_hu_bu(a: v32i8) -> v16i16 { + unsafe { __lasx_vext2xv_hu_bu(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_vext2xv_wu_hu(a: v16i16) -> v8i32 { - __lasx_vext2xv_wu_hu(a) +pub fn lasx_vext2xv_wu_hu(a: v16i16) -> v8i32 { + unsafe { __lasx_vext2xv_wu_hu(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_vext2xv_du_wu(a: v8i32) -> v4i64 { - __lasx_vext2xv_du_wu(a) +pub fn lasx_vext2xv_du_wu(a: v8i32) -> v4i64 { + unsafe { __lasx_vext2xv_du_wu(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_vext2xv_wu_bu(a: v32i8) -> v8i32 { - __lasx_vext2xv_wu_bu(a) +pub fn lasx_vext2xv_wu_bu(a: v32i8) -> v8i32 { + unsafe { __lasx_vext2xv_wu_bu(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_vext2xv_du_hu(a: v16i16) -> v4i64 { - __lasx_vext2xv_du_hu(a) +pub fn lasx_vext2xv_du_hu(a: v16i16) -> v4i64 { + unsafe { __lasx_vext2xv_du_hu(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_vext2xv_du_bu(a: v32i8) -> v4i64 { - __lasx_vext2xv_du_bu(a) +pub fn lasx_vext2xv_du_bu(a: v32i8) -> v4i64 { + unsafe { __lasx_vext2xv_du_bu(a) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvpermi_q(a: v32i8, b: v32i8) -> v32i8 { +pub fn lasx_xvpermi_q(a: v32i8, b: v32i8) -> v32i8 { static_assert_uimm_bits!(IMM8, 8); - __lasx_xvpermi_q(a, b, IMM8) + unsafe { __lasx_xvpermi_q(a, b, IMM8) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvpermi_d(a: v4i64) -> v4i64 { +pub fn lasx_xvpermi_d(a: v4i64) -> v4i64 { static_assert_uimm_bits!(IMM8, 8); - __lasx_xvpermi_d(a, IMM8) + unsafe { __lasx_xvpermi_d(a, IMM8) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvperm_w(a: v8i32, b: v8i32) -> v8i32 { - __lasx_xvperm_w(a, b) +pub fn lasx_xvperm_w(a: v8i32, b: v8i32) -> v8i32 { + unsafe { __lasx_xvperm_w(a, b) } } #[inline] @@ -5367,1697 +5367,1697 @@ pub unsafe fn lasx_xvldrepl_d(mem_addr: *const i8) -> v4i64 { #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvpickve2gr_w(a: v8i32) -> i32 { +pub fn lasx_xvpickve2gr_w(a: v8i32) -> i32 { static_assert_uimm_bits!(IMM3, 3); - __lasx_xvpickve2gr_w(a, IMM3) + unsafe { __lasx_xvpickve2gr_w(a, IMM3) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvpickve2gr_wu(a: v8i32) -> u32 { +pub fn lasx_xvpickve2gr_wu(a: v8i32) -> u32 { static_assert_uimm_bits!(IMM3, 3); - __lasx_xvpickve2gr_wu(a, IMM3) + unsafe { __lasx_xvpickve2gr_wu(a, IMM3) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvpickve2gr_d(a: v4i64) -> i64 { +pub fn lasx_xvpickve2gr_d(a: v4i64) -> i64 { static_assert_uimm_bits!(IMM2, 2); - __lasx_xvpickve2gr_d(a, IMM2) + unsafe { __lasx_xvpickve2gr_d(a, IMM2) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvpickve2gr_du(a: v4i64) -> u64 { +pub fn lasx_xvpickve2gr_du(a: v4i64) -> u64 { static_assert_uimm_bits!(IMM2, 2); - __lasx_xvpickve2gr_du(a, IMM2) + unsafe { __lasx_xvpickve2gr_du(a, IMM2) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvaddwev_q_d(a: v4i64, b: v4i64) -> v4i64 { - __lasx_xvaddwev_q_d(a, b) +pub fn lasx_xvaddwev_q_d(a: v4i64, b: v4i64) -> v4i64 { + unsafe { __lasx_xvaddwev_q_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvaddwev_d_w(a: v8i32, b: v8i32) -> v4i64 { - __lasx_xvaddwev_d_w(a, b) +pub fn lasx_xvaddwev_d_w(a: v8i32, b: v8i32) -> v4i64 { + unsafe { __lasx_xvaddwev_d_w(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvaddwev_w_h(a: v16i16, b: v16i16) -> v8i32 { - __lasx_xvaddwev_w_h(a, b) +pub fn lasx_xvaddwev_w_h(a: v16i16, b: v16i16) -> v8i32 { + unsafe { __lasx_xvaddwev_w_h(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvaddwev_h_b(a: v32i8, b: v32i8) -> v16i16 { - __lasx_xvaddwev_h_b(a, b) +pub fn lasx_xvaddwev_h_b(a: v32i8, b: v32i8) -> v16i16 { + unsafe { __lasx_xvaddwev_h_b(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvaddwev_q_du(a: v4u64, b: v4u64) -> v4i64 { - __lasx_xvaddwev_q_du(a, b) +pub fn lasx_xvaddwev_q_du(a: v4u64, b: v4u64) -> v4i64 { + unsafe { __lasx_xvaddwev_q_du(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvaddwev_d_wu(a: v8u32, b: v8u32) -> v4i64 { - __lasx_xvaddwev_d_wu(a, b) +pub fn lasx_xvaddwev_d_wu(a: v8u32, b: v8u32) -> v4i64 { + unsafe { __lasx_xvaddwev_d_wu(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvaddwev_w_hu(a: v16u16, b: v16u16) -> v8i32 { - __lasx_xvaddwev_w_hu(a, b) +pub fn lasx_xvaddwev_w_hu(a: v16u16, b: v16u16) -> v8i32 { + unsafe { __lasx_xvaddwev_w_hu(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvaddwev_h_bu(a: v32u8, b: v32u8) -> v16i16 { - __lasx_xvaddwev_h_bu(a, b) +pub fn lasx_xvaddwev_h_bu(a: v32u8, b: v32u8) -> v16i16 { + unsafe { __lasx_xvaddwev_h_bu(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsubwev_q_d(a: v4i64, b: v4i64) -> v4i64 { - __lasx_xvsubwev_q_d(a, b) +pub fn lasx_xvsubwev_q_d(a: v4i64, b: v4i64) -> v4i64 { + unsafe { __lasx_xvsubwev_q_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsubwev_d_w(a: v8i32, b: v8i32) -> v4i64 { - __lasx_xvsubwev_d_w(a, b) +pub fn lasx_xvsubwev_d_w(a: v8i32, b: v8i32) -> v4i64 { + unsafe { __lasx_xvsubwev_d_w(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsubwev_w_h(a: v16i16, b: v16i16) -> v8i32 { - __lasx_xvsubwev_w_h(a, b) +pub fn lasx_xvsubwev_w_h(a: v16i16, b: v16i16) -> v8i32 { + unsafe { __lasx_xvsubwev_w_h(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsubwev_h_b(a: v32i8, b: v32i8) -> v16i16 { - __lasx_xvsubwev_h_b(a, b) +pub fn lasx_xvsubwev_h_b(a: v32i8, b: v32i8) -> v16i16 { + unsafe { __lasx_xvsubwev_h_b(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsubwev_q_du(a: v4u64, b: v4u64) -> v4i64 { - __lasx_xvsubwev_q_du(a, b) +pub fn lasx_xvsubwev_q_du(a: v4u64, b: v4u64) -> v4i64 { + unsafe { __lasx_xvsubwev_q_du(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsubwev_d_wu(a: v8u32, b: v8u32) -> v4i64 { - __lasx_xvsubwev_d_wu(a, b) +pub fn lasx_xvsubwev_d_wu(a: v8u32, b: v8u32) -> v4i64 { + unsafe { __lasx_xvsubwev_d_wu(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsubwev_w_hu(a: v16u16, b: v16u16) -> v8i32 { - __lasx_xvsubwev_w_hu(a, b) +pub fn lasx_xvsubwev_w_hu(a: v16u16, b: v16u16) -> v8i32 { + unsafe { __lasx_xvsubwev_w_hu(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsubwev_h_bu(a: v32u8, b: v32u8) -> v16i16 { - __lasx_xvsubwev_h_bu(a, b) +pub fn lasx_xvsubwev_h_bu(a: v32u8, b: v32u8) -> v16i16 { + unsafe { __lasx_xvsubwev_h_bu(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmulwev_q_d(a: v4i64, b: v4i64) -> v4i64 { - __lasx_xvmulwev_q_d(a, b) +pub fn lasx_xvmulwev_q_d(a: v4i64, b: v4i64) -> v4i64 { + unsafe { __lasx_xvmulwev_q_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmulwev_d_w(a: v8i32, b: v8i32) -> v4i64 { - __lasx_xvmulwev_d_w(a, b) +pub fn lasx_xvmulwev_d_w(a: v8i32, b: v8i32) -> v4i64 { + unsafe { __lasx_xvmulwev_d_w(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmulwev_w_h(a: v16i16, b: v16i16) -> v8i32 { - __lasx_xvmulwev_w_h(a, b) +pub fn lasx_xvmulwev_w_h(a: v16i16, b: v16i16) -> v8i32 { + unsafe { __lasx_xvmulwev_w_h(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmulwev_h_b(a: v32i8, b: v32i8) -> v16i16 { - __lasx_xvmulwev_h_b(a, b) +pub fn lasx_xvmulwev_h_b(a: v32i8, b: v32i8) -> v16i16 { + unsafe { __lasx_xvmulwev_h_b(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmulwev_q_du(a: v4u64, b: v4u64) -> v4i64 { - __lasx_xvmulwev_q_du(a, b) +pub fn lasx_xvmulwev_q_du(a: v4u64, b: v4u64) -> v4i64 { + unsafe { __lasx_xvmulwev_q_du(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmulwev_d_wu(a: v8u32, b: v8u32) -> v4i64 { - __lasx_xvmulwev_d_wu(a, b) +pub fn lasx_xvmulwev_d_wu(a: v8u32, b: v8u32) -> v4i64 { + unsafe { __lasx_xvmulwev_d_wu(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmulwev_w_hu(a: v16u16, b: v16u16) -> v8i32 { - __lasx_xvmulwev_w_hu(a, b) +pub fn lasx_xvmulwev_w_hu(a: v16u16, b: v16u16) -> v8i32 { + unsafe { __lasx_xvmulwev_w_hu(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmulwev_h_bu(a: v32u8, b: v32u8) -> v16i16 { - __lasx_xvmulwev_h_bu(a, b) +pub fn lasx_xvmulwev_h_bu(a: v32u8, b: v32u8) -> v16i16 { + unsafe { __lasx_xvmulwev_h_bu(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvaddwod_q_d(a: v4i64, b: v4i64) -> v4i64 { - __lasx_xvaddwod_q_d(a, b) +pub fn lasx_xvaddwod_q_d(a: v4i64, b: v4i64) -> v4i64 { + unsafe { __lasx_xvaddwod_q_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvaddwod_d_w(a: v8i32, b: v8i32) -> v4i64 { - __lasx_xvaddwod_d_w(a, b) +pub fn lasx_xvaddwod_d_w(a: v8i32, b: v8i32) -> v4i64 { + unsafe { __lasx_xvaddwod_d_w(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvaddwod_w_h(a: v16i16, b: v16i16) -> v8i32 { - __lasx_xvaddwod_w_h(a, b) +pub fn lasx_xvaddwod_w_h(a: v16i16, b: v16i16) -> v8i32 { + unsafe { __lasx_xvaddwod_w_h(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvaddwod_h_b(a: v32i8, b: v32i8) -> v16i16 { - __lasx_xvaddwod_h_b(a, b) +pub fn lasx_xvaddwod_h_b(a: v32i8, b: v32i8) -> v16i16 { + unsafe { __lasx_xvaddwod_h_b(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvaddwod_q_du(a: v4u64, b: v4u64) -> v4i64 { - __lasx_xvaddwod_q_du(a, b) +pub fn lasx_xvaddwod_q_du(a: v4u64, b: v4u64) -> v4i64 { + unsafe { __lasx_xvaddwod_q_du(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvaddwod_d_wu(a: v8u32, b: v8u32) -> v4i64 { - __lasx_xvaddwod_d_wu(a, b) +pub fn lasx_xvaddwod_d_wu(a: v8u32, b: v8u32) -> v4i64 { + unsafe { __lasx_xvaddwod_d_wu(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvaddwod_w_hu(a: v16u16, b: v16u16) -> v8i32 { - __lasx_xvaddwod_w_hu(a, b) +pub fn lasx_xvaddwod_w_hu(a: v16u16, b: v16u16) -> v8i32 { + unsafe { __lasx_xvaddwod_w_hu(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvaddwod_h_bu(a: v32u8, b: v32u8) -> v16i16 { - __lasx_xvaddwod_h_bu(a, b) +pub fn lasx_xvaddwod_h_bu(a: v32u8, b: v32u8) -> v16i16 { + unsafe { __lasx_xvaddwod_h_bu(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsubwod_q_d(a: v4i64, b: v4i64) -> v4i64 { - __lasx_xvsubwod_q_d(a, b) +pub fn lasx_xvsubwod_q_d(a: v4i64, b: v4i64) -> v4i64 { + unsafe { __lasx_xvsubwod_q_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsubwod_d_w(a: v8i32, b: v8i32) -> v4i64 { - __lasx_xvsubwod_d_w(a, b) +pub fn lasx_xvsubwod_d_w(a: v8i32, b: v8i32) -> v4i64 { + unsafe { __lasx_xvsubwod_d_w(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsubwod_w_h(a: v16i16, b: v16i16) -> v8i32 { - __lasx_xvsubwod_w_h(a, b) +pub fn lasx_xvsubwod_w_h(a: v16i16, b: v16i16) -> v8i32 { + unsafe { __lasx_xvsubwod_w_h(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsubwod_h_b(a: v32i8, b: v32i8) -> v16i16 { - __lasx_xvsubwod_h_b(a, b) +pub fn lasx_xvsubwod_h_b(a: v32i8, b: v32i8) -> v16i16 { + unsafe { __lasx_xvsubwod_h_b(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsubwod_q_du(a: v4u64, b: v4u64) -> v4i64 { - __lasx_xvsubwod_q_du(a, b) +pub fn lasx_xvsubwod_q_du(a: v4u64, b: v4u64) -> v4i64 { + unsafe { __lasx_xvsubwod_q_du(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsubwod_d_wu(a: v8u32, b: v8u32) -> v4i64 { - __lasx_xvsubwod_d_wu(a, b) +pub fn lasx_xvsubwod_d_wu(a: v8u32, b: v8u32) -> v4i64 { + unsafe { __lasx_xvsubwod_d_wu(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsubwod_w_hu(a: v16u16, b: v16u16) -> v8i32 { - __lasx_xvsubwod_w_hu(a, b) +pub fn lasx_xvsubwod_w_hu(a: v16u16, b: v16u16) -> v8i32 { + unsafe { __lasx_xvsubwod_w_hu(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsubwod_h_bu(a: v32u8, b: v32u8) -> v16i16 { - __lasx_xvsubwod_h_bu(a, b) +pub fn lasx_xvsubwod_h_bu(a: v32u8, b: v32u8) -> v16i16 { + unsafe { __lasx_xvsubwod_h_bu(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmulwod_q_d(a: v4i64, b: v4i64) -> v4i64 { - __lasx_xvmulwod_q_d(a, b) +pub fn lasx_xvmulwod_q_d(a: v4i64, b: v4i64) -> v4i64 { + unsafe { __lasx_xvmulwod_q_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmulwod_d_w(a: v8i32, b: v8i32) -> v4i64 { - __lasx_xvmulwod_d_w(a, b) +pub fn lasx_xvmulwod_d_w(a: v8i32, b: v8i32) -> v4i64 { + unsafe { __lasx_xvmulwod_d_w(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmulwod_w_h(a: v16i16, b: v16i16) -> v8i32 { - __lasx_xvmulwod_w_h(a, b) +pub fn lasx_xvmulwod_w_h(a: v16i16, b: v16i16) -> v8i32 { + unsafe { __lasx_xvmulwod_w_h(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmulwod_h_b(a: v32i8, b: v32i8) -> v16i16 { - __lasx_xvmulwod_h_b(a, b) +pub fn lasx_xvmulwod_h_b(a: v32i8, b: v32i8) -> v16i16 { + unsafe { __lasx_xvmulwod_h_b(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmulwod_q_du(a: v4u64, b: v4u64) -> v4i64 { - __lasx_xvmulwod_q_du(a, b) +pub fn lasx_xvmulwod_q_du(a: v4u64, b: v4u64) -> v4i64 { + unsafe { __lasx_xvmulwod_q_du(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmulwod_d_wu(a: v8u32, b: v8u32) -> v4i64 { - __lasx_xvmulwod_d_wu(a, b) +pub fn lasx_xvmulwod_d_wu(a: v8u32, b: v8u32) -> v4i64 { + unsafe { __lasx_xvmulwod_d_wu(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmulwod_w_hu(a: v16u16, b: v16u16) -> v8i32 { - __lasx_xvmulwod_w_hu(a, b) +pub fn lasx_xvmulwod_w_hu(a: v16u16, b: v16u16) -> v8i32 { + unsafe { __lasx_xvmulwod_w_hu(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmulwod_h_bu(a: v32u8, b: v32u8) -> v16i16 { - __lasx_xvmulwod_h_bu(a, b) +pub fn lasx_xvmulwod_h_bu(a: v32u8, b: v32u8) -> v16i16 { + unsafe { __lasx_xvmulwod_h_bu(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvaddwev_d_wu_w(a: v8u32, b: v8i32) -> v4i64 { - __lasx_xvaddwev_d_wu_w(a, b) +pub fn lasx_xvaddwev_d_wu_w(a: v8u32, b: v8i32) -> v4i64 { + unsafe { __lasx_xvaddwev_d_wu_w(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvaddwev_w_hu_h(a: v16u16, b: v16i16) -> v8i32 { - __lasx_xvaddwev_w_hu_h(a, b) +pub fn lasx_xvaddwev_w_hu_h(a: v16u16, b: v16i16) -> v8i32 { + unsafe { __lasx_xvaddwev_w_hu_h(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvaddwev_h_bu_b(a: v32u8, b: v32i8) -> v16i16 { - __lasx_xvaddwev_h_bu_b(a, b) +pub fn lasx_xvaddwev_h_bu_b(a: v32u8, b: v32i8) -> v16i16 { + unsafe { __lasx_xvaddwev_h_bu_b(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmulwev_d_wu_w(a: v8u32, b: v8i32) -> v4i64 { - __lasx_xvmulwev_d_wu_w(a, b) +pub fn lasx_xvmulwev_d_wu_w(a: v8u32, b: v8i32) -> v4i64 { + unsafe { __lasx_xvmulwev_d_wu_w(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmulwev_w_hu_h(a: v16u16, b: v16i16) -> v8i32 { - __lasx_xvmulwev_w_hu_h(a, b) +pub fn lasx_xvmulwev_w_hu_h(a: v16u16, b: v16i16) -> v8i32 { + unsafe { __lasx_xvmulwev_w_hu_h(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmulwev_h_bu_b(a: v32u8, b: v32i8) -> v16i16 { - __lasx_xvmulwev_h_bu_b(a, b) +pub fn lasx_xvmulwev_h_bu_b(a: v32u8, b: v32i8) -> v16i16 { + unsafe { __lasx_xvmulwev_h_bu_b(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvaddwod_d_wu_w(a: v8u32, b: v8i32) -> v4i64 { - __lasx_xvaddwod_d_wu_w(a, b) +pub fn lasx_xvaddwod_d_wu_w(a: v8u32, b: v8i32) -> v4i64 { + unsafe { __lasx_xvaddwod_d_wu_w(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvaddwod_w_hu_h(a: v16u16, b: v16i16) -> v8i32 { - __lasx_xvaddwod_w_hu_h(a, b) +pub fn lasx_xvaddwod_w_hu_h(a: v16u16, b: v16i16) -> v8i32 { + unsafe { __lasx_xvaddwod_w_hu_h(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvaddwod_h_bu_b(a: v32u8, b: v32i8) -> v16i16 { - __lasx_xvaddwod_h_bu_b(a, b) +pub fn lasx_xvaddwod_h_bu_b(a: v32u8, b: v32i8) -> v16i16 { + unsafe { __lasx_xvaddwod_h_bu_b(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmulwod_d_wu_w(a: v8u32, b: v8i32) -> v4i64 { - __lasx_xvmulwod_d_wu_w(a, b) +pub fn lasx_xvmulwod_d_wu_w(a: v8u32, b: v8i32) -> v4i64 { + unsafe { __lasx_xvmulwod_d_wu_w(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmulwod_w_hu_h(a: v16u16, b: v16i16) -> v8i32 { - __lasx_xvmulwod_w_hu_h(a, b) +pub fn lasx_xvmulwod_w_hu_h(a: v16u16, b: v16i16) -> v8i32 { + unsafe { __lasx_xvmulwod_w_hu_h(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmulwod_h_bu_b(a: v32u8, b: v32i8) -> v16i16 { - __lasx_xvmulwod_h_bu_b(a, b) +pub fn lasx_xvmulwod_h_bu_b(a: v32u8, b: v32i8) -> v16i16 { + unsafe { __lasx_xvmulwod_h_bu_b(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvhaddw_q_d(a: v4i64, b: v4i64) -> v4i64 { - __lasx_xvhaddw_q_d(a, b) +pub fn lasx_xvhaddw_q_d(a: v4i64, b: v4i64) -> v4i64 { + unsafe { __lasx_xvhaddw_q_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvhaddw_qu_du(a: v4u64, b: v4u64) -> v4u64 { - __lasx_xvhaddw_qu_du(a, b) +pub fn lasx_xvhaddw_qu_du(a: v4u64, b: v4u64) -> v4u64 { + unsafe { __lasx_xvhaddw_qu_du(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvhsubw_q_d(a: v4i64, b: v4i64) -> v4i64 { - __lasx_xvhsubw_q_d(a, b) +pub fn lasx_xvhsubw_q_d(a: v4i64, b: v4i64) -> v4i64 { + unsafe { __lasx_xvhsubw_q_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvhsubw_qu_du(a: v4u64, b: v4u64) -> v4u64 { - __lasx_xvhsubw_qu_du(a, b) +pub fn lasx_xvhsubw_qu_du(a: v4u64, b: v4u64) -> v4u64 { + unsafe { __lasx_xvhsubw_qu_du(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmaddwev_q_d(a: v4i64, b: v4i64, c: v4i64) -> v4i64 { - __lasx_xvmaddwev_q_d(a, b, c) +pub fn lasx_xvmaddwev_q_d(a: v4i64, b: v4i64, c: v4i64) -> v4i64 { + unsafe { __lasx_xvmaddwev_q_d(a, b, c) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmaddwev_d_w(a: v4i64, b: v8i32, c: v8i32) -> v4i64 { - __lasx_xvmaddwev_d_w(a, b, c) +pub fn lasx_xvmaddwev_d_w(a: v4i64, b: v8i32, c: v8i32) -> v4i64 { + unsafe { __lasx_xvmaddwev_d_w(a, b, c) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmaddwev_w_h(a: v8i32, b: v16i16, c: v16i16) -> v8i32 { - __lasx_xvmaddwev_w_h(a, b, c) +pub fn lasx_xvmaddwev_w_h(a: v8i32, b: v16i16, c: v16i16) -> v8i32 { + unsafe { __lasx_xvmaddwev_w_h(a, b, c) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmaddwev_h_b(a: v16i16, b: v32i8, c: v32i8) -> v16i16 { - __lasx_xvmaddwev_h_b(a, b, c) +pub fn lasx_xvmaddwev_h_b(a: v16i16, b: v32i8, c: v32i8) -> v16i16 { + unsafe { __lasx_xvmaddwev_h_b(a, b, c) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmaddwev_q_du(a: v4u64, b: v4u64, c: v4u64) -> v4u64 { - __lasx_xvmaddwev_q_du(a, b, c) +pub fn lasx_xvmaddwev_q_du(a: v4u64, b: v4u64, c: v4u64) -> v4u64 { + unsafe { __lasx_xvmaddwev_q_du(a, b, c) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmaddwev_d_wu(a: v4u64, b: v8u32, c: v8u32) -> v4u64 { - __lasx_xvmaddwev_d_wu(a, b, c) +pub fn lasx_xvmaddwev_d_wu(a: v4u64, b: v8u32, c: v8u32) -> v4u64 { + unsafe { __lasx_xvmaddwev_d_wu(a, b, c) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmaddwev_w_hu(a: v8u32, b: v16u16, c: v16u16) -> v8u32 { - __lasx_xvmaddwev_w_hu(a, b, c) +pub fn lasx_xvmaddwev_w_hu(a: v8u32, b: v16u16, c: v16u16) -> v8u32 { + unsafe { __lasx_xvmaddwev_w_hu(a, b, c) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmaddwev_h_bu(a: v16u16, b: v32u8, c: v32u8) -> v16u16 { - __lasx_xvmaddwev_h_bu(a, b, c) +pub fn lasx_xvmaddwev_h_bu(a: v16u16, b: v32u8, c: v32u8) -> v16u16 { + unsafe { __lasx_xvmaddwev_h_bu(a, b, c) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmaddwod_q_d(a: v4i64, b: v4i64, c: v4i64) -> v4i64 { - __lasx_xvmaddwod_q_d(a, b, c) +pub fn lasx_xvmaddwod_q_d(a: v4i64, b: v4i64, c: v4i64) -> v4i64 { + unsafe { __lasx_xvmaddwod_q_d(a, b, c) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmaddwod_d_w(a: v4i64, b: v8i32, c: v8i32) -> v4i64 { - __lasx_xvmaddwod_d_w(a, b, c) +pub fn lasx_xvmaddwod_d_w(a: v4i64, b: v8i32, c: v8i32) -> v4i64 { + unsafe { __lasx_xvmaddwod_d_w(a, b, c) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmaddwod_w_h(a: v8i32, b: v16i16, c: v16i16) -> v8i32 { - __lasx_xvmaddwod_w_h(a, b, c) +pub fn lasx_xvmaddwod_w_h(a: v8i32, b: v16i16, c: v16i16) -> v8i32 { + unsafe { __lasx_xvmaddwod_w_h(a, b, c) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmaddwod_h_b(a: v16i16, b: v32i8, c: v32i8) -> v16i16 { - __lasx_xvmaddwod_h_b(a, b, c) +pub fn lasx_xvmaddwod_h_b(a: v16i16, b: v32i8, c: v32i8) -> v16i16 { + unsafe { __lasx_xvmaddwod_h_b(a, b, c) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmaddwod_q_du(a: v4u64, b: v4u64, c: v4u64) -> v4u64 { - __lasx_xvmaddwod_q_du(a, b, c) +pub fn lasx_xvmaddwod_q_du(a: v4u64, b: v4u64, c: v4u64) -> v4u64 { + unsafe { __lasx_xvmaddwod_q_du(a, b, c) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmaddwod_d_wu(a: v4u64, b: v8u32, c: v8u32) -> v4u64 { - __lasx_xvmaddwod_d_wu(a, b, c) +pub fn lasx_xvmaddwod_d_wu(a: v4u64, b: v8u32, c: v8u32) -> v4u64 { + unsafe { __lasx_xvmaddwod_d_wu(a, b, c) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmaddwod_w_hu(a: v8u32, b: v16u16, c: v16u16) -> v8u32 { - __lasx_xvmaddwod_w_hu(a, b, c) +pub fn lasx_xvmaddwod_w_hu(a: v8u32, b: v16u16, c: v16u16) -> v8u32 { + unsafe { __lasx_xvmaddwod_w_hu(a, b, c) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmaddwod_h_bu(a: v16u16, b: v32u8, c: v32u8) -> v16u16 { - __lasx_xvmaddwod_h_bu(a, b, c) +pub fn lasx_xvmaddwod_h_bu(a: v16u16, b: v32u8, c: v32u8) -> v16u16 { + unsafe { __lasx_xvmaddwod_h_bu(a, b, c) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmaddwev_q_du_d(a: v4i64, b: v4u64, c: v4i64) -> v4i64 { - __lasx_xvmaddwev_q_du_d(a, b, c) +pub fn lasx_xvmaddwev_q_du_d(a: v4i64, b: v4u64, c: v4i64) -> v4i64 { + unsafe { __lasx_xvmaddwev_q_du_d(a, b, c) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmaddwev_d_wu_w(a: v4i64, b: v8u32, c: v8i32) -> v4i64 { - __lasx_xvmaddwev_d_wu_w(a, b, c) +pub fn lasx_xvmaddwev_d_wu_w(a: v4i64, b: v8u32, c: v8i32) -> v4i64 { + unsafe { __lasx_xvmaddwev_d_wu_w(a, b, c) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmaddwev_w_hu_h(a: v8i32, b: v16u16, c: v16i16) -> v8i32 { - __lasx_xvmaddwev_w_hu_h(a, b, c) +pub fn lasx_xvmaddwev_w_hu_h(a: v8i32, b: v16u16, c: v16i16) -> v8i32 { + unsafe { __lasx_xvmaddwev_w_hu_h(a, b, c) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmaddwev_h_bu_b(a: v16i16, b: v32u8, c: v32i8) -> v16i16 { - __lasx_xvmaddwev_h_bu_b(a, b, c) +pub fn lasx_xvmaddwev_h_bu_b(a: v16i16, b: v32u8, c: v32i8) -> v16i16 { + unsafe { __lasx_xvmaddwev_h_bu_b(a, b, c) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmaddwod_q_du_d(a: v4i64, b: v4u64, c: v4i64) -> v4i64 { - __lasx_xvmaddwod_q_du_d(a, b, c) +pub fn lasx_xvmaddwod_q_du_d(a: v4i64, b: v4u64, c: v4i64) -> v4i64 { + unsafe { __lasx_xvmaddwod_q_du_d(a, b, c) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmaddwod_d_wu_w(a: v4i64, b: v8u32, c: v8i32) -> v4i64 { - __lasx_xvmaddwod_d_wu_w(a, b, c) +pub fn lasx_xvmaddwod_d_wu_w(a: v4i64, b: v8u32, c: v8i32) -> v4i64 { + unsafe { __lasx_xvmaddwod_d_wu_w(a, b, c) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmaddwod_w_hu_h(a: v8i32, b: v16u16, c: v16i16) -> v8i32 { - __lasx_xvmaddwod_w_hu_h(a, b, c) +pub fn lasx_xvmaddwod_w_hu_h(a: v8i32, b: v16u16, c: v16i16) -> v8i32 { + unsafe { __lasx_xvmaddwod_w_hu_h(a, b, c) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmaddwod_h_bu_b(a: v16i16, b: v32u8, c: v32i8) -> v16i16 { - __lasx_xvmaddwod_h_bu_b(a, b, c) +pub fn lasx_xvmaddwod_h_bu_b(a: v16i16, b: v32u8, c: v32i8) -> v16i16 { + unsafe { __lasx_xvmaddwod_h_bu_b(a, b, c) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvrotr_b(a: v32i8, b: v32i8) -> v32i8 { - __lasx_xvrotr_b(a, b) +pub fn lasx_xvrotr_b(a: v32i8, b: v32i8) -> v32i8 { + unsafe { __lasx_xvrotr_b(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvrotr_h(a: v16i16, b: v16i16) -> v16i16 { - __lasx_xvrotr_h(a, b) +pub fn lasx_xvrotr_h(a: v16i16, b: v16i16) -> v16i16 { + unsafe { __lasx_xvrotr_h(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvrotr_w(a: v8i32, b: v8i32) -> v8i32 { - __lasx_xvrotr_w(a, b) +pub fn lasx_xvrotr_w(a: v8i32, b: v8i32) -> v8i32 { + unsafe { __lasx_xvrotr_w(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvrotr_d(a: v4i64, b: v4i64) -> v4i64 { - __lasx_xvrotr_d(a, b) +pub fn lasx_xvrotr_d(a: v4i64, b: v4i64) -> v4i64 { + unsafe { __lasx_xvrotr_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvadd_q(a: v4i64, b: v4i64) -> v4i64 { - __lasx_xvadd_q(a, b) +pub fn lasx_xvadd_q(a: v4i64, b: v4i64) -> v4i64 { + unsafe { __lasx_xvadd_q(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsub_q(a: v4i64, b: v4i64) -> v4i64 { - __lasx_xvsub_q(a, b) +pub fn lasx_xvsub_q(a: v4i64, b: v4i64) -> v4i64 { + unsafe { __lasx_xvsub_q(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvaddwev_q_du_d(a: v4u64, b: v4i64) -> v4i64 { - __lasx_xvaddwev_q_du_d(a, b) +pub fn lasx_xvaddwev_q_du_d(a: v4u64, b: v4i64) -> v4i64 { + unsafe { __lasx_xvaddwev_q_du_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvaddwod_q_du_d(a: v4u64, b: v4i64) -> v4i64 { - __lasx_xvaddwod_q_du_d(a, b) +pub fn lasx_xvaddwod_q_du_d(a: v4u64, b: v4i64) -> v4i64 { + unsafe { __lasx_xvaddwod_q_du_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmulwev_q_du_d(a: v4u64, b: v4i64) -> v4i64 { - __lasx_xvmulwev_q_du_d(a, b) +pub fn lasx_xvmulwev_q_du_d(a: v4u64, b: v4i64) -> v4i64 { + unsafe { __lasx_xvmulwev_q_du_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmulwod_q_du_d(a: v4u64, b: v4i64) -> v4i64 { - __lasx_xvmulwod_q_du_d(a, b) +pub fn lasx_xvmulwod_q_du_d(a: v4u64, b: v4i64) -> v4i64 { + unsafe { __lasx_xvmulwod_q_du_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmskgez_b(a: v32i8) -> v32i8 { - __lasx_xvmskgez_b(a) +pub fn lasx_xvmskgez_b(a: v32i8) -> v32i8 { + unsafe { __lasx_xvmskgez_b(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvmsknz_b(a: v32i8) -> v32i8 { - __lasx_xvmsknz_b(a) +pub fn lasx_xvmsknz_b(a: v32i8) -> v32i8 { + unsafe { __lasx_xvmsknz_b(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvexth_h_b(a: v32i8) -> v16i16 { - __lasx_xvexth_h_b(a) +pub fn lasx_xvexth_h_b(a: v32i8) -> v16i16 { + unsafe { __lasx_xvexth_h_b(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvexth_w_h(a: v16i16) -> v8i32 { - __lasx_xvexth_w_h(a) +pub fn lasx_xvexth_w_h(a: v16i16) -> v8i32 { + unsafe { __lasx_xvexth_w_h(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvexth_d_w(a: v8i32) -> v4i64 { - __lasx_xvexth_d_w(a) +pub fn lasx_xvexth_d_w(a: v8i32) -> v4i64 { + unsafe { __lasx_xvexth_d_w(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvexth_q_d(a: v4i64) -> v4i64 { - __lasx_xvexth_q_d(a) +pub fn lasx_xvexth_q_d(a: v4i64) -> v4i64 { + unsafe { __lasx_xvexth_q_d(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvexth_hu_bu(a: v32u8) -> v16u16 { - __lasx_xvexth_hu_bu(a) +pub fn lasx_xvexth_hu_bu(a: v32u8) -> v16u16 { + unsafe { __lasx_xvexth_hu_bu(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvexth_wu_hu(a: v16u16) -> v8u32 { - __lasx_xvexth_wu_hu(a) +pub fn lasx_xvexth_wu_hu(a: v16u16) -> v8u32 { + unsafe { __lasx_xvexth_wu_hu(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvexth_du_wu(a: v8u32) -> v4u64 { - __lasx_xvexth_du_wu(a) +pub fn lasx_xvexth_du_wu(a: v8u32) -> v4u64 { + unsafe { __lasx_xvexth_du_wu(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvexth_qu_du(a: v4u64) -> v4u64 { - __lasx_xvexth_qu_du(a) +pub fn lasx_xvexth_qu_du(a: v4u64) -> v4u64 { + unsafe { __lasx_xvexth_qu_du(a) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvrotri_b(a: v32i8) -> v32i8 { +pub fn lasx_xvrotri_b(a: v32i8) -> v32i8 { static_assert_uimm_bits!(IMM3, 3); - __lasx_xvrotri_b(a, IMM3) + unsafe { __lasx_xvrotri_b(a, IMM3) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvrotri_h(a: v16i16) -> v16i16 { +pub fn lasx_xvrotri_h(a: v16i16) -> v16i16 { static_assert_uimm_bits!(IMM4, 4); - __lasx_xvrotri_h(a, IMM4) + unsafe { __lasx_xvrotri_h(a, IMM4) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvrotri_w(a: v8i32) -> v8i32 { +pub fn lasx_xvrotri_w(a: v8i32) -> v8i32 { static_assert_uimm_bits!(IMM5, 5); - __lasx_xvrotri_w(a, IMM5) + unsafe { __lasx_xvrotri_w(a, IMM5) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvrotri_d(a: v4i64) -> v4i64 { +pub fn lasx_xvrotri_d(a: v4i64) -> v4i64 { static_assert_uimm_bits!(IMM6, 6); - __lasx_xvrotri_d(a, IMM6) + unsafe { __lasx_xvrotri_d(a, IMM6) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvextl_q_d(a: v4i64) -> v4i64 { - __lasx_xvextl_q_d(a) +pub fn lasx_xvextl_q_d(a: v4i64) -> v4i64 { + unsafe { __lasx_xvextl_q_d(a) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsrlni_b_h(a: v32i8, b: v32i8) -> v32i8 { +pub fn lasx_xvsrlni_b_h(a: v32i8, b: v32i8) -> v32i8 { static_assert_uimm_bits!(IMM4, 4); - __lasx_xvsrlni_b_h(a, b, IMM4) + unsafe { __lasx_xvsrlni_b_h(a, b, IMM4) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsrlni_h_w(a: v16i16, b: v16i16) -> v16i16 { +pub fn lasx_xvsrlni_h_w(a: v16i16, b: v16i16) -> v16i16 { static_assert_uimm_bits!(IMM5, 5); - __lasx_xvsrlni_h_w(a, b, IMM5) + unsafe { __lasx_xvsrlni_h_w(a, b, IMM5) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsrlni_w_d(a: v8i32, b: v8i32) -> v8i32 { +pub fn lasx_xvsrlni_w_d(a: v8i32, b: v8i32) -> v8i32 { static_assert_uimm_bits!(IMM6, 6); - __lasx_xvsrlni_w_d(a, b, IMM6) + unsafe { __lasx_xvsrlni_w_d(a, b, IMM6) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsrlni_d_q(a: v4i64, b: v4i64) -> v4i64 { +pub fn lasx_xvsrlni_d_q(a: v4i64, b: v4i64) -> v4i64 { static_assert_uimm_bits!(IMM7, 7); - __lasx_xvsrlni_d_q(a, b, IMM7) + unsafe { __lasx_xvsrlni_d_q(a, b, IMM7) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsrlrni_b_h(a: v32i8, b: v32i8) -> v32i8 { +pub fn lasx_xvsrlrni_b_h(a: v32i8, b: v32i8) -> v32i8 { static_assert_uimm_bits!(IMM4, 4); - __lasx_xvsrlrni_b_h(a, b, IMM4) + unsafe { __lasx_xvsrlrni_b_h(a, b, IMM4) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsrlrni_h_w(a: v16i16, b: v16i16) -> v16i16 { +pub fn lasx_xvsrlrni_h_w(a: v16i16, b: v16i16) -> v16i16 { static_assert_uimm_bits!(IMM5, 5); - __lasx_xvsrlrni_h_w(a, b, IMM5) + unsafe { __lasx_xvsrlrni_h_w(a, b, IMM5) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsrlrni_w_d(a: v8i32, b: v8i32) -> v8i32 { +pub fn lasx_xvsrlrni_w_d(a: v8i32, b: v8i32) -> v8i32 { static_assert_uimm_bits!(IMM6, 6); - __lasx_xvsrlrni_w_d(a, b, IMM6) + unsafe { __lasx_xvsrlrni_w_d(a, b, IMM6) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsrlrni_d_q(a: v4i64, b: v4i64) -> v4i64 { +pub fn lasx_xvsrlrni_d_q(a: v4i64, b: v4i64) -> v4i64 { static_assert_uimm_bits!(IMM7, 7); - __lasx_xvsrlrni_d_q(a, b, IMM7) + unsafe { __lasx_xvsrlrni_d_q(a, b, IMM7) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvssrlni_b_h(a: v32i8, b: v32i8) -> v32i8 { +pub fn lasx_xvssrlni_b_h(a: v32i8, b: v32i8) -> v32i8 { static_assert_uimm_bits!(IMM4, 4); - __lasx_xvssrlni_b_h(a, b, IMM4) + unsafe { __lasx_xvssrlni_b_h(a, b, IMM4) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvssrlni_h_w(a: v16i16, b: v16i16) -> v16i16 { +pub fn lasx_xvssrlni_h_w(a: v16i16, b: v16i16) -> v16i16 { static_assert_uimm_bits!(IMM5, 5); - __lasx_xvssrlni_h_w(a, b, IMM5) + unsafe { __lasx_xvssrlni_h_w(a, b, IMM5) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvssrlni_w_d(a: v8i32, b: v8i32) -> v8i32 { +pub fn lasx_xvssrlni_w_d(a: v8i32, b: v8i32) -> v8i32 { static_assert_uimm_bits!(IMM6, 6); - __lasx_xvssrlni_w_d(a, b, IMM6) + unsafe { __lasx_xvssrlni_w_d(a, b, IMM6) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvssrlni_d_q(a: v4i64, b: v4i64) -> v4i64 { +pub fn lasx_xvssrlni_d_q(a: v4i64, b: v4i64) -> v4i64 { static_assert_uimm_bits!(IMM7, 7); - __lasx_xvssrlni_d_q(a, b, IMM7) + unsafe { __lasx_xvssrlni_d_q(a, b, IMM7) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvssrlni_bu_h(a: v32u8, b: v32i8) -> v32u8 { +pub fn lasx_xvssrlni_bu_h(a: v32u8, b: v32i8) -> v32u8 { static_assert_uimm_bits!(IMM4, 4); - __lasx_xvssrlni_bu_h(a, b, IMM4) + unsafe { __lasx_xvssrlni_bu_h(a, b, IMM4) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvssrlni_hu_w(a: v16u16, b: v16i16) -> v16u16 { +pub fn lasx_xvssrlni_hu_w(a: v16u16, b: v16i16) -> v16u16 { static_assert_uimm_bits!(IMM5, 5); - __lasx_xvssrlni_hu_w(a, b, IMM5) + unsafe { __lasx_xvssrlni_hu_w(a, b, IMM5) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvssrlni_wu_d(a: v8u32, b: v8i32) -> v8u32 { +pub fn lasx_xvssrlni_wu_d(a: v8u32, b: v8i32) -> v8u32 { static_assert_uimm_bits!(IMM6, 6); - __lasx_xvssrlni_wu_d(a, b, IMM6) + unsafe { __lasx_xvssrlni_wu_d(a, b, IMM6) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvssrlni_du_q(a: v4u64, b: v4i64) -> v4u64 { +pub fn lasx_xvssrlni_du_q(a: v4u64, b: v4i64) -> v4u64 { static_assert_uimm_bits!(IMM7, 7); - __lasx_xvssrlni_du_q(a, b, IMM7) + unsafe { __lasx_xvssrlni_du_q(a, b, IMM7) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvssrlrni_b_h(a: v32i8, b: v32i8) -> v32i8 { +pub fn lasx_xvssrlrni_b_h(a: v32i8, b: v32i8) -> v32i8 { static_assert_uimm_bits!(IMM4, 4); - __lasx_xvssrlrni_b_h(a, b, IMM4) + unsafe { __lasx_xvssrlrni_b_h(a, b, IMM4) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvssrlrni_h_w(a: v16i16, b: v16i16) -> v16i16 { +pub fn lasx_xvssrlrni_h_w(a: v16i16, b: v16i16) -> v16i16 { static_assert_uimm_bits!(IMM5, 5); - __lasx_xvssrlrni_h_w(a, b, IMM5) + unsafe { __lasx_xvssrlrni_h_w(a, b, IMM5) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvssrlrni_w_d(a: v8i32, b: v8i32) -> v8i32 { +pub fn lasx_xvssrlrni_w_d(a: v8i32, b: v8i32) -> v8i32 { static_assert_uimm_bits!(IMM6, 6); - __lasx_xvssrlrni_w_d(a, b, IMM6) + unsafe { __lasx_xvssrlrni_w_d(a, b, IMM6) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvssrlrni_d_q(a: v4i64, b: v4i64) -> v4i64 { +pub fn lasx_xvssrlrni_d_q(a: v4i64, b: v4i64) -> v4i64 { static_assert_uimm_bits!(IMM7, 7); - __lasx_xvssrlrni_d_q(a, b, IMM7) + unsafe { __lasx_xvssrlrni_d_q(a, b, IMM7) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvssrlrni_bu_h(a: v32u8, b: v32i8) -> v32u8 { +pub fn lasx_xvssrlrni_bu_h(a: v32u8, b: v32i8) -> v32u8 { static_assert_uimm_bits!(IMM4, 4); - __lasx_xvssrlrni_bu_h(a, b, IMM4) + unsafe { __lasx_xvssrlrni_bu_h(a, b, IMM4) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvssrlrni_hu_w(a: v16u16, b: v16i16) -> v16u16 { +pub fn lasx_xvssrlrni_hu_w(a: v16u16, b: v16i16) -> v16u16 { static_assert_uimm_bits!(IMM5, 5); - __lasx_xvssrlrni_hu_w(a, b, IMM5) + unsafe { __lasx_xvssrlrni_hu_w(a, b, IMM5) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvssrlrni_wu_d(a: v8u32, b: v8i32) -> v8u32 { +pub fn lasx_xvssrlrni_wu_d(a: v8u32, b: v8i32) -> v8u32 { static_assert_uimm_bits!(IMM6, 6); - __lasx_xvssrlrni_wu_d(a, b, IMM6) + unsafe { __lasx_xvssrlrni_wu_d(a, b, IMM6) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvssrlrni_du_q(a: v4u64, b: v4i64) -> v4u64 { +pub fn lasx_xvssrlrni_du_q(a: v4u64, b: v4i64) -> v4u64 { static_assert_uimm_bits!(IMM7, 7); - __lasx_xvssrlrni_du_q(a, b, IMM7) + unsafe { __lasx_xvssrlrni_du_q(a, b, IMM7) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsrani_b_h(a: v32i8, b: v32i8) -> v32i8 { +pub fn lasx_xvsrani_b_h(a: v32i8, b: v32i8) -> v32i8 { static_assert_uimm_bits!(IMM4, 4); - __lasx_xvsrani_b_h(a, b, IMM4) + unsafe { __lasx_xvsrani_b_h(a, b, IMM4) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsrani_h_w(a: v16i16, b: v16i16) -> v16i16 { +pub fn lasx_xvsrani_h_w(a: v16i16, b: v16i16) -> v16i16 { static_assert_uimm_bits!(IMM5, 5); - __lasx_xvsrani_h_w(a, b, IMM5) + unsafe { __lasx_xvsrani_h_w(a, b, IMM5) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsrani_w_d(a: v8i32, b: v8i32) -> v8i32 { +pub fn lasx_xvsrani_w_d(a: v8i32, b: v8i32) -> v8i32 { static_assert_uimm_bits!(IMM6, 6); - __lasx_xvsrani_w_d(a, b, IMM6) + unsafe { __lasx_xvsrani_w_d(a, b, IMM6) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsrani_d_q(a: v4i64, b: v4i64) -> v4i64 { +pub fn lasx_xvsrani_d_q(a: v4i64, b: v4i64) -> v4i64 { static_assert_uimm_bits!(IMM7, 7); - __lasx_xvsrani_d_q(a, b, IMM7) + unsafe { __lasx_xvsrani_d_q(a, b, IMM7) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsrarni_b_h(a: v32i8, b: v32i8) -> v32i8 { +pub fn lasx_xvsrarni_b_h(a: v32i8, b: v32i8) -> v32i8 { static_assert_uimm_bits!(IMM4, 4); - __lasx_xvsrarni_b_h(a, b, IMM4) + unsafe { __lasx_xvsrarni_b_h(a, b, IMM4) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsrarni_h_w(a: v16i16, b: v16i16) -> v16i16 { +pub fn lasx_xvsrarni_h_w(a: v16i16, b: v16i16) -> v16i16 { static_assert_uimm_bits!(IMM5, 5); - __lasx_xvsrarni_h_w(a, b, IMM5) + unsafe { __lasx_xvsrarni_h_w(a, b, IMM5) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsrarni_w_d(a: v8i32, b: v8i32) -> v8i32 { +pub fn lasx_xvsrarni_w_d(a: v8i32, b: v8i32) -> v8i32 { static_assert_uimm_bits!(IMM6, 6); - __lasx_xvsrarni_w_d(a, b, IMM6) + unsafe { __lasx_xvsrarni_w_d(a, b, IMM6) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvsrarni_d_q(a: v4i64, b: v4i64) -> v4i64 { +pub fn lasx_xvsrarni_d_q(a: v4i64, b: v4i64) -> v4i64 { static_assert_uimm_bits!(IMM7, 7); - __lasx_xvsrarni_d_q(a, b, IMM7) + unsafe { __lasx_xvsrarni_d_q(a, b, IMM7) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvssrani_b_h(a: v32i8, b: v32i8) -> v32i8 { +pub fn lasx_xvssrani_b_h(a: v32i8, b: v32i8) -> v32i8 { static_assert_uimm_bits!(IMM4, 4); - __lasx_xvssrani_b_h(a, b, IMM4) + unsafe { __lasx_xvssrani_b_h(a, b, IMM4) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvssrani_h_w(a: v16i16, b: v16i16) -> v16i16 { +pub fn lasx_xvssrani_h_w(a: v16i16, b: v16i16) -> v16i16 { static_assert_uimm_bits!(IMM5, 5); - __lasx_xvssrani_h_w(a, b, IMM5) + unsafe { __lasx_xvssrani_h_w(a, b, IMM5) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvssrani_w_d(a: v8i32, b: v8i32) -> v8i32 { +pub fn lasx_xvssrani_w_d(a: v8i32, b: v8i32) -> v8i32 { static_assert_uimm_bits!(IMM6, 6); - __lasx_xvssrani_w_d(a, b, IMM6) + unsafe { __lasx_xvssrani_w_d(a, b, IMM6) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvssrani_d_q(a: v4i64, b: v4i64) -> v4i64 { +pub fn lasx_xvssrani_d_q(a: v4i64, b: v4i64) -> v4i64 { static_assert_uimm_bits!(IMM7, 7); - __lasx_xvssrani_d_q(a, b, IMM7) + unsafe { __lasx_xvssrani_d_q(a, b, IMM7) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvssrani_bu_h(a: v32u8, b: v32i8) -> v32u8 { +pub fn lasx_xvssrani_bu_h(a: v32u8, b: v32i8) -> v32u8 { static_assert_uimm_bits!(IMM4, 4); - __lasx_xvssrani_bu_h(a, b, IMM4) + unsafe { __lasx_xvssrani_bu_h(a, b, IMM4) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvssrani_hu_w(a: v16u16, b: v16i16) -> v16u16 { +pub fn lasx_xvssrani_hu_w(a: v16u16, b: v16i16) -> v16u16 { static_assert_uimm_bits!(IMM5, 5); - __lasx_xvssrani_hu_w(a, b, IMM5) + unsafe { __lasx_xvssrani_hu_w(a, b, IMM5) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvssrani_wu_d(a: v8u32, b: v8i32) -> v8u32 { +pub fn lasx_xvssrani_wu_d(a: v8u32, b: v8i32) -> v8u32 { static_assert_uimm_bits!(IMM6, 6); - __lasx_xvssrani_wu_d(a, b, IMM6) + unsafe { __lasx_xvssrani_wu_d(a, b, IMM6) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvssrani_du_q(a: v4u64, b: v4i64) -> v4u64 { +pub fn lasx_xvssrani_du_q(a: v4u64, b: v4i64) -> v4u64 { static_assert_uimm_bits!(IMM7, 7); - __lasx_xvssrani_du_q(a, b, IMM7) + unsafe { __lasx_xvssrani_du_q(a, b, IMM7) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvssrarni_b_h(a: v32i8, b: v32i8) -> v32i8 { +pub fn lasx_xvssrarni_b_h(a: v32i8, b: v32i8) -> v32i8 { static_assert_uimm_bits!(IMM4, 4); - __lasx_xvssrarni_b_h(a, b, IMM4) + unsafe { __lasx_xvssrarni_b_h(a, b, IMM4) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvssrarni_h_w(a: v16i16, b: v16i16) -> v16i16 { +pub fn lasx_xvssrarni_h_w(a: v16i16, b: v16i16) -> v16i16 { static_assert_uimm_bits!(IMM5, 5); - __lasx_xvssrarni_h_w(a, b, IMM5) + unsafe { __lasx_xvssrarni_h_w(a, b, IMM5) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvssrarni_w_d(a: v8i32, b: v8i32) -> v8i32 { +pub fn lasx_xvssrarni_w_d(a: v8i32, b: v8i32) -> v8i32 { static_assert_uimm_bits!(IMM6, 6); - __lasx_xvssrarni_w_d(a, b, IMM6) + unsafe { __lasx_xvssrarni_w_d(a, b, IMM6) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvssrarni_d_q(a: v4i64, b: v4i64) -> v4i64 { +pub fn lasx_xvssrarni_d_q(a: v4i64, b: v4i64) -> v4i64 { static_assert_uimm_bits!(IMM7, 7); - __lasx_xvssrarni_d_q(a, b, IMM7) + unsafe { __lasx_xvssrarni_d_q(a, b, IMM7) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvssrarni_bu_h(a: v32u8, b: v32i8) -> v32u8 { +pub fn lasx_xvssrarni_bu_h(a: v32u8, b: v32i8) -> v32u8 { static_assert_uimm_bits!(IMM4, 4); - __lasx_xvssrarni_bu_h(a, b, IMM4) + unsafe { __lasx_xvssrarni_bu_h(a, b, IMM4) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvssrarni_hu_w(a: v16u16, b: v16i16) -> v16u16 { +pub fn lasx_xvssrarni_hu_w(a: v16u16, b: v16i16) -> v16u16 { static_assert_uimm_bits!(IMM5, 5); - __lasx_xvssrarni_hu_w(a, b, IMM5) + unsafe { __lasx_xvssrarni_hu_w(a, b, IMM5) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvssrarni_wu_d(a: v8u32, b: v8i32) -> v8u32 { +pub fn lasx_xvssrarni_wu_d(a: v8u32, b: v8i32) -> v8u32 { static_assert_uimm_bits!(IMM6, 6); - __lasx_xvssrarni_wu_d(a, b, IMM6) + unsafe { __lasx_xvssrarni_wu_d(a, b, IMM6) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvssrarni_du_q(a: v4u64, b: v4i64) -> v4u64 { +pub fn lasx_xvssrarni_du_q(a: v4u64, b: v4i64) -> v4u64 { static_assert_uimm_bits!(IMM7, 7); - __lasx_xvssrarni_du_q(a, b, IMM7) + unsafe { __lasx_xvssrarni_du_q(a, b, IMM7) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xbnz_b(a: v32u8) -> i32 { - __lasx_xbnz_b(a) +pub fn lasx_xbnz_b(a: v32u8) -> i32 { + unsafe { __lasx_xbnz_b(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xbnz_d(a: v4u64) -> i32 { - __lasx_xbnz_d(a) +pub fn lasx_xbnz_d(a: v4u64) -> i32 { + unsafe { __lasx_xbnz_d(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xbnz_h(a: v16u16) -> i32 { - __lasx_xbnz_h(a) +pub fn lasx_xbnz_h(a: v16u16) -> i32 { + unsafe { __lasx_xbnz_h(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xbnz_v(a: v32u8) -> i32 { - __lasx_xbnz_v(a) +pub fn lasx_xbnz_v(a: v32u8) -> i32 { + unsafe { __lasx_xbnz_v(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xbnz_w(a: v8u32) -> i32 { - __lasx_xbnz_w(a) +pub fn lasx_xbnz_w(a: v8u32) -> i32 { + unsafe { __lasx_xbnz_w(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xbz_b(a: v32u8) -> i32 { - __lasx_xbz_b(a) +pub fn lasx_xbz_b(a: v32u8) -> i32 { + unsafe { __lasx_xbz_b(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xbz_d(a: v4u64) -> i32 { - __lasx_xbz_d(a) +pub fn lasx_xbz_d(a: v4u64) -> i32 { + unsafe { __lasx_xbz_d(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xbz_h(a: v16u16) -> i32 { - __lasx_xbz_h(a) +pub fn lasx_xbz_h(a: v16u16) -> i32 { + unsafe { __lasx_xbz_h(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xbz_v(a: v32u8) -> i32 { - __lasx_xbz_v(a) +pub fn lasx_xbz_v(a: v32u8) -> i32 { + unsafe { __lasx_xbz_v(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xbz_w(a: v8u32) -> i32 { - __lasx_xbz_w(a) +pub fn lasx_xbz_w(a: v8u32) -> i32 { + unsafe { __lasx_xbz_w(a) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfcmp_caf_d(a: v4f64, b: v4f64) -> v4i64 { - __lasx_xvfcmp_caf_d(a, b) +pub fn lasx_xvfcmp_caf_d(a: v4f64, b: v4f64) -> v4i64 { + unsafe { __lasx_xvfcmp_caf_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfcmp_caf_s(a: v8f32, b: v8f32) -> v8i32 { - __lasx_xvfcmp_caf_s(a, b) +pub fn lasx_xvfcmp_caf_s(a: v8f32, b: v8f32) -> v8i32 { + unsafe { __lasx_xvfcmp_caf_s(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfcmp_ceq_d(a: v4f64, b: v4f64) -> v4i64 { - __lasx_xvfcmp_ceq_d(a, b) +pub fn lasx_xvfcmp_ceq_d(a: v4f64, b: v4f64) -> v4i64 { + unsafe { __lasx_xvfcmp_ceq_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfcmp_ceq_s(a: v8f32, b: v8f32) -> v8i32 { - __lasx_xvfcmp_ceq_s(a, b) +pub fn lasx_xvfcmp_ceq_s(a: v8f32, b: v8f32) -> v8i32 { + unsafe { __lasx_xvfcmp_ceq_s(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfcmp_cle_d(a: v4f64, b: v4f64) -> v4i64 { - __lasx_xvfcmp_cle_d(a, b) +pub fn lasx_xvfcmp_cle_d(a: v4f64, b: v4f64) -> v4i64 { + unsafe { __lasx_xvfcmp_cle_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfcmp_cle_s(a: v8f32, b: v8f32) -> v8i32 { - __lasx_xvfcmp_cle_s(a, b) +pub fn lasx_xvfcmp_cle_s(a: v8f32, b: v8f32) -> v8i32 { + unsafe { __lasx_xvfcmp_cle_s(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfcmp_clt_d(a: v4f64, b: v4f64) -> v4i64 { - __lasx_xvfcmp_clt_d(a, b) +pub fn lasx_xvfcmp_clt_d(a: v4f64, b: v4f64) -> v4i64 { + unsafe { __lasx_xvfcmp_clt_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfcmp_clt_s(a: v8f32, b: v8f32) -> v8i32 { - __lasx_xvfcmp_clt_s(a, b) +pub fn lasx_xvfcmp_clt_s(a: v8f32, b: v8f32) -> v8i32 { + unsafe { __lasx_xvfcmp_clt_s(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfcmp_cne_d(a: v4f64, b: v4f64) -> v4i64 { - __lasx_xvfcmp_cne_d(a, b) +pub fn lasx_xvfcmp_cne_d(a: v4f64, b: v4f64) -> v4i64 { + unsafe { __lasx_xvfcmp_cne_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfcmp_cne_s(a: v8f32, b: v8f32) -> v8i32 { - __lasx_xvfcmp_cne_s(a, b) +pub fn lasx_xvfcmp_cne_s(a: v8f32, b: v8f32) -> v8i32 { + unsafe { __lasx_xvfcmp_cne_s(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfcmp_cor_d(a: v4f64, b: v4f64) -> v4i64 { - __lasx_xvfcmp_cor_d(a, b) +pub fn lasx_xvfcmp_cor_d(a: v4f64, b: v4f64) -> v4i64 { + unsafe { __lasx_xvfcmp_cor_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfcmp_cor_s(a: v8f32, b: v8f32) -> v8i32 { - __lasx_xvfcmp_cor_s(a, b) +pub fn lasx_xvfcmp_cor_s(a: v8f32, b: v8f32) -> v8i32 { + unsafe { __lasx_xvfcmp_cor_s(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfcmp_cueq_d(a: v4f64, b: v4f64) -> v4i64 { - __lasx_xvfcmp_cueq_d(a, b) +pub fn lasx_xvfcmp_cueq_d(a: v4f64, b: v4f64) -> v4i64 { + unsafe { __lasx_xvfcmp_cueq_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfcmp_cueq_s(a: v8f32, b: v8f32) -> v8i32 { - __lasx_xvfcmp_cueq_s(a, b) +pub fn lasx_xvfcmp_cueq_s(a: v8f32, b: v8f32) -> v8i32 { + unsafe { __lasx_xvfcmp_cueq_s(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfcmp_cule_d(a: v4f64, b: v4f64) -> v4i64 { - __lasx_xvfcmp_cule_d(a, b) +pub fn lasx_xvfcmp_cule_d(a: v4f64, b: v4f64) -> v4i64 { + unsafe { __lasx_xvfcmp_cule_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfcmp_cule_s(a: v8f32, b: v8f32) -> v8i32 { - __lasx_xvfcmp_cule_s(a, b) +pub fn lasx_xvfcmp_cule_s(a: v8f32, b: v8f32) -> v8i32 { + unsafe { __lasx_xvfcmp_cule_s(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfcmp_cult_d(a: v4f64, b: v4f64) -> v4i64 { - __lasx_xvfcmp_cult_d(a, b) +pub fn lasx_xvfcmp_cult_d(a: v4f64, b: v4f64) -> v4i64 { + unsafe { __lasx_xvfcmp_cult_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfcmp_cult_s(a: v8f32, b: v8f32) -> v8i32 { - __lasx_xvfcmp_cult_s(a, b) +pub fn lasx_xvfcmp_cult_s(a: v8f32, b: v8f32) -> v8i32 { + unsafe { __lasx_xvfcmp_cult_s(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfcmp_cun_d(a: v4f64, b: v4f64) -> v4i64 { - __lasx_xvfcmp_cun_d(a, b) +pub fn lasx_xvfcmp_cun_d(a: v4f64, b: v4f64) -> v4i64 { + unsafe { __lasx_xvfcmp_cun_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfcmp_cune_d(a: v4f64, b: v4f64) -> v4i64 { - __lasx_xvfcmp_cune_d(a, b) +pub fn lasx_xvfcmp_cune_d(a: v4f64, b: v4f64) -> v4i64 { + unsafe { __lasx_xvfcmp_cune_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfcmp_cune_s(a: v8f32, b: v8f32) -> v8i32 { - __lasx_xvfcmp_cune_s(a, b) +pub fn lasx_xvfcmp_cune_s(a: v8f32, b: v8f32) -> v8i32 { + unsafe { __lasx_xvfcmp_cune_s(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfcmp_cun_s(a: v8f32, b: v8f32) -> v8i32 { - __lasx_xvfcmp_cun_s(a, b) +pub fn lasx_xvfcmp_cun_s(a: v8f32, b: v8f32) -> v8i32 { + unsafe { __lasx_xvfcmp_cun_s(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfcmp_saf_d(a: v4f64, b: v4f64) -> v4i64 { - __lasx_xvfcmp_saf_d(a, b) +pub fn lasx_xvfcmp_saf_d(a: v4f64, b: v4f64) -> v4i64 { + unsafe { __lasx_xvfcmp_saf_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfcmp_saf_s(a: v8f32, b: v8f32) -> v8i32 { - __lasx_xvfcmp_saf_s(a, b) +pub fn lasx_xvfcmp_saf_s(a: v8f32, b: v8f32) -> v8i32 { + unsafe { __lasx_xvfcmp_saf_s(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfcmp_seq_d(a: v4f64, b: v4f64) -> v4i64 { - __lasx_xvfcmp_seq_d(a, b) +pub fn lasx_xvfcmp_seq_d(a: v4f64, b: v4f64) -> v4i64 { + unsafe { __lasx_xvfcmp_seq_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfcmp_seq_s(a: v8f32, b: v8f32) -> v8i32 { - __lasx_xvfcmp_seq_s(a, b) +pub fn lasx_xvfcmp_seq_s(a: v8f32, b: v8f32) -> v8i32 { + unsafe { __lasx_xvfcmp_seq_s(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfcmp_sle_d(a: v4f64, b: v4f64) -> v4i64 { - __lasx_xvfcmp_sle_d(a, b) +pub fn lasx_xvfcmp_sle_d(a: v4f64, b: v4f64) -> v4i64 { + unsafe { __lasx_xvfcmp_sle_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfcmp_sle_s(a: v8f32, b: v8f32) -> v8i32 { - __lasx_xvfcmp_sle_s(a, b) +pub fn lasx_xvfcmp_sle_s(a: v8f32, b: v8f32) -> v8i32 { + unsafe { __lasx_xvfcmp_sle_s(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfcmp_slt_d(a: v4f64, b: v4f64) -> v4i64 { - __lasx_xvfcmp_slt_d(a, b) +pub fn lasx_xvfcmp_slt_d(a: v4f64, b: v4f64) -> v4i64 { + unsafe { __lasx_xvfcmp_slt_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfcmp_slt_s(a: v8f32, b: v8f32) -> v8i32 { - __lasx_xvfcmp_slt_s(a, b) +pub fn lasx_xvfcmp_slt_s(a: v8f32, b: v8f32) -> v8i32 { + unsafe { __lasx_xvfcmp_slt_s(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfcmp_sne_d(a: v4f64, b: v4f64) -> v4i64 { - __lasx_xvfcmp_sne_d(a, b) +pub fn lasx_xvfcmp_sne_d(a: v4f64, b: v4f64) -> v4i64 { + unsafe { __lasx_xvfcmp_sne_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfcmp_sne_s(a: v8f32, b: v8f32) -> v8i32 { - __lasx_xvfcmp_sne_s(a, b) +pub fn lasx_xvfcmp_sne_s(a: v8f32, b: v8f32) -> v8i32 { + unsafe { __lasx_xvfcmp_sne_s(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfcmp_sor_d(a: v4f64, b: v4f64) -> v4i64 { - __lasx_xvfcmp_sor_d(a, b) +pub fn lasx_xvfcmp_sor_d(a: v4f64, b: v4f64) -> v4i64 { + unsafe { __lasx_xvfcmp_sor_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfcmp_sor_s(a: v8f32, b: v8f32) -> v8i32 { - __lasx_xvfcmp_sor_s(a, b) +pub fn lasx_xvfcmp_sor_s(a: v8f32, b: v8f32) -> v8i32 { + unsafe { __lasx_xvfcmp_sor_s(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfcmp_sueq_d(a: v4f64, b: v4f64) -> v4i64 { - __lasx_xvfcmp_sueq_d(a, b) +pub fn lasx_xvfcmp_sueq_d(a: v4f64, b: v4f64) -> v4i64 { + unsafe { __lasx_xvfcmp_sueq_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfcmp_sueq_s(a: v8f32, b: v8f32) -> v8i32 { - __lasx_xvfcmp_sueq_s(a, b) +pub fn lasx_xvfcmp_sueq_s(a: v8f32, b: v8f32) -> v8i32 { + unsafe { __lasx_xvfcmp_sueq_s(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfcmp_sule_d(a: v4f64, b: v4f64) -> v4i64 { - __lasx_xvfcmp_sule_d(a, b) +pub fn lasx_xvfcmp_sule_d(a: v4f64, b: v4f64) -> v4i64 { + unsafe { __lasx_xvfcmp_sule_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfcmp_sule_s(a: v8f32, b: v8f32) -> v8i32 { - __lasx_xvfcmp_sule_s(a, b) +pub fn lasx_xvfcmp_sule_s(a: v8f32, b: v8f32) -> v8i32 { + unsafe { __lasx_xvfcmp_sule_s(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfcmp_sult_d(a: v4f64, b: v4f64) -> v4i64 { - __lasx_xvfcmp_sult_d(a, b) +pub fn lasx_xvfcmp_sult_d(a: v4f64, b: v4f64) -> v4i64 { + unsafe { __lasx_xvfcmp_sult_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfcmp_sult_s(a: v8f32, b: v8f32) -> v8i32 { - __lasx_xvfcmp_sult_s(a, b) +pub fn lasx_xvfcmp_sult_s(a: v8f32, b: v8f32) -> v8i32 { + unsafe { __lasx_xvfcmp_sult_s(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfcmp_sun_d(a: v4f64, b: v4f64) -> v4i64 { - __lasx_xvfcmp_sun_d(a, b) +pub fn lasx_xvfcmp_sun_d(a: v4f64, b: v4f64) -> v4i64 { + unsafe { __lasx_xvfcmp_sun_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfcmp_sune_d(a: v4f64, b: v4f64) -> v4i64 { - __lasx_xvfcmp_sune_d(a, b) +pub fn lasx_xvfcmp_sune_d(a: v4f64, b: v4f64) -> v4i64 { + unsafe { __lasx_xvfcmp_sune_d(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfcmp_sune_s(a: v8f32, b: v8f32) -> v8i32 { - __lasx_xvfcmp_sune_s(a, b) +pub fn lasx_xvfcmp_sune_s(a: v8f32, b: v8f32) -> v8i32 { + unsafe { __lasx_xvfcmp_sune_s(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvfcmp_sun_s(a: v8f32, b: v8f32) -> v8i32 { - __lasx_xvfcmp_sun_s(a, b) +pub fn lasx_xvfcmp_sun_s(a: v8f32, b: v8f32) -> v8i32 { + unsafe { __lasx_xvfcmp_sun_s(a, b) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvpickve_d_f(a: v4f64) -> v4f64 { +pub fn lasx_xvpickve_d_f(a: v4f64) -> v4f64 { static_assert_uimm_bits!(IMM2, 2); - __lasx_xvpickve_d_f(a, IMM2) + unsafe { __lasx_xvpickve_d_f(a, IMM2) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvpickve_w_f(a: v8f32) -> v8f32 { +pub fn lasx_xvpickve_w_f(a: v8f32) -> v8f32 { static_assert_uimm_bits!(IMM3, 3); - __lasx_xvpickve_w_f(a, IMM3) + unsafe { __lasx_xvpickve_w_f(a, IMM3) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(0)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvrepli_b() -> v32i8 { +pub fn lasx_xvrepli_b() -> v32i8 { static_assert_simm_bits!(IMM_S10, 10); - __lasx_xvrepli_b(IMM_S10) + unsafe { __lasx_xvrepli_b(IMM_S10) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(0)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvrepli_d() -> v4i64 { +pub fn lasx_xvrepli_d() -> v4i64 { static_assert_simm_bits!(IMM_S10, 10); - __lasx_xvrepli_d(IMM_S10) + unsafe { __lasx_xvrepli_d(IMM_S10) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(0)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvrepli_h() -> v16i16 { +pub fn lasx_xvrepli_h() -> v16i16 { static_assert_simm_bits!(IMM_S10, 10); - __lasx_xvrepli_h(IMM_S10) + unsafe { __lasx_xvrepli_h(IMM_S10) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(0)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvrepli_w() -> v8i32 { +pub fn lasx_xvrepli_w() -> v8i32 { static_assert_simm_bits!(IMM_S10, 10); - __lasx_xvrepli_w(IMM_S10) + unsafe { __lasx_xvrepli_w(IMM_S10) } } diff --git a/library/stdarch/crates/core_arch/src/loongarch64/lsx/generated.rs b/library/stdarch/crates/core_arch/src/loongarch64/lsx/generated.rs index 2bc364f3e069..ba821a3e3dc6 100644 --- a/library/stdarch/crates/core_arch/src/loongarch64/lsx/generated.rs +++ b/library/stdarch/crates/core_arch/src/loongarch64/lsx/generated.rs @@ -1455,3593 +1455,3593 @@ unsafe extern "unadjusted" { #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsll_b(a: v16i8, b: v16i8) -> v16i8 { - __lsx_vsll_b(a, b) +pub fn lsx_vsll_b(a: v16i8, b: v16i8) -> v16i8 { + unsafe { __lsx_vsll_b(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsll_h(a: v8i16, b: v8i16) -> v8i16 { - __lsx_vsll_h(a, b) +pub fn lsx_vsll_h(a: v8i16, b: v8i16) -> v8i16 { + unsafe { __lsx_vsll_h(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsll_w(a: v4i32, b: v4i32) -> v4i32 { - __lsx_vsll_w(a, b) +pub fn lsx_vsll_w(a: v4i32, b: v4i32) -> v4i32 { + unsafe { __lsx_vsll_w(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsll_d(a: v2i64, b: v2i64) -> v2i64 { - __lsx_vsll_d(a, b) +pub fn lsx_vsll_d(a: v2i64, b: v2i64) -> v2i64 { + unsafe { __lsx_vsll_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vslli_b(a: v16i8) -> v16i8 { +pub fn lsx_vslli_b(a: v16i8) -> v16i8 { static_assert_uimm_bits!(IMM3, 3); - __lsx_vslli_b(a, IMM3) + unsafe { __lsx_vslli_b(a, IMM3) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vslli_h(a: v8i16) -> v8i16 { +pub fn lsx_vslli_h(a: v8i16) -> v8i16 { static_assert_uimm_bits!(IMM4, 4); - __lsx_vslli_h(a, IMM4) + unsafe { __lsx_vslli_h(a, IMM4) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vslli_w(a: v4i32) -> v4i32 { +pub fn lsx_vslli_w(a: v4i32) -> v4i32 { static_assert_uimm_bits!(IMM5, 5); - __lsx_vslli_w(a, IMM5) + unsafe { __lsx_vslli_w(a, IMM5) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vslli_d(a: v2i64) -> v2i64 { +pub fn lsx_vslli_d(a: v2i64) -> v2i64 { static_assert_uimm_bits!(IMM6, 6); - __lsx_vslli_d(a, IMM6) + unsafe { __lsx_vslli_d(a, IMM6) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsra_b(a: v16i8, b: v16i8) -> v16i8 { - __lsx_vsra_b(a, b) +pub fn lsx_vsra_b(a: v16i8, b: v16i8) -> v16i8 { + unsafe { __lsx_vsra_b(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsra_h(a: v8i16, b: v8i16) -> v8i16 { - __lsx_vsra_h(a, b) +pub fn lsx_vsra_h(a: v8i16, b: v8i16) -> v8i16 { + unsafe { __lsx_vsra_h(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsra_w(a: v4i32, b: v4i32) -> v4i32 { - __lsx_vsra_w(a, b) +pub fn lsx_vsra_w(a: v4i32, b: v4i32) -> v4i32 { + unsafe { __lsx_vsra_w(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsra_d(a: v2i64, b: v2i64) -> v2i64 { - __lsx_vsra_d(a, b) +pub fn lsx_vsra_d(a: v2i64, b: v2i64) -> v2i64 { + unsafe { __lsx_vsra_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsrai_b(a: v16i8) -> v16i8 { +pub fn lsx_vsrai_b(a: v16i8) -> v16i8 { static_assert_uimm_bits!(IMM3, 3); - __lsx_vsrai_b(a, IMM3) + unsafe { __lsx_vsrai_b(a, IMM3) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsrai_h(a: v8i16) -> v8i16 { +pub fn lsx_vsrai_h(a: v8i16) -> v8i16 { static_assert_uimm_bits!(IMM4, 4); - __lsx_vsrai_h(a, IMM4) + unsafe { __lsx_vsrai_h(a, IMM4) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsrai_w(a: v4i32) -> v4i32 { +pub fn lsx_vsrai_w(a: v4i32) -> v4i32 { static_assert_uimm_bits!(IMM5, 5); - __lsx_vsrai_w(a, IMM5) + unsafe { __lsx_vsrai_w(a, IMM5) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsrai_d(a: v2i64) -> v2i64 { +pub fn lsx_vsrai_d(a: v2i64) -> v2i64 { static_assert_uimm_bits!(IMM6, 6); - __lsx_vsrai_d(a, IMM6) + unsafe { __lsx_vsrai_d(a, IMM6) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsrar_b(a: v16i8, b: v16i8) -> v16i8 { - __lsx_vsrar_b(a, b) +pub fn lsx_vsrar_b(a: v16i8, b: v16i8) -> v16i8 { + unsafe { __lsx_vsrar_b(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsrar_h(a: v8i16, b: v8i16) -> v8i16 { - __lsx_vsrar_h(a, b) +pub fn lsx_vsrar_h(a: v8i16, b: v8i16) -> v8i16 { + unsafe { __lsx_vsrar_h(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsrar_w(a: v4i32, b: v4i32) -> v4i32 { - __lsx_vsrar_w(a, b) +pub fn lsx_vsrar_w(a: v4i32, b: v4i32) -> v4i32 { + unsafe { __lsx_vsrar_w(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsrar_d(a: v2i64, b: v2i64) -> v2i64 { - __lsx_vsrar_d(a, b) +pub fn lsx_vsrar_d(a: v2i64, b: v2i64) -> v2i64 { + unsafe { __lsx_vsrar_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsrari_b(a: v16i8) -> v16i8 { +pub fn lsx_vsrari_b(a: v16i8) -> v16i8 { static_assert_uimm_bits!(IMM3, 3); - __lsx_vsrari_b(a, IMM3) + unsafe { __lsx_vsrari_b(a, IMM3) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsrari_h(a: v8i16) -> v8i16 { +pub fn lsx_vsrari_h(a: v8i16) -> v8i16 { static_assert_uimm_bits!(IMM4, 4); - __lsx_vsrari_h(a, IMM4) + unsafe { __lsx_vsrari_h(a, IMM4) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsrari_w(a: v4i32) -> v4i32 { +pub fn lsx_vsrari_w(a: v4i32) -> v4i32 { static_assert_uimm_bits!(IMM5, 5); - __lsx_vsrari_w(a, IMM5) + unsafe { __lsx_vsrari_w(a, IMM5) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsrari_d(a: v2i64) -> v2i64 { +pub fn lsx_vsrari_d(a: v2i64) -> v2i64 { static_assert_uimm_bits!(IMM6, 6); - __lsx_vsrari_d(a, IMM6) + unsafe { __lsx_vsrari_d(a, IMM6) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsrl_b(a: v16i8, b: v16i8) -> v16i8 { - __lsx_vsrl_b(a, b) +pub fn lsx_vsrl_b(a: v16i8, b: v16i8) -> v16i8 { + unsafe { __lsx_vsrl_b(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsrl_h(a: v8i16, b: v8i16) -> v8i16 { - __lsx_vsrl_h(a, b) +pub fn lsx_vsrl_h(a: v8i16, b: v8i16) -> v8i16 { + unsafe { __lsx_vsrl_h(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsrl_w(a: v4i32, b: v4i32) -> v4i32 { - __lsx_vsrl_w(a, b) +pub fn lsx_vsrl_w(a: v4i32, b: v4i32) -> v4i32 { + unsafe { __lsx_vsrl_w(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsrl_d(a: v2i64, b: v2i64) -> v2i64 { - __lsx_vsrl_d(a, b) +pub fn lsx_vsrl_d(a: v2i64, b: v2i64) -> v2i64 { + unsafe { __lsx_vsrl_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsrli_b(a: v16i8) -> v16i8 { +pub fn lsx_vsrli_b(a: v16i8) -> v16i8 { static_assert_uimm_bits!(IMM3, 3); - __lsx_vsrli_b(a, IMM3) + unsafe { __lsx_vsrli_b(a, IMM3) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsrli_h(a: v8i16) -> v8i16 { +pub fn lsx_vsrli_h(a: v8i16) -> v8i16 { static_assert_uimm_bits!(IMM4, 4); - __lsx_vsrli_h(a, IMM4) + unsafe { __lsx_vsrli_h(a, IMM4) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsrli_w(a: v4i32) -> v4i32 { +pub fn lsx_vsrli_w(a: v4i32) -> v4i32 { static_assert_uimm_bits!(IMM5, 5); - __lsx_vsrli_w(a, IMM5) + unsafe { __lsx_vsrli_w(a, IMM5) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsrli_d(a: v2i64) -> v2i64 { +pub fn lsx_vsrli_d(a: v2i64) -> v2i64 { static_assert_uimm_bits!(IMM6, 6); - __lsx_vsrli_d(a, IMM6) + unsafe { __lsx_vsrli_d(a, IMM6) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsrlr_b(a: v16i8, b: v16i8) -> v16i8 { - __lsx_vsrlr_b(a, b) +pub fn lsx_vsrlr_b(a: v16i8, b: v16i8) -> v16i8 { + unsafe { __lsx_vsrlr_b(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsrlr_h(a: v8i16, b: v8i16) -> v8i16 { - __lsx_vsrlr_h(a, b) +pub fn lsx_vsrlr_h(a: v8i16, b: v8i16) -> v8i16 { + unsafe { __lsx_vsrlr_h(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsrlr_w(a: v4i32, b: v4i32) -> v4i32 { - __lsx_vsrlr_w(a, b) +pub fn lsx_vsrlr_w(a: v4i32, b: v4i32) -> v4i32 { + unsafe { __lsx_vsrlr_w(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsrlr_d(a: v2i64, b: v2i64) -> v2i64 { - __lsx_vsrlr_d(a, b) +pub fn lsx_vsrlr_d(a: v2i64, b: v2i64) -> v2i64 { + unsafe { __lsx_vsrlr_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsrlri_b(a: v16i8) -> v16i8 { +pub fn lsx_vsrlri_b(a: v16i8) -> v16i8 { static_assert_uimm_bits!(IMM3, 3); - __lsx_vsrlri_b(a, IMM3) + unsafe { __lsx_vsrlri_b(a, IMM3) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsrlri_h(a: v8i16) -> v8i16 { +pub fn lsx_vsrlri_h(a: v8i16) -> v8i16 { static_assert_uimm_bits!(IMM4, 4); - __lsx_vsrlri_h(a, IMM4) + unsafe { __lsx_vsrlri_h(a, IMM4) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsrlri_w(a: v4i32) -> v4i32 { +pub fn lsx_vsrlri_w(a: v4i32) -> v4i32 { static_assert_uimm_bits!(IMM5, 5); - __lsx_vsrlri_w(a, IMM5) + unsafe { __lsx_vsrlri_w(a, IMM5) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsrlri_d(a: v2i64) -> v2i64 { +pub fn lsx_vsrlri_d(a: v2i64) -> v2i64 { static_assert_uimm_bits!(IMM6, 6); - __lsx_vsrlri_d(a, IMM6) + unsafe { __lsx_vsrlri_d(a, IMM6) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vbitclr_b(a: v16u8, b: v16u8) -> v16u8 { - __lsx_vbitclr_b(a, b) +pub fn lsx_vbitclr_b(a: v16u8, b: v16u8) -> v16u8 { + unsafe { __lsx_vbitclr_b(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vbitclr_h(a: v8u16, b: v8u16) -> v8u16 { - __lsx_vbitclr_h(a, b) +pub fn lsx_vbitclr_h(a: v8u16, b: v8u16) -> v8u16 { + unsafe { __lsx_vbitclr_h(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vbitclr_w(a: v4u32, b: v4u32) -> v4u32 { - __lsx_vbitclr_w(a, b) +pub fn lsx_vbitclr_w(a: v4u32, b: v4u32) -> v4u32 { + unsafe { __lsx_vbitclr_w(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vbitclr_d(a: v2u64, b: v2u64) -> v2u64 { - __lsx_vbitclr_d(a, b) +pub fn lsx_vbitclr_d(a: v2u64, b: v2u64) -> v2u64 { + unsafe { __lsx_vbitclr_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vbitclri_b(a: v16u8) -> v16u8 { +pub fn lsx_vbitclri_b(a: v16u8) -> v16u8 { static_assert_uimm_bits!(IMM3, 3); - __lsx_vbitclri_b(a, IMM3) + unsafe { __lsx_vbitclri_b(a, IMM3) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vbitclri_h(a: v8u16) -> v8u16 { +pub fn lsx_vbitclri_h(a: v8u16) -> v8u16 { static_assert_uimm_bits!(IMM4, 4); - __lsx_vbitclri_h(a, IMM4) + unsafe { __lsx_vbitclri_h(a, IMM4) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vbitclri_w(a: v4u32) -> v4u32 { +pub fn lsx_vbitclri_w(a: v4u32) -> v4u32 { static_assert_uimm_bits!(IMM5, 5); - __lsx_vbitclri_w(a, IMM5) + unsafe { __lsx_vbitclri_w(a, IMM5) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vbitclri_d(a: v2u64) -> v2u64 { +pub fn lsx_vbitclri_d(a: v2u64) -> v2u64 { static_assert_uimm_bits!(IMM6, 6); - __lsx_vbitclri_d(a, IMM6) + unsafe { __lsx_vbitclri_d(a, IMM6) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vbitset_b(a: v16u8, b: v16u8) -> v16u8 { - __lsx_vbitset_b(a, b) +pub fn lsx_vbitset_b(a: v16u8, b: v16u8) -> v16u8 { + unsafe { __lsx_vbitset_b(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vbitset_h(a: v8u16, b: v8u16) -> v8u16 { - __lsx_vbitset_h(a, b) +pub fn lsx_vbitset_h(a: v8u16, b: v8u16) -> v8u16 { + unsafe { __lsx_vbitset_h(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vbitset_w(a: v4u32, b: v4u32) -> v4u32 { - __lsx_vbitset_w(a, b) +pub fn lsx_vbitset_w(a: v4u32, b: v4u32) -> v4u32 { + unsafe { __lsx_vbitset_w(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vbitset_d(a: v2u64, b: v2u64) -> v2u64 { - __lsx_vbitset_d(a, b) +pub fn lsx_vbitset_d(a: v2u64, b: v2u64) -> v2u64 { + unsafe { __lsx_vbitset_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vbitseti_b(a: v16u8) -> v16u8 { +pub fn lsx_vbitseti_b(a: v16u8) -> v16u8 { static_assert_uimm_bits!(IMM3, 3); - __lsx_vbitseti_b(a, IMM3) + unsafe { __lsx_vbitseti_b(a, IMM3) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vbitseti_h(a: v8u16) -> v8u16 { +pub fn lsx_vbitseti_h(a: v8u16) -> v8u16 { static_assert_uimm_bits!(IMM4, 4); - __lsx_vbitseti_h(a, IMM4) + unsafe { __lsx_vbitseti_h(a, IMM4) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vbitseti_w(a: v4u32) -> v4u32 { +pub fn lsx_vbitseti_w(a: v4u32) -> v4u32 { static_assert_uimm_bits!(IMM5, 5); - __lsx_vbitseti_w(a, IMM5) + unsafe { __lsx_vbitseti_w(a, IMM5) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vbitseti_d(a: v2u64) -> v2u64 { +pub fn lsx_vbitseti_d(a: v2u64) -> v2u64 { static_assert_uimm_bits!(IMM6, 6); - __lsx_vbitseti_d(a, IMM6) + unsafe { __lsx_vbitseti_d(a, IMM6) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vbitrev_b(a: v16u8, b: v16u8) -> v16u8 { - __lsx_vbitrev_b(a, b) +pub fn lsx_vbitrev_b(a: v16u8, b: v16u8) -> v16u8 { + unsafe { __lsx_vbitrev_b(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vbitrev_h(a: v8u16, b: v8u16) -> v8u16 { - __lsx_vbitrev_h(a, b) +pub fn lsx_vbitrev_h(a: v8u16, b: v8u16) -> v8u16 { + unsafe { __lsx_vbitrev_h(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vbitrev_w(a: v4u32, b: v4u32) -> v4u32 { - __lsx_vbitrev_w(a, b) +pub fn lsx_vbitrev_w(a: v4u32, b: v4u32) -> v4u32 { + unsafe { __lsx_vbitrev_w(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vbitrev_d(a: v2u64, b: v2u64) -> v2u64 { - __lsx_vbitrev_d(a, b) +pub fn lsx_vbitrev_d(a: v2u64, b: v2u64) -> v2u64 { + unsafe { __lsx_vbitrev_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vbitrevi_b(a: v16u8) -> v16u8 { +pub fn lsx_vbitrevi_b(a: v16u8) -> v16u8 { static_assert_uimm_bits!(IMM3, 3); - __lsx_vbitrevi_b(a, IMM3) + unsafe { __lsx_vbitrevi_b(a, IMM3) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vbitrevi_h(a: v8u16) -> v8u16 { +pub fn lsx_vbitrevi_h(a: v8u16) -> v8u16 { static_assert_uimm_bits!(IMM4, 4); - __lsx_vbitrevi_h(a, IMM4) + unsafe { __lsx_vbitrevi_h(a, IMM4) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vbitrevi_w(a: v4u32) -> v4u32 { +pub fn lsx_vbitrevi_w(a: v4u32) -> v4u32 { static_assert_uimm_bits!(IMM5, 5); - __lsx_vbitrevi_w(a, IMM5) + unsafe { __lsx_vbitrevi_w(a, IMM5) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vbitrevi_d(a: v2u64) -> v2u64 { +pub fn lsx_vbitrevi_d(a: v2u64) -> v2u64 { static_assert_uimm_bits!(IMM6, 6); - __lsx_vbitrevi_d(a, IMM6) + unsafe { __lsx_vbitrevi_d(a, IMM6) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vadd_b(a: v16i8, b: v16i8) -> v16i8 { - __lsx_vadd_b(a, b) +pub fn lsx_vadd_b(a: v16i8, b: v16i8) -> v16i8 { + unsafe { __lsx_vadd_b(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vadd_h(a: v8i16, b: v8i16) -> v8i16 { - __lsx_vadd_h(a, b) +pub fn lsx_vadd_h(a: v8i16, b: v8i16) -> v8i16 { + unsafe { __lsx_vadd_h(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vadd_w(a: v4i32, b: v4i32) -> v4i32 { - __lsx_vadd_w(a, b) +pub fn lsx_vadd_w(a: v4i32, b: v4i32) -> v4i32 { + unsafe { __lsx_vadd_w(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vadd_d(a: v2i64, b: v2i64) -> v2i64 { - __lsx_vadd_d(a, b) +pub fn lsx_vadd_d(a: v2i64, b: v2i64) -> v2i64 { + unsafe { __lsx_vadd_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vaddi_bu(a: v16i8) -> v16i8 { +pub fn lsx_vaddi_bu(a: v16i8) -> v16i8 { static_assert_uimm_bits!(IMM5, 5); - __lsx_vaddi_bu(a, IMM5) + unsafe { __lsx_vaddi_bu(a, IMM5) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vaddi_hu(a: v8i16) -> v8i16 { +pub fn lsx_vaddi_hu(a: v8i16) -> v8i16 { static_assert_uimm_bits!(IMM5, 5); - __lsx_vaddi_hu(a, IMM5) + unsafe { __lsx_vaddi_hu(a, IMM5) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vaddi_wu(a: v4i32) -> v4i32 { +pub fn lsx_vaddi_wu(a: v4i32) -> v4i32 { static_assert_uimm_bits!(IMM5, 5); - __lsx_vaddi_wu(a, IMM5) + unsafe { __lsx_vaddi_wu(a, IMM5) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vaddi_du(a: v2i64) -> v2i64 { +pub fn lsx_vaddi_du(a: v2i64) -> v2i64 { static_assert_uimm_bits!(IMM5, 5); - __lsx_vaddi_du(a, IMM5) + unsafe { __lsx_vaddi_du(a, IMM5) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsub_b(a: v16i8, b: v16i8) -> v16i8 { - __lsx_vsub_b(a, b) +pub fn lsx_vsub_b(a: v16i8, b: v16i8) -> v16i8 { + unsafe { __lsx_vsub_b(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsub_h(a: v8i16, b: v8i16) -> v8i16 { - __lsx_vsub_h(a, b) +pub fn lsx_vsub_h(a: v8i16, b: v8i16) -> v8i16 { + unsafe { __lsx_vsub_h(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsub_w(a: v4i32, b: v4i32) -> v4i32 { - __lsx_vsub_w(a, b) +pub fn lsx_vsub_w(a: v4i32, b: v4i32) -> v4i32 { + unsafe { __lsx_vsub_w(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsub_d(a: v2i64, b: v2i64) -> v2i64 { - __lsx_vsub_d(a, b) +pub fn lsx_vsub_d(a: v2i64, b: v2i64) -> v2i64 { + unsafe { __lsx_vsub_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsubi_bu(a: v16i8) -> v16i8 { +pub fn lsx_vsubi_bu(a: v16i8) -> v16i8 { static_assert_uimm_bits!(IMM5, 5); - __lsx_vsubi_bu(a, IMM5) + unsafe { __lsx_vsubi_bu(a, IMM5) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsubi_hu(a: v8i16) -> v8i16 { +pub fn lsx_vsubi_hu(a: v8i16) -> v8i16 { static_assert_uimm_bits!(IMM5, 5); - __lsx_vsubi_hu(a, IMM5) + unsafe { __lsx_vsubi_hu(a, IMM5) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsubi_wu(a: v4i32) -> v4i32 { +pub fn lsx_vsubi_wu(a: v4i32) -> v4i32 { static_assert_uimm_bits!(IMM5, 5); - __lsx_vsubi_wu(a, IMM5) + unsafe { __lsx_vsubi_wu(a, IMM5) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsubi_du(a: v2i64) -> v2i64 { +pub fn lsx_vsubi_du(a: v2i64) -> v2i64 { static_assert_uimm_bits!(IMM5, 5); - __lsx_vsubi_du(a, IMM5) + unsafe { __lsx_vsubi_du(a, IMM5) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmax_b(a: v16i8, b: v16i8) -> v16i8 { - __lsx_vmax_b(a, b) +pub fn lsx_vmax_b(a: v16i8, b: v16i8) -> v16i8 { + unsafe { __lsx_vmax_b(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmax_h(a: v8i16, b: v8i16) -> v8i16 { - __lsx_vmax_h(a, b) +pub fn lsx_vmax_h(a: v8i16, b: v8i16) -> v8i16 { + unsafe { __lsx_vmax_h(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmax_w(a: v4i32, b: v4i32) -> v4i32 { - __lsx_vmax_w(a, b) +pub fn lsx_vmax_w(a: v4i32, b: v4i32) -> v4i32 { + unsafe { __lsx_vmax_w(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmax_d(a: v2i64, b: v2i64) -> v2i64 { - __lsx_vmax_d(a, b) +pub fn lsx_vmax_d(a: v2i64, b: v2i64) -> v2i64 { + unsafe { __lsx_vmax_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmaxi_b(a: v16i8) -> v16i8 { +pub fn lsx_vmaxi_b(a: v16i8) -> v16i8 { static_assert_simm_bits!(IMM_S5, 5); - __lsx_vmaxi_b(a, IMM_S5) + unsafe { __lsx_vmaxi_b(a, IMM_S5) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmaxi_h(a: v8i16) -> v8i16 { +pub fn lsx_vmaxi_h(a: v8i16) -> v8i16 { static_assert_simm_bits!(IMM_S5, 5); - __lsx_vmaxi_h(a, IMM_S5) + unsafe { __lsx_vmaxi_h(a, IMM_S5) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmaxi_w(a: v4i32) -> v4i32 { +pub fn lsx_vmaxi_w(a: v4i32) -> v4i32 { static_assert_simm_bits!(IMM_S5, 5); - __lsx_vmaxi_w(a, IMM_S5) + unsafe { __lsx_vmaxi_w(a, IMM_S5) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmaxi_d(a: v2i64) -> v2i64 { +pub fn lsx_vmaxi_d(a: v2i64) -> v2i64 { static_assert_simm_bits!(IMM_S5, 5); - __lsx_vmaxi_d(a, IMM_S5) + unsafe { __lsx_vmaxi_d(a, IMM_S5) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmax_bu(a: v16u8, b: v16u8) -> v16u8 { - __lsx_vmax_bu(a, b) +pub fn lsx_vmax_bu(a: v16u8, b: v16u8) -> v16u8 { + unsafe { __lsx_vmax_bu(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmax_hu(a: v8u16, b: v8u16) -> v8u16 { - __lsx_vmax_hu(a, b) +pub fn lsx_vmax_hu(a: v8u16, b: v8u16) -> v8u16 { + unsafe { __lsx_vmax_hu(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmax_wu(a: v4u32, b: v4u32) -> v4u32 { - __lsx_vmax_wu(a, b) +pub fn lsx_vmax_wu(a: v4u32, b: v4u32) -> v4u32 { + unsafe { __lsx_vmax_wu(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmax_du(a: v2u64, b: v2u64) -> v2u64 { - __lsx_vmax_du(a, b) +pub fn lsx_vmax_du(a: v2u64, b: v2u64) -> v2u64 { + unsafe { __lsx_vmax_du(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmaxi_bu(a: v16u8) -> v16u8 { +pub fn lsx_vmaxi_bu(a: v16u8) -> v16u8 { static_assert_uimm_bits!(IMM5, 5); - __lsx_vmaxi_bu(a, IMM5) + unsafe { __lsx_vmaxi_bu(a, IMM5) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmaxi_hu(a: v8u16) -> v8u16 { +pub fn lsx_vmaxi_hu(a: v8u16) -> v8u16 { static_assert_uimm_bits!(IMM5, 5); - __lsx_vmaxi_hu(a, IMM5) + unsafe { __lsx_vmaxi_hu(a, IMM5) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmaxi_wu(a: v4u32) -> v4u32 { +pub fn lsx_vmaxi_wu(a: v4u32) -> v4u32 { static_assert_uimm_bits!(IMM5, 5); - __lsx_vmaxi_wu(a, IMM5) + unsafe { __lsx_vmaxi_wu(a, IMM5) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmaxi_du(a: v2u64) -> v2u64 { +pub fn lsx_vmaxi_du(a: v2u64) -> v2u64 { static_assert_uimm_bits!(IMM5, 5); - __lsx_vmaxi_du(a, IMM5) + unsafe { __lsx_vmaxi_du(a, IMM5) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmin_b(a: v16i8, b: v16i8) -> v16i8 { - __lsx_vmin_b(a, b) +pub fn lsx_vmin_b(a: v16i8, b: v16i8) -> v16i8 { + unsafe { __lsx_vmin_b(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmin_h(a: v8i16, b: v8i16) -> v8i16 { - __lsx_vmin_h(a, b) +pub fn lsx_vmin_h(a: v8i16, b: v8i16) -> v8i16 { + unsafe { __lsx_vmin_h(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmin_w(a: v4i32, b: v4i32) -> v4i32 { - __lsx_vmin_w(a, b) +pub fn lsx_vmin_w(a: v4i32, b: v4i32) -> v4i32 { + unsafe { __lsx_vmin_w(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmin_d(a: v2i64, b: v2i64) -> v2i64 { - __lsx_vmin_d(a, b) +pub fn lsx_vmin_d(a: v2i64, b: v2i64) -> v2i64 { + unsafe { __lsx_vmin_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmini_b(a: v16i8) -> v16i8 { +pub fn lsx_vmini_b(a: v16i8) -> v16i8 { static_assert_simm_bits!(IMM_S5, 5); - __lsx_vmini_b(a, IMM_S5) + unsafe { __lsx_vmini_b(a, IMM_S5) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmini_h(a: v8i16) -> v8i16 { +pub fn lsx_vmini_h(a: v8i16) -> v8i16 { static_assert_simm_bits!(IMM_S5, 5); - __lsx_vmini_h(a, IMM_S5) + unsafe { __lsx_vmini_h(a, IMM_S5) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmini_w(a: v4i32) -> v4i32 { +pub fn lsx_vmini_w(a: v4i32) -> v4i32 { static_assert_simm_bits!(IMM_S5, 5); - __lsx_vmini_w(a, IMM_S5) + unsafe { __lsx_vmini_w(a, IMM_S5) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmini_d(a: v2i64) -> v2i64 { +pub fn lsx_vmini_d(a: v2i64) -> v2i64 { static_assert_simm_bits!(IMM_S5, 5); - __lsx_vmini_d(a, IMM_S5) + unsafe { __lsx_vmini_d(a, IMM_S5) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmin_bu(a: v16u8, b: v16u8) -> v16u8 { - __lsx_vmin_bu(a, b) +pub fn lsx_vmin_bu(a: v16u8, b: v16u8) -> v16u8 { + unsafe { __lsx_vmin_bu(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmin_hu(a: v8u16, b: v8u16) -> v8u16 { - __lsx_vmin_hu(a, b) +pub fn lsx_vmin_hu(a: v8u16, b: v8u16) -> v8u16 { + unsafe { __lsx_vmin_hu(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmin_wu(a: v4u32, b: v4u32) -> v4u32 { - __lsx_vmin_wu(a, b) +pub fn lsx_vmin_wu(a: v4u32, b: v4u32) -> v4u32 { + unsafe { __lsx_vmin_wu(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmin_du(a: v2u64, b: v2u64) -> v2u64 { - __lsx_vmin_du(a, b) +pub fn lsx_vmin_du(a: v2u64, b: v2u64) -> v2u64 { + unsafe { __lsx_vmin_du(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmini_bu(a: v16u8) -> v16u8 { +pub fn lsx_vmini_bu(a: v16u8) -> v16u8 { static_assert_uimm_bits!(IMM5, 5); - __lsx_vmini_bu(a, IMM5) + unsafe { __lsx_vmini_bu(a, IMM5) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmini_hu(a: v8u16) -> v8u16 { +pub fn lsx_vmini_hu(a: v8u16) -> v8u16 { static_assert_uimm_bits!(IMM5, 5); - __lsx_vmini_hu(a, IMM5) + unsafe { __lsx_vmini_hu(a, IMM5) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmini_wu(a: v4u32) -> v4u32 { +pub fn lsx_vmini_wu(a: v4u32) -> v4u32 { static_assert_uimm_bits!(IMM5, 5); - __lsx_vmini_wu(a, IMM5) + unsafe { __lsx_vmini_wu(a, IMM5) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmini_du(a: v2u64) -> v2u64 { +pub fn lsx_vmini_du(a: v2u64) -> v2u64 { static_assert_uimm_bits!(IMM5, 5); - __lsx_vmini_du(a, IMM5) + unsafe { __lsx_vmini_du(a, IMM5) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vseq_b(a: v16i8, b: v16i8) -> v16i8 { - __lsx_vseq_b(a, b) +pub fn lsx_vseq_b(a: v16i8, b: v16i8) -> v16i8 { + unsafe { __lsx_vseq_b(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vseq_h(a: v8i16, b: v8i16) -> v8i16 { - __lsx_vseq_h(a, b) +pub fn lsx_vseq_h(a: v8i16, b: v8i16) -> v8i16 { + unsafe { __lsx_vseq_h(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vseq_w(a: v4i32, b: v4i32) -> v4i32 { - __lsx_vseq_w(a, b) +pub fn lsx_vseq_w(a: v4i32, b: v4i32) -> v4i32 { + unsafe { __lsx_vseq_w(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vseq_d(a: v2i64, b: v2i64) -> v2i64 { - __lsx_vseq_d(a, b) +pub fn lsx_vseq_d(a: v2i64, b: v2i64) -> v2i64 { + unsafe { __lsx_vseq_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vseqi_b(a: v16i8) -> v16i8 { +pub fn lsx_vseqi_b(a: v16i8) -> v16i8 { static_assert_simm_bits!(IMM_S5, 5); - __lsx_vseqi_b(a, IMM_S5) + unsafe { __lsx_vseqi_b(a, IMM_S5) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vseqi_h(a: v8i16) -> v8i16 { +pub fn lsx_vseqi_h(a: v8i16) -> v8i16 { static_assert_simm_bits!(IMM_S5, 5); - __lsx_vseqi_h(a, IMM_S5) + unsafe { __lsx_vseqi_h(a, IMM_S5) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vseqi_w(a: v4i32) -> v4i32 { +pub fn lsx_vseqi_w(a: v4i32) -> v4i32 { static_assert_simm_bits!(IMM_S5, 5); - __lsx_vseqi_w(a, IMM_S5) + unsafe { __lsx_vseqi_w(a, IMM_S5) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vseqi_d(a: v2i64) -> v2i64 { +pub fn lsx_vseqi_d(a: v2i64) -> v2i64 { static_assert_simm_bits!(IMM_S5, 5); - __lsx_vseqi_d(a, IMM_S5) + unsafe { __lsx_vseqi_d(a, IMM_S5) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vslti_b(a: v16i8) -> v16i8 { +pub fn lsx_vslti_b(a: v16i8) -> v16i8 { static_assert_simm_bits!(IMM_S5, 5); - __lsx_vslti_b(a, IMM_S5) + unsafe { __lsx_vslti_b(a, IMM_S5) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vslt_b(a: v16i8, b: v16i8) -> v16i8 { - __lsx_vslt_b(a, b) +pub fn lsx_vslt_b(a: v16i8, b: v16i8) -> v16i8 { + unsafe { __lsx_vslt_b(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vslt_h(a: v8i16, b: v8i16) -> v8i16 { - __lsx_vslt_h(a, b) +pub fn lsx_vslt_h(a: v8i16, b: v8i16) -> v8i16 { + unsafe { __lsx_vslt_h(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vslt_w(a: v4i32, b: v4i32) -> v4i32 { - __lsx_vslt_w(a, b) +pub fn lsx_vslt_w(a: v4i32, b: v4i32) -> v4i32 { + unsafe { __lsx_vslt_w(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vslt_d(a: v2i64, b: v2i64) -> v2i64 { - __lsx_vslt_d(a, b) +pub fn lsx_vslt_d(a: v2i64, b: v2i64) -> v2i64 { + unsafe { __lsx_vslt_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vslti_h(a: v8i16) -> v8i16 { +pub fn lsx_vslti_h(a: v8i16) -> v8i16 { static_assert_simm_bits!(IMM_S5, 5); - __lsx_vslti_h(a, IMM_S5) + unsafe { __lsx_vslti_h(a, IMM_S5) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vslti_w(a: v4i32) -> v4i32 { +pub fn lsx_vslti_w(a: v4i32) -> v4i32 { static_assert_simm_bits!(IMM_S5, 5); - __lsx_vslti_w(a, IMM_S5) + unsafe { __lsx_vslti_w(a, IMM_S5) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vslti_d(a: v2i64) -> v2i64 { +pub fn lsx_vslti_d(a: v2i64) -> v2i64 { static_assert_simm_bits!(IMM_S5, 5); - __lsx_vslti_d(a, IMM_S5) + unsafe { __lsx_vslti_d(a, IMM_S5) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vslt_bu(a: v16u8, b: v16u8) -> v16i8 { - __lsx_vslt_bu(a, b) +pub fn lsx_vslt_bu(a: v16u8, b: v16u8) -> v16i8 { + unsafe { __lsx_vslt_bu(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vslt_hu(a: v8u16, b: v8u16) -> v8i16 { - __lsx_vslt_hu(a, b) +pub fn lsx_vslt_hu(a: v8u16, b: v8u16) -> v8i16 { + unsafe { __lsx_vslt_hu(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vslt_wu(a: v4u32, b: v4u32) -> v4i32 { - __lsx_vslt_wu(a, b) +pub fn lsx_vslt_wu(a: v4u32, b: v4u32) -> v4i32 { + unsafe { __lsx_vslt_wu(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vslt_du(a: v2u64, b: v2u64) -> v2i64 { - __lsx_vslt_du(a, b) +pub fn lsx_vslt_du(a: v2u64, b: v2u64) -> v2i64 { + unsafe { __lsx_vslt_du(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vslti_bu(a: v16u8) -> v16i8 { +pub fn lsx_vslti_bu(a: v16u8) -> v16i8 { static_assert_uimm_bits!(IMM5, 5); - __lsx_vslti_bu(a, IMM5) + unsafe { __lsx_vslti_bu(a, IMM5) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vslti_hu(a: v8u16) -> v8i16 { +pub fn lsx_vslti_hu(a: v8u16) -> v8i16 { static_assert_uimm_bits!(IMM5, 5); - __lsx_vslti_hu(a, IMM5) + unsafe { __lsx_vslti_hu(a, IMM5) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vslti_wu(a: v4u32) -> v4i32 { +pub fn lsx_vslti_wu(a: v4u32) -> v4i32 { static_assert_uimm_bits!(IMM5, 5); - __lsx_vslti_wu(a, IMM5) + unsafe { __lsx_vslti_wu(a, IMM5) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vslti_du(a: v2u64) -> v2i64 { +pub fn lsx_vslti_du(a: v2u64) -> v2i64 { static_assert_uimm_bits!(IMM5, 5); - __lsx_vslti_du(a, IMM5) + unsafe { __lsx_vslti_du(a, IMM5) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsle_b(a: v16i8, b: v16i8) -> v16i8 { - __lsx_vsle_b(a, b) +pub fn lsx_vsle_b(a: v16i8, b: v16i8) -> v16i8 { + unsafe { __lsx_vsle_b(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsle_h(a: v8i16, b: v8i16) -> v8i16 { - __lsx_vsle_h(a, b) +pub fn lsx_vsle_h(a: v8i16, b: v8i16) -> v8i16 { + unsafe { __lsx_vsle_h(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsle_w(a: v4i32, b: v4i32) -> v4i32 { - __lsx_vsle_w(a, b) +pub fn lsx_vsle_w(a: v4i32, b: v4i32) -> v4i32 { + unsafe { __lsx_vsle_w(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsle_d(a: v2i64, b: v2i64) -> v2i64 { - __lsx_vsle_d(a, b) +pub fn lsx_vsle_d(a: v2i64, b: v2i64) -> v2i64 { + unsafe { __lsx_vsle_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vslei_b(a: v16i8) -> v16i8 { +pub fn lsx_vslei_b(a: v16i8) -> v16i8 { static_assert_simm_bits!(IMM_S5, 5); - __lsx_vslei_b(a, IMM_S5) + unsafe { __lsx_vslei_b(a, IMM_S5) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vslei_h(a: v8i16) -> v8i16 { +pub fn lsx_vslei_h(a: v8i16) -> v8i16 { static_assert_simm_bits!(IMM_S5, 5); - __lsx_vslei_h(a, IMM_S5) + unsafe { __lsx_vslei_h(a, IMM_S5) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vslei_w(a: v4i32) -> v4i32 { +pub fn lsx_vslei_w(a: v4i32) -> v4i32 { static_assert_simm_bits!(IMM_S5, 5); - __lsx_vslei_w(a, IMM_S5) + unsafe { __lsx_vslei_w(a, IMM_S5) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vslei_d(a: v2i64) -> v2i64 { +pub fn lsx_vslei_d(a: v2i64) -> v2i64 { static_assert_simm_bits!(IMM_S5, 5); - __lsx_vslei_d(a, IMM_S5) + unsafe { __lsx_vslei_d(a, IMM_S5) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsle_bu(a: v16u8, b: v16u8) -> v16i8 { - __lsx_vsle_bu(a, b) +pub fn lsx_vsle_bu(a: v16u8, b: v16u8) -> v16i8 { + unsafe { __lsx_vsle_bu(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsle_hu(a: v8u16, b: v8u16) -> v8i16 { - __lsx_vsle_hu(a, b) +pub fn lsx_vsle_hu(a: v8u16, b: v8u16) -> v8i16 { + unsafe { __lsx_vsle_hu(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsle_wu(a: v4u32, b: v4u32) -> v4i32 { - __lsx_vsle_wu(a, b) +pub fn lsx_vsle_wu(a: v4u32, b: v4u32) -> v4i32 { + unsafe { __lsx_vsle_wu(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsle_du(a: v2u64, b: v2u64) -> v2i64 { - __lsx_vsle_du(a, b) +pub fn lsx_vsle_du(a: v2u64, b: v2u64) -> v2i64 { + unsafe { __lsx_vsle_du(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vslei_bu(a: v16u8) -> v16i8 { +pub fn lsx_vslei_bu(a: v16u8) -> v16i8 { static_assert_uimm_bits!(IMM5, 5); - __lsx_vslei_bu(a, IMM5) + unsafe { __lsx_vslei_bu(a, IMM5) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vslei_hu(a: v8u16) -> v8i16 { +pub fn lsx_vslei_hu(a: v8u16) -> v8i16 { static_assert_uimm_bits!(IMM5, 5); - __lsx_vslei_hu(a, IMM5) + unsafe { __lsx_vslei_hu(a, IMM5) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vslei_wu(a: v4u32) -> v4i32 { +pub fn lsx_vslei_wu(a: v4u32) -> v4i32 { static_assert_uimm_bits!(IMM5, 5); - __lsx_vslei_wu(a, IMM5) + unsafe { __lsx_vslei_wu(a, IMM5) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vslei_du(a: v2u64) -> v2i64 { +pub fn lsx_vslei_du(a: v2u64) -> v2i64 { static_assert_uimm_bits!(IMM5, 5); - __lsx_vslei_du(a, IMM5) + unsafe { __lsx_vslei_du(a, IMM5) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsat_b(a: v16i8) -> v16i8 { +pub fn lsx_vsat_b(a: v16i8) -> v16i8 { static_assert_uimm_bits!(IMM3, 3); - __lsx_vsat_b(a, IMM3) + unsafe { __lsx_vsat_b(a, IMM3) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsat_h(a: v8i16) -> v8i16 { +pub fn lsx_vsat_h(a: v8i16) -> v8i16 { static_assert_uimm_bits!(IMM4, 4); - __lsx_vsat_h(a, IMM4) + unsafe { __lsx_vsat_h(a, IMM4) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsat_w(a: v4i32) -> v4i32 { +pub fn lsx_vsat_w(a: v4i32) -> v4i32 { static_assert_uimm_bits!(IMM5, 5); - __lsx_vsat_w(a, IMM5) + unsafe { __lsx_vsat_w(a, IMM5) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsat_d(a: v2i64) -> v2i64 { +pub fn lsx_vsat_d(a: v2i64) -> v2i64 { static_assert_uimm_bits!(IMM6, 6); - __lsx_vsat_d(a, IMM6) + unsafe { __lsx_vsat_d(a, IMM6) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsat_bu(a: v16u8) -> v16u8 { +pub fn lsx_vsat_bu(a: v16u8) -> v16u8 { static_assert_uimm_bits!(IMM3, 3); - __lsx_vsat_bu(a, IMM3) + unsafe { __lsx_vsat_bu(a, IMM3) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsat_hu(a: v8u16) -> v8u16 { +pub fn lsx_vsat_hu(a: v8u16) -> v8u16 { static_assert_uimm_bits!(IMM4, 4); - __lsx_vsat_hu(a, IMM4) + unsafe { __lsx_vsat_hu(a, IMM4) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsat_wu(a: v4u32) -> v4u32 { +pub fn lsx_vsat_wu(a: v4u32) -> v4u32 { static_assert_uimm_bits!(IMM5, 5); - __lsx_vsat_wu(a, IMM5) + unsafe { __lsx_vsat_wu(a, IMM5) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsat_du(a: v2u64) -> v2u64 { +pub fn lsx_vsat_du(a: v2u64) -> v2u64 { static_assert_uimm_bits!(IMM6, 6); - __lsx_vsat_du(a, IMM6) + unsafe { __lsx_vsat_du(a, IMM6) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vadda_b(a: v16i8, b: v16i8) -> v16i8 { - __lsx_vadda_b(a, b) +pub fn lsx_vadda_b(a: v16i8, b: v16i8) -> v16i8 { + unsafe { __lsx_vadda_b(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vadda_h(a: v8i16, b: v8i16) -> v8i16 { - __lsx_vadda_h(a, b) +pub fn lsx_vadda_h(a: v8i16, b: v8i16) -> v8i16 { + unsafe { __lsx_vadda_h(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vadda_w(a: v4i32, b: v4i32) -> v4i32 { - __lsx_vadda_w(a, b) +pub fn lsx_vadda_w(a: v4i32, b: v4i32) -> v4i32 { + unsafe { __lsx_vadda_w(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vadda_d(a: v2i64, b: v2i64) -> v2i64 { - __lsx_vadda_d(a, b) +pub fn lsx_vadda_d(a: v2i64, b: v2i64) -> v2i64 { + unsafe { __lsx_vadda_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsadd_b(a: v16i8, b: v16i8) -> v16i8 { - __lsx_vsadd_b(a, b) +pub fn lsx_vsadd_b(a: v16i8, b: v16i8) -> v16i8 { + unsafe { __lsx_vsadd_b(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsadd_h(a: v8i16, b: v8i16) -> v8i16 { - __lsx_vsadd_h(a, b) +pub fn lsx_vsadd_h(a: v8i16, b: v8i16) -> v8i16 { + unsafe { __lsx_vsadd_h(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsadd_w(a: v4i32, b: v4i32) -> v4i32 { - __lsx_vsadd_w(a, b) +pub fn lsx_vsadd_w(a: v4i32, b: v4i32) -> v4i32 { + unsafe { __lsx_vsadd_w(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsadd_d(a: v2i64, b: v2i64) -> v2i64 { - __lsx_vsadd_d(a, b) +pub fn lsx_vsadd_d(a: v2i64, b: v2i64) -> v2i64 { + unsafe { __lsx_vsadd_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsadd_bu(a: v16u8, b: v16u8) -> v16u8 { - __lsx_vsadd_bu(a, b) +pub fn lsx_vsadd_bu(a: v16u8, b: v16u8) -> v16u8 { + unsafe { __lsx_vsadd_bu(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsadd_hu(a: v8u16, b: v8u16) -> v8u16 { - __lsx_vsadd_hu(a, b) +pub fn lsx_vsadd_hu(a: v8u16, b: v8u16) -> v8u16 { + unsafe { __lsx_vsadd_hu(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsadd_wu(a: v4u32, b: v4u32) -> v4u32 { - __lsx_vsadd_wu(a, b) +pub fn lsx_vsadd_wu(a: v4u32, b: v4u32) -> v4u32 { + unsafe { __lsx_vsadd_wu(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsadd_du(a: v2u64, b: v2u64) -> v2u64 { - __lsx_vsadd_du(a, b) +pub fn lsx_vsadd_du(a: v2u64, b: v2u64) -> v2u64 { + unsafe { __lsx_vsadd_du(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vavg_b(a: v16i8, b: v16i8) -> v16i8 { - __lsx_vavg_b(a, b) +pub fn lsx_vavg_b(a: v16i8, b: v16i8) -> v16i8 { + unsafe { __lsx_vavg_b(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vavg_h(a: v8i16, b: v8i16) -> v8i16 { - __lsx_vavg_h(a, b) +pub fn lsx_vavg_h(a: v8i16, b: v8i16) -> v8i16 { + unsafe { __lsx_vavg_h(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vavg_w(a: v4i32, b: v4i32) -> v4i32 { - __lsx_vavg_w(a, b) +pub fn lsx_vavg_w(a: v4i32, b: v4i32) -> v4i32 { + unsafe { __lsx_vavg_w(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vavg_d(a: v2i64, b: v2i64) -> v2i64 { - __lsx_vavg_d(a, b) +pub fn lsx_vavg_d(a: v2i64, b: v2i64) -> v2i64 { + unsafe { __lsx_vavg_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vavg_bu(a: v16u8, b: v16u8) -> v16u8 { - __lsx_vavg_bu(a, b) +pub fn lsx_vavg_bu(a: v16u8, b: v16u8) -> v16u8 { + unsafe { __lsx_vavg_bu(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vavg_hu(a: v8u16, b: v8u16) -> v8u16 { - __lsx_vavg_hu(a, b) +pub fn lsx_vavg_hu(a: v8u16, b: v8u16) -> v8u16 { + unsafe { __lsx_vavg_hu(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vavg_wu(a: v4u32, b: v4u32) -> v4u32 { - __lsx_vavg_wu(a, b) +pub fn lsx_vavg_wu(a: v4u32, b: v4u32) -> v4u32 { + unsafe { __lsx_vavg_wu(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vavg_du(a: v2u64, b: v2u64) -> v2u64 { - __lsx_vavg_du(a, b) +pub fn lsx_vavg_du(a: v2u64, b: v2u64) -> v2u64 { + unsafe { __lsx_vavg_du(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vavgr_b(a: v16i8, b: v16i8) -> v16i8 { - __lsx_vavgr_b(a, b) +pub fn lsx_vavgr_b(a: v16i8, b: v16i8) -> v16i8 { + unsafe { __lsx_vavgr_b(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vavgr_h(a: v8i16, b: v8i16) -> v8i16 { - __lsx_vavgr_h(a, b) +pub fn lsx_vavgr_h(a: v8i16, b: v8i16) -> v8i16 { + unsafe { __lsx_vavgr_h(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vavgr_w(a: v4i32, b: v4i32) -> v4i32 { - __lsx_vavgr_w(a, b) +pub fn lsx_vavgr_w(a: v4i32, b: v4i32) -> v4i32 { + unsafe { __lsx_vavgr_w(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vavgr_d(a: v2i64, b: v2i64) -> v2i64 { - __lsx_vavgr_d(a, b) +pub fn lsx_vavgr_d(a: v2i64, b: v2i64) -> v2i64 { + unsafe { __lsx_vavgr_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vavgr_bu(a: v16u8, b: v16u8) -> v16u8 { - __lsx_vavgr_bu(a, b) +pub fn lsx_vavgr_bu(a: v16u8, b: v16u8) -> v16u8 { + unsafe { __lsx_vavgr_bu(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vavgr_hu(a: v8u16, b: v8u16) -> v8u16 { - __lsx_vavgr_hu(a, b) +pub fn lsx_vavgr_hu(a: v8u16, b: v8u16) -> v8u16 { + unsafe { __lsx_vavgr_hu(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vavgr_wu(a: v4u32, b: v4u32) -> v4u32 { - __lsx_vavgr_wu(a, b) +pub fn lsx_vavgr_wu(a: v4u32, b: v4u32) -> v4u32 { + unsafe { __lsx_vavgr_wu(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vavgr_du(a: v2u64, b: v2u64) -> v2u64 { - __lsx_vavgr_du(a, b) +pub fn lsx_vavgr_du(a: v2u64, b: v2u64) -> v2u64 { + unsafe { __lsx_vavgr_du(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vssub_b(a: v16i8, b: v16i8) -> v16i8 { - __lsx_vssub_b(a, b) +pub fn lsx_vssub_b(a: v16i8, b: v16i8) -> v16i8 { + unsafe { __lsx_vssub_b(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vssub_h(a: v8i16, b: v8i16) -> v8i16 { - __lsx_vssub_h(a, b) +pub fn lsx_vssub_h(a: v8i16, b: v8i16) -> v8i16 { + unsafe { __lsx_vssub_h(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vssub_w(a: v4i32, b: v4i32) -> v4i32 { - __lsx_vssub_w(a, b) +pub fn lsx_vssub_w(a: v4i32, b: v4i32) -> v4i32 { + unsafe { __lsx_vssub_w(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vssub_d(a: v2i64, b: v2i64) -> v2i64 { - __lsx_vssub_d(a, b) +pub fn lsx_vssub_d(a: v2i64, b: v2i64) -> v2i64 { + unsafe { __lsx_vssub_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vssub_bu(a: v16u8, b: v16u8) -> v16u8 { - __lsx_vssub_bu(a, b) +pub fn lsx_vssub_bu(a: v16u8, b: v16u8) -> v16u8 { + unsafe { __lsx_vssub_bu(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vssub_hu(a: v8u16, b: v8u16) -> v8u16 { - __lsx_vssub_hu(a, b) +pub fn lsx_vssub_hu(a: v8u16, b: v8u16) -> v8u16 { + unsafe { __lsx_vssub_hu(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vssub_wu(a: v4u32, b: v4u32) -> v4u32 { - __lsx_vssub_wu(a, b) +pub fn lsx_vssub_wu(a: v4u32, b: v4u32) -> v4u32 { + unsafe { __lsx_vssub_wu(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vssub_du(a: v2u64, b: v2u64) -> v2u64 { - __lsx_vssub_du(a, b) +pub fn lsx_vssub_du(a: v2u64, b: v2u64) -> v2u64 { + unsafe { __lsx_vssub_du(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vabsd_b(a: v16i8, b: v16i8) -> v16i8 { - __lsx_vabsd_b(a, b) +pub fn lsx_vabsd_b(a: v16i8, b: v16i8) -> v16i8 { + unsafe { __lsx_vabsd_b(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vabsd_h(a: v8i16, b: v8i16) -> v8i16 { - __lsx_vabsd_h(a, b) +pub fn lsx_vabsd_h(a: v8i16, b: v8i16) -> v8i16 { + unsafe { __lsx_vabsd_h(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vabsd_w(a: v4i32, b: v4i32) -> v4i32 { - __lsx_vabsd_w(a, b) +pub fn lsx_vabsd_w(a: v4i32, b: v4i32) -> v4i32 { + unsafe { __lsx_vabsd_w(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vabsd_d(a: v2i64, b: v2i64) -> v2i64 { - __lsx_vabsd_d(a, b) +pub fn lsx_vabsd_d(a: v2i64, b: v2i64) -> v2i64 { + unsafe { __lsx_vabsd_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vabsd_bu(a: v16u8, b: v16u8) -> v16u8 { - __lsx_vabsd_bu(a, b) +pub fn lsx_vabsd_bu(a: v16u8, b: v16u8) -> v16u8 { + unsafe { __lsx_vabsd_bu(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vabsd_hu(a: v8u16, b: v8u16) -> v8u16 { - __lsx_vabsd_hu(a, b) +pub fn lsx_vabsd_hu(a: v8u16, b: v8u16) -> v8u16 { + unsafe { __lsx_vabsd_hu(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vabsd_wu(a: v4u32, b: v4u32) -> v4u32 { - __lsx_vabsd_wu(a, b) +pub fn lsx_vabsd_wu(a: v4u32, b: v4u32) -> v4u32 { + unsafe { __lsx_vabsd_wu(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vabsd_du(a: v2u64, b: v2u64) -> v2u64 { - __lsx_vabsd_du(a, b) +pub fn lsx_vabsd_du(a: v2u64, b: v2u64) -> v2u64 { + unsafe { __lsx_vabsd_du(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmul_b(a: v16i8, b: v16i8) -> v16i8 { - __lsx_vmul_b(a, b) +pub fn lsx_vmul_b(a: v16i8, b: v16i8) -> v16i8 { + unsafe { __lsx_vmul_b(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmul_h(a: v8i16, b: v8i16) -> v8i16 { - __lsx_vmul_h(a, b) +pub fn lsx_vmul_h(a: v8i16, b: v8i16) -> v8i16 { + unsafe { __lsx_vmul_h(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmul_w(a: v4i32, b: v4i32) -> v4i32 { - __lsx_vmul_w(a, b) +pub fn lsx_vmul_w(a: v4i32, b: v4i32) -> v4i32 { + unsafe { __lsx_vmul_w(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmul_d(a: v2i64, b: v2i64) -> v2i64 { - __lsx_vmul_d(a, b) +pub fn lsx_vmul_d(a: v2i64, b: v2i64) -> v2i64 { + unsafe { __lsx_vmul_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmadd_b(a: v16i8, b: v16i8, c: v16i8) -> v16i8 { - __lsx_vmadd_b(a, b, c) +pub fn lsx_vmadd_b(a: v16i8, b: v16i8, c: v16i8) -> v16i8 { + unsafe { __lsx_vmadd_b(a, b, c) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmadd_h(a: v8i16, b: v8i16, c: v8i16) -> v8i16 { - __lsx_vmadd_h(a, b, c) +pub fn lsx_vmadd_h(a: v8i16, b: v8i16, c: v8i16) -> v8i16 { + unsafe { __lsx_vmadd_h(a, b, c) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmadd_w(a: v4i32, b: v4i32, c: v4i32) -> v4i32 { - __lsx_vmadd_w(a, b, c) +pub fn lsx_vmadd_w(a: v4i32, b: v4i32, c: v4i32) -> v4i32 { + unsafe { __lsx_vmadd_w(a, b, c) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmadd_d(a: v2i64, b: v2i64, c: v2i64) -> v2i64 { - __lsx_vmadd_d(a, b, c) +pub fn lsx_vmadd_d(a: v2i64, b: v2i64, c: v2i64) -> v2i64 { + unsafe { __lsx_vmadd_d(a, b, c) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmsub_b(a: v16i8, b: v16i8, c: v16i8) -> v16i8 { - __lsx_vmsub_b(a, b, c) +pub fn lsx_vmsub_b(a: v16i8, b: v16i8, c: v16i8) -> v16i8 { + unsafe { __lsx_vmsub_b(a, b, c) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmsub_h(a: v8i16, b: v8i16, c: v8i16) -> v8i16 { - __lsx_vmsub_h(a, b, c) +pub fn lsx_vmsub_h(a: v8i16, b: v8i16, c: v8i16) -> v8i16 { + unsafe { __lsx_vmsub_h(a, b, c) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmsub_w(a: v4i32, b: v4i32, c: v4i32) -> v4i32 { - __lsx_vmsub_w(a, b, c) +pub fn lsx_vmsub_w(a: v4i32, b: v4i32, c: v4i32) -> v4i32 { + unsafe { __lsx_vmsub_w(a, b, c) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmsub_d(a: v2i64, b: v2i64, c: v2i64) -> v2i64 { - __lsx_vmsub_d(a, b, c) +pub fn lsx_vmsub_d(a: v2i64, b: v2i64, c: v2i64) -> v2i64 { + unsafe { __lsx_vmsub_d(a, b, c) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vdiv_b(a: v16i8, b: v16i8) -> v16i8 { - __lsx_vdiv_b(a, b) +pub fn lsx_vdiv_b(a: v16i8, b: v16i8) -> v16i8 { + unsafe { __lsx_vdiv_b(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vdiv_h(a: v8i16, b: v8i16) -> v8i16 { - __lsx_vdiv_h(a, b) +pub fn lsx_vdiv_h(a: v8i16, b: v8i16) -> v8i16 { + unsafe { __lsx_vdiv_h(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vdiv_w(a: v4i32, b: v4i32) -> v4i32 { - __lsx_vdiv_w(a, b) +pub fn lsx_vdiv_w(a: v4i32, b: v4i32) -> v4i32 { + unsafe { __lsx_vdiv_w(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vdiv_d(a: v2i64, b: v2i64) -> v2i64 { - __lsx_vdiv_d(a, b) +pub fn lsx_vdiv_d(a: v2i64, b: v2i64) -> v2i64 { + unsafe { __lsx_vdiv_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vdiv_bu(a: v16u8, b: v16u8) -> v16u8 { - __lsx_vdiv_bu(a, b) +pub fn lsx_vdiv_bu(a: v16u8, b: v16u8) -> v16u8 { + unsafe { __lsx_vdiv_bu(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vdiv_hu(a: v8u16, b: v8u16) -> v8u16 { - __lsx_vdiv_hu(a, b) +pub fn lsx_vdiv_hu(a: v8u16, b: v8u16) -> v8u16 { + unsafe { __lsx_vdiv_hu(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vdiv_wu(a: v4u32, b: v4u32) -> v4u32 { - __lsx_vdiv_wu(a, b) +pub fn lsx_vdiv_wu(a: v4u32, b: v4u32) -> v4u32 { + unsafe { __lsx_vdiv_wu(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vdiv_du(a: v2u64, b: v2u64) -> v2u64 { - __lsx_vdiv_du(a, b) +pub fn lsx_vdiv_du(a: v2u64, b: v2u64) -> v2u64 { + unsafe { __lsx_vdiv_du(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vhaddw_h_b(a: v16i8, b: v16i8) -> v8i16 { - __lsx_vhaddw_h_b(a, b) +pub fn lsx_vhaddw_h_b(a: v16i8, b: v16i8) -> v8i16 { + unsafe { __lsx_vhaddw_h_b(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vhaddw_w_h(a: v8i16, b: v8i16) -> v4i32 { - __lsx_vhaddw_w_h(a, b) +pub fn lsx_vhaddw_w_h(a: v8i16, b: v8i16) -> v4i32 { + unsafe { __lsx_vhaddw_w_h(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vhaddw_d_w(a: v4i32, b: v4i32) -> v2i64 { - __lsx_vhaddw_d_w(a, b) +pub fn lsx_vhaddw_d_w(a: v4i32, b: v4i32) -> v2i64 { + unsafe { __lsx_vhaddw_d_w(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vhaddw_hu_bu(a: v16u8, b: v16u8) -> v8u16 { - __lsx_vhaddw_hu_bu(a, b) +pub fn lsx_vhaddw_hu_bu(a: v16u8, b: v16u8) -> v8u16 { + unsafe { __lsx_vhaddw_hu_bu(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vhaddw_wu_hu(a: v8u16, b: v8u16) -> v4u32 { - __lsx_vhaddw_wu_hu(a, b) +pub fn lsx_vhaddw_wu_hu(a: v8u16, b: v8u16) -> v4u32 { + unsafe { __lsx_vhaddw_wu_hu(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vhaddw_du_wu(a: v4u32, b: v4u32) -> v2u64 { - __lsx_vhaddw_du_wu(a, b) +pub fn lsx_vhaddw_du_wu(a: v4u32, b: v4u32) -> v2u64 { + unsafe { __lsx_vhaddw_du_wu(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vhsubw_h_b(a: v16i8, b: v16i8) -> v8i16 { - __lsx_vhsubw_h_b(a, b) +pub fn lsx_vhsubw_h_b(a: v16i8, b: v16i8) -> v8i16 { + unsafe { __lsx_vhsubw_h_b(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vhsubw_w_h(a: v8i16, b: v8i16) -> v4i32 { - __lsx_vhsubw_w_h(a, b) +pub fn lsx_vhsubw_w_h(a: v8i16, b: v8i16) -> v4i32 { + unsafe { __lsx_vhsubw_w_h(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vhsubw_d_w(a: v4i32, b: v4i32) -> v2i64 { - __lsx_vhsubw_d_w(a, b) +pub fn lsx_vhsubw_d_w(a: v4i32, b: v4i32) -> v2i64 { + unsafe { __lsx_vhsubw_d_w(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vhsubw_hu_bu(a: v16u8, b: v16u8) -> v8i16 { - __lsx_vhsubw_hu_bu(a, b) +pub fn lsx_vhsubw_hu_bu(a: v16u8, b: v16u8) -> v8i16 { + unsafe { __lsx_vhsubw_hu_bu(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vhsubw_wu_hu(a: v8u16, b: v8u16) -> v4i32 { - __lsx_vhsubw_wu_hu(a, b) +pub fn lsx_vhsubw_wu_hu(a: v8u16, b: v8u16) -> v4i32 { + unsafe { __lsx_vhsubw_wu_hu(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vhsubw_du_wu(a: v4u32, b: v4u32) -> v2i64 { - __lsx_vhsubw_du_wu(a, b) +pub fn lsx_vhsubw_du_wu(a: v4u32, b: v4u32) -> v2i64 { + unsafe { __lsx_vhsubw_du_wu(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmod_b(a: v16i8, b: v16i8) -> v16i8 { - __lsx_vmod_b(a, b) +pub fn lsx_vmod_b(a: v16i8, b: v16i8) -> v16i8 { + unsafe { __lsx_vmod_b(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmod_h(a: v8i16, b: v8i16) -> v8i16 { - __lsx_vmod_h(a, b) +pub fn lsx_vmod_h(a: v8i16, b: v8i16) -> v8i16 { + unsafe { __lsx_vmod_h(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmod_w(a: v4i32, b: v4i32) -> v4i32 { - __lsx_vmod_w(a, b) +pub fn lsx_vmod_w(a: v4i32, b: v4i32) -> v4i32 { + unsafe { __lsx_vmod_w(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmod_d(a: v2i64, b: v2i64) -> v2i64 { - __lsx_vmod_d(a, b) +pub fn lsx_vmod_d(a: v2i64, b: v2i64) -> v2i64 { + unsafe { __lsx_vmod_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmod_bu(a: v16u8, b: v16u8) -> v16u8 { - __lsx_vmod_bu(a, b) +pub fn lsx_vmod_bu(a: v16u8, b: v16u8) -> v16u8 { + unsafe { __lsx_vmod_bu(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmod_hu(a: v8u16, b: v8u16) -> v8u16 { - __lsx_vmod_hu(a, b) +pub fn lsx_vmod_hu(a: v8u16, b: v8u16) -> v8u16 { + unsafe { __lsx_vmod_hu(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmod_wu(a: v4u32, b: v4u32) -> v4u32 { - __lsx_vmod_wu(a, b) +pub fn lsx_vmod_wu(a: v4u32, b: v4u32) -> v4u32 { + unsafe { __lsx_vmod_wu(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmod_du(a: v2u64, b: v2u64) -> v2u64 { - __lsx_vmod_du(a, b) +pub fn lsx_vmod_du(a: v2u64, b: v2u64) -> v2u64 { + unsafe { __lsx_vmod_du(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vreplve_b(a: v16i8, b: i32) -> v16i8 { - __lsx_vreplve_b(a, b) +pub fn lsx_vreplve_b(a: v16i8, b: i32) -> v16i8 { + unsafe { __lsx_vreplve_b(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vreplve_h(a: v8i16, b: i32) -> v8i16 { - __lsx_vreplve_h(a, b) +pub fn lsx_vreplve_h(a: v8i16, b: i32) -> v8i16 { + unsafe { __lsx_vreplve_h(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vreplve_w(a: v4i32, b: i32) -> v4i32 { - __lsx_vreplve_w(a, b) +pub fn lsx_vreplve_w(a: v4i32, b: i32) -> v4i32 { + unsafe { __lsx_vreplve_w(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vreplve_d(a: v2i64, b: i32) -> v2i64 { - __lsx_vreplve_d(a, b) +pub fn lsx_vreplve_d(a: v2i64, b: i32) -> v2i64 { + unsafe { __lsx_vreplve_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vreplvei_b(a: v16i8) -> v16i8 { +pub fn lsx_vreplvei_b(a: v16i8) -> v16i8 { static_assert_uimm_bits!(IMM4, 4); - __lsx_vreplvei_b(a, IMM4) + unsafe { __lsx_vreplvei_b(a, IMM4) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vreplvei_h(a: v8i16) -> v8i16 { +pub fn lsx_vreplvei_h(a: v8i16) -> v8i16 { static_assert_uimm_bits!(IMM3, 3); - __lsx_vreplvei_h(a, IMM3) + unsafe { __lsx_vreplvei_h(a, IMM3) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vreplvei_w(a: v4i32) -> v4i32 { +pub fn lsx_vreplvei_w(a: v4i32) -> v4i32 { static_assert_uimm_bits!(IMM2, 2); - __lsx_vreplvei_w(a, IMM2) + unsafe { __lsx_vreplvei_w(a, IMM2) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vreplvei_d(a: v2i64) -> v2i64 { +pub fn lsx_vreplvei_d(a: v2i64) -> v2i64 { static_assert_uimm_bits!(IMM1, 1); - __lsx_vreplvei_d(a, IMM1) + unsafe { __lsx_vreplvei_d(a, IMM1) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vpickev_b(a: v16i8, b: v16i8) -> v16i8 { - __lsx_vpickev_b(a, b) +pub fn lsx_vpickev_b(a: v16i8, b: v16i8) -> v16i8 { + unsafe { __lsx_vpickev_b(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vpickev_h(a: v8i16, b: v8i16) -> v8i16 { - __lsx_vpickev_h(a, b) +pub fn lsx_vpickev_h(a: v8i16, b: v8i16) -> v8i16 { + unsafe { __lsx_vpickev_h(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vpickev_w(a: v4i32, b: v4i32) -> v4i32 { - __lsx_vpickev_w(a, b) +pub fn lsx_vpickev_w(a: v4i32, b: v4i32) -> v4i32 { + unsafe { __lsx_vpickev_w(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vpickev_d(a: v2i64, b: v2i64) -> v2i64 { - __lsx_vpickev_d(a, b) +pub fn lsx_vpickev_d(a: v2i64, b: v2i64) -> v2i64 { + unsafe { __lsx_vpickev_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vpickod_b(a: v16i8, b: v16i8) -> v16i8 { - __lsx_vpickod_b(a, b) +pub fn lsx_vpickod_b(a: v16i8, b: v16i8) -> v16i8 { + unsafe { __lsx_vpickod_b(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vpickod_h(a: v8i16, b: v8i16) -> v8i16 { - __lsx_vpickod_h(a, b) +pub fn lsx_vpickod_h(a: v8i16, b: v8i16) -> v8i16 { + unsafe { __lsx_vpickod_h(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vpickod_w(a: v4i32, b: v4i32) -> v4i32 { - __lsx_vpickod_w(a, b) +pub fn lsx_vpickod_w(a: v4i32, b: v4i32) -> v4i32 { + unsafe { __lsx_vpickod_w(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vpickod_d(a: v2i64, b: v2i64) -> v2i64 { - __lsx_vpickod_d(a, b) +pub fn lsx_vpickod_d(a: v2i64, b: v2i64) -> v2i64 { + unsafe { __lsx_vpickod_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vilvh_b(a: v16i8, b: v16i8) -> v16i8 { - __lsx_vilvh_b(a, b) +pub fn lsx_vilvh_b(a: v16i8, b: v16i8) -> v16i8 { + unsafe { __lsx_vilvh_b(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vilvh_h(a: v8i16, b: v8i16) -> v8i16 { - __lsx_vilvh_h(a, b) +pub fn lsx_vilvh_h(a: v8i16, b: v8i16) -> v8i16 { + unsafe { __lsx_vilvh_h(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vilvh_w(a: v4i32, b: v4i32) -> v4i32 { - __lsx_vilvh_w(a, b) +pub fn lsx_vilvh_w(a: v4i32, b: v4i32) -> v4i32 { + unsafe { __lsx_vilvh_w(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vilvh_d(a: v2i64, b: v2i64) -> v2i64 { - __lsx_vilvh_d(a, b) +pub fn lsx_vilvh_d(a: v2i64, b: v2i64) -> v2i64 { + unsafe { __lsx_vilvh_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vilvl_b(a: v16i8, b: v16i8) -> v16i8 { - __lsx_vilvl_b(a, b) +pub fn lsx_vilvl_b(a: v16i8, b: v16i8) -> v16i8 { + unsafe { __lsx_vilvl_b(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vilvl_h(a: v8i16, b: v8i16) -> v8i16 { - __lsx_vilvl_h(a, b) +pub fn lsx_vilvl_h(a: v8i16, b: v8i16) -> v8i16 { + unsafe { __lsx_vilvl_h(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vilvl_w(a: v4i32, b: v4i32) -> v4i32 { - __lsx_vilvl_w(a, b) +pub fn lsx_vilvl_w(a: v4i32, b: v4i32) -> v4i32 { + unsafe { __lsx_vilvl_w(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vilvl_d(a: v2i64, b: v2i64) -> v2i64 { - __lsx_vilvl_d(a, b) +pub fn lsx_vilvl_d(a: v2i64, b: v2i64) -> v2i64 { + unsafe { __lsx_vilvl_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vpackev_b(a: v16i8, b: v16i8) -> v16i8 { - __lsx_vpackev_b(a, b) +pub fn lsx_vpackev_b(a: v16i8, b: v16i8) -> v16i8 { + unsafe { __lsx_vpackev_b(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vpackev_h(a: v8i16, b: v8i16) -> v8i16 { - __lsx_vpackev_h(a, b) +pub fn lsx_vpackev_h(a: v8i16, b: v8i16) -> v8i16 { + unsafe { __lsx_vpackev_h(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vpackev_w(a: v4i32, b: v4i32) -> v4i32 { - __lsx_vpackev_w(a, b) +pub fn lsx_vpackev_w(a: v4i32, b: v4i32) -> v4i32 { + unsafe { __lsx_vpackev_w(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vpackev_d(a: v2i64, b: v2i64) -> v2i64 { - __lsx_vpackev_d(a, b) +pub fn lsx_vpackev_d(a: v2i64, b: v2i64) -> v2i64 { + unsafe { __lsx_vpackev_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vpackod_b(a: v16i8, b: v16i8) -> v16i8 { - __lsx_vpackod_b(a, b) +pub fn lsx_vpackod_b(a: v16i8, b: v16i8) -> v16i8 { + unsafe { __lsx_vpackod_b(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vpackod_h(a: v8i16, b: v8i16) -> v8i16 { - __lsx_vpackod_h(a, b) +pub fn lsx_vpackod_h(a: v8i16, b: v8i16) -> v8i16 { + unsafe { __lsx_vpackod_h(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vpackod_w(a: v4i32, b: v4i32) -> v4i32 { - __lsx_vpackod_w(a, b) +pub fn lsx_vpackod_w(a: v4i32, b: v4i32) -> v4i32 { + unsafe { __lsx_vpackod_w(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vpackod_d(a: v2i64, b: v2i64) -> v2i64 { - __lsx_vpackod_d(a, b) +pub fn lsx_vpackod_d(a: v2i64, b: v2i64) -> v2i64 { + unsafe { __lsx_vpackod_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vshuf_h(a: v8i16, b: v8i16, c: v8i16) -> v8i16 { - __lsx_vshuf_h(a, b, c) +pub fn lsx_vshuf_h(a: v8i16, b: v8i16, c: v8i16) -> v8i16 { + unsafe { __lsx_vshuf_h(a, b, c) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vshuf_w(a: v4i32, b: v4i32, c: v4i32) -> v4i32 { - __lsx_vshuf_w(a, b, c) +pub fn lsx_vshuf_w(a: v4i32, b: v4i32, c: v4i32) -> v4i32 { + unsafe { __lsx_vshuf_w(a, b, c) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vshuf_d(a: v2i64, b: v2i64, c: v2i64) -> v2i64 { - __lsx_vshuf_d(a, b, c) +pub fn lsx_vshuf_d(a: v2i64, b: v2i64, c: v2i64) -> v2i64 { + unsafe { __lsx_vshuf_d(a, b, c) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vand_v(a: v16u8, b: v16u8) -> v16u8 { - __lsx_vand_v(a, b) +pub fn lsx_vand_v(a: v16u8, b: v16u8) -> v16u8 { + unsafe { __lsx_vand_v(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vandi_b(a: v16u8) -> v16u8 { +pub fn lsx_vandi_b(a: v16u8) -> v16u8 { static_assert_uimm_bits!(IMM8, 8); - __lsx_vandi_b(a, IMM8) + unsafe { __lsx_vandi_b(a, IMM8) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vor_v(a: v16u8, b: v16u8) -> v16u8 { - __lsx_vor_v(a, b) +pub fn lsx_vor_v(a: v16u8, b: v16u8) -> v16u8 { + unsafe { __lsx_vor_v(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vori_b(a: v16u8) -> v16u8 { +pub fn lsx_vori_b(a: v16u8) -> v16u8 { static_assert_uimm_bits!(IMM8, 8); - __lsx_vori_b(a, IMM8) + unsafe { __lsx_vori_b(a, IMM8) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vnor_v(a: v16u8, b: v16u8) -> v16u8 { - __lsx_vnor_v(a, b) +pub fn lsx_vnor_v(a: v16u8, b: v16u8) -> v16u8 { + unsafe { __lsx_vnor_v(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vnori_b(a: v16u8) -> v16u8 { +pub fn lsx_vnori_b(a: v16u8) -> v16u8 { static_assert_uimm_bits!(IMM8, 8); - __lsx_vnori_b(a, IMM8) + unsafe { __lsx_vnori_b(a, IMM8) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vxor_v(a: v16u8, b: v16u8) -> v16u8 { - __lsx_vxor_v(a, b) +pub fn lsx_vxor_v(a: v16u8, b: v16u8) -> v16u8 { + unsafe { __lsx_vxor_v(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vxori_b(a: v16u8) -> v16u8 { +pub fn lsx_vxori_b(a: v16u8) -> v16u8 { static_assert_uimm_bits!(IMM8, 8); - __lsx_vxori_b(a, IMM8) + unsafe { __lsx_vxori_b(a, IMM8) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vbitsel_v(a: v16u8, b: v16u8, c: v16u8) -> v16u8 { - __lsx_vbitsel_v(a, b, c) +pub fn lsx_vbitsel_v(a: v16u8, b: v16u8, c: v16u8) -> v16u8 { + unsafe { __lsx_vbitsel_v(a, b, c) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vbitseli_b(a: v16u8, b: v16u8) -> v16u8 { +pub fn lsx_vbitseli_b(a: v16u8, b: v16u8) -> v16u8 { static_assert_uimm_bits!(IMM8, 8); - __lsx_vbitseli_b(a, b, IMM8) + unsafe { __lsx_vbitseli_b(a, b, IMM8) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vshuf4i_b(a: v16i8) -> v16i8 { +pub fn lsx_vshuf4i_b(a: v16i8) -> v16i8 { static_assert_uimm_bits!(IMM8, 8); - __lsx_vshuf4i_b(a, IMM8) + unsafe { __lsx_vshuf4i_b(a, IMM8) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vshuf4i_h(a: v8i16) -> v8i16 { +pub fn lsx_vshuf4i_h(a: v8i16) -> v8i16 { static_assert_uimm_bits!(IMM8, 8); - __lsx_vshuf4i_h(a, IMM8) + unsafe { __lsx_vshuf4i_h(a, IMM8) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vshuf4i_w(a: v4i32) -> v4i32 { +pub fn lsx_vshuf4i_w(a: v4i32) -> v4i32 { static_assert_uimm_bits!(IMM8, 8); - __lsx_vshuf4i_w(a, IMM8) + unsafe { __lsx_vshuf4i_w(a, IMM8) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vreplgr2vr_b(a: i32) -> v16i8 { - __lsx_vreplgr2vr_b(a) +pub fn lsx_vreplgr2vr_b(a: i32) -> v16i8 { + unsafe { __lsx_vreplgr2vr_b(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vreplgr2vr_h(a: i32) -> v8i16 { - __lsx_vreplgr2vr_h(a) +pub fn lsx_vreplgr2vr_h(a: i32) -> v8i16 { + unsafe { __lsx_vreplgr2vr_h(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vreplgr2vr_w(a: i32) -> v4i32 { - __lsx_vreplgr2vr_w(a) +pub fn lsx_vreplgr2vr_w(a: i32) -> v4i32 { + unsafe { __lsx_vreplgr2vr_w(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vreplgr2vr_d(a: i64) -> v2i64 { - __lsx_vreplgr2vr_d(a) +pub fn lsx_vreplgr2vr_d(a: i64) -> v2i64 { + unsafe { __lsx_vreplgr2vr_d(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vpcnt_b(a: v16i8) -> v16i8 { - __lsx_vpcnt_b(a) +pub fn lsx_vpcnt_b(a: v16i8) -> v16i8 { + unsafe { __lsx_vpcnt_b(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vpcnt_h(a: v8i16) -> v8i16 { - __lsx_vpcnt_h(a) +pub fn lsx_vpcnt_h(a: v8i16) -> v8i16 { + unsafe { __lsx_vpcnt_h(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vpcnt_w(a: v4i32) -> v4i32 { - __lsx_vpcnt_w(a) +pub fn lsx_vpcnt_w(a: v4i32) -> v4i32 { + unsafe { __lsx_vpcnt_w(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vpcnt_d(a: v2i64) -> v2i64 { - __lsx_vpcnt_d(a) +pub fn lsx_vpcnt_d(a: v2i64) -> v2i64 { + unsafe { __lsx_vpcnt_d(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vclo_b(a: v16i8) -> v16i8 { - __lsx_vclo_b(a) +pub fn lsx_vclo_b(a: v16i8) -> v16i8 { + unsafe { __lsx_vclo_b(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vclo_h(a: v8i16) -> v8i16 { - __lsx_vclo_h(a) +pub fn lsx_vclo_h(a: v8i16) -> v8i16 { + unsafe { __lsx_vclo_h(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vclo_w(a: v4i32) -> v4i32 { - __lsx_vclo_w(a) +pub fn lsx_vclo_w(a: v4i32) -> v4i32 { + unsafe { __lsx_vclo_w(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vclo_d(a: v2i64) -> v2i64 { - __lsx_vclo_d(a) +pub fn lsx_vclo_d(a: v2i64) -> v2i64 { + unsafe { __lsx_vclo_d(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vclz_b(a: v16i8) -> v16i8 { - __lsx_vclz_b(a) +pub fn lsx_vclz_b(a: v16i8) -> v16i8 { + unsafe { __lsx_vclz_b(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vclz_h(a: v8i16) -> v8i16 { - __lsx_vclz_h(a) +pub fn lsx_vclz_h(a: v8i16) -> v8i16 { + unsafe { __lsx_vclz_h(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vclz_w(a: v4i32) -> v4i32 { - __lsx_vclz_w(a) +pub fn lsx_vclz_w(a: v4i32) -> v4i32 { + unsafe { __lsx_vclz_w(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vclz_d(a: v2i64) -> v2i64 { - __lsx_vclz_d(a) +pub fn lsx_vclz_d(a: v2i64) -> v2i64 { + unsafe { __lsx_vclz_d(a) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vpickve2gr_b(a: v16i8) -> i32 { +pub fn lsx_vpickve2gr_b(a: v16i8) -> i32 { static_assert_uimm_bits!(IMM4, 4); - __lsx_vpickve2gr_b(a, IMM4) + unsafe { __lsx_vpickve2gr_b(a, IMM4) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vpickve2gr_h(a: v8i16) -> i32 { +pub fn lsx_vpickve2gr_h(a: v8i16) -> i32 { static_assert_uimm_bits!(IMM3, 3); - __lsx_vpickve2gr_h(a, IMM3) + unsafe { __lsx_vpickve2gr_h(a, IMM3) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vpickve2gr_w(a: v4i32) -> i32 { +pub fn lsx_vpickve2gr_w(a: v4i32) -> i32 { static_assert_uimm_bits!(IMM2, 2); - __lsx_vpickve2gr_w(a, IMM2) + unsafe { __lsx_vpickve2gr_w(a, IMM2) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vpickve2gr_d(a: v2i64) -> i64 { +pub fn lsx_vpickve2gr_d(a: v2i64) -> i64 { static_assert_uimm_bits!(IMM1, 1); - __lsx_vpickve2gr_d(a, IMM1) + unsafe { __lsx_vpickve2gr_d(a, IMM1) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vpickve2gr_bu(a: v16i8) -> u32 { +pub fn lsx_vpickve2gr_bu(a: v16i8) -> u32 { static_assert_uimm_bits!(IMM4, 4); - __lsx_vpickve2gr_bu(a, IMM4) + unsafe { __lsx_vpickve2gr_bu(a, IMM4) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vpickve2gr_hu(a: v8i16) -> u32 { +pub fn lsx_vpickve2gr_hu(a: v8i16) -> u32 { static_assert_uimm_bits!(IMM3, 3); - __lsx_vpickve2gr_hu(a, IMM3) + unsafe { __lsx_vpickve2gr_hu(a, IMM3) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vpickve2gr_wu(a: v4i32) -> u32 { +pub fn lsx_vpickve2gr_wu(a: v4i32) -> u32 { static_assert_uimm_bits!(IMM2, 2); - __lsx_vpickve2gr_wu(a, IMM2) + unsafe { __lsx_vpickve2gr_wu(a, IMM2) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vpickve2gr_du(a: v2i64) -> u64 { +pub fn lsx_vpickve2gr_du(a: v2i64) -> u64 { static_assert_uimm_bits!(IMM1, 1); - __lsx_vpickve2gr_du(a, IMM1) + unsafe { __lsx_vpickve2gr_du(a, IMM1) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vinsgr2vr_b(a: v16i8, b: i32) -> v16i8 { +pub fn lsx_vinsgr2vr_b(a: v16i8, b: i32) -> v16i8 { static_assert_uimm_bits!(IMM4, 4); - __lsx_vinsgr2vr_b(a, b, IMM4) + unsafe { __lsx_vinsgr2vr_b(a, b, IMM4) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vinsgr2vr_h(a: v8i16, b: i32) -> v8i16 { +pub fn lsx_vinsgr2vr_h(a: v8i16, b: i32) -> v8i16 { static_assert_uimm_bits!(IMM3, 3); - __lsx_vinsgr2vr_h(a, b, IMM3) + unsafe { __lsx_vinsgr2vr_h(a, b, IMM3) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vinsgr2vr_w(a: v4i32, b: i32) -> v4i32 { +pub fn lsx_vinsgr2vr_w(a: v4i32, b: i32) -> v4i32 { static_assert_uimm_bits!(IMM2, 2); - __lsx_vinsgr2vr_w(a, b, IMM2) + unsafe { __lsx_vinsgr2vr_w(a, b, IMM2) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vinsgr2vr_d(a: v2i64, b: i64) -> v2i64 { +pub fn lsx_vinsgr2vr_d(a: v2i64, b: i64) -> v2i64 { static_assert_uimm_bits!(IMM1, 1); - __lsx_vinsgr2vr_d(a, b, IMM1) + unsafe { __lsx_vinsgr2vr_d(a, b, IMM1) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfadd_s(a: v4f32, b: v4f32) -> v4f32 { - __lsx_vfadd_s(a, b) +pub fn lsx_vfadd_s(a: v4f32, b: v4f32) -> v4f32 { + unsafe { __lsx_vfadd_s(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfadd_d(a: v2f64, b: v2f64) -> v2f64 { - __lsx_vfadd_d(a, b) +pub fn lsx_vfadd_d(a: v2f64, b: v2f64) -> v2f64 { + unsafe { __lsx_vfadd_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfsub_s(a: v4f32, b: v4f32) -> v4f32 { - __lsx_vfsub_s(a, b) +pub fn lsx_vfsub_s(a: v4f32, b: v4f32) -> v4f32 { + unsafe { __lsx_vfsub_s(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfsub_d(a: v2f64, b: v2f64) -> v2f64 { - __lsx_vfsub_d(a, b) +pub fn lsx_vfsub_d(a: v2f64, b: v2f64) -> v2f64 { + unsafe { __lsx_vfsub_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfmul_s(a: v4f32, b: v4f32) -> v4f32 { - __lsx_vfmul_s(a, b) +pub fn lsx_vfmul_s(a: v4f32, b: v4f32) -> v4f32 { + unsafe { __lsx_vfmul_s(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfmul_d(a: v2f64, b: v2f64) -> v2f64 { - __lsx_vfmul_d(a, b) +pub fn lsx_vfmul_d(a: v2f64, b: v2f64) -> v2f64 { + unsafe { __lsx_vfmul_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfdiv_s(a: v4f32, b: v4f32) -> v4f32 { - __lsx_vfdiv_s(a, b) +pub fn lsx_vfdiv_s(a: v4f32, b: v4f32) -> v4f32 { + unsafe { __lsx_vfdiv_s(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfdiv_d(a: v2f64, b: v2f64) -> v2f64 { - __lsx_vfdiv_d(a, b) +pub fn lsx_vfdiv_d(a: v2f64, b: v2f64) -> v2f64 { + unsafe { __lsx_vfdiv_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfcvt_h_s(a: v4f32, b: v4f32) -> v8i16 { - __lsx_vfcvt_h_s(a, b) +pub fn lsx_vfcvt_h_s(a: v4f32, b: v4f32) -> v8i16 { + unsafe { __lsx_vfcvt_h_s(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfcvt_s_d(a: v2f64, b: v2f64) -> v4f32 { - __lsx_vfcvt_s_d(a, b) +pub fn lsx_vfcvt_s_d(a: v2f64, b: v2f64) -> v4f32 { + unsafe { __lsx_vfcvt_s_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfmin_s(a: v4f32, b: v4f32) -> v4f32 { - __lsx_vfmin_s(a, b) +pub fn lsx_vfmin_s(a: v4f32, b: v4f32) -> v4f32 { + unsafe { __lsx_vfmin_s(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfmin_d(a: v2f64, b: v2f64) -> v2f64 { - __lsx_vfmin_d(a, b) +pub fn lsx_vfmin_d(a: v2f64, b: v2f64) -> v2f64 { + unsafe { __lsx_vfmin_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfmina_s(a: v4f32, b: v4f32) -> v4f32 { - __lsx_vfmina_s(a, b) +pub fn lsx_vfmina_s(a: v4f32, b: v4f32) -> v4f32 { + unsafe { __lsx_vfmina_s(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfmina_d(a: v2f64, b: v2f64) -> v2f64 { - __lsx_vfmina_d(a, b) +pub fn lsx_vfmina_d(a: v2f64, b: v2f64) -> v2f64 { + unsafe { __lsx_vfmina_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfmax_s(a: v4f32, b: v4f32) -> v4f32 { - __lsx_vfmax_s(a, b) +pub fn lsx_vfmax_s(a: v4f32, b: v4f32) -> v4f32 { + unsafe { __lsx_vfmax_s(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfmax_d(a: v2f64, b: v2f64) -> v2f64 { - __lsx_vfmax_d(a, b) +pub fn lsx_vfmax_d(a: v2f64, b: v2f64) -> v2f64 { + unsafe { __lsx_vfmax_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfmaxa_s(a: v4f32, b: v4f32) -> v4f32 { - __lsx_vfmaxa_s(a, b) +pub fn lsx_vfmaxa_s(a: v4f32, b: v4f32) -> v4f32 { + unsafe { __lsx_vfmaxa_s(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfmaxa_d(a: v2f64, b: v2f64) -> v2f64 { - __lsx_vfmaxa_d(a, b) +pub fn lsx_vfmaxa_d(a: v2f64, b: v2f64) -> v2f64 { + unsafe { __lsx_vfmaxa_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfclass_s(a: v4f32) -> v4i32 { - __lsx_vfclass_s(a) +pub fn lsx_vfclass_s(a: v4f32) -> v4i32 { + unsafe { __lsx_vfclass_s(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfclass_d(a: v2f64) -> v2i64 { - __lsx_vfclass_d(a) +pub fn lsx_vfclass_d(a: v2f64) -> v2i64 { + unsafe { __lsx_vfclass_d(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfsqrt_s(a: v4f32) -> v4f32 { - __lsx_vfsqrt_s(a) +pub fn lsx_vfsqrt_s(a: v4f32) -> v4f32 { + unsafe { __lsx_vfsqrt_s(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfsqrt_d(a: v2f64) -> v2f64 { - __lsx_vfsqrt_d(a) +pub fn lsx_vfsqrt_d(a: v2f64) -> v2f64 { + unsafe { __lsx_vfsqrt_d(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfrecip_s(a: v4f32) -> v4f32 { - __lsx_vfrecip_s(a) +pub fn lsx_vfrecip_s(a: v4f32) -> v4f32 { + unsafe { __lsx_vfrecip_s(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfrecip_d(a: v2f64) -> v2f64 { - __lsx_vfrecip_d(a) +pub fn lsx_vfrecip_d(a: v2f64) -> v2f64 { + unsafe { __lsx_vfrecip_d(a) } } #[inline] #[target_feature(enable = "lsx,frecipe")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfrecipe_s(a: v4f32) -> v4f32 { - __lsx_vfrecipe_s(a) +pub fn lsx_vfrecipe_s(a: v4f32) -> v4f32 { + unsafe { __lsx_vfrecipe_s(a) } } #[inline] #[target_feature(enable = "lsx,frecipe")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfrecipe_d(a: v2f64) -> v2f64 { - __lsx_vfrecipe_d(a) +pub fn lsx_vfrecipe_d(a: v2f64) -> v2f64 { + unsafe { __lsx_vfrecipe_d(a) } } #[inline] #[target_feature(enable = "lsx,frecipe")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfrsqrte_s(a: v4f32) -> v4f32 { - __lsx_vfrsqrte_s(a) +pub fn lsx_vfrsqrte_s(a: v4f32) -> v4f32 { + unsafe { __lsx_vfrsqrte_s(a) } } #[inline] #[target_feature(enable = "lsx,frecipe")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfrsqrte_d(a: v2f64) -> v2f64 { - __lsx_vfrsqrte_d(a) +pub fn lsx_vfrsqrte_d(a: v2f64) -> v2f64 { + unsafe { __lsx_vfrsqrte_d(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfrint_s(a: v4f32) -> v4f32 { - __lsx_vfrint_s(a) +pub fn lsx_vfrint_s(a: v4f32) -> v4f32 { + unsafe { __lsx_vfrint_s(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfrint_d(a: v2f64) -> v2f64 { - __lsx_vfrint_d(a) +pub fn lsx_vfrint_d(a: v2f64) -> v2f64 { + unsafe { __lsx_vfrint_d(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfrsqrt_s(a: v4f32) -> v4f32 { - __lsx_vfrsqrt_s(a) +pub fn lsx_vfrsqrt_s(a: v4f32) -> v4f32 { + unsafe { __lsx_vfrsqrt_s(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfrsqrt_d(a: v2f64) -> v2f64 { - __lsx_vfrsqrt_d(a) +pub fn lsx_vfrsqrt_d(a: v2f64) -> v2f64 { + unsafe { __lsx_vfrsqrt_d(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vflogb_s(a: v4f32) -> v4f32 { - __lsx_vflogb_s(a) +pub fn lsx_vflogb_s(a: v4f32) -> v4f32 { + unsafe { __lsx_vflogb_s(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vflogb_d(a: v2f64) -> v2f64 { - __lsx_vflogb_d(a) +pub fn lsx_vflogb_d(a: v2f64) -> v2f64 { + unsafe { __lsx_vflogb_d(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfcvth_s_h(a: v8i16) -> v4f32 { - __lsx_vfcvth_s_h(a) +pub fn lsx_vfcvth_s_h(a: v8i16) -> v4f32 { + unsafe { __lsx_vfcvth_s_h(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfcvth_d_s(a: v4f32) -> v2f64 { - __lsx_vfcvth_d_s(a) +pub fn lsx_vfcvth_d_s(a: v4f32) -> v2f64 { + unsafe { __lsx_vfcvth_d_s(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfcvtl_s_h(a: v8i16) -> v4f32 { - __lsx_vfcvtl_s_h(a) +pub fn lsx_vfcvtl_s_h(a: v8i16) -> v4f32 { + unsafe { __lsx_vfcvtl_s_h(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfcvtl_d_s(a: v4f32) -> v2f64 { - __lsx_vfcvtl_d_s(a) +pub fn lsx_vfcvtl_d_s(a: v4f32) -> v2f64 { + unsafe { __lsx_vfcvtl_d_s(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vftint_w_s(a: v4f32) -> v4i32 { - __lsx_vftint_w_s(a) +pub fn lsx_vftint_w_s(a: v4f32) -> v4i32 { + unsafe { __lsx_vftint_w_s(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vftint_l_d(a: v2f64) -> v2i64 { - __lsx_vftint_l_d(a) +pub fn lsx_vftint_l_d(a: v2f64) -> v2i64 { + unsafe { __lsx_vftint_l_d(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vftint_wu_s(a: v4f32) -> v4u32 { - __lsx_vftint_wu_s(a) +pub fn lsx_vftint_wu_s(a: v4f32) -> v4u32 { + unsafe { __lsx_vftint_wu_s(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vftint_lu_d(a: v2f64) -> v2u64 { - __lsx_vftint_lu_d(a) +pub fn lsx_vftint_lu_d(a: v2f64) -> v2u64 { + unsafe { __lsx_vftint_lu_d(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vftintrz_w_s(a: v4f32) -> v4i32 { - __lsx_vftintrz_w_s(a) +pub fn lsx_vftintrz_w_s(a: v4f32) -> v4i32 { + unsafe { __lsx_vftintrz_w_s(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vftintrz_l_d(a: v2f64) -> v2i64 { - __lsx_vftintrz_l_d(a) +pub fn lsx_vftintrz_l_d(a: v2f64) -> v2i64 { + unsafe { __lsx_vftintrz_l_d(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vftintrz_wu_s(a: v4f32) -> v4u32 { - __lsx_vftintrz_wu_s(a) +pub fn lsx_vftintrz_wu_s(a: v4f32) -> v4u32 { + unsafe { __lsx_vftintrz_wu_s(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vftintrz_lu_d(a: v2f64) -> v2u64 { - __lsx_vftintrz_lu_d(a) +pub fn lsx_vftintrz_lu_d(a: v2f64) -> v2u64 { + unsafe { __lsx_vftintrz_lu_d(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vffint_s_w(a: v4i32) -> v4f32 { - __lsx_vffint_s_w(a) +pub fn lsx_vffint_s_w(a: v4i32) -> v4f32 { + unsafe { __lsx_vffint_s_w(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vffint_d_l(a: v2i64) -> v2f64 { - __lsx_vffint_d_l(a) +pub fn lsx_vffint_d_l(a: v2i64) -> v2f64 { + unsafe { __lsx_vffint_d_l(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vffint_s_wu(a: v4u32) -> v4f32 { - __lsx_vffint_s_wu(a) +pub fn lsx_vffint_s_wu(a: v4u32) -> v4f32 { + unsafe { __lsx_vffint_s_wu(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vffint_d_lu(a: v2u64) -> v2f64 { - __lsx_vffint_d_lu(a) +pub fn lsx_vffint_d_lu(a: v2u64) -> v2f64 { + unsafe { __lsx_vffint_d_lu(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vandn_v(a: v16u8, b: v16u8) -> v16u8 { - __lsx_vandn_v(a, b) +pub fn lsx_vandn_v(a: v16u8, b: v16u8) -> v16u8 { + unsafe { __lsx_vandn_v(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vneg_b(a: v16i8) -> v16i8 { - __lsx_vneg_b(a) +pub fn lsx_vneg_b(a: v16i8) -> v16i8 { + unsafe { __lsx_vneg_b(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vneg_h(a: v8i16) -> v8i16 { - __lsx_vneg_h(a) +pub fn lsx_vneg_h(a: v8i16) -> v8i16 { + unsafe { __lsx_vneg_h(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vneg_w(a: v4i32) -> v4i32 { - __lsx_vneg_w(a) +pub fn lsx_vneg_w(a: v4i32) -> v4i32 { + unsafe { __lsx_vneg_w(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vneg_d(a: v2i64) -> v2i64 { - __lsx_vneg_d(a) +pub fn lsx_vneg_d(a: v2i64) -> v2i64 { + unsafe { __lsx_vneg_d(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmuh_b(a: v16i8, b: v16i8) -> v16i8 { - __lsx_vmuh_b(a, b) +pub fn lsx_vmuh_b(a: v16i8, b: v16i8) -> v16i8 { + unsafe { __lsx_vmuh_b(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmuh_h(a: v8i16, b: v8i16) -> v8i16 { - __lsx_vmuh_h(a, b) +pub fn lsx_vmuh_h(a: v8i16, b: v8i16) -> v8i16 { + unsafe { __lsx_vmuh_h(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmuh_w(a: v4i32, b: v4i32) -> v4i32 { - __lsx_vmuh_w(a, b) +pub fn lsx_vmuh_w(a: v4i32, b: v4i32) -> v4i32 { + unsafe { __lsx_vmuh_w(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmuh_d(a: v2i64, b: v2i64) -> v2i64 { - __lsx_vmuh_d(a, b) +pub fn lsx_vmuh_d(a: v2i64, b: v2i64) -> v2i64 { + unsafe { __lsx_vmuh_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmuh_bu(a: v16u8, b: v16u8) -> v16u8 { - __lsx_vmuh_bu(a, b) +pub fn lsx_vmuh_bu(a: v16u8, b: v16u8) -> v16u8 { + unsafe { __lsx_vmuh_bu(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmuh_hu(a: v8u16, b: v8u16) -> v8u16 { - __lsx_vmuh_hu(a, b) +pub fn lsx_vmuh_hu(a: v8u16, b: v8u16) -> v8u16 { + unsafe { __lsx_vmuh_hu(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmuh_wu(a: v4u32, b: v4u32) -> v4u32 { - __lsx_vmuh_wu(a, b) +pub fn lsx_vmuh_wu(a: v4u32, b: v4u32) -> v4u32 { + unsafe { __lsx_vmuh_wu(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmuh_du(a: v2u64, b: v2u64) -> v2u64 { - __lsx_vmuh_du(a, b) +pub fn lsx_vmuh_du(a: v2u64, b: v2u64) -> v2u64 { + unsafe { __lsx_vmuh_du(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsllwil_h_b(a: v16i8) -> v8i16 { +pub fn lsx_vsllwil_h_b(a: v16i8) -> v8i16 { static_assert_uimm_bits!(IMM3, 3); - __lsx_vsllwil_h_b(a, IMM3) + unsafe { __lsx_vsllwil_h_b(a, IMM3) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsllwil_w_h(a: v8i16) -> v4i32 { +pub fn lsx_vsllwil_w_h(a: v8i16) -> v4i32 { static_assert_uimm_bits!(IMM4, 4); - __lsx_vsllwil_w_h(a, IMM4) + unsafe { __lsx_vsllwil_w_h(a, IMM4) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsllwil_d_w(a: v4i32) -> v2i64 { +pub fn lsx_vsllwil_d_w(a: v4i32) -> v2i64 { static_assert_uimm_bits!(IMM5, 5); - __lsx_vsllwil_d_w(a, IMM5) + unsafe { __lsx_vsllwil_d_w(a, IMM5) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsllwil_hu_bu(a: v16u8) -> v8u16 { +pub fn lsx_vsllwil_hu_bu(a: v16u8) -> v8u16 { static_assert_uimm_bits!(IMM3, 3); - __lsx_vsllwil_hu_bu(a, IMM3) + unsafe { __lsx_vsllwil_hu_bu(a, IMM3) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsllwil_wu_hu(a: v8u16) -> v4u32 { +pub fn lsx_vsllwil_wu_hu(a: v8u16) -> v4u32 { static_assert_uimm_bits!(IMM4, 4); - __lsx_vsllwil_wu_hu(a, IMM4) + unsafe { __lsx_vsllwil_wu_hu(a, IMM4) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsllwil_du_wu(a: v4u32) -> v2u64 { +pub fn lsx_vsllwil_du_wu(a: v4u32) -> v2u64 { static_assert_uimm_bits!(IMM5, 5); - __lsx_vsllwil_du_wu(a, IMM5) + unsafe { __lsx_vsllwil_du_wu(a, IMM5) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsran_b_h(a: v8i16, b: v8i16) -> v16i8 { - __lsx_vsran_b_h(a, b) +pub fn lsx_vsran_b_h(a: v8i16, b: v8i16) -> v16i8 { + unsafe { __lsx_vsran_b_h(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsran_h_w(a: v4i32, b: v4i32) -> v8i16 { - __lsx_vsran_h_w(a, b) +pub fn lsx_vsran_h_w(a: v4i32, b: v4i32) -> v8i16 { + unsafe { __lsx_vsran_h_w(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsran_w_d(a: v2i64, b: v2i64) -> v4i32 { - __lsx_vsran_w_d(a, b) +pub fn lsx_vsran_w_d(a: v2i64, b: v2i64) -> v4i32 { + unsafe { __lsx_vsran_w_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vssran_b_h(a: v8i16, b: v8i16) -> v16i8 { - __lsx_vssran_b_h(a, b) +pub fn lsx_vssran_b_h(a: v8i16, b: v8i16) -> v16i8 { + unsafe { __lsx_vssran_b_h(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vssran_h_w(a: v4i32, b: v4i32) -> v8i16 { - __lsx_vssran_h_w(a, b) +pub fn lsx_vssran_h_w(a: v4i32, b: v4i32) -> v8i16 { + unsafe { __lsx_vssran_h_w(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vssran_w_d(a: v2i64, b: v2i64) -> v4i32 { - __lsx_vssran_w_d(a, b) +pub fn lsx_vssran_w_d(a: v2i64, b: v2i64) -> v4i32 { + unsafe { __lsx_vssran_w_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vssran_bu_h(a: v8u16, b: v8u16) -> v16u8 { - __lsx_vssran_bu_h(a, b) +pub fn lsx_vssran_bu_h(a: v8u16, b: v8u16) -> v16u8 { + unsafe { __lsx_vssran_bu_h(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vssran_hu_w(a: v4u32, b: v4u32) -> v8u16 { - __lsx_vssran_hu_w(a, b) +pub fn lsx_vssran_hu_w(a: v4u32, b: v4u32) -> v8u16 { + unsafe { __lsx_vssran_hu_w(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vssran_wu_d(a: v2u64, b: v2u64) -> v4u32 { - __lsx_vssran_wu_d(a, b) +pub fn lsx_vssran_wu_d(a: v2u64, b: v2u64) -> v4u32 { + unsafe { __lsx_vssran_wu_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsrarn_b_h(a: v8i16, b: v8i16) -> v16i8 { - __lsx_vsrarn_b_h(a, b) +pub fn lsx_vsrarn_b_h(a: v8i16, b: v8i16) -> v16i8 { + unsafe { __lsx_vsrarn_b_h(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsrarn_h_w(a: v4i32, b: v4i32) -> v8i16 { - __lsx_vsrarn_h_w(a, b) +pub fn lsx_vsrarn_h_w(a: v4i32, b: v4i32) -> v8i16 { + unsafe { __lsx_vsrarn_h_w(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsrarn_w_d(a: v2i64, b: v2i64) -> v4i32 { - __lsx_vsrarn_w_d(a, b) +pub fn lsx_vsrarn_w_d(a: v2i64, b: v2i64) -> v4i32 { + unsafe { __lsx_vsrarn_w_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vssrarn_b_h(a: v8i16, b: v8i16) -> v16i8 { - __lsx_vssrarn_b_h(a, b) +pub fn lsx_vssrarn_b_h(a: v8i16, b: v8i16) -> v16i8 { + unsafe { __lsx_vssrarn_b_h(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vssrarn_h_w(a: v4i32, b: v4i32) -> v8i16 { - __lsx_vssrarn_h_w(a, b) +pub fn lsx_vssrarn_h_w(a: v4i32, b: v4i32) -> v8i16 { + unsafe { __lsx_vssrarn_h_w(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vssrarn_w_d(a: v2i64, b: v2i64) -> v4i32 { - __lsx_vssrarn_w_d(a, b) +pub fn lsx_vssrarn_w_d(a: v2i64, b: v2i64) -> v4i32 { + unsafe { __lsx_vssrarn_w_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vssrarn_bu_h(a: v8u16, b: v8u16) -> v16u8 { - __lsx_vssrarn_bu_h(a, b) +pub fn lsx_vssrarn_bu_h(a: v8u16, b: v8u16) -> v16u8 { + unsafe { __lsx_vssrarn_bu_h(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vssrarn_hu_w(a: v4u32, b: v4u32) -> v8u16 { - __lsx_vssrarn_hu_w(a, b) +pub fn lsx_vssrarn_hu_w(a: v4u32, b: v4u32) -> v8u16 { + unsafe { __lsx_vssrarn_hu_w(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vssrarn_wu_d(a: v2u64, b: v2u64) -> v4u32 { - __lsx_vssrarn_wu_d(a, b) +pub fn lsx_vssrarn_wu_d(a: v2u64, b: v2u64) -> v4u32 { + unsafe { __lsx_vssrarn_wu_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsrln_b_h(a: v8i16, b: v8i16) -> v16i8 { - __lsx_vsrln_b_h(a, b) +pub fn lsx_vsrln_b_h(a: v8i16, b: v8i16) -> v16i8 { + unsafe { __lsx_vsrln_b_h(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsrln_h_w(a: v4i32, b: v4i32) -> v8i16 { - __lsx_vsrln_h_w(a, b) +pub fn lsx_vsrln_h_w(a: v4i32, b: v4i32) -> v8i16 { + unsafe { __lsx_vsrln_h_w(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsrln_w_d(a: v2i64, b: v2i64) -> v4i32 { - __lsx_vsrln_w_d(a, b) +pub fn lsx_vsrln_w_d(a: v2i64, b: v2i64) -> v4i32 { + unsafe { __lsx_vsrln_w_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vssrln_bu_h(a: v8u16, b: v8u16) -> v16u8 { - __lsx_vssrln_bu_h(a, b) +pub fn lsx_vssrln_bu_h(a: v8u16, b: v8u16) -> v16u8 { + unsafe { __lsx_vssrln_bu_h(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vssrln_hu_w(a: v4u32, b: v4u32) -> v8u16 { - __lsx_vssrln_hu_w(a, b) +pub fn lsx_vssrln_hu_w(a: v4u32, b: v4u32) -> v8u16 { + unsafe { __lsx_vssrln_hu_w(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vssrln_wu_d(a: v2u64, b: v2u64) -> v4u32 { - __lsx_vssrln_wu_d(a, b) +pub fn lsx_vssrln_wu_d(a: v2u64, b: v2u64) -> v4u32 { + unsafe { __lsx_vssrln_wu_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsrlrn_b_h(a: v8i16, b: v8i16) -> v16i8 { - __lsx_vsrlrn_b_h(a, b) +pub fn lsx_vsrlrn_b_h(a: v8i16, b: v8i16) -> v16i8 { + unsafe { __lsx_vsrlrn_b_h(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsrlrn_h_w(a: v4i32, b: v4i32) -> v8i16 { - __lsx_vsrlrn_h_w(a, b) +pub fn lsx_vsrlrn_h_w(a: v4i32, b: v4i32) -> v8i16 { + unsafe { __lsx_vsrlrn_h_w(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsrlrn_w_d(a: v2i64, b: v2i64) -> v4i32 { - __lsx_vsrlrn_w_d(a, b) +pub fn lsx_vsrlrn_w_d(a: v2i64, b: v2i64) -> v4i32 { + unsafe { __lsx_vsrlrn_w_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vssrlrn_bu_h(a: v8u16, b: v8u16) -> v16u8 { - __lsx_vssrlrn_bu_h(a, b) +pub fn lsx_vssrlrn_bu_h(a: v8u16, b: v8u16) -> v16u8 { + unsafe { __lsx_vssrlrn_bu_h(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vssrlrn_hu_w(a: v4u32, b: v4u32) -> v8u16 { - __lsx_vssrlrn_hu_w(a, b) +pub fn lsx_vssrlrn_hu_w(a: v4u32, b: v4u32) -> v8u16 { + unsafe { __lsx_vssrlrn_hu_w(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vssrlrn_wu_d(a: v2u64, b: v2u64) -> v4u32 { - __lsx_vssrlrn_wu_d(a, b) +pub fn lsx_vssrlrn_wu_d(a: v2u64, b: v2u64) -> v4u32 { + unsafe { __lsx_vssrlrn_wu_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfrstpi_b(a: v16i8, b: v16i8) -> v16i8 { +pub fn lsx_vfrstpi_b(a: v16i8, b: v16i8) -> v16i8 { static_assert_uimm_bits!(IMM5, 5); - __lsx_vfrstpi_b(a, b, IMM5) + unsafe { __lsx_vfrstpi_b(a, b, IMM5) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfrstpi_h(a: v8i16, b: v8i16) -> v8i16 { +pub fn lsx_vfrstpi_h(a: v8i16, b: v8i16) -> v8i16 { static_assert_uimm_bits!(IMM5, 5); - __lsx_vfrstpi_h(a, b, IMM5) + unsafe { __lsx_vfrstpi_h(a, b, IMM5) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfrstp_b(a: v16i8, b: v16i8, c: v16i8) -> v16i8 { - __lsx_vfrstp_b(a, b, c) +pub fn lsx_vfrstp_b(a: v16i8, b: v16i8, c: v16i8) -> v16i8 { + unsafe { __lsx_vfrstp_b(a, b, c) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfrstp_h(a: v8i16, b: v8i16, c: v8i16) -> v8i16 { - __lsx_vfrstp_h(a, b, c) +pub fn lsx_vfrstp_h(a: v8i16, b: v8i16, c: v8i16) -> v8i16 { + unsafe { __lsx_vfrstp_h(a, b, c) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vshuf4i_d(a: v2i64, b: v2i64) -> v2i64 { +pub fn lsx_vshuf4i_d(a: v2i64, b: v2i64) -> v2i64 { static_assert_uimm_bits!(IMM8, 8); - __lsx_vshuf4i_d(a, b, IMM8) + unsafe { __lsx_vshuf4i_d(a, b, IMM8) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vbsrl_v(a: v16i8) -> v16i8 { +pub fn lsx_vbsrl_v(a: v16i8) -> v16i8 { static_assert_uimm_bits!(IMM5, 5); - __lsx_vbsrl_v(a, IMM5) + unsafe { __lsx_vbsrl_v(a, IMM5) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vbsll_v(a: v16i8) -> v16i8 { +pub fn lsx_vbsll_v(a: v16i8) -> v16i8 { static_assert_uimm_bits!(IMM5, 5); - __lsx_vbsll_v(a, IMM5) + unsafe { __lsx_vbsll_v(a, IMM5) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vextrins_b(a: v16i8, b: v16i8) -> v16i8 { +pub fn lsx_vextrins_b(a: v16i8, b: v16i8) -> v16i8 { static_assert_uimm_bits!(IMM8, 8); - __lsx_vextrins_b(a, b, IMM8) + unsafe { __lsx_vextrins_b(a, b, IMM8) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vextrins_h(a: v8i16, b: v8i16) -> v8i16 { +pub fn lsx_vextrins_h(a: v8i16, b: v8i16) -> v8i16 { static_assert_uimm_bits!(IMM8, 8); - __lsx_vextrins_h(a, b, IMM8) + unsafe { __lsx_vextrins_h(a, b, IMM8) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vextrins_w(a: v4i32, b: v4i32) -> v4i32 { +pub fn lsx_vextrins_w(a: v4i32, b: v4i32) -> v4i32 { static_assert_uimm_bits!(IMM8, 8); - __lsx_vextrins_w(a, b, IMM8) + unsafe { __lsx_vextrins_w(a, b, IMM8) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vextrins_d(a: v2i64, b: v2i64) -> v2i64 { +pub fn lsx_vextrins_d(a: v2i64, b: v2i64) -> v2i64 { static_assert_uimm_bits!(IMM8, 8); - __lsx_vextrins_d(a, b, IMM8) + unsafe { __lsx_vextrins_d(a, b, IMM8) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmskltz_b(a: v16i8) -> v16i8 { - __lsx_vmskltz_b(a) +pub fn lsx_vmskltz_b(a: v16i8) -> v16i8 { + unsafe { __lsx_vmskltz_b(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmskltz_h(a: v8i16) -> v8i16 { - __lsx_vmskltz_h(a) +pub fn lsx_vmskltz_h(a: v8i16) -> v8i16 { + unsafe { __lsx_vmskltz_h(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmskltz_w(a: v4i32) -> v4i32 { - __lsx_vmskltz_w(a) +pub fn lsx_vmskltz_w(a: v4i32) -> v4i32 { + unsafe { __lsx_vmskltz_w(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmskltz_d(a: v2i64) -> v2i64 { - __lsx_vmskltz_d(a) +pub fn lsx_vmskltz_d(a: v2i64) -> v2i64 { + unsafe { __lsx_vmskltz_d(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsigncov_b(a: v16i8, b: v16i8) -> v16i8 { - __lsx_vsigncov_b(a, b) +pub fn lsx_vsigncov_b(a: v16i8, b: v16i8) -> v16i8 { + unsafe { __lsx_vsigncov_b(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsigncov_h(a: v8i16, b: v8i16) -> v8i16 { - __lsx_vsigncov_h(a, b) +pub fn lsx_vsigncov_h(a: v8i16, b: v8i16) -> v8i16 { + unsafe { __lsx_vsigncov_h(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsigncov_w(a: v4i32, b: v4i32) -> v4i32 { - __lsx_vsigncov_w(a, b) +pub fn lsx_vsigncov_w(a: v4i32, b: v4i32) -> v4i32 { + unsafe { __lsx_vsigncov_w(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsigncov_d(a: v2i64, b: v2i64) -> v2i64 { - __lsx_vsigncov_d(a, b) +pub fn lsx_vsigncov_d(a: v2i64, b: v2i64) -> v2i64 { + unsafe { __lsx_vsigncov_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfmadd_s(a: v4f32, b: v4f32, c: v4f32) -> v4f32 { - __lsx_vfmadd_s(a, b, c) +pub fn lsx_vfmadd_s(a: v4f32, b: v4f32, c: v4f32) -> v4f32 { + unsafe { __lsx_vfmadd_s(a, b, c) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfmadd_d(a: v2f64, b: v2f64, c: v2f64) -> v2f64 { - __lsx_vfmadd_d(a, b, c) +pub fn lsx_vfmadd_d(a: v2f64, b: v2f64, c: v2f64) -> v2f64 { + unsafe { __lsx_vfmadd_d(a, b, c) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfmsub_s(a: v4f32, b: v4f32, c: v4f32) -> v4f32 { - __lsx_vfmsub_s(a, b, c) +pub fn lsx_vfmsub_s(a: v4f32, b: v4f32, c: v4f32) -> v4f32 { + unsafe { __lsx_vfmsub_s(a, b, c) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfmsub_d(a: v2f64, b: v2f64, c: v2f64) -> v2f64 { - __lsx_vfmsub_d(a, b, c) +pub fn lsx_vfmsub_d(a: v2f64, b: v2f64, c: v2f64) -> v2f64 { + unsafe { __lsx_vfmsub_d(a, b, c) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfnmadd_s(a: v4f32, b: v4f32, c: v4f32) -> v4f32 { - __lsx_vfnmadd_s(a, b, c) +pub fn lsx_vfnmadd_s(a: v4f32, b: v4f32, c: v4f32) -> v4f32 { + unsafe { __lsx_vfnmadd_s(a, b, c) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfnmadd_d(a: v2f64, b: v2f64, c: v2f64) -> v2f64 { - __lsx_vfnmadd_d(a, b, c) +pub fn lsx_vfnmadd_d(a: v2f64, b: v2f64, c: v2f64) -> v2f64 { + unsafe { __lsx_vfnmadd_d(a, b, c) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfnmsub_s(a: v4f32, b: v4f32, c: v4f32) -> v4f32 { - __lsx_vfnmsub_s(a, b, c) +pub fn lsx_vfnmsub_s(a: v4f32, b: v4f32, c: v4f32) -> v4f32 { + unsafe { __lsx_vfnmsub_s(a, b, c) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfnmsub_d(a: v2f64, b: v2f64, c: v2f64) -> v2f64 { - __lsx_vfnmsub_d(a, b, c) +pub fn lsx_vfnmsub_d(a: v2f64, b: v2f64, c: v2f64) -> v2f64 { + unsafe { __lsx_vfnmsub_d(a, b, c) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vftintrne_w_s(a: v4f32) -> v4i32 { - __lsx_vftintrne_w_s(a) +pub fn lsx_vftintrne_w_s(a: v4f32) -> v4i32 { + unsafe { __lsx_vftintrne_w_s(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vftintrne_l_d(a: v2f64) -> v2i64 { - __lsx_vftintrne_l_d(a) +pub fn lsx_vftintrne_l_d(a: v2f64) -> v2i64 { + unsafe { __lsx_vftintrne_l_d(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vftintrp_w_s(a: v4f32) -> v4i32 { - __lsx_vftintrp_w_s(a) +pub fn lsx_vftintrp_w_s(a: v4f32) -> v4i32 { + unsafe { __lsx_vftintrp_w_s(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vftintrp_l_d(a: v2f64) -> v2i64 { - __lsx_vftintrp_l_d(a) +pub fn lsx_vftintrp_l_d(a: v2f64) -> v2i64 { + unsafe { __lsx_vftintrp_l_d(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vftintrm_w_s(a: v4f32) -> v4i32 { - __lsx_vftintrm_w_s(a) +pub fn lsx_vftintrm_w_s(a: v4f32) -> v4i32 { + unsafe { __lsx_vftintrm_w_s(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vftintrm_l_d(a: v2f64) -> v2i64 { - __lsx_vftintrm_l_d(a) +pub fn lsx_vftintrm_l_d(a: v2f64) -> v2i64 { + unsafe { __lsx_vftintrm_l_d(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vftint_w_d(a: v2f64, b: v2f64) -> v4i32 { - __lsx_vftint_w_d(a, b) +pub fn lsx_vftint_w_d(a: v2f64, b: v2f64) -> v4i32 { + unsafe { __lsx_vftint_w_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vffint_s_l(a: v2i64, b: v2i64) -> v4f32 { - __lsx_vffint_s_l(a, b) +pub fn lsx_vffint_s_l(a: v2i64, b: v2i64) -> v4f32 { + unsafe { __lsx_vffint_s_l(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vftintrz_w_d(a: v2f64, b: v2f64) -> v4i32 { - __lsx_vftintrz_w_d(a, b) +pub fn lsx_vftintrz_w_d(a: v2f64, b: v2f64) -> v4i32 { + unsafe { __lsx_vftintrz_w_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vftintrp_w_d(a: v2f64, b: v2f64) -> v4i32 { - __lsx_vftintrp_w_d(a, b) +pub fn lsx_vftintrp_w_d(a: v2f64, b: v2f64) -> v4i32 { + unsafe { __lsx_vftintrp_w_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vftintrm_w_d(a: v2f64, b: v2f64) -> v4i32 { - __lsx_vftintrm_w_d(a, b) +pub fn lsx_vftintrm_w_d(a: v2f64, b: v2f64) -> v4i32 { + unsafe { __lsx_vftintrm_w_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vftintrne_w_d(a: v2f64, b: v2f64) -> v4i32 { - __lsx_vftintrne_w_d(a, b) +pub fn lsx_vftintrne_w_d(a: v2f64, b: v2f64) -> v4i32 { + unsafe { __lsx_vftintrne_w_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vftintl_l_s(a: v4f32) -> v2i64 { - __lsx_vftintl_l_s(a) +pub fn lsx_vftintl_l_s(a: v4f32) -> v2i64 { + unsafe { __lsx_vftintl_l_s(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vftinth_l_s(a: v4f32) -> v2i64 { - __lsx_vftinth_l_s(a) +pub fn lsx_vftinth_l_s(a: v4f32) -> v2i64 { + unsafe { __lsx_vftinth_l_s(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vffinth_d_w(a: v4i32) -> v2f64 { - __lsx_vffinth_d_w(a) +pub fn lsx_vffinth_d_w(a: v4i32) -> v2f64 { + unsafe { __lsx_vffinth_d_w(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vffintl_d_w(a: v4i32) -> v2f64 { - __lsx_vffintl_d_w(a) +pub fn lsx_vffintl_d_w(a: v4i32) -> v2f64 { + unsafe { __lsx_vffintl_d_w(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vftintrzl_l_s(a: v4f32) -> v2i64 { - __lsx_vftintrzl_l_s(a) +pub fn lsx_vftintrzl_l_s(a: v4f32) -> v2i64 { + unsafe { __lsx_vftintrzl_l_s(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vftintrzh_l_s(a: v4f32) -> v2i64 { - __lsx_vftintrzh_l_s(a) +pub fn lsx_vftintrzh_l_s(a: v4f32) -> v2i64 { + unsafe { __lsx_vftintrzh_l_s(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vftintrpl_l_s(a: v4f32) -> v2i64 { - __lsx_vftintrpl_l_s(a) +pub fn lsx_vftintrpl_l_s(a: v4f32) -> v2i64 { + unsafe { __lsx_vftintrpl_l_s(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vftintrph_l_s(a: v4f32) -> v2i64 { - __lsx_vftintrph_l_s(a) +pub fn lsx_vftintrph_l_s(a: v4f32) -> v2i64 { + unsafe { __lsx_vftintrph_l_s(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vftintrml_l_s(a: v4f32) -> v2i64 { - __lsx_vftintrml_l_s(a) +pub fn lsx_vftintrml_l_s(a: v4f32) -> v2i64 { + unsafe { __lsx_vftintrml_l_s(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vftintrmh_l_s(a: v4f32) -> v2i64 { - __lsx_vftintrmh_l_s(a) +pub fn lsx_vftintrmh_l_s(a: v4f32) -> v2i64 { + unsafe { __lsx_vftintrmh_l_s(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vftintrnel_l_s(a: v4f32) -> v2i64 { - __lsx_vftintrnel_l_s(a) +pub fn lsx_vftintrnel_l_s(a: v4f32) -> v2i64 { + unsafe { __lsx_vftintrnel_l_s(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vftintrneh_l_s(a: v4f32) -> v2i64 { - __lsx_vftintrneh_l_s(a) +pub fn lsx_vftintrneh_l_s(a: v4f32) -> v2i64 { + unsafe { __lsx_vftintrneh_l_s(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfrintrne_s(a: v4f32) -> v4f32 { - __lsx_vfrintrne_s(a) +pub fn lsx_vfrintrne_s(a: v4f32) -> v4f32 { + unsafe { __lsx_vfrintrne_s(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfrintrne_d(a: v2f64) -> v2f64 { - __lsx_vfrintrne_d(a) +pub fn lsx_vfrintrne_d(a: v2f64) -> v2f64 { + unsafe { __lsx_vfrintrne_d(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfrintrz_s(a: v4f32) -> v4f32 { - __lsx_vfrintrz_s(a) +pub fn lsx_vfrintrz_s(a: v4f32) -> v4f32 { + unsafe { __lsx_vfrintrz_s(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfrintrz_d(a: v2f64) -> v2f64 { - __lsx_vfrintrz_d(a) +pub fn lsx_vfrintrz_d(a: v2f64) -> v2f64 { + unsafe { __lsx_vfrintrz_d(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfrintrp_s(a: v4f32) -> v4f32 { - __lsx_vfrintrp_s(a) +pub fn lsx_vfrintrp_s(a: v4f32) -> v4f32 { + unsafe { __lsx_vfrintrp_s(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfrintrp_d(a: v2f64) -> v2f64 { - __lsx_vfrintrp_d(a) +pub fn lsx_vfrintrp_d(a: v2f64) -> v2f64 { + unsafe { __lsx_vfrintrp_d(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfrintrm_s(a: v4f32) -> v4f32 { - __lsx_vfrintrm_s(a) +pub fn lsx_vfrintrm_s(a: v4f32) -> v4f32 { + unsafe { __lsx_vfrintrm_s(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfrintrm_d(a: v2f64) -> v2f64 { - __lsx_vfrintrm_d(a) +pub fn lsx_vfrintrm_d(a: v2f64) -> v2f64 { + unsafe { __lsx_vfrintrm_d(a) } } #[inline] @@ -5087,687 +5087,687 @@ pub unsafe fn lsx_vstelm_d(a: v2i64, mem_add #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vaddwev_d_w(a: v4i32, b: v4i32) -> v2i64 { - __lsx_vaddwev_d_w(a, b) +pub fn lsx_vaddwev_d_w(a: v4i32, b: v4i32) -> v2i64 { + unsafe { __lsx_vaddwev_d_w(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vaddwev_w_h(a: v8i16, b: v8i16) -> v4i32 { - __lsx_vaddwev_w_h(a, b) +pub fn lsx_vaddwev_w_h(a: v8i16, b: v8i16) -> v4i32 { + unsafe { __lsx_vaddwev_w_h(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vaddwev_h_b(a: v16i8, b: v16i8) -> v8i16 { - __lsx_vaddwev_h_b(a, b) +pub fn lsx_vaddwev_h_b(a: v16i8, b: v16i8) -> v8i16 { + unsafe { __lsx_vaddwev_h_b(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vaddwod_d_w(a: v4i32, b: v4i32) -> v2i64 { - __lsx_vaddwod_d_w(a, b) +pub fn lsx_vaddwod_d_w(a: v4i32, b: v4i32) -> v2i64 { + unsafe { __lsx_vaddwod_d_w(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vaddwod_w_h(a: v8i16, b: v8i16) -> v4i32 { - __lsx_vaddwod_w_h(a, b) +pub fn lsx_vaddwod_w_h(a: v8i16, b: v8i16) -> v4i32 { + unsafe { __lsx_vaddwod_w_h(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vaddwod_h_b(a: v16i8, b: v16i8) -> v8i16 { - __lsx_vaddwod_h_b(a, b) +pub fn lsx_vaddwod_h_b(a: v16i8, b: v16i8) -> v8i16 { + unsafe { __lsx_vaddwod_h_b(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vaddwev_d_wu(a: v4u32, b: v4u32) -> v2i64 { - __lsx_vaddwev_d_wu(a, b) +pub fn lsx_vaddwev_d_wu(a: v4u32, b: v4u32) -> v2i64 { + unsafe { __lsx_vaddwev_d_wu(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vaddwev_w_hu(a: v8u16, b: v8u16) -> v4i32 { - __lsx_vaddwev_w_hu(a, b) +pub fn lsx_vaddwev_w_hu(a: v8u16, b: v8u16) -> v4i32 { + unsafe { __lsx_vaddwev_w_hu(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vaddwev_h_bu(a: v16u8, b: v16u8) -> v8i16 { - __lsx_vaddwev_h_bu(a, b) +pub fn lsx_vaddwev_h_bu(a: v16u8, b: v16u8) -> v8i16 { + unsafe { __lsx_vaddwev_h_bu(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vaddwod_d_wu(a: v4u32, b: v4u32) -> v2i64 { - __lsx_vaddwod_d_wu(a, b) +pub fn lsx_vaddwod_d_wu(a: v4u32, b: v4u32) -> v2i64 { + unsafe { __lsx_vaddwod_d_wu(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vaddwod_w_hu(a: v8u16, b: v8u16) -> v4i32 { - __lsx_vaddwod_w_hu(a, b) +pub fn lsx_vaddwod_w_hu(a: v8u16, b: v8u16) -> v4i32 { + unsafe { __lsx_vaddwod_w_hu(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vaddwod_h_bu(a: v16u8, b: v16u8) -> v8i16 { - __lsx_vaddwod_h_bu(a, b) +pub fn lsx_vaddwod_h_bu(a: v16u8, b: v16u8) -> v8i16 { + unsafe { __lsx_vaddwod_h_bu(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vaddwev_d_wu_w(a: v4u32, b: v4i32) -> v2i64 { - __lsx_vaddwev_d_wu_w(a, b) +pub fn lsx_vaddwev_d_wu_w(a: v4u32, b: v4i32) -> v2i64 { + unsafe { __lsx_vaddwev_d_wu_w(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vaddwev_w_hu_h(a: v8u16, b: v8i16) -> v4i32 { - __lsx_vaddwev_w_hu_h(a, b) +pub fn lsx_vaddwev_w_hu_h(a: v8u16, b: v8i16) -> v4i32 { + unsafe { __lsx_vaddwev_w_hu_h(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vaddwev_h_bu_b(a: v16u8, b: v16i8) -> v8i16 { - __lsx_vaddwev_h_bu_b(a, b) +pub fn lsx_vaddwev_h_bu_b(a: v16u8, b: v16i8) -> v8i16 { + unsafe { __lsx_vaddwev_h_bu_b(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vaddwod_d_wu_w(a: v4u32, b: v4i32) -> v2i64 { - __lsx_vaddwod_d_wu_w(a, b) +pub fn lsx_vaddwod_d_wu_w(a: v4u32, b: v4i32) -> v2i64 { + unsafe { __lsx_vaddwod_d_wu_w(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vaddwod_w_hu_h(a: v8u16, b: v8i16) -> v4i32 { - __lsx_vaddwod_w_hu_h(a, b) +pub fn lsx_vaddwod_w_hu_h(a: v8u16, b: v8i16) -> v4i32 { + unsafe { __lsx_vaddwod_w_hu_h(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vaddwod_h_bu_b(a: v16u8, b: v16i8) -> v8i16 { - __lsx_vaddwod_h_bu_b(a, b) +pub fn lsx_vaddwod_h_bu_b(a: v16u8, b: v16i8) -> v8i16 { + unsafe { __lsx_vaddwod_h_bu_b(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsubwev_d_w(a: v4i32, b: v4i32) -> v2i64 { - __lsx_vsubwev_d_w(a, b) +pub fn lsx_vsubwev_d_w(a: v4i32, b: v4i32) -> v2i64 { + unsafe { __lsx_vsubwev_d_w(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsubwev_w_h(a: v8i16, b: v8i16) -> v4i32 { - __lsx_vsubwev_w_h(a, b) +pub fn lsx_vsubwev_w_h(a: v8i16, b: v8i16) -> v4i32 { + unsafe { __lsx_vsubwev_w_h(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsubwev_h_b(a: v16i8, b: v16i8) -> v8i16 { - __lsx_vsubwev_h_b(a, b) +pub fn lsx_vsubwev_h_b(a: v16i8, b: v16i8) -> v8i16 { + unsafe { __lsx_vsubwev_h_b(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsubwod_d_w(a: v4i32, b: v4i32) -> v2i64 { - __lsx_vsubwod_d_w(a, b) +pub fn lsx_vsubwod_d_w(a: v4i32, b: v4i32) -> v2i64 { + unsafe { __lsx_vsubwod_d_w(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsubwod_w_h(a: v8i16, b: v8i16) -> v4i32 { - __lsx_vsubwod_w_h(a, b) +pub fn lsx_vsubwod_w_h(a: v8i16, b: v8i16) -> v4i32 { + unsafe { __lsx_vsubwod_w_h(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsubwod_h_b(a: v16i8, b: v16i8) -> v8i16 { - __lsx_vsubwod_h_b(a, b) +pub fn lsx_vsubwod_h_b(a: v16i8, b: v16i8) -> v8i16 { + unsafe { __lsx_vsubwod_h_b(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsubwev_d_wu(a: v4u32, b: v4u32) -> v2i64 { - __lsx_vsubwev_d_wu(a, b) +pub fn lsx_vsubwev_d_wu(a: v4u32, b: v4u32) -> v2i64 { + unsafe { __lsx_vsubwev_d_wu(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsubwev_w_hu(a: v8u16, b: v8u16) -> v4i32 { - __lsx_vsubwev_w_hu(a, b) +pub fn lsx_vsubwev_w_hu(a: v8u16, b: v8u16) -> v4i32 { + unsafe { __lsx_vsubwev_w_hu(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsubwev_h_bu(a: v16u8, b: v16u8) -> v8i16 { - __lsx_vsubwev_h_bu(a, b) +pub fn lsx_vsubwev_h_bu(a: v16u8, b: v16u8) -> v8i16 { + unsafe { __lsx_vsubwev_h_bu(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsubwod_d_wu(a: v4u32, b: v4u32) -> v2i64 { - __lsx_vsubwod_d_wu(a, b) +pub fn lsx_vsubwod_d_wu(a: v4u32, b: v4u32) -> v2i64 { + unsafe { __lsx_vsubwod_d_wu(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsubwod_w_hu(a: v8u16, b: v8u16) -> v4i32 { - __lsx_vsubwod_w_hu(a, b) +pub fn lsx_vsubwod_w_hu(a: v8u16, b: v8u16) -> v4i32 { + unsafe { __lsx_vsubwod_w_hu(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsubwod_h_bu(a: v16u8, b: v16u8) -> v8i16 { - __lsx_vsubwod_h_bu(a, b) +pub fn lsx_vsubwod_h_bu(a: v16u8, b: v16u8) -> v8i16 { + unsafe { __lsx_vsubwod_h_bu(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vaddwev_q_d(a: v2i64, b: v2i64) -> v2i64 { - __lsx_vaddwev_q_d(a, b) +pub fn lsx_vaddwev_q_d(a: v2i64, b: v2i64) -> v2i64 { + unsafe { __lsx_vaddwev_q_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vaddwod_q_d(a: v2i64, b: v2i64) -> v2i64 { - __lsx_vaddwod_q_d(a, b) +pub fn lsx_vaddwod_q_d(a: v2i64, b: v2i64) -> v2i64 { + unsafe { __lsx_vaddwod_q_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vaddwev_q_du(a: v2u64, b: v2u64) -> v2i64 { - __lsx_vaddwev_q_du(a, b) +pub fn lsx_vaddwev_q_du(a: v2u64, b: v2u64) -> v2i64 { + unsafe { __lsx_vaddwev_q_du(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vaddwod_q_du(a: v2u64, b: v2u64) -> v2i64 { - __lsx_vaddwod_q_du(a, b) +pub fn lsx_vaddwod_q_du(a: v2u64, b: v2u64) -> v2i64 { + unsafe { __lsx_vaddwod_q_du(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsubwev_q_d(a: v2i64, b: v2i64) -> v2i64 { - __lsx_vsubwev_q_d(a, b) +pub fn lsx_vsubwev_q_d(a: v2i64, b: v2i64) -> v2i64 { + unsafe { __lsx_vsubwev_q_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsubwod_q_d(a: v2i64, b: v2i64) -> v2i64 { - __lsx_vsubwod_q_d(a, b) +pub fn lsx_vsubwod_q_d(a: v2i64, b: v2i64) -> v2i64 { + unsafe { __lsx_vsubwod_q_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsubwev_q_du(a: v2u64, b: v2u64) -> v2i64 { - __lsx_vsubwev_q_du(a, b) +pub fn lsx_vsubwev_q_du(a: v2u64, b: v2u64) -> v2i64 { + unsafe { __lsx_vsubwev_q_du(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsubwod_q_du(a: v2u64, b: v2u64) -> v2i64 { - __lsx_vsubwod_q_du(a, b) +pub fn lsx_vsubwod_q_du(a: v2u64, b: v2u64) -> v2i64 { + unsafe { __lsx_vsubwod_q_du(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vaddwev_q_du_d(a: v2u64, b: v2i64) -> v2i64 { - __lsx_vaddwev_q_du_d(a, b) +pub fn lsx_vaddwev_q_du_d(a: v2u64, b: v2i64) -> v2i64 { + unsafe { __lsx_vaddwev_q_du_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vaddwod_q_du_d(a: v2u64, b: v2i64) -> v2i64 { - __lsx_vaddwod_q_du_d(a, b) +pub fn lsx_vaddwod_q_du_d(a: v2u64, b: v2i64) -> v2i64 { + unsafe { __lsx_vaddwod_q_du_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmulwev_d_w(a: v4i32, b: v4i32) -> v2i64 { - __lsx_vmulwev_d_w(a, b) +pub fn lsx_vmulwev_d_w(a: v4i32, b: v4i32) -> v2i64 { + unsafe { __lsx_vmulwev_d_w(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmulwev_w_h(a: v8i16, b: v8i16) -> v4i32 { - __lsx_vmulwev_w_h(a, b) +pub fn lsx_vmulwev_w_h(a: v8i16, b: v8i16) -> v4i32 { + unsafe { __lsx_vmulwev_w_h(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmulwev_h_b(a: v16i8, b: v16i8) -> v8i16 { - __lsx_vmulwev_h_b(a, b) +pub fn lsx_vmulwev_h_b(a: v16i8, b: v16i8) -> v8i16 { + unsafe { __lsx_vmulwev_h_b(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmulwod_d_w(a: v4i32, b: v4i32) -> v2i64 { - __lsx_vmulwod_d_w(a, b) +pub fn lsx_vmulwod_d_w(a: v4i32, b: v4i32) -> v2i64 { + unsafe { __lsx_vmulwod_d_w(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmulwod_w_h(a: v8i16, b: v8i16) -> v4i32 { - __lsx_vmulwod_w_h(a, b) +pub fn lsx_vmulwod_w_h(a: v8i16, b: v8i16) -> v4i32 { + unsafe { __lsx_vmulwod_w_h(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmulwod_h_b(a: v16i8, b: v16i8) -> v8i16 { - __lsx_vmulwod_h_b(a, b) +pub fn lsx_vmulwod_h_b(a: v16i8, b: v16i8) -> v8i16 { + unsafe { __lsx_vmulwod_h_b(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmulwev_d_wu(a: v4u32, b: v4u32) -> v2i64 { - __lsx_vmulwev_d_wu(a, b) +pub fn lsx_vmulwev_d_wu(a: v4u32, b: v4u32) -> v2i64 { + unsafe { __lsx_vmulwev_d_wu(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmulwev_w_hu(a: v8u16, b: v8u16) -> v4i32 { - __lsx_vmulwev_w_hu(a, b) +pub fn lsx_vmulwev_w_hu(a: v8u16, b: v8u16) -> v4i32 { + unsafe { __lsx_vmulwev_w_hu(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmulwev_h_bu(a: v16u8, b: v16u8) -> v8i16 { - __lsx_vmulwev_h_bu(a, b) +pub fn lsx_vmulwev_h_bu(a: v16u8, b: v16u8) -> v8i16 { + unsafe { __lsx_vmulwev_h_bu(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmulwod_d_wu(a: v4u32, b: v4u32) -> v2i64 { - __lsx_vmulwod_d_wu(a, b) +pub fn lsx_vmulwod_d_wu(a: v4u32, b: v4u32) -> v2i64 { + unsafe { __lsx_vmulwod_d_wu(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmulwod_w_hu(a: v8u16, b: v8u16) -> v4i32 { - __lsx_vmulwod_w_hu(a, b) +pub fn lsx_vmulwod_w_hu(a: v8u16, b: v8u16) -> v4i32 { + unsafe { __lsx_vmulwod_w_hu(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmulwod_h_bu(a: v16u8, b: v16u8) -> v8i16 { - __lsx_vmulwod_h_bu(a, b) +pub fn lsx_vmulwod_h_bu(a: v16u8, b: v16u8) -> v8i16 { + unsafe { __lsx_vmulwod_h_bu(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmulwev_d_wu_w(a: v4u32, b: v4i32) -> v2i64 { - __lsx_vmulwev_d_wu_w(a, b) +pub fn lsx_vmulwev_d_wu_w(a: v4u32, b: v4i32) -> v2i64 { + unsafe { __lsx_vmulwev_d_wu_w(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmulwev_w_hu_h(a: v8u16, b: v8i16) -> v4i32 { - __lsx_vmulwev_w_hu_h(a, b) +pub fn lsx_vmulwev_w_hu_h(a: v8u16, b: v8i16) -> v4i32 { + unsafe { __lsx_vmulwev_w_hu_h(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmulwev_h_bu_b(a: v16u8, b: v16i8) -> v8i16 { - __lsx_vmulwev_h_bu_b(a, b) +pub fn lsx_vmulwev_h_bu_b(a: v16u8, b: v16i8) -> v8i16 { + unsafe { __lsx_vmulwev_h_bu_b(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmulwod_d_wu_w(a: v4u32, b: v4i32) -> v2i64 { - __lsx_vmulwod_d_wu_w(a, b) +pub fn lsx_vmulwod_d_wu_w(a: v4u32, b: v4i32) -> v2i64 { + unsafe { __lsx_vmulwod_d_wu_w(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmulwod_w_hu_h(a: v8u16, b: v8i16) -> v4i32 { - __lsx_vmulwod_w_hu_h(a, b) +pub fn lsx_vmulwod_w_hu_h(a: v8u16, b: v8i16) -> v4i32 { + unsafe { __lsx_vmulwod_w_hu_h(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmulwod_h_bu_b(a: v16u8, b: v16i8) -> v8i16 { - __lsx_vmulwod_h_bu_b(a, b) +pub fn lsx_vmulwod_h_bu_b(a: v16u8, b: v16i8) -> v8i16 { + unsafe { __lsx_vmulwod_h_bu_b(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmulwev_q_d(a: v2i64, b: v2i64) -> v2i64 { - __lsx_vmulwev_q_d(a, b) +pub fn lsx_vmulwev_q_d(a: v2i64, b: v2i64) -> v2i64 { + unsafe { __lsx_vmulwev_q_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmulwod_q_d(a: v2i64, b: v2i64) -> v2i64 { - __lsx_vmulwod_q_d(a, b) +pub fn lsx_vmulwod_q_d(a: v2i64, b: v2i64) -> v2i64 { + unsafe { __lsx_vmulwod_q_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmulwev_q_du(a: v2u64, b: v2u64) -> v2i64 { - __lsx_vmulwev_q_du(a, b) +pub fn lsx_vmulwev_q_du(a: v2u64, b: v2u64) -> v2i64 { + unsafe { __lsx_vmulwev_q_du(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmulwod_q_du(a: v2u64, b: v2u64) -> v2i64 { - __lsx_vmulwod_q_du(a, b) +pub fn lsx_vmulwod_q_du(a: v2u64, b: v2u64) -> v2i64 { + unsafe { __lsx_vmulwod_q_du(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmulwev_q_du_d(a: v2u64, b: v2i64) -> v2i64 { - __lsx_vmulwev_q_du_d(a, b) +pub fn lsx_vmulwev_q_du_d(a: v2u64, b: v2i64) -> v2i64 { + unsafe { __lsx_vmulwev_q_du_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmulwod_q_du_d(a: v2u64, b: v2i64) -> v2i64 { - __lsx_vmulwod_q_du_d(a, b) +pub fn lsx_vmulwod_q_du_d(a: v2u64, b: v2i64) -> v2i64 { + unsafe { __lsx_vmulwod_q_du_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vhaddw_q_d(a: v2i64, b: v2i64) -> v2i64 { - __lsx_vhaddw_q_d(a, b) +pub fn lsx_vhaddw_q_d(a: v2i64, b: v2i64) -> v2i64 { + unsafe { __lsx_vhaddw_q_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vhaddw_qu_du(a: v2u64, b: v2u64) -> v2u64 { - __lsx_vhaddw_qu_du(a, b) +pub fn lsx_vhaddw_qu_du(a: v2u64, b: v2u64) -> v2u64 { + unsafe { __lsx_vhaddw_qu_du(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vhsubw_q_d(a: v2i64, b: v2i64) -> v2i64 { - __lsx_vhsubw_q_d(a, b) +pub fn lsx_vhsubw_q_d(a: v2i64, b: v2i64) -> v2i64 { + unsafe { __lsx_vhsubw_q_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vhsubw_qu_du(a: v2u64, b: v2u64) -> v2u64 { - __lsx_vhsubw_qu_du(a, b) +pub fn lsx_vhsubw_qu_du(a: v2u64, b: v2u64) -> v2u64 { + unsafe { __lsx_vhsubw_qu_du(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmaddwev_d_w(a: v2i64, b: v4i32, c: v4i32) -> v2i64 { - __lsx_vmaddwev_d_w(a, b, c) +pub fn lsx_vmaddwev_d_w(a: v2i64, b: v4i32, c: v4i32) -> v2i64 { + unsafe { __lsx_vmaddwev_d_w(a, b, c) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmaddwev_w_h(a: v4i32, b: v8i16, c: v8i16) -> v4i32 { - __lsx_vmaddwev_w_h(a, b, c) +pub fn lsx_vmaddwev_w_h(a: v4i32, b: v8i16, c: v8i16) -> v4i32 { + unsafe { __lsx_vmaddwev_w_h(a, b, c) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmaddwev_h_b(a: v8i16, b: v16i8, c: v16i8) -> v8i16 { - __lsx_vmaddwev_h_b(a, b, c) +pub fn lsx_vmaddwev_h_b(a: v8i16, b: v16i8, c: v16i8) -> v8i16 { + unsafe { __lsx_vmaddwev_h_b(a, b, c) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmaddwev_d_wu(a: v2u64, b: v4u32, c: v4u32) -> v2u64 { - __lsx_vmaddwev_d_wu(a, b, c) +pub fn lsx_vmaddwev_d_wu(a: v2u64, b: v4u32, c: v4u32) -> v2u64 { + unsafe { __lsx_vmaddwev_d_wu(a, b, c) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmaddwev_w_hu(a: v4u32, b: v8u16, c: v8u16) -> v4u32 { - __lsx_vmaddwev_w_hu(a, b, c) +pub fn lsx_vmaddwev_w_hu(a: v4u32, b: v8u16, c: v8u16) -> v4u32 { + unsafe { __lsx_vmaddwev_w_hu(a, b, c) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmaddwev_h_bu(a: v8u16, b: v16u8, c: v16u8) -> v8u16 { - __lsx_vmaddwev_h_bu(a, b, c) +pub fn lsx_vmaddwev_h_bu(a: v8u16, b: v16u8, c: v16u8) -> v8u16 { + unsafe { __lsx_vmaddwev_h_bu(a, b, c) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmaddwod_d_w(a: v2i64, b: v4i32, c: v4i32) -> v2i64 { - __lsx_vmaddwod_d_w(a, b, c) +pub fn lsx_vmaddwod_d_w(a: v2i64, b: v4i32, c: v4i32) -> v2i64 { + unsafe { __lsx_vmaddwod_d_w(a, b, c) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmaddwod_w_h(a: v4i32, b: v8i16, c: v8i16) -> v4i32 { - __lsx_vmaddwod_w_h(a, b, c) +pub fn lsx_vmaddwod_w_h(a: v4i32, b: v8i16, c: v8i16) -> v4i32 { + unsafe { __lsx_vmaddwod_w_h(a, b, c) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmaddwod_h_b(a: v8i16, b: v16i8, c: v16i8) -> v8i16 { - __lsx_vmaddwod_h_b(a, b, c) +pub fn lsx_vmaddwod_h_b(a: v8i16, b: v16i8, c: v16i8) -> v8i16 { + unsafe { __lsx_vmaddwod_h_b(a, b, c) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmaddwod_d_wu(a: v2u64, b: v4u32, c: v4u32) -> v2u64 { - __lsx_vmaddwod_d_wu(a, b, c) +pub fn lsx_vmaddwod_d_wu(a: v2u64, b: v4u32, c: v4u32) -> v2u64 { + unsafe { __lsx_vmaddwod_d_wu(a, b, c) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmaddwod_w_hu(a: v4u32, b: v8u16, c: v8u16) -> v4u32 { - __lsx_vmaddwod_w_hu(a, b, c) +pub fn lsx_vmaddwod_w_hu(a: v4u32, b: v8u16, c: v8u16) -> v4u32 { + unsafe { __lsx_vmaddwod_w_hu(a, b, c) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmaddwod_h_bu(a: v8u16, b: v16u8, c: v16u8) -> v8u16 { - __lsx_vmaddwod_h_bu(a, b, c) +pub fn lsx_vmaddwod_h_bu(a: v8u16, b: v16u8, c: v16u8) -> v8u16 { + unsafe { __lsx_vmaddwod_h_bu(a, b, c) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmaddwev_d_wu_w(a: v2i64, b: v4u32, c: v4i32) -> v2i64 { - __lsx_vmaddwev_d_wu_w(a, b, c) +pub fn lsx_vmaddwev_d_wu_w(a: v2i64, b: v4u32, c: v4i32) -> v2i64 { + unsafe { __lsx_vmaddwev_d_wu_w(a, b, c) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmaddwev_w_hu_h(a: v4i32, b: v8u16, c: v8i16) -> v4i32 { - __lsx_vmaddwev_w_hu_h(a, b, c) +pub fn lsx_vmaddwev_w_hu_h(a: v4i32, b: v8u16, c: v8i16) -> v4i32 { + unsafe { __lsx_vmaddwev_w_hu_h(a, b, c) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmaddwev_h_bu_b(a: v8i16, b: v16u8, c: v16i8) -> v8i16 { - __lsx_vmaddwev_h_bu_b(a, b, c) +pub fn lsx_vmaddwev_h_bu_b(a: v8i16, b: v16u8, c: v16i8) -> v8i16 { + unsafe { __lsx_vmaddwev_h_bu_b(a, b, c) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmaddwod_d_wu_w(a: v2i64, b: v4u32, c: v4i32) -> v2i64 { - __lsx_vmaddwod_d_wu_w(a, b, c) +pub fn lsx_vmaddwod_d_wu_w(a: v2i64, b: v4u32, c: v4i32) -> v2i64 { + unsafe { __lsx_vmaddwod_d_wu_w(a, b, c) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmaddwod_w_hu_h(a: v4i32, b: v8u16, c: v8i16) -> v4i32 { - __lsx_vmaddwod_w_hu_h(a, b, c) +pub fn lsx_vmaddwod_w_hu_h(a: v4i32, b: v8u16, c: v8i16) -> v4i32 { + unsafe { __lsx_vmaddwod_w_hu_h(a, b, c) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmaddwod_h_bu_b(a: v8i16, b: v16u8, c: v16i8) -> v8i16 { - __lsx_vmaddwod_h_bu_b(a, b, c) +pub fn lsx_vmaddwod_h_bu_b(a: v8i16, b: v16u8, c: v16i8) -> v8i16 { + unsafe { __lsx_vmaddwod_h_bu_b(a, b, c) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmaddwev_q_d(a: v2i64, b: v2i64, c: v2i64) -> v2i64 { - __lsx_vmaddwev_q_d(a, b, c) +pub fn lsx_vmaddwev_q_d(a: v2i64, b: v2i64, c: v2i64) -> v2i64 { + unsafe { __lsx_vmaddwev_q_d(a, b, c) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmaddwod_q_d(a: v2i64, b: v2i64, c: v2i64) -> v2i64 { - __lsx_vmaddwod_q_d(a, b, c) +pub fn lsx_vmaddwod_q_d(a: v2i64, b: v2i64, c: v2i64) -> v2i64 { + unsafe { __lsx_vmaddwod_q_d(a, b, c) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmaddwev_q_du(a: v2u64, b: v2u64, c: v2u64) -> v2u64 { - __lsx_vmaddwev_q_du(a, b, c) +pub fn lsx_vmaddwev_q_du(a: v2u64, b: v2u64, c: v2u64) -> v2u64 { + unsafe { __lsx_vmaddwev_q_du(a, b, c) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmaddwod_q_du(a: v2u64, b: v2u64, c: v2u64) -> v2u64 { - __lsx_vmaddwod_q_du(a, b, c) +pub fn lsx_vmaddwod_q_du(a: v2u64, b: v2u64, c: v2u64) -> v2u64 { + unsafe { __lsx_vmaddwod_q_du(a, b, c) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmaddwev_q_du_d(a: v2i64, b: v2u64, c: v2i64) -> v2i64 { - __lsx_vmaddwev_q_du_d(a, b, c) +pub fn lsx_vmaddwev_q_du_d(a: v2i64, b: v2u64, c: v2i64) -> v2i64 { + unsafe { __lsx_vmaddwev_q_du_d(a, b, c) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmaddwod_q_du_d(a: v2i64, b: v2u64, c: v2i64) -> v2i64 { - __lsx_vmaddwod_q_du_d(a, b, c) +pub fn lsx_vmaddwod_q_du_d(a: v2i64, b: v2u64, c: v2i64) -> v2i64 { + unsafe { __lsx_vmaddwod_q_du_d(a, b, c) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vrotr_b(a: v16i8, b: v16i8) -> v16i8 { - __lsx_vrotr_b(a, b) +pub fn lsx_vrotr_b(a: v16i8, b: v16i8) -> v16i8 { + unsafe { __lsx_vrotr_b(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vrotr_h(a: v8i16, b: v8i16) -> v8i16 { - __lsx_vrotr_h(a, b) +pub fn lsx_vrotr_h(a: v8i16, b: v8i16) -> v8i16 { + unsafe { __lsx_vrotr_h(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vrotr_w(a: v4i32, b: v4i32) -> v4i32 { - __lsx_vrotr_w(a, b) +pub fn lsx_vrotr_w(a: v4i32, b: v4i32) -> v4i32 { + unsafe { __lsx_vrotr_w(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vrotr_d(a: v2i64, b: v2i64) -> v2i64 { - __lsx_vrotr_d(a, b) +pub fn lsx_vrotr_d(a: v2i64, b: v2i64) -> v2i64 { + unsafe { __lsx_vrotr_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vadd_q(a: v2i64, b: v2i64) -> v2i64 { - __lsx_vadd_q(a, b) +pub fn lsx_vadd_q(a: v2i64, b: v2i64) -> v2i64 { + unsafe { __lsx_vadd_q(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsub_q(a: v2i64, b: v2i64) -> v2i64 { - __lsx_vsub_q(a, b) +pub fn lsx_vsub_q(a: v2i64, b: v2i64) -> v2i64 { + unsafe { __lsx_vsub_q(a, b) } } #[inline] @@ -5809,555 +5809,555 @@ pub unsafe fn lsx_vldrepl_d(mem_addr: *const i8) -> v2i64 { #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmskgez_b(a: v16i8) -> v16i8 { - __lsx_vmskgez_b(a) +pub fn lsx_vmskgez_b(a: v16i8) -> v16i8 { + unsafe { __lsx_vmskgez_b(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vmsknz_b(a: v16i8) -> v16i8 { - __lsx_vmsknz_b(a) +pub fn lsx_vmsknz_b(a: v16i8) -> v16i8 { + unsafe { __lsx_vmsknz_b(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vexth_h_b(a: v16i8) -> v8i16 { - __lsx_vexth_h_b(a) +pub fn lsx_vexth_h_b(a: v16i8) -> v8i16 { + unsafe { __lsx_vexth_h_b(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vexth_w_h(a: v8i16) -> v4i32 { - __lsx_vexth_w_h(a) +pub fn lsx_vexth_w_h(a: v8i16) -> v4i32 { + unsafe { __lsx_vexth_w_h(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vexth_d_w(a: v4i32) -> v2i64 { - __lsx_vexth_d_w(a) +pub fn lsx_vexth_d_w(a: v4i32) -> v2i64 { + unsafe { __lsx_vexth_d_w(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vexth_q_d(a: v2i64) -> v2i64 { - __lsx_vexth_q_d(a) +pub fn lsx_vexth_q_d(a: v2i64) -> v2i64 { + unsafe { __lsx_vexth_q_d(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vexth_hu_bu(a: v16u8) -> v8u16 { - __lsx_vexth_hu_bu(a) +pub fn lsx_vexth_hu_bu(a: v16u8) -> v8u16 { + unsafe { __lsx_vexth_hu_bu(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vexth_wu_hu(a: v8u16) -> v4u32 { - __lsx_vexth_wu_hu(a) +pub fn lsx_vexth_wu_hu(a: v8u16) -> v4u32 { + unsafe { __lsx_vexth_wu_hu(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vexth_du_wu(a: v4u32) -> v2u64 { - __lsx_vexth_du_wu(a) +pub fn lsx_vexth_du_wu(a: v4u32) -> v2u64 { + unsafe { __lsx_vexth_du_wu(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vexth_qu_du(a: v2u64) -> v2u64 { - __lsx_vexth_qu_du(a) +pub fn lsx_vexth_qu_du(a: v2u64) -> v2u64 { + unsafe { __lsx_vexth_qu_du(a) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vrotri_b(a: v16i8) -> v16i8 { +pub fn lsx_vrotri_b(a: v16i8) -> v16i8 { static_assert_uimm_bits!(IMM3, 3); - __lsx_vrotri_b(a, IMM3) + unsafe { __lsx_vrotri_b(a, IMM3) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vrotri_h(a: v8i16) -> v8i16 { +pub fn lsx_vrotri_h(a: v8i16) -> v8i16 { static_assert_uimm_bits!(IMM4, 4); - __lsx_vrotri_h(a, IMM4) + unsafe { __lsx_vrotri_h(a, IMM4) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vrotri_w(a: v4i32) -> v4i32 { +pub fn lsx_vrotri_w(a: v4i32) -> v4i32 { static_assert_uimm_bits!(IMM5, 5); - __lsx_vrotri_w(a, IMM5) + unsafe { __lsx_vrotri_w(a, IMM5) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vrotri_d(a: v2i64) -> v2i64 { +pub fn lsx_vrotri_d(a: v2i64) -> v2i64 { static_assert_uimm_bits!(IMM6, 6); - __lsx_vrotri_d(a, IMM6) + unsafe { __lsx_vrotri_d(a, IMM6) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vextl_q_d(a: v2i64) -> v2i64 { - __lsx_vextl_q_d(a) +pub fn lsx_vextl_q_d(a: v2i64) -> v2i64 { + unsafe { __lsx_vextl_q_d(a) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsrlni_b_h(a: v16i8, b: v16i8) -> v16i8 { +pub fn lsx_vsrlni_b_h(a: v16i8, b: v16i8) -> v16i8 { static_assert_uimm_bits!(IMM4, 4); - __lsx_vsrlni_b_h(a, b, IMM4) + unsafe { __lsx_vsrlni_b_h(a, b, IMM4) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsrlni_h_w(a: v8i16, b: v8i16) -> v8i16 { +pub fn lsx_vsrlni_h_w(a: v8i16, b: v8i16) -> v8i16 { static_assert_uimm_bits!(IMM5, 5); - __lsx_vsrlni_h_w(a, b, IMM5) + unsafe { __lsx_vsrlni_h_w(a, b, IMM5) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsrlni_w_d(a: v4i32, b: v4i32) -> v4i32 { +pub fn lsx_vsrlni_w_d(a: v4i32, b: v4i32) -> v4i32 { static_assert_uimm_bits!(IMM6, 6); - __lsx_vsrlni_w_d(a, b, IMM6) + unsafe { __lsx_vsrlni_w_d(a, b, IMM6) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsrlni_d_q(a: v2i64, b: v2i64) -> v2i64 { +pub fn lsx_vsrlni_d_q(a: v2i64, b: v2i64) -> v2i64 { static_assert_uimm_bits!(IMM7, 7); - __lsx_vsrlni_d_q(a, b, IMM7) + unsafe { __lsx_vsrlni_d_q(a, b, IMM7) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsrlrni_b_h(a: v16i8, b: v16i8) -> v16i8 { +pub fn lsx_vsrlrni_b_h(a: v16i8, b: v16i8) -> v16i8 { static_assert_uimm_bits!(IMM4, 4); - __lsx_vsrlrni_b_h(a, b, IMM4) + unsafe { __lsx_vsrlrni_b_h(a, b, IMM4) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsrlrni_h_w(a: v8i16, b: v8i16) -> v8i16 { +pub fn lsx_vsrlrni_h_w(a: v8i16, b: v8i16) -> v8i16 { static_assert_uimm_bits!(IMM5, 5); - __lsx_vsrlrni_h_w(a, b, IMM5) + unsafe { __lsx_vsrlrni_h_w(a, b, IMM5) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsrlrni_w_d(a: v4i32, b: v4i32) -> v4i32 { +pub fn lsx_vsrlrni_w_d(a: v4i32, b: v4i32) -> v4i32 { static_assert_uimm_bits!(IMM6, 6); - __lsx_vsrlrni_w_d(a, b, IMM6) + unsafe { __lsx_vsrlrni_w_d(a, b, IMM6) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsrlrni_d_q(a: v2i64, b: v2i64) -> v2i64 { +pub fn lsx_vsrlrni_d_q(a: v2i64, b: v2i64) -> v2i64 { static_assert_uimm_bits!(IMM7, 7); - __lsx_vsrlrni_d_q(a, b, IMM7) + unsafe { __lsx_vsrlrni_d_q(a, b, IMM7) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vssrlni_b_h(a: v16i8, b: v16i8) -> v16i8 { +pub fn lsx_vssrlni_b_h(a: v16i8, b: v16i8) -> v16i8 { static_assert_uimm_bits!(IMM4, 4); - __lsx_vssrlni_b_h(a, b, IMM4) + unsafe { __lsx_vssrlni_b_h(a, b, IMM4) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vssrlni_h_w(a: v8i16, b: v8i16) -> v8i16 { +pub fn lsx_vssrlni_h_w(a: v8i16, b: v8i16) -> v8i16 { static_assert_uimm_bits!(IMM5, 5); - __lsx_vssrlni_h_w(a, b, IMM5) + unsafe { __lsx_vssrlni_h_w(a, b, IMM5) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vssrlni_w_d(a: v4i32, b: v4i32) -> v4i32 { +pub fn lsx_vssrlni_w_d(a: v4i32, b: v4i32) -> v4i32 { static_assert_uimm_bits!(IMM6, 6); - __lsx_vssrlni_w_d(a, b, IMM6) + unsafe { __lsx_vssrlni_w_d(a, b, IMM6) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vssrlni_d_q(a: v2i64, b: v2i64) -> v2i64 { +pub fn lsx_vssrlni_d_q(a: v2i64, b: v2i64) -> v2i64 { static_assert_uimm_bits!(IMM7, 7); - __lsx_vssrlni_d_q(a, b, IMM7) + unsafe { __lsx_vssrlni_d_q(a, b, IMM7) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vssrlni_bu_h(a: v16u8, b: v16i8) -> v16u8 { +pub fn lsx_vssrlni_bu_h(a: v16u8, b: v16i8) -> v16u8 { static_assert_uimm_bits!(IMM4, 4); - __lsx_vssrlni_bu_h(a, b, IMM4) + unsafe { __lsx_vssrlni_bu_h(a, b, IMM4) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vssrlni_hu_w(a: v8u16, b: v8i16) -> v8u16 { +pub fn lsx_vssrlni_hu_w(a: v8u16, b: v8i16) -> v8u16 { static_assert_uimm_bits!(IMM5, 5); - __lsx_vssrlni_hu_w(a, b, IMM5) + unsafe { __lsx_vssrlni_hu_w(a, b, IMM5) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vssrlni_wu_d(a: v4u32, b: v4i32) -> v4u32 { +pub fn lsx_vssrlni_wu_d(a: v4u32, b: v4i32) -> v4u32 { static_assert_uimm_bits!(IMM6, 6); - __lsx_vssrlni_wu_d(a, b, IMM6) + unsafe { __lsx_vssrlni_wu_d(a, b, IMM6) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vssrlni_du_q(a: v2u64, b: v2i64) -> v2u64 { +pub fn lsx_vssrlni_du_q(a: v2u64, b: v2i64) -> v2u64 { static_assert_uimm_bits!(IMM7, 7); - __lsx_vssrlni_du_q(a, b, IMM7) + unsafe { __lsx_vssrlni_du_q(a, b, IMM7) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vssrlrni_b_h(a: v16i8, b: v16i8) -> v16i8 { +pub fn lsx_vssrlrni_b_h(a: v16i8, b: v16i8) -> v16i8 { static_assert_uimm_bits!(IMM4, 4); - __lsx_vssrlrni_b_h(a, b, IMM4) + unsafe { __lsx_vssrlrni_b_h(a, b, IMM4) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vssrlrni_h_w(a: v8i16, b: v8i16) -> v8i16 { +pub fn lsx_vssrlrni_h_w(a: v8i16, b: v8i16) -> v8i16 { static_assert_uimm_bits!(IMM5, 5); - __lsx_vssrlrni_h_w(a, b, IMM5) + unsafe { __lsx_vssrlrni_h_w(a, b, IMM5) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vssrlrni_w_d(a: v4i32, b: v4i32) -> v4i32 { +pub fn lsx_vssrlrni_w_d(a: v4i32, b: v4i32) -> v4i32 { static_assert_uimm_bits!(IMM6, 6); - __lsx_vssrlrni_w_d(a, b, IMM6) + unsafe { __lsx_vssrlrni_w_d(a, b, IMM6) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vssrlrni_d_q(a: v2i64, b: v2i64) -> v2i64 { +pub fn lsx_vssrlrni_d_q(a: v2i64, b: v2i64) -> v2i64 { static_assert_uimm_bits!(IMM7, 7); - __lsx_vssrlrni_d_q(a, b, IMM7) + unsafe { __lsx_vssrlrni_d_q(a, b, IMM7) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vssrlrni_bu_h(a: v16u8, b: v16i8) -> v16u8 { +pub fn lsx_vssrlrni_bu_h(a: v16u8, b: v16i8) -> v16u8 { static_assert_uimm_bits!(IMM4, 4); - __lsx_vssrlrni_bu_h(a, b, IMM4) + unsafe { __lsx_vssrlrni_bu_h(a, b, IMM4) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vssrlrni_hu_w(a: v8u16, b: v8i16) -> v8u16 { +pub fn lsx_vssrlrni_hu_w(a: v8u16, b: v8i16) -> v8u16 { static_assert_uimm_bits!(IMM5, 5); - __lsx_vssrlrni_hu_w(a, b, IMM5) + unsafe { __lsx_vssrlrni_hu_w(a, b, IMM5) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vssrlrni_wu_d(a: v4u32, b: v4i32) -> v4u32 { +pub fn lsx_vssrlrni_wu_d(a: v4u32, b: v4i32) -> v4u32 { static_assert_uimm_bits!(IMM6, 6); - __lsx_vssrlrni_wu_d(a, b, IMM6) + unsafe { __lsx_vssrlrni_wu_d(a, b, IMM6) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vssrlrni_du_q(a: v2u64, b: v2i64) -> v2u64 { +pub fn lsx_vssrlrni_du_q(a: v2u64, b: v2i64) -> v2u64 { static_assert_uimm_bits!(IMM7, 7); - __lsx_vssrlrni_du_q(a, b, IMM7) + unsafe { __lsx_vssrlrni_du_q(a, b, IMM7) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsrani_b_h(a: v16i8, b: v16i8) -> v16i8 { +pub fn lsx_vsrani_b_h(a: v16i8, b: v16i8) -> v16i8 { static_assert_uimm_bits!(IMM4, 4); - __lsx_vsrani_b_h(a, b, IMM4) + unsafe { __lsx_vsrani_b_h(a, b, IMM4) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsrani_h_w(a: v8i16, b: v8i16) -> v8i16 { +pub fn lsx_vsrani_h_w(a: v8i16, b: v8i16) -> v8i16 { static_assert_uimm_bits!(IMM5, 5); - __lsx_vsrani_h_w(a, b, IMM5) + unsafe { __lsx_vsrani_h_w(a, b, IMM5) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsrani_w_d(a: v4i32, b: v4i32) -> v4i32 { +pub fn lsx_vsrani_w_d(a: v4i32, b: v4i32) -> v4i32 { static_assert_uimm_bits!(IMM6, 6); - __lsx_vsrani_w_d(a, b, IMM6) + unsafe { __lsx_vsrani_w_d(a, b, IMM6) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsrani_d_q(a: v2i64, b: v2i64) -> v2i64 { +pub fn lsx_vsrani_d_q(a: v2i64, b: v2i64) -> v2i64 { static_assert_uimm_bits!(IMM7, 7); - __lsx_vsrani_d_q(a, b, IMM7) + unsafe { __lsx_vsrani_d_q(a, b, IMM7) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsrarni_b_h(a: v16i8, b: v16i8) -> v16i8 { +pub fn lsx_vsrarni_b_h(a: v16i8, b: v16i8) -> v16i8 { static_assert_uimm_bits!(IMM4, 4); - __lsx_vsrarni_b_h(a, b, IMM4) + unsafe { __lsx_vsrarni_b_h(a, b, IMM4) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsrarni_h_w(a: v8i16, b: v8i16) -> v8i16 { +pub fn lsx_vsrarni_h_w(a: v8i16, b: v8i16) -> v8i16 { static_assert_uimm_bits!(IMM5, 5); - __lsx_vsrarni_h_w(a, b, IMM5) + unsafe { __lsx_vsrarni_h_w(a, b, IMM5) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsrarni_w_d(a: v4i32, b: v4i32) -> v4i32 { +pub fn lsx_vsrarni_w_d(a: v4i32, b: v4i32) -> v4i32 { static_assert_uimm_bits!(IMM6, 6); - __lsx_vsrarni_w_d(a, b, IMM6) + unsafe { __lsx_vsrarni_w_d(a, b, IMM6) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vsrarni_d_q(a: v2i64, b: v2i64) -> v2i64 { +pub fn lsx_vsrarni_d_q(a: v2i64, b: v2i64) -> v2i64 { static_assert_uimm_bits!(IMM7, 7); - __lsx_vsrarni_d_q(a, b, IMM7) + unsafe { __lsx_vsrarni_d_q(a, b, IMM7) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vssrani_b_h(a: v16i8, b: v16i8) -> v16i8 { +pub fn lsx_vssrani_b_h(a: v16i8, b: v16i8) -> v16i8 { static_assert_uimm_bits!(IMM4, 4); - __lsx_vssrani_b_h(a, b, IMM4) + unsafe { __lsx_vssrani_b_h(a, b, IMM4) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vssrani_h_w(a: v8i16, b: v8i16) -> v8i16 { +pub fn lsx_vssrani_h_w(a: v8i16, b: v8i16) -> v8i16 { static_assert_uimm_bits!(IMM5, 5); - __lsx_vssrani_h_w(a, b, IMM5) + unsafe { __lsx_vssrani_h_w(a, b, IMM5) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vssrani_w_d(a: v4i32, b: v4i32) -> v4i32 { +pub fn lsx_vssrani_w_d(a: v4i32, b: v4i32) -> v4i32 { static_assert_uimm_bits!(IMM6, 6); - __lsx_vssrani_w_d(a, b, IMM6) + unsafe { __lsx_vssrani_w_d(a, b, IMM6) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vssrani_d_q(a: v2i64, b: v2i64) -> v2i64 { +pub fn lsx_vssrani_d_q(a: v2i64, b: v2i64) -> v2i64 { static_assert_uimm_bits!(IMM7, 7); - __lsx_vssrani_d_q(a, b, IMM7) + unsafe { __lsx_vssrani_d_q(a, b, IMM7) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vssrani_bu_h(a: v16u8, b: v16i8) -> v16u8 { +pub fn lsx_vssrani_bu_h(a: v16u8, b: v16i8) -> v16u8 { static_assert_uimm_bits!(IMM4, 4); - __lsx_vssrani_bu_h(a, b, IMM4) + unsafe { __lsx_vssrani_bu_h(a, b, IMM4) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vssrani_hu_w(a: v8u16, b: v8i16) -> v8u16 { +pub fn lsx_vssrani_hu_w(a: v8u16, b: v8i16) -> v8u16 { static_assert_uimm_bits!(IMM5, 5); - __lsx_vssrani_hu_w(a, b, IMM5) + unsafe { __lsx_vssrani_hu_w(a, b, IMM5) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vssrani_wu_d(a: v4u32, b: v4i32) -> v4u32 { +pub fn lsx_vssrani_wu_d(a: v4u32, b: v4i32) -> v4u32 { static_assert_uimm_bits!(IMM6, 6); - __lsx_vssrani_wu_d(a, b, IMM6) + unsafe { __lsx_vssrani_wu_d(a, b, IMM6) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vssrani_du_q(a: v2u64, b: v2i64) -> v2u64 { +pub fn lsx_vssrani_du_q(a: v2u64, b: v2i64) -> v2u64 { static_assert_uimm_bits!(IMM7, 7); - __lsx_vssrani_du_q(a, b, IMM7) + unsafe { __lsx_vssrani_du_q(a, b, IMM7) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vssrarni_b_h(a: v16i8, b: v16i8) -> v16i8 { +pub fn lsx_vssrarni_b_h(a: v16i8, b: v16i8) -> v16i8 { static_assert_uimm_bits!(IMM4, 4); - __lsx_vssrarni_b_h(a, b, IMM4) + unsafe { __lsx_vssrarni_b_h(a, b, IMM4) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vssrarni_h_w(a: v8i16, b: v8i16) -> v8i16 { +pub fn lsx_vssrarni_h_w(a: v8i16, b: v8i16) -> v8i16 { static_assert_uimm_bits!(IMM5, 5); - __lsx_vssrarni_h_w(a, b, IMM5) + unsafe { __lsx_vssrarni_h_w(a, b, IMM5) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vssrarni_w_d(a: v4i32, b: v4i32) -> v4i32 { +pub fn lsx_vssrarni_w_d(a: v4i32, b: v4i32) -> v4i32 { static_assert_uimm_bits!(IMM6, 6); - __lsx_vssrarni_w_d(a, b, IMM6) + unsafe { __lsx_vssrarni_w_d(a, b, IMM6) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vssrarni_d_q(a: v2i64, b: v2i64) -> v2i64 { +pub fn lsx_vssrarni_d_q(a: v2i64, b: v2i64) -> v2i64 { static_assert_uimm_bits!(IMM7, 7); - __lsx_vssrarni_d_q(a, b, IMM7) + unsafe { __lsx_vssrarni_d_q(a, b, IMM7) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vssrarni_bu_h(a: v16u8, b: v16i8) -> v16u8 { +pub fn lsx_vssrarni_bu_h(a: v16u8, b: v16i8) -> v16u8 { static_assert_uimm_bits!(IMM4, 4); - __lsx_vssrarni_bu_h(a, b, IMM4) + unsafe { __lsx_vssrarni_bu_h(a, b, IMM4) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vssrarni_hu_w(a: v8u16, b: v8i16) -> v8u16 { +pub fn lsx_vssrarni_hu_w(a: v8u16, b: v8i16) -> v8u16 { static_assert_uimm_bits!(IMM5, 5); - __lsx_vssrarni_hu_w(a, b, IMM5) + unsafe { __lsx_vssrarni_hu_w(a, b, IMM5) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vssrarni_wu_d(a: v4u32, b: v4i32) -> v4u32 { +pub fn lsx_vssrarni_wu_d(a: v4u32, b: v4i32) -> v4u32 { static_assert_uimm_bits!(IMM6, 6); - __lsx_vssrarni_wu_d(a, b, IMM6) + unsafe { __lsx_vssrarni_wu_d(a, b, IMM6) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vssrarni_du_q(a: v2u64, b: v2i64) -> v2u64 { +pub fn lsx_vssrarni_du_q(a: v2u64, b: v2i64) -> v2u64 { static_assert_uimm_bits!(IMM7, 7); - __lsx_vssrarni_du_q(a, b, IMM7) + unsafe { __lsx_vssrarni_du_q(a, b, IMM7) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vpermi_w(a: v4i32, b: v4i32) -> v4i32 { +pub fn lsx_vpermi_w(a: v4i32, b: v4i32) -> v4i32 { static_assert_uimm_bits!(IMM8, 8); - __lsx_vpermi_w(a, b, IMM8) + unsafe { __lsx_vpermi_w(a, b, IMM8) } } #[inline] @@ -6381,66 +6381,66 @@ pub unsafe fn lsx_vst(a: v16i8, mem_addr: *mut i8) { #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vssrlrn_b_h(a: v8i16, b: v8i16) -> v16i8 { - __lsx_vssrlrn_b_h(a, b) +pub fn lsx_vssrlrn_b_h(a: v8i16, b: v8i16) -> v16i8 { + unsafe { __lsx_vssrlrn_b_h(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vssrlrn_h_w(a: v4i32, b: v4i32) -> v8i16 { - __lsx_vssrlrn_h_w(a, b) +pub fn lsx_vssrlrn_h_w(a: v4i32, b: v4i32) -> v8i16 { + unsafe { __lsx_vssrlrn_h_w(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vssrlrn_w_d(a: v2i64, b: v2i64) -> v4i32 { - __lsx_vssrlrn_w_d(a, b) +pub fn lsx_vssrlrn_w_d(a: v2i64, b: v2i64) -> v4i32 { + unsafe { __lsx_vssrlrn_w_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vssrln_b_h(a: v8i16, b: v8i16) -> v16i8 { - __lsx_vssrln_b_h(a, b) +pub fn lsx_vssrln_b_h(a: v8i16, b: v8i16) -> v16i8 { + unsafe { __lsx_vssrln_b_h(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vssrln_h_w(a: v4i32, b: v4i32) -> v8i16 { - __lsx_vssrln_h_w(a, b) +pub fn lsx_vssrln_h_w(a: v4i32, b: v4i32) -> v8i16 { + unsafe { __lsx_vssrln_h_w(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vssrln_w_d(a: v2i64, b: v2i64) -> v4i32 { - __lsx_vssrln_w_d(a, b) +pub fn lsx_vssrln_w_d(a: v2i64, b: v2i64) -> v4i32 { + unsafe { __lsx_vssrln_w_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vorn_v(a: v16i8, b: v16i8) -> v16i8 { - __lsx_vorn_v(a, b) +pub fn lsx_vorn_v(a: v16i8, b: v16i8) -> v16i8 { + unsafe { __lsx_vorn_v(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(0)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vldi() -> v2i64 { +pub fn lsx_vldi() -> v2i64 { static_assert_simm_bits!(IMM_S13, 13); - __lsx_vldi(IMM_S13) + unsafe { __lsx_vldi(IMM_S13) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vshuf_b(a: v16i8, b: v16i8, c: v16i8) -> v16i8 { - __lsx_vshuf_b(a, b, c) +pub fn lsx_vshuf_b(a: v16i8, b: v16i8, c: v16i8) -> v16i8 { + unsafe { __lsx_vshuf_b(a, b, c) } } #[inline] @@ -6460,420 +6460,420 @@ pub unsafe fn lsx_vstx(a: v16i8, mem_addr: *mut i8, b: i64) { #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vextl_qu_du(a: v2u64) -> v2u64 { - __lsx_vextl_qu_du(a) +pub fn lsx_vextl_qu_du(a: v2u64) -> v2u64 { + unsafe { __lsx_vextl_qu_du(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_bnz_b(a: v16u8) -> i32 { - __lsx_bnz_b(a) +pub fn lsx_bnz_b(a: v16u8) -> i32 { + unsafe { __lsx_bnz_b(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_bnz_d(a: v2u64) -> i32 { - __lsx_bnz_d(a) +pub fn lsx_bnz_d(a: v2u64) -> i32 { + unsafe { __lsx_bnz_d(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_bnz_h(a: v8u16) -> i32 { - __lsx_bnz_h(a) +pub fn lsx_bnz_h(a: v8u16) -> i32 { + unsafe { __lsx_bnz_h(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_bnz_v(a: v16u8) -> i32 { - __lsx_bnz_v(a) +pub fn lsx_bnz_v(a: v16u8) -> i32 { + unsafe { __lsx_bnz_v(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_bnz_w(a: v4u32) -> i32 { - __lsx_bnz_w(a) +pub fn lsx_bnz_w(a: v4u32) -> i32 { + unsafe { __lsx_bnz_w(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_bz_b(a: v16u8) -> i32 { - __lsx_bz_b(a) +pub fn lsx_bz_b(a: v16u8) -> i32 { + unsafe { __lsx_bz_b(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_bz_d(a: v2u64) -> i32 { - __lsx_bz_d(a) +pub fn lsx_bz_d(a: v2u64) -> i32 { + unsafe { __lsx_bz_d(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_bz_h(a: v8u16) -> i32 { - __lsx_bz_h(a) +pub fn lsx_bz_h(a: v8u16) -> i32 { + unsafe { __lsx_bz_h(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_bz_v(a: v16u8) -> i32 { - __lsx_bz_v(a) +pub fn lsx_bz_v(a: v16u8) -> i32 { + unsafe { __lsx_bz_v(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_bz_w(a: v4u32) -> i32 { - __lsx_bz_w(a) +pub fn lsx_bz_w(a: v4u32) -> i32 { + unsafe { __lsx_bz_w(a) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfcmp_caf_d(a: v2f64, b: v2f64) -> v2i64 { - __lsx_vfcmp_caf_d(a, b) +pub fn lsx_vfcmp_caf_d(a: v2f64, b: v2f64) -> v2i64 { + unsafe { __lsx_vfcmp_caf_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfcmp_caf_s(a: v4f32, b: v4f32) -> v4i32 { - __lsx_vfcmp_caf_s(a, b) +pub fn lsx_vfcmp_caf_s(a: v4f32, b: v4f32) -> v4i32 { + unsafe { __lsx_vfcmp_caf_s(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfcmp_ceq_d(a: v2f64, b: v2f64) -> v2i64 { - __lsx_vfcmp_ceq_d(a, b) +pub fn lsx_vfcmp_ceq_d(a: v2f64, b: v2f64) -> v2i64 { + unsafe { __lsx_vfcmp_ceq_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfcmp_ceq_s(a: v4f32, b: v4f32) -> v4i32 { - __lsx_vfcmp_ceq_s(a, b) +pub fn lsx_vfcmp_ceq_s(a: v4f32, b: v4f32) -> v4i32 { + unsafe { __lsx_vfcmp_ceq_s(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfcmp_cle_d(a: v2f64, b: v2f64) -> v2i64 { - __lsx_vfcmp_cle_d(a, b) +pub fn lsx_vfcmp_cle_d(a: v2f64, b: v2f64) -> v2i64 { + unsafe { __lsx_vfcmp_cle_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfcmp_cle_s(a: v4f32, b: v4f32) -> v4i32 { - __lsx_vfcmp_cle_s(a, b) +pub fn lsx_vfcmp_cle_s(a: v4f32, b: v4f32) -> v4i32 { + unsafe { __lsx_vfcmp_cle_s(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfcmp_clt_d(a: v2f64, b: v2f64) -> v2i64 { - __lsx_vfcmp_clt_d(a, b) +pub fn lsx_vfcmp_clt_d(a: v2f64, b: v2f64) -> v2i64 { + unsafe { __lsx_vfcmp_clt_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfcmp_clt_s(a: v4f32, b: v4f32) -> v4i32 { - __lsx_vfcmp_clt_s(a, b) +pub fn lsx_vfcmp_clt_s(a: v4f32, b: v4f32) -> v4i32 { + unsafe { __lsx_vfcmp_clt_s(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfcmp_cne_d(a: v2f64, b: v2f64) -> v2i64 { - __lsx_vfcmp_cne_d(a, b) +pub fn lsx_vfcmp_cne_d(a: v2f64, b: v2f64) -> v2i64 { + unsafe { __lsx_vfcmp_cne_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfcmp_cne_s(a: v4f32, b: v4f32) -> v4i32 { - __lsx_vfcmp_cne_s(a, b) +pub fn lsx_vfcmp_cne_s(a: v4f32, b: v4f32) -> v4i32 { + unsafe { __lsx_vfcmp_cne_s(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfcmp_cor_d(a: v2f64, b: v2f64) -> v2i64 { - __lsx_vfcmp_cor_d(a, b) +pub fn lsx_vfcmp_cor_d(a: v2f64, b: v2f64) -> v2i64 { + unsafe { __lsx_vfcmp_cor_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfcmp_cor_s(a: v4f32, b: v4f32) -> v4i32 { - __lsx_vfcmp_cor_s(a, b) +pub fn lsx_vfcmp_cor_s(a: v4f32, b: v4f32) -> v4i32 { + unsafe { __lsx_vfcmp_cor_s(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfcmp_cueq_d(a: v2f64, b: v2f64) -> v2i64 { - __lsx_vfcmp_cueq_d(a, b) +pub fn lsx_vfcmp_cueq_d(a: v2f64, b: v2f64) -> v2i64 { + unsafe { __lsx_vfcmp_cueq_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfcmp_cueq_s(a: v4f32, b: v4f32) -> v4i32 { - __lsx_vfcmp_cueq_s(a, b) +pub fn lsx_vfcmp_cueq_s(a: v4f32, b: v4f32) -> v4i32 { + unsafe { __lsx_vfcmp_cueq_s(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfcmp_cule_d(a: v2f64, b: v2f64) -> v2i64 { - __lsx_vfcmp_cule_d(a, b) +pub fn lsx_vfcmp_cule_d(a: v2f64, b: v2f64) -> v2i64 { + unsafe { __lsx_vfcmp_cule_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfcmp_cule_s(a: v4f32, b: v4f32) -> v4i32 { - __lsx_vfcmp_cule_s(a, b) +pub fn lsx_vfcmp_cule_s(a: v4f32, b: v4f32) -> v4i32 { + unsafe { __lsx_vfcmp_cule_s(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfcmp_cult_d(a: v2f64, b: v2f64) -> v2i64 { - __lsx_vfcmp_cult_d(a, b) +pub fn lsx_vfcmp_cult_d(a: v2f64, b: v2f64) -> v2i64 { + unsafe { __lsx_vfcmp_cult_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfcmp_cult_s(a: v4f32, b: v4f32) -> v4i32 { - __lsx_vfcmp_cult_s(a, b) +pub fn lsx_vfcmp_cult_s(a: v4f32, b: v4f32) -> v4i32 { + unsafe { __lsx_vfcmp_cult_s(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfcmp_cun_d(a: v2f64, b: v2f64) -> v2i64 { - __lsx_vfcmp_cun_d(a, b) +pub fn lsx_vfcmp_cun_d(a: v2f64, b: v2f64) -> v2i64 { + unsafe { __lsx_vfcmp_cun_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfcmp_cune_d(a: v2f64, b: v2f64) -> v2i64 { - __lsx_vfcmp_cune_d(a, b) +pub fn lsx_vfcmp_cune_d(a: v2f64, b: v2f64) -> v2i64 { + unsafe { __lsx_vfcmp_cune_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfcmp_cune_s(a: v4f32, b: v4f32) -> v4i32 { - __lsx_vfcmp_cune_s(a, b) +pub fn lsx_vfcmp_cune_s(a: v4f32, b: v4f32) -> v4i32 { + unsafe { __lsx_vfcmp_cune_s(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfcmp_cun_s(a: v4f32, b: v4f32) -> v4i32 { - __lsx_vfcmp_cun_s(a, b) +pub fn lsx_vfcmp_cun_s(a: v4f32, b: v4f32) -> v4i32 { + unsafe { __lsx_vfcmp_cun_s(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfcmp_saf_d(a: v2f64, b: v2f64) -> v2i64 { - __lsx_vfcmp_saf_d(a, b) +pub fn lsx_vfcmp_saf_d(a: v2f64, b: v2f64) -> v2i64 { + unsafe { __lsx_vfcmp_saf_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfcmp_saf_s(a: v4f32, b: v4f32) -> v4i32 { - __lsx_vfcmp_saf_s(a, b) +pub fn lsx_vfcmp_saf_s(a: v4f32, b: v4f32) -> v4i32 { + unsafe { __lsx_vfcmp_saf_s(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfcmp_seq_d(a: v2f64, b: v2f64) -> v2i64 { - __lsx_vfcmp_seq_d(a, b) +pub fn lsx_vfcmp_seq_d(a: v2f64, b: v2f64) -> v2i64 { + unsafe { __lsx_vfcmp_seq_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfcmp_seq_s(a: v4f32, b: v4f32) -> v4i32 { - __lsx_vfcmp_seq_s(a, b) +pub fn lsx_vfcmp_seq_s(a: v4f32, b: v4f32) -> v4i32 { + unsafe { __lsx_vfcmp_seq_s(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfcmp_sle_d(a: v2f64, b: v2f64) -> v2i64 { - __lsx_vfcmp_sle_d(a, b) +pub fn lsx_vfcmp_sle_d(a: v2f64, b: v2f64) -> v2i64 { + unsafe { __lsx_vfcmp_sle_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfcmp_sle_s(a: v4f32, b: v4f32) -> v4i32 { - __lsx_vfcmp_sle_s(a, b) +pub fn lsx_vfcmp_sle_s(a: v4f32, b: v4f32) -> v4i32 { + unsafe { __lsx_vfcmp_sle_s(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfcmp_slt_d(a: v2f64, b: v2f64) -> v2i64 { - __lsx_vfcmp_slt_d(a, b) +pub fn lsx_vfcmp_slt_d(a: v2f64, b: v2f64) -> v2i64 { + unsafe { __lsx_vfcmp_slt_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfcmp_slt_s(a: v4f32, b: v4f32) -> v4i32 { - __lsx_vfcmp_slt_s(a, b) +pub fn lsx_vfcmp_slt_s(a: v4f32, b: v4f32) -> v4i32 { + unsafe { __lsx_vfcmp_slt_s(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfcmp_sne_d(a: v2f64, b: v2f64) -> v2i64 { - __lsx_vfcmp_sne_d(a, b) +pub fn lsx_vfcmp_sne_d(a: v2f64, b: v2f64) -> v2i64 { + unsafe { __lsx_vfcmp_sne_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfcmp_sne_s(a: v4f32, b: v4f32) -> v4i32 { - __lsx_vfcmp_sne_s(a, b) +pub fn lsx_vfcmp_sne_s(a: v4f32, b: v4f32) -> v4i32 { + unsafe { __lsx_vfcmp_sne_s(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfcmp_sor_d(a: v2f64, b: v2f64) -> v2i64 { - __lsx_vfcmp_sor_d(a, b) +pub fn lsx_vfcmp_sor_d(a: v2f64, b: v2f64) -> v2i64 { + unsafe { __lsx_vfcmp_sor_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfcmp_sor_s(a: v4f32, b: v4f32) -> v4i32 { - __lsx_vfcmp_sor_s(a, b) +pub fn lsx_vfcmp_sor_s(a: v4f32, b: v4f32) -> v4i32 { + unsafe { __lsx_vfcmp_sor_s(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfcmp_sueq_d(a: v2f64, b: v2f64) -> v2i64 { - __lsx_vfcmp_sueq_d(a, b) +pub fn lsx_vfcmp_sueq_d(a: v2f64, b: v2f64) -> v2i64 { + unsafe { __lsx_vfcmp_sueq_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfcmp_sueq_s(a: v4f32, b: v4f32) -> v4i32 { - __lsx_vfcmp_sueq_s(a, b) +pub fn lsx_vfcmp_sueq_s(a: v4f32, b: v4f32) -> v4i32 { + unsafe { __lsx_vfcmp_sueq_s(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfcmp_sule_d(a: v2f64, b: v2f64) -> v2i64 { - __lsx_vfcmp_sule_d(a, b) +pub fn lsx_vfcmp_sule_d(a: v2f64, b: v2f64) -> v2i64 { + unsafe { __lsx_vfcmp_sule_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfcmp_sule_s(a: v4f32, b: v4f32) -> v4i32 { - __lsx_vfcmp_sule_s(a, b) +pub fn lsx_vfcmp_sule_s(a: v4f32, b: v4f32) -> v4i32 { + unsafe { __lsx_vfcmp_sule_s(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfcmp_sult_d(a: v2f64, b: v2f64) -> v2i64 { - __lsx_vfcmp_sult_d(a, b) +pub fn lsx_vfcmp_sult_d(a: v2f64, b: v2f64) -> v2i64 { + unsafe { __lsx_vfcmp_sult_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfcmp_sult_s(a: v4f32, b: v4f32) -> v4i32 { - __lsx_vfcmp_sult_s(a, b) +pub fn lsx_vfcmp_sult_s(a: v4f32, b: v4f32) -> v4i32 { + unsafe { __lsx_vfcmp_sult_s(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfcmp_sun_d(a: v2f64, b: v2f64) -> v2i64 { - __lsx_vfcmp_sun_d(a, b) +pub fn lsx_vfcmp_sun_d(a: v2f64, b: v2f64) -> v2i64 { + unsafe { __lsx_vfcmp_sun_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfcmp_sune_d(a: v2f64, b: v2f64) -> v2i64 { - __lsx_vfcmp_sune_d(a, b) +pub fn lsx_vfcmp_sune_d(a: v2f64, b: v2f64) -> v2i64 { + unsafe { __lsx_vfcmp_sune_d(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfcmp_sune_s(a: v4f32, b: v4f32) -> v4i32 { - __lsx_vfcmp_sune_s(a, b) +pub fn lsx_vfcmp_sune_s(a: v4f32, b: v4f32) -> v4i32 { + unsafe { __lsx_vfcmp_sune_s(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vfcmp_sun_s(a: v4f32, b: v4f32) -> v4i32 { - __lsx_vfcmp_sun_s(a, b) +pub fn lsx_vfcmp_sun_s(a: v4f32, b: v4f32) -> v4i32 { + unsafe { __lsx_vfcmp_sun_s(a, b) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(0)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vrepli_b() -> v16i8 { +pub fn lsx_vrepli_b() -> v16i8 { static_assert_simm_bits!(IMM_S10, 10); - __lsx_vrepli_b(IMM_S10) + unsafe { __lsx_vrepli_b(IMM_S10) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(0)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vrepli_d() -> v2i64 { +pub fn lsx_vrepli_d() -> v2i64 { static_assert_simm_bits!(IMM_S10, 10); - __lsx_vrepli_d(IMM_S10) + unsafe { __lsx_vrepli_d(IMM_S10) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(0)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vrepli_h() -> v8i16 { +pub fn lsx_vrepli_h() -> v8i16 { static_assert_simm_bits!(IMM_S10, 10); - __lsx_vrepli_h(IMM_S10) + unsafe { __lsx_vrepli_h(IMM_S10) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(0)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vrepli_w() -> v4i32 { +pub fn lsx_vrepli_w() -> v4i32 { static_assert_simm_bits!(IMM_S10, 10); - __lsx_vrepli_w(IMM_S10) + unsafe { __lsx_vrepli_w(IMM_S10) } } diff --git a/library/stdarch/crates/stdarch-gen-loongarch/README.md b/library/stdarch/crates/stdarch-gen-loongarch/README.md index 1fc81483a12e..2b3f00f34aff 100644 --- a/library/stdarch/crates/stdarch-gen-loongarch/README.md +++ b/library/stdarch/crates/stdarch-gen-loongarch/README.md @@ -11,7 +11,6 @@ LSX: # Generate bindings OUT_DIR=`pwd`/crates/stdarch-gen-loongarch cargo run -p stdarch-gen-loongarch -- crates/stdarch-gen-loongarch/lsxintrin.h OUT_DIR=`pwd`/crates/core_arch cargo run -p stdarch-gen-loongarch -- crates/stdarch-gen-loongarch/lsx.spec -rustfmt crates/core_arch/src/loongarch64/lsx/generated.rs # Generate tests OUT_DIR=`pwd`/crates/stdarch-gen-loongarch cargo run -p stdarch-gen-loongarch -- crates/stdarch-gen-loongarch/lsx.spec test @@ -25,7 +24,6 @@ LASX: # Generate bindings OUT_DIR=`pwd`/crates/stdarch-gen-loongarch cargo run -p stdarch-gen-loongarch -- crates/stdarch-gen-loongarch/lasxintrin.h OUT_DIR=`pwd`/crates/core_arch cargo run -p stdarch-gen-loongarch -- crates/stdarch-gen-loongarch/lasx.spec -rustfmt crates/core_arch/src/loongarch64/lasx/generated.rs # Generate tests OUT_DIR=`pwd`/crates/stdarch-gen-loongarch cargo run -p stdarch-gen-loongarch -- crates/stdarch-gen-loongarch/lasx.spec test diff --git a/library/stdarch/crates/stdarch-gen-loongarch/src/main.rs b/library/stdarch/crates/stdarch-gen-loongarch/src/main.rs index aa9990b6ccd1..40132097f5de 100644 --- a/library/stdarch/crates/stdarch-gen-loongarch/src/main.rs +++ b/library/stdarch/crates/stdarch-gen-loongarch/src/main.rs @@ -274,13 +274,14 @@ fn gen_bind_body( } }; + let is_mem = in_t.iter().any(|s| s.contains("POINTER")); let is_store = current_name.to_string().contains("vst"); let link_function = { let fn_decl = { let fn_output = if out_t.to_lowercase() == "void" { String::new() } else { - format!("-> {}", type_to_rst(out_t, is_store)) + format!(" -> {}", type_to_rst(out_t, is_store)) }; let fn_inputs = match para_num { 1 => format!("(a: {})", type_to_rst(in_t[0], is_store)), @@ -304,7 +305,7 @@ fn gen_bind_body( ), _ => panic!("unsupported parameter number"), }; - format!("fn __{current_name}{fn_inputs} {fn_output};") + format!("fn __{current_name}{fn_inputs}{fn_output};") }; let function = format!( r#" #[link_name = "llvm.loongarch.{}"] @@ -456,31 +457,40 @@ fn gen_bind_body( }; rustc_legacy_const_generics = "rustc_legacy_const_generics(2, 3)"; } - format!("pub unsafe fn {current_name}{fn_inputs} {fn_output}") + format!( + "pub {}fn {current_name}{fn_inputs} {fn_output}", + if is_mem { "unsafe " } else { "" } + ) }; + let unsafe_start = if !is_mem { "unsafe { " } else { "" }; + let unsafe_end = if !is_mem { " }" } else { "" }; let mut call_params = { match para_num { - 1 => format!("__{current_name}(a)"), - 2 => format!("__{current_name}(a, b)"), - 3 => format!("__{current_name}(a, b, c)"), - 4 => format!("__{current_name}(a, b, c, d)"), + 1 => format!("{unsafe_start}__{current_name}(a){unsafe_end}"), + 2 => format!("{unsafe_start}__{current_name}(a, b){unsafe_end}"), + 3 => format!("{unsafe_start}__{current_name}(a, b, c){unsafe_end}"), + 4 => format!("{unsafe_start}__{current_name}(a, b, c, d){unsafe_end}"), _ => panic!("unsupported parameter number"), } }; if para_num == 1 && in_t[0] == "HI" { call_params = match asm_fmts[1].as_str() { "si10" => { - format!("static_assert_simm_bits!(IMM_S10, 10);\n __{current_name}(IMM_S10)") + format!( + "static_assert_simm_bits!(IMM_S10, 10);\n {unsafe_start}__{current_name}(IMM_S10){unsafe_end}" + ) } "i13" => { - format!("static_assert_simm_bits!(IMM_S13, 13);\n __{current_name}(IMM_S13)") + format!( + "static_assert_simm_bits!(IMM_S13, 13);\n {unsafe_start}__{current_name}(IMM_S13){unsafe_end}" + ) } _ => panic!("unsupported assembly format: {}", asm_fmts[2]), } } else if para_num == 2 && (in_t[1] == "UQI" || in_t[1] == "USI") { call_params = if asm_fmts[2].starts_with("ui") { format!( - "static_assert_uimm_bits!(IMM{0}, {0});\n __{current_name}(a, IMM{0})", + "static_assert_uimm_bits!(IMM{0}, {0});\n {unsafe_start}__{current_name}(a, IMM{0}){unsafe_end}", asm_fmts[2].get(2..).unwrap() ) } else { @@ -489,14 +499,16 @@ fn gen_bind_body( } else if para_num == 2 && in_t[1] == "QI" { call_params = match asm_fmts[2].as_str() { "si5" => { - format!("static_assert_simm_bits!(IMM_S5, 5);\n __{current_name}(a, IMM_S5)") + format!( + "static_assert_simm_bits!(IMM_S5, 5);\n {unsafe_start}__{current_name}(a, IMM_S5){unsafe_end}" + ) } _ => panic!("unsupported assembly format: {}", asm_fmts[2]), }; } else if para_num == 2 && in_t[0] == "CVPOINTER" && in_t[1] == "SI" { call_params = if asm_fmts[2].starts_with("si") { format!( - "static_assert_simm_bits!(IMM_S{0}, {0});\n __{current_name}(mem_addr, IMM_S{0})", + "static_assert_simm_bits!(IMM_S{0}, {0});\n {unsafe_start}__{current_name}(mem_addr, IMM_S{0}){unsafe_end}", asm_fmts[2].get(2..).unwrap() ) } else { @@ -504,13 +516,13 @@ fn gen_bind_body( } } else if para_num == 2 && in_t[0] == "CVPOINTER" && in_t[1] == "DI" { call_params = match asm_fmts[2].as_str() { - "rk" => format!("__{current_name}(mem_addr, b)"), + "rk" => format!("{unsafe_start}__{current_name}(mem_addr, b){unsafe_end}"), _ => panic!("unsupported assembly format: {}", asm_fmts[2]), }; } else if para_num == 3 && (in_t[2] == "USI" || in_t[2] == "UQI") { call_params = if asm_fmts[2].starts_with("ui") { format!( - "static_assert_uimm_bits!(IMM{0}, {0});\n __{current_name}(a, b, IMM{0})", + "static_assert_uimm_bits!(IMM{0}, {0});\n {unsafe_start}__{current_name}(a, b, IMM{0}){unsafe_end}", asm_fmts[2].get(2..).unwrap() ) } else { @@ -519,19 +531,19 @@ fn gen_bind_body( } else if para_num == 3 && in_t[1] == "CVPOINTER" && in_t[2] == "SI" { call_params = match asm_fmts[2].as_str() { "si12" => format!( - "static_assert_simm_bits!(IMM_S12, 12);\n __{current_name}(a, mem_addr, IMM_S12)" + "static_assert_simm_bits!(IMM_S12, 12);\n {unsafe_start}__{current_name}(a, mem_addr, IMM_S12){unsafe_end}" ), _ => panic!("unsupported assembly format: {}", asm_fmts[2]), }; } else if para_num == 3 && in_t[1] == "CVPOINTER" && in_t[2] == "DI" { call_params = match asm_fmts[2].as_str() { - "rk" => format!("__{current_name}(a, mem_addr, b)"), + "rk" => format!("{unsafe_start}__{current_name}(a, mem_addr, b){unsafe_end}"), _ => panic!("unsupported assembly format: {}", asm_fmts[2]), }; } else if para_num == 4 { call_params = match (asm_fmts[2].as_str(), current_name.chars().last().unwrap()) { ("si8", t) => format!( - "static_assert_simm_bits!(IMM_S8, 8);\n static_assert_uimm_bits!(IMM{0}, {0});\n __{current_name}(a, mem_addr, IMM_S8, IMM{0})", + "static_assert_simm_bits!(IMM_S8, 8);\n static_assert_uimm_bits!(IMM{0}, {0});\n {unsafe_start}__{current_name}(a, mem_addr, IMM_S8, IMM{0}){unsafe_end}", type_to_imm(t) ), (_, _) => panic!( From a2586f0c801aa52150925b4a66a517b1ffe13ddd Mon Sep 17 00:00:00 2001 From: binarycat Date: Mon, 23 Jun 2025 12:50:18 -0500 Subject: [PATCH 055/139] tidy: running of eslint, tsc, and es-check are now an extra check --- src/bootstrap/src/core/config/flags.rs | 2 +- src/etc/completions/x.fish | 6 +- src/etc/completions/x.ps1 | 6 +- src/etc/completions/x.py.fish | 6 +- src/etc/completions/x.py.ps1 | 6 +- src/etc/completions/x.py.zsh | 6 +- src/etc/completions/x.zsh | 6 +- src/tools/tidy/src/ext_tool_checks.rs | 37 ++++- .../tidy/src/ext_tool_checks/rustdoc_js.rs | 141 ++++++++++++++++++ src/tools/tidy/src/lib.rs | 1 - src/tools/tidy/src/main.rs | 4 +- src/tools/tidy/src/rustdoc_js.rs | 101 ------------- 12 files changed, 211 insertions(+), 111 deletions(-) create mode 100644 src/tools/tidy/src/ext_tool_checks/rustdoc_js.rs delete mode 100644 src/tools/tidy/src/rustdoc_js.rs diff --git a/src/bootstrap/src/core/config/flags.rs b/src/bootstrap/src/core/config/flags.rs index 1547ca444943..31a427f9ffaa 100644 --- a/src/bootstrap/src/core/config/flags.rs +++ b/src/bootstrap/src/core/config/flags.rs @@ -386,7 +386,7 @@ pub enum Subcommand { bless: bool, #[arg(long)] /// comma-separated list of other files types to check (accepts py, py:lint, - /// py:fmt, shell, shell:lint, cpp, cpp:fmt, spellcheck) + /// py:fmt, shell, cpp, cpp:fmt, js, js:lint, js:typecheck, spellcheck) /// /// Any argument can be prefixed with "auto:" to only run if /// relevant files are modified (eg. "auto:py"). diff --git a/src/etc/completions/x.fish b/src/etc/completions/x.fish index 28a228d54645..f4e7413ca53a 100644 --- a/src/etc/completions/x.fish +++ b/src/etc/completions/x.fish @@ -299,7 +299,11 @@ complete -c x -n "__fish_x_using_subcommand doc" -l skip-std-check-if-no-downloa complete -c x -n "__fish_x_using_subcommand doc" -s h -l help -d 'Print help (see more with \'--help\')' complete -c x -n "__fish_x_using_subcommand test" -l test-args -d 'extra arguments to be passed for the test tool being used (e.g. libtest, compiletest or rustdoc)' -r complete -c x -n "__fish_x_using_subcommand test" -l compiletest-rustc-args -d 'extra options to pass the compiler when running compiletest tests' -r -complete -c x -n "__fish_x_using_subcommand test" -l extra-checks -d 'comma-separated list of other files types to check (accepts py, py:lint, py:fmt, shell, shell:lint, cpp, cpp:fmt, spellcheck)' -r +<<<<<<< HEAD +complete -c x -n "__fish_x_using_subcommand test" -l extra-checks -d 'comma-separated list of other files types to check (accepts py, py:lint, py:fmt, shell, cpp, cpp:fmt, js, js:lint, js:typecheck, spellcheck)' -r +======= +complete -c x -n "__fish_x_using_subcommand test" -l extra-checks -d 'comma-separated list of other files types to check (accepts py, py:lint, py:fmt, shell, cpp, cpp:fmt, js, js:lint, js:typecheck)' -r +>>>>>>> 98204a1f527 (bootstrap: js:es-lint was removed, remove it from the docs) complete -c x -n "__fish_x_using_subcommand test" -l compare-mode -d 'mode describing what file the actual ui output will be compared to' -r complete -c x -n "__fish_x_using_subcommand test" -l pass -d 'force {check,build,run}-pass tests to this mode' -r complete -c x -n "__fish_x_using_subcommand test" -l run -d 'whether to execute run-* tests' -r diff --git a/src/etc/completions/x.ps1 b/src/etc/completions/x.ps1 index 0c9b38282731..fced6587d32a 100644 --- a/src/etc/completions/x.ps1 +++ b/src/etc/completions/x.ps1 @@ -345,7 +345,11 @@ Register-ArgumentCompleter -Native -CommandName 'x' -ScriptBlock { 'x;test' { [CompletionResult]::new('--test-args', '--test-args', [CompletionResultType]::ParameterName, 'extra arguments to be passed for the test tool being used (e.g. libtest, compiletest or rustdoc)') [CompletionResult]::new('--compiletest-rustc-args', '--compiletest-rustc-args', [CompletionResultType]::ParameterName, 'extra options to pass the compiler when running compiletest tests') - [CompletionResult]::new('--extra-checks', '--extra-checks', [CompletionResultType]::ParameterName, 'comma-separated list of other files types to check (accepts py, py:lint, py:fmt, shell, shell:lint, cpp, cpp:fmt, spellcheck)') +<<<<<<< HEAD + [CompletionResult]::new('--extra-checks', '--extra-checks', [CompletionResultType]::ParameterName, 'comma-separated list of other files types to check (accepts py, py:lint, py:fmt, shell, cpp, cpp:fmt, js, js:lint, js:typecheck, spellcheck)') +======= + [CompletionResult]::new('--extra-checks', '--extra-checks', [CompletionResultType]::ParameterName, 'comma-separated list of other files types to check (accepts py, py:lint, py:fmt, shell, cpp, cpp:fmt, js, js:lint, js:typecheck)') +>>>>>>> 98204a1f527 (bootstrap: js:es-lint was removed, remove it from the docs) [CompletionResult]::new('--compare-mode', '--compare-mode', [CompletionResultType]::ParameterName, 'mode describing what file the actual ui output will be compared to') [CompletionResult]::new('--pass', '--pass', [CompletionResultType]::ParameterName, 'force {check,build,run}-pass tests to this mode') [CompletionResult]::new('--run', '--run', [CompletionResultType]::ParameterName, 'whether to execute run-* tests') diff --git a/src/etc/completions/x.py.fish b/src/etc/completions/x.py.fish index 43ae7424e27b..c80750111f7b 100644 --- a/src/etc/completions/x.py.fish +++ b/src/etc/completions/x.py.fish @@ -299,7 +299,11 @@ complete -c x.py -n "__fish_x.py_using_subcommand doc" -l skip-std-check-if-no-d complete -c x.py -n "__fish_x.py_using_subcommand doc" -s h -l help -d 'Print help (see more with \'--help\')' complete -c x.py -n "__fish_x.py_using_subcommand test" -l test-args -d 'extra arguments to be passed for the test tool being used (e.g. libtest, compiletest or rustdoc)' -r complete -c x.py -n "__fish_x.py_using_subcommand test" -l compiletest-rustc-args -d 'extra options to pass the compiler when running compiletest tests' -r -complete -c x.py -n "__fish_x.py_using_subcommand test" -l extra-checks -d 'comma-separated list of other files types to check (accepts py, py:lint, py:fmt, shell, shell:lint, cpp, cpp:fmt, spellcheck)' -r +<<<<<<< HEAD +complete -c x.py -n "__fish_x.py_using_subcommand test" -l extra-checks -d 'comma-separated list of other files types to check (accepts py, py:lint, py:fmt, shell, cpp, cpp:fmt, js, js:lint, js:typecheck, spellcheck)' -r +======= +complete -c x.py -n "__fish_x.py_using_subcommand test" -l extra-checks -d 'comma-separated list of other files types to check (accepts py, py:lint, py:fmt, shell, cpp, cpp:fmt, js, js:lint, js:typecheck)' -r +>>>>>>> 98204a1f527 (bootstrap: js:es-lint was removed, remove it from the docs) complete -c x.py -n "__fish_x.py_using_subcommand test" -l compare-mode -d 'mode describing what file the actual ui output will be compared to' -r complete -c x.py -n "__fish_x.py_using_subcommand test" -l pass -d 'force {check,build,run}-pass tests to this mode' -r complete -c x.py -n "__fish_x.py_using_subcommand test" -l run -d 'whether to execute run-* tests' -r diff --git a/src/etc/completions/x.py.ps1 b/src/etc/completions/x.py.ps1 index 4311e383d640..dfb6482b41c8 100644 --- a/src/etc/completions/x.py.ps1 +++ b/src/etc/completions/x.py.ps1 @@ -345,7 +345,11 @@ Register-ArgumentCompleter -Native -CommandName 'x.py' -ScriptBlock { 'x.py;test' { [CompletionResult]::new('--test-args', '--test-args', [CompletionResultType]::ParameterName, 'extra arguments to be passed for the test tool being used (e.g. libtest, compiletest or rustdoc)') [CompletionResult]::new('--compiletest-rustc-args', '--compiletest-rustc-args', [CompletionResultType]::ParameterName, 'extra options to pass the compiler when running compiletest tests') - [CompletionResult]::new('--extra-checks', '--extra-checks', [CompletionResultType]::ParameterName, 'comma-separated list of other files types to check (accepts py, py:lint, py:fmt, shell, shell:lint, cpp, cpp:fmt, spellcheck)') +<<<<<<< HEAD + [CompletionResult]::new('--extra-checks', '--extra-checks', [CompletionResultType]::ParameterName, 'comma-separated list of other files types to check (accepts py, py:lint, py:fmt, shell, cpp, cpp:fmt, js, js:lint, js:typecheck, spellcheck)') +======= + [CompletionResult]::new('--extra-checks', '--extra-checks', [CompletionResultType]::ParameterName, 'comma-separated list of other files types to check (accepts py, py:lint, py:fmt, shell, cpp, cpp:fmt, js, js:lint, js:typecheck)') +>>>>>>> 98204a1f527 (bootstrap: js:es-lint was removed, remove it from the docs) [CompletionResult]::new('--compare-mode', '--compare-mode', [CompletionResultType]::ParameterName, 'mode describing what file the actual ui output will be compared to') [CompletionResult]::new('--pass', '--pass', [CompletionResultType]::ParameterName, 'force {check,build,run}-pass tests to this mode') [CompletionResult]::new('--run', '--run', [CompletionResultType]::ParameterName, 'whether to execute run-* tests') diff --git a/src/etc/completions/x.py.zsh b/src/etc/completions/x.py.zsh index aff35b31e212..8ccc7a7091ce 100644 --- a/src/etc/completions/x.py.zsh +++ b/src/etc/completions/x.py.zsh @@ -345,7 +345,11 @@ _arguments "${_arguments_options[@]}" : \ _arguments "${_arguments_options[@]}" : \ '*--test-args=[extra arguments to be passed for the test tool being used (e.g. libtest, compiletest or rustdoc)]:ARGS:_default' \ '*--compiletest-rustc-args=[extra options to pass the compiler when running compiletest tests]:ARGS:_default' \ -'--extra-checks=[comma-separated list of other files types to check (accepts py, py\:lint, py\:fmt, shell, shell\:lint, cpp, cpp\:fmt, spellcheck)]:EXTRA_CHECKS:_default' \ +<<<<<<< HEAD +'--extra-checks=[comma-separated list of other files types to check (accepts py, py\:lint, py\:fmt, shell, cpp, cpp\:fmt, js, js\:lint, js\:typecheck, spellcheck)]:EXTRA_CHECKS:_default' \ +======= +'--extra-checks=[comma-separated list of other files types to check (accepts py, py\:lint, py\:fmt, shell, cpp, cpp\:fmt, js, js\:lint, js\:typecheck)]:EXTRA_CHECKS:_default' \ +>>>>>>> 98204a1f527 (bootstrap: js:es-lint was removed, remove it from the docs) '--compare-mode=[mode describing what file the actual ui output will be compared to]:COMPARE MODE:_default' \ '--pass=[force {check,build,run}-pass tests to this mode]:check | build | run:_default' \ '--run=[whether to execute run-* tests]:auto | always | never:_default' \ diff --git a/src/etc/completions/x.zsh b/src/etc/completions/x.zsh index 28ad00f3a0de..8c00abb7b21a 100644 --- a/src/etc/completions/x.zsh +++ b/src/etc/completions/x.zsh @@ -345,7 +345,11 @@ _arguments "${_arguments_options[@]}" : \ _arguments "${_arguments_options[@]}" : \ '*--test-args=[extra arguments to be passed for the test tool being used (e.g. libtest, compiletest or rustdoc)]:ARGS:_default' \ '*--compiletest-rustc-args=[extra options to pass the compiler when running compiletest tests]:ARGS:_default' \ -'--extra-checks=[comma-separated list of other files types to check (accepts py, py\:lint, py\:fmt, shell, shell\:lint, cpp, cpp\:fmt, spellcheck)]:EXTRA_CHECKS:_default' \ +<<<<<<< HEAD +'--extra-checks=[comma-separated list of other files types to check (accepts py, py\:lint, py\:fmt, shell, cpp, cpp\:fmt, js, js\:lint, js\:typecheck, spellcheck)]:EXTRA_CHECKS:_default' \ +======= +'--extra-checks=[comma-separated list of other files types to check (accepts py, py\:lint, py\:fmt, shell, cpp, cpp\:fmt, js, js\:lint, js\:typecheck)]:EXTRA_CHECKS:_default' \ +>>>>>>> 98204a1f527 (bootstrap: js:es-lint was removed, remove it from the docs) '--compare-mode=[mode describing what file the actual ui output will be compared to]:COMPARE MODE:_default' \ '--pass=[force {check,build,run}-pass tests to this mode]:check | build | run:_default' \ '--run=[whether to execute run-* tests]:auto | always | never:_default' \ diff --git a/src/tools/tidy/src/ext_tool_checks.rs b/src/tools/tidy/src/ext_tool_checks.rs index 381ea44fd46d..03ed0b00f3ef 100644 --- a/src/tools/tidy/src/ext_tool_checks.rs +++ b/src/tools/tidy/src/ext_tool_checks.rs @@ -25,6 +25,8 @@ use std::{fmt, fs, io}; use crate::CiInfo; +mod rustdoc_js; + const MIN_PY_REV: (u32, u32) = (3, 9); const MIN_PY_REV_STR: &str = "≥3.9"; @@ -46,12 +48,25 @@ pub fn check( root_path: &Path, outdir: &Path, ci_info: &CiInfo, + librustdoc_path: &Path, + tools_path: &Path, + src_path: &Path, bless: bool, extra_checks: Option<&str>, pos_args: &[String], bad: &mut bool, ) { - if let Err(e) = check_impl(root_path, outdir, ci_info, bless, extra_checks, pos_args) { + if let Err(e) = check_impl( + root_path, + outdir, + ci_info, + librustdoc_path, + tools_path, + src_path, + bless, + extra_checks, + pos_args, + ) { tidy_error!(bad, "{e}"); } } @@ -60,6 +75,9 @@ fn check_impl( root_path: &Path, outdir: &Path, ci_info: &CiInfo, + librustdoc_path: &Path, + tools_path: &Path, + src_path: &Path, bless: bool, extra_checks: Option<&str>, pos_args: &[String], @@ -108,6 +126,8 @@ fn check_impl( let shell_lint = extra_check!(Shell, Lint); let cpp_fmt = extra_check!(Cpp, Fmt); let spellcheck = extra_check!(Spellcheck, None); + let js_lint = extra_check!(Js, Lint); + let js_typecheck = extra_check!(Js, Typecheck); let mut py_path = None; @@ -275,6 +295,15 @@ fn check_impl( spellcheck_runner(&args)?; } + if js_lint { + rustdoc_js::lint(librustdoc_path, tools_path, src_path)?; + rustdoc_js::es_check(librustdoc_path)?; + } + + if js_typecheck { + rustdoc_js::typecheck(librustdoc_path)?; + } + Ok(()) } @@ -697,6 +726,7 @@ impl ExtraCheckArg { ExtraCheckLang::Py => ".py", ExtraCheckLang::Cpp => ".cpp", ExtraCheckLang::Shell => ".sh", + ExtraCheckLang::Js => ".js", ExtraCheckLang::Spellcheck => { return !crate::files_modified(ci_info, |s| { SPELLCHECK_DIRS.iter().any(|dir| Path::new(s).starts_with(dir)) @@ -717,6 +747,7 @@ impl ExtraCheckArg { ExtraCheckLang::Cpp => &[Fmt], ExtraCheckLang::Shell => &[Lint], ExtraCheckLang::Spellcheck => &[], + ExtraCheckLang::Js => &[Lint, Typecheck], }; supported_kinds.contains(&kind) } @@ -757,6 +788,7 @@ enum ExtraCheckLang { Shell, Cpp, Spellcheck, + Js, } impl FromStr for ExtraCheckLang { @@ -768,6 +800,7 @@ impl FromStr for ExtraCheckLang { "shell" => Self::Shell, "cpp" => Self::Cpp, "spellcheck" => Self::Spellcheck, + "js" => Self::Js, _ => return Err(ExtraCheckParseError::UnknownLang(s.to_string())), }) } @@ -777,6 +810,7 @@ impl FromStr for ExtraCheckLang { enum ExtraCheckKind { Lint, Fmt, + Typecheck, /// Never parsed, but used as a placeholder for /// langs that never have a specific kind. None, @@ -789,6 +823,7 @@ impl FromStr for ExtraCheckKind { Ok(match s { "lint" => Self::Lint, "fmt" => Self::Fmt, + "typecheck" => Self::Typecheck, _ => return Err(ExtraCheckParseError::UnknownKind(s.to_string())), }) } diff --git a/src/tools/tidy/src/ext_tool_checks/rustdoc_js.rs b/src/tools/tidy/src/ext_tool_checks/rustdoc_js.rs new file mode 100644 index 000000000000..24be26ffbd91 --- /dev/null +++ b/src/tools/tidy/src/ext_tool_checks/rustdoc_js.rs @@ -0,0 +1,141 @@ +//! Tidy check to ensure that rustdoc templates didn't forget a `{# #}` to strip extra whitespace +//! characters. + +use std::ffi::OsStr; +use std::path::{Path, PathBuf}; +use std::process::Command; + +use ignore::DirEntry; + +use crate::walk::walk_no_read; + +fn rustdoc_js_files(librustdoc_path: &Path) -> Vec { + let mut files = Vec::new(); + walk_no_read( + &[&librustdoc_path.join("html/static/js")], + |path, is_dir| is_dir || path.extension().is_none_or(|ext| ext != OsStr::new("js")), + &mut |path: &DirEntry| { + files.push(path.path().into()); + }, + ); + return files; +} + +fn run_eslint(args: &[PathBuf], config_folder: PathBuf) -> Result<(), super::Error> { + let mut child = Command::new("npx") + .arg("eslint") + .arg("-c") + .arg(config_folder.join(".eslintrc.js")) + .args(args) + .spawn()?; + match child.wait() { + Ok(exit_status) => { + if exit_status.success() { + return Ok(()); + } + Err(super::Error::FailedCheck("eslint command failed")) + } + Err(error) => Err(super::Error::Generic(format!("eslint command failed: {error:?}"))), + } +} + +fn get_eslint_version_inner(global: bool) -> Option { + let mut command = Command::new("npm"); + command.arg("list").arg("--parseable").arg("--long").arg("--depth=0"); + if global { + command.arg("--global"); + } + let output = command.output().ok()?; + let lines = String::from_utf8_lossy(&output.stdout); + lines.lines().find_map(|l| l.split(':').nth(1)?.strip_prefix("eslint@")).map(|v| v.to_owned()) +} + +fn get_eslint_version() -> Option { + get_eslint_version_inner(false).or_else(|| get_eslint_version_inner(true)) +} + +pub(super) fn lint( + librustdoc_path: &Path, + tools_path: &Path, + src_path: &Path, +) -> Result<(), super::Error> { + let eslint_version_path = src_path.join("ci/docker/host-x86_64/tidy/eslint.version"); + let eslint_version = match std::fs::read_to_string(&eslint_version_path) { + Ok(version) => version.trim().to_string(), + Err(error) => { + eprintln!("failed to read `{}`: {error:?}", eslint_version_path.display()); + return Err(error.into()); + } + }; + // Having the correct `eslint` version installed via `npm` isn't strictly necessary, since we're invoking it via `npx`, + // but this check allows the vast majority that is not working on the rustdoc frontend to avoid the penalty of running + // `eslint` in tidy. See also: https://github.com/rust-lang/rust/pull/142851 + match get_eslint_version() { + Some(version) => { + if version != eslint_version { + // unfortunatly we can't use `Error::Version` here becuse `str::trim` isn't const and + // Version::required must be a static str + return Err(super::Error::Generic(format!( + "⚠️ Installed version of eslint (`{version}`) is different than the \ + one used in the CI (`{eslint_version}`)\n\ + You can install this version using `npm update eslint` or by using \ + `npm install eslint@{eslint_version}`\n +" + ))); + } + } + None => { + //eprintln!("`eslint` doesn't seem to be installed. Skipping tidy check for JS files."); + //eprintln!("You can install it using `npm install eslint@{eslint_version}`"); + return Err(super::Error::MissingReq( + "eslint", + "js lint checks", + Some(format!("You can install it using `npm install eslint@{eslint_version}`")), + )); + } + } + let files_to_check = rustdoc_js_files(librustdoc_path); + println!("Running eslint on rustdoc JS files"); + run_eslint(&files_to_check, librustdoc_path.join("html/static"))?; + + run_eslint(&[tools_path.join("rustdoc-js/tester.js")], tools_path.join("rustdoc-js"))?; + run_eslint(&[tools_path.join("rustdoc-gui/tester.js")], tools_path.join("rustdoc-gui"))?; + Ok(()) +} + +pub(super) fn typecheck(librustdoc_path: &Path) -> Result<(), super::Error> { + // use npx to ensure correct version + let mut child = Command::new("npx") + .arg("tsc") + .arg("-p") + .arg(librustdoc_path.join("html/static/js/tsconfig.json")) + .spawn()?; + match child.wait() { + Ok(exit_status) => { + if exit_status.success() { + return Ok(()); + } + Err(super::Error::FailedCheck("tsc command failed")) + } + Err(error) => Err(super::Error::Generic(format!("tsc command failed: {error:?}"))), + } +} + +pub(super) fn es_check(librustdoc_path: &Path) -> Result<(), super::Error> { + let files_to_check = rustdoc_js_files(librustdoc_path); + // use npx to ensure correct version + let mut cmd = Command::new("npx"); + cmd.arg("es-check").arg("es2019"); + for f in files_to_check { + cmd.arg(f); + } + match cmd.spawn()?.wait() { + Ok(exit_status) => { + if exit_status.success() { + return Ok(()); + } + Err(super::Error::FailedCheck("es-check command failed")) + } + Err(error) => Err(super::Error::Generic(format!("es-check command failed: {error:?}"))), + } +} diff --git a/src/tools/tidy/src/lib.rs b/src/tools/tidy/src/lib.rs index ade4055b5bd1..4db74cbf61c7 100644 --- a/src/tools/tidy/src/lib.rs +++ b/src/tools/tidy/src/lib.rs @@ -178,7 +178,6 @@ pub mod mir_opt_tests; pub mod pal; pub mod rustdoc_css_themes; pub mod rustdoc_gui_tests; -pub mod rustdoc_js; pub mod rustdoc_json; pub mod rustdoc_templates; pub mod style; diff --git a/src/tools/tidy/src/main.rs b/src/tools/tidy/src/main.rs index 0f1116a632e2..358a03dd18c1 100644 --- a/src/tools/tidy/src/main.rs +++ b/src/tools/tidy/src/main.rs @@ -112,7 +112,6 @@ fn main() { check!(rustdoc_gui_tests, &tests_path); check!(rustdoc_css_themes, &librustdoc_path); check!(rustdoc_templates, &librustdoc_path); - check!(rustdoc_js, &librustdoc_path, &tools_path, &src_path); check!(rustdoc_json, &src_path, &ci_info); check!(known_bug, &crashes_path); check!(unknown_revision, &tests_path); @@ -181,6 +180,9 @@ fn main() { &root_path, &output_directory, &ci_info, + &librustdoc_path, + &tools_path, + &src_path, bless, extra_checks, pos_args diff --git a/src/tools/tidy/src/rustdoc_js.rs b/src/tools/tidy/src/rustdoc_js.rs deleted file mode 100644 index 5737fcbafc02..000000000000 --- a/src/tools/tidy/src/rustdoc_js.rs +++ /dev/null @@ -1,101 +0,0 @@ -//! Tidy check to ensure that rustdoc templates didn't forget a `{# #}` to strip extra whitespace -//! characters. - -use std::ffi::OsStr; -use std::path::{Path, PathBuf}; -use std::process::Command; - -use ignore::DirEntry; - -use crate::walk::walk_no_read; - -fn run_eslint(args: &[PathBuf], config_folder: PathBuf, bad: &mut bool) { - let mut child = match Command::new("npx") - .arg("eslint") - .arg("-c") - .arg(config_folder.join(".eslintrc.js")) - .args(args) - .spawn() - { - Ok(child) => child, - Err(error) => { - *bad = true; - eprintln!("failed to run eslint: {error:?}"); - return; - } - }; - match child.wait() { - Ok(exit_status) => { - if exit_status.success() { - return; - } - eprintln!("eslint command failed"); - } - Err(error) => eprintln!("eslint command failed: {error:?}"), - } - *bad = true; -} - -fn get_eslint_version_inner(global: bool) -> Option { - let mut command = Command::new("npm"); - command.arg("list").arg("--parseable").arg("--long").arg("--depth=0"); - if global { - command.arg("--global"); - } - let output = command.output().ok()?; - let lines = String::from_utf8_lossy(&output.stdout); - lines.lines().find_map(|l| l.split(':').nth(1)?.strip_prefix("eslint@")).map(|v| v.to_owned()) -} - -fn get_eslint_version() -> Option { - get_eslint_version_inner(false).or_else(|| get_eslint_version_inner(true)) -} - -pub fn check(librustdoc_path: &Path, tools_path: &Path, src_path: &Path, bad: &mut bool) { - let eslint_version_path = src_path.join("ci/docker/host-x86_64/tidy/eslint.version"); - let eslint_version = match std::fs::read_to_string(&eslint_version_path) { - Ok(version) => version.trim().to_string(), - Err(error) => { - *bad = true; - eprintln!("failed to read `{}`: {error:?}", eslint_version_path.display()); - return; - } - }; - // Having the correct `eslint` version installed via `npm` isn't strictly necessary, since we're invoking it via `npx`, - // but this check allows the vast majority that is not working on the rustdoc frontend to avoid the penalty of running - // `eslint` in tidy. See also: https://github.com/rust-lang/rust/pull/142851 - match get_eslint_version() { - Some(version) => { - if version != eslint_version { - *bad = true; - eprintln!( - "⚠️ Installed version of eslint (`{version}`) is different than the \ - one used in the CI (`{eslint_version}`)", - ); - eprintln!( - "You can install this version using `npm update eslint` or by using \ - `npm install eslint@{eslint_version}`", - ); - return; - } - } - None => { - eprintln!("`eslint` doesn't seem to be installed. Skipping tidy check for JS files."); - eprintln!("You can install it using `npm install eslint@{eslint_version}`"); - return; - } - } - let mut files_to_check = Vec::new(); - walk_no_read( - &[&librustdoc_path.join("html/static/js")], - |path, is_dir| is_dir || path.extension().is_none_or(|ext| ext != OsStr::new("js")), - &mut |path: &DirEntry| { - files_to_check.push(path.path().into()); - }, - ); - println!("Running eslint on rustdoc JS files"); - run_eslint(&files_to_check, librustdoc_path.join("html/static"), bad); - - run_eslint(&[tools_path.join("rustdoc-js/tester.js")], tools_path.join("rustdoc-js"), bad); - run_eslint(&[tools_path.join("rustdoc-gui/tester.js")], tools_path.join("rustdoc-gui"), bad); -} From 4bd3b74aa9ec4a21507d73f712186619baf93ba0 Mon Sep 17 00:00:00 2001 From: binarycat Date: Mon, 23 Jun 2025 12:57:16 -0500 Subject: [PATCH 056/139] update CI to use new tidy extra checks for rustdoc js --- src/ci/docker/host-x86_64/pr-check-1/Dockerfile | 5 +---- src/ci/docker/host-x86_64/tidy/Dockerfile | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/ci/docker/host-x86_64/pr-check-1/Dockerfile b/src/ci/docker/host-x86_64/pr-check-1/Dockerfile index 8bbcc18e2bef..e63a383ec997 100644 --- a/src/ci/docker/host-x86_64/pr-check-1/Dockerfile +++ b/src/ci/docker/host-x86_64/pr-check-1/Dockerfile @@ -52,7 +52,4 @@ ENV SCRIPT \ python3 ../x.py check --set build.optimized-compiler-builtins=false core alloc std --target=aarch64-unknown-linux-gnu,i686-pc-windows-msvc,i686-unknown-linux-gnu,x86_64-apple-darwin,x86_64-pc-windows-gnu,x86_64-pc-windows-msvc && \ /scripts/validate-toolstate.sh && \ reuse --include-submodules lint && \ - python3 ../x.py test collect-license-metadata && \ - # Runs checks to ensure that there are no issues in our JS code. - es-check es2019 ../src/librustdoc/html/static/js/*.js && \ - tsc --project ../src/librustdoc/html/static/js/tsconfig.json + python3 ../x.py test collect-license-metadata diff --git a/src/ci/docker/host-x86_64/tidy/Dockerfile b/src/ci/docker/host-x86_64/tidy/Dockerfile index dbb950cbe0cd..ee1ae5410ee8 100644 --- a/src/ci/docker/host-x86_64/tidy/Dockerfile +++ b/src/ci/docker/host-x86_64/tidy/Dockerfile @@ -45,4 +45,4 @@ RUN bash -c 'npm install -g eslint@$(cat /tmp/eslint.version)' # NOTE: intentionally uses python2 for x.py so we can test it still works. # validate-toolstate only runs in our CI, so it's ok for it to only support python3. ENV SCRIPT TIDY_PRINT_DIFF=1 python2.7 ../x.py test --stage 0 \ - src/tools/tidy tidyselftest --extra-checks=py,cpp + src/tools/tidy tidyselftest --extra-checks=py,cpp,js From c8e2a65ed16b948819cee23d883d8e598665318b Mon Sep 17 00:00:00 2001 From: binarycat Date: Fri, 27 Jun 2025 14:29:39 -0500 Subject: [PATCH 057/139] tidy: use a lockfile for js tools instead of npx this makes us less vulnerable to MITM and supply chain attacks. it also means that the CI scripts are no longer responsible for tracking the versions of these tools. it should also avoid the situation where local tsc and CI disagree on the presense of errors due to them being different versions. --- .gitignore | 2 - package-lock.json | 3232 +++++++++++++++++ package.json | 9 + .../docker/host-x86_64/pr-check-1/Dockerfile | 4 - src/tools/tidy/src/ext_tool_checks.rs | 13 +- .../tidy/src/ext_tool_checks/rustdoc_js.rs | 148 +- src/tools/tidy/src/main.rs | 1 - 7 files changed, 3323 insertions(+), 86 deletions(-) create mode 100644 package-lock.json create mode 100644 package.json diff --git a/.gitignore b/.gitignore index a549b6e6e56c..5988a64916ad 100644 --- a/.gitignore +++ b/.gitignore @@ -85,8 +85,6 @@ __pycache__/ ## Node node_modules -package-lock.json -package.json /src/doc/rustc-dev-guide/mermaid.min.js ## Rustdoc GUI tests diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 000000000000..dbdd9c644f14 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,3232 @@ +{ + "name": "rust", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "dependencies": { + "browser-ui-test": "^0.21.1", + "es-check": "^6.2.1", + "eslint": "^8.57.1", + "eslint-js": "github:eslint/js", + "typescript": "^5.8.3" + } + }, + "node_modules/@babel/code-frame": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.27.1.tgz", + "integrity": "sha512-cjQ7ZlQ0Mv3b47hABuTevyTuYN4i+loJKGeV9flcCgIK37cCXRh+L1bd3iBHlynerhQ7BhCkn2BPbQUL+rGqFg==", + "license": "MIT", + "dependencies": { + "@babel/helper-validator-identifier": "^7.27.1", + "js-tokens": "^4.0.0", + "picocolors": "^1.1.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.27.1.tgz", + "integrity": "sha512-D2hP9eA+Sqx1kBZgzxZh0y1trbuU+JoDkiEwqhQ36nodYqJwyEIhPSdMNd7lOm/4io72luTPWH20Yda0xOuUow==", + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@caporal/core": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/@caporal/core/-/core-2.0.7.tgz", + "integrity": "sha512-OvKBEidoXUGT28RP3USXFdLgiR5kGCHfRXR1uBQznyxBHaWjGcpH+G1chRqyIVT82pQoJiauOZRIGlrpyAbRYQ==", + "license": "MIT", + "dependencies": { + "@types/glob": "^7.1.1", + "@types/lodash": "^4.14.149", + "@types/node": "13.9.3", + "@types/table": "^5.0.0", + "@types/tabtab": "^3.0.1", + "@types/wrap-ansi": "^3.0.0", + "chalk": "^3.0.0", + "glob": "^7.1.6", + "lodash": "^4.17.21", + "table": "^5.4.6", + "tabtab": "^3.0.2", + "winston": "^3.2.1", + "wrap-ansi": "^6.2.0" + }, + "engines": { + "node": ">= 10" + } + }, + "node_modules/@colors/colors": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@colors/colors/-/colors-1.6.0.tgz", + "integrity": "sha512-Ir+AOibqzrIsL6ajt3Rz3LskB7OiMVHqltZmspbW/TJuTVuyOMirVqAkjfY6JISiLHgyNqicAC8AyHHGzNd/dA==", + "license": "MIT", + "engines": { + "node": ">=0.1.90" + } + }, + "node_modules/@dabh/diagnostics": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@dabh/diagnostics/-/diagnostics-2.0.3.tgz", + "integrity": "sha512-hrlQOIi7hAfzsMqlGSFyVucrx38O+j6wiGOf//H2ecvIEqYN4ADBSS2iLMh5UFyDunCNniUIPk/q3riFv45xRA==", + "license": "MIT", + "dependencies": { + "colorspace": "1.1.x", + "enabled": "2.0.x", + "kuler": "^2.0.0" + } + }, + "node_modules/@eslint-community/eslint-utils": { + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.7.0.tgz", + "integrity": "sha512-dyybb3AcajC7uha6CvhdVRJqaKyn7w2YKqKyAN37NKYgZT36w+iRb0Dymmc5qEJ549c/S31cMMSFd75bteCpCw==", + "license": "MIT", + "dependencies": { + "eslint-visitor-keys": "^3.4.3" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" + } + }, + "node_modules/@eslint-community/regexpp": { + "version": "4.12.1", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.12.1.tgz", + "integrity": "sha512-CCZCDJuduB9OUkFkY2IgppNZMi2lBQgD2qzwXkEia16cge2pijY/aXi96CJMquDMn3nJdlPV1A5KrJEXwfLNzQ==", + "license": "MIT", + "engines": { + "node": "^12.0.0 || ^14.0.0 || >=16.0.0" + } + }, + "node_modules/@eslint/eslintrc": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.4.tgz", + "integrity": "sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==", + "license": "MIT", + "dependencies": { + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^9.6.0", + "globals": "^13.19.0", + "ignore": "^5.2.0", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.0", + "minimatch": "^3.1.2", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint/js": { + "version": "8.57.1", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.57.1.tgz", + "integrity": "sha512-d9zaMRSTIKDLhctzH12MtXvJKSSUhaHcjV+2Z+GK+EEY7XKpP5yR4x+N3TAcHTcu963nIr+TMcCb4DBCYX1z6Q==", + "license": "MIT", + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/@humanwhocodes/config-array": { + "version": "0.13.0", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.13.0.tgz", + "integrity": "sha512-DZLEEqFWQFiyK6h5YIeynKx7JlvCYWL0cImfSRXZ9l4Sg2efkFGTuFf6vzXjK1cq6IYkU+Eg/JizXw+TD2vRNw==", + "deprecated": "Use @eslint/config-array instead", + "license": "Apache-2.0", + "dependencies": { + "@humanwhocodes/object-schema": "^2.0.3", + "debug": "^4.3.1", + "minimatch": "^3.0.5" + }, + "engines": { + "node": ">=10.10.0" + } + }, + "node_modules/@humanwhocodes/module-importer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", + "license": "Apache-2.0", + "engines": { + "node": ">=12.22" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@humanwhocodes/object-schema": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.3.tgz", + "integrity": "sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA==", + "deprecated": "Use @eslint/object-schema instead", + "license": "BSD-3-Clause" + }, + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "license": "MIT", + "dependencies": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "license": "MIT", + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "license": "MIT", + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@puppeteer/browsers": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@puppeteer/browsers/-/browsers-2.3.0.tgz", + "integrity": "sha512-ioXoq9gPxkss4MYhD+SFaU9p1IHFUX0ILAWFPyjGaBdjLsYAlZw6j1iLA0N/m12uVHLFDfSYNF7EQccjinIMDA==", + "license": "Apache-2.0", + "dependencies": { + "debug": "^4.3.5", + "extract-zip": "^2.0.1", + "progress": "^2.0.3", + "proxy-agent": "^6.4.0", + "semver": "^7.6.3", + "tar-fs": "^3.0.6", + "unbzip2-stream": "^1.4.3", + "yargs": "^17.7.2" + }, + "bin": { + "browsers": "lib/cjs/main-cli.js" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@tootallnate/quickjs-emscripten": { + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@tootallnate/quickjs-emscripten/-/quickjs-emscripten-0.23.0.tgz", + "integrity": "sha512-C5Mc6rdnsaJDjO3UpGW/CQTHtCKaYlScZTly4JIu97Jxo/odCiH0ITnDXSJPTOrEKk/ycSZ0AOgTmkDtkOsvIA==", + "license": "MIT" + }, + "node_modules/@types/glob": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.2.0.tgz", + "integrity": "sha512-ZUxbzKl0IfJILTS6t7ip5fQQM/J3TJYubDm3nMbgubNNYS62eXeUpoLUC8/7fJNiFYHTrGPQn7hspDUzIHX3UA==", + "license": "MIT", + "dependencies": { + "@types/minimatch": "*", + "@types/node": "*" + } + }, + "node_modules/@types/lodash": { + "version": "4.17.20", + "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.17.20.tgz", + "integrity": "sha512-H3MHACvFUEiujabxhaI/ImO6gUrd8oOurg7LQtS7mbwIXA/cUqWrvBsaeJ23aZEPk1TAYkurjfMbSELfoCXlGA==", + "license": "MIT" + }, + "node_modules/@types/minimatch": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-5.1.2.tgz", + "integrity": "sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA==", + "license": "MIT" + }, + "node_modules/@types/node": { + "version": "13.9.3", + "resolved": "https://registry.npmjs.org/@types/node/-/node-13.9.3.tgz", + "integrity": "sha512-01s+ac4qerwd6RHD+mVbOEsraDHSgUaefQlEdBbUolnQFjKwCr7luvAlEwW1RFojh67u0z4OUTjPn9LEl4zIkA==", + "license": "MIT" + }, + "node_modules/@types/table": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@types/table/-/table-5.0.0.tgz", + "integrity": "sha512-fQLtGLZXor264zUPWI95WNDsZ3QV43/c0lJpR/h1hhLJumXRmHNsrvBfEzW2YMhb0EWCsn4U6h82IgwsajAuTA==", + "license": "MIT" + }, + "node_modules/@types/tabtab": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@types/tabtab/-/tabtab-3.0.4.tgz", + "integrity": "sha512-gmh8JsmIYPGRqk8Xb4dmulV37TpLwg0Quo3GJ0LgEcl4v0O92F14PGebBd7LHv9GBEw2KbmBSrvU0/NzIy5AoA==", + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/triple-beam": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/@types/triple-beam/-/triple-beam-1.3.5.tgz", + "integrity": "sha512-6WaYesThRMCl19iryMYP7/x2OVgCtbIVflDGFpWnb9irXI3UjYE4AzmYuiUKY1AJstGijoY+MgUszMgRxIYTYw==", + "license": "MIT" + }, + "node_modules/@types/wrap-ansi": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@types/wrap-ansi/-/wrap-ansi-3.0.0.tgz", + "integrity": "sha512-ltIpx+kM7g/MLRZfkbL7EsCEjfzCcScLpkg37eXEtx5kmrAKBkTJwd1GIAjDSL8wTpM6Hzn5YO4pSb91BEwu1g==", + "license": "MIT" + }, + "node_modules/@types/yauzl": { + "version": "2.10.3", + "resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.10.3.tgz", + "integrity": "sha512-oJoftv0LSuaDZE3Le4DbKX+KS9G36NzOeSap90UIK0yMA/NhKJhqlSGtNDORNRaIbQfzjXDrQa0ytJ6mNRGz/Q==", + "license": "MIT", + "optional": true, + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@ungap/structured-clone": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.3.0.tgz", + "integrity": "sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g==", + "license": "ISC" + }, + "node_modules/acorn": { + "version": "8.15.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz", + "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", + "license": "MIT", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "license": "MIT", + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "node_modules/agent-base": { + "version": "7.1.4", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.4.tgz", + "integrity": "sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ==", + "license": "MIT", + "engines": { + "node": ">= 14" + } + }, + "node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ansi-escapes": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.2.0.tgz", + "integrity": "sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ==", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "license": "Python-2.0" + }, + "node_modules/ast-types": { + "version": "0.13.4", + "resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.13.4.tgz", + "integrity": "sha512-x1FCFnFifvYDDzTaLII71vG5uvDwgtmDTEVWAxrgeiR8VjMONcCXJx7E+USjDtHlwFmt9MysbqgF9b9Vjr6w+w==", + "license": "MIT", + "dependencies": { + "tslib": "^2.0.1" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/astral-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-1.0.0.tgz", + "integrity": "sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg==", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/async": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/async/-/async-3.2.6.tgz", + "integrity": "sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA==", + "license": "MIT" + }, + "node_modules/b4a": { + "version": "1.6.7", + "resolved": "https://registry.npmjs.org/b4a/-/b4a-1.6.7.tgz", + "integrity": "sha512-OnAYlL5b7LEkALw87fUVafQw5rVR9RjwGd4KUwNQ6DrrNmaVaUCgLipfVlzrPQ4tWOR9P0IXGNOx50jYCCdSJg==", + "license": "Apache-2.0" + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "license": "MIT" + }, + "node_modules/bare-events": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/bare-events/-/bare-events-2.6.0.tgz", + "integrity": "sha512-EKZ5BTXYExaNqi3I3f9RtEsaI/xBSGjE0XZCZilPzFAV/goswFHuPd9jEZlPIZ/iNZJwDSao9qRiScySz7MbQg==", + "license": "Apache-2.0", + "optional": true + }, + "node_modules/bare-fs": { + "version": "4.1.6", + "resolved": "https://registry.npmjs.org/bare-fs/-/bare-fs-4.1.6.tgz", + "integrity": "sha512-25RsLF33BqooOEFNdMcEhMpJy8EoR88zSMrnOQOaM3USnOK2VmaJ1uaQEwPA6AQjrv1lXChScosN6CzbwbO9OQ==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "bare-events": "^2.5.4", + "bare-path": "^3.0.0", + "bare-stream": "^2.6.4" + }, + "engines": { + "bare": ">=1.16.0" + }, + "peerDependencies": { + "bare-buffer": "*" + }, + "peerDependenciesMeta": { + "bare-buffer": { + "optional": true + } + } + }, + "node_modules/bare-os": { + "version": "3.6.1", + "resolved": "https://registry.npmjs.org/bare-os/-/bare-os-3.6.1.tgz", + "integrity": "sha512-uaIjxokhFidJP+bmmvKSgiMzj2sV5GPHaZVAIktcxcpCyBFFWO+YlikVAdhmUo2vYFvFhOXIAlldqV29L8126g==", + "license": "Apache-2.0", + "optional": true, + "engines": { + "bare": ">=1.14.0" + } + }, + "node_modules/bare-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/bare-path/-/bare-path-3.0.0.tgz", + "integrity": "sha512-tyfW2cQcB5NN8Saijrhqn0Zh7AnFNsnczRcuWODH0eYAXBsJ5gVxAUuNr7tsHSC6IZ77cA0SitzT+s47kot8Mw==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "bare-os": "^3.0.1" + } + }, + "node_modules/bare-stream": { + "version": "2.6.5", + "resolved": "https://registry.npmjs.org/bare-stream/-/bare-stream-2.6.5.tgz", + "integrity": "sha512-jSmxKJNJmHySi6hC42zlZnq00rga4jjxcgNZjY9N5WlOe/iOoGRtdwGsHzQv2RlH2KOYMwGUXhf2zXd32BA9RA==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "streamx": "^2.21.0" + }, + "peerDependencies": { + "bare-buffer": "*", + "bare-events": "*" + }, + "peerDependenciesMeta": { + "bare-buffer": { + "optional": true + }, + "bare-events": { + "optional": true + } + } + }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/basic-ftp": { + "version": "5.0.5", + "resolved": "https://registry.npmjs.org/basic-ftp/-/basic-ftp-5.0.5.tgz", + "integrity": "sha512-4Bcg1P8xhUuqcii/S0Z9wiHIrQVPMermM1any+MX5GeGD7faD3/msQUDGLol9wOcz4/jbg/WJnGqoJF6LiBdtg==", + "license": "MIT", + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/brace-expansion": { + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", + "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/braces": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "license": "MIT", + "dependencies": { + "fill-range": "^7.1.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/browser-ui-test": { + "version": "0.21.1", + "resolved": "https://registry.npmjs.org/browser-ui-test/-/browser-ui-test-0.21.1.tgz", + "integrity": "sha512-b3a9mhALAmbP+GifoN/c295RPyuyfIUFMz0DtlBHbeDW5PYQTMHZZJtm7R2UyP6JiIQSkR+7227sS3maMGMUTg==", + "license": "MIT", + "dependencies": { + "css-unit-converter": "^1.1.2", + "pngjs": "^3.4.0", + "puppeteer": "^22.15.0", + "readline-sync": "^1.4.10" + }, + "bin": { + "browser-ui-test": "src/index.js" + } + }, + "node_modules/buffer": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + }, + "node_modules/buffer-crc32": { + "version": "0.2.13", + "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", + "integrity": "sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==", + "license": "MIT", + "engines": { + "node": "*" + } + }, + "node_modules/callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/chardet": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz", + "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==", + "license": "MIT" + }, + "node_modules/chromium-bidi": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/chromium-bidi/-/chromium-bidi-0.6.3.tgz", + "integrity": "sha512-qXlsCmpCZJAnoTYI83Iu6EdYQpMYdVkCfq08KDh2pmlVqK5t5IA9mGs4/LwCwp4fqisSOMXZxP3HIh8w8aRn0A==", + "license": "Apache-2.0", + "dependencies": { + "mitt": "3.0.1", + "urlpattern-polyfill": "10.0.0", + "zod": "3.23.8" + }, + "peerDependencies": { + "devtools-protocol": "*" + } + }, + "node_modules/cli-cursor": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz", + "integrity": "sha512-8lgKz8LmCRYZZQDpRyT2m5rKJ08TnU4tR9FFFW2rxpxR1FzWi4PQ/NfyODchAatHaUgnSPVcx/R5w6NuTBzFiw==", + "license": "MIT", + "dependencies": { + "restore-cursor": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/cli-width": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.1.tgz", + "integrity": "sha512-GRMWDxpOB6Dgk2E5Uo+3eEBvtOOlimMmpbFiKuLFnQzYDavtLFY3K5ona41jgN/WdRZtG7utuVSVTL4HbZHGkw==", + "license": "ISC" + }, + "node_modules/cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "license": "ISC", + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/cliui/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "license": "MIT" + }, + "node_modules/cliui/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/cliui/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/cliui/node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/color": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/color/-/color-3.2.1.tgz", + "integrity": "sha512-aBl7dZI9ENN6fUGC7mWpMTPNHmWUSNan9tuWN6ahh5ZLNk9baLJOnSMlrQkHcrfFgz2/RigjUVAjdx36VcemKA==", + "license": "MIT", + "dependencies": { + "color-convert": "^1.9.3", + "color-string": "^1.6.0" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "license": "MIT" + }, + "node_modules/color-string": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/color-string/-/color-string-1.9.1.tgz", + "integrity": "sha512-shrVawQFojnZv6xM40anx4CkoDP+fZsw/ZerEMsW/pyzsRbElpsL/DBVW7q3ExxwusdNXI3lXpuhEZkzs8p5Eg==", + "license": "MIT", + "dependencies": { + "color-name": "^1.0.0", + "simple-swizzle": "^0.2.2" + } + }, + "node_modules/color/node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "license": "MIT", + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/color/node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "license": "MIT" + }, + "node_modules/colorspace": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/colorspace/-/colorspace-1.1.4.tgz", + "integrity": "sha512-BgvKJiuVu1igBUF2kEjRCZXol6wiiGbY5ipL/oVPwm0BL9sIpMIzM8IK7vwuxIIzOXMV3Ey5w+vxhm0rR/TN8w==", + "license": "MIT", + "dependencies": { + "color": "^3.1.3", + "text-hex": "1.0.x" + } + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "license": "MIT" + }, + "node_modules/cosmiconfig": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-9.0.0.tgz", + "integrity": "sha512-itvL5h8RETACmOTFc4UfIyB2RfEHi71Ax6E/PivVxq9NseKbOWpeyHEOIbmAw1rs8Ak0VursQNww7lf7YtUwzg==", + "license": "MIT", + "dependencies": { + "env-paths": "^2.2.1", + "import-fresh": "^3.3.0", + "js-yaml": "^4.1.0", + "parse-json": "^5.2.0" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/d-fischer" + }, + "peerDependencies": { + "typescript": ">=4.9.5" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/cross-spawn": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", + "license": "MIT", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/css-unit-converter": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/css-unit-converter/-/css-unit-converter-1.1.2.tgz", + "integrity": "sha512-IiJwMC8rdZE0+xiEZHeru6YoONC4rfPMqGm2W85jMIbkFvv5nFTwJVFHam2eFrN6txmoUYFAFXiv8ICVeTO0MA==", + "license": "MIT" + }, + "node_modules/data-uri-to-buffer": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-6.0.2.tgz", + "integrity": "sha512-7hvf7/GW8e86rW0ptuwS3OcBGDjIi6SZva7hCyWC0yYry2cOPmLIjXAUHI6DK2HsnwJd9ifmt57i8eV2n4YNpw==", + "license": "MIT", + "engines": { + "node": ">= 14" + } + }, + "node_modules/debug": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.1.tgz", + "integrity": "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "license": "MIT" + }, + "node_modules/degenerator": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/degenerator/-/degenerator-5.0.1.tgz", + "integrity": "sha512-TllpMR/t0M5sqCXfj85i4XaAzxmS5tVA16dqvdkMwGmzI+dXLXnw3J+3Vdv7VKw+ThlTMboK6i9rnZ6Nntj5CQ==", + "license": "MIT", + "dependencies": { + "ast-types": "^0.13.4", + "escodegen": "^2.1.0", + "esprima": "^4.0.1" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/devtools-protocol": { + "version": "0.0.1312386", + "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1312386.tgz", + "integrity": "sha512-DPnhUXvmvKT2dFA/j7B+riVLUt9Q6RKJlcppojL5CoRywJJKLDYnRlw0gTFKfgDPHP5E04UoB71SxoJlVZy8FA==", + "license": "BSD-3-Clause" + }, + "node_modules/doctrine": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", + "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", + "license": "Apache-2.0", + "dependencies": { + "esutils": "^2.0.2" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/emoji-regex": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", + "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", + "license": "MIT" + }, + "node_modules/enabled": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/enabled/-/enabled-2.0.0.tgz", + "integrity": "sha512-AKrN98kuwOzMIdAizXGI86UFBoo26CL21UM763y1h/GMSJ4/OHU9k2YlsmBpyScFo/wbLzWQJBMCW4+IO3/+OQ==", + "license": "MIT" + }, + "node_modules/end-of-stream": { + "version": "1.4.5", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.5.tgz", + "integrity": "sha512-ooEGc6HP26xXq/N+GCGOT0JKCLDGrq2bQUZrQ7gyrJiZANJ/8YDTxTpQBXGMn+WbIQXNVpyWymm7KYVICQnyOg==", + "license": "MIT", + "dependencies": { + "once": "^1.4.0" + } + }, + "node_modules/env-paths": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/env-paths/-/env-paths-2.2.1.tgz", + "integrity": "sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "license": "MIT", + "dependencies": { + "is-arrayish": "^0.2.1" + } + }, + "node_modules/es-check": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/es-check/-/es-check-6.2.1.tgz", + "integrity": "sha512-IPiRXUlwSTd2yMklIf9yEGe6GK5wCS8Sz1aTNHm1QSiYzI4aiq19giYbLi95tb+e0JJVKmcU0iQXQWW60a8V9A==", + "license": "MIT", + "dependencies": { + "@caporal/core": "^2.0.2", + "acorn": "^8.7.0", + "fast-glob": "^3.2.11" + }, + "bin": { + "es-check": "index.js" + }, + "engines": { + "node": ">= 4" + } + }, + "node_modules/es6-promisify": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/es6-promisify/-/es6-promisify-6.1.1.tgz", + "integrity": "sha512-HBL8I3mIki5C1Cc9QjKUenHtnG0A5/xA8Q/AllRcfiwl2CZFXGK7ddBiCoRwAix4i2KxcQfjtIVcrVbB3vbmwg==", + "license": "MIT" + }, + "node_modules/escalade": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/escodegen": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-2.1.0.tgz", + "integrity": "sha512-2NlIDTwUWJN0mRPQOdtQBzbUHvdGY2P1VXSyU83Q3xKxM7WHX2Ql8dKq782Q9TgQUNOLEzEYu9bzLNj1q88I5w==", + "license": "BSD-2-Clause", + "dependencies": { + "esprima": "^4.0.1", + "estraverse": "^5.2.0", + "esutils": "^2.0.2" + }, + "bin": { + "escodegen": "bin/escodegen.js", + "esgenerate": "bin/esgenerate.js" + }, + "engines": { + "node": ">=6.0" + }, + "optionalDependencies": { + "source-map": "~0.6.1" + } + }, + "node_modules/eslint": { + "version": "8.57.1", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.57.1.tgz", + "integrity": "sha512-ypowyDxpVSYpkXr9WPv2PAZCtNip1Mv5KTW0SCurXv/9iOpcrH9PaqUElksqEB6pChqHGDRCFTyrZlGhnLNGiA==", + "deprecated": "This version is no longer supported. Please see https://eslint.org/version-support for other options.", + "license": "MIT", + "dependencies": { + "@eslint-community/eslint-utils": "^4.2.0", + "@eslint-community/regexpp": "^4.6.1", + "@eslint/eslintrc": "^2.1.4", + "@eslint/js": "8.57.1", + "@humanwhocodes/config-array": "^0.13.0", + "@humanwhocodes/module-importer": "^1.0.1", + "@nodelib/fs.walk": "^1.2.8", + "@ungap/structured-clone": "^1.2.0", + "ajv": "^6.12.4", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.3.2", + "doctrine": "^3.0.0", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^7.2.2", + "eslint-visitor-keys": "^3.4.3", + "espree": "^9.6.1", + "esquery": "^1.4.2", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^6.0.1", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "globals": "^13.19.0", + "graphemer": "^1.4.0", + "ignore": "^5.2.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "is-path-inside": "^3.0.3", + "js-yaml": "^4.1.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.1.2", + "natural-compare": "^1.4.0", + "optionator": "^0.9.3", + "strip-ansi": "^6.0.1", + "text-table": "^0.2.0" + }, + "bin": { + "eslint": "bin/eslint.js" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-js": { + "version": "1.0.0", + "resolved": "git+ssh://git@github.com/eslint/js.git#5bd12e3772d361af2c4bfad774ea7bfd9caae6bc", + "workspaces": [ + "packages/*" + ] + }, + "node_modules/eslint-scope": { + "version": "7.2.2", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", + "integrity": "sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==", + "license": "BSD-2-Clause", + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-visitor-keys": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", + "license": "Apache-2.0", + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/espree": { + "version": "9.6.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz", + "integrity": "sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==", + "license": "BSD-2-Clause", + "dependencies": { + "acorn": "^8.9.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^3.4.1" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "license": "BSD-2-Clause", + "bin": { + "esparse": "bin/esparse.js", + "esvalidate": "bin/esvalidate.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/esquery": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.6.0.tgz", + "integrity": "sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg==", + "license": "BSD-3-Clause", + "dependencies": { + "estraverse": "^5.1.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "license": "BSD-2-Clause", + "dependencies": { + "estraverse": "^5.2.0" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "license": "BSD-2-Clause", + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "license": "BSD-2-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/external-editor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.1.0.tgz", + "integrity": "sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==", + "license": "MIT", + "dependencies": { + "chardet": "^0.7.0", + "iconv-lite": "^0.4.24", + "tmp": "^0.0.33" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/extract-zip": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-2.0.1.tgz", + "integrity": "sha512-GDhU9ntwuKyGXdZBUgTIe+vXnWj0fppUEtMDL0+idd5Sta8TGpHssn/eusA9mrPr9qNDym6SxAYZjNvCn/9RBg==", + "license": "BSD-2-Clause", + "dependencies": { + "debug": "^4.1.1", + "get-stream": "^5.1.0", + "yauzl": "^2.10.0" + }, + "bin": { + "extract-zip": "cli.js" + }, + "engines": { + "node": ">= 10.17.0" + }, + "optionalDependencies": { + "@types/yauzl": "^2.9.1" + } + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "license": "MIT" + }, + "node_modules/fast-fifo": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/fast-fifo/-/fast-fifo-1.3.2.tgz", + "integrity": "sha512-/d9sfos4yxzpwkDkuN7k2SqFKtYNmCTzgfEpz82x34IM9/zc8KGxQoXg1liNC/izpRM/MBdt44Nmx41ZWqk+FQ==", + "license": "MIT" + }, + "node_modules/fast-glob": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.3.tgz", + "integrity": "sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==", + "license": "MIT", + "dependencies": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.8" + }, + "engines": { + "node": ">=8.6.0" + } + }, + "node_modules/fast-glob/node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "license": "MIT" + }, + "node_modules/fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "license": "MIT" + }, + "node_modules/fastq": { + "version": "1.19.1", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.19.1.tgz", + "integrity": "sha512-GwLTyxkCXjXbxqIhTsMI2Nui8huMPtnxg7krajPJAjnEG/iiOS7i+zCtWGZR9G0NBKbXKh6X9m9UIsYX/N6vvQ==", + "license": "ISC", + "dependencies": { + "reusify": "^1.0.4" + } + }, + "node_modules/fd-slicer": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", + "integrity": "sha512-cE1qsB/VwyQozZ+q1dGxR8LBYNZeofhEdUNGSMbQD3Gw2lAzX9Zb3uIU6Ebc/Fmyjo9AWWfnn0AUCHqtevs/8g==", + "license": "MIT", + "dependencies": { + "pend": "~1.2.0" + } + }, + "node_modules/fecha": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/fecha/-/fecha-4.2.3.tgz", + "integrity": "sha512-OP2IUU6HeYKJi3i0z4A19kHMQoLVs4Hc+DPqqxI2h/DPZHTm/vjsfC6P0b4jCMy14XizLBqvndQ+UilD7707Jw==", + "license": "MIT" + }, + "node_modules/figures": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz", + "integrity": "sha512-Oa2M9atig69ZkfwiApY8F2Yy+tzMbazyvqv21R0NsSC8floSOC09BbT1ITWAdoMGQvJ/aZnR1KMwdx9tvHnTNA==", + "license": "MIT", + "dependencies": { + "escape-string-regexp": "^1.0.5" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/figures/node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "license": "MIT", + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/file-entry-cache": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", + "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", + "license": "MIT", + "dependencies": { + "flat-cache": "^3.0.4" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, + "node_modules/fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "license": "MIT", + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "license": "MIT", + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/flat-cache": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.2.0.tgz", + "integrity": "sha512-CYcENa+FtcUKLmhhqyctpclsq7QF38pKjZHsGNiSQF5r4FtoKDWabFDl3hzaEQMvT1LHEysw5twgLvpYYb4vbw==", + "license": "MIT", + "dependencies": { + "flatted": "^3.2.9", + "keyv": "^4.5.3", + "rimraf": "^3.0.2" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, + "node_modules/flatted": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.3.tgz", + "integrity": "sha512-GX+ysw4PBCz0PzosHDepZGANEuFCMLrnRTiEy9McGjmkCQYwRq4A/X786G/fjM/+OjsWSU1ZrY5qyARZmO/uwg==", + "license": "ISC" + }, + "node_modules/fn.name": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fn.name/-/fn.name-1.1.0.tgz", + "integrity": "sha512-GRnmB5gPyJpAhTQdSZTSp9uaPSvl09KoYcMQtsB9rQoOmzs9dH6ffeccH+Z+cv6P68Hu5bC6JjRh4Ah/mHSNRw==", + "license": "MIT" + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "license": "ISC" + }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "license": "ISC", + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/get-stream": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", + "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", + "license": "MIT", + "dependencies": { + "pump": "^3.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/get-uri": { + "version": "6.0.5", + "resolved": "https://registry.npmjs.org/get-uri/-/get-uri-6.0.5.tgz", + "integrity": "sha512-b1O07XYq8eRuVzBNgJLstU6FYc1tS6wnMtF1I1D9lE8LxZSOGZ7LhxN54yPP6mGw5f2CkXY2BQUL9Fx41qvcIg==", + "license": "MIT", + "dependencies": { + "basic-ftp": "^5.0.2", + "data-uri-to-buffer": "^6.0.2", + "debug": "^4.3.4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "deprecated": "Glob versions prior to v9 are no longer supported", + "license": "ISC", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/globals": { + "version": "13.24.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz", + "integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==", + "license": "MIT", + "dependencies": { + "type-fest": "^0.20.2" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/graphemer": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", + "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", + "license": "MIT" + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/http-proxy-agent": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-7.0.2.tgz", + "integrity": "sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==", + "license": "MIT", + "dependencies": { + "agent-base": "^7.1.0", + "debug": "^4.3.4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/https-proxy-agent": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.6.tgz", + "integrity": "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==", + "license": "MIT", + "dependencies": { + "agent-base": "^7.1.2", + "debug": "4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "BSD-3-Clause" + }, + "node_modules/ignore": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", + "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/import-fresh": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.1.tgz", + "integrity": "sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==", + "license": "MIT", + "dependencies": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", + "license": "MIT", + "engines": { + "node": ">=0.8.19" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.", + "license": "ISC", + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "license": "ISC" + }, + "node_modules/inquirer": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-6.5.2.tgz", + "integrity": "sha512-cntlB5ghuB0iuO65Ovoi8ogLHiWGs/5yNrtUcKjFhSSiVeAIVpD7koaSU9RM8mpXw5YDi9RdYXGQMaOURB7ycQ==", + "license": "MIT", + "dependencies": { + "ansi-escapes": "^3.2.0", + "chalk": "^2.4.2", + "cli-cursor": "^2.1.0", + "cli-width": "^2.0.0", + "external-editor": "^3.0.3", + "figures": "^2.0.0", + "lodash": "^4.17.12", + "mute-stream": "0.0.7", + "run-async": "^2.2.0", + "rxjs": "^6.4.0", + "string-width": "^2.1.0", + "strip-ansi": "^5.1.0", + "through": "^2.3.6" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/inquirer/node_modules/ansi-regex": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.1.tgz", + "integrity": "sha512-ILlv4k/3f6vfQ4OoP2AGvirOktlQ98ZEL1k9FaQjxa3L1abBgbuTDAdPOpvbGncC0BTVQrl+OM8xZGK6tWXt7g==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/inquirer/node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "license": "MIT", + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/inquirer/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "license": "MIT", + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/inquirer/node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "license": "MIT", + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/inquirer/node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "license": "MIT" + }, + "node_modules/inquirer/node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "license": "MIT", + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/inquirer/node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/inquirer/node_modules/string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "license": "MIT", + "dependencies": { + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/inquirer/node_modules/string-width/node_modules/ansi-regex": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.1.tgz", + "integrity": "sha512-+O9Jct8wf++lXxxFc4hc8LsjaSq0HFzzL7cVsw8pRDIPdjKD2mT4ytDZlLuSBZ4cLKZFXIrMGO7DbQCtMJJMKw==", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/inquirer/node_modules/string-width/node_modules/strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha512-4XaJ2zQdCzROZDivEVIDPkcQn8LMFSa8kj8Gxb/Lnwzv9A8VctNZ+lfivC/sV3ivW8ElJTERXZoPBRrZKkNKow==", + "license": "MIT", + "dependencies": { + "ansi-regex": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/inquirer/node_modules/strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "license": "MIT", + "dependencies": { + "ansi-regex": "^4.1.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/inquirer/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "license": "MIT", + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/ip-address": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/ip-address/-/ip-address-9.0.5.tgz", + "integrity": "sha512-zHtQzGojZXTwZTHQqra+ETKd4Sn3vgi7uBmlPoXVWZqYvuKmtI0l/VZTjqGmJY9x88GGOaZ9+G9ES8hC4T4X8g==", + "license": "MIT", + "dependencies": { + "jsbn": "1.1.0", + "sprintf-js": "^1.1.3" + }, + "engines": { + "node": ">= 12" + } + }, + "node_modules/is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", + "license": "MIT" + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha512-VHskAKYM8RfSFXwee5t5cbN5PZeq1Wrh6qd5bkyiXIf6UQcN6w/A0eXM9r6t8d+GYOh+o6ZhiEnb88LN/Y8m2w==", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "license": "MIT", + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "license": "MIT", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/is-path-inside": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", + "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/is-stream": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", + "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "license": "ISC" + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "license": "MIT" + }, + "node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "license": "MIT", + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/jsbn": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-1.1.0.tgz", + "integrity": "sha512-4bYVV3aAMtDTTu4+xsDYa6sy9GyJ69/amsu9sYF2zqjiEoZA5xJi3BrfX3uY+/IekIu7MwdObdbDWpoZdBv3/A==", + "license": "MIT" + }, + "node_modules/json-buffer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", + "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", + "license": "MIT" + }, + "node_modules/json-parse-even-better-errors": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", + "license": "MIT" + }, + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "license": "MIT" + }, + "node_modules/json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", + "license": "MIT" + }, + "node_modules/keyv": { + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", + "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", + "license": "MIT", + "dependencies": { + "json-buffer": "3.0.1" + } + }, + "node_modules/kuler": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/kuler/-/kuler-2.0.0.tgz", + "integrity": "sha512-Xq9nH7KlWZmXAtodXDDRE7vs6DU1gTU8zYDHDiWLSip45Egwq3plLHzPn27NgvzL2r1LMPC1vdqh98sQxtqj4A==", + "license": "MIT" + }, + "node_modules/levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "license": "MIT", + "dependencies": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/lines-and-columns": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", + "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", + "license": "MIT" + }, + "node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "license": "MIT", + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", + "license": "MIT" + }, + "node_modules/lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", + "license": "MIT" + }, + "node_modules/logform": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/logform/-/logform-2.7.0.tgz", + "integrity": "sha512-TFYA4jnP7PVbmlBIfhlSe+WKxs9dklXMTEGcBCIvLhE/Tn3H6Gk1norupVW7m5Cnd4bLcr08AytbyV/xj7f/kQ==", + "license": "MIT", + "dependencies": { + "@colors/colors": "1.6.0", + "@types/triple-beam": "^1.3.2", + "fecha": "^4.2.0", + "ms": "^2.1.1", + "safe-stable-stringify": "^2.3.1", + "triple-beam": "^1.3.0" + }, + "engines": { + "node": ">= 12.0.0" + } + }, + "node_modules/lru-cache": { + "version": "7.18.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz", + "integrity": "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==", + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "license": "MIT", + "engines": { + "node": ">= 8" + } + }, + "node_modules/micromatch": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", + "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", + "license": "MIT", + "dependencies": { + "braces": "^3.0.3", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/mimic-fn": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz", + "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/mitt": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/mitt/-/mitt-3.0.1.tgz", + "integrity": "sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw==", + "license": "MIT" + }, + "node_modules/mkdirp": { + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", + "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", + "license": "MIT", + "dependencies": { + "minimist": "^1.2.6" + }, + "bin": { + "mkdirp": "bin/cmd.js" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/mute-stream": { + "version": "0.0.7", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz", + "integrity": "sha512-r65nCZhrbXXb6dXOACihYApHw2Q6pV0M3V0PSxd74N0+D8nzAdEAITq2oAjA1jVnKI+tGvEBUpqiMh0+rW6zDQ==", + "license": "ISC" + }, + "node_modules/natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", + "license": "MIT" + }, + "node_modules/netmask": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/netmask/-/netmask-2.0.2.tgz", + "integrity": "sha512-dBpDMdxv9Irdq66304OLfEmQ9tbNRFnFTuZiLo+bD+r332bBmMJ8GBLXklIXXgxd3+v9+KUnZaUR5PJMa75Gsg==", + "license": "MIT", + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "license": "ISC", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/one-time": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/one-time/-/one-time-1.0.0.tgz", + "integrity": "sha512-5DXOiRKwuSEcQ/l0kGCF6Q3jcADFv5tSmRaJck/OqkVFcOzutB134KRSfF0xDrL39MNnqxbHBbUUcjZIhTgb2g==", + "license": "MIT", + "dependencies": { + "fn.name": "1.x.x" + } + }, + "node_modules/onetime": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz", + "integrity": "sha512-oyyPpiMaKARvvcgip+JV+7zci5L8D1W9RZIz2l1o08AM3pfspitVWnPt3mzHcBPp12oYMTy0pqrFs/C+m3EwsQ==", + "license": "MIT", + "dependencies": { + "mimic-fn": "^1.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/optionator": { + "version": "0.9.4", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", + "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==", + "license": "MIT", + "dependencies": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.5" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/os-tmpdir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "license": "MIT", + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "license": "MIT", + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/pac-proxy-agent": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/pac-proxy-agent/-/pac-proxy-agent-7.2.0.tgz", + "integrity": "sha512-TEB8ESquiLMc0lV8vcd5Ql/JAKAoyzHFXaStwjkzpOpC5Yv+pIzLfHvjTSdf3vpa2bMiUQrg9i6276yn8666aA==", + "license": "MIT", + "dependencies": { + "@tootallnate/quickjs-emscripten": "^0.23.0", + "agent-base": "^7.1.2", + "debug": "^4.3.4", + "get-uri": "^6.0.1", + "http-proxy-agent": "^7.0.0", + "https-proxy-agent": "^7.0.6", + "pac-resolver": "^7.0.1", + "socks-proxy-agent": "^8.0.5" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/pac-resolver": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/pac-resolver/-/pac-resolver-7.0.1.tgz", + "integrity": "sha512-5NPgf87AT2STgwa2ntRMr45jTKrYBGkVU36yT0ig/n/GMAa3oPqhZfIQ2kMEimReg0+t9kZViDVZ83qfVUlckg==", + "license": "MIT", + "dependencies": { + "degenerator": "^5.0.0", + "netmask": "^2.0.2" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "license": "MIT", + "dependencies": { + "callsites": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/parse-json": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", + "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.0.0", + "error-ex": "^1.3.1", + "json-parse-even-better-errors": "^2.3.0", + "lines-and-columns": "^1.1.6" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/pend": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", + "integrity": "sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg==", + "license": "MIT" + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "license": "ISC" + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pngjs": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/pngjs/-/pngjs-3.4.0.tgz", + "integrity": "sha512-NCrCHhWmnQklfH4MtJMRjZ2a8c80qXeMlQMv2uVp9ISJMTt562SbGd6n2oq0PaPgKm7Z6pL9E2UlLIhC+SHL3w==", + "license": "MIT", + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "license": "MIT", + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/progress": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", + "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", + "license": "MIT", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/proxy-agent": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/proxy-agent/-/proxy-agent-6.5.0.tgz", + "integrity": "sha512-TmatMXdr2KlRiA2CyDu8GqR8EjahTG3aY3nXjdzFyoZbmB8hrBsTyMezhULIXKnC0jpfjlmiZ3+EaCzoInSu/A==", + "license": "MIT", + "dependencies": { + "agent-base": "^7.1.2", + "debug": "^4.3.4", + "http-proxy-agent": "^7.0.1", + "https-proxy-agent": "^7.0.6", + "lru-cache": "^7.14.1", + "pac-proxy-agent": "^7.1.0", + "proxy-from-env": "^1.1.0", + "socks-proxy-agent": "^8.0.5" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", + "license": "MIT" + }, + "node_modules/pump": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.3.tgz", + "integrity": "sha512-todwxLMY7/heScKmntwQG8CXVkWUOdYxIvY2s0VWAAMh/nd8SoYiRaKjlr7+iCs984f2P8zvrfWcDDYVb73NfA==", + "license": "MIT", + "dependencies": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "node_modules/punycode": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/puppeteer": { + "version": "22.15.0", + "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-22.15.0.tgz", + "integrity": "sha512-XjCY1SiSEi1T7iSYuxS82ft85kwDJUS7wj1Z0eGVXKdtr5g4xnVcbjwxhq5xBnpK/E7x1VZZoJDxpjAOasHT4Q==", + "hasInstallScript": true, + "license": "Apache-2.0", + "dependencies": { + "@puppeteer/browsers": "2.3.0", + "cosmiconfig": "^9.0.0", + "devtools-protocol": "0.0.1312386", + "puppeteer-core": "22.15.0" + }, + "bin": { + "puppeteer": "lib/esm/puppeteer/node/cli.js" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/puppeteer-core": { + "version": "22.15.0", + "resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-22.15.0.tgz", + "integrity": "sha512-cHArnywCiAAVXa3t4GGL2vttNxh7GqXtIYGym99egkNJ3oG//wL9LkvO4WE8W1TJe95t1F1ocu9X4xWaGsOKOA==", + "license": "Apache-2.0", + "dependencies": { + "@puppeteer/browsers": "2.3.0", + "chromium-bidi": "0.6.3", + "debug": "^4.3.6", + "devtools-protocol": "0.0.1312386", + "ws": "^8.18.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "license": "MIT", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/readline-sync": { + "version": "1.4.10", + "resolved": "https://registry.npmjs.org/readline-sync/-/readline-sync-1.4.10.tgz", + "integrity": "sha512-gNva8/6UAe8QYepIQH/jQ2qn91Qj0B9sYjMBBs3QOB8F2CXcKgLxQaJRP76sWVRQt+QU+8fAkCbCvjjMFu7Ycw==", + "license": "MIT", + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/restore-cursor": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz", + "integrity": "sha512-6IzJLuGi4+R14vwagDHX+JrXmPVtPpn4mffDJ1UdR7/Edm87fl6yi8mMBIVvFtJaNTUvjughmW4hwLhRG7gC1Q==", + "license": "MIT", + "dependencies": { + "onetime": "^2.0.0", + "signal-exit": "^3.0.2" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/reusify": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.1.0.tgz", + "integrity": "sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==", + "license": "MIT", + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, + "node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "deprecated": "Rimraf versions prior to v4 are no longer supported", + "license": "ISC", + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/run-async": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.4.1.tgz", + "integrity": "sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ==", + "license": "MIT", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "queue-microtask": "^1.2.2" + } + }, + "node_modules/rxjs": { + "version": "6.6.7", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.7.tgz", + "integrity": "sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ==", + "license": "Apache-2.0", + "dependencies": { + "tslib": "^1.9.0" + }, + "engines": { + "npm": ">=2.0.0" + } + }, + "node_modules/rxjs/node_modules/tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "license": "0BSD" + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/safe-stable-stringify": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/safe-stable-stringify/-/safe-stable-stringify-2.5.0.tgz", + "integrity": "sha512-b3rppTKm9T+PsVCBEOUR46GWI7fdOs00VKZ1+9c1EWDaDMvjQc6tUwuFyIprgGgTcWoVHSKrU8H31ZHA2e0RHA==", + "license": "MIT", + "engines": { + "node": ">=10" + } + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "license": "MIT" + }, + "node_modules/semver": { + "version": "7.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.2.tgz", + "integrity": "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==", + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "license": "MIT", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "license": "ISC" + }, + "node_modules/simple-swizzle": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.2.tgz", + "integrity": "sha512-JA//kQgZtbuY83m+xT+tXJkmJncGMTFT+C+g2h2R9uxkYIrE2yy9sgmcLhCnw57/WSD+Eh3J97FPEDFnbXnDUg==", + "license": "MIT", + "dependencies": { + "is-arrayish": "^0.3.1" + } + }, + "node_modules/simple-swizzle/node_modules/is-arrayish": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.3.2.tgz", + "integrity": "sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ==", + "license": "MIT" + }, + "node_modules/slice-ansi": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-2.1.0.tgz", + "integrity": "sha512-Qu+VC3EwYLldKa1fCxuuvULvSJOKEgk9pi8dZeCVK7TqBfUNTH4sFkk4joj8afVSfAYgJoSOetjx9QWOJ5mYoQ==", + "license": "MIT", + "dependencies": { + "ansi-styles": "^3.2.0", + "astral-regex": "^1.0.0", + "is-fullwidth-code-point": "^2.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/slice-ansi/node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "license": "MIT", + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/slice-ansi/node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "license": "MIT", + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/slice-ansi/node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "license": "MIT" + }, + "node_modules/smart-buffer": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz", + "integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==", + "license": "MIT", + "engines": { + "node": ">= 6.0.0", + "npm": ">= 3.0.0" + } + }, + "node_modules/socks": { + "version": "2.8.6", + "resolved": "https://registry.npmjs.org/socks/-/socks-2.8.6.tgz", + "integrity": "sha512-pe4Y2yzru68lXCb38aAqRf5gvN8YdjP1lok5o0J7BOHljkyCGKVz7H3vpVIXKD27rj2giOJ7DwVyk/GWrPHDWA==", + "license": "MIT", + "dependencies": { + "ip-address": "^9.0.5", + "smart-buffer": "^4.2.0" + }, + "engines": { + "node": ">= 10.0.0", + "npm": ">= 3.0.0" + } + }, + "node_modules/socks-proxy-agent": { + "version": "8.0.5", + "resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-8.0.5.tgz", + "integrity": "sha512-HehCEsotFqbPW9sJ8WVYB6UbmIMv7kUUORIF2Nncq4VQvBfNBLibW9YZR5dlYCSUhwcD628pRllm7n+E+YTzJw==", + "license": "MIT", + "dependencies": { + "agent-base": "^7.1.2", + "debug": "^4.3.4", + "socks": "^2.8.3" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "license": "BSD-3-Clause", + "optional": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/sprintf-js": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.3.tgz", + "integrity": "sha512-Oo+0REFV59/rz3gfJNKQiBlwfHaSESl1pcGyABQsnnIfWOFt6JNj5gCog2U6MLZ//IGYD+nA8nI+mTShREReaA==", + "license": "BSD-3-Clause" + }, + "node_modules/stack-trace": { + "version": "0.0.10", + "resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.10.tgz", + "integrity": "sha512-KGzahc7puUKkzyMt+IqAep+TVNbKP+k2Lmwhub39m1AsTSkaDutx56aDCo+HLDzf/D26BIHTJWNiTG1KAJiQCg==", + "license": "MIT", + "engines": { + "node": "*" + } + }, + "node_modules/streamx": { + "version": "2.22.1", + "resolved": "https://registry.npmjs.org/streamx/-/streamx-2.22.1.tgz", + "integrity": "sha512-znKXEBxfatz2GBNK02kRnCXjV+AA4kjZIUxeWSr3UGirZMJfTE9uiwKHobnbgxWyL/JWro8tTq+vOqAK1/qbSA==", + "license": "MIT", + "dependencies": { + "fast-fifo": "^1.3.2", + "text-decoder": "^1.1.0" + }, + "optionalDependencies": { + "bare-events": "^2.2.0" + } + }, + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/string-width": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "license": "MIT", + "dependencies": { + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/string-width/node_modules/ansi-regex": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.1.tgz", + "integrity": "sha512-ILlv4k/3f6vfQ4OoP2AGvirOktlQ98ZEL1k9FaQjxa3L1abBgbuTDAdPOpvbGncC0BTVQrl+OM8xZGK6tWXt7g==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/string-width/node_modules/strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "license": "MIT", + "dependencies": { + "ansi-regex": "^4.1.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/table": { + "version": "5.4.6", + "resolved": "https://registry.npmjs.org/table/-/table-5.4.6.tgz", + "integrity": "sha512-wmEc8m4fjnob4gt5riFRtTu/6+4rSe12TpAELNSqHMfF3IqnA+CH37USM6/YR3qRZv7e56kAEAtd6nKZaxe0Ug==", + "license": "BSD-3-Clause", + "dependencies": { + "ajv": "^6.10.2", + "lodash": "^4.17.14", + "slice-ansi": "^2.1.0", + "string-width": "^3.0.0" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/tabtab": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/tabtab/-/tabtab-3.0.2.tgz", + "integrity": "sha512-jANKmUe0sIQc/zTALTBy186PoM/k6aPrh3A7p6AaAfF6WPSbTx1JYeGIGH162btpH+mmVEXln+UxwViZHO2Jhg==", + "license": "MIT", + "dependencies": { + "debug": "^4.0.1", + "es6-promisify": "^6.0.0", + "inquirer": "^6.0.0", + "minimist": "^1.2.0", + "mkdirp": "^0.5.1", + "untildify": "^3.0.3" + } + }, + "node_modules/tar-fs": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-3.1.0.tgz", + "integrity": "sha512-5Mty5y/sOF1YWj1J6GiBodjlDc05CUR8PKXrsnFAiSG0xA+GHeWLovaZPYUDXkH/1iKRf2+M5+OrRgzC7O9b7w==", + "license": "MIT", + "dependencies": { + "pump": "^3.0.0", + "tar-stream": "^3.1.5" + }, + "optionalDependencies": { + "bare-fs": "^4.0.1", + "bare-path": "^3.0.0" + } + }, + "node_modules/tar-stream": { + "version": "3.1.7", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-3.1.7.tgz", + "integrity": "sha512-qJj60CXt7IU1Ffyc3NJMjh6EkuCFej46zUqJ4J7pqYlThyd9bO0XBTmcOIhSzZJVWfsLks0+nle/j538YAW9RQ==", + "license": "MIT", + "dependencies": { + "b4a": "^1.6.4", + "fast-fifo": "^1.2.0", + "streamx": "^2.15.0" + } + }, + "node_modules/text-decoder": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/text-decoder/-/text-decoder-1.2.3.tgz", + "integrity": "sha512-3/o9z3X0X0fTupwsYvR03pJ/DjWuqqrfwBgTQzdWDiQSm9KitAyz/9WqsT2JQW7KV2m+bC2ol/zqpW37NHxLaA==", + "license": "Apache-2.0", + "dependencies": { + "b4a": "^1.6.4" + } + }, + "node_modules/text-hex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/text-hex/-/text-hex-1.0.0.tgz", + "integrity": "sha512-uuVGNWzgJ4yhRaNSiubPY7OjISw4sw4E5Uv0wbjp+OzcbmVU/rsT8ujgcXJhn9ypzsgr5vlzpPqP+MBBKcGvbg==", + "license": "MIT" + }, + "node_modules/text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", + "license": "MIT" + }, + "node_modules/through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==", + "license": "MIT" + }, + "node_modules/tmp": { + "version": "0.0.33", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", + "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", + "license": "MIT", + "dependencies": { + "os-tmpdir": "~1.0.2" + }, + "engines": { + "node": ">=0.6.0" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "license": "MIT", + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/triple-beam": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/triple-beam/-/triple-beam-1.4.1.tgz", + "integrity": "sha512-aZbgViZrg1QNcG+LULa7nhZpJTZSLm/mXnHXnbAbjmN5aSa0y7V+wvv6+4WaBtpISJzThKy+PIPxc1Nq1EJ9mg==", + "license": "MIT", + "engines": { + "node": ">= 14.0.0" + } + }, + "node_modules/tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "license": "0BSD" + }, + "node_modules/type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "license": "MIT", + "dependencies": { + "prelude-ls": "^1.2.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "license": "(MIT OR CC0-1.0)", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/typescript": { + "version": "5.8.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.8.3.tgz", + "integrity": "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==", + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/unbzip2-stream": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/unbzip2-stream/-/unbzip2-stream-1.4.3.tgz", + "integrity": "sha512-mlExGW4w71ebDJviH16lQLtZS32VKqsSfk80GCfUlwT/4/hNRFsoscrF/c++9xinkMzECL1uL9DDwXqFWkruPg==", + "license": "MIT", + "dependencies": { + "buffer": "^5.2.1", + "through": "^2.3.8" + } + }, + "node_modules/untildify": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/untildify/-/untildify-3.0.3.tgz", + "integrity": "sha512-iSk/J8efr8uPT/Z4eSUywnqyrQU7DSdMfdqK4iWEaUVVmcP5JcnpRqmVMwcwcnmI1ATFNgC5V90u09tBynNFKA==", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "license": "BSD-2-Clause", + "dependencies": { + "punycode": "^2.1.0" + } + }, + "node_modules/urlpattern-polyfill": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/urlpattern-polyfill/-/urlpattern-polyfill-10.0.0.tgz", + "integrity": "sha512-H/A06tKD7sS1O1X2SshBVeA5FLycRpjqiBeqGKmBwBDBy28EnRjORxTNe269KSSr5un5qyWi1iL61wLxpd+ZOg==", + "license": "MIT" + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "license": "MIT" + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/winston": { + "version": "3.17.0", + "resolved": "https://registry.npmjs.org/winston/-/winston-3.17.0.tgz", + "integrity": "sha512-DLiFIXYC5fMPxaRg832S6F5mJYvePtmO5G9v9IgUFPhXm9/GkXarH/TUrBAVzhTCzAj9anE/+GjrgXp/54nOgw==", + "license": "MIT", + "dependencies": { + "@colors/colors": "^1.6.0", + "@dabh/diagnostics": "^2.0.2", + "async": "^3.2.3", + "is-stream": "^2.0.0", + "logform": "^2.7.0", + "one-time": "^1.0.0", + "readable-stream": "^3.4.0", + "safe-stable-stringify": "^2.3.1", + "stack-trace": "0.0.x", + "triple-beam": "^1.3.0", + "winston-transport": "^4.9.0" + }, + "engines": { + "node": ">= 12.0.0" + } + }, + "node_modules/winston-transport": { + "version": "4.9.0", + "resolved": "https://registry.npmjs.org/winston-transport/-/winston-transport-4.9.0.tgz", + "integrity": "sha512-8drMJ4rkgaPo1Me4zD/3WLfI/zPdA9o2IipKODunnGDcuqbHwjsbB79ylv04LCGGzU0xQ6vTznOMpQGaLhhm6A==", + "license": "MIT", + "dependencies": { + "logform": "^2.7.0", + "readable-stream": "^3.6.2", + "triple-beam": "^1.3.0" + }, + "engines": { + "node": ">= 12.0.0" + } + }, + "node_modules/word-wrap": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", + "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/wrap-ansi": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", + "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "license": "MIT" + }, + "node_modules/wrap-ansi/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "license": "ISC" + }, + "node_modules/ws": { + "version": "8.18.3", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.3.tgz", + "integrity": "sha512-PEIGCY5tSlUt50cqyMXfCzX+oOPqN0vuGqWzbcJ2xvnkzkq46oOpz7dQaTDBdfICb4N14+GARUDw2XV2N4tvzg==", + "license": "MIT", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "license": "ISC", + "engines": { + "node": ">=10" + } + }, + "node_modules/yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "license": "MIT", + "dependencies": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/yargs/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "license": "MIT" + }, + "node_modules/yargs/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/yargs/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/yauzl": { + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", + "integrity": "sha512-p4a9I6X6nu6IhoGmBqAcbJy1mlC4j27vEPZX9F4L4/vZT3Lyq1VkFHw/V/PUcB9Buo+DG3iHkT0x3Qya58zc3g==", + "license": "MIT", + "dependencies": { + "buffer-crc32": "~0.2.3", + "fd-slicer": "~1.1.0" + } + }, + "node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/zod": { + "version": "3.23.8", + "resolved": "https://registry.npmjs.org/zod/-/zod-3.23.8.tgz", + "integrity": "sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/colinhacks" + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 000000000000..945f9a3ee87d --- /dev/null +++ b/package.json @@ -0,0 +1,9 @@ +{ + "dependencies": { + "browser-ui-test": "^0.21.1", + "es-check": "^6.2.1", + "eslint": "^8.57.1", + "eslint-js": "github:eslint/js", + "typescript": "^5.8.3" + } +} diff --git a/src/ci/docker/host-x86_64/pr-check-1/Dockerfile b/src/ci/docker/host-x86_64/pr-check-1/Dockerfile index e63a383ec997..d3c3cd1b63e4 100644 --- a/src/ci/docker/host-x86_64/pr-check-1/Dockerfile +++ b/src/ci/docker/host-x86_64/pr-check-1/Dockerfile @@ -27,10 +27,6 @@ COPY scripts/nodejs.sh /scripts/ RUN sh /scripts/nodejs.sh /node ENV PATH="/node/bin:${PATH}" -# Install es-check -# Pin its version to prevent unrelated CI failures due to future es-check versions. -RUN npm install es-check@6.1.1 eslint@8.6.0 typescript@5.7.3 -g - COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh diff --git a/src/tools/tidy/src/ext_tool_checks.rs b/src/tools/tidy/src/ext_tool_checks.rs index 03ed0b00f3ef..911d4daae5cd 100644 --- a/src/tools/tidy/src/ext_tool_checks.rs +++ b/src/tools/tidy/src/ext_tool_checks.rs @@ -50,7 +50,6 @@ pub fn check( ci_info: &CiInfo, librustdoc_path: &Path, tools_path: &Path, - src_path: &Path, bless: bool, extra_checks: Option<&str>, pos_args: &[String], @@ -62,7 +61,6 @@ pub fn check( ci_info, librustdoc_path, tools_path, - src_path, bless, extra_checks, pos_args, @@ -77,7 +75,6 @@ fn check_impl( ci_info: &CiInfo, librustdoc_path: &Path, tools_path: &Path, - src_path: &Path, bless: bool, extra_checks: Option<&str>, pos_args: &[String], @@ -295,13 +292,17 @@ fn check_impl( spellcheck_runner(&args)?; } + if js_lint || js_typecheck { + rustdoc_js::npm_install(root_path, outdir)?; + } + if js_lint { - rustdoc_js::lint(librustdoc_path, tools_path, src_path)?; - rustdoc_js::es_check(librustdoc_path)?; + rustdoc_js::lint(outdir, librustdoc_path, tools_path)?; + rustdoc_js::es_check(outdir, librustdoc_path)?; } if js_typecheck { - rustdoc_js::typecheck(librustdoc_path)?; + rustdoc_js::typecheck(outdir, librustdoc_path)?; } Ok(()) diff --git a/src/tools/tidy/src/ext_tool_checks/rustdoc_js.rs b/src/tools/tidy/src/ext_tool_checks/rustdoc_js.rs index 24be26ffbd91..f96c9612a8e1 100644 --- a/src/tools/tidy/src/ext_tool_checks/rustdoc_js.rs +++ b/src/tools/tidy/src/ext_tool_checks/rustdoc_js.rs @@ -3,12 +3,61 @@ use std::ffi::OsStr; use std::path::{Path, PathBuf}; -use std::process::Command; +use std::process::{Child, Command}; +use std::{fs, io}; +use build_helper::ci::CiEnv; use ignore::DirEntry; use crate::walk::walk_no_read; +fn node_module_bin(outdir: &Path, name: &str) -> PathBuf { + outdir.join("node_modules/.bin").join(name) +} + +fn spawn_cmd(cmd: &mut Command) -> Result { + cmd.spawn().map_err(|err| { + eprintln!("unable to run {cmd:?} due to {err:?}"); + err + }) +} + +/// install all js dependencies from package.json. +pub(super) fn npm_install(root_path: &Path, outdir: &Path) -> Result<(), super::Error> { + let copy_to_build = |p| { + fs::copy(root_path.join(p), outdir.join(p)).map_err(|e| { + eprintln!("unable to copy {p:?} to build directory: {e:?}"); + e + }) + }; + // copy stuff to the output directory to make node_modules get put there. + copy_to_build("package.json")?; + copy_to_build("package-lock.json")?; + + let mut cmd = Command::new("npm"); + if CiEnv::is_ci() { + // `npm ci` redownloads every time and thus is too slow for local development. + cmd.arg("ci"); + } else { + cmd.arg("install"); + } + // disable a bunch of things we don't want. + // this makes tidy output less noisy, and also significantly improves runtime + // of repeated tidy invokations. + cmd.args(&["--audit=false", "--save=false", "--fund=false"]); + cmd.current_dir(outdir); + let mut child = spawn_cmd(&mut cmd)?; + match child.wait() { + Ok(exit_status) => { + if exit_status.success() { + return Ok(()); + } + Err(super::Error::FailedCheck("npm install")) + } + Err(error) => Err(super::Error::Generic(format!("npm install failed: {error:?}"))), + } +} + fn rustdoc_js_files(librustdoc_path: &Path) -> Vec { let mut files = Vec::new(); walk_no_read( @@ -21,13 +70,13 @@ fn rustdoc_js_files(librustdoc_path: &Path) -> Vec { return files; } -fn run_eslint(args: &[PathBuf], config_folder: PathBuf) -> Result<(), super::Error> { - let mut child = Command::new("npx") - .arg("eslint") - .arg("-c") - .arg(config_folder.join(".eslintrc.js")) - .args(args) - .spawn()?; +fn run_eslint(outdir: &Path, args: &[PathBuf], config_folder: PathBuf) -> Result<(), super::Error> { + let mut child = spawn_cmd( + Command::new(node_module_bin(outdir, "eslint")) + .arg("-c") + .arg(config_folder.join(".eslintrc.js")) + .args(args), + )?; match child.wait() { Ok(exit_status) => { if exit_status.success() { @@ -39,77 +88,31 @@ fn run_eslint(args: &[PathBuf], config_folder: PathBuf) -> Result<(), super::Err } } -fn get_eslint_version_inner(global: bool) -> Option { - let mut command = Command::new("npm"); - command.arg("list").arg("--parseable").arg("--long").arg("--depth=0"); - if global { - command.arg("--global"); - } - let output = command.output().ok()?; - let lines = String::from_utf8_lossy(&output.stdout); - lines.lines().find_map(|l| l.split(':').nth(1)?.strip_prefix("eslint@")).map(|v| v.to_owned()) -} - -fn get_eslint_version() -> Option { - get_eslint_version_inner(false).or_else(|| get_eslint_version_inner(true)) -} - pub(super) fn lint( + outdir: &Path, librustdoc_path: &Path, tools_path: &Path, - src_path: &Path, ) -> Result<(), super::Error> { - let eslint_version_path = src_path.join("ci/docker/host-x86_64/tidy/eslint.version"); - let eslint_version = match std::fs::read_to_string(&eslint_version_path) { - Ok(version) => version.trim().to_string(), - Err(error) => { - eprintln!("failed to read `{}`: {error:?}", eslint_version_path.display()); - return Err(error.into()); - } - }; - // Having the correct `eslint` version installed via `npm` isn't strictly necessary, since we're invoking it via `npx`, - // but this check allows the vast majority that is not working on the rustdoc frontend to avoid the penalty of running - // `eslint` in tidy. See also: https://github.com/rust-lang/rust/pull/142851 - match get_eslint_version() { - Some(version) => { - if version != eslint_version { - // unfortunatly we can't use `Error::Version` here becuse `str::trim` isn't const and - // Version::required must be a static str - return Err(super::Error::Generic(format!( - "⚠️ Installed version of eslint (`{version}`) is different than the \ - one used in the CI (`{eslint_version}`)\n\ - You can install this version using `npm update eslint` or by using \ - `npm install eslint@{eslint_version}`\n -" - ))); - } - } - None => { - //eprintln!("`eslint` doesn't seem to be installed. Skipping tidy check for JS files."); - //eprintln!("You can install it using `npm install eslint@{eslint_version}`"); - return Err(super::Error::MissingReq( - "eslint", - "js lint checks", - Some(format!("You can install it using `npm install eslint@{eslint_version}`")), - )); - } - } let files_to_check = rustdoc_js_files(librustdoc_path); println!("Running eslint on rustdoc JS files"); - run_eslint(&files_to_check, librustdoc_path.join("html/static"))?; + run_eslint(outdir, &files_to_check, librustdoc_path.join("html/static"))?; - run_eslint(&[tools_path.join("rustdoc-js/tester.js")], tools_path.join("rustdoc-js"))?; - run_eslint(&[tools_path.join("rustdoc-gui/tester.js")], tools_path.join("rustdoc-gui"))?; + run_eslint(outdir, &[tools_path.join("rustdoc-js/tester.js")], tools_path.join("rustdoc-js"))?; + run_eslint( + outdir, + &[tools_path.join("rustdoc-gui/tester.js")], + tools_path.join("rustdoc-gui"), + )?; Ok(()) } -pub(super) fn typecheck(librustdoc_path: &Path) -> Result<(), super::Error> { +pub(super) fn typecheck(outdir: &Path, librustdoc_path: &Path) -> Result<(), super::Error> { // use npx to ensure correct version - let mut child = Command::new("npx") - .arg("tsc") - .arg("-p") - .arg(librustdoc_path.join("html/static/js/tsconfig.json")) - .spawn()?; + let mut child = spawn_cmd( + Command::new(node_module_bin(outdir, "tsc")) + .arg("-p") + .arg(librustdoc_path.join("html/static/js/tsconfig.json")), + )?; match child.wait() { Ok(exit_status) => { if exit_status.success() { @@ -121,15 +124,14 @@ pub(super) fn typecheck(librustdoc_path: &Path) -> Result<(), super::Error> { } } -pub(super) fn es_check(librustdoc_path: &Path) -> Result<(), super::Error> { +pub(super) fn es_check(outdir: &Path, librustdoc_path: &Path) -> Result<(), super::Error> { let files_to_check = rustdoc_js_files(librustdoc_path); - // use npx to ensure correct version - let mut cmd = Command::new("npx"); - cmd.arg("es-check").arg("es2019"); + let mut cmd = Command::new(node_module_bin(outdir, "es-check")); + cmd.arg("es2019"); for f in files_to_check { cmd.arg(f); } - match cmd.spawn()?.wait() { + match spawn_cmd(&mut cmd)?.wait() { Ok(exit_status) => { if exit_status.success() { return Ok(()); diff --git a/src/tools/tidy/src/main.rs b/src/tools/tidy/src/main.rs index 358a03dd18c1..13b20f33bd0f 100644 --- a/src/tools/tidy/src/main.rs +++ b/src/tools/tidy/src/main.rs @@ -182,7 +182,6 @@ fn main() { &ci_info, &librustdoc_path, &tools_path, - &src_path, bless, extra_checks, pos_args From 2ffa711ea5ad140635042b09eb5b739f90248a67 Mon Sep 17 00:00:00 2001 From: binarycat Date: Thu, 10 Jul 2025 19:36:27 -0500 Subject: [PATCH 058/139] REUSE.toml: add new package.json and package-lock.json --- REUSE.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/REUSE.toml b/REUSE.toml index 027b4ccbe259..13aa3e0a4112 100644 --- a/REUSE.toml +++ b/REUSE.toml @@ -37,6 +37,8 @@ path = [ "rust-bors.toml", "triagebot.toml", "typos.toml", + "package.json", + "package-lock.json", "x", "x.ps1", "x.py", From ca39010d3e7d3c512d5d8df8094862ffa146837f Mon Sep 17 00:00:00 2001 From: binarycat Date: Sat, 19 Jul 2025 14:52:31 -0500 Subject: [PATCH 059/139] update completions --- src/etc/completions/x.fish | 4 ---- src/etc/completions/x.ps1 | 4 ---- src/etc/completions/x.py.fish | 4 ---- src/etc/completions/x.py.ps1 | 4 ---- src/etc/completions/x.py.zsh | 4 ---- src/etc/completions/x.zsh | 4 ---- 6 files changed, 24 deletions(-) diff --git a/src/etc/completions/x.fish b/src/etc/completions/x.fish index f4e7413ca53a..a5e5bb8f09e8 100644 --- a/src/etc/completions/x.fish +++ b/src/etc/completions/x.fish @@ -299,11 +299,7 @@ complete -c x -n "__fish_x_using_subcommand doc" -l skip-std-check-if-no-downloa complete -c x -n "__fish_x_using_subcommand doc" -s h -l help -d 'Print help (see more with \'--help\')' complete -c x -n "__fish_x_using_subcommand test" -l test-args -d 'extra arguments to be passed for the test tool being used (e.g. libtest, compiletest or rustdoc)' -r complete -c x -n "__fish_x_using_subcommand test" -l compiletest-rustc-args -d 'extra options to pass the compiler when running compiletest tests' -r -<<<<<<< HEAD complete -c x -n "__fish_x_using_subcommand test" -l extra-checks -d 'comma-separated list of other files types to check (accepts py, py:lint, py:fmt, shell, cpp, cpp:fmt, js, js:lint, js:typecheck, spellcheck)' -r -======= -complete -c x -n "__fish_x_using_subcommand test" -l extra-checks -d 'comma-separated list of other files types to check (accepts py, py:lint, py:fmt, shell, cpp, cpp:fmt, js, js:lint, js:typecheck)' -r ->>>>>>> 98204a1f527 (bootstrap: js:es-lint was removed, remove it from the docs) complete -c x -n "__fish_x_using_subcommand test" -l compare-mode -d 'mode describing what file the actual ui output will be compared to' -r complete -c x -n "__fish_x_using_subcommand test" -l pass -d 'force {check,build,run}-pass tests to this mode' -r complete -c x -n "__fish_x_using_subcommand test" -l run -d 'whether to execute run-* tests' -r diff --git a/src/etc/completions/x.ps1 b/src/etc/completions/x.ps1 index fced6587d32a..4fee3bc0a869 100644 --- a/src/etc/completions/x.ps1 +++ b/src/etc/completions/x.ps1 @@ -345,11 +345,7 @@ Register-ArgumentCompleter -Native -CommandName 'x' -ScriptBlock { 'x;test' { [CompletionResult]::new('--test-args', '--test-args', [CompletionResultType]::ParameterName, 'extra arguments to be passed for the test tool being used (e.g. libtest, compiletest or rustdoc)') [CompletionResult]::new('--compiletest-rustc-args', '--compiletest-rustc-args', [CompletionResultType]::ParameterName, 'extra options to pass the compiler when running compiletest tests') -<<<<<<< HEAD [CompletionResult]::new('--extra-checks', '--extra-checks', [CompletionResultType]::ParameterName, 'comma-separated list of other files types to check (accepts py, py:lint, py:fmt, shell, cpp, cpp:fmt, js, js:lint, js:typecheck, spellcheck)') -======= - [CompletionResult]::new('--extra-checks', '--extra-checks', [CompletionResultType]::ParameterName, 'comma-separated list of other files types to check (accepts py, py:lint, py:fmt, shell, cpp, cpp:fmt, js, js:lint, js:typecheck)') ->>>>>>> 98204a1f527 (bootstrap: js:es-lint was removed, remove it from the docs) [CompletionResult]::new('--compare-mode', '--compare-mode', [CompletionResultType]::ParameterName, 'mode describing what file the actual ui output will be compared to') [CompletionResult]::new('--pass', '--pass', [CompletionResultType]::ParameterName, 'force {check,build,run}-pass tests to this mode') [CompletionResult]::new('--run', '--run', [CompletionResultType]::ParameterName, 'whether to execute run-* tests') diff --git a/src/etc/completions/x.py.fish b/src/etc/completions/x.py.fish index c80750111f7b..e2e6ae05ee03 100644 --- a/src/etc/completions/x.py.fish +++ b/src/etc/completions/x.py.fish @@ -299,11 +299,7 @@ complete -c x.py -n "__fish_x.py_using_subcommand doc" -l skip-std-check-if-no-d complete -c x.py -n "__fish_x.py_using_subcommand doc" -s h -l help -d 'Print help (see more with \'--help\')' complete -c x.py -n "__fish_x.py_using_subcommand test" -l test-args -d 'extra arguments to be passed for the test tool being used (e.g. libtest, compiletest or rustdoc)' -r complete -c x.py -n "__fish_x.py_using_subcommand test" -l compiletest-rustc-args -d 'extra options to pass the compiler when running compiletest tests' -r -<<<<<<< HEAD complete -c x.py -n "__fish_x.py_using_subcommand test" -l extra-checks -d 'comma-separated list of other files types to check (accepts py, py:lint, py:fmt, shell, cpp, cpp:fmt, js, js:lint, js:typecheck, spellcheck)' -r -======= -complete -c x.py -n "__fish_x.py_using_subcommand test" -l extra-checks -d 'comma-separated list of other files types to check (accepts py, py:lint, py:fmt, shell, cpp, cpp:fmt, js, js:lint, js:typecheck)' -r ->>>>>>> 98204a1f527 (bootstrap: js:es-lint was removed, remove it from the docs) complete -c x.py -n "__fish_x.py_using_subcommand test" -l compare-mode -d 'mode describing what file the actual ui output will be compared to' -r complete -c x.py -n "__fish_x.py_using_subcommand test" -l pass -d 'force {check,build,run}-pass tests to this mode' -r complete -c x.py -n "__fish_x.py_using_subcommand test" -l run -d 'whether to execute run-* tests' -r diff --git a/src/etc/completions/x.py.ps1 b/src/etc/completions/x.py.ps1 index dfb6482b41c8..ea3aacc21c7a 100644 --- a/src/etc/completions/x.py.ps1 +++ b/src/etc/completions/x.py.ps1 @@ -345,11 +345,7 @@ Register-ArgumentCompleter -Native -CommandName 'x.py' -ScriptBlock { 'x.py;test' { [CompletionResult]::new('--test-args', '--test-args', [CompletionResultType]::ParameterName, 'extra arguments to be passed for the test tool being used (e.g. libtest, compiletest or rustdoc)') [CompletionResult]::new('--compiletest-rustc-args', '--compiletest-rustc-args', [CompletionResultType]::ParameterName, 'extra options to pass the compiler when running compiletest tests') -<<<<<<< HEAD [CompletionResult]::new('--extra-checks', '--extra-checks', [CompletionResultType]::ParameterName, 'comma-separated list of other files types to check (accepts py, py:lint, py:fmt, shell, cpp, cpp:fmt, js, js:lint, js:typecheck, spellcheck)') -======= - [CompletionResult]::new('--extra-checks', '--extra-checks', [CompletionResultType]::ParameterName, 'comma-separated list of other files types to check (accepts py, py:lint, py:fmt, shell, cpp, cpp:fmt, js, js:lint, js:typecheck)') ->>>>>>> 98204a1f527 (bootstrap: js:es-lint was removed, remove it from the docs) [CompletionResult]::new('--compare-mode', '--compare-mode', [CompletionResultType]::ParameterName, 'mode describing what file the actual ui output will be compared to') [CompletionResult]::new('--pass', '--pass', [CompletionResultType]::ParameterName, 'force {check,build,run}-pass tests to this mode') [CompletionResult]::new('--run', '--run', [CompletionResultType]::ParameterName, 'whether to execute run-* tests') diff --git a/src/etc/completions/x.py.zsh b/src/etc/completions/x.py.zsh index 8ccc7a7091ce..32e986ad141f 100644 --- a/src/etc/completions/x.py.zsh +++ b/src/etc/completions/x.py.zsh @@ -345,11 +345,7 @@ _arguments "${_arguments_options[@]}" : \ _arguments "${_arguments_options[@]}" : \ '*--test-args=[extra arguments to be passed for the test tool being used (e.g. libtest, compiletest or rustdoc)]:ARGS:_default' \ '*--compiletest-rustc-args=[extra options to pass the compiler when running compiletest tests]:ARGS:_default' \ -<<<<<<< HEAD '--extra-checks=[comma-separated list of other files types to check (accepts py, py\:lint, py\:fmt, shell, cpp, cpp\:fmt, js, js\:lint, js\:typecheck, spellcheck)]:EXTRA_CHECKS:_default' \ -======= -'--extra-checks=[comma-separated list of other files types to check (accepts py, py\:lint, py\:fmt, shell, cpp, cpp\:fmt, js, js\:lint, js\:typecheck)]:EXTRA_CHECKS:_default' \ ->>>>>>> 98204a1f527 (bootstrap: js:es-lint was removed, remove it from the docs) '--compare-mode=[mode describing what file the actual ui output will be compared to]:COMPARE MODE:_default' \ '--pass=[force {check,build,run}-pass tests to this mode]:check | build | run:_default' \ '--run=[whether to execute run-* tests]:auto | always | never:_default' \ diff --git a/src/etc/completions/x.zsh b/src/etc/completions/x.zsh index 8c00abb7b21a..65995553276d 100644 --- a/src/etc/completions/x.zsh +++ b/src/etc/completions/x.zsh @@ -345,11 +345,7 @@ _arguments "${_arguments_options[@]}" : \ _arguments "${_arguments_options[@]}" : \ '*--test-args=[extra arguments to be passed for the test tool being used (e.g. libtest, compiletest or rustdoc)]:ARGS:_default' \ '*--compiletest-rustc-args=[extra options to pass the compiler when running compiletest tests]:ARGS:_default' \ -<<<<<<< HEAD '--extra-checks=[comma-separated list of other files types to check (accepts py, py\:lint, py\:fmt, shell, cpp, cpp\:fmt, js, js\:lint, js\:typecheck, spellcheck)]:EXTRA_CHECKS:_default' \ -======= -'--extra-checks=[comma-separated list of other files types to check (accepts py, py\:lint, py\:fmt, shell, cpp, cpp\:fmt, js, js\:lint, js\:typecheck)]:EXTRA_CHECKS:_default' \ ->>>>>>> 98204a1f527 (bootstrap: js:es-lint was removed, remove it from the docs) '--compare-mode=[mode describing what file the actual ui output will be compared to]:COMPARE MODE:_default' \ '--pass=[force {check,build,run}-pass tests to this mode]:check | build | run:_default' \ '--run=[whether to execute run-* tests]:auto | always | never:_default' \ From c6d50eaa497ef0c3013d21f23cd85e6e97c32c2c Mon Sep 17 00:00:00 2001 From: binarycat Date: Sat, 19 Jul 2025 14:56:42 -0500 Subject: [PATCH 060/139] integrate build_helper::npm into js checks and package.json usage --- src/build_helper/src/npm.rs | 43 ++++++++++++------- src/tools/rustdoc-gui-test/src/main.rs | 6 +-- .../tidy/src/ext_tool_checks/rustdoc_js.rs | 39 +++-------------- 3 files changed, 34 insertions(+), 54 deletions(-) diff --git a/src/build_helper/src/npm.rs b/src/build_helper/src/npm.rs index dedef40978dd..86cf6183bd04 100644 --- a/src/build_helper/src/npm.rs +++ b/src/build_helper/src/npm.rs @@ -3,23 +3,34 @@ use std::path::{Path, PathBuf}; use std::process::Command; use std::{fs, io}; -/// Install an exact package version, and return the path of `node_modules`. -pub fn install_one( - out_dir: &Path, - npm_bin: &Path, - pkg_name: &str, - pkg_version: &str, -) -> Result { +use crate::ci::CiEnv; + +/// Install all the npm deps, and return the path of `node_modules`. +pub fn install(src_root_path: &Path, out_dir: &Path, npm: &Path) -> Result { let nm_path = out_dir.join("node_modules"); - let _ = fs::create_dir(&nm_path); - let mut child = Command::new(npm_bin) - .arg("install") - .arg("--audit=false") - .arg("--fund=false") - .arg(format!("{pkg_name}@{pkg_version}")) - .current_dir(out_dir) - .spawn()?; - let exit_status = child.wait()?; + let copy_to_build = |p| { + fs::copy(src_root_path.join(p), out_dir.join(p)).map_err(|e| { + eprintln!("unable to copy {p:?} to build directory: {e:?}"); + e + }) + }; + // copy stuff to the output directory to make node_modules get put there. + copy_to_build("package.json")?; + copy_to_build("package-lock.json")?; + + let mut cmd = Command::new(npm); + if CiEnv::is_ci() { + // `npm ci` redownloads every time and thus is too slow for local development. + cmd.arg("ci"); + } else { + cmd.arg("install"); + } + // disable a bunch of things we don't want. + // this makes tidy output less noisy, and also significantly improves runtime + // of repeated tidy invokations. + cmd.args(&["--audit=false", "--save=false", "--fund=false"]); + cmd.current_dir(out_dir); + let exit_status = cmd.spawn()?.wait()?; if !exit_status.success() { eprintln!("npm install did not exit successfully"); return Err(io::Error::other(Box::::from(format!( diff --git a/src/tools/rustdoc-gui-test/src/main.rs b/src/tools/rustdoc-gui-test/src/main.rs index 5b86bea89329..42feae8c2080 100644 --- a/src/tools/rustdoc-gui-test/src/main.rs +++ b/src/tools/rustdoc-gui-test/src/main.rs @@ -65,10 +65,8 @@ fn main() -> Result<(), ()> { } } - // FIXME(binarycat): once we get package.json in version control, this should be updated to install via that instead - let local_node_modules = - npm::install_one(&config.out_dir, &config.npm, "browser-ui-test", "0.21.1") - .expect("unable to install browser-ui-test"); + let local_node_modules = npm::install(&config.rust_src, &config.out_dir, &config.npm) + .expect("unable to install browser-ui-test"); let mut command = Command::new(&config.nodejs); diff --git a/src/tools/tidy/src/ext_tool_checks/rustdoc_js.rs b/src/tools/tidy/src/ext_tool_checks/rustdoc_js.rs index f96c9612a8e1..c1a62cedd331 100644 --- a/src/tools/tidy/src/ext_tool_checks/rustdoc_js.rs +++ b/src/tools/tidy/src/ext_tool_checks/rustdoc_js.rs @@ -2,11 +2,11 @@ //! characters. use std::ffi::OsStr; +use std::io; use std::path::{Path, PathBuf}; use std::process::{Child, Command}; -use std::{fs, io}; -use build_helper::ci::CiEnv; +use build_helper::npm; use ignore::DirEntry; use crate::walk::walk_no_read; @@ -24,38 +24,9 @@ fn spawn_cmd(cmd: &mut Command) -> Result { /// install all js dependencies from package.json. pub(super) fn npm_install(root_path: &Path, outdir: &Path) -> Result<(), super::Error> { - let copy_to_build = |p| { - fs::copy(root_path.join(p), outdir.join(p)).map_err(|e| { - eprintln!("unable to copy {p:?} to build directory: {e:?}"); - e - }) - }; - // copy stuff to the output directory to make node_modules get put there. - copy_to_build("package.json")?; - copy_to_build("package-lock.json")?; - - let mut cmd = Command::new("npm"); - if CiEnv::is_ci() { - // `npm ci` redownloads every time and thus is too slow for local development. - cmd.arg("ci"); - } else { - cmd.arg("install"); - } - // disable a bunch of things we don't want. - // this makes tidy output less noisy, and also significantly improves runtime - // of repeated tidy invokations. - cmd.args(&["--audit=false", "--save=false", "--fund=false"]); - cmd.current_dir(outdir); - let mut child = spawn_cmd(&mut cmd)?; - match child.wait() { - Ok(exit_status) => { - if exit_status.success() { - return Ok(()); - } - Err(super::Error::FailedCheck("npm install")) - } - Err(error) => Err(super::Error::Generic(format!("npm install failed: {error:?}"))), - } + // FIXME(lolbinarycat): make this obey build.npm bootstrap option + npm::install(root_path, outdir, Path::new("npm"))?; + Ok(()) } fn rustdoc_js_files(librustdoc_path: &Path) -> Vec { From 258e410feb78aaa2cc897f80124bc67c949df93b Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Thu, 3 Jul 2025 13:37:41 +0000 Subject: [PATCH 061/139] Unquerify maybe_unused_trait_imports. --- compiler/rustc_hir_analysis/src/check_unused.rs | 2 +- compiler/rustc_middle/src/query/mod.rs | 3 --- compiler/rustc_middle/src/ty/context.rs | 2 -- src/tools/clippy/clippy_lints/src/unused_trait_names.rs | 2 +- 4 files changed, 2 insertions(+), 7 deletions(-) diff --git a/compiler/rustc_hir_analysis/src/check_unused.rs b/compiler/rustc_hir_analysis/src/check_unused.rs index 0133b1e8fcd3..3fb33c741c9d 100644 --- a/compiler/rustc_hir_analysis/src/check_unused.rs +++ b/compiler/rustc_hir_analysis/src/check_unused.rs @@ -18,7 +18,7 @@ pub(super) fn check_unused_traits(tcx: TyCtxt<'_>, (): ()) { used_trait_imports.extend_unord(imports.items().copied()); } - for &id in tcx.maybe_unused_trait_imports(()) { + for &id in tcx.resolutions(()).maybe_unused_trait_imports.iter() { debug_assert_eq!(tcx.def_kind(id), DefKind::Use); if tcx.visibility(id).is_public() { continue; diff --git a/compiler/rustc_middle/src/query/mod.rs b/compiler/rustc_middle/src/query/mod.rs index ae8c8259be4c..ad7f4973e235 100644 --- a/compiler/rustc_middle/src/query/mod.rs +++ b/compiler/rustc_middle/src/query/mod.rs @@ -2285,9 +2285,6 @@ rustc_queries! { query upvars_mentioned(def_id: DefId) -> Option<&'tcx FxIndexMap> { desc { |tcx| "collecting upvars mentioned in `{}`", tcx.def_path_str(def_id) } } - query maybe_unused_trait_imports(_: ()) -> &'tcx FxIndexSet { - desc { "fetching potentially unused trait imports" } - } /// All available crates in the graph, including those that should not be user-facing /// (such as private crates). diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs index 7e6bcfee0254..51db92ecd78f 100644 --- a/compiler/rustc_middle/src/ty/context.rs +++ b/compiler/rustc_middle/src/ty/context.rs @@ -3428,8 +3428,6 @@ pub struct DeducedParamAttrs { } pub fn provide(providers: &mut Providers) { - providers.maybe_unused_trait_imports = - |tcx, ()| &tcx.resolutions(()).maybe_unused_trait_imports; providers.extern_mod_stmt_cnum = |tcx, id| tcx.resolutions(()).extern_crate_map.get(&id).cloned(); providers.is_panic_runtime = diff --git a/src/tools/clippy/clippy_lints/src/unused_trait_names.rs b/src/tools/clippy/clippy_lints/src/unused_trait_names.rs index 610cec7b8c8d..b7a1d5b2123e 100644 --- a/src/tools/clippy/clippy_lints/src/unused_trait_names.rs +++ b/src/tools/clippy/clippy_lints/src/unused_trait_names.rs @@ -65,7 +65,7 @@ impl<'tcx> LateLintPass<'tcx> for UnusedTraitNames { && ident.name != kw::Underscore // Only check traits && let Some(Res::Def(DefKind::Trait, _)) = path.res.type_ns - && cx.tcx.maybe_unused_trait_imports(()).contains(&item.owner_id.def_id) + && cx.tcx.resolutions(()).maybe_unused_trait_imports.contains(&item.owner_id.def_id) // Only check this import if it is visible to its module only (no pub, pub(crate), ...) && let module = cx.tcx.parent_module_from_def_id(item.owner_id.def_id) && cx.tcx.visibility(item.owner_id.def_id) == Visibility::Restricted(module.to_def_id()) From f147716e7d5a3b4e1e4c0e8b5b5dd26da00cdab0 Mon Sep 17 00:00:00 2001 From: Marijn Schouten Date: Sun, 20 Jul 2025 05:33:25 +0000 Subject: [PATCH 062/139] flt2dec: use fill instead of loop --- library/core/src/num/flt2dec/mod.rs | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/library/core/src/num/flt2dec/mod.rs b/library/core/src/num/flt2dec/mod.rs index 7601e3e2c58a..e79a00a86596 100644 --- a/library/core/src/num/flt2dec/mod.rs +++ b/library/core/src/num/flt2dec/mod.rs @@ -150,23 +150,19 @@ pub fn round_up(d: &mut [u8]) -> Option { Some(i) => { // d[i+1..n] is all nines d[i] += 1; - for j in i + 1..d.len() { - d[j] = b'0'; - } + d[i + 1..].fill(b'0'); None } - None if d.len() > 0 => { - // 999..999 rounds to 1000..000 with an increased exponent - d[0] = b'1'; - for j in 1..d.len() { - d[j] = b'0'; - } - Some(b'0') - } - None => { + None if d.is_empty() => { // an empty buffer rounds up (a bit strange but reasonable) Some(b'1') } + None => { + // 999..999 rounds to 1000..000 with an increased exponent + d[0] = b'1'; + d[1..].fill(b'0'); + Some(b'0') + } } } From 725523e9b0b7f8c415e238a09a61688a7f3d36a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Ml=C3=A1dek?= Date: Wed, 16 Jul 2025 17:49:47 +0200 Subject: [PATCH 063/139] tests: cover more `exported_private_dependencies` cases --- .../pub-priv-dep/auxiliary/priv_dep.rs | 6 + tests/ui/privacy/pub-priv-dep/pub-priv1.rs | 71 +++++++- .../ui/privacy/pub-priv-dep/pub-priv1.stderr | 166 ++++++++++++++++-- 3 files changed, 223 insertions(+), 20 deletions(-) diff --git a/tests/ui/privacy/pub-priv-dep/auxiliary/priv_dep.rs b/tests/ui/privacy/pub-priv-dep/auxiliary/priv_dep.rs index 756401470262..d389f8c861a4 100644 --- a/tests/ui/privacy/pub-priv-dep/auxiliary/priv_dep.rs +++ b/tests/ui/privacy/pub-priv-dep/auxiliary/priv_dep.rs @@ -10,3 +10,9 @@ macro_rules! m { pub enum E { V1 } + +struct PrivType; + +pub type Unit = (); +pub type PubPub = OtherType; +pub type PubPriv = PrivType; diff --git a/tests/ui/privacy/pub-priv-dep/pub-priv1.rs b/tests/ui/privacy/pub-priv-dep/pub-priv1.rs index b85f2754fb18..eae0f9756a10 100644 --- a/tests/ui/privacy/pub-priv-dep/pub-priv1.rs +++ b/tests/ui/privacy/pub-priv-dep/pub-priv1.rs @@ -32,6 +32,33 @@ pub struct PublicType { pub other_field: PubType, // Type from public dependency - this is fine } +pub struct PublicTuple( + pub OtherType, + //~^ ERROR type `OtherType` from private dependency 'priv_dep' in public interface [exported_private_dependencies] + OtherType, + pub PubType, +); + +pub enum PublicEnum { + OtherType, + ActualOtherType(OtherType, PubType), + //~^ ERROR type `OtherType` from private dependency 'priv_dep' in public interface [exported_private_dependencies] + ActualOtherTypeStruct { + field: OtherType, + //~^ ERROR type `OtherType` from private dependency 'priv_dep' in public interface [exported_private_dependencies] + other_field: PubType, + }, +} + +pub struct PublicGenericType(pub T, U); +pub type ReexportedPublicGeneric = PublicGenericType; +//~^ ERROR type `OtherType` from private dependency 'priv_dep' in public interface +pub type ReexportedPrivateGeneric = PublicGenericType<(), OtherType>; +//~^ ERROR type `OtherType` from private dependency 'priv_dep' in public interface + +pub struct PublicGenericBoundedType(T); +//~^ ERROR trait `OtherTrait` from private dependency 'priv_dep' in public interface + impl PublicType { pub fn pub_fn_param(param: OtherType) {} //~^ ERROR type `OtherType` from private dependency 'priv_dep' in public interface @@ -46,9 +73,15 @@ pub trait MyPubTrait { type Foo: OtherTrait; //~^ ERROR trait `OtherTrait` from private dependency 'priv_dep' in public interface - fn required() -> impl OtherTrait; + fn required_impl_trait() -> impl OtherTrait; - fn provided() -> impl OtherTrait { OtherType } + fn provided_impl_trait() -> impl OtherTrait { OtherType } + + fn required_concrete() -> OtherType; + //~^ ERROR type `OtherType` from private dependency 'priv_dep' in public interface + + fn provided_concrete() -> OtherType { OtherType } + //~^ ERROR type `OtherType` from private dependency 'priv_dep' in public interface } pub trait WithSuperTrait: OtherTrait {} @@ -67,6 +100,12 @@ impl PubLocalTraitWithAssoc for PrivateAssoc { pub fn in_bounds(x: T) { unimplemented!() } //~^ ERROR trait `OtherTrait` from private dependency 'priv_dep' in public interface +pub fn private_return_impl_trait() -> impl OtherTrait { OtherType } +//~^ ERROR trait `OtherTrait` from private dependency 'priv_dep' in public interface + +pub fn private_return() -> OtherType { OtherType } +//~^ ERROR type `OtherType` from private dependency 'priv_dep' in public interface + pub fn private_in_generic() -> std::num::Saturating { unimplemented!() } //~^ ERROR type `OtherType` from private dependency 'priv_dep' in public interface @@ -79,6 +118,9 @@ pub const CONST: OtherType = OtherType; pub type Alias = OtherType; //~^ ERROR type `OtherType` from private dependency 'priv_dep' in public interface +pub type AliasOfAlias = priv_dep::PubPub; +//~^ ERROR type `OtherType` from private dependency 'priv_dep' in public interface + pub struct PublicWithPrivateImpl; impl OtherTrait for PublicWithPrivateImpl {} @@ -90,6 +132,22 @@ impl PubTraitOnPrivate for OtherType {} //~^ ERROR type `OtherType` from private dependency 'priv_dep' in public interface //~| ERROR type `OtherType` from private dependency 'priv_dep' in public interface +pub struct PublicWithStdImpl; + +impl From for PublicWithStdImpl { +//~^ ERROR type `OtherType` from private dependency 'priv_dep' in public interface + fn from(val: OtherType) -> Self { Self } + //~^ ERROR type `OtherType` from private dependency 'priv_dep' in public interface +} + +impl From for OtherType { + //~^ ERROR type `OtherType` from private dependency 'priv_dep' in public interface + //~| ERROR type `OtherType` from private dependency 'priv_dep' in public interface + fn from(val: PublicWithStdImpl) -> Self { Self } + //~^ ERROR type `OtherType` from private dependency 'priv_dep' in public interface + //~| ERROR type `OtherType` from private dependency 'priv_dep' in public interface +} + pub struct AllowedPrivType { #[allow(exported_private_dependencies)] pub allowed: OtherType, @@ -107,4 +165,13 @@ pub use pm::pm_attr; pub use priv_dep::E::V1; //~^ ERROR variant `V1` from private dependency 'priv_dep' is re-exported +pub use priv_dep::Unit; +//~^ ERROR type alias `Unit` from private dependency 'priv_dep' is re-exported +pub use priv_dep::PubPub; +//~^ ERROR type alias `PubPub` from private dependency 'priv_dep' is re-exported +pub use priv_dep::PubPriv; +//~^ ERROR type alias `PubPriv` from private dependency 'priv_dep' is re-exported +pub use priv_dep::OtherType as Renamed; +//~^ ERROR struct `Renamed` from private dependency 'priv_dep' is re-exported + fn main() {} diff --git a/tests/ui/privacy/pub-priv-dep/pub-priv1.stderr b/tests/ui/privacy/pub-priv-dep/pub-priv1.stderr index 24bd071567fc..e66db53f65dd 100644 --- a/tests/ui/privacy/pub-priv-dep/pub-priv1.stderr +++ b/tests/ui/privacy/pub-priv-dep/pub-priv1.stderr @@ -11,35 +11,59 @@ LL | #![deny(exported_private_dependencies)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: macro `m` from private dependency 'priv_dep' is re-exported - --> $DIR/pub-priv1.rs:98:9 + --> $DIR/pub-priv1.rs:156:9 | LL | pub use priv_dep::m; | ^^^^^^^^^^^ error: macro `fn_like` from private dependency 'pm' is re-exported - --> $DIR/pub-priv1.rs:100:9 + --> $DIR/pub-priv1.rs:158:9 | LL | pub use pm::fn_like; | ^^^^^^^^^^^ error: derive macro `PmDerive` from private dependency 'pm' is re-exported - --> $DIR/pub-priv1.rs:102:9 + --> $DIR/pub-priv1.rs:160:9 | LL | pub use pm::PmDerive; | ^^^^^^^^^^^^ error: attribute macro `pm_attr` from private dependency 'pm' is re-exported - --> $DIR/pub-priv1.rs:104:9 + --> $DIR/pub-priv1.rs:162:9 | LL | pub use pm::pm_attr; | ^^^^^^^^^^^ error: variant `V1` from private dependency 'priv_dep' is re-exported - --> $DIR/pub-priv1.rs:107:9 + --> $DIR/pub-priv1.rs:165:9 | LL | pub use priv_dep::E::V1; | ^^^^^^^^^^^^^^^ +error: type alias `Unit` from private dependency 'priv_dep' is re-exported + --> $DIR/pub-priv1.rs:168:9 + | +LL | pub use priv_dep::Unit; + | ^^^^^^^^^^^^^^ + +error: type alias `PubPub` from private dependency 'priv_dep' is re-exported + --> $DIR/pub-priv1.rs:170:9 + | +LL | pub use priv_dep::PubPub; + | ^^^^^^^^^^^^^^^^ + +error: type alias `PubPriv` from private dependency 'priv_dep' is re-exported + --> $DIR/pub-priv1.rs:172:9 + | +LL | pub use priv_dep::PubPriv; + | ^^^^^^^^^^^^^^^^^ + +error: struct `Renamed` from private dependency 'priv_dep' is re-exported + --> $DIR/pub-priv1.rs:174:9 + | +LL | pub use priv_dep::OtherType as Renamed; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + error: type `OtherType` from private dependency 'priv_dep' in public interface --> $DIR/pub-priv1.rs:29:5 | @@ -49,82 +73,188 @@ LL | pub field: OtherType, error: type `OtherType` from private dependency 'priv_dep' in public interface --> $DIR/pub-priv1.rs:36:5 | +LL | pub OtherType, + | ^^^^^^^^^^^^^ + +error: type `OtherType` from private dependency 'priv_dep' in public interface + --> $DIR/pub-priv1.rs:44:21 + | +LL | ActualOtherType(OtherType, PubType), + | ^^^^^^^^^ + +error: type `OtherType` from private dependency 'priv_dep' in public interface + --> $DIR/pub-priv1.rs:47:9 + | +LL | field: OtherType, + | ^^^^^^^^^^^^^^^^ + +error: type `OtherType` from private dependency 'priv_dep' in public interface + --> $DIR/pub-priv1.rs:54:1 + | +LL | pub type ReexportedPublicGeneric = PublicGenericType; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: type `OtherType` from private dependency 'priv_dep' in public interface + --> $DIR/pub-priv1.rs:56:1 + | +LL | pub type ReexportedPrivateGeneric = PublicGenericType<(), OtherType>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: trait `OtherTrait` from private dependency 'priv_dep' in public interface + --> $DIR/pub-priv1.rs:59:1 + | +LL | pub struct PublicGenericBoundedType(T); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: type `OtherType` from private dependency 'priv_dep' in public interface + --> $DIR/pub-priv1.rs:63:5 + | LL | pub fn pub_fn_param(param: OtherType) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: type `OtherType` from private dependency 'priv_dep' in public interface - --> $DIR/pub-priv1.rs:39:5 + --> $DIR/pub-priv1.rs:66:5 | LL | pub fn pub_fn_return() -> OtherType { OtherType } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: trait `OtherTrait` from private dependency 'priv_dep' in public interface - --> $DIR/pub-priv1.rs:46:5 + --> $DIR/pub-priv1.rs:73:5 | LL | type Foo: OtherTrait; | ^^^^^^^^^^^^^^^^^^^^ +error: type `OtherType` from private dependency 'priv_dep' in public interface + --> $DIR/pub-priv1.rs:80:5 + | +LL | fn required_concrete() -> OtherType; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: type `OtherType` from private dependency 'priv_dep' in public interface + --> $DIR/pub-priv1.rs:83:5 + | +LL | fn provided_concrete() -> OtherType { OtherType } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + error: trait `OtherTrait` from private dependency 'priv_dep' in public interface - --> $DIR/pub-priv1.rs:54:1 + --> $DIR/pub-priv1.rs:87:1 | LL | pub trait WithSuperTrait: OtherTrait {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: type `OtherType` from private dependency 'priv_dep' in public interface - --> $DIR/pub-priv1.rs:63:5 + --> $DIR/pub-priv1.rs:96:5 | LL | type X = OtherType; | ^^^^^^ error: trait `OtherTrait` from private dependency 'priv_dep' in public interface - --> $DIR/pub-priv1.rs:67:1 + --> $DIR/pub-priv1.rs:100:1 | LL | pub fn in_bounds(x: T) { unimplemented!() } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +error: trait `OtherTrait` from private dependency 'priv_dep' in public interface + --> $DIR/pub-priv1.rs:103:1 + | +LL | pub fn private_return_impl_trait() -> impl OtherTrait { OtherType } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + error: type `OtherType` from private dependency 'priv_dep' in public interface - --> $DIR/pub-priv1.rs:70:1 + --> $DIR/pub-priv1.rs:106:1 + | +LL | pub fn private_return() -> OtherType { OtherType } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: type `OtherType` from private dependency 'priv_dep' in public interface + --> $DIR/pub-priv1.rs:109:1 | LL | pub fn private_in_generic() -> std::num::Saturating { unimplemented!() } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: type `OtherType` from private dependency 'priv_dep' in public interface - --> $DIR/pub-priv1.rs:73:1 + --> $DIR/pub-priv1.rs:112:1 | LL | pub static STATIC: OtherType = OtherType; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: type `OtherType` from private dependency 'priv_dep' in public interface - --> $DIR/pub-priv1.rs:76:1 + --> $DIR/pub-priv1.rs:115:1 | LL | pub const CONST: OtherType = OtherType; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: type `OtherType` from private dependency 'priv_dep' in public interface - --> $DIR/pub-priv1.rs:79:1 + --> $DIR/pub-priv1.rs:118:1 | LL | pub type Alias = OtherType; | ^^^^^^^^^^^^^^ +error: type `OtherType` from private dependency 'priv_dep' in public interface + --> $DIR/pub-priv1.rs:121:1 + | +LL | pub type AliasOfAlias = priv_dep::PubPub; + | ^^^^^^^^^^^^^^^^^^^^^ + error: trait `OtherTrait` from private dependency 'priv_dep' in public interface - --> $DIR/pub-priv1.rs:84:1 + --> $DIR/pub-priv1.rs:126:1 | LL | impl OtherTrait for PublicWithPrivateImpl {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: type `OtherType` from private dependency 'priv_dep' in public interface - --> $DIR/pub-priv1.rs:89:1 + --> $DIR/pub-priv1.rs:131:1 | LL | impl PubTraitOnPrivate for OtherType {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: type `OtherType` from private dependency 'priv_dep' in public interface - --> $DIR/pub-priv1.rs:89:1 + --> $DIR/pub-priv1.rs:131:1 | LL | impl PubTraitOnPrivate for OtherType {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -error: aborting due to 20 previous errors +error: type `OtherType` from private dependency 'priv_dep' in public interface + --> $DIR/pub-priv1.rs:137:1 + | +LL | impl From for PublicWithStdImpl { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: type `OtherType` from private dependency 'priv_dep' in public interface + --> $DIR/pub-priv1.rs:139:5 + | +LL | fn from(val: OtherType) -> Self { Self } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: type `OtherType` from private dependency 'priv_dep' in public interface + --> $DIR/pub-priv1.rs:143:1 + | +LL | impl From for OtherType { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: type `OtherType` from private dependency 'priv_dep' in public interface + --> $DIR/pub-priv1.rs:143:1 + | +LL | impl From for OtherType { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: type `OtherType` from private dependency 'priv_dep' in public interface + --> $DIR/pub-priv1.rs:146:5 + | +LL | fn from(val: PublicWithStdImpl) -> Self { Self } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: type `OtherType` from private dependency 'priv_dep' in public interface + --> $DIR/pub-priv1.rs:146:5 + | +LL | fn from(val: PublicWithStdImpl) -> Self { Self } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: aborting due to 41 previous errors From 1987471d05854cc8b5014dab44e7648834c02213 Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Sun, 20 Jul 2025 22:33:04 +0000 Subject: [PATCH 064/139] Consider parent predicates in ImpossiblePredicates pass. --- .../src/impossible_predicates.rs | 26 ++++++++++++++----- .../type-alias-bounds.neg.stderr | 25 +++++++++++------- .../generic_const_exprs/type-alias-bounds.rs | 1 + ...utable-due-to-trivial-bounds-ice-135138.rs | 3 ++- ...le-due-to-trivial-bounds-ice-135138.stderr | 6 ++--- .../layout/unknown-when-no-type-parameter.rs | 5 ++-- .../unknown-when-no-type-parameter.stderr | 7 ++--- .../unknown-when-ptr-metadata-is-DST.rs | 3 ++- .../unknown-when-ptr-metadata-is-DST.stderr | 6 ++--- .../trivial-bounds/everybody-copies.rs} | 7 +++-- .../trivial-bounds/two-sized-strs.rs} | 4 ++- 11 files changed, 58 insertions(+), 35 deletions(-) rename tests/{crashes/131507.rs => ui/trivial-bounds/everybody-copies.rs} (57%) rename tests/{crashes/121363.rs => ui/trivial-bounds/two-sized-strs.rs} (67%) diff --git a/compiler/rustc_mir_transform/src/impossible_predicates.rs b/compiler/rustc_mir_transform/src/impossible_predicates.rs index 86e2bf6cb3c6..5f116d7716db 100644 --- a/compiler/rustc_mir_transform/src/impossible_predicates.rs +++ b/compiler/rustc_mir_transform/src/impossible_predicates.rs @@ -27,7 +27,7 @@ //! it's usually never invoked in this way. use rustc_middle::mir::{Body, START_BLOCK, TerminatorKind}; -use rustc_middle::ty::{TyCtxt, TypeVisitableExt}; +use rustc_middle::ty::{TyCtxt, TypeFlags, TypeVisitableExt}; use rustc_trait_selection::traits; use tracing::trace; @@ -36,14 +36,26 @@ use crate::pass_manager::MirPass; pub(crate) struct ImpossiblePredicates; impl<'tcx> MirPass<'tcx> for ImpossiblePredicates { + #[tracing::instrument(level = "trace", skip(self, tcx, body))] fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) { - let predicates = tcx - .predicates_of(body.source.def_id()) + tracing::trace!(def_id = ?body.source.def_id()); + let predicates = tcx.predicates_of(body.source.def_id()).instantiate_identity(tcx); + tracing::trace!(?predicates); + let predicates = predicates .predicates - .iter() - .filter_map(|(p, _)| if p.is_global() { Some(*p) } else { None }); - if traits::impossible_predicates(tcx, traits::elaborate(tcx, predicates).collect()) { - trace!("found unsatisfiable predicates for {:?}", body.source); + .into_iter() + .filter(|p| { + !p.has_type_flags( + // Only consider global clauses to simplify. + TypeFlags::HAS_FREE_LOCAL_NAMES + // Clauses that refer to unevaluated constants as they cause cycles. + | TypeFlags::HAS_CT_PROJECTION, + ) + }) + .collect(); + tracing::trace!(?predicates); + if traits::impossible_predicates(tcx, predicates) { + trace!("found unsatisfiable predicates"); // Clear the body to only contain a single `unreachable` statement. let bbs = body.basic_blocks.as_mut(); bbs.raw.truncate(1); diff --git a/tests/ui/const-generics/generic_const_exprs/type-alias-bounds.neg.stderr b/tests/ui/const-generics/generic_const_exprs/type-alias-bounds.neg.stderr index fa12dd14753f..364fecb96ea9 100644 --- a/tests/ui/const-generics/generic_const_exprs/type-alias-bounds.neg.stderr +++ b/tests/ui/const-generics/generic_const_exprs/type-alias-bounds.neg.stderr @@ -10,8 +10,14 @@ note: required by a bound in `ct_unused_0::AliasConstUnused` LL | type AliasConstUnused = (T, I32<{ DATA }>); | ^^^^ required by this bound in `AliasConstUnused` +error[E0080]: entering unreachable code + --> $DIR/type-alias-bounds.rs:29:52 + | +LL | type AliasConstUnused where String: Copy = I32<{ 0; 0 }>; + | ^^^^^^^^ evaluation of `ct_unused_1::AliasConstUnused::{constant#0}` failed here + error[E0277]: the trait bound `String: Copy` is not satisfied - --> $DIR/type-alias-bounds.rs:31:12 + --> $DIR/type-alias-bounds.rs:32:12 | LL | let _: AliasConstUnused; | ^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `String` @@ -23,41 +29,42 @@ LL | type AliasConstUnused where String: Copy = I32<{ 0; 0 }>; | ^^^^ required by this bound in `AliasConstUnused` error[E0277]: the trait bound `String: Copy` is not satisfied - --> $DIR/type-alias-bounds.rs:39:12 + --> $DIR/type-alias-bounds.rs:40:12 | LL | let _: AliasFnUnused; | ^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `String` | note: required by a bound in `AliasFnUnused` - --> $DIR/type-alias-bounds.rs:36:27 + --> $DIR/type-alias-bounds.rs:37:27 | LL | type AliasFnUnused = (T, I32<{ code() }>); | ^^^^ required by this bound in `AliasFnUnused` error[E0277]: the trait bound `String: Copy` is not satisfied - --> $DIR/type-alias-bounds.rs:57:12 + --> $DIR/type-alias-bounds.rs:58:12 | LL | let _: AliasAssocConstUsed; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `String` | note: required by a bound in `AliasAssocConstUsed` - --> $DIR/type-alias-bounds.rs:55:41 + --> $DIR/type-alias-bounds.rs:56:41 | LL | type AliasAssocConstUsed = I32<{ T::DATA }>; | ^^^^ required by this bound in `AliasAssocConstUsed` error[E0277]: the trait bound `String: Copy` is not satisfied - --> $DIR/type-alias-bounds.rs:65:12 + --> $DIR/type-alias-bounds.rs:66:12 | LL | let _: AliasFnUsed; | ^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `String` | note: required by a bound in `AliasFnUsed` - --> $DIR/type-alias-bounds.rs:62:33 + --> $DIR/type-alias-bounds.rs:63:33 | LL | type AliasFnUsed = I32<{ code::() }>; | ^^^^ required by this bound in `AliasFnUsed` -error: aborting due to 5 previous errors +error: aborting due to 6 previous errors -For more information about this error, try `rustc --explain E0277`. +Some errors have detailed explanations: E0080, E0277. +For more information about an error, try `rustc --explain E0080`. diff --git a/tests/ui/const-generics/generic_const_exprs/type-alias-bounds.rs b/tests/ui/const-generics/generic_const_exprs/type-alias-bounds.rs index f16e646129c6..775b28f8c73a 100644 --- a/tests/ui/const-generics/generic_const_exprs/type-alias-bounds.rs +++ b/tests/ui/const-generics/generic_const_exprs/type-alias-bounds.rs @@ -27,6 +27,7 @@ fn ct_unused_0() { fn ct_unused_1() { #[allow(trivial_bounds)] type AliasConstUnused where String: Copy = I32<{ 0; 0 }>; + //[neg]~^ ERROR entering unreachable code #[cfg(neg)] let _: AliasConstUnused; //[neg]~^ ERROR the trait bound `String: Copy` is not satisfied diff --git a/tests/ui/layout/uncomputable-due-to-trivial-bounds-ice-135138.rs b/tests/ui/layout/uncomputable-due-to-trivial-bounds-ice-135138.rs index 4423b83e24d4..8015a2fe081f 100644 --- a/tests/ui/layout/uncomputable-due-to-trivial-bounds-ice-135138.rs +++ b/tests/ui/layout/uncomputable-due-to-trivial-bounds-ice-135138.rs @@ -5,7 +5,8 @@ where str: Sized, { [(); { let _a: Option = None; 0 }]; - //~^ ERROR the type `Option` has an unknown layout + //~^ ERROR entering unreachable code + //~| NOTE evaluation of `return_str::{constant#0}` failed here } fn main() {} diff --git a/tests/ui/layout/uncomputable-due-to-trivial-bounds-ice-135138.stderr b/tests/ui/layout/uncomputable-due-to-trivial-bounds-ice-135138.stderr index 43fe9e3a7a72..cad73b603c1e 100644 --- a/tests/ui/layout/uncomputable-due-to-trivial-bounds-ice-135138.stderr +++ b/tests/ui/layout/uncomputable-due-to-trivial-bounds-ice-135138.stderr @@ -1,8 +1,8 @@ -error[E0080]: the type `Option` has an unknown layout - --> $DIR/uncomputable-due-to-trivial-bounds-ice-135138.rs:7:16 +error[E0080]: entering unreachable code + --> $DIR/uncomputable-due-to-trivial-bounds-ice-135138.rs:7:10 | LL | [(); { let _a: Option = None; 0 }]; - | ^^ evaluation of `return_str::{constant#0}` failed here + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `return_str::{constant#0}` failed here error: aborting due to 1 previous error diff --git a/tests/ui/layout/unknown-when-no-type-parameter.rs b/tests/ui/layout/unknown-when-no-type-parameter.rs index f787998868d4..8579593c65c6 100644 --- a/tests/ui/layout/unknown-when-no-type-parameter.rs +++ b/tests/ui/layout/unknown-when-no-type-parameter.rs @@ -9,9 +9,8 @@ where (): Project, { [(); size_of::<<() as Project>::Assoc>()]; - //~^ ERROR the type `<() as Project>::Assoc` has an unknown layout - //~| NOTE inside `std::mem::size_of::<<() as Project>::Assoc>` - //~| NOTE failed inside this call + //~^ ERROR entering unreachable code + //~| NOTE evaluation of `foo::{constant#0}` failed here } fn main() {} diff --git a/tests/ui/layout/unknown-when-no-type-parameter.stderr b/tests/ui/layout/unknown-when-no-type-parameter.stderr index 9bb42c46ec3e..7c382c7a8550 100644 --- a/tests/ui/layout/unknown-when-no-type-parameter.stderr +++ b/tests/ui/layout/unknown-when-no-type-parameter.stderr @@ -1,11 +1,8 @@ -error[E0080]: the type `<() as Project>::Assoc` has an unknown layout +error[E0080]: entering unreachable code --> $DIR/unknown-when-no-type-parameter.rs:11:10 | LL | [(); size_of::<<() as Project>::Assoc>()]; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `foo::{constant#0}` failed inside this call - | -note: inside `std::mem::size_of::<<() as Project>::Assoc>` - --> $SRC_DIR/core/src/mem/mod.rs:LL:COL + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `foo::{constant#0}` failed here error: aborting due to 1 previous error diff --git a/tests/ui/layout/unknown-when-ptr-metadata-is-DST.rs b/tests/ui/layout/unknown-when-ptr-metadata-is-DST.rs index 54f339711d5c..da11804c2267 100644 --- a/tests/ui/layout/unknown-when-ptr-metadata-is-DST.rs +++ b/tests/ui/layout/unknown-when-ptr-metadata-is-DST.rs @@ -6,7 +6,8 @@ where str: std::ptr::Pointee, { [(); { let _a: Option<&str> = None; 0 }]; - //~^ ERROR the type `str` has an unknown layout + //~^ ERROR entering unreachable code + //~| NOTE evaluation of `return_str::{constant#0}` failed here } fn main() {} diff --git a/tests/ui/layout/unknown-when-ptr-metadata-is-DST.stderr b/tests/ui/layout/unknown-when-ptr-metadata-is-DST.stderr index fd9eedc9267a..888e2574119d 100644 --- a/tests/ui/layout/unknown-when-ptr-metadata-is-DST.stderr +++ b/tests/ui/layout/unknown-when-ptr-metadata-is-DST.stderr @@ -1,8 +1,8 @@ -error[E0080]: the type `str` has an unknown layout - --> $DIR/unknown-when-ptr-metadata-is-DST.rs:8:16 +error[E0080]: entering unreachable code + --> $DIR/unknown-when-ptr-metadata-is-DST.rs:8:10 | LL | [(); { let _a: Option<&str> = None; 0 }]; - | ^^ evaluation of `return_str::{constant#0}` failed here + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `return_str::{constant#0}` failed here error: aborting due to 1 previous error diff --git a/tests/crashes/131507.rs b/tests/ui/trivial-bounds/everybody-copies.rs similarity index 57% rename from tests/crashes/131507.rs rename to tests/ui/trivial-bounds/everybody-copies.rs index 05b5e76bed7d..3469fa1f1dae 100644 --- a/tests/crashes/131507.rs +++ b/tests/ui/trivial-bounds/everybody-copies.rs @@ -1,5 +1,8 @@ -//@ known-bug: #131507 -//@ compile-flags: -Zmir-enable-passes=+GVN -Zmir-enable-passes=+Inline -Zvalidate-mir +//! Regression test for #131507 +//@ compile-flags: -Zmir-enable-passes=+GVN -Zmir-enable-passes=+Inline -Zvalidate-mir --crate-type lib +//@ build-pass + +#![expect(incomplete_features)] #![feature(non_lifetime_binders)] fn brick() diff --git a/tests/crashes/121363.rs b/tests/ui/trivial-bounds/two-sized-strs.rs similarity index 67% rename from tests/crashes/121363.rs rename to tests/ui/trivial-bounds/two-sized-strs.rs index 387963422848..5cb82eac417f 100644 --- a/tests/crashes/121363.rs +++ b/tests/ui/trivial-bounds/two-sized-strs.rs @@ -1,7 +1,9 @@ -//@ known-bug: #121363 +//! Regression test for #121363 //@ compile-flags: -Zmir-enable-passes=+GVN --crate-type lib +//@ build-pass #![feature(trivial_bounds)] +#![expect(trivial_bounds)] #[derive(Debug)] struct TwoStrs(str, str) From 538b0004bc3a64004c9935c91231ed1d518ee35f Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Sun, 20 Jul 2025 23:12:44 +0000 Subject: [PATCH 065/139] Also bail out if predicates contain errors. --- .../src/impossible_predicates.rs | 4 ++-- tests/crashes/140100.rs | 7 ------- tests/crashes/140365.rs | 8 -------- tests/ui/mir/meaningless-bound.rs | 20 +++++++++++++++++++ tests/ui/mir/meaningless-bound.stderr | 19 ++++++++++++++++++ 5 files changed, 41 insertions(+), 17 deletions(-) delete mode 100644 tests/crashes/140100.rs delete mode 100644 tests/crashes/140365.rs create mode 100644 tests/ui/mir/meaningless-bound.rs create mode 100644 tests/ui/mir/meaningless-bound.stderr diff --git a/compiler/rustc_mir_transform/src/impossible_predicates.rs b/compiler/rustc_mir_transform/src/impossible_predicates.rs index 5f116d7716db..9a0de3c93263 100644 --- a/compiler/rustc_mir_transform/src/impossible_predicates.rs +++ b/compiler/rustc_mir_transform/src/impossible_predicates.rs @@ -41,7 +41,7 @@ impl<'tcx> MirPass<'tcx> for ImpossiblePredicates { tracing::trace!(def_id = ?body.source.def_id()); let predicates = tcx.predicates_of(body.source.def_id()).instantiate_identity(tcx); tracing::trace!(?predicates); - let predicates = predicates + let predicates: Vec<_> = predicates .predicates .into_iter() .filter(|p| { @@ -54,7 +54,7 @@ impl<'tcx> MirPass<'tcx> for ImpossiblePredicates { }) .collect(); tracing::trace!(?predicates); - if traits::impossible_predicates(tcx, predicates) { + if predicates.references_error() || traits::impossible_predicates(tcx, predicates) { trace!("found unsatisfiable predicates"); // Clear the body to only contain a single `unreachable` statement. let bbs = body.basic_blocks.as_mut(); diff --git a/tests/crashes/140100.rs b/tests/crashes/140100.rs deleted file mode 100644 index 0836ffe2d92f..000000000000 --- a/tests/crashes/140100.rs +++ /dev/null @@ -1,7 +0,0 @@ -//@ known-bug: #140100 -fn a() -where - b: Sized, -{ - println!() -} diff --git a/tests/crashes/140365.rs b/tests/crashes/140365.rs deleted file mode 100644 index 809ceaf35a05..000000000000 --- a/tests/crashes/140365.rs +++ /dev/null @@ -1,8 +0,0 @@ -//@ known-bug: #140365 -//@compile-flags: -C opt-level=1 -Zvalidate-mir -fn f() -> &'static str -where - Self: Sized, -{ - "" -} diff --git a/tests/ui/mir/meaningless-bound.rs b/tests/ui/mir/meaningless-bound.rs new file mode 100644 index 000000000000..c9427e7ece51 --- /dev/null +++ b/tests/ui/mir/meaningless-bound.rs @@ -0,0 +1,20 @@ +//! Regression test for #140100 and #140365 +//@compile-flags: -C opt-level=1 -Zvalidate-mir + +fn a() +where + b: Sized, + //~^ ERROR cannot find type `b` in this scope +{ + println!() +} + +fn f() -> &'static str +where + Self: Sized, + //~^ ERROR cannot find type `Self` in this scope +{ + "" +} + +fn main() {} diff --git a/tests/ui/mir/meaningless-bound.stderr b/tests/ui/mir/meaningless-bound.stderr new file mode 100644 index 000000000000..dc08def83b66 --- /dev/null +++ b/tests/ui/mir/meaningless-bound.stderr @@ -0,0 +1,19 @@ +error[E0412]: cannot find type `b` in this scope + --> $DIR/meaningless-bound.rs:6:5 + | +LL | b: Sized, + | ^ not found in this scope + +error[E0411]: cannot find type `Self` in this scope + --> $DIR/meaningless-bound.rs:14:5 + | +LL | fn f() -> &'static str + | - `Self` not allowed in a function +LL | where +LL | Self: Sized, + | ^^^^ `Self` is only available in impls, traits, and type definitions + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0411, E0412. +For more information about an error, try `rustc --explain E0411`. From 112799e63772988d874287979b5b4cc8b27668ab Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Fri, 4 Jul 2025 07:42:28 +0000 Subject: [PATCH 066/139] Merge modules and cached_modules for fat LTO The modules vec can already contain serialized modules and there is no need to distinguish between cached and non-cached cgus at LTO time. --- compiler/rustc_codegen_gcc/src/back/lto.rs | 12 ------------ compiler/rustc_codegen_gcc/src/lib.rs | 3 +-- compiler/rustc_codegen_llvm/src/back/lto.rs | 13 +------------ compiler/rustc_codegen_llvm/src/lib.rs | 3 +-- compiler/rustc_codegen_ssa/src/back/write.rs | 15 +++++++++++---- compiler/rustc_codegen_ssa/src/traits/write.rs | 1 - 6 files changed, 14 insertions(+), 33 deletions(-) diff --git a/compiler/rustc_codegen_gcc/src/back/lto.rs b/compiler/rustc_codegen_gcc/src/back/lto.rs index e554dd2500bd..9f2842d7abc8 100644 --- a/compiler/rustc_codegen_gcc/src/back/lto.rs +++ b/compiler/rustc_codegen_gcc/src/back/lto.rs @@ -175,7 +175,6 @@ fn save_as_file(obj: &[u8], path: &Path) -> Result<(), LtoBitcodeFromRlib> { pub(crate) fn run_fat( cgcx: &CodegenContext, modules: Vec>, - cached_modules: Vec<(SerializedModule, WorkProduct)>, ) -> Result, FatalError> { let dcx = cgcx.create_dcx(); let dcx = dcx.handle(); @@ -186,7 +185,6 @@ pub(crate) fn run_fat( cgcx, dcx, modules, - cached_modules, lto_data.upstream_modules, lto_data.tmp_path, //<o_data.symbols_below_threshold, @@ -197,7 +195,6 @@ fn fat_lto( cgcx: &CodegenContext, _dcx: DiagCtxtHandle<'_>, modules: Vec>, - cached_modules: Vec<(SerializedModule, WorkProduct)>, mut serialized_modules: Vec<(SerializedModule, CString)>, tmp_path: TempDir, //symbols_below_threshold: &[String], @@ -211,21 +208,12 @@ fn fat_lto( // modules that are serialized in-memory. // * `in_memory` contains modules which are already parsed and in-memory, // such as from multi-CGU builds. - // - // All of `cached_modules` (cached from previous incremental builds) can - // immediately go onto the `serialized_modules` modules list and then we can - // split the `modules` array into these two lists. let mut in_memory = Vec::new(); - serialized_modules.extend(cached_modules.into_iter().map(|(buffer, wp)| { - info!("pushing cached module {:?}", wp.cgu_name); - (buffer, CString::new(wp.cgu_name).unwrap()) - })); for module in modules { match module { FatLtoInput::InMemory(m) => in_memory.push(m), FatLtoInput::Serialized { name, buffer } => { info!("pushing serialized module {:?}", name); - let buffer = SerializedModule::Local(buffer); serialized_modules.push((buffer, CString::new(name).unwrap())); } } diff --git a/compiler/rustc_codegen_gcc/src/lib.rs b/compiler/rustc_codegen_gcc/src/lib.rs index af416929ea73..3fbbaacf1bbb 100644 --- a/compiler/rustc_codegen_gcc/src/lib.rs +++ b/compiler/rustc_codegen_gcc/src/lib.rs @@ -359,14 +359,13 @@ impl WriteBackendMethods for GccCodegenBackend { fn run_and_optimize_fat_lto( cgcx: &CodegenContext, modules: Vec>, - cached_modules: Vec<(SerializedModule, WorkProduct)>, diff_fncs: Vec, ) -> Result, FatalError> { if !diff_fncs.is_empty() { unimplemented!(); } - back::lto::run_fat(cgcx, modules, cached_modules) + back::lto::run_fat(cgcx, modules) } fn run_thin_lto( diff --git a/compiler/rustc_codegen_llvm/src/back/lto.rs b/compiler/rustc_codegen_llvm/src/back/lto.rs index 655e1c953737..2dac29c4ee48 100644 --- a/compiler/rustc_codegen_llvm/src/back/lto.rs +++ b/compiler/rustc_codegen_llvm/src/back/lto.rs @@ -200,14 +200,13 @@ fn get_bitcode_slice_from_object_data<'a>( pub(crate) fn run_fat( cgcx: &CodegenContext, modules: Vec>, - cached_modules: Vec<(SerializedModule, WorkProduct)>, ) -> Result, FatalError> { let dcx = cgcx.create_dcx(); let dcx = dcx.handle(); let (symbols_below_threshold, upstream_modules) = prepare_lto(cgcx, dcx)?; let symbols_below_threshold = symbols_below_threshold.iter().map(|c| c.as_ptr()).collect::>(); - fat_lto(cgcx, dcx, modules, cached_modules, upstream_modules, &symbols_below_threshold) + fat_lto(cgcx, dcx, modules, upstream_modules, &symbols_below_threshold) } /// Performs thin LTO by performing necessary global analysis and returning two @@ -245,7 +244,6 @@ fn fat_lto( cgcx: &CodegenContext, dcx: DiagCtxtHandle<'_>, modules: Vec>, - cached_modules: Vec<(SerializedModule, WorkProduct)>, mut serialized_modules: Vec<(SerializedModule, CString)>, symbols_below_threshold: &[*const libc::c_char], ) -> Result, FatalError> { @@ -258,21 +256,12 @@ fn fat_lto( // modules that are serialized in-memory. // * `in_memory` contains modules which are already parsed and in-memory, // such as from multi-CGU builds. - // - // All of `cached_modules` (cached from previous incremental builds) can - // immediately go onto the `serialized_modules` modules list and then we can - // split the `modules` array into these two lists. let mut in_memory = Vec::new(); - serialized_modules.extend(cached_modules.into_iter().map(|(buffer, wp)| { - info!("pushing cached module {:?}", wp.cgu_name); - (buffer, CString::new(wp.cgu_name).unwrap()) - })); for module in modules { match module { FatLtoInput::InMemory(m) => in_memory.push(m), FatLtoInput::Serialized { name, buffer } => { info!("pushing serialized module {:?}", name); - let buffer = SerializedModule::Local(buffer); serialized_modules.push((buffer, CString::new(name).unwrap())); } } diff --git a/compiler/rustc_codegen_llvm/src/lib.rs b/compiler/rustc_codegen_llvm/src/lib.rs index 6db4e122ad6e..5747e87e077b 100644 --- a/compiler/rustc_codegen_llvm/src/lib.rs +++ b/compiler/rustc_codegen_llvm/src/lib.rs @@ -177,10 +177,9 @@ impl WriteBackendMethods for LlvmCodegenBackend { fn run_and_optimize_fat_lto( cgcx: &CodegenContext, modules: Vec>, - cached_modules: Vec<(SerializedModule, WorkProduct)>, diff_fncs: Vec, ) -> Result, FatalError> { - let mut module = back::lto::run_fat(cgcx, modules, cached_modules)?; + let mut module = back::lto::run_fat(cgcx, modules)?; if !diff_fncs.is_empty() { builder::autodiff::differentiate(&module, cgcx, diff_fncs)?; diff --git a/compiler/rustc_codegen_ssa/src/back/write.rs b/compiler/rustc_codegen_ssa/src/back/write.rs index 50a7cba300b4..50e799a16873 100644 --- a/compiler/rustc_codegen_ssa/src/back/write.rs +++ b/compiler/rustc_codegen_ssa/src/back/write.rs @@ -808,7 +808,7 @@ pub(crate) enum WorkItemResult { } pub enum FatLtoInput { - Serialized { name: String, buffer: B::ModuleBuffer }, + Serialized { name: String, buffer: SerializedModule }, InMemory(ModuleCodegen), } @@ -897,7 +897,10 @@ fn execute_optimize_work_item( fs::write(&path, buffer.data()).unwrap_or_else(|e| { panic!("Error writing pre-lto-bitcode file `{}`: {}", path.display(), e); }); - Ok(WorkItemResult::NeedsFatLto(FatLtoInput::Serialized { name, buffer })) + Ok(WorkItemResult::NeedsFatLto(FatLtoInput::Serialized { + name, + buffer: SerializedModule::Local(buffer), + })) } None => Ok(WorkItemResult::NeedsFatLto(FatLtoInput::InMemory(module))), }, @@ -990,12 +993,16 @@ fn execute_copy_from_cache_work_item( fn execute_fat_lto_work_item( cgcx: &CodegenContext, - needs_fat_lto: Vec>, + mut needs_fat_lto: Vec>, import_only_modules: Vec<(SerializedModule, WorkProduct)>, autodiff: Vec, module_config: &ModuleConfig, ) -> Result, FatalError> { - let module = B::run_and_optimize_fat_lto(cgcx, needs_fat_lto, import_only_modules, autodiff)?; + for (module, wp) in import_only_modules { + needs_fat_lto.push(FatLtoInput::Serialized { name: wp.cgu_name, buffer: module }) + } + + let module = B::run_and_optimize_fat_lto(cgcx, needs_fat_lto, autodiff)?; let module = B::codegen(cgcx, module, module_config)?; Ok(WorkItemResult::Finished(module)) } diff --git a/compiler/rustc_codegen_ssa/src/traits/write.rs b/compiler/rustc_codegen_ssa/src/traits/write.rs index 5e993640472d..3e18cce316ef 100644 --- a/compiler/rustc_codegen_ssa/src/traits/write.rs +++ b/compiler/rustc_codegen_ssa/src/traits/write.rs @@ -25,7 +25,6 @@ pub trait WriteBackendMethods: Clone + 'static { fn run_and_optimize_fat_lto( cgcx: &CodegenContext, modules: Vec>, - cached_modules: Vec<(SerializedModule, WorkProduct)>, diff_fncs: Vec, ) -> Result, FatalError>; /// Performs thin LTO by performing necessary global analysis and returning two From 2ad7930b40bd5cb0e103cb5c7145f4b335dd4520 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Fri, 4 Jul 2025 07:52:30 +0000 Subject: [PATCH 067/139] Remove worker id It isn't used anywhere. Also inline free_worker into the only call site. --- compiler/rustc_codegen_ssa/src/back/write.rs | 75 +++++--------------- 1 file changed, 19 insertions(+), 56 deletions(-) diff --git a/compiler/rustc_codegen_ssa/src/back/write.rs b/compiler/rustc_codegen_ssa/src/back/write.rs index 50e799a16873..8c3d17115191 100644 --- a/compiler/rustc_codegen_ssa/src/back/write.rs +++ b/compiler/rustc_codegen_ssa/src/back/write.rs @@ -1037,7 +1037,7 @@ pub(crate) enum Message { /// The backend has finished processing a work item for a codegen unit. /// Sent from a backend worker thread. - WorkItem { result: Result, Option>, worker_id: usize }, + WorkItem { result: Result, Option> }, /// The frontend has finished generating something (backend IR or a /// post-LTO artifact) for a codegen unit, and it should be passed to the @@ -1355,18 +1355,6 @@ fn start_executing_work( // necessary. There's already optimizations in place to avoid sending work // back to the coordinator if LTO isn't requested. return B::spawn_named_thread(cgcx.time_trace, "coordinator".to_string(), move || { - let mut worker_id_counter = 0; - let mut free_worker_ids = Vec::new(); - let mut get_worker_id = |free_worker_ids: &mut Vec| { - if let Some(id) = free_worker_ids.pop() { - id - } else { - let id = worker_id_counter; - worker_id_counter += 1; - id - } - }; - // This is where we collect codegen units that have gone all the way // through codegen and LLVM. let mut compiled_modules = vec![]; @@ -1447,12 +1435,7 @@ fn start_executing_work( let (item, _) = work_items.pop().expect("queue empty - queue_full_enough() broken?"); main_thread_state = MainThreadState::Lending; - spawn_work( - &cgcx, - &mut llvm_start_time, - get_worker_id(&mut free_worker_ids), - item, - ); + spawn_work(&cgcx, &mut llvm_start_time, item); } } } else if codegen_state == Completed { @@ -1521,12 +1504,7 @@ fn start_executing_work( MainThreadState::Idle => { if let Some((item, _)) = work_items.pop() { main_thread_state = MainThreadState::Lending; - spawn_work( - &cgcx, - &mut llvm_start_time, - get_worker_id(&mut free_worker_ids), - item, - ); + spawn_work(&cgcx, &mut llvm_start_time, item); } else { // There is no unstarted work, so let the main thread // take over for a running worker. Otherwise the @@ -1562,12 +1540,7 @@ fn start_executing_work( while running_with_own_token < tokens.len() && let Some((item, _)) = work_items.pop() { - spawn_work( - &cgcx, - &mut llvm_start_time, - get_worker_id(&mut free_worker_ids), - item, - ); + spawn_work(&cgcx, &mut llvm_start_time, item); running_with_own_token += 1; } } @@ -1575,21 +1548,6 @@ fn start_executing_work( // Relinquish accidentally acquired extra tokens. tokens.truncate(running_with_own_token); - // If a thread exits successfully then we drop a token associated - // with that worker and update our `running_with_own_token` count. - // We may later re-acquire a token to continue running more work. - // We may also not actually drop a token here if the worker was - // running with an "ephemeral token". - let mut free_worker = |worker_id| { - if main_thread_state == MainThreadState::Lending { - main_thread_state = MainThreadState::Idle; - } else { - running_with_own_token -= 1; - } - - free_worker_ids.push(worker_id); - }; - let msg = coordinator_receive.recv().unwrap(); match *msg.downcast::>().ok().unwrap() { // Save the token locally and the next turn of the loop will use @@ -1658,8 +1616,17 @@ fn start_executing_work( codegen_state = Aborted; } - Message::WorkItem { result, worker_id } => { - free_worker(worker_id); + Message::WorkItem { result } => { + // If a thread exits successfully then we drop a token associated + // with that worker and update our `running_with_own_token` count. + // We may later re-acquire a token to continue running more work. + // We may also not actually drop a token here if the worker was + // running with an "ephemeral token". + if main_thread_state == MainThreadState::Lending { + main_thread_state = MainThreadState::Idle; + } else { + running_with_own_token -= 1; + } match result { Ok(WorkItemResult::Finished(compiled_module)) => { @@ -1805,7 +1772,6 @@ pub(crate) struct WorkerFatalError; fn spawn_work<'a, B: ExtraBackendMethods>( cgcx: &'a CodegenContext, llvm_start_time: &mut Option>, - worker_id: usize, work: WorkItem, ) { if cgcx.config(work.module_kind()).time_module && llvm_start_time.is_none() { @@ -1820,24 +1786,21 @@ fn spawn_work<'a, B: ExtraBackendMethods>( struct Bomb { coordinator_send: Sender>, result: Option, FatalError>>, - worker_id: usize, } impl Drop for Bomb { fn drop(&mut self) { - let worker_id = self.worker_id; let msg = match self.result.take() { - Some(Ok(result)) => Message::WorkItem:: { result: Ok(result), worker_id }, + Some(Ok(result)) => Message::WorkItem:: { result: Ok(result) }, Some(Err(FatalError)) => { - Message::WorkItem:: { result: Err(Some(WorkerFatalError)), worker_id } + Message::WorkItem:: { result: Err(Some(WorkerFatalError)) } } - None => Message::WorkItem:: { result: Err(None), worker_id }, + None => Message::WorkItem:: { result: Err(None) }, }; drop(self.coordinator_send.send(Box::new(msg))); } } - let mut bomb = - Bomb:: { coordinator_send: cgcx.coordinator_send.clone(), result: None, worker_id }; + let mut bomb = Bomb:: { coordinator_send: cgcx.coordinator_send.clone(), result: None }; // Execute the work itself, and if it finishes successfully then flag // ourselves as a success as well. From 1c8dc6f4405124b092dc534d17d4b13f29a4adae Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Fri, 4 Jul 2025 14:59:53 +0000 Subject: [PATCH 068/139] Move LTO symbol export calculation from backends to cg_ssa --- compiler/rustc_codegen_gcc/messages.ftl | 8 -- compiler/rustc_codegen_gcc/src/back/lto.rs | 74 ++--------------- compiler/rustc_codegen_gcc/src/errors.rs | 13 --- compiler/rustc_codegen_llvm/messages.ftl | 10 --- compiler/rustc_codegen_llvm/src/back/lto.rs | 91 ++++----------------- compiler/rustc_codegen_llvm/src/errors.rs | 17 ---- compiler/rustc_codegen_ssa/messages.ftl | 10 +++ compiler/rustc_codegen_ssa/src/back/lto.rs | 83 +++++++++++++++++++ compiler/rustc_codegen_ssa/src/errors.rs | 17 ++++ 9 files changed, 132 insertions(+), 191 deletions(-) diff --git a/compiler/rustc_codegen_gcc/messages.ftl b/compiler/rustc_codegen_gcc/messages.ftl index 55a28bc9493e..a70ac08f01ae 100644 --- a/compiler/rustc_codegen_gcc/messages.ftl +++ b/compiler/rustc_codegen_gcc/messages.ftl @@ -3,12 +3,4 @@ codegen_gcc_unwinding_inline_asm = codegen_gcc_copy_bitcode = failed to copy bitcode to object file: {$err} -codegen_gcc_dynamic_linking_with_lto = - cannot prefer dynamic linking when performing LTO - .note = only 'staticlib', 'bin', and 'cdylib' outputs are supported with LTO - -codegen_gcc_lto_disallowed = lto can only be run for executables, cdylibs and static library outputs - -codegen_gcc_lto_dylib = lto cannot be used for `dylib` crate type without `-Zdylib-lto` - codegen_gcc_lto_bitcode_from_rlib = failed to get bitcode from object file for LTO ({$gcc_err}) diff --git a/compiler/rustc_codegen_gcc/src/back/lto.rs b/compiler/rustc_codegen_gcc/src/back/lto.rs index 9f2842d7abc8..e075aa8480aa 100644 --- a/compiler/rustc_codegen_gcc/src/back/lto.rs +++ b/compiler/rustc_codegen_gcc/src/back/lto.rs @@ -24,36 +24,24 @@ use std::sync::Arc; use gccjit::{Context, OutputKind}; use object::read::archive::ArchiveFile; -use rustc_codegen_ssa::back::lto::{SerializedModule, ThinModule, ThinShared}; -use rustc_codegen_ssa::back::symbol_export; +use rustc_codegen_ssa::back::lto::{ + SerializedModule, ThinModule, ThinShared, exported_symbols_for_lto, +}; use rustc_codegen_ssa::back::write::{CodegenContext, FatLtoInput}; use rustc_codegen_ssa::traits::*; use rustc_codegen_ssa::{ModuleCodegen, ModuleKind, looks_like_rust_object_file}; use rustc_data_structures::memmap::Mmap; use rustc_errors::{DiagCtxtHandle, FatalError}; -use rustc_hir::def_id::LOCAL_CRATE; use rustc_middle::bug; use rustc_middle::dep_graph::WorkProduct; -use rustc_middle::middle::exported_symbols::{SymbolExportInfo, SymbolExportLevel}; -use rustc_session::config::{CrateType, Lto}; +use rustc_session::config::Lto; use rustc_target::spec::RelocModel; use tempfile::{TempDir, tempdir}; use crate::back::write::save_temp_bitcode; -use crate::errors::{DynamicLinkingWithLTO, LtoBitcodeFromRlib, LtoDisallowed, LtoDylib}; +use crate::errors::LtoBitcodeFromRlib; use crate::{GccCodegenBackend, GccContext, SyncContext, to_gcc_opt_level}; -pub fn crate_type_allows_lto(crate_type: CrateType) -> bool { - match crate_type { - CrateType::Executable - | CrateType::Dylib - | CrateType::Staticlib - | CrateType::Cdylib - | CrateType::Sdylib => true, - CrateType::Rlib | CrateType::ProcMacro => false, - } -} - struct LtoData { // TODO(antoyo): use symbols_below_threshold. //symbols_below_threshold: Vec, @@ -65,15 +53,8 @@ fn prepare_lto( cgcx: &CodegenContext, dcx: DiagCtxtHandle<'_>, ) -> Result { - let export_threshold = match cgcx.lto { - // We're just doing LTO for our one crate - Lto::ThinLocal => SymbolExportLevel::Rust, - - // We're doing LTO for the entire crate graph - Lto::Fat | Lto::Thin => symbol_export::crates_export_threshold(&cgcx.crate_types), - - Lto::No => panic!("didn't request LTO but we're doing LTO"), - }; + // FIXME(bjorn3): Limit LTO exports to these symbols + let _symbols_below_threshold = exported_symbols_for_lto(cgcx, dcx)?; let tmp_path = match tempdir() { Ok(tmp_path) => tmp_path, @@ -83,20 +64,6 @@ fn prepare_lto( } }; - let symbol_filter = &|&(ref name, info): &(String, SymbolExportInfo)| { - if info.level.is_below_threshold(export_threshold) || info.used { - Some(name.clone()) - } else { - None - } - }; - let exported_symbols = cgcx.exported_symbols.as_ref().expect("needs exported symbols for LTO"); - let mut symbols_below_threshold = { - let _timer = cgcx.prof.generic_activity("GCC_lto_generate_symbols_below_threshold"); - exported_symbols[&LOCAL_CRATE].iter().filter_map(symbol_filter).collect::>() - }; - info!("{} symbols to preserve in this crate", symbols_below_threshold.len()); - // If we're performing LTO for the entire crate graph, then for each of our // upstream dependencies, find the corresponding rlib and load the bitcode // from the archive. @@ -105,32 +72,7 @@ fn prepare_lto( // with either fat or thin LTO let mut upstream_modules = Vec::new(); if cgcx.lto != Lto::ThinLocal { - // Make sure we actually can run LTO - for crate_type in cgcx.crate_types.iter() { - if !crate_type_allows_lto(*crate_type) { - dcx.emit_err(LtoDisallowed); - return Err(FatalError); - } - if *crate_type == CrateType::Dylib && !cgcx.opts.unstable_opts.dylib_lto { - dcx.emit_err(LtoDylib); - return Err(FatalError); - } - } - - if cgcx.opts.cg.prefer_dynamic && !cgcx.opts.unstable_opts.dylib_lto { - dcx.emit_err(DynamicLinkingWithLTO); - return Err(FatalError); - } - - for &(cnum, ref path) in cgcx.each_linked_rlib_for_lto.iter() { - let exported_symbols = - cgcx.exported_symbols.as_ref().expect("needs exported symbols for LTO"); - { - let _timer = cgcx.prof.generic_activity("GCC_lto_generate_symbols_below_threshold"); - symbols_below_threshold - .extend(exported_symbols[&cnum].iter().filter_map(symbol_filter)); - } - + for &(_cnum, ref path) in cgcx.each_linked_rlib_for_lto.iter() { let archive_data = unsafe { Mmap::map(File::open(path).expect("couldn't open rlib")).expect("couldn't map rlib") }; diff --git a/compiler/rustc_codegen_gcc/src/errors.rs b/compiler/rustc_codegen_gcc/src/errors.rs index b7e7343460fb..0aa16bd88b43 100644 --- a/compiler/rustc_codegen_gcc/src/errors.rs +++ b/compiler/rustc_codegen_gcc/src/errors.rs @@ -14,19 +14,6 @@ pub(crate) struct CopyBitcode { pub err: std::io::Error, } -#[derive(Diagnostic)] -#[diag(codegen_gcc_dynamic_linking_with_lto)] -#[note] -pub(crate) struct DynamicLinkingWithLTO; - -#[derive(Diagnostic)] -#[diag(codegen_gcc_lto_disallowed)] -pub(crate) struct LtoDisallowed; - -#[derive(Diagnostic)] -#[diag(codegen_gcc_lto_dylib)] -pub(crate) struct LtoDylib; - #[derive(Diagnostic)] #[diag(codegen_gcc_lto_bitcode_from_rlib)] pub(crate) struct LtoBitcodeFromRlib { diff --git a/compiler/rustc_codegen_llvm/messages.ftl b/compiler/rustc_codegen_llvm/messages.ftl index f197ea744732..3d5f17a60345 100644 --- a/compiler/rustc_codegen_llvm/messages.ftl +++ b/compiler/rustc_codegen_llvm/messages.ftl @@ -2,10 +2,6 @@ codegen_llvm_autodiff_without_enable = using the autodiff feature requires -Z au codegen_llvm_copy_bitcode = failed to copy bitcode to object file: {$err} -codegen_llvm_dynamic_linking_with_lto = - cannot prefer dynamic linking when performing LTO - .note = only 'staticlib', 'bin', and 'cdylib' outputs are supported with LTO - codegen_llvm_fixed_x18_invalid_arch = the `-Zfixed-x18` flag is not supported on the `{$arch}` architecture @@ -18,12 +14,6 @@ codegen_llvm_load_bitcode_with_llvm_err = failed to load bitcode of module "{$na codegen_llvm_lto_bitcode_from_rlib = failed to get bitcode from object file for LTO ({$llvm_err}) -codegen_llvm_lto_disallowed = lto can only be run for executables, cdylibs and static library outputs - -codegen_llvm_lto_dylib = lto cannot be used for `dylib` crate type without `-Zdylib-lto` - -codegen_llvm_lto_proc_macro = lto cannot be used for `proc-macro` crate type without `-Zdylib-lto` - codegen_llvm_mismatch_data_layout = data-layout for target `{$rustc_target}`, `{$rustc_layout}`, differs from LLVM target's `{$llvm_target}` default layout, `{$llvm_layout}` diff --git a/compiler/rustc_codegen_llvm/src/back/lto.rs b/compiler/rustc_codegen_llvm/src/back/lto.rs index 2dac29c4ee48..633a944005e2 100644 --- a/compiler/rustc_codegen_llvm/src/back/lto.rs +++ b/compiler/rustc_codegen_llvm/src/back/lto.rs @@ -7,27 +7,24 @@ use std::sync::Arc; use std::{io, iter, slice}; use object::read::archive::ArchiveFile; -use rustc_codegen_ssa::back::lto::{SerializedModule, ThinModule, ThinShared}; -use rustc_codegen_ssa::back::symbol_export; +use rustc_codegen_ssa::back::lto::{ + SerializedModule, ThinModule, ThinShared, exported_symbols_for_lto, +}; use rustc_codegen_ssa::back::write::{CodegenContext, FatLtoInput}; use rustc_codegen_ssa::traits::*; use rustc_codegen_ssa::{ModuleCodegen, ModuleKind, looks_like_rust_object_file}; use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::memmap::Mmap; use rustc_errors::{DiagCtxtHandle, FatalError}; -use rustc_hir::def_id::LOCAL_CRATE; use rustc_middle::bug; use rustc_middle::dep_graph::WorkProduct; -use rustc_middle::middle::exported_symbols::{SymbolExportInfo, SymbolExportLevel}; -use rustc_session::config::{self, CrateType, Lto}; +use rustc_session::config::{self, Lto}; use tracing::{debug, info}; use crate::back::write::{ self, CodegenDiagnosticsStage, DiagnosticHandlers, bitcode_section_name, save_temp_bitcode, }; -use crate::errors::{ - DynamicLinkingWithLTO, LlvmError, LtoBitcodeFromRlib, LtoDisallowed, LtoDylib, LtoProcMacro, -}; +use crate::errors::{LlvmError, LtoBitcodeFromRlib}; use crate::llvm::AttributePlace::Function; use crate::llvm::{self, build_string}; use crate::{LlvmCodegenBackend, ModuleLlvm, SimpleCx, attributes}; @@ -36,45 +33,19 @@ use crate::{LlvmCodegenBackend, ModuleLlvm, SimpleCx, attributes}; /// session to determine which CGUs we can reuse. const THIN_LTO_KEYS_INCR_COMP_FILE_NAME: &str = "thin-lto-past-keys.bin"; -fn crate_type_allows_lto(crate_type: CrateType) -> bool { - match crate_type { - CrateType::Executable - | CrateType::Dylib - | CrateType::Staticlib - | CrateType::Cdylib - | CrateType::ProcMacro - | CrateType::Sdylib => true, - CrateType::Rlib => false, - } -} - fn prepare_lto( cgcx: &CodegenContext, dcx: DiagCtxtHandle<'_>, ) -> Result<(Vec, Vec<(SerializedModule, CString)>), FatalError> { - let export_threshold = match cgcx.lto { - // We're just doing LTO for our one crate - Lto::ThinLocal => SymbolExportLevel::Rust, + let mut symbols_below_threshold = exported_symbols_for_lto(cgcx, dcx)? + .into_iter() + .map(|symbol| CString::new(symbol).unwrap()) + .collect::>(); - // We're doing LTO for the entire crate graph - Lto::Fat | Lto::Thin => symbol_export::crates_export_threshold(&cgcx.crate_types), - - Lto::No => panic!("didn't request LTO but we're doing LTO"), - }; - - let symbol_filter = &|&(ref name, info): &(String, SymbolExportInfo)| { - if info.level.is_below_threshold(export_threshold) || info.used { - Some(CString::new(name.as_str()).unwrap()) - } else { - None - } - }; - let exported_symbols = cgcx.exported_symbols.as_ref().expect("needs exported symbols for LTO"); - let mut symbols_below_threshold = { - let _timer = cgcx.prof.generic_activity("LLVM_lto_generate_symbols_below_threshold"); - exported_symbols[&LOCAL_CRATE].iter().filter_map(symbol_filter).collect::>() - }; - info!("{} symbols to preserve in this crate", symbols_below_threshold.len()); + // __llvm_profile_counter_bias is pulled in at link time by an undefined reference to + // __llvm_profile_runtime, therefore we won't know until link time if this symbol + // should have default visibility. + symbols_below_threshold.push(c"__llvm_profile_counter_bias".to_owned()); // If we're performing LTO for the entire crate graph, then for each of our // upstream dependencies, find the corresponding rlib and load the bitcode @@ -84,37 +55,7 @@ fn prepare_lto( // with either fat or thin LTO let mut upstream_modules = Vec::new(); if cgcx.lto != Lto::ThinLocal { - // Make sure we actually can run LTO - for crate_type in cgcx.crate_types.iter() { - if !crate_type_allows_lto(*crate_type) { - dcx.emit_err(LtoDisallowed); - return Err(FatalError); - } else if *crate_type == CrateType::Dylib { - if !cgcx.opts.unstable_opts.dylib_lto { - dcx.emit_err(LtoDylib); - return Err(FatalError); - } - } else if *crate_type == CrateType::ProcMacro && !cgcx.opts.unstable_opts.dylib_lto { - dcx.emit_err(LtoProcMacro); - return Err(FatalError); - } - } - - if cgcx.opts.cg.prefer_dynamic && !cgcx.opts.unstable_opts.dylib_lto { - dcx.emit_err(DynamicLinkingWithLTO); - return Err(FatalError); - } - - for &(cnum, ref path) in cgcx.each_linked_rlib_for_lto.iter() { - let exported_symbols = - cgcx.exported_symbols.as_ref().expect("needs exported symbols for LTO"); - { - let _timer = - cgcx.prof.generic_activity("LLVM_lto_generate_symbols_below_threshold"); - symbols_below_threshold - .extend(exported_symbols[&cnum].iter().filter_map(symbol_filter)); - } - + for &(_cnum, ref path) in cgcx.each_linked_rlib_for_lto.iter() { let archive_data = unsafe { Mmap::map(std::fs::File::open(&path).expect("couldn't open rlib")) .expect("couldn't map rlib") @@ -147,10 +88,6 @@ fn prepare_lto( } } - // __llvm_profile_counter_bias is pulled in at link time by an undefined reference to - // __llvm_profile_runtime, therefore we won't know until link time if this symbol - // should have default visibility. - symbols_below_threshold.push(c"__llvm_profile_counter_bias".to_owned()); Ok((symbols_below_threshold, upstream_modules)) } diff --git a/compiler/rustc_codegen_llvm/src/errors.rs b/compiler/rustc_codegen_llvm/src/errors.rs index 31d49e863195..2a889888a39b 100644 --- a/compiler/rustc_codegen_llvm/src/errors.rs +++ b/compiler/rustc_codegen_llvm/src/errors.rs @@ -20,11 +20,6 @@ pub(crate) struct SymbolAlreadyDefined<'a> { #[diag(codegen_llvm_sanitizer_memtag_requires_mte)] pub(crate) struct SanitizerMemtagRequiresMte; -#[derive(Diagnostic)] -#[diag(codegen_llvm_dynamic_linking_with_lto)] -#[note] -pub(crate) struct DynamicLinkingWithLTO; - pub(crate) struct ParseTargetMachineConfig<'a>(pub LlvmError<'a>); impl Diagnostic<'_, G> for ParseTargetMachineConfig<'_> { @@ -41,18 +36,6 @@ impl Diagnostic<'_, G> for ParseTargetMachineConfig<'_> { #[diag(codegen_llvm_autodiff_without_enable)] pub(crate) struct AutoDiffWithoutEnable; -#[derive(Diagnostic)] -#[diag(codegen_llvm_lto_disallowed)] -pub(crate) struct LtoDisallowed; - -#[derive(Diagnostic)] -#[diag(codegen_llvm_lto_dylib)] -pub(crate) struct LtoDylib; - -#[derive(Diagnostic)] -#[diag(codegen_llvm_lto_proc_macro)] -pub(crate) struct LtoProcMacro; - #[derive(Diagnostic)] #[diag(codegen_llvm_lto_bitcode_from_rlib)] pub(crate) struct LtoBitcodeFromRlib { diff --git a/compiler/rustc_codegen_ssa/messages.ftl b/compiler/rustc_codegen_ssa/messages.ftl index c7bd6ffd1f27..a70d0011d161 100644 --- a/compiler/rustc_codegen_ssa/messages.ftl +++ b/compiler/rustc_codegen_ssa/messages.ftl @@ -35,6 +35,10 @@ codegen_ssa_dlltool_fail_import_library = {$stdout} {$stderr} +codegen_ssa_dynamic_linking_with_lto = + cannot prefer dynamic linking when performing LTO + .note = only 'staticlib', 'bin', and 'cdylib' outputs are supported with LTO + codegen_ssa_error_calling_dlltool = Error calling dlltool '{$dlltool_path}': {$error} @@ -191,6 +195,12 @@ codegen_ssa_linker_unsupported_modifier = `as-needed` modifier not supported for codegen_ssa_linking_failed = linking with `{$linker_path}` failed: {$exit_status} +codegen_ssa_lto_disallowed = lto can only be run for executables, cdylibs and static library outputs + +codegen_ssa_lto_dylib = lto cannot be used for `dylib` crate type without `-Zdylib-lto` + +codegen_ssa_lto_proc_macro = lto cannot be used for `proc-macro` crate type without `-Zdylib-lto` + codegen_ssa_malformed_cgu_name = found malformed codegen unit name `{$user_path}`. codegen units names must always start with the name of the crate (`{$crate_name}` in this case). diff --git a/compiler/rustc_codegen_ssa/src/back/lto.rs b/compiler/rustc_codegen_ssa/src/back/lto.rs index b49b6783bbd9..474a5e08baf4 100644 --- a/compiler/rustc_codegen_ssa/src/back/lto.rs +++ b/compiler/rustc_codegen_ssa/src/back/lto.rs @@ -2,7 +2,15 @@ use std::ffi::CString; use std::sync::Arc; use rustc_data_structures::memmap::Mmap; +use rustc_errors::{DiagCtxtHandle, FatalError}; +use rustc_hir::def_id::LOCAL_CRATE; +use rustc_middle::middle::exported_symbols::{SymbolExportInfo, SymbolExportLevel}; +use rustc_session::config::{CrateType, Lto}; +use tracing::info; +use crate::back::symbol_export; +use crate::back::write::CodegenContext; +use crate::errors::{DynamicLinkingWithLTO, LtoDisallowed, LtoDylib, LtoProcMacro}; use crate::traits::*; pub struct ThinModule { @@ -52,3 +60,78 @@ impl SerializedModule { } } } + +fn crate_type_allows_lto(crate_type: CrateType) -> bool { + match crate_type { + CrateType::Executable + | CrateType::Dylib + | CrateType::Staticlib + | CrateType::Cdylib + | CrateType::ProcMacro + | CrateType::Sdylib => true, + CrateType::Rlib => false, + } +} + +pub fn exported_symbols_for_lto<'a, B: WriteBackendMethods>( + cgcx: &'a CodegenContext, + dcx: DiagCtxtHandle<'_>, +) -> Result, FatalError> { + // FIXME move symbol filtering to cg_ssa + let export_threshold = match cgcx.lto { + // We're just doing LTO for our one crate + Lto::ThinLocal => SymbolExportLevel::Rust, + + // We're doing LTO for the entire crate graph + Lto::Fat | Lto::Thin => symbol_export::crates_export_threshold(&cgcx.crate_types), + + Lto::No => panic!("didn't request LTO but we're doing LTO"), + }; + + let symbol_filter = &|&(ref name, info): &'a (String, SymbolExportInfo)| { + if info.level.is_below_threshold(export_threshold) || info.used { + Some(name.as_str()) + } else { + None + } + }; + let exported_symbols = cgcx.exported_symbols.as_ref().expect("needs exported symbols for LTO"); + let mut symbols_below_threshold = { + let _timer = cgcx.prof.generic_activity("lto_generate_symbols_below_threshold"); + exported_symbols[&LOCAL_CRATE].iter().filter_map(symbol_filter).collect::>() + }; + info!("{} symbols to preserve in this crate", symbols_below_threshold.len()); + + // If we're performing LTO for the entire crate graph, then for each of our + // upstream dependencies, include their exported symbols. + if cgcx.lto != Lto::ThinLocal { + // Make sure we actually can run LTO + for crate_type in cgcx.crate_types.iter() { + if !crate_type_allows_lto(*crate_type) { + return Err(dcx.emit_almost_fatal(LtoDisallowed)); + } else if *crate_type == CrateType::Dylib { + if !cgcx.opts.unstable_opts.dylib_lto { + return Err(dcx.emit_almost_fatal(LtoDylib)); + } + } else if *crate_type == CrateType::ProcMacro && !cgcx.opts.unstable_opts.dylib_lto { + return Err(dcx.emit_almost_fatal(LtoProcMacro)); + } + } + + if cgcx.opts.cg.prefer_dynamic && !cgcx.opts.unstable_opts.dylib_lto { + return Err(dcx.emit_almost_fatal(DynamicLinkingWithLTO)); + } + + for &(cnum, ref _path) in cgcx.each_linked_rlib_for_lto.iter() { + let exported_symbols = + cgcx.exported_symbols.as_ref().expect("needs exported symbols for LTO"); + { + let _timer = cgcx.prof.generic_activity("lto_generate_symbols_below_threshold"); + symbols_below_threshold + .extend(exported_symbols[&cnum].iter().filter_map(symbol_filter)); + } + } + } + + Ok(symbols_below_threshold) +} diff --git a/compiler/rustc_codegen_ssa/src/errors.rs b/compiler/rustc_codegen_ssa/src/errors.rs index 9040915b6af3..3d787d8bdbde 100644 --- a/compiler/rustc_codegen_ssa/src/errors.rs +++ b/compiler/rustc_codegen_ssa/src/errors.rs @@ -1294,3 +1294,20 @@ pub(crate) struct FeatureNotValid<'a> { #[help] pub plus_hint: bool, } + +#[derive(Diagnostic)] +#[diag(codegen_ssa_lto_disallowed)] +pub(crate) struct LtoDisallowed; + +#[derive(Diagnostic)] +#[diag(codegen_ssa_lto_dylib)] +pub(crate) struct LtoDylib; + +#[derive(Diagnostic)] +#[diag(codegen_ssa_lto_proc_macro)] +pub(crate) struct LtoProcMacro; + +#[derive(Diagnostic)] +#[diag(codegen_ssa_dynamic_linking_with_lto)] +#[note] +pub(crate) struct DynamicLinkingWithLTO; From 6e757354ada32657886a9ec944c389cb93b9c919 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Sun, 6 Jul 2025 15:57:20 +0000 Subject: [PATCH 069/139] Merge exported_symbols computation into exported_symbols_for_lto And move exported_symbols_for_lto call from backends to cg_ssa. --- compiler/rustc_codegen_gcc/src/back/lto.rs | 6 +- compiler/rustc_codegen_llvm/src/back/lto.rs | 11 +- compiler/rustc_codegen_ssa/src/back/lto.rs | 105 ++++++++++--------- compiler/rustc_codegen_ssa/src/back/write.rs | 45 ++------ 4 files changed, 73 insertions(+), 94 deletions(-) diff --git a/compiler/rustc_codegen_gcc/src/back/lto.rs b/compiler/rustc_codegen_gcc/src/back/lto.rs index e075aa8480aa..f957bb7f101b 100644 --- a/compiler/rustc_codegen_gcc/src/back/lto.rs +++ b/compiler/rustc_codegen_gcc/src/back/lto.rs @@ -24,9 +24,7 @@ use std::sync::Arc; use gccjit::{Context, OutputKind}; use object::read::archive::ArchiveFile; -use rustc_codegen_ssa::back::lto::{ - SerializedModule, ThinModule, ThinShared, exported_symbols_for_lto, -}; +use rustc_codegen_ssa::back::lto::{SerializedModule, ThinModule, ThinShared}; use rustc_codegen_ssa::back::write::{CodegenContext, FatLtoInput}; use rustc_codegen_ssa::traits::*; use rustc_codegen_ssa::{ModuleCodegen, ModuleKind, looks_like_rust_object_file}; @@ -54,7 +52,7 @@ fn prepare_lto( dcx: DiagCtxtHandle<'_>, ) -> Result { // FIXME(bjorn3): Limit LTO exports to these symbols - let _symbols_below_threshold = exported_symbols_for_lto(cgcx, dcx)?; + let _symbols_below_threshold = &cgcx.exported_symbols_for_lto; let tmp_path = match tempdir() { Ok(tmp_path) => tmp_path, diff --git a/compiler/rustc_codegen_llvm/src/back/lto.rs b/compiler/rustc_codegen_llvm/src/back/lto.rs index 633a944005e2..4abf9b6842a0 100644 --- a/compiler/rustc_codegen_llvm/src/back/lto.rs +++ b/compiler/rustc_codegen_llvm/src/back/lto.rs @@ -7,9 +7,7 @@ use std::sync::Arc; use std::{io, iter, slice}; use object::read::archive::ArchiveFile; -use rustc_codegen_ssa::back::lto::{ - SerializedModule, ThinModule, ThinShared, exported_symbols_for_lto, -}; +use rustc_codegen_ssa::back::lto::{SerializedModule, ThinModule, ThinShared}; use rustc_codegen_ssa::back::write::{CodegenContext, FatLtoInput}; use rustc_codegen_ssa::traits::*; use rustc_codegen_ssa::{ModuleCodegen, ModuleKind, looks_like_rust_object_file}; @@ -37,9 +35,10 @@ fn prepare_lto( cgcx: &CodegenContext, dcx: DiagCtxtHandle<'_>, ) -> Result<(Vec, Vec<(SerializedModule, CString)>), FatalError> { - let mut symbols_below_threshold = exported_symbols_for_lto(cgcx, dcx)? - .into_iter() - .map(|symbol| CString::new(symbol).unwrap()) + let mut symbols_below_threshold = cgcx + .exported_symbols_for_lto + .iter() + .map(|symbol| CString::new(symbol.to_owned()).unwrap()) .collect::>(); // __llvm_profile_counter_bias is pulled in at link time by an undefined reference to diff --git a/compiler/rustc_codegen_ssa/src/back/lto.rs b/compiler/rustc_codegen_ssa/src/back/lto.rs index 474a5e08baf4..150a588ffed7 100644 --- a/compiler/rustc_codegen_ssa/src/back/lto.rs +++ b/compiler/rustc_codegen_ssa/src/back/lto.rs @@ -1,14 +1,15 @@ use std::ffi::CString; +use std::path::PathBuf; use std::sync::Arc; use rustc_data_structures::memmap::Mmap; -use rustc_errors::{DiagCtxtHandle, FatalError}; -use rustc_hir::def_id::LOCAL_CRATE; -use rustc_middle::middle::exported_symbols::{SymbolExportInfo, SymbolExportLevel}; +use rustc_hir::def_id::{CrateNum, LOCAL_CRATE}; +use rustc_middle::middle::exported_symbols::{ExportedSymbol, SymbolExportInfo, SymbolExportLevel}; +use rustc_middle::ty::TyCtxt; use rustc_session::config::{CrateType, Lto}; use tracing::info; -use crate::back::symbol_export; +use crate::back::symbol_export::{self, symbol_name_for_instance_in_crate}; use crate::back::write::CodegenContext; use crate::errors::{DynamicLinkingWithLTO, LtoDisallowed, LtoDylib, LtoProcMacro}; use crate::traits::*; @@ -73,65 +74,73 @@ fn crate_type_allows_lto(crate_type: CrateType) -> bool { } } -pub fn exported_symbols_for_lto<'a, B: WriteBackendMethods>( - cgcx: &'a CodegenContext, - dcx: DiagCtxtHandle<'_>, -) -> Result, FatalError> { - // FIXME move symbol filtering to cg_ssa - let export_threshold = match cgcx.lto { +pub(super) fn exported_symbols_for_lto( + tcx: TyCtxt<'_>, + each_linked_rlib_for_lto: &[(CrateNum, PathBuf)], +) -> Vec { + let export_threshold = match tcx.sess.lto() { // We're just doing LTO for our one crate Lto::ThinLocal => SymbolExportLevel::Rust, // We're doing LTO for the entire crate graph - Lto::Fat | Lto::Thin => symbol_export::crates_export_threshold(&cgcx.crate_types), + Lto::Fat | Lto::Thin => symbol_export::crates_export_threshold(&tcx.crate_types()), - Lto::No => panic!("didn't request LTO but we're doing LTO"), + Lto::No => return vec![], }; - let symbol_filter = &|&(ref name, info): &'a (String, SymbolExportInfo)| { - if info.level.is_below_threshold(export_threshold) || info.used { - Some(name.as_str()) - } else { - None - } + let copy_symbols = |cnum| { + tcx.exported_non_generic_symbols(cnum) + .iter() + .chain(tcx.exported_generic_symbols(cnum)) + .filter_map(|&(s, info): &(ExportedSymbol<'_>, SymbolExportInfo)| { + if info.level.is_below_threshold(export_threshold) || info.used { + Some(symbol_name_for_instance_in_crate(tcx, s, cnum)) + } else { + None + } + }) + .collect::>() }; - let exported_symbols = cgcx.exported_symbols.as_ref().expect("needs exported symbols for LTO"); let mut symbols_below_threshold = { - let _timer = cgcx.prof.generic_activity("lto_generate_symbols_below_threshold"); - exported_symbols[&LOCAL_CRATE].iter().filter_map(symbol_filter).collect::>() + let _timer = tcx.prof.generic_activity("lto_generate_symbols_below_threshold"); + copy_symbols(LOCAL_CRATE) }; info!("{} symbols to preserve in this crate", symbols_below_threshold.len()); // If we're performing LTO for the entire crate graph, then for each of our // upstream dependencies, include their exported symbols. - if cgcx.lto != Lto::ThinLocal { - // Make sure we actually can run LTO - for crate_type in cgcx.crate_types.iter() { - if !crate_type_allows_lto(*crate_type) { - return Err(dcx.emit_almost_fatal(LtoDisallowed)); - } else if *crate_type == CrateType::Dylib { - if !cgcx.opts.unstable_opts.dylib_lto { - return Err(dcx.emit_almost_fatal(LtoDylib)); - } - } else if *crate_type == CrateType::ProcMacro && !cgcx.opts.unstable_opts.dylib_lto { - return Err(dcx.emit_almost_fatal(LtoProcMacro)); - } - } - - if cgcx.opts.cg.prefer_dynamic && !cgcx.opts.unstable_opts.dylib_lto { - return Err(dcx.emit_almost_fatal(DynamicLinkingWithLTO)); - } - - for &(cnum, ref _path) in cgcx.each_linked_rlib_for_lto.iter() { - let exported_symbols = - cgcx.exported_symbols.as_ref().expect("needs exported symbols for LTO"); - { - let _timer = cgcx.prof.generic_activity("lto_generate_symbols_below_threshold"); - symbols_below_threshold - .extend(exported_symbols[&cnum].iter().filter_map(symbol_filter)); - } + if tcx.sess.lto() != Lto::ThinLocal { + for &(cnum, ref _path) in each_linked_rlib_for_lto { + let _timer = tcx.prof.generic_activity("lto_generate_symbols_below_threshold"); + symbols_below_threshold.extend(copy_symbols(cnum)); } } - Ok(symbols_below_threshold) + symbols_below_threshold +} + +pub(super) fn check_lto_allowed(cgcx: &CodegenContext) { + if cgcx.lto == Lto::ThinLocal { + // Crate local LTO is always allowed + return; + } + + let dcx = cgcx.create_dcx(); + + // Make sure we actually can run LTO + for crate_type in cgcx.crate_types.iter() { + if !crate_type_allows_lto(*crate_type) { + dcx.handle().emit_fatal(LtoDisallowed); + } else if *crate_type == CrateType::Dylib { + if !cgcx.opts.unstable_opts.dylib_lto { + dcx.handle().emit_fatal(LtoDylib); + } + } else if *crate_type == CrateType::ProcMacro && !cgcx.opts.unstable_opts.dylib_lto { + dcx.handle().emit_fatal(LtoProcMacro); + } + } + + if cgcx.opts.cg.prefer_dynamic && !cgcx.opts.unstable_opts.dylib_lto { + dcx.handle().emit_fatal(DynamicLinkingWithLTO); + } } diff --git a/compiler/rustc_codegen_ssa/src/back/write.rs b/compiler/rustc_codegen_ssa/src/back/write.rs index 8c3d17115191..c507255dfe1e 100644 --- a/compiler/rustc_codegen_ssa/src/back/write.rs +++ b/compiler/rustc_codegen_ssa/src/back/write.rs @@ -9,7 +9,7 @@ use std::{fs, io, mem, str, thread}; use rustc_abi::Size; use rustc_ast::attr; use rustc_ast::expand::autodiff_attrs::AutoDiffItem; -use rustc_data_structures::fx::{FxHashMap, FxIndexMap}; +use rustc_data_structures::fx::FxIndexMap; use rustc_data_structures::jobserver::{self, Acquired}; use rustc_data_structures::memmap::Mmap; use rustc_data_structures::profiling::{SelfProfilerRef, VerboseTimingGuard}; @@ -20,14 +20,13 @@ use rustc_errors::{ Suggestions, }; use rustc_fs_util::link_or_copy; -use rustc_hir::def_id::{CrateNum, LOCAL_CRATE}; +use rustc_hir::def_id::CrateNum; use rustc_incremental::{ copy_cgu_workproduct_to_incr_comp_cache_dir, in_incr_comp_dir, in_incr_comp_dir_sess, }; use rustc_metadata::fs::copy_to_stdout; use rustc_middle::bug; use rustc_middle::dep_graph::{WorkProduct, WorkProductId}; -use rustc_middle::middle::exported_symbols::SymbolExportInfo; use rustc_middle::ty::TyCtxt; use rustc_session::Session; use rustc_session::config::{ @@ -40,7 +39,7 @@ use tracing::debug; use super::link::{self, ensure_removed}; use super::lto::{self, SerializedModule}; -use super::symbol_export::symbol_name_for_instance_in_crate; +use crate::back::lto::check_lto_allowed; use crate::errors::{AutodiffWithoutLto, ErrorCreatingRemarkDir}; use crate::traits::*; use crate::{ @@ -330,8 +329,6 @@ pub type TargetMachineFactoryFn = Arc< + Sync, >; -type ExportedSymbols = FxHashMap>>; - /// Additional resources used by optimize_and_codegen (not module specific) #[derive(Clone)] pub struct CodegenContext { @@ -341,10 +338,10 @@ pub struct CodegenContext { pub save_temps: bool, pub fewer_names: bool, pub time_trace: bool, - pub exported_symbols: Option>, pub opts: Arc, pub crate_types: Vec, pub each_linked_rlib_for_lto: Vec<(CrateNum, PathBuf)>, + pub exported_symbols_for_lto: Arc>, pub output_filenames: Arc, pub invocation_temp: Option, pub regular_module_config: Arc, @@ -1126,34 +1123,8 @@ fn start_executing_work( })); // Compute the set of symbols we need to retain when doing LTO (if we need to) - let exported_symbols = { - let mut exported_symbols = FxHashMap::default(); - - let copy_symbols = |cnum| { - let symbols = tcx - .exported_non_generic_symbols(cnum) - .iter() - .chain(tcx.exported_generic_symbols(cnum)) - .map(|&(s, lvl)| (symbol_name_for_instance_in_crate(tcx, s, cnum), lvl)) - .collect(); - Arc::new(symbols) - }; - - match sess.lto() { - Lto::No => None, - Lto::ThinLocal => { - exported_symbols.insert(LOCAL_CRATE, copy_symbols(LOCAL_CRATE)); - Some(Arc::new(exported_symbols)) - } - Lto::Fat | Lto::Thin => { - exported_symbols.insert(LOCAL_CRATE, copy_symbols(LOCAL_CRATE)); - for &(cnum, ref _path) in &each_linked_rlib_for_lto { - exported_symbols.insert(cnum, copy_symbols(cnum)); - } - Some(Arc::new(exported_symbols)) - } - } - }; + let exported_symbols_for_lto = + Arc::new(lto::exported_symbols_for_lto(tcx, &each_linked_rlib_for_lto)); // First up, convert our jobserver into a helper thread so we can use normal // mpsc channels to manage our messages and such. @@ -1189,13 +1160,13 @@ fn start_executing_work( let cgcx = CodegenContext:: { crate_types: tcx.crate_types().to_vec(), each_linked_rlib_for_lto, + exported_symbols_for_lto, lto: sess.lto(), fewer_names: sess.fewer_names(), save_temps: sess.opts.cg.save_temps, time_trace: sess.opts.unstable_opts.llvm_time_trace, opts: Arc::new(sess.opts.clone()), prof: sess.prof.clone(), - exported_symbols, remark: sess.opts.cg.remark.clone(), remark_dir, incr_comp_session_dir: sess.incr_comp_session_dir_opt().map(|r| r.clone()), @@ -1463,6 +1434,8 @@ fn start_executing_work( let needs_thin_lto = mem::take(&mut needs_thin_lto); let import_only_modules = mem::take(&mut lto_import_only_modules); + check_lto_allowed(&cgcx); + if !needs_fat_lto.is_empty() { assert!(needs_thin_lto.is_empty()); From 1a6f941d2b1e9f9987518961d3bc49e2691aab2e Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Sun, 6 Jul 2025 16:06:10 +0000 Subject: [PATCH 070/139] Move exported_symbols_for_lto out of CodegenContext --- compiler/rustc_codegen_gcc/src/back/lto.rs | 3 -- compiler/rustc_codegen_gcc/src/lib.rs | 4 +++ compiler/rustc_codegen_llvm/src/back/lto.rs | 12 +++++--- compiler/rustc_codegen_llvm/src/lib.rs | 6 ++-- compiler/rustc_codegen_ssa/src/back/write.rs | 29 ++++++++++++++----- .../rustc_codegen_ssa/src/traits/write.rs | 2 ++ 6 files changed, 39 insertions(+), 17 deletions(-) diff --git a/compiler/rustc_codegen_gcc/src/back/lto.rs b/compiler/rustc_codegen_gcc/src/back/lto.rs index f957bb7f101b..d107e56fa35a 100644 --- a/compiler/rustc_codegen_gcc/src/back/lto.rs +++ b/compiler/rustc_codegen_gcc/src/back/lto.rs @@ -51,9 +51,6 @@ fn prepare_lto( cgcx: &CodegenContext, dcx: DiagCtxtHandle<'_>, ) -> Result { - // FIXME(bjorn3): Limit LTO exports to these symbols - let _symbols_below_threshold = &cgcx.exported_symbols_for_lto; - let tmp_path = match tempdir() { Ok(tmp_path) => tmp_path, Err(error) => { diff --git a/compiler/rustc_codegen_gcc/src/lib.rs b/compiler/rustc_codegen_gcc/src/lib.rs index 3fbbaacf1bbb..c8bf5bd8f67b 100644 --- a/compiler/rustc_codegen_gcc/src/lib.rs +++ b/compiler/rustc_codegen_gcc/src/lib.rs @@ -358,6 +358,8 @@ impl WriteBackendMethods for GccCodegenBackend { fn run_and_optimize_fat_lto( cgcx: &CodegenContext, + // FIXME(bjorn3): Limit LTO exports to these symbols + _exported_symbols_for_lto: &[String], modules: Vec>, diff_fncs: Vec, ) -> Result, FatalError> { @@ -370,6 +372,8 @@ impl WriteBackendMethods for GccCodegenBackend { fn run_thin_lto( cgcx: &CodegenContext, + // FIXME(bjorn3): Limit LTO exports to these symbols + _exported_symbols_for_lto: &[String], modules: Vec<(String, Self::ThinBuffer)>, cached_modules: Vec<(SerializedModule, WorkProduct)>, ) -> Result<(Vec>, Vec), FatalError> { diff --git a/compiler/rustc_codegen_llvm/src/back/lto.rs b/compiler/rustc_codegen_llvm/src/back/lto.rs index 4abf9b6842a0..f4879c6e5274 100644 --- a/compiler/rustc_codegen_llvm/src/back/lto.rs +++ b/compiler/rustc_codegen_llvm/src/back/lto.rs @@ -33,10 +33,10 @@ const THIN_LTO_KEYS_INCR_COMP_FILE_NAME: &str = "thin-lto-past-keys.bin"; fn prepare_lto( cgcx: &CodegenContext, + exported_symbols_for_lto: &[String], dcx: DiagCtxtHandle<'_>, ) -> Result<(Vec, Vec<(SerializedModule, CString)>), FatalError> { - let mut symbols_below_threshold = cgcx - .exported_symbols_for_lto + let mut symbols_below_threshold = exported_symbols_for_lto .iter() .map(|symbol| CString::new(symbol.to_owned()).unwrap()) .collect::>(); @@ -135,11 +135,13 @@ fn get_bitcode_slice_from_object_data<'a>( /// for further optimization. pub(crate) fn run_fat( cgcx: &CodegenContext, + exported_symbols_for_lto: &[String], modules: Vec>, ) -> Result, FatalError> { let dcx = cgcx.create_dcx(); let dcx = dcx.handle(); - let (symbols_below_threshold, upstream_modules) = prepare_lto(cgcx, dcx)?; + let (symbols_below_threshold, upstream_modules) = + prepare_lto(cgcx, exported_symbols_for_lto, dcx)?; let symbols_below_threshold = symbols_below_threshold.iter().map(|c| c.as_ptr()).collect::>(); fat_lto(cgcx, dcx, modules, upstream_modules, &symbols_below_threshold) @@ -150,12 +152,14 @@ pub(crate) fn run_fat( /// can simply be copied over from the incr. comp. cache. pub(crate) fn run_thin( cgcx: &CodegenContext, + exported_symbols_for_lto: &[String], modules: Vec<(String, ThinBuffer)>, cached_modules: Vec<(SerializedModule, WorkProduct)>, ) -> Result<(Vec>, Vec), FatalError> { let dcx = cgcx.create_dcx(); let dcx = dcx.handle(); - let (symbols_below_threshold, upstream_modules) = prepare_lto(cgcx, dcx)?; + let (symbols_below_threshold, upstream_modules) = + prepare_lto(cgcx, exported_symbols_for_lto, dcx)?; let symbols_below_threshold = symbols_below_threshold.iter().map(|c| c.as_ptr()).collect::>(); if cgcx.opts.cg.linker_plugin_lto.enabled() { diff --git a/compiler/rustc_codegen_llvm/src/lib.rs b/compiler/rustc_codegen_llvm/src/lib.rs index 5747e87e077b..44c1608dca07 100644 --- a/compiler/rustc_codegen_llvm/src/lib.rs +++ b/compiler/rustc_codegen_llvm/src/lib.rs @@ -176,10 +176,11 @@ impl WriteBackendMethods for LlvmCodegenBackend { } fn run_and_optimize_fat_lto( cgcx: &CodegenContext, + exported_symbols_for_lto: &[String], modules: Vec>, diff_fncs: Vec, ) -> Result, FatalError> { - let mut module = back::lto::run_fat(cgcx, modules)?; + let mut module = back::lto::run_fat(cgcx, exported_symbols_for_lto, modules)?; if !diff_fncs.is_empty() { builder::autodiff::differentiate(&module, cgcx, diff_fncs)?; @@ -193,10 +194,11 @@ impl WriteBackendMethods for LlvmCodegenBackend { } fn run_thin_lto( cgcx: &CodegenContext, + exported_symbols_for_lto: &[String], modules: Vec<(String, Self::ThinBuffer)>, cached_modules: Vec<(SerializedModule, WorkProduct)>, ) -> Result<(Vec>, Vec), FatalError> { - back::lto::run_thin(cgcx, modules, cached_modules) + back::lto::run_thin(cgcx, exported_symbols_for_lto, modules, cached_modules) } fn optimize( cgcx: &CodegenContext, diff --git a/compiler/rustc_codegen_ssa/src/back/write.rs b/compiler/rustc_codegen_ssa/src/back/write.rs index c507255dfe1e..45e90cd072bc 100644 --- a/compiler/rustc_codegen_ssa/src/back/write.rs +++ b/compiler/rustc_codegen_ssa/src/back/write.rs @@ -341,7 +341,6 @@ pub struct CodegenContext { pub opts: Arc, pub crate_types: Vec, pub each_linked_rlib_for_lto: Vec<(CrateNum, PathBuf)>, - pub exported_symbols_for_lto: Arc>, pub output_filenames: Arc, pub invocation_temp: Option, pub regular_module_config: Arc, @@ -396,13 +395,15 @@ impl CodegenContext { fn generate_thin_lto_work( cgcx: &CodegenContext, + exported_symbols_for_lto: &[String], needs_thin_lto: Vec<(String, B::ThinBuffer)>, import_only_modules: Vec<(SerializedModule, WorkProduct)>, ) -> Vec<(WorkItem, u64)> { let _prof_timer = cgcx.prof.generic_activity("codegen_thin_generate_lto_work"); let (lto_modules, copy_jobs) = - B::run_thin_lto(cgcx, needs_thin_lto, import_only_modules).unwrap_or_else(|e| e.raise()); + B::run_thin_lto(cgcx, exported_symbols_for_lto, needs_thin_lto, import_only_modules) + .unwrap_or_else(|e| e.raise()); lto_modules .into_iter() .map(|module| { @@ -718,6 +719,7 @@ pub(crate) enum WorkItem { CopyPostLtoArtifacts(CachedModuleCodegen), /// Performs fat LTO on the given module. FatLto { + exported_symbols_for_lto: Arc>, needs_fat_lto: Vec>, import_only_modules: Vec<(SerializedModule, WorkProduct)>, autodiff: Vec, @@ -990,6 +992,7 @@ fn execute_copy_from_cache_work_item( fn execute_fat_lto_work_item( cgcx: &CodegenContext, + exported_symbols_for_lto: &[String], mut needs_fat_lto: Vec>, import_only_modules: Vec<(SerializedModule, WorkProduct)>, autodiff: Vec, @@ -999,7 +1002,8 @@ fn execute_fat_lto_work_item( needs_fat_lto.push(FatLtoInput::Serialized { name: wp.cgu_name, buffer: module }) } - let module = B::run_and_optimize_fat_lto(cgcx, needs_fat_lto, autodiff)?; + let module = + B::run_and_optimize_fat_lto(cgcx, exported_symbols_for_lto, needs_fat_lto, autodiff)?; let module = B::codegen(cgcx, module, module_config)?; Ok(WorkItemResult::Finished(module)) } @@ -1160,7 +1164,6 @@ fn start_executing_work( let cgcx = CodegenContext:: { crate_types: tcx.crate_types().to_vec(), each_linked_rlib_for_lto, - exported_symbols_for_lto, lto: sess.lto(), fewer_names: sess.fewer_names(), save_temps: sess.opts.cg.save_temps, @@ -1441,6 +1444,7 @@ fn start_executing_work( work_items.push(( WorkItem::FatLto { + exported_symbols_for_lto: Arc::clone(&exported_symbols_for_lto), needs_fat_lto, import_only_modules, autodiff: autodiff_items.clone(), @@ -1456,9 +1460,12 @@ fn start_executing_work( dcx.handle().emit_fatal(AutodiffWithoutLto {}); } - for (work, cost) in - generate_thin_lto_work(&cgcx, needs_thin_lto, import_only_modules) - { + for (work, cost) in generate_thin_lto_work( + &cgcx, + &exported_symbols_for_lto, + needs_thin_lto, + import_only_modules, + ) { let insertion_index = work_items .binary_search_by_key(&cost, |&(_, cost)| cost) .unwrap_or_else(|e| e); @@ -1797,12 +1804,18 @@ fn spawn_work<'a, B: ExtraBackendMethods>( ); Ok(execute_copy_from_cache_work_item(&cgcx, m, module_config)) } - WorkItem::FatLto { needs_fat_lto, import_only_modules, autodiff } => { + WorkItem::FatLto { + exported_symbols_for_lto, + needs_fat_lto, + import_only_modules, + autodiff, + } => { let _timer = cgcx .prof .generic_activity_with_arg("codegen_module_perform_lto", "everything"); execute_fat_lto_work_item( &cgcx, + &exported_symbols_for_lto, needs_fat_lto, import_only_modules, autodiff, diff --git a/compiler/rustc_codegen_ssa/src/traits/write.rs b/compiler/rustc_codegen_ssa/src/traits/write.rs index 3e18cce316ef..d0b3099191a8 100644 --- a/compiler/rustc_codegen_ssa/src/traits/write.rs +++ b/compiler/rustc_codegen_ssa/src/traits/write.rs @@ -24,6 +24,7 @@ pub trait WriteBackendMethods: Clone + 'static { /// if necessary and running any further optimizations fn run_and_optimize_fat_lto( cgcx: &CodegenContext, + exported_symbols_for_lto: &[String], modules: Vec>, diff_fncs: Vec, ) -> Result, FatalError>; @@ -32,6 +33,7 @@ pub trait WriteBackendMethods: Clone + 'static { /// can simply be copied over from the incr. comp. cache. fn run_thin_lto( cgcx: &CodegenContext, + exported_symbols_for_lto: &[String], modules: Vec<(String, Self::ThinBuffer)>, cached_modules: Vec<(SerializedModule, WorkProduct)>, ) -> Result<(Vec>, Vec), FatalError>; From dadc4cae501d9fa515a6cd3b7fe546db13b44a7b Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Sun, 6 Jul 2025 16:59:30 +0000 Subject: [PATCH 071/139] Remove each_linked_rlib_for_lto from CodegenContext --- compiler/rustc_codegen_gcc/src/back/lto.rs | 9 +++-- compiler/rustc_codegen_gcc/src/lib.rs | 7 ++-- compiler/rustc_codegen_llvm/src/back/lto.rs | 11 +++--- compiler/rustc_codegen_llvm/src/lib.rs | 14 ++++++-- compiler/rustc_codegen_ssa/src/back/lto.rs | 5 ++- compiler/rustc_codegen_ssa/src/back/write.rs | 36 ++++++++++++++----- .../rustc_codegen_ssa/src/traits/write.rs | 4 +++ 7 files changed, 63 insertions(+), 23 deletions(-) diff --git a/compiler/rustc_codegen_gcc/src/back/lto.rs b/compiler/rustc_codegen_gcc/src/back/lto.rs index d107e56fa35a..d558dfbc1c45 100644 --- a/compiler/rustc_codegen_gcc/src/back/lto.rs +++ b/compiler/rustc_codegen_gcc/src/back/lto.rs @@ -49,6 +49,7 @@ struct LtoData { fn prepare_lto( cgcx: &CodegenContext, + each_linked_rlib_for_lto: &[PathBuf], dcx: DiagCtxtHandle<'_>, ) -> Result { let tmp_path = match tempdir() { @@ -67,7 +68,7 @@ fn prepare_lto( // with either fat or thin LTO let mut upstream_modules = Vec::new(); if cgcx.lto != Lto::ThinLocal { - for &(_cnum, ref path) in cgcx.each_linked_rlib_for_lto.iter() { + for path in each_linked_rlib_for_lto { let archive_data = unsafe { Mmap::map(File::open(path).expect("couldn't open rlib")).expect("couldn't map rlib") }; @@ -111,11 +112,12 @@ fn save_as_file(obj: &[u8], path: &Path) -> Result<(), LtoBitcodeFromRlib> { /// for further optimization. pub(crate) fn run_fat( cgcx: &CodegenContext, + each_linked_rlib_for_lto: &[PathBuf], modules: Vec>, ) -> Result, FatalError> { let dcx = cgcx.create_dcx(); let dcx = dcx.handle(); - let lto_data = prepare_lto(cgcx, dcx)?; + let lto_data = prepare_lto(cgcx, each_linked_rlib_for_lto, dcx)?; /*let symbols_below_threshold = lto_data.symbols_below_threshold.iter().map(|c| c.as_ptr()).collect::>();*/ fat_lto( @@ -281,12 +283,13 @@ impl ModuleBufferMethods for ModuleBuffer { /// can simply be copied over from the incr. comp. cache. pub(crate) fn run_thin( cgcx: &CodegenContext, + each_linked_rlib_for_lto: &[PathBuf], modules: Vec<(String, ThinBuffer)>, cached_modules: Vec<(SerializedModule, WorkProduct)>, ) -> Result<(Vec>, Vec), FatalError> { let dcx = cgcx.create_dcx(); let dcx = dcx.handle(); - let lto_data = prepare_lto(cgcx, dcx)?; + let lto_data = prepare_lto(cgcx, each_linked_rlib_for_lto, dcx)?; if cgcx.opts.cg.linker_plugin_lto.enabled() { unreachable!( "We should never reach this case if the LTO step \ diff --git a/compiler/rustc_codegen_gcc/src/lib.rs b/compiler/rustc_codegen_gcc/src/lib.rs index c8bf5bd8f67b..71765c511381 100644 --- a/compiler/rustc_codegen_gcc/src/lib.rs +++ b/compiler/rustc_codegen_gcc/src/lib.rs @@ -81,6 +81,7 @@ mod type_of; use std::any::Any; use std::fmt::Debug; use std::ops::Deref; +use std::path::PathBuf; #[cfg(not(feature = "master"))] use std::sync::atomic::AtomicBool; #[cfg(not(feature = "master"))] @@ -360,6 +361,7 @@ impl WriteBackendMethods for GccCodegenBackend { cgcx: &CodegenContext, // FIXME(bjorn3): Limit LTO exports to these symbols _exported_symbols_for_lto: &[String], + each_linked_rlib_for_lto: &[PathBuf], modules: Vec>, diff_fncs: Vec, ) -> Result, FatalError> { @@ -367,17 +369,18 @@ impl WriteBackendMethods for GccCodegenBackend { unimplemented!(); } - back::lto::run_fat(cgcx, modules) + back::lto::run_fat(cgcx, each_linked_rlib_for_lto, modules) } fn run_thin_lto( cgcx: &CodegenContext, // FIXME(bjorn3): Limit LTO exports to these symbols _exported_symbols_for_lto: &[String], + each_linked_rlib_for_lto: &[PathBuf], modules: Vec<(String, Self::ThinBuffer)>, cached_modules: Vec<(SerializedModule, WorkProduct)>, ) -> Result<(Vec>, Vec), FatalError> { - back::lto::run_thin(cgcx, modules, cached_modules) + back::lto::run_thin(cgcx, each_linked_rlib_for_lto, modules, cached_modules) } fn print_pass_timings(&self) { diff --git a/compiler/rustc_codegen_llvm/src/back/lto.rs b/compiler/rustc_codegen_llvm/src/back/lto.rs index f4879c6e5274..e88417090236 100644 --- a/compiler/rustc_codegen_llvm/src/back/lto.rs +++ b/compiler/rustc_codegen_llvm/src/back/lto.rs @@ -1,7 +1,7 @@ use std::collections::BTreeMap; use std::ffi::{CStr, CString}; use std::fs::File; -use std::path::Path; +use std::path::{Path, PathBuf}; use std::ptr::NonNull; use std::sync::Arc; use std::{io, iter, slice}; @@ -34,6 +34,7 @@ const THIN_LTO_KEYS_INCR_COMP_FILE_NAME: &str = "thin-lto-past-keys.bin"; fn prepare_lto( cgcx: &CodegenContext, exported_symbols_for_lto: &[String], + each_linked_rlib_for_lto: &[PathBuf], dcx: DiagCtxtHandle<'_>, ) -> Result<(Vec, Vec<(SerializedModule, CString)>), FatalError> { let mut symbols_below_threshold = exported_symbols_for_lto @@ -54,7 +55,7 @@ fn prepare_lto( // with either fat or thin LTO let mut upstream_modules = Vec::new(); if cgcx.lto != Lto::ThinLocal { - for &(_cnum, ref path) in cgcx.each_linked_rlib_for_lto.iter() { + for path in each_linked_rlib_for_lto { let archive_data = unsafe { Mmap::map(std::fs::File::open(&path).expect("couldn't open rlib")) .expect("couldn't map rlib") @@ -136,12 +137,13 @@ fn get_bitcode_slice_from_object_data<'a>( pub(crate) fn run_fat( cgcx: &CodegenContext, exported_symbols_for_lto: &[String], + each_linked_rlib_for_lto: &[PathBuf], modules: Vec>, ) -> Result, FatalError> { let dcx = cgcx.create_dcx(); let dcx = dcx.handle(); let (symbols_below_threshold, upstream_modules) = - prepare_lto(cgcx, exported_symbols_for_lto, dcx)?; + prepare_lto(cgcx, exported_symbols_for_lto, each_linked_rlib_for_lto, dcx)?; let symbols_below_threshold = symbols_below_threshold.iter().map(|c| c.as_ptr()).collect::>(); fat_lto(cgcx, dcx, modules, upstream_modules, &symbols_below_threshold) @@ -153,13 +155,14 @@ pub(crate) fn run_fat( pub(crate) fn run_thin( cgcx: &CodegenContext, exported_symbols_for_lto: &[String], + each_linked_rlib_for_lto: &[PathBuf], modules: Vec<(String, ThinBuffer)>, cached_modules: Vec<(SerializedModule, WorkProduct)>, ) -> Result<(Vec>, Vec), FatalError> { let dcx = cgcx.create_dcx(); let dcx = dcx.handle(); let (symbols_below_threshold, upstream_modules) = - prepare_lto(cgcx, exported_symbols_for_lto, dcx)?; + prepare_lto(cgcx, exported_symbols_for_lto, each_linked_rlib_for_lto, dcx)?; let symbols_below_threshold = symbols_below_threshold.iter().map(|c| c.as_ptr()).collect::>(); if cgcx.opts.cg.linker_plugin_lto.enabled() { diff --git a/compiler/rustc_codegen_llvm/src/lib.rs b/compiler/rustc_codegen_llvm/src/lib.rs index 44c1608dca07..20616c0b9fed 100644 --- a/compiler/rustc_codegen_llvm/src/lib.rs +++ b/compiler/rustc_codegen_llvm/src/lib.rs @@ -22,6 +22,7 @@ use std::any::Any; use std::ffi::CStr; use std::mem::ManuallyDrop; +use std::path::PathBuf; use back::owned_target_machine::OwnedTargetMachine; use back::write::{create_informational_target_machine, create_target_machine}; @@ -177,10 +178,12 @@ impl WriteBackendMethods for LlvmCodegenBackend { fn run_and_optimize_fat_lto( cgcx: &CodegenContext, exported_symbols_for_lto: &[String], + each_linked_rlib_for_lto: &[PathBuf], modules: Vec>, diff_fncs: Vec, ) -> Result, FatalError> { - let mut module = back::lto::run_fat(cgcx, exported_symbols_for_lto, modules)?; + let mut module = + back::lto::run_fat(cgcx, exported_symbols_for_lto, each_linked_rlib_for_lto, modules)?; if !diff_fncs.is_empty() { builder::autodiff::differentiate(&module, cgcx, diff_fncs)?; @@ -195,10 +198,17 @@ impl WriteBackendMethods for LlvmCodegenBackend { fn run_thin_lto( cgcx: &CodegenContext, exported_symbols_for_lto: &[String], + each_linked_rlib_for_lto: &[PathBuf], modules: Vec<(String, Self::ThinBuffer)>, cached_modules: Vec<(SerializedModule, WorkProduct)>, ) -> Result<(Vec>, Vec), FatalError> { - back::lto::run_thin(cgcx, exported_symbols_for_lto, modules, cached_modules) + back::lto::run_thin( + cgcx, + exported_symbols_for_lto, + each_linked_rlib_for_lto, + modules, + cached_modules, + ) } fn optimize( cgcx: &CodegenContext, diff --git a/compiler/rustc_codegen_ssa/src/back/lto.rs b/compiler/rustc_codegen_ssa/src/back/lto.rs index 150a588ffed7..c95038375a1b 100644 --- a/compiler/rustc_codegen_ssa/src/back/lto.rs +++ b/compiler/rustc_codegen_ssa/src/back/lto.rs @@ -1,5 +1,4 @@ use std::ffi::CString; -use std::path::PathBuf; use std::sync::Arc; use rustc_data_structures::memmap::Mmap; @@ -76,7 +75,7 @@ fn crate_type_allows_lto(crate_type: CrateType) -> bool { pub(super) fn exported_symbols_for_lto( tcx: TyCtxt<'_>, - each_linked_rlib_for_lto: &[(CrateNum, PathBuf)], + each_linked_rlib_for_lto: &[CrateNum], ) -> Vec { let export_threshold = match tcx.sess.lto() { // We're just doing LTO for our one crate @@ -110,7 +109,7 @@ pub(super) fn exported_symbols_for_lto( // If we're performing LTO for the entire crate graph, then for each of our // upstream dependencies, include their exported symbols. if tcx.sess.lto() != Lto::ThinLocal { - for &(cnum, ref _path) in each_linked_rlib_for_lto { + for &cnum in each_linked_rlib_for_lto { let _timer = tcx.prof.generic_activity("lto_generate_symbols_below_threshold"); symbols_below_threshold.extend(copy_symbols(cnum)); } diff --git a/compiler/rustc_codegen_ssa/src/back/write.rs b/compiler/rustc_codegen_ssa/src/back/write.rs index 45e90cd072bc..158001c40265 100644 --- a/compiler/rustc_codegen_ssa/src/back/write.rs +++ b/compiler/rustc_codegen_ssa/src/back/write.rs @@ -20,7 +20,6 @@ use rustc_errors::{ Suggestions, }; use rustc_fs_util::link_or_copy; -use rustc_hir::def_id::CrateNum; use rustc_incremental::{ copy_cgu_workproduct_to_incr_comp_cache_dir, in_incr_comp_dir, in_incr_comp_dir_sess, }; @@ -340,7 +339,6 @@ pub struct CodegenContext { pub time_trace: bool, pub opts: Arc, pub crate_types: Vec, - pub each_linked_rlib_for_lto: Vec<(CrateNum, PathBuf)>, pub output_filenames: Arc, pub invocation_temp: Option, pub regular_module_config: Arc, @@ -396,14 +394,20 @@ impl CodegenContext { fn generate_thin_lto_work( cgcx: &CodegenContext, exported_symbols_for_lto: &[String], + each_linked_rlib_for_lto: &[PathBuf], needs_thin_lto: Vec<(String, B::ThinBuffer)>, import_only_modules: Vec<(SerializedModule, WorkProduct)>, ) -> Vec<(WorkItem, u64)> { let _prof_timer = cgcx.prof.generic_activity("codegen_thin_generate_lto_work"); - let (lto_modules, copy_jobs) = - B::run_thin_lto(cgcx, exported_symbols_for_lto, needs_thin_lto, import_only_modules) - .unwrap_or_else(|e| e.raise()); + let (lto_modules, copy_jobs) = B::run_thin_lto( + cgcx, + exported_symbols_for_lto, + each_linked_rlib_for_lto, + needs_thin_lto, + import_only_modules, + ) + .unwrap_or_else(|e| e.raise()); lto_modules .into_iter() .map(|module| { @@ -720,6 +724,7 @@ pub(crate) enum WorkItem { /// Performs fat LTO on the given module. FatLto { exported_symbols_for_lto: Arc>, + each_linked_rlib_for_lto: Vec, needs_fat_lto: Vec>, import_only_modules: Vec<(SerializedModule, WorkProduct)>, autodiff: Vec, @@ -993,6 +998,7 @@ fn execute_copy_from_cache_work_item( fn execute_fat_lto_work_item( cgcx: &CodegenContext, exported_symbols_for_lto: &[String], + each_linked_rlib_for_lto: &[PathBuf], mut needs_fat_lto: Vec>, import_only_modules: Vec<(SerializedModule, WorkProduct)>, autodiff: Vec, @@ -1002,8 +1008,13 @@ fn execute_fat_lto_work_item( needs_fat_lto.push(FatLtoInput::Serialized { name: wp.cgu_name, buffer: module }) } - let module = - B::run_and_optimize_fat_lto(cgcx, exported_symbols_for_lto, needs_fat_lto, autodiff)?; + let module = B::run_and_optimize_fat_lto( + cgcx, + exported_symbols_for_lto, + each_linked_rlib_for_lto, + needs_fat_lto, + autodiff, + )?; let module = B::codegen(cgcx, module, module_config)?; Ok(WorkItemResult::Finished(module)) } @@ -1119,11 +1130,13 @@ fn start_executing_work( let autodiff_items = autodiff_items.to_vec(); let mut each_linked_rlib_for_lto = Vec::new(); + let mut each_linked_rlib_file_for_lto = Vec::new(); drop(link::each_linked_rlib(crate_info, None, &mut |cnum, path| { if link::ignored_for_lto(sess, crate_info, cnum) { return; } - each_linked_rlib_for_lto.push((cnum, path.to_path_buf())); + each_linked_rlib_for_lto.push(cnum); + each_linked_rlib_file_for_lto.push(path.to_path_buf()); })); // Compute the set of symbols we need to retain when doing LTO (if we need to) @@ -1163,7 +1176,6 @@ fn start_executing_work( let cgcx = CodegenContext:: { crate_types: tcx.crate_types().to_vec(), - each_linked_rlib_for_lto, lto: sess.lto(), fewer_names: sess.fewer_names(), save_temps: sess.opts.cg.save_temps, @@ -1436,6 +1448,8 @@ fn start_executing_work( let needs_fat_lto = mem::take(&mut needs_fat_lto); let needs_thin_lto = mem::take(&mut needs_thin_lto); let import_only_modules = mem::take(&mut lto_import_only_modules); + let each_linked_rlib_file_for_lto = + mem::take(&mut each_linked_rlib_file_for_lto); check_lto_allowed(&cgcx); @@ -1445,6 +1459,7 @@ fn start_executing_work( work_items.push(( WorkItem::FatLto { exported_symbols_for_lto: Arc::clone(&exported_symbols_for_lto), + each_linked_rlib_for_lto: each_linked_rlib_file_for_lto, needs_fat_lto, import_only_modules, autodiff: autodiff_items.clone(), @@ -1463,6 +1478,7 @@ fn start_executing_work( for (work, cost) in generate_thin_lto_work( &cgcx, &exported_symbols_for_lto, + &each_linked_rlib_file_for_lto, needs_thin_lto, import_only_modules, ) { @@ -1806,6 +1822,7 @@ fn spawn_work<'a, B: ExtraBackendMethods>( } WorkItem::FatLto { exported_symbols_for_lto, + each_linked_rlib_for_lto, needs_fat_lto, import_only_modules, autodiff, @@ -1816,6 +1833,7 @@ fn spawn_work<'a, B: ExtraBackendMethods>( execute_fat_lto_work_item( &cgcx, &exported_symbols_for_lto, + &each_linked_rlib_for_lto, needs_fat_lto, import_only_modules, autodiff, diff --git a/compiler/rustc_codegen_ssa/src/traits/write.rs b/compiler/rustc_codegen_ssa/src/traits/write.rs index d0b3099191a8..8e78cbe1963b 100644 --- a/compiler/rustc_codegen_ssa/src/traits/write.rs +++ b/compiler/rustc_codegen_ssa/src/traits/write.rs @@ -1,3 +1,5 @@ +use std::path::PathBuf; + use rustc_ast::expand::autodiff_attrs::AutoDiffItem; use rustc_errors::{DiagCtxtHandle, FatalError}; use rustc_middle::dep_graph::WorkProduct; @@ -25,6 +27,7 @@ pub trait WriteBackendMethods: Clone + 'static { fn run_and_optimize_fat_lto( cgcx: &CodegenContext, exported_symbols_for_lto: &[String], + each_linked_rlib_for_lto: &[PathBuf], modules: Vec>, diff_fncs: Vec, ) -> Result, FatalError>; @@ -34,6 +37,7 @@ pub trait WriteBackendMethods: Clone + 'static { fn run_thin_lto( cgcx: &CodegenContext, exported_symbols_for_lto: &[String], + each_linked_rlib_for_lto: &[PathBuf], modules: Vec<(String, Self::ThinBuffer)>, cached_modules: Vec<(SerializedModule, WorkProduct)>, ) -> Result<(Vec>, Vec), FatalError>; From bcaa79529d351416a2ab1c07931a0ba05b99c9c3 Mon Sep 17 00:00:00 2001 From: Kivooeo Date: Sat, 19 Jul 2025 15:18:21 +0500 Subject: [PATCH 072/139] removed tidy check on issues files --- src/tools/tidy/src/issues.txt | 1224 -------------------------------- src/tools/tidy/src/ui_tests.rs | 55 +- triagebot.toml | 6 + 3 files changed, 10 insertions(+), 1275 deletions(-) diff --git a/src/tools/tidy/src/issues.txt b/src/tools/tidy/src/issues.txt index 77414bec82d3..ee06707415f5 100644 --- a/src/tools/tidy/src/issues.txt +++ b/src/tools/tidy/src/issues.txt @@ -1364,1230 +1364,6 @@ ui/infinite/issue-41731-infinite-macro-println.rs ui/intrinsics/issue-28575.rs ui/intrinsics/issue-84297-reifying-copy.rs ui/invalid/issue-114435-layout-type-err.rs -ui/issues/auxiliary/issue-11224.rs -ui/issues/auxiliary/issue-11508.rs -ui/issues/auxiliary/issue-11529.rs -ui/issues/auxiliary/issue-11680.rs -ui/issues/auxiliary/issue-12612-1.rs -ui/issues/auxiliary/issue-12612-2.rs -ui/issues/auxiliary/issue-12660-aux.rs -ui/issues/auxiliary/issue-13507.rs -ui/issues/auxiliary/issue-13620-1.rs -ui/issues/auxiliary/issue-13620-2.rs -ui/issues/auxiliary/issue-14344-1.rs -ui/issues/auxiliary/issue-14344-2.rs -ui/issues/auxiliary/issue-14422.rs -ui/issues/auxiliary/issue-15562.rs -ui/issues/auxiliary/issue-16643.rs -ui/issues/auxiliary/issue-16725.rs -ui/issues/auxiliary/issue-17662.rs -ui/issues/auxiliary/issue-18501.rs -ui/issues/auxiliary/issue-18514.rs -ui/issues/auxiliary/issue-18711.rs -ui/issues/auxiliary/issue-18913-1.rs -ui/issues/auxiliary/issue-18913-2.rs -ui/issues/auxiliary/issue-19293.rs -ui/issues/auxiliary/issue-20389.rs -ui/issues/auxiliary/issue-21202.rs -ui/issues/auxiliary/issue-2170-lib.rs -ui/issues/auxiliary/issue-2316-a.rs -ui/issues/auxiliary/issue-2316-b.rs -ui/issues/auxiliary/issue-2380.rs -ui/issues/auxiliary/issue-2414-a.rs -ui/issues/auxiliary/issue-2414-b.rs -ui/issues/auxiliary/issue-2472-b.rs -ui/issues/auxiliary/issue-25185-1.rs -ui/issues/auxiliary/issue-25185-2.rs -ui/issues/auxiliary/issue-2526.rs -ui/issues/auxiliary/issue-25467.rs -ui/issues/auxiliary/issue-2631-a.rs -ui/issues/auxiliary/issue-2723-a.rs -ui/issues/auxiliary/issue-29265.rs -ui/issues/auxiliary/issue-29485.rs -ui/issues/auxiliary/issue-3012-1.rs -ui/issues/auxiliary/issue-30123-aux.rs -ui/issues/auxiliary/issue-3136-a.rs -ui/issues/auxiliary/issue-31702-1.rs -ui/issues/auxiliary/issue-31702-2.rs -ui/issues/auxiliary/issue-34796-aux.rs -ui/issues/auxiliary/issue-36954.rs -ui/issues/auxiliary/issue-38190.rs -ui/issues/auxiliary/issue-38226-aux.rs -ui/issues/auxiliary/issue-3979-traits.rs -ui/issues/auxiliary/issue-41053.rs -ui/issues/auxiliary/issue-41549.rs -ui/issues/auxiliary/issue-42007-s.rs -ui/issues/auxiliary/issue-4208-cc.rs -ui/issues/auxiliary/issue-4545.rs -ui/issues/auxiliary/issue-48984-aux.rs -ui/issues/auxiliary/issue-49544.rs -ui/issues/auxiliary/issue-51798.rs -ui/issues/auxiliary/issue-52489.rs -ui/issues/auxiliary/issue-5518.rs -ui/issues/auxiliary/issue-5521.rs -ui/issues/auxiliary/issue-56943.rs -ui/issues/auxiliary/issue-57271-lib.rs -ui/issues/auxiliary/issue-5844-aux.rs -ui/issues/auxiliary/issue-7178.rs -ui/issues/auxiliary/issue-73112.rs -ui/issues/auxiliary/issue-7899.rs -ui/issues/auxiliary/issue-8044.rs -ui/issues/auxiliary/issue-8259.rs -ui/issues/auxiliary/issue-8401.rs -ui/issues/auxiliary/issue-9123.rs -ui/issues/auxiliary/issue-9155.rs -ui/issues/auxiliary/issue-9188.rs -ui/issues/auxiliary/issue-9906.rs -ui/issues/auxiliary/issue-9968.rs -ui/issues/issue-10228.rs -ui/issues/issue-10291.rs -ui/issues/issue-102964.rs -ui/issues/issue-10396.rs -ui/issues/issue-10412.rs -ui/issues/issue-10436.rs -ui/issues/issue-10456.rs -ui/issues/issue-10465.rs -ui/issues/issue-10545.rs -ui/issues/issue-10638.rs -ui/issues/issue-10656.rs -ui/issues/issue-106755.rs -ui/issues/issue-10683.rs -ui/issues/issue-10718.rs -ui/issues/issue-10734.rs -ui/issues/issue-10764.rs -ui/issues/issue-10767.rs -ui/issues/issue-10802.rs -ui/issues/issue-10806.rs -ui/issues/issue-10853.rs -ui/issues/issue-10877.rs -ui/issues/issue-10902.rs -ui/issues/issue-11004.rs -ui/issues/issue-11047.rs -ui/issues/issue-11085.rs -ui/issues/issue-11192.rs -ui/issues/issue-11205.rs -ui/issues/issue-11224.rs -ui/issues/issue-11267.rs -ui/issues/issue-11374.rs -ui/issues/issue-11382.rs -ui/issues/issue-11384.rs -ui/issues/issue-11508.rs -ui/issues/issue-11529.rs -ui/issues/issue-11552.rs -ui/issues/issue-11592.rs -ui/issues/issue-11677.rs -ui/issues/issue-11680.rs -ui/issues/issue-11681.rs -ui/issues/issue-11709.rs -ui/issues/issue-11740.rs -ui/issues/issue-11771.rs -ui/issues/issue-11820.rs -ui/issues/issue-11844.rs -ui/issues/issue-11869.rs -ui/issues/issue-11958.rs -ui/issues/issue-12033.rs -ui/issues/issue-12041.rs -ui/issues/issue-12127.rs -ui/issues/issue-12285.rs -ui/issues/issue-12567.rs -ui/issues/issue-12612.rs -ui/issues/issue-12660.rs -ui/issues/issue-12677.rs -ui/issues/issue-12729.rs -ui/issues/issue-12744.rs -ui/issues/issue-12860.rs -ui/issues/issue-12863.rs -ui/issues/issue-12909.rs -ui/issues/issue-12920.rs -ui/issues/issue-13027.rs -ui/issues/issue-13058.rs -ui/issues/issue-13105.rs -ui/issues/issue-13167.rs -ui/issues/issue-13202.rs -ui/issues/issue-13204.rs -ui/issues/issue-13214.rs -ui/issues/issue-13259-windows-tcb-trash.rs -ui/issues/issue-13264.rs -ui/issues/issue-13323.rs -ui/issues/issue-13359.rs -ui/issues/issue-13405.rs -ui/issues/issue-13407.rs -ui/issues/issue-13434.rs -ui/issues/issue-13446.rs -ui/issues/issue-13466.rs -ui/issues/issue-13482-2.rs -ui/issues/issue-13482.rs -ui/issues/issue-13497-2.rs -ui/issues/issue-13497.rs -ui/issues/issue-13507-2.rs -ui/issues/issue-13620.rs -ui/issues/issue-13665.rs -ui/issues/issue-13703.rs -ui/issues/issue-13763.rs -ui/issues/issue-13775.rs -ui/issues/issue-13808.rs -ui/issues/issue-13847.rs -ui/issues/issue-13867.rs -ui/issues/issue-14082.rs -ui/issues/issue-14091-2.rs -ui/issues/issue-14091.rs -ui/issues/issue-14092.rs -ui/issues/issue-14229.rs -ui/issues/issue-14254.rs -ui/issues/issue-14285.rs -ui/issues/issue-14308.rs -ui/issues/issue-14330.rs -ui/issues/issue-14344.rs -ui/issues/issue-14366.rs -ui/issues/issue-14382.rs -ui/issues/issue-14393.rs -ui/issues/issue-14399.rs -ui/issues/issue-14422.rs -ui/issues/issue-14541.rs -ui/issues/issue-14721.rs -ui/issues/issue-14821.rs -ui/issues/issue-14845.rs -ui/issues/issue-14853.rs -ui/issues/issue-14865.rs -ui/issues/issue-14875.rs -ui/issues/issue-14901.rs -ui/issues/issue-14915.rs -ui/issues/issue-14919.rs -ui/issues/issue-14959.rs -ui/issues/issue-15034.rs -ui/issues/issue-15043.rs -ui/issues/issue-15063.rs -ui/issues/issue-15094.rs -ui/issues/issue-15104.rs -ui/issues/issue-15129-rpass.rs -ui/issues/issue-15167.rs -ui/issues/issue-15189.rs -ui/issues/issue-15207.rs -ui/issues/issue-15260.rs -ui/issues/issue-15381.rs -ui/issues/issue-15444.rs -ui/issues/issue-15523-big.rs -ui/issues/issue-15523.rs -ui/issues/issue-15562.rs -ui/issues/issue-15571.rs -ui/issues/issue-15673.rs -ui/issues/issue-15734.rs -ui/issues/issue-15735.rs -ui/issues/issue-15756.rs -ui/issues/issue-15763.rs -ui/issues/issue-15774.rs -ui/issues/issue-15783.rs -ui/issues/issue-15793.rs -ui/issues/issue-15858.rs -ui/issues/issue-15896.rs -ui/issues/issue-15965.rs -ui/issues/issue-16048.rs -ui/issues/issue-16149.rs -ui/issues/issue-16151.rs -ui/issues/issue-16256.rs -ui/issues/issue-16278.rs -ui/issues/issue-16401.rs -ui/issues/issue-16441.rs -ui/issues/issue-16452.rs -ui/issues/issue-16492.rs -ui/issues/issue-16530.rs -ui/issues/issue-16560.rs -ui/issues/issue-16562.rs -ui/issues/issue-16596.rs -ui/issues/issue-16643.rs -ui/issues/issue-16648.rs -ui/issues/issue-16668.rs -ui/issues/issue-16671.rs -ui/issues/issue-16683.rs -ui/issues/issue-16725.rs -ui/issues/issue-16739.rs -ui/issues/issue-16745.rs -ui/issues/issue-16774.rs -ui/issues/issue-16783.rs -ui/issues/issue-16819.rs -ui/issues/issue-16922-rpass.rs -ui/issues/issue-16966.rs -ui/issues/issue-16994.rs -ui/issues/issue-17001.rs -ui/issues/issue-17033.rs -ui/issues/issue-17068.rs -ui/issues/issue-17121.rs -ui/issues/issue-17216.rs -ui/issues/issue-17252.rs -ui/issues/issue-17322.rs -ui/issues/issue-17336.rs -ui/issues/issue-17337.rs -ui/issues/issue-17351.rs -ui/issues/issue-17361.rs -ui/issues/issue-17373.rs -ui/issues/issue-17385.rs -ui/issues/issue-17405.rs -ui/issues/issue-17441.rs -ui/issues/issue-17450.rs -ui/issues/issue-17503.rs -ui/issues/issue-17546.rs -ui/issues/issue-17551.rs -ui/issues/issue-17651.rs -ui/issues/issue-17662.rs -ui/issues/issue-17732.rs -ui/issues/issue-17734.rs -ui/issues/issue-17740.rs -ui/issues/issue-17746.rs -ui/issues/issue-17758.rs -ui/issues/issue-17771.rs -ui/issues/issue-17800.rs -ui/issues/issue-17816.rs -ui/issues/issue-17877.rs -ui/issues/issue-17897.rs -ui/issues/issue-17904-2.rs -ui/issues/issue-17904.rs -ui/issues/issue-17905-2.rs -ui/issues/issue-17905.rs -ui/issues/issue-17933.rs -ui/issues/issue-17954.rs -ui/issues/issue-17959.rs -ui/issues/issue-17994.rs -ui/issues/issue-17999.rs -ui/issues/issue-18058.rs -ui/issues/issue-18088.rs -ui/issues/issue-18107.rs -ui/issues/issue-18110.rs -ui/issues/issue-18119.rs -ui/issues/issue-18159.rs -ui/issues/issue-18173.rs -ui/issues/issue-18183.rs -ui/issues/issue-18188.rs -ui/issues/issue-18232.rs -ui/issues/issue-18352.rs -ui/issues/issue-18353.rs -ui/issues/issue-18389.rs -ui/issues/issue-18423.rs -ui/issues/issue-18446-2.rs -ui/issues/issue-18446.rs -ui/issues/issue-18464.rs -ui/issues/issue-18501.rs -ui/issues/issue-18514.rs -ui/issues/issue-18532.rs -ui/issues/issue-18539.rs -ui/issues/issue-18566.rs -ui/issues/issue-18611.rs -ui/issues/issue-18685.rs -ui/issues/issue-18711.rs -ui/issues/issue-18767.rs -ui/issues/issue-18783.rs -ui/issues/issue-18809.rs -ui/issues/issue-18845.rs -ui/issues/issue-18859.rs -ui/issues/issue-18906.rs -ui/issues/issue-18913.rs -ui/issues/issue-18919.rs -ui/issues/issue-18952.rs -ui/issues/issue-18959.rs -ui/issues/issue-18988.rs -ui/issues/issue-19001.rs -ui/issues/issue-19037.rs -ui/issues/issue-19086.rs -ui/issues/issue-19097.rs -ui/issues/issue-19098.rs -ui/issues/issue-19100.rs -ui/issues/issue-19127.rs -ui/issues/issue-19135.rs -ui/issues/issue-19293.rs -ui/issues/issue-19367.rs -ui/issues/issue-19380.rs -ui/issues/issue-19398.rs -ui/issues/issue-19404.rs -ui/issues/issue-19479.rs -ui/issues/issue-19482.rs -ui/issues/issue-19499.rs -ui/issues/issue-19601.rs -ui/issues/issue-19631.rs -ui/issues/issue-19632.rs -ui/issues/issue-19692.rs -ui/issues/issue-19734.rs -ui/issues/issue-19811-escape-unicode.rs -ui/issues/issue-19850.rs -ui/issues/issue-19922.rs -ui/issues/issue-19982.rs -ui/issues/issue-19991.rs -ui/issues/issue-20009.rs -ui/issues/issue-20055-box-trait.rs -ui/issues/issue-20055-box-unsized-array.rs -ui/issues/issue-20162.rs -ui/issues/issue-20174.rs -ui/issues/issue-20186.rs -ui/issues/issue-20225.rs -ui/issues/issue-20261.rs -ui/issues/issue-20313-rpass.rs -ui/issues/issue-20313.rs -ui/issues/issue-20389.rs -ui/issues/issue-20396.rs -ui/issues/issue-20413.rs -ui/issues/issue-20414.rs -ui/issues/issue-20427.rs -ui/issues/issue-20433.rs -ui/issues/issue-20454.rs -ui/issues/issue-20544.rs -ui/issues/issue-20575.rs -ui/issues/issue-20644.rs -ui/issues/issue-20676.rs -ui/issues/issue-20714.rs -ui/issues/issue-2074.rs -ui/issues/issue-20772.rs -ui/issues/issue-20797.rs -ui/issues/issue-20803.rs -ui/issues/issue-20831-debruijn.rs -ui/issues/issue-20847.rs -ui/issues/issue-20939.rs -ui/issues/issue-20953.rs -ui/issues/issue-20971.rs -ui/issues/issue-21033.rs -ui/issues/issue-21140.rs -ui/issues/issue-21160.rs -ui/issues/issue-21174-2.rs -ui/issues/issue-21174.rs -ui/issues/issue-21177.rs -ui/issues/issue-21202.rs -ui/issues/issue-21245.rs -ui/issues/issue-21291.rs -ui/issues/issue-21306.rs -ui/issues/issue-21332.rs -ui/issues/issue-21361.rs -ui/issues/issue-21384.rs -ui/issues/issue-21400.rs -ui/issues/issue-21402.rs -ui/issues/issue-21449.rs -ui/issues/issue-2150.rs -ui/issues/issue-2151.rs -ui/issues/issue-21546.rs -ui/issues/issue-21554.rs -ui/issues/issue-21600.rs -ui/issues/issue-21622.rs -ui/issues/issue-21634.rs -ui/issues/issue-21655.rs -ui/issues/issue-2170-exe.rs -ui/issues/issue-21701.rs -ui/issues/issue-21763.rs -ui/issues/issue-21891.rs -ui/issues/issue-2190-1.rs -ui/issues/issue-21909.rs -ui/issues/issue-21922.rs -ui/issues/issue-21946.rs -ui/issues/issue-21950.rs -ui/issues/issue-21974.rs -ui/issues/issue-22008.rs -ui/issues/issue-22034.rs -ui/issues/issue-22036.rs -ui/issues/issue-2214.rs -ui/issues/issue-22258.rs -ui/issues/issue-22289.rs -ui/issues/issue-22312.rs -ui/issues/issue-22346.rs -ui/issues/issue-22356.rs -ui/issues/issue-22370.rs -ui/issues/issue-22403.rs -ui/issues/issue-22426.rs -ui/issues/issue-22434.rs -ui/issues/issue-22468.rs -ui/issues/issue-22471.rs -ui/issues/issue-22577.rs -ui/issues/issue-22599.rs -ui/issues/issue-22603.rs -ui/issues/issue-22629.rs -ui/issues/issue-22638.rs -ui/issues/issue-22644.rs -ui/issues/issue-22673.rs -ui/issues/issue-22684.rs -ui/issues/issue-22706.rs -ui/issues/issue-22777.rs -ui/issues/issue-22781.rs -ui/issues/issue-22789.rs -ui/issues/issue-2281-part1.rs -ui/issues/issue-22814.rs -ui/issues/issue-2284.rs -ui/issues/issue-22872.rs -ui/issues/issue-22874.rs -ui/issues/issue-2288.rs -ui/issues/issue-22886.rs -ui/issues/issue-22894.rs -ui/issues/issue-22992-2.rs -ui/issues/issue-22992.rs -ui/issues/issue-23024.rs -ui/issues/issue-23036.rs -ui/issues/issue-23041.rs -ui/issues/issue-23046.rs -ui/issues/issue-23073.rs -ui/issues/issue-2311-2.rs -ui/issues/issue-2311.rs -ui/issues/issue-2312.rs -ui/issues/issue-2316-c.rs -ui/issues/issue-23173.rs -ui/issues/issue-23189.rs -ui/issues/issue-23217.rs -ui/issues/issue-23253.rs -ui/issues/issue-23261.rs -ui/issues/issue-23281.rs -ui/issues/issue-23311.rs -ui/issues/issue-23336.rs -ui/issues/issue-23354-2.rs -ui/issues/issue-23354.rs -ui/issues/issue-23406.rs -ui/issues/issue-23433.rs -ui/issues/issue-23442.rs -ui/issues/issue-23477.rs -ui/issues/issue-23485.rs -ui/issues/issue-23491.rs -ui/issues/issue-23543.rs -ui/issues/issue-23544.rs -ui/issues/issue-23550.rs -ui/issues/issue-23589.rs -ui/issues/issue-23699.rs -ui/issues/issue-2380-b.rs -ui/issues/issue-2383.rs -ui/issues/issue-23891.rs -ui/issues/issue-23898.rs -ui/issues/issue-23958.rs -ui/issues/issue-23966.rs -ui/issues/issue-23992.rs -ui/issues/issue-24013.rs -ui/issues/issue-24036.rs -ui/issues/issue-24086.rs -ui/issues/issue-2414-c.rs -ui/issues/issue-24161.rs -ui/issues/issue-24227.rs -ui/issues/issue-2428.rs -ui/issues/issue-24308.rs -ui/issues/issue-24322.rs -ui/issues/issue-24352.rs -ui/issues/issue-24353.rs -ui/issues/issue-24357.rs -ui/issues/issue-24363.rs -ui/issues/issue-24365.rs -ui/issues/issue-24389.rs -ui/issues/issue-24424.rs -ui/issues/issue-24434.rs -ui/issues/issue-2445-b.rs -ui/issues/issue-2445.rs -ui/issues/issue-24533.rs -ui/issues/issue-24589.rs -ui/issues/issue-2463.rs -ui/issues/issue-24682.rs -ui/issues/issue-24687-embed-debuginfo/auxiliary/issue-24687-lib.rs -ui/issues/issue-24687-embed-debuginfo/auxiliary/issue-24687-mbcs-in-comments.rs -ui/issues/issue-2470-bounds-check-overflow.rs -ui/issues/issue-2472.rs -ui/issues/issue-24779.rs -ui/issues/issue-24819.rs -ui/issues/issue-2487-a.rs -ui/issues/issue-24945-repeat-dash-opts.rs -ui/issues/issue-24947.rs -ui/issues/issue-24954.rs -ui/issues/issue-2502.rs -ui/issues/issue-25076.rs -ui/issues/issue-25089.rs -ui/issues/issue-25145.rs -ui/issues/issue-25180.rs -ui/issues/issue-25185.rs -ui/issues/issue-2526-a.rs -ui/issues/issue-25279.rs -ui/issues/issue-25343.rs -ui/issues/issue-25368.rs -ui/issues/issue-25386.rs -ui/issues/issue-25394.rs -ui/issues/issue-25467.rs -ui/issues/issue-25497.rs -ui/issues/issue-2550.rs -ui/issues/issue-25515.rs -ui/issues/issue-25549-multiple-drop.rs -ui/issues/issue-25579.rs -ui/issues/issue-25679.rs -ui/issues/issue-25693.rs -ui/issues/issue-25746-bool-transmute.rs -ui/issues/issue-25757.rs -ui/issues/issue-25810.rs -ui/issues/issue-2590.rs -ui/issues/issue-25901.rs -ui/issues/issue-26056.rs -ui/issues/issue-26093.rs -ui/issues/issue-26095.rs -ui/issues/issue-26127.rs -ui/issues/issue-26186.rs -ui/issues/issue-26205.rs -ui/issues/issue-26217.rs -ui/issues/issue-26237.rs -ui/issues/issue-2631-b.rs -ui/issues/issue-2642.rs -ui/issues/issue-26468.rs -ui/issues/issue-26472.rs -ui/issues/issue-26484.rs -ui/issues/issue-26614.rs -ui/issues/issue-26619.rs -ui/issues/issue-26641.rs -ui/issues/issue-26646.rs -ui/issues/issue-26655.rs -ui/issues/issue-26709.rs -ui/issues/issue-26802.rs -ui/issues/issue-26805.rs -ui/issues/issue-26812.rs -ui/issues/issue-26948.rs -ui/issues/issue-26997.rs -ui/issues/issue-27008.rs -ui/issues/issue-27033.rs -ui/issues/issue-27042.rs -ui/issues/issue-27054-primitive-binary-ops.rs -ui/issues/issue-27078.rs -ui/issues/issue-2708.rs -ui/issues/issue-27105.rs -ui/issues/issue-2723-b.rs -ui/issues/issue-27240.rs -ui/issues/issue-27268.rs -ui/issues/issue-27281.rs -ui/issues/issue-27340.rs -ui/issues/issue-27401-dropflag-reinit.rs -ui/issues/issue-27433.rs -ui/issues/issue-27592.rs -ui/issues/issue-2761.rs -ui/issues/issue-27639.rs -ui/issues/issue-27697.rs -ui/issues/issue-27815.rs -ui/issues/issue-27842.rs -ui/issues/issue-27889.rs -ui/issues/issue-27942.rs -ui/issues/issue-27949.rs -ui/issues/issue-27997.rs -ui/issues/issue-28105.rs -ui/issues/issue-28109.rs -ui/issues/issue-28181.rs -ui/issues/issue-28279.rs -ui/issues/issue-28344.rs -ui/issues/issue-28433.rs -ui/issues/issue-28472.rs -ui/issues/issue-2848.rs -ui/issues/issue-2849.rs -ui/issues/issue-28498-must-work-ex1.rs -ui/issues/issue-28498-must-work-ex2.rs -ui/issues/issue-28498-ugeh-ex1.rs -ui/issues/issue-28550.rs -ui/issues/issue-28561.rs -ui/issues/issue-28568.rs -ui/issues/issue-28586.rs -ui/issues/issue-28600.rs -ui/issues/issue-28625.rs -ui/issues/issue-28776.rs -ui/issues/issue-28828.rs -ui/issues/issue-28839.rs -ui/issues/issue-28936.rs -ui/issues/issue-2895.rs -ui/issues/issue-28971.rs -ui/issues/issue-28983.rs -ui/issues/issue-28999.rs -ui/issues/issue-29030.rs -ui/issues/issue-29037.rs -ui/issues/issue-2904.rs -ui/issues/issue-29048.rs -ui/issues/issue-29053.rs -ui/issues/issue-29071-2.rs -ui/issues/issue-29071.rs -ui/issues/issue-29092.rs -ui/issues/issue-29147-rpass.rs -ui/issues/issue-29147.rs -ui/issues/issue-29265.rs -ui/issues/issue-29276.rs -ui/issues/issue-2935.rs -ui/issues/issue-29466.rs -ui/issues/issue-29485.rs -ui/issues/issue-2951.rs -ui/issues/issue-29516.rs -ui/issues/issue-29522.rs -ui/issues/issue-29540.rs -ui/issues/issue-29663.rs -ui/issues/issue-29668.rs -ui/issues/issue-29710.rs -ui/issues/issue-29723.rs -ui/issues/issue-29740.rs -ui/issues/issue-29743.rs -ui/issues/issue-29821.rs -ui/issues/issue-29857.rs -ui/issues/issue-29861.rs -ui/issues/issue-2989.rs -ui/issues/issue-29948.rs -ui/issues/issue-2995.rs -ui/issues/issue-30018-panic.rs -ui/issues/issue-30081.rs -ui/issues/issue-3012-2.rs -ui/issues/issue-30123.rs -ui/issues/issue-3021-b.rs -ui/issues/issue-3021-d.rs -ui/issues/issue-30236.rs -ui/issues/issue-30255.rs -ui/issues/issue-3026.rs -ui/issues/issue-3029.rs -ui/issues/issue-3037.rs -ui/issues/issue-30371.rs -ui/issues/issue-3038.rs -ui/issues/issue-30380.rs -ui/issues/issue-3052.rs -ui/issues/issue-30530.rs -ui/issues/issue-30589.rs -ui/issues/issue-30615.rs -ui/issues/issue-30756.rs -ui/issues/issue-30891.rs -ui/issues/issue-3091.rs -ui/issues/issue-31011.rs -ui/issues/issue-3109.rs -ui/issues/issue-3121.rs -ui/issues/issue-31267-additional.rs -ui/issues/issue-31267.rs -ui/issues/issue-31299.rs -ui/issues/issue-3136-b.rs -ui/issues/issue-3149.rs -ui/issues/issue-31511.rs -ui/issues/issue-3154.rs -ui/issues/issue-31702.rs -ui/issues/issue-31769.rs -ui/issues/issue-31776.rs -ui/issues/issue-31910.rs -ui/issues/issue-32004.rs -ui/issues/issue-32008.rs -ui/issues/issue-32086.rs -ui/issues/issue-3220.rs -ui/issues/issue-32292.rs -ui/issues/issue-32324.rs -ui/issues/issue-32326.rs -ui/issues/issue-32377.rs -ui/issues/issue-32389.rs -ui/issues/issue-32518.rs -ui/issues/issue-32655.rs -ui/issues/issue-32782.rs -ui/issues/issue-32797.rs -ui/issues/issue-32805.rs -ui/issues/issue-3290.rs -ui/issues/issue-32995-2.rs -ui/issues/issue-32995.rs -ui/issues/issue-33202.rs -ui/issues/issue-33241.rs -ui/issues/issue-33287.rs -ui/issues/issue-33293.rs -ui/issues/issue-33387.rs -ui/issues/issue-3344.rs -ui/issues/issue-33461.rs -ui/issues/issue-33504.rs -ui/issues/issue-33525.rs -ui/issues/issue-33571.rs -ui/issues/issue-33687.rs -ui/issues/issue-33770.rs -ui/issues/issue-3389.rs -ui/issues/issue-33941.rs -ui/issues/issue-34047.rs -ui/issues/issue-34074.rs -ui/issues/issue-34209.rs -ui/issues/issue-34229.rs -ui/issues/issue-3424.rs -ui/issues/issue-3429.rs -ui/issues/issue-34334.rs -ui/issues/issue-34349.rs -ui/issues/issue-34373.rs -ui/issues/issue-34418.rs -ui/issues/issue-34427.rs -ui/issues/issue-3447.rs -ui/issues/issue-34503.rs -ui/issues/issue-34569.rs -ui/issues/issue-34571.rs -ui/issues/issue-34751.rs -ui/issues/issue-3477.rs -ui/issues/issue-34780.rs -ui/issues/issue-34796.rs -ui/issues/issue-34839.rs -ui/issues/issue-3500.rs -ui/issues/issue-35139.rs -ui/issues/issue-3521-2.rs -ui/issues/issue-35241.rs -ui/issues/issue-35423.rs -ui/issues/issue-3556.rs -ui/issues/issue-35570.rs -ui/issues/issue-3559.rs -ui/issues/issue-35600.rs -ui/issues/issue-3574.rs -ui/issues/issue-35815.rs -ui/issues/issue-35976.rs -ui/issues/issue-35988.rs -ui/issues/issue-36023.rs -ui/issues/issue-36036-associated-type-layout.rs -ui/issues/issue-36075.rs -ui/issues/issue-3609.rs -ui/issues/issue-36116.rs -ui/issues/issue-36260.rs -ui/issues/issue-36278-prefix-nesting.rs -ui/issues/issue-36299.rs -ui/issues/issue-36379.rs -ui/issues/issue-36400.rs -ui/issues/issue-36474.rs -ui/issues/issue-3656.rs -ui/issues/issue-3668-non-constant-value-in-constant/issue-3668-2.rs -ui/issues/issue-3668-non-constant-value-in-constant/issue-3668.rs -ui/issues/issue-36744-bitcast-args-if-needed.rs -ui/issues/issue-36786-resolve-call.rs -ui/issues/issue-3680.rs -ui/issues/issue-36816.rs -ui/issues/issue-36836.rs -ui/issues/issue-36839.rs -ui/issues/issue-36856.rs -ui/issues/issue-36936.rs -ui/issues/issue-36954.rs -ui/issues/issue-3702-2.rs -ui/issues/issue-3702.rs -ui/issues/issue-37051.rs -ui/issues/issue-37109.rs -ui/issues/issue-37131.rs -ui/issues/issue-37311-type-length-limit/issue-37311.rs -ui/issues/issue-37510.rs -ui/issues/issue-3753.rs -ui/issues/issue-37534.rs -ui/issues/issue-37576.rs -ui/issues/issue-3763.rs -ui/issues/issue-37665.rs -ui/issues/issue-37686.rs -ui/issues/issue-37725.rs -ui/issues/issue-37733.rs -ui/issues/issue-3779.rs -ui/issues/issue-37884.rs -ui/issues/issue-38160.rs -ui/issues/issue-38190.rs -ui/issues/issue-38226.rs -ui/issues/issue-38381.rs -ui/issues/issue-38412.rs -ui/issues/issue-38437.rs -ui/issues/issue-38458.rs -ui/issues/issue-3847.rs -ui/issues/issue-38556.rs -ui/issues/issue-38727.rs -ui/issues/issue-3874.rs -ui/issues/issue-38763.rs -ui/issues/issue-38857.rs -ui/issues/issue-38875/auxiliary/issue-38875-b.rs -ui/issues/issue-38875/issue-38875.rs -ui/issues/issue-3888-2.rs -ui/issues/issue-38919.rs -ui/issues/issue-38942.rs -ui/issues/issue-3895.rs -ui/issues/issue-38954.rs -ui/issues/issue-38987.rs -ui/issues/issue-39089.rs -ui/issues/issue-39211.rs -ui/issues/issue-39367.rs -ui/issues/issue-39548.rs -ui/issues/issue-39687.rs -ui/issues/issue-39709.rs -ui/issues/issue-3979-2.rs -ui/issues/issue-3979-xcrate.rs -ui/issues/issue-3979.rs -ui/issues/issue-39808.rs -ui/issues/issue-39827.rs -ui/issues/issue-39848.rs -ui/issues/issue-3991.rs -ui/issues/issue-3993.rs -ui/issues/issue-39970.rs -ui/issues/issue-39984.rs -ui/issues/issue-40000.rs -ui/issues/issue-4025.rs -ui/issues/issue-40288-2.rs -ui/issues/issue-40288.rs -ui/issues/issue-40951.rs -ui/issues/issue-41053.rs -ui/issues/issue-41229-ref-str.rs -ui/issues/issue-41298.rs -ui/issues/issue-41479.rs -ui/issues/issue-41498.rs -ui/issues/issue-41549.rs -ui/issues/issue-41604.rs -ui/issues/issue-41652/auxiliary/issue-41652-b.rs -ui/issues/issue-41652/issue-41652.rs -ui/issues/issue-41677.rs -ui/issues/issue-41696.rs -ui/issues/issue-41726.rs -ui/issues/issue-41742.rs -ui/issues/issue-41744.rs -ui/issues/issue-41849-variance-req.rs -ui/issues/issue-41880.rs -ui/issues/issue-41888.rs -ui/issues/issue-41936-variance-coerce-unsized-cycle.rs -ui/issues/issue-41974.rs -ui/issues/issue-41998.rs -ui/issues/issue-42007.rs -ui/issues/issue-4208.rs -ui/issues/issue-42106.rs -ui/issues/issue-42148.rs -ui/issues/issue-42210.rs -ui/issues/issue-4228.rs -ui/issues/issue-42312.rs -ui/issues/issue-42453.rs -ui/issues/issue-42467.rs -ui/issues/issue-4252.rs -ui/issues/issue-42552.rs -ui/issues/issue-4265.rs -ui/issues/issue-42755.rs -ui/issues/issue-42796.rs -ui/issues/issue-42880.rs -ui/issues/issue-42956.rs -ui/issues/issue-43057.rs -ui/issues/issue-43205.rs -ui/issues/issue-43250.rs -ui/issues/issue-43291.rs -ui/issues/issue-4333.rs -ui/issues/issue-4335.rs -ui/issues/issue-43355.rs -ui/issues/issue-43357.rs -ui/issues/issue-43420-no-over-suggest.rs -ui/issues/issue-43424.rs -ui/issues/issue-43431.rs -ui/issues/issue-43483.rs -ui/issues/issue-43692.rs -ui/issues/issue-43806.rs -ui/issues/issue-43853.rs -ui/issues/issue-4387.rs -ui/issues/issue-43910.rs -ui/issues/issue-43923.rs -ui/issues/issue-43988.rs -ui/issues/issue-44023.rs -ui/issues/issue-44056.rs -ui/issues/issue-44078.rs -ui/issues/issue-44216-add-instant.rs -ui/issues/issue-44216-add-system-time.rs -ui/issues/issue-44216-sub-instant.rs -ui/issues/issue-44216-sub-system-time.rs -ui/issues/issue-44239.rs -ui/issues/issue-44247.rs -ui/issues/issue-44405.rs -ui/issues/issue-4464.rs -ui/issues/issue-44730.rs -ui/issues/issue-44851.rs -ui/issues/issue-4517.rs -ui/issues/issue-4541.rs -ui/issues/issue-4542.rs -ui/issues/issue-45425.rs -ui/issues/issue-4545.rs -ui/issues/issue-45510.rs -ui/issues/issue-45562.rs -ui/issues/issue-45697-1.rs -ui/issues/issue-45697.rs -ui/issues/issue-45730.rs -ui/issues/issue-45731.rs -ui/issues/issue-45801.rs -ui/issues/issue-45965.rs -ui/issues/issue-46069.rs -ui/issues/issue-46101.rs -ui/issues/issue-46302.rs -ui/issues/issue-46311.rs -ui/issues/issue-46332.rs -ui/issues/issue-46471-1.rs -ui/issues/issue-46472.rs -ui/issues/issue-46604.rs -ui/issues/issue-46756-consider-borrowing-cast-or-binexpr.rs -ui/issues/issue-46771.rs -ui/issues/issue-46855.rs -ui/issues/issue-46964.rs -ui/issues/issue-46983.rs -ui/issues/issue-47073-zero-padded-tuple-struct-indices.rs -ui/issues/issue-47094.rs -ui/issues/issue-47184.rs -ui/issues/issue-47309.rs -ui/issues/issue-4734.rs -ui/issues/issue-4735.rs -ui/issues/issue-4736.rs -ui/issues/issue-47364.rs -ui/issues/issue-47377.rs -ui/issues/issue-47380.rs -ui/issues/issue-47486.rs -ui/issues/issue-4759-1.rs -ui/issues/issue-4759.rs -ui/issues/issue-47638.rs -ui/issues/issue-47673.rs -ui/issues/issue-47703-1.rs -ui/issues/issue-47703-tuple.rs -ui/issues/issue-47703.rs -ui/issues/issue-47715.rs -ui/issues/issue-47722.rs -ui/issues/issue-48006.rs -ui/issues/issue-48131.rs -ui/issues/issue-48132.rs -ui/issues/issue-48159.rs -ui/issues/issue-48276.rs -ui/issues/issue-4830.rs -ui/issues/issue-48364.rs -ui/issues/issue-48728.rs -ui/issues/issue-4875.rs -ui/issues/issue-48984.rs -ui/issues/issue-49298.rs -ui/issues/issue-4935.rs -ui/issues/issue-49544.rs -ui/issues/issue-49632.rs -ui/issues/issue-4968.rs -ui/issues/issue-4972.rs -ui/issues/issue-49824.rs -ui/issues/issue-49854.rs -ui/issues/issue-49919.rs -ui/issues/issue-49934-errors.rs -ui/issues/issue-49934.rs -ui/issues/issue-49955.rs -ui/issues/issue-49973.rs -ui/issues/issue-50187.rs -ui/issues/issue-50411.rs -ui/issues/issue-50415.rs -ui/issues/issue-50442.rs -ui/issues/issue-50471.rs -ui/issues/issue-50518.rs -ui/issues/issue-50581.rs -ui/issues/issue-50582.rs -ui/issues/issue-50585.rs -ui/issues/issue-50600.rs -ui/issues/issue-50618.rs -ui/issues/issue-5062.rs -ui/issues/issue-5067.rs -ui/issues/issue-50688.rs -ui/issues/issue-50714.rs -ui/issues/issue-50761.rs -ui/issues/issue-50781.rs -ui/issues/issue-50802.rs -ui/issues/issue-50811.rs -ui/issues/issue-5100.rs -ui/issues/issue-51022.rs -ui/issues/issue-51044.rs -ui/issues/issue-51102.rs -ui/issues/issue-51116.rs -ui/issues/issue-51154.rs -ui/issues/issue-51515.rs -ui/issues/issue-51632-try-desugar-incompatible-types.rs -ui/issues/issue-51655.rs -ui/issues/issue-51714.rs -ui/issues/issue-51798.rs -ui/issues/issue-51874.rs -ui/issues/issue-51907.rs -ui/issues/issue-5192.rs -ui/issues/issue-51947.rs -ui/issues/issue-52049.rs -ui/issues/issue-52126-assign-op-invariance.rs -ui/issues/issue-52262.rs -ui/issues/issue-52489.rs -ui/issues/issue-52533.rs -ui/issues/issue-52717.rs -ui/issues/issue-5280.rs -ui/issues/issue-5315.rs -ui/issues/issue-5321-immediates-with-bare-self.rs -ui/issues/issue-53251.rs -ui/issues/issue-53275.rs -ui/issues/issue-53300.rs -ui/issues/issue-53333.rs -ui/issues/issue-53348.rs -ui/issues/issue-53419.rs -ui/issues/issue-53568.rs -ui/issues/issue-5358-1.rs -ui/issues/issue-53728.rs -ui/issues/issue-53843.rs -ui/issues/issue-54044.rs -ui/issues/issue-54062.rs -ui/issues/issue-54094.rs -ui/issues/issue-5439.rs -ui/issues/issue-54410.rs -ui/issues/issue-54462-mutable-noalias-correctness.rs -ui/issues/issue-54477-reduced-2.rs -ui/issues/issue-54696.rs -ui/issues/issue-5518.rs -ui/issues/issue-5521.rs -ui/issues/issue-55376.rs -ui/issues/issue-55380.rs -ui/issues/issue-5550.rs -ui/issues/issue-5554.rs -ui/issues/issue-55587.rs -ui/issues/issue-5572.rs -ui/issues/issue-55731.rs -ui/issues/issue-56128.rs -ui/issues/issue-56175.rs -ui/issues/issue-56199.rs -ui/issues/issue-56229.rs -ui/issues/issue-56237.rs -ui/issues/issue-5666.rs -ui/issues/issue-56806.rs -ui/issues/issue-56835.rs -ui/issues/issue-56870.rs -ui/issues/issue-5688.rs -ui/issues/issue-56943.rs -ui/issues/issue-5708.rs -ui/issues/issue-57156.rs -ui/issues/issue-57162.rs -ui/issues/issue-5718.rs -ui/issues/issue-57198-pass.rs -ui/issues/issue-57271.rs -ui/issues/issue-57399-self-return-impl-trait.rs -ui/issues/issue-5741.rs -ui/issues/issue-5754.rs -ui/issues/issue-57741-dereference-boxed-value/issue-57741-1.rs -ui/issues/issue-57741-dereference-boxed-value/issue-57741.rs -ui/issues/issue-57781.rs -ui/issues/issue-57924.rs -ui/issues/issue-58212.rs -ui/issues/issue-58375-monomorphize-default-impls.rs -ui/issues/issue-5844.rs -ui/issues/issue-58463.rs -ui/issues/issue-58712.rs -ui/issues/issue-58734.rs -ui/issues/issue-5883.rs -ui/issues/issue-5884.rs -ui/issues/issue-58857.rs -ui/issues/issue-5900.rs -ui/issues/issue-59020.rs -ui/issues/issue-5917.rs -ui/issues/issue-59326.rs -ui/issues/issue-59488.rs -ui/issues/issue-59494.rs -ui/issues/issue-5950.rs -ui/issues/issue-59756.rs -ui/issues/issue-5988.rs -ui/issues/issue-5997-outer-generic-parameter/issue-5997-enum.rs -ui/issues/issue-5997-outer-generic-parameter/issue-5997-struct.rs -ui/issues/issue-5997-outer-generic-parameter/issue-5997.rs -ui/issues/issue-60218.rs -ui/issues/issue-60622.rs -ui/issues/issue-60989.rs -ui/issues/issue-61106.rs -ui/issues/issue-61108.rs -ui/issues/issue-6117.rs -ui/issues/issue-6130.rs -ui/issues/issue-61475.rs -ui/issues/issue-6153.rs -ui/issues/issue-61623.rs -ui/issues/issue-61894.rs -ui/issues/issue-62480.rs -ui/issues/issue-6318.rs -ui/issues/issue-6344-let.rs -ui/issues/issue-6344-match.rs -ui/issues/issue-63983.rs -ui/issues/issue-64430.rs -ui/issues/issue-64559.rs -ui/issues/issue-64593.rs -ui/issues/issue-64792-bad-unicode-ctor.rs -ui/issues/issue-65131.rs -ui/issues/issue-65230.rs -ui/issues/issue-65462.rs -ui/issues/issue-6557.rs -ui/issues/issue-66308.rs -ui/issues/issue-66353.rs -ui/issues/issue-66667-function-cmp-cycle.rs -ui/issues/issue-66702-break-outside-loop-val.rs -ui/issues/issue-66706.rs -ui/issues/issue-66923-show-error-for-correct-call.rs -ui/issues/issue-67039-unsound-pin-partialeq.rs -ui/issues/issue-6738.rs -ui/issues/issue-67535.rs -ui/issues/issue-67552.rs -ui/issues/issue-68010-large-zst-consts.rs -ui/issues/issue-68696-catch-during-unwind.rs -ui/issues/issue-6892.rs -ui/issues/issue-68951.rs -ui/issues/issue-6898.rs -ui/issues/issue-69130.rs -ui/issues/issue-6919.rs -ui/issues/issue-69306.rs -ui/issues/issue-6936.rs -ui/issues/issue-69455.rs -ui/issues/issue-69602-type-err-during-codegen-ice.rs -ui/issues/issue-69683.rs -ui/issues/issue-7012.rs -ui/issues/issue-70381.rs -ui/issues/issue-7044.rs -ui/issues/issue-7061.rs -ui/issues/issue-70673.rs -ui/issues/issue-70724-add_type_neq_err_label-unwrap.rs -ui/issues/issue-70746.rs -ui/issues/issue-7092.rs -ui/issues/issue-71406.rs -ui/issues/issue-7178.rs -ui/issues/issue-72002.rs -ui/issues/issue-72076.rs -ui/issues/issue-72278.rs -ui/issues/issue-7246.rs -ui/issues/issue-7268.rs -ui/issues/issue-72839-error-overflow.rs -ui/issues/issue-72933-match-stack-overflow.rs -ui/issues/issue-73112.rs -ui/issues/issue-73229.rs -ui/issues/issue-7344.rs -ui/issues/issue-7364.rs -ui/issues/issue-74082.rs -ui/issues/issue-74564-if-expr-stack-overflow.rs -ui/issues/issue-7519-match-unit-in-arg.rs -ui/issues/issue-75283.rs -ui/issues/issue-7563.rs -ui/issues/issue-75704.rs -ui/issues/issue-7575.rs -ui/issues/issue-76042.rs -ui/issues/issue-76077-inaccesible-private-fields/issue-76077-1.rs -ui/issues/issue-76077-inaccesible-private-fields/issue-76077.rs -ui/issues/issue-76191.rs -ui/issues/issue-7660.rs -ui/issues/issue-7663.rs -ui/issues/issue-7673-cast-generically-implemented-trait.rs -ui/issues/issue-77218/issue-77218-2.rs -ui/issues/issue-77218/issue-77218.rs -ui/issues/issue-7784.rs -ui/issues/issue-77919.rs -ui/issues/issue-78192.rs -ui/issues/issue-78622.rs -ui/issues/issue-7867.rs -ui/issues/issue-78957.rs -ui/issues/issue-7899.rs -ui/issues/issue-7911.rs -ui/issues/issue-7970a.rs -ui/issues/issue-8044.rs -ui/issues/issue-80607.rs -ui/issues/issue-81584.rs -ui/issues/issue-8171-default-method-self-inherit-builtin-trait.rs -ui/issues/issue-81918.rs -ui/issues/issue-8248.rs -ui/issues/issue-8249.rs -ui/issues/issue-8259.rs -ui/issues/issue-83048.rs -ui/issues/issue-8391.rs -ui/issues/issue-8398.rs -ui/issues/issue-8401.rs -ui/issues/issue-8498.rs -ui/issues/issue-8506.rs -ui/issues/issue-8521.rs -ui/issues/issue-85461.rs -ui/issues/issue-8578.rs -ui/issues/issue-86756.rs -ui/issues/issue-87199.rs -ui/issues/issue-8727.rs -ui/issues/issue-87490.rs -ui/issues/issue-8761.rs -ui/issues/issue-8767.rs -ui/issues/issue-87707.rs -ui/issues/issue-8783.rs -ui/issues/issue-88150.rs -ui/issues/issue-8860.rs -ui/issues/issue-8898.rs -ui/issues/issue-9047.rs -ui/issues/issue-9110.rs -ui/issues/issue-9123.rs -ui/issues/issue-9129.rs -ui/issues/issue-91489.rs -ui/issues/issue-9155.rs -ui/issues/issue-9188.rs -ui/issues/issue-9243.rs -ui/issues/issue-9249.rs -ui/issues/issue-9259.rs -ui/issues/issue-92741.rs -ui/issues/issue-9446.rs -ui/issues/issue-9725.rs -ui/issues/issue-9737.rs -ui/issues/issue-9814.rs -ui/issues/issue-98299.rs -ui/issues/issue-9837.rs -ui/issues/issue-9906.rs -ui/issues/issue-9918.rs -ui/issues/issue-9942.rs -ui/issues/issue-9951.rs -ui/issues/issue-9968.rs -ui/issues/issue-99838.rs ui/iterators/issue-28098.rs ui/iterators/issue-58952-filter-type-length.rs ui/lang-items/issue-83471.rs diff --git a/src/tools/tidy/src/ui_tests.rs b/src/tools/tidy/src/ui_tests.rs index b9d22ece5975..4d195b3952e2 100644 --- a/src/tools/tidy/src/ui_tests.rs +++ b/src/tools/tidy/src/ui_tests.rs @@ -1,24 +1,12 @@ //! Tidy check to ensure below in UI test directories: -//! - the number of entries in each directory must be less than `ENTRY_LIMIT` //! - there are no stray `.stderr` files -use std::collections::{BTreeSet, HashMap}; +use std::collections::BTreeSet; use std::ffi::OsStr; use std::fs; use std::io::Write; use std::path::{Path, PathBuf}; -use ignore::Walk; - -// FIXME: GitHub's UI truncates file lists that exceed 1000 entries, so these -// should all be 1000 or lower. Limits significantly smaller than 1000 are also -// desirable, because large numbers of files are unwieldy in general. See issue -// #73494. -const ENTRY_LIMIT: u32 = 901; -// FIXME: The following limits should be reduced eventually. - -const ISSUES_ENTRY_LIMIT: u32 = 1616; - const EXPECTED_TEST_FILE_EXTENSIONS: &[&str] = &[ "rs", // test source files "stderr", // expected stderr file, corresponds to a rs file @@ -54,42 +42,6 @@ const EXTENSION_EXCEPTION_PATHS: &[&str] = &[ "tests/ui/std/windows-bat-args3.bat", // tests escaping arguments through batch files ]; -fn check_entries(tests_path: &Path, bad: &mut bool) { - let mut directories: HashMap = HashMap::new(); - - for entry in Walk::new(tests_path.join("ui")).flatten() { - let parent = entry.path().parent().unwrap().to_path_buf(); - *directories.entry(parent).or_default() += 1; - } - - let (mut max, mut max_issues) = (0, 0); - for (dir_path, count) in directories { - let is_issues_dir = tests_path.join("ui/issues") == dir_path; - let (limit, maxcnt) = if is_issues_dir { - (ISSUES_ENTRY_LIMIT, &mut max_issues) - } else { - (ENTRY_LIMIT, &mut max) - }; - *maxcnt = (*maxcnt).max(count); - if count > limit { - tidy_error!( - bad, - "following path contains more than {} entries, \ - you should move the test to some relevant subdirectory (current: {}): {}", - limit, - count, - dir_path.display() - ); - } - } - if ISSUES_ENTRY_LIMIT > max_issues { - tidy_error!( - bad, - "`ISSUES_ENTRY_LIMIT` is too high (is {ISSUES_ENTRY_LIMIT}, should be {max_issues})" - ); - } -} - pub fn check(root_path: &Path, bless: bool, bad: &mut bool) { let issues_txt_header = r#"============================================================ ⚠️⚠️⚠️NOTHING SHOULD EVER BE ADDED TO THIS LIST⚠️⚠️⚠️ @@ -97,7 +49,6 @@ pub fn check(root_path: &Path, bless: bool, bad: &mut bool) { "#; let path = &root_path.join("tests"); - check_entries(path, bad); // the list of files in ui tests that are allowed to start with `issue-XXXX` // BTreeSet because we would like a stable ordering so --bless works @@ -179,7 +130,9 @@ pub fn check(root_path: &Path, bless: bool, bad: &mut bool) { .unwrap() .replace(std::path::MAIN_SEPARATOR_STR, "/"); - if !remaining_issue_names.remove(stripped_path.as_str()) { + if !remaining_issue_names.remove(stripped_path.as_str()) + && !stripped_path.starts_with("ui/issues/") + { tidy_error!( bad, "file `tests/{stripped_path}` must begin with a descriptive name, consider `{{reason}}-issue-{issue_n}.rs`", diff --git a/triagebot.toml b/triagebot.toml index 61d8a814c89e..4aec1251c7e7 100644 --- a/triagebot.toml +++ b/triagebot.toml @@ -1147,6 +1147,12 @@ cc = ["@nnethercote"] message = "Changes to the size of AST and/or HIR nodes." cc = ["@nnethercote"] +[mentions."tests/ui/issues"] +message = """ +This PR modifies `tests/ui/issues/`. If this PR is adding new tests to `tests/ui/issues/`, +please refrain from doing so, and instead add it to more descriptive subdirectories. +""" + [mentions."compiler/rustc_sanitizers"] cc = ["@rcvalle"] From 21768bb380495d5c771cad9b6eb2b877844f5a11 Mon Sep 17 00:00:00 2001 From: Jieyou Xu Date: Mon, 21 Jul 2025 14:02:02 +0800 Subject: [PATCH 073/139] Enforce PR CI jobs are a subset of Auto CI jobs (modulo carve-outs) To prevent possibility of a PR with red PR-only CI passing Auto CI, then all subsequent PR CI runs will be red until that is fixed. Note that this is **not** a "strict" subset relationship: some jobs necessarily have to differ under PR CI and Auto CI environments. For instance: - `x86_64-gnu-tools` will have auto-only env vars like `DEPLOY_TOOLSTATES_JSON: toolstates-linux.json`. - `tidy` will want to `continue_on_error: true` in PR CI to allow for more "useful" compilation errors to also be reported, whereas it needs to `continue_on_error: false` in Auto CI to prevent wasting Auto CI resources. The carve-outs are: 1. `env` variables. 2. `continue_on_error`. --- src/ci/citool/src/jobs.rs | 116 ++++++++++++++++- src/ci/citool/src/jobs/tests.rs | 220 ++++++++++++++++++++++++++++++++ src/ci/citool/tests/jobs.rs | 2 +- 3 files changed, 333 insertions(+), 5 deletions(-) diff --git a/src/ci/citool/src/jobs.rs b/src/ci/citool/src/jobs.rs index 410274227e4b..47516cbc1f4c 100644 --- a/src/ci/citool/src/jobs.rs +++ b/src/ci/citool/src/jobs.rs @@ -1,9 +1,9 @@ #[cfg(test)] mod tests; -use std::collections::BTreeMap; +use std::collections::{BTreeMap, HashSet}; -use anyhow::Context as _; +use anyhow::{Context as _, anyhow}; use serde_yaml::Value; use crate::GitHubContext; @@ -85,6 +85,10 @@ impl JobDatabase { .cloned() .collect() } + + fn find_auto_job_by_name(&self, job_name: &str) -> Option<&Job> { + self.auto_jobs.iter().find(|job| job.name == job_name) + } } pub fn load_job_db(db: &str) -> anyhow::Result { @@ -97,14 +101,118 @@ pub fn load_job_db(db: &str) -> anyhow::Result { db.apply_merge().context("failed to apply merge keys") }; - // Apply merge twice to handle nested merges + // Apply merge twice to handle nested merges up to depth 2. apply_merge(&mut db)?; apply_merge(&mut db)?; - let db: JobDatabase = serde_yaml::from_value(db).context("failed to parse job database")?; + let mut db: JobDatabase = serde_yaml::from_value(db).context("failed to parse job database")?; + + register_pr_jobs_as_auto_jobs(&mut db)?; + + validate_job_database(&db)?; + Ok(db) } +/// Maintain invariant that PR CI jobs must be a subset of Auto CI jobs modulo carve-outs. +/// +/// When PR jobs are auto-registered as Auto jobs, they will have `continue_on_error` overridden to +/// be `false` to avoid wasting Auto CI resources. +/// +/// When a job is already both a PR job and a auto job, we will post-validate their "equivalence +/// modulo certain carve-outs" in [`validate_job_database`]. +/// +/// This invariant is important to make sure that it's not easily possible (without modifying +/// `citool`) to have PRs with red PR-only CI jobs merged into `master`, causing all subsequent PR +/// CI runs to be red until the cause is fixed. +fn register_pr_jobs_as_auto_jobs(db: &mut JobDatabase) -> anyhow::Result<()> { + for pr_job in &db.pr_jobs { + // It's acceptable to "override" a PR job in Auto job, for instance, `x86_64-gnu-tools` will + // receive an additional `DEPLOY_TOOLSTATES_JSON: toolstates-linux.json` env when under Auto + // environment versus PR environment. + if db.find_auto_job_by_name(&pr_job.name).is_some() { + continue; + } + + let auto_registered_job = Job { continue_on_error: Some(false), ..pr_job.clone() }; + db.auto_jobs.push(auto_registered_job); + } + + Ok(()) +} + +fn validate_job_database(db: &JobDatabase) -> anyhow::Result<()> { + fn ensure_no_duplicate_job_names(section: &str, jobs: &Vec) -> anyhow::Result<()> { + let mut job_names = HashSet::new(); + for job in jobs { + let job_name = job.name.as_str(); + if !job_names.insert(job_name) { + return Err(anyhow::anyhow!( + "duplicate job name `{job_name}` in section `{section}`" + )); + } + } + Ok(()) + } + + ensure_no_duplicate_job_names("pr", &db.pr_jobs)?; + ensure_no_duplicate_job_names("auto", &db.auto_jobs)?; + ensure_no_duplicate_job_names("try", &db.try_jobs)?; + ensure_no_duplicate_job_names("optional", &db.optional_jobs)?; + + fn equivalent_modulo_carve_out(pr_job: &Job, auto_job: &Job) -> anyhow::Result<()> { + let Job { + name, + os, + only_on_channel, + free_disk, + doc_url, + codebuild, + + // Carve-out configs allowed to be different. + env: _, + continue_on_error: _, + } = pr_job; + + if *name == auto_job.name + && *os == auto_job.os + && *only_on_channel == auto_job.only_on_channel + && *free_disk == auto_job.free_disk + && *doc_url == auto_job.doc_url + && *codebuild == auto_job.codebuild + { + Ok(()) + } else { + Err(anyhow!( + "PR job `{}` differs from corresponding Auto job `{}` in configuration other than `continue_on_error` and `env`", + pr_job.name, + auto_job.name + )) + } + } + + for pr_job in &db.pr_jobs { + // At this point, any PR job must also be an Auto job, auto-registered or overridden. + let auto_job = db + .find_auto_job_by_name(&pr_job.name) + .expect("PR job must either be auto-registered as Auto job or overridden"); + + equivalent_modulo_carve_out(pr_job, auto_job)?; + } + + // Auto CI jobs must all "fail-fast" to avoid wasting Auto CI resources. For instance, `tidy`. + for auto_job in &db.auto_jobs { + if auto_job.continue_on_error == Some(true) { + return Err(anyhow!( + "Auto job `{}` cannot have `continue_on_error: true`", + auto_job.name + )); + } + } + + Ok(()) +} + /// Representation of a job outputted to a GitHub Actions workflow. #[derive(serde::Serialize, Debug)] struct GithubActionsJob { diff --git a/src/ci/citool/src/jobs/tests.rs b/src/ci/citool/src/jobs/tests.rs index 63ac508b632e..f1f6274e1ed7 100644 --- a/src/ci/citool/src/jobs/tests.rs +++ b/src/ci/citool/src/jobs/tests.rs @@ -1,3 +1,4 @@ +use std::collections::BTreeMap; use std::path::Path; use super::Job; @@ -146,3 +147,222 @@ fn validate_jobs() { panic!("Job validation failed:\n{error_messages}"); } } + +#[test] +fn pr_job_implies_auto_job() { + let db = load_job_db( + r#" +envs: + pr: + try: + auto: + optional: + +pr: + - name: pr-ci-a + os: ubuntu + env: {} +try: +auto: +optional: +"#, + ) + .unwrap(); + + assert_eq!(db.auto_jobs.iter().map(|j| j.name.as_str()).collect::>(), vec!["pr-ci-a"]) +} + +#[test] +fn implied_auto_job_keeps_env_and_fails_fast() { + let db = load_job_db( + r#" +envs: + pr: + try: + auto: + optional: + +pr: + - name: tidy + env: + DEPLOY_TOOLSTATES_JSON: toolstates-linux.json + continue_on_error: true + os: ubuntu +try: +auto: +optional: +"#, + ) + .unwrap(); + + assert_eq!(db.auto_jobs.iter().map(|j| j.name.as_str()).collect::>(), vec!["tidy"]); + assert_eq!(db.auto_jobs[0].continue_on_error, Some(false)); + assert_eq!( + db.auto_jobs[0].env, + BTreeMap::from([( + "DEPLOY_TOOLSTATES_JSON".to_string(), + serde_yaml::Value::String("toolstates-linux.json".to_string()) + )]) + ); +} + +#[test] +#[should_panic = "duplicate"] +fn duplicate_job_name() { + let _ = load_job_db( + r#" +envs: + pr: + try: + auto: + + +pr: + - name: pr-ci-a + os: ubuntu + env: {} + - name: pr-ci-a + os: ubuntu + env: {} +try: +auto: +optional: +"#, + ) + .unwrap(); +} + +#[test] +fn auto_job_can_override_pr_job_spec() { + let db = load_job_db( + r#" +envs: + pr: + try: + auto: + optional: + +pr: + - name: tidy + os: ubuntu + env: {} +try: +auto: + - name: tidy + env: + DEPLOY_TOOLSTATES_JSON: toolstates-linux.json + continue_on_error: false + os: ubuntu +optional: +"#, + ) + .unwrap(); + + assert_eq!(db.auto_jobs.iter().map(|j| j.name.as_str()).collect::>(), vec!["tidy"]); + assert_eq!(db.auto_jobs[0].continue_on_error, Some(false)); + assert_eq!( + db.auto_jobs[0].env, + BTreeMap::from([( + "DEPLOY_TOOLSTATES_JSON".to_string(), + serde_yaml::Value::String("toolstates-linux.json".to_string()) + )]) + ); +} + +#[test] +fn compatible_divergence_pr_auto_job() { + let db = load_job_db( + r#" +envs: + pr: + try: + auto: + optional: + +pr: + - name: tidy + continue_on_error: true + env: + ENV_ALLOWED_TO_DIFFER: "hello world" + os: ubuntu +try: +auto: + - name: tidy + continue_on_error: false + env: + ENV_ALLOWED_TO_DIFFER: "goodbye world" + os: ubuntu +optional: +"#, + ) + .unwrap(); + + // `continue_on_error` and `env` are carve-outs *allowed* to diverge between PR and Auto job of + // the same name. Should load successfully. + + assert_eq!(db.auto_jobs.iter().map(|j| j.name.as_str()).collect::>(), vec!["tidy"]); + assert_eq!(db.auto_jobs[0].continue_on_error, Some(false)); + assert_eq!( + db.auto_jobs[0].env, + BTreeMap::from([( + "ENV_ALLOWED_TO_DIFFER".to_string(), + serde_yaml::Value::String("goodbye world".to_string()) + )]) + ); +} + +#[test] +#[should_panic = "differs"] +fn incompatible_divergence_pr_auto_job() { + // `os` is not one of the carve-out options allowed to diverge. This should fail. + let _ = load_job_db( + r#" +envs: + pr: + try: + auto: + optional: + +pr: + - name: tidy + continue_on_error: true + env: + ENV_ALLOWED_TO_DIFFER: "hello world" + os: ubuntu +try: +auto: + - name: tidy + continue_on_error: false + env: + ENV_ALLOWED_TO_DIFFER: "goodbye world" + os: windows +optional: +"#, + ) + .unwrap(); +} + +#[test] +#[should_panic = "cannot have `continue_on_error: true`"] +fn auto_job_continue_on_error() { + // Auto CI jobs must fail-fast. + let _ = load_job_db( + r#" +envs: + pr: + try: + auto: + optional: + +pr: +try: +auto: + - name: tidy + continue_on_error: true + os: windows + env: {} +optional: +"#, + ) + .unwrap(); +} diff --git a/src/ci/citool/tests/jobs.rs b/src/ci/citool/tests/jobs.rs index dbaf13d4f428..24e0b85cab22 100644 --- a/src/ci/citool/tests/jobs.rs +++ b/src/ci/citool/tests/jobs.rs @@ -6,7 +6,7 @@ const TEST_JOBS_YML_PATH: &str = concat!(env!("CARGO_MANIFEST_DIR"), "/tests/tes fn auto_jobs() { let stdout = get_matrix("push", "commit", "refs/heads/auto"); insta::assert_snapshot!(stdout, @r#" - jobs=[{"name":"aarch64-gnu","full_name":"auto - aarch64-gnu","os":"ubuntu-22.04-arm","env":{"ARTIFACTS_AWS_ACCESS_KEY_ID":"AKIA46X5W6CZN24CBO55","AWS_REGION":"us-west-1","CACHES_AWS_ACCESS_KEY_ID":"AKIA46X5W6CZI5DHEBFL","DEPLOY_BUCKET":"rust-lang-ci2","TOOLSTATE_PUBLISH":1},"free_disk":true},{"name":"x86_64-gnu-llvm-18-1","full_name":"auto - x86_64-gnu-llvm-18-1","os":"ubuntu-24.04","env":{"ARTIFACTS_AWS_ACCESS_KEY_ID":"AKIA46X5W6CZN24CBO55","AWS_REGION":"us-west-1","CACHES_AWS_ACCESS_KEY_ID":"AKIA46X5W6CZI5DHEBFL","DEPLOY_BUCKET":"rust-lang-ci2","DOCKER_SCRIPT":"stage_2_test_set1.sh","IMAGE":"x86_64-gnu-llvm-18","READ_ONLY_SRC":"0","RUST_BACKTRACE":1,"TOOLSTATE_PUBLISH":1},"free_disk":true},{"name":"aarch64-apple","full_name":"auto - aarch64-apple","os":"macos-14","env":{"ARTIFACTS_AWS_ACCESS_KEY_ID":"AKIA46X5W6CZN24CBO55","AWS_REGION":"us-west-1","CACHES_AWS_ACCESS_KEY_ID":"AKIA46X5W6CZI5DHEBFL","DEPLOY_BUCKET":"rust-lang-ci2","MACOSX_DEPLOYMENT_TARGET":11.0,"MACOSX_STD_DEPLOYMENT_TARGET":11.0,"NO_DEBUG_ASSERTIONS":1,"NO_LLVM_ASSERTIONS":1,"NO_OVERFLOW_CHECKS":1,"RUSTC_RETRY_LINKER_ON_SEGFAULT":1,"RUST_CONFIGURE_ARGS":"--enable-sanitizers --enable-profiler --set rust.jemalloc","SCRIPT":"./x.py --stage 2 test --host=aarch64-apple-darwin --target=aarch64-apple-darwin","SELECT_XCODE":"/Applications/Xcode_15.4.app","TOOLSTATE_PUBLISH":1,"USE_XCODE_CLANG":1}},{"name":"dist-i686-msvc","full_name":"auto - dist-i686-msvc","os":"windows-2022","env":{"ARTIFACTS_AWS_ACCESS_KEY_ID":"AKIA46X5W6CZN24CBO55","AWS_REGION":"us-west-1","CACHES_AWS_ACCESS_KEY_ID":"AKIA46X5W6CZI5DHEBFL","CODEGEN_BACKENDS":"llvm,cranelift","DEPLOY_BUCKET":"rust-lang-ci2","DIST_REQUIRE_ALL_TOOLS":1,"RUST_CONFIGURE_ARGS":"--build=i686-pc-windows-msvc --host=i686-pc-windows-msvc --target=i686-pc-windows-msvc,i586-pc-windows-msvc --enable-full-tools --enable-profiler","SCRIPT":"python x.py dist bootstrap --include-default-paths","TOOLSTATE_PUBLISH":1}}] + jobs=[{"name":"aarch64-gnu","full_name":"auto - aarch64-gnu","os":"ubuntu-22.04-arm","env":{"ARTIFACTS_AWS_ACCESS_KEY_ID":"AKIA46X5W6CZN24CBO55","AWS_REGION":"us-west-1","CACHES_AWS_ACCESS_KEY_ID":"AKIA46X5W6CZI5DHEBFL","DEPLOY_BUCKET":"rust-lang-ci2","TOOLSTATE_PUBLISH":1},"free_disk":true},{"name":"x86_64-gnu-llvm-18-1","full_name":"auto - x86_64-gnu-llvm-18-1","os":"ubuntu-24.04","env":{"ARTIFACTS_AWS_ACCESS_KEY_ID":"AKIA46X5W6CZN24CBO55","AWS_REGION":"us-west-1","CACHES_AWS_ACCESS_KEY_ID":"AKIA46X5W6CZI5DHEBFL","DEPLOY_BUCKET":"rust-lang-ci2","DOCKER_SCRIPT":"stage_2_test_set1.sh","IMAGE":"x86_64-gnu-llvm-18","READ_ONLY_SRC":"0","RUST_BACKTRACE":1,"TOOLSTATE_PUBLISH":1},"free_disk":true},{"name":"aarch64-apple","full_name":"auto - aarch64-apple","os":"macos-14","env":{"ARTIFACTS_AWS_ACCESS_KEY_ID":"AKIA46X5W6CZN24CBO55","AWS_REGION":"us-west-1","CACHES_AWS_ACCESS_KEY_ID":"AKIA46X5W6CZI5DHEBFL","DEPLOY_BUCKET":"rust-lang-ci2","MACOSX_DEPLOYMENT_TARGET":11.0,"MACOSX_STD_DEPLOYMENT_TARGET":11.0,"NO_DEBUG_ASSERTIONS":1,"NO_LLVM_ASSERTIONS":1,"NO_OVERFLOW_CHECKS":1,"RUSTC_RETRY_LINKER_ON_SEGFAULT":1,"RUST_CONFIGURE_ARGS":"--enable-sanitizers --enable-profiler --set rust.jemalloc","SCRIPT":"./x.py --stage 2 test --host=aarch64-apple-darwin --target=aarch64-apple-darwin","SELECT_XCODE":"/Applications/Xcode_15.4.app","TOOLSTATE_PUBLISH":1,"USE_XCODE_CLANG":1}},{"name":"dist-i686-msvc","full_name":"auto - dist-i686-msvc","os":"windows-2022","env":{"ARTIFACTS_AWS_ACCESS_KEY_ID":"AKIA46X5W6CZN24CBO55","AWS_REGION":"us-west-1","CACHES_AWS_ACCESS_KEY_ID":"AKIA46X5W6CZI5DHEBFL","CODEGEN_BACKENDS":"llvm,cranelift","DEPLOY_BUCKET":"rust-lang-ci2","DIST_REQUIRE_ALL_TOOLS":1,"RUST_CONFIGURE_ARGS":"--build=i686-pc-windows-msvc --host=i686-pc-windows-msvc --target=i686-pc-windows-msvc,i586-pc-windows-msvc --enable-full-tools --enable-profiler","SCRIPT":"python x.py dist bootstrap --include-default-paths","TOOLSTATE_PUBLISH":1}},{"name":"pr-check-1","full_name":"auto - pr-check-1","os":"ubuntu-24.04","env":{"ARTIFACTS_AWS_ACCESS_KEY_ID":"AKIA46X5W6CZN24CBO55","AWS_REGION":"us-west-1","CACHES_AWS_ACCESS_KEY_ID":"AKIA46X5W6CZI5DHEBFL","DEPLOY_BUCKET":"rust-lang-ci2","TOOLSTATE_PUBLISH":1},"continue_on_error":false,"free_disk":true},{"name":"pr-check-2","full_name":"auto - pr-check-2","os":"ubuntu-24.04","env":{"ARTIFACTS_AWS_ACCESS_KEY_ID":"AKIA46X5W6CZN24CBO55","AWS_REGION":"us-west-1","CACHES_AWS_ACCESS_KEY_ID":"AKIA46X5W6CZI5DHEBFL","DEPLOY_BUCKET":"rust-lang-ci2","TOOLSTATE_PUBLISH":1},"continue_on_error":false,"free_disk":true},{"name":"tidy","full_name":"auto - tidy","os":"ubuntu-24.04","env":{"ARTIFACTS_AWS_ACCESS_KEY_ID":"AKIA46X5W6CZN24CBO55","AWS_REGION":"us-west-1","CACHES_AWS_ACCESS_KEY_ID":"AKIA46X5W6CZI5DHEBFL","DEPLOY_BUCKET":"rust-lang-ci2","TOOLSTATE_PUBLISH":1},"continue_on_error":false,"free_disk":true,"doc_url":"https://foo.bar"}] run_type=auto "#); } From fc4bf03a81592b112abfd7274606af1c6919c3f6 Mon Sep 17 00:00:00 2001 From: Jieyou Xu Date: Mon, 21 Jul 2025 14:43:17 +0800 Subject: [PATCH 074/139] Remove spellcheck workflow Unfortunately, the separate spellcheck GHA workflow does not really work with homu, if we would like to enforce the invariant that PR CI is a subset of Full CI (modulo carve outs). This is not prejudice against a reland of a `typos`-based spellcheck, it just probably has to go through the "usual" CI flow with bootstrap, so that it can work with homu. --- .github/workflows/spellcheck.yml | 23 ----------------------- 1 file changed, 23 deletions(-) delete mode 100644 .github/workflows/spellcheck.yml diff --git a/.github/workflows/spellcheck.yml b/.github/workflows/spellcheck.yml deleted file mode 100644 index 7e21bb1b7ffb..000000000000 --- a/.github/workflows/spellcheck.yml +++ /dev/null @@ -1,23 +0,0 @@ -# This workflow runs spellcheck job - -name: Spellcheck -on: - pull_request: - branches: - - "**" - -jobs: - spellcheck: - name: run spellchecker - runs-on: ubuntu-latest - steps: - - name: Checkout the source code - uses: actions/checkout@v4 - - - name: check typos - # sync version with src/tools/tidy/src/ext_tool_checks.rs in spellcheck_runner - uses: crate-ci/typos@v1.34.0 - with: - # sync target files with src/tools/tidy/src/ext_tool_checks.rs in check_impl - files: ./compiler ./library ./src/bootstrap ./src/librustdoc - config: ./typos.toml From 523594d7aec3293c6f1926e4f1edcec141ef496b Mon Sep 17 00:00:00 2001 From: Jieyou Xu Date: Mon, 21 Jul 2025 15:20:35 +0800 Subject: [PATCH 075/139] Update `jobs.yml` docs to reflect subset-modulo-carve-outs relationship --- src/ci/github-actions/jobs.yml | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/src/ci/github-actions/jobs.yml b/src/ci/github-actions/jobs.yml index 0a6ebe44b3d7..011688487b44 100644 --- a/src/ci/github-actions/jobs.yml +++ b/src/ci/github-actions/jobs.yml @@ -124,9 +124,16 @@ jobs: <<: *job-linux-36c-codebuild -# Jobs that run on each push to a pull request (PR) -# These jobs automatically inherit envs.pr, to avoid repeating -# it in each job definition. +# Jobs that run on each push to a pull request (PR). +# +# These jobs automatically inherit envs.pr, to avoid repeating it in each job +# definition. +# +# PR CI jobs will be automatically registered as Auto CI jobs or overriden. When +# automatically registered, the PR CI job configuration will be copied as an +# Auto CI job but with `continue_on_error` overriden to `false` (to fail-fast). +# When overriden, `citool` will check for equivalence between the PR and CI job +# of the same name modulo `continue_on_error` and `env`. pr: - name: pr-check-1 <<: *job-linux-4c @@ -177,9 +184,15 @@ optional: IMAGE: pr-check-1 <<: *job-linux-4c -# Main CI jobs that have to be green to merge a commit into master -# These jobs automatically inherit envs.auto, to avoid repeating -# it in each job definition. +# Main CI jobs that have to be green to merge a commit into master. +# +# These jobs automatically inherit envs.auto, to avoid repeating it in each job +# definition. +# +# Auto jobs may not specify `continue_on_error: true`, and thus will fail-fast. +# +# Unless explicitly overriden, PR CI jobs will be automatically registered as +# Auto CI jobs. auto: ############################# # Linux/Docker builders # From 58537fb869a8e08d5146e8feab982f17b3fd990a Mon Sep 17 00:00:00 2001 From: roblabla Date: Mon, 21 Jul 2025 01:32:26 +0200 Subject: [PATCH 076/139] Fix broken TLS destructors on 32-bit win7 On the 32-bit win7 target, we use OS TLS instead of native TLS, due to issues with how the OS handles alignment. Unfortunately, this caused issues due to the TLS destructors not running, causing memory leaks among other problems. On Windows, to support OS TLS, the TlsAlloc family of function is used by Rust. This function does not support TLS destructors at all. However, rust has some code to emulate those destructors, by leveraging the TLS support functionality found in the MSVC CRT (specifically, in tlssup.c of the CRT). Specifically, the CRT provides the ability to register callbacks that are called (among other things) on thread destruction. By registering our own callback, we can run through a list of registered destructors functions to execute. To use this functionality, the user must do two things: 1. They must put the address to their callback in a section between `.CRT$XLB` and `.CRT$XLY`. 2. They must add a reference to `_tls_used` (or `__tls_used` on x86) to make sure the TLS support code in tlssup.c isn't garbage collected by the linker. Prior to this commit, this second bit wasn't being done properly by the Rust TLS support code. Instead of adding a reference to _tls_used, it instead had a reference to its own callback to prevent it from getting GC'd by the linker. While this is _also_ necessary, not having a reference on _tls_used made the entire support non-functional. This commit reworks the code to: 1. Add an unconditional `#[used]` attribute on the CALLBACK, which should be enough to prevent it from getting GC'd by the linker. 2. Add a reference to `_tls_used`, which should pull the TLS support code into the Rust programs and not let it be GC'd by the linker. --- .../std/src/sys/thread_local/guard/windows.rs | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/library/std/src/sys/thread_local/guard/windows.rs b/library/std/src/sys/thread_local/guard/windows.rs index b15a0d7c0bdf..f747129465d6 100644 --- a/library/std/src/sys/thread_local/guard/windows.rs +++ b/library/std/src/sys/thread_local/guard/windows.rs @@ -58,7 +58,7 @@ //! We don't actually use the `/INCLUDE` linker flag here like the article //! mentions because the Rust compiler doesn't propagate linker flags, but //! instead we use a shim function which performs a volatile 1-byte load from -//! the address of the symbol to ensure it sticks around. +//! the address of the _tls_used symbol to ensure it sticks around. //! //! [1]: https://www.codeproject.com/Articles/8113/Thread-Local-Storage-The-C-Way //! [2]: https://github.com/ChromiumWebApps/chromium/blob/master/base/threading/thread_local_storage_win.cc#L42 @@ -68,9 +68,20 @@ use core::ffi::c_void; use crate::ptr; use crate::sys::c; +unsafe extern "C" { + #[link_name = "_tls_used"] + static TLS_USED: u8; +} pub fn enable() { - // When destructors are used, we don't want LLVM eliminating CALLBACK for any - // reason. Once the symbol makes it to the linker, it will do the rest. + // When destructors are used, we need to add a reference to the _tls_used + // symbol provided by the CRT, otherwise the TLS support code will get + // GC'd by the linker and our callback won't be called. + unsafe { ptr::from_ref(&TLS_USED).read_volatile() }; + // We also need to reference CALLBACK to make sure it does not get GC'd + // by the compiler/LLVM. The callback will end up inside the TLS + // callback array pointed to by _TLS_USED through linker shenanigans, + // but as far as the compiler is concerned, it looks like the data is + // unused, so we need this hack to prevent it from disappearing. unsafe { ptr::from_ref(&CALLBACK).read_volatile() }; } From fa924641d67a510a1101b79bbc2cea4f5360135e Mon Sep 17 00:00:00 2001 From: Maksim Bondarenkov Date: Mon, 21 Jul 2025 15:58:38 +0300 Subject: [PATCH 077/139] opt-dist: add an option for setting path to stage0 root in MSYS2 we have problems with stage0 for *-gnullvm hosts because prebuilt dist tarballs will be available starting from 1.90.0-beta. also this change helps to match bootstrap.toml config --- src/tools/opt-dist/src/environment.rs | 16 ++++++++-------- src/tools/opt-dist/src/main.rs | 6 ++++++ 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/tools/opt-dist/src/environment.rs b/src/tools/opt-dist/src/environment.rs index e6e4c711c0cb..2cae0785f33b 100644 --- a/src/tools/opt-dist/src/environment.rs +++ b/src/tools/opt-dist/src/environment.rs @@ -28,6 +28,8 @@ pub struct Environment { run_tests: bool, fast_try_build: bool, build_llvm: bool, + #[builder(default)] + stage0_root: Option, } impl Environment { @@ -56,17 +58,11 @@ impl Environment { } pub fn cargo_stage_0(&self) -> Utf8PathBuf { - self.build_artifacts() - .join("stage0") - .join("bin") - .join(format!("cargo{}", executable_extension())) + self.stage0().join("bin").join(format!("cargo{}", executable_extension())) } pub fn rustc_stage_0(&self) -> Utf8PathBuf { - self.build_artifacts() - .join("stage0") - .join("bin") - .join(format!("rustc{}", executable_extension())) + self.stage0().join("bin").join(format!("rustc{}", executable_extension())) } pub fn rustc_stage_2(&self) -> Utf8PathBuf { @@ -116,6 +112,10 @@ impl Environment { pub fn build_llvm(&self) -> bool { self.build_llvm } + + pub fn stage0(&self) -> Utf8PathBuf { + self.stage0_root.clone().unwrap_or_else(|| self.build_artifacts().join("stage0")) + } } /// What is the extension of binary executables on this platform? diff --git a/src/tools/opt-dist/src/main.rs b/src/tools/opt-dist/src/main.rs index d0e6badede6e..f46a86f507cc 100644 --- a/src/tools/opt-dist/src/main.rs +++ b/src/tools/opt-dist/src/main.rs @@ -107,6 +107,10 @@ enum EnvironmentCmd { /// in bootstrap.toml via `build.build-dir` option #[arg(long, default_value = "build")] build_dir: Utf8PathBuf, + + /// Path to custom stage0 root + #[arg(long)] + stage0_root: Option, }, /// Perform an optimized build on Linux CI, from inside Docker. LinuxCi { @@ -144,6 +148,7 @@ fn create_environment(args: Args) -> anyhow::Result<(Environment, Vec)> run_tests, build_llvm, build_dir, + stage0_root, } => { let env = EnvironmentBuilder::default() .host_tuple(target_triple) @@ -160,6 +165,7 @@ fn create_environment(args: Args) -> anyhow::Result<(Environment, Vec)> .run_tests(run_tests) .fast_try_build(is_fast_try_build) .build_llvm(build_llvm) + .stage0_root(stage0_root) .build()?; (env, shared.build_args) From b2f8b406335310f885a0d2d21ff8472b6a5f9ce5 Mon Sep 17 00:00:00 2001 From: Oli Scherer Date: Mon, 21 Jul 2025 13:16:10 +0000 Subject: [PATCH 078/139] Don't ICE on non-TypeId metadata within TypeId --- .../rustc_const_eval/src/interpret/memory.rs | 2 +- tests/ui/consts/const_transmute_type_id6.rs | 16 ++++++++++++++++ tests/ui/consts/const_transmute_type_id6.stderr | 15 +++++++++++++++ 3 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 tests/ui/consts/const_transmute_type_id6.rs create mode 100644 tests/ui/consts/const_transmute_type_id6.stderr diff --git a/compiler/rustc_const_eval/src/interpret/memory.rs b/compiler/rustc_const_eval/src/interpret/memory.rs index 20c8e983ceae..20825d2ad9b5 100644 --- a/compiler/rustc_const_eval/src/interpret/memory.rs +++ b/compiler/rustc_const_eval/src/interpret/memory.rs @@ -997,7 +997,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> { ptr: Pointer>, ) -> InterpResult<'tcx, (Ty<'tcx>, u64)> { let (alloc_id, offset, _meta) = self.ptr_get_alloc_id(ptr, 0)?; - let GlobalAlloc::TypeId { ty } = self.tcx.global_alloc(alloc_id) else { + let Some(GlobalAlloc::TypeId { ty }) = self.tcx.try_get_global_alloc(alloc_id) else { throw_ub_format!("invalid `TypeId` value: not all bytes carry type id metadata") }; interp_ok((ty, offset.bytes())) diff --git a/tests/ui/consts/const_transmute_type_id6.rs b/tests/ui/consts/const_transmute_type_id6.rs new file mode 100644 index 000000000000..668eb0bb2b0f --- /dev/null +++ b/tests/ui/consts/const_transmute_type_id6.rs @@ -0,0 +1,16 @@ +//! Test that we do not ICE and that we do report an error +//! when placing non-TypeId provenance into a TypeId. + +#![feature(const_trait_impl, const_cmp)] + +use std::any::TypeId; +use std::mem::transmute; + +const X: bool = { + let a = (); + let id: TypeId = unsafe { transmute([&raw const a; 16 / size_of::<*const ()>()]) }; + id == id + //~^ ERROR: invalid `TypeId` value: not all bytes carry type id metadata +}; + +fn main() {} diff --git a/tests/ui/consts/const_transmute_type_id6.stderr b/tests/ui/consts/const_transmute_type_id6.stderr new file mode 100644 index 000000000000..f5d90256e7c6 --- /dev/null +++ b/tests/ui/consts/const_transmute_type_id6.stderr @@ -0,0 +1,15 @@ +error[E0080]: invalid `TypeId` value: not all bytes carry type id metadata + --> $DIR/const_transmute_type_id6.rs:12:5 + | +LL | id == id + | ^^^^^^^^ evaluation of `X` failed inside this call + | +note: inside `::eq` + --> $SRC_DIR/core/src/any.rs:LL:COL +note: inside `::eq::compiletime` + --> $SRC_DIR/core/src/any.rs:LL:COL + = note: this error originates in the macro `$crate::intrinsics::const_eval_select` which comes from the expansion of the macro `crate::intrinsics::const_eval_select` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0080`. From 4ca5afdc7ac807da8e1beac0813515cc36ef1ac0 Mon Sep 17 00:00:00 2001 From: bit-aloo Date: Fri, 18 Jul 2025 17:09:29 +0530 Subject: [PATCH 079/139] add default_lld_opt_in_targets method and modified test accordingly add test for lld opt in and also add thread_local defined state to change opt in targets make the config lld test parameter smoother to work, and have no_llvm_config set even when target_config is not present --- src/bootstrap/src/core/builder/tests.rs | 25 ++++++++++++++++-- src/bootstrap/src/core/config/toml/rust.rs | 30 ++++++++++++++++++++-- 2 files changed, 51 insertions(+), 4 deletions(-) diff --git a/src/bootstrap/src/core/builder/tests.rs b/src/bootstrap/src/core/builder/tests.rs index 7f0c6fbd8545..81a526593b4d 100644 --- a/src/bootstrap/src/core/builder/tests.rs +++ b/src/bootstrap/src/core/builder/tests.rs @@ -642,6 +642,7 @@ mod snapshot { }; use crate::core::builder::{Builder, Kind, StepDescription, StepMetadata}; use crate::core::config::TargetSelection; + use crate::core::config::toml::rust::with_lld_opt_in_targets; use crate::utils::cache::Cache; use crate::utils::helpers::get_host_target; use crate::utils::tests::{ConfigBuilder, TestCtx}; @@ -1638,12 +1639,33 @@ mod snapshot { .render_steps(), @r" [build] llvm [build] rustc 0 -> rustc 1 - [build] rustc 0 -> LldWrapper 1 [build] rustdoc 0 [doc] std 1 crates=[core] "); } + #[test] + fn test_lld_opt_in() { + let target: &'static str = Box::leak(Box::new(host_target())); + let slice: &'static [&'static str] = Box::leak(Box::new([target])); + + with_lld_opt_in_targets(slice, || { + let ctx = TestCtx::new(); + + insta::assert_snapshot!( + ctx.config("doc") + .path("core") + .override_target_no_std(&host_target()) + .render_steps(), @r" + [build] llvm + [build] rustc 0 -> rustc 1 + [build] rustc 0 -> LldWrapper 1 + [build] rustdoc 0 + [doc] std 1 crates=[core] + "); + }); + } + #[test] fn doc_library_no_std_target() { let ctx = TestCtx::new(); @@ -1654,7 +1676,6 @@ mod snapshot { .render_steps(), @r" [build] llvm [build] rustc 0 -> rustc 1 - [build] rustc 0 -> LldWrapper 1 [build] rustdoc 0 [doc] std 1 crates=[alloc,core] "); diff --git a/src/bootstrap/src/core/config/toml/rust.rs b/src/bootstrap/src/core/config/toml/rust.rs index 307aa52294ba..60484ee9e907 100644 --- a/src/bootstrap/src/core/config/toml/rust.rs +++ b/src/bootstrap/src/core/config/toml/rust.rs @@ -410,6 +410,31 @@ pub(crate) fn validate_codegen_backends(backends: Vec, section: &str) -> backends } +#[cfg(not(test))] +fn default_lld_opt_in_targets() -> Vec { + vec!["x86_64-unknown-linux-gnu".to_string()] +} + +#[cfg(test)] +thread_local! { + static TEST_LLD_OPT_IN_TARGETS: std::cell::RefCell>> = std::cell::RefCell::new(None); +} + +#[cfg(test)] +fn default_lld_opt_in_targets() -> Vec { + TEST_LLD_OPT_IN_TARGETS.with(|cell| cell.borrow().clone()).unwrap_or_default() +} + +#[cfg(test)] +pub fn with_lld_opt_in_targets(targets: Vec, f: impl FnOnce() -> R) -> R { + TEST_LLD_OPT_IN_TARGETS.with(|cell| { + let prev = cell.replace(Some(targets)); + let result = f(); + cell.replace(prev); + result + }) +} + impl Config { pub fn apply_rust_config(&mut self, toml_rust: Option, warnings: Warnings) { let mut debug = None; @@ -609,12 +634,13 @@ impl Config { // thus, disabled // - similarly, lld will not be built nor used by default when explicitly asked not to, e.g. // when the config sets `rust.lld = false` - if self.host_target.triple == "x86_64-unknown-linux-gnu" && self.hosts == [self.host_target] + if default_lld_opt_in_targets().contains(&self.host_target.triple.to_string()) + && self.hosts == [self.host_target] { let no_llvm_config = self .target_config .get(&self.host_target) - .is_some_and(|target_config| target_config.llvm_config.is_none()); + .is_none_or(|target_config| target_config.llvm_config.is_none()); let enable_lld = self.llvm_from_ci || no_llvm_config; // Prefer the config setting in case an explicit opt-out is needed. self.lld_enabled = lld_enabled.unwrap_or(enable_lld); From fb10084b84b23e042c8888490c771ae5a315cfab Mon Sep 17 00:00:00 2001 From: bit-aloo Date: Mon, 21 Jul 2025 20:10:58 +0530 Subject: [PATCH 080/139] add test_lld_opt_in test --- src/bootstrap/src/core/builder/tests.rs | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/bootstrap/src/core/builder/tests.rs b/src/bootstrap/src/core/builder/tests.rs index 81a526593b4d..4cc57996f3ff 100644 --- a/src/bootstrap/src/core/builder/tests.rs +++ b/src/bootstrap/src/core/builder/tests.rs @@ -1646,22 +1646,15 @@ mod snapshot { #[test] fn test_lld_opt_in() { - let target: &'static str = Box::leak(Box::new(host_target())); - let slice: &'static [&'static str] = Box::leak(Box::new([target])); - - with_lld_opt_in_targets(slice, || { + with_lld_opt_in_targets(vec![host_target()], || { let ctx = TestCtx::new(); - insta::assert_snapshot!( - ctx.config("doc") - .path("core") - .override_target_no_std(&host_target()) + ctx.config("build") + .path("compiler") .render_steps(), @r" [build] llvm [build] rustc 0 -> rustc 1 [build] rustc 0 -> LldWrapper 1 - [build] rustdoc 0 - [doc] std 1 crates=[core] "); }); } From b5d36e5294d3354ad8feec86b27c698e368c88a6 Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Mon, 21 Jul 2025 16:07:12 +0000 Subject: [PATCH 081/139] Dont ICE on copy error being suppressed due to overflow --- .../src/diagnostics/move_errors.rs | 9 +++++---- tests/ui/borrowck/copy-overflow.rs | 16 ++++++++++++++++ tests/ui/borrowck/copy-overflow.stderr | 15 +++++++++++++++ 3 files changed, 36 insertions(+), 4 deletions(-) create mode 100644 tests/ui/borrowck/copy-overflow.rs create mode 100644 tests/ui/borrowck/copy-overflow.stderr diff --git a/compiler/rustc_borrowck/src/diagnostics/move_errors.rs b/compiler/rustc_borrowck/src/diagnostics/move_errors.rs index 92ca868eb992..447bf7d091a7 100644 --- a/compiler/rustc_borrowck/src/diagnostics/move_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/move_errors.rs @@ -303,10 +303,11 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { } fn has_ambiguous_copy(&mut self, ty: Ty<'tcx>) -> bool { - let Some(copy_trait_def) = self.infcx.tcx.lang_items().copy_trait() else { return false }; - // This is only going to be ambiguous if there are incoherent impls, because otherwise - // ambiguity should never happen in MIR. - self.infcx.type_implements_trait(copy_trait_def, [ty], self.infcx.param_env).may_apply() + let Some(copy_def_id) = self.infcx.tcx.lang_items().copy_trait() else { return false }; + + // Avoid bogus move errors because of an incoherent `Copy` impl. + self.infcx.type_implements_trait(copy_def_id, [ty], self.infcx.param_env).may_apply() + && self.infcx.tcx.coherent_trait(copy_def_id).is_err() } fn report_cannot_move_from_static(&mut self, place: Place<'tcx>, span: Span) -> Diag<'infcx> { diff --git a/tests/ui/borrowck/copy-overflow.rs b/tests/ui/borrowck/copy-overflow.rs new file mode 100644 index 000000000000..5aa1afdee68e --- /dev/null +++ b/tests/ui/borrowck/copy-overflow.rs @@ -0,0 +1,16 @@ +// Regression test for . + +// We were previously suppressing the copy error in the `Clone` impl because we assumed +// that the only way we get `Copy` ambiguity errors was due to incoherent impls. This is +// not true, since ambiguities can be encountered due to overflows (among other ways). + +struct S(Option<&'static T>); + +impl Copy for S where S: Copy + Clone {} +impl Clone for S { + fn clone(&self) -> Self { + *self + //~^ ERROR cannot move out of `*self` which is behind a shared reference + } +} +fn main() {} diff --git a/tests/ui/borrowck/copy-overflow.stderr b/tests/ui/borrowck/copy-overflow.stderr new file mode 100644 index 000000000000..3f601276f8fd --- /dev/null +++ b/tests/ui/borrowck/copy-overflow.stderr @@ -0,0 +1,15 @@ +error[E0507]: cannot move out of `*self` which is behind a shared reference + --> $DIR/copy-overflow.rs:12:9 + | +LL | *self + | ^^^^^ move occurs because `*self` has type `S`, which does not implement the `Copy` trait + | +help: consider cloning the value if the performance cost is acceptable + | +LL - *self +LL + self.clone() + | + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0507`. From 690ae523e5c0ac9602db7bbe2b8094ee422e4d0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Sun, 20 Jul 2025 01:19:55 +0000 Subject: [PATCH 082/139] Tweak borrowck label pointing at `!Copy` value moved into closure When encountering a non-`Copy` value that is moved into a closure which is coming directly from a fn parameter, point at the parameter's type when mentioning it is not `Copy`. Before: ``` error[E0507]: cannot move out of `foo`, a captured variable in an `Fn` closure --> f111.rs:14:25 | 13 | fn do_stuff(foo: Option) { | --- captured outer variable 14 | require_fn_trait(|| async { | -- ^^^^^ `foo` is moved here | | | captured by this `Fn` closure 15 | if foo.map_or(false, |f| f.foo()) { | --- | | | variable moved due to use in coroutine | move occurs because `foo` has type `Option`, which does not implement the `Copy` trait ``` After: ``` error[E0507]: cannot move out of `foo`, a captured variable in an `Fn` closure --> f111.rs:14:25 | 13 | fn do_stuff(foo: Option) { | --- ----------- move occurs because `foo` has type `Option`, which does not implement the `Copy` trait | | | captured outer variable 14 | require_fn_trait(|| async { | -- ^^^^^ `foo` is moved here | | | captured by this `Fn` closure 15 | if foo.map_or(false, |f| f.foo()) { | --- variable moved due to use in coroutine ``` --- .../src/diagnostics/move_errors.rs | 131 +++++++++++------- tests/ui/issues/issue-4335.stderr | 6 +- 2 files changed, 83 insertions(+), 54 deletions(-) diff --git a/compiler/rustc_borrowck/src/diagnostics/move_errors.rs b/compiler/rustc_borrowck/src/diagnostics/move_errors.rs index 92ca868eb992..28024e6fecef 100644 --- a/compiler/rustc_borrowck/src/diagnostics/move_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/move_errors.rs @@ -115,10 +115,8 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { fn append_to_grouped_errors( &self, grouped_errors: &mut Vec>, - error: MoveError<'tcx>, + MoveError { place: original_path, location, kind }: MoveError<'tcx>, ) { - let MoveError { place: original_path, location, kind } = error; - // Note: that the only time we assign a place isn't a temporary // to a user variable is when initializing it. // If that ever stops being the case, then the ever initialized @@ -251,54 +249,47 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { } fn report(&mut self, error: GroupedMoveError<'tcx>) { - let (mut err, err_span) = { - let (span, use_spans, original_path, kind) = match error { - GroupedMoveError::MovesFromPlace { span, original_path, ref kind, .. } - | GroupedMoveError::MovesFromValue { span, original_path, ref kind, .. } => { - (span, None, original_path, kind) - } - GroupedMoveError::OtherIllegalMove { use_spans, original_path, ref kind } => { - (use_spans.args_or_use(), Some(use_spans), original_path, kind) - } - }; - debug!( - "report: original_path={:?} span={:?}, kind={:?} \ - original_path.is_upvar_field_projection={:?}", - original_path, - span, - kind, - self.is_upvar_field_projection(original_path.as_ref()) - ); - if self.has_ambiguous_copy(original_path.ty(self.body, self.infcx.tcx).ty) { - // If the type may implement Copy, skip the error. - // It's an error with the Copy implementation (e.g. duplicate Copy) rather than borrow check - self.dcx().span_delayed_bug( - span, - "Type may implement copy, but there is no other error.", - ); - return; + let (span, use_spans, original_path, kind) = match error { + GroupedMoveError::MovesFromPlace { span, original_path, ref kind, .. } + | GroupedMoveError::MovesFromValue { span, original_path, ref kind, .. } => { + (span, None, original_path, kind) + } + GroupedMoveError::OtherIllegalMove { use_spans, original_path, ref kind } => { + (use_spans.args_or_use(), Some(use_spans), original_path, kind) + } + }; + debug!( + "report: original_path={:?} span={:?}, kind={:?} \ + original_path.is_upvar_field_projection={:?}", + original_path, + span, + kind, + self.is_upvar_field_projection(original_path.as_ref()) + ); + if self.has_ambiguous_copy(original_path.ty(self.body, self.infcx.tcx).ty) { + // If the type may implement Copy, skip the error. + // It's an error with the Copy implementation (e.g. duplicate Copy) rather than borrow check + self.dcx() + .span_delayed_bug(span, "Type may implement copy, but there is no other error."); + return; + } + let mut err = match kind { + &IllegalMoveOriginKind::BorrowedContent { target_place } => self + .report_cannot_move_from_borrowed_content( + original_path, + target_place, + span, + use_spans, + ), + &IllegalMoveOriginKind::InteriorOfTypeWithDestructor { container_ty: ty } => { + self.cannot_move_out_of_interior_of_drop(span, ty) + } + &IllegalMoveOriginKind::InteriorOfSliceOrArray { ty, is_index } => { + self.cannot_move_out_of_interior_noncopy(span, ty, Some(is_index)) } - ( - match kind { - &IllegalMoveOriginKind::BorrowedContent { target_place } => self - .report_cannot_move_from_borrowed_content( - original_path, - target_place, - span, - use_spans, - ), - &IllegalMoveOriginKind::InteriorOfTypeWithDestructor { container_ty: ty } => { - self.cannot_move_out_of_interior_of_drop(span, ty) - } - &IllegalMoveOriginKind::InteriorOfSliceOrArray { ty, is_index } => { - self.cannot_move_out_of_interior_noncopy(span, ty, Some(is_index)) - } - }, - span, - ) }; - self.add_move_hints(error, &mut err, err_span); + self.add_move_hints(error, &mut err, span); self.buffer_error(err); } @@ -482,7 +473,8 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { self.cannot_move_out_of_interior_noncopy(span, ty, None) } ty::Closure(def_id, closure_args) - if def_id.as_local() == Some(self.mir_def_id()) && upvar_field.is_some() => + if def_id.as_local() == Some(self.mir_def_id()) + && let Some(upvar_field) = upvar_field => { let closure_kind_ty = closure_args.as_closure().kind_ty(); let closure_kind = match closure_kind_ty.to_opt_closure_kind() { @@ -495,7 +487,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { let capture_description = format!("captured variable in an `{closure_kind}` closure"); - let upvar = &self.upvars[upvar_field.unwrap().index()]; + let upvar = &self.upvars[upvar_field.index()]; let upvar_hir_id = upvar.get_root_variable(); let upvar_name = upvar.to_string(tcx); let upvar_span = tcx.hir_span(upvar_hir_id); @@ -604,8 +596,10 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { self.add_move_error_details(err, &binds_to); } // No binding. Nothing to suggest. - GroupedMoveError::OtherIllegalMove { ref original_path, use_spans, .. } => { - let use_span = use_spans.var_or_use(); + GroupedMoveError::OtherIllegalMove { + ref original_path, use_spans, ref kind, .. + } => { + let mut use_span = use_spans.var_or_use(); let place_ty = original_path.ty(self.body, self.infcx.tcx).ty; let place_desc = match self.describe_place(original_path.as_ref()) { Some(desc) => format!("`{desc}`"), @@ -622,6 +616,39 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { ); } + if let IllegalMoveOriginKind::BorrowedContent { target_place } = &kind + && let ty = target_place.ty(self.body, self.infcx.tcx).ty + && let ty::Closure(def_id, _) = ty.kind() + && def_id.as_local() == Some(self.mir_def_id()) + && let Some(upvar_field) = self + .prefixes(original_path.as_ref(), PrefixSet::All) + .find_map(|p| self.is_upvar_field_projection(p)) + && let upvar = &self.upvars[upvar_field.index()] + && let upvar_hir_id = upvar.get_root_variable() + && let hir::Node::Param(param) = self.infcx.tcx.parent_hir_node(upvar_hir_id) + { + // Instead of pointing at the path where we access the value within a closure, + // we point at the type on the parameter from the definition of the outer + // function: + // + // error[E0507]: cannot move out of `foo`, a captured + // variable in an `Fn` closure + // --> file.rs:14:25 + // | + // 13 | fn do_stuff(foo: Option) { + // | --- ----------- move occurs because `foo` has type + // | | `Option`, which does not implement + // | | the `Copy` trait + // | captured outer variable + // 14 | require_fn_trait(|| async { + // | -- ^^^^^ `foo` is moved here + // | | + // | captured by this `Fn` closure + // 15 | if foo.map_or(false, |f| f.foo()) { + // | --- variable moved due to use in coroutine + use_span = param.ty_span; + } + err.subdiagnostic(crate::session_diagnostics::TypeNoCopy::Label { is_partial_move: false, ty: place_ty, diff --git a/tests/ui/issues/issue-4335.stderr b/tests/ui/issues/issue-4335.stderr index 14b5cfa9f9ac..1f1a2595a318 100644 --- a/tests/ui/issues/issue-4335.stderr +++ b/tests/ui/issues/issue-4335.stderr @@ -2,9 +2,11 @@ error[E0507]: cannot move out of `*v`, as `v` is a captured variable in an `FnMu --> $DIR/issue-4335.rs:6:20 | LL | fn f<'r, T>(v: &'r T) -> Box T + 'r> { - | - captured outer variable + | - ----- move occurs because `*v` has type `T`, which does not implement the `Copy` trait + | | + | captured outer variable LL | id(Box::new(|| *v)) - | -- ^^ move occurs because `*v` has type `T`, which does not implement the `Copy` trait + | -- ^^ | | | captured by this `FnMut` closure | From 5082e6a300974459aec6dc73e76cc039c3a517c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Sun, 20 Jul 2025 02:15:45 +0000 Subject: [PATCH 083/139] Generalize logic pointing at binding moved into closure Account not only for `fn` parameters when moving non-`Copy` values into closure, but also for let bindings. ``` error[E0507]: cannot move out of `bar`, a captured variable in an `FnMut` closure --> $DIR/borrowck-move-by-capture.rs:9:29 | LL | let bar: Box<_> = Box::new(3); | --- ------ move occurs because `bar` has type `Box`, which does not implement the `Copy` trait | | | captured outer variable LL | let _g = to_fn_mut(|| { | -- captured by this `FnMut` closure LL | let _h = to_fn_once(move || -> isize { *bar }); | ^^^^^^^^^^^^^^^^ ---- variable moved due to use in closure | | | `bar` is moved here | help: consider cloning the value before moving it into the closure | LL ~ let value = bar.clone(); LL ~ let _h = to_fn_once(move || -> isize { value }); | ``` ``` error[E0507]: cannot move out of `y`, a captured variable in an `Fn` closure --> $DIR/unboxed-closures-move-upvar-from-non-once-ref-closure.rs:12:9 | LL | let y = vec![format!("World")]; | - ---------------------- move occurs because `y` has type `Vec`, which does not implement the `Copy` trait | | | captured outer variable LL | call(|| { | -- captured by this `Fn` closure LL | y.into_iter(); | ^ ----------- `y` moved due to this method call | | | `y` is moved here | note: `into_iter` takes ownership of the receiver `self`, which moves `y` --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL help: you can `clone` the value and consume it, but this might not be your desired behavior | LL | as Clone>::clone(&y).into_iter(); | +++++++++++++++++++++++++++++++ + help: consider cloning the value if the performance cost is acceptable | LL | y.clone().into_iter(); | ++++++++ ``` --- .../src/diagnostics/move_errors.rs | 79 +++++++++++++------ tests/ui/borrowck/borrowck-in-static.stderr | 6 +- .../borrowck/borrowck-move-by-capture.stderr | 10 +-- tests/ui/borrowck/issue-103624.stderr | 7 +- ...ove-upvar-from-non-once-ref-closure.stderr | 6 +- tests/ui/issues/issue-4335.stderr | 2 +- ...-move-out-of-closure-env-issue-1965.stderr | 6 +- ...e-52663-span-decl-captured-variable.stderr | 6 +- ...borrowck-call-is-borrow-issue-12224.stderr | 18 +++-- .../suggestions/option-content-move2.stderr | 18 ++--- .../suggestions/option-content-move3.stderr | 18 ++--- .../unboxed-closure-illegal-move.stderr | 24 ++++-- 12 files changed, 125 insertions(+), 75 deletions(-) diff --git a/compiler/rustc_borrowck/src/diagnostics/move_errors.rs b/compiler/rustc_borrowck/src/diagnostics/move_errors.rs index 28024e6fecef..56f7fe688544 100644 --- a/compiler/rustc_borrowck/src/diagnostics/move_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/move_errors.rs @@ -623,30 +623,51 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { && let Some(upvar_field) = self .prefixes(original_path.as_ref(), PrefixSet::All) .find_map(|p| self.is_upvar_field_projection(p)) - && let upvar = &self.upvars[upvar_field.index()] - && let upvar_hir_id = upvar.get_root_variable() - && let hir::Node::Param(param) = self.infcx.tcx.parent_hir_node(upvar_hir_id) { - // Instead of pointing at the path where we access the value within a closure, - // we point at the type on the parameter from the definition of the outer - // function: - // - // error[E0507]: cannot move out of `foo`, a captured - // variable in an `Fn` closure - // --> file.rs:14:25 - // | - // 13 | fn do_stuff(foo: Option) { - // | --- ----------- move occurs because `foo` has type - // | | `Option`, which does not implement - // | | the `Copy` trait - // | captured outer variable - // 14 | require_fn_trait(|| async { - // | -- ^^^^^ `foo` is moved here - // | | - // | captured by this `Fn` closure - // 15 | if foo.map_or(false, |f| f.foo()) { - // | --- variable moved due to use in coroutine - use_span = param.ty_span; + let upvar = &self.upvars[upvar_field.index()]; + let upvar_hir_id = upvar.get_root_variable(); + use_span = match self.infcx.tcx.parent_hir_node(upvar_hir_id) { + hir::Node::Param(param) => { + // Instead of pointing at the path where we access the value within a + // closure, we point at the type on the parameter from the definition + // of the outer function: + // + // error[E0507]: cannot move out of `foo`, a captured + // variable in an `Fn` closure + // --> file.rs:14:25 + // | + // 13 | fn do_stuff(foo: Option) { + // | --- ----------- move occurs because `foo` has type + // | | `Option`, which does not + // | | implement the `Copy` trait + // | captured outer variable + // 14 | require_fn_trait(|| async { + // | -- ^^^^^ `foo` is moved here + // | | + // | captured by this `Fn` closure + // 15 | if foo.map_or(false, |f| f.foo()) { + // | --- variable moved due to use in coroutine + param.ty_span + } + hir::Node::LetStmt(stmt) => match (stmt.ty, stmt.init) { + // 13 | fn do_stuff(foo: Option) { + // 14 | let foo: Option = foo; + // | --- ----------- move occurs because `foo` has type + // | | `Option`, which does not implement + // | | the `Copy` trait + // | captured outer variable + (Some(ty), _) => ty.span, + // 13 | fn do_stuff(bar: Option) { + // 14 | let foo = bar; + // | --- --- move occurs because `foo` has type + // | | `Option`, which does not implement the + // | | `Copy` trait + // | captured outer variable + (None, Some(init)) => init.span, + (None, None) => use_span, + }, + _ => use_span, + }; } err.subdiagnostic(crate::session_diagnostics::TypeNoCopy::Label { @@ -656,12 +677,22 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { span: use_span, }); + let mut pointed_at_span = false; use_spans.args_subdiag(err, |args_span| { + if args_span == span || args_span == use_span { + pointed_at_span = true; + } crate::session_diagnostics::CaptureArgLabel::MoveOutPlace { - place: place_desc, + place: place_desc.clone(), args_span, } }); + if !pointed_at_span && use_span != span { + err.subdiagnostic(crate::session_diagnostics::CaptureArgLabel::MoveOutPlace { + place: place_desc, + args_span: span, + }); + } self.add_note_for_packed_struct_derive(err, original_path.local); } diff --git a/tests/ui/borrowck/borrowck-in-static.stderr b/tests/ui/borrowck/borrowck-in-static.stderr index 745b02ae21b8..9bcf64dd62e2 100644 --- a/tests/ui/borrowck/borrowck-in-static.stderr +++ b/tests/ui/borrowck/borrowck-in-static.stderr @@ -2,9 +2,11 @@ error[E0507]: cannot move out of `x`, a captured variable in an `Fn` closure --> $DIR/borrowck-in-static.rs:5:17 | LL | let x = Box::new(0); - | - captured outer variable + | - ----------- move occurs because `x` has type `Box`, which does not implement the `Copy` trait + | | + | captured outer variable LL | Box::new(|| x) - | -- ^ move occurs because `x` has type `Box`, which does not implement the `Copy` trait + | -- ^ `x` is moved here | | | captured by this `Fn` closure | diff --git a/tests/ui/borrowck/borrowck-move-by-capture.stderr b/tests/ui/borrowck/borrowck-move-by-capture.stderr index 58d5e90e990a..732af1593d60 100644 --- a/tests/ui/borrowck/borrowck-move-by-capture.stderr +++ b/tests/ui/borrowck/borrowck-move-by-capture.stderr @@ -2,14 +2,14 @@ error[E0507]: cannot move out of `bar`, a captured variable in an `FnMut` closur --> $DIR/borrowck-move-by-capture.rs:9:29 | LL | let bar: Box<_> = Box::new(3); - | --- captured outer variable + | --- ------ move occurs because `bar` has type `Box`, which does not implement the `Copy` trait + | | + | captured outer variable LL | let _g = to_fn_mut(|| { | -- captured by this `FnMut` closure LL | let _h = to_fn_once(move || -> isize { *bar }); - | ^^^^^^^^^^^^^^^^ ---- - | | | - | | variable moved due to use in closure - | | move occurs because `bar` has type `Box`, which does not implement the `Copy` trait + | ^^^^^^^^^^^^^^^^ ---- variable moved due to use in closure + | | | `bar` is moved here | help: consider cloning the value before moving it into the closure diff --git a/tests/ui/borrowck/issue-103624.stderr b/tests/ui/borrowck/issue-103624.stderr index 603055beadce..af65deb16dcf 100644 --- a/tests/ui/borrowck/issue-103624.stderr +++ b/tests/ui/borrowck/issue-103624.stderr @@ -2,13 +2,16 @@ error[E0507]: cannot move out of `self.b`, as `self` is a captured variable in a --> $DIR/issue-103624.rs:16:13 | LL | async fn foo(&self) { - | ----- captured outer variable + | ----- + | | + | captured outer variable + | move occurs because `self.b` has type `StructB`, which does not implement the `Copy` trait LL | let bar = self.b.bar().await; LL | spawn_blocking(move || { | ------- captured by this `Fn` closure LL | LL | self.b; - | ^^^^^^ move occurs because `self.b` has type `StructB`, which does not implement the `Copy` trait + | ^^^^^^ `self.b` is moved here | note: if `StructB` implemented `Clone`, you could clone the value --> $DIR/issue-103624.rs:23:1 diff --git a/tests/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.stderr b/tests/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.stderr index 177e9c8d2487..da0e133ba023 100644 --- a/tests/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.stderr +++ b/tests/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.stderr @@ -2,13 +2,15 @@ error[E0507]: cannot move out of `y`, a captured variable in an `Fn` closure --> $DIR/unboxed-closures-move-upvar-from-non-once-ref-closure.rs:12:9 | LL | let y = vec![format!("World")]; - | - captured outer variable + | - ---------------------- move occurs because `y` has type `Vec`, which does not implement the `Copy` trait + | | + | captured outer variable LL | call(|| { | -- captured by this `Fn` closure LL | y.into_iter(); | ^ ----------- `y` moved due to this method call | | - | move occurs because `y` has type `Vec`, which does not implement the `Copy` trait + | `y` is moved here | note: `into_iter` takes ownership of the receiver `self`, which moves `y` --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL diff --git a/tests/ui/issues/issue-4335.stderr b/tests/ui/issues/issue-4335.stderr index 1f1a2595a318..42ac63225640 100644 --- a/tests/ui/issues/issue-4335.stderr +++ b/tests/ui/issues/issue-4335.stderr @@ -6,7 +6,7 @@ LL | fn f<'r, T>(v: &'r T) -> Box T + 'r> { | | | captured outer variable LL | id(Box::new(|| *v)) - | -- ^^ + | -- ^^ `*v` is moved here | | | captured by this `FnMut` closure | diff --git a/tests/ui/moves/moves-based-on-type-move-out-of-closure-env-issue-1965.stderr b/tests/ui/moves/moves-based-on-type-move-out-of-closure-env-issue-1965.stderr index 523134a9425f..51d0f85c031f 100644 --- a/tests/ui/moves/moves-based-on-type-move-out-of-closure-env-issue-1965.stderr +++ b/tests/ui/moves/moves-based-on-type-move-out-of-closure-env-issue-1965.stderr @@ -2,9 +2,11 @@ error[E0507]: cannot move out of `i`, a captured variable in an `Fn` closure --> $DIR/moves-based-on-type-move-out-of-closure-env-issue-1965.rs:9:28 | LL | let i = Box::new(3); - | - captured outer variable + | - ----------- move occurs because `i` has type `Box`, which does not implement the `Copy` trait + | | + | captured outer variable LL | let _f = to_fn(|| test(i)); - | -- ^ move occurs because `i` has type `Box`, which does not implement the `Copy` trait + | -- ^ `i` is moved here | | | captured by this `Fn` closure | diff --git a/tests/ui/nll/issue-52663-span-decl-captured-variable.stderr b/tests/ui/nll/issue-52663-span-decl-captured-variable.stderr index fbaec8a6008a..575460370065 100644 --- a/tests/ui/nll/issue-52663-span-decl-captured-variable.stderr +++ b/tests/ui/nll/issue-52663-span-decl-captured-variable.stderr @@ -2,9 +2,11 @@ error[E0507]: cannot move out of `x.0`, as `x` is a captured variable in an `Fn` --> $DIR/issue-52663-span-decl-captured-variable.rs:8:26 | LL | let x = (vec![22], vec![44]); - | - captured outer variable + | - -------------------- move occurs because `x.0` has type `Vec`, which does not implement the `Copy` trait + | | + | captured outer variable LL | expect_fn(|| drop(x.0)); - | -- ^^^ move occurs because `x.0` has type `Vec`, which does not implement the `Copy` trait + | -- ^^^ `x.0` is moved here | | | captured by this `Fn` closure | diff --git a/tests/ui/span/borrowck-call-is-borrow-issue-12224.stderr b/tests/ui/span/borrowck-call-is-borrow-issue-12224.stderr index f37dc320fa31..287616924139 100644 --- a/tests/ui/span/borrowck-call-is-borrow-issue-12224.stderr +++ b/tests/ui/span/borrowck-call-is-borrow-issue-12224.stderr @@ -35,14 +35,18 @@ LL | fn test4(f: &mut Test) { error[E0507]: cannot move out of `f`, a captured variable in an `FnMut` closure --> $DIR/borrowck-call-is-borrow-issue-12224.rs:57:13 | -LL | let mut f = move |g: Box, b: isize| { - | ----- captured outer variable -... -LL | f(Box::new(|a| { - | --- captured by this `FnMut` closure +LL | let mut f = move |g: Box, b: isize| { + | _________-----___- + | | | + | | captured outer variable +LL | | let _ = s.len(); +LL | | }; + | |_____- move occurs because `f` has type `{closure@$DIR/borrowck-call-is-borrow-issue-12224.rs:52:17: 52:58}`, which does not implement the `Copy` trait +LL | f(Box::new(|a| { + | --- captured by this `FnMut` closure LL | -LL | foo(f); - | ^ move occurs because `f` has type `{closure@$DIR/borrowck-call-is-borrow-issue-12224.rs:52:17: 52:58}`, which does not implement the `Copy` trait +LL | foo(f); + | ^ `f` is moved here | help: consider cloning the value if the performance cost is acceptable | diff --git a/tests/ui/suggestions/option-content-move2.stderr b/tests/ui/suggestions/option-content-move2.stderr index be97cba17b90..436441d6f1b9 100644 --- a/tests/ui/suggestions/option-content-move2.stderr +++ b/tests/ui/suggestions/option-content-move2.stderr @@ -2,7 +2,9 @@ error[E0507]: cannot move out of `var`, a captured variable in an `FnMut` closur --> $DIR/option-content-move2.rs:11:9 | LL | let mut var = None; - | ------- captured outer variable + | ------- ---- move occurs because `var` has type `Option`, which does not implement the `Copy` trait + | | + | captured outer variable LL | func(|| { | -- captured by this `FnMut` closure LL | // Shouldn't suggest `move ||.as_ref()` here @@ -10,16 +12,15 @@ LL | move || { | ^^^^^^^ `var` is moved here LL | LL | var = Some(NotCopyable); - | --- - | | - | variable moved due to use in closure - | move occurs because `var` has type `Option`, which does not implement the `Copy` trait + | --- variable moved due to use in closure error[E0507]: cannot move out of `var`, a captured variable in an `FnMut` closure --> $DIR/option-content-move2.rs:21:9 | LL | let mut var = None; - | ------- captured outer variable + | ------- ---- move occurs because `var` has type `Option`, which does not implement the `Copy` trait + | | + | captured outer variable LL | func(|| { | -- captured by this `FnMut` closure LL | // Shouldn't suggest `move ||.as_ref()` nor to `clone()` here @@ -27,10 +28,7 @@ LL | move || { | ^^^^^^^ `var` is moved here LL | LL | var = Some(NotCopyableButCloneable); - | --- - | | - | variable moved due to use in closure - | move occurs because `var` has type `Option`, which does not implement the `Copy` trait + | --- variable moved due to use in closure error: aborting due to 2 previous errors diff --git a/tests/ui/suggestions/option-content-move3.stderr b/tests/ui/suggestions/option-content-move3.stderr index faaf8a9df9d7..68c52352a651 100644 --- a/tests/ui/suggestions/option-content-move3.stderr +++ b/tests/ui/suggestions/option-content-move3.stderr @@ -26,17 +26,16 @@ error[E0507]: cannot move out of `var`, a captured variable in an `FnMut` closur --> $DIR/option-content-move3.rs:12:9 | LL | let var = NotCopyable; - | --- captured outer variable + | --- ----------- move occurs because `var` has type `NotCopyable`, which does not implement the `Copy` trait + | | + | captured outer variable LL | func(|| { | -- captured by this `FnMut` closure LL | // Shouldn't suggest `move ||.as_ref()` here LL | move || { | ^^^^^^^ `var` is moved here LL | let x = var; - | --- - | | - | variable moved due to use in closure - | move occurs because `var` has type `NotCopyable`, which does not implement the `Copy` trait + | --- variable moved due to use in closure | note: if `NotCopyable` implemented `Clone`, you could clone the value --> $DIR/option-content-move3.rs:2:1 @@ -67,17 +66,16 @@ error[E0507]: cannot move out of `var`, a captured variable in an `FnMut` closur --> $DIR/option-content-move3.rs:23:9 | LL | let var = NotCopyableButCloneable; - | --- captured outer variable + | --- ----------------------- move occurs because `var` has type `NotCopyableButCloneable`, which does not implement the `Copy` trait + | | + | captured outer variable LL | func(|| { | -- captured by this `FnMut` closure LL | // Shouldn't suggest `move ||.as_ref()` here LL | move || { | ^^^^^^^ `var` is moved here LL | let x = var; - | --- - | | - | variable moved due to use in closure - | move occurs because `var` has type `NotCopyableButCloneable`, which does not implement the `Copy` trait + | --- variable moved due to use in closure | help: consider cloning the value before moving it into the closure | diff --git a/tests/ui/unboxed-closures/unboxed-closure-illegal-move.stderr b/tests/ui/unboxed-closures/unboxed-closure-illegal-move.stderr index cf4391311d03..8d9a61cb6812 100644 --- a/tests/ui/unboxed-closures/unboxed-closure-illegal-move.stderr +++ b/tests/ui/unboxed-closures/unboxed-closure-illegal-move.stderr @@ -2,9 +2,11 @@ error[E0507]: cannot move out of `x`, a captured variable in an `Fn` closure --> $DIR/unboxed-closure-illegal-move.rs:15:31 | LL | let x = Box::new(0); - | - captured outer variable + | - ----------- move occurs because `x` has type `Box`, which does not implement the `Copy` trait + | | + | captured outer variable LL | let f = to_fn(|| drop(x)); - | -- ^ move occurs because `x` has type `Box`, which does not implement the `Copy` trait + | -- ^ `x` is moved here | | | captured by this `Fn` closure | @@ -17,9 +19,11 @@ error[E0507]: cannot move out of `x`, a captured variable in an `FnMut` closure --> $DIR/unboxed-closure-illegal-move.rs:19:35 | LL | let x = Box::new(0); - | - captured outer variable + | - ----------- move occurs because `x` has type `Box`, which does not implement the `Copy` trait + | | + | captured outer variable LL | let f = to_fn_mut(|| drop(x)); - | -- ^ move occurs because `x` has type `Box`, which does not implement the `Copy` trait + | -- ^ `x` is moved here | | | captured by this `FnMut` closure | @@ -32,9 +36,11 @@ error[E0507]: cannot move out of `x`, a captured variable in an `Fn` closure --> $DIR/unboxed-closure-illegal-move.rs:28:36 | LL | let x = Box::new(0); - | - captured outer variable + | - ----------- move occurs because `x` has type `Box`, which does not implement the `Copy` trait + | | + | captured outer variable LL | let f = to_fn(move || drop(x)); - | ------- ^ move occurs because `x` has type `Box`, which does not implement the `Copy` trait + | ------- ^ `x` is moved here | | | captured by this `Fn` closure @@ -42,9 +48,11 @@ error[E0507]: cannot move out of `x`, a captured variable in an `FnMut` closure --> $DIR/unboxed-closure-illegal-move.rs:32:40 | LL | let x = Box::new(0); - | - captured outer variable + | - ----------- move occurs because `x` has type `Box`, which does not implement the `Copy` trait + | | + | captured outer variable LL | let f = to_fn_mut(move || drop(x)); - | ------- ^ move occurs because `x` has type `Box`, which does not implement the `Copy` trait + | ------- ^ `x` is moved here | | | captured by this `FnMut` closure From 8df93e6966e71da8a249a0022680b83eff105f42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Sun, 20 Jul 2025 02:22:55 +0000 Subject: [PATCH 084/139] Tweak spans when encountering multiline initializer in move error ``` error[E0507]: cannot move out of `f`, a captured variable in an `FnMut` closure --> $DIR/borrowck-call-is-borrow-issue-12224.rs:57:13 | LL | let mut f = move |g: Box, b: isize| { | ----- captured outer variable ... LL | f(Box::new(|a| { | --- captured by this `FnMut` closure LL | LL | foo(f); | ^ move occurs because `f` has type `{closure@$DIR/borrowck-call-is-borrow-issue-12224.rs:52:17: 52:58}`, which does not implement the `Copy` trait ``` instead of ``` error[E0507]: cannot move out of `f`, a captured variable in an `FnMut` closure --> $DIR/borrowck-call-is-borrow-issue-12224.rs:57:13 | LL | let mut f = move |g: Box, b: isize| { | _________-----___- | | | | | captured outer variable LL | | let _ = s.len(); LL | | }; | |_____- move occurs because `f` has type `{closure@$DIR/borrowck-call-is-borrow-issue-12224.rs:52:17: 52:58}`, which does not implement the `Copy` trait LL | f(Box::new(|a| { | --- captured by this `FnMut` closure LL | LL | foo(f); | ^ `f` is moved here ``` --- .../src/diagnostics/move_errors.rs | 11 +++++++++-- ...move-upvar-from-non-once-ref-closure.stderr | 6 ++---- .../borrowck-call-is-borrow-issue-12224.stderr | 18 +++++++----------- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/compiler/rustc_borrowck/src/diagnostics/move_errors.rs b/compiler/rustc_borrowck/src/diagnostics/move_errors.rs index 56f7fe688544..40361906e042 100644 --- a/compiler/rustc_borrowck/src/diagnostics/move_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/move_errors.rs @@ -663,8 +663,15 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { // | | `Option`, which does not implement the // | | `Copy` trait // | captured outer variable - (None, Some(init)) => init.span, - (None, None) => use_span, + // + // We don't want the case where the initializer is something that spans + // multiple lines, like a closure, as the ASCII art gets messy. + (None, Some(init)) + if !self.infcx.tcx.sess.source_map().is_multiline(init.span) => + { + init.span + } + _ => use_span, }, _ => use_span, }; diff --git a/tests/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.stderr b/tests/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.stderr index da0e133ba023..177e9c8d2487 100644 --- a/tests/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.stderr +++ b/tests/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.stderr @@ -2,15 +2,13 @@ error[E0507]: cannot move out of `y`, a captured variable in an `Fn` closure --> $DIR/unboxed-closures-move-upvar-from-non-once-ref-closure.rs:12:9 | LL | let y = vec![format!("World")]; - | - ---------------------- move occurs because `y` has type `Vec`, which does not implement the `Copy` trait - | | - | captured outer variable + | - captured outer variable LL | call(|| { | -- captured by this `Fn` closure LL | y.into_iter(); | ^ ----------- `y` moved due to this method call | | - | `y` is moved here + | move occurs because `y` has type `Vec`, which does not implement the `Copy` trait | note: `into_iter` takes ownership of the receiver `self`, which moves `y` --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL diff --git a/tests/ui/span/borrowck-call-is-borrow-issue-12224.stderr b/tests/ui/span/borrowck-call-is-borrow-issue-12224.stderr index 287616924139..f37dc320fa31 100644 --- a/tests/ui/span/borrowck-call-is-borrow-issue-12224.stderr +++ b/tests/ui/span/borrowck-call-is-borrow-issue-12224.stderr @@ -35,18 +35,14 @@ LL | fn test4(f: &mut Test) { error[E0507]: cannot move out of `f`, a captured variable in an `FnMut` closure --> $DIR/borrowck-call-is-borrow-issue-12224.rs:57:13 | -LL | let mut f = move |g: Box, b: isize| { - | _________-----___- - | | | - | | captured outer variable -LL | | let _ = s.len(); -LL | | }; - | |_____- move occurs because `f` has type `{closure@$DIR/borrowck-call-is-borrow-issue-12224.rs:52:17: 52:58}`, which does not implement the `Copy` trait -LL | f(Box::new(|a| { - | --- captured by this `FnMut` closure +LL | let mut f = move |g: Box, b: isize| { + | ----- captured outer variable +... +LL | f(Box::new(|a| { + | --- captured by this `FnMut` closure LL | -LL | foo(f); - | ^ `f` is moved here +LL | foo(f); + | ^ move occurs because `f` has type `{closure@$DIR/borrowck-call-is-borrow-issue-12224.rs:52:17: 52:58}`, which does not implement the `Copy` trait | help: consider cloning the value if the performance cost is acceptable | From dafc9f9b534c8d1a50ba87f776eb1d6dfb1a7c94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Mon, 21 Jul 2025 16:23:13 +0000 Subject: [PATCH 085/139] Reduce comment verbosity --- .../src/diagnostics/move_errors.rs | 38 +++---------------- 1 file changed, 5 insertions(+), 33 deletions(-) diff --git a/compiler/rustc_borrowck/src/diagnostics/move_errors.rs b/compiler/rustc_borrowck/src/diagnostics/move_errors.rs index 40361906e042..67dce7615c0d 100644 --- a/compiler/rustc_borrowck/src/diagnostics/move_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/move_errors.rs @@ -629,43 +629,15 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { use_span = match self.infcx.tcx.parent_hir_node(upvar_hir_id) { hir::Node::Param(param) => { // Instead of pointing at the path where we access the value within a - // closure, we point at the type on the parameter from the definition - // of the outer function: - // - // error[E0507]: cannot move out of `foo`, a captured - // variable in an `Fn` closure - // --> file.rs:14:25 - // | - // 13 | fn do_stuff(foo: Option) { - // | --- ----------- move occurs because `foo` has type - // | | `Option`, which does not - // | | implement the `Copy` trait - // | captured outer variable - // 14 | require_fn_trait(|| async { - // | -- ^^^^^ `foo` is moved here - // | | - // | captured by this `Fn` closure - // 15 | if foo.map_or(false, |f| f.foo()) { - // | --- variable moved due to use in coroutine + // closure, we point at the type of the outer `fn` argument. param.ty_span } hir::Node::LetStmt(stmt) => match (stmt.ty, stmt.init) { - // 13 | fn do_stuff(foo: Option) { - // 14 | let foo: Option = foo; - // | --- ----------- move occurs because `foo` has type - // | | `Option`, which does not implement - // | | the `Copy` trait - // | captured outer variable + // We point at the type of the outer let-binding. (Some(ty), _) => ty.span, - // 13 | fn do_stuff(bar: Option) { - // 14 | let foo = bar; - // | --- --- move occurs because `foo` has type - // | | `Option`, which does not implement the - // | | `Copy` trait - // | captured outer variable - // - // We don't want the case where the initializer is something that spans - // multiple lines, like a closure, as the ASCII art gets messy. + // We point at the initializer of the outer let-binding, but only if it + // isn't something that spans multiple lines, like a closure, as the + // ASCII art gets messy. (None, Some(init)) if !self.infcx.tcx.sess.source_map().is_multiline(init.span) => { From dad96b107c0dd35ce2eecfaecc0e6af4988b3bb4 Mon Sep 17 00:00:00 2001 From: Noratrieb <48135649+Noratrieb@users.noreply.github.com> Date: Sun, 20 Jul 2025 14:35:43 +0200 Subject: [PATCH 086/139] Use serde for target spec json deserialize The previous manual parsing of `serde_json::Value` was a lot of complicated code and extremely error-prone. It was full of janky behavior like sometimes ignoring type errors, sometimes erroring for type errors, sometimes warning for type errors, and sometimes just ICEing for type errors (the icing on the top). Additionally, many of the error messages about allowed values were out of date because they were in a completely different place than the FromStr impls. Overall, the system caused confusion for users. I also found the old deserialization code annoying to read. Whenever a `key!` invocation was found, one had to first look for the right macro arm, and no go to definition could help. This PR replaces all this manual parsing with a 2-step process involving serde. First, the string is parsed into a `TargetSpecJson` struct. This struct is a 1:1 representation of the spec JSON. It already parses all the enums and is very simple to read and write. Then, the fields from this struct are copied into the actual `Target`. The reason for this two-step process instead of just serializing into a `Target` is because of a few reasons 1. There are a few transformations performed between the two formats 2. The default logic is implemented this way. Otherwise all the default field values would have to be spelled out again, which is suboptimal. With this logic, they fall out naturally, because everything in the json struct is an `Option`. Overall, the mapping is pretty simple, with the vast majority of fields just doing a 1:1 mapping that is captured by two macros. I have deliberately avoided making the macros generic to keep them simple. All the `FromStr` impls now have the error message right inside them, which increases the chance of it being up to date. Some "`from_str`" impls were turned into proper `FromStr` impls to support this. The new code is much less involved, delegating all the JSON parsing logic to serde, without any manual type matching. This change introduces a few breaking changes for consumers. While it is possible to use this format on stable, it is very much subject to change, so breaking changes are expected. The hope is also that because of the way stricter behavior, breaking changes are easier to deal with, as they come with clearer error messages. 1. Invalid types now always error, everywhere. Previously, they would sometimes error, and sometimes just be ignored (which meant the users JSON was still broken, just silently!) 2. This now makes use of `deny_unknown_fields` instead of just warning on unused fields, which was done previously. Serde doesn't make it easy to get such warning behavior, which was the primary reason that this now changed. But I think error behavior is very reasonable too. If someone has random stale fields in their JSON, it is likely because these fields did something at some point but no longer do, and the user likely wants to be informed of this so they can figure out what to do. This is also relevant for the future. If we remove a field but someone has it set, it probably makes sense for them to take a look whether they need this and should look for alternatives, or whether they can just delete it. Overall, the JSON is made more explicit. This is the only expected breakage, but there could also be small breakage from small mistakes. All targets roundtrip though, so it can't be anything too major. --- Cargo.lock | 13 + compiler/rustc_session/src/config.rs | 4 +- compiler/rustc_session/src/options.rs | 2 +- compiler/rustc_target/Cargo.toml | 3 + compiler/rustc_target/src/json.rs | 15 + compiler/rustc_target/src/spec/json.rs | 1029 ++++++----------- compiler/rustc_target/src/spec/mod.rs | 388 ++++--- compiler/rustc_target/src/tests.rs | 50 +- src/librustdoc/doctest.rs | 2 +- src/tools/tidy/src/deps.rs | 1 + .../rustdoc-target-spec-json-path/target.json | 1 - .../target-specs/endianness-mismatch.json | 1 - .../target-specs/my-awesome-platform.json | 4 +- .../target-specs/my-incomplete-platform.json | 4 +- .../my-x86_64-unknown-linux-gnu-platform.json | 4 +- .../target-specs/require-explicit-cpu.json | 1 - tests/run-make/target-specs/rmake.rs | 4 +- tests/ui/check-cfg/my-awesome-platform.json | 1 - tests/ui/codegen/mismatched-data-layout.json | 1 - tests/ui/codegen/mismatched-data-layouts.rs | 1 + .../ui/codegen/mismatched-data-layouts.stderr | 2 +- 21 files changed, 680 insertions(+), 851 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7d2fca8bb3f4..1537a6071862 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4499,7 +4499,10 @@ dependencies = [ "rustc_macros", "rustc_serialize", "rustc_span", + "serde", + "serde_derive", "serde_json", + "serde_path_to_error", "tracing", ] @@ -4870,6 +4873,16 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_path_to_error" +version = "0.1.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59fab13f937fa393d08645bf3a84bdfe86e296747b506ada67bb15f10f218b2a" +dependencies = [ + "itoa", + "serde", +] + [[package]] name = "serde_spanned" version = "0.6.9" diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs index d6215e1de043..190cb6c5e038 100644 --- a/compiler/rustc_session/src/config.rs +++ b/compiler/rustc_session/src/config.rs @@ -336,12 +336,12 @@ impl LinkSelfContained { if let Some(component_to_enable) = component.strip_prefix('+') { self.explicitly_set = None; self.enabled_components - .insert(LinkSelfContainedComponents::from_str(component_to_enable)?); + .insert(LinkSelfContainedComponents::from_str(component_to_enable).ok()?); Some(()) } else if let Some(component_to_disable) = component.strip_prefix('-') { self.explicitly_set = None; self.disabled_components - .insert(LinkSelfContainedComponents::from_str(component_to_disable)?); + .insert(LinkSelfContainedComponents::from_str(component_to_disable).ok()?); Some(()) } else { None diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs index 2bdde2f887a3..313eec6268d3 100644 --- a/compiler/rustc_session/src/options.rs +++ b/compiler/rustc_session/src/options.rs @@ -1295,7 +1295,7 @@ pub mod parse { } pub(crate) fn parse_linker_flavor(slot: &mut Option, v: Option<&str>) -> bool { - match v.and_then(LinkerFlavorCli::from_str) { + match v.and_then(|v| LinkerFlavorCli::from_str(v).ok()) { Some(lf) => *slot = Some(lf), _ => return false, } diff --git a/compiler/rustc_target/Cargo.toml b/compiler/rustc_target/Cargo.toml index 0121c752dbdd..56932c24922e 100644 --- a/compiler/rustc_target/Cargo.toml +++ b/compiler/rustc_target/Cargo.toml @@ -12,7 +12,10 @@ rustc_fs_util = { path = "../rustc_fs_util" } rustc_macros = { path = "../rustc_macros" } rustc_serialize = { path = "../rustc_serialize" } rustc_span = { path = "../rustc_span" } +serde = "1.0.219" +serde_derive = "1.0.219" serde_json = "1.0.59" +serde_path_to_error = "0.1.17" tracing = "0.1" # tidy-alphabetical-end diff --git a/compiler/rustc_target/src/json.rs b/compiler/rustc_target/src/json.rs index 4fcc477921ba..896609bdbe3a 100644 --- a/compiler/rustc_target/src/json.rs +++ b/compiler/rustc_target/src/json.rs @@ -114,3 +114,18 @@ impl ToJson for rustc_abi::CanonAbi { self.to_string().to_json() } } + +macro_rules! serde_deserialize_from_str { + ($ty:ty) => { + impl<'de> serde::Deserialize<'de> for $ty { + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let s = String::deserialize(deserializer)?; + FromStr::from_str(&s).map_err(serde::de::Error::custom) + } + } + }; +} +pub(crate) use serde_deserialize_from_str; diff --git a/compiler/rustc_target/src/spec/json.rs b/compiler/rustc_target/src/spec/json.rs index 6c716f871253..d27c1929aef7 100644 --- a/compiler/rustc_target/src/spec/json.rs +++ b/compiler/rustc_target/src/spec/json.rs @@ -1,60 +1,47 @@ -use std::borrow::Cow; use std::collections::BTreeMap; use std::str::FromStr; -use rustc_abi::{Align, AlignFromBytesError, ExternAbi}; -use serde_json::Value; +use rustc_abi::{Align, AlignFromBytesError}; -use super::{Target, TargetKind, TargetOptions, TargetWarnings}; +use super::crt_objects::CrtObjects; +use super::{ + BinaryFormat, CodeModel, DebuginfoKind, FloatAbi, FramePointer, LinkArgsCli, + LinkSelfContainedComponents, LinkSelfContainedDefault, LinkerFlavorCli, LldFlavor, + MergeFunctions, PanicStrategy, RelocModel, RelroLevel, RustcAbi, SanitizerSet, + SmallDataThresholdSupport, SplitDebuginfo, StackProbeType, StaticCow, SymbolVisibility, Target, + TargetKind, TargetOptions, TargetWarnings, TlsModel, +}; use crate::json::{Json, ToJson}; use crate::spec::AbiMap; impl Target { /// Loads a target descriptor from a JSON object. - pub fn from_json(obj: Json) -> Result<(Target, TargetWarnings), String> { - // While ugly, this code must remain this way to retain - // compatibility with existing JSON fields and the internal - // expected naming of the Target and TargetOptions structs. - // To ensure compatibility is retained, the built-in targets - // are round-tripped through this code to catch cases where - // the JSON parser is not updated to match the structs. + pub fn from_json(json: &str) -> Result<(Target, TargetWarnings), String> { + let json_deserializer = &mut serde_json::Deserializer::from_str(json); - let mut obj = match obj { - Value::Object(obj) => obj, - _ => return Err("Expected JSON object for target")?, - }; - - let mut get_req_field = |name: &str| { - obj.remove(name) - .and_then(|j| j.as_str().map(str::to_string)) - .ok_or_else(|| format!("Field {name} in target specification is required")) - }; + let json: TargetSpecJson = + serde_path_to_error::deserialize(json_deserializer).map_err(|err| err.to_string())?; let mut base = Target { - llvm_target: get_req_field("llvm-target")?.into(), + llvm_target: json.llvm_target, metadata: Default::default(), - pointer_width: get_req_field("target-pointer-width")? - .parse::() - .map_err(|_| "target-pointer-width must be an integer".to_string())?, - data_layout: get_req_field("data-layout")?.into(), - arch: get_req_field("arch")?.into(), + pointer_width: json + .target_pointer_width + .parse() + .map_err(|err| format!("invalid target-pointer-width: {err}"))?, + data_layout: json.data_layout, + arch: json.arch, options: Default::default(), }; // FIXME: This doesn't properly validate anything and just ignores the data if it's invalid. // That's okay for now, the only use of this is when generating docs, which we don't do for // custom targets. - if let Some(Json::Object(mut metadata)) = obj.remove("metadata") { - base.metadata.description = metadata - .remove("description") - .and_then(|desc| desc.as_str().map(|desc| desc.to_owned().into())); - base.metadata.tier = metadata - .remove("tier") - .and_then(|tier| tier.as_u64()) - .filter(|tier| (1..=3).contains(tier)); - base.metadata.host_tools = - metadata.remove("host_tools").and_then(|host| host.as_bool()); - base.metadata.std = metadata.remove("std").and_then(|host| host.as_bool()); + if let Some(metadata) = json.metadata { + base.metadata.description = metadata.description; + base.metadata.tier = metadata.tier.filter(|tier| (1..=3).contains(tier)); + base.metadata.host_tools = metadata.host_tools; + base.metadata.std = metadata.std; } let alignment_error = |field_name: &str, error: AlignFromBytesError| -> String { @@ -65,640 +52,188 @@ impl Target { format!("`{}` bits is not a valid value for {field_name}: {msg}", error.align() * 8) }; - let mut incorrect_type = vec![]; - - macro_rules! key { - ($key_name:ident) => ( { - let name = (stringify!($key_name)).replace("_", "-"); - if let Some(s) = obj.remove(&name).and_then(|s| s.as_str().map(str::to_string).map(Cow::from)) { - base.$key_name = s; + macro_rules! forward { + ($name:ident) => { + if let Some($name) = json.$name { + base.$name = $name; } - } ); - ($key_name:ident = $json_name:expr) => ( { - let name = $json_name; - if let Some(s) = obj.remove(name).and_then(|s| s.as_str().map(str::to_string).map(Cow::from)) { - base.$key_name = s; + }; + } + macro_rules! forward_opt { + ($name:ident) => { + if let Some($name) = json.$name { + base.$name = Some($name); } - } ); - ($key_name:ident = $json_name:expr, u64 as $int_ty:ty) => ( { - let name = $json_name; - if let Some(s) = obj.remove(name).and_then(|b| b.as_u64()) { - base.$key_name = s as $int_ty; - } - } ); - ($key_name:ident, bool) => ( { - let name = (stringify!($key_name)).replace("_", "-"); - if let Some(s) = obj.remove(&name).and_then(|b| b.as_bool()) { - base.$key_name = s; - } - } ); - ($key_name:ident = $json_name:expr, bool) => ( { - let name = $json_name; - if let Some(s) = obj.remove(name).and_then(|b| b.as_bool()) { - base.$key_name = s; - } - } ); - ($key_name:ident, u32) => ( { - let name = (stringify!($key_name)).replace("_", "-"); - if let Some(s) = obj.remove(&name).and_then(|b| b.as_u64()) { - if s < 1 || s > 5 { - return Err("Not a valid DWARF version number".into()); - } - base.$key_name = s as u32; - } - } ); - ($key_name:ident, Option) => ( { - let name = (stringify!($key_name)).replace("_", "-"); - if let Some(s) = obj.remove(&name).and_then(|b| b.as_bool()) { - base.$key_name = Some(s); - } - } ); - ($key_name:ident, Option) => ( { - let name = (stringify!($key_name)).replace("_", "-"); - if let Some(s) = obj.remove(&name).and_then(|b| b.as_u64()) { - base.$key_name = Some(s); - } - } ); - ($key_name:ident, Option>) => ( { - let name = (stringify!($key_name)).replace("_", "-"); - if let Some(s) = obj.remove(&name).and_then(|b| Some(b.as_str()?.to_string())) { - base.$key_name = Some(s.into()); - } - } ); - ($key_name:ident, Option) => ( { - let name = (stringify!($key_name)).replace("_", "-"); - if let Some(b) = obj.remove(&name).and_then(|b| b.as_u64()) { - match Align::from_bits(b) { - Ok(align) => base.$key_name = Some(align), - Err(e) => return Err(alignment_error(&name, e)), - } - } - } ); - ($key_name:ident, BinaryFormat) => ( { - let name = (stringify!($key_name)).replace("_", "-"); - obj.remove(&name).and_then(|f| f.as_str().and_then(|s| { - match s.parse::() { - Ok(binary_format) => base.$key_name = binary_format, - _ => return Some(Err(format!( - "'{s}' is not a valid value for binary_format. \ - Use 'coff', 'elf', 'mach-o', 'wasm' or 'xcoff' " - ))), - } - Some(Ok(())) - })).unwrap_or(Ok(())) - } ); - ($key_name:ident, MergeFunctions) => ( { - let name = (stringify!($key_name)).replace("_", "-"); - obj.remove(&name).and_then(|o| o.as_str().and_then(|s| { - match s.parse::() { - Ok(mergefunc) => base.$key_name = mergefunc, - _ => return Some(Err(format!("'{}' is not a valid value for \ - merge-functions. Use 'disabled', \ - 'trampolines', or 'aliases'.", - s))), - } - Some(Ok(())) - })).unwrap_or(Ok(())) - } ); - ($key_name:ident, FloatAbi) => ( { - let name = (stringify!($key_name)).replace("_", "-"); - obj.remove(&name).and_then(|o| o.as_str().and_then(|s| { - match s.parse::() { - Ok(float_abi) => base.$key_name = Some(float_abi), - _ => return Some(Err(format!("'{}' is not a valid value for \ - llvm-floatabi. Use 'soft' or 'hard'.", - s))), - } - Some(Ok(())) - })).unwrap_or(Ok(())) - } ); - ($key_name:ident, RustcAbi) => ( { - let name = (stringify!($key_name)).replace("_", "-"); - obj.remove(&name).and_then(|o| o.as_str().and_then(|s| { - match s.parse::() { - Ok(rustc_abi) => base.$key_name = Some(rustc_abi), - _ => return Some(Err(format!( - "'{s}' is not a valid value for rustc-abi. \ - Use 'x86-softfloat' or leave the field unset." - ))), - } - Some(Ok(())) - })).unwrap_or(Ok(())) - } ); - ($key_name:ident, RelocModel) => ( { - let name = (stringify!($key_name)).replace("_", "-"); - obj.remove(&name).and_then(|o| o.as_str().and_then(|s| { - match s.parse::() { - Ok(relocation_model) => base.$key_name = relocation_model, - _ => return Some(Err(format!("'{}' is not a valid relocation model. \ - Run `rustc --print relocation-models` to \ - see the list of supported values.", s))), - } - Some(Ok(())) - })).unwrap_or(Ok(())) - } ); - ($key_name:ident, CodeModel) => ( { - let name = (stringify!($key_name)).replace("_", "-"); - obj.remove(&name).and_then(|o| o.as_str().and_then(|s| { - match s.parse::() { - Ok(code_model) => base.$key_name = Some(code_model), - _ => return Some(Err(format!("'{}' is not a valid code model. \ - Run `rustc --print code-models` to \ - see the list of supported values.", s))), - } - Some(Ok(())) - })).unwrap_or(Ok(())) - } ); - ($key_name:ident, TlsModel) => ( { - let name = (stringify!($key_name)).replace("_", "-"); - obj.remove(&name).and_then(|o| o.as_str().and_then(|s| { - match s.parse::() { - Ok(tls_model) => base.$key_name = tls_model, - _ => return Some(Err(format!("'{}' is not a valid TLS model. \ - Run `rustc --print tls-models` to \ - see the list of supported values.", s))), - } - Some(Ok(())) - })).unwrap_or(Ok(())) - } ); - ($key_name:ident, SmallDataThresholdSupport) => ( { - obj.remove("small-data-threshold-support").and_then(|o| o.as_str().and_then(|s| { - match s.parse::() { - Ok(support) => base.small_data_threshold_support = support, - _ => return Some(Err(format!("'{s}' is not a valid value for small-data-threshold-support."))), - } - Some(Ok(())) - })).unwrap_or(Ok(())) - } ); - ($key_name:ident, PanicStrategy) => ( { - let name = (stringify!($key_name)).replace("_", "-"); - obj.remove(&name).and_then(|o| o.as_str().and_then(|s| { - match s { - "unwind" => base.$key_name = super::PanicStrategy::Unwind, - "abort" => base.$key_name = super::PanicStrategy::Abort, - _ => return Some(Err(format!("'{}' is not a valid value for \ - panic-strategy. Use 'unwind' or 'abort'.", - s))), - } - Some(Ok(())) - })).unwrap_or(Ok(())) - } ); - ($key_name:ident, RelroLevel) => ( { - let name = (stringify!($key_name)).replace("_", "-"); - obj.remove(&name).and_then(|o| o.as_str().and_then(|s| { - match s.parse::() { - Ok(level) => base.$key_name = level, - _ => return Some(Err(format!("'{}' is not a valid value for \ - relro-level. Use 'full', 'partial, or 'off'.", - s))), - } - Some(Ok(())) - })).unwrap_or(Ok(())) - } ); - ($key_name:ident, Option) => ( { - let name = (stringify!($key_name)).replace("_", "-"); - obj.remove(&name).and_then(|o| o.as_str().and_then(|s| { - match s.parse::() { - Ok(level) => base.$key_name = Some(level), - _ => return Some(Err(format!("'{}' is not a valid value for \ - symbol-visibility. Use 'hidden', 'protected, or 'interposable'.", - s))), - } - Some(Ok(())) - })).unwrap_or(Ok(())) - } ); - ($key_name:ident, DebuginfoKind) => ( { - let name = (stringify!($key_name)).replace("_", "-"); - obj.remove(&name).and_then(|o| o.as_str().and_then(|s| { - match s.parse::() { - Ok(level) => base.$key_name = level, - _ => return Some(Err( - format!("'{s}' is not a valid value for debuginfo-kind. Use 'dwarf', \ - 'dwarf-dsym' or 'pdb'.") - )), - } - Some(Ok(())) - })).unwrap_or(Ok(())) - } ); - ($key_name:ident, SplitDebuginfo) => ( { - let name = (stringify!($key_name)).replace("_", "-"); - obj.remove(&name).and_then(|o| o.as_str().and_then(|s| { - match s.parse::() { - Ok(level) => base.$key_name = level, - _ => return Some(Err(format!("'{}' is not a valid value for \ - split-debuginfo. Use 'off' or 'dsymutil'.", - s))), - } - Some(Ok(())) - })).unwrap_or(Ok(())) - } ); - ($key_name:ident, list) => ( { - let name = (stringify!($key_name)).replace("_", "-"); - if let Some(j) = obj.remove(&name) { - if let Some(v) = j.as_array() { - base.$key_name = v.iter() - .map(|a| a.as_str().unwrap().to_string().into()) - .collect(); - } else { - incorrect_type.push(name) - } - } - } ); - ($key_name:ident, opt_list) => ( { - let name = (stringify!($key_name)).replace("_", "-"); - if let Some(j) = obj.remove(&name) { - if let Some(v) = j.as_array() { - base.$key_name = Some(v.iter() - .map(|a| a.as_str().unwrap().to_string().into()) - .collect()); - } else { - incorrect_type.push(name) - } - } - } ); - ($key_name:ident, fallible_list) => ( { - let name = (stringify!($key_name)).replace("_", "-"); - obj.remove(&name).and_then(|j| { - if let Some(v) = j.as_array() { - match v.iter().map(|a| FromStr::from_str(a.as_str().unwrap())).collect() { - Ok(l) => { base.$key_name = l }, - // FIXME: `fallible_list` can't re-use the `key!` macro for list - // elements and the error messages from that macro, so it has a bad - // generic message instead - Err(_) => return Some(Err( - format!("`{:?}` is not a valid value for `{}`", j, name) - )), - } - } else { - incorrect_type.push(name) - } - Some(Ok(())) - }).unwrap_or(Ok(())) - } ); - ($key_name:ident, optional) => ( { - let name = (stringify!($key_name)).replace("_", "-"); - if let Some(o) = obj.remove(&name) { - base.$key_name = o - .as_str() - .map(|s| s.to_string().into()); - } - } ); - ($key_name:ident = $json_name:expr, LldFlavor) => ( { - let name = $json_name; - obj.remove(name).and_then(|o| o.as_str().and_then(|s| { - if let Some(flavor) = super::LldFlavor::from_str(&s) { - base.$key_name = flavor; - } else { - return Some(Err(format!( - "'{}' is not a valid value for lld-flavor. \ - Use 'darwin', 'gnu', 'link' or 'wasm'.", - s))) - } - Some(Ok(())) - })).unwrap_or(Ok(())) - } ); - ($key_name:ident = $json_name:expr, LinkerFlavorCli) => ( { - let name = $json_name; - obj.remove(name).and_then(|o| o.as_str().and_then(|s| { - match super::LinkerFlavorCli::from_str(s) { - Some(linker_flavor) => base.$key_name = linker_flavor, - _ => return Some(Err(format!("'{}' is not a valid value for linker-flavor. \ - Use {}", s, super::LinkerFlavorCli::one_of()))), - } - Some(Ok(())) - })).unwrap_or(Ok(())) - } ); - ($key_name:ident, StackProbeType) => ( { - let name = (stringify!($key_name)).replace("_", "-"); - obj.remove(&name).and_then(|o| match super::StackProbeType::from_json(&o) { - Ok(v) => { - base.$key_name = v; - Some(Ok(())) - }, - Err(s) => Some(Err( - format!("`{:?}` is not a valid value for `{}`: {}", o, name, s) - )), - }).unwrap_or(Ok(())) - } ); - ($key_name:ident, SanitizerSet) => ( { - let name = (stringify!($key_name)).replace("_", "-"); - if let Some(o) = obj.remove(&name) { - if let Some(a) = o.as_array() { - for s in a { - use super::SanitizerSet; - base.$key_name |= match s.as_str() { - Some("address") => SanitizerSet::ADDRESS, - Some("cfi") => SanitizerSet::CFI, - Some("dataflow") => SanitizerSet::DATAFLOW, - Some("kcfi") => SanitizerSet::KCFI, - Some("kernel-address") => SanitizerSet::KERNELADDRESS, - Some("leak") => SanitizerSet::LEAK, - Some("memory") => SanitizerSet::MEMORY, - Some("memtag") => SanitizerSet::MEMTAG, - Some("safestack") => SanitizerSet::SAFESTACK, - Some("shadow-call-stack") => SanitizerSet::SHADOWCALLSTACK, - Some("thread") => SanitizerSet::THREAD, - Some("hwaddress") => SanitizerSet::HWADDRESS, - Some(s) => return Err(format!("unknown sanitizer {}", s)), - _ => return Err(format!("not a string: {:?}", s)), - }; - } - } else { - incorrect_type.push(name) - } - } - Ok::<(), String>(()) - } ); - ($key_name:ident, link_self_contained_components) => ( { - // Skeleton of what needs to be parsed: - // - // ``` - // $name: { - // "components": [ - // - // ] - // } - // ``` - let name = (stringify!($key_name)).replace("_", "-"); - if let Some(o) = obj.remove(&name) { - if let Some(o) = o.as_object() { - let component_array = o.get("components") - .ok_or_else(|| format!("{name}: expected a \ - JSON object with a `components` field."))?; - let component_array = component_array.as_array() - .ok_or_else(|| format!("{name}.components: expected a JSON array"))?; - let mut components = super::LinkSelfContainedComponents::empty(); - for s in component_array { - components |= match s.as_str() { - Some(s) => { - super::LinkSelfContainedComponents::from_str(s) - .ok_or_else(|| format!("unknown \ - `-Clink-self-contained` component: {s}"))? - }, - _ => return Err(format!("not a string: {:?}", s)), - }; - } - base.$key_name = super::LinkSelfContainedDefault::WithComponents(components); - } else { - incorrect_type.push(name) - } - } - Ok::<(), String>(()) - } ); - ($key_name:ident = $json_name:expr, link_self_contained_backwards_compatible) => ( { - let name = $json_name; - obj.remove(name).and_then(|o| o.as_str().and_then(|s| { - match s.parse::() { - Ok(lsc_default) => base.$key_name = lsc_default, - _ => return Some(Err(format!("'{}' is not a valid `-Clink-self-contained` default. \ - Use 'false', 'true', 'musl' or 'mingw'", s))), - } - Some(Ok(())) - })).unwrap_or(Ok(())) - } ); - ($key_name:ident = $json_name:expr, link_objects) => ( { - let name = $json_name; - if let Some(val) = obj.remove(name) { - let obj = val.as_object().ok_or_else(|| format!("{}: expected a \ - JSON object with fields per CRT object kind.", name))?; - let mut args = super::CrtObjects::new(); - for (k, v) in obj { - let kind = super::LinkOutputKind::from_str(&k).ok_or_else(|| { - format!("{}: '{}' is not a valid value for CRT object kind. \ - Use '(dynamic,static)-(nopic,pic)-exe' or \ - '(dynamic,static)-dylib' or 'wasi-reactor-exe'", name, k) - })?; - - let v = v.as_array().ok_or_else(|| - format!("{}.{}: expected a JSON array", name, k) - )?.iter().enumerate() - .map(|(i,s)| { - let s = s.as_str().ok_or_else(|| - format!("{}.{}[{}]: expected a JSON string", name, k, i))?; - Ok(s.to_string().into()) - }) - .collect::, String>>()?; - - args.insert(kind, v); - } - base.$key_name = args; - } - } ); - ($key_name:ident = $json_name:expr, link_args) => ( { - let name = $json_name; - if let Some(val) = obj.remove(name) { - let obj = val.as_object().ok_or_else(|| format!("{}: expected a \ - JSON object with fields per linker-flavor.", name))?; - let mut args = super::LinkArgsCli::new(); - for (k, v) in obj { - let flavor = super::LinkerFlavorCli::from_str(&k).ok_or_else(|| { - format!("{}: '{}' is not a valid value for linker-flavor. \ - Use 'em', 'gcc', 'ld' or 'msvc'", name, k) - })?; - - let v = v.as_array().ok_or_else(|| - format!("{}.{}: expected a JSON array", name, k) - )?.iter().enumerate() - .map(|(i,s)| { - let s = s.as_str().ok_or_else(|| - format!("{}.{}[{}]: expected a JSON string", name, k, i))?; - Ok(s.to_string().into()) - }) - .collect::, String>>()?; - - args.insert(flavor, v); - } - base.$key_name = args; - } - } ); - ($key_name:ident, env) => ( { - let name = (stringify!($key_name)).replace("_", "-"); - if let Some(o) = obj.remove(&name) { - if let Some(a) = o.as_array() { - for o in a { - if let Some(s) = o.as_str() { - if let [k, v] = *s.split('=').collect::>() { - base.$key_name - .to_mut() - .push((k.to_string().into(), v.to_string().into())) - } - } - } - } else { - incorrect_type.push(name) - } - } - } ); - ($key_name:ident, target_families) => ( { - if let Some(value) = obj.remove("target-family") { - if let Some(v) = value.as_array() { - base.$key_name = v.iter() - .map(|a| a.as_str().unwrap().to_string().into()) - .collect(); - } else if let Some(v) = value.as_str() { - base.$key_name = vec![v.to_string().into()].into(); - } - } - } ); + }; } - if let Some(j) = obj.remove("target-endian") { - if let Some(s) = j.as_str() { - base.endian = s.parse()?; - } else { - incorrect_type.push("target-endian".into()) - } + if let Some(target_endian) = json.target_endian { + base.endian = target_endian.0; } - if let Some(fp) = obj.remove("frame-pointer") { - if let Some(s) = fp.as_str() { - base.frame_pointer = s - .parse() - .map_err(|()| format!("'{s}' is not a valid value for frame-pointer"))?; - } else { - incorrect_type.push("frame-pointer".into()) - } - } + forward!(frame_pointer); + forward!(c_int_width); + forward_opt!(c_enum_min_bits); // if None, matches c_int_width + forward!(os); + forward!(env); + forward!(abi); + forward!(vendor); + forward_opt!(linker); + forward!(linker_flavor_json); + forward!(lld_flavor_json); + forward!(linker_is_gnu_json); + forward!(pre_link_objects); + forward!(post_link_objects); + forward!(pre_link_objects_self_contained); + forward!(post_link_objects_self_contained); - key!(c_int_width = "target-c-int-width", u64 as u16); - key!(c_enum_min_bits, Option); // if None, matches c_int_width - key!(os); - key!(env); - key!(abi); - key!(vendor); - key!(linker, optional); - key!(linker_flavor_json = "linker-flavor", LinkerFlavorCli)?; - key!(lld_flavor_json = "lld-flavor", LldFlavor)?; - key!(linker_is_gnu_json = "linker-is-gnu", bool); - key!(pre_link_objects = "pre-link-objects", link_objects); - key!(post_link_objects = "post-link-objects", link_objects); - key!(pre_link_objects_self_contained = "pre-link-objects-fallback", link_objects); - key!(post_link_objects_self_contained = "post-link-objects-fallback", link_objects); // Deserializes the backwards-compatible variants of `-Clink-self-contained` - key!( - link_self_contained = "crt-objects-fallback", - link_self_contained_backwards_compatible - )?; + if let Some(link_self_contained) = json.link_self_contained_backwards_compatible { + base.link_self_contained = link_self_contained; + } // Deserializes the components variant of `-Clink-self-contained` - key!(link_self_contained, link_self_contained_components)?; - key!(pre_link_args_json = "pre-link-args", link_args); - key!(late_link_args_json = "late-link-args", link_args); - key!(late_link_args_dynamic_json = "late-link-args-dynamic", link_args); - key!(late_link_args_static_json = "late-link-args-static", link_args); - key!(post_link_args_json = "post-link-args", link_args); - key!(link_script, optional); - key!(link_env, env); - key!(link_env_remove, list); - key!(asm_args, list); - key!(cpu); - key!(need_explicit_cpu, bool); - key!(features); - key!(dynamic_linking, bool); - key!(direct_access_external_data, Option); - key!(dll_tls_export, bool); - key!(only_cdylib, bool); - key!(executables, bool); - key!(relocation_model, RelocModel)?; - key!(code_model, CodeModel)?; - key!(tls_model, TlsModel)?; - key!(disable_redzone, bool); - key!(function_sections, bool); - key!(dll_prefix); - key!(dll_suffix); - key!(exe_suffix); - key!(staticlib_prefix); - key!(staticlib_suffix); - key!(families, target_families); - key!(abi_return_struct_as_int, bool); - key!(is_like_aix, bool); - key!(is_like_darwin, bool); - key!(is_like_solaris, bool); - key!(is_like_windows, bool); - key!(is_like_msvc, bool); - key!(is_like_wasm, bool); - key!(is_like_android, bool); - key!(binary_format, BinaryFormat)?; - key!(default_dwarf_version, u32); - key!(allows_weak_linkage, bool); - key!(has_rpath, bool); - key!(no_default_libraries, bool); - key!(position_independent_executables, bool); - key!(static_position_independent_executables, bool); - key!(plt_by_default, bool); - key!(relro_level, RelroLevel)?; - key!(archive_format); - key!(allow_asm, bool); - key!(main_needs_argc_argv, bool); - key!(has_thread_local, bool); - key!(obj_is_bitcode, bool); - key!(bitcode_llvm_cmdline); - key!(max_atomic_width, Option); - key!(min_atomic_width, Option); - key!(atomic_cas, bool); - key!(panic_strategy, PanicStrategy)?; - key!(crt_static_allows_dylibs, bool); - key!(crt_static_default, bool); - key!(crt_static_respected, bool); - key!(stack_probes, StackProbeType)?; - key!(min_global_align, Option); - key!(default_codegen_units, Option); - key!(default_codegen_backend, Option>); - key!(trap_unreachable, bool); - key!(requires_lto, bool); - key!(singlethread, bool); - key!(no_builtins, bool); - key!(default_visibility, Option)?; - key!(emit_debug_gdb_scripts, bool); - key!(requires_uwtable, bool); - key!(default_uwtable, bool); - key!(simd_types_indirect, bool); - key!(limit_rdylib_exports, bool); - key!(override_export_symbols, opt_list); - key!(merge_functions, MergeFunctions)?; - key!(mcount = "target-mcount"); - key!(llvm_mcount_intrinsic, optional); - key!(llvm_abiname); - key!(llvm_floatabi, FloatAbi)?; - key!(rustc_abi, RustcAbi)?; - key!(relax_elf_relocations, bool); - key!(llvm_args, list); - key!(use_ctors_section, bool); - key!(eh_frame_header, bool); - key!(has_thumb_interworking, bool); - key!(debuginfo_kind, DebuginfoKind)?; - key!(split_debuginfo, SplitDebuginfo)?; - key!(supported_split_debuginfo, fallible_list)?; - key!(supported_sanitizers, SanitizerSet)?; - key!(generate_arange_section, bool); - key!(supports_stack_protector, bool); - key!(small_data_threshold_support, SmallDataThresholdSupport)?; - key!(entry_name); - key!(supports_xray, bool); + if let Some(link_self_contained) = json.link_self_contained { + let components = link_self_contained + .components + .into_iter() + .fold(LinkSelfContainedComponents::empty(), |a, b| a | b); + base.link_self_contained = LinkSelfContainedDefault::WithComponents(components); + } + + forward!(pre_link_args_json); + forward!(late_link_args_json); + forward!(late_link_args_dynamic_json); + forward!(late_link_args_static_json); + forward!(post_link_args_json); + forward_opt!(link_script); + + if let Some(link_env) = json.link_env { + for s in link_env { + if let [k, v] = *s.split('=').collect::>() { + base.link_env.to_mut().push((k.to_string().into(), v.to_string().into())) + } else { + return Err(format!("link-env value '{s}' must be of the pattern 'KEY=VALUE'")); + } + } + } + + forward!(link_env_remove); + forward!(asm_args); + forward!(cpu); + forward!(need_explicit_cpu); + forward!(features); + forward!(dynamic_linking); + forward_opt!(direct_access_external_data); + forward!(dll_tls_export); + forward!(only_cdylib); + forward!(executables); + forward!(relocation_model); + forward_opt!(code_model); + forward!(tls_model); + forward!(disable_redzone); + forward!(function_sections); + forward!(dll_prefix); + forward!(dll_suffix); + forward!(exe_suffix); + forward!(staticlib_prefix); + forward!(staticlib_suffix); + + if let Some(target_family) = json.target_family { + match target_family { + TargetFamiliesJson::Array(families) => base.families = families, + TargetFamiliesJson::String(family) => base.families = vec![family].into(), + } + } + + forward!(abi_return_struct_as_int); + forward!(is_like_aix); + forward!(is_like_darwin); + forward!(is_like_solaris); + forward!(is_like_windows); + forward!(is_like_msvc); + forward!(is_like_wasm); + forward!(is_like_android); + forward!(binary_format); + forward!(default_dwarf_version); + forward!(allows_weak_linkage); + forward!(has_rpath); + forward!(no_default_libraries); + forward!(position_independent_executables); + forward!(static_position_independent_executables); + forward!(plt_by_default); + forward!(relro_level); + forward!(archive_format); + forward!(allow_asm); + forward!(main_needs_argc_argv); + forward!(has_thread_local); + forward!(obj_is_bitcode); + forward!(bitcode_llvm_cmdline); + forward_opt!(max_atomic_width); + forward_opt!(min_atomic_width); + forward!(atomic_cas); + forward!(panic_strategy); + forward!(crt_static_allows_dylibs); + forward!(crt_static_default); + forward!(crt_static_respected); + forward!(stack_probes); + + if let Some(min_global_align) = json.min_global_align { + match Align::from_bits(min_global_align) { + Ok(align) => base.min_global_align = Some(align), + Err(e) => return Err(alignment_error("min-global-align", e)), + } + } + + forward_opt!(default_codegen_units); + forward_opt!(default_codegen_backend); + forward!(trap_unreachable); + forward!(requires_lto); + forward!(singlethread); + forward!(no_builtins); + forward_opt!(default_visibility); + forward!(emit_debug_gdb_scripts); + forward!(requires_uwtable); + forward!(default_uwtable); + forward!(simd_types_indirect); + forward!(limit_rdylib_exports); + forward_opt!(override_export_symbols); + forward!(merge_functions); + forward!(mcount); + forward_opt!(llvm_mcount_intrinsic); + forward!(llvm_abiname); + forward_opt!(llvm_floatabi); + forward_opt!(rustc_abi); + forward!(relax_elf_relocations); + forward!(llvm_args); + forward!(use_ctors_section); + forward!(eh_frame_header); + forward!(has_thumb_interworking); + forward!(debuginfo_kind); + forward!(split_debuginfo); + forward!(supported_split_debuginfo); + + if let Some(supported_sanitizers) = json.supported_sanitizers { + base.supported_sanitizers = + supported_sanitizers.into_iter().fold(SanitizerSet::empty(), |a, b| a | b); + } + + forward!(generate_arange_section); + forward!(supports_stack_protector); + forward!(small_data_threshold_support); + forward!(entry_name); + forward!(supports_xray); // we're going to run `update_from_cli`, but that won't change the target's AbiMap // FIXME: better factor the Target definition so we enforce this on a type level let abi_map = AbiMap::from_target(&base); - - if let Some(abi_str) = obj.remove("entry-abi") { - if let Json::String(abi_str) = abi_str { - match abi_str.parse::() { - Ok(abi) => base.options.entry_abi = abi_map.canonize_abi(abi, false).unwrap(), - Err(_) => return Err(format!("{abi_str} is not a valid ExternAbi")), - } - } else { - incorrect_type.push("entry-abi".to_owned()) - } + if let Some(entry_abi) = json.entry_abi { + base.options.entry_abi = abi_map.canonize_abi(entry_abi.0, false).unwrap(); } base.update_from_cli(); base.check_consistency(TargetKind::Json)?; - // Each field should have been read using `Json::remove` so any keys remaining are unused. - let remaining_keys = obj.keys(); - Ok(( - base, - TargetWarnings { unused_fields: remaining_keys.cloned().collect(), incorrect_type }, - )) + Ok((base, TargetWarnings { unused_fields: vec![] })) } } @@ -877,3 +412,189 @@ impl ToJson for Target { Json::Object(d) } } + +#[derive(serde_derive::Deserialize)] +struct LinkSelfContainedComponentsWrapper { + components: Vec, +} + +#[derive(serde_derive::Deserialize)] +#[serde(untagged)] +enum TargetFamiliesJson { + Array(StaticCow<[StaticCow]>), + String(StaticCow), +} + +/// `Endian` is in `rustc_abi`, which doesn't have access to the macro and serde. +struct EndianWrapper(rustc_abi::Endian); +impl FromStr for EndianWrapper { + type Err = String; + fn from_str(s: &str) -> Result { + rustc_abi::Endian::from_str(s).map(Self) + } +} +crate::json::serde_deserialize_from_str!(EndianWrapper); + +/// `ExternAbi` is in `rustc_abi`, which doesn't have access to the macro and serde. +struct ExternAbiWrapper(rustc_abi::ExternAbi); +impl FromStr for ExternAbiWrapper { + type Err = String; + fn from_str(s: &str) -> Result { + rustc_abi::ExternAbi::from_str(s) + .map(Self) + .map_err(|_| format!("{s} is not a valid extern ABI")) + } +} +crate::json::serde_deserialize_from_str!(ExternAbiWrapper); + +#[derive(serde_derive::Deserialize)] +struct TargetSpecJsonMetadata { + description: Option>, + tier: Option, + host_tools: Option, + std: Option, +} + +#[derive(serde_derive::Deserialize)] +#[serde(rename_all = "kebab-case")] +// Ensure that all unexpected fields get turned into errors. +// This helps users stay up to date when the schema changes instead of silently +// ignoring their old values. +#[serde(deny_unknown_fields)] +struct TargetSpecJson { + llvm_target: StaticCow, + target_pointer_width: String, + data_layout: StaticCow, + arch: StaticCow, + + metadata: Option, + + // options: + target_endian: Option, + frame_pointer: Option, + #[serde(rename = "target-c-int-width")] + c_int_width: Option, + c_enum_min_bits: Option, + os: Option>, + env: Option>, + abi: Option>, + vendor: Option>, + linker: Option>, + #[serde(rename = "linker-flavor")] + linker_flavor_json: Option, + #[serde(rename = "lld-flavor")] + lld_flavor_json: Option, + #[serde(rename = "linker-is-gnu")] + linker_is_gnu_json: Option, + #[serde(rename = "pre-link-objects")] + pre_link_objects: Option, + #[serde(rename = "post-link-objects")] + post_link_objects: Option, + #[serde(rename = "pre-link-objects-fallback")] + pre_link_objects_self_contained: Option, + #[serde(rename = "post-link-objects-fallback")] + post_link_objects_self_contained: Option, + #[serde(rename = "crt-objects-fallback")] + link_self_contained_backwards_compatible: Option, + link_self_contained: Option, + #[serde(rename = "pre-link-args")] + pre_link_args_json: Option, + #[serde(rename = "late-link-args")] + late_link_args_json: Option, + #[serde(rename = "late-link-args-dynamic")] + late_link_args_dynamic_json: Option, + #[serde(rename = "late-link-args-static")] + late_link_args_static_json: Option, + #[serde(rename = "post-link-args")] + post_link_args_json: Option, + link_script: Option>, + link_env: Option>>, + link_env_remove: Option]>>, + asm_args: Option]>>, + cpu: Option>, + need_explicit_cpu: Option, + features: Option>, + dynamic_linking: Option, + direct_access_external_data: Option, + dll_tls_export: Option, + only_cdylib: Option, + executables: Option, + relocation_model: Option, + code_model: Option, + tls_model: Option, + disable_redzone: Option, + function_sections: Option, + dll_prefix: Option>, + dll_suffix: Option>, + exe_suffix: Option>, + staticlib_prefix: Option>, + staticlib_suffix: Option>, + target_family: Option, + abi_return_struct_as_int: Option, + is_like_aix: Option, + is_like_darwin: Option, + is_like_solaris: Option, + is_like_windows: Option, + is_like_msvc: Option, + is_like_wasm: Option, + is_like_android: Option, + binary_format: Option, + default_dwarf_version: Option, + allows_weak_linkage: Option, + has_rpath: Option, + no_default_libraries: Option, + position_independent_executables: Option, + static_position_independent_executables: Option, + plt_by_default: Option, + relro_level: Option, + archive_format: Option>, + allow_asm: Option, + main_needs_argc_argv: Option, + has_thread_local: Option, + obj_is_bitcode: Option, + bitcode_llvm_cmdline: Option>, + max_atomic_width: Option, + min_atomic_width: Option, + atomic_cas: Option, + panic_strategy: Option, + crt_static_allows_dylibs: Option, + crt_static_default: Option, + crt_static_respected: Option, + stack_probes: Option, + min_global_align: Option, + default_codegen_units: Option, + default_codegen_backend: Option>, + trap_unreachable: Option, + requires_lto: Option, + singlethread: Option, + no_builtins: Option, + default_visibility: Option, + emit_debug_gdb_scripts: Option, + requires_uwtable: Option, + default_uwtable: Option, + simd_types_indirect: Option, + limit_rdylib_exports: Option, + override_export_symbols: Option]>>, + merge_functions: Option, + #[serde(rename = "target-mcount")] + mcount: Option>, + llvm_mcount_intrinsic: Option>, + llvm_abiname: Option>, + llvm_floatabi: Option, + rustc_abi: Option, + relax_elf_relocations: Option, + llvm_args: Option]>>, + use_ctors_section: Option, + eh_frame_header: Option, + has_thumb_interworking: Option, + debuginfo_kind: Option, + split_debuginfo: Option, + supported_split_debuginfo: Option>, + supported_sanitizers: Option>, + generate_arange_section: Option, + supports_stack_protector: Option, + small_data_threshold_support: Option, + entry_name: Option>, + supports_xray: Option, + entry_abi: Option, +} diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs index 4bc0d88a910c..c64cd9a51b7d 100644 --- a/compiler/rustc_target/src/spec/mod.rs +++ b/compiler/rustc_target/src/spec/mod.rs @@ -37,6 +37,7 @@ //! //! [JSON]: https://json.org +use core::result::Result; use std::borrow::Cow; use std::collections::BTreeMap; use std::hash::{Hash, Hasher}; @@ -198,18 +199,29 @@ impl LldFlavor { LldFlavor::Link => "link", } } +} - fn from_str(s: &str) -> Option { - Some(match s { +impl FromStr for LldFlavor { + type Err = String; + + fn from_str(s: &str) -> Result { + Ok(match s { "darwin" => LldFlavor::Ld64, "gnu" => LldFlavor::Ld, "link" => LldFlavor::Link, "wasm" => LldFlavor::Wasm, - _ => return None, + _ => { + return Err( + "invalid value for lld flavor: '{s}', expected one of 'darwin', 'gnu', 'link', 'wasm'" + .into(), + ); + } }) } } +crate::json::serde_deserialize_from_str!(LldFlavor); + impl ToJson for LldFlavor { fn to_json(&self) -> Json { self.as_str().to_json() @@ -494,19 +506,23 @@ macro_rules! linker_flavor_cli_impls { concat!("one of: ", $($string, " ",)*) } - pub fn from_str(s: &str) -> Option { - Some(match s { - $($string => $($flavor)*,)* - _ => return None, - }) - } - pub fn desc(self) -> &'static str { match self { $($($flavor)* => $string,)* } } } + + impl FromStr for LinkerFlavorCli { + type Err = String; + + fn from_str(s: &str) -> Result { + Ok(match s { + $($string => $($flavor)*,)* + _ => return Err(format!("invalid linker flavor, allowed values: {}", Self::one_of())), + }) + } + } ) } @@ -540,6 +556,8 @@ linker_flavor_cli_impls! { (LinkerFlavorCli::Em) "em" } +crate::json::serde_deserialize_from_str!(LinkerFlavorCli); + impl ToJson for LinkerFlavorCli { fn to_json(&self) -> Json { self.desc().to_json() @@ -573,19 +591,26 @@ pub enum LinkSelfContainedDefault { /// Parses a backwards-compatible `-Clink-self-contained` option string, without components. impl FromStr for LinkSelfContainedDefault { - type Err = (); + type Err = String; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> Result { Ok(match s { "false" => LinkSelfContainedDefault::False, "true" | "wasm" => LinkSelfContainedDefault::True, "musl" => LinkSelfContainedDefault::InferredForMusl, "mingw" => LinkSelfContainedDefault::InferredForMingw, - _ => return Err(()), + _ => { + return Err(format!( + "'{s}' is not a valid `-Clink-self-contained` default. \ + Use 'false', 'true', 'wasm', 'musl' or 'mingw'", + )); + } }) } } +crate::json::serde_deserialize_from_str!(LinkSelfContainedDefault); + impl ToJson for LinkSelfContainedDefault { fn to_json(&self) -> Json { match *self { @@ -652,19 +677,6 @@ bitflags::bitflags! { rustc_data_structures::external_bitflags_debug! { LinkSelfContainedComponents } impl LinkSelfContainedComponents { - /// Parses a single `-Clink-self-contained` well-known component, not a set of flags. - pub fn from_str(s: &str) -> Option { - Some(match s { - "crto" => LinkSelfContainedComponents::CRT_OBJECTS, - "libc" => LinkSelfContainedComponents::LIBC, - "unwind" => LinkSelfContainedComponents::UNWIND, - "linker" => LinkSelfContainedComponents::LINKER, - "sanitizers" => LinkSelfContainedComponents::SANITIZERS, - "mingw" => LinkSelfContainedComponents::MINGW, - _ => return None, - }) - } - /// Return the component's name. /// /// Returns `None` if the bitflags aren't a singular component (but a mix of multiple flags). @@ -708,6 +720,29 @@ impl LinkSelfContainedComponents { } } +impl FromStr for LinkSelfContainedComponents { + type Err = String; + + /// Parses a single `-Clink-self-contained` well-known component, not a set of flags. + fn from_str(s: &str) -> Result { + Ok(match s { + "crto" => LinkSelfContainedComponents::CRT_OBJECTS, + "libc" => LinkSelfContainedComponents::LIBC, + "unwind" => LinkSelfContainedComponents::UNWIND, + "linker" => LinkSelfContainedComponents::LINKER, + "sanitizers" => LinkSelfContainedComponents::SANITIZERS, + "mingw" => LinkSelfContainedComponents::MINGW, + _ => { + return Err(format!( + "'{s}' is not a valid link-self-contained component, expected 'crto', 'libc', 'unwind', 'linker', 'sanitizers', 'mingw'" + )); + } + }) + } +} + +crate::json::serde_deserialize_from_str!(LinkSelfContainedComponents); + impl ToJson for LinkSelfContainedComponents { fn to_json(&self) -> Json { let components: Vec<_> = Self::all_components() @@ -821,6 +856,25 @@ impl PanicStrategy { } } +impl FromStr for PanicStrategy { + type Err = String; + fn from_str(s: &str) -> Result { + Ok(match s { + "unwind" => PanicStrategy::Unwind, + "abort" => PanicStrategy::Abort, + _ => { + return Err(format!( + "'{}' is not a valid value for \ + panic-strategy. Use 'unwind' or 'abort'.", + s + )); + } + }) + } +} + +crate::json::serde_deserialize_from_str!(PanicStrategy); + impl ToJson for PanicStrategy { fn to_json(&self) -> Json { match *self { @@ -867,18 +921,24 @@ impl SymbolVisibility { } impl FromStr for SymbolVisibility { - type Err = (); + type Err = String; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> Result { match s { "hidden" => Ok(SymbolVisibility::Hidden), "protected" => Ok(SymbolVisibility::Protected), "interposable" => Ok(SymbolVisibility::Interposable), - _ => Err(()), + _ => Err(format!( + "'{}' is not a valid value for \ + symbol-visibility. Use 'hidden', 'protected, or 'interposable'.", + s + )), } } } +crate::json::serde_deserialize_from_str!(SymbolVisibility); + impl ToJson for SymbolVisibility { fn to_json(&self) -> Json { match *self { @@ -890,19 +950,25 @@ impl ToJson for SymbolVisibility { } impl FromStr for RelroLevel { - type Err = (); + type Err = String; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> Result { match s { "full" => Ok(RelroLevel::Full), "partial" => Ok(RelroLevel::Partial), "off" => Ok(RelroLevel::Off), "none" => Ok(RelroLevel::None), - _ => Err(()), + _ => Err(format!( + "'{}' is not a valid value for \ + relro-level. Use 'full', 'partial, 'off', or 'none'.", + s + )), } } } +crate::json::serde_deserialize_from_str!(RelroLevel); + impl ToJson for RelroLevel { fn to_json(&self) -> Json { match *self { @@ -923,7 +989,7 @@ pub enum SmallDataThresholdSupport { } impl FromStr for SmallDataThresholdSupport { - type Err = (); + type Err = String; fn from_str(s: &str) -> Result { if s == "none" { @@ -935,11 +1001,13 @@ impl FromStr for SmallDataThresholdSupport { } else if let Some(arg) = s.strip_prefix("llvm-arg=") { Ok(Self::LlvmArg(arg.to_string().into())) } else { - Err(()) + Err(format!("'{s}' is not a valid value for small-data-threshold-support.")) } } } +crate::json::serde_deserialize_from_str!(SmallDataThresholdSupport); + impl ToJson for SmallDataThresholdSupport { fn to_json(&self) -> Value { match self { @@ -969,18 +1037,25 @@ impl MergeFunctions { } impl FromStr for MergeFunctions { - type Err = (); + type Err = String; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> Result { match s { "disabled" => Ok(MergeFunctions::Disabled), "trampolines" => Ok(MergeFunctions::Trampolines), "aliases" => Ok(MergeFunctions::Aliases), - _ => Err(()), + _ => Err(format!( + "'{}' is not a valid value for \ + merge-functions. Use 'disabled', \ + 'trampolines', or 'aliases'.", + s + )), } } } +crate::json::serde_deserialize_from_str!(MergeFunctions); + impl ToJson for MergeFunctions { fn to_json(&self) -> Json { match *self { @@ -1040,9 +1115,9 @@ impl RelocModel { } impl FromStr for RelocModel { - type Err = (); + type Err = String; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> Result { Ok(match s { "static" => RelocModel::Static, "pic" => RelocModel::Pic, @@ -1051,11 +1126,19 @@ impl FromStr for RelocModel { "ropi" => RelocModel::Ropi, "rwpi" => RelocModel::Rwpi, "ropi-rwpi" => RelocModel::RopiRwpi, - _ => return Err(()), + _ => { + return Err(format!( + "invalid relocation model '{s}'. + Run `rustc --print relocation-models` to \ + see the list of supported values.'" + )); + } }) } } +crate::json::serde_deserialize_from_str!(RelocModel); + impl ToJson for RelocModel { fn to_json(&self) -> Json { self.desc().to_json() @@ -1072,20 +1155,28 @@ pub enum CodeModel { } impl FromStr for CodeModel { - type Err = (); + type Err = String; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> Result { Ok(match s { "tiny" => CodeModel::Tiny, "small" => CodeModel::Small, "kernel" => CodeModel::Kernel, "medium" => CodeModel::Medium, "large" => CodeModel::Large, - _ => return Err(()), + _ => { + return Err(format!( + "'{s}' is not a valid code model. \ + Run `rustc --print code-models` to \ + see the list of supported values." + )); + } }) } } +crate::json::serde_deserialize_from_str!(CodeModel); + impl ToJson for CodeModel { fn to_json(&self) -> Json { match *self { @@ -1107,17 +1198,25 @@ pub enum FloatAbi { } impl FromStr for FloatAbi { - type Err = (); + type Err = String; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> Result { Ok(match s { "soft" => FloatAbi::Soft, "hard" => FloatAbi::Hard, - _ => return Err(()), + _ => { + return Err(format!( + "'{}' is not a valid value for \ + llvm-floatabi. Use 'soft' or 'hard'.", + s + )); + } }) } } +crate::json::serde_deserialize_from_str!(FloatAbi); + impl ToJson for FloatAbi { fn to_json(&self) -> Json { match *self { @@ -1138,17 +1237,24 @@ pub enum RustcAbi { } impl FromStr for RustcAbi { - type Err = (); + type Err = String; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> Result { Ok(match s { "x86-sse2" => RustcAbi::X86Sse2, "x86-softfloat" => RustcAbi::X86Softfloat, - _ => return Err(()), + _ => { + return Err(format!( + "'{s}' is not a valid value for rustc-abi. \ + Use 'x86-softfloat' or leave the field unset." + )); + } }) } } +crate::json::serde_deserialize_from_str!(RustcAbi); + impl ToJson for RustcAbi { fn to_json(&self) -> Json { match *self { @@ -1169,9 +1275,9 @@ pub enum TlsModel { } impl FromStr for TlsModel { - type Err = (); + type Err = String; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> Result { Ok(match s { // Note the difference "general" vs "global" difference. The model name is "general", // but the user-facing option name is "global" for consistency with other compilers. @@ -1180,11 +1286,19 @@ impl FromStr for TlsModel { "initial-exec" => TlsModel::InitialExec, "local-exec" => TlsModel::LocalExec, "emulated" => TlsModel::Emulated, - _ => return Err(()), + _ => { + return Err(format!( + "'{s}' is not a valid TLS model. \ + Run `rustc --print tls-models` to \ + see the list of supported values." + )); + } }) } } +crate::json::serde_deserialize_from_str!(TlsModel); + impl ToJson for TlsModel { fn to_json(&self) -> Json { match *self { @@ -1230,19 +1344,6 @@ impl LinkOutputKind { } } - pub(super) fn from_str(s: &str) -> Option { - Some(match s { - "dynamic-nopic-exe" => LinkOutputKind::DynamicNoPicExe, - "dynamic-pic-exe" => LinkOutputKind::DynamicPicExe, - "static-nopic-exe" => LinkOutputKind::StaticNoPicExe, - "static-pic-exe" => LinkOutputKind::StaticPicExe, - "dynamic-dylib" => LinkOutputKind::DynamicDylib, - "static-dylib" => LinkOutputKind::StaticDylib, - "wasi-reactor-exe" => LinkOutputKind::WasiReactorExe, - _ => return None, - }) - } - pub fn can_link_dylib(self) -> bool { match self { LinkOutputKind::StaticNoPicExe | LinkOutputKind::StaticPicExe => false, @@ -1255,6 +1356,31 @@ impl LinkOutputKind { } } +impl FromStr for LinkOutputKind { + type Err = String; + + fn from_str(s: &str) -> Result { + Ok(match s { + "dynamic-nopic-exe" => LinkOutputKind::DynamicNoPicExe, + "dynamic-pic-exe" => LinkOutputKind::DynamicPicExe, + "static-nopic-exe" => LinkOutputKind::StaticNoPicExe, + "static-pic-exe" => LinkOutputKind::StaticPicExe, + "dynamic-dylib" => LinkOutputKind::DynamicDylib, + "static-dylib" => LinkOutputKind::StaticDylib, + "wasi-reactor-exe" => LinkOutputKind::WasiReactorExe, + _ => { + return Err(format!( + "invalid value for CRT object kind. \ + Use '(dynamic,static)-(nopic,pic)-exe' or \ + '(dynamic,static)-dylib' or 'wasi-reactor-exe'" + )); + } + }) + } +} + +crate::json::serde_deserialize_from_str!(LinkOutputKind); + impl fmt::Display for LinkOutputKind { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.write_str(self.as_str()) @@ -1290,18 +1416,25 @@ impl DebuginfoKind { } impl FromStr for DebuginfoKind { - type Err = (); + type Err = String; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> Result { Ok(match s { "dwarf" => DebuginfoKind::Dwarf, "dwarf-dsym" => DebuginfoKind::DwarfDsym, "pdb" => DebuginfoKind::Pdb, - _ => return Err(()), + _ => { + return Err(format!( + "'{s}' is not a valid value for debuginfo-kind. Use 'dwarf', \ + 'dwarf-dsym' or 'pdb'." + )); + } }) } } +crate::json::serde_deserialize_from_str!(DebuginfoKind); + impl ToJson for DebuginfoKind { fn to_json(&self) -> Json { self.as_str().to_json() @@ -1354,18 +1487,25 @@ impl SplitDebuginfo { } impl FromStr for SplitDebuginfo { - type Err = (); + type Err = String; - fn from_str(s: &str) -> Result { + fn from_str(s: &str) -> Result { Ok(match s { "off" => SplitDebuginfo::Off, "unpacked" => SplitDebuginfo::Unpacked, "packed" => SplitDebuginfo::Packed, - _ => return Err(()), + _ => { + return Err(format!( + "'{s}' is not a valid value for \ + split-debuginfo. Use 'off', 'unpacked', or 'packed'.", + )); + } }) } } +crate::json::serde_deserialize_from_str!(SplitDebuginfo); + impl ToJson for SplitDebuginfo { fn to_json(&self) -> Json { self.as_str().to_json() @@ -1378,7 +1518,9 @@ impl fmt::Display for SplitDebuginfo { } } -#[derive(Clone, Debug, PartialEq, Eq)] +#[derive(Clone, Debug, PartialEq, Eq, serde_derive::Deserialize)] +#[serde(tag = "kind")] +#[serde(rename_all = "kebab-case")] pub enum StackProbeType { /// Don't emit any stack probes. None, @@ -1390,44 +1532,10 @@ pub enum StackProbeType { Call, /// Use inline option for LLVM versions later than specified in `min_llvm_version_for_inline` /// and call `__rust_probestack` otherwise. - InlineOrCall { min_llvm_version_for_inline: (u32, u32, u32) }, -} - -impl StackProbeType { - fn from_json(json: &Json) -> Result { - let object = json.as_object().ok_or_else(|| "expected a JSON object")?; - let kind = object - .get("kind") - .and_then(|o| o.as_str()) - .ok_or_else(|| "expected `kind` to be a string")?; - match kind { - "none" => Ok(StackProbeType::None), - "inline" => Ok(StackProbeType::Inline), - "call" => Ok(StackProbeType::Call), - "inline-or-call" => { - let min_version = object - .get("min-llvm-version-for-inline") - .and_then(|o| o.as_array()) - .ok_or_else(|| "expected `min-llvm-version-for-inline` to be an array")?; - let mut iter = min_version.into_iter().map(|v| { - let int = v.as_u64().ok_or_else( - || "expected `min-llvm-version-for-inline` values to be integers", - )?; - u32::try_from(int) - .map_err(|_| "`min-llvm-version-for-inline` values don't convert to u32") - }); - let min_llvm_version_for_inline = ( - iter.next().unwrap_or(Ok(11))?, - iter.next().unwrap_or(Ok(0))?, - iter.next().unwrap_or(Ok(0))?, - ); - Ok(StackProbeType::InlineOrCall { min_llvm_version_for_inline }) - } - _ => Err(String::from( - "`kind` expected to be one of `none`, `inline`, `call` or `inline-or-call`", - )), - } - } + InlineOrCall { + #[serde(rename = "min-llvm-version-for-inline")] + min_llvm_version_for_inline: (u32, u32, u32), + }, } impl ToJson for StackProbeType { @@ -1549,6 +1657,29 @@ impl fmt::Display for SanitizerSet { } } +impl FromStr for SanitizerSet { + type Err = String; + fn from_str(s: &str) -> Result { + Ok(match s { + "address" => SanitizerSet::ADDRESS, + "cfi" => SanitizerSet::CFI, + "dataflow" => SanitizerSet::DATAFLOW, + "kcfi" => SanitizerSet::KCFI, + "kernel-address" => SanitizerSet::KERNELADDRESS, + "leak" => SanitizerSet::LEAK, + "memory" => SanitizerSet::MEMORY, + "memtag" => SanitizerSet::MEMTAG, + "safestack" => SanitizerSet::SAFESTACK, + "shadow-call-stack" => SanitizerSet::SHADOWCALLSTACK, + "thread" => SanitizerSet::THREAD, + "hwaddress" => SanitizerSet::HWADDRESS, + s => return Err(format!("unknown sanitizer {s}")), + }) + } +} + +crate::json::serde_deserialize_from_str!(SanitizerSet); + impl ToJson for SanitizerSet { fn to_json(&self) -> Json { self.into_iter() @@ -1587,17 +1718,19 @@ impl FramePointer { } impl FromStr for FramePointer { - type Err = (); - fn from_str(s: &str) -> Result { + type Err = String; + fn from_str(s: &str) -> Result { Ok(match s { "always" => Self::Always, "non-leaf" => Self::NonLeaf, "may-omit" => Self::MayOmit, - _ => return Err(()), + _ => return Err(format!("'{s}' is not a valid value for frame-pointer")), }) } } +crate::json::serde_deserialize_from_str!(FramePointer); + impl ToJson for FramePointer { fn to_json(&self) -> Json { match *self { @@ -1685,7 +1818,7 @@ impl BinaryFormat { } impl FromStr for BinaryFormat { - type Err = (); + type Err = String; fn from_str(s: &str) -> Result { match s { "coff" => Ok(Self::Coff), @@ -1693,11 +1826,16 @@ impl FromStr for BinaryFormat { "mach-o" => Ok(Self::MachO), "wasm" => Ok(Self::Wasm), "xcoff" => Ok(Self::Xcoff), - _ => Err(()), + _ => Err(format!( + "'{s}' is not a valid value for binary_format. \ + Use 'coff', 'elf', 'mach-o', 'wasm' or 'xcoff' " + )), } } } +crate::json::serde_deserialize_from_str!(BinaryFormat); + impl ToJson for BinaryFormat { fn to_json(&self) -> Json { match self { @@ -2130,12 +2268,11 @@ pub(crate) use cvs; #[derive(Debug, PartialEq)] pub struct TargetWarnings { unused_fields: Vec, - incorrect_type: Vec, } impl TargetWarnings { pub fn empty() -> Self { - Self { unused_fields: Vec::new(), incorrect_type: Vec::new() } + Self { unused_fields: Vec::new() } } pub fn warning_messages(&self) -> Vec { @@ -2146,12 +2283,6 @@ impl TargetWarnings { self.unused_fields.join(", ") )); } - if !self.incorrect_type.is_empty() { - warnings.push(format!( - "target json file contains fields whose value doesn't have the correct json type: {}", - self.incorrect_type.join(", ") - )); - } warnings } } @@ -3325,7 +3456,8 @@ impl Target { /// Test target self-consistency and JSON encoding/decoding roundtrip. #[cfg(test)] fn test_target(mut self) { - let recycled_target = Target::from_json(self.to_json()).map(|(j, _)| j); + let recycled_target = + Target::from_json(&serde_json::to_string(&self.to_json()).unwrap()).map(|(j, _)| j); self.update_to_cli(); self.check_consistency(TargetKind::Builtin).unwrap(); assert_eq!(recycled_target, Ok(self)); @@ -3373,8 +3505,7 @@ impl Target { fn load_file(path: &Path) -> Result<(Target, TargetWarnings), String> { let contents = fs::read_to_string(path).map_err(|e| e.to_string())?; - let obj = serde_json::from_str(&contents).map_err(|e| e.to_string())?; - Target::from_json(obj) + Target::from_json(&contents) } match *target_tuple { @@ -3422,10 +3553,7 @@ impl Target { Err(format!("could not find specification for target {target_tuple:?}")) } } - TargetTuple::TargetJson { ref contents, .. } => { - let obj = serde_json::from_str(contents).map_err(|e| e.to_string())?; - Target::from_json(obj) - } + TargetTuple::TargetJson { ref contents, .. } => Target::from_json(contents), } } diff --git a/compiler/rustc_target/src/tests.rs b/compiler/rustc_target/src/tests.rs index 76375170db63..ee847a84007f 100644 --- a/compiler/rustc_target/src/tests.rs +++ b/compiler/rustc_target/src/tests.rs @@ -2,8 +2,7 @@ use crate::spec::Target; #[test] fn report_unused_fields() { - let json = serde_json::from_str( - r#" + let json = r#" { "arch": "powerpc64", "data-layout": "e-m:e-i64:64-n32:64", @@ -11,47 +10,8 @@ fn report_unused_fields() { "target-pointer-width": "64", "code-mode": "foo" } - "#, - ) - .unwrap(); - let warnings = Target::from_json(json).unwrap().1; - assert_eq!(warnings.warning_messages().len(), 1); - assert!(warnings.warning_messages().join("\n").contains("code-mode")); -} - -#[test] -fn report_incorrect_json_type() { - let json = serde_json::from_str( - r#" - { - "arch": "powerpc64", - "data-layout": "e-m:e-i64:64-n32:64", - "llvm-target": "powerpc64le-elf", - "target-pointer-width": "64", - "link-env-remove": "foo" - } - "#, - ) - .unwrap(); - let warnings = Target::from_json(json).unwrap().1; - assert_eq!(warnings.warning_messages().len(), 1); - assert!(warnings.warning_messages().join("\n").contains("link-env-remove")); -} - -#[test] -fn no_warnings_for_valid_target() { - let json = serde_json::from_str( - r#" - { - "arch": "powerpc64", - "data-layout": "e-m:e-i64:64-n32:64", - "llvm-target": "powerpc64le-elf", - "target-pointer-width": "64", - "link-env-remove": ["foo"] - } - "#, - ) - .unwrap(); - let warnings = Target::from_json(json).unwrap().1; - assert_eq!(warnings.warning_messages().len(), 0); + "#; + let result = Target::from_json(json); + eprintln!("{result:#?}"); + assert!(result.is_err()); } diff --git a/src/librustdoc/doctest.rs b/src/librustdoc/doctest.rs index 38ba6b4503dc..a32c2f7fb18c 100644 --- a/src/librustdoc/doctest.rs +++ b/src/librustdoc/doctest.rs @@ -444,7 +444,7 @@ fn add_exe_suffix(input: String, target: &TargetTuple) -> String { let exe_suffix = match target { TargetTuple::TargetTuple(_) => Target::expect_builtin(target).options.exe_suffix, TargetTuple::TargetJson { contents, .. } => { - Target::from_json(contents.parse().unwrap()).unwrap().0.options.exe_suffix + Target::from_json(contents).unwrap().0.options.exe_suffix } }; input + &exe_suffix diff --git a/src/tools/tidy/src/deps.rs b/src/tools/tidy/src/deps.rs index f43f5eae9a56..d17ae162ab23 100644 --- a/src/tools/tidy/src/deps.rs +++ b/src/tools/tidy/src/deps.rs @@ -378,6 +378,7 @@ const PERMITTED_RUSTC_DEPENDENCIES: &[&str] = &[ "serde", "serde_derive", "serde_json", + "serde_path_to_error", "sha1", "sha2", "sharded-slab", diff --git a/tests/run-make/rustdoc-target-spec-json-path/target.json b/tests/run-make/rustdoc-target-spec-json-path/target.json index c478f1196fae..d7e4cac57ae7 100644 --- a/tests/run-make/rustdoc-target-spec-json-path/target.json +++ b/tests/run-make/rustdoc-target-spec-json-path/target.json @@ -6,7 +6,6 @@ "dynamic-linking": true, "env": "gnu", "executables": true, - "has-elf-tls": true, "has-rpath": true, "linker-is-gnu": true, "llvm-target": "x86_64-unknown-linux-gnu", diff --git a/tests/run-make/target-specs/endianness-mismatch.json b/tests/run-make/target-specs/endianness-mismatch.json index 431053ea99b6..cc03becc59af 100644 --- a/tests/run-make/target-specs/endianness-mismatch.json +++ b/tests/run-make/target-specs/endianness-mismatch.json @@ -5,7 +5,6 @@ "llvm-target": "x86_64-unknown-linux-gnu", "target-endian": "big", "target-pointer-width": "64", - "target-c-int-width": "32", "arch": "x86_64", "os": "linux" } diff --git a/tests/run-make/target-specs/my-awesome-platform.json b/tests/run-make/target-specs/my-awesome-platform.json index 1673ef7bd54d..d41038b84a86 100644 --- a/tests/run-make/target-specs/my-awesome-platform.json +++ b/tests/run-make/target-specs/my-awesome-platform.json @@ -4,8 +4,6 @@ "llvm-target": "i686-unknown-linux-gnu", "target-endian": "little", "target-pointer-width": "32", - "target-c-int-width": "32", "arch": "x86", - "os": "linux", - "morestack": false + "os": "linux" } diff --git a/tests/run-make/target-specs/my-incomplete-platform.json b/tests/run-make/target-specs/my-incomplete-platform.json index ceaa25cdf2fe..8bdc4108f494 100644 --- a/tests/run-make/target-specs/my-incomplete-platform.json +++ b/tests/run-make/target-specs/my-incomplete-platform.json @@ -3,8 +3,6 @@ "linker-flavor": "gcc", "target-endian": "little", "target-pointer-width": "32", - "target-c-int-width": "32", "arch": "x86", - "os": "foo", - "morestack": false + "os": "foo" } diff --git a/tests/run-make/target-specs/my-x86_64-unknown-linux-gnu-platform.json b/tests/run-make/target-specs/my-x86_64-unknown-linux-gnu-platform.json index 0cafce15a9fe..27833f1abdd9 100644 --- a/tests/run-make/target-specs/my-x86_64-unknown-linux-gnu-platform.json +++ b/tests/run-make/target-specs/my-x86_64-unknown-linux-gnu-platform.json @@ -5,8 +5,6 @@ "llvm-target": "x86_64-unknown-linux-gnu", "target-endian": "little", "target-pointer-width": "64", - "target-c-int-width": "32", "arch": "x86_64", - "os": "linux", - "morestack": false + "os": "linux" } diff --git a/tests/run-make/target-specs/require-explicit-cpu.json b/tests/run-make/target-specs/require-explicit-cpu.json index 5cbb9573b3f1..9744bca168e2 100644 --- a/tests/run-make/target-specs/require-explicit-cpu.json +++ b/tests/run-make/target-specs/require-explicit-cpu.json @@ -4,7 +4,6 @@ "llvm-target": "i686-unknown-linux-gnu", "target-endian": "little", "target-pointer-width": "32", - "target-c-int-width": "32", "arch": "x86", "os": "linux", "need-explicit-cpu": true diff --git a/tests/run-make/target-specs/rmake.rs b/tests/run-make/target-specs/rmake.rs index 9184e5f772f7..7e565588ed6b 100644 --- a/tests/run-make/target-specs/rmake.rs +++ b/tests/run-make/target-specs/rmake.rs @@ -8,8 +8,6 @@ use run_make_support::{diff, rfs, rustc}; fn main() { - rustc().input("foo.rs").target("my-awesome-platform.json").crate_type("lib").emit("asm").run(); - assert!(!rfs::read_to_string("foo.s").contains("morestack")); rustc() .input("foo.rs") .target("my-invalid-platform.json") @@ -19,7 +17,7 @@ fn main() { .input("foo.rs") .target("my-incomplete-platform.json") .run_fail() - .assert_stderr_contains("Field llvm-target"); + .assert_stderr_contains("missing field `llvm-target`"); rustc() .env("RUST_TARGET_PATH", ".") .input("foo.rs") diff --git a/tests/ui/check-cfg/my-awesome-platform.json b/tests/ui/check-cfg/my-awesome-platform.json index 03b08b727bd3..4c16d06c7b7d 100644 --- a/tests/ui/check-cfg/my-awesome-platform.json +++ b/tests/ui/check-cfg/my-awesome-platform.json @@ -4,7 +4,6 @@ "arch": "x86_64", "target-endian": "little", "target-pointer-width": "64", - "target-c-int-width": "32", "os": "ericos", "linker-flavor": "ld.lld", "linker": "rust-lld", diff --git a/tests/ui/codegen/mismatched-data-layout.json b/tests/ui/codegen/mismatched-data-layout.json index 7adc88325247..f8c510c18636 100644 --- a/tests/ui/codegen/mismatched-data-layout.json +++ b/tests/ui/codegen/mismatched-data-layout.json @@ -4,7 +4,6 @@ "arch": "x86_64", "target-endian": "little", "target-pointer-width": "64", - "target-c-int-width": "32", "os": "none", "linker-flavor": "ld.lld", "linker": "rust-lld", diff --git a/tests/ui/codegen/mismatched-data-layouts.rs b/tests/ui/codegen/mismatched-data-layouts.rs index 6428b8c5247b..ea1457148a52 100644 --- a/tests/ui/codegen/mismatched-data-layouts.rs +++ b/tests/ui/codegen/mismatched-data-layouts.rs @@ -5,6 +5,7 @@ //@ compile-flags: --crate-type=lib --target={{src-base}}/codegen/mismatched-data-layout.json -Z unstable-options //@ normalize-stderr: "`, `[A-Za-z0-9-:]*`" -> "`, `normalized data layout`" //@ normalize-stderr: "layout, `[A-Za-z0-9-:]*`" -> "layout, `normalized data layout`" +//@ normalize-stderr: "`mismatched-data-layout-\d+`" -> "`mismatched-data-layout-`" #![feature(lang_items, no_core, auto_traits)] #![no_core] diff --git a/tests/ui/codegen/mismatched-data-layouts.stderr b/tests/ui/codegen/mismatched-data-layouts.stderr index b7d5d82bee08..d1117564d5b7 100644 --- a/tests/ui/codegen/mismatched-data-layouts.stderr +++ b/tests/ui/codegen/mismatched-data-layouts.stderr @@ -1,4 +1,4 @@ -error: data-layout for target `mismatched-data-layout-7193370089426056427`, `normalized data layout`, differs from LLVM target's `x86_64-unknown-none-gnu` default layout, `normalized data layout` +error: data-layout for target `mismatched-data-layout-`, `normalized data layout`, differs from LLVM target's `x86_64-unknown-none-gnu` default layout, `normalized data layout` error: aborting due to 1 previous error From c4eb07761643d2fa26d6f609eb23c8d22e14d8eb Mon Sep 17 00:00:00 2001 From: Ben Kimock Date: Thu, 17 Jul 2025 18:41:52 -0400 Subject: [PATCH 087/139] Ensure we codegen and don't internalize the entrypoint --- compiler/rustc_middle/src/mir/mono.rs | 6 ++---- compiler/rustc_middle/src/ty/context.rs | 14 ++++++++++++++ compiler/rustc_monomorphize/src/collector.rs | 9 +++++++++ compiler/rustc_monomorphize/src/partitioning.rs | 15 +++++---------- tests/ui/entry-point/auxiliary/main_functions.rs | 3 +++ .../ui/entry-point/imported_main_local_codegen.rs | 11 +++++++++++ 6 files changed, 44 insertions(+), 14 deletions(-) create mode 100644 tests/ui/entry-point/imported_main_local_codegen.rs diff --git a/compiler/rustc_middle/src/mir/mono.rs b/compiler/rustc_middle/src/mir/mono.rs index 47ba850d50dd..c2927361d05c 100644 --- a/compiler/rustc_middle/src/mir/mono.rs +++ b/compiler/rustc_middle/src/mir/mono.rs @@ -143,10 +143,8 @@ impl<'tcx> MonoItem<'tcx> { }; // Similarly, the executable entrypoint must be instantiated exactly once. - if let Some((entry_def_id, _)) = tcx.entry_fn(()) { - if instance.def_id() == entry_def_id { - return InstantiationMode::GloballyShared { may_conflict: false }; - } + if tcx.is_entrypoint(instance.def_id()) { + return InstantiationMode::GloballyShared { may_conflict: false }; } // If the function is #[naked] or contains any other attribute that requires exactly-once diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs index 915b062417f2..26da2abe126c 100644 --- a/compiler/rustc_middle/src/ty/context.rs +++ b/compiler/rustc_middle/src/ty/context.rs @@ -3402,6 +3402,20 @@ impl<'tcx> TyCtxt<'tcx> { pub fn do_not_recommend_impl(self, def_id: DefId) -> bool { self.get_diagnostic_attr(def_id, sym::do_not_recommend).is_some() } + + /// Whether this def is one of the special bin crate entrypoint functions that must have a + /// monomorphization and also not be internalized in the bin crate. + pub fn is_entrypoint(self, def_id: DefId) -> bool { + if self.is_lang_item(def_id, LangItem::Start) { + return true; + } + if let Some((entry_def_id, _)) = self.entry_fn(()) + && entry_def_id == def_id + { + return true; + } + false + } } /// Parameter attributes that can only be determined by examining the body of a function instead diff --git a/compiler/rustc_monomorphize/src/collector.rs b/compiler/rustc_monomorphize/src/collector.rs index 91c8e64ce9af..5071f9f89221 100644 --- a/compiler/rustc_monomorphize/src/collector.rs +++ b/compiler/rustc_monomorphize/src/collector.rs @@ -1582,6 +1582,15 @@ impl<'v> RootCollector<'_, 'v> { return; }; + let main_instance = Instance::mono(self.tcx, main_def_id); + if self.tcx.should_codegen_locally(main_instance) { + self.output.push(create_fn_mono_item( + self.tcx, + main_instance, + self.tcx.def_span(main_def_id), + )); + } + let Some(start_def_id) = self.tcx.lang_items().start_fn() else { self.tcx.dcx().emit_fatal(errors::StartNotFound); }; diff --git a/compiler/rustc_monomorphize/src/partitioning.rs b/compiler/rustc_monomorphize/src/partitioning.rs index 69851511fb1f..ca8228de57e8 100644 --- a/compiler/rustc_monomorphize/src/partitioning.rs +++ b/compiler/rustc_monomorphize/src/partitioning.rs @@ -223,11 +223,7 @@ where // So even if its mode is LocalCopy, we need to treat it like a root. match mono_item.instantiation_mode(cx.tcx) { InstantiationMode::GloballyShared { .. } => {} - InstantiationMode::LocalCopy => { - if !cx.tcx.is_lang_item(mono_item.def_id(), LangItem::Start) { - continue; - } - } + InstantiationMode::LocalCopy => continue, } let characteristic_def_id = characteristic_def_id_of_mono_item(cx.tcx, mono_item); @@ -821,10 +817,9 @@ fn mono_item_visibility<'tcx>( | InstanceKind::FnPtrAddrShim(..) => return Visibility::Hidden, }; - // The `start_fn` lang item is actually a monomorphized instance of a - // function in the standard library, used for the `main` function. We don't - // want to export it so we tag it with `Hidden` visibility but this symbol - // is only referenced from the actual `main` symbol which we unfortunately + // Both the `start_fn` lang item and `main` itself should not be exported, + // so we give them with `Hidden` visibility but these symbols are + // only referenced from the actual `main` symbol which we unfortunately // don't know anything about during partitioning/collection. As a result we // forcibly keep this symbol out of the `internalization_candidates` set. // @@ -834,7 +829,7 @@ fn mono_item_visibility<'tcx>( // from the `main` symbol we'll generate later. // // This may be fixable with a new `InstanceKind` perhaps? Unsure! - if tcx.is_lang_item(def_id, LangItem::Start) { + if tcx.is_entrypoint(def_id) { *can_be_internalized = false; return Visibility::Hidden; } diff --git a/tests/ui/entry-point/auxiliary/main_functions.rs b/tests/ui/entry-point/auxiliary/main_functions.rs index cc7992a42c18..ab4a09b63310 100644 --- a/tests/ui/entry-point/auxiliary/main_functions.rs +++ b/tests/ui/entry-point/auxiliary/main_functions.rs @@ -1 +1,4 @@ pub fn boilerplate() {} + +#[inline] +pub fn local_codegen() {} diff --git a/tests/ui/entry-point/imported_main_local_codegen.rs b/tests/ui/entry-point/imported_main_local_codegen.rs new file mode 100644 index 000000000000..1e46c1093730 --- /dev/null +++ b/tests/ui/entry-point/imported_main_local_codegen.rs @@ -0,0 +1,11 @@ +//@ run-pass +//@ aux-build:main_functions.rs +//@ compile-flags: -Ccodegen-units=1024 + +// This is a regression test for https://github.com/rust-lang/rust/issues/144052. +// Entrypoint functions call each other in ways that CGU partitioning doesn't know about. So there +// is a special check to not internalize any of them. But internalizing them can be okay if there +// are few enough CGUs, so we use a lot of CGUs in this test to hit the bad case. + +extern crate main_functions; +pub use main_functions::local_codegen as main; From 6e8762f769c90f7a6ab0428db8ba55066eafd859 Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Sun, 1 Oct 2023 15:09:35 +0000 Subject: [PATCH 088/139] Use less HIR in check_private_in_public. --- compiler/rustc_privacy/src/lib.rs | 122 +++++++----------- .../associated-item-privacy-trait.stderr | 22 ++-- .../ui/privacy/private-in-public-warn.stderr | 72 +++++------ 3 files changed, 92 insertions(+), 124 deletions(-) diff --git a/compiler/rustc_privacy/src/lib.rs b/compiler/rustc_privacy/src/lib.rs index 80c13e44d7d8..5021002e4cbc 100644 --- a/compiler/rustc_privacy/src/lib.rs +++ b/compiler/rustc_privacy/src/lib.rs @@ -26,7 +26,7 @@ use rustc_errors::{MultiSpan, listify}; use rustc_hir::def::{DefKind, Res}; use rustc_hir::def_id::{CRATE_DEF_ID, DefId, LocalDefId, LocalModDefId}; use rustc_hir::intravisit::{self, InferKind, Visitor}; -use rustc_hir::{AmbigArg, ForeignItemKind, ItemId, ItemKind, PatKind}; +use rustc_hir::{AmbigArg, ForeignItemId, ItemId, PatKind}; use rustc_middle::middle::privacy::{EffectiveVisibilities, EffectiveVisibility, Level}; use rustc_middle::query::Providers; use rustc_middle::ty::print::PrintTraitRefExt as _; @@ -599,18 +599,13 @@ impl<'tcx> EmbargoVisitor<'tcx> { DefKind::Struct | DefKind::Union => { // While structs and unions have type privacy, their fields do not. - let item = self.tcx.hir_expect_item(def_id); - if let hir::ItemKind::Struct(_, _, ref struct_def) - | hir::ItemKind::Union(_, _, ref struct_def) = item.kind - { - for field in struct_def.fields() { - let field_vis = self.tcx.local_visibility(field.def_id); - if field_vis.is_accessible_from(module, self.tcx) { - self.reach(field.def_id, macro_ev).ty(); - } + let struct_def = self.tcx.adt_def(def_id); + for field in struct_def.non_enum_variant().fields.iter() { + let def_id = field.did.expect_local(); + let field_vis = self.tcx.local_visibility(def_id); + if field_vis.is_accessible_from(module, self.tcx) { + self.reach(def_id, macro_ev).ty(); } - } else { - bug!("item {:?} with DefKind {:?}", item, def_kind); } } @@ -1640,66 +1635,29 @@ impl<'tcx> PrivateItemsInPublicInterfacesChecker<'_, 'tcx> { self.check(def_id, item_visibility, effective_vis).generics().predicates(); } DefKind::Enum => { - let item = tcx.hir_item(id); - if let hir::ItemKind::Enum(_, _, ref def) = item.kind { - self.check_unnameable(item.owner_id.def_id, effective_vis); + self.check_unnameable(def_id, effective_vis); + self.check(def_id, item_visibility, effective_vis).generics().predicates(); - self.check(item.owner_id.def_id, item_visibility, effective_vis) - .generics() - .predicates(); - - for variant in def.variants { - for field in variant.data.fields() { - self.check(field.def_id, item_visibility, effective_vis).ty(); - } - } - } - } - // Subitems of foreign modules have their own publicity. - DefKind::ForeignMod => { - let item = tcx.hir_item(id); - if let hir::ItemKind::ForeignMod { items, .. } = item.kind { - for &foreign_item in items { - let foreign_item = tcx.hir_foreign_item(foreign_item); - - let ev = self.get(foreign_item.owner_id.def_id); - let vis = tcx.local_visibility(foreign_item.owner_id.def_id); - - if let ForeignItemKind::Type = foreign_item.kind { - self.check_unnameable(foreign_item.owner_id.def_id, ev); - } - - self.check(foreign_item.owner_id.def_id, vis, ev) - .generics() - .predicates() - .ty(); - } + let adt = tcx.adt_def(id.owner_id); + for field in adt.all_fields() { + self.check(field.did.expect_local(), item_visibility, effective_vis).ty(); } } // Subitems of structs and unions have their own publicity. DefKind::Struct | DefKind::Union => { - let item = tcx.hir_item(id); - if let hir::ItemKind::Struct(_, _, ref struct_def) - | hir::ItemKind::Union(_, _, ref struct_def) = item.kind - { - self.check_unnameable(item.owner_id.def_id, effective_vis); - self.check(item.owner_id.def_id, item_visibility, effective_vis) - .generics() - .predicates(); + self.check_unnameable(def_id, effective_vis); + self.check(def_id, item_visibility, effective_vis).generics().predicates(); - for field in struct_def.fields() { - let field_visibility = tcx.local_visibility(field.def_id); - let field_ev = self.get(field.def_id); + let adt = tcx.adt_def(id.owner_id); + for field in adt.all_fields() { + let visibility = min(item_visibility, field.vis.expect_local(), tcx); + let field_ev = self.get(field.did.expect_local()); - self.check( - field.def_id, - min(item_visibility, field_visibility, tcx), - field_ev, - ) - .ty(); - } + self.check(field.did.expect_local(), visibility, field_ev).ty(); } } + // Subitems of foreign modules have their own publicity. + DefKind::ForeignMod => {} // An inherent impl is public when its type is public // Subitems of inherent impls have their own publicity. // A trait impl is public when both its type and its trait are public @@ -1755,6 +1713,19 @@ impl<'tcx> PrivateItemsInPublicInterfacesChecker<'_, 'tcx> { _ => {} } } + + fn check_foreign_item(&mut self, id: ForeignItemId) { + let tcx = self.tcx; + let def_id = id.owner_id.def_id; + let item_visibility = tcx.local_visibility(def_id); + let effective_vis = self.get(def_id); + + if let DefKind::ForeignTy = self.tcx.def_kind(def_id) { + self.check_unnameable(def_id, effective_vis); + } + + self.check(def_id, item_visibility, effective_vis).generics().predicates().ty(); + } } pub fn provide(providers: &mut Providers) { @@ -1783,20 +1754,13 @@ fn check_mod_privacy(tcx: TyCtxt<'_>, module_def_id: LocalModDefId) { if let Some(body_id) = tcx.hir_maybe_body_owned_by(def_id) { visitor.visit_nested_body(body_id.id()); } - } - for id in module.free_items() { - if let ItemKind::Impl(i) = tcx.hir_item(id).kind { - if let Some(item) = i.of_trait { - let trait_ref = tcx.impl_trait_ref(id.owner_id.def_id).unwrap(); - let trait_ref = trait_ref.instantiate_identity(); - visitor.span = item.path.span; - let _ = visitor.visit_def_id( - trait_ref.def_id, - "trait", - &trait_ref.print_only_trait_path(), - ); - } + if let DefKind::Impl { of_trait: true } = tcx.def_kind(def_id) { + let trait_ref = tcx.impl_trait_ref(def_id).unwrap(); + let trait_ref = trait_ref.instantiate_identity(); + visitor.span = tcx.hir_expect_item(def_id).expect_impl().of_trait.unwrap().path.span; + let _ = + visitor.visit_def_id(trait_ref.def_id, "trait", &trait_ref.print_only_trait_path()); } } } @@ -1887,7 +1851,11 @@ fn check_private_in_public(tcx: TyCtxt<'_>, (): ()) { // Check for private types in public interfaces. let mut checker = PrivateItemsInPublicInterfacesChecker { tcx, effective_visibilities }; - for id in tcx.hir_free_items() { + let crate_items = tcx.hir_crate_items(()); + for id in crate_items.free_items() { checker.check_item(id); } + for id in crate_items.foreign_items() { + checker.check_foreign_item(id); + } } diff --git a/tests/ui/privacy/associated-item-privacy-trait.stderr b/tests/ui/privacy/associated-item-privacy-trait.stderr index f79c4cff72fa..4e9dfa4a8351 100644 --- a/tests/ui/privacy/associated-item-privacy-trait.stderr +++ b/tests/ui/privacy/associated-item-privacy-trait.stderr @@ -75,6 +75,17 @@ LL | priv_trait::mac!(); | = note: this error originates in the macro `priv_trait::mac` (in Nightly builds, run with -Z macro-backtrace for more info) +error: trait `PrivTr` is private + --> $DIR/associated-item-privacy-trait.rs:29:14 + | +LL | impl PrivTr for u8 {} + | ^^^^^^ private trait +... +LL | priv_trait::mac!(); + | ------------------ in this macro invocation + | + = note: this error originates in the macro `priv_trait::mac` (in Nightly builds, run with -Z macro-backtrace for more info) + error: type `priv_signature::Priv` is private --> $DIR/associated-item-privacy-trait.rs:46:21 | @@ -317,16 +328,5 @@ LL | priv_parent_substs::mac!(); | = note: this error originates in the macro `priv_parent_substs::mac` (in Nightly builds, run with -Z macro-backtrace for more info) -error: trait `PrivTr` is private - --> $DIR/associated-item-privacy-trait.rs:29:14 - | -LL | impl PrivTr for u8 {} - | ^^^^^^ private trait -... -LL | priv_trait::mac!(); - | ------------------ in this macro invocation - | - = note: this error originates in the macro `priv_trait::mac` (in Nightly builds, run with -Z macro-backtrace for more info) - error: aborting due to 30 previous errors diff --git a/tests/ui/privacy/private-in-public-warn.stderr b/tests/ui/privacy/private-in-public-warn.stderr index 3743879ffa61..0343002ea318 100644 --- a/tests/ui/privacy/private-in-public-warn.stderr +++ b/tests/ui/privacy/private-in-public-warn.stderr @@ -84,42 +84,6 @@ note: but type `types::Priv` is only usable at visibility `pub(self)` LL | struct Priv; | ^^^^^^^^^^^ -error: type `types::Priv` is more private than the item `types::ES` - --> $DIR/private-in-public-warn.rs:27:9 - | -LL | pub static ES: Priv; - | ^^^^^^^^^^^^^^^^^^^ static `types::ES` is reachable at visibility `pub(crate)` - | -note: but type `types::Priv` is only usable at visibility `pub(self)` - --> $DIR/private-in-public-warn.rs:9:5 - | -LL | struct Priv; - | ^^^^^^^^^^^ - -error: type `types::Priv` is more private than the item `types::ef1` - --> $DIR/private-in-public-warn.rs:28:9 - | -LL | pub fn ef1(arg: Priv); - | ^^^^^^^^^^^^^^^^^^^^^^ function `types::ef1` is reachable at visibility `pub(crate)` - | -note: but type `types::Priv` is only usable at visibility `pub(self)` - --> $DIR/private-in-public-warn.rs:9:5 - | -LL | struct Priv; - | ^^^^^^^^^^^ - -error: type `types::Priv` is more private than the item `types::ef2` - --> $DIR/private-in-public-warn.rs:29:9 - | -LL | pub fn ef2() -> Priv; - | ^^^^^^^^^^^^^^^^^^^^^ function `types::ef2` is reachable at visibility `pub(crate)` - | -note: but type `types::Priv` is only usable at visibility `pub(self)` - --> $DIR/private-in-public-warn.rs:9:5 - | -LL | struct Priv; - | ^^^^^^^^^^^ - error[E0446]: private type `types::Priv` in public interface --> $DIR/private-in-public-warn.rs:32:9 | @@ -395,6 +359,42 @@ note: but type `Priv2` is only usable at visibility `pub(self)` LL | struct Priv2; | ^^^^^^^^^^^^ +error: type `types::Priv` is more private than the item `types::ES` + --> $DIR/private-in-public-warn.rs:27:9 + | +LL | pub static ES: Priv; + | ^^^^^^^^^^^^^^^^^^^ static `types::ES` is reachable at visibility `pub(crate)` + | +note: but type `types::Priv` is only usable at visibility `pub(self)` + --> $DIR/private-in-public-warn.rs:9:5 + | +LL | struct Priv; + | ^^^^^^^^^^^ + +error: type `types::Priv` is more private than the item `types::ef1` + --> $DIR/private-in-public-warn.rs:28:9 + | +LL | pub fn ef1(arg: Priv); + | ^^^^^^^^^^^^^^^^^^^^^^ function `types::ef1` is reachable at visibility `pub(crate)` + | +note: but type `types::Priv` is only usable at visibility `pub(self)` + --> $DIR/private-in-public-warn.rs:9:5 + | +LL | struct Priv; + | ^^^^^^^^^^^ + +error: type `types::Priv` is more private than the item `types::ef2` + --> $DIR/private-in-public-warn.rs:29:9 + | +LL | pub fn ef2() -> Priv; + | ^^^^^^^^^^^^^^^^^^^^^ function `types::ef2` is reachable at visibility `pub(crate)` + | +note: but type `types::Priv` is only usable at visibility `pub(self)` + --> $DIR/private-in-public-warn.rs:9:5 + | +LL | struct Priv; + | ^^^^^^^^^^^ + warning: bounds on generic parameters in type aliases are not enforced --> $DIR/private-in-public-warn.rs:41:23 | From b1d88ba086ee6f34584ed4e8eb09761a03fe249d Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Tue, 22 Jul 2025 01:43:44 +0000 Subject: [PATCH 089/139] Keep elaborating predicates. --- .../src/impossible_predicates.rs | 21 ++++++++----------- 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/compiler/rustc_mir_transform/src/impossible_predicates.rs b/compiler/rustc_mir_transform/src/impossible_predicates.rs index 9a0de3c93263..b03518de00a9 100644 --- a/compiler/rustc_mir_transform/src/impossible_predicates.rs +++ b/compiler/rustc_mir_transform/src/impossible_predicates.rs @@ -41,18 +41,15 @@ impl<'tcx> MirPass<'tcx> for ImpossiblePredicates { tracing::trace!(def_id = ?body.source.def_id()); let predicates = tcx.predicates_of(body.source.def_id()).instantiate_identity(tcx); tracing::trace!(?predicates); - let predicates: Vec<_> = predicates - .predicates - .into_iter() - .filter(|p| { - !p.has_type_flags( - // Only consider global clauses to simplify. - TypeFlags::HAS_FREE_LOCAL_NAMES - // Clauses that refer to unevaluated constants as they cause cycles. - | TypeFlags::HAS_CT_PROJECTION, - ) - }) - .collect(); + let predicates = predicates.predicates.into_iter().filter(|p| { + !p.has_type_flags( + // Only consider global clauses to simplify. + TypeFlags::HAS_FREE_LOCAL_NAMES + // Clauses that refer to unevaluated constants as they cause cycles. + | TypeFlags::HAS_CT_PROJECTION, + ) + }); + let predicates: Vec<_> = traits::elaborate(tcx, predicates).collect(); tracing::trace!(?predicates); if predicates.references_error() || traits::impossible_predicates(tcx, predicates) { trace!("found unsatisfiable predicates"); From 3c81faec23161d3f997666e90e6e34747ace6d28 Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Thu, 3 Jul 2025 22:24:21 +0000 Subject: [PATCH 090/139] Implement AST visitors using a derive macro. --- compiler/rustc_ast/src/ast.rs | 285 +-- compiler/rustc_ast/src/format.rs | 20 +- compiler/rustc_ast/src/mut_visit.rs | 259 ++- compiler/rustc_ast/src/tokenstream.rs | 4 +- compiler/rustc_ast/src/visit.rs | 2233 ++++++++---------------- compiler/rustc_macros/src/lib.rs | 11 + compiler/rustc_macros/src/visitable.rs | 82 + 7 files changed, 1219 insertions(+), 1675 deletions(-) create mode 100644 compiler/rustc_macros/src/visitable.rs diff --git a/compiler/rustc_ast/src/ast.rs b/compiler/rustc_ast/src/ast.rs index 8c2b521c560d..97e070958751 100644 --- a/compiler/rustc_ast/src/ast.rs +++ b/compiler/rustc_ast/src/ast.rs @@ -28,7 +28,7 @@ use rustc_data_structures::packed::Pu128; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; use rustc_data_structures::stack::ensure_sufficient_stack; use rustc_data_structures::tagged_ptr::Tag; -use rustc_macros::{Decodable, Encodable, HashStable_Generic}; +use rustc_macros::{Decodable, Encodable, HashStable_Generic, Walkable}; pub use rustc_span::AttrId; use rustc_span::source_map::{Spanned, respan}; use rustc_span::{ByteSymbol, DUMMY_SP, ErrorGuaranteed, Ident, Span, Symbol, kw, sym}; @@ -39,6 +39,7 @@ use crate::ptr::P; use crate::token::{self, CommentKind, Delimiter}; use crate::tokenstream::{DelimSpan, LazyAttrTokenStream, TokenStream}; use crate::util::parser::{ExprPrecedence, Fixity}; +use crate::visit::{AssocCtxt, BoundKind, LifetimeCtxt}; /// A "Label" is an identifier of some point in sources, /// e.g. in the following code: @@ -50,7 +51,7 @@ use crate::util::parser::{ExprPrecedence, Fixity}; /// ``` /// /// `'outer` is a label. -#[derive(Clone, Encodable, Decodable, Copy, HashStable_Generic, Eq, PartialEq)] +#[derive(Clone, Encodable, Decodable, Copy, HashStable_Generic, Eq, PartialEq, Walkable)] pub struct Label { pub ident: Ident, } @@ -63,7 +64,7 @@ impl fmt::Debug for Label { /// A "Lifetime" is an annotation of the scope in which variable /// can be used, e.g. `'a` in `&'a i32`. -#[derive(Clone, Encodable, Decodable, Copy, PartialEq, Eq, Hash)] +#[derive(Clone, Encodable, Decodable, Copy, PartialEq, Eq, Hash, Walkable)] pub struct Lifetime { pub id: NodeId, pub ident: Ident, @@ -87,7 +88,7 @@ impl fmt::Display for Lifetime { /// along with a bunch of supporting information. /// /// E.g., `std::cmp::PartialEq`. -#[derive(Clone, Encodable, Decodable, Debug)] +#[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub struct Path { pub span: Span, /// The segments in the path: the things separated by `::`. @@ -211,7 +212,7 @@ pub fn join_path_idents(path: impl IntoIterator>) -> S /// A segment of a path: an identifier, an optional lifetime, and a set of types. /// /// E.g., `std`, `String` or `Box`. -#[derive(Clone, Encodable, Decodable, Debug)] +#[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub struct PathSegment { /// The identifier portion of this path segment. pub ident: Ident, @@ -255,7 +256,7 @@ impl PathSegment { /// The generic arguments and associated item constraints of a path segment. /// /// E.g., `` as in `Foo` or `(A, B)` as in `Foo(A, B)`. -#[derive(Clone, Encodable, Decodable, Debug)] +#[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub enum GenericArgs { /// The `<'a, A, B, C>` in `foo::bar::baz::<'a, A, B, C>`. AngleBracketed(AngleBracketedArgs), @@ -280,10 +281,10 @@ impl GenericArgs { } /// Concrete argument in the sequence of generic args. -#[derive(Clone, Encodable, Decodable, Debug)] +#[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub enum GenericArg { /// `'a` in `Foo<'a>`. - Lifetime(Lifetime), + Lifetime(#[visitable(extra = LifetimeCtxt::GenericArg)] Lifetime), /// `Bar` in `Foo`. Type(P), /// `1` in `Foo<1>`. @@ -301,7 +302,7 @@ impl GenericArg { } /// A path like `Foo<'a, T>`. -#[derive(Clone, Encodable, Decodable, Debug, Default)] +#[derive(Clone, Encodable, Decodable, Debug, Default, Walkable)] pub struct AngleBracketedArgs { /// The overall span. pub span: Span, @@ -310,7 +311,7 @@ pub struct AngleBracketedArgs { } /// Either an argument for a generic parameter or a constraint on an associated item. -#[derive(Clone, Encodable, Decodable, Debug)] +#[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub enum AngleBracketedArg { /// A generic argument for a generic parameter. Arg(GenericArg), @@ -340,7 +341,7 @@ impl From for P { } /// A path like `Foo(A, B) -> C`. -#[derive(Clone, Encodable, Decodable, Debug)] +#[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub struct ParenthesizedArgs { /// ```text /// Foo(A, B) -> C @@ -376,7 +377,7 @@ impl ParenthesizedArgs { pub use crate::node_id::{CRATE_NODE_ID, DUMMY_NODE_ID, NodeId}; /// Modifiers on a trait bound like `[const]`, `?` and `!`. -#[derive(Copy, Clone, PartialEq, Eq, Encodable, Decodable, Debug)] +#[derive(Copy, Clone, PartialEq, Eq, Encodable, Decodable, Debug, Walkable)] pub struct TraitBoundModifiers { pub constness: BoundConstness, pub asyncness: BoundAsyncness, @@ -391,10 +392,10 @@ impl TraitBoundModifiers { }; } -#[derive(Clone, Encodable, Decodable, Debug)] +#[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub enum GenericBound { Trait(PolyTraitRef), - Outlives(Lifetime), + Outlives(#[visitable(extra = LifetimeCtxt::Bound)] Lifetime), /// Precise capturing syntax: `impl Sized + use<'a>` Use(ThinVec, Span), } @@ -429,7 +430,7 @@ impl fmt::Display for ParamKindOrd { } } -#[derive(Clone, Encodable, Decodable, Debug)] +#[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub enum GenericParamKind { /// A lifetime definition (e.g., `'a: 'b + 'c + 'd`). Lifetime, @@ -445,11 +446,12 @@ pub enum GenericParamKind { }, } -#[derive(Clone, Encodable, Decodable, Debug)] +#[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub struct GenericParam { pub id: NodeId, pub ident: Ident, pub attrs: AttrVec, + #[visitable(extra = BoundKind::Bound)] pub bounds: GenericBounds, pub is_placeholder: bool, pub kind: GenericParamKind, @@ -470,7 +472,7 @@ impl GenericParam { /// Represents lifetime, type and const parameters attached to a declaration of /// a function, enum, trait, etc. -#[derive(Clone, Encodable, Decodable, Debug, Default)] +#[derive(Clone, Encodable, Decodable, Debug, Default, Walkable)] pub struct Generics { pub params: ThinVec, pub where_clause: WhereClause, @@ -478,7 +480,7 @@ pub struct Generics { } /// A where-clause in a definition. -#[derive(Clone, Encodable, Decodable, Debug, Default)] +#[derive(Clone, Encodable, Decodable, Debug, Default, Walkable)] pub struct WhereClause { /// `true` if we ate a `where` token. /// @@ -496,7 +498,7 @@ impl WhereClause { } /// A single predicate in a where-clause. -#[derive(Clone, Encodable, Decodable, Debug)] +#[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub struct WherePredicate { pub attrs: AttrVec, pub kind: WherePredicateKind, @@ -506,7 +508,7 @@ pub struct WherePredicate { } /// Predicate kind in where-clause. -#[derive(Clone, Encodable, Decodable, Debug)] +#[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub enum WherePredicateKind { /// A type bound (e.g., `for<'c> Foo: Send + Clone + 'c`). BoundPredicate(WhereBoundPredicate), @@ -519,42 +521,45 @@ pub enum WherePredicateKind { /// A type bound. /// /// E.g., `for<'c> Foo: Send + Clone + 'c`. -#[derive(Clone, Encodable, Decodable, Debug)] +#[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub struct WhereBoundPredicate { /// Any generics from a `for` binding. pub bound_generic_params: ThinVec, /// The type being bounded. pub bounded_ty: P, /// Trait and lifetime bounds (`Clone + Send + 'static`). + #[visitable(extra = BoundKind::Bound)] pub bounds: GenericBounds, } /// A lifetime predicate. /// /// E.g., `'a: 'b + 'c`. -#[derive(Clone, Encodable, Decodable, Debug)] +#[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub struct WhereRegionPredicate { + #[visitable(extra = LifetimeCtxt::Bound)] pub lifetime: Lifetime, + #[visitable(extra = BoundKind::Bound)] pub bounds: GenericBounds, } /// An equality predicate (unsupported). /// /// E.g., `T = int`. -#[derive(Clone, Encodable, Decodable, Debug)] +#[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub struct WhereEqPredicate { pub lhs_ty: P, pub rhs_ty: P, } -#[derive(Clone, Encodable, Decodable, Debug)] +#[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub struct Crate { - pub attrs: AttrVec, - pub items: ThinVec>, - pub spans: ModSpans, /// Must be equal to `CRATE_NODE_ID` after the crate root is expanded, but may hold /// expansion placeholders or an unassigned value (`DUMMY_NODE_ID`) before that. pub id: NodeId, + pub attrs: AttrVec, + pub items: ThinVec>, + pub spans: ModSpans, pub is_placeholder: bool, } @@ -608,7 +613,7 @@ pub enum MetaItemInner { /// A block (`{ .. }`). /// /// E.g., `{ .. }` as in `fn foo() { .. }`. -#[derive(Clone, Encodable, Decodable, Debug)] +#[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub struct Block { /// The statements in the block. pub stmts: ThinVec, @@ -622,7 +627,7 @@ pub struct Block { /// A match pattern. /// /// Patterns appear in match statements and some other contexts, such as `let` and `if let`. -#[derive(Clone, Encodable, Decodable, Debug)] +#[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub struct Pat { pub id: NodeId, pub kind: PatKind, @@ -770,7 +775,7 @@ impl From> for Pat { /// Patterns like the fields of `Foo { x, ref y, ref mut z }` /// are treated the same as `x: x, y: ref y, z: ref mut z`, /// except when `is_shorthand` is true. -#[derive(Clone, Encodable, Decodable, Debug)] +#[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub struct PatField { /// The identifier for the field. pub ident: Ident, @@ -784,7 +789,7 @@ pub struct PatField { } #[derive(Clone, Copy, Debug, Eq, PartialEq)] -#[derive(Encodable, Decodable, HashStable_Generic)] +#[derive(Encodable, Decodable, HashStable_Generic, Walkable)] pub enum ByRef { Yes(Mutability), No, @@ -806,7 +811,7 @@ impl ByRef { /// `.0` is the by-reference mode (`ref`, `ref mut`, or by value), /// `.1` is the mutability of the binding. #[derive(Clone, Copy, Debug, Eq, PartialEq)] -#[derive(Encodable, Decodable, HashStable_Generic)] +#[derive(Encodable, Decodable, HashStable_Generic, Walkable)] pub struct BindingMode(pub ByRef, pub Mutability); impl BindingMode { @@ -829,7 +834,7 @@ impl BindingMode { } } -#[derive(Clone, Encodable, Decodable, Debug)] +#[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub enum RangeEnd { /// `..=` or `...` Included(RangeSyntax), @@ -837,7 +842,7 @@ pub enum RangeEnd { Excluded, } -#[derive(Clone, Encodable, Decodable, Debug)] +#[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub enum RangeSyntax { /// `...` DotDotDot, @@ -848,7 +853,7 @@ pub enum RangeSyntax { /// All the different flavors of pattern that Rust recognizes. // // Adding a new variant? Please update `test_pat` in `tests/ui/macros/stringify.rs`. -#[derive(Clone, Encodable, Decodable, Debug)] +#[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub enum PatKind { /// A missing pattern, e.g. for an anonymous param in a bare fn like `fn f(u32)`. Missing, @@ -930,7 +935,7 @@ pub enum PatKind { } /// Whether the `..` is present in a struct fields pattern. -#[derive(Clone, Copy, Encodable, Decodable, Debug, PartialEq)] +#[derive(Clone, Copy, Encodable, Decodable, Debug, PartialEq, Walkable)] pub enum PatFieldsRest { /// `module::StructName { field, ..}` Rest, @@ -943,7 +948,7 @@ pub enum PatFieldsRest { /// The kind of borrow in an `AddrOf` expression, /// e.g., `&place` or `&raw const place`. #[derive(Clone, Copy, PartialEq, Eq, Debug)] -#[derive(Encodable, Decodable, HashStable_Generic)] +#[derive(Encodable, Decodable, HashStable_Generic, Walkable)] pub enum BorrowKind { /// A normal borrow, `&$expr` or `&mut $expr`. /// The resulting type is either `&'a T` or `&'a mut T` @@ -959,7 +964,7 @@ pub enum BorrowKind { Pin, } -#[derive(Clone, Copy, Debug, PartialEq, Encodable, Decodable, HashStable_Generic)] +#[derive(Clone, Copy, Debug, PartialEq, Encodable, Decodable, HashStable_Generic, Walkable)] pub enum BinOpKind { /// The `+` operator (addition) Add, @@ -1089,7 +1094,7 @@ impl From for BinOpKind { } } -#[derive(Clone, Copy, Debug, PartialEq, Encodable, Decodable, HashStable_Generic)] +#[derive(Clone, Copy, Debug, PartialEq, Encodable, Decodable, HashStable_Generic, Walkable)] pub enum AssignOpKind { /// The `+=` operator (addition) AddAssign, @@ -1141,7 +1146,7 @@ pub type AssignOp = Spanned; /// Unary operator. /// /// Note that `&data` is not an operator, it's an `AddrOf` expression. -#[derive(Clone, Copy, Debug, PartialEq, Encodable, Decodable, HashStable_Generic)] +#[derive(Clone, Copy, Debug, PartialEq, Encodable, Decodable, HashStable_Generic, Walkable)] pub enum UnOp { /// The `*` operator for dereferencing Deref, @@ -1215,7 +1220,7 @@ impl Stmt { } // Adding a new variant? Please update `test_stmt` in `tests/ui/macros/stringify.rs`. -#[derive(Clone, Encodable, Decodable, Debug)] +#[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub enum StmtKind { /// A local (let) binding. Let(P), @@ -1231,7 +1236,7 @@ pub enum StmtKind { MacCall(P), } -#[derive(Clone, Encodable, Decodable, Debug)] +#[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub struct MacCallStmt { pub mac: P, pub style: MacStmtStyle, @@ -1239,7 +1244,7 @@ pub struct MacCallStmt { pub tokens: Option, } -#[derive(Clone, Copy, PartialEq, Encodable, Decodable, Debug)] +#[derive(Clone, Copy, PartialEq, Encodable, Decodable, Debug, Walkable)] pub enum MacStmtStyle { /// The macro statement had a trailing semicolon (e.g., `foo! { ... };` /// `foo!(...);`, `foo![...];`). @@ -1253,7 +1258,7 @@ pub enum MacStmtStyle { } /// Local represents a `let` statement, e.g., `let : = ;`. -#[derive(Clone, Encodable, Decodable, Debug)] +#[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub struct Local { pub id: NodeId, pub super_: Option, @@ -1266,7 +1271,7 @@ pub struct Local { pub tokens: Option, } -#[derive(Clone, Encodable, Decodable, Debug)] +#[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub enum LocalKind { /// Local declaration. /// Example: `let x;` @@ -1306,7 +1311,7 @@ impl LocalKind { /// _ => { println!("no match!") }, /// } /// ``` -#[derive(Clone, Encodable, Decodable, Debug)] +#[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub struct Arm { pub attrs: AttrVec, /// Match arm pattern, e.g. `10` in `match foo { 10 => {}, _ => {} }`. @@ -1321,7 +1326,7 @@ pub struct Arm { } /// A single field in a struct expression, e.g. `x: value` and `y` in `Foo { x: value, y }`. -#[derive(Clone, Encodable, Decodable, Debug)] +#[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub struct ExprField { pub attrs: AttrVec, pub id: NodeId, @@ -1332,13 +1337,13 @@ pub struct ExprField { pub is_placeholder: bool, } -#[derive(Clone, PartialEq, Encodable, Decodable, Debug, Copy)] +#[derive(Clone, PartialEq, Encodable, Decodable, Debug, Copy, Walkable)] pub enum BlockCheckMode { Default, Unsafe(UnsafeSource), } -#[derive(Clone, PartialEq, Encodable, Decodable, Debug, Copy)] +#[derive(Clone, PartialEq, Encodable, Decodable, Debug, Copy, Walkable)] pub enum UnsafeSource { CompilerGenerated, UserProvided, @@ -1349,7 +1354,7 @@ pub enum UnsafeSource { /// These are usually found nested inside types (e.g., array lengths) /// or expressions (e.g., repeat counts), and also used to define /// explicit discriminant values for enum variants. -#[derive(Clone, Encodable, Decodable, Debug)] +#[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub struct AnonConst { pub id: NodeId, pub value: P, @@ -1633,7 +1638,7 @@ impl From> for Expr { } } -#[derive(Clone, Encodable, Decodable, Debug)] +#[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub struct Closure { pub binder: ClosureBinder, pub capture_clause: CaptureBy, @@ -1649,7 +1654,7 @@ pub struct Closure { } /// Limit types of a range (inclusive or exclusive). -#[derive(Copy, Clone, PartialEq, Encodable, Decodable, Debug)] +#[derive(Copy, Clone, PartialEq, Encodable, Decodable, Debug, Walkable)] pub enum RangeLimits { /// Inclusive at the beginning, exclusive at the end. HalfOpen, @@ -1680,7 +1685,7 @@ pub struct MethodCall { pub span: Span, } -#[derive(Clone, Encodable, Decodable, Debug)] +#[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub enum StructRest { /// `..x`. Base(P), @@ -1690,7 +1695,7 @@ pub enum StructRest { None, } -#[derive(Clone, Encodable, Decodable, Debug)] +#[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub struct StructExpr { pub qself: Option>, pub path: Path, @@ -1880,14 +1885,14 @@ pub enum ExprKind { } /// Used to differentiate between `for` loops and `for await` loops. -#[derive(Clone, Copy, Encodable, Decodable, Debug, PartialEq, Eq)] +#[derive(Clone, Copy, Encodable, Decodable, Debug, PartialEq, Eq, Walkable)] pub enum ForLoopKind { For, ForAwait, } /// Used to differentiate between `async {}` blocks and `gen {}` blocks. -#[derive(Clone, Encodable, Decodable, Debug, PartialEq, Eq)] +#[derive(Clone, Encodable, Decodable, Debug, PartialEq, Eq, Walkable)] pub enum GenBlockKind { Async, Gen, @@ -1912,7 +1917,7 @@ impl GenBlockKind { /// Whether we're unwrapping or wrapping an unsafe binder #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)] -#[derive(Encodable, Decodable, HashStable_Generic)] +#[derive(Encodable, Decodable, HashStable_Generic, Walkable)] pub enum UnsafeBinderCastKind { // e.g. `&i32` -> `unsafe<'a> &'a i32` Wrap, @@ -1934,7 +1939,7 @@ pub enum UnsafeBinderCastKind { /// ^~~~~ ^ /// ty position = 0 /// ``` -#[derive(Clone, Encodable, Decodable, Debug)] +#[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub struct QSelf { pub ty: P, @@ -1946,7 +1951,7 @@ pub struct QSelf { } /// A capture clause used in closures and `async` blocks. -#[derive(Clone, Copy, PartialEq, Encodable, Decodable, Debug, HashStable_Generic)] +#[derive(Clone, Copy, PartialEq, Encodable, Decodable, Debug, HashStable_Generic, Walkable)] pub enum CaptureBy { /// `move |x| y + x`. Value { @@ -1967,7 +1972,7 @@ pub enum CaptureBy { } /// Closure lifetime binder, `for<'a, 'b>` in `for<'a, 'b> |_: &'a (), _: &'b ()|`. -#[derive(Clone, Encodable, Decodable, Debug)] +#[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub enum ClosureBinder { /// The binder is not present, all closure lifetimes are inferred. NotPresent, @@ -1993,7 +1998,7 @@ pub enum ClosureBinder { /// Represents a macro invocation. The `path` indicates which macro /// is being invoked, and the `args` are arguments passed to it. -#[derive(Clone, Encodable, Decodable, Debug)] +#[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub struct MacCall { pub path: Path, pub args: P, @@ -2006,7 +2011,7 @@ impl MacCall { } /// Arguments passed to an attribute macro. -#[derive(Clone, Encodable, Decodable, Debug)] +#[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub enum AttrArgs { /// No arguments: `#[attr]`. Empty, @@ -2041,7 +2046,7 @@ impl AttrArgs { } /// Delimited arguments, as used in `#[attr()/[]/{}]` or `mac!()/[]/{}`. -#[derive(Clone, Encodable, Decodable, Debug, HashStable_Generic)] +#[derive(Clone, Encodable, Decodable, Debug, HashStable_Generic, Walkable)] pub struct DelimArgs { pub dspan: DelimSpan, pub delim: Delimiter, // Note: `Delimiter::Invisible` never occurs @@ -2057,7 +2062,7 @@ impl DelimArgs { } /// Represents a macro definition. -#[derive(Clone, Encodable, Decodable, Debug, HashStable_Generic)] +#[derive(Clone, Encodable, Decodable, Debug, HashStable_Generic, Walkable)] pub struct MacroDef { pub body: P, /// `true` if macro was defined with `macro_rules`. @@ -2065,7 +2070,7 @@ pub struct MacroDef { } #[derive(Clone, Encodable, Decodable, Debug, Copy, Hash, Eq, PartialEq)] -#[derive(HashStable_Generic)] +#[derive(HashStable_Generic, Walkable)] pub enum StrStyle { /// A regular string, like `"foo"`. Cooked, @@ -2076,7 +2081,7 @@ pub enum StrStyle { } /// The kind of match expression -#[derive(Clone, Copy, Encodable, Decodable, Debug, PartialEq)] +#[derive(Clone, Copy, Encodable, Decodable, Debug, PartialEq, Walkable)] pub enum MatchKind { /// match expr { ... } Prefix, @@ -2085,7 +2090,7 @@ pub enum MatchKind { } /// The kind of yield expression -#[derive(Clone, Encodable, Decodable, Debug)] +#[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub enum YieldKind { /// yield expr { ... } Prefix(Option>), @@ -2136,7 +2141,7 @@ pub struct MetaItemLit { } /// Similar to `MetaItemLit`, but restricted to string literals. -#[derive(Clone, Copy, Encodable, Decodable, Debug)] +#[derive(Clone, Copy, Encodable, Decodable, Debug, Walkable)] pub struct StrLit { /// The original literal as written in source code. pub symbol: Symbol, @@ -2265,7 +2270,7 @@ impl LitKind { // N.B., If you change this, you'll probably want to change the corresponding // type structure in `middle/ty.rs` as well. -#[derive(Clone, Encodable, Decodable, Debug)] +#[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub struct MutTy { pub ty: P, pub mutbl: Mutability, @@ -2389,7 +2394,7 @@ impl UintTy { /// * the `RetTy` in `Trait(ArgTy, ArgTy) -> RetTy` /// * the `C = { Ct }` in `Trait` (feature `associated_const_equality`) /// * the `f(..): Bound` in `Trait` (feature `return_type_notation`) -#[derive(Clone, Encodable, Decodable, Debug)] +#[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub struct AssocItemConstraint { pub id: NodeId, pub ident: Ident, @@ -2398,7 +2403,7 @@ pub struct AssocItemConstraint { pub span: Span, } -#[derive(Clone, Encodable, Decodable, Debug)] +#[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub enum Term { Ty(P), Const(AnonConst), @@ -2417,7 +2422,7 @@ impl From for Term { } /// The kind of [associated item constraint][AssocItemConstraint]. -#[derive(Clone, Encodable, Decodable, Debug)] +#[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub enum AssocItemConstraintKind { /// An equality constraint for an associated item (e.g., `AssocTy = Ty` in `Trait`). /// @@ -2427,10 +2432,13 @@ pub enum AssocItemConstraintKind { /// bindings*. Similarly with associated const equality constraints and *associated const bindings*. Equality { term: Term }, /// A bound on an associated type (e.g., `AssocTy: Bound` in `Trait`). - Bound { bounds: GenericBounds }, + Bound { + #[visitable(extra = BoundKind::Bound)] + bounds: GenericBounds, + }, } -#[derive(Encodable, Decodable, Debug)] +#[derive(Encodable, Decodable, Debug, Walkable)] pub struct Ty { pub id: NodeId, pub kind: TyKind, @@ -2474,7 +2482,7 @@ impl Ty { } } -#[derive(Clone, Encodable, Decodable, Debug)] +#[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub struct FnPtrTy { pub safety: Safety, pub ext: Extern, @@ -2485,7 +2493,7 @@ pub struct FnPtrTy { pub decl_span: Span, } -#[derive(Clone, Encodable, Decodable, Debug)] +#[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub struct UnsafeBinderTy { pub generic_params: ThinVec, pub inner_ty: P, @@ -2494,7 +2502,7 @@ pub struct UnsafeBinderTy { /// The various kinds of type recognized by the compiler. // // Adding a new variant? Please update `test_ty` in `tests/ui/macros/stringify.rs`. -#[derive(Clone, Encodable, Decodable, Debug)] +#[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub enum TyKind { /// A variable-length slice (`[T]`). Slice(P), @@ -2503,11 +2511,11 @@ pub enum TyKind { /// A raw pointer (`*const T` or `*mut T`). Ptr(MutTy), /// A reference (`&'a T` or `&'a mut T`). - Ref(Option, MutTy), + Ref(#[visitable(extra = LifetimeCtxt::Ref)] Option, MutTy), /// A pinned reference (`&'a pin const T` or `&'a pin mut T`). /// /// Desugars into `Pin<&'a T>` or `Pin<&'a mut T>`. - PinnedRef(Option, MutTy), + PinnedRef(#[visitable(extra = LifetimeCtxt::Ref)] Option, MutTy), /// A function pointer type (e.g., `fn(usize) -> bool`). FnPtr(P), /// An unsafe existential lifetime binder (e.g., `unsafe<'a> &'a ()`). @@ -2523,14 +2531,14 @@ pub enum TyKind { Path(Option>, Path), /// A trait object type `Bound1 + Bound2 + Bound3` /// where `Bound` is a trait or a lifetime. - TraitObject(GenericBounds, TraitObjectSyntax), + TraitObject(#[visitable(extra = BoundKind::TraitObject)] GenericBounds, TraitObjectSyntax), /// An `impl Bound1 + Bound2 + Bound3` type /// where `Bound` is a trait or a lifetime. /// /// The `NodeId` exists to prevent lowering from having to /// generate `NodeId`s on the fly, which would complicate /// the generation of opaque `type Foo = impl Trait` items significantly. - ImplTrait(NodeId, GenericBounds), + ImplTrait(NodeId, #[visitable(extra = BoundKind::Impl)] GenericBounds), /// No-op; kept solely so that we can pretty-print faithfully. Paren(P), /// Unused for now. @@ -2608,7 +2616,7 @@ impl TyKind { } /// A pattern type pattern. -#[derive(Clone, Encodable, Decodable, Debug)] +#[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub struct TyPat { pub id: NodeId, pub kind: TyPatKind, @@ -2619,7 +2627,7 @@ pub struct TyPat { /// All the different flavors of pattern that Rust recognizes. // // Adding a new variant? Please update `test_pat` in `tests/ui/macros/stringify.rs`. -#[derive(Clone, Encodable, Decodable, Debug)] +#[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub enum TyPatKind { /// A range pattern (e.g., `1...2`, `1..2`, `1..`, `..2`, `1..=2`, `..=2`). Range(Option>, Option>, Spanned), @@ -2631,7 +2639,7 @@ pub enum TyPatKind { } /// Syntax used to declare a trait object. -#[derive(Clone, Copy, PartialEq, Encodable, Decodable, Debug, HashStable_Generic)] +#[derive(Clone, Copy, PartialEq, Encodable, Decodable, Debug, HashStable_Generic, Walkable)] #[repr(u8)] pub enum TraitObjectSyntax { // SAFETY: When adding new variants make sure to update the `Tag` impl. @@ -2658,10 +2666,10 @@ unsafe impl Tag for TraitObjectSyntax { } } -#[derive(Clone, Encodable, Decodable, Debug)] +#[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub enum PreciseCapturingArg { /// Lifetime parameter. - Lifetime(Lifetime), + Lifetime(#[visitable(extra = LifetimeCtxt::GenericArg)] Lifetime), /// Type or const parameter. Arg(Path, NodeId), } @@ -2669,7 +2677,7 @@ pub enum PreciseCapturingArg { /// Inline assembly operand explicit register or register class. /// /// E.g., `"eax"` as in `asm!("mov eax, 2", out("eax") result)`. -#[derive(Clone, Copy, Encodable, Decodable, Debug)] +#[derive(Clone, Copy, Encodable, Decodable, Debug, Walkable)] pub enum InlineAsmRegOrRegClass { Reg(Symbol), RegClass(Symbol), @@ -2738,7 +2746,7 @@ impl std::fmt::Debug for InlineAsmOptions { } } -#[derive(Clone, PartialEq, Encodable, Decodable, Debug, Hash, HashStable_Generic)] +#[derive(Clone, PartialEq, Encodable, Decodable, Debug, Hash, HashStable_Generic, Walkable)] pub enum InlineAsmTemplatePiece { String(Cow<'static, str>), Placeholder { operand_idx: usize, modifier: Option, span: Span }, @@ -2786,7 +2794,7 @@ impl InlineAsmTemplatePiece { /// `DefCollector`. Instead this is deferred until AST lowering where we /// lower it to an `AnonConst` (for functions) or a `Path` (for statics) /// depending on what the path resolves to. -#[derive(Clone, Encodable, Decodable, Debug)] +#[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub struct InlineAsmSym { pub id: NodeId, pub qself: Option>, @@ -2796,7 +2804,7 @@ pub struct InlineAsmSym { /// Inline assembly operand. /// /// E.g., `out("eax") result` as in `asm!("mov eax, 2", out("eax") result)`. -#[derive(Clone, Encodable, Decodable, Debug)] +#[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub enum InlineAsmOperand { In { reg: InlineAsmRegOrRegClass, @@ -2841,7 +2849,7 @@ impl InlineAsmOperand { } } -#[derive(Clone, Copy, Encodable, Decodable, Debug, HashStable_Generic)] +#[derive(Clone, Copy, Encodable, Decodable, Debug, HashStable_Generic, Walkable)] pub enum AsmMacro { /// The `asm!` macro Asm, @@ -2880,13 +2888,14 @@ impl AsmMacro { /// Inline assembly. /// /// E.g., `asm!("NOP");`. -#[derive(Clone, Encodable, Decodable, Debug)] +#[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub struct InlineAsm { pub asm_macro: AsmMacro, pub template: Vec, pub template_strs: Box<[(Symbol, Option, Span)]>, pub operands: Vec<(InlineAsmOperand, Span)>, pub clobber_abis: Vec<(Symbol, Span)>, + #[visitable(ignore)] pub options: InlineAsmOptions, pub line_spans: Vec, } @@ -2894,7 +2903,7 @@ pub struct InlineAsm { /// A parameter in a function header. /// /// E.g., `bar: usize` as in `fn foo(bar: usize)`. -#[derive(Clone, Encodable, Decodable, Debug)] +#[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub struct Param { pub attrs: AttrVec, pub ty: P, @@ -3022,7 +3031,7 @@ impl Param { /// /// Please note that it's different from `FnHeader` structure /// which contains metadata about function safety, asyncness, constness and ABI. -#[derive(Clone, Encodable, Decodable, Debug)] +#[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub struct FnDecl { pub inputs: ThinVec, pub output: FnRetTy, @@ -3038,7 +3047,7 @@ impl FnDecl { } /// Is the trait definition an auto trait? -#[derive(Copy, Clone, PartialEq, Encodable, Decodable, Debug, HashStable_Generic)] +#[derive(Copy, Clone, PartialEq, Encodable, Decodable, Debug, HashStable_Generic, Walkable)] pub enum IsAuto { Yes, No, @@ -3046,7 +3055,7 @@ pub enum IsAuto { /// Safety of items. #[derive(Copy, Clone, PartialEq, Eq, Hash, Encodable, Decodable, Debug)] -#[derive(HashStable_Generic)] +#[derive(HashStable_Generic, Walkable)] pub enum Safety { /// `unsafe` an item is explicitly marked as `unsafe`. Unsafe(Span), @@ -3062,7 +3071,7 @@ pub enum Safety { /// Coroutine markers are things that cause the function to generate a coroutine, such as `async`, /// which makes the function return `impl Future`, or `gen`, which makes the function return `impl /// Iterator`. -#[derive(Copy, Clone, Encodable, Decodable, Debug)] +#[derive(Copy, Clone, Encodable, Decodable, Debug, Walkable)] pub enum CoroutineKind { /// `async`, which returns an `impl Future`. Async { span: Span, closure_id: NodeId, return_impl_trait_id: NodeId }, @@ -3111,7 +3120,7 @@ impl CoroutineKind { } #[derive(Copy, Clone, PartialEq, Eq, Hash, Encodable, Decodable, Debug)] -#[derive(HashStable_Generic)] +#[derive(HashStable_Generic, Walkable)] pub enum Const { Yes(Span), No, @@ -3119,13 +3128,13 @@ pub enum Const { /// Item defaultness. /// For details see the [RFC #2532](https://github.com/rust-lang/rfcs/pull/2532). -#[derive(Copy, Clone, PartialEq, Encodable, Decodable, Debug, HashStable_Generic)] +#[derive(Copy, Clone, PartialEq, Encodable, Decodable, Debug, HashStable_Generic, Walkable)] pub enum Defaultness { Default(Span), Final, } -#[derive(Copy, Clone, PartialEq, Encodable, Decodable, HashStable_Generic)] +#[derive(Copy, Clone, PartialEq, Encodable, Decodable, HashStable_Generic, Walkable)] pub enum ImplPolarity { /// `impl Trait for Type` Positive, @@ -3144,7 +3153,7 @@ impl fmt::Debug for ImplPolarity { /// The polarity of a trait bound. #[derive(Copy, Clone, PartialEq, Eq, Encodable, Decodable, Debug, Hash)] -#[derive(HashStable_Generic)] +#[derive(HashStable_Generic, Walkable)] pub enum BoundPolarity { /// `Type: Trait` Positive, @@ -3166,7 +3175,7 @@ impl BoundPolarity { /// The constness of a trait bound. #[derive(Copy, Clone, PartialEq, Eq, Encodable, Decodable, Debug, Hash)] -#[derive(HashStable_Generic)] +#[derive(HashStable_Generic, Walkable)] pub enum BoundConstness { /// `Type: Trait` Never, @@ -3188,7 +3197,7 @@ impl BoundConstness { /// The asyncness of a trait bound. #[derive(Copy, Clone, PartialEq, Eq, Encodable, Decodable, Debug)] -#[derive(HashStable_Generic)] +#[derive(HashStable_Generic, Walkable)] pub enum BoundAsyncness { /// `Type: Trait` Normal, @@ -3205,7 +3214,7 @@ impl BoundAsyncness { } } -#[derive(Clone, Encodable, Decodable, Debug)] +#[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub enum FnRetTy { /// Returns type is not specified. /// @@ -3225,14 +3234,14 @@ impl FnRetTy { } } -#[derive(Clone, Copy, PartialEq, Encodable, Decodable, Debug)] +#[derive(Clone, Copy, PartialEq, Encodable, Decodable, Debug, Walkable)] pub enum Inline { Yes, No, } /// Module item kind. -#[derive(Clone, Encodable, Decodable, Debug)] +#[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub enum ModKind { /// Module with inlined definition `mod foo { ... }`, /// or with definition outlined to a separate file `mod foo;` and already loaded from it. @@ -3243,7 +3252,7 @@ pub enum ModKind { Unloaded, } -#[derive(Copy, Clone, Encodable, Decodable, Debug, Default)] +#[derive(Copy, Clone, Encodable, Decodable, Debug, Default, Walkable)] pub struct ModSpans { /// `inner_span` covers the body of the module; for a file module, its the whole file. /// For an inline module, its the span inside the `{ ... }`, not including the curly braces. @@ -3254,7 +3263,7 @@ pub struct ModSpans { /// Foreign module declaration. /// /// E.g., `extern { .. }` or `extern "C" { .. }`. -#[derive(Clone, Encodable, Decodable, Debug)] +#[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub struct ForeignMod { /// Span of the `extern` keyword. pub extern_span: Span, @@ -3265,12 +3274,13 @@ pub struct ForeignMod { pub items: ThinVec>, } -#[derive(Clone, Encodable, Decodable, Debug)] +#[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub struct EnumDef { pub variants: ThinVec, } + /// Enum variant. -#[derive(Clone, Encodable, Decodable, Debug)] +#[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub struct Variant { /// Attributes of the variant. pub attrs: AttrVec, @@ -3292,7 +3302,7 @@ pub struct Variant { } /// Part of `use` item to the right of its prefix. -#[derive(Clone, Encodable, Decodable, Debug)] +#[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub enum UseTreeKind { /// `use prefix` or `use prefix as rename` Simple(Option), @@ -3311,7 +3321,7 @@ pub enum UseTreeKind { /// A tree of paths sharing common prefixes. /// Used in `use` items both at top-level and inside of braces in import groups. -#[derive(Clone, Encodable, Decodable, Debug)] +#[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub struct UseTree { pub prefix: Path, pub kind: UseTreeKind, @@ -3333,7 +3343,7 @@ impl UseTree { /// Distinguishes between `Attribute`s that decorate items and Attributes that /// are contained as statements within items. These two cases need to be /// distinguished for pretty-printing. -#[derive(Clone, PartialEq, Encodable, Decodable, Debug, Copy, HashStable_Generic)] +#[derive(Clone, PartialEq, Encodable, Decodable, Debug, Copy, HashStable_Generic, Walkable)] pub enum AttrStyle { Outer, Inner, @@ -3343,7 +3353,7 @@ pub enum AttrStyle { pub type AttrVec = ThinVec; /// A syntax-level representation of an attribute. -#[derive(Clone, Encodable, Decodable, Debug)] +#[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub struct Attribute { pub kind: AttrKind, pub id: AttrId, @@ -3353,7 +3363,7 @@ pub struct Attribute { pub span: Span, } -#[derive(Clone, Encodable, Decodable, Debug)] +#[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub enum AttrKind { /// A normal attribute. Normal(P), @@ -3364,7 +3374,7 @@ pub enum AttrKind { DocComment(CommentKind, Symbol), } -#[derive(Clone, Encodable, Decodable, Debug)] +#[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub struct NormalAttr { pub item: AttrItem, // Tokens for the full attribute, e.g. `#[foo]`, `#![bar]`. @@ -3385,7 +3395,7 @@ impl NormalAttr { } } -#[derive(Clone, Encodable, Decodable, Debug)] +#[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub struct AttrItem { pub unsafety: Safety, pub path: Path, @@ -3411,20 +3421,20 @@ impl AttrItem { /// that the `ref_id` is for. The `impl_id` maps to the "self type" of this impl. /// If this impl is an `ItemKind::Impl`, the `impl_id` is redundant (it could be the /// same as the impl's `NodeId`). -#[derive(Clone, Encodable, Decodable, Debug)] +#[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub struct TraitRef { pub path: Path, pub ref_id: NodeId, } /// Whether enclosing parentheses are present or not. -#[derive(Clone, Encodable, Decodable, Debug)] +#[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub enum Parens { Yes, No, } -#[derive(Clone, Encodable, Decodable, Debug)] +#[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub struct PolyTraitRef { /// The `'a` in `for<'a> Foo<&'a T>`. pub bound_generic_params: ThinVec, @@ -3460,14 +3470,14 @@ impl PolyTraitRef { } } -#[derive(Clone, Encodable, Decodable, Debug)] +#[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub struct Visibility { pub kind: VisibilityKind, pub span: Span, pub tokens: Option, } -#[derive(Clone, Encodable, Decodable, Debug)] +#[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub enum VisibilityKind { Public, Restricted { path: P, id: NodeId, shorthand: bool }, @@ -3483,7 +3493,7 @@ impl VisibilityKind { /// Field definition in a struct, variant or union. /// /// E.g., `bar: usize` as in `struct Foo { bar: usize }`. -#[derive(Clone, Encodable, Decodable, Debug)] +#[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub struct FieldDef { pub attrs: AttrVec, pub id: NodeId, @@ -3498,14 +3508,14 @@ pub struct FieldDef { } /// Was parsing recovery performed? -#[derive(Copy, Clone, Debug, Encodable, Decodable, HashStable_Generic)] +#[derive(Copy, Clone, Debug, Encodable, Decodable, HashStable_Generic, Walkable)] pub enum Recovered { No, Yes(ErrorGuaranteed), } /// Fields and constructor ids of enum variants and structs. -#[derive(Clone, Encodable, Decodable, Debug)] +#[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub enum VariantData { /// Struct variant. /// @@ -3591,7 +3601,7 @@ impl Item { } /// `extern` qualifier on a function item or function type. -#[derive(Clone, Copy, Encodable, Decodable, Debug)] +#[derive(Clone, Copy, Encodable, Decodable, Debug, Walkable)] pub enum Extern { /// No explicit extern keyword was used. /// @@ -3622,7 +3632,7 @@ impl Extern { /// /// All the information between the visibility and the name of the function is /// included in this struct (e.g., `async unsafe fn` or `const extern "C" fn`). -#[derive(Clone, Copy, Encodable, Decodable, Debug)] +#[derive(Clone, Copy, Encodable, Decodable, Debug, Walkable)] pub struct FnHeader { /// Whether this is `unsafe`, or has a default safety. pub safety: Safety, @@ -3688,14 +3698,16 @@ impl Default for FnHeader { } } -#[derive(Clone, Encodable, Decodable, Debug)] +#[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub struct Trait { pub constness: Const, pub safety: Safety, pub is_auto: IsAuto, pub ident: Ident, pub generics: Generics, + #[visitable(extra = BoundKind::SuperTraits)] pub bounds: GenericBounds, + #[visitable(extra = AssocCtxt::Trait)] pub items: ThinVec>, } @@ -3717,14 +3729,14 @@ pub struct Trait { /// ``` /// /// If there is no where clause, then this is `false` with `DUMMY_SP`. -#[derive(Copy, Clone, Encodable, Decodable, Debug, Default)] +#[derive(Copy, Clone, Encodable, Decodable, Debug, Default, Walkable)] pub struct TyAliasWhereClause { pub has_where_token: bool, pub span: Span, } /// The span information for the two where clauses on a `TyAlias`. -#[derive(Copy, Clone, Encodable, Decodable, Debug, Default)] +#[derive(Copy, Clone, Encodable, Decodable, Debug, Default, Walkable)] pub struct TyAliasWhereClauses { /// Before the equals sign. pub before: TyAliasWhereClause, @@ -3736,12 +3748,13 @@ pub struct TyAliasWhereClauses { pub split: usize, } -#[derive(Clone, Encodable, Decodable, Debug)] +#[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub struct TyAlias { pub defaultness: Defaultness, pub ident: Ident, pub generics: Generics, pub where_clauses: TyAliasWhereClauses, + #[visitable(extra = BoundKind::Bound)] pub bounds: GenericBounds, pub ty: Option>, } @@ -3759,7 +3772,7 @@ pub struct Impl { pub items: ThinVec>, } -#[derive(Clone, Encodable, Decodable, Debug, Default)] +#[derive(Clone, Encodable, Decodable, Debug, Default, Walkable)] pub struct FnContract { pub requires: Option>, pub ensures: Option>, @@ -3776,7 +3789,7 @@ pub struct Fn { pub body: Option>, } -#[derive(Clone, Encodable, Decodable, Debug)] +#[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub struct Delegation { /// Path resolution id. pub id: NodeId, @@ -3789,7 +3802,7 @@ pub struct Delegation { pub from_glob: bool, } -#[derive(Clone, Encodable, Decodable, Debug)] +#[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub struct DelegationMac { pub qself: Option>, pub prefix: Path, @@ -3798,7 +3811,7 @@ pub struct DelegationMac { pub body: Option>, } -#[derive(Clone, Encodable, Decodable, Debug)] +#[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub struct StaticItem { pub ident: Ident, pub ty: P, @@ -3808,7 +3821,7 @@ pub struct StaticItem { pub define_opaque: Option>, } -#[derive(Clone, Encodable, Decodable, Debug)] +#[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub struct ConstItem { pub defaultness: Defaultness, pub ident: Ident, diff --git a/compiler/rustc_ast/src/format.rs b/compiler/rustc_ast/src/format.rs index 28d260419c51..c2a1de60a981 100644 --- a/compiler/rustc_ast/src/format.rs +++ b/compiler/rustc_ast/src/format.rs @@ -1,5 +1,5 @@ use rustc_data_structures::fx::FxHashMap; -use rustc_macros::{Decodable, Encodable}; +use rustc_macros::{Decodable, Encodable, Walkable}; use rustc_span::{Ident, Span, Symbol}; use crate::Expr; @@ -41,7 +41,7 @@ use crate::token::LitKind; /// Basically the "AST" for a complete `format_args!()`. /// /// E.g., `format_args!("hello {name}");`. -#[derive(Clone, Encodable, Decodable, Debug)] +#[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub struct FormatArgs { pub span: Span, pub template: Vec, @@ -63,7 +63,7 @@ pub struct FormatArgs { /// A piece of a format template string. /// /// E.g. "hello" or "{name}". -#[derive(Clone, Encodable, Decodable, Debug)] +#[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub enum FormatArgsPiece { Literal(Symbol), Placeholder(FormatPlaceholder), @@ -73,7 +73,7 @@ pub enum FormatArgsPiece { /// /// E.g. `1, 2, name="ferris", n=3`, /// but also implicit captured arguments like `x` in `format_args!("{x}")`. -#[derive(Clone, Encodable, Decodable, Debug)] +#[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub struct FormatArguments { arguments: Vec, num_unnamed_args: usize, @@ -144,13 +144,13 @@ impl FormatArguments { } } -#[derive(Clone, Encodable, Decodable, Debug)] +#[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub struct FormatArgument { pub kind: FormatArgumentKind, pub expr: P, } -#[derive(Clone, Encodable, Decodable, Debug)] +#[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub enum FormatArgumentKind { /// `format_args(…, arg)` Normal, @@ -170,24 +170,28 @@ impl FormatArgumentKind { } } -#[derive(Clone, Encodable, Decodable, Debug, PartialEq, Eq)] +#[derive(Clone, Encodable, Decodable, Debug, PartialEq, Eq, Walkable)] pub struct FormatPlaceholder { /// Index into [`FormatArgs::arguments`]. pub argument: FormatArgPosition, /// The span inside the format string for the full `{…}` placeholder. pub span: Option, /// `{}`, `{:?}`, or `{:x}`, etc. + #[visitable(ignore)] pub format_trait: FormatTrait, /// `{}` or `{:.5}` or `{:-^20}`, etc. + #[visitable(ignore)] pub format_options: FormatOptions, } -#[derive(Clone, Encodable, Decodable, Debug, PartialEq, Eq)] +#[derive(Clone, Encodable, Decodable, Debug, PartialEq, Eq, Walkable)] pub struct FormatArgPosition { /// Which argument this position refers to (Ok), /// or would've referred to if it existed (Err). + #[visitable(ignore)] pub index: Result, /// What kind of position this is. See [`FormatArgPositionKind`]. + #[visitable(ignore)] pub kind: FormatArgPositionKind, /// The span of the name or number. pub span: Option, diff --git a/compiler/rustc_ast/src/mut_visit.rs b/compiler/rustc_ast/src/mut_visit.rs index 3eae19f4daa1..06708e2e703a 100644 --- a/compiler/rustc_ast/src/mut_visit.rs +++ b/compiler/rustc_ast/src/mut_visit.rs @@ -12,14 +12,14 @@ use std::panic; use rustc_data_structures::flat_map_in_place::FlatMapInPlace; use rustc_span::source_map::Spanned; -use rustc_span::{Ident, Span}; +use rustc_span::{Ident, Span, Symbol}; use smallvec::{SmallVec, smallvec}; use thin_vec::ThinVec; use crate::ast::*; use crate::ptr::P; use crate::tokenstream::*; -use crate::visit::{AssocCtxt, BoundKind, FnCtxt, VisitorResult, try_visit, visit_opt, walk_list}; +use crate::visit::{AssocCtxt, BoundKind, FnCtxt, LifetimeCtxt, VisitorResult, try_visit}; mod sealed { use rustc_ast_ir::visit::VisitorResult; @@ -36,11 +36,249 @@ mod sealed { use sealed::MutVisitorResult; +pub(crate) trait MutVisitable { + type Extra: Copy; + fn visit_mut(&mut self, visitor: &mut V, extra: Self::Extra); +} + +impl MutVisitable for P +where + T: MutVisitable, +{ + type Extra = T::Extra; + fn visit_mut(&mut self, visitor: &mut V, extra: Self::Extra) { + (**self).visit_mut(visitor, extra) + } +} + +impl MutVisitable for Option +where + T: MutVisitable, +{ + type Extra = T::Extra; + fn visit_mut(&mut self, visitor: &mut V, extra: Self::Extra) { + if let Some(this) = self { + this.visit_mut(visitor, extra) + } + } +} + +impl MutVisitable for Spanned +where + T: MutVisitable, +{ + type Extra = T::Extra; + fn visit_mut(&mut self, visitor: &mut V, extra: Self::Extra) { + let Spanned { span, node } = self; + span.visit_mut(visitor, ()); + node.visit_mut(visitor, extra); + } +} + +impl MutVisitable for [T] +where + T: MutVisitable, +{ + type Extra = T::Extra; + fn visit_mut(&mut self, visitor: &mut V, extra: Self::Extra) { + for item in self { + item.visit_mut(visitor, extra); + } + } +} + +impl MutVisitable for Vec +where + T: MutVisitable, +{ + type Extra = T::Extra; + fn visit_mut(&mut self, visitor: &mut V, extra: Self::Extra) { + for item in self { + item.visit_mut(visitor, extra); + } + } +} + +impl MutVisitable for (T,) +where + T: MutVisitable, +{ + type Extra = T::Extra; + fn visit_mut(&mut self, visitor: &mut V, extra: Self::Extra) { + self.0.visit_mut(visitor, extra); + } +} + +impl MutVisitable for (T1, T2) +where + T1: MutVisitable, + T2: MutVisitable, +{ + type Extra = (); + fn visit_mut(&mut self, visitor: &mut V, extra: Self::Extra) { + self.0.visit_mut(visitor, extra); + self.1.visit_mut(visitor, extra); + } +} + +impl MutVisitable for (T1, T2, T3) +where + T1: MutVisitable, + T2: MutVisitable, + T3: MutVisitable, +{ + type Extra = (); + fn visit_mut(&mut self, visitor: &mut V, extra: Self::Extra) { + self.0.visit_mut(visitor, extra); + self.1.visit_mut(visitor, extra); + self.2.visit_mut(visitor, extra); + } +} + +impl MutVisitable for (T1, T2, T3, T4) +where + T1: MutVisitable, + T2: MutVisitable, + T3: MutVisitable, + T4: MutVisitable, +{ + type Extra = (); + fn visit_mut(&mut self, visitor: &mut V, extra: Self::Extra) { + self.0.visit_mut(visitor, extra); + self.1.visit_mut(visitor, extra); + self.2.visit_mut(visitor, extra); + self.3.visit_mut(visitor, extra); + } +} + +pub trait MutWalkable { + fn walk_mut(&mut self, visitor: &mut V); +} + +macro_rules! visit_visitable { + (mut $visitor:expr, $($expr:expr),* $(,)?) => {{ + $(MutVisitable::visit_mut($expr, $visitor, ());)* + }}; +} + +macro_rules! visit_visitable_with { + (mut $visitor:expr, $expr:expr, $extra:expr $(,)?) => { + MutVisitable::visit_mut($expr, $visitor, $extra) + }; +} + +macro_rules! walk_walkable { + ($visitor:expr, $expr:expr, mut) => { + MutWalkable::walk_mut($expr, $visitor) + }; +} + +macro_rules! impl_visitable { + (|&mut $self:ident: $self_ty:ty, + $vis:ident: &mut $vis_ty:ident, + $extra:ident: $extra_ty:ty| $block:block) => { + #[allow(unused_parens, non_local_definitions)] + impl<$vis_ty: MutVisitor> MutVisitable<$vis_ty> for $self_ty { + type Extra = $extra_ty; + fn visit_mut(&mut $self, $vis: &mut $vis_ty, $extra: Self::Extra) -> V::Result { + $block + } + } + }; +} + +macro_rules! impl_walkable { + ($(<$K:ident: $Kb:ident>)? |&mut $self:ident: $self_ty:ty, + $vis:ident: &mut $vis_ty:ident| $block:block) => { + #[allow(unused_parens, non_local_definitions)] + impl<$($K: $Kb,)? $vis_ty: MutVisitor> MutWalkable<$vis_ty> for $self_ty { + fn walk_mut(&mut $self, $vis: &mut $vis_ty) -> V::Result { + $block + } + } + }; +} + +macro_rules! impl_visitable_noop { + ( $($ty:ty,)*) => { + $( + impl_visitable!(|&mut self: $ty, _vis: &mut V, _extra: ()| {}); + )* + }; +} + +macro_rules! impl_visitable_list { + ( $($ty:ty,)*) => { + $(impl MutVisitable for $ty + where + for<'a> &'a mut $ty: IntoIterator, + T: MutVisitable, + { + type Extra = >::Extra; + + #[inline] + fn visit_mut(&mut self, visitor: &mut V, extra: Self::Extra) { + for i in self { + i.visit_mut(visitor, extra); + } + } + })* + } +} + +macro_rules! impl_visitable_direct { + ( $($ty:ty,)*) => { + $(impl_visitable!( + |&mut self: $ty, visitor: &mut V, _extra: ()| { + MutWalkable::walk_mut(self, visitor) + } + );)* + } +} + +macro_rules! impl_visitable_calling_walkable { + ( + $( fn $method:ident($ty:ty $(, $extra_name:ident: $extra_ty:ty)?); )* + ) => { + $(fn $method(&mut self, node: &mut $ty $(, $extra_name:$extra_ty)?) { + impl_visitable!(|&mut self: $ty, visitor: &mut V, extra: ($($extra_ty)?)| { + let ($($extra_name)?) = extra; + visitor.$method(self $(, $extra_name)?); + }); + walk_walkable!(self, node, mut) + })* + } +} + +macro_rules! define_named_walk { + ((mut) $Visitor:ident + $( pub fn $method:ident($ty:ty); )* + ) => { + $(pub fn $method(visitor: &mut V, node: &mut $ty) { + walk_walkable!(visitor, node, mut) + })* + }; +} + super::common_visitor_and_walkers!((mut) MutVisitor); macro_rules! generate_flat_map_visitor_fns { ($($name:ident, $Ty:ty, $flat_map_fn:ident$(, $param:ident: $ParamTy:ty)*;)+) => { $( + #[allow(unused_parens)] + impl MutVisitable for ThinVec<$Ty> { + type Extra = ($($ParamTy),*); + + #[inline] + fn visit_mut( + &mut self, + visitor: &mut V, + ($($param),*): Self::Extra, + ) -> V::Result { + $name(visitor, self $(, $param)*) + } + } + fn $name( vis: &mut V, values: &mut ThinVec<$Ty>, @@ -78,15 +316,6 @@ pub fn walk_flat_map_pat_field( smallvec![fp] } -fn visit_nested_use_tree( - vis: &mut V, - nested_tree: &mut UseTree, - nested_id: &mut NodeId, -) { - vis.visit_id(nested_id); - vis.visit_use_tree(nested_tree); -} - macro_rules! generate_walk_flat_map_fns { ($($fn_name:ident($Ty:ty$(,$extra_name:ident: $ExtraTy:ty)*) => $visit_fn_name:ident;)+) => {$( pub fn $fn_name(vis: &mut V, mut value: $Ty$(,$extra_name: $ExtraTy)*) -> SmallVec<[$Ty; 1]> { @@ -109,14 +338,6 @@ generate_walk_flat_map_fns! { walk_flat_map_assoc_item(P, ctxt: AssocCtxt) => visit_assoc_item; } -fn walk_ty_alias_where_clauses(vis: &mut T, tawcs: &mut TyAliasWhereClauses) { - let TyAliasWhereClauses { before, after, split: _ } = tawcs; - let TyAliasWhereClause { has_where_token: _, span: span_before } = before; - let TyAliasWhereClause { has_where_token: _, span: span_after } = after; - vis.visit_span(span_before); - vis.visit_span(span_after); -} - pub fn walk_filter_map_expr(vis: &mut T, mut e: P) -> Option> { vis.visit_expr(&mut e); Some(e) diff --git a/compiler/rustc_ast/src/tokenstream.rs b/compiler/rustc_ast/src/tokenstream.rs index c60185cdde00..e55399adfb85 100644 --- a/compiler/rustc_ast/src/tokenstream.rs +++ b/compiler/rustc_ast/src/tokenstream.rs @@ -20,7 +20,7 @@ use std::{cmp, fmt, iter, mem}; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; use rustc_data_structures::sync; -use rustc_macros::{Decodable, Encodable, HashStable_Generic}; +use rustc_macros::{Decodable, Encodable, HashStable_Generic, Walkable}; use rustc_serialize::{Decodable, Encodable}; use rustc_span::{DUMMY_SP, Span, SpanDecoder, SpanEncoder, Symbol, sym}; use thin_vec::ThinVec; @@ -977,7 +977,7 @@ impl TokenCursor { } } -#[derive(Debug, Copy, Clone, PartialEq, Encodable, Decodable, HashStable_Generic)] +#[derive(Debug, Copy, Clone, PartialEq, Encodable, Decodable, HashStable_Generic, Walkable)] pub struct DelimSpan { pub open: Span, pub close: Span, diff --git a/compiler/rustc_ast/src/visit.rs b/compiler/rustc_ast/src/visit.rs index a344f23c345f..ab15cb28fa12 100644 --- a/compiler/rustc_ast/src/visit.rs +++ b/compiler/rustc_ast/src/visit.rs @@ -16,7 +16,7 @@ pub use rustc_ast_ir::visit::VisitorResult; pub use rustc_ast_ir::{try_visit, visit_opt, walk_list, walk_visitable_list}; use rustc_span::source_map::Spanned; -use rustc_span::{Ident, Span}; +use rustc_span::{Ident, Span, Symbol}; use thin_vec::ThinVec; use crate::ast::*; @@ -75,6 +75,241 @@ pub enum LifetimeCtxt { GenericArg, } +pub(crate) trait Visitable<'a, V: Visitor<'a>> { + type Extra: Copy; + + #[must_use] + fn visit(&'a self, visitor: &mut V, extra: Self::Extra) -> V::Result; +} + +impl<'a, V: Visitor<'a>, T: ?Sized> Visitable<'a, V> for P +where + T: Visitable<'a, V>, +{ + type Extra = T::Extra; + fn visit(&'a self, visitor: &mut V, extra: Self::Extra) -> V::Result { + (**self).visit(visitor, extra) + } +} + +impl<'a, V: Visitor<'a>, T> Visitable<'a, V> for Option +where + T: Visitable<'a, V>, +{ + type Extra = T::Extra; + fn visit(&'a self, visitor: &mut V, extra: Self::Extra) -> V::Result { + if let Some(this) = self { + try_visit!(this.visit(visitor, extra)); + } + V::Result::output() + } +} + +impl<'a, V: Visitor<'a>, T> Visitable<'a, V> for Spanned +where + T: Visitable<'a, V>, +{ + type Extra = T::Extra; + fn visit(&'a self, visitor: &mut V, extra: Self::Extra) -> V::Result { + let Spanned { span: _, node } = self; + node.visit(visitor, extra) + } +} + +impl<'a, V: Visitor<'a>, T> Visitable<'a, V> for [T] +where + T: Visitable<'a, V>, +{ + type Extra = T::Extra; + fn visit(&'a self, visitor: &mut V, extra: Self::Extra) -> V::Result { + for item in self { + try_visit!(item.visit(visitor, extra)); + } + V::Result::output() + } +} + +impl<'a, V: Visitor<'a>, T> Visitable<'a, V> for Vec +where + T: Visitable<'a, V>, +{ + type Extra = T::Extra; + fn visit(&'a self, visitor: &mut V, extra: Self::Extra) -> V::Result { + for item in self { + try_visit!(item.visit(visitor, extra)); + } + V::Result::output() + } +} + +impl<'a, V: Visitor<'a>, T> Visitable<'a, V> for (T,) +where + T: Visitable<'a, V>, +{ + type Extra = T::Extra; + fn visit(&'a self, visitor: &mut V, extra: Self::Extra) -> V::Result { + self.0.visit(visitor, extra) + } +} + +impl<'a, V: Visitor<'a>, T1, T2> Visitable<'a, V> for (T1, T2) +where + T1: Visitable<'a, V, Extra = ()>, + T2: Visitable<'a, V, Extra = ()>, +{ + type Extra = (); + fn visit(&'a self, visitor: &mut V, extra: Self::Extra) -> V::Result { + try_visit!(self.0.visit(visitor, extra)); + try_visit!(self.1.visit(visitor, extra)); + V::Result::output() + } +} + +impl<'a, V: Visitor<'a>, T1, T2, T3> Visitable<'a, V> for (T1, T2, T3) +where + T1: Visitable<'a, V, Extra = ()>, + T2: Visitable<'a, V, Extra = ()>, + T3: Visitable<'a, V, Extra = ()>, +{ + type Extra = (); + fn visit(&'a self, visitor: &mut V, extra: Self::Extra) -> V::Result { + try_visit!(self.0.visit(visitor, extra)); + try_visit!(self.1.visit(visitor, extra)); + try_visit!(self.2.visit(visitor, extra)); + V::Result::output() + } +} + +impl<'a, V: Visitor<'a>, T1, T2, T3, T4> Visitable<'a, V> for (T1, T2, T3, T4) +where + T1: Visitable<'a, V, Extra = ()>, + T2: Visitable<'a, V, Extra = ()>, + T3: Visitable<'a, V, Extra = ()>, + T4: Visitable<'a, V, Extra = ()>, +{ + type Extra = (); + fn visit(&'a self, visitor: &mut V, extra: Self::Extra) -> V::Result { + try_visit!(self.0.visit(visitor, extra)); + try_visit!(self.1.visit(visitor, extra)); + try_visit!(self.2.visit(visitor, extra)); + try_visit!(self.3.visit(visitor, extra)); + V::Result::output() + } +} + +pub(crate) trait Walkable<'a, V: Visitor<'a>> { + #[must_use] + fn walk_ref(&'a self, visitor: &mut V) -> V::Result; +} + +macro_rules! visit_visitable { + ($visitor:expr, $($expr:expr),* $(,)?) => {{ + $(try_visit!(Visitable::visit($expr, $visitor, ()));)* + }}; +} + +macro_rules! visit_visitable_with { + ($visitor:expr, $expr:expr, $extra:expr $(,)?) => { + try_visit!(Visitable::visit($expr, $visitor, $extra)) + }; +} + +macro_rules! walk_walkable { + ($visitor:expr, $expr:expr, ) => { + Walkable::walk_ref($expr, $visitor) + }; +} + +macro_rules! impl_visitable { + (|&$lt:lifetime $self:ident: $self_ty:ty, + $vis:ident: &mut $vis_ty:ident, + $extra:ident: $extra_ty:ty| $block:block) => { + #[allow(unused_parens, non_local_definitions)] + impl<$lt, $vis_ty: Visitor<$lt>> Visitable<$lt, $vis_ty> for $self_ty { + type Extra = $extra_ty; + fn visit(&$lt $self, $vis: &mut $vis_ty, $extra: Self::Extra) -> V::Result { + $block + } + } + }; +} + +macro_rules! impl_walkable { + ($(<$K:ident: $Kb:ident>)? |&$lt:lifetime $self:ident: $self_ty:ty, + $vis:ident: &mut $vis_ty:ident| $block:block) => { + #[allow(unused_parens, non_local_definitions)] + impl<$($K: $Kb,)? $lt, $vis_ty: Visitor<$lt>> Walkable<$lt, $vis_ty> for $self_ty { + fn walk_ref(&$lt $self, $vis: &mut $vis_ty) -> V::Result { + $block + } + } + }; +} + +macro_rules! impl_visitable_noop { + (<$lt:lifetime> $($ty:ty,)*) => { + $( + impl_visitable!(|&$lt self: $ty, _vis: &mut V, _extra: ()| { + V::Result::output() + }); + )* + }; +} + +macro_rules! impl_visitable_list { + (<$lt:lifetime> $($ty:ty,)*) => { + $(impl<$lt, V: Visitor<$lt>, T> Visitable<$lt, V> for $ty + where + &$lt $ty: IntoIterator, + T: $lt + Visitable<$lt, V>, + { + type Extra = >::Extra; + + #[inline] + fn visit(&$lt self, visitor: &mut V, extra: Self::Extra) -> V::Result { + for i in self { + try_visit!(i.visit(visitor, extra)); + } + V::Result::output() + } + })* + }; +} + +macro_rules! impl_visitable_direct { + (<$lt:lifetime> $($ty:ty,)*) => { + $(impl_visitable!( + |&$lt self: $ty, visitor: &mut V, _extra: ()| { + Walkable::walk_ref(self, visitor) + } + );)* + }; +} + +macro_rules! impl_visitable_calling_walkable { + (<$lt:lifetime> + $( fn $method:ident($ty:ty $(, $extra_name:ident: $extra_ty:ty)?); )* + ) => { + $(fn $method(&mut self, node: &$lt $ty $(, $extra_name:$extra_ty)?) -> Self::Result { + impl_visitable!(|&$lt self: $ty, visitor: &mut V, extra: ($($extra_ty)?)| { + let ($($extra_name)?) = extra; + visitor.$method(self $(, $extra_name)?) + }); + walk_walkable!(self, node, ) + })* + }; +} + +macro_rules! define_named_walk { + ($Visitor:ident<$lt:lifetime> + $( pub fn $method:ident($ty:ty); )* + ) => { + $(pub fn $method<$lt, V: $Visitor<$lt>>(visitor: &mut V, node: &$lt $ty) -> V::Result { + walk_walkable!(visitor, node,) + })* + }; +} + #[macro_export] macro_rules! common_visitor_and_walkers { ($(($mut: ident))? $Visitor:ident$(<$lt:lifetime>)?) => { @@ -120,6 +355,139 @@ macro_rules! common_visitor_and_walkers { } } + // This macro generates `impl Visitable` and `impl MutVisitable` that do nothing. + impl_visitable_noop!(<$($lt)? $($mut)?> + AttrId, + bool, + rustc_span::ByteSymbol, + char, + crate::token::CommentKind, + crate::token::Delimiter, + crate::token::Lit, + crate::token::LitKind, + crate::tokenstream::LazyAttrTokenStream, + crate::tokenstream::TokenStream, + Movability, + Mutability, + Result<(), rustc_span::ErrorGuaranteed>, + rustc_data_structures::fx::FxHashMap, + rustc_span::ErrorGuaranteed, + std::borrow::Cow<'_, str>, + Symbol, + u8, + usize, + ); + // `Span` is only a no-op for the non-mutable visitor. + $(impl_visitable_noop!(<$lt> Span,);)? + + // This macro generates `impl Visitable` and `impl MutVisitable` that simply iterate over + // their contents. We do not use a generic impl for `ThinVec` because we want to allow + // custom visits for the `MutVisitor`. + impl_visitable_list!(<$($lt)? $($mut)?> + ThinVec, + ThinVec, + ThinVec<(Ident, Option)>, + ThinVec<(NodeId, Path)>, + ThinVec, + ThinVec, + ThinVec>, + ThinVec>, + ThinVec>, + ); + + // This macro generates `impl Visitable` and `impl MutVisitable` that forward to `Walkable` + // or `MutWalkable`. By default, all types that do not have a custom visit method in the + // visitor should appear here. + impl_visitable_direct!(<$($lt)? $($mut)?> + AngleBracketedArg, + AngleBracketedArgs, + AsmMacro, + AssignOpKind, + AssocItemConstraintKind, + AttrArgs, + AttrItem, + AttrKind, + AttrStyle, + FnPtrTy, + BindingMode, + GenBlockKind, + RangeLimits, + UnsafeBinderCastKind, + BinOpKind, + BlockCheckMode, + BorrowKind, + BoundAsyncness, + BoundConstness, + BoundPolarity, + ByRef, + Closure, + Const, + ConstItem, + Defaultness, + Delegation, + DelegationMac, + DelimArgs, + DelimSpan, + EnumDef, + Extern, + ForLoopKind, + FormatArgPosition, + FormatArgsPiece, + FormatArgument, + FormatArgumentKind, + FormatArguments, + FormatPlaceholder, + GenericParamKind, + Impl, + ImplPolarity, + Inline, + InlineAsmOperand, + InlineAsmRegOrRegClass, + InlineAsmTemplatePiece, + IsAuto, + LocalKind, + MacCallStmt, + MacStmtStyle, + MatchKind, + MethodCall, + ModKind, + ModSpans, + MutTy, + NormalAttr, + Parens, + ParenthesizedArgs, + PatFieldsRest, + PatKind, + RangeEnd, + RangeSyntax, + Recovered, + Safety, + StaticItem, + StrLit, + StrStyle, + StructExpr, + StructRest, + Term, + Trait, + TraitBoundModifiers, + TraitObjectSyntax, + TyAlias, + TyAliasWhereClause, + TyAliasWhereClauses, + TyKind, + TyPatKind, + UnOp, + UnsafeBinderTy, + UnsafeSource, + UseTreeKind, + VisibilityKind, + WhereBoundPredicate, + WhereClause, + WhereEqPredicate, + WhereRegionPredicate, + YieldKind, + ); + /// Each method of this trait is a hook to be potentially /// overridden. Each method's default implementation recursively visits /// the substructure of the input via the corresponding `walk` method; @@ -169,47 +537,82 @@ macro_rules! common_visitor_and_walkers { // field access version will continue working and it would be easy to // forget to add handling for it. fn visit_ident(&mut self, Ident { name: _, span }: &$($lt)? $($mut)? Ident) -> Self::Result { + impl_visitable!(|&$($lt)? $($mut)? self: Ident, visitor: &mut V, _extra: ()| { + visitor.visit_ident(self) + }); visit_span(self, span) } - fn visit_foreign_mod(&mut self, nm: &$($lt)? $($mut)? ForeignMod) -> Self::Result { - walk_foreign_mod(self, nm) - } + // This macro defines a custom visit method for each listed type. + // It implements `impl Visitable` and `impl MutVisitable` to call those methods on the + // visitor. + impl_visitable_calling_walkable!(<$($lt)? $($mut)?> + fn visit_anon_const(AnonConst); + fn visit_arm(Arm); + //fn visit_assoc_item(AssocItem, _ctxt: AssocCtxt); + fn visit_assoc_item_constraint(AssocItemConstraint); + fn visit_attribute(Attribute); + fn visit_block(Block); + //fn visit_nested_use_tree((UseTree, NodeId)); + fn visit_capture_by(CaptureBy); + fn visit_closure_binder(ClosureBinder); + fn visit_contract(FnContract); + fn visit_coroutine_kind(CoroutineKind); + fn visit_crate(Crate); + fn visit_expr(Expr); + fn visit_expr_field(ExprField); + fn visit_field_def(FieldDef); + fn visit_fn_decl(FnDecl); + fn visit_fn_header(FnHeader); + fn visit_fn_ret_ty(FnRetTy); + //fn visit_foreign_item(ForeignItem); + fn visit_foreign_mod(ForeignMod); + fn visit_format_args(FormatArgs); + fn visit_generic_arg(GenericArg); + fn visit_generic_args(GenericArgs); + fn visit_generic_param(GenericParam); + fn visit_generics(Generics); + fn visit_inline_asm(InlineAsm); + fn visit_inline_asm_sym(InlineAsmSym); + //fn visit_item(Item); + fn visit_label(Label); + fn visit_lifetime(Lifetime, _ctxt: LifetimeCtxt); + fn visit_local(Local); + fn visit_mac_call(MacCall); + fn visit_macro_def(MacroDef); + fn visit_param_bound(GenericBound, _ctxt: BoundKind); + fn visit_param(Param); + fn visit_pat_field(PatField); + fn visit_path(Path); + fn visit_path_segment(PathSegment); + fn visit_pat(Pat); + fn visit_poly_trait_ref(PolyTraitRef); + fn visit_precise_capturing_arg(PreciseCapturingArg); + fn visit_qself(QSelf); + fn visit_trait_ref(TraitRef); + fn visit_ty_pat(TyPat); + fn visit_ty(Ty); + fn visit_use_tree(UseTree); + fn visit_variant_data(VariantData); + fn visit_variant(Variant); + fn visit_vis(Visibility); + fn visit_where_predicate_kind(WherePredicateKind); + fn visit_where_predicate(WherePredicate); + ); - fn visit_foreign_item(&mut self, i: &$($lt)? $($mut)? ForeignItem) -> Self::Result { - walk_item(self, i) - } - - fn visit_item(&mut self, i: &$($lt)? $($mut)? Item) -> Self::Result { - walk_item(self, i) - } - - fn visit_local(&mut self, l: &$($lt)? $($mut)? Local) -> Self::Result { - walk_local(self, l) - } - - fn visit_block(&mut self, b: &$($lt)? $($mut)? Block) -> Self::Result { - walk_block(self, b) - } - - fn visit_param(&mut self, param: &$($lt)? $($mut)? Param) -> Self::Result { - walk_param(self, param) - } - - fn visit_arm(&mut self, a: &$($lt)? $($mut)? Arm) -> Self::Result { - walk_arm(self, a) - } - - fn visit_pat(&mut self, p: &$($lt)? $($mut)? Pat) -> Self::Result { - walk_pat(self, p) - } - - fn visit_anon_const(&mut self, c: &$($lt)? $($mut)? AnonConst) -> Self::Result { - walk_anon_const(self, c) - } - - fn visit_expr(&mut self, ex: &$($lt)? $($mut)? Expr) -> Self::Result { - walk_expr(self, ex) + // We want `Visitor` to take the `NodeId` by value. + fn visit_id(&mut self, _id: $(&$mut)? NodeId) -> Self::Result { + $(impl_visitable!( + |&$lt self: NodeId, visitor: &mut V, _extra: ()| { + visitor.visit_id(*self) + } + );)? + $(impl_visitable!( + |&$mut self: NodeId, visitor: &mut V, _extra: ()| { + visitor.visit_id(self) + } + );)? + Self::Result::output() } /// This method is a hack to workaround unstable of `stmt_expr_attributes`. @@ -218,34 +621,25 @@ macro_rules! common_visitor_and_walkers { self.visit_expr(ex) } - fn visit_ty(&mut self, t: &$($lt)? $($mut)? Ty) -> Self::Result { - walk_ty(self, t) + fn visit_item(&mut self, item: &$($lt)? $($mut)? Item) -> Self::Result { + impl_visitable!(|&$($lt)? $($mut)? self: Item, vis: &mut V, _extra: ()| { + vis.visit_item(self) + }); + walk_item(self, item) } - fn visit_ty_pat(&mut self, t: &$($lt)? $($mut)? TyPat) -> Self::Result { - walk_ty_pat(self, t) + fn visit_foreign_item(&mut self, item: &$($lt)? $($mut)? ForeignItem) -> Self::Result { + impl_visitable!(|&$($lt)? $($mut)? self: ForeignItem, vis: &mut V, _extra: ()| { + vis.visit_foreign_item(self) + }); + walk_item(self, item) } - fn visit_generic_param(&mut self, param: &$($lt)? $($mut)? GenericParam) -> Self::Result { - walk_generic_param(self, param) - } - - fn visit_generics(&mut self, g: &$($lt)? $($mut)? Generics) -> Self::Result { - walk_generics(self, g) - } - fn visit_closure_binder(&mut self, b: &$($lt)? $($mut)? ClosureBinder) -> Self::Result { - walk_closure_binder(self, b) - } - fn visit_contract(&mut self, c: &$($lt)? $($mut)? FnContract) -> Self::Result { - walk_contract(self, c) - } - - fn visit_where_predicate(&mut self, p: &$($lt)? $($mut)? WherePredicate) -> Self::Result { - walk_where_predicate(self, p) - } - - fn visit_where_predicate_kind(&mut self, k: &$($lt)? $($mut)? WherePredicateKind) -> Self::Result { - walk_where_predicate_kind(self, k) + fn visit_assoc_item(&mut self, item: &$($lt)? $($mut)? AssocItem, ctxt: AssocCtxt) -> Self::Result { + impl_visitable!(|&$($lt)? $($mut)? self: AssocItem, vis: &mut V, ctxt: AssocCtxt| { + vis.visit_assoc_item(self, ctxt) + }); + walk_assoc_item(self, item, ctxt) } // for `MutVisitor`: `Span` and `NodeId` are mutated at the caller site. @@ -258,141 +652,6 @@ macro_rules! common_visitor_and_walkers { walk_fn(self, fk) } - fn visit_assoc_item(&mut self, i: &$($lt)? $($mut)? AssocItem, ctxt: AssocCtxt) -> Self::Result { - walk_assoc_item(self, i, ctxt) - } - - fn visit_trait_ref(&mut self, t: &$($lt)? $($mut)? TraitRef) -> Self::Result { - walk_trait_ref(self, t) - } - - fn visit_param_bound(&mut self, bounds: &$($lt)? $($mut)? GenericBound, _ctxt: BoundKind) -> Self::Result { - walk_param_bound(self, bounds) - } - - fn visit_precise_capturing_arg(&mut self, arg: &$($lt)? $($mut)? PreciseCapturingArg) -> Self::Result { - walk_precise_capturing_arg(self, arg) - } - - fn visit_poly_trait_ref(&mut self, t: &$($lt)? $($mut)? PolyTraitRef) -> Self::Result { - walk_poly_trait_ref(self, t) - } - - fn visit_variant_data(&mut self, s: &$($lt)? $($mut)? VariantData) -> Self::Result { - walk_variant_data(self, s) - } - - fn visit_field_def(&mut self, s: &$($lt)? $($mut)? FieldDef) -> Self::Result { - walk_field_def(self, s) - } - - fn visit_variant(&mut self, v: &$($lt)? $($mut)? Variant) -> Self::Result { - walk_variant(self, v) - } - - fn visit_label(&mut self, label: &$($lt)? $($mut)? Label) -> Self::Result { - walk_label(self, label) - } - - fn visit_lifetime(&mut self, lifetime: &$($lt)? $($mut)? Lifetime, $(${ignore($lt)} _: LifetimeCtxt )?) -> Self::Result { - walk_lifetime(self, lifetime) - } - - fn visit_mac_call(&mut self, mac: &$($lt)? $($mut)? MacCall) -> Self::Result { - walk_mac(self, mac) - } - - fn visit_id(&mut self, _id: $(&$mut)? NodeId) -> Self::Result { - Self::Result::output() - } - - fn visit_macro_def(&mut self, macro_def: &$($lt)? $($mut)? MacroDef) -> Self::Result { - walk_macro_def(self, macro_def) - } - - fn visit_path(&mut self, path: &$($lt)? $($mut)? Path) -> Self::Result { - walk_path(self, path) - } - - fn visit_use_tree(&mut self, use_tree: &$($lt)? $($mut)? UseTree) -> Self::Result { - walk_use_tree(self, use_tree) - } - - fn visit_path_segment(&mut self, path_segment: &$($lt)? $($mut)? PathSegment) -> Self::Result { - walk_path_segment(self, path_segment) - } - - fn visit_generic_args(&mut self, generic_args: &$($lt)? $($mut)? GenericArgs) -> Self::Result { - walk_generic_args(self, generic_args) - } - - fn visit_generic_arg(&mut self, generic_arg: &$($lt)? $($mut)? GenericArg) -> Self::Result { - walk_generic_arg(self, generic_arg) - } - - fn visit_assoc_item_constraint( - &mut self, - constraint: &$($lt)? $($mut)? AssocItemConstraint, - ) -> Self::Result { - walk_assoc_item_constraint(self, constraint) - } - - fn visit_attribute(&mut self, attr: &$($lt)? $($mut)? Attribute) -> Self::Result { - walk_attribute(self, attr) - } - - fn visit_vis(&mut self, vis: &$($lt)? $($mut)? Visibility) -> Self::Result { - walk_vis(self, vis) - } - - fn visit_fn_ret_ty(&mut self, ret_ty: &$($lt)? $($mut)? FnRetTy) -> Self::Result { - walk_fn_ret_ty(self, ret_ty) - } - - fn visit_fn_header(&mut self, header: &$($lt)? $($mut)? FnHeader) -> Self::Result { - walk_fn_header(self, header) - } - - fn visit_expr_field(&mut self, f: &$($lt)? $($mut)? ExprField) -> Self::Result { - walk_expr_field(self, f) - } - - fn visit_pat_field(&mut self, fp: &$($lt)? $($mut)? PatField) -> Self::Result { - walk_pat_field(self, fp) - } - - fn visit_crate(&mut self, krate: &$($lt)? $($mut)? Crate) -> Self::Result { - walk_crate(self, krate) - } - - fn visit_inline_asm(&mut self, asm: &$($lt)? $($mut)? InlineAsm) -> Self::Result { - walk_inline_asm(self, asm) - } - - fn visit_format_args(&mut self, fmt: &$($lt)? $($mut)? FormatArgs) -> Self::Result { - walk_format_args(self, fmt) - } - - fn visit_inline_asm_sym(&mut self, sym: &$($lt)? $($mut)? InlineAsmSym) -> Self::Result { - walk_inline_asm_sym(self, sym) - } - - fn visit_capture_by(&mut self, capture_by: &$($lt)? $($mut)? CaptureBy) -> Self::Result { - walk_capture_by(self, capture_by) - } - - fn visit_coroutine_kind(&mut self, coroutine_kind: &$($lt)? $($mut)? CoroutineKind) -> Self::Result { - walk_coroutine_kind(self, coroutine_kind) - } - - fn visit_fn_decl(&mut self, fn_decl: &$($lt)? $($mut)? FnDecl) -> Self::Result { - walk_fn_decl(self, fn_decl) - } - - fn visit_qself(&mut self, qs: &$($lt)? $($mut)? Option>) -> Self::Result { - walk_qself(self, qs) - } - // (non-mut) `Visitor`-only methods $( fn visit_stmt(&mut self, s: &$lt Stmt) -> Self::Result { @@ -407,6 +666,16 @@ macro_rules! common_visitor_and_walkers { // `MutVisitor`-only methods $( + // Span visiting is no longer used, but we keep it for now, + // in case it's needed for something like #127241. + #[inline] + fn visit_span(&mut self, _sp: &$mut Span) { + impl_visitable!(|&mut self: Span, visitor: &mut V, _extra: ()| { + visitor.visit_span(self) + }); + // Do nothing. + } + fn flat_map_foreign_item(&mut self, ni: P) -> SmallVec<[P; 1]> { walk_flat_map_foreign_item(self, ni) } @@ -462,12 +731,6 @@ macro_rules! common_visitor_and_walkers { walk_flat_map_where_predicate(self, where_predicate) } - // Span visiting is no longer used, but we keep it for now, - // in case it's needed for something like #127241. - fn visit_span(&mut self, _sp: &$mut Span) { - // Do nothing. - } - fn flat_map_pat_field(&mut self, fp: PatField) -> SmallVec<[PatField; 1]> { walk_flat_map_pat_field(self, fp) } @@ -492,148 +755,45 @@ macro_rules! common_visitor_and_walkers { #[inline] )? fn visit_span<$($lt,)? V: $Visitor$(<$lt>)?>(vis: &mut V, span: &$($lt)? $($mut)? Span) -> V::Result { - $( - ${ignore($mut)} - vis.visit_span(span); - )? + $(${ignore($mut)} vis.visit_span(span))?; V::Result::output() } - /// helper since `Visitor` wants `NodeId` but `MutVisitor` wants `&mut NodeId` - $(${ignore($lt)} - #[expect(rustc::pass_by_value)] - )? - #[inline] - fn visit_id<$($lt,)? V: $Visitor$(<$lt>)?>(vis: &mut V, id: &$($lt)? $($mut)? NodeId) -> V::Result { - // deref `&NodeId` into `NodeId` only for `Visitor` - vis.visit_id( $(${ignore($lt)} * )? id) - } - - // this is only used by the MutVisitor. We include this symmetry here to make writing other functions easier - fn visit_safety<$($lt,)? V: $Visitor$(<$lt>)?>(vis: &mut V, safety: &$($lt)? $($mut)? Safety) -> V::Result { - match safety { - Safety::Unsafe(span) => visit_span(vis, span), - Safety::Safe(span) => visit_span(vis, span), - Safety::Default => { V::Result::output() } - } - } - - fn visit_constness<$($lt,)? V: $Visitor$(<$lt>)?>(vis: &mut V, constness: &$($lt)? $($mut)? Const) -> V::Result { - match constness { - Const::Yes(span) => visit_span(vis, span), - Const::No => { - V::Result::output() - } - } - } - - fn visit_defaultness<$($lt,)? V: $Visitor$(<$lt>)?>(vis: &mut V, defaultness: &$($lt)? $($mut)? Defaultness) -> V::Result { - match defaultness { - Defaultness::Default(span) => visit_span(vis, span), - Defaultness::Final => { - V::Result::output() - } - } - } - - fn visit_polarity<$($lt,)? V: $Visitor$(<$lt>)?>( - vis: &mut V, - polarity: &$($lt)? $($mut)? ImplPolarity, - ) -> V::Result { - match polarity { - ImplPolarity::Positive => { V::Result::output() } - ImplPolarity::Negative(span) => visit_span(vis, span), - } - } - - $(${ignore($lt)} - #[inline] - )? - fn visit_modifiers<$($lt,)? V: $Visitor$(<$lt>)?>( - vis: &mut V, - m: &$($lt)? $($mut)? TraitBoundModifiers - ) -> V::Result { - let TraitBoundModifiers { constness, asyncness, polarity } = m; - match constness { - BoundConstness::Never => {} - BoundConstness::Always(span) | BoundConstness::Maybe(span) => try_visit!(visit_span(vis, span)), - } - match asyncness { - BoundAsyncness::Normal => {} - BoundAsyncness::Async(span) => try_visit!(visit_span(vis, span)), - } - match polarity { - BoundPolarity::Positive => {} - BoundPolarity::Negative(span) | BoundPolarity::Maybe(span) => try_visit!(visit_span(vis, span)), + $(impl_visitable!(|&$lt self: ThinVec<(UseTree, NodeId)>, vis: &mut V, _extra: ()| { + for (nested_tree, nested_id) in self { + try_visit!(vis.visit_nested_use_tree(nested_tree, *nested_id)); } V::Result::output() - } + });)? + $(impl_visitable_list!(<$mut> ThinVec<(UseTree, NodeId)>,);)? - $(${ignore($lt)} - #[inline] - )? - fn walk_capture_by<$($lt,)? V: $Visitor$(<$lt>)?>( - vis: &mut V, - capture_by: &$($lt)? $($mut)? CaptureBy - ) -> V::Result { - match capture_by { - CaptureBy::Ref => { V::Result::output() } - CaptureBy::Value { move_kw } => { - visit_span(vis, move_kw) - } - CaptureBy::Use { use_kw } => { - visit_span(vis, use_kw) - } - } - } - - fn visit_bounds<$($lt,)? V: $Visitor$(<$lt>)?>(visitor: &mut V, bounds: &$($lt)? $($mut)? GenericBounds, ctxt: BoundKind) -> V::Result { - walk_list!(visitor, visit_param_bound, bounds, ctxt); - V::Result::output() - } - - pub fn walk_label<$($lt,)? V: $Visitor$(<$lt>)?>(visitor: &mut V, Label { ident }: &$($lt)? $($mut)? Label) -> V::Result { - visitor.visit_ident(ident) - } - - pub fn walk_fn_header<$($lt,)? V: $Visitor$(<$lt>)?>(visitor: &mut V, header: &$($lt)? $($mut)? FnHeader) -> V::Result { - let FnHeader { safety, coroutine_kind, constness, ext: _ } = header; - try_visit!(visit_constness(visitor, constness)); - visit_opt!(visitor, visit_coroutine_kind, coroutine_kind); - visit_safety(visitor, safety) - } - - pub fn walk_lifetime<$($lt,)? V: $Visitor$(<$lt>)?>(visitor: &mut V, Lifetime { id, ident }: &$($lt)? $($mut)? Lifetime) -> V::Result { - try_visit!(visit_id(visitor, id)); - visitor.visit_ident(ident) - } - - fn walk_item_ctxt<$($lt,)? V: $Visitor$(<$lt>)?, K: WalkItemKind>( + fn walk_item_inner<$($lt,)? K: WalkItemKind, V: $Visitor$(<$lt>)?>( visitor: &mut V, item: &$($mut)? $($lt)? Item, ctxt: K::Ctxt, ) -> V::Result { let Item { attrs, id, kind, vis, span, tokens: _ } = item; - try_visit!(visit_id(visitor, id)); - walk_list!(visitor, visit_attribute, attrs); - try_visit!(visitor.visit_vis(vis)); + visit_visitable!($($mut)? visitor, id, attrs, vis); try_visit!(kind.walk(*span, *id, vis, ctxt, visitor)); - visit_span(visitor, span) + visit_visitable!($($mut)? visitor, span); + V::Result::output() } - pub fn walk_item<$($lt,)? V: $Visitor$(<$lt>)?, K: WalkItemKind>( + // Do not implement `Walkable`/`MutWalkable` for *Item to avoid confusion. + pub fn walk_item<$($lt,)? K: WalkItemKind, V: $Visitor$(<$lt>)?>( visitor: &mut V, item: &$($mut)? $($lt)? Item, ) -> V::Result { - walk_item_ctxt(visitor, item, ()) + walk_item_inner(visitor, item, ()) } - pub fn walk_assoc_item<$($lt,)? V: $Visitor$(<$lt>)?>( + // Do not implement `Walkable`/`MutWalkable` for *Item to avoid confusion. + pub fn walk_assoc_item<$($lt,)? K: WalkItemKind, V: $Visitor$(<$lt>)?>( visitor: &mut V, - item: &$($mut)? $($lt)? AssocItem, + item: &$($mut)? $($lt)? Item, ctxt: AssocCtxt, ) -> V::Result { - walk_item_ctxt(visitor, item, ctxt) + walk_item_inner(visitor, item, ctxt) } impl WalkItemKind for ItemKind { @@ -647,180 +807,52 @@ macro_rules! common_visitor_and_walkers { vis: &mut V, ) -> V::Result { match self { - ItemKind::ExternCrate(_orig_name, ident) => vis.visit_ident(ident), - ItemKind::Use(use_tree) => vis.visit_use_tree(use_tree), - ItemKind::Static(box StaticItem { - ident, - ty, - safety: _, - mutability: _, - expr, - define_opaque, - }) => { - try_visit!(vis.visit_ident(ident)); - try_visit!(vis.visit_ty(ty)); - visit_opt!(vis, visit_expr, expr); - walk_define_opaques(vis, define_opaque) - } - ItemKind::Const(item) => { - walk_const_item(vis, item) - } ItemKind::Fn(func) => { let kind = FnKind::Fn(FnCtxt::Free, visibility, &$($mut)? *func); - vis.visit_fn(kind, span, id) - } - ItemKind::Mod(safety, ident, mod_kind) => { - try_visit!(visit_safety(vis, safety)); - try_visit!(vis.visit_ident(ident)); - match mod_kind { - ModKind::Loaded( - items, - _inline, - ModSpans { inner_span, inject_use_span }, - _, - ) => { - try_visit!(visit_items(vis, items)); - try_visit!(visit_span(vis, inner_span)); - try_visit!(visit_span(vis, inject_use_span)); - } - ModKind::Unloaded => {} - } - V::Result::output() - } - ItemKind::ForeignMod(nm) => vis.visit_foreign_mod(nm), - ItemKind::GlobalAsm(asm) => vis.visit_inline_asm(asm), - ItemKind::TyAlias(box TyAlias { - defaultness, - ident, - generics, - $(${ignore($lt)} #[expect(unused)])? - where_clauses, - bounds, - ty, - }) => { - try_visit!(visit_defaultness(vis, defaultness)); - try_visit!(vis.visit_ident(ident)); - try_visit!(vis.visit_generics(generics)); - try_visit!(visit_bounds(vis, bounds, BoundKind::Bound)); - visit_opt!(vis, visit_ty, ty); - $(${ignore($mut)} - walk_ty_alias_where_clauses(vis, where_clauses); - )? - V::Result::output() - } - ItemKind::Enum(ident, generics, enum_definition) => { - try_visit!(vis.visit_ident(ident)); - try_visit!(vis.visit_generics(generics)); - visit_variants(vis, &$($mut)? enum_definition.variants) + try_visit!(vis.visit_fn(kind, span, id)); } + ItemKind::ExternCrate(orig_name, ident) => + visit_visitable!($($mut)? vis, orig_name, ident), + ItemKind::Use(use_tree) => + visit_visitable!($($mut)? vis, use_tree), + ItemKind::Static(item) => + visit_visitable!($($mut)? vis, item), + ItemKind::Const(item) => + visit_visitable!($($mut)? vis, item), + ItemKind::Mod(safety, ident, mod_kind) => + visit_visitable!($($mut)? vis, safety, ident, mod_kind), + ItemKind::ForeignMod(nm) => + visit_visitable!($($mut)? vis, nm), + ItemKind::GlobalAsm(asm) => + visit_visitable!($($mut)? vis, asm), + ItemKind::TyAlias(ty_alias) => + visit_visitable!($($mut)? vis, ty_alias), + ItemKind::Enum(ident, generics, enum_definition) => + visit_visitable!($($mut)? vis, ident, generics, enum_definition), ItemKind::Struct(ident, generics, variant_data) - | ItemKind::Union(ident, generics, variant_data) => { - try_visit!(vis.visit_ident(ident)); - try_visit!(vis.visit_generics(generics)); - vis.visit_variant_data(variant_data) - } - ItemKind::Impl(box Impl { - defaultness, - safety, - generics, - constness, - polarity, - of_trait, - self_ty, - items, - }) => { - try_visit!(visit_defaultness(vis, defaultness)); - try_visit!(visit_safety(vis, safety)); - try_visit!(vis.visit_generics(generics)); - try_visit!(visit_constness(vis, constness)); - try_visit!(visit_polarity(vis, polarity)); - visit_opt!(vis, visit_trait_ref, of_trait); - try_visit!(vis.visit_ty(self_ty)); - visit_assoc_items(vis, items, AssocCtxt::Impl { of_trait: of_trait.is_some() }) - } - ItemKind::Trait(box Trait { constness, safety, is_auto: _, ident, generics, bounds, items }) => { - try_visit!(visit_constness(vis, constness)); - try_visit!(visit_safety(vis, safety)); - try_visit!(vis.visit_ident(ident)); - try_visit!(vis.visit_generics(generics)); - try_visit!(visit_bounds(vis, bounds, BoundKind::Bound)); - visit_assoc_items(vis, items, AssocCtxt::Trait) - } + | ItemKind::Union(ident, generics, variant_data) => + visit_visitable!($($mut)? vis, ident, generics, variant_data), + ItemKind::Impl(impl_) => + visit_visitable!($($mut)? vis, impl_), + ItemKind::Trait(trait_) => + visit_visitable!($($mut)? vis, trait_), ItemKind::TraitAlias(ident, generics, bounds) => { - try_visit!(vis.visit_ident(ident)); - try_visit!(vis.visit_generics(generics)); - visit_bounds(vis, bounds, BoundKind::Bound) - } - ItemKind::MacCall(m) => vis.visit_mac_call(m), - ItemKind::MacroDef(ident, def) => { - try_visit!(vis.visit_ident(ident)); - vis.visit_macro_def(def) - } - ItemKind::Delegation(box Delegation { - id, - qself, - path, - ident, - rename, - body, - from_glob: _, - }) => { - try_visit!(visit_id(vis, id)); - try_visit!(vis.visit_qself(qself)); - try_visit!(vis.visit_path(path)); - try_visit!(vis.visit_ident(ident)); - visit_opt!(vis, visit_ident, rename); - visit_opt!(vis, visit_block, body); - V::Result::output() - } - ItemKind::DelegationMac(box DelegationMac { qself, prefix, suffixes, body }) => { - try_visit!(vis.visit_qself(qself)); - try_visit!(vis.visit_path(prefix)); - if let Some(suffixes) = suffixes { - for (ident, rename) in suffixes { - try_visit!(vis.visit_ident(ident)); - visit_opt!(vis, visit_ident, rename); - } - } - visit_opt!(vis, visit_block, body); - V::Result::output() + visit_visitable!($($mut)? vis, ident, generics); + visit_visitable_with!($($mut)? vis, bounds, BoundKind::Bound) } + ItemKind::MacCall(m) => + visit_visitable!($($mut)? vis, m), + ItemKind::MacroDef(ident, def) => + visit_visitable!($($mut)? vis, ident, def), + ItemKind::Delegation(delegation) => + visit_visitable!($($mut)? vis, delegation), + ItemKind::DelegationMac(dm) => + visit_visitable!($($mut)? vis, dm), } + V::Result::output() } } - fn walk_const_item<$($lt,)? V: $Visitor$(<$lt>)?>( - vis: &mut V, - item: &$($lt)? $($mut)? ConstItem, - ) -> V::Result { - let ConstItem { defaultness, ident, generics, ty, expr, define_opaque } = item; - try_visit!(visit_defaultness(vis, defaultness)); - try_visit!(vis.visit_ident(ident)); - try_visit!(vis.visit_generics(generics)); - try_visit!(vis.visit_ty(ty)); - visit_opt!(vis, visit_expr, expr); - walk_define_opaques(vis, define_opaque) - } - - fn walk_foreign_mod<$($lt,)? V: $Visitor$(<$lt>)?>(vis: &mut V, foreign_mod: &$($lt)? $($mut)? ForeignMod) -> V::Result { - let ForeignMod { extern_span: _, safety, abi: _, items } = foreign_mod; - try_visit!(visit_safety(vis, safety)); - visit_foreign_items(vis, items) - } - - fn walk_define_opaques<$($lt,)? V: $Visitor$(<$lt>)?>( - visitor: &mut V, - define_opaque: &$($lt)? $($mut)? Option>, - ) -> V::Result { - if let Some(define_opaque) = define_opaque { - for (id, path) in define_opaque { - try_visit!(visit_id(visitor, id)); - try_visit!(visitor.visit_path(path)); - } - } - V::Result::output() - } - impl WalkItemKind for AssocItemKind { type Ctxt = AssocCtxt; fn walk<$($lt,)? V: $Visitor$(<$lt>)?>( @@ -832,64 +864,22 @@ macro_rules! common_visitor_and_walkers { vis: &mut V, ) -> V::Result { match self { - AssocItemKind::Const(item) => { - walk_const_item(vis, item) - } + AssocItemKind::Const(item) => + visit_visitable!($($mut)? vis, item), AssocItemKind::Fn(func) => { - vis.visit_fn(FnKind::Fn(FnCtxt::Assoc(ctxt), visibility, &$($mut)? *func), span, id) - } - AssocItemKind::Type(box TyAlias { - generics, - ident, - bounds, - ty, - defaultness, - $(${ignore($lt)} #[expect(unused)])? - where_clauses, - }) => { - try_visit!(visit_defaultness(vis, defaultness)); - try_visit!(vis.visit_ident(ident)); - try_visit!(vis.visit_generics(generics)); - try_visit!(visit_bounds(vis, bounds, BoundKind::Bound)); - visit_opt!(vis, visit_ty, ty); - $(${ignore($mut)} - walk_ty_alias_where_clauses(vis, where_clauses); - )? - V::Result::output() - } - AssocItemKind::MacCall(mac) => { - vis.visit_mac_call(mac) - } - AssocItemKind::Delegation(box Delegation { - id, - qself, - path, - ident, - rename, - body, - from_glob: _, - }) => { - try_visit!(visit_id(vis, id)); - try_visit!(vis.visit_qself(qself)); - try_visit!(vis.visit_path(path)); - try_visit!(vis.visit_ident(ident)); - visit_opt!(vis, visit_ident, rename); - visit_opt!(vis, visit_block, body); - V::Result::output() - } - AssocItemKind::DelegationMac(box DelegationMac { qself, prefix, suffixes, body }) => { - try_visit!(vis.visit_qself(qself)); - try_visit!(vis.visit_path(prefix)); - if let Some(suffixes) = suffixes { - for (ident, rename) in suffixes { - try_visit!(vis.visit_ident(ident)); - visit_opt!(vis, visit_ident, rename); - } - } - visit_opt!(vis, visit_block, body); - V::Result::output() + let kind = FnKind::Fn(FnCtxt::Assoc(ctxt), visibility, &$($mut)? *func); + try_visit!(vis.visit_fn(kind, span, id)) } + AssocItemKind::Type(alias) => + visit_visitable!($($mut)? vis, alias), + AssocItemKind::MacCall(mac) => + visit_visitable!($($mut)? vis, mac), + AssocItemKind::Delegation(delegation) => + visit_visitable!($($mut)? vis, delegation), + AssocItemKind::DelegationMac(dm) => + visit_visitable!($($mut)? vis, dm), } + V::Result::output() } } @@ -904,545 +894,18 @@ macro_rules! common_visitor_and_walkers { vis: &mut V, ) -> V::Result { match self { - ForeignItemKind::Static(box StaticItem { - ident, - ty, - mutability: _, - expr, - safety: _, - define_opaque, - }) => { - try_visit!(vis.visit_ident(ident)); - try_visit!(vis.visit_ty(ty)); - visit_opt!(vis, visit_expr, expr); - walk_define_opaques(vis, define_opaque) - } + ForeignItemKind::Static(item) => + visit_visitable!($($mut)? vis, item), ForeignItemKind::Fn(func) => { - vis.visit_fn(FnKind::Fn(FnCtxt::Foreign, visibility, &$($mut)?*func), span, id) - } - ForeignItemKind::TyAlias(box TyAlias { - defaultness, - ident, - generics, - bounds, - ty, - $(${ignore($lt)} #[expect(unused)])? - where_clauses, - }) => { - try_visit!(visit_defaultness(vis, defaultness)); - try_visit!(vis.visit_ident(ident)); - try_visit!(vis.visit_generics(generics)); - try_visit!(visit_bounds(vis, bounds, BoundKind::Bound)); - visit_opt!(vis, visit_ty, ty); - $(${ignore($mut)} - walk_ty_alias_where_clauses(vis, where_clauses); - )? - V::Result::output() - } - ForeignItemKind::MacCall(mac) => { - vis.visit_mac_call(mac) + let kind = FnKind::Fn(FnCtxt::Foreign, visibility, &$($mut)?*func); + try_visit!(vis.visit_fn(kind, span, id)) } + ForeignItemKind::TyAlias(alias) => + visit_visitable!($($mut)? vis, alias), + ForeignItemKind::MacCall(mac) => + visit_visitable!($($mut)? vis, mac), } - } - } - - fn walk_coroutine_kind<$($lt,)? V: $Visitor$(<$lt>)?>( - vis: &mut V, - coroutine_kind: &$($lt)? $($mut)? CoroutineKind, - ) -> V::Result { - let (CoroutineKind::Async { span, closure_id, return_impl_trait_id } - | CoroutineKind::Gen { span, closure_id, return_impl_trait_id } - | CoroutineKind::AsyncGen { span, closure_id, return_impl_trait_id }) - = coroutine_kind; - try_visit!(visit_id(vis, closure_id)); - try_visit!(visit_id(vis, return_impl_trait_id)); - visit_span(vis, span) - } - - pub fn walk_pat<$($lt,)? V: $Visitor$(<$lt>)?>( - vis: &mut V, - pattern: &$($lt)? $($mut)? Pat - ) -> V::Result { - let Pat { id, kind, span, tokens: _ } = pattern; - try_visit!(visit_id(vis, id)); - match kind { - PatKind::Err(_guar) => {} - PatKind::Missing | PatKind::Wild | PatKind::Rest | PatKind::Never => {} - PatKind::Ident(_bmode, ident, optional_subpattern) => { - try_visit!(vis.visit_ident(ident)); - visit_opt!(vis, visit_pat, optional_subpattern); - } - PatKind::Expr(expression) => try_visit!(vis.visit_expr(expression)), - PatKind::TupleStruct(opt_qself, path, elems) => { - try_visit!(vis.visit_qself(opt_qself)); - try_visit!(vis.visit_path(path)); - walk_list!(vis, visit_pat, elems); - } - PatKind::Path(opt_qself, path) => { - try_visit!(vis.visit_qself(opt_qself)); - try_visit!(vis.visit_path(path)) - } - PatKind::Struct(opt_qself, path, fields, _rest) => { - try_visit!(vis.visit_qself(opt_qself)); - try_visit!(vis.visit_path(path)); - try_visit!(visit_pat_fields(vis, fields)); - } - PatKind::Box(subpattern) | PatKind::Deref(subpattern) | PatKind::Paren(subpattern) => { - try_visit!(vis.visit_pat(subpattern)); - } - PatKind::Ref(subpattern, _ /*mutbl*/) => { - try_visit!(vis.visit_pat(subpattern)); - } - PatKind::Range(lower_bound, upper_bound, _end) => { - visit_opt!(vis, visit_expr, lower_bound); - visit_opt!(vis, visit_expr, upper_bound); - try_visit!(visit_span(vis, span)); - } - PatKind::Guard(subpattern, guard_condition) => { - try_visit!(vis.visit_pat(subpattern)); - try_visit!(vis.visit_expr(guard_condition)); - } - PatKind::Tuple(elems) | PatKind::Slice(elems) | PatKind::Or(elems) => { - walk_list!(vis, visit_pat, elems); - } - PatKind::MacCall(mac) => try_visit!(vis.visit_mac_call(mac)), - } - visit_span(vis, span) - } - - pub fn walk_anon_const<$($lt,)? V: $Visitor$(<$lt>)?>( - vis: &mut V, - constant: &$($lt)? $($mut)? AnonConst, - ) -> V::Result { - let AnonConst { id, value } = constant; - try_visit!(visit_id(vis, id)); - vis.visit_expr(value) - } - - pub fn walk_path_segment<$($lt,)? V: $Visitor$(<$lt>)?>( - vis: &mut V, - segment: &$($lt)? $($mut)? PathSegment, - ) -> V::Result { - let PathSegment { ident, id, args } = segment; - try_visit!(visit_id(vis, id)); - try_visit!(vis.visit_ident(ident)); - visit_opt!(vis, visit_generic_args, args); - V::Result::output() - } - - pub fn walk_block<$($lt,)? V: $Visitor$(<$lt>)?>( - vis: &mut V, - block: &$($lt)? $($mut)? Block - ) -> V::Result { - let Block { stmts, id, rules: _, span, tokens: _ } = block; - try_visit!(visit_id(vis, id)); - try_visit!(visit_stmts(vis, stmts)); - visit_span(vis, span) - } - - - pub fn walk_ty<$($lt,)? V: $Visitor$(<$lt>)?>( - vis: &mut V, ty: &$($lt)? $($mut)? Ty - ) -> V::Result { - let Ty { id, kind, span, tokens: _ } = ty; - try_visit!(visit_id(vis, id)); - match kind { - TyKind::Err(_guar) => {} - TyKind::Infer | TyKind::ImplicitSelf | TyKind::Dummy | TyKind::Never | TyKind::CVarArgs => {} - TyKind::Slice(ty) | TyKind::Paren(ty) => try_visit!(vis.visit_ty(ty)), - TyKind::Ptr(MutTy { ty, mutbl: _ }) => try_visit!(vis.visit_ty(ty)), - TyKind::Ref(opt_lifetime, MutTy { ty, mutbl: _ }) - | TyKind::PinnedRef(opt_lifetime, MutTy { ty, mutbl: _ }) => { - // FIXME(fee1-dead) asymmetry - visit_opt!(vis, visit_lifetime, opt_lifetime$(${ignore($lt)}, LifetimeCtxt::Ref)?); - try_visit!(vis.visit_ty(ty)); - } - TyKind::Tup(tuple_element_types) => { - walk_list!(vis, visit_ty, tuple_element_types); - } - TyKind::FnPtr(function_declaration) => { - let FnPtrTy { safety, ext: _, generic_params, decl, decl_span } = - &$($mut)? **function_declaration; - try_visit!(visit_safety(vis, safety)); - try_visit!(visit_generic_params(vis, generic_params)); - try_visit!(vis.visit_fn_decl(decl)); - try_visit!(visit_span(vis, decl_span)); - } - TyKind::UnsafeBinder(binder) => { - try_visit!(visit_generic_params(vis, &$($mut)? binder.generic_params)); - try_visit!(vis.visit_ty(&$($mut)? binder.inner_ty)); - } - TyKind::Path(maybe_qself, path) => { - try_visit!(vis.visit_qself(maybe_qself)); - try_visit!(vis.visit_path(path)); - } - TyKind::Pat(ty, pat) => { - try_visit!(vis.visit_ty(ty)); - try_visit!(vis.visit_ty_pat(pat)); - } - TyKind::Array(ty, length) => { - try_visit!(vis.visit_ty(ty)); - try_visit!(vis.visit_anon_const(length)); - } - TyKind::TraitObject(bounds, _syntax) => { - walk_list!(vis, visit_param_bound, bounds, BoundKind::TraitObject); - } - TyKind::ImplTrait(id, bounds) => { - try_visit!(visit_id(vis, id)); - walk_list!(vis, visit_param_bound, bounds, BoundKind::Impl); - } - TyKind::Typeof(expression) => try_visit!(vis.visit_anon_const(expression)), - - TyKind::MacCall(mac) => try_visit!(vis.visit_mac_call(mac)), - } - visit_span(vis, span) - } - - pub fn walk_crate<$($lt,)? V: $Visitor$(<$lt>)?>( - vis: &mut V, - krate: &$($lt)? $($mut)? Crate, - ) -> V::Result { - let Crate { attrs, items, spans, id, is_placeholder: _ } = krate; - try_visit!(visit_id(vis, id)); - walk_list!(vis, visit_attribute, attrs); - try_visit!(visit_items(vis, items)); - let ModSpans { inner_span, inject_use_span } = spans; - try_visit!(visit_span(vis, inner_span)); - visit_span(vis, inject_use_span) - } - - pub fn walk_local<$($lt,)? V: $Visitor$(<$lt>)?>( - vis: &mut V, - local: &$($lt)? $($mut)? Local, - ) -> V::Result { - let Local { id, super_, pat, ty, kind, span, colon_sp, attrs, tokens: _ } = local; - if let Some(sp) = super_ { - try_visit!(visit_span(vis, sp)); - } - try_visit!(visit_id(vis, id)); - walk_list!(vis, visit_attribute, attrs); - try_visit!(vis.visit_pat(pat)); - visit_opt!(vis, visit_ty, ty); - match kind { - LocalKind::Decl => {} - LocalKind::Init(init) => { - try_visit!(vis.visit_expr(init)) - } - LocalKind::InitElse(init, els) => { - try_visit!(vis.visit_expr(init)); - try_visit!(vis.visit_block(els)); - } - } - if let Some(sp) = colon_sp { - try_visit!(visit_span(vis, sp)); - } - visit_span(vis, span) - } - - pub fn walk_poly_trait_ref<$($lt,)? V: $Visitor$(<$lt>)?>( - vis: &mut V, - p: &$($lt)? $($mut)? PolyTraitRef, - ) -> V::Result { - let PolyTraitRef { bound_generic_params, modifiers, trait_ref, span, parens: _ } = p; - try_visit!(visit_modifiers(vis, modifiers)); - try_visit!(visit_generic_params(vis, bound_generic_params)); - try_visit!(vis.visit_trait_ref(trait_ref)); - visit_span(vis, span) - } - - pub fn walk_trait_ref<$($lt,)? V: $Visitor$(<$lt>)?>( - vis: &mut V, - TraitRef { path, ref_id }: &$($lt)? $($mut)? TraitRef, - ) -> V::Result { - try_visit!(vis.visit_path(path)); - visit_id(vis, ref_id) - } - - pub fn walk_variant<$($lt,)? V: $Visitor$(<$lt>)?>( - vis: &mut V, - variant: &$($lt)? $($mut)? Variant, - ) -> V::Result { - let Variant { attrs, id, span, vis: visibility, ident, data, disr_expr, is_placeholder: _ } = variant; - try_visit!(visit_id(vis, id)); - walk_list!(vis, visit_attribute, attrs); - try_visit!(vis.visit_vis(visibility)); - try_visit!(vis.visit_ident(ident)); - try_visit!(vis.visit_variant_data(data)); - visit_opt!(vis, visit_anon_const, disr_expr); - visit_span(vis, span) - } - - pub fn walk_expr_field<$($lt,)? V: $Visitor$(<$lt>)?>( - vis: &mut V, - f: &$($lt)? $($mut)? ExprField, - ) -> V::Result { - let ExprField { attrs, id, span, ident, expr, is_shorthand: _, is_placeholder: _ } = f; - try_visit!(visit_id(vis, id)); - walk_list!(vis, visit_attribute, attrs); - try_visit!(vis.visit_ident(ident)); - try_visit!(vis.visit_expr(expr)); - visit_span(vis, span) - } - - pub fn walk_pat_field<$($lt,)? V: $Visitor$(<$lt>)?>( - vis: &mut V, - fp: &$($lt)? $($mut)? PatField, - ) -> V::Result { - let PatField { ident, pat, is_shorthand: _, attrs, id, span, is_placeholder: _ } = fp; - try_visit!(visit_id(vis, id)); - walk_list!(vis, visit_attribute, attrs); - try_visit!(vis.visit_ident(ident)); - try_visit!(vis.visit_pat(pat)); - visit_span(vis, span) - } - - pub fn walk_ty_pat<$($lt,)? V: $Visitor$(<$lt>)?>( - vis: &mut V, - tp: &$($lt)? $($mut)? TyPat, - ) -> V::Result { - let TyPat { id, kind, span, tokens: _ } = tp; - try_visit!(visit_id(vis, id)); - match kind { - TyPatKind::Range(start, end, Spanned { span, node: _include_end }) => { - visit_opt!(vis, visit_anon_const, start); - visit_opt!(vis, visit_anon_const, end); - try_visit!(visit_span(vis, span)); - } - TyPatKind::Or(variants) => walk_list!(vis, visit_ty_pat, variants), - TyPatKind::Err(_) => {} - } - visit_span(vis, span) - } - - fn walk_qself<$($lt,)? V: $Visitor$(<$lt>)?>( - vis: &mut V, - qself: &$($lt)? $($mut)? Option>, - ) -> V::Result { - if let Some(qself) = qself { - let QSelf { ty, path_span, position: _ } = &$($mut)? **qself; - try_visit!(vis.visit_ty(ty)); - try_visit!(visit_span(vis, path_span)); - } - V::Result::output() - } - - pub fn walk_path<$($lt,)? V: $Visitor$(<$lt>)?>( - vis: &mut V, - path: &$($lt)? $($mut)? Path, - ) -> V::Result { - let Path { span, segments, tokens: _ } = path; - walk_list!(vis, visit_path_segment, segments); - visit_span(vis, span) - } - - pub fn walk_use_tree<$($lt,)? V: $Visitor$(<$lt>)?>( - vis: &mut V, - use_tree: &$($lt)? $($mut)? UseTree, - ) -> V::Result { - let UseTree { prefix, kind, span } = use_tree; - try_visit!(vis.visit_path(prefix)); - match kind { - UseTreeKind::Simple(rename) => { - // The extra IDs are handled during AST lowering. - visit_opt!(vis, visit_ident, rename); - } - UseTreeKind::Glob => {} - UseTreeKind::Nested { items, span } => { - for (nested_tree, nested_id) in items { - try_visit!(visit_nested_use_tree(vis, nested_tree, nested_id)); - } - try_visit!(visit_span(vis, span)); - } - } - visit_span(vis, span) - } - - pub fn walk_generic_args<$($lt,)? V: $Visitor$(<$lt>)?>( - vis: &mut V, - generic_args: &$($lt)? $($mut)? GenericArgs - ) -> V::Result { - match generic_args { - GenericArgs::AngleBracketed(AngleBracketedArgs { span, args }) => { - for arg in args { - match arg { - AngleBracketedArg::Arg(a) => try_visit!(vis.visit_generic_arg(a)), - AngleBracketedArg::Constraint(c) => { - try_visit!(vis.visit_assoc_item_constraint(c)) - } - } - } - visit_span(vis, span) - } - GenericArgs::Parenthesized(data) => { - let ParenthesizedArgs { span, inputs, inputs_span, output } = data; - walk_list!(vis, visit_ty, inputs); - try_visit!(vis.visit_fn_ret_ty(output)); - try_visit!(visit_span(vis, span)); - visit_span(vis, inputs_span) - } - GenericArgs::ParenthesizedElided(span) => visit_span(vis, span) - } - } - - pub fn walk_generic_arg<$($lt,)? V: $Visitor$(<$lt>)?>( - vis: &mut V, - generic_arg: &$($lt)? $($mut)? GenericArg, - ) -> V::Result { - match generic_arg { - GenericArg::Lifetime(lt) => vis.visit_lifetime(lt, $(${ignore($lt)} LifetimeCtxt::GenericArg)? ), - GenericArg::Type(ty) => vis.visit_ty(ty), - GenericArg::Const(ct) => vis.visit_anon_const(ct), - } - } - - pub fn walk_assoc_item_constraint<$($lt,)? V: $Visitor$(<$lt>)?>( - vis: &mut V, - constraint: &$($lt)? $($mut)? AssocItemConstraint, - ) -> V::Result { - let AssocItemConstraint { id, ident, gen_args, kind, span } = constraint; - try_visit!(visit_id(vis, id)); - try_visit!(vis.visit_ident(ident)); - visit_opt!(vis, visit_generic_args, gen_args); - match kind { - AssocItemConstraintKind::Equality { term } => match term { - Term::Ty(ty) => try_visit!(vis.visit_ty(ty)), - Term::Const(c) => try_visit!(vis.visit_anon_const(c)), - }, - AssocItemConstraintKind::Bound { bounds } => { - try_visit!(visit_bounds(vis, bounds, BoundKind::Bound)); - } - } - visit_span(vis, span) - } - - pub fn walk_param_bound<$($lt,)? V: $Visitor$(<$lt>)?>(vis: &mut V, bound: &$($lt)? $($mut)? GenericBound) -> V::Result { - match bound { - GenericBound::Trait(trait_ref) => vis.visit_poly_trait_ref(trait_ref), - GenericBound::Outlives(lifetime) => vis.visit_lifetime(lifetime, $(${ignore($lt)} LifetimeCtxt::Bound)?), - GenericBound::Use(args, span) => { - walk_list!(vis, visit_precise_capturing_arg, args); - visit_span(vis, span) - } - } - } - - pub fn walk_precise_capturing_arg<$($lt,)? V: $Visitor$(<$lt>)?>( - vis: &mut V, - arg: &$($lt)? $($mut)? PreciseCapturingArg, - ) -> V::Result { - match arg { - PreciseCapturingArg::Lifetime(lt) => vis.visit_lifetime(lt, $(${ignore($lt)} LifetimeCtxt::GenericArg)?), - PreciseCapturingArg::Arg(path, id) => { - try_visit!(visit_id(vis, id)); - vis.visit_path(path) - } - } - } - - pub fn walk_generic_param<$($lt,)? V: $Visitor$(<$lt>)?>( - vis: &mut V, - param: &$($lt)? $($mut)? GenericParam, - ) -> V::Result { - let GenericParam { id, ident, attrs, bounds, is_placeholder: _, kind, colon_span } = - param; - try_visit!(visit_id(vis, id)); - walk_list!(vis, visit_attribute, attrs); - try_visit!(vis.visit_ident(ident)); - walk_list!(vis, visit_param_bound, bounds, BoundKind::Bound); - match kind { - GenericParamKind::Lifetime => (), - GenericParamKind::Type { default } => visit_opt!(vis, visit_ty, default), - GenericParamKind::Const { ty, default, span } => { - try_visit!(vis.visit_ty(ty)); - visit_opt!(vis, visit_anon_const, default); - try_visit!(visit_span(vis, span)); - } - } - if let Some(sp) = colon_span { - try_visit!(visit_span(vis, sp)) - } - V::Result::output() - } - - pub fn walk_generics<$($lt,)? V: $Visitor$(<$lt>)?>(vis: &mut V, generics: &$($lt)? $($mut)? Generics) -> V::Result { - let Generics { params, where_clause, span } = generics; - let WhereClause { has_where_token: _, predicates, span: where_clause_span } = where_clause; - try_visit!(visit_generic_params(vis, params)); - try_visit!(visit_where_predicates(vis, predicates)); - try_visit!(visit_span(vis, span)); - visit_span(vis, where_clause_span) - } - - pub fn walk_contract<$($lt,)? V: $Visitor$(<$lt>)?>(vis: &mut V, c: &$($lt)? $($mut)? FnContract) -> V::Result { - let FnContract { requires, ensures } = c; - visit_opt!(vis, visit_expr, requires); - visit_opt!(vis, visit_expr, ensures); - V::Result::output() - } - - pub fn walk_where_predicate<$($lt,)? V: $Visitor$(<$lt>)?>( - vis: &mut V, - predicate: &$($lt)? $($mut)? WherePredicate, - ) -> V::Result { - let WherePredicate { attrs, kind, id, span, is_placeholder: _ } = predicate; - try_visit!(visit_id(vis, id)); - walk_list!(vis, visit_attribute, attrs); - try_visit!(visit_span(vis, span)); - vis.visit_where_predicate_kind(kind) - } - - pub fn walk_closure_binder<$($lt,)? V: $Visitor$(<$lt>)?>( - vis: &mut V, - binder: &$($lt)? $($mut)? ClosureBinder, - ) -> V::Result { - match binder { - ClosureBinder::NotPresent => {} - ClosureBinder::For { generic_params, span } => { - try_visit!(visit_generic_params(vis, generic_params)); - try_visit!(visit_span(vis, span)); - } - } - V::Result::output() - } - - pub fn walk_where_predicate_kind<$($lt,)? V: $Visitor$(<$lt>)?>( - vis: &mut V, - kind: &$($lt)? $($mut)? WherePredicateKind, - ) -> V::Result { - match kind { - WherePredicateKind::BoundPredicate(WhereBoundPredicate { - bounded_ty, - bounds, - bound_generic_params, - }) => { - try_visit!(visit_generic_params(vis, bound_generic_params)); - try_visit!(vis.visit_ty(bounded_ty)); - walk_list!(vis, visit_param_bound, bounds, BoundKind::Bound); - } - WherePredicateKind::RegionPredicate(WhereRegionPredicate { lifetime, bounds }) => { - try_visit!(vis.visit_lifetime(lifetime, $(${ignore($lt)} LifetimeCtxt::Bound )?)); - walk_list!(vis, visit_param_bound, bounds, BoundKind::Bound); - } - WherePredicateKind::EqPredicate(WhereEqPredicate { lhs_ty, rhs_ty }) => { - try_visit!(vis.visit_ty(lhs_ty)); - try_visit!(vis.visit_ty(rhs_ty)); - } - } - V::Result::output() - } - - pub fn walk_fn_decl<$($lt,)? V: $Visitor$(<$lt>)?>( - vis: &mut V, - FnDecl { inputs, output }: &$($lt)? $($mut)? FnDecl, - ) -> V::Result { - try_visit!(visit_params(vis, inputs)); - vis.visit_fn_ret_ty(output) - } - - pub fn walk_fn_ret_ty<$($lt,)? V: $Visitor$(<$lt>)?>(vis: &mut V, ret_ty: &$($lt)? $($mut)? FnRetTy) -> V::Result { - match ret_ty { - FnRetTy::Default(span) => visit_span(vis, span), - FnRetTy::Ty(output_ty) => vis.visit_ty(output_ty), + V::Result::output() } } @@ -1450,455 +913,200 @@ macro_rules! common_visitor_and_walkers { match kind { FnKind::Fn( _ctxt, - _vis, - Fn { - defaultness, - ident, - sig: FnSig { header, decl, span }, - generics, - contract, - body, - define_opaque, - }, - ) => { // Visibility is visited as a part of the item. - try_visit!(visit_defaultness(vis, defaultness)); - try_visit!(vis.visit_ident(ident)); - try_visit!(vis.visit_fn_header(header)); - try_visit!(vis.visit_generics(generics)); - try_visit!(vis.visit_fn_decl(decl)); - visit_opt!(vis, visit_contract, contract); - visit_opt!(vis, visit_block, body); - try_visit!(visit_span(vis, span)); - walk_define_opaques(vis, define_opaque) + _vis, + Fn { defaultness, ident, sig, generics, contract, body, define_opaque }, + ) => { + let FnSig { header, decl, span } = sig; + visit_visitable!($($mut)? vis, + defaultness, ident, header, generics, decl, + contract, body, span, define_opaque + ) } - FnKind::Closure(binder, coroutine_kind, decl, body) => { - try_visit!(vis.visit_closure_binder(binder)); - visit_opt!(vis, visit_coroutine_kind, coroutine_kind); - try_visit!(vis.visit_fn_decl(decl)); - vis.visit_expr(body) - } - } - } - - pub fn walk_variant_data<$($lt,)? V: $Visitor$(<$lt>)?>(vis: &mut V, data: &$($lt)? $($mut)? VariantData) -> V::Result { - match data { - VariantData::Struct { fields, recovered: _ } => { - visit_field_defs(vis, fields) - } - VariantData::Tuple(fields, id) => { - try_visit!(visit_id(vis, id)); - visit_field_defs(vis, fields) - } - VariantData::Unit(id) => visit_id(vis, id), - } - } - - pub fn walk_field_def<$($lt,)? V: $Visitor$(<$lt>)?>(vis: &mut V, field: &$($lt)? $($mut)? FieldDef) -> V::Result { - let FieldDef { attrs, id, span, vis: visibility, ident, ty, is_placeholder: _, safety: _, default } = - field; - try_visit!(visit_id(vis, id)); - walk_list!(vis, visit_attribute, attrs); - try_visit!(vis.visit_vis(visibility)); - visit_opt!(vis, visit_ident, ident); - try_visit!(vis.visit_ty(ty)); - visit_opt!(vis, visit_anon_const, default); - visit_span(vis, span) - } - - fn visit_delim_args<$($lt,)? V: $Visitor$(<$lt>)?>(vis: &mut V, args: &$($lt)? $($mut)? DelimArgs) -> V::Result { - let DelimArgs { dspan, delim: _, tokens: _ } = args; - let DelimSpan { open, close } = dspan; - try_visit!(visit_span(vis, open)); - visit_span(vis, close) - } - - pub fn walk_mac<$($lt,)? V: $Visitor$(<$lt>)?>(vis: &mut V, mac: &$($lt)? $($mut)? MacCall) -> V::Result { - let MacCall { path, args } = mac; - try_visit!(vis.visit_path(path)); - visit_delim_args(vis, args) - } - - fn walk_macro_def<$($lt,)? V: $Visitor$(<$lt>)?>(vis: &mut V, macro_def: &$($lt)? $($mut)? MacroDef) -> V::Result { - let MacroDef { body, macro_rules: _ } = macro_def; - visit_delim_args(vis, body) - } - - pub fn walk_inline_asm<$($lt,)? V: $Visitor$(<$lt>)?>(vis: &mut V, asm: &$($lt)? $($mut)? InlineAsm) -> V::Result { - let InlineAsm { - asm_macro: _, - template, - template_strs, - operands, - clobber_abis, - options: _, - line_spans, - } = asm; - for piece in template { - match piece { - InlineAsmTemplatePiece::String(_str) => {} - InlineAsmTemplatePiece::Placeholder { operand_idx: _, modifier: _, span } => { - try_visit!(visit_span(vis, span)); - } - } - } - for (_s1, _s2, span) in template_strs { - try_visit!(visit_span(vis, span)); - } - for (op, span) in operands { - match op { - InlineAsmOperand::In { expr, reg: _ } - | InlineAsmOperand::Out { expr: Some(expr), reg: _, late: _ } - | InlineAsmOperand::InOut { expr, reg: _, late: _ } => { - try_visit!(vis.visit_expr(expr)) - } - InlineAsmOperand::Out { expr: None, reg: _, late: _ } => {} - InlineAsmOperand::SplitInOut { in_expr, out_expr, reg: _, late: _ } => { - try_visit!(vis.visit_expr(in_expr)); - visit_opt!(vis, visit_expr, out_expr); - } - InlineAsmOperand::Const { anon_const } => { - try_visit!(vis.visit_anon_const(anon_const)) - } - InlineAsmOperand::Sym { sym } => try_visit!(vis.visit_inline_asm_sym(sym)), - InlineAsmOperand::Label { block } => try_visit!(vis.visit_block(block)), - } - try_visit!(visit_span(vis, span)); - } - for (_s1, span) in clobber_abis { - try_visit!(visit_span(vis, span)) - } - for span in line_spans { - try_visit!(visit_span(vis, span)) + FnKind::Closure(binder, coroutine_kind, decl, body) => + visit_visitable!($($mut)? vis, binder, coroutine_kind, decl, body), } V::Result::output() } - pub fn walk_inline_asm_sym<$($lt,)? V: $Visitor$(<$lt>)?>( - vis: &mut V, - InlineAsmSym { id, qself, path }: &$($lt)? $($mut)? InlineAsmSym, - ) -> V::Result { - try_visit!(visit_id(vis, id)); - try_visit!(vis.visit_qself(qself)); - vis.visit_path(path) - } - - pub fn walk_format_args<$($lt,)? V: $Visitor$(<$lt>)?>(vis: &mut V, fmt: &$($lt)? $($mut)? FormatArgs) -> V::Result { - let FormatArgs { span, template, arguments, uncooked_fmt_str: _, is_source_literal: _ } = fmt; - - let args = $(${ignore($mut)} arguments.all_args_mut())? $(${ignore($lt)} arguments.all_args())? ; - for FormatArgument { kind, expr } in args { - match kind { - FormatArgumentKind::Named(ident) | FormatArgumentKind::Captured(ident) => { - try_visit!(vis.visit_ident(ident)) - } - FormatArgumentKind::Normal => {} - } - try_visit!(vis.visit_expr(expr)); - } - for piece in template { - match piece { - FormatArgsPiece::Literal(_symbol) => {} - FormatArgsPiece::Placeholder(placeholder) => try_visit!(walk_format_placeholder(vis, placeholder)), - } - } - visit_span(vis, span) - } - - fn walk_format_placeholder<$($lt,)? V: $Visitor$(<$lt>)?>( - vis: &mut V, - placeholder: &$($lt)? $($mut)? FormatPlaceholder, - ) -> V::Result { - let FormatPlaceholder { argument, span, format_options, format_trait: _ } = placeholder; - if let Some(span) = span { - try_visit!(visit_span(vis, span)); - } - let FormatArgPosition { span, index: _, kind: _ } = argument; - if let Some(span) = span { - try_visit!(visit_span(vis, span)); - } - let FormatOptions { - width, - precision, - alignment: _, - fill: _, - sign: _, - alternate: _, - zero_pad: _, - debug_hex: _, - } = format_options; - match width { - None => {} - Some(FormatCount::Literal(_)) => {} - Some(FormatCount::Argument(FormatArgPosition { span, index: _, kind: _ })) => { - if let Some(span) = span { - try_visit!(visit_span(vis, span)); - } - } - } - match precision { - None => {} - Some(FormatCount::Literal(_)) => {} - Some(FormatCount::Argument(FormatArgPosition { span, index: _, kind: _ })) => { - if let Some(span) = span { - try_visit!(visit_span(vis, span)); - } - } - } + impl_walkable!(|&$($mut)? $($lt)? self: Impl, vis: &mut V| { + let Impl { defaultness, safety, generics, constness, polarity, of_trait, self_ty, items } = self; + visit_visitable!($($mut)? vis, defaultness, safety, generics, constness, polarity, of_trait, self_ty); + visit_visitable_with!($($mut)? vis, items, AssocCtxt::Impl { of_trait: of_trait.is_some() }); V::Result::output() - } + }); - pub fn walk_expr<$($lt,)? V: $Visitor$(<$lt>)?>(vis: &mut V, expression: &$($lt)? $($mut)? Expr) -> V::Result { - let Expr { id, kind, span, attrs, tokens: _ } = expression; - try_visit!(visit_id(vis, id)); - walk_list!(vis, visit_attribute, attrs); + // Special case to call `visit_method_receiver_expr`. + impl_walkable!(|&$($mut)? $($lt)? self: MethodCall, vis: &mut V| { + let MethodCall { seg, receiver, args, span } = self; + try_visit!(vis.visit_method_receiver_expr(receiver)); + visit_visitable!($($mut)? vis, seg, args, span); + V::Result::output() + }); + + impl_walkable!(|&$($mut)? $($lt)? self: Expr, vis: &mut V| { + let Expr { id, kind, span, attrs, tokens: _ } = self; + visit_visitable!($($mut)? vis, id, attrs); match kind { - ExprKind::Array(exprs) => { - try_visit!(visit_exprs(vis, exprs)); - } - ExprKind::ConstBlock(anon_const) => try_visit!(vis.visit_anon_const(anon_const)), - ExprKind::Repeat(element, count) => { - try_visit!(vis.visit_expr(element)); - try_visit!(vis.visit_anon_const(count)); - } - ExprKind::Struct(se) => { - let StructExpr { qself, path, fields, rest } = &$($mut)?**se; - try_visit!(vis.visit_qself(qself)); - try_visit!(vis.visit_path(path)); - try_visit!(visit_expr_fields(vis, fields)); - match rest { - StructRest::Base(expr) => try_visit!(vis.visit_expr(expr)), - StructRest::Rest(span) => try_visit!(visit_span(vis, span)), - StructRest::None => {} - } - } - ExprKind::Tup(exprs) => { - try_visit!(visit_exprs(vis, exprs)); - } - ExprKind::Call(callee_expression, arguments) => { - try_visit!(vis.visit_expr(callee_expression)); - try_visit!(visit_exprs(vis, arguments)); - } - ExprKind::MethodCall(box MethodCall { seg, receiver, args, span }) => { - try_visit!(vis.visit_method_receiver_expr(receiver)); - try_visit!(vis.visit_path_segment(seg)); - try_visit!(visit_exprs(vis, args)); - try_visit!(visit_span(vis, span)); - } - ExprKind::Binary(Spanned { span, node: _ }, left_expression, right_expression) => { - try_visit!(vis.visit_expr(left_expression)); - try_visit!(vis.visit_expr(right_expression)); - try_visit!(visit_span(vis, span)) - } - ExprKind::AddrOf(_kind, _mutbl, subexpression) => { - try_visit!(vis.visit_expr(subexpression)); - } - ExprKind::Unary(_op, subexpression) => { - try_visit!(vis.visit_expr(subexpression)); - } - ExprKind::Cast(subexpression, typ) | ExprKind::Type(subexpression, typ) => { - try_visit!(vis.visit_expr(subexpression)); - try_visit!(vis.visit_ty(typ)); - } - ExprKind::Let(pat, expr, span, _recovered) => { - try_visit!(vis.visit_pat(pat)); - try_visit!(vis.visit_expr(expr)); - try_visit!(visit_span(vis, span)) - } - ExprKind::If(head_expression, if_block, optional_else) => { - try_visit!(vis.visit_expr(head_expression)); - try_visit!(vis.visit_block(if_block)); - visit_opt!(vis, visit_expr, optional_else); - } - ExprKind::While(subexpression, block, opt_label) => { - visit_opt!(vis, visit_label, opt_label); - try_visit!(vis.visit_expr(subexpression)); - try_visit!(vis.visit_block(block)); - } - ExprKind::ForLoop { pat, iter, body, label, kind: _ } => { - visit_opt!(vis, visit_label, label); - try_visit!(vis.visit_pat(pat)); - try_visit!(vis.visit_expr(iter)); - try_visit!(vis.visit_block(body)); - } - ExprKind::Loop(block, opt_label, span) => { - visit_opt!(vis, visit_label, opt_label); - try_visit!(vis.visit_block(block)); - try_visit!(visit_span(vis, span)) - } - ExprKind::Match(subexpression, arms, _kind) => { - try_visit!(vis.visit_expr(subexpression)); - try_visit!(visit_arms(vis, arms)); - } + ExprKind::Array(exprs) => + visit_visitable!($($mut)? vis, exprs), + ExprKind::ConstBlock(anon_const) => + visit_visitable!($($mut)? vis, anon_const), + ExprKind::Repeat(element, count) => + visit_visitable!($($mut)? vis, element, count), + ExprKind::Struct(se) => + visit_visitable!($($mut)? vis, se), + ExprKind::Tup(exprs) => + visit_visitable!($($mut)? vis, exprs), + ExprKind::Call(callee_expression, arguments) => + visit_visitable!($($mut)? vis, callee_expression, arguments), + ExprKind::MethodCall(mc) => + visit_visitable!($($mut)? vis, mc), + ExprKind::Binary(op, lhs, rhs) => + visit_visitable!($($mut)? vis, op, lhs, rhs), + ExprKind::AddrOf(kind, mutbl, subexpression) => + visit_visitable!($($mut)? vis, kind, mutbl, subexpression), + ExprKind::Unary(op, subexpression) => + visit_visitable!($($mut)? vis, op, subexpression), + ExprKind::Cast(subexpression, typ) | ExprKind::Type(subexpression, typ) => + visit_visitable!($($mut)? vis, subexpression, typ), + ExprKind::Let(pat, expr, span, _recovered) => + visit_visitable!($($mut)? vis, pat, expr, span), + ExprKind::If(head_expression, if_block, optional_else) => + visit_visitable!($($mut)? vis, head_expression, if_block, optional_else), + ExprKind::While(subexpression, block, opt_label) => + visit_visitable!($($mut)? vis, subexpression, block, opt_label), + ExprKind::ForLoop { pat, iter, body, label, kind } => + visit_visitable!($($mut)? vis, pat, iter, body, label, kind), + ExprKind::Loop(block, opt_label, span) => + visit_visitable!($($mut)? vis, block, opt_label, span), + ExprKind::Match(subexpression, arms, kind) => + visit_visitable!($($mut)? vis, subexpression, arms, kind), ExprKind::Closure(box Closure { binder, capture_clause, coroutine_kind, constness, - movability: _, + movability, fn_decl, body, fn_decl_span, fn_arg_span, }) => { - try_visit!(visit_constness(vis, constness)); - try_visit!(vis.visit_capture_by(capture_clause)); - try_visit!(vis.visit_fn( - FnKind::Closure(binder, coroutine_kind, fn_decl, body), - *span, - *id - )); - try_visit!(visit_span(vis, fn_decl_span)); - try_visit!(visit_span(vis, fn_arg_span)); - } - ExprKind::Block(block, opt_label) => { - visit_opt!(vis, visit_label, opt_label); - try_visit!(vis.visit_block(block)); - } - ExprKind::Gen(capture_clause, body, _kind, decl_span) => { - try_visit!(vis.visit_capture_by(capture_clause)); - try_visit!(vis.visit_block(body)); - try_visit!(visit_span(vis, decl_span)); - } - ExprKind::Await(expr, span) => { - try_visit!(vis.visit_expr(expr)); - try_visit!(visit_span(vis, span)); - } - ExprKind::Use(expr, span) => { - try_visit!(vis.visit_expr(expr)); - try_visit!(visit_span(vis, span)); - } - ExprKind::Assign(lhs, rhs, span) => { - try_visit!(vis.visit_expr(lhs)); - try_visit!(vis.visit_expr(rhs)); - try_visit!(visit_span(vis, span)); - } - ExprKind::AssignOp(Spanned { span, node: _ }, left_expression, right_expression) => { - try_visit!(vis.visit_expr(left_expression)); - try_visit!(vis.visit_expr(right_expression)); - try_visit!(visit_span(vis, span)); - } - ExprKind::Field(subexpression, ident) => { - try_visit!(vis.visit_expr(subexpression)); - try_visit!(vis.visit_ident(ident)); - } - ExprKind::Index(main_expression, index_expression, span) => { - try_visit!(vis.visit_expr(main_expression)); - try_visit!(vis.visit_expr(index_expression)); - try_visit!(visit_span(vis, span)); - } - ExprKind::Range(start, end, _limit) => { - visit_opt!(vis, visit_expr, start); - visit_opt!(vis, visit_expr, end); + visit_visitable!($($mut)? vis, constness, movability, capture_clause); + let kind = FnKind::Closure(binder, coroutine_kind, fn_decl, body); + try_visit!(vis.visit_fn(kind, *span, *id)); + visit_visitable!($($mut)? vis, fn_decl_span, fn_arg_span); } + ExprKind::Block(block, opt_label) => + visit_visitable!($($mut)? vis, block, opt_label), + ExprKind::Gen(capt, body, kind, decl_span) => + visit_visitable!($($mut)? vis, capt, body, kind, decl_span), + ExprKind::Await(expr, span) | ExprKind::Use(expr, span) => + visit_visitable!($($mut)? vis, expr, span), + ExprKind::Assign(lhs, rhs, span) => + visit_visitable!($($mut)? vis, lhs, rhs, span), + ExprKind::AssignOp(op, lhs, rhs) => + visit_visitable!($($mut)? vis, op, lhs, rhs), + ExprKind::Field(subexpression, ident) => + visit_visitable!($($mut)? vis, subexpression, ident), + ExprKind::Index(main_expression, index_expression, span) => + visit_visitable!($($mut)? vis, main_expression, index_expression, span), + ExprKind::Range(start, end, limit) => + visit_visitable!($($mut)? vis, start, end, limit), ExprKind::Underscore => {} - ExprKind::Path(maybe_qself, path) => { - try_visit!(vis.visit_qself(maybe_qself)); - try_visit!(vis.visit_path(path)); - } - ExprKind::Break(opt_label, opt_expr) => { - visit_opt!(vis, visit_label, opt_label); - visit_opt!(vis, visit_expr, opt_expr); - } - ExprKind::Continue(opt_label) => { - visit_opt!(vis, visit_label, opt_label); - } - ExprKind::Ret(optional_expression) => { - visit_opt!(vis, visit_expr, optional_expression); - } - ExprKind::Yeet(optional_expression) => { - visit_opt!(vis, visit_expr, optional_expression); - } - ExprKind::Become(expr) => try_visit!(vis.visit_expr(expr)), - ExprKind::MacCall(mac) => try_visit!(vis.visit_mac_call(mac)), - ExprKind::Paren(subexpression) => try_visit!(vis.visit_expr(subexpression)), - ExprKind::InlineAsm(asm) => try_visit!(vis.visit_inline_asm(asm)), - ExprKind::FormatArgs(f) => try_visit!(vis.visit_format_args(f)), - ExprKind::OffsetOf(container, fields) => { - try_visit!(vis.visit_ty(container)); - walk_list!(vis, visit_ident, fields); - } - ExprKind::Yield(kind) => { - match kind { - YieldKind::Postfix(expr) => { - try_visit!(vis.visit_expr(expr)); - } - YieldKind::Prefix(expr) => { - visit_opt!(vis, visit_expr, expr); - } - } - } - ExprKind::Try(subexpression) => try_visit!(vis.visit_expr(subexpression)), - ExprKind::TryBlock(body) => try_visit!(vis.visit_block(body)), - ExprKind::Lit(_token) => {} - ExprKind::IncludedBytes(_bytes) => {} - ExprKind::UnsafeBinderCast(_kind, expr, ty) => { - try_visit!(vis.visit_expr(expr)); - visit_opt!(vis, visit_ty, ty); - } + ExprKind::Path(maybe_qself, path) => + visit_visitable!($($mut)? vis, maybe_qself, path), + ExprKind::Break(opt_label, opt_expr) => + visit_visitable!($($mut)? vis, opt_label, opt_expr), + ExprKind::Continue(opt_label) => + visit_visitable!($($mut)? vis, opt_label), + ExprKind::Ret(optional_expression) | ExprKind::Yeet(optional_expression) => + visit_visitable!($($mut)? vis, optional_expression), + ExprKind::Become(expr) => + visit_visitable!($($mut)? vis, expr), + ExprKind::MacCall(mac) => + visit_visitable!($($mut)? vis, mac), + ExprKind::Paren(subexpression) => + visit_visitable!($($mut)? vis, subexpression), + ExprKind::InlineAsm(asm) => + visit_visitable!($($mut)? vis, asm), + ExprKind::FormatArgs(f) => + visit_visitable!($($mut)? vis, f), + ExprKind::OffsetOf(container, fields) => + visit_visitable!($($mut)? vis, container, fields), + ExprKind::Yield(kind) => + visit_visitable!($($mut)? vis, kind), + ExprKind::Try(subexpression) => + visit_visitable!($($mut)? vis, subexpression), + ExprKind::TryBlock(body) => + visit_visitable!($($mut)? vis, body), + ExprKind::Lit(token) => + visit_visitable!($($mut)? vis, token), + ExprKind::IncludedBytes(bytes) => + visit_visitable!($($mut)? vis, bytes), + ExprKind::UnsafeBinderCast(kind, expr, ty) => + visit_visitable!($($mut)? vis, kind, expr, ty), ExprKind::Err(_guar) => {} ExprKind::Dummy => {} } visit_span(vis, span) - } + }); - pub fn walk_param<$($lt,)? V: $Visitor$(<$lt>)?>(vis: &mut V, param: &$($lt)? $($mut)? Param) -> V::Result { - let Param { attrs, ty, pat, id, span, is_placeholder: _ } = param; - try_visit!(visit_id(vis, id)); - walk_list!(vis, visit_attribute, attrs); - try_visit!(vis.visit_pat(pat)); - try_visit!(vis.visit_ty(ty)); - visit_span(vis, span) - } - - pub fn walk_arm<$($lt,)? V: $Visitor$(<$lt>)?>(vis: &mut V, arm: &$($lt)? $($mut)? Arm) -> V::Result { - let Arm { attrs, pat, guard, body, span, id, is_placeholder: _ } = arm; - try_visit!(visit_id(vis, id)); - walk_list!(vis, visit_attribute, attrs); - try_visit!(vis.visit_pat(pat)); - visit_opt!(vis, visit_expr, guard); - visit_opt!(vis, visit_expr, body); - visit_span(vis, span) - } - - pub fn walk_vis<$($lt,)? V: $Visitor$(<$lt>)?>(vis: &mut V, visibility: &$($lt)? $($mut)? Visibility) -> V::Result { - let Visibility { kind, span, tokens: _ } = visibility; - match kind { - VisibilityKind::Restricted { path, id, shorthand: _ } => { - try_visit!(visit_id(vis, id)); - try_visit!(vis.visit_path(path)); - } - VisibilityKind::Public | VisibilityKind::Inherited => {} - } - visit_span(vis, span) - } - - pub fn walk_attribute<$($lt,)? V: $Visitor$(<$lt>)?>(vis: &mut V, attr: &$($lt)? $($mut)? Attribute) -> V::Result { - let Attribute { kind, id: _, style: _, span } = attr; - match kind { - AttrKind::Normal(normal) => { - let NormalAttr { item, tokens: _ } = &$($mut)?**normal; - let AttrItem { unsafety: _, path, args, tokens: _ } = item; - try_visit!(vis.visit_path(path)); - try_visit!(walk_attr_args(vis, args)); - } - AttrKind::DocComment(_kind, _sym) => {} - } - visit_span(vis, span) - } - - pub fn walk_attr_args<$($lt,)? V: $Visitor$(<$lt>)?>(vis: &mut V, args: &$($lt)? $($mut)? AttrArgs) -> V::Result { - match args { - AttrArgs::Empty => {} - AttrArgs::Delimited(args) => try_visit!(visit_delim_args(vis, args)), - AttrArgs::Eq { eq_span, expr } => { - try_visit!(vis.visit_expr(expr)); - try_visit!(visit_span(vis, eq_span)); - } - } - V::Result::output() - } + define_named_walk!($(($mut))? $Visitor$(<$lt>)? + pub fn walk_anon_const(AnonConst); + pub fn walk_arm(Arm); + //pub fn walk_assoc_item(AssocItem, _ctxt: AssocCtxt); + pub fn walk_assoc_item_constraint(AssocItemConstraint); + pub fn walk_attribute(Attribute); + pub fn walk_block(Block); + //pub fn walk_nested_use_tree((UseTree, NodeId)); + pub fn walk_capture_by(CaptureBy); + pub fn walk_closure_binder(ClosureBinder); + pub fn walk_contract(FnContract); + pub fn walk_coroutine_kind(CoroutineKind); + pub fn walk_crate(Crate); + pub fn walk_expr(Expr); + pub fn walk_expr_field(ExprField); + pub fn walk_field_def(FieldDef); + pub fn walk_fn_decl(FnDecl); + pub fn walk_fn_header(FnHeader); + pub fn walk_fn_ret_ty(FnRetTy); + //pub fn walk_foreign_item(ForeignItem); + pub fn walk_foreign_mod(ForeignMod); + pub fn walk_format_args(FormatArgs); + pub fn walk_generic_arg(GenericArg); + pub fn walk_generic_args(GenericArgs); + pub fn walk_generic_param(GenericParam); + pub fn walk_generics(Generics); + pub fn walk_inline_asm(InlineAsm); + pub fn walk_inline_asm_sym(InlineAsmSym); + //pub fn walk_item(Item); + pub fn walk_label(Label); + pub fn walk_lifetime(Lifetime); + pub fn walk_local(Local); + pub fn walk_mac(MacCall); + pub fn walk_macro_def(MacroDef); + pub fn walk_param_bound(GenericBound); + pub fn walk_param(Param); + pub fn walk_pat_field(PatField); + pub fn walk_path(Path); + pub fn walk_path_segment(PathSegment); + pub fn walk_pat(Pat); + pub fn walk_poly_trait_ref(PolyTraitRef); + pub fn walk_precise_capturing_arg(PreciseCapturingArg); + pub fn walk_qself(QSelf); + pub fn walk_trait_ref(TraitRef); + pub fn walk_ty_pat(TyPat); + pub fn walk_ty(Ty); + pub fn walk_use_tree(UseTree); + pub fn walk_variant_data(VariantData); + pub fn walk_variant(Variant); + pub fn walk_vis(Visibility); + pub fn walk_where_predicate_kind(WherePredicateKind); + pub fn walk_where_predicate(WherePredicate); + ); }; } @@ -1907,6 +1115,20 @@ common_visitor_and_walkers!(Visitor<'a>); macro_rules! generate_list_visit_fns { ($($name:ident, $Ty:ty, $visit_fn:ident$(, $param:ident: $ParamTy:ty)*;)+) => { $( + #[allow(unused_parens)] + impl<'a, V: Visitor<'a>> Visitable<'a, V> for ThinVec<$Ty> { + type Extra = ($($ParamTy),*); + + #[inline] + fn visit( + &'a self, + visitor: &mut V, + ($($param),*): Self::Extra, + ) -> V::Result { + $name(visitor, self $(, $param)*) + } + } + fn $name<'a, V: Visitor<'a>>( vis: &mut V, values: &'a ThinVec<$Ty>, @@ -1937,18 +1159,9 @@ generate_list_visit_fns! { visit_arms, Arm, visit_arm; } -#[expect(rustc::pass_by_value)] // needed for symmetry with mut_visit -fn visit_nested_use_tree<'a, V: Visitor<'a>>( - vis: &mut V, - nested_tree: &'a UseTree, - &nested_id: &NodeId, -) -> V::Result { - vis.visit_nested_use_tree(nested_tree, nested_id) -} - pub fn walk_stmt<'a, V: Visitor<'a>>(visitor: &mut V, statement: &'a Stmt) -> V::Result { let Stmt { id, kind, span: _ } = statement; - try_visit!(visit_id(visitor, id)); + try_visit!(visitor.visit_id(*id)); match kind { StmtKind::Let(local) => try_visit!(visitor.visit_local(local)), StmtKind::Item(item) => try_visit!(visitor.visit_item(item)), diff --git a/compiler/rustc_macros/src/lib.rs b/compiler/rustc_macros/src/lib.rs index 1006ea3ba10a..101f5ccb7a47 100644 --- a/compiler/rustc_macros/src/lib.rs +++ b/compiler/rustc_macros/src/lib.rs @@ -21,6 +21,7 @@ mod symbols; mod try_from; mod type_foldable; mod type_visitable; +mod visitable; // Reads the rust version (e.g. "1.75.0") from the CFG_RELEASE env var and // produces a `RustcVersion` literal containing that version (e.g. @@ -101,6 +102,16 @@ decl_derive!( /// visited (and its type is not required to implement `TypeVisitable`). type_visitable::type_visitable_derive ); +decl_derive!( + [Walkable, attributes(visitable)] => + /// Derives `Walkable` for the annotated `struct` or `enum` (`union` is not supported). + /// + /// Each field of the struct or enum variant will be visited in definition order, using the + /// `Walkable` implementation for its type. However, if a field of a struct or an enum + /// variant is annotated with `#[visitable(ignore)]` then that field will not be + /// visited (and its type is not required to implement `Walkable`). + visitable::visitable_derive +); decl_derive!([Lift, attributes(lift)] => lift::lift_derive); decl_derive!( [Diagnostic, attributes( diff --git a/compiler/rustc_macros/src/visitable.rs b/compiler/rustc_macros/src/visitable.rs new file mode 100644 index 000000000000..a7a82538eabe --- /dev/null +++ b/compiler/rustc_macros/src/visitable.rs @@ -0,0 +1,82 @@ +use quote::quote; +use synstructure::BindingInfo; + +pub(super) fn visitable_derive(mut s: synstructure::Structure<'_>) -> proc_macro2::TokenStream { + if let syn::Data::Union(_) = s.ast().data { + panic!("cannot derive on union") + } + + let has_attr = |bind: &BindingInfo<'_>, name| { + let mut found = false; + bind.ast().attrs.iter().for_each(|attr| { + if !attr.path().is_ident("visitable") { + return; + } + let _ = attr.parse_nested_meta(|nested| { + if nested.path.is_ident(name) { + found = true; + } + Ok(()) + }); + }); + found + }; + + let get_attr = |bind: &BindingInfo<'_>, name: &str| { + let mut content = None; + bind.ast().attrs.iter().for_each(|attr| { + if !attr.path().is_ident("visitable") { + return; + } + let _ = attr.parse_nested_meta(|nested| { + if nested.path.is_ident(name) { + let value = nested.value()?; + let value = value.parse()?; + content = Some(value); + } + Ok(()) + }); + }); + content + }; + + s.add_bounds(synstructure::AddBounds::Generics); + s.bind_with(|_| synstructure::BindStyle::Ref); + let ref_visit = s.each(|bind| { + let extra = get_attr(bind, "extra").unwrap_or(quote! {}); + if has_attr(bind, "ignore") { + quote! {} + } else { + quote! { rustc_ast_ir::try_visit!(crate::visit::Visitable::visit(#bind, __visitor, (#extra))) } + } + }); + + s.bind_with(|_| synstructure::BindStyle::RefMut); + let mut_visit = s.each(|bind| { + let extra = get_attr(bind, "extra").unwrap_or(quote! {}); + if has_attr(bind, "ignore") { + quote! {} + } else { + quote! { crate::mut_visit::MutVisitable::visit_mut(#bind, __visitor, (#extra)) } + } + }); + + s.gen_impl(quote! { + gen impl<'__ast, __V> crate::visit::Walkable<'__ast, __V> for @Self + where __V: crate::visit::Visitor<'__ast>, + { + fn walk_ref(&'__ast self, __visitor: &mut __V) -> __V::Result { + match *self { #ref_visit } + <__V::Result as rustc_ast_ir::visit::VisitorResult>::output() + } + } + + gen impl<__V> crate::mut_visit::MutWalkable<__V> for @Self + where __V: crate::mut_visit::MutVisitor, + { + fn walk_mut(&mut self, __visitor: &mut __V) { + match *self { #mut_visit } + } + } + }) +} From 6df15a172e7cd26fa59826fbc123938fabe260bb Mon Sep 17 00:00:00 2001 From: Makai Date: Wed, 16 Jul 2025 12:10:39 +0000 Subject: [PATCH 091/139] update SUMMARY.md --- tests/ui/SUMMARY.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/ui/SUMMARY.md b/tests/ui/SUMMARY.md index 1aeb0fcfbea6..b635b6326fce 100644 --- a/tests/ui/SUMMARY.md +++ b/tests/ui/SUMMARY.md @@ -1277,9 +1277,9 @@ See [Tracking issue for specialization (RFC 1210) #31844](https://github.com/rus Stability attributes used internally by the standard library: `#[stable()]` and `#[unstable()]`. -## `tests/ui/stable-mir-print/` +## `tests/ui/rustc_public-ir-print/` -Some tests for pretty printing of StableMIR. +Some tests for pretty printing of rustc_public's IR. ## `tests/ui/stack-protector/`: `-Z stack-protector` command line flag From 551cb9f1f4fa315639033e3db39794e10a14b7f7 Mon Sep 17 00:00:00 2001 From: Josh Triplett Date: Tue, 22 Jul 2025 00:32:59 -0700 Subject: [PATCH 092/139] mbe: Use concrete type for `get_unused_rule` Rather than adding `get_unused_rule` to the `TTMacroExpander` trait, put it on the concrete `MacroRulesMacroExpander`, and downcast to that type via `Any` in order to call it. Suggested-by: Vadim Petrochenkov --- compiler/rustc_expand/src/base.rs | 9 +++------ compiler/rustc_expand/src/lib.rs | 2 +- compiler/rustc_expand/src/mbe/macro_rules.rs | 16 +++++++++------- compiler/rustc_resolve/src/macros.rs | 9 +++++++-- 4 files changed, 20 insertions(+), 16 deletions(-) diff --git a/compiler/rustc_expand/src/base.rs b/compiler/rustc_expand/src/base.rs index 1928cfd90482..25ec54011111 100644 --- a/compiler/rustc_expand/src/base.rs +++ b/compiler/rustc_expand/src/base.rs @@ -1,3 +1,4 @@ +use std::any::Any; use std::default::Default; use std::iter; use std::path::Component::Prefix; @@ -361,17 +362,13 @@ where } /// Represents a thing that maps token trees to Macro Results -pub trait TTMacroExpander { +pub trait TTMacroExpander: Any { fn expand<'cx>( &self, ecx: &'cx mut ExtCtxt<'_>, span: Span, input: TokenStream, ) -> MacroExpanderResult<'cx>; - - fn get_unused_rule(&self, _rule_i: usize) -> Option<(&Ident, Span)> { - None - } } pub type MacroExpanderResult<'cx> = ExpandResult, ()>; @@ -379,7 +376,7 @@ pub type MacroExpanderResult<'cx> = ExpandResult, ()>; pub type MacroExpanderFn = for<'cx> fn(&'cx mut ExtCtxt<'_>, Span, TokenStream) -> MacroExpanderResult<'cx>; -impl TTMacroExpander for F +impl TTMacroExpander for F where F: for<'cx> Fn(&'cx mut ExtCtxt<'_>, Span, TokenStream) -> MacroExpanderResult<'cx>, { diff --git a/compiler/rustc_expand/src/lib.rs b/compiler/rustc_expand/src/lib.rs index 64be7649775f..b54dabbb8e26 100644 --- a/compiler/rustc_expand/src/lib.rs +++ b/compiler/rustc_expand/src/lib.rs @@ -22,7 +22,7 @@ mod placeholders; mod proc_macro_server; mod stats; -pub use mbe::macro_rules::compile_declarative_macro; +pub use mbe::macro_rules::{MacroRulesMacroExpander, compile_declarative_macro}; pub mod base; pub mod config; pub mod expand; diff --git a/compiler/rustc_expand/src/mbe/macro_rules.rs b/compiler/rustc_expand/src/mbe/macro_rules.rs index 2d792355b278..2f713a09b95e 100644 --- a/compiler/rustc_expand/src/mbe/macro_rules.rs +++ b/compiler/rustc_expand/src/mbe/macro_rules.rs @@ -128,7 +128,7 @@ pub(super) struct MacroRule { rhs: mbe::TokenTree, } -struct MacroRulesMacroExpander { +pub struct MacroRulesMacroExpander { node_id: NodeId, name: Ident, span: Span, @@ -136,6 +136,14 @@ struct MacroRulesMacroExpander { rules: Vec, } +impl MacroRulesMacroExpander { + pub fn get_unused_rule(&self, rule_i: usize) -> Option<(&Ident, Span)> { + // If the rhs contains an invocation like `compile_error!`, don't report it as unused. + let rule = &self.rules[rule_i]; + if has_compile_error_macro(&rule.rhs) { None } else { Some((&self.name, rule.lhs_span)) } + } +} + impl TTMacroExpander for MacroRulesMacroExpander { fn expand<'cx>( &self, @@ -154,12 +162,6 @@ impl TTMacroExpander for MacroRulesMacroExpander { &self.rules, )) } - - fn get_unused_rule(&self, rule_i: usize) -> Option<(&Ident, Span)> { - // If the rhs contains an invocation like `compile_error!`, don't report it as unused. - let rule = &self.rules[rule_i]; - if has_compile_error_macro(&rule.rhs) { None } else { Some((&self.name, rule.lhs_span)) } - } } struct DummyExpander(ErrorGuaranteed); diff --git a/compiler/rustc_resolve/src/macros.rs b/compiler/rustc_resolve/src/macros.rs index 77ef7f56c094..333fc808d1b8 100644 --- a/compiler/rustc_resolve/src/macros.rs +++ b/compiler/rustc_resolve/src/macros.rs @@ -1,6 +1,7 @@ //! A bunch of methods and structures more or less related to resolving macros and //! interface provided by `Resolver` to macro expander. +use std::any::Any; use std::cell::Cell; use std::mem; use std::sync::Arc; @@ -13,10 +14,10 @@ use rustc_expand::base::{ Annotatable, DeriveResolution, Indeterminate, ResolverExpand, SyntaxExtension, SyntaxExtensionKind, }; -use rustc_expand::compile_declarative_macro; use rustc_expand::expand::{ AstFragment, AstFragmentKind, Invocation, InvocationKind, SupportsMacroExpansion, }; +use rustc_expand::{MacroRulesMacroExpander, compile_declarative_macro}; use rustc_hir::def::{self, DefKind, Namespace, NonMacroAttrKind}; use rustc_hir::def_id::{CrateNum, DefId, LocalDefId}; use rustc_middle::middle::stability; @@ -357,8 +358,12 @@ impl<'ra, 'tcx> ResolverExpand for Resolver<'ra, 'tcx> { let SyntaxExtensionKind::LegacyBang(ref ext) = m.ext.kind else { continue; }; + let ext: &dyn Any = ext.as_ref(); + let Some(m) = ext.downcast_ref::() else { + continue; + }; for arm_i in unused_arms.iter() { - if let Some((ident, rule_span)) = ext.get_unused_rule(arm_i) { + if let Some((ident, rule_span)) = m.get_unused_rule(arm_i) { self.lint_buffer.buffer_lint( UNUSED_MACRO_RULES, node_id, From f877aa7d14916f71a2f88c6d4c009e7ded7684c4 Mon Sep 17 00:00:00 2001 From: Zalathar Date: Sun, 4 May 2025 14:09:52 +1000 Subject: [PATCH 093/139] coverage: Enlarge empty spans during MIR instrumentation, not codegen This allows us to assume that coverage spans will only be discarded during codegen in very unusual situations. --- .../src/coverageinfo/mapgen/spans.rs | 28 ++------------ .../rustc_mir_transform/src/coverage/spans.rs | 38 ++++++++++++++++++- tests/coverage/async_closure.cov-map | 21 +++++----- ...ch_match_arms.main.InstrumentCoverage.diff | 2 +- ...ument_coverage.bar.InstrumentCoverage.diff | 2 +- ...ment_coverage.main.InstrumentCoverage.diff | 4 +- ...rage_cleanup.main.CleanupPostBorrowck.diff | 4 +- ...erage_cleanup.main.InstrumentCoverage.diff | 4 +- 8 files changed, 57 insertions(+), 46 deletions(-) diff --git a/compiler/rustc_codegen_llvm/src/coverageinfo/mapgen/spans.rs b/compiler/rustc_codegen_llvm/src/coverageinfo/mapgen/spans.rs index 39a59560c9d3..574463be7ffe 100644 --- a/compiler/rustc_codegen_llvm/src/coverageinfo/mapgen/spans.rs +++ b/compiler/rustc_codegen_llvm/src/coverageinfo/mapgen/spans.rs @@ -39,7 +39,10 @@ impl Coords { /// or other expansions), and if it does happen then skipping a span or function is /// better than an ICE or `llvm-cov` failure that the user might have no way to avoid. pub(crate) fn make_coords(source_map: &SourceMap, file: &SourceFile, span: Span) -> Option { - let span = ensure_non_empty_span(source_map, span)?; + if span.is_empty() { + debug_assert!(false, "can't make coords from empty span: {span:?}"); + return None; + } let lo = span.lo(); let hi = span.hi(); @@ -70,29 +73,6 @@ pub(crate) fn make_coords(source_map: &SourceMap, file: &SourceFile, span: Span) }) } -fn ensure_non_empty_span(source_map: &SourceMap, span: Span) -> Option { - if !span.is_empty() { - return Some(span); - } - - // The span is empty, so try to enlarge it to cover an adjacent '{' or '}'. - source_map - .span_to_source(span, |src, start, end| try { - // Adjusting span endpoints by `BytePos(1)` is normally a bug, - // but in this case we have specifically checked that the character - // we're skipping over is one of two specific ASCII characters, so - // adjusting by exactly 1 byte is correct. - if src.as_bytes().get(end).copied() == Some(b'{') { - Some(span.with_hi(span.hi() + BytePos(1))) - } else if start > 0 && src.as_bytes()[start - 1] == b'}' { - Some(span.with_lo(span.lo() - BytePos(1))) - } else { - None - } - }) - .ok()? -} - /// If `llvm-cov` sees a source region that is improperly ordered (end < start), /// it will immediately exit with a fatal error. To prevent that from happening, /// discard regions that are improperly ordered, or might be interpreted in a diff --git a/compiler/rustc_mir_transform/src/coverage/spans.rs b/compiler/rustc_mir_transform/src/coverage/spans.rs index ec76076020eb..ddeae093df5b 100644 --- a/compiler/rustc_mir_transform/src/coverage/spans.rs +++ b/compiler/rustc_mir_transform/src/coverage/spans.rs @@ -1,7 +1,8 @@ use rustc_data_structures::fx::FxHashSet; use rustc_middle::mir; use rustc_middle::ty::TyCtxt; -use rustc_span::{DesugaringKind, ExpnKind, MacroKind, Span}; +use rustc_span::source_map::SourceMap; +use rustc_span::{BytePos, DesugaringKind, ExpnKind, MacroKind, Span}; use tracing::instrument; use crate::coverage::graph::{BasicCoverageBlock, CoverageGraph}; @@ -83,8 +84,18 @@ pub(super) fn extract_refined_covspans<'tcx>( // Discard any span that overlaps with a hole. discard_spans_overlapping_holes(&mut covspans, &holes); - // Perform more refinement steps after holes have been dealt with. + // Discard spans that overlap in unwanted ways. let mut covspans = remove_unwanted_overlapping_spans(covspans); + + // For all empty spans, either enlarge them to be non-empty, or discard them. + let source_map = tcx.sess.source_map(); + covspans.retain_mut(|covspan| { + let Some(span) = ensure_non_empty_span(source_map, covspan.span) else { return false }; + covspan.span = span; + true + }); + + // Merge covspans that can be merged. covspans.dedup_by(|b, a| a.merge_if_eligible(b)); code_mappings.extend(covspans.into_iter().map(|Covspan { span, bcb }| { @@ -230,3 +241,26 @@ fn compare_spans(a: Span, b: Span) -> std::cmp::Ordering { // - Both have the same start and span A extends further right .then_with(|| Ord::cmp(&a.hi(), &b.hi()).reverse()) } + +fn ensure_non_empty_span(source_map: &SourceMap, span: Span) -> Option { + if !span.is_empty() { + return Some(span); + } + + // The span is empty, so try to enlarge it to cover an adjacent '{' or '}'. + source_map + .span_to_source(span, |src, start, end| try { + // Adjusting span endpoints by `BytePos(1)` is normally a bug, + // but in this case we have specifically checked that the character + // we're skipping over is one of two specific ASCII characters, so + // adjusting by exactly 1 byte is correct. + if src.as_bytes().get(end).copied() == Some(b'{') { + Some(span.with_hi(span.hi() + BytePos(1))) + } else if start > 0 && src.as_bytes()[start - 1] == b'}' { + Some(span.with_lo(span.lo() - BytePos(1))) + } else { + None + } + }) + .ok()? +} diff --git a/tests/coverage/async_closure.cov-map b/tests/coverage/async_closure.cov-map index 9f8dc8d6cbba..53128dd7a48b 100644 --- a/tests/coverage/async_closure.cov-map +++ b/tests/coverage/async_closure.cov-map @@ -37,32 +37,29 @@ Number of file 0 mappings: 8 Highest counter ID seen: c0 Function name: async_closure::main::{closure#0} -Raw bytes (14): 0x[01, 01, 00, 02, 01, 0b, 22, 00, 23, 01, 00, 23, 00, 24] +Raw bytes (9): 0x[01, 01, 00, 01, 01, 0b, 22, 00, 24] Number of files: 1 - file 0 => $DIR/async_closure.rs Number of expressions: 0 -Number of file 0 mappings: 2 -- Code(Counter(0)) at (prev + 11, 34) to (start + 0, 35) -- Code(Counter(0)) at (prev + 0, 35) to (start + 0, 36) +Number of file 0 mappings: 1 +- Code(Counter(0)) at (prev + 11, 34) to (start + 0, 36) Highest counter ID seen: c0 Function name: async_closure::main::{closure#0} -Raw bytes (14): 0x[01, 01, 00, 02, 01, 0b, 22, 00, 23, 01, 00, 23, 00, 24] +Raw bytes (9): 0x[01, 01, 00, 01, 01, 0b, 22, 00, 24] Number of files: 1 - file 0 => $DIR/async_closure.rs Number of expressions: 0 -Number of file 0 mappings: 2 -- Code(Counter(0)) at (prev + 11, 34) to (start + 0, 35) -- Code(Counter(0)) at (prev + 0, 35) to (start + 0, 36) +Number of file 0 mappings: 1 +- Code(Counter(0)) at (prev + 11, 34) to (start + 0, 36) Highest counter ID seen: c0 Function name: async_closure::main::{closure#0}::{closure#0}:: -Raw bytes (14): 0x[01, 01, 00, 02, 01, 0b, 22, 00, 23, 01, 00, 23, 00, 24] +Raw bytes (9): 0x[01, 01, 00, 01, 01, 0b, 22, 00, 24] Number of files: 1 - file 0 => $DIR/async_closure.rs Number of expressions: 0 -Number of file 0 mappings: 2 -- Code(Counter(0)) at (prev + 11, 34) to (start + 0, 35) -- Code(Counter(0)) at (prev + 0, 35) to (start + 0, 36) +Number of file 0 mappings: 1 +- Code(Counter(0)) at (prev + 11, 34) to (start + 0, 36) Highest counter ID seen: c0 diff --git a/tests/mir-opt/coverage/branch_match_arms.main.InstrumentCoverage.diff b/tests/mir-opt/coverage/branch_match_arms.main.InstrumentCoverage.diff index d465b8bded22..fa88211383a0 100644 --- a/tests/mir-opt/coverage/branch_match_arms.main.InstrumentCoverage.diff +++ b/tests/mir-opt/coverage/branch_match_arms.main.InstrumentCoverage.diff @@ -40,7 +40,7 @@ + coverage Code { bcb: bcb5 } => $DIR/branch_match_arms.rs:19:17: 19:18 (#0); + coverage Code { bcb: bcb5 } => $DIR/branch_match_arms.rs:19:23: 19:30 (#0); + coverage Code { bcb: bcb5 } => $DIR/branch_match_arms.rs:19:31: 19:32 (#0); -+ coverage Code { bcb: bcb2 } => $DIR/branch_match_arms.rs:21:2: 21:2 (#0); ++ coverage Code { bcb: bcb2 } => $DIR/branch_match_arms.rs:21:1: 21:2 (#0); + bb0: { + Coverage::VirtualCounter(bcb0); diff --git a/tests/mir-opt/coverage/instrument_coverage.bar.InstrumentCoverage.diff b/tests/mir-opt/coverage/instrument_coverage.bar.InstrumentCoverage.diff index cf6d85abd80e..9b6d2b22087b 100644 --- a/tests/mir-opt/coverage/instrument_coverage.bar.InstrumentCoverage.diff +++ b/tests/mir-opt/coverage/instrument_coverage.bar.InstrumentCoverage.diff @@ -6,7 +6,7 @@ + coverage Code { bcb: bcb0 } => $DIR/instrument_coverage.rs:27:1: 27:17 (#0); + coverage Code { bcb: bcb0 } => $DIR/instrument_coverage.rs:28:5: 28:9 (#0); -+ coverage Code { bcb: bcb0 } => $DIR/instrument_coverage.rs:29:2: 29:2 (#0); ++ coverage Code { bcb: bcb0 } => $DIR/instrument_coverage.rs:29:1: 29:2 (#0); + bb0: { + Coverage::VirtualCounter(bcb0); diff --git a/tests/mir-opt/coverage/instrument_coverage.main.InstrumentCoverage.diff b/tests/mir-opt/coverage/instrument_coverage.main.InstrumentCoverage.diff index 980c5e202ffd..b2bb2375aee6 100644 --- a/tests/mir-opt/coverage/instrument_coverage.main.InstrumentCoverage.diff +++ b/tests/mir-opt/coverage/instrument_coverage.main.InstrumentCoverage.diff @@ -10,8 +10,8 @@ + coverage Code { bcb: bcb0 } => $DIR/instrument_coverage.rs:13:1: 13:10 (#0); + coverage Code { bcb: bcb1 } => $DIR/instrument_coverage.rs:15:12: 15:15 (#0); + coverage Code { bcb: bcb2 } => $DIR/instrument_coverage.rs:16:13: 16:18 (#0); -+ coverage Code { bcb: bcb3 } => $DIR/instrument_coverage.rs:17:10: 17:10 (#0); -+ coverage Code { bcb: bcb2 } => $DIR/instrument_coverage.rs:19:2: 19:2 (#0); ++ coverage Code { bcb: bcb3 } => $DIR/instrument_coverage.rs:17:9: 17:10 (#0); ++ coverage Code { bcb: bcb2 } => $DIR/instrument_coverage.rs:19:1: 19:2 (#0); + bb0: { + Coverage::VirtualCounter(bcb0); diff --git a/tests/mir-opt/coverage/instrument_coverage_cleanup.main.CleanupPostBorrowck.diff b/tests/mir-opt/coverage/instrument_coverage_cleanup.main.CleanupPostBorrowck.diff index b707cd41788a..2eb78c08ee80 100644 --- a/tests/mir-opt/coverage/instrument_coverage_cleanup.main.CleanupPostBorrowck.diff +++ b/tests/mir-opt/coverage/instrument_coverage_cleanup.main.CleanupPostBorrowck.diff @@ -10,8 +10,8 @@ coverage Code { bcb: bcb0 } => $DIR/instrument_coverage_cleanup.rs:13:1: 13:10 (#0); coverage Code { bcb: bcb0 } => $DIR/instrument_coverage_cleanup.rs:14:8: 14:36 (#0); coverage Code { bcb: bcb3 } => $DIR/instrument_coverage_cleanup.rs:14:37: 14:39 (#0); - coverage Code { bcb: bcb1 } => $DIR/instrument_coverage_cleanup.rs:14:39: 14:39 (#0); - coverage Code { bcb: bcb2 } => $DIR/instrument_coverage_cleanup.rs:15:2: 15:2 (#0); + coverage Code { bcb: bcb1 } => $DIR/instrument_coverage_cleanup.rs:14:38: 14:39 (#0); + coverage Code { bcb: bcb2 } => $DIR/instrument_coverage_cleanup.rs:15:1: 15:2 (#0); coverage Branch { true_bcb: bcb3, false_bcb: bcb1 } => $DIR/instrument_coverage_cleanup.rs:14:8: 14:36 (#0); bb0: { diff --git a/tests/mir-opt/coverage/instrument_coverage_cleanup.main.InstrumentCoverage.diff b/tests/mir-opt/coverage/instrument_coverage_cleanup.main.InstrumentCoverage.diff index 239b845c2311..0c1bc24b6dc1 100644 --- a/tests/mir-opt/coverage/instrument_coverage_cleanup.main.InstrumentCoverage.diff +++ b/tests/mir-opt/coverage/instrument_coverage_cleanup.main.InstrumentCoverage.diff @@ -10,8 +10,8 @@ + coverage Code { bcb: bcb0 } => $DIR/instrument_coverage_cleanup.rs:13:1: 13:10 (#0); + coverage Code { bcb: bcb0 } => $DIR/instrument_coverage_cleanup.rs:14:8: 14:36 (#0); + coverage Code { bcb: bcb3 } => $DIR/instrument_coverage_cleanup.rs:14:37: 14:39 (#0); -+ coverage Code { bcb: bcb1 } => $DIR/instrument_coverage_cleanup.rs:14:39: 14:39 (#0); -+ coverage Code { bcb: bcb2 } => $DIR/instrument_coverage_cleanup.rs:15:2: 15:2 (#0); ++ coverage Code { bcb: bcb1 } => $DIR/instrument_coverage_cleanup.rs:14:38: 14:39 (#0); ++ coverage Code { bcb: bcb2 } => $DIR/instrument_coverage_cleanup.rs:15:1: 15:2 (#0); + coverage Branch { true_bcb: bcb3, false_bcb: bcb1 } => $DIR/instrument_coverage_cleanup.rs:14:8: 14:36 (#0); + bb0: { From 2832517ba174906b6d6ebedf4893dca8d8a98f55 Mon Sep 17 00:00:00 2001 From: xizheyin Date: Mon, 21 Jul 2025 11:05:37 +0800 Subject: [PATCH 094/139] Clean code for `rustc_parse/src/lexer` 1. Rename `make_unclosed_delims_error` and return `Vec` 2. change magic number `unclosed_delimiter_show_limit` to const 3. move `eof_err` below parsing logic 4. Add `calculate_spacing` for `bump` and `bump_minimal` Signed-off-by: xizheyin --- compiler/rustc_parse/src/lexer/diagnostics.rs | 44 ++++---- compiler/rustc_parse/src/lexer/mod.rs | 18 ++- compiler/rustc_parse/src/lexer/tokentrees.rs | 106 +++++++++--------- 3 files changed, 83 insertions(+), 85 deletions(-) diff --git a/compiler/rustc_parse/src/lexer/diagnostics.rs b/compiler/rustc_parse/src/lexer/diagnostics.rs index 6de001fc9985..947f3df179ff 100644 --- a/compiler/rustc_parse/src/lexer/diagnostics.rs +++ b/compiler/rustc_parse/src/lexer/diagnostics.rs @@ -126,23 +126,29 @@ pub(super) fn report_suspicious_mismatch_block( } } -pub(crate) fn make_unclosed_delims_error( - unmatched: UnmatchedDelim, - psess: &ParseSess, -) -> Option> { - // `None` here means an `Eof` was found. We already emit those errors elsewhere, we add them to - // `unmatched_delims` only for error recovery in the `Parser`. - let found_delim = unmatched.found_delim?; - let mut spans = vec![unmatched.found_span]; - if let Some(sp) = unmatched.unclosed_span { - spans.push(sp); - }; - let err = psess.dcx().create_err(MismatchedClosingDelimiter { - spans, - delimiter: pprust::token_kind_to_string(&found_delim.as_close_token_kind()).to_string(), - unmatched: unmatched.found_span, - opening_candidate: unmatched.candidate_span, - unclosed: unmatched.unclosed_span, - }); - Some(err) +pub(crate) fn make_errors_for_mismatched_closing_delims<'psess>( + unmatcheds: &[UnmatchedDelim], + psess: &'psess ParseSess, +) -> Vec> { + unmatcheds + .iter() + .filter_map(|unmatched| { + // `None` here means an `Eof` was found. We already emit those errors elsewhere, we add them to + // `unmatched_delims` only for error recovery in the `Parser`. + let found_delim = unmatched.found_delim?; + let mut spans = vec![unmatched.found_span]; + if let Some(sp) = unmatched.unclosed_span { + spans.push(sp); + }; + let err = psess.dcx().create_err(MismatchedClosingDelimiter { + spans, + delimiter: pprust::token_kind_to_string(&found_delim.as_close_token_kind()) + .to_string(), + unmatched: unmatched.found_span, + opening_candidate: unmatched.candidate_span, + unclosed: unmatched.unclosed_span, + }); + Some(err) + }) + .collect() } diff --git a/compiler/rustc_parse/src/lexer/mod.rs b/compiler/rustc_parse/src/lexer/mod.rs index 60d275bf2b40..85af5a615aef 100644 --- a/compiler/rustc_parse/src/lexer/mod.rs +++ b/compiler/rustc_parse/src/lexer/mod.rs @@ -1,4 +1,4 @@ -use diagnostics::make_unclosed_delims_error; +use diagnostics::make_errors_for_mismatched_closing_delims; use rustc_ast::ast::{self, AttrStyle}; use rustc_ast::token::{self, CommentKind, Delimiter, IdentIsRaw, Token, TokenKind}; use rustc_ast::tokenstream::TokenStream; @@ -71,27 +71,23 @@ pub(crate) fn lex_token_trees<'psess, 'src>( }; let res = lexer.lex_token_trees(/* is_delimited */ false); - let mut unmatched_delims: Vec<_> = lexer - .diag_info - .unmatched_delims - .into_iter() - .filter_map(|unmatched_delim| make_unclosed_delims_error(unmatched_delim, psess)) - .collect(); + let mut unmatched_closing_delims: Vec<_> = + make_errors_for_mismatched_closing_delims(&lexer.diag_info.unmatched_delims, psess); match res { Ok((_open_spacing, stream)) => { - if unmatched_delims.is_empty() { + if unmatched_closing_delims.is_empty() { Ok(stream) } else { // Return error if there are unmatched delimiters or unclosed delimiters. - Err(unmatched_delims) + Err(unmatched_closing_delims) } } Err(errs) => { // We emit delimiter mismatch errors first, then emit the unclosing delimiter mismatch // because the delimiter mismatch is more likely to be the root cause of error - unmatched_delims.extend(errs); - Err(unmatched_delims) + unmatched_closing_delims.extend(errs); + Err(unmatched_closing_delims) } } } diff --git a/compiler/rustc_parse/src/lexer/tokentrees.rs b/compiler/rustc_parse/src/lexer/tokentrees.rs index 64748199f28d..634f4c30b260 100644 --- a/compiler/rustc_parse/src/lexer/tokentrees.rs +++ b/compiler/rustc_parse/src/lexer/tokentrees.rs @@ -51,45 +51,6 @@ impl<'psess, 'src> Lexer<'psess, 'src> { } } - fn eof_err(&mut self) -> Diag<'psess> { - let msg = "this file contains an unclosed delimiter"; - let mut err = self.dcx().struct_span_err(self.token.span, msg); - - let unclosed_delimiter_show_limit = 5; - let len = usize::min(unclosed_delimiter_show_limit, self.diag_info.open_delimiters.len()); - for &(_, span) in &self.diag_info.open_delimiters[..len] { - err.span_label(span, "unclosed delimiter"); - self.diag_info.unmatched_delims.push(UnmatchedDelim { - found_delim: None, - found_span: self.token.span, - unclosed_span: Some(span), - candidate_span: None, - }); - } - - if let Some((_, span)) = self.diag_info.open_delimiters.get(unclosed_delimiter_show_limit) - && self.diag_info.open_delimiters.len() >= unclosed_delimiter_show_limit + 2 - { - err.span_label( - *span, - format!( - "another {} unclosed delimiters begin from here", - self.diag_info.open_delimiters.len() - unclosed_delimiter_show_limit - ), - ); - } - - if let Some((delim, _)) = self.diag_info.open_delimiters.last() { - report_suspicious_mismatch_block( - &mut err, - &self.diag_info, - self.psess.source_map(), - *delim, - ) - } - err - } - fn lex_token_tree_open_delim( &mut self, open_delim: Delimiter, @@ -206,13 +167,7 @@ impl<'psess, 'src> Lexer<'psess, 'src> { } else if let Some(glued) = self.token.glue(&next_tok) { self.token = glued; } else { - let this_spacing = if next_tok.is_punct() { - Spacing::Joint - } else if next_tok == token::Eof { - Spacing::Alone - } else { - Spacing::JointHidden - }; + let this_spacing = self.calculate_spacing(&next_tok); break (this_spacing, next_tok); } }; @@ -223,23 +178,64 @@ impl<'psess, 'src> Lexer<'psess, 'src> { // Cut-down version of `bump` used when the token kind is known in advance. fn bump_minimal(&mut self) -> Spacing { let (next_tok, is_next_tok_preceded_by_whitespace) = self.next_token_from_cursor(); - let this_spacing = if is_next_tok_preceded_by_whitespace { Spacing::Alone } else { - if next_tok.is_punct() { - Spacing::Joint - } else if next_tok == token::Eof { - Spacing::Alone - } else { - Spacing::JointHidden - } + self.calculate_spacing(&next_tok) }; - self.token = next_tok; this_spacing } + fn calculate_spacing(&self, next_tok: &Token) -> Spacing { + if next_tok.is_punct() { + Spacing::Joint + } else if *next_tok == token::Eof { + Spacing::Alone + } else { + Spacing::JointHidden + } + } + + fn eof_err(&mut self) -> Diag<'psess> { + const UNCLOSED_DELIMITER_SHOW_LIMIT: usize = 5; + let msg = "this file contains an unclosed delimiter"; + let mut err = self.dcx().struct_span_err(self.token.span, msg); + + let len = usize::min(UNCLOSED_DELIMITER_SHOW_LIMIT, self.diag_info.open_delimiters.len()); + for &(_, span) in &self.diag_info.open_delimiters[..len] { + err.span_label(span, "unclosed delimiter"); + self.diag_info.unmatched_delims.push(UnmatchedDelim { + found_delim: None, + found_span: self.token.span, + unclosed_span: Some(span), + candidate_span: None, + }); + } + + if let Some((_, span)) = self.diag_info.open_delimiters.get(UNCLOSED_DELIMITER_SHOW_LIMIT) + && self.diag_info.open_delimiters.len() >= UNCLOSED_DELIMITER_SHOW_LIMIT + 2 + { + err.span_label( + *span, + format!( + "another {} unclosed delimiters begin from here", + self.diag_info.open_delimiters.len() - UNCLOSED_DELIMITER_SHOW_LIMIT + ), + ); + } + + if let Some((delim, _)) = self.diag_info.open_delimiters.last() { + report_suspicious_mismatch_block( + &mut err, + &self.diag_info, + self.psess.source_map(), + *delim, + ) + } + err + } + fn close_delim_err(&mut self, delim: Delimiter) -> Diag<'psess> { // An unexpected closing delimiter (i.e., there is no matching opening delimiter). let token_str = token_to_string(&self.token); From ed93c1783b404d728d4809973a0550eb33cd293f Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Mon, 21 Jul 2025 14:22:51 +0200 Subject: [PATCH 095/139] Rename `tests/assembly` into `tests/assembly-llvm` --- compiler/rustc_codegen_gcc/build_system/src/test.rs | 2 +- src/bootstrap/src/core/build_steps/test.rs | 7 ++++++- src/bootstrap/src/core/builder/mod.rs | 4 ++-- src/ci/docker/host-x86_64/test-various/Dockerfile | 4 ++-- src/doc/rustc-dev-guide/src/asm.md | 4 ++-- src/doc/rustc-dev-guide/src/tests/compiletest.md | 4 ++-- src/tools/opt-dist/src/tests.rs | 2 +- src/tools/tidy/src/target_policy.rs | 6 +++--- tests/{assembly => assembly-llvm}/aarch64-pointer-auth.rs | 0 tests/{assembly => assembly-llvm}/aarch64-xray.rs | 0 tests/{assembly => assembly-llvm}/align_offset.rs | 0 tests/{assembly => assembly-llvm}/asm/aarch64-el2vmsa.rs | 0 tests/{assembly => assembly-llvm}/asm/aarch64-modifiers.rs | 0 .../asm/aarch64-outline-atomics.rs | 0 tests/{assembly => assembly-llvm}/asm/aarch64-types.rs | 0 tests/{assembly => assembly-llvm}/asm/arm-modifiers.rs | 0 tests/{assembly => assembly-llvm}/asm/arm-types.rs | 0 tests/{assembly => assembly-llvm}/asm/avr-modifiers.rs | 0 tests/{assembly => assembly-llvm}/asm/avr-types.rs | 0 tests/{assembly => assembly-llvm}/asm/bpf-types.rs | 0 tests/{assembly => assembly-llvm}/asm/comments.rs | 0 tests/{assembly => assembly-llvm}/asm/global_asm.rs | 0 tests/{assembly => assembly-llvm}/asm/hexagon-types.rs | 0 tests/{assembly => assembly-llvm}/asm/inline-asm-avx.rs | 0 tests/{assembly => assembly-llvm}/asm/loongarch-type.rs | 0 tests/{assembly => assembly-llvm}/asm/m68k-types.rs | 0 tests/{assembly => assembly-llvm}/asm/mips-types.rs | 0 tests/{assembly => assembly-llvm}/asm/msp430-types.rs | 0 tests/{assembly => assembly-llvm}/asm/nvptx-types.rs | 0 tests/{assembly => assembly-llvm}/asm/powerpc-types.rs | 0 tests/{assembly => assembly-llvm}/asm/riscv-types.rs | 0 tests/{assembly => assembly-llvm}/asm/s390x-types.rs | 0 tests/{assembly => assembly-llvm}/asm/sparc-types.rs | 0 tests/{assembly => assembly-llvm}/asm/wasm-types.rs | 0 tests/{assembly => assembly-llvm}/asm/x86-modifiers.rs | 0 tests/{assembly => assembly-llvm}/asm/x86-types.rs | 0 .../auxiliary/breakpoint-panic-handler.rs | 0 .../auxiliary/dwarf-mixed-versions-lto-aux.rs | 0 .../auxiliary/non-inline-dependency.rs | 0 tests/{assembly => assembly-llvm}/breakpoint.rs | 0 .../closure-inherit-target-feature.rs | 0 tests/{assembly => assembly-llvm}/cmse.rs | 0 .../compiletest-self-test/use-minicore-no-run.rs | 0 tests/{assembly => assembly-llvm}/cstring-merging.rs | 0 .../dwarf-mixed-versions-lto.rs | 0 tests/{assembly => assembly-llvm}/dwarf4.rs | 0 tests/{assembly => assembly-llvm}/dwarf5.rs | 0 tests/{assembly => assembly-llvm}/emit-intel-att-syntax.rs | 0 tests/{assembly => assembly-llvm}/is_aligned.rs | 0 .../issue-83585-small-pod-struct-equality.rs | 0 .../libs/issue-115339-zip-arrays.rs | 0 .../libs/issue-140207-slice-min-simd.rs | 0 tests/{assembly => assembly-llvm}/manual-eq-efficient.rs | 0 .../naked-functions/aarch64-naked-fn-no-bti-prolog.rs | 0 tests/{assembly => assembly-llvm}/naked-functions/aix.rs | 0 .../{assembly => assembly-llvm}/naked-functions/wasm32.rs | 0 .../naked-functions/x86_64-naked-fn-no-cet-prolog.rs | 0 tests/{assembly => assembly-llvm}/niche-prefer-zero.rs | 0 tests/{assembly => assembly-llvm}/nvptx-arch-default.rs | 0 tests/{assembly => assembly-llvm}/nvptx-arch-emit-asm.rs | 0 tests/{assembly => assembly-llvm}/nvptx-arch-link-arg.rs | 0 tests/{assembly => assembly-llvm}/nvptx-arch-target-cpu.rs | 0 tests/{assembly => assembly-llvm}/nvptx-atomics.rs | 0 tests/{assembly => assembly-llvm}/nvptx-c-abi-arg-v7.rs | 0 tests/{assembly => assembly-llvm}/nvptx-c-abi-ret-v7.rs | 0 tests/{assembly => assembly-llvm}/nvptx-internalizing.rs | 0 .../nvptx-kernel-abi/nvptx-kernel-args-abi-v7.rs | 0 tests/{assembly => assembly-llvm}/nvptx-linking-binary.rs | 0 tests/{assembly => assembly-llvm}/nvptx-linking-cdylib.rs | 0 tests/{assembly => assembly-llvm}/nvptx-safe-naming.rs | 0 .../panic-no-unwind-no-uwtable.rs | 0 .../{assembly => assembly-llvm}/panic-unwind-no-uwtable.rs | 0 tests/{assembly => assembly-llvm}/pic-relocation-model.rs | 0 tests/{assembly => assembly-llvm}/pie-relocation-model.rs | 0 tests/{assembly => assembly-llvm}/powerpc64-struct-abi.rs | 0 .../{assembly => assembly-llvm}/riscv-float-struct-abi.rs | 0 .../riscv-soft-abi-with-float-features.rs | 0 tests/{assembly => assembly-llvm}/rust-abi-arg-attr.rs | 0 .../{assembly => assembly-llvm}/s390x-backchain-toggle.rs | 0 tests/{assembly => assembly-llvm}/s390x-vector-abi.rs | 0 .../sanitizer/kcfi/emit-arity-indicator.rs | 0 tests/{assembly => assembly-llvm}/simd-bitmask.rs | 0 tests/{assembly => assembly-llvm}/simd-intrinsic-gather.rs | 0 .../simd-intrinsic-mask-load.rs | 0 .../simd-intrinsic-mask-reduce.rs | 0 .../simd-intrinsic-mask-store.rs | 0 .../{assembly => assembly-llvm}/simd-intrinsic-scatter.rs | 0 tests/{assembly => assembly-llvm}/simd-intrinsic-select.rs | 0 .../simd/reduce-fadd-unordered.rs | 0 tests/{assembly => assembly-llvm}/slice-is_ascii.rs | 0 tests/{assembly => assembly-llvm}/small_data_threshold.rs | 0 tests/{assembly => assembly-llvm}/sparc-struct-abi.rs | 0 tests/{assembly => assembly-llvm}/stack-probes.rs | 0 .../stack-protector-heuristics-effect-windows-32bit.rs | 0 .../stack-protector-heuristics-effect-windows-64bit.rs | 0 .../stack-protector/stack-protector-heuristics-effect.rs | 0 .../stack-protector/stack-protector-target-support.rs | 0 .../{assembly => assembly-llvm}/static-relocation-model.rs | 0 tests/{assembly => assembly-llvm}/strict_provenance.rs | 0 .../{assembly => assembly-llvm}/target-feature-multiple.rs | 0 .../{assembly => assembly-llvm}/targets/targets-amdgpu.rs | 0 tests/{assembly => assembly-llvm}/targets/targets-elf.rs | 0 tests/{assembly => assembly-llvm}/targets/targets-macho.rs | 0 tests/{assembly => assembly-llvm}/targets/targets-nvptx.rs | 0 tests/{assembly => assembly-llvm}/targets/targets-pe.rs | 0 tests/{assembly => assembly-llvm}/wasm_exceptions.rs | 0 tests/{assembly => assembly-llvm}/x86-return-float.rs | 0 .../x86_64-array-pair-load-store-merge.rs | 0 tests/{assembly => assembly-llvm}/x86_64-bigint-helpers.rs | 0 tests/{assembly => assembly-llvm}/x86_64-cmp.rs | 0 .../x86_64-floating-point-clamp.rs | 0 .../x86_64-fortanix-unknown-sgx-lvi-generic-load.rs | 0 .../x86_64-fortanix-unknown-sgx-lvi-generic-ret.rs | 0 .../x86_64-fortanix-unknown-sgx-lvi-inline-assembly.rs | 0 .../{assembly => assembly-llvm}/x86_64-function-return.rs | 0 tests/{assembly => assembly-llvm}/x86_64-no-jump-tables.rs | 0 tests/{assembly => assembly-llvm}/x86_64-sse_crc.rs | 0 tests/{assembly => assembly-llvm}/x86_64-typed-swap.rs | 0 .../x86_64-windows-float-abi.rs | 0 .../{assembly => assembly-llvm}/x86_64-windows-i128-abi.rs | 0 tests/{assembly => assembly-llvm}/x86_64-xray.rs | 0 tests/codegen/target-feature-overrides.rs | 2 +- tests/run-make/avr-rjmp-offset/rmake.rs | 2 +- triagebot.toml | 2 +- 124 files changed, 22 insertions(+), 17 deletions(-) rename tests/{assembly => assembly-llvm}/aarch64-pointer-auth.rs (100%) rename tests/{assembly => assembly-llvm}/aarch64-xray.rs (100%) rename tests/{assembly => assembly-llvm}/align_offset.rs (100%) rename tests/{assembly => assembly-llvm}/asm/aarch64-el2vmsa.rs (100%) rename tests/{assembly => assembly-llvm}/asm/aarch64-modifiers.rs (100%) rename tests/{assembly => assembly-llvm}/asm/aarch64-outline-atomics.rs (100%) rename tests/{assembly => assembly-llvm}/asm/aarch64-types.rs (100%) rename tests/{assembly => assembly-llvm}/asm/arm-modifiers.rs (100%) rename tests/{assembly => assembly-llvm}/asm/arm-types.rs (100%) rename tests/{assembly => assembly-llvm}/asm/avr-modifiers.rs (100%) rename tests/{assembly => assembly-llvm}/asm/avr-types.rs (100%) rename tests/{assembly => assembly-llvm}/asm/bpf-types.rs (100%) rename tests/{assembly => assembly-llvm}/asm/comments.rs (100%) rename tests/{assembly => assembly-llvm}/asm/global_asm.rs (100%) rename tests/{assembly => assembly-llvm}/asm/hexagon-types.rs (100%) rename tests/{assembly => assembly-llvm}/asm/inline-asm-avx.rs (100%) rename tests/{assembly => assembly-llvm}/asm/loongarch-type.rs (100%) rename tests/{assembly => assembly-llvm}/asm/m68k-types.rs (100%) rename tests/{assembly => assembly-llvm}/asm/mips-types.rs (100%) rename tests/{assembly => assembly-llvm}/asm/msp430-types.rs (100%) rename tests/{assembly => assembly-llvm}/asm/nvptx-types.rs (100%) rename tests/{assembly => assembly-llvm}/asm/powerpc-types.rs (100%) rename tests/{assembly => assembly-llvm}/asm/riscv-types.rs (100%) rename tests/{assembly => assembly-llvm}/asm/s390x-types.rs (100%) rename tests/{assembly => assembly-llvm}/asm/sparc-types.rs (100%) rename tests/{assembly => assembly-llvm}/asm/wasm-types.rs (100%) rename tests/{assembly => assembly-llvm}/asm/x86-modifiers.rs (100%) rename tests/{assembly => assembly-llvm}/asm/x86-types.rs (100%) rename tests/{assembly => assembly-llvm}/auxiliary/breakpoint-panic-handler.rs (100%) rename tests/{assembly => assembly-llvm}/auxiliary/dwarf-mixed-versions-lto-aux.rs (100%) rename tests/{assembly => assembly-llvm}/auxiliary/non-inline-dependency.rs (100%) rename tests/{assembly => assembly-llvm}/breakpoint.rs (100%) rename tests/{assembly => assembly-llvm}/closure-inherit-target-feature.rs (100%) rename tests/{assembly => assembly-llvm}/cmse.rs (100%) rename tests/{assembly => assembly-llvm}/compiletest-self-test/use-minicore-no-run.rs (100%) rename tests/{assembly => assembly-llvm}/cstring-merging.rs (100%) rename tests/{assembly => assembly-llvm}/dwarf-mixed-versions-lto.rs (100%) rename tests/{assembly => assembly-llvm}/dwarf4.rs (100%) rename tests/{assembly => assembly-llvm}/dwarf5.rs (100%) rename tests/{assembly => assembly-llvm}/emit-intel-att-syntax.rs (100%) rename tests/{assembly => assembly-llvm}/is_aligned.rs (100%) rename tests/{assembly => assembly-llvm}/issue-83585-small-pod-struct-equality.rs (100%) rename tests/{assembly => assembly-llvm}/libs/issue-115339-zip-arrays.rs (100%) rename tests/{assembly => assembly-llvm}/libs/issue-140207-slice-min-simd.rs (100%) rename tests/{assembly => assembly-llvm}/manual-eq-efficient.rs (100%) rename tests/{assembly => assembly-llvm}/naked-functions/aarch64-naked-fn-no-bti-prolog.rs (100%) rename tests/{assembly => assembly-llvm}/naked-functions/aix.rs (100%) rename tests/{assembly => assembly-llvm}/naked-functions/wasm32.rs (100%) rename tests/{assembly => assembly-llvm}/naked-functions/x86_64-naked-fn-no-cet-prolog.rs (100%) rename tests/{assembly => assembly-llvm}/niche-prefer-zero.rs (100%) rename tests/{assembly => assembly-llvm}/nvptx-arch-default.rs (100%) rename tests/{assembly => assembly-llvm}/nvptx-arch-emit-asm.rs (100%) rename tests/{assembly => assembly-llvm}/nvptx-arch-link-arg.rs (100%) rename tests/{assembly => assembly-llvm}/nvptx-arch-target-cpu.rs (100%) rename tests/{assembly => assembly-llvm}/nvptx-atomics.rs (100%) rename tests/{assembly => assembly-llvm}/nvptx-c-abi-arg-v7.rs (100%) rename tests/{assembly => assembly-llvm}/nvptx-c-abi-ret-v7.rs (100%) rename tests/{assembly => assembly-llvm}/nvptx-internalizing.rs (100%) rename tests/{assembly => assembly-llvm}/nvptx-kernel-abi/nvptx-kernel-args-abi-v7.rs (100%) rename tests/{assembly => assembly-llvm}/nvptx-linking-binary.rs (100%) rename tests/{assembly => assembly-llvm}/nvptx-linking-cdylib.rs (100%) rename tests/{assembly => assembly-llvm}/nvptx-safe-naming.rs (100%) rename tests/{assembly => assembly-llvm}/panic-no-unwind-no-uwtable.rs (100%) rename tests/{assembly => assembly-llvm}/panic-unwind-no-uwtable.rs (100%) rename tests/{assembly => assembly-llvm}/pic-relocation-model.rs (100%) rename tests/{assembly => assembly-llvm}/pie-relocation-model.rs (100%) rename tests/{assembly => assembly-llvm}/powerpc64-struct-abi.rs (100%) rename tests/{assembly => assembly-llvm}/riscv-float-struct-abi.rs (100%) rename tests/{assembly => assembly-llvm}/riscv-soft-abi-with-float-features.rs (100%) rename tests/{assembly => assembly-llvm}/rust-abi-arg-attr.rs (100%) rename tests/{assembly => assembly-llvm}/s390x-backchain-toggle.rs (100%) rename tests/{assembly => assembly-llvm}/s390x-vector-abi.rs (100%) rename tests/{assembly => assembly-llvm}/sanitizer/kcfi/emit-arity-indicator.rs (100%) rename tests/{assembly => assembly-llvm}/simd-bitmask.rs (100%) rename tests/{assembly => assembly-llvm}/simd-intrinsic-gather.rs (100%) rename tests/{assembly => assembly-llvm}/simd-intrinsic-mask-load.rs (100%) rename tests/{assembly => assembly-llvm}/simd-intrinsic-mask-reduce.rs (100%) rename tests/{assembly => assembly-llvm}/simd-intrinsic-mask-store.rs (100%) rename tests/{assembly => assembly-llvm}/simd-intrinsic-scatter.rs (100%) rename tests/{assembly => assembly-llvm}/simd-intrinsic-select.rs (100%) rename tests/{assembly => assembly-llvm}/simd/reduce-fadd-unordered.rs (100%) rename tests/{assembly => assembly-llvm}/slice-is_ascii.rs (100%) rename tests/{assembly => assembly-llvm}/small_data_threshold.rs (100%) rename tests/{assembly => assembly-llvm}/sparc-struct-abi.rs (100%) rename tests/{assembly => assembly-llvm}/stack-probes.rs (100%) rename tests/{assembly => assembly-llvm}/stack-protector/stack-protector-heuristics-effect-windows-32bit.rs (100%) rename tests/{assembly => assembly-llvm}/stack-protector/stack-protector-heuristics-effect-windows-64bit.rs (100%) rename tests/{assembly => assembly-llvm}/stack-protector/stack-protector-heuristics-effect.rs (100%) rename tests/{assembly => assembly-llvm}/stack-protector/stack-protector-target-support.rs (100%) rename tests/{assembly => assembly-llvm}/static-relocation-model.rs (100%) rename tests/{assembly => assembly-llvm}/strict_provenance.rs (100%) rename tests/{assembly => assembly-llvm}/target-feature-multiple.rs (100%) rename tests/{assembly => assembly-llvm}/targets/targets-amdgpu.rs (100%) rename tests/{assembly => assembly-llvm}/targets/targets-elf.rs (100%) rename tests/{assembly => assembly-llvm}/targets/targets-macho.rs (100%) rename tests/{assembly => assembly-llvm}/targets/targets-nvptx.rs (100%) rename tests/{assembly => assembly-llvm}/targets/targets-pe.rs (100%) rename tests/{assembly => assembly-llvm}/wasm_exceptions.rs (100%) rename tests/{assembly => assembly-llvm}/x86-return-float.rs (100%) rename tests/{assembly => assembly-llvm}/x86_64-array-pair-load-store-merge.rs (100%) rename tests/{assembly => assembly-llvm}/x86_64-bigint-helpers.rs (100%) rename tests/{assembly => assembly-llvm}/x86_64-cmp.rs (100%) rename tests/{assembly => assembly-llvm}/x86_64-floating-point-clamp.rs (100%) rename tests/{assembly => assembly-llvm}/x86_64-fortanix-unknown-sgx-lvi-generic-load.rs (100%) rename tests/{assembly => assembly-llvm}/x86_64-fortanix-unknown-sgx-lvi-generic-ret.rs (100%) rename tests/{assembly => assembly-llvm}/x86_64-fortanix-unknown-sgx-lvi-inline-assembly.rs (100%) rename tests/{assembly => assembly-llvm}/x86_64-function-return.rs (100%) rename tests/{assembly => assembly-llvm}/x86_64-no-jump-tables.rs (100%) rename tests/{assembly => assembly-llvm}/x86_64-sse_crc.rs (100%) rename tests/{assembly => assembly-llvm}/x86_64-typed-swap.rs (100%) rename tests/{assembly => assembly-llvm}/x86_64-windows-float-abi.rs (100%) rename tests/{assembly => assembly-llvm}/x86_64-windows-i128-abi.rs (100%) rename tests/{assembly => assembly-llvm}/x86_64-xray.rs (100%) diff --git a/compiler/rustc_codegen_gcc/build_system/src/test.rs b/compiler/rustc_codegen_gcc/build_system/src/test.rs index cbb0f9493838..bc0fdd40b6e8 100644 --- a/compiler/rustc_codegen_gcc/build_system/src/test.rs +++ b/compiler/rustc_codegen_gcc/build_system/src/test.rs @@ -588,7 +588,7 @@ fn asm_tests(env: &Env, args: &TestArg) -> Result<(), String> { &"always", &"--stage", &"0", - &"tests/assembly/asm", + &"tests/assembly-llvm/asm", &"--compiletest-rustc-args", &rustc_args, ], diff --git a/src/bootstrap/src/core/build_steps/test.rs b/src/bootstrap/src/core/build_steps/test.rs index 8344b0e03b48..99c9e8ae92eb 100644 --- a/src/bootstrap/src/core/build_steps/test.rs +++ b/src/bootstrap/src/core/build_steps/test.rs @@ -1407,7 +1407,12 @@ test!(Pretty { test!(RunMake { path: "tests/run-make", mode: "run-make", suite: "run-make", default: true }); -test!(Assembly { path: "tests/assembly", mode: "assembly", suite: "assembly", default: true }); +test!(AssemblyLlvm { + path: "tests/assembly-llvm", + mode: "assembly", + suite: "assembly-llvm", + default: true +}); /// Runs the coverage test suite at `tests/coverage` in some or all of the /// coverage test modes. diff --git a/src/bootstrap/src/core/builder/mod.rs b/src/bootstrap/src/core/builder/mod.rs index d73e2bce25ba..925e47a41644 100644 --- a/src/bootstrap/src/core/builder/mod.rs +++ b/src/bootstrap/src/core/builder/mod.rs @@ -411,7 +411,7 @@ const PATH_REMAP: &[(&str, &[&str])] = &[ "tests", &[ // tidy-alphabetical-start - "tests/assembly", + "tests/assembly-llvm", "tests/codegen", "tests/codegen-units", "tests/coverage", @@ -1051,7 +1051,7 @@ impl<'a> Builder<'a> { test::MirOpt, test::Codegen, test::CodegenUnits, - test::Assembly, + test::AssemblyLlvm, test::Incremental, test::Debuginfo, test::UiFullDeps, diff --git a/src/ci/docker/host-x86_64/test-various/Dockerfile b/src/ci/docker/host-x86_64/test-various/Dockerfile index 8d2e45ae497e..54ca7131608e 100644 --- a/src/ci/docker/host-x86_64/test-various/Dockerfile +++ b/src/ci/docker/host-x86_64/test-various/Dockerfile @@ -66,13 +66,13 @@ ENV WASM_SCRIPT python3 /checkout/x.py --stage 2 test --host='' --target $WASM_T tests/mir-opt \ tests/codegen-units \ tests/codegen \ - tests/assembly \ + tests/assembly-llvm \ library/core ENV NVPTX_TARGETS=nvptx64-nvidia-cuda ENV NVPTX_SCRIPT python3 /checkout/x.py --stage 2 test --host='' --target $NVPTX_TARGETS \ tests/run-make \ - tests/assembly + tests/assembly-llvm ENV MUSL_TARGETS=x86_64-unknown-linux-musl \ CC_x86_64_unknown_linux_musl=x86_64-linux-musl-gcc \ diff --git a/src/doc/rustc-dev-guide/src/asm.md b/src/doc/rustc-dev-guide/src/asm.md index eec9d448b0c9..3d93d5a4c57e 100644 --- a/src/doc/rustc-dev-guide/src/asm.md +++ b/src/doc/rustc-dev-guide/src/asm.md @@ -155,9 +155,9 @@ can't know ahead of time whether a function will require a frame/base pointer. Various tests for inline assembly are available: -- `tests/assembly/asm` +- `tests/assembly-llvm/asm` - `tests/ui/asm` - `tests/codegen/asm-*` Every architecture supported by inline assembly must have exhaustive tests in -`tests/assembly/asm` which test all combinations of register classes and types. +`tests/assembly-llvm/asm` which test all combinations of register classes and types. diff --git a/src/doc/rustc-dev-guide/src/tests/compiletest.md b/src/doc/rustc-dev-guide/src/tests/compiletest.md index aa99347b2bba..6a60e7118d38 100644 --- a/src/doc/rustc-dev-guide/src/tests/compiletest.md +++ b/src/doc/rustc-dev-guide/src/tests/compiletest.md @@ -307,7 +307,7 @@ If you need to work with `#![no_std]` cross-compiling tests, consult the ### Assembly tests -The tests in [`tests/assembly`] test LLVM assembly output. They compile the test +The tests in [`tests/assembly-llvm`] test LLVM assembly output. They compile the test with the `--emit=asm` flag to emit a `.s` file with the assembly output. They then run the LLVM [FileCheck] tool. @@ -324,7 +324,7 @@ See also the [codegen tests](#codegen-tests) for a similar set of tests. If you need to work with `#![no_std]` cross-compiling tests, consult the [`minicore` test auxiliary](./minicore.md) chapter. -[`tests/assembly`]: https://github.com/rust-lang/rust/tree/master/tests/assembly +[`tests/assembly-llvm`]: https://github.com/rust-lang/rust/tree/master/tests/assembly-llvm ### Codegen-units tests diff --git a/src/tools/opt-dist/src/tests.rs b/src/tools/opt-dist/src/tests.rs index c3c45d262dde..a70c257e52bf 100644 --- a/src/tools/opt-dist/src/tests.rs +++ b/src/tools/opt-dist/src/tests.rs @@ -100,7 +100,7 @@ llvm-config = "{llvm_config}" env.host_tuple(), "--stage", "0", - "tests/assembly", + "tests/assembly-llvm", "tests/codegen", "tests/codegen-units", "tests/incremental", diff --git a/src/tools/tidy/src/target_policy.rs b/src/tools/tidy/src/target_policy.rs index 776221d30623..550932dbfdc3 100644 --- a/src/tools/tidy/src/target_policy.rs +++ b/src/tools/tidy/src/target_policy.rs @@ -8,7 +8,7 @@ use std::path::Path; use crate::walk::{filter_not_rust, walk}; const TARGET_DEFINITIONS_PATH: &str = "compiler/rustc_target/src/spec/targets/"; -const ASSEMBLY_TEST_PATH: &str = "tests/assembly/targets/"; +const ASSEMBLY_LLVM_TEST_PATH: &str = "tests/assembly-llvm/targets/"; const REVISION_LINE_START: &str = "//@ revisions: "; const EXCEPTIONS: &[&str] = &[ // FIXME: disabled since it fails on CI saying the csky component is missing @@ -43,7 +43,7 @@ pub fn check(root_path: &Path, bad: &mut bool) { let _ = targets_to_find.insert(target_name); } - walk(&root_path.join(ASSEMBLY_TEST_PATH), |_, _| false, &mut |_, contents| { + walk(&root_path.join(ASSEMBLY_LLVM_TEST_PATH), |_, _| false, &mut |_, contents| { for line in contents.lines() { let Some(_) = line.find(REVISION_LINE_START) else { continue; @@ -55,7 +55,7 @@ pub fn check(root_path: &Path, bad: &mut bool) { for target in targets_to_find { if !EXCEPTIONS.contains(&target.as_str()) { - tidy_error!(bad, "{ASSEMBLY_TEST_PATH}: missing assembly test for {target}") + tidy_error!(bad, "{ASSEMBLY_LLVM_TEST_PATH}: missing assembly test for {target}") } } } diff --git a/tests/assembly/aarch64-pointer-auth.rs b/tests/assembly-llvm/aarch64-pointer-auth.rs similarity index 100% rename from tests/assembly/aarch64-pointer-auth.rs rename to tests/assembly-llvm/aarch64-pointer-auth.rs diff --git a/tests/assembly/aarch64-xray.rs b/tests/assembly-llvm/aarch64-xray.rs similarity index 100% rename from tests/assembly/aarch64-xray.rs rename to tests/assembly-llvm/aarch64-xray.rs diff --git a/tests/assembly/align_offset.rs b/tests/assembly-llvm/align_offset.rs similarity index 100% rename from tests/assembly/align_offset.rs rename to tests/assembly-llvm/align_offset.rs diff --git a/tests/assembly/asm/aarch64-el2vmsa.rs b/tests/assembly-llvm/asm/aarch64-el2vmsa.rs similarity index 100% rename from tests/assembly/asm/aarch64-el2vmsa.rs rename to tests/assembly-llvm/asm/aarch64-el2vmsa.rs diff --git a/tests/assembly/asm/aarch64-modifiers.rs b/tests/assembly-llvm/asm/aarch64-modifiers.rs similarity index 100% rename from tests/assembly/asm/aarch64-modifiers.rs rename to tests/assembly-llvm/asm/aarch64-modifiers.rs diff --git a/tests/assembly/asm/aarch64-outline-atomics.rs b/tests/assembly-llvm/asm/aarch64-outline-atomics.rs similarity index 100% rename from tests/assembly/asm/aarch64-outline-atomics.rs rename to tests/assembly-llvm/asm/aarch64-outline-atomics.rs diff --git a/tests/assembly/asm/aarch64-types.rs b/tests/assembly-llvm/asm/aarch64-types.rs similarity index 100% rename from tests/assembly/asm/aarch64-types.rs rename to tests/assembly-llvm/asm/aarch64-types.rs diff --git a/tests/assembly/asm/arm-modifiers.rs b/tests/assembly-llvm/asm/arm-modifiers.rs similarity index 100% rename from tests/assembly/asm/arm-modifiers.rs rename to tests/assembly-llvm/asm/arm-modifiers.rs diff --git a/tests/assembly/asm/arm-types.rs b/tests/assembly-llvm/asm/arm-types.rs similarity index 100% rename from tests/assembly/asm/arm-types.rs rename to tests/assembly-llvm/asm/arm-types.rs diff --git a/tests/assembly/asm/avr-modifiers.rs b/tests/assembly-llvm/asm/avr-modifiers.rs similarity index 100% rename from tests/assembly/asm/avr-modifiers.rs rename to tests/assembly-llvm/asm/avr-modifiers.rs diff --git a/tests/assembly/asm/avr-types.rs b/tests/assembly-llvm/asm/avr-types.rs similarity index 100% rename from tests/assembly/asm/avr-types.rs rename to tests/assembly-llvm/asm/avr-types.rs diff --git a/tests/assembly/asm/bpf-types.rs b/tests/assembly-llvm/asm/bpf-types.rs similarity index 100% rename from tests/assembly/asm/bpf-types.rs rename to tests/assembly-llvm/asm/bpf-types.rs diff --git a/tests/assembly/asm/comments.rs b/tests/assembly-llvm/asm/comments.rs similarity index 100% rename from tests/assembly/asm/comments.rs rename to tests/assembly-llvm/asm/comments.rs diff --git a/tests/assembly/asm/global_asm.rs b/tests/assembly-llvm/asm/global_asm.rs similarity index 100% rename from tests/assembly/asm/global_asm.rs rename to tests/assembly-llvm/asm/global_asm.rs diff --git a/tests/assembly/asm/hexagon-types.rs b/tests/assembly-llvm/asm/hexagon-types.rs similarity index 100% rename from tests/assembly/asm/hexagon-types.rs rename to tests/assembly-llvm/asm/hexagon-types.rs diff --git a/tests/assembly/asm/inline-asm-avx.rs b/tests/assembly-llvm/asm/inline-asm-avx.rs similarity index 100% rename from tests/assembly/asm/inline-asm-avx.rs rename to tests/assembly-llvm/asm/inline-asm-avx.rs diff --git a/tests/assembly/asm/loongarch-type.rs b/tests/assembly-llvm/asm/loongarch-type.rs similarity index 100% rename from tests/assembly/asm/loongarch-type.rs rename to tests/assembly-llvm/asm/loongarch-type.rs diff --git a/tests/assembly/asm/m68k-types.rs b/tests/assembly-llvm/asm/m68k-types.rs similarity index 100% rename from tests/assembly/asm/m68k-types.rs rename to tests/assembly-llvm/asm/m68k-types.rs diff --git a/tests/assembly/asm/mips-types.rs b/tests/assembly-llvm/asm/mips-types.rs similarity index 100% rename from tests/assembly/asm/mips-types.rs rename to tests/assembly-llvm/asm/mips-types.rs diff --git a/tests/assembly/asm/msp430-types.rs b/tests/assembly-llvm/asm/msp430-types.rs similarity index 100% rename from tests/assembly/asm/msp430-types.rs rename to tests/assembly-llvm/asm/msp430-types.rs diff --git a/tests/assembly/asm/nvptx-types.rs b/tests/assembly-llvm/asm/nvptx-types.rs similarity index 100% rename from tests/assembly/asm/nvptx-types.rs rename to tests/assembly-llvm/asm/nvptx-types.rs diff --git a/tests/assembly/asm/powerpc-types.rs b/tests/assembly-llvm/asm/powerpc-types.rs similarity index 100% rename from tests/assembly/asm/powerpc-types.rs rename to tests/assembly-llvm/asm/powerpc-types.rs diff --git a/tests/assembly/asm/riscv-types.rs b/tests/assembly-llvm/asm/riscv-types.rs similarity index 100% rename from tests/assembly/asm/riscv-types.rs rename to tests/assembly-llvm/asm/riscv-types.rs diff --git a/tests/assembly/asm/s390x-types.rs b/tests/assembly-llvm/asm/s390x-types.rs similarity index 100% rename from tests/assembly/asm/s390x-types.rs rename to tests/assembly-llvm/asm/s390x-types.rs diff --git a/tests/assembly/asm/sparc-types.rs b/tests/assembly-llvm/asm/sparc-types.rs similarity index 100% rename from tests/assembly/asm/sparc-types.rs rename to tests/assembly-llvm/asm/sparc-types.rs diff --git a/tests/assembly/asm/wasm-types.rs b/tests/assembly-llvm/asm/wasm-types.rs similarity index 100% rename from tests/assembly/asm/wasm-types.rs rename to tests/assembly-llvm/asm/wasm-types.rs diff --git a/tests/assembly/asm/x86-modifiers.rs b/tests/assembly-llvm/asm/x86-modifiers.rs similarity index 100% rename from tests/assembly/asm/x86-modifiers.rs rename to tests/assembly-llvm/asm/x86-modifiers.rs diff --git a/tests/assembly/asm/x86-types.rs b/tests/assembly-llvm/asm/x86-types.rs similarity index 100% rename from tests/assembly/asm/x86-types.rs rename to tests/assembly-llvm/asm/x86-types.rs diff --git a/tests/assembly/auxiliary/breakpoint-panic-handler.rs b/tests/assembly-llvm/auxiliary/breakpoint-panic-handler.rs similarity index 100% rename from tests/assembly/auxiliary/breakpoint-panic-handler.rs rename to tests/assembly-llvm/auxiliary/breakpoint-panic-handler.rs diff --git a/tests/assembly/auxiliary/dwarf-mixed-versions-lto-aux.rs b/tests/assembly-llvm/auxiliary/dwarf-mixed-versions-lto-aux.rs similarity index 100% rename from tests/assembly/auxiliary/dwarf-mixed-versions-lto-aux.rs rename to tests/assembly-llvm/auxiliary/dwarf-mixed-versions-lto-aux.rs diff --git a/tests/assembly/auxiliary/non-inline-dependency.rs b/tests/assembly-llvm/auxiliary/non-inline-dependency.rs similarity index 100% rename from tests/assembly/auxiliary/non-inline-dependency.rs rename to tests/assembly-llvm/auxiliary/non-inline-dependency.rs diff --git a/tests/assembly/breakpoint.rs b/tests/assembly-llvm/breakpoint.rs similarity index 100% rename from tests/assembly/breakpoint.rs rename to tests/assembly-llvm/breakpoint.rs diff --git a/tests/assembly/closure-inherit-target-feature.rs b/tests/assembly-llvm/closure-inherit-target-feature.rs similarity index 100% rename from tests/assembly/closure-inherit-target-feature.rs rename to tests/assembly-llvm/closure-inherit-target-feature.rs diff --git a/tests/assembly/cmse.rs b/tests/assembly-llvm/cmse.rs similarity index 100% rename from tests/assembly/cmse.rs rename to tests/assembly-llvm/cmse.rs diff --git a/tests/assembly/compiletest-self-test/use-minicore-no-run.rs b/tests/assembly-llvm/compiletest-self-test/use-minicore-no-run.rs similarity index 100% rename from tests/assembly/compiletest-self-test/use-minicore-no-run.rs rename to tests/assembly-llvm/compiletest-self-test/use-minicore-no-run.rs diff --git a/tests/assembly/cstring-merging.rs b/tests/assembly-llvm/cstring-merging.rs similarity index 100% rename from tests/assembly/cstring-merging.rs rename to tests/assembly-llvm/cstring-merging.rs diff --git a/tests/assembly/dwarf-mixed-versions-lto.rs b/tests/assembly-llvm/dwarf-mixed-versions-lto.rs similarity index 100% rename from tests/assembly/dwarf-mixed-versions-lto.rs rename to tests/assembly-llvm/dwarf-mixed-versions-lto.rs diff --git a/tests/assembly/dwarf4.rs b/tests/assembly-llvm/dwarf4.rs similarity index 100% rename from tests/assembly/dwarf4.rs rename to tests/assembly-llvm/dwarf4.rs diff --git a/tests/assembly/dwarf5.rs b/tests/assembly-llvm/dwarf5.rs similarity index 100% rename from tests/assembly/dwarf5.rs rename to tests/assembly-llvm/dwarf5.rs diff --git a/tests/assembly/emit-intel-att-syntax.rs b/tests/assembly-llvm/emit-intel-att-syntax.rs similarity index 100% rename from tests/assembly/emit-intel-att-syntax.rs rename to tests/assembly-llvm/emit-intel-att-syntax.rs diff --git a/tests/assembly/is_aligned.rs b/tests/assembly-llvm/is_aligned.rs similarity index 100% rename from tests/assembly/is_aligned.rs rename to tests/assembly-llvm/is_aligned.rs diff --git a/tests/assembly/issue-83585-small-pod-struct-equality.rs b/tests/assembly-llvm/issue-83585-small-pod-struct-equality.rs similarity index 100% rename from tests/assembly/issue-83585-small-pod-struct-equality.rs rename to tests/assembly-llvm/issue-83585-small-pod-struct-equality.rs diff --git a/tests/assembly/libs/issue-115339-zip-arrays.rs b/tests/assembly-llvm/libs/issue-115339-zip-arrays.rs similarity index 100% rename from tests/assembly/libs/issue-115339-zip-arrays.rs rename to tests/assembly-llvm/libs/issue-115339-zip-arrays.rs diff --git a/tests/assembly/libs/issue-140207-slice-min-simd.rs b/tests/assembly-llvm/libs/issue-140207-slice-min-simd.rs similarity index 100% rename from tests/assembly/libs/issue-140207-slice-min-simd.rs rename to tests/assembly-llvm/libs/issue-140207-slice-min-simd.rs diff --git a/tests/assembly/manual-eq-efficient.rs b/tests/assembly-llvm/manual-eq-efficient.rs similarity index 100% rename from tests/assembly/manual-eq-efficient.rs rename to tests/assembly-llvm/manual-eq-efficient.rs diff --git a/tests/assembly/naked-functions/aarch64-naked-fn-no-bti-prolog.rs b/tests/assembly-llvm/naked-functions/aarch64-naked-fn-no-bti-prolog.rs similarity index 100% rename from tests/assembly/naked-functions/aarch64-naked-fn-no-bti-prolog.rs rename to tests/assembly-llvm/naked-functions/aarch64-naked-fn-no-bti-prolog.rs diff --git a/tests/assembly/naked-functions/aix.rs b/tests/assembly-llvm/naked-functions/aix.rs similarity index 100% rename from tests/assembly/naked-functions/aix.rs rename to tests/assembly-llvm/naked-functions/aix.rs diff --git a/tests/assembly/naked-functions/wasm32.rs b/tests/assembly-llvm/naked-functions/wasm32.rs similarity index 100% rename from tests/assembly/naked-functions/wasm32.rs rename to tests/assembly-llvm/naked-functions/wasm32.rs diff --git a/tests/assembly/naked-functions/x86_64-naked-fn-no-cet-prolog.rs b/tests/assembly-llvm/naked-functions/x86_64-naked-fn-no-cet-prolog.rs similarity index 100% rename from tests/assembly/naked-functions/x86_64-naked-fn-no-cet-prolog.rs rename to tests/assembly-llvm/naked-functions/x86_64-naked-fn-no-cet-prolog.rs diff --git a/tests/assembly/niche-prefer-zero.rs b/tests/assembly-llvm/niche-prefer-zero.rs similarity index 100% rename from tests/assembly/niche-prefer-zero.rs rename to tests/assembly-llvm/niche-prefer-zero.rs diff --git a/tests/assembly/nvptx-arch-default.rs b/tests/assembly-llvm/nvptx-arch-default.rs similarity index 100% rename from tests/assembly/nvptx-arch-default.rs rename to tests/assembly-llvm/nvptx-arch-default.rs diff --git a/tests/assembly/nvptx-arch-emit-asm.rs b/tests/assembly-llvm/nvptx-arch-emit-asm.rs similarity index 100% rename from tests/assembly/nvptx-arch-emit-asm.rs rename to tests/assembly-llvm/nvptx-arch-emit-asm.rs diff --git a/tests/assembly/nvptx-arch-link-arg.rs b/tests/assembly-llvm/nvptx-arch-link-arg.rs similarity index 100% rename from tests/assembly/nvptx-arch-link-arg.rs rename to tests/assembly-llvm/nvptx-arch-link-arg.rs diff --git a/tests/assembly/nvptx-arch-target-cpu.rs b/tests/assembly-llvm/nvptx-arch-target-cpu.rs similarity index 100% rename from tests/assembly/nvptx-arch-target-cpu.rs rename to tests/assembly-llvm/nvptx-arch-target-cpu.rs diff --git a/tests/assembly/nvptx-atomics.rs b/tests/assembly-llvm/nvptx-atomics.rs similarity index 100% rename from tests/assembly/nvptx-atomics.rs rename to tests/assembly-llvm/nvptx-atomics.rs diff --git a/tests/assembly/nvptx-c-abi-arg-v7.rs b/tests/assembly-llvm/nvptx-c-abi-arg-v7.rs similarity index 100% rename from tests/assembly/nvptx-c-abi-arg-v7.rs rename to tests/assembly-llvm/nvptx-c-abi-arg-v7.rs diff --git a/tests/assembly/nvptx-c-abi-ret-v7.rs b/tests/assembly-llvm/nvptx-c-abi-ret-v7.rs similarity index 100% rename from tests/assembly/nvptx-c-abi-ret-v7.rs rename to tests/assembly-llvm/nvptx-c-abi-ret-v7.rs diff --git a/tests/assembly/nvptx-internalizing.rs b/tests/assembly-llvm/nvptx-internalizing.rs similarity index 100% rename from tests/assembly/nvptx-internalizing.rs rename to tests/assembly-llvm/nvptx-internalizing.rs diff --git a/tests/assembly/nvptx-kernel-abi/nvptx-kernel-args-abi-v7.rs b/tests/assembly-llvm/nvptx-kernel-abi/nvptx-kernel-args-abi-v7.rs similarity index 100% rename from tests/assembly/nvptx-kernel-abi/nvptx-kernel-args-abi-v7.rs rename to tests/assembly-llvm/nvptx-kernel-abi/nvptx-kernel-args-abi-v7.rs diff --git a/tests/assembly/nvptx-linking-binary.rs b/tests/assembly-llvm/nvptx-linking-binary.rs similarity index 100% rename from tests/assembly/nvptx-linking-binary.rs rename to tests/assembly-llvm/nvptx-linking-binary.rs diff --git a/tests/assembly/nvptx-linking-cdylib.rs b/tests/assembly-llvm/nvptx-linking-cdylib.rs similarity index 100% rename from tests/assembly/nvptx-linking-cdylib.rs rename to tests/assembly-llvm/nvptx-linking-cdylib.rs diff --git a/tests/assembly/nvptx-safe-naming.rs b/tests/assembly-llvm/nvptx-safe-naming.rs similarity index 100% rename from tests/assembly/nvptx-safe-naming.rs rename to tests/assembly-llvm/nvptx-safe-naming.rs diff --git a/tests/assembly/panic-no-unwind-no-uwtable.rs b/tests/assembly-llvm/panic-no-unwind-no-uwtable.rs similarity index 100% rename from tests/assembly/panic-no-unwind-no-uwtable.rs rename to tests/assembly-llvm/panic-no-unwind-no-uwtable.rs diff --git a/tests/assembly/panic-unwind-no-uwtable.rs b/tests/assembly-llvm/panic-unwind-no-uwtable.rs similarity index 100% rename from tests/assembly/panic-unwind-no-uwtable.rs rename to tests/assembly-llvm/panic-unwind-no-uwtable.rs diff --git a/tests/assembly/pic-relocation-model.rs b/tests/assembly-llvm/pic-relocation-model.rs similarity index 100% rename from tests/assembly/pic-relocation-model.rs rename to tests/assembly-llvm/pic-relocation-model.rs diff --git a/tests/assembly/pie-relocation-model.rs b/tests/assembly-llvm/pie-relocation-model.rs similarity index 100% rename from tests/assembly/pie-relocation-model.rs rename to tests/assembly-llvm/pie-relocation-model.rs diff --git a/tests/assembly/powerpc64-struct-abi.rs b/tests/assembly-llvm/powerpc64-struct-abi.rs similarity index 100% rename from tests/assembly/powerpc64-struct-abi.rs rename to tests/assembly-llvm/powerpc64-struct-abi.rs diff --git a/tests/assembly/riscv-float-struct-abi.rs b/tests/assembly-llvm/riscv-float-struct-abi.rs similarity index 100% rename from tests/assembly/riscv-float-struct-abi.rs rename to tests/assembly-llvm/riscv-float-struct-abi.rs diff --git a/tests/assembly/riscv-soft-abi-with-float-features.rs b/tests/assembly-llvm/riscv-soft-abi-with-float-features.rs similarity index 100% rename from tests/assembly/riscv-soft-abi-with-float-features.rs rename to tests/assembly-llvm/riscv-soft-abi-with-float-features.rs diff --git a/tests/assembly/rust-abi-arg-attr.rs b/tests/assembly-llvm/rust-abi-arg-attr.rs similarity index 100% rename from tests/assembly/rust-abi-arg-attr.rs rename to tests/assembly-llvm/rust-abi-arg-attr.rs diff --git a/tests/assembly/s390x-backchain-toggle.rs b/tests/assembly-llvm/s390x-backchain-toggle.rs similarity index 100% rename from tests/assembly/s390x-backchain-toggle.rs rename to tests/assembly-llvm/s390x-backchain-toggle.rs diff --git a/tests/assembly/s390x-vector-abi.rs b/tests/assembly-llvm/s390x-vector-abi.rs similarity index 100% rename from tests/assembly/s390x-vector-abi.rs rename to tests/assembly-llvm/s390x-vector-abi.rs diff --git a/tests/assembly/sanitizer/kcfi/emit-arity-indicator.rs b/tests/assembly-llvm/sanitizer/kcfi/emit-arity-indicator.rs similarity index 100% rename from tests/assembly/sanitizer/kcfi/emit-arity-indicator.rs rename to tests/assembly-llvm/sanitizer/kcfi/emit-arity-indicator.rs diff --git a/tests/assembly/simd-bitmask.rs b/tests/assembly-llvm/simd-bitmask.rs similarity index 100% rename from tests/assembly/simd-bitmask.rs rename to tests/assembly-llvm/simd-bitmask.rs diff --git a/tests/assembly/simd-intrinsic-gather.rs b/tests/assembly-llvm/simd-intrinsic-gather.rs similarity index 100% rename from tests/assembly/simd-intrinsic-gather.rs rename to tests/assembly-llvm/simd-intrinsic-gather.rs diff --git a/tests/assembly/simd-intrinsic-mask-load.rs b/tests/assembly-llvm/simd-intrinsic-mask-load.rs similarity index 100% rename from tests/assembly/simd-intrinsic-mask-load.rs rename to tests/assembly-llvm/simd-intrinsic-mask-load.rs diff --git a/tests/assembly/simd-intrinsic-mask-reduce.rs b/tests/assembly-llvm/simd-intrinsic-mask-reduce.rs similarity index 100% rename from tests/assembly/simd-intrinsic-mask-reduce.rs rename to tests/assembly-llvm/simd-intrinsic-mask-reduce.rs diff --git a/tests/assembly/simd-intrinsic-mask-store.rs b/tests/assembly-llvm/simd-intrinsic-mask-store.rs similarity index 100% rename from tests/assembly/simd-intrinsic-mask-store.rs rename to tests/assembly-llvm/simd-intrinsic-mask-store.rs diff --git a/tests/assembly/simd-intrinsic-scatter.rs b/tests/assembly-llvm/simd-intrinsic-scatter.rs similarity index 100% rename from tests/assembly/simd-intrinsic-scatter.rs rename to tests/assembly-llvm/simd-intrinsic-scatter.rs diff --git a/tests/assembly/simd-intrinsic-select.rs b/tests/assembly-llvm/simd-intrinsic-select.rs similarity index 100% rename from tests/assembly/simd-intrinsic-select.rs rename to tests/assembly-llvm/simd-intrinsic-select.rs diff --git a/tests/assembly/simd/reduce-fadd-unordered.rs b/tests/assembly-llvm/simd/reduce-fadd-unordered.rs similarity index 100% rename from tests/assembly/simd/reduce-fadd-unordered.rs rename to tests/assembly-llvm/simd/reduce-fadd-unordered.rs diff --git a/tests/assembly/slice-is_ascii.rs b/tests/assembly-llvm/slice-is_ascii.rs similarity index 100% rename from tests/assembly/slice-is_ascii.rs rename to tests/assembly-llvm/slice-is_ascii.rs diff --git a/tests/assembly/small_data_threshold.rs b/tests/assembly-llvm/small_data_threshold.rs similarity index 100% rename from tests/assembly/small_data_threshold.rs rename to tests/assembly-llvm/small_data_threshold.rs diff --git a/tests/assembly/sparc-struct-abi.rs b/tests/assembly-llvm/sparc-struct-abi.rs similarity index 100% rename from tests/assembly/sparc-struct-abi.rs rename to tests/assembly-llvm/sparc-struct-abi.rs diff --git a/tests/assembly/stack-probes.rs b/tests/assembly-llvm/stack-probes.rs similarity index 100% rename from tests/assembly/stack-probes.rs rename to tests/assembly-llvm/stack-probes.rs diff --git a/tests/assembly/stack-protector/stack-protector-heuristics-effect-windows-32bit.rs b/tests/assembly-llvm/stack-protector/stack-protector-heuristics-effect-windows-32bit.rs similarity index 100% rename from tests/assembly/stack-protector/stack-protector-heuristics-effect-windows-32bit.rs rename to tests/assembly-llvm/stack-protector/stack-protector-heuristics-effect-windows-32bit.rs diff --git a/tests/assembly/stack-protector/stack-protector-heuristics-effect-windows-64bit.rs b/tests/assembly-llvm/stack-protector/stack-protector-heuristics-effect-windows-64bit.rs similarity index 100% rename from tests/assembly/stack-protector/stack-protector-heuristics-effect-windows-64bit.rs rename to tests/assembly-llvm/stack-protector/stack-protector-heuristics-effect-windows-64bit.rs diff --git a/tests/assembly/stack-protector/stack-protector-heuristics-effect.rs b/tests/assembly-llvm/stack-protector/stack-protector-heuristics-effect.rs similarity index 100% rename from tests/assembly/stack-protector/stack-protector-heuristics-effect.rs rename to tests/assembly-llvm/stack-protector/stack-protector-heuristics-effect.rs diff --git a/tests/assembly/stack-protector/stack-protector-target-support.rs b/tests/assembly-llvm/stack-protector/stack-protector-target-support.rs similarity index 100% rename from tests/assembly/stack-protector/stack-protector-target-support.rs rename to tests/assembly-llvm/stack-protector/stack-protector-target-support.rs diff --git a/tests/assembly/static-relocation-model.rs b/tests/assembly-llvm/static-relocation-model.rs similarity index 100% rename from tests/assembly/static-relocation-model.rs rename to tests/assembly-llvm/static-relocation-model.rs diff --git a/tests/assembly/strict_provenance.rs b/tests/assembly-llvm/strict_provenance.rs similarity index 100% rename from tests/assembly/strict_provenance.rs rename to tests/assembly-llvm/strict_provenance.rs diff --git a/tests/assembly/target-feature-multiple.rs b/tests/assembly-llvm/target-feature-multiple.rs similarity index 100% rename from tests/assembly/target-feature-multiple.rs rename to tests/assembly-llvm/target-feature-multiple.rs diff --git a/tests/assembly/targets/targets-amdgpu.rs b/tests/assembly-llvm/targets/targets-amdgpu.rs similarity index 100% rename from tests/assembly/targets/targets-amdgpu.rs rename to tests/assembly-llvm/targets/targets-amdgpu.rs diff --git a/tests/assembly/targets/targets-elf.rs b/tests/assembly-llvm/targets/targets-elf.rs similarity index 100% rename from tests/assembly/targets/targets-elf.rs rename to tests/assembly-llvm/targets/targets-elf.rs diff --git a/tests/assembly/targets/targets-macho.rs b/tests/assembly-llvm/targets/targets-macho.rs similarity index 100% rename from tests/assembly/targets/targets-macho.rs rename to tests/assembly-llvm/targets/targets-macho.rs diff --git a/tests/assembly/targets/targets-nvptx.rs b/tests/assembly-llvm/targets/targets-nvptx.rs similarity index 100% rename from tests/assembly/targets/targets-nvptx.rs rename to tests/assembly-llvm/targets/targets-nvptx.rs diff --git a/tests/assembly/targets/targets-pe.rs b/tests/assembly-llvm/targets/targets-pe.rs similarity index 100% rename from tests/assembly/targets/targets-pe.rs rename to tests/assembly-llvm/targets/targets-pe.rs diff --git a/tests/assembly/wasm_exceptions.rs b/tests/assembly-llvm/wasm_exceptions.rs similarity index 100% rename from tests/assembly/wasm_exceptions.rs rename to tests/assembly-llvm/wasm_exceptions.rs diff --git a/tests/assembly/x86-return-float.rs b/tests/assembly-llvm/x86-return-float.rs similarity index 100% rename from tests/assembly/x86-return-float.rs rename to tests/assembly-llvm/x86-return-float.rs diff --git a/tests/assembly/x86_64-array-pair-load-store-merge.rs b/tests/assembly-llvm/x86_64-array-pair-load-store-merge.rs similarity index 100% rename from tests/assembly/x86_64-array-pair-load-store-merge.rs rename to tests/assembly-llvm/x86_64-array-pair-load-store-merge.rs diff --git a/tests/assembly/x86_64-bigint-helpers.rs b/tests/assembly-llvm/x86_64-bigint-helpers.rs similarity index 100% rename from tests/assembly/x86_64-bigint-helpers.rs rename to tests/assembly-llvm/x86_64-bigint-helpers.rs diff --git a/tests/assembly/x86_64-cmp.rs b/tests/assembly-llvm/x86_64-cmp.rs similarity index 100% rename from tests/assembly/x86_64-cmp.rs rename to tests/assembly-llvm/x86_64-cmp.rs diff --git a/tests/assembly/x86_64-floating-point-clamp.rs b/tests/assembly-llvm/x86_64-floating-point-clamp.rs similarity index 100% rename from tests/assembly/x86_64-floating-point-clamp.rs rename to tests/assembly-llvm/x86_64-floating-point-clamp.rs diff --git a/tests/assembly/x86_64-fortanix-unknown-sgx-lvi-generic-load.rs b/tests/assembly-llvm/x86_64-fortanix-unknown-sgx-lvi-generic-load.rs similarity index 100% rename from tests/assembly/x86_64-fortanix-unknown-sgx-lvi-generic-load.rs rename to tests/assembly-llvm/x86_64-fortanix-unknown-sgx-lvi-generic-load.rs diff --git a/tests/assembly/x86_64-fortanix-unknown-sgx-lvi-generic-ret.rs b/tests/assembly-llvm/x86_64-fortanix-unknown-sgx-lvi-generic-ret.rs similarity index 100% rename from tests/assembly/x86_64-fortanix-unknown-sgx-lvi-generic-ret.rs rename to tests/assembly-llvm/x86_64-fortanix-unknown-sgx-lvi-generic-ret.rs diff --git a/tests/assembly/x86_64-fortanix-unknown-sgx-lvi-inline-assembly.rs b/tests/assembly-llvm/x86_64-fortanix-unknown-sgx-lvi-inline-assembly.rs similarity index 100% rename from tests/assembly/x86_64-fortanix-unknown-sgx-lvi-inline-assembly.rs rename to tests/assembly-llvm/x86_64-fortanix-unknown-sgx-lvi-inline-assembly.rs diff --git a/tests/assembly/x86_64-function-return.rs b/tests/assembly-llvm/x86_64-function-return.rs similarity index 100% rename from tests/assembly/x86_64-function-return.rs rename to tests/assembly-llvm/x86_64-function-return.rs diff --git a/tests/assembly/x86_64-no-jump-tables.rs b/tests/assembly-llvm/x86_64-no-jump-tables.rs similarity index 100% rename from tests/assembly/x86_64-no-jump-tables.rs rename to tests/assembly-llvm/x86_64-no-jump-tables.rs diff --git a/tests/assembly/x86_64-sse_crc.rs b/tests/assembly-llvm/x86_64-sse_crc.rs similarity index 100% rename from tests/assembly/x86_64-sse_crc.rs rename to tests/assembly-llvm/x86_64-sse_crc.rs diff --git a/tests/assembly/x86_64-typed-swap.rs b/tests/assembly-llvm/x86_64-typed-swap.rs similarity index 100% rename from tests/assembly/x86_64-typed-swap.rs rename to tests/assembly-llvm/x86_64-typed-swap.rs diff --git a/tests/assembly/x86_64-windows-float-abi.rs b/tests/assembly-llvm/x86_64-windows-float-abi.rs similarity index 100% rename from tests/assembly/x86_64-windows-float-abi.rs rename to tests/assembly-llvm/x86_64-windows-float-abi.rs diff --git a/tests/assembly/x86_64-windows-i128-abi.rs b/tests/assembly-llvm/x86_64-windows-i128-abi.rs similarity index 100% rename from tests/assembly/x86_64-windows-i128-abi.rs rename to tests/assembly-llvm/x86_64-windows-i128-abi.rs diff --git a/tests/assembly/x86_64-xray.rs b/tests/assembly-llvm/x86_64-xray.rs similarity index 100% rename from tests/assembly/x86_64-xray.rs rename to tests/assembly-llvm/x86_64-xray.rs diff --git a/tests/codegen/target-feature-overrides.rs b/tests/codegen/target-feature-overrides.rs index eb19b0de2fa8..63a586d388b6 100644 --- a/tests/codegen/target-feature-overrides.rs +++ b/tests/codegen/target-feature-overrides.rs @@ -6,7 +6,7 @@ //@ [COMPAT] compile-flags: -Ctarget-feature=+avx2 //@ [INCOMPAT] compile-flags: -Ctarget-feature=-avx2,-avx -// See also tests/assembly/target-feature-multiple.rs +// See also tests/assembly-llvm/target-feature-multiple.rs #![feature(no_core, lang_items)] #![crate_type = "lib"] #![no_core] diff --git a/tests/run-make/avr-rjmp-offset/rmake.rs b/tests/run-make/avr-rjmp-offset/rmake.rs index da314f26ca78..86d85e89f788 100644 --- a/tests/run-make/avr-rjmp-offset/rmake.rs +++ b/tests/run-make/avr-rjmp-offset/rmake.rs @@ -6,7 +6,7 @@ //! loop instruction to be missed. This test therefore contains a simple loop //! with trivial instructions in it, to see, where the label is placed. //! -//! This must be a `rmake`-test and cannot be a `tests/assembly`-test, since the +//! This must be a `rmake`-test and cannot be a `tests/assembly-llvm/`-test, since the //! wrong output is only produced with direct assembly generation, but not when //! "emit-asm" is used, as described in the issue description of #129301: //! https://github.com/rust-lang/rust/issues/129301#issue-2475070770 diff --git a/triagebot.toml b/triagebot.toml index 61d8a814c89e..e34e4a88f42d 100644 --- a/triagebot.toml +++ b/triagebot.toml @@ -302,7 +302,7 @@ trigger_files = [ "compiler", # Tests - "tests/assembly", + "tests/assembly-llvm", "tests/auxiliary", "tests/codegen", "tests/codegen-units", From a27f3e3fd1e4d16160f8885b6b06665b5319f56c Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Mon, 21 Jul 2025 14:34:12 +0200 Subject: [PATCH 096/139] Rename `tests/codegen` into `tests/codegen-llvm` --- compiler/rustc_codegen_ssa/src/mir/rvalue.rs | 2 +- .../src/unreachable_prop.rs | 2 +- .../alloc/src/collections/vec_deque/drain.rs | 2 +- library/alloc/src/raw_vec/mod.rs | 2 +- rustfmt.toml | 4 ++-- src/bootstrap/src/core/build_steps/test.rs | 11 ++++++++--- src/bootstrap/src/core/builder/mod.rs | 4 ++-- .../docker/host-x86_64/test-various/Dockerfile | 2 +- src/doc/rustc-dev-guide/src/asm.md | 2 +- .../src/autodiff/installation.md | 2 +- .../src/llvm-coverage-instrumentation.md | 4 ++-- .../src/offload/installation.md | 2 +- .../src/profile-guided-optimization.md | 2 +- src/doc/rustc-dev-guide/src/sanitizers.md | 4 ++-- .../rustc-dev-guide/src/tests/compiletest.md | 6 +++--- src/tools/opt-dist/src/tests.rs | 2 +- tests/assembly-llvm/target-feature-multiple.rs | 2 +- tests/{codegen => codegen-llvm}/README.md | 0 .../aarch64-softfloat.rs | 0 .../aarch64-struct-align-128.rs | 0 tests/{codegen => codegen-llvm}/abi-efiapi.rs | 0 .../abi-main-signature-16bit-c-int.rs | 0 .../abi-main-signature-32bit-c-int.rs | 0 .../{codegen => codegen-llvm}/abi-repr-ext.rs | 0 tests/{codegen => codegen-llvm}/abi-sysv64.rs | 0 .../{codegen => codegen-llvm}/abi-win64-zst.rs | 0 .../abi-x86-interrupt.rs | 0 tests/{codegen => codegen-llvm}/abi-x86-sse.rs | 0 .../abi-x86_64_sysv.rs | 0 .../addr-of-mutate.rs | 0 tests/{codegen => codegen-llvm}/adjustments.rs | 0 .../align-byval-alignment-mismatch.rs | 0 .../align-byval-vector.rs | 0 tests/{codegen => codegen-llvm}/align-byval.rs | 0 tests/{codegen => codegen-llvm}/align-enum.rs | 0 tests/{codegen => codegen-llvm}/align-fn.rs | 0 .../{codegen => codegen-llvm}/align-offset.rs | 0 .../{codegen => codegen-llvm}/align-struct.rs | 0 .../alloc-optimisation.rs | 0 .../amdgpu-addrspacecast.rs | 0 tests/{codegen => codegen-llvm}/array-clone.rs | 0 tests/{codegen => codegen-llvm}/array-cmp.rs | 0 .../{codegen => codegen-llvm}/array-codegen.rs | 0 .../array-equality.rs | 0 .../{codegen => codegen-llvm}/array-from_fn.rs | 0 tests/{codegen => codegen-llvm}/array-map.rs | 0 .../array-optimized.rs | 0 .../{codegen => codegen-llvm}/array-repeat.rs | 0 tests/{codegen => codegen-llvm}/ascii-char.rs | 0 .../asm/aarch64-clobbers.rs | 0 .../asm/avr-clobbers.rs | 0 .../asm/bpf-clobbers.rs | 0 .../{codegen => codegen-llvm}/asm/critical.rs | 0 .../asm/csky-clobbers.rs | 0 tests/{codegen => codegen-llvm}/asm/foo.s | 0 .../asm/global_asm.rs | 0 .../asm/global_asm_include.rs | 0 .../asm/global_asm_x2.rs | 0 tests/{codegen => codegen-llvm}/asm/goto.rs | 0 .../asm/hexagon-clobbers.rs | 0 .../asm/may_unwind.rs | 0 .../asm/maybe-uninit.rs | 0 .../asm/msp430-clobbers.rs | 0 .../asm/multiple-options.rs | 0 tests/{codegen => codegen-llvm}/asm/options.rs | 0 .../asm/powerpc-clobbers.rs | 0 .../asm/riscv-clobbers.rs | 0 .../asm/s390x-clobbers.rs | 0 .../asm/sanitize-llvm.rs | 0 .../asm/sparc-clobbers.rs | 0 .../asm/x86-clobber_abi.rs | 0 .../asm/x86-clobbers.rs | 0 .../asm/x86-target-clobbers.rs | 0 .../assign-desugar-debuginfo.rs | 0 .../async-closure-debug.rs | 0 .../async-fn-debug-awaitee-field.rs | 0 .../async-fn-debug-msvc.rs | 0 .../async-fn-debug.rs | 0 .../atomic-operations.rs | 0 tests/{codegen => codegen-llvm}/atomicptr.rs | 0 .../autodiff/batched.rs | 0 .../autodiff/generic.rs | 0 .../autodiff/identical_fnc.rs | 0 .../autodiff/inline.rs | 0 .../autodiff/scalar.rs | 0 .../{codegen => codegen-llvm}/autodiff/sret.rs | 0 tests/{codegen => codegen-llvm}/autodiffv2.rs | 0 .../autovec/dont-shuffle-bswaps-opt2.rs | 0 .../autovec/dont-shuffle-bswaps-opt3.rs | 0 .../autovectorize-f32x4.rs | 0 .../auxiliary/extern_decl.rs | 0 .../auxiliary/nounwind.rs | 0 .../auxiliary/thread_local_aux.rs | 0 .../avr/avr-func-addrspace.rs | 0 .../bigint-helpers.rs | 0 .../binary-heap-peek-mut-pop-no-panic.rs | 0 .../binary-search-index-no-bound-check.rs | 0 tests/{codegen => codegen-llvm}/bool-cmp.rs | 0 .../bounds-checking/gep-issue-133979.rs | 0 .../box-default-debug-copies.rs | 0 .../box-uninit-bytes.rs | 0 tests/{codegen => codegen-llvm}/bpf-alu32.rs | 0 .../branch-protection.rs | 0 .../call-llvm-intrinsics.rs | 0 .../call-tmps-lifetime.rs | 0 .../cast-optimized.rs | 0 .../cast-target-abi.rs | 0 .../{codegen => codegen-llvm}/catch-unwind.rs | 0 .../cdylib-external-inline-fns.rs | 0 .../{codegen => codegen-llvm}/cf-protection.rs | 0 .../cffi/c-variadic-copy.rs | 0 .../cffi/c-variadic-naked.rs | 0 .../cffi/c-variadic-opt.rs | 0 .../cffi/c-variadic.rs | 0 .../cffi/ffi-const.rs | 0 .../cffi/ffi-out-of-bounds-loads.rs | 0 .../{codegen => codegen-llvm}/cffi/ffi-pure.rs | 0 .../cfguard-checks.rs | 0 .../cfguard-disabled.rs | 0 .../cfguard-nochecks.rs | 0 .../cfguard-non-msvc.rs | 0 .../char-ascii-branchless.rs | 0 .../char-escape-debug-no-bounds-check.rs | 0 .../{codegen => codegen-llvm}/checked_ilog.rs | 0 .../{codegen => codegen-llvm}/checked_math.rs | 0 tests/{codegen => codegen-llvm}/clone-shims.rs | 0 .../{codegen => codegen-llvm}/clone_as_copy.rs | 0 tests/{codegen => codegen-llvm}/codemodels.rs | 0 tests/{codegen => codegen-llvm}/coercions.rs | 0 .../cold-call-declare-and-call.rs | 0 .../common_prim_int_ptr.rs | 0 .../comparison-operators-2-struct.rs | 0 .../comparison-operators-2-tuple.rs | 0 .../comparison-operators-newtype.rs | 0 .../minicore-smoke-test.rs | 0 tests/{codegen => codegen-llvm}/const-array.rs | 0 .../{codegen => codegen-llvm}/const-vector.rs | 0 .../const_scalar_pair.rs | 0 .../constant-branch.rs | 0 tests/{codegen => codegen-llvm}/consts.rs | 0 .../coroutine-debug-msvc.rs | 0 .../coroutine-debug.rs | 0 .../cross-crate-inlining/always-inline.rs | 0 .../cross-crate-inlining/auxiliary/always.rs | 0 .../cross-crate-inlining/auxiliary/leaf.rs | 0 .../cross-crate-inlining/auxiliary/never.rs | 0 .../cross-crate-inlining/leaf-inlining.rs | 0 .../cross-crate-inlining/never-inline.rs | 0 .../dealloc-no-unwind.rs | 0 .../debug-accessibility/crate-enum.rs | 0 .../debug-accessibility/crate-struct.rs | 0 .../debug-accessibility/private-enum.rs | 0 .../debug-accessibility/private-struct.rs | 0 .../debug-accessibility/public-enum.rs | 0 .../debug-accessibility/public-struct.rs | 0 .../debug-accessibility/struct-fields.rs | 0 .../debug-accessibility/super-enum.rs | 0 .../debug-accessibility/super-struct.rs | 0 .../debug-accessibility/tuple-fields.rs | 0 .../debug-alignment.rs | 0 .../debug-column-msvc.rs | 0 .../{codegen => codegen-llvm}/debug-column.rs | 0 .../debug-compile-unit-path.rs | 0 .../debug-fndef-size.rs | 0 .../{codegen => codegen-llvm}/debug-limited.rs | 0 .../debug-line-directives-only.rs | 0 .../debug-line-tables-only.rs | 0 .../debug-linkage-name.rs | 0 .../{codegen => codegen-llvm}/debug-vtable.rs | 0 .../debuginfo-constant-locals.rs | 0 .../debuginfo-generic-closure-env-names.rs | 0 .../debuginfo-inline-callsite-location.rs | 0 .../auxiliary/macro_def.rs | 0 .../mir_inlined_twice_var_locs.rs | 0 .../deduced-param-attrs.rs | 0 .../default-requires-uwtable.rs | 0 .../default-visibility.rs | 0 .../direct-access-external-data.rs | 0 .../dllimports/auxiliary/dummy.rs | 0 .../dllimports/auxiliary/wrapper.rs | 0 .../dllimports/main.rs | 0 ...private_const_fn_only_used_in_const_eval.rs | 0 .../drop-in-place-noalias.rs | 0 tests/{codegen => codegen-llvm}/drop.rs | 0 tests/{codegen => codegen-llvm}/dst-offset.rs | 0 .../dst-vtable-align-nonzero.rs | 0 .../dst-vtable-size-range.rs | 0 .../ehcontguard_disabled.rs | 0 .../ehcontguard_enabled.rs | 0 .../emscripten-catch-unwind-js-eh.rs | 0 .../emscripten-catch-unwind-wasm-eh.rs | 0 .../enable-lto-unit-splitting.rs | 0 .../enum/enum-aggregate.rs | 0 .../enum/enum-bounds-check-derived-idx.rs | 0 .../enum/enum-bounds-check-issue-13926.rs | 0 .../enum/enum-bounds-check-issue-82871.rs | 0 .../enum/enum-bounds-check.rs | 0 .../enum/enum-debug-clike.rs | 0 .../enum/enum-debug-niche-2.rs | 0 .../enum/enum-debug-niche.rs | 0 .../enum/enum-debug-tagged.rs | 0 .../enum/enum-discriminant-eq.rs | 0 .../enum/enum-discriminant-value.rs | 0 .../enum/enum-early-otherwise-branch.rs | 0 .../enum/enum-match.rs | 0 .../enum/enum-two-variants-match.rs | 0 .../enum/enum-u128.rs | 0 .../enum/unreachable_enum_default_branch.rs | 0 .../ergonomic-clones/closure.rs | 0 .../{codegen => codegen-llvm}/error-provide.rs | 0 .../export-no-mangle.rs | 0 .../external-no-mangle-fns.rs | 0 .../external-no-mangle-statics.rs | 0 .../f128-wasm32-callconv.rs | 0 .../fastcall-inreg.rs | 0 tests/{codegen => codegen-llvm}/fatptr.rs | 0 tests/{codegen => codegen-llvm}/fewer-names.rs | 0 tests/{codegen => codegen-llvm}/fixed-x18.rs | 0 .../float/algebraic.rs | 0 tests/{codegen => codegen-llvm}/float/f128.rs | 0 .../float/f16-f128-inline.rs | 0 tests/{codegen => codegen-llvm}/float/f16.rs | 0 tests/{codegen => codegen-llvm}/float_math.rs | 0 .../fn-impl-trait-self.rs | 0 ...-parameters-on-different-lines-debuginfo.rs | 0 .../force-frame-pointers.rs | 0 .../force-no-unwind-tables.rs | 0 .../force-unwind-tables.rs | 0 .../frame-pointer-cli-control.rs | 0 .../{codegen => codegen-llvm}/frame-pointer.rs | 0 .../function-arguments-noopt.rs | 0 .../function-arguments.rs | 0 .../function-return.rs | 0 .../gdb_debug_script_load.rs | 0 .../{codegen => codegen-llvm}/generic-debug.rs | 0 tests/{codegen => codegen-llvm}/gep-index.rs | 0 .../gpu-kernel-abi.rs | 0 .../gpu_offload/gpu_host.rs | 0 .../hint/cold_path.rs | 0 tests/{codegen => codegen-llvm}/hint/likely.rs | 0 .../{codegen => codegen-llvm}/hint/unlikely.rs | 0 .../i128-wasm32-callconv.rs | 0 .../i128-x86-align.rs | 0 .../i128-x86-callconv.rs | 0 .../infallible-unwrap-in-opt-z.rs | 0 .../inherit_overflow.rs | 0 .../inline-always-works-always.rs | 0 .../inline-debuginfo.rs | 0 .../inline-function-args-debug-info.rs | 0 tests/{codegen => codegen-llvm}/inline-hint.rs | 0 .../instrument-coverage-off.rs | 0 .../instrument-coverage/instrument-coverage.rs | 0 .../instrument-coverage/testprog.rs | 0 .../instrument-mcount.rs | 0 .../instrument-xray/basic.rs | 0 .../instrument-xray/options-combine.rs | 0 .../instrument-xray/options-override.rs | 0 tests/{codegen => codegen-llvm}/integer-cmp.rs | 0 .../integer-overflow.rs | 0 .../internalize-closures.rs | 0 .../intrinsic-no-unnamed-attr.rs | 0 .../intrinsics/aggregate-thin-pointer.rs | 0 .../intrinsics/carrying_mul_add.rs | 0 .../intrinsics/cold_path.rs | 0 .../intrinsics/cold_path2.rs | 0 .../intrinsics/cold_path3.rs | 0 .../intrinsics/compare_bytes.rs | 0 .../intrinsics/const_eval_select.rs | 0 .../intrinsics/ctlz.rs | 0 .../intrinsics/ctpop.rs | 0 .../intrinsics/disjoint_bitor.rs | 0 .../intrinsics/exact_div.rs | 0 .../intrinsics/likely.rs | 0 .../intrinsics/likely_assert.rs | 0 .../intrinsics/mask.rs | 0 .../intrinsics/nontemporal.rs | 0 .../intrinsics/offset.rs | 0 .../intrinsics/offset_from.rs | 0 .../intrinsics/prefetch.rs | 0 .../intrinsics/ptr_metadata.rs | 0 .../intrinsics/rotate_left.rs | 0 .../rustc_intrinsic_must_be_overridden.rs | 0 .../intrinsics/select_unpredictable.rs | 0 .../intrinsics/three_way_compare.rs | 0 .../intrinsics/transmute-niched.rs | 0 .../intrinsics/transmute-x64.rs | 0 .../intrinsics/transmute.rs | 0 .../intrinsics/typed_swap.rs | 0 .../intrinsics/unchecked_math.rs | 0 .../intrinsics/unlikely.rs | 0 .../intrinsics/volatile.rs | 0 .../intrinsics/volatile_order.rs | 0 .../is_val_statically_known.rs | 0 tests/{codegen => codegen-llvm}/issue-97217.rs | 0 .../issues/issue-101048.rs | 0 .../issues/issue-101082.rs | 0 .../issues/issue-101814.rs | 0 .../issues/issue-103132.rs | 0 .../issue-103285-ptr-addr-overflow-check.rs | 0 .../issues/issue-103327.rs | 0 .../issues/issue-103840.rs | 0 .../issues/issue-105386-ub-in-debuginfo.rs | 0 .../issues/issue-106369.rs | 0 .../issues/issue-107681-unwrap_unchecked.rs | 0 .../issues/issue-108395-branchy-bool-match.rs | 0 .../issues/issue-109328-split_first.rs | 0 .../issues/issue-110797-enum-jump-same.rs | 0 .../issues/issue-111603.rs | 0 .../issue-112509-slice-get-andthen-get.rs | 0 .../issue-113757-bounds-check-after-cmp-max.rs | 0 .../issues/issue-114312.rs | 0 .../issues/issue-115385-llvm-jump-threading.rs | 0 .../issues/issue-116878.rs | 0 .../issues/issue-118306.rs | 0 .../issues/issue-118392.rs | 0 .../issues/issue-119422.rs | 0 .../issues/issue-121719-common-field-offset.rs | 0 .../issue-122600-ptr-discriminant-update.rs | 0 ...ue-123712-str-to-lower-autovectorization.rs | 0 .../issues/issue-126585.rs | 0 .../issues/issue-129795.rs | 0 .../issues/issue-13018.rs | 0 .../issues/issue-136329-optnone-noinline.rs | 0 .../issues/issue-15953.rs | 0 .../issues/issue-27130.rs | 0 .../issues/issue-32031.rs | 0 .../issues/issue-32364.rs | 0 .../issues/issue-34634.rs | 0 .../issues/issue-34947-pow-i32.rs | 0 .../issues/issue-36010-some-box-is_some.rs | 0 .../issues/issue-37945.rs | 0 .../issues/issue-45222.rs | 0 .../issues/issue-45466.rs | 0 .../issue-45964-bounds-check-slice-pos.rs | 0 .../issues/issue-47278.rs | 0 .../issues/issue-47442.rs | 0 .../issues/issue-56267-2.rs | 0 .../issues/issue-56267.rs | 0 .../issues/issue-56927.rs | 0 .../issues/issue-58881.rs | 0 .../issues/issue-59352.rs | 0 ...-fn-ptr-call-returning-never-is-noreturn.rs | 0 .../issues/issue-68667-unwrap-combinators.rs | 0 .../issues/issue-69101-bounds-check.rs | 0 .../issues/issue-73031.rs | 0 .../issues/issue-73258.rs | 0 .../issues/issue-73338-effecient-cmp.rs | 0 .../issue-73396-bounds-check-after-position.rs | 0 ...ssue-73827-bounds-check-index-in-subexpr.rs | 0 .../issues/issue-74938-array-split-at.rs | 0 .../issues/issue-75525-bounds-checks.rs | 0 .../issues/issue-75546.rs | 0 .../issues/issue-75659.rs | 0 .../issues/issue-75978.rs | 0 .../issues/issue-77812.rs | 0 .../issues/issue-84268.rs | 0 .../issues/issue-85872-multiple-reverse.rs | 0 .../issues/issue-86106.rs | 0 .../issue-86109-eliminate-div-by-zero-check.rs | 0 .../issues/issue-93036-assert-index.rs | 0 .../issues/issue-96274.rs | 0 .../issues/issue-96497-slice-size-nowrap.rs | 0 .../issue-98294-get-mut-copy-from-slice-opt.rs | 0 .../issues/issue-98678-async.rs | 0 .../issues/issue-98678-closure-coroutine.rs | 0 .../issues/issue-98678-enum.rs | 0 .../issues/issue-98678-struct-union.rs | 0 .../issues/issue-99960.rs | 0 .../issues/looping-over-ne-bytes-133528.rs | 0 .../issues/str-to-string-128690.rs | 0 .../iter-repeat-n-trivial-drop.rs | 0 .../layout-size-checks.rs | 0 .../lib-optimizations/iter-sum.rs | 0 .../lib-optimizations/slice_rotate.rs | 0 .../lifetime_start_end.rs | 0 .../link-dead-code.rs | 0 .../{codegen => codegen-llvm}/link_section.rs | 0 tests/{codegen => codegen-llvm}/llvm-ident.rs | 0 .../llvm_module_flags.rs | 0 tests/{codegen => codegen-llvm}/loads.rs | 0 .../local-generics-in-exe-internalized.rs | 0 .../loongarch-abi/call-llvm-intrinsics.rs | 0 .../loongarch-abi/loongarch64-lp64d-abi.rs | 0 .../lto-removes-invokes.rs | 0 .../macos/i686-macosx-deployment-target.rs | 0 .../macos/i686-no-macosx-deployment-target.rs | 0 .../macos/x86_64-macosx-deployment-target.rs | 0 .../x86_64-no-macosx-deployment-target.rs | 0 .../mainsubprogram.rs | 0 .../match-optimized.rs | 0 .../match-optimizes-away.rs | 0 .../match-unoptimized.rs | 0 .../maybeuninit-rvo.rs | 0 .../mem-replace-big-type.rs | 0 .../mem-replace-simple-type.rs | 0 .../merge-functions.rs | 0 .../meta-filecheck/check-prefix.rs | 0 .../meta-filecheck/filecheck-flags.rs | 0 .../meta-filecheck/msvc-prefix-bad.rs | 0 .../meta-filecheck/no-directives.rs | 0 .../meta-filecheck/revision-prefix.rs | 0 .../method-declaration.rs | 0 .../min-function-alignment.rs | 0 .../mir-aggregate-no-alloca.rs | 0 .../mir-inlined-line-numbers.rs | 0 .../mir_zst_stores.rs | 0 .../move-before-nocapture-ref-arg.rs | 0 .../{codegen => codegen-llvm}/move-operands.rs | 0 tests/{codegen => codegen-llvm}/naked-asan.rs | 0 .../naked-fn/aligned.rs | 0 .../naked-fn/generics.rs | 0 .../naked-fn/instruction-set.rs | 0 .../naked-fn/min-function-alignment.rs | 0 .../naked-fn/naked-functions.rs | 0 .../no-alloca-inside-if-false.rs | 0 .../no-assumes-on-casts.rs | 0 .../no-dllimport-w-cross-lang-lto.rs | 0 .../no-jump-tables.rs | 0 tests/{codegen => codegen-llvm}/no-plt.rs | 0 .../no-redundant-item-monomorphization.rs | 0 .../no_builtins-at-crate.rs | 0 .../noalias-box-off.rs | 0 tests/{codegen => codegen-llvm}/noalias-box.rs | 0 .../{codegen => codegen-llvm}/noalias-flag.rs | 0 .../noalias-freeze.rs | 0 .../noalias-refcell.rs | 0 .../noalias-rwlockreadguard.rs | 0 .../{codegen => codegen-llvm}/noalias-unpin.rs | 0 .../non-terminate/infinite-loop-1.rs | 0 .../non-terminate/infinite-loop-2.rs | 0 .../non-terminate/infinite-recursion.rs | 0 .../non-terminate/nonempty-infinite-loop.rs | 0 .../noreturn-uninhabited.rs | 0 .../{codegen => codegen-llvm}/noreturnflag.rs | 0 tests/{codegen => codegen-llvm}/nounwind.rs | 0 tests/{codegen => codegen-llvm}/nrvo.rs | 0 .../optimize-attr-1.rs | 0 .../option-as-slice.rs | 0 .../option-niche-eq.rs | 0 .../option-niche-unfixed/option-nonzero-eq.rs | 0 .../overaligned-constant.rs | 0 tests/{codegen => codegen-llvm}/packed.rs | 0 .../panic-abort-windows.rs | 0 .../panic-in-drop-abort.rs | 0 .../panic-unwind-default-uwtable.rs | 0 .../patchable-function-entry-both-flags.rs | 0 .../patchable-function-entry-no-flag.rs | 0 .../patchable-function-entry-one-flag.rs | 0 .../pattern_type_symbols.rs | 0 .../personality_lifetimes.rs | 0 .../pgo-counter-bias.rs | 0 .../pgo-instrumentation.rs | 0 .../pic-relocation-model.rs | 0 .../pie-relocation-model.rs | 0 .../{codegen => codegen-llvm}/placement-new.rs | 0 .../powerpc64le-struct-align-128.rs | 0 .../precondition-checks.rs | 0 .../ptr-arithmetic.rs | 0 .../ptr-read-metadata.rs | 0 .../range-attribute.rs | 0 tests/{codegen => codegen-llvm}/range-loop.rs | 0 .../range_to_inclusive.rs | 0 tests/{codegen => codegen-llvm}/refs.rs | 0 .../reg-struct-return.rs | 0 .../{codegen => codegen-llvm}/regparm-inreg.rs | 0 .../remap_path_prefix/aux_mod.rs | 0 .../auxiliary/remap_path_prefix_aux.rs | 0 .../auxiliary/xcrate-generic.rs | 0 .../remap_path_prefix/issue-73167-remap-std.rs | 0 .../remap_path_prefix/main.rs | 0 .../remap_path_prefix/xcrate-generic.rs | 0 .../repeat-operand-zero-len.rs | 0 .../repeat-operand-zst-elem.rs | 0 .../repeat-trusted-len.rs | 0 .../repr/transparent-byval-struct-ptr.rs | 0 .../repr/transparent-imm-array.rs | 0 .../repr/transparent-mips64.rs | 0 .../repr/transparent-opaque-ptr.rs | 0 .../repr/transparent-sparc64.rs | 0 .../repr/transparent-sysv64.rs | 0 .../repr/transparent.rs | 0 tests/{codegen => codegen-llvm}/retpoline.rs | 0 .../riscv-abi/call-llvm-intrinsics.rs | 0 .../riscv-abi/cast-local-large-enough.rs | 0 .../riscv-abi/riscv64-lp64-lp64f-lp64d-abi.rs | 0 .../riscv-abi/riscv64-lp64d-abi.rs | 0 .../riscv-abi/riscv64-lp64f-lp64d-abi.rs | 0 .../riscv-target-abi.rs | 0 .../rust-abi-arch-specific-adjustment.rs | 0 tests/{codegen => codegen-llvm}/s390x-simd.rs | 0 ...aarch64-shadow-call-stack-with-fixed-x18.rs | 0 .../address-sanitizer-globals-tracking.rs | 0 .../cfi/add-canonical-jump-tables-flag.rs | 0 .../cfi/add-cfi-normalize-integers-flag.rs | 0 .../cfi/add-enable-split-lto-unit-flag.rs | 0 .../cfi/dbg-location-on-cfi-blocks.rs | 0 .../cfi/emit-type-checks-attr-no-sanitize.rs | 0 .../sanitizer/cfi/emit-type-checks.rs | 0 .../emit-type-metadata-attr-cfi-encoding.rs | 0 ...tadata-id-itanium-cxx-abi-const-generics.rs | 0 ...etadata-id-itanium-cxx-abi-drop-in-place.rs | 0 ...tadata-id-itanium-cxx-abi-function-types.rs | 0 ...pe-metadata-id-itanium-cxx-abi-lifetimes.rs | 0 ...-itanium-cxx-abi-method-secondary-typeid.rs | 0 ...t-type-metadata-id-itanium-cxx-abi-paths.rs | 0 ...etadata-id-itanium-cxx-abi-pointer-types.rs | 0 ...adata-id-itanium-cxx-abi-primitive-types.rs | 0 ...d-itanium-cxx-abi-repr-transparent-types.rs | 0 ...tadata-id-itanium-cxx-abi-sequence-types.rs | 0 ...-metadata-id-itanium-cxx-abi-trait-types.rs | 0 ...ta-id-itanium-cxx-abi-user-defined-types.rs | 0 ...ype-metadata-itanium-cxx-abi-generalized.rs | 0 ...a-itanium-cxx-abi-normalized-generalized.rs | 0 ...type-metadata-itanium-cxx-abi-normalized.rs | 0 .../cfi/emit-type-metadata-itanium-cxx-abi.rs | 0 .../cfi/emit-type-metadata-trait-objects.rs | 0 .../sanitizer/cfi/external_weak_symbols.rs | 0 .../sanitizer/cfi/generalize-pointers.rs | 0 .../sanitizer/cfi/normalize-integers.rs | 0 .../sanitizer/dataflow-instrument-functions.rs | 0 .../sanitizer/kasan-emits-instrumentation.rs | 0 .../kcfi/add-cfi-normalize-integers-flag.rs | 0 .../sanitizer/kcfi/add-kcfi-arity-flag.rs | 0 .../sanitizer/kcfi/add-kcfi-flag.rs | 0 .../sanitizer/kcfi/add-kcfi-offset-flag.rs | 0 ...mit-kcfi-operand-bundle-attr-no-sanitize.rs | 0 ...erand-bundle-itanium-cxx-abi-generalized.rs | 0 ...e-itanium-cxx-abi-normalized-generalized.rs | 0 ...perand-bundle-itanium-cxx-abi-normalized.rs | 0 ...emit-kcfi-operand-bundle-itanium-cxx-abi.rs | 0 .../sanitizer/kcfi/emit-kcfi-operand-bundle.rs | 0 .../kcfi/emit-type-metadata-trait-objects.rs | 0 .../sanitizer/kcfi/naked-function.rs | 0 .../sanitizer/memory-track-origins.rs | 0 .../sanitizer/memtag-attr-check.rs | 0 .../sanitizer/no-sanitize-inlining.rs | 0 .../sanitizer/no-sanitize.rs | 0 .../sanitizer/riscv64-shadow-call-stack.rs | 0 .../sanitizer/safestack-attr-check.rs | 0 .../sanitizer/sanitizer-recover.rs | 0 .../sanitizer/scs-attr-check.rs | 0 .../scalar-pair-bool.rs | 0 .../set-discriminant-invalid.rs | 0 .../simd-intrinsic/simd-intrinsic-float-abs.rs | 0 .../simd-intrinsic-float-ceil.rs | 0 .../simd-intrinsic/simd-intrinsic-float-cos.rs | 0 .../simd-intrinsic/simd-intrinsic-float-exp.rs | 0 .../simd-intrinsic-float-exp2.rs | 0 .../simd-intrinsic-float-floor.rs | 0 .../simd-intrinsic/simd-intrinsic-float-fma.rs | 0 .../simd-intrinsic-float-fsqrt.rs | 0 .../simd-intrinsic/simd-intrinsic-float-log.rs | 0 .../simd-intrinsic-float-log10.rs | 0 .../simd-intrinsic-float-log2.rs | 0 .../simd-intrinsic-float-minmax.rs | 0 .../simd-intrinsic/simd-intrinsic-float-sin.rs | 0 ...-intrinsic-generic-arithmetic-saturating.rs | 0 .../simd-intrinsic-generic-bitmask.rs | 0 .../simd-intrinsic-generic-gather.rs | 0 .../simd-intrinsic-generic-masked-load.rs | 0 .../simd-intrinsic-generic-masked-store.rs | 0 .../simd-intrinsic-generic-scatter.rs | 0 .../simd-intrinsic-generic-select.rs | 0 .../simd-intrinsic-mask-reduce.rs | 0 .../simd-intrinsic-transmute-array.rs | 0 .../simd/aggregate-simd.rs | 0 .../simd/extract-insert-dyn.rs | 0 .../simd/packed-simd-alignment.rs | 0 .../simd/packed-simd.rs | 0 .../simd/simd-wide-sum.rs | 0 .../simd/simd_arith_offset.rs | 0 .../simd/swap-simd-types.rs | 0 .../simd/unpadded-simd.rs | 0 .../skip-mono-inside-if-false.rs | 0 .../slice-as_chunks.rs | 0 .../slice-indexing.rs | 0 tests/{codegen => codegen-llvm}/slice-init.rs | 0 .../slice-is-ascii.rs | 0 .../slice-iter-fold.rs | 0 .../slice-iter-len-eq-zero.rs | 0 .../slice-iter-nonnull.rs | 0 .../slice-last-elements-optimization.rs | 0 .../slice-pointer-nonnull-unwrap.rs | 0 .../slice-position-bounds-check.rs | 0 .../slice-ref-equality.rs | 0 .../{codegen => codegen-llvm}/slice-reverse.rs | 0 .../slice-split-at.rs | 0 .../slice-windows-no-bounds-check.rs | 0 .../slice_as_from_ptr_range.rs | 0 .../some-abis-do-extend-params-to-32-bits.rs | 0 .../some-global-nonnull.rs | 0 .../sparc-struct-abi.rs | 0 .../split-lto-unit.rs | 0 .../src-hash-algorithm-md5.rs | 0 .../src-hash-algorithm-sha1.rs | 0 .../src-hash-algorithm-sha256.rs | 0 .../sroa-fragment-debuginfo.rs | 0 .../sse42-implies-crc32.rs | 0 .../stack-probes-inline.rs | 0 .../stack-protector.rs | 0 .../static-relocation-model-msvc.rs | 0 .../staticlib-external-inline-fns.rs | 0 .../step_by-overflow-checks.rs | 0 tests/{codegen => codegen-llvm}/stores.rs | 0 tests/{codegen => codegen-llvm}/string-push.rs | 0 .../swap-large-types.rs | 0 .../swap-small-types.rs | 0 .../target-cpu-on-functions.rs | 0 .../target-feature-inline-closure.rs | 0 .../target-feature-negative-implication.rs | 0 .../target-feature-overrides.rs | 0 .../terminating-catchpad.rs | 0 .../{codegen => codegen-llvm}/thread-local.rs | 0 .../tied-features-strength.rs | 0 tests/{codegen => codegen-llvm}/to_vec.rs | 0 .../trailing_zeros.rs | 0 .../transmute-optimized.rs | 0 .../transmute-scalar.rs | 0 .../try_question_mark_nop.rs | 0 .../tune-cpu-on-functions.rs | 0 .../tuple-layout-opt.rs | 0 tests/{codegen => codegen-llvm}/ub-checks.rs | 0 .../unchecked-float-casts.rs | 0 .../unchecked_shifts.rs | 0 .../uninhabited-transparent-return-abi.rs | 0 .../{codegen => codegen-llvm}/uninit-consts.rs | 0 .../uninit-repeat-in-aggregate.rs | 0 tests/{codegen => codegen-llvm}/union-abi.rs | 0 .../union-aggregate.rs | 0 .../unwind-abis/aapcs-unwind-abi.rs | 0 .../unwind-abis/c-unwind-abi-panic-abort.rs | 0 .../unwind-abis/c-unwind-abi.rs | 0 .../unwind-abis/cdecl-unwind-abi.rs | 0 .../unwind-abis/fastcall-unwind-abi.rs | 0 .../nounwind-on-stable-panic-abort.rs | 0 .../unwind-abis/nounwind.rs | 0 .../unwind-abis/stdcall-unwind-abi.rs | 0 .../unwind-abis/system-unwind-abi.rs | 0 .../unwind-abis/sysv64-unwind-abi.rs | 0 .../unwind-abis/thiscall-unwind-abi.rs | 0 .../unwind-abis/vectorcall-unwind-abi.rs | 0 .../unwind-abis/win64-unwind-abi.rs | 0 .../unwind-and-panic-abort.rs | 0 .../unwind-extern-exports.rs | 0 .../unwind-extern-imports.rs | 0 .../unwind-landingpad-cold.rs | 0 .../unwind-landingpad-inline.rs | 0 .../{codegen => codegen-llvm}/used_with_arg.rs | 0 tests/{codegen => codegen-llvm}/var-names.rs | 0 tests/{codegen => codegen-llvm}/vec-as-ptr.rs | 0 tests/{codegen => codegen-llvm}/vec-calloc.rs | 0 .../{codegen => codegen-llvm}/vec-in-place.rs | 0 .../vec-iter-collect-len.rs | 0 tests/{codegen => codegen-llvm}/vec-iter.rs | 0 .../vec-len-invariant.rs | 0 .../vec-optimizes-away.rs | 0 .../vec-reserve-extend.rs | 0 .../vec-shrink-panik.rs | 0 .../vec-with-capacity.rs | 0 .../vec_pop_push_noop.rs | 0 .../vecdeque-drain.rs | 0 .../vecdeque-nonempty-get-no-panic.rs | 0 .../vecdeque_no_panic.rs | 0 .../vecdeque_pop_push.rs | 0 .../virtual-call-attrs-issue-137646.rs | 0 .../virtual-function-elimination-32bit.rs | 0 .../virtual-function-elimination.rs | 0 .../{codegen => codegen-llvm}/vtable-loads.rs | 0 .../{codegen => codegen-llvm}/vtable-upcast.rs | 0 .../wasm_casts_trapping.rs | 0 .../wasm_exceptions.rs | 0 tests/{codegen => codegen-llvm}/zip.rs | 0 tests/{codegen => codegen-llvm}/zst-offset.rs | 0 tests/run-make/llvm-ident/rmake.rs | 2 +- tests/ui/abi/fixed_x18.rs | 2 +- triagebot.toml | 18 +++++++++--------- 676 files changed, 41 insertions(+), 36 deletions(-) rename tests/{codegen => codegen-llvm}/README.md (100%) rename tests/{codegen => codegen-llvm}/aarch64-softfloat.rs (100%) rename tests/{codegen => codegen-llvm}/aarch64-struct-align-128.rs (100%) rename tests/{codegen => codegen-llvm}/abi-efiapi.rs (100%) rename tests/{codegen => codegen-llvm}/abi-main-signature-16bit-c-int.rs (100%) rename tests/{codegen => codegen-llvm}/abi-main-signature-32bit-c-int.rs (100%) rename tests/{codegen => codegen-llvm}/abi-repr-ext.rs (100%) rename tests/{codegen => codegen-llvm}/abi-sysv64.rs (100%) rename tests/{codegen => codegen-llvm}/abi-win64-zst.rs (100%) rename tests/{codegen => codegen-llvm}/abi-x86-interrupt.rs (100%) rename tests/{codegen => codegen-llvm}/abi-x86-sse.rs (100%) rename tests/{codegen => codegen-llvm}/abi-x86_64_sysv.rs (100%) rename tests/{codegen => codegen-llvm}/addr-of-mutate.rs (100%) rename tests/{codegen => codegen-llvm}/adjustments.rs (100%) rename tests/{codegen => codegen-llvm}/align-byval-alignment-mismatch.rs (100%) rename tests/{codegen => codegen-llvm}/align-byval-vector.rs (100%) rename tests/{codegen => codegen-llvm}/align-byval.rs (100%) rename tests/{codegen => codegen-llvm}/align-enum.rs (100%) rename tests/{codegen => codegen-llvm}/align-fn.rs (100%) rename tests/{codegen => codegen-llvm}/align-offset.rs (100%) rename tests/{codegen => codegen-llvm}/align-struct.rs (100%) rename tests/{codegen => codegen-llvm}/alloc-optimisation.rs (100%) rename tests/{codegen => codegen-llvm}/amdgpu-addrspacecast.rs (100%) rename tests/{codegen => codegen-llvm}/array-clone.rs (100%) rename tests/{codegen => codegen-llvm}/array-cmp.rs (100%) rename tests/{codegen => codegen-llvm}/array-codegen.rs (100%) rename tests/{codegen => codegen-llvm}/array-equality.rs (100%) rename tests/{codegen => codegen-llvm}/array-from_fn.rs (100%) rename tests/{codegen => codegen-llvm}/array-map.rs (100%) rename tests/{codegen => codegen-llvm}/array-optimized.rs (100%) rename tests/{codegen => codegen-llvm}/array-repeat.rs (100%) rename tests/{codegen => codegen-llvm}/ascii-char.rs (100%) rename tests/{codegen => codegen-llvm}/asm/aarch64-clobbers.rs (100%) rename tests/{codegen => codegen-llvm}/asm/avr-clobbers.rs (100%) rename tests/{codegen => codegen-llvm}/asm/bpf-clobbers.rs (100%) rename tests/{codegen => codegen-llvm}/asm/critical.rs (100%) rename tests/{codegen => codegen-llvm}/asm/csky-clobbers.rs (100%) rename tests/{codegen => codegen-llvm}/asm/foo.s (100%) rename tests/{codegen => codegen-llvm}/asm/global_asm.rs (100%) rename tests/{codegen => codegen-llvm}/asm/global_asm_include.rs (100%) rename tests/{codegen => codegen-llvm}/asm/global_asm_x2.rs (100%) rename tests/{codegen => codegen-llvm}/asm/goto.rs (100%) rename tests/{codegen => codegen-llvm}/asm/hexagon-clobbers.rs (100%) rename tests/{codegen => codegen-llvm}/asm/may_unwind.rs (100%) rename tests/{codegen => codegen-llvm}/asm/maybe-uninit.rs (100%) rename tests/{codegen => codegen-llvm}/asm/msp430-clobbers.rs (100%) rename tests/{codegen => codegen-llvm}/asm/multiple-options.rs (100%) rename tests/{codegen => codegen-llvm}/asm/options.rs (100%) rename tests/{codegen => codegen-llvm}/asm/powerpc-clobbers.rs (100%) rename tests/{codegen => codegen-llvm}/asm/riscv-clobbers.rs (100%) rename tests/{codegen => codegen-llvm}/asm/s390x-clobbers.rs (100%) rename tests/{codegen => codegen-llvm}/asm/sanitize-llvm.rs (100%) rename tests/{codegen => codegen-llvm}/asm/sparc-clobbers.rs (100%) rename tests/{codegen => codegen-llvm}/asm/x86-clobber_abi.rs (100%) rename tests/{codegen => codegen-llvm}/asm/x86-clobbers.rs (100%) rename tests/{codegen => codegen-llvm}/asm/x86-target-clobbers.rs (100%) rename tests/{codegen => codegen-llvm}/assign-desugar-debuginfo.rs (100%) rename tests/{codegen => codegen-llvm}/async-closure-debug.rs (100%) rename tests/{codegen => codegen-llvm}/async-fn-debug-awaitee-field.rs (100%) rename tests/{codegen => codegen-llvm}/async-fn-debug-msvc.rs (100%) rename tests/{codegen => codegen-llvm}/async-fn-debug.rs (100%) rename tests/{codegen => codegen-llvm}/atomic-operations.rs (100%) rename tests/{codegen => codegen-llvm}/atomicptr.rs (100%) rename tests/{codegen => codegen-llvm}/autodiff/batched.rs (100%) rename tests/{codegen => codegen-llvm}/autodiff/generic.rs (100%) rename tests/{codegen => codegen-llvm}/autodiff/identical_fnc.rs (100%) rename tests/{codegen => codegen-llvm}/autodiff/inline.rs (100%) rename tests/{codegen => codegen-llvm}/autodiff/scalar.rs (100%) rename tests/{codegen => codegen-llvm}/autodiff/sret.rs (100%) rename tests/{codegen => codegen-llvm}/autodiffv2.rs (100%) rename tests/{codegen => codegen-llvm}/autovec/dont-shuffle-bswaps-opt2.rs (100%) rename tests/{codegen => codegen-llvm}/autovec/dont-shuffle-bswaps-opt3.rs (100%) rename tests/{codegen => codegen-llvm}/autovectorize-f32x4.rs (100%) rename tests/{codegen => codegen-llvm}/auxiliary/extern_decl.rs (100%) rename tests/{codegen => codegen-llvm}/auxiliary/nounwind.rs (100%) rename tests/{codegen => codegen-llvm}/auxiliary/thread_local_aux.rs (100%) rename tests/{codegen => codegen-llvm}/avr/avr-func-addrspace.rs (100%) rename tests/{codegen => codegen-llvm}/bigint-helpers.rs (100%) rename tests/{codegen => codegen-llvm}/binary-heap-peek-mut-pop-no-panic.rs (100%) rename tests/{codegen => codegen-llvm}/binary-search-index-no-bound-check.rs (100%) rename tests/{codegen => codegen-llvm}/bool-cmp.rs (100%) rename tests/{codegen => codegen-llvm}/bounds-checking/gep-issue-133979.rs (100%) rename tests/{codegen => codegen-llvm}/box-default-debug-copies.rs (100%) rename tests/{codegen => codegen-llvm}/box-uninit-bytes.rs (100%) rename tests/{codegen => codegen-llvm}/bpf-alu32.rs (100%) rename tests/{codegen => codegen-llvm}/branch-protection.rs (100%) rename tests/{codegen => codegen-llvm}/call-llvm-intrinsics.rs (100%) rename tests/{codegen => codegen-llvm}/call-tmps-lifetime.rs (100%) rename tests/{codegen => codegen-llvm}/cast-optimized.rs (100%) rename tests/{codegen => codegen-llvm}/cast-target-abi.rs (100%) rename tests/{codegen => codegen-llvm}/catch-unwind.rs (100%) rename tests/{codegen => codegen-llvm}/cdylib-external-inline-fns.rs (100%) rename tests/{codegen => codegen-llvm}/cf-protection.rs (100%) rename tests/{codegen => codegen-llvm}/cffi/c-variadic-copy.rs (100%) rename tests/{codegen => codegen-llvm}/cffi/c-variadic-naked.rs (100%) rename tests/{codegen => codegen-llvm}/cffi/c-variadic-opt.rs (100%) rename tests/{codegen => codegen-llvm}/cffi/c-variadic.rs (100%) rename tests/{codegen => codegen-llvm}/cffi/ffi-const.rs (100%) rename tests/{codegen => codegen-llvm}/cffi/ffi-out-of-bounds-loads.rs (100%) rename tests/{codegen => codegen-llvm}/cffi/ffi-pure.rs (100%) rename tests/{codegen => codegen-llvm}/cfguard-checks.rs (100%) rename tests/{codegen => codegen-llvm}/cfguard-disabled.rs (100%) rename tests/{codegen => codegen-llvm}/cfguard-nochecks.rs (100%) rename tests/{codegen => codegen-llvm}/cfguard-non-msvc.rs (100%) rename tests/{codegen => codegen-llvm}/char-ascii-branchless.rs (100%) rename tests/{codegen => codegen-llvm}/char-escape-debug-no-bounds-check.rs (100%) rename tests/{codegen => codegen-llvm}/checked_ilog.rs (100%) rename tests/{codegen => codegen-llvm}/checked_math.rs (100%) rename tests/{codegen => codegen-llvm}/clone-shims.rs (100%) rename tests/{codegen => codegen-llvm}/clone_as_copy.rs (100%) rename tests/{codegen => codegen-llvm}/codemodels.rs (100%) rename tests/{codegen => codegen-llvm}/coercions.rs (100%) rename tests/{codegen => codegen-llvm}/cold-call-declare-and-call.rs (100%) rename tests/{codegen => codegen-llvm}/common_prim_int_ptr.rs (100%) rename tests/{codegen => codegen-llvm}/comparison-operators-2-struct.rs (100%) rename tests/{codegen => codegen-llvm}/comparison-operators-2-tuple.rs (100%) rename tests/{codegen => codegen-llvm}/comparison-operators-newtype.rs (100%) rename tests/{codegen => codegen-llvm}/compiletest-self-test/minicore-smoke-test.rs (100%) rename tests/{codegen => codegen-llvm}/const-array.rs (100%) rename tests/{codegen => codegen-llvm}/const-vector.rs (100%) rename tests/{codegen => codegen-llvm}/const_scalar_pair.rs (100%) rename tests/{codegen => codegen-llvm}/constant-branch.rs (100%) rename tests/{codegen => codegen-llvm}/consts.rs (100%) rename tests/{codegen => codegen-llvm}/coroutine-debug-msvc.rs (100%) rename tests/{codegen => codegen-llvm}/coroutine-debug.rs (100%) rename tests/{codegen => codegen-llvm}/cross-crate-inlining/always-inline.rs (100%) rename tests/{codegen => codegen-llvm}/cross-crate-inlining/auxiliary/always.rs (100%) rename tests/{codegen => codegen-llvm}/cross-crate-inlining/auxiliary/leaf.rs (100%) rename tests/{codegen => codegen-llvm}/cross-crate-inlining/auxiliary/never.rs (100%) rename tests/{codegen => codegen-llvm}/cross-crate-inlining/leaf-inlining.rs (100%) rename tests/{codegen => codegen-llvm}/cross-crate-inlining/never-inline.rs (100%) rename tests/{codegen => codegen-llvm}/dealloc-no-unwind.rs (100%) rename tests/{codegen => codegen-llvm}/debug-accessibility/crate-enum.rs (100%) rename tests/{codegen => codegen-llvm}/debug-accessibility/crate-struct.rs (100%) rename tests/{codegen => codegen-llvm}/debug-accessibility/private-enum.rs (100%) rename tests/{codegen => codegen-llvm}/debug-accessibility/private-struct.rs (100%) rename tests/{codegen => codegen-llvm}/debug-accessibility/public-enum.rs (100%) rename tests/{codegen => codegen-llvm}/debug-accessibility/public-struct.rs (100%) rename tests/{codegen => codegen-llvm}/debug-accessibility/struct-fields.rs (100%) rename tests/{codegen => codegen-llvm}/debug-accessibility/super-enum.rs (100%) rename tests/{codegen => codegen-llvm}/debug-accessibility/super-struct.rs (100%) rename tests/{codegen => codegen-llvm}/debug-accessibility/tuple-fields.rs (100%) rename tests/{codegen => codegen-llvm}/debug-alignment.rs (100%) rename tests/{codegen => codegen-llvm}/debug-column-msvc.rs (100%) rename tests/{codegen => codegen-llvm}/debug-column.rs (100%) rename tests/{codegen => codegen-llvm}/debug-compile-unit-path.rs (100%) rename tests/{codegen => codegen-llvm}/debug-fndef-size.rs (100%) rename tests/{codegen => codegen-llvm}/debug-limited.rs (100%) rename tests/{codegen => codegen-llvm}/debug-line-directives-only.rs (100%) rename tests/{codegen => codegen-llvm}/debug-line-tables-only.rs (100%) rename tests/{codegen => codegen-llvm}/debug-linkage-name.rs (100%) rename tests/{codegen => codegen-llvm}/debug-vtable.rs (100%) rename tests/{codegen => codegen-llvm}/debuginfo-constant-locals.rs (100%) rename tests/{codegen => codegen-llvm}/debuginfo-generic-closure-env-names.rs (100%) rename tests/{codegen => codegen-llvm}/debuginfo-inline-callsite-location.rs (100%) rename tests/{codegen => codegen-llvm}/debuginfo-proc-macro/auxiliary/macro_def.rs (100%) rename tests/{codegen => codegen-llvm}/debuginfo-proc-macro/mir_inlined_twice_var_locs.rs (100%) rename tests/{codegen => codegen-llvm}/deduced-param-attrs.rs (100%) rename tests/{codegen => codegen-llvm}/default-requires-uwtable.rs (100%) rename tests/{codegen => codegen-llvm}/default-visibility.rs (100%) rename tests/{codegen => codegen-llvm}/direct-access-external-data.rs (100%) rename tests/{codegen => codegen-llvm}/dllimports/auxiliary/dummy.rs (100%) rename tests/{codegen => codegen-llvm}/dllimports/auxiliary/wrapper.rs (100%) rename tests/{codegen => codegen-llvm}/dllimports/main.rs (100%) rename tests/{codegen => codegen-llvm}/dont_codegen_private_const_fn_only_used_in_const_eval.rs (100%) rename tests/{codegen => codegen-llvm}/drop-in-place-noalias.rs (100%) rename tests/{codegen => codegen-llvm}/drop.rs (100%) rename tests/{codegen => codegen-llvm}/dst-offset.rs (100%) rename tests/{codegen => codegen-llvm}/dst-vtable-align-nonzero.rs (100%) rename tests/{codegen => codegen-llvm}/dst-vtable-size-range.rs (100%) rename tests/{codegen => codegen-llvm}/ehcontguard_disabled.rs (100%) rename tests/{codegen => codegen-llvm}/ehcontguard_enabled.rs (100%) rename tests/{codegen => codegen-llvm}/emscripten-catch-unwind-js-eh.rs (100%) rename tests/{codegen => codegen-llvm}/emscripten-catch-unwind-wasm-eh.rs (100%) rename tests/{codegen => codegen-llvm}/enable-lto-unit-splitting.rs (100%) rename tests/{codegen => codegen-llvm}/enum/enum-aggregate.rs (100%) rename tests/{codegen => codegen-llvm}/enum/enum-bounds-check-derived-idx.rs (100%) rename tests/{codegen => codegen-llvm}/enum/enum-bounds-check-issue-13926.rs (100%) rename tests/{codegen => codegen-llvm}/enum/enum-bounds-check-issue-82871.rs (100%) rename tests/{codegen => codegen-llvm}/enum/enum-bounds-check.rs (100%) rename tests/{codegen => codegen-llvm}/enum/enum-debug-clike.rs (100%) rename tests/{codegen => codegen-llvm}/enum/enum-debug-niche-2.rs (100%) rename tests/{codegen => codegen-llvm}/enum/enum-debug-niche.rs (100%) rename tests/{codegen => codegen-llvm}/enum/enum-debug-tagged.rs (100%) rename tests/{codegen => codegen-llvm}/enum/enum-discriminant-eq.rs (100%) rename tests/{codegen => codegen-llvm}/enum/enum-discriminant-value.rs (100%) rename tests/{codegen => codegen-llvm}/enum/enum-early-otherwise-branch.rs (100%) rename tests/{codegen => codegen-llvm}/enum/enum-match.rs (100%) rename tests/{codegen => codegen-llvm}/enum/enum-two-variants-match.rs (100%) rename tests/{codegen => codegen-llvm}/enum/enum-u128.rs (100%) rename tests/{codegen => codegen-llvm}/enum/unreachable_enum_default_branch.rs (100%) rename tests/{codegen => codegen-llvm}/ergonomic-clones/closure.rs (100%) rename tests/{codegen => codegen-llvm}/error-provide.rs (100%) rename tests/{codegen => codegen-llvm}/export-no-mangle.rs (100%) rename tests/{codegen => codegen-llvm}/external-no-mangle-fns.rs (100%) rename tests/{codegen => codegen-llvm}/external-no-mangle-statics.rs (100%) rename tests/{codegen => codegen-llvm}/f128-wasm32-callconv.rs (100%) rename tests/{codegen => codegen-llvm}/fastcall-inreg.rs (100%) rename tests/{codegen => codegen-llvm}/fatptr.rs (100%) rename tests/{codegen => codegen-llvm}/fewer-names.rs (100%) rename tests/{codegen => codegen-llvm}/fixed-x18.rs (100%) rename tests/{codegen => codegen-llvm}/float/algebraic.rs (100%) rename tests/{codegen => codegen-llvm}/float/f128.rs (100%) rename tests/{codegen => codegen-llvm}/float/f16-f128-inline.rs (100%) rename tests/{codegen => codegen-llvm}/float/f16.rs (100%) rename tests/{codegen => codegen-llvm}/float_math.rs (100%) rename tests/{codegen => codegen-llvm}/fn-impl-trait-self.rs (100%) rename tests/{codegen => codegen-llvm}/fn-parameters-on-different-lines-debuginfo.rs (100%) rename tests/{codegen => codegen-llvm}/force-frame-pointers.rs (100%) rename tests/{codegen => codegen-llvm}/force-no-unwind-tables.rs (100%) rename tests/{codegen => codegen-llvm}/force-unwind-tables.rs (100%) rename tests/{codegen => codegen-llvm}/frame-pointer-cli-control.rs (100%) rename tests/{codegen => codegen-llvm}/frame-pointer.rs (100%) rename tests/{codegen => codegen-llvm}/function-arguments-noopt.rs (100%) rename tests/{codegen => codegen-llvm}/function-arguments.rs (100%) rename tests/{codegen => codegen-llvm}/function-return.rs (100%) rename tests/{codegen => codegen-llvm}/gdb_debug_script_load.rs (100%) rename tests/{codegen => codegen-llvm}/generic-debug.rs (100%) rename tests/{codegen => codegen-llvm}/gep-index.rs (100%) rename tests/{codegen => codegen-llvm}/gpu-kernel-abi.rs (100%) rename tests/{codegen => codegen-llvm}/gpu_offload/gpu_host.rs (100%) rename tests/{codegen => codegen-llvm}/hint/cold_path.rs (100%) rename tests/{codegen => codegen-llvm}/hint/likely.rs (100%) rename tests/{codegen => codegen-llvm}/hint/unlikely.rs (100%) rename tests/{codegen => codegen-llvm}/i128-wasm32-callconv.rs (100%) rename tests/{codegen => codegen-llvm}/i128-x86-align.rs (100%) rename tests/{codegen => codegen-llvm}/i128-x86-callconv.rs (100%) rename tests/{codegen => codegen-llvm}/infallible-unwrap-in-opt-z.rs (100%) rename tests/{codegen => codegen-llvm}/inherit_overflow.rs (100%) rename tests/{codegen => codegen-llvm}/inline-always-works-always.rs (100%) rename tests/{codegen => codegen-llvm}/inline-debuginfo.rs (100%) rename tests/{codegen => codegen-llvm}/inline-function-args-debug-info.rs (100%) rename tests/{codegen => codegen-llvm}/inline-hint.rs (100%) rename tests/{codegen => codegen-llvm}/instrument-coverage/instrument-coverage-off.rs (100%) rename tests/{codegen => codegen-llvm}/instrument-coverage/instrument-coverage.rs (100%) rename tests/{codegen => codegen-llvm}/instrument-coverage/testprog.rs (100%) rename tests/{codegen => codegen-llvm}/instrument-mcount.rs (100%) rename tests/{codegen => codegen-llvm}/instrument-xray/basic.rs (100%) rename tests/{codegen => codegen-llvm}/instrument-xray/options-combine.rs (100%) rename tests/{codegen => codegen-llvm}/instrument-xray/options-override.rs (100%) rename tests/{codegen => codegen-llvm}/integer-cmp.rs (100%) rename tests/{codegen => codegen-llvm}/integer-overflow.rs (100%) rename tests/{codegen => codegen-llvm}/internalize-closures.rs (100%) rename tests/{codegen => codegen-llvm}/intrinsic-no-unnamed-attr.rs (100%) rename tests/{codegen => codegen-llvm}/intrinsics/aggregate-thin-pointer.rs (100%) rename tests/{codegen => codegen-llvm}/intrinsics/carrying_mul_add.rs (100%) rename tests/{codegen => codegen-llvm}/intrinsics/cold_path.rs (100%) rename tests/{codegen => codegen-llvm}/intrinsics/cold_path2.rs (100%) rename tests/{codegen => codegen-llvm}/intrinsics/cold_path3.rs (100%) rename tests/{codegen => codegen-llvm}/intrinsics/compare_bytes.rs (100%) rename tests/{codegen => codegen-llvm}/intrinsics/const_eval_select.rs (100%) rename tests/{codegen => codegen-llvm}/intrinsics/ctlz.rs (100%) rename tests/{codegen => codegen-llvm}/intrinsics/ctpop.rs (100%) rename tests/{codegen => codegen-llvm}/intrinsics/disjoint_bitor.rs (100%) rename tests/{codegen => codegen-llvm}/intrinsics/exact_div.rs (100%) rename tests/{codegen => codegen-llvm}/intrinsics/likely.rs (100%) rename tests/{codegen => codegen-llvm}/intrinsics/likely_assert.rs (100%) rename tests/{codegen => codegen-llvm}/intrinsics/mask.rs (100%) rename tests/{codegen => codegen-llvm}/intrinsics/nontemporal.rs (100%) rename tests/{codegen => codegen-llvm}/intrinsics/offset.rs (100%) rename tests/{codegen => codegen-llvm}/intrinsics/offset_from.rs (100%) rename tests/{codegen => codegen-llvm}/intrinsics/prefetch.rs (100%) rename tests/{codegen => codegen-llvm}/intrinsics/ptr_metadata.rs (100%) rename tests/{codegen => codegen-llvm}/intrinsics/rotate_left.rs (100%) rename tests/{codegen => codegen-llvm}/intrinsics/rustc_intrinsic_must_be_overridden.rs (100%) rename tests/{codegen => codegen-llvm}/intrinsics/select_unpredictable.rs (100%) rename tests/{codegen => codegen-llvm}/intrinsics/three_way_compare.rs (100%) rename tests/{codegen => codegen-llvm}/intrinsics/transmute-niched.rs (100%) rename tests/{codegen => codegen-llvm}/intrinsics/transmute-x64.rs (100%) rename tests/{codegen => codegen-llvm}/intrinsics/transmute.rs (100%) rename tests/{codegen => codegen-llvm}/intrinsics/typed_swap.rs (100%) rename tests/{codegen => codegen-llvm}/intrinsics/unchecked_math.rs (100%) rename tests/{codegen => codegen-llvm}/intrinsics/unlikely.rs (100%) rename tests/{codegen => codegen-llvm}/intrinsics/volatile.rs (100%) rename tests/{codegen => codegen-llvm}/intrinsics/volatile_order.rs (100%) rename tests/{codegen => codegen-llvm}/is_val_statically_known.rs (100%) rename tests/{codegen => codegen-llvm}/issue-97217.rs (100%) rename tests/{codegen => codegen-llvm}/issues/issue-101048.rs (100%) rename tests/{codegen => codegen-llvm}/issues/issue-101082.rs (100%) rename tests/{codegen => codegen-llvm}/issues/issue-101814.rs (100%) rename tests/{codegen => codegen-llvm}/issues/issue-103132.rs (100%) rename tests/{codegen => codegen-llvm}/issues/issue-103285-ptr-addr-overflow-check.rs (100%) rename tests/{codegen => codegen-llvm}/issues/issue-103327.rs (100%) rename tests/{codegen => codegen-llvm}/issues/issue-103840.rs (100%) rename tests/{codegen => codegen-llvm}/issues/issue-105386-ub-in-debuginfo.rs (100%) rename tests/{codegen => codegen-llvm}/issues/issue-106369.rs (100%) rename tests/{codegen => codegen-llvm}/issues/issue-107681-unwrap_unchecked.rs (100%) rename tests/{codegen => codegen-llvm}/issues/issue-108395-branchy-bool-match.rs (100%) rename tests/{codegen => codegen-llvm}/issues/issue-109328-split_first.rs (100%) rename tests/{codegen => codegen-llvm}/issues/issue-110797-enum-jump-same.rs (100%) rename tests/{codegen => codegen-llvm}/issues/issue-111603.rs (100%) rename tests/{codegen => codegen-llvm}/issues/issue-112509-slice-get-andthen-get.rs (100%) rename tests/{codegen => codegen-llvm}/issues/issue-113757-bounds-check-after-cmp-max.rs (100%) rename tests/{codegen => codegen-llvm}/issues/issue-114312.rs (100%) rename tests/{codegen => codegen-llvm}/issues/issue-115385-llvm-jump-threading.rs (100%) rename tests/{codegen => codegen-llvm}/issues/issue-116878.rs (100%) rename tests/{codegen => codegen-llvm}/issues/issue-118306.rs (100%) rename tests/{codegen => codegen-llvm}/issues/issue-118392.rs (100%) rename tests/{codegen => codegen-llvm}/issues/issue-119422.rs (100%) rename tests/{codegen => codegen-llvm}/issues/issue-121719-common-field-offset.rs (100%) rename tests/{codegen => codegen-llvm}/issues/issue-122600-ptr-discriminant-update.rs (100%) rename tests/{codegen => codegen-llvm}/issues/issue-123712-str-to-lower-autovectorization.rs (100%) rename tests/{codegen => codegen-llvm}/issues/issue-126585.rs (100%) rename tests/{codegen => codegen-llvm}/issues/issue-129795.rs (100%) rename tests/{codegen => codegen-llvm}/issues/issue-13018.rs (100%) rename tests/{codegen => codegen-llvm}/issues/issue-136329-optnone-noinline.rs (100%) rename tests/{codegen => codegen-llvm}/issues/issue-15953.rs (100%) rename tests/{codegen => codegen-llvm}/issues/issue-27130.rs (100%) rename tests/{codegen => codegen-llvm}/issues/issue-32031.rs (100%) rename tests/{codegen => codegen-llvm}/issues/issue-32364.rs (100%) rename tests/{codegen => codegen-llvm}/issues/issue-34634.rs (100%) rename tests/{codegen => codegen-llvm}/issues/issue-34947-pow-i32.rs (100%) rename tests/{codegen => codegen-llvm}/issues/issue-36010-some-box-is_some.rs (100%) rename tests/{codegen => codegen-llvm}/issues/issue-37945.rs (100%) rename tests/{codegen => codegen-llvm}/issues/issue-45222.rs (100%) rename tests/{codegen => codegen-llvm}/issues/issue-45466.rs (100%) rename tests/{codegen => codegen-llvm}/issues/issue-45964-bounds-check-slice-pos.rs (100%) rename tests/{codegen => codegen-llvm}/issues/issue-47278.rs (100%) rename tests/{codegen => codegen-llvm}/issues/issue-47442.rs (100%) rename tests/{codegen => codegen-llvm}/issues/issue-56267-2.rs (100%) rename tests/{codegen => codegen-llvm}/issues/issue-56267.rs (100%) rename tests/{codegen => codegen-llvm}/issues/issue-56927.rs (100%) rename tests/{codegen => codegen-llvm}/issues/issue-58881.rs (100%) rename tests/{codegen => codegen-llvm}/issues/issue-59352.rs (100%) rename tests/{codegen => codegen-llvm}/issues/issue-64219-fn-ptr-call-returning-never-is-noreturn.rs (100%) rename tests/{codegen => codegen-llvm}/issues/issue-68667-unwrap-combinators.rs (100%) rename tests/{codegen => codegen-llvm}/issues/issue-69101-bounds-check.rs (100%) rename tests/{codegen => codegen-llvm}/issues/issue-73031.rs (100%) rename tests/{codegen => codegen-llvm}/issues/issue-73258.rs (100%) rename tests/{codegen => codegen-llvm}/issues/issue-73338-effecient-cmp.rs (100%) rename tests/{codegen => codegen-llvm}/issues/issue-73396-bounds-check-after-position.rs (100%) rename tests/{codegen => codegen-llvm}/issues/issue-73827-bounds-check-index-in-subexpr.rs (100%) rename tests/{codegen => codegen-llvm}/issues/issue-74938-array-split-at.rs (100%) rename tests/{codegen => codegen-llvm}/issues/issue-75525-bounds-checks.rs (100%) rename tests/{codegen => codegen-llvm}/issues/issue-75546.rs (100%) rename tests/{codegen => codegen-llvm}/issues/issue-75659.rs (100%) rename tests/{codegen => codegen-llvm}/issues/issue-75978.rs (100%) rename tests/{codegen => codegen-llvm}/issues/issue-77812.rs (100%) rename tests/{codegen => codegen-llvm}/issues/issue-84268.rs (100%) rename tests/{codegen => codegen-llvm}/issues/issue-85872-multiple-reverse.rs (100%) rename tests/{codegen => codegen-llvm}/issues/issue-86106.rs (100%) rename tests/{codegen => codegen-llvm}/issues/issue-86109-eliminate-div-by-zero-check.rs (100%) rename tests/{codegen => codegen-llvm}/issues/issue-93036-assert-index.rs (100%) rename tests/{codegen => codegen-llvm}/issues/issue-96274.rs (100%) rename tests/{codegen => codegen-llvm}/issues/issue-96497-slice-size-nowrap.rs (100%) rename tests/{codegen => codegen-llvm}/issues/issue-98294-get-mut-copy-from-slice-opt.rs (100%) rename tests/{codegen => codegen-llvm}/issues/issue-98678-async.rs (100%) rename tests/{codegen => codegen-llvm}/issues/issue-98678-closure-coroutine.rs (100%) rename tests/{codegen => codegen-llvm}/issues/issue-98678-enum.rs (100%) rename tests/{codegen => codegen-llvm}/issues/issue-98678-struct-union.rs (100%) rename tests/{codegen => codegen-llvm}/issues/issue-99960.rs (100%) rename tests/{codegen => codegen-llvm}/issues/looping-over-ne-bytes-133528.rs (100%) rename tests/{codegen => codegen-llvm}/issues/str-to-string-128690.rs (100%) rename tests/{codegen => codegen-llvm}/iter-repeat-n-trivial-drop.rs (100%) rename tests/{codegen => codegen-llvm}/layout-size-checks.rs (100%) rename tests/{codegen => codegen-llvm}/lib-optimizations/iter-sum.rs (100%) rename tests/{codegen => codegen-llvm}/lib-optimizations/slice_rotate.rs (100%) rename tests/{codegen => codegen-llvm}/lifetime_start_end.rs (100%) rename tests/{codegen => codegen-llvm}/link-dead-code.rs (100%) rename tests/{codegen => codegen-llvm}/link_section.rs (100%) rename tests/{codegen => codegen-llvm}/llvm-ident.rs (100%) rename tests/{codegen => codegen-llvm}/llvm_module_flags.rs (100%) rename tests/{codegen => codegen-llvm}/loads.rs (100%) rename tests/{codegen => codegen-llvm}/local-generics-in-exe-internalized.rs (100%) rename tests/{codegen => codegen-llvm}/loongarch-abi/call-llvm-intrinsics.rs (100%) rename tests/{codegen => codegen-llvm}/loongarch-abi/loongarch64-lp64d-abi.rs (100%) rename tests/{codegen => codegen-llvm}/lto-removes-invokes.rs (100%) rename tests/{codegen => codegen-llvm}/macos/i686-macosx-deployment-target.rs (100%) rename tests/{codegen => codegen-llvm}/macos/i686-no-macosx-deployment-target.rs (100%) rename tests/{codegen => codegen-llvm}/macos/x86_64-macosx-deployment-target.rs (100%) rename tests/{codegen => codegen-llvm}/macos/x86_64-no-macosx-deployment-target.rs (100%) rename tests/{codegen => codegen-llvm}/mainsubprogram.rs (100%) rename tests/{codegen => codegen-llvm}/match-optimized.rs (100%) rename tests/{codegen => codegen-llvm}/match-optimizes-away.rs (100%) rename tests/{codegen => codegen-llvm}/match-unoptimized.rs (100%) rename tests/{codegen => codegen-llvm}/maybeuninit-rvo.rs (100%) rename tests/{codegen => codegen-llvm}/mem-replace-big-type.rs (100%) rename tests/{codegen => codegen-llvm}/mem-replace-simple-type.rs (100%) rename tests/{codegen => codegen-llvm}/merge-functions.rs (100%) rename tests/{codegen => codegen-llvm}/meta-filecheck/check-prefix.rs (100%) rename tests/{codegen => codegen-llvm}/meta-filecheck/filecheck-flags.rs (100%) rename tests/{codegen => codegen-llvm}/meta-filecheck/msvc-prefix-bad.rs (100%) rename tests/{codegen => codegen-llvm}/meta-filecheck/no-directives.rs (100%) rename tests/{codegen => codegen-llvm}/meta-filecheck/revision-prefix.rs (100%) rename tests/{codegen => codegen-llvm}/method-declaration.rs (100%) rename tests/{codegen => codegen-llvm}/min-function-alignment.rs (100%) rename tests/{codegen => codegen-llvm}/mir-aggregate-no-alloca.rs (100%) rename tests/{codegen => codegen-llvm}/mir-inlined-line-numbers.rs (100%) rename tests/{codegen => codegen-llvm}/mir_zst_stores.rs (100%) rename tests/{codegen => codegen-llvm}/move-before-nocapture-ref-arg.rs (100%) rename tests/{codegen => codegen-llvm}/move-operands.rs (100%) rename tests/{codegen => codegen-llvm}/naked-asan.rs (100%) rename tests/{codegen => codegen-llvm}/naked-fn/aligned.rs (100%) rename tests/{codegen => codegen-llvm}/naked-fn/generics.rs (100%) rename tests/{codegen => codegen-llvm}/naked-fn/instruction-set.rs (100%) rename tests/{codegen => codegen-llvm}/naked-fn/min-function-alignment.rs (100%) rename tests/{codegen => codegen-llvm}/naked-fn/naked-functions.rs (100%) rename tests/{codegen => codegen-llvm}/no-alloca-inside-if-false.rs (100%) rename tests/{codegen => codegen-llvm}/no-assumes-on-casts.rs (100%) rename tests/{codegen => codegen-llvm}/no-dllimport-w-cross-lang-lto.rs (100%) rename tests/{codegen => codegen-llvm}/no-jump-tables.rs (100%) rename tests/{codegen => codegen-llvm}/no-plt.rs (100%) rename tests/{codegen => codegen-llvm}/no-redundant-item-monomorphization.rs (100%) rename tests/{codegen => codegen-llvm}/no_builtins-at-crate.rs (100%) rename tests/{codegen => codegen-llvm}/noalias-box-off.rs (100%) rename tests/{codegen => codegen-llvm}/noalias-box.rs (100%) rename tests/{codegen => codegen-llvm}/noalias-flag.rs (100%) rename tests/{codegen => codegen-llvm}/noalias-freeze.rs (100%) rename tests/{codegen => codegen-llvm}/noalias-refcell.rs (100%) rename tests/{codegen => codegen-llvm}/noalias-rwlockreadguard.rs (100%) rename tests/{codegen => codegen-llvm}/noalias-unpin.rs (100%) rename tests/{codegen => codegen-llvm}/non-terminate/infinite-loop-1.rs (100%) rename tests/{codegen => codegen-llvm}/non-terminate/infinite-loop-2.rs (100%) rename tests/{codegen => codegen-llvm}/non-terminate/infinite-recursion.rs (100%) rename tests/{codegen => codegen-llvm}/non-terminate/nonempty-infinite-loop.rs (100%) rename tests/{codegen => codegen-llvm}/noreturn-uninhabited.rs (100%) rename tests/{codegen => codegen-llvm}/noreturnflag.rs (100%) rename tests/{codegen => codegen-llvm}/nounwind.rs (100%) rename tests/{codegen => codegen-llvm}/nrvo.rs (100%) rename tests/{codegen => codegen-llvm}/optimize-attr-1.rs (100%) rename tests/{codegen => codegen-llvm}/option-as-slice.rs (100%) rename tests/{codegen => codegen-llvm}/option-niche-eq.rs (100%) rename tests/{codegen => codegen-llvm}/option-niche-unfixed/option-nonzero-eq.rs (100%) rename tests/{codegen => codegen-llvm}/overaligned-constant.rs (100%) rename tests/{codegen => codegen-llvm}/packed.rs (100%) rename tests/{codegen => codegen-llvm}/panic-abort-windows.rs (100%) rename tests/{codegen => codegen-llvm}/panic-in-drop-abort.rs (100%) rename tests/{codegen => codegen-llvm}/panic-unwind-default-uwtable.rs (100%) rename tests/{codegen => codegen-llvm}/patchable-function-entry/patchable-function-entry-both-flags.rs (100%) rename tests/{codegen => codegen-llvm}/patchable-function-entry/patchable-function-entry-no-flag.rs (100%) rename tests/{codegen => codegen-llvm}/patchable-function-entry/patchable-function-entry-one-flag.rs (100%) rename tests/{codegen => codegen-llvm}/pattern_type_symbols.rs (100%) rename tests/{codegen => codegen-llvm}/personality_lifetimes.rs (100%) rename tests/{codegen => codegen-llvm}/pgo-counter-bias.rs (100%) rename tests/{codegen => codegen-llvm}/pgo-instrumentation.rs (100%) rename tests/{codegen => codegen-llvm}/pic-relocation-model.rs (100%) rename tests/{codegen => codegen-llvm}/pie-relocation-model.rs (100%) rename tests/{codegen => codegen-llvm}/placement-new.rs (100%) rename tests/{codegen => codegen-llvm}/powerpc64le-struct-align-128.rs (100%) rename tests/{codegen => codegen-llvm}/precondition-checks.rs (100%) rename tests/{codegen => codegen-llvm}/ptr-arithmetic.rs (100%) rename tests/{codegen => codegen-llvm}/ptr-read-metadata.rs (100%) rename tests/{codegen => codegen-llvm}/range-attribute.rs (100%) rename tests/{codegen => codegen-llvm}/range-loop.rs (100%) rename tests/{codegen => codegen-llvm}/range_to_inclusive.rs (100%) rename tests/{codegen => codegen-llvm}/refs.rs (100%) rename tests/{codegen => codegen-llvm}/reg-struct-return.rs (100%) rename tests/{codegen => codegen-llvm}/regparm-inreg.rs (100%) rename tests/{codegen => codegen-llvm}/remap_path_prefix/aux_mod.rs (100%) rename tests/{codegen => codegen-llvm}/remap_path_prefix/auxiliary/remap_path_prefix_aux.rs (100%) rename tests/{codegen => codegen-llvm}/remap_path_prefix/auxiliary/xcrate-generic.rs (100%) rename tests/{codegen => codegen-llvm}/remap_path_prefix/issue-73167-remap-std.rs (100%) rename tests/{codegen => codegen-llvm}/remap_path_prefix/main.rs (100%) rename tests/{codegen => codegen-llvm}/remap_path_prefix/xcrate-generic.rs (100%) rename tests/{codegen => codegen-llvm}/repeat-operand-zero-len.rs (100%) rename tests/{codegen => codegen-llvm}/repeat-operand-zst-elem.rs (100%) rename tests/{codegen => codegen-llvm}/repeat-trusted-len.rs (100%) rename tests/{codegen => codegen-llvm}/repr/transparent-byval-struct-ptr.rs (100%) rename tests/{codegen => codegen-llvm}/repr/transparent-imm-array.rs (100%) rename tests/{codegen => codegen-llvm}/repr/transparent-mips64.rs (100%) rename tests/{codegen => codegen-llvm}/repr/transparent-opaque-ptr.rs (100%) rename tests/{codegen => codegen-llvm}/repr/transparent-sparc64.rs (100%) rename tests/{codegen => codegen-llvm}/repr/transparent-sysv64.rs (100%) rename tests/{codegen => codegen-llvm}/repr/transparent.rs (100%) rename tests/{codegen => codegen-llvm}/retpoline.rs (100%) rename tests/{codegen => codegen-llvm}/riscv-abi/call-llvm-intrinsics.rs (100%) rename tests/{codegen => codegen-llvm}/riscv-abi/cast-local-large-enough.rs (100%) rename tests/{codegen => codegen-llvm}/riscv-abi/riscv64-lp64-lp64f-lp64d-abi.rs (100%) rename tests/{codegen => codegen-llvm}/riscv-abi/riscv64-lp64d-abi.rs (100%) rename tests/{codegen => codegen-llvm}/riscv-abi/riscv64-lp64f-lp64d-abi.rs (100%) rename tests/{codegen => codegen-llvm}/riscv-target-abi.rs (100%) rename tests/{codegen => codegen-llvm}/rust-abi-arch-specific-adjustment.rs (100%) rename tests/{codegen => codegen-llvm}/s390x-simd.rs (100%) rename tests/{codegen => codegen-llvm}/sanitizer/aarch64-shadow-call-stack-with-fixed-x18.rs (100%) rename tests/{codegen => codegen-llvm}/sanitizer/address-sanitizer-globals-tracking.rs (100%) rename tests/{codegen => codegen-llvm}/sanitizer/cfi/add-canonical-jump-tables-flag.rs (100%) rename tests/{codegen => codegen-llvm}/sanitizer/cfi/add-cfi-normalize-integers-flag.rs (100%) rename tests/{codegen => codegen-llvm}/sanitizer/cfi/add-enable-split-lto-unit-flag.rs (100%) rename tests/{codegen => codegen-llvm}/sanitizer/cfi/dbg-location-on-cfi-blocks.rs (100%) rename tests/{codegen => codegen-llvm}/sanitizer/cfi/emit-type-checks-attr-no-sanitize.rs (100%) rename tests/{codegen => codegen-llvm}/sanitizer/cfi/emit-type-checks.rs (100%) rename tests/{codegen => codegen-llvm}/sanitizer/cfi/emit-type-metadata-attr-cfi-encoding.rs (100%) rename tests/{codegen => codegen-llvm}/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-const-generics.rs (100%) rename tests/{codegen => codegen-llvm}/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-drop-in-place.rs (100%) rename tests/{codegen => codegen-llvm}/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-function-types.rs (100%) rename tests/{codegen => codegen-llvm}/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-lifetimes.rs (100%) rename tests/{codegen => codegen-llvm}/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-method-secondary-typeid.rs (100%) rename tests/{codegen => codegen-llvm}/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-paths.rs (100%) rename tests/{codegen => codegen-llvm}/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-pointer-types.rs (100%) rename tests/{codegen => codegen-llvm}/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-primitive-types.rs (100%) rename tests/{codegen => codegen-llvm}/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-repr-transparent-types.rs (100%) rename tests/{codegen => codegen-llvm}/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-sequence-types.rs (100%) rename tests/{codegen => codegen-llvm}/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-trait-types.rs (100%) rename tests/{codegen => codegen-llvm}/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-user-defined-types.rs (100%) rename tests/{codegen => codegen-llvm}/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi-generalized.rs (100%) rename tests/{codegen => codegen-llvm}/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi-normalized-generalized.rs (100%) rename tests/{codegen => codegen-llvm}/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi-normalized.rs (100%) rename tests/{codegen => codegen-llvm}/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi.rs (100%) rename tests/{codegen => codegen-llvm}/sanitizer/cfi/emit-type-metadata-trait-objects.rs (100%) rename tests/{codegen => codegen-llvm}/sanitizer/cfi/external_weak_symbols.rs (100%) rename tests/{codegen => codegen-llvm}/sanitizer/cfi/generalize-pointers.rs (100%) rename tests/{codegen => codegen-llvm}/sanitizer/cfi/normalize-integers.rs (100%) rename tests/{codegen => codegen-llvm}/sanitizer/dataflow-instrument-functions.rs (100%) rename tests/{codegen => codegen-llvm}/sanitizer/kasan-emits-instrumentation.rs (100%) rename tests/{codegen => codegen-llvm}/sanitizer/kcfi/add-cfi-normalize-integers-flag.rs (100%) rename tests/{codegen => codegen-llvm}/sanitizer/kcfi/add-kcfi-arity-flag.rs (100%) rename tests/{codegen => codegen-llvm}/sanitizer/kcfi/add-kcfi-flag.rs (100%) rename tests/{codegen => codegen-llvm}/sanitizer/kcfi/add-kcfi-offset-flag.rs (100%) rename tests/{codegen => codegen-llvm}/sanitizer/kcfi/emit-kcfi-operand-bundle-attr-no-sanitize.rs (100%) rename tests/{codegen => codegen-llvm}/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-generalized.rs (100%) rename tests/{codegen => codegen-llvm}/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-normalized-generalized.rs (100%) rename tests/{codegen => codegen-llvm}/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-normalized.rs (100%) rename tests/{codegen => codegen-llvm}/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi.rs (100%) rename tests/{codegen => codegen-llvm}/sanitizer/kcfi/emit-kcfi-operand-bundle.rs (100%) rename tests/{codegen => codegen-llvm}/sanitizer/kcfi/emit-type-metadata-trait-objects.rs (100%) rename tests/{codegen => codegen-llvm}/sanitizer/kcfi/naked-function.rs (100%) rename tests/{codegen => codegen-llvm}/sanitizer/memory-track-origins.rs (100%) rename tests/{codegen => codegen-llvm}/sanitizer/memtag-attr-check.rs (100%) rename tests/{codegen => codegen-llvm}/sanitizer/no-sanitize-inlining.rs (100%) rename tests/{codegen => codegen-llvm}/sanitizer/no-sanitize.rs (100%) rename tests/{codegen => codegen-llvm}/sanitizer/riscv64-shadow-call-stack.rs (100%) rename tests/{codegen => codegen-llvm}/sanitizer/safestack-attr-check.rs (100%) rename tests/{codegen => codegen-llvm}/sanitizer/sanitizer-recover.rs (100%) rename tests/{codegen => codegen-llvm}/sanitizer/scs-attr-check.rs (100%) rename tests/{codegen => codegen-llvm}/scalar-pair-bool.rs (100%) rename tests/{codegen => codegen-llvm}/set-discriminant-invalid.rs (100%) rename tests/{codegen => codegen-llvm}/simd-intrinsic/simd-intrinsic-float-abs.rs (100%) rename tests/{codegen => codegen-llvm}/simd-intrinsic/simd-intrinsic-float-ceil.rs (100%) rename tests/{codegen => codegen-llvm}/simd-intrinsic/simd-intrinsic-float-cos.rs (100%) rename tests/{codegen => codegen-llvm}/simd-intrinsic/simd-intrinsic-float-exp.rs (100%) rename tests/{codegen => codegen-llvm}/simd-intrinsic/simd-intrinsic-float-exp2.rs (100%) rename tests/{codegen => codegen-llvm}/simd-intrinsic/simd-intrinsic-float-floor.rs (100%) rename tests/{codegen => codegen-llvm}/simd-intrinsic/simd-intrinsic-float-fma.rs (100%) rename tests/{codegen => codegen-llvm}/simd-intrinsic/simd-intrinsic-float-fsqrt.rs (100%) rename tests/{codegen => codegen-llvm}/simd-intrinsic/simd-intrinsic-float-log.rs (100%) rename tests/{codegen => codegen-llvm}/simd-intrinsic/simd-intrinsic-float-log10.rs (100%) rename tests/{codegen => codegen-llvm}/simd-intrinsic/simd-intrinsic-float-log2.rs (100%) rename tests/{codegen => codegen-llvm}/simd-intrinsic/simd-intrinsic-float-minmax.rs (100%) rename tests/{codegen => codegen-llvm}/simd-intrinsic/simd-intrinsic-float-sin.rs (100%) rename tests/{codegen => codegen-llvm}/simd-intrinsic/simd-intrinsic-generic-arithmetic-saturating.rs (100%) rename tests/{codegen => codegen-llvm}/simd-intrinsic/simd-intrinsic-generic-bitmask.rs (100%) rename tests/{codegen => codegen-llvm}/simd-intrinsic/simd-intrinsic-generic-gather.rs (100%) rename tests/{codegen => codegen-llvm}/simd-intrinsic/simd-intrinsic-generic-masked-load.rs (100%) rename tests/{codegen => codegen-llvm}/simd-intrinsic/simd-intrinsic-generic-masked-store.rs (100%) rename tests/{codegen => codegen-llvm}/simd-intrinsic/simd-intrinsic-generic-scatter.rs (100%) rename tests/{codegen => codegen-llvm}/simd-intrinsic/simd-intrinsic-generic-select.rs (100%) rename tests/{codegen => codegen-llvm}/simd-intrinsic/simd-intrinsic-mask-reduce.rs (100%) rename tests/{codegen => codegen-llvm}/simd-intrinsic/simd-intrinsic-transmute-array.rs (100%) rename tests/{codegen => codegen-llvm}/simd/aggregate-simd.rs (100%) rename tests/{codegen => codegen-llvm}/simd/extract-insert-dyn.rs (100%) rename tests/{codegen => codegen-llvm}/simd/packed-simd-alignment.rs (100%) rename tests/{codegen => codegen-llvm}/simd/packed-simd.rs (100%) rename tests/{codegen => codegen-llvm}/simd/simd-wide-sum.rs (100%) rename tests/{codegen => codegen-llvm}/simd/simd_arith_offset.rs (100%) rename tests/{codegen => codegen-llvm}/simd/swap-simd-types.rs (100%) rename tests/{codegen => codegen-llvm}/simd/unpadded-simd.rs (100%) rename tests/{codegen => codegen-llvm}/skip-mono-inside-if-false.rs (100%) rename tests/{codegen => codegen-llvm}/slice-as_chunks.rs (100%) rename tests/{codegen => codegen-llvm}/slice-indexing.rs (100%) rename tests/{codegen => codegen-llvm}/slice-init.rs (100%) rename tests/{codegen => codegen-llvm}/slice-is-ascii.rs (100%) rename tests/{codegen => codegen-llvm}/slice-iter-fold.rs (100%) rename tests/{codegen => codegen-llvm}/slice-iter-len-eq-zero.rs (100%) rename tests/{codegen => codegen-llvm}/slice-iter-nonnull.rs (100%) rename tests/{codegen => codegen-llvm}/slice-last-elements-optimization.rs (100%) rename tests/{codegen => codegen-llvm}/slice-pointer-nonnull-unwrap.rs (100%) rename tests/{codegen => codegen-llvm}/slice-position-bounds-check.rs (100%) rename tests/{codegen => codegen-llvm}/slice-ref-equality.rs (100%) rename tests/{codegen => codegen-llvm}/slice-reverse.rs (100%) rename tests/{codegen => codegen-llvm}/slice-split-at.rs (100%) rename tests/{codegen => codegen-llvm}/slice-windows-no-bounds-check.rs (100%) rename tests/{codegen => codegen-llvm}/slice_as_from_ptr_range.rs (100%) rename tests/{codegen => codegen-llvm}/some-abis-do-extend-params-to-32-bits.rs (100%) rename tests/{codegen => codegen-llvm}/some-global-nonnull.rs (100%) rename tests/{codegen => codegen-llvm}/sparc-struct-abi.rs (100%) rename tests/{codegen => codegen-llvm}/split-lto-unit.rs (100%) rename tests/{codegen => codegen-llvm}/src-hash-algorithm/src-hash-algorithm-md5.rs (100%) rename tests/{codegen => codegen-llvm}/src-hash-algorithm/src-hash-algorithm-sha1.rs (100%) rename tests/{codegen => codegen-llvm}/src-hash-algorithm/src-hash-algorithm-sha256.rs (100%) rename tests/{codegen => codegen-llvm}/sroa-fragment-debuginfo.rs (100%) rename tests/{codegen => codegen-llvm}/sse42-implies-crc32.rs (100%) rename tests/{codegen => codegen-llvm}/stack-probes-inline.rs (100%) rename tests/{codegen => codegen-llvm}/stack-protector.rs (100%) rename tests/{codegen => codegen-llvm}/static-relocation-model-msvc.rs (100%) rename tests/{codegen => codegen-llvm}/staticlib-external-inline-fns.rs (100%) rename tests/{codegen => codegen-llvm}/step_by-overflow-checks.rs (100%) rename tests/{codegen => codegen-llvm}/stores.rs (100%) rename tests/{codegen => codegen-llvm}/string-push.rs (100%) rename tests/{codegen => codegen-llvm}/swap-large-types.rs (100%) rename tests/{codegen => codegen-llvm}/swap-small-types.rs (100%) rename tests/{codegen => codegen-llvm}/target-cpu-on-functions.rs (100%) rename tests/{codegen => codegen-llvm}/target-feature-inline-closure.rs (100%) rename tests/{codegen => codegen-llvm}/target-feature-negative-implication.rs (100%) rename tests/{codegen => codegen-llvm}/target-feature-overrides.rs (100%) rename tests/{codegen => codegen-llvm}/terminating-catchpad.rs (100%) rename tests/{codegen => codegen-llvm}/thread-local.rs (100%) rename tests/{codegen => codegen-llvm}/tied-features-strength.rs (100%) rename tests/{codegen => codegen-llvm}/to_vec.rs (100%) rename tests/{codegen => codegen-llvm}/trailing_zeros.rs (100%) rename tests/{codegen => codegen-llvm}/transmute-optimized.rs (100%) rename tests/{codegen => codegen-llvm}/transmute-scalar.rs (100%) rename tests/{codegen => codegen-llvm}/try_question_mark_nop.rs (100%) rename tests/{codegen => codegen-llvm}/tune-cpu-on-functions.rs (100%) rename tests/{codegen => codegen-llvm}/tuple-layout-opt.rs (100%) rename tests/{codegen => codegen-llvm}/ub-checks.rs (100%) rename tests/{codegen => codegen-llvm}/unchecked-float-casts.rs (100%) rename tests/{codegen => codegen-llvm}/unchecked_shifts.rs (100%) rename tests/{codegen => codegen-llvm}/uninhabited-transparent-return-abi.rs (100%) rename tests/{codegen => codegen-llvm}/uninit-consts.rs (100%) rename tests/{codegen => codegen-llvm}/uninit-repeat-in-aggregate.rs (100%) rename tests/{codegen => codegen-llvm}/union-abi.rs (100%) rename tests/{codegen => codegen-llvm}/union-aggregate.rs (100%) rename tests/{codegen => codegen-llvm}/unwind-abis/aapcs-unwind-abi.rs (100%) rename tests/{codegen => codegen-llvm}/unwind-abis/c-unwind-abi-panic-abort.rs (100%) rename tests/{codegen => codegen-llvm}/unwind-abis/c-unwind-abi.rs (100%) rename tests/{codegen => codegen-llvm}/unwind-abis/cdecl-unwind-abi.rs (100%) rename tests/{codegen => codegen-llvm}/unwind-abis/fastcall-unwind-abi.rs (100%) rename tests/{codegen => codegen-llvm}/unwind-abis/nounwind-on-stable-panic-abort.rs (100%) rename tests/{codegen => codegen-llvm}/unwind-abis/nounwind.rs (100%) rename tests/{codegen => codegen-llvm}/unwind-abis/stdcall-unwind-abi.rs (100%) rename tests/{codegen => codegen-llvm}/unwind-abis/system-unwind-abi.rs (100%) rename tests/{codegen => codegen-llvm}/unwind-abis/sysv64-unwind-abi.rs (100%) rename tests/{codegen => codegen-llvm}/unwind-abis/thiscall-unwind-abi.rs (100%) rename tests/{codegen => codegen-llvm}/unwind-abis/vectorcall-unwind-abi.rs (100%) rename tests/{codegen => codegen-llvm}/unwind-abis/win64-unwind-abi.rs (100%) rename tests/{codegen => codegen-llvm}/unwind-and-panic-abort.rs (100%) rename tests/{codegen => codegen-llvm}/unwind-extern-exports.rs (100%) rename tests/{codegen => codegen-llvm}/unwind-extern-imports.rs (100%) rename tests/{codegen => codegen-llvm}/unwind-landingpad-cold.rs (100%) rename tests/{codegen => codegen-llvm}/unwind-landingpad-inline.rs (100%) rename tests/{codegen => codegen-llvm}/used_with_arg.rs (100%) rename tests/{codegen => codegen-llvm}/var-names.rs (100%) rename tests/{codegen => codegen-llvm}/vec-as-ptr.rs (100%) rename tests/{codegen => codegen-llvm}/vec-calloc.rs (100%) rename tests/{codegen => codegen-llvm}/vec-in-place.rs (100%) rename tests/{codegen => codegen-llvm}/vec-iter-collect-len.rs (100%) rename tests/{codegen => codegen-llvm}/vec-iter.rs (100%) rename tests/{codegen => codegen-llvm}/vec-len-invariant.rs (100%) rename tests/{codegen => codegen-llvm}/vec-optimizes-away.rs (100%) rename tests/{codegen => codegen-llvm}/vec-reserve-extend.rs (100%) rename tests/{codegen => codegen-llvm}/vec-shrink-panik.rs (100%) rename tests/{codegen => codegen-llvm}/vec-with-capacity.rs (100%) rename tests/{codegen => codegen-llvm}/vec_pop_push_noop.rs (100%) rename tests/{codegen => codegen-llvm}/vecdeque-drain.rs (100%) rename tests/{codegen => codegen-llvm}/vecdeque-nonempty-get-no-panic.rs (100%) rename tests/{codegen => codegen-llvm}/vecdeque_no_panic.rs (100%) rename tests/{codegen => codegen-llvm}/vecdeque_pop_push.rs (100%) rename tests/{codegen => codegen-llvm}/virtual-call-attrs-issue-137646.rs (100%) rename tests/{codegen => codegen-llvm}/virtual-function-elimination-32bit.rs (100%) rename tests/{codegen => codegen-llvm}/virtual-function-elimination.rs (100%) rename tests/{codegen => codegen-llvm}/vtable-loads.rs (100%) rename tests/{codegen => codegen-llvm}/vtable-upcast.rs (100%) rename tests/{codegen => codegen-llvm}/wasm_casts_trapping.rs (100%) rename tests/{codegen => codegen-llvm}/wasm_exceptions.rs (100%) rename tests/{codegen => codegen-llvm}/zip.rs (100%) rename tests/{codegen => codegen-llvm}/zst-offset.rs (100%) diff --git a/compiler/rustc_codegen_ssa/src/mir/rvalue.rs b/compiler/rustc_codegen_ssa/src/mir/rvalue.rs index e872f8434e56..610e2fd23111 100644 --- a/compiler/rustc_codegen_ssa/src/mir/rvalue.rs +++ b/compiler/rustc_codegen_ssa/src/mir/rvalue.rs @@ -869,7 +869,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { let ltext = bx.zext(is_lt, bx.type_i8()); bx.unchecked_ssub(gtext, ltext) } else { - // These operations are those expected by `tests/codegen/integer-cmp.rs`, + // These operations are those expected by `tests/codegen-llvm/integer-cmp.rs`, // from . let is_lt = bx.icmp(pred(mir::BinOp::Lt), lhs, rhs); let is_ne = bx.icmp(pred(mir::BinOp::Ne), lhs, rhs); diff --git a/compiler/rustc_mir_transform/src/unreachable_prop.rs b/compiler/rustc_mir_transform/src/unreachable_prop.rs index 13fb5b3e56f2..c417a9272f2a 100644 --- a/compiler/rustc_mir_transform/src/unreachable_prop.rs +++ b/compiler/rustc_mir_transform/src/unreachable_prop.rs @@ -75,7 +75,7 @@ fn remove_successors_from_switch<'tcx>( let is_unreachable = |bb| unreachable_blocks.contains(&bb); // If there are multiple targets, we want to keep information about reachability for codegen. - // For example (see tests/codegen/match-optimizes-away.rs) + // For example (see tests/codegen-llvm/match-optimizes-away.rs) // // pub enum Two { A, B } // pub fn identity(x: Two) -> Two { diff --git a/library/alloc/src/collections/vec_deque/drain.rs b/library/alloc/src/collections/vec_deque/drain.rs index 44fcef4ed7dc..321621d18be9 100644 --- a/library/alloc/src/collections/vec_deque/drain.rs +++ b/library/alloc/src/collections/vec_deque/drain.rs @@ -192,7 +192,7 @@ impl Drop for Drain<'_, T, A> { // this branch is never taken. // We use `#[cold]` instead of `#[inline(never)]`, because inlining this // function into the general case (`.drain(n..m)`) is fine. - // See `tests/codegen/vecdeque-drain.rs` for a test. + // See `tests/codegen-llvm/vecdeque-drain.rs` for a test. #[cold] fn join_head_and_tail_wrapping( source_deque: &mut VecDeque, diff --git a/library/alloc/src/raw_vec/mod.rs b/library/alloc/src/raw_vec/mod.rs index 3e006a2d1bdf..40716755aad3 100644 --- a/library/alloc/src/raw_vec/mod.rs +++ b/library/alloc/src/raw_vec/mod.rs @@ -761,7 +761,7 @@ impl RawVecInner { } // not marked inline(never) since we want optimizers to be able to observe the specifics of this -// function, see tests/codegen/vec-reserve-extend.rs. +// function, see tests/codegen-llvm/vec-reserve-extend.rs. #[cold] fn finish_grow( new_layout: Layout, diff --git a/rustfmt.toml b/rustfmt.toml index 689e390b990c..6172a2bb3bf9 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -14,7 +14,7 @@ ignore = [ "/vendor/", # Some tests are not formatted, for various reasons. - "/tests/codegen/simd-intrinsic/", # Many types like `u8x64` are better hand-formatted. + "/tests/codegen-llvm/simd-intrinsic/", # Many types like `u8x64` are better hand-formatted. "/tests/crashes/", # Many of these tests contain syntax errors. "/tests/debuginfo/", # These tests are somewhat sensitive to source code layout. "/tests/incremental/", # These tests are somewhat sensitive to source code layout. @@ -58,5 +58,5 @@ ignore = [ # Rustfmt doesn't support use closures yet "tests/mir-opt/ergonomic-clones/closure.rs", - "tests/codegen/ergonomic-clones/closure.rs", + "tests/codegen-llvm/ergonomic-clones/closure.rs", ] diff --git a/src/bootstrap/src/core/build_steps/test.rs b/src/bootstrap/src/core/build_steps/test.rs index 99c9e8ae92eb..d346062761c1 100644 --- a/src/bootstrap/src/core/build_steps/test.rs +++ b/src/bootstrap/src/core/build_steps/test.rs @@ -1342,7 +1342,12 @@ test!(Ui { path: "tests/ui", mode: "ui", suite: "ui", default: true }); test!(Crashes { path: "tests/crashes", mode: "crashes", suite: "crashes", default: true }); -test!(Codegen { path: "tests/codegen", mode: "codegen", suite: "codegen", default: true }); +test!(CodegenLlvm { + path: "tests/codegen-llvm", + mode: "codegen", + suite: "codegen-llvm", + default: true +}); test!(CodegenUnits { path: "tests/codegen-units", @@ -1620,7 +1625,7 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the let suite_path = self.path; // Skip codegen tests if they aren't enabled in configuration. - if !builder.config.codegen_tests && suite == "codegen" { + if !builder.config.codegen_tests && mode == "codegen" { return; } @@ -1817,7 +1822,7 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the let mut flags = if is_rustdoc { Vec::new() } else { vec!["-Crpath".to_string()] }; flags.push(format!( "-Cdebuginfo={}", - if suite == "codegen" { + if mode == "codegen" { // codegen tests typically check LLVM IR and are sensitive to additional debuginfo. // So do not apply `rust.debuginfo-level-tests` for codegen tests. if builder.config.rust_debuginfo_level_tests diff --git a/src/bootstrap/src/core/builder/mod.rs b/src/bootstrap/src/core/builder/mod.rs index 925e47a41644..923c3a9a9350 100644 --- a/src/bootstrap/src/core/builder/mod.rs +++ b/src/bootstrap/src/core/builder/mod.rs @@ -412,7 +412,7 @@ const PATH_REMAP: &[(&str, &[&str])] = &[ &[ // tidy-alphabetical-start "tests/assembly-llvm", - "tests/codegen", + "tests/codegen-llvm", "tests/codegen-units", "tests/coverage", "tests/coverage-run-rustdoc", @@ -1049,7 +1049,7 @@ impl<'a> Builder<'a> { test::Crashes, test::Coverage, test::MirOpt, - test::Codegen, + test::CodegenLlvm, test::CodegenUnits, test::AssemblyLlvm, test::Incremental, diff --git a/src/ci/docker/host-x86_64/test-various/Dockerfile b/src/ci/docker/host-x86_64/test-various/Dockerfile index 54ca7131608e..4d09bea69c08 100644 --- a/src/ci/docker/host-x86_64/test-various/Dockerfile +++ b/src/ci/docker/host-x86_64/test-various/Dockerfile @@ -65,7 +65,7 @@ ENV WASM_SCRIPT python3 /checkout/x.py --stage 2 test --host='' --target $WASM_T tests/ui \ tests/mir-opt \ tests/codegen-units \ - tests/codegen \ + tests/codegen-llvm \ tests/assembly-llvm \ library/core diff --git a/src/doc/rustc-dev-guide/src/asm.md b/src/doc/rustc-dev-guide/src/asm.md index 3d93d5a4c57e..1bb493e73d58 100644 --- a/src/doc/rustc-dev-guide/src/asm.md +++ b/src/doc/rustc-dev-guide/src/asm.md @@ -157,7 +157,7 @@ Various tests for inline assembly are available: - `tests/assembly-llvm/asm` - `tests/ui/asm` -- `tests/codegen/asm-*` +- `tests/codegen-llvm/asm-*` Every architecture supported by inline assembly must have exhaustive tests in `tests/assembly-llvm/asm` which test all combinations of register classes and types. diff --git a/src/doc/rustc-dev-guide/src/autodiff/installation.md b/src/doc/rustc-dev-guide/src/autodiff/installation.md index a550f6d233eb..ddbb3a054241 100644 --- a/src/doc/rustc-dev-guide/src/autodiff/installation.md +++ b/src/doc/rustc-dev-guide/src/autodiff/installation.md @@ -25,7 +25,7 @@ rustup toolchain install nightly # enables -Z unstable-options You can then run our test cases: ```bash -./x test --stage 1 tests/codegen/autodiff +./x test --stage 1 tests/codegen-llvm/autodiff ./x test --stage 1 tests/pretty/autodiff ./x test --stage 1 tests/ui/autodiff ./x test --stage 1 tests/ui/feature-gates/feature-gate-autodiff.rs diff --git a/src/doc/rustc-dev-guide/src/llvm-coverage-instrumentation.md b/src/doc/rustc-dev-guide/src/llvm-coverage-instrumentation.md index 28e0e7a908d6..880363b94bf2 100644 --- a/src/doc/rustc-dev-guide/src/llvm-coverage-instrumentation.md +++ b/src/doc/rustc-dev-guide/src/llvm-coverage-instrumentation.md @@ -117,7 +117,7 @@ human-readable coverage report. > directive, so they will be skipped if the profiler runtime has not been > [enabled in `bootstrap.toml`](#recommended-configtoml-settings). -Finally, the [`tests/codegen/instrument-coverage/testprog.rs`] test compiles a simple Rust program +Finally, the [`tests/codegen-llvm/instrument-coverage/testprog.rs`] test compiles a simple Rust program with `-C instrument-coverage` and compares the compiled program's LLVM IR to expected LLVM IR instructions and structured data for a coverage-enabled program, including various checks for Coverage Map-related metadata and the LLVM @@ -136,4 +136,4 @@ and `mir-opt` tests can be refreshed by running: [`tests/coverage`]: https://github.com/rust-lang/rust/tree/master/tests/coverage [`src/tools/coverage-dump`]: https://github.com/rust-lang/rust/tree/master/src/tools/coverage-dump [`tests/coverage-run-rustdoc`]: https://github.com/rust-lang/rust/tree/master/tests/coverage-run-rustdoc -[`tests/codegen/instrument-coverage/testprog.rs`]: https://github.com/rust-lang/rust/blob/master/tests/mir-opt/coverage/instrument_coverage.rs +[`tests/codegen-llvm/instrument-coverage/testprog.rs`]: https://github.com/rust-lang/rust/blob/master/tests/mir-opt/coverage/instrument_coverage.rs diff --git a/src/doc/rustc-dev-guide/src/offload/installation.md b/src/doc/rustc-dev-guide/src/offload/installation.md index 1962314c70ac..1e792de3c8ce 100644 --- a/src/doc/rustc-dev-guide/src/offload/installation.md +++ b/src/doc/rustc-dev-guide/src/offload/installation.md @@ -40,7 +40,7 @@ This gives you a working LLVM build. ## Testing run ``` -./x test --stage 1 tests/codegen/gpu_offload +./x test --stage 1 tests/codegen-llvm/gpu_offload ``` ## Usage diff --git a/src/doc/rustc-dev-guide/src/profile-guided-optimization.md b/src/doc/rustc-dev-guide/src/profile-guided-optimization.md index d279786ac45e..2fa810210451 100644 --- a/src/doc/rustc-dev-guide/src/profile-guided-optimization.md +++ b/src/doc/rustc-dev-guide/src/profile-guided-optimization.md @@ -132,7 +132,7 @@ There is also a [codegen test][codegen-test] that checks that some expected instrumentation artifacts show up in LLVM IR. [rmake-tests]: https://github.com/rust-lang/rust/tree/master/tests/run-make -[codegen-test]: https://github.com/rust-lang/rust/blob/master/tests/codegen/pgo-instrumentation.rs +[codegen-test]: https://github.com/rust-lang/rust/blob/master/tests/codegen-llvm/pgo-instrumentation.rs ## Additional information diff --git a/src/doc/rustc-dev-guide/src/sanitizers.md b/src/doc/rustc-dev-guide/src/sanitizers.md index 664b4feac4f0..29d9056c15d0 100644 --- a/src/doc/rustc-dev-guide/src/sanitizers.md +++ b/src/doc/rustc-dev-guide/src/sanitizers.md @@ -76,7 +76,7 @@ implementation: ## Testing sanitizers Sanitizers are validated by code generation tests in -[`tests/codegen/sanitize*.rs`][test-cg] and end-to-end functional tests in +[`tests/codegen-llvm/sanitize*.rs`][test-cg] and end-to-end functional tests in [`tests/ui/sanitizer/`][test-ui] directory. Testing sanitizer functionality requires the sanitizer runtimes (built when @@ -85,7 +85,7 @@ sanitizer. When sanitizer is unsupported on given target, sanitizers tests will be ignored. This behaviour is controlled by compiletest `needs-sanitizer-*` directives. -[test-cg]: https://github.com/rust-lang/rust/tree/master/tests/codegen +[test-cg]: https://github.com/rust-lang/rust/tree/master/tests/codegen-llvm [test-ui]: https://github.com/rust-lang/rust/tree/master/tests/ui/sanitizer ## Enabling sanitizer on a new target diff --git a/src/doc/rustc-dev-guide/src/tests/compiletest.md b/src/doc/rustc-dev-guide/src/tests/compiletest.md index 6a60e7118d38..a108dfdef9b3 100644 --- a/src/doc/rustc-dev-guide/src/tests/compiletest.md +++ b/src/doc/rustc-dev-guide/src/tests/compiletest.md @@ -68,7 +68,7 @@ The following test suites are available, with links for more information: | [`pretty`](#pretty-printer-tests) | Check pretty printing | | [`incremental`](#incremental-tests) | Check incremental compilation behavior | | [`debuginfo`](#debuginfo-tests) | Check debuginfo generation running debuggers | -| [`codegen`](#codegen-tests) | Check code generation | +| [`codegen-*`](#codegen-tests) | Check code generation | | [`codegen-units`](#codegen-units-tests) | Check codegen unit partitioning | | [`assembly`](#assembly-tests) | Check assembly output | | [`mir-opt`](#mir-opt-tests) | Check MIR generation and optimizations | @@ -290,7 +290,7 @@ For example, `./x test tests/debuginfo -- --debugger gdb` will only test GDB com ### Codegen tests -The tests in [`tests/codegen`] test LLVM code generation. They compile the test +The tests in [`tests/codegen-llvm`] test LLVM code generation. They compile the test with the `--emit=llvm-ir` flag to emit LLVM IR. They then run the LLVM [FileCheck] tool. The test is annotated with various `// CHECK` comments to check the generated code. See the [FileCheck] documentation for a tutorial and @@ -301,7 +301,7 @@ See also the [assembly tests](#assembly-tests) for a similar set of tests. If you need to work with `#![no_std]` cross-compiling tests, consult the [`minicore` test auxiliary](./minicore.md) chapter. -[`tests/codegen`]: https://github.com/rust-lang/rust/tree/master/tests/codegen +[`tests/codegen-llvm`]: https://github.com/rust-lang/rust/tree/master/tests/codegen-llvm [FileCheck]: https://llvm.org/docs/CommandGuide/FileCheck.html diff --git a/src/tools/opt-dist/src/tests.rs b/src/tools/opt-dist/src/tests.rs index a70c257e52bf..c9a21fc6fb29 100644 --- a/src/tools/opt-dist/src/tests.rs +++ b/src/tools/opt-dist/src/tests.rs @@ -101,7 +101,7 @@ llvm-config = "{llvm_config}" "--stage", "0", "tests/assembly-llvm", - "tests/codegen", + "tests/codegen-llvm", "tests/codegen-units", "tests/incremental", "tests/mir-opt", diff --git a/tests/assembly-llvm/target-feature-multiple.rs b/tests/assembly-llvm/target-feature-multiple.rs index bc432d219317..9a941c52bdac 100644 --- a/tests/assembly-llvm/target-feature-multiple.rs +++ b/tests/assembly-llvm/target-feature-multiple.rs @@ -15,7 +15,7 @@ // > LLVM ERROR: Cannot select: 0x7f00f400c010: i32,i32,ch = X86ISD::RDSEED 0x7f00f400bfa8:2 // > In function: foo // -// See also tests/codegen/target-feature-overrides.rs +// See also tests/codegen-llvm/target-feature-overrides.rs #![feature(no_core, lang_items, link_llvm_intrinsics, abi_unadjusted)] #![crate_type = "lib"] #![no_core] diff --git a/tests/codegen/README.md b/tests/codegen-llvm/README.md similarity index 100% rename from tests/codegen/README.md rename to tests/codegen-llvm/README.md diff --git a/tests/codegen/aarch64-softfloat.rs b/tests/codegen-llvm/aarch64-softfloat.rs similarity index 100% rename from tests/codegen/aarch64-softfloat.rs rename to tests/codegen-llvm/aarch64-softfloat.rs diff --git a/tests/codegen/aarch64-struct-align-128.rs b/tests/codegen-llvm/aarch64-struct-align-128.rs similarity index 100% rename from tests/codegen/aarch64-struct-align-128.rs rename to tests/codegen-llvm/aarch64-struct-align-128.rs diff --git a/tests/codegen/abi-efiapi.rs b/tests/codegen-llvm/abi-efiapi.rs similarity index 100% rename from tests/codegen/abi-efiapi.rs rename to tests/codegen-llvm/abi-efiapi.rs diff --git a/tests/codegen/abi-main-signature-16bit-c-int.rs b/tests/codegen-llvm/abi-main-signature-16bit-c-int.rs similarity index 100% rename from tests/codegen/abi-main-signature-16bit-c-int.rs rename to tests/codegen-llvm/abi-main-signature-16bit-c-int.rs diff --git a/tests/codegen/abi-main-signature-32bit-c-int.rs b/tests/codegen-llvm/abi-main-signature-32bit-c-int.rs similarity index 100% rename from tests/codegen/abi-main-signature-32bit-c-int.rs rename to tests/codegen-llvm/abi-main-signature-32bit-c-int.rs diff --git a/tests/codegen/abi-repr-ext.rs b/tests/codegen-llvm/abi-repr-ext.rs similarity index 100% rename from tests/codegen/abi-repr-ext.rs rename to tests/codegen-llvm/abi-repr-ext.rs diff --git a/tests/codegen/abi-sysv64.rs b/tests/codegen-llvm/abi-sysv64.rs similarity index 100% rename from tests/codegen/abi-sysv64.rs rename to tests/codegen-llvm/abi-sysv64.rs diff --git a/tests/codegen/abi-win64-zst.rs b/tests/codegen-llvm/abi-win64-zst.rs similarity index 100% rename from tests/codegen/abi-win64-zst.rs rename to tests/codegen-llvm/abi-win64-zst.rs diff --git a/tests/codegen/abi-x86-interrupt.rs b/tests/codegen-llvm/abi-x86-interrupt.rs similarity index 100% rename from tests/codegen/abi-x86-interrupt.rs rename to tests/codegen-llvm/abi-x86-interrupt.rs diff --git a/tests/codegen/abi-x86-sse.rs b/tests/codegen-llvm/abi-x86-sse.rs similarity index 100% rename from tests/codegen/abi-x86-sse.rs rename to tests/codegen-llvm/abi-x86-sse.rs diff --git a/tests/codegen/abi-x86_64_sysv.rs b/tests/codegen-llvm/abi-x86_64_sysv.rs similarity index 100% rename from tests/codegen/abi-x86_64_sysv.rs rename to tests/codegen-llvm/abi-x86_64_sysv.rs diff --git a/tests/codegen/addr-of-mutate.rs b/tests/codegen-llvm/addr-of-mutate.rs similarity index 100% rename from tests/codegen/addr-of-mutate.rs rename to tests/codegen-llvm/addr-of-mutate.rs diff --git a/tests/codegen/adjustments.rs b/tests/codegen-llvm/adjustments.rs similarity index 100% rename from tests/codegen/adjustments.rs rename to tests/codegen-llvm/adjustments.rs diff --git a/tests/codegen/align-byval-alignment-mismatch.rs b/tests/codegen-llvm/align-byval-alignment-mismatch.rs similarity index 100% rename from tests/codegen/align-byval-alignment-mismatch.rs rename to tests/codegen-llvm/align-byval-alignment-mismatch.rs diff --git a/tests/codegen/align-byval-vector.rs b/tests/codegen-llvm/align-byval-vector.rs similarity index 100% rename from tests/codegen/align-byval-vector.rs rename to tests/codegen-llvm/align-byval-vector.rs diff --git a/tests/codegen/align-byval.rs b/tests/codegen-llvm/align-byval.rs similarity index 100% rename from tests/codegen/align-byval.rs rename to tests/codegen-llvm/align-byval.rs diff --git a/tests/codegen/align-enum.rs b/tests/codegen-llvm/align-enum.rs similarity index 100% rename from tests/codegen/align-enum.rs rename to tests/codegen-llvm/align-enum.rs diff --git a/tests/codegen/align-fn.rs b/tests/codegen-llvm/align-fn.rs similarity index 100% rename from tests/codegen/align-fn.rs rename to tests/codegen-llvm/align-fn.rs diff --git a/tests/codegen/align-offset.rs b/tests/codegen-llvm/align-offset.rs similarity index 100% rename from tests/codegen/align-offset.rs rename to tests/codegen-llvm/align-offset.rs diff --git a/tests/codegen/align-struct.rs b/tests/codegen-llvm/align-struct.rs similarity index 100% rename from tests/codegen/align-struct.rs rename to tests/codegen-llvm/align-struct.rs diff --git a/tests/codegen/alloc-optimisation.rs b/tests/codegen-llvm/alloc-optimisation.rs similarity index 100% rename from tests/codegen/alloc-optimisation.rs rename to tests/codegen-llvm/alloc-optimisation.rs diff --git a/tests/codegen/amdgpu-addrspacecast.rs b/tests/codegen-llvm/amdgpu-addrspacecast.rs similarity index 100% rename from tests/codegen/amdgpu-addrspacecast.rs rename to tests/codegen-llvm/amdgpu-addrspacecast.rs diff --git a/tests/codegen/array-clone.rs b/tests/codegen-llvm/array-clone.rs similarity index 100% rename from tests/codegen/array-clone.rs rename to tests/codegen-llvm/array-clone.rs diff --git a/tests/codegen/array-cmp.rs b/tests/codegen-llvm/array-cmp.rs similarity index 100% rename from tests/codegen/array-cmp.rs rename to tests/codegen-llvm/array-cmp.rs diff --git a/tests/codegen/array-codegen.rs b/tests/codegen-llvm/array-codegen.rs similarity index 100% rename from tests/codegen/array-codegen.rs rename to tests/codegen-llvm/array-codegen.rs diff --git a/tests/codegen/array-equality.rs b/tests/codegen-llvm/array-equality.rs similarity index 100% rename from tests/codegen/array-equality.rs rename to tests/codegen-llvm/array-equality.rs diff --git a/tests/codegen/array-from_fn.rs b/tests/codegen-llvm/array-from_fn.rs similarity index 100% rename from tests/codegen/array-from_fn.rs rename to tests/codegen-llvm/array-from_fn.rs diff --git a/tests/codegen/array-map.rs b/tests/codegen-llvm/array-map.rs similarity index 100% rename from tests/codegen/array-map.rs rename to tests/codegen-llvm/array-map.rs diff --git a/tests/codegen/array-optimized.rs b/tests/codegen-llvm/array-optimized.rs similarity index 100% rename from tests/codegen/array-optimized.rs rename to tests/codegen-llvm/array-optimized.rs diff --git a/tests/codegen/array-repeat.rs b/tests/codegen-llvm/array-repeat.rs similarity index 100% rename from tests/codegen/array-repeat.rs rename to tests/codegen-llvm/array-repeat.rs diff --git a/tests/codegen/ascii-char.rs b/tests/codegen-llvm/ascii-char.rs similarity index 100% rename from tests/codegen/ascii-char.rs rename to tests/codegen-llvm/ascii-char.rs diff --git a/tests/codegen/asm/aarch64-clobbers.rs b/tests/codegen-llvm/asm/aarch64-clobbers.rs similarity index 100% rename from tests/codegen/asm/aarch64-clobbers.rs rename to tests/codegen-llvm/asm/aarch64-clobbers.rs diff --git a/tests/codegen/asm/avr-clobbers.rs b/tests/codegen-llvm/asm/avr-clobbers.rs similarity index 100% rename from tests/codegen/asm/avr-clobbers.rs rename to tests/codegen-llvm/asm/avr-clobbers.rs diff --git a/tests/codegen/asm/bpf-clobbers.rs b/tests/codegen-llvm/asm/bpf-clobbers.rs similarity index 100% rename from tests/codegen/asm/bpf-clobbers.rs rename to tests/codegen-llvm/asm/bpf-clobbers.rs diff --git a/tests/codegen/asm/critical.rs b/tests/codegen-llvm/asm/critical.rs similarity index 100% rename from tests/codegen/asm/critical.rs rename to tests/codegen-llvm/asm/critical.rs diff --git a/tests/codegen/asm/csky-clobbers.rs b/tests/codegen-llvm/asm/csky-clobbers.rs similarity index 100% rename from tests/codegen/asm/csky-clobbers.rs rename to tests/codegen-llvm/asm/csky-clobbers.rs diff --git a/tests/codegen/asm/foo.s b/tests/codegen-llvm/asm/foo.s similarity index 100% rename from tests/codegen/asm/foo.s rename to tests/codegen-llvm/asm/foo.s diff --git a/tests/codegen/asm/global_asm.rs b/tests/codegen-llvm/asm/global_asm.rs similarity index 100% rename from tests/codegen/asm/global_asm.rs rename to tests/codegen-llvm/asm/global_asm.rs diff --git a/tests/codegen/asm/global_asm_include.rs b/tests/codegen-llvm/asm/global_asm_include.rs similarity index 100% rename from tests/codegen/asm/global_asm_include.rs rename to tests/codegen-llvm/asm/global_asm_include.rs diff --git a/tests/codegen/asm/global_asm_x2.rs b/tests/codegen-llvm/asm/global_asm_x2.rs similarity index 100% rename from tests/codegen/asm/global_asm_x2.rs rename to tests/codegen-llvm/asm/global_asm_x2.rs diff --git a/tests/codegen/asm/goto.rs b/tests/codegen-llvm/asm/goto.rs similarity index 100% rename from tests/codegen/asm/goto.rs rename to tests/codegen-llvm/asm/goto.rs diff --git a/tests/codegen/asm/hexagon-clobbers.rs b/tests/codegen-llvm/asm/hexagon-clobbers.rs similarity index 100% rename from tests/codegen/asm/hexagon-clobbers.rs rename to tests/codegen-llvm/asm/hexagon-clobbers.rs diff --git a/tests/codegen/asm/may_unwind.rs b/tests/codegen-llvm/asm/may_unwind.rs similarity index 100% rename from tests/codegen/asm/may_unwind.rs rename to tests/codegen-llvm/asm/may_unwind.rs diff --git a/tests/codegen/asm/maybe-uninit.rs b/tests/codegen-llvm/asm/maybe-uninit.rs similarity index 100% rename from tests/codegen/asm/maybe-uninit.rs rename to tests/codegen-llvm/asm/maybe-uninit.rs diff --git a/tests/codegen/asm/msp430-clobbers.rs b/tests/codegen-llvm/asm/msp430-clobbers.rs similarity index 100% rename from tests/codegen/asm/msp430-clobbers.rs rename to tests/codegen-llvm/asm/msp430-clobbers.rs diff --git a/tests/codegen/asm/multiple-options.rs b/tests/codegen-llvm/asm/multiple-options.rs similarity index 100% rename from tests/codegen/asm/multiple-options.rs rename to tests/codegen-llvm/asm/multiple-options.rs diff --git a/tests/codegen/asm/options.rs b/tests/codegen-llvm/asm/options.rs similarity index 100% rename from tests/codegen/asm/options.rs rename to tests/codegen-llvm/asm/options.rs diff --git a/tests/codegen/asm/powerpc-clobbers.rs b/tests/codegen-llvm/asm/powerpc-clobbers.rs similarity index 100% rename from tests/codegen/asm/powerpc-clobbers.rs rename to tests/codegen-llvm/asm/powerpc-clobbers.rs diff --git a/tests/codegen/asm/riscv-clobbers.rs b/tests/codegen-llvm/asm/riscv-clobbers.rs similarity index 100% rename from tests/codegen/asm/riscv-clobbers.rs rename to tests/codegen-llvm/asm/riscv-clobbers.rs diff --git a/tests/codegen/asm/s390x-clobbers.rs b/tests/codegen-llvm/asm/s390x-clobbers.rs similarity index 100% rename from tests/codegen/asm/s390x-clobbers.rs rename to tests/codegen-llvm/asm/s390x-clobbers.rs diff --git a/tests/codegen/asm/sanitize-llvm.rs b/tests/codegen-llvm/asm/sanitize-llvm.rs similarity index 100% rename from tests/codegen/asm/sanitize-llvm.rs rename to tests/codegen-llvm/asm/sanitize-llvm.rs diff --git a/tests/codegen/asm/sparc-clobbers.rs b/tests/codegen-llvm/asm/sparc-clobbers.rs similarity index 100% rename from tests/codegen/asm/sparc-clobbers.rs rename to tests/codegen-llvm/asm/sparc-clobbers.rs diff --git a/tests/codegen/asm/x86-clobber_abi.rs b/tests/codegen-llvm/asm/x86-clobber_abi.rs similarity index 100% rename from tests/codegen/asm/x86-clobber_abi.rs rename to tests/codegen-llvm/asm/x86-clobber_abi.rs diff --git a/tests/codegen/asm/x86-clobbers.rs b/tests/codegen-llvm/asm/x86-clobbers.rs similarity index 100% rename from tests/codegen/asm/x86-clobbers.rs rename to tests/codegen-llvm/asm/x86-clobbers.rs diff --git a/tests/codegen/asm/x86-target-clobbers.rs b/tests/codegen-llvm/asm/x86-target-clobbers.rs similarity index 100% rename from tests/codegen/asm/x86-target-clobbers.rs rename to tests/codegen-llvm/asm/x86-target-clobbers.rs diff --git a/tests/codegen/assign-desugar-debuginfo.rs b/tests/codegen-llvm/assign-desugar-debuginfo.rs similarity index 100% rename from tests/codegen/assign-desugar-debuginfo.rs rename to tests/codegen-llvm/assign-desugar-debuginfo.rs diff --git a/tests/codegen/async-closure-debug.rs b/tests/codegen-llvm/async-closure-debug.rs similarity index 100% rename from tests/codegen/async-closure-debug.rs rename to tests/codegen-llvm/async-closure-debug.rs diff --git a/tests/codegen/async-fn-debug-awaitee-field.rs b/tests/codegen-llvm/async-fn-debug-awaitee-field.rs similarity index 100% rename from tests/codegen/async-fn-debug-awaitee-field.rs rename to tests/codegen-llvm/async-fn-debug-awaitee-field.rs diff --git a/tests/codegen/async-fn-debug-msvc.rs b/tests/codegen-llvm/async-fn-debug-msvc.rs similarity index 100% rename from tests/codegen/async-fn-debug-msvc.rs rename to tests/codegen-llvm/async-fn-debug-msvc.rs diff --git a/tests/codegen/async-fn-debug.rs b/tests/codegen-llvm/async-fn-debug.rs similarity index 100% rename from tests/codegen/async-fn-debug.rs rename to tests/codegen-llvm/async-fn-debug.rs diff --git a/tests/codegen/atomic-operations.rs b/tests/codegen-llvm/atomic-operations.rs similarity index 100% rename from tests/codegen/atomic-operations.rs rename to tests/codegen-llvm/atomic-operations.rs diff --git a/tests/codegen/atomicptr.rs b/tests/codegen-llvm/atomicptr.rs similarity index 100% rename from tests/codegen/atomicptr.rs rename to tests/codegen-llvm/atomicptr.rs diff --git a/tests/codegen/autodiff/batched.rs b/tests/codegen-llvm/autodiff/batched.rs similarity index 100% rename from tests/codegen/autodiff/batched.rs rename to tests/codegen-llvm/autodiff/batched.rs diff --git a/tests/codegen/autodiff/generic.rs b/tests/codegen-llvm/autodiff/generic.rs similarity index 100% rename from tests/codegen/autodiff/generic.rs rename to tests/codegen-llvm/autodiff/generic.rs diff --git a/tests/codegen/autodiff/identical_fnc.rs b/tests/codegen-llvm/autodiff/identical_fnc.rs similarity index 100% rename from tests/codegen/autodiff/identical_fnc.rs rename to tests/codegen-llvm/autodiff/identical_fnc.rs diff --git a/tests/codegen/autodiff/inline.rs b/tests/codegen-llvm/autodiff/inline.rs similarity index 100% rename from tests/codegen/autodiff/inline.rs rename to tests/codegen-llvm/autodiff/inline.rs diff --git a/tests/codegen/autodiff/scalar.rs b/tests/codegen-llvm/autodiff/scalar.rs similarity index 100% rename from tests/codegen/autodiff/scalar.rs rename to tests/codegen-llvm/autodiff/scalar.rs diff --git a/tests/codegen/autodiff/sret.rs b/tests/codegen-llvm/autodiff/sret.rs similarity index 100% rename from tests/codegen/autodiff/sret.rs rename to tests/codegen-llvm/autodiff/sret.rs diff --git a/tests/codegen/autodiffv2.rs b/tests/codegen-llvm/autodiffv2.rs similarity index 100% rename from tests/codegen/autodiffv2.rs rename to tests/codegen-llvm/autodiffv2.rs diff --git a/tests/codegen/autovec/dont-shuffle-bswaps-opt2.rs b/tests/codegen-llvm/autovec/dont-shuffle-bswaps-opt2.rs similarity index 100% rename from tests/codegen/autovec/dont-shuffle-bswaps-opt2.rs rename to tests/codegen-llvm/autovec/dont-shuffle-bswaps-opt2.rs diff --git a/tests/codegen/autovec/dont-shuffle-bswaps-opt3.rs b/tests/codegen-llvm/autovec/dont-shuffle-bswaps-opt3.rs similarity index 100% rename from tests/codegen/autovec/dont-shuffle-bswaps-opt3.rs rename to tests/codegen-llvm/autovec/dont-shuffle-bswaps-opt3.rs diff --git a/tests/codegen/autovectorize-f32x4.rs b/tests/codegen-llvm/autovectorize-f32x4.rs similarity index 100% rename from tests/codegen/autovectorize-f32x4.rs rename to tests/codegen-llvm/autovectorize-f32x4.rs diff --git a/tests/codegen/auxiliary/extern_decl.rs b/tests/codegen-llvm/auxiliary/extern_decl.rs similarity index 100% rename from tests/codegen/auxiliary/extern_decl.rs rename to tests/codegen-llvm/auxiliary/extern_decl.rs diff --git a/tests/codegen/auxiliary/nounwind.rs b/tests/codegen-llvm/auxiliary/nounwind.rs similarity index 100% rename from tests/codegen/auxiliary/nounwind.rs rename to tests/codegen-llvm/auxiliary/nounwind.rs diff --git a/tests/codegen/auxiliary/thread_local_aux.rs b/tests/codegen-llvm/auxiliary/thread_local_aux.rs similarity index 100% rename from tests/codegen/auxiliary/thread_local_aux.rs rename to tests/codegen-llvm/auxiliary/thread_local_aux.rs diff --git a/tests/codegen/avr/avr-func-addrspace.rs b/tests/codegen-llvm/avr/avr-func-addrspace.rs similarity index 100% rename from tests/codegen/avr/avr-func-addrspace.rs rename to tests/codegen-llvm/avr/avr-func-addrspace.rs diff --git a/tests/codegen/bigint-helpers.rs b/tests/codegen-llvm/bigint-helpers.rs similarity index 100% rename from tests/codegen/bigint-helpers.rs rename to tests/codegen-llvm/bigint-helpers.rs diff --git a/tests/codegen/binary-heap-peek-mut-pop-no-panic.rs b/tests/codegen-llvm/binary-heap-peek-mut-pop-no-panic.rs similarity index 100% rename from tests/codegen/binary-heap-peek-mut-pop-no-panic.rs rename to tests/codegen-llvm/binary-heap-peek-mut-pop-no-panic.rs diff --git a/tests/codegen/binary-search-index-no-bound-check.rs b/tests/codegen-llvm/binary-search-index-no-bound-check.rs similarity index 100% rename from tests/codegen/binary-search-index-no-bound-check.rs rename to tests/codegen-llvm/binary-search-index-no-bound-check.rs diff --git a/tests/codegen/bool-cmp.rs b/tests/codegen-llvm/bool-cmp.rs similarity index 100% rename from tests/codegen/bool-cmp.rs rename to tests/codegen-llvm/bool-cmp.rs diff --git a/tests/codegen/bounds-checking/gep-issue-133979.rs b/tests/codegen-llvm/bounds-checking/gep-issue-133979.rs similarity index 100% rename from tests/codegen/bounds-checking/gep-issue-133979.rs rename to tests/codegen-llvm/bounds-checking/gep-issue-133979.rs diff --git a/tests/codegen/box-default-debug-copies.rs b/tests/codegen-llvm/box-default-debug-copies.rs similarity index 100% rename from tests/codegen/box-default-debug-copies.rs rename to tests/codegen-llvm/box-default-debug-copies.rs diff --git a/tests/codegen/box-uninit-bytes.rs b/tests/codegen-llvm/box-uninit-bytes.rs similarity index 100% rename from tests/codegen/box-uninit-bytes.rs rename to tests/codegen-llvm/box-uninit-bytes.rs diff --git a/tests/codegen/bpf-alu32.rs b/tests/codegen-llvm/bpf-alu32.rs similarity index 100% rename from tests/codegen/bpf-alu32.rs rename to tests/codegen-llvm/bpf-alu32.rs diff --git a/tests/codegen/branch-protection.rs b/tests/codegen-llvm/branch-protection.rs similarity index 100% rename from tests/codegen/branch-protection.rs rename to tests/codegen-llvm/branch-protection.rs diff --git a/tests/codegen/call-llvm-intrinsics.rs b/tests/codegen-llvm/call-llvm-intrinsics.rs similarity index 100% rename from tests/codegen/call-llvm-intrinsics.rs rename to tests/codegen-llvm/call-llvm-intrinsics.rs diff --git a/tests/codegen/call-tmps-lifetime.rs b/tests/codegen-llvm/call-tmps-lifetime.rs similarity index 100% rename from tests/codegen/call-tmps-lifetime.rs rename to tests/codegen-llvm/call-tmps-lifetime.rs diff --git a/tests/codegen/cast-optimized.rs b/tests/codegen-llvm/cast-optimized.rs similarity index 100% rename from tests/codegen/cast-optimized.rs rename to tests/codegen-llvm/cast-optimized.rs diff --git a/tests/codegen/cast-target-abi.rs b/tests/codegen-llvm/cast-target-abi.rs similarity index 100% rename from tests/codegen/cast-target-abi.rs rename to tests/codegen-llvm/cast-target-abi.rs diff --git a/tests/codegen/catch-unwind.rs b/tests/codegen-llvm/catch-unwind.rs similarity index 100% rename from tests/codegen/catch-unwind.rs rename to tests/codegen-llvm/catch-unwind.rs diff --git a/tests/codegen/cdylib-external-inline-fns.rs b/tests/codegen-llvm/cdylib-external-inline-fns.rs similarity index 100% rename from tests/codegen/cdylib-external-inline-fns.rs rename to tests/codegen-llvm/cdylib-external-inline-fns.rs diff --git a/tests/codegen/cf-protection.rs b/tests/codegen-llvm/cf-protection.rs similarity index 100% rename from tests/codegen/cf-protection.rs rename to tests/codegen-llvm/cf-protection.rs diff --git a/tests/codegen/cffi/c-variadic-copy.rs b/tests/codegen-llvm/cffi/c-variadic-copy.rs similarity index 100% rename from tests/codegen/cffi/c-variadic-copy.rs rename to tests/codegen-llvm/cffi/c-variadic-copy.rs diff --git a/tests/codegen/cffi/c-variadic-naked.rs b/tests/codegen-llvm/cffi/c-variadic-naked.rs similarity index 100% rename from tests/codegen/cffi/c-variadic-naked.rs rename to tests/codegen-llvm/cffi/c-variadic-naked.rs diff --git a/tests/codegen/cffi/c-variadic-opt.rs b/tests/codegen-llvm/cffi/c-variadic-opt.rs similarity index 100% rename from tests/codegen/cffi/c-variadic-opt.rs rename to tests/codegen-llvm/cffi/c-variadic-opt.rs diff --git a/tests/codegen/cffi/c-variadic.rs b/tests/codegen-llvm/cffi/c-variadic.rs similarity index 100% rename from tests/codegen/cffi/c-variadic.rs rename to tests/codegen-llvm/cffi/c-variadic.rs diff --git a/tests/codegen/cffi/ffi-const.rs b/tests/codegen-llvm/cffi/ffi-const.rs similarity index 100% rename from tests/codegen/cffi/ffi-const.rs rename to tests/codegen-llvm/cffi/ffi-const.rs diff --git a/tests/codegen/cffi/ffi-out-of-bounds-loads.rs b/tests/codegen-llvm/cffi/ffi-out-of-bounds-loads.rs similarity index 100% rename from tests/codegen/cffi/ffi-out-of-bounds-loads.rs rename to tests/codegen-llvm/cffi/ffi-out-of-bounds-loads.rs diff --git a/tests/codegen/cffi/ffi-pure.rs b/tests/codegen-llvm/cffi/ffi-pure.rs similarity index 100% rename from tests/codegen/cffi/ffi-pure.rs rename to tests/codegen-llvm/cffi/ffi-pure.rs diff --git a/tests/codegen/cfguard-checks.rs b/tests/codegen-llvm/cfguard-checks.rs similarity index 100% rename from tests/codegen/cfguard-checks.rs rename to tests/codegen-llvm/cfguard-checks.rs diff --git a/tests/codegen/cfguard-disabled.rs b/tests/codegen-llvm/cfguard-disabled.rs similarity index 100% rename from tests/codegen/cfguard-disabled.rs rename to tests/codegen-llvm/cfguard-disabled.rs diff --git a/tests/codegen/cfguard-nochecks.rs b/tests/codegen-llvm/cfguard-nochecks.rs similarity index 100% rename from tests/codegen/cfguard-nochecks.rs rename to tests/codegen-llvm/cfguard-nochecks.rs diff --git a/tests/codegen/cfguard-non-msvc.rs b/tests/codegen-llvm/cfguard-non-msvc.rs similarity index 100% rename from tests/codegen/cfguard-non-msvc.rs rename to tests/codegen-llvm/cfguard-non-msvc.rs diff --git a/tests/codegen/char-ascii-branchless.rs b/tests/codegen-llvm/char-ascii-branchless.rs similarity index 100% rename from tests/codegen/char-ascii-branchless.rs rename to tests/codegen-llvm/char-ascii-branchless.rs diff --git a/tests/codegen/char-escape-debug-no-bounds-check.rs b/tests/codegen-llvm/char-escape-debug-no-bounds-check.rs similarity index 100% rename from tests/codegen/char-escape-debug-no-bounds-check.rs rename to tests/codegen-llvm/char-escape-debug-no-bounds-check.rs diff --git a/tests/codegen/checked_ilog.rs b/tests/codegen-llvm/checked_ilog.rs similarity index 100% rename from tests/codegen/checked_ilog.rs rename to tests/codegen-llvm/checked_ilog.rs diff --git a/tests/codegen/checked_math.rs b/tests/codegen-llvm/checked_math.rs similarity index 100% rename from tests/codegen/checked_math.rs rename to tests/codegen-llvm/checked_math.rs diff --git a/tests/codegen/clone-shims.rs b/tests/codegen-llvm/clone-shims.rs similarity index 100% rename from tests/codegen/clone-shims.rs rename to tests/codegen-llvm/clone-shims.rs diff --git a/tests/codegen/clone_as_copy.rs b/tests/codegen-llvm/clone_as_copy.rs similarity index 100% rename from tests/codegen/clone_as_copy.rs rename to tests/codegen-llvm/clone_as_copy.rs diff --git a/tests/codegen/codemodels.rs b/tests/codegen-llvm/codemodels.rs similarity index 100% rename from tests/codegen/codemodels.rs rename to tests/codegen-llvm/codemodels.rs diff --git a/tests/codegen/coercions.rs b/tests/codegen-llvm/coercions.rs similarity index 100% rename from tests/codegen/coercions.rs rename to tests/codegen-llvm/coercions.rs diff --git a/tests/codegen/cold-call-declare-and-call.rs b/tests/codegen-llvm/cold-call-declare-and-call.rs similarity index 100% rename from tests/codegen/cold-call-declare-and-call.rs rename to tests/codegen-llvm/cold-call-declare-and-call.rs diff --git a/tests/codegen/common_prim_int_ptr.rs b/tests/codegen-llvm/common_prim_int_ptr.rs similarity index 100% rename from tests/codegen/common_prim_int_ptr.rs rename to tests/codegen-llvm/common_prim_int_ptr.rs diff --git a/tests/codegen/comparison-operators-2-struct.rs b/tests/codegen-llvm/comparison-operators-2-struct.rs similarity index 100% rename from tests/codegen/comparison-operators-2-struct.rs rename to tests/codegen-llvm/comparison-operators-2-struct.rs diff --git a/tests/codegen/comparison-operators-2-tuple.rs b/tests/codegen-llvm/comparison-operators-2-tuple.rs similarity index 100% rename from tests/codegen/comparison-operators-2-tuple.rs rename to tests/codegen-llvm/comparison-operators-2-tuple.rs diff --git a/tests/codegen/comparison-operators-newtype.rs b/tests/codegen-llvm/comparison-operators-newtype.rs similarity index 100% rename from tests/codegen/comparison-operators-newtype.rs rename to tests/codegen-llvm/comparison-operators-newtype.rs diff --git a/tests/codegen/compiletest-self-test/minicore-smoke-test.rs b/tests/codegen-llvm/compiletest-self-test/minicore-smoke-test.rs similarity index 100% rename from tests/codegen/compiletest-self-test/minicore-smoke-test.rs rename to tests/codegen-llvm/compiletest-self-test/minicore-smoke-test.rs diff --git a/tests/codegen/const-array.rs b/tests/codegen-llvm/const-array.rs similarity index 100% rename from tests/codegen/const-array.rs rename to tests/codegen-llvm/const-array.rs diff --git a/tests/codegen/const-vector.rs b/tests/codegen-llvm/const-vector.rs similarity index 100% rename from tests/codegen/const-vector.rs rename to tests/codegen-llvm/const-vector.rs diff --git a/tests/codegen/const_scalar_pair.rs b/tests/codegen-llvm/const_scalar_pair.rs similarity index 100% rename from tests/codegen/const_scalar_pair.rs rename to tests/codegen-llvm/const_scalar_pair.rs diff --git a/tests/codegen/constant-branch.rs b/tests/codegen-llvm/constant-branch.rs similarity index 100% rename from tests/codegen/constant-branch.rs rename to tests/codegen-llvm/constant-branch.rs diff --git a/tests/codegen/consts.rs b/tests/codegen-llvm/consts.rs similarity index 100% rename from tests/codegen/consts.rs rename to tests/codegen-llvm/consts.rs diff --git a/tests/codegen/coroutine-debug-msvc.rs b/tests/codegen-llvm/coroutine-debug-msvc.rs similarity index 100% rename from tests/codegen/coroutine-debug-msvc.rs rename to tests/codegen-llvm/coroutine-debug-msvc.rs diff --git a/tests/codegen/coroutine-debug.rs b/tests/codegen-llvm/coroutine-debug.rs similarity index 100% rename from tests/codegen/coroutine-debug.rs rename to tests/codegen-llvm/coroutine-debug.rs diff --git a/tests/codegen/cross-crate-inlining/always-inline.rs b/tests/codegen-llvm/cross-crate-inlining/always-inline.rs similarity index 100% rename from tests/codegen/cross-crate-inlining/always-inline.rs rename to tests/codegen-llvm/cross-crate-inlining/always-inline.rs diff --git a/tests/codegen/cross-crate-inlining/auxiliary/always.rs b/tests/codegen-llvm/cross-crate-inlining/auxiliary/always.rs similarity index 100% rename from tests/codegen/cross-crate-inlining/auxiliary/always.rs rename to tests/codegen-llvm/cross-crate-inlining/auxiliary/always.rs diff --git a/tests/codegen/cross-crate-inlining/auxiliary/leaf.rs b/tests/codegen-llvm/cross-crate-inlining/auxiliary/leaf.rs similarity index 100% rename from tests/codegen/cross-crate-inlining/auxiliary/leaf.rs rename to tests/codegen-llvm/cross-crate-inlining/auxiliary/leaf.rs diff --git a/tests/codegen/cross-crate-inlining/auxiliary/never.rs b/tests/codegen-llvm/cross-crate-inlining/auxiliary/never.rs similarity index 100% rename from tests/codegen/cross-crate-inlining/auxiliary/never.rs rename to tests/codegen-llvm/cross-crate-inlining/auxiliary/never.rs diff --git a/tests/codegen/cross-crate-inlining/leaf-inlining.rs b/tests/codegen-llvm/cross-crate-inlining/leaf-inlining.rs similarity index 100% rename from tests/codegen/cross-crate-inlining/leaf-inlining.rs rename to tests/codegen-llvm/cross-crate-inlining/leaf-inlining.rs diff --git a/tests/codegen/cross-crate-inlining/never-inline.rs b/tests/codegen-llvm/cross-crate-inlining/never-inline.rs similarity index 100% rename from tests/codegen/cross-crate-inlining/never-inline.rs rename to tests/codegen-llvm/cross-crate-inlining/never-inline.rs diff --git a/tests/codegen/dealloc-no-unwind.rs b/tests/codegen-llvm/dealloc-no-unwind.rs similarity index 100% rename from tests/codegen/dealloc-no-unwind.rs rename to tests/codegen-llvm/dealloc-no-unwind.rs diff --git a/tests/codegen/debug-accessibility/crate-enum.rs b/tests/codegen-llvm/debug-accessibility/crate-enum.rs similarity index 100% rename from tests/codegen/debug-accessibility/crate-enum.rs rename to tests/codegen-llvm/debug-accessibility/crate-enum.rs diff --git a/tests/codegen/debug-accessibility/crate-struct.rs b/tests/codegen-llvm/debug-accessibility/crate-struct.rs similarity index 100% rename from tests/codegen/debug-accessibility/crate-struct.rs rename to tests/codegen-llvm/debug-accessibility/crate-struct.rs diff --git a/tests/codegen/debug-accessibility/private-enum.rs b/tests/codegen-llvm/debug-accessibility/private-enum.rs similarity index 100% rename from tests/codegen/debug-accessibility/private-enum.rs rename to tests/codegen-llvm/debug-accessibility/private-enum.rs diff --git a/tests/codegen/debug-accessibility/private-struct.rs b/tests/codegen-llvm/debug-accessibility/private-struct.rs similarity index 100% rename from tests/codegen/debug-accessibility/private-struct.rs rename to tests/codegen-llvm/debug-accessibility/private-struct.rs diff --git a/tests/codegen/debug-accessibility/public-enum.rs b/tests/codegen-llvm/debug-accessibility/public-enum.rs similarity index 100% rename from tests/codegen/debug-accessibility/public-enum.rs rename to tests/codegen-llvm/debug-accessibility/public-enum.rs diff --git a/tests/codegen/debug-accessibility/public-struct.rs b/tests/codegen-llvm/debug-accessibility/public-struct.rs similarity index 100% rename from tests/codegen/debug-accessibility/public-struct.rs rename to tests/codegen-llvm/debug-accessibility/public-struct.rs diff --git a/tests/codegen/debug-accessibility/struct-fields.rs b/tests/codegen-llvm/debug-accessibility/struct-fields.rs similarity index 100% rename from tests/codegen/debug-accessibility/struct-fields.rs rename to tests/codegen-llvm/debug-accessibility/struct-fields.rs diff --git a/tests/codegen/debug-accessibility/super-enum.rs b/tests/codegen-llvm/debug-accessibility/super-enum.rs similarity index 100% rename from tests/codegen/debug-accessibility/super-enum.rs rename to tests/codegen-llvm/debug-accessibility/super-enum.rs diff --git a/tests/codegen/debug-accessibility/super-struct.rs b/tests/codegen-llvm/debug-accessibility/super-struct.rs similarity index 100% rename from tests/codegen/debug-accessibility/super-struct.rs rename to tests/codegen-llvm/debug-accessibility/super-struct.rs diff --git a/tests/codegen/debug-accessibility/tuple-fields.rs b/tests/codegen-llvm/debug-accessibility/tuple-fields.rs similarity index 100% rename from tests/codegen/debug-accessibility/tuple-fields.rs rename to tests/codegen-llvm/debug-accessibility/tuple-fields.rs diff --git a/tests/codegen/debug-alignment.rs b/tests/codegen-llvm/debug-alignment.rs similarity index 100% rename from tests/codegen/debug-alignment.rs rename to tests/codegen-llvm/debug-alignment.rs diff --git a/tests/codegen/debug-column-msvc.rs b/tests/codegen-llvm/debug-column-msvc.rs similarity index 100% rename from tests/codegen/debug-column-msvc.rs rename to tests/codegen-llvm/debug-column-msvc.rs diff --git a/tests/codegen/debug-column.rs b/tests/codegen-llvm/debug-column.rs similarity index 100% rename from tests/codegen/debug-column.rs rename to tests/codegen-llvm/debug-column.rs diff --git a/tests/codegen/debug-compile-unit-path.rs b/tests/codegen-llvm/debug-compile-unit-path.rs similarity index 100% rename from tests/codegen/debug-compile-unit-path.rs rename to tests/codegen-llvm/debug-compile-unit-path.rs diff --git a/tests/codegen/debug-fndef-size.rs b/tests/codegen-llvm/debug-fndef-size.rs similarity index 100% rename from tests/codegen/debug-fndef-size.rs rename to tests/codegen-llvm/debug-fndef-size.rs diff --git a/tests/codegen/debug-limited.rs b/tests/codegen-llvm/debug-limited.rs similarity index 100% rename from tests/codegen/debug-limited.rs rename to tests/codegen-llvm/debug-limited.rs diff --git a/tests/codegen/debug-line-directives-only.rs b/tests/codegen-llvm/debug-line-directives-only.rs similarity index 100% rename from tests/codegen/debug-line-directives-only.rs rename to tests/codegen-llvm/debug-line-directives-only.rs diff --git a/tests/codegen/debug-line-tables-only.rs b/tests/codegen-llvm/debug-line-tables-only.rs similarity index 100% rename from tests/codegen/debug-line-tables-only.rs rename to tests/codegen-llvm/debug-line-tables-only.rs diff --git a/tests/codegen/debug-linkage-name.rs b/tests/codegen-llvm/debug-linkage-name.rs similarity index 100% rename from tests/codegen/debug-linkage-name.rs rename to tests/codegen-llvm/debug-linkage-name.rs diff --git a/tests/codegen/debug-vtable.rs b/tests/codegen-llvm/debug-vtable.rs similarity index 100% rename from tests/codegen/debug-vtable.rs rename to tests/codegen-llvm/debug-vtable.rs diff --git a/tests/codegen/debuginfo-constant-locals.rs b/tests/codegen-llvm/debuginfo-constant-locals.rs similarity index 100% rename from tests/codegen/debuginfo-constant-locals.rs rename to tests/codegen-llvm/debuginfo-constant-locals.rs diff --git a/tests/codegen/debuginfo-generic-closure-env-names.rs b/tests/codegen-llvm/debuginfo-generic-closure-env-names.rs similarity index 100% rename from tests/codegen/debuginfo-generic-closure-env-names.rs rename to tests/codegen-llvm/debuginfo-generic-closure-env-names.rs diff --git a/tests/codegen/debuginfo-inline-callsite-location.rs b/tests/codegen-llvm/debuginfo-inline-callsite-location.rs similarity index 100% rename from tests/codegen/debuginfo-inline-callsite-location.rs rename to tests/codegen-llvm/debuginfo-inline-callsite-location.rs diff --git a/tests/codegen/debuginfo-proc-macro/auxiliary/macro_def.rs b/tests/codegen-llvm/debuginfo-proc-macro/auxiliary/macro_def.rs similarity index 100% rename from tests/codegen/debuginfo-proc-macro/auxiliary/macro_def.rs rename to tests/codegen-llvm/debuginfo-proc-macro/auxiliary/macro_def.rs diff --git a/tests/codegen/debuginfo-proc-macro/mir_inlined_twice_var_locs.rs b/tests/codegen-llvm/debuginfo-proc-macro/mir_inlined_twice_var_locs.rs similarity index 100% rename from tests/codegen/debuginfo-proc-macro/mir_inlined_twice_var_locs.rs rename to tests/codegen-llvm/debuginfo-proc-macro/mir_inlined_twice_var_locs.rs diff --git a/tests/codegen/deduced-param-attrs.rs b/tests/codegen-llvm/deduced-param-attrs.rs similarity index 100% rename from tests/codegen/deduced-param-attrs.rs rename to tests/codegen-llvm/deduced-param-attrs.rs diff --git a/tests/codegen/default-requires-uwtable.rs b/tests/codegen-llvm/default-requires-uwtable.rs similarity index 100% rename from tests/codegen/default-requires-uwtable.rs rename to tests/codegen-llvm/default-requires-uwtable.rs diff --git a/tests/codegen/default-visibility.rs b/tests/codegen-llvm/default-visibility.rs similarity index 100% rename from tests/codegen/default-visibility.rs rename to tests/codegen-llvm/default-visibility.rs diff --git a/tests/codegen/direct-access-external-data.rs b/tests/codegen-llvm/direct-access-external-data.rs similarity index 100% rename from tests/codegen/direct-access-external-data.rs rename to tests/codegen-llvm/direct-access-external-data.rs diff --git a/tests/codegen/dllimports/auxiliary/dummy.rs b/tests/codegen-llvm/dllimports/auxiliary/dummy.rs similarity index 100% rename from tests/codegen/dllimports/auxiliary/dummy.rs rename to tests/codegen-llvm/dllimports/auxiliary/dummy.rs diff --git a/tests/codegen/dllimports/auxiliary/wrapper.rs b/tests/codegen-llvm/dllimports/auxiliary/wrapper.rs similarity index 100% rename from tests/codegen/dllimports/auxiliary/wrapper.rs rename to tests/codegen-llvm/dllimports/auxiliary/wrapper.rs diff --git a/tests/codegen/dllimports/main.rs b/tests/codegen-llvm/dllimports/main.rs similarity index 100% rename from tests/codegen/dllimports/main.rs rename to tests/codegen-llvm/dllimports/main.rs diff --git a/tests/codegen/dont_codegen_private_const_fn_only_used_in_const_eval.rs b/tests/codegen-llvm/dont_codegen_private_const_fn_only_used_in_const_eval.rs similarity index 100% rename from tests/codegen/dont_codegen_private_const_fn_only_used_in_const_eval.rs rename to tests/codegen-llvm/dont_codegen_private_const_fn_only_used_in_const_eval.rs diff --git a/tests/codegen/drop-in-place-noalias.rs b/tests/codegen-llvm/drop-in-place-noalias.rs similarity index 100% rename from tests/codegen/drop-in-place-noalias.rs rename to tests/codegen-llvm/drop-in-place-noalias.rs diff --git a/tests/codegen/drop.rs b/tests/codegen-llvm/drop.rs similarity index 100% rename from tests/codegen/drop.rs rename to tests/codegen-llvm/drop.rs diff --git a/tests/codegen/dst-offset.rs b/tests/codegen-llvm/dst-offset.rs similarity index 100% rename from tests/codegen/dst-offset.rs rename to tests/codegen-llvm/dst-offset.rs diff --git a/tests/codegen/dst-vtable-align-nonzero.rs b/tests/codegen-llvm/dst-vtable-align-nonzero.rs similarity index 100% rename from tests/codegen/dst-vtable-align-nonzero.rs rename to tests/codegen-llvm/dst-vtable-align-nonzero.rs diff --git a/tests/codegen/dst-vtable-size-range.rs b/tests/codegen-llvm/dst-vtable-size-range.rs similarity index 100% rename from tests/codegen/dst-vtable-size-range.rs rename to tests/codegen-llvm/dst-vtable-size-range.rs diff --git a/tests/codegen/ehcontguard_disabled.rs b/tests/codegen-llvm/ehcontguard_disabled.rs similarity index 100% rename from tests/codegen/ehcontguard_disabled.rs rename to tests/codegen-llvm/ehcontguard_disabled.rs diff --git a/tests/codegen/ehcontguard_enabled.rs b/tests/codegen-llvm/ehcontguard_enabled.rs similarity index 100% rename from tests/codegen/ehcontguard_enabled.rs rename to tests/codegen-llvm/ehcontguard_enabled.rs diff --git a/tests/codegen/emscripten-catch-unwind-js-eh.rs b/tests/codegen-llvm/emscripten-catch-unwind-js-eh.rs similarity index 100% rename from tests/codegen/emscripten-catch-unwind-js-eh.rs rename to tests/codegen-llvm/emscripten-catch-unwind-js-eh.rs diff --git a/tests/codegen/emscripten-catch-unwind-wasm-eh.rs b/tests/codegen-llvm/emscripten-catch-unwind-wasm-eh.rs similarity index 100% rename from tests/codegen/emscripten-catch-unwind-wasm-eh.rs rename to tests/codegen-llvm/emscripten-catch-unwind-wasm-eh.rs diff --git a/tests/codegen/enable-lto-unit-splitting.rs b/tests/codegen-llvm/enable-lto-unit-splitting.rs similarity index 100% rename from tests/codegen/enable-lto-unit-splitting.rs rename to tests/codegen-llvm/enable-lto-unit-splitting.rs diff --git a/tests/codegen/enum/enum-aggregate.rs b/tests/codegen-llvm/enum/enum-aggregate.rs similarity index 100% rename from tests/codegen/enum/enum-aggregate.rs rename to tests/codegen-llvm/enum/enum-aggregate.rs diff --git a/tests/codegen/enum/enum-bounds-check-derived-idx.rs b/tests/codegen-llvm/enum/enum-bounds-check-derived-idx.rs similarity index 100% rename from tests/codegen/enum/enum-bounds-check-derived-idx.rs rename to tests/codegen-llvm/enum/enum-bounds-check-derived-idx.rs diff --git a/tests/codegen/enum/enum-bounds-check-issue-13926.rs b/tests/codegen-llvm/enum/enum-bounds-check-issue-13926.rs similarity index 100% rename from tests/codegen/enum/enum-bounds-check-issue-13926.rs rename to tests/codegen-llvm/enum/enum-bounds-check-issue-13926.rs diff --git a/tests/codegen/enum/enum-bounds-check-issue-82871.rs b/tests/codegen-llvm/enum/enum-bounds-check-issue-82871.rs similarity index 100% rename from tests/codegen/enum/enum-bounds-check-issue-82871.rs rename to tests/codegen-llvm/enum/enum-bounds-check-issue-82871.rs diff --git a/tests/codegen/enum/enum-bounds-check.rs b/tests/codegen-llvm/enum/enum-bounds-check.rs similarity index 100% rename from tests/codegen/enum/enum-bounds-check.rs rename to tests/codegen-llvm/enum/enum-bounds-check.rs diff --git a/tests/codegen/enum/enum-debug-clike.rs b/tests/codegen-llvm/enum/enum-debug-clike.rs similarity index 100% rename from tests/codegen/enum/enum-debug-clike.rs rename to tests/codegen-llvm/enum/enum-debug-clike.rs diff --git a/tests/codegen/enum/enum-debug-niche-2.rs b/tests/codegen-llvm/enum/enum-debug-niche-2.rs similarity index 100% rename from tests/codegen/enum/enum-debug-niche-2.rs rename to tests/codegen-llvm/enum/enum-debug-niche-2.rs diff --git a/tests/codegen/enum/enum-debug-niche.rs b/tests/codegen-llvm/enum/enum-debug-niche.rs similarity index 100% rename from tests/codegen/enum/enum-debug-niche.rs rename to tests/codegen-llvm/enum/enum-debug-niche.rs diff --git a/tests/codegen/enum/enum-debug-tagged.rs b/tests/codegen-llvm/enum/enum-debug-tagged.rs similarity index 100% rename from tests/codegen/enum/enum-debug-tagged.rs rename to tests/codegen-llvm/enum/enum-debug-tagged.rs diff --git a/tests/codegen/enum/enum-discriminant-eq.rs b/tests/codegen-llvm/enum/enum-discriminant-eq.rs similarity index 100% rename from tests/codegen/enum/enum-discriminant-eq.rs rename to tests/codegen-llvm/enum/enum-discriminant-eq.rs diff --git a/tests/codegen/enum/enum-discriminant-value.rs b/tests/codegen-llvm/enum/enum-discriminant-value.rs similarity index 100% rename from tests/codegen/enum/enum-discriminant-value.rs rename to tests/codegen-llvm/enum/enum-discriminant-value.rs diff --git a/tests/codegen/enum/enum-early-otherwise-branch.rs b/tests/codegen-llvm/enum/enum-early-otherwise-branch.rs similarity index 100% rename from tests/codegen/enum/enum-early-otherwise-branch.rs rename to tests/codegen-llvm/enum/enum-early-otherwise-branch.rs diff --git a/tests/codegen/enum/enum-match.rs b/tests/codegen-llvm/enum/enum-match.rs similarity index 100% rename from tests/codegen/enum/enum-match.rs rename to tests/codegen-llvm/enum/enum-match.rs diff --git a/tests/codegen/enum/enum-two-variants-match.rs b/tests/codegen-llvm/enum/enum-two-variants-match.rs similarity index 100% rename from tests/codegen/enum/enum-two-variants-match.rs rename to tests/codegen-llvm/enum/enum-two-variants-match.rs diff --git a/tests/codegen/enum/enum-u128.rs b/tests/codegen-llvm/enum/enum-u128.rs similarity index 100% rename from tests/codegen/enum/enum-u128.rs rename to tests/codegen-llvm/enum/enum-u128.rs diff --git a/tests/codegen/enum/unreachable_enum_default_branch.rs b/tests/codegen-llvm/enum/unreachable_enum_default_branch.rs similarity index 100% rename from tests/codegen/enum/unreachable_enum_default_branch.rs rename to tests/codegen-llvm/enum/unreachable_enum_default_branch.rs diff --git a/tests/codegen/ergonomic-clones/closure.rs b/tests/codegen-llvm/ergonomic-clones/closure.rs similarity index 100% rename from tests/codegen/ergonomic-clones/closure.rs rename to tests/codegen-llvm/ergonomic-clones/closure.rs diff --git a/tests/codegen/error-provide.rs b/tests/codegen-llvm/error-provide.rs similarity index 100% rename from tests/codegen/error-provide.rs rename to tests/codegen-llvm/error-provide.rs diff --git a/tests/codegen/export-no-mangle.rs b/tests/codegen-llvm/export-no-mangle.rs similarity index 100% rename from tests/codegen/export-no-mangle.rs rename to tests/codegen-llvm/export-no-mangle.rs diff --git a/tests/codegen/external-no-mangle-fns.rs b/tests/codegen-llvm/external-no-mangle-fns.rs similarity index 100% rename from tests/codegen/external-no-mangle-fns.rs rename to tests/codegen-llvm/external-no-mangle-fns.rs diff --git a/tests/codegen/external-no-mangle-statics.rs b/tests/codegen-llvm/external-no-mangle-statics.rs similarity index 100% rename from tests/codegen/external-no-mangle-statics.rs rename to tests/codegen-llvm/external-no-mangle-statics.rs diff --git a/tests/codegen/f128-wasm32-callconv.rs b/tests/codegen-llvm/f128-wasm32-callconv.rs similarity index 100% rename from tests/codegen/f128-wasm32-callconv.rs rename to tests/codegen-llvm/f128-wasm32-callconv.rs diff --git a/tests/codegen/fastcall-inreg.rs b/tests/codegen-llvm/fastcall-inreg.rs similarity index 100% rename from tests/codegen/fastcall-inreg.rs rename to tests/codegen-llvm/fastcall-inreg.rs diff --git a/tests/codegen/fatptr.rs b/tests/codegen-llvm/fatptr.rs similarity index 100% rename from tests/codegen/fatptr.rs rename to tests/codegen-llvm/fatptr.rs diff --git a/tests/codegen/fewer-names.rs b/tests/codegen-llvm/fewer-names.rs similarity index 100% rename from tests/codegen/fewer-names.rs rename to tests/codegen-llvm/fewer-names.rs diff --git a/tests/codegen/fixed-x18.rs b/tests/codegen-llvm/fixed-x18.rs similarity index 100% rename from tests/codegen/fixed-x18.rs rename to tests/codegen-llvm/fixed-x18.rs diff --git a/tests/codegen/float/algebraic.rs b/tests/codegen-llvm/float/algebraic.rs similarity index 100% rename from tests/codegen/float/algebraic.rs rename to tests/codegen-llvm/float/algebraic.rs diff --git a/tests/codegen/float/f128.rs b/tests/codegen-llvm/float/f128.rs similarity index 100% rename from tests/codegen/float/f128.rs rename to tests/codegen-llvm/float/f128.rs diff --git a/tests/codegen/float/f16-f128-inline.rs b/tests/codegen-llvm/float/f16-f128-inline.rs similarity index 100% rename from tests/codegen/float/f16-f128-inline.rs rename to tests/codegen-llvm/float/f16-f128-inline.rs diff --git a/tests/codegen/float/f16.rs b/tests/codegen-llvm/float/f16.rs similarity index 100% rename from tests/codegen/float/f16.rs rename to tests/codegen-llvm/float/f16.rs diff --git a/tests/codegen/float_math.rs b/tests/codegen-llvm/float_math.rs similarity index 100% rename from tests/codegen/float_math.rs rename to tests/codegen-llvm/float_math.rs diff --git a/tests/codegen/fn-impl-trait-self.rs b/tests/codegen-llvm/fn-impl-trait-self.rs similarity index 100% rename from tests/codegen/fn-impl-trait-self.rs rename to tests/codegen-llvm/fn-impl-trait-self.rs diff --git a/tests/codegen/fn-parameters-on-different-lines-debuginfo.rs b/tests/codegen-llvm/fn-parameters-on-different-lines-debuginfo.rs similarity index 100% rename from tests/codegen/fn-parameters-on-different-lines-debuginfo.rs rename to tests/codegen-llvm/fn-parameters-on-different-lines-debuginfo.rs diff --git a/tests/codegen/force-frame-pointers.rs b/tests/codegen-llvm/force-frame-pointers.rs similarity index 100% rename from tests/codegen/force-frame-pointers.rs rename to tests/codegen-llvm/force-frame-pointers.rs diff --git a/tests/codegen/force-no-unwind-tables.rs b/tests/codegen-llvm/force-no-unwind-tables.rs similarity index 100% rename from tests/codegen/force-no-unwind-tables.rs rename to tests/codegen-llvm/force-no-unwind-tables.rs diff --git a/tests/codegen/force-unwind-tables.rs b/tests/codegen-llvm/force-unwind-tables.rs similarity index 100% rename from tests/codegen/force-unwind-tables.rs rename to tests/codegen-llvm/force-unwind-tables.rs diff --git a/tests/codegen/frame-pointer-cli-control.rs b/tests/codegen-llvm/frame-pointer-cli-control.rs similarity index 100% rename from tests/codegen/frame-pointer-cli-control.rs rename to tests/codegen-llvm/frame-pointer-cli-control.rs diff --git a/tests/codegen/frame-pointer.rs b/tests/codegen-llvm/frame-pointer.rs similarity index 100% rename from tests/codegen/frame-pointer.rs rename to tests/codegen-llvm/frame-pointer.rs diff --git a/tests/codegen/function-arguments-noopt.rs b/tests/codegen-llvm/function-arguments-noopt.rs similarity index 100% rename from tests/codegen/function-arguments-noopt.rs rename to tests/codegen-llvm/function-arguments-noopt.rs diff --git a/tests/codegen/function-arguments.rs b/tests/codegen-llvm/function-arguments.rs similarity index 100% rename from tests/codegen/function-arguments.rs rename to tests/codegen-llvm/function-arguments.rs diff --git a/tests/codegen/function-return.rs b/tests/codegen-llvm/function-return.rs similarity index 100% rename from tests/codegen/function-return.rs rename to tests/codegen-llvm/function-return.rs diff --git a/tests/codegen/gdb_debug_script_load.rs b/tests/codegen-llvm/gdb_debug_script_load.rs similarity index 100% rename from tests/codegen/gdb_debug_script_load.rs rename to tests/codegen-llvm/gdb_debug_script_load.rs diff --git a/tests/codegen/generic-debug.rs b/tests/codegen-llvm/generic-debug.rs similarity index 100% rename from tests/codegen/generic-debug.rs rename to tests/codegen-llvm/generic-debug.rs diff --git a/tests/codegen/gep-index.rs b/tests/codegen-llvm/gep-index.rs similarity index 100% rename from tests/codegen/gep-index.rs rename to tests/codegen-llvm/gep-index.rs diff --git a/tests/codegen/gpu-kernel-abi.rs b/tests/codegen-llvm/gpu-kernel-abi.rs similarity index 100% rename from tests/codegen/gpu-kernel-abi.rs rename to tests/codegen-llvm/gpu-kernel-abi.rs diff --git a/tests/codegen/gpu_offload/gpu_host.rs b/tests/codegen-llvm/gpu_offload/gpu_host.rs similarity index 100% rename from tests/codegen/gpu_offload/gpu_host.rs rename to tests/codegen-llvm/gpu_offload/gpu_host.rs diff --git a/tests/codegen/hint/cold_path.rs b/tests/codegen-llvm/hint/cold_path.rs similarity index 100% rename from tests/codegen/hint/cold_path.rs rename to tests/codegen-llvm/hint/cold_path.rs diff --git a/tests/codegen/hint/likely.rs b/tests/codegen-llvm/hint/likely.rs similarity index 100% rename from tests/codegen/hint/likely.rs rename to tests/codegen-llvm/hint/likely.rs diff --git a/tests/codegen/hint/unlikely.rs b/tests/codegen-llvm/hint/unlikely.rs similarity index 100% rename from tests/codegen/hint/unlikely.rs rename to tests/codegen-llvm/hint/unlikely.rs diff --git a/tests/codegen/i128-wasm32-callconv.rs b/tests/codegen-llvm/i128-wasm32-callconv.rs similarity index 100% rename from tests/codegen/i128-wasm32-callconv.rs rename to tests/codegen-llvm/i128-wasm32-callconv.rs diff --git a/tests/codegen/i128-x86-align.rs b/tests/codegen-llvm/i128-x86-align.rs similarity index 100% rename from tests/codegen/i128-x86-align.rs rename to tests/codegen-llvm/i128-x86-align.rs diff --git a/tests/codegen/i128-x86-callconv.rs b/tests/codegen-llvm/i128-x86-callconv.rs similarity index 100% rename from tests/codegen/i128-x86-callconv.rs rename to tests/codegen-llvm/i128-x86-callconv.rs diff --git a/tests/codegen/infallible-unwrap-in-opt-z.rs b/tests/codegen-llvm/infallible-unwrap-in-opt-z.rs similarity index 100% rename from tests/codegen/infallible-unwrap-in-opt-z.rs rename to tests/codegen-llvm/infallible-unwrap-in-opt-z.rs diff --git a/tests/codegen/inherit_overflow.rs b/tests/codegen-llvm/inherit_overflow.rs similarity index 100% rename from tests/codegen/inherit_overflow.rs rename to tests/codegen-llvm/inherit_overflow.rs diff --git a/tests/codegen/inline-always-works-always.rs b/tests/codegen-llvm/inline-always-works-always.rs similarity index 100% rename from tests/codegen/inline-always-works-always.rs rename to tests/codegen-llvm/inline-always-works-always.rs diff --git a/tests/codegen/inline-debuginfo.rs b/tests/codegen-llvm/inline-debuginfo.rs similarity index 100% rename from tests/codegen/inline-debuginfo.rs rename to tests/codegen-llvm/inline-debuginfo.rs diff --git a/tests/codegen/inline-function-args-debug-info.rs b/tests/codegen-llvm/inline-function-args-debug-info.rs similarity index 100% rename from tests/codegen/inline-function-args-debug-info.rs rename to tests/codegen-llvm/inline-function-args-debug-info.rs diff --git a/tests/codegen/inline-hint.rs b/tests/codegen-llvm/inline-hint.rs similarity index 100% rename from tests/codegen/inline-hint.rs rename to tests/codegen-llvm/inline-hint.rs diff --git a/tests/codegen/instrument-coverage/instrument-coverage-off.rs b/tests/codegen-llvm/instrument-coverage/instrument-coverage-off.rs similarity index 100% rename from tests/codegen/instrument-coverage/instrument-coverage-off.rs rename to tests/codegen-llvm/instrument-coverage/instrument-coverage-off.rs diff --git a/tests/codegen/instrument-coverage/instrument-coverage.rs b/tests/codegen-llvm/instrument-coverage/instrument-coverage.rs similarity index 100% rename from tests/codegen/instrument-coverage/instrument-coverage.rs rename to tests/codegen-llvm/instrument-coverage/instrument-coverage.rs diff --git a/tests/codegen/instrument-coverage/testprog.rs b/tests/codegen-llvm/instrument-coverage/testprog.rs similarity index 100% rename from tests/codegen/instrument-coverage/testprog.rs rename to tests/codegen-llvm/instrument-coverage/testprog.rs diff --git a/tests/codegen/instrument-mcount.rs b/tests/codegen-llvm/instrument-mcount.rs similarity index 100% rename from tests/codegen/instrument-mcount.rs rename to tests/codegen-llvm/instrument-mcount.rs diff --git a/tests/codegen/instrument-xray/basic.rs b/tests/codegen-llvm/instrument-xray/basic.rs similarity index 100% rename from tests/codegen/instrument-xray/basic.rs rename to tests/codegen-llvm/instrument-xray/basic.rs diff --git a/tests/codegen/instrument-xray/options-combine.rs b/tests/codegen-llvm/instrument-xray/options-combine.rs similarity index 100% rename from tests/codegen/instrument-xray/options-combine.rs rename to tests/codegen-llvm/instrument-xray/options-combine.rs diff --git a/tests/codegen/instrument-xray/options-override.rs b/tests/codegen-llvm/instrument-xray/options-override.rs similarity index 100% rename from tests/codegen/instrument-xray/options-override.rs rename to tests/codegen-llvm/instrument-xray/options-override.rs diff --git a/tests/codegen/integer-cmp.rs b/tests/codegen-llvm/integer-cmp.rs similarity index 100% rename from tests/codegen/integer-cmp.rs rename to tests/codegen-llvm/integer-cmp.rs diff --git a/tests/codegen/integer-overflow.rs b/tests/codegen-llvm/integer-overflow.rs similarity index 100% rename from tests/codegen/integer-overflow.rs rename to tests/codegen-llvm/integer-overflow.rs diff --git a/tests/codegen/internalize-closures.rs b/tests/codegen-llvm/internalize-closures.rs similarity index 100% rename from tests/codegen/internalize-closures.rs rename to tests/codegen-llvm/internalize-closures.rs diff --git a/tests/codegen/intrinsic-no-unnamed-attr.rs b/tests/codegen-llvm/intrinsic-no-unnamed-attr.rs similarity index 100% rename from tests/codegen/intrinsic-no-unnamed-attr.rs rename to tests/codegen-llvm/intrinsic-no-unnamed-attr.rs diff --git a/tests/codegen/intrinsics/aggregate-thin-pointer.rs b/tests/codegen-llvm/intrinsics/aggregate-thin-pointer.rs similarity index 100% rename from tests/codegen/intrinsics/aggregate-thin-pointer.rs rename to tests/codegen-llvm/intrinsics/aggregate-thin-pointer.rs diff --git a/tests/codegen/intrinsics/carrying_mul_add.rs b/tests/codegen-llvm/intrinsics/carrying_mul_add.rs similarity index 100% rename from tests/codegen/intrinsics/carrying_mul_add.rs rename to tests/codegen-llvm/intrinsics/carrying_mul_add.rs diff --git a/tests/codegen/intrinsics/cold_path.rs b/tests/codegen-llvm/intrinsics/cold_path.rs similarity index 100% rename from tests/codegen/intrinsics/cold_path.rs rename to tests/codegen-llvm/intrinsics/cold_path.rs diff --git a/tests/codegen/intrinsics/cold_path2.rs b/tests/codegen-llvm/intrinsics/cold_path2.rs similarity index 100% rename from tests/codegen/intrinsics/cold_path2.rs rename to tests/codegen-llvm/intrinsics/cold_path2.rs diff --git a/tests/codegen/intrinsics/cold_path3.rs b/tests/codegen-llvm/intrinsics/cold_path3.rs similarity index 100% rename from tests/codegen/intrinsics/cold_path3.rs rename to tests/codegen-llvm/intrinsics/cold_path3.rs diff --git a/tests/codegen/intrinsics/compare_bytes.rs b/tests/codegen-llvm/intrinsics/compare_bytes.rs similarity index 100% rename from tests/codegen/intrinsics/compare_bytes.rs rename to tests/codegen-llvm/intrinsics/compare_bytes.rs diff --git a/tests/codegen/intrinsics/const_eval_select.rs b/tests/codegen-llvm/intrinsics/const_eval_select.rs similarity index 100% rename from tests/codegen/intrinsics/const_eval_select.rs rename to tests/codegen-llvm/intrinsics/const_eval_select.rs diff --git a/tests/codegen/intrinsics/ctlz.rs b/tests/codegen-llvm/intrinsics/ctlz.rs similarity index 100% rename from tests/codegen/intrinsics/ctlz.rs rename to tests/codegen-llvm/intrinsics/ctlz.rs diff --git a/tests/codegen/intrinsics/ctpop.rs b/tests/codegen-llvm/intrinsics/ctpop.rs similarity index 100% rename from tests/codegen/intrinsics/ctpop.rs rename to tests/codegen-llvm/intrinsics/ctpop.rs diff --git a/tests/codegen/intrinsics/disjoint_bitor.rs b/tests/codegen-llvm/intrinsics/disjoint_bitor.rs similarity index 100% rename from tests/codegen/intrinsics/disjoint_bitor.rs rename to tests/codegen-llvm/intrinsics/disjoint_bitor.rs diff --git a/tests/codegen/intrinsics/exact_div.rs b/tests/codegen-llvm/intrinsics/exact_div.rs similarity index 100% rename from tests/codegen/intrinsics/exact_div.rs rename to tests/codegen-llvm/intrinsics/exact_div.rs diff --git a/tests/codegen/intrinsics/likely.rs b/tests/codegen-llvm/intrinsics/likely.rs similarity index 100% rename from tests/codegen/intrinsics/likely.rs rename to tests/codegen-llvm/intrinsics/likely.rs diff --git a/tests/codegen/intrinsics/likely_assert.rs b/tests/codegen-llvm/intrinsics/likely_assert.rs similarity index 100% rename from tests/codegen/intrinsics/likely_assert.rs rename to tests/codegen-llvm/intrinsics/likely_assert.rs diff --git a/tests/codegen/intrinsics/mask.rs b/tests/codegen-llvm/intrinsics/mask.rs similarity index 100% rename from tests/codegen/intrinsics/mask.rs rename to tests/codegen-llvm/intrinsics/mask.rs diff --git a/tests/codegen/intrinsics/nontemporal.rs b/tests/codegen-llvm/intrinsics/nontemporal.rs similarity index 100% rename from tests/codegen/intrinsics/nontemporal.rs rename to tests/codegen-llvm/intrinsics/nontemporal.rs diff --git a/tests/codegen/intrinsics/offset.rs b/tests/codegen-llvm/intrinsics/offset.rs similarity index 100% rename from tests/codegen/intrinsics/offset.rs rename to tests/codegen-llvm/intrinsics/offset.rs diff --git a/tests/codegen/intrinsics/offset_from.rs b/tests/codegen-llvm/intrinsics/offset_from.rs similarity index 100% rename from tests/codegen/intrinsics/offset_from.rs rename to tests/codegen-llvm/intrinsics/offset_from.rs diff --git a/tests/codegen/intrinsics/prefetch.rs b/tests/codegen-llvm/intrinsics/prefetch.rs similarity index 100% rename from tests/codegen/intrinsics/prefetch.rs rename to tests/codegen-llvm/intrinsics/prefetch.rs diff --git a/tests/codegen/intrinsics/ptr_metadata.rs b/tests/codegen-llvm/intrinsics/ptr_metadata.rs similarity index 100% rename from tests/codegen/intrinsics/ptr_metadata.rs rename to tests/codegen-llvm/intrinsics/ptr_metadata.rs diff --git a/tests/codegen/intrinsics/rotate_left.rs b/tests/codegen-llvm/intrinsics/rotate_left.rs similarity index 100% rename from tests/codegen/intrinsics/rotate_left.rs rename to tests/codegen-llvm/intrinsics/rotate_left.rs diff --git a/tests/codegen/intrinsics/rustc_intrinsic_must_be_overridden.rs b/tests/codegen-llvm/intrinsics/rustc_intrinsic_must_be_overridden.rs similarity index 100% rename from tests/codegen/intrinsics/rustc_intrinsic_must_be_overridden.rs rename to tests/codegen-llvm/intrinsics/rustc_intrinsic_must_be_overridden.rs diff --git a/tests/codegen/intrinsics/select_unpredictable.rs b/tests/codegen-llvm/intrinsics/select_unpredictable.rs similarity index 100% rename from tests/codegen/intrinsics/select_unpredictable.rs rename to tests/codegen-llvm/intrinsics/select_unpredictable.rs diff --git a/tests/codegen/intrinsics/three_way_compare.rs b/tests/codegen-llvm/intrinsics/three_way_compare.rs similarity index 100% rename from tests/codegen/intrinsics/three_way_compare.rs rename to tests/codegen-llvm/intrinsics/three_way_compare.rs diff --git a/tests/codegen/intrinsics/transmute-niched.rs b/tests/codegen-llvm/intrinsics/transmute-niched.rs similarity index 100% rename from tests/codegen/intrinsics/transmute-niched.rs rename to tests/codegen-llvm/intrinsics/transmute-niched.rs diff --git a/tests/codegen/intrinsics/transmute-x64.rs b/tests/codegen-llvm/intrinsics/transmute-x64.rs similarity index 100% rename from tests/codegen/intrinsics/transmute-x64.rs rename to tests/codegen-llvm/intrinsics/transmute-x64.rs diff --git a/tests/codegen/intrinsics/transmute.rs b/tests/codegen-llvm/intrinsics/transmute.rs similarity index 100% rename from tests/codegen/intrinsics/transmute.rs rename to tests/codegen-llvm/intrinsics/transmute.rs diff --git a/tests/codegen/intrinsics/typed_swap.rs b/tests/codegen-llvm/intrinsics/typed_swap.rs similarity index 100% rename from tests/codegen/intrinsics/typed_swap.rs rename to tests/codegen-llvm/intrinsics/typed_swap.rs diff --git a/tests/codegen/intrinsics/unchecked_math.rs b/tests/codegen-llvm/intrinsics/unchecked_math.rs similarity index 100% rename from tests/codegen/intrinsics/unchecked_math.rs rename to tests/codegen-llvm/intrinsics/unchecked_math.rs diff --git a/tests/codegen/intrinsics/unlikely.rs b/tests/codegen-llvm/intrinsics/unlikely.rs similarity index 100% rename from tests/codegen/intrinsics/unlikely.rs rename to tests/codegen-llvm/intrinsics/unlikely.rs diff --git a/tests/codegen/intrinsics/volatile.rs b/tests/codegen-llvm/intrinsics/volatile.rs similarity index 100% rename from tests/codegen/intrinsics/volatile.rs rename to tests/codegen-llvm/intrinsics/volatile.rs diff --git a/tests/codegen/intrinsics/volatile_order.rs b/tests/codegen-llvm/intrinsics/volatile_order.rs similarity index 100% rename from tests/codegen/intrinsics/volatile_order.rs rename to tests/codegen-llvm/intrinsics/volatile_order.rs diff --git a/tests/codegen/is_val_statically_known.rs b/tests/codegen-llvm/is_val_statically_known.rs similarity index 100% rename from tests/codegen/is_val_statically_known.rs rename to tests/codegen-llvm/is_val_statically_known.rs diff --git a/tests/codegen/issue-97217.rs b/tests/codegen-llvm/issue-97217.rs similarity index 100% rename from tests/codegen/issue-97217.rs rename to tests/codegen-llvm/issue-97217.rs diff --git a/tests/codegen/issues/issue-101048.rs b/tests/codegen-llvm/issues/issue-101048.rs similarity index 100% rename from tests/codegen/issues/issue-101048.rs rename to tests/codegen-llvm/issues/issue-101048.rs diff --git a/tests/codegen/issues/issue-101082.rs b/tests/codegen-llvm/issues/issue-101082.rs similarity index 100% rename from tests/codegen/issues/issue-101082.rs rename to tests/codegen-llvm/issues/issue-101082.rs diff --git a/tests/codegen/issues/issue-101814.rs b/tests/codegen-llvm/issues/issue-101814.rs similarity index 100% rename from tests/codegen/issues/issue-101814.rs rename to tests/codegen-llvm/issues/issue-101814.rs diff --git a/tests/codegen/issues/issue-103132.rs b/tests/codegen-llvm/issues/issue-103132.rs similarity index 100% rename from tests/codegen/issues/issue-103132.rs rename to tests/codegen-llvm/issues/issue-103132.rs diff --git a/tests/codegen/issues/issue-103285-ptr-addr-overflow-check.rs b/tests/codegen-llvm/issues/issue-103285-ptr-addr-overflow-check.rs similarity index 100% rename from tests/codegen/issues/issue-103285-ptr-addr-overflow-check.rs rename to tests/codegen-llvm/issues/issue-103285-ptr-addr-overflow-check.rs diff --git a/tests/codegen/issues/issue-103327.rs b/tests/codegen-llvm/issues/issue-103327.rs similarity index 100% rename from tests/codegen/issues/issue-103327.rs rename to tests/codegen-llvm/issues/issue-103327.rs diff --git a/tests/codegen/issues/issue-103840.rs b/tests/codegen-llvm/issues/issue-103840.rs similarity index 100% rename from tests/codegen/issues/issue-103840.rs rename to tests/codegen-llvm/issues/issue-103840.rs diff --git a/tests/codegen/issues/issue-105386-ub-in-debuginfo.rs b/tests/codegen-llvm/issues/issue-105386-ub-in-debuginfo.rs similarity index 100% rename from tests/codegen/issues/issue-105386-ub-in-debuginfo.rs rename to tests/codegen-llvm/issues/issue-105386-ub-in-debuginfo.rs diff --git a/tests/codegen/issues/issue-106369.rs b/tests/codegen-llvm/issues/issue-106369.rs similarity index 100% rename from tests/codegen/issues/issue-106369.rs rename to tests/codegen-llvm/issues/issue-106369.rs diff --git a/tests/codegen/issues/issue-107681-unwrap_unchecked.rs b/tests/codegen-llvm/issues/issue-107681-unwrap_unchecked.rs similarity index 100% rename from tests/codegen/issues/issue-107681-unwrap_unchecked.rs rename to tests/codegen-llvm/issues/issue-107681-unwrap_unchecked.rs diff --git a/tests/codegen/issues/issue-108395-branchy-bool-match.rs b/tests/codegen-llvm/issues/issue-108395-branchy-bool-match.rs similarity index 100% rename from tests/codegen/issues/issue-108395-branchy-bool-match.rs rename to tests/codegen-llvm/issues/issue-108395-branchy-bool-match.rs diff --git a/tests/codegen/issues/issue-109328-split_first.rs b/tests/codegen-llvm/issues/issue-109328-split_first.rs similarity index 100% rename from tests/codegen/issues/issue-109328-split_first.rs rename to tests/codegen-llvm/issues/issue-109328-split_first.rs diff --git a/tests/codegen/issues/issue-110797-enum-jump-same.rs b/tests/codegen-llvm/issues/issue-110797-enum-jump-same.rs similarity index 100% rename from tests/codegen/issues/issue-110797-enum-jump-same.rs rename to tests/codegen-llvm/issues/issue-110797-enum-jump-same.rs diff --git a/tests/codegen/issues/issue-111603.rs b/tests/codegen-llvm/issues/issue-111603.rs similarity index 100% rename from tests/codegen/issues/issue-111603.rs rename to tests/codegen-llvm/issues/issue-111603.rs diff --git a/tests/codegen/issues/issue-112509-slice-get-andthen-get.rs b/tests/codegen-llvm/issues/issue-112509-slice-get-andthen-get.rs similarity index 100% rename from tests/codegen/issues/issue-112509-slice-get-andthen-get.rs rename to tests/codegen-llvm/issues/issue-112509-slice-get-andthen-get.rs diff --git a/tests/codegen/issues/issue-113757-bounds-check-after-cmp-max.rs b/tests/codegen-llvm/issues/issue-113757-bounds-check-after-cmp-max.rs similarity index 100% rename from tests/codegen/issues/issue-113757-bounds-check-after-cmp-max.rs rename to tests/codegen-llvm/issues/issue-113757-bounds-check-after-cmp-max.rs diff --git a/tests/codegen/issues/issue-114312.rs b/tests/codegen-llvm/issues/issue-114312.rs similarity index 100% rename from tests/codegen/issues/issue-114312.rs rename to tests/codegen-llvm/issues/issue-114312.rs diff --git a/tests/codegen/issues/issue-115385-llvm-jump-threading.rs b/tests/codegen-llvm/issues/issue-115385-llvm-jump-threading.rs similarity index 100% rename from tests/codegen/issues/issue-115385-llvm-jump-threading.rs rename to tests/codegen-llvm/issues/issue-115385-llvm-jump-threading.rs diff --git a/tests/codegen/issues/issue-116878.rs b/tests/codegen-llvm/issues/issue-116878.rs similarity index 100% rename from tests/codegen/issues/issue-116878.rs rename to tests/codegen-llvm/issues/issue-116878.rs diff --git a/tests/codegen/issues/issue-118306.rs b/tests/codegen-llvm/issues/issue-118306.rs similarity index 100% rename from tests/codegen/issues/issue-118306.rs rename to tests/codegen-llvm/issues/issue-118306.rs diff --git a/tests/codegen/issues/issue-118392.rs b/tests/codegen-llvm/issues/issue-118392.rs similarity index 100% rename from tests/codegen/issues/issue-118392.rs rename to tests/codegen-llvm/issues/issue-118392.rs diff --git a/tests/codegen/issues/issue-119422.rs b/tests/codegen-llvm/issues/issue-119422.rs similarity index 100% rename from tests/codegen/issues/issue-119422.rs rename to tests/codegen-llvm/issues/issue-119422.rs diff --git a/tests/codegen/issues/issue-121719-common-field-offset.rs b/tests/codegen-llvm/issues/issue-121719-common-field-offset.rs similarity index 100% rename from tests/codegen/issues/issue-121719-common-field-offset.rs rename to tests/codegen-llvm/issues/issue-121719-common-field-offset.rs diff --git a/tests/codegen/issues/issue-122600-ptr-discriminant-update.rs b/tests/codegen-llvm/issues/issue-122600-ptr-discriminant-update.rs similarity index 100% rename from tests/codegen/issues/issue-122600-ptr-discriminant-update.rs rename to tests/codegen-llvm/issues/issue-122600-ptr-discriminant-update.rs diff --git a/tests/codegen/issues/issue-123712-str-to-lower-autovectorization.rs b/tests/codegen-llvm/issues/issue-123712-str-to-lower-autovectorization.rs similarity index 100% rename from tests/codegen/issues/issue-123712-str-to-lower-autovectorization.rs rename to tests/codegen-llvm/issues/issue-123712-str-to-lower-autovectorization.rs diff --git a/tests/codegen/issues/issue-126585.rs b/tests/codegen-llvm/issues/issue-126585.rs similarity index 100% rename from tests/codegen/issues/issue-126585.rs rename to tests/codegen-llvm/issues/issue-126585.rs diff --git a/tests/codegen/issues/issue-129795.rs b/tests/codegen-llvm/issues/issue-129795.rs similarity index 100% rename from tests/codegen/issues/issue-129795.rs rename to tests/codegen-llvm/issues/issue-129795.rs diff --git a/tests/codegen/issues/issue-13018.rs b/tests/codegen-llvm/issues/issue-13018.rs similarity index 100% rename from tests/codegen/issues/issue-13018.rs rename to tests/codegen-llvm/issues/issue-13018.rs diff --git a/tests/codegen/issues/issue-136329-optnone-noinline.rs b/tests/codegen-llvm/issues/issue-136329-optnone-noinline.rs similarity index 100% rename from tests/codegen/issues/issue-136329-optnone-noinline.rs rename to tests/codegen-llvm/issues/issue-136329-optnone-noinline.rs diff --git a/tests/codegen/issues/issue-15953.rs b/tests/codegen-llvm/issues/issue-15953.rs similarity index 100% rename from tests/codegen/issues/issue-15953.rs rename to tests/codegen-llvm/issues/issue-15953.rs diff --git a/tests/codegen/issues/issue-27130.rs b/tests/codegen-llvm/issues/issue-27130.rs similarity index 100% rename from tests/codegen/issues/issue-27130.rs rename to tests/codegen-llvm/issues/issue-27130.rs diff --git a/tests/codegen/issues/issue-32031.rs b/tests/codegen-llvm/issues/issue-32031.rs similarity index 100% rename from tests/codegen/issues/issue-32031.rs rename to tests/codegen-llvm/issues/issue-32031.rs diff --git a/tests/codegen/issues/issue-32364.rs b/tests/codegen-llvm/issues/issue-32364.rs similarity index 100% rename from tests/codegen/issues/issue-32364.rs rename to tests/codegen-llvm/issues/issue-32364.rs diff --git a/tests/codegen/issues/issue-34634.rs b/tests/codegen-llvm/issues/issue-34634.rs similarity index 100% rename from tests/codegen/issues/issue-34634.rs rename to tests/codegen-llvm/issues/issue-34634.rs diff --git a/tests/codegen/issues/issue-34947-pow-i32.rs b/tests/codegen-llvm/issues/issue-34947-pow-i32.rs similarity index 100% rename from tests/codegen/issues/issue-34947-pow-i32.rs rename to tests/codegen-llvm/issues/issue-34947-pow-i32.rs diff --git a/tests/codegen/issues/issue-36010-some-box-is_some.rs b/tests/codegen-llvm/issues/issue-36010-some-box-is_some.rs similarity index 100% rename from tests/codegen/issues/issue-36010-some-box-is_some.rs rename to tests/codegen-llvm/issues/issue-36010-some-box-is_some.rs diff --git a/tests/codegen/issues/issue-37945.rs b/tests/codegen-llvm/issues/issue-37945.rs similarity index 100% rename from tests/codegen/issues/issue-37945.rs rename to tests/codegen-llvm/issues/issue-37945.rs diff --git a/tests/codegen/issues/issue-45222.rs b/tests/codegen-llvm/issues/issue-45222.rs similarity index 100% rename from tests/codegen/issues/issue-45222.rs rename to tests/codegen-llvm/issues/issue-45222.rs diff --git a/tests/codegen/issues/issue-45466.rs b/tests/codegen-llvm/issues/issue-45466.rs similarity index 100% rename from tests/codegen/issues/issue-45466.rs rename to tests/codegen-llvm/issues/issue-45466.rs diff --git a/tests/codegen/issues/issue-45964-bounds-check-slice-pos.rs b/tests/codegen-llvm/issues/issue-45964-bounds-check-slice-pos.rs similarity index 100% rename from tests/codegen/issues/issue-45964-bounds-check-slice-pos.rs rename to tests/codegen-llvm/issues/issue-45964-bounds-check-slice-pos.rs diff --git a/tests/codegen/issues/issue-47278.rs b/tests/codegen-llvm/issues/issue-47278.rs similarity index 100% rename from tests/codegen/issues/issue-47278.rs rename to tests/codegen-llvm/issues/issue-47278.rs diff --git a/tests/codegen/issues/issue-47442.rs b/tests/codegen-llvm/issues/issue-47442.rs similarity index 100% rename from tests/codegen/issues/issue-47442.rs rename to tests/codegen-llvm/issues/issue-47442.rs diff --git a/tests/codegen/issues/issue-56267-2.rs b/tests/codegen-llvm/issues/issue-56267-2.rs similarity index 100% rename from tests/codegen/issues/issue-56267-2.rs rename to tests/codegen-llvm/issues/issue-56267-2.rs diff --git a/tests/codegen/issues/issue-56267.rs b/tests/codegen-llvm/issues/issue-56267.rs similarity index 100% rename from tests/codegen/issues/issue-56267.rs rename to tests/codegen-llvm/issues/issue-56267.rs diff --git a/tests/codegen/issues/issue-56927.rs b/tests/codegen-llvm/issues/issue-56927.rs similarity index 100% rename from tests/codegen/issues/issue-56927.rs rename to tests/codegen-llvm/issues/issue-56927.rs diff --git a/tests/codegen/issues/issue-58881.rs b/tests/codegen-llvm/issues/issue-58881.rs similarity index 100% rename from tests/codegen/issues/issue-58881.rs rename to tests/codegen-llvm/issues/issue-58881.rs diff --git a/tests/codegen/issues/issue-59352.rs b/tests/codegen-llvm/issues/issue-59352.rs similarity index 100% rename from tests/codegen/issues/issue-59352.rs rename to tests/codegen-llvm/issues/issue-59352.rs diff --git a/tests/codegen/issues/issue-64219-fn-ptr-call-returning-never-is-noreturn.rs b/tests/codegen-llvm/issues/issue-64219-fn-ptr-call-returning-never-is-noreturn.rs similarity index 100% rename from tests/codegen/issues/issue-64219-fn-ptr-call-returning-never-is-noreturn.rs rename to tests/codegen-llvm/issues/issue-64219-fn-ptr-call-returning-never-is-noreturn.rs diff --git a/tests/codegen/issues/issue-68667-unwrap-combinators.rs b/tests/codegen-llvm/issues/issue-68667-unwrap-combinators.rs similarity index 100% rename from tests/codegen/issues/issue-68667-unwrap-combinators.rs rename to tests/codegen-llvm/issues/issue-68667-unwrap-combinators.rs diff --git a/tests/codegen/issues/issue-69101-bounds-check.rs b/tests/codegen-llvm/issues/issue-69101-bounds-check.rs similarity index 100% rename from tests/codegen/issues/issue-69101-bounds-check.rs rename to tests/codegen-llvm/issues/issue-69101-bounds-check.rs diff --git a/tests/codegen/issues/issue-73031.rs b/tests/codegen-llvm/issues/issue-73031.rs similarity index 100% rename from tests/codegen/issues/issue-73031.rs rename to tests/codegen-llvm/issues/issue-73031.rs diff --git a/tests/codegen/issues/issue-73258.rs b/tests/codegen-llvm/issues/issue-73258.rs similarity index 100% rename from tests/codegen/issues/issue-73258.rs rename to tests/codegen-llvm/issues/issue-73258.rs diff --git a/tests/codegen/issues/issue-73338-effecient-cmp.rs b/tests/codegen-llvm/issues/issue-73338-effecient-cmp.rs similarity index 100% rename from tests/codegen/issues/issue-73338-effecient-cmp.rs rename to tests/codegen-llvm/issues/issue-73338-effecient-cmp.rs diff --git a/tests/codegen/issues/issue-73396-bounds-check-after-position.rs b/tests/codegen-llvm/issues/issue-73396-bounds-check-after-position.rs similarity index 100% rename from tests/codegen/issues/issue-73396-bounds-check-after-position.rs rename to tests/codegen-llvm/issues/issue-73396-bounds-check-after-position.rs diff --git a/tests/codegen/issues/issue-73827-bounds-check-index-in-subexpr.rs b/tests/codegen-llvm/issues/issue-73827-bounds-check-index-in-subexpr.rs similarity index 100% rename from tests/codegen/issues/issue-73827-bounds-check-index-in-subexpr.rs rename to tests/codegen-llvm/issues/issue-73827-bounds-check-index-in-subexpr.rs diff --git a/tests/codegen/issues/issue-74938-array-split-at.rs b/tests/codegen-llvm/issues/issue-74938-array-split-at.rs similarity index 100% rename from tests/codegen/issues/issue-74938-array-split-at.rs rename to tests/codegen-llvm/issues/issue-74938-array-split-at.rs diff --git a/tests/codegen/issues/issue-75525-bounds-checks.rs b/tests/codegen-llvm/issues/issue-75525-bounds-checks.rs similarity index 100% rename from tests/codegen/issues/issue-75525-bounds-checks.rs rename to tests/codegen-llvm/issues/issue-75525-bounds-checks.rs diff --git a/tests/codegen/issues/issue-75546.rs b/tests/codegen-llvm/issues/issue-75546.rs similarity index 100% rename from tests/codegen/issues/issue-75546.rs rename to tests/codegen-llvm/issues/issue-75546.rs diff --git a/tests/codegen/issues/issue-75659.rs b/tests/codegen-llvm/issues/issue-75659.rs similarity index 100% rename from tests/codegen/issues/issue-75659.rs rename to tests/codegen-llvm/issues/issue-75659.rs diff --git a/tests/codegen/issues/issue-75978.rs b/tests/codegen-llvm/issues/issue-75978.rs similarity index 100% rename from tests/codegen/issues/issue-75978.rs rename to tests/codegen-llvm/issues/issue-75978.rs diff --git a/tests/codegen/issues/issue-77812.rs b/tests/codegen-llvm/issues/issue-77812.rs similarity index 100% rename from tests/codegen/issues/issue-77812.rs rename to tests/codegen-llvm/issues/issue-77812.rs diff --git a/tests/codegen/issues/issue-84268.rs b/tests/codegen-llvm/issues/issue-84268.rs similarity index 100% rename from tests/codegen/issues/issue-84268.rs rename to tests/codegen-llvm/issues/issue-84268.rs diff --git a/tests/codegen/issues/issue-85872-multiple-reverse.rs b/tests/codegen-llvm/issues/issue-85872-multiple-reverse.rs similarity index 100% rename from tests/codegen/issues/issue-85872-multiple-reverse.rs rename to tests/codegen-llvm/issues/issue-85872-multiple-reverse.rs diff --git a/tests/codegen/issues/issue-86106.rs b/tests/codegen-llvm/issues/issue-86106.rs similarity index 100% rename from tests/codegen/issues/issue-86106.rs rename to tests/codegen-llvm/issues/issue-86106.rs diff --git a/tests/codegen/issues/issue-86109-eliminate-div-by-zero-check.rs b/tests/codegen-llvm/issues/issue-86109-eliminate-div-by-zero-check.rs similarity index 100% rename from tests/codegen/issues/issue-86109-eliminate-div-by-zero-check.rs rename to tests/codegen-llvm/issues/issue-86109-eliminate-div-by-zero-check.rs diff --git a/tests/codegen/issues/issue-93036-assert-index.rs b/tests/codegen-llvm/issues/issue-93036-assert-index.rs similarity index 100% rename from tests/codegen/issues/issue-93036-assert-index.rs rename to tests/codegen-llvm/issues/issue-93036-assert-index.rs diff --git a/tests/codegen/issues/issue-96274.rs b/tests/codegen-llvm/issues/issue-96274.rs similarity index 100% rename from tests/codegen/issues/issue-96274.rs rename to tests/codegen-llvm/issues/issue-96274.rs diff --git a/tests/codegen/issues/issue-96497-slice-size-nowrap.rs b/tests/codegen-llvm/issues/issue-96497-slice-size-nowrap.rs similarity index 100% rename from tests/codegen/issues/issue-96497-slice-size-nowrap.rs rename to tests/codegen-llvm/issues/issue-96497-slice-size-nowrap.rs diff --git a/tests/codegen/issues/issue-98294-get-mut-copy-from-slice-opt.rs b/tests/codegen-llvm/issues/issue-98294-get-mut-copy-from-slice-opt.rs similarity index 100% rename from tests/codegen/issues/issue-98294-get-mut-copy-from-slice-opt.rs rename to tests/codegen-llvm/issues/issue-98294-get-mut-copy-from-slice-opt.rs diff --git a/tests/codegen/issues/issue-98678-async.rs b/tests/codegen-llvm/issues/issue-98678-async.rs similarity index 100% rename from tests/codegen/issues/issue-98678-async.rs rename to tests/codegen-llvm/issues/issue-98678-async.rs diff --git a/tests/codegen/issues/issue-98678-closure-coroutine.rs b/tests/codegen-llvm/issues/issue-98678-closure-coroutine.rs similarity index 100% rename from tests/codegen/issues/issue-98678-closure-coroutine.rs rename to tests/codegen-llvm/issues/issue-98678-closure-coroutine.rs diff --git a/tests/codegen/issues/issue-98678-enum.rs b/tests/codegen-llvm/issues/issue-98678-enum.rs similarity index 100% rename from tests/codegen/issues/issue-98678-enum.rs rename to tests/codegen-llvm/issues/issue-98678-enum.rs diff --git a/tests/codegen/issues/issue-98678-struct-union.rs b/tests/codegen-llvm/issues/issue-98678-struct-union.rs similarity index 100% rename from tests/codegen/issues/issue-98678-struct-union.rs rename to tests/codegen-llvm/issues/issue-98678-struct-union.rs diff --git a/tests/codegen/issues/issue-99960.rs b/tests/codegen-llvm/issues/issue-99960.rs similarity index 100% rename from tests/codegen/issues/issue-99960.rs rename to tests/codegen-llvm/issues/issue-99960.rs diff --git a/tests/codegen/issues/looping-over-ne-bytes-133528.rs b/tests/codegen-llvm/issues/looping-over-ne-bytes-133528.rs similarity index 100% rename from tests/codegen/issues/looping-over-ne-bytes-133528.rs rename to tests/codegen-llvm/issues/looping-over-ne-bytes-133528.rs diff --git a/tests/codegen/issues/str-to-string-128690.rs b/tests/codegen-llvm/issues/str-to-string-128690.rs similarity index 100% rename from tests/codegen/issues/str-to-string-128690.rs rename to tests/codegen-llvm/issues/str-to-string-128690.rs diff --git a/tests/codegen/iter-repeat-n-trivial-drop.rs b/tests/codegen-llvm/iter-repeat-n-trivial-drop.rs similarity index 100% rename from tests/codegen/iter-repeat-n-trivial-drop.rs rename to tests/codegen-llvm/iter-repeat-n-trivial-drop.rs diff --git a/tests/codegen/layout-size-checks.rs b/tests/codegen-llvm/layout-size-checks.rs similarity index 100% rename from tests/codegen/layout-size-checks.rs rename to tests/codegen-llvm/layout-size-checks.rs diff --git a/tests/codegen/lib-optimizations/iter-sum.rs b/tests/codegen-llvm/lib-optimizations/iter-sum.rs similarity index 100% rename from tests/codegen/lib-optimizations/iter-sum.rs rename to tests/codegen-llvm/lib-optimizations/iter-sum.rs diff --git a/tests/codegen/lib-optimizations/slice_rotate.rs b/tests/codegen-llvm/lib-optimizations/slice_rotate.rs similarity index 100% rename from tests/codegen/lib-optimizations/slice_rotate.rs rename to tests/codegen-llvm/lib-optimizations/slice_rotate.rs diff --git a/tests/codegen/lifetime_start_end.rs b/tests/codegen-llvm/lifetime_start_end.rs similarity index 100% rename from tests/codegen/lifetime_start_end.rs rename to tests/codegen-llvm/lifetime_start_end.rs diff --git a/tests/codegen/link-dead-code.rs b/tests/codegen-llvm/link-dead-code.rs similarity index 100% rename from tests/codegen/link-dead-code.rs rename to tests/codegen-llvm/link-dead-code.rs diff --git a/tests/codegen/link_section.rs b/tests/codegen-llvm/link_section.rs similarity index 100% rename from tests/codegen/link_section.rs rename to tests/codegen-llvm/link_section.rs diff --git a/tests/codegen/llvm-ident.rs b/tests/codegen-llvm/llvm-ident.rs similarity index 100% rename from tests/codegen/llvm-ident.rs rename to tests/codegen-llvm/llvm-ident.rs diff --git a/tests/codegen/llvm_module_flags.rs b/tests/codegen-llvm/llvm_module_flags.rs similarity index 100% rename from tests/codegen/llvm_module_flags.rs rename to tests/codegen-llvm/llvm_module_flags.rs diff --git a/tests/codegen/loads.rs b/tests/codegen-llvm/loads.rs similarity index 100% rename from tests/codegen/loads.rs rename to tests/codegen-llvm/loads.rs diff --git a/tests/codegen/local-generics-in-exe-internalized.rs b/tests/codegen-llvm/local-generics-in-exe-internalized.rs similarity index 100% rename from tests/codegen/local-generics-in-exe-internalized.rs rename to tests/codegen-llvm/local-generics-in-exe-internalized.rs diff --git a/tests/codegen/loongarch-abi/call-llvm-intrinsics.rs b/tests/codegen-llvm/loongarch-abi/call-llvm-intrinsics.rs similarity index 100% rename from tests/codegen/loongarch-abi/call-llvm-intrinsics.rs rename to tests/codegen-llvm/loongarch-abi/call-llvm-intrinsics.rs diff --git a/tests/codegen/loongarch-abi/loongarch64-lp64d-abi.rs b/tests/codegen-llvm/loongarch-abi/loongarch64-lp64d-abi.rs similarity index 100% rename from tests/codegen/loongarch-abi/loongarch64-lp64d-abi.rs rename to tests/codegen-llvm/loongarch-abi/loongarch64-lp64d-abi.rs diff --git a/tests/codegen/lto-removes-invokes.rs b/tests/codegen-llvm/lto-removes-invokes.rs similarity index 100% rename from tests/codegen/lto-removes-invokes.rs rename to tests/codegen-llvm/lto-removes-invokes.rs diff --git a/tests/codegen/macos/i686-macosx-deployment-target.rs b/tests/codegen-llvm/macos/i686-macosx-deployment-target.rs similarity index 100% rename from tests/codegen/macos/i686-macosx-deployment-target.rs rename to tests/codegen-llvm/macos/i686-macosx-deployment-target.rs diff --git a/tests/codegen/macos/i686-no-macosx-deployment-target.rs b/tests/codegen-llvm/macos/i686-no-macosx-deployment-target.rs similarity index 100% rename from tests/codegen/macos/i686-no-macosx-deployment-target.rs rename to tests/codegen-llvm/macos/i686-no-macosx-deployment-target.rs diff --git a/tests/codegen/macos/x86_64-macosx-deployment-target.rs b/tests/codegen-llvm/macos/x86_64-macosx-deployment-target.rs similarity index 100% rename from tests/codegen/macos/x86_64-macosx-deployment-target.rs rename to tests/codegen-llvm/macos/x86_64-macosx-deployment-target.rs diff --git a/tests/codegen/macos/x86_64-no-macosx-deployment-target.rs b/tests/codegen-llvm/macos/x86_64-no-macosx-deployment-target.rs similarity index 100% rename from tests/codegen/macos/x86_64-no-macosx-deployment-target.rs rename to tests/codegen-llvm/macos/x86_64-no-macosx-deployment-target.rs diff --git a/tests/codegen/mainsubprogram.rs b/tests/codegen-llvm/mainsubprogram.rs similarity index 100% rename from tests/codegen/mainsubprogram.rs rename to tests/codegen-llvm/mainsubprogram.rs diff --git a/tests/codegen/match-optimized.rs b/tests/codegen-llvm/match-optimized.rs similarity index 100% rename from tests/codegen/match-optimized.rs rename to tests/codegen-llvm/match-optimized.rs diff --git a/tests/codegen/match-optimizes-away.rs b/tests/codegen-llvm/match-optimizes-away.rs similarity index 100% rename from tests/codegen/match-optimizes-away.rs rename to tests/codegen-llvm/match-optimizes-away.rs diff --git a/tests/codegen/match-unoptimized.rs b/tests/codegen-llvm/match-unoptimized.rs similarity index 100% rename from tests/codegen/match-unoptimized.rs rename to tests/codegen-llvm/match-unoptimized.rs diff --git a/tests/codegen/maybeuninit-rvo.rs b/tests/codegen-llvm/maybeuninit-rvo.rs similarity index 100% rename from tests/codegen/maybeuninit-rvo.rs rename to tests/codegen-llvm/maybeuninit-rvo.rs diff --git a/tests/codegen/mem-replace-big-type.rs b/tests/codegen-llvm/mem-replace-big-type.rs similarity index 100% rename from tests/codegen/mem-replace-big-type.rs rename to tests/codegen-llvm/mem-replace-big-type.rs diff --git a/tests/codegen/mem-replace-simple-type.rs b/tests/codegen-llvm/mem-replace-simple-type.rs similarity index 100% rename from tests/codegen/mem-replace-simple-type.rs rename to tests/codegen-llvm/mem-replace-simple-type.rs diff --git a/tests/codegen/merge-functions.rs b/tests/codegen-llvm/merge-functions.rs similarity index 100% rename from tests/codegen/merge-functions.rs rename to tests/codegen-llvm/merge-functions.rs diff --git a/tests/codegen/meta-filecheck/check-prefix.rs b/tests/codegen-llvm/meta-filecheck/check-prefix.rs similarity index 100% rename from tests/codegen/meta-filecheck/check-prefix.rs rename to tests/codegen-llvm/meta-filecheck/check-prefix.rs diff --git a/tests/codegen/meta-filecheck/filecheck-flags.rs b/tests/codegen-llvm/meta-filecheck/filecheck-flags.rs similarity index 100% rename from tests/codegen/meta-filecheck/filecheck-flags.rs rename to tests/codegen-llvm/meta-filecheck/filecheck-flags.rs diff --git a/tests/codegen/meta-filecheck/msvc-prefix-bad.rs b/tests/codegen-llvm/meta-filecheck/msvc-prefix-bad.rs similarity index 100% rename from tests/codegen/meta-filecheck/msvc-prefix-bad.rs rename to tests/codegen-llvm/meta-filecheck/msvc-prefix-bad.rs diff --git a/tests/codegen/meta-filecheck/no-directives.rs b/tests/codegen-llvm/meta-filecheck/no-directives.rs similarity index 100% rename from tests/codegen/meta-filecheck/no-directives.rs rename to tests/codegen-llvm/meta-filecheck/no-directives.rs diff --git a/tests/codegen/meta-filecheck/revision-prefix.rs b/tests/codegen-llvm/meta-filecheck/revision-prefix.rs similarity index 100% rename from tests/codegen/meta-filecheck/revision-prefix.rs rename to tests/codegen-llvm/meta-filecheck/revision-prefix.rs diff --git a/tests/codegen/method-declaration.rs b/tests/codegen-llvm/method-declaration.rs similarity index 100% rename from tests/codegen/method-declaration.rs rename to tests/codegen-llvm/method-declaration.rs diff --git a/tests/codegen/min-function-alignment.rs b/tests/codegen-llvm/min-function-alignment.rs similarity index 100% rename from tests/codegen/min-function-alignment.rs rename to tests/codegen-llvm/min-function-alignment.rs diff --git a/tests/codegen/mir-aggregate-no-alloca.rs b/tests/codegen-llvm/mir-aggregate-no-alloca.rs similarity index 100% rename from tests/codegen/mir-aggregate-no-alloca.rs rename to tests/codegen-llvm/mir-aggregate-no-alloca.rs diff --git a/tests/codegen/mir-inlined-line-numbers.rs b/tests/codegen-llvm/mir-inlined-line-numbers.rs similarity index 100% rename from tests/codegen/mir-inlined-line-numbers.rs rename to tests/codegen-llvm/mir-inlined-line-numbers.rs diff --git a/tests/codegen/mir_zst_stores.rs b/tests/codegen-llvm/mir_zst_stores.rs similarity index 100% rename from tests/codegen/mir_zst_stores.rs rename to tests/codegen-llvm/mir_zst_stores.rs diff --git a/tests/codegen/move-before-nocapture-ref-arg.rs b/tests/codegen-llvm/move-before-nocapture-ref-arg.rs similarity index 100% rename from tests/codegen/move-before-nocapture-ref-arg.rs rename to tests/codegen-llvm/move-before-nocapture-ref-arg.rs diff --git a/tests/codegen/move-operands.rs b/tests/codegen-llvm/move-operands.rs similarity index 100% rename from tests/codegen/move-operands.rs rename to tests/codegen-llvm/move-operands.rs diff --git a/tests/codegen/naked-asan.rs b/tests/codegen-llvm/naked-asan.rs similarity index 100% rename from tests/codegen/naked-asan.rs rename to tests/codegen-llvm/naked-asan.rs diff --git a/tests/codegen/naked-fn/aligned.rs b/tests/codegen-llvm/naked-fn/aligned.rs similarity index 100% rename from tests/codegen/naked-fn/aligned.rs rename to tests/codegen-llvm/naked-fn/aligned.rs diff --git a/tests/codegen/naked-fn/generics.rs b/tests/codegen-llvm/naked-fn/generics.rs similarity index 100% rename from tests/codegen/naked-fn/generics.rs rename to tests/codegen-llvm/naked-fn/generics.rs diff --git a/tests/codegen/naked-fn/instruction-set.rs b/tests/codegen-llvm/naked-fn/instruction-set.rs similarity index 100% rename from tests/codegen/naked-fn/instruction-set.rs rename to tests/codegen-llvm/naked-fn/instruction-set.rs diff --git a/tests/codegen/naked-fn/min-function-alignment.rs b/tests/codegen-llvm/naked-fn/min-function-alignment.rs similarity index 100% rename from tests/codegen/naked-fn/min-function-alignment.rs rename to tests/codegen-llvm/naked-fn/min-function-alignment.rs diff --git a/tests/codegen/naked-fn/naked-functions.rs b/tests/codegen-llvm/naked-fn/naked-functions.rs similarity index 100% rename from tests/codegen/naked-fn/naked-functions.rs rename to tests/codegen-llvm/naked-fn/naked-functions.rs diff --git a/tests/codegen/no-alloca-inside-if-false.rs b/tests/codegen-llvm/no-alloca-inside-if-false.rs similarity index 100% rename from tests/codegen/no-alloca-inside-if-false.rs rename to tests/codegen-llvm/no-alloca-inside-if-false.rs diff --git a/tests/codegen/no-assumes-on-casts.rs b/tests/codegen-llvm/no-assumes-on-casts.rs similarity index 100% rename from tests/codegen/no-assumes-on-casts.rs rename to tests/codegen-llvm/no-assumes-on-casts.rs diff --git a/tests/codegen/no-dllimport-w-cross-lang-lto.rs b/tests/codegen-llvm/no-dllimport-w-cross-lang-lto.rs similarity index 100% rename from tests/codegen/no-dllimport-w-cross-lang-lto.rs rename to tests/codegen-llvm/no-dllimport-w-cross-lang-lto.rs diff --git a/tests/codegen/no-jump-tables.rs b/tests/codegen-llvm/no-jump-tables.rs similarity index 100% rename from tests/codegen/no-jump-tables.rs rename to tests/codegen-llvm/no-jump-tables.rs diff --git a/tests/codegen/no-plt.rs b/tests/codegen-llvm/no-plt.rs similarity index 100% rename from tests/codegen/no-plt.rs rename to tests/codegen-llvm/no-plt.rs diff --git a/tests/codegen/no-redundant-item-monomorphization.rs b/tests/codegen-llvm/no-redundant-item-monomorphization.rs similarity index 100% rename from tests/codegen/no-redundant-item-monomorphization.rs rename to tests/codegen-llvm/no-redundant-item-monomorphization.rs diff --git a/tests/codegen/no_builtins-at-crate.rs b/tests/codegen-llvm/no_builtins-at-crate.rs similarity index 100% rename from tests/codegen/no_builtins-at-crate.rs rename to tests/codegen-llvm/no_builtins-at-crate.rs diff --git a/tests/codegen/noalias-box-off.rs b/tests/codegen-llvm/noalias-box-off.rs similarity index 100% rename from tests/codegen/noalias-box-off.rs rename to tests/codegen-llvm/noalias-box-off.rs diff --git a/tests/codegen/noalias-box.rs b/tests/codegen-llvm/noalias-box.rs similarity index 100% rename from tests/codegen/noalias-box.rs rename to tests/codegen-llvm/noalias-box.rs diff --git a/tests/codegen/noalias-flag.rs b/tests/codegen-llvm/noalias-flag.rs similarity index 100% rename from tests/codegen/noalias-flag.rs rename to tests/codegen-llvm/noalias-flag.rs diff --git a/tests/codegen/noalias-freeze.rs b/tests/codegen-llvm/noalias-freeze.rs similarity index 100% rename from tests/codegen/noalias-freeze.rs rename to tests/codegen-llvm/noalias-freeze.rs diff --git a/tests/codegen/noalias-refcell.rs b/tests/codegen-llvm/noalias-refcell.rs similarity index 100% rename from tests/codegen/noalias-refcell.rs rename to tests/codegen-llvm/noalias-refcell.rs diff --git a/tests/codegen/noalias-rwlockreadguard.rs b/tests/codegen-llvm/noalias-rwlockreadguard.rs similarity index 100% rename from tests/codegen/noalias-rwlockreadguard.rs rename to tests/codegen-llvm/noalias-rwlockreadguard.rs diff --git a/tests/codegen/noalias-unpin.rs b/tests/codegen-llvm/noalias-unpin.rs similarity index 100% rename from tests/codegen/noalias-unpin.rs rename to tests/codegen-llvm/noalias-unpin.rs diff --git a/tests/codegen/non-terminate/infinite-loop-1.rs b/tests/codegen-llvm/non-terminate/infinite-loop-1.rs similarity index 100% rename from tests/codegen/non-terminate/infinite-loop-1.rs rename to tests/codegen-llvm/non-terminate/infinite-loop-1.rs diff --git a/tests/codegen/non-terminate/infinite-loop-2.rs b/tests/codegen-llvm/non-terminate/infinite-loop-2.rs similarity index 100% rename from tests/codegen/non-terminate/infinite-loop-2.rs rename to tests/codegen-llvm/non-terminate/infinite-loop-2.rs diff --git a/tests/codegen/non-terminate/infinite-recursion.rs b/tests/codegen-llvm/non-terminate/infinite-recursion.rs similarity index 100% rename from tests/codegen/non-terminate/infinite-recursion.rs rename to tests/codegen-llvm/non-terminate/infinite-recursion.rs diff --git a/tests/codegen/non-terminate/nonempty-infinite-loop.rs b/tests/codegen-llvm/non-terminate/nonempty-infinite-loop.rs similarity index 100% rename from tests/codegen/non-terminate/nonempty-infinite-loop.rs rename to tests/codegen-llvm/non-terminate/nonempty-infinite-loop.rs diff --git a/tests/codegen/noreturn-uninhabited.rs b/tests/codegen-llvm/noreturn-uninhabited.rs similarity index 100% rename from tests/codegen/noreturn-uninhabited.rs rename to tests/codegen-llvm/noreturn-uninhabited.rs diff --git a/tests/codegen/noreturnflag.rs b/tests/codegen-llvm/noreturnflag.rs similarity index 100% rename from tests/codegen/noreturnflag.rs rename to tests/codegen-llvm/noreturnflag.rs diff --git a/tests/codegen/nounwind.rs b/tests/codegen-llvm/nounwind.rs similarity index 100% rename from tests/codegen/nounwind.rs rename to tests/codegen-llvm/nounwind.rs diff --git a/tests/codegen/nrvo.rs b/tests/codegen-llvm/nrvo.rs similarity index 100% rename from tests/codegen/nrvo.rs rename to tests/codegen-llvm/nrvo.rs diff --git a/tests/codegen/optimize-attr-1.rs b/tests/codegen-llvm/optimize-attr-1.rs similarity index 100% rename from tests/codegen/optimize-attr-1.rs rename to tests/codegen-llvm/optimize-attr-1.rs diff --git a/tests/codegen/option-as-slice.rs b/tests/codegen-llvm/option-as-slice.rs similarity index 100% rename from tests/codegen/option-as-slice.rs rename to tests/codegen-llvm/option-as-slice.rs diff --git a/tests/codegen/option-niche-eq.rs b/tests/codegen-llvm/option-niche-eq.rs similarity index 100% rename from tests/codegen/option-niche-eq.rs rename to tests/codegen-llvm/option-niche-eq.rs diff --git a/tests/codegen/option-niche-unfixed/option-nonzero-eq.rs b/tests/codegen-llvm/option-niche-unfixed/option-nonzero-eq.rs similarity index 100% rename from tests/codegen/option-niche-unfixed/option-nonzero-eq.rs rename to tests/codegen-llvm/option-niche-unfixed/option-nonzero-eq.rs diff --git a/tests/codegen/overaligned-constant.rs b/tests/codegen-llvm/overaligned-constant.rs similarity index 100% rename from tests/codegen/overaligned-constant.rs rename to tests/codegen-llvm/overaligned-constant.rs diff --git a/tests/codegen/packed.rs b/tests/codegen-llvm/packed.rs similarity index 100% rename from tests/codegen/packed.rs rename to tests/codegen-llvm/packed.rs diff --git a/tests/codegen/panic-abort-windows.rs b/tests/codegen-llvm/panic-abort-windows.rs similarity index 100% rename from tests/codegen/panic-abort-windows.rs rename to tests/codegen-llvm/panic-abort-windows.rs diff --git a/tests/codegen/panic-in-drop-abort.rs b/tests/codegen-llvm/panic-in-drop-abort.rs similarity index 100% rename from tests/codegen/panic-in-drop-abort.rs rename to tests/codegen-llvm/panic-in-drop-abort.rs diff --git a/tests/codegen/panic-unwind-default-uwtable.rs b/tests/codegen-llvm/panic-unwind-default-uwtable.rs similarity index 100% rename from tests/codegen/panic-unwind-default-uwtable.rs rename to tests/codegen-llvm/panic-unwind-default-uwtable.rs diff --git a/tests/codegen/patchable-function-entry/patchable-function-entry-both-flags.rs b/tests/codegen-llvm/patchable-function-entry/patchable-function-entry-both-flags.rs similarity index 100% rename from tests/codegen/patchable-function-entry/patchable-function-entry-both-flags.rs rename to tests/codegen-llvm/patchable-function-entry/patchable-function-entry-both-flags.rs diff --git a/tests/codegen/patchable-function-entry/patchable-function-entry-no-flag.rs b/tests/codegen-llvm/patchable-function-entry/patchable-function-entry-no-flag.rs similarity index 100% rename from tests/codegen/patchable-function-entry/patchable-function-entry-no-flag.rs rename to tests/codegen-llvm/patchable-function-entry/patchable-function-entry-no-flag.rs diff --git a/tests/codegen/patchable-function-entry/patchable-function-entry-one-flag.rs b/tests/codegen-llvm/patchable-function-entry/patchable-function-entry-one-flag.rs similarity index 100% rename from tests/codegen/patchable-function-entry/patchable-function-entry-one-flag.rs rename to tests/codegen-llvm/patchable-function-entry/patchable-function-entry-one-flag.rs diff --git a/tests/codegen/pattern_type_symbols.rs b/tests/codegen-llvm/pattern_type_symbols.rs similarity index 100% rename from tests/codegen/pattern_type_symbols.rs rename to tests/codegen-llvm/pattern_type_symbols.rs diff --git a/tests/codegen/personality_lifetimes.rs b/tests/codegen-llvm/personality_lifetimes.rs similarity index 100% rename from tests/codegen/personality_lifetimes.rs rename to tests/codegen-llvm/personality_lifetimes.rs diff --git a/tests/codegen/pgo-counter-bias.rs b/tests/codegen-llvm/pgo-counter-bias.rs similarity index 100% rename from tests/codegen/pgo-counter-bias.rs rename to tests/codegen-llvm/pgo-counter-bias.rs diff --git a/tests/codegen/pgo-instrumentation.rs b/tests/codegen-llvm/pgo-instrumentation.rs similarity index 100% rename from tests/codegen/pgo-instrumentation.rs rename to tests/codegen-llvm/pgo-instrumentation.rs diff --git a/tests/codegen/pic-relocation-model.rs b/tests/codegen-llvm/pic-relocation-model.rs similarity index 100% rename from tests/codegen/pic-relocation-model.rs rename to tests/codegen-llvm/pic-relocation-model.rs diff --git a/tests/codegen/pie-relocation-model.rs b/tests/codegen-llvm/pie-relocation-model.rs similarity index 100% rename from tests/codegen/pie-relocation-model.rs rename to tests/codegen-llvm/pie-relocation-model.rs diff --git a/tests/codegen/placement-new.rs b/tests/codegen-llvm/placement-new.rs similarity index 100% rename from tests/codegen/placement-new.rs rename to tests/codegen-llvm/placement-new.rs diff --git a/tests/codegen/powerpc64le-struct-align-128.rs b/tests/codegen-llvm/powerpc64le-struct-align-128.rs similarity index 100% rename from tests/codegen/powerpc64le-struct-align-128.rs rename to tests/codegen-llvm/powerpc64le-struct-align-128.rs diff --git a/tests/codegen/precondition-checks.rs b/tests/codegen-llvm/precondition-checks.rs similarity index 100% rename from tests/codegen/precondition-checks.rs rename to tests/codegen-llvm/precondition-checks.rs diff --git a/tests/codegen/ptr-arithmetic.rs b/tests/codegen-llvm/ptr-arithmetic.rs similarity index 100% rename from tests/codegen/ptr-arithmetic.rs rename to tests/codegen-llvm/ptr-arithmetic.rs diff --git a/tests/codegen/ptr-read-metadata.rs b/tests/codegen-llvm/ptr-read-metadata.rs similarity index 100% rename from tests/codegen/ptr-read-metadata.rs rename to tests/codegen-llvm/ptr-read-metadata.rs diff --git a/tests/codegen/range-attribute.rs b/tests/codegen-llvm/range-attribute.rs similarity index 100% rename from tests/codegen/range-attribute.rs rename to tests/codegen-llvm/range-attribute.rs diff --git a/tests/codegen/range-loop.rs b/tests/codegen-llvm/range-loop.rs similarity index 100% rename from tests/codegen/range-loop.rs rename to tests/codegen-llvm/range-loop.rs diff --git a/tests/codegen/range_to_inclusive.rs b/tests/codegen-llvm/range_to_inclusive.rs similarity index 100% rename from tests/codegen/range_to_inclusive.rs rename to tests/codegen-llvm/range_to_inclusive.rs diff --git a/tests/codegen/refs.rs b/tests/codegen-llvm/refs.rs similarity index 100% rename from tests/codegen/refs.rs rename to tests/codegen-llvm/refs.rs diff --git a/tests/codegen/reg-struct-return.rs b/tests/codegen-llvm/reg-struct-return.rs similarity index 100% rename from tests/codegen/reg-struct-return.rs rename to tests/codegen-llvm/reg-struct-return.rs diff --git a/tests/codegen/regparm-inreg.rs b/tests/codegen-llvm/regparm-inreg.rs similarity index 100% rename from tests/codegen/regparm-inreg.rs rename to tests/codegen-llvm/regparm-inreg.rs diff --git a/tests/codegen/remap_path_prefix/aux_mod.rs b/tests/codegen-llvm/remap_path_prefix/aux_mod.rs similarity index 100% rename from tests/codegen/remap_path_prefix/aux_mod.rs rename to tests/codegen-llvm/remap_path_prefix/aux_mod.rs diff --git a/tests/codegen/remap_path_prefix/auxiliary/remap_path_prefix_aux.rs b/tests/codegen-llvm/remap_path_prefix/auxiliary/remap_path_prefix_aux.rs similarity index 100% rename from tests/codegen/remap_path_prefix/auxiliary/remap_path_prefix_aux.rs rename to tests/codegen-llvm/remap_path_prefix/auxiliary/remap_path_prefix_aux.rs diff --git a/tests/codegen/remap_path_prefix/auxiliary/xcrate-generic.rs b/tests/codegen-llvm/remap_path_prefix/auxiliary/xcrate-generic.rs similarity index 100% rename from tests/codegen/remap_path_prefix/auxiliary/xcrate-generic.rs rename to tests/codegen-llvm/remap_path_prefix/auxiliary/xcrate-generic.rs diff --git a/tests/codegen/remap_path_prefix/issue-73167-remap-std.rs b/tests/codegen-llvm/remap_path_prefix/issue-73167-remap-std.rs similarity index 100% rename from tests/codegen/remap_path_prefix/issue-73167-remap-std.rs rename to tests/codegen-llvm/remap_path_prefix/issue-73167-remap-std.rs diff --git a/tests/codegen/remap_path_prefix/main.rs b/tests/codegen-llvm/remap_path_prefix/main.rs similarity index 100% rename from tests/codegen/remap_path_prefix/main.rs rename to tests/codegen-llvm/remap_path_prefix/main.rs diff --git a/tests/codegen/remap_path_prefix/xcrate-generic.rs b/tests/codegen-llvm/remap_path_prefix/xcrate-generic.rs similarity index 100% rename from tests/codegen/remap_path_prefix/xcrate-generic.rs rename to tests/codegen-llvm/remap_path_prefix/xcrate-generic.rs diff --git a/tests/codegen/repeat-operand-zero-len.rs b/tests/codegen-llvm/repeat-operand-zero-len.rs similarity index 100% rename from tests/codegen/repeat-operand-zero-len.rs rename to tests/codegen-llvm/repeat-operand-zero-len.rs diff --git a/tests/codegen/repeat-operand-zst-elem.rs b/tests/codegen-llvm/repeat-operand-zst-elem.rs similarity index 100% rename from tests/codegen/repeat-operand-zst-elem.rs rename to tests/codegen-llvm/repeat-operand-zst-elem.rs diff --git a/tests/codegen/repeat-trusted-len.rs b/tests/codegen-llvm/repeat-trusted-len.rs similarity index 100% rename from tests/codegen/repeat-trusted-len.rs rename to tests/codegen-llvm/repeat-trusted-len.rs diff --git a/tests/codegen/repr/transparent-byval-struct-ptr.rs b/tests/codegen-llvm/repr/transparent-byval-struct-ptr.rs similarity index 100% rename from tests/codegen/repr/transparent-byval-struct-ptr.rs rename to tests/codegen-llvm/repr/transparent-byval-struct-ptr.rs diff --git a/tests/codegen/repr/transparent-imm-array.rs b/tests/codegen-llvm/repr/transparent-imm-array.rs similarity index 100% rename from tests/codegen/repr/transparent-imm-array.rs rename to tests/codegen-llvm/repr/transparent-imm-array.rs diff --git a/tests/codegen/repr/transparent-mips64.rs b/tests/codegen-llvm/repr/transparent-mips64.rs similarity index 100% rename from tests/codegen/repr/transparent-mips64.rs rename to tests/codegen-llvm/repr/transparent-mips64.rs diff --git a/tests/codegen/repr/transparent-opaque-ptr.rs b/tests/codegen-llvm/repr/transparent-opaque-ptr.rs similarity index 100% rename from tests/codegen/repr/transparent-opaque-ptr.rs rename to tests/codegen-llvm/repr/transparent-opaque-ptr.rs diff --git a/tests/codegen/repr/transparent-sparc64.rs b/tests/codegen-llvm/repr/transparent-sparc64.rs similarity index 100% rename from tests/codegen/repr/transparent-sparc64.rs rename to tests/codegen-llvm/repr/transparent-sparc64.rs diff --git a/tests/codegen/repr/transparent-sysv64.rs b/tests/codegen-llvm/repr/transparent-sysv64.rs similarity index 100% rename from tests/codegen/repr/transparent-sysv64.rs rename to tests/codegen-llvm/repr/transparent-sysv64.rs diff --git a/tests/codegen/repr/transparent.rs b/tests/codegen-llvm/repr/transparent.rs similarity index 100% rename from tests/codegen/repr/transparent.rs rename to tests/codegen-llvm/repr/transparent.rs diff --git a/tests/codegen/retpoline.rs b/tests/codegen-llvm/retpoline.rs similarity index 100% rename from tests/codegen/retpoline.rs rename to tests/codegen-llvm/retpoline.rs diff --git a/tests/codegen/riscv-abi/call-llvm-intrinsics.rs b/tests/codegen-llvm/riscv-abi/call-llvm-intrinsics.rs similarity index 100% rename from tests/codegen/riscv-abi/call-llvm-intrinsics.rs rename to tests/codegen-llvm/riscv-abi/call-llvm-intrinsics.rs diff --git a/tests/codegen/riscv-abi/cast-local-large-enough.rs b/tests/codegen-llvm/riscv-abi/cast-local-large-enough.rs similarity index 100% rename from tests/codegen/riscv-abi/cast-local-large-enough.rs rename to tests/codegen-llvm/riscv-abi/cast-local-large-enough.rs diff --git a/tests/codegen/riscv-abi/riscv64-lp64-lp64f-lp64d-abi.rs b/tests/codegen-llvm/riscv-abi/riscv64-lp64-lp64f-lp64d-abi.rs similarity index 100% rename from tests/codegen/riscv-abi/riscv64-lp64-lp64f-lp64d-abi.rs rename to tests/codegen-llvm/riscv-abi/riscv64-lp64-lp64f-lp64d-abi.rs diff --git a/tests/codegen/riscv-abi/riscv64-lp64d-abi.rs b/tests/codegen-llvm/riscv-abi/riscv64-lp64d-abi.rs similarity index 100% rename from tests/codegen/riscv-abi/riscv64-lp64d-abi.rs rename to tests/codegen-llvm/riscv-abi/riscv64-lp64d-abi.rs diff --git a/tests/codegen/riscv-abi/riscv64-lp64f-lp64d-abi.rs b/tests/codegen-llvm/riscv-abi/riscv64-lp64f-lp64d-abi.rs similarity index 100% rename from tests/codegen/riscv-abi/riscv64-lp64f-lp64d-abi.rs rename to tests/codegen-llvm/riscv-abi/riscv64-lp64f-lp64d-abi.rs diff --git a/tests/codegen/riscv-target-abi.rs b/tests/codegen-llvm/riscv-target-abi.rs similarity index 100% rename from tests/codegen/riscv-target-abi.rs rename to tests/codegen-llvm/riscv-target-abi.rs diff --git a/tests/codegen/rust-abi-arch-specific-adjustment.rs b/tests/codegen-llvm/rust-abi-arch-specific-adjustment.rs similarity index 100% rename from tests/codegen/rust-abi-arch-specific-adjustment.rs rename to tests/codegen-llvm/rust-abi-arch-specific-adjustment.rs diff --git a/tests/codegen/s390x-simd.rs b/tests/codegen-llvm/s390x-simd.rs similarity index 100% rename from tests/codegen/s390x-simd.rs rename to tests/codegen-llvm/s390x-simd.rs diff --git a/tests/codegen/sanitizer/aarch64-shadow-call-stack-with-fixed-x18.rs b/tests/codegen-llvm/sanitizer/aarch64-shadow-call-stack-with-fixed-x18.rs similarity index 100% rename from tests/codegen/sanitizer/aarch64-shadow-call-stack-with-fixed-x18.rs rename to tests/codegen-llvm/sanitizer/aarch64-shadow-call-stack-with-fixed-x18.rs diff --git a/tests/codegen/sanitizer/address-sanitizer-globals-tracking.rs b/tests/codegen-llvm/sanitizer/address-sanitizer-globals-tracking.rs similarity index 100% rename from tests/codegen/sanitizer/address-sanitizer-globals-tracking.rs rename to tests/codegen-llvm/sanitizer/address-sanitizer-globals-tracking.rs diff --git a/tests/codegen/sanitizer/cfi/add-canonical-jump-tables-flag.rs b/tests/codegen-llvm/sanitizer/cfi/add-canonical-jump-tables-flag.rs similarity index 100% rename from tests/codegen/sanitizer/cfi/add-canonical-jump-tables-flag.rs rename to tests/codegen-llvm/sanitizer/cfi/add-canonical-jump-tables-flag.rs diff --git a/tests/codegen/sanitizer/cfi/add-cfi-normalize-integers-flag.rs b/tests/codegen-llvm/sanitizer/cfi/add-cfi-normalize-integers-flag.rs similarity index 100% rename from tests/codegen/sanitizer/cfi/add-cfi-normalize-integers-flag.rs rename to tests/codegen-llvm/sanitizer/cfi/add-cfi-normalize-integers-flag.rs diff --git a/tests/codegen/sanitizer/cfi/add-enable-split-lto-unit-flag.rs b/tests/codegen-llvm/sanitizer/cfi/add-enable-split-lto-unit-flag.rs similarity index 100% rename from tests/codegen/sanitizer/cfi/add-enable-split-lto-unit-flag.rs rename to tests/codegen-llvm/sanitizer/cfi/add-enable-split-lto-unit-flag.rs diff --git a/tests/codegen/sanitizer/cfi/dbg-location-on-cfi-blocks.rs b/tests/codegen-llvm/sanitizer/cfi/dbg-location-on-cfi-blocks.rs similarity index 100% rename from tests/codegen/sanitizer/cfi/dbg-location-on-cfi-blocks.rs rename to tests/codegen-llvm/sanitizer/cfi/dbg-location-on-cfi-blocks.rs diff --git a/tests/codegen/sanitizer/cfi/emit-type-checks-attr-no-sanitize.rs b/tests/codegen-llvm/sanitizer/cfi/emit-type-checks-attr-no-sanitize.rs similarity index 100% rename from tests/codegen/sanitizer/cfi/emit-type-checks-attr-no-sanitize.rs rename to tests/codegen-llvm/sanitizer/cfi/emit-type-checks-attr-no-sanitize.rs diff --git a/tests/codegen/sanitizer/cfi/emit-type-checks.rs b/tests/codegen-llvm/sanitizer/cfi/emit-type-checks.rs similarity index 100% rename from tests/codegen/sanitizer/cfi/emit-type-checks.rs rename to tests/codegen-llvm/sanitizer/cfi/emit-type-checks.rs diff --git a/tests/codegen/sanitizer/cfi/emit-type-metadata-attr-cfi-encoding.rs b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-attr-cfi-encoding.rs similarity index 100% rename from tests/codegen/sanitizer/cfi/emit-type-metadata-attr-cfi-encoding.rs rename to tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-attr-cfi-encoding.rs diff --git a/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-const-generics.rs b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-const-generics.rs similarity index 100% rename from tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-const-generics.rs rename to tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-const-generics.rs diff --git a/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-drop-in-place.rs b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-drop-in-place.rs similarity index 100% rename from tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-drop-in-place.rs rename to tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-drop-in-place.rs diff --git a/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-function-types.rs b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-function-types.rs similarity index 100% rename from tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-function-types.rs rename to tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-function-types.rs diff --git a/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-lifetimes.rs b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-lifetimes.rs similarity index 100% rename from tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-lifetimes.rs rename to tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-lifetimes.rs diff --git a/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-method-secondary-typeid.rs b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-method-secondary-typeid.rs similarity index 100% rename from tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-method-secondary-typeid.rs rename to tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-method-secondary-typeid.rs diff --git a/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-paths.rs b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-paths.rs similarity index 100% rename from tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-paths.rs rename to tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-paths.rs diff --git a/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-pointer-types.rs b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-pointer-types.rs similarity index 100% rename from tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-pointer-types.rs rename to tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-pointer-types.rs diff --git a/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-primitive-types.rs b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-primitive-types.rs similarity index 100% rename from tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-primitive-types.rs rename to tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-primitive-types.rs diff --git a/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-repr-transparent-types.rs b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-repr-transparent-types.rs similarity index 100% rename from tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-repr-transparent-types.rs rename to tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-repr-transparent-types.rs diff --git a/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-sequence-types.rs b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-sequence-types.rs similarity index 100% rename from tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-sequence-types.rs rename to tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-sequence-types.rs diff --git a/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-trait-types.rs b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-trait-types.rs similarity index 100% rename from tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-trait-types.rs rename to tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-trait-types.rs diff --git a/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-user-defined-types.rs b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-user-defined-types.rs similarity index 100% rename from tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-user-defined-types.rs rename to tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-user-defined-types.rs diff --git a/tests/codegen/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi-generalized.rs b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi-generalized.rs similarity index 100% rename from tests/codegen/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi-generalized.rs rename to tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi-generalized.rs diff --git a/tests/codegen/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi-normalized-generalized.rs b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi-normalized-generalized.rs similarity index 100% rename from tests/codegen/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi-normalized-generalized.rs rename to tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi-normalized-generalized.rs diff --git a/tests/codegen/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi-normalized.rs b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi-normalized.rs similarity index 100% rename from tests/codegen/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi-normalized.rs rename to tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi-normalized.rs diff --git a/tests/codegen/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi.rs b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi.rs similarity index 100% rename from tests/codegen/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi.rs rename to tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi.rs diff --git a/tests/codegen/sanitizer/cfi/emit-type-metadata-trait-objects.rs b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-trait-objects.rs similarity index 100% rename from tests/codegen/sanitizer/cfi/emit-type-metadata-trait-objects.rs rename to tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-trait-objects.rs diff --git a/tests/codegen/sanitizer/cfi/external_weak_symbols.rs b/tests/codegen-llvm/sanitizer/cfi/external_weak_symbols.rs similarity index 100% rename from tests/codegen/sanitizer/cfi/external_weak_symbols.rs rename to tests/codegen-llvm/sanitizer/cfi/external_weak_symbols.rs diff --git a/tests/codegen/sanitizer/cfi/generalize-pointers.rs b/tests/codegen-llvm/sanitizer/cfi/generalize-pointers.rs similarity index 100% rename from tests/codegen/sanitizer/cfi/generalize-pointers.rs rename to tests/codegen-llvm/sanitizer/cfi/generalize-pointers.rs diff --git a/tests/codegen/sanitizer/cfi/normalize-integers.rs b/tests/codegen-llvm/sanitizer/cfi/normalize-integers.rs similarity index 100% rename from tests/codegen/sanitizer/cfi/normalize-integers.rs rename to tests/codegen-llvm/sanitizer/cfi/normalize-integers.rs diff --git a/tests/codegen/sanitizer/dataflow-instrument-functions.rs b/tests/codegen-llvm/sanitizer/dataflow-instrument-functions.rs similarity index 100% rename from tests/codegen/sanitizer/dataflow-instrument-functions.rs rename to tests/codegen-llvm/sanitizer/dataflow-instrument-functions.rs diff --git a/tests/codegen/sanitizer/kasan-emits-instrumentation.rs b/tests/codegen-llvm/sanitizer/kasan-emits-instrumentation.rs similarity index 100% rename from tests/codegen/sanitizer/kasan-emits-instrumentation.rs rename to tests/codegen-llvm/sanitizer/kasan-emits-instrumentation.rs diff --git a/tests/codegen/sanitizer/kcfi/add-cfi-normalize-integers-flag.rs b/tests/codegen-llvm/sanitizer/kcfi/add-cfi-normalize-integers-flag.rs similarity index 100% rename from tests/codegen/sanitizer/kcfi/add-cfi-normalize-integers-flag.rs rename to tests/codegen-llvm/sanitizer/kcfi/add-cfi-normalize-integers-flag.rs diff --git a/tests/codegen/sanitizer/kcfi/add-kcfi-arity-flag.rs b/tests/codegen-llvm/sanitizer/kcfi/add-kcfi-arity-flag.rs similarity index 100% rename from tests/codegen/sanitizer/kcfi/add-kcfi-arity-flag.rs rename to tests/codegen-llvm/sanitizer/kcfi/add-kcfi-arity-flag.rs diff --git a/tests/codegen/sanitizer/kcfi/add-kcfi-flag.rs b/tests/codegen-llvm/sanitizer/kcfi/add-kcfi-flag.rs similarity index 100% rename from tests/codegen/sanitizer/kcfi/add-kcfi-flag.rs rename to tests/codegen-llvm/sanitizer/kcfi/add-kcfi-flag.rs diff --git a/tests/codegen/sanitizer/kcfi/add-kcfi-offset-flag.rs b/tests/codegen-llvm/sanitizer/kcfi/add-kcfi-offset-flag.rs similarity index 100% rename from tests/codegen/sanitizer/kcfi/add-kcfi-offset-flag.rs rename to tests/codegen-llvm/sanitizer/kcfi/add-kcfi-offset-flag.rs diff --git a/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-attr-no-sanitize.rs b/tests/codegen-llvm/sanitizer/kcfi/emit-kcfi-operand-bundle-attr-no-sanitize.rs similarity index 100% rename from tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-attr-no-sanitize.rs rename to tests/codegen-llvm/sanitizer/kcfi/emit-kcfi-operand-bundle-attr-no-sanitize.rs diff --git a/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-generalized.rs b/tests/codegen-llvm/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-generalized.rs similarity index 100% rename from tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-generalized.rs rename to tests/codegen-llvm/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-generalized.rs diff --git a/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-normalized-generalized.rs b/tests/codegen-llvm/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-normalized-generalized.rs similarity index 100% rename from tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-normalized-generalized.rs rename to tests/codegen-llvm/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-normalized-generalized.rs diff --git a/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-normalized.rs b/tests/codegen-llvm/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-normalized.rs similarity index 100% rename from tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-normalized.rs rename to tests/codegen-llvm/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-normalized.rs diff --git a/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi.rs b/tests/codegen-llvm/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi.rs similarity index 100% rename from tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi.rs rename to tests/codegen-llvm/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi.rs diff --git a/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle.rs b/tests/codegen-llvm/sanitizer/kcfi/emit-kcfi-operand-bundle.rs similarity index 100% rename from tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle.rs rename to tests/codegen-llvm/sanitizer/kcfi/emit-kcfi-operand-bundle.rs diff --git a/tests/codegen/sanitizer/kcfi/emit-type-metadata-trait-objects.rs b/tests/codegen-llvm/sanitizer/kcfi/emit-type-metadata-trait-objects.rs similarity index 100% rename from tests/codegen/sanitizer/kcfi/emit-type-metadata-trait-objects.rs rename to tests/codegen-llvm/sanitizer/kcfi/emit-type-metadata-trait-objects.rs diff --git a/tests/codegen/sanitizer/kcfi/naked-function.rs b/tests/codegen-llvm/sanitizer/kcfi/naked-function.rs similarity index 100% rename from tests/codegen/sanitizer/kcfi/naked-function.rs rename to tests/codegen-llvm/sanitizer/kcfi/naked-function.rs diff --git a/tests/codegen/sanitizer/memory-track-origins.rs b/tests/codegen-llvm/sanitizer/memory-track-origins.rs similarity index 100% rename from tests/codegen/sanitizer/memory-track-origins.rs rename to tests/codegen-llvm/sanitizer/memory-track-origins.rs diff --git a/tests/codegen/sanitizer/memtag-attr-check.rs b/tests/codegen-llvm/sanitizer/memtag-attr-check.rs similarity index 100% rename from tests/codegen/sanitizer/memtag-attr-check.rs rename to tests/codegen-llvm/sanitizer/memtag-attr-check.rs diff --git a/tests/codegen/sanitizer/no-sanitize-inlining.rs b/tests/codegen-llvm/sanitizer/no-sanitize-inlining.rs similarity index 100% rename from tests/codegen/sanitizer/no-sanitize-inlining.rs rename to tests/codegen-llvm/sanitizer/no-sanitize-inlining.rs diff --git a/tests/codegen/sanitizer/no-sanitize.rs b/tests/codegen-llvm/sanitizer/no-sanitize.rs similarity index 100% rename from tests/codegen/sanitizer/no-sanitize.rs rename to tests/codegen-llvm/sanitizer/no-sanitize.rs diff --git a/tests/codegen/sanitizer/riscv64-shadow-call-stack.rs b/tests/codegen-llvm/sanitizer/riscv64-shadow-call-stack.rs similarity index 100% rename from tests/codegen/sanitizer/riscv64-shadow-call-stack.rs rename to tests/codegen-llvm/sanitizer/riscv64-shadow-call-stack.rs diff --git a/tests/codegen/sanitizer/safestack-attr-check.rs b/tests/codegen-llvm/sanitizer/safestack-attr-check.rs similarity index 100% rename from tests/codegen/sanitizer/safestack-attr-check.rs rename to tests/codegen-llvm/sanitizer/safestack-attr-check.rs diff --git a/tests/codegen/sanitizer/sanitizer-recover.rs b/tests/codegen-llvm/sanitizer/sanitizer-recover.rs similarity index 100% rename from tests/codegen/sanitizer/sanitizer-recover.rs rename to tests/codegen-llvm/sanitizer/sanitizer-recover.rs diff --git a/tests/codegen/sanitizer/scs-attr-check.rs b/tests/codegen-llvm/sanitizer/scs-attr-check.rs similarity index 100% rename from tests/codegen/sanitizer/scs-attr-check.rs rename to tests/codegen-llvm/sanitizer/scs-attr-check.rs diff --git a/tests/codegen/scalar-pair-bool.rs b/tests/codegen-llvm/scalar-pair-bool.rs similarity index 100% rename from tests/codegen/scalar-pair-bool.rs rename to tests/codegen-llvm/scalar-pair-bool.rs diff --git a/tests/codegen/set-discriminant-invalid.rs b/tests/codegen-llvm/set-discriminant-invalid.rs similarity index 100% rename from tests/codegen/set-discriminant-invalid.rs rename to tests/codegen-llvm/set-discriminant-invalid.rs diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-float-abs.rs b/tests/codegen-llvm/simd-intrinsic/simd-intrinsic-float-abs.rs similarity index 100% rename from tests/codegen/simd-intrinsic/simd-intrinsic-float-abs.rs rename to tests/codegen-llvm/simd-intrinsic/simd-intrinsic-float-abs.rs diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-float-ceil.rs b/tests/codegen-llvm/simd-intrinsic/simd-intrinsic-float-ceil.rs similarity index 100% rename from tests/codegen/simd-intrinsic/simd-intrinsic-float-ceil.rs rename to tests/codegen-llvm/simd-intrinsic/simd-intrinsic-float-ceil.rs diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-float-cos.rs b/tests/codegen-llvm/simd-intrinsic/simd-intrinsic-float-cos.rs similarity index 100% rename from tests/codegen/simd-intrinsic/simd-intrinsic-float-cos.rs rename to tests/codegen-llvm/simd-intrinsic/simd-intrinsic-float-cos.rs diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-float-exp.rs b/tests/codegen-llvm/simd-intrinsic/simd-intrinsic-float-exp.rs similarity index 100% rename from tests/codegen/simd-intrinsic/simd-intrinsic-float-exp.rs rename to tests/codegen-llvm/simd-intrinsic/simd-intrinsic-float-exp.rs diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-float-exp2.rs b/tests/codegen-llvm/simd-intrinsic/simd-intrinsic-float-exp2.rs similarity index 100% rename from tests/codegen/simd-intrinsic/simd-intrinsic-float-exp2.rs rename to tests/codegen-llvm/simd-intrinsic/simd-intrinsic-float-exp2.rs diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-float-floor.rs b/tests/codegen-llvm/simd-intrinsic/simd-intrinsic-float-floor.rs similarity index 100% rename from tests/codegen/simd-intrinsic/simd-intrinsic-float-floor.rs rename to tests/codegen-llvm/simd-intrinsic/simd-intrinsic-float-floor.rs diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-float-fma.rs b/tests/codegen-llvm/simd-intrinsic/simd-intrinsic-float-fma.rs similarity index 100% rename from tests/codegen/simd-intrinsic/simd-intrinsic-float-fma.rs rename to tests/codegen-llvm/simd-intrinsic/simd-intrinsic-float-fma.rs diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-float-fsqrt.rs b/tests/codegen-llvm/simd-intrinsic/simd-intrinsic-float-fsqrt.rs similarity index 100% rename from tests/codegen/simd-intrinsic/simd-intrinsic-float-fsqrt.rs rename to tests/codegen-llvm/simd-intrinsic/simd-intrinsic-float-fsqrt.rs diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-float-log.rs b/tests/codegen-llvm/simd-intrinsic/simd-intrinsic-float-log.rs similarity index 100% rename from tests/codegen/simd-intrinsic/simd-intrinsic-float-log.rs rename to tests/codegen-llvm/simd-intrinsic/simd-intrinsic-float-log.rs diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-float-log10.rs b/tests/codegen-llvm/simd-intrinsic/simd-intrinsic-float-log10.rs similarity index 100% rename from tests/codegen/simd-intrinsic/simd-intrinsic-float-log10.rs rename to tests/codegen-llvm/simd-intrinsic/simd-intrinsic-float-log10.rs diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-float-log2.rs b/tests/codegen-llvm/simd-intrinsic/simd-intrinsic-float-log2.rs similarity index 100% rename from tests/codegen/simd-intrinsic/simd-intrinsic-float-log2.rs rename to tests/codegen-llvm/simd-intrinsic/simd-intrinsic-float-log2.rs diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-float-minmax.rs b/tests/codegen-llvm/simd-intrinsic/simd-intrinsic-float-minmax.rs similarity index 100% rename from tests/codegen/simd-intrinsic/simd-intrinsic-float-minmax.rs rename to tests/codegen-llvm/simd-intrinsic/simd-intrinsic-float-minmax.rs diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-float-sin.rs b/tests/codegen-llvm/simd-intrinsic/simd-intrinsic-float-sin.rs similarity index 100% rename from tests/codegen/simd-intrinsic/simd-intrinsic-float-sin.rs rename to tests/codegen-llvm/simd-intrinsic/simd-intrinsic-float-sin.rs diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-generic-arithmetic-saturating.rs b/tests/codegen-llvm/simd-intrinsic/simd-intrinsic-generic-arithmetic-saturating.rs similarity index 100% rename from tests/codegen/simd-intrinsic/simd-intrinsic-generic-arithmetic-saturating.rs rename to tests/codegen-llvm/simd-intrinsic/simd-intrinsic-generic-arithmetic-saturating.rs diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-generic-bitmask.rs b/tests/codegen-llvm/simd-intrinsic/simd-intrinsic-generic-bitmask.rs similarity index 100% rename from tests/codegen/simd-intrinsic/simd-intrinsic-generic-bitmask.rs rename to tests/codegen-llvm/simd-intrinsic/simd-intrinsic-generic-bitmask.rs diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-generic-gather.rs b/tests/codegen-llvm/simd-intrinsic/simd-intrinsic-generic-gather.rs similarity index 100% rename from tests/codegen/simd-intrinsic/simd-intrinsic-generic-gather.rs rename to tests/codegen-llvm/simd-intrinsic/simd-intrinsic-generic-gather.rs diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-generic-masked-load.rs b/tests/codegen-llvm/simd-intrinsic/simd-intrinsic-generic-masked-load.rs similarity index 100% rename from tests/codegen/simd-intrinsic/simd-intrinsic-generic-masked-load.rs rename to tests/codegen-llvm/simd-intrinsic/simd-intrinsic-generic-masked-load.rs diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-generic-masked-store.rs b/tests/codegen-llvm/simd-intrinsic/simd-intrinsic-generic-masked-store.rs similarity index 100% rename from tests/codegen/simd-intrinsic/simd-intrinsic-generic-masked-store.rs rename to tests/codegen-llvm/simd-intrinsic/simd-intrinsic-generic-masked-store.rs diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-generic-scatter.rs b/tests/codegen-llvm/simd-intrinsic/simd-intrinsic-generic-scatter.rs similarity index 100% rename from tests/codegen/simd-intrinsic/simd-intrinsic-generic-scatter.rs rename to tests/codegen-llvm/simd-intrinsic/simd-intrinsic-generic-scatter.rs diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-generic-select.rs b/tests/codegen-llvm/simd-intrinsic/simd-intrinsic-generic-select.rs similarity index 100% rename from tests/codegen/simd-intrinsic/simd-intrinsic-generic-select.rs rename to tests/codegen-llvm/simd-intrinsic/simd-intrinsic-generic-select.rs diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-mask-reduce.rs b/tests/codegen-llvm/simd-intrinsic/simd-intrinsic-mask-reduce.rs similarity index 100% rename from tests/codegen/simd-intrinsic/simd-intrinsic-mask-reduce.rs rename to tests/codegen-llvm/simd-intrinsic/simd-intrinsic-mask-reduce.rs diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-transmute-array.rs b/tests/codegen-llvm/simd-intrinsic/simd-intrinsic-transmute-array.rs similarity index 100% rename from tests/codegen/simd-intrinsic/simd-intrinsic-transmute-array.rs rename to tests/codegen-llvm/simd-intrinsic/simd-intrinsic-transmute-array.rs diff --git a/tests/codegen/simd/aggregate-simd.rs b/tests/codegen-llvm/simd/aggregate-simd.rs similarity index 100% rename from tests/codegen/simd/aggregate-simd.rs rename to tests/codegen-llvm/simd/aggregate-simd.rs diff --git a/tests/codegen/simd/extract-insert-dyn.rs b/tests/codegen-llvm/simd/extract-insert-dyn.rs similarity index 100% rename from tests/codegen/simd/extract-insert-dyn.rs rename to tests/codegen-llvm/simd/extract-insert-dyn.rs diff --git a/tests/codegen/simd/packed-simd-alignment.rs b/tests/codegen-llvm/simd/packed-simd-alignment.rs similarity index 100% rename from tests/codegen/simd/packed-simd-alignment.rs rename to tests/codegen-llvm/simd/packed-simd-alignment.rs diff --git a/tests/codegen/simd/packed-simd.rs b/tests/codegen-llvm/simd/packed-simd.rs similarity index 100% rename from tests/codegen/simd/packed-simd.rs rename to tests/codegen-llvm/simd/packed-simd.rs diff --git a/tests/codegen/simd/simd-wide-sum.rs b/tests/codegen-llvm/simd/simd-wide-sum.rs similarity index 100% rename from tests/codegen/simd/simd-wide-sum.rs rename to tests/codegen-llvm/simd/simd-wide-sum.rs diff --git a/tests/codegen/simd/simd_arith_offset.rs b/tests/codegen-llvm/simd/simd_arith_offset.rs similarity index 100% rename from tests/codegen/simd/simd_arith_offset.rs rename to tests/codegen-llvm/simd/simd_arith_offset.rs diff --git a/tests/codegen/simd/swap-simd-types.rs b/tests/codegen-llvm/simd/swap-simd-types.rs similarity index 100% rename from tests/codegen/simd/swap-simd-types.rs rename to tests/codegen-llvm/simd/swap-simd-types.rs diff --git a/tests/codegen/simd/unpadded-simd.rs b/tests/codegen-llvm/simd/unpadded-simd.rs similarity index 100% rename from tests/codegen/simd/unpadded-simd.rs rename to tests/codegen-llvm/simd/unpadded-simd.rs diff --git a/tests/codegen/skip-mono-inside-if-false.rs b/tests/codegen-llvm/skip-mono-inside-if-false.rs similarity index 100% rename from tests/codegen/skip-mono-inside-if-false.rs rename to tests/codegen-llvm/skip-mono-inside-if-false.rs diff --git a/tests/codegen/slice-as_chunks.rs b/tests/codegen-llvm/slice-as_chunks.rs similarity index 100% rename from tests/codegen/slice-as_chunks.rs rename to tests/codegen-llvm/slice-as_chunks.rs diff --git a/tests/codegen/slice-indexing.rs b/tests/codegen-llvm/slice-indexing.rs similarity index 100% rename from tests/codegen/slice-indexing.rs rename to tests/codegen-llvm/slice-indexing.rs diff --git a/tests/codegen/slice-init.rs b/tests/codegen-llvm/slice-init.rs similarity index 100% rename from tests/codegen/slice-init.rs rename to tests/codegen-llvm/slice-init.rs diff --git a/tests/codegen/slice-is-ascii.rs b/tests/codegen-llvm/slice-is-ascii.rs similarity index 100% rename from tests/codegen/slice-is-ascii.rs rename to tests/codegen-llvm/slice-is-ascii.rs diff --git a/tests/codegen/slice-iter-fold.rs b/tests/codegen-llvm/slice-iter-fold.rs similarity index 100% rename from tests/codegen/slice-iter-fold.rs rename to tests/codegen-llvm/slice-iter-fold.rs diff --git a/tests/codegen/slice-iter-len-eq-zero.rs b/tests/codegen-llvm/slice-iter-len-eq-zero.rs similarity index 100% rename from tests/codegen/slice-iter-len-eq-zero.rs rename to tests/codegen-llvm/slice-iter-len-eq-zero.rs diff --git a/tests/codegen/slice-iter-nonnull.rs b/tests/codegen-llvm/slice-iter-nonnull.rs similarity index 100% rename from tests/codegen/slice-iter-nonnull.rs rename to tests/codegen-llvm/slice-iter-nonnull.rs diff --git a/tests/codegen/slice-last-elements-optimization.rs b/tests/codegen-llvm/slice-last-elements-optimization.rs similarity index 100% rename from tests/codegen/slice-last-elements-optimization.rs rename to tests/codegen-llvm/slice-last-elements-optimization.rs diff --git a/tests/codegen/slice-pointer-nonnull-unwrap.rs b/tests/codegen-llvm/slice-pointer-nonnull-unwrap.rs similarity index 100% rename from tests/codegen/slice-pointer-nonnull-unwrap.rs rename to tests/codegen-llvm/slice-pointer-nonnull-unwrap.rs diff --git a/tests/codegen/slice-position-bounds-check.rs b/tests/codegen-llvm/slice-position-bounds-check.rs similarity index 100% rename from tests/codegen/slice-position-bounds-check.rs rename to tests/codegen-llvm/slice-position-bounds-check.rs diff --git a/tests/codegen/slice-ref-equality.rs b/tests/codegen-llvm/slice-ref-equality.rs similarity index 100% rename from tests/codegen/slice-ref-equality.rs rename to tests/codegen-llvm/slice-ref-equality.rs diff --git a/tests/codegen/slice-reverse.rs b/tests/codegen-llvm/slice-reverse.rs similarity index 100% rename from tests/codegen/slice-reverse.rs rename to tests/codegen-llvm/slice-reverse.rs diff --git a/tests/codegen/slice-split-at.rs b/tests/codegen-llvm/slice-split-at.rs similarity index 100% rename from tests/codegen/slice-split-at.rs rename to tests/codegen-llvm/slice-split-at.rs diff --git a/tests/codegen/slice-windows-no-bounds-check.rs b/tests/codegen-llvm/slice-windows-no-bounds-check.rs similarity index 100% rename from tests/codegen/slice-windows-no-bounds-check.rs rename to tests/codegen-llvm/slice-windows-no-bounds-check.rs diff --git a/tests/codegen/slice_as_from_ptr_range.rs b/tests/codegen-llvm/slice_as_from_ptr_range.rs similarity index 100% rename from tests/codegen/slice_as_from_ptr_range.rs rename to tests/codegen-llvm/slice_as_from_ptr_range.rs diff --git a/tests/codegen/some-abis-do-extend-params-to-32-bits.rs b/tests/codegen-llvm/some-abis-do-extend-params-to-32-bits.rs similarity index 100% rename from tests/codegen/some-abis-do-extend-params-to-32-bits.rs rename to tests/codegen-llvm/some-abis-do-extend-params-to-32-bits.rs diff --git a/tests/codegen/some-global-nonnull.rs b/tests/codegen-llvm/some-global-nonnull.rs similarity index 100% rename from tests/codegen/some-global-nonnull.rs rename to tests/codegen-llvm/some-global-nonnull.rs diff --git a/tests/codegen/sparc-struct-abi.rs b/tests/codegen-llvm/sparc-struct-abi.rs similarity index 100% rename from tests/codegen/sparc-struct-abi.rs rename to tests/codegen-llvm/sparc-struct-abi.rs diff --git a/tests/codegen/split-lto-unit.rs b/tests/codegen-llvm/split-lto-unit.rs similarity index 100% rename from tests/codegen/split-lto-unit.rs rename to tests/codegen-llvm/split-lto-unit.rs diff --git a/tests/codegen/src-hash-algorithm/src-hash-algorithm-md5.rs b/tests/codegen-llvm/src-hash-algorithm/src-hash-algorithm-md5.rs similarity index 100% rename from tests/codegen/src-hash-algorithm/src-hash-algorithm-md5.rs rename to tests/codegen-llvm/src-hash-algorithm/src-hash-algorithm-md5.rs diff --git a/tests/codegen/src-hash-algorithm/src-hash-algorithm-sha1.rs b/tests/codegen-llvm/src-hash-algorithm/src-hash-algorithm-sha1.rs similarity index 100% rename from tests/codegen/src-hash-algorithm/src-hash-algorithm-sha1.rs rename to tests/codegen-llvm/src-hash-algorithm/src-hash-algorithm-sha1.rs diff --git a/tests/codegen/src-hash-algorithm/src-hash-algorithm-sha256.rs b/tests/codegen-llvm/src-hash-algorithm/src-hash-algorithm-sha256.rs similarity index 100% rename from tests/codegen/src-hash-algorithm/src-hash-algorithm-sha256.rs rename to tests/codegen-llvm/src-hash-algorithm/src-hash-algorithm-sha256.rs diff --git a/tests/codegen/sroa-fragment-debuginfo.rs b/tests/codegen-llvm/sroa-fragment-debuginfo.rs similarity index 100% rename from tests/codegen/sroa-fragment-debuginfo.rs rename to tests/codegen-llvm/sroa-fragment-debuginfo.rs diff --git a/tests/codegen/sse42-implies-crc32.rs b/tests/codegen-llvm/sse42-implies-crc32.rs similarity index 100% rename from tests/codegen/sse42-implies-crc32.rs rename to tests/codegen-llvm/sse42-implies-crc32.rs diff --git a/tests/codegen/stack-probes-inline.rs b/tests/codegen-llvm/stack-probes-inline.rs similarity index 100% rename from tests/codegen/stack-probes-inline.rs rename to tests/codegen-llvm/stack-probes-inline.rs diff --git a/tests/codegen/stack-protector.rs b/tests/codegen-llvm/stack-protector.rs similarity index 100% rename from tests/codegen/stack-protector.rs rename to tests/codegen-llvm/stack-protector.rs diff --git a/tests/codegen/static-relocation-model-msvc.rs b/tests/codegen-llvm/static-relocation-model-msvc.rs similarity index 100% rename from tests/codegen/static-relocation-model-msvc.rs rename to tests/codegen-llvm/static-relocation-model-msvc.rs diff --git a/tests/codegen/staticlib-external-inline-fns.rs b/tests/codegen-llvm/staticlib-external-inline-fns.rs similarity index 100% rename from tests/codegen/staticlib-external-inline-fns.rs rename to tests/codegen-llvm/staticlib-external-inline-fns.rs diff --git a/tests/codegen/step_by-overflow-checks.rs b/tests/codegen-llvm/step_by-overflow-checks.rs similarity index 100% rename from tests/codegen/step_by-overflow-checks.rs rename to tests/codegen-llvm/step_by-overflow-checks.rs diff --git a/tests/codegen/stores.rs b/tests/codegen-llvm/stores.rs similarity index 100% rename from tests/codegen/stores.rs rename to tests/codegen-llvm/stores.rs diff --git a/tests/codegen/string-push.rs b/tests/codegen-llvm/string-push.rs similarity index 100% rename from tests/codegen/string-push.rs rename to tests/codegen-llvm/string-push.rs diff --git a/tests/codegen/swap-large-types.rs b/tests/codegen-llvm/swap-large-types.rs similarity index 100% rename from tests/codegen/swap-large-types.rs rename to tests/codegen-llvm/swap-large-types.rs diff --git a/tests/codegen/swap-small-types.rs b/tests/codegen-llvm/swap-small-types.rs similarity index 100% rename from tests/codegen/swap-small-types.rs rename to tests/codegen-llvm/swap-small-types.rs diff --git a/tests/codegen/target-cpu-on-functions.rs b/tests/codegen-llvm/target-cpu-on-functions.rs similarity index 100% rename from tests/codegen/target-cpu-on-functions.rs rename to tests/codegen-llvm/target-cpu-on-functions.rs diff --git a/tests/codegen/target-feature-inline-closure.rs b/tests/codegen-llvm/target-feature-inline-closure.rs similarity index 100% rename from tests/codegen/target-feature-inline-closure.rs rename to tests/codegen-llvm/target-feature-inline-closure.rs diff --git a/tests/codegen/target-feature-negative-implication.rs b/tests/codegen-llvm/target-feature-negative-implication.rs similarity index 100% rename from tests/codegen/target-feature-negative-implication.rs rename to tests/codegen-llvm/target-feature-negative-implication.rs diff --git a/tests/codegen/target-feature-overrides.rs b/tests/codegen-llvm/target-feature-overrides.rs similarity index 100% rename from tests/codegen/target-feature-overrides.rs rename to tests/codegen-llvm/target-feature-overrides.rs diff --git a/tests/codegen/terminating-catchpad.rs b/tests/codegen-llvm/terminating-catchpad.rs similarity index 100% rename from tests/codegen/terminating-catchpad.rs rename to tests/codegen-llvm/terminating-catchpad.rs diff --git a/tests/codegen/thread-local.rs b/tests/codegen-llvm/thread-local.rs similarity index 100% rename from tests/codegen/thread-local.rs rename to tests/codegen-llvm/thread-local.rs diff --git a/tests/codegen/tied-features-strength.rs b/tests/codegen-llvm/tied-features-strength.rs similarity index 100% rename from tests/codegen/tied-features-strength.rs rename to tests/codegen-llvm/tied-features-strength.rs diff --git a/tests/codegen/to_vec.rs b/tests/codegen-llvm/to_vec.rs similarity index 100% rename from tests/codegen/to_vec.rs rename to tests/codegen-llvm/to_vec.rs diff --git a/tests/codegen/trailing_zeros.rs b/tests/codegen-llvm/trailing_zeros.rs similarity index 100% rename from tests/codegen/trailing_zeros.rs rename to tests/codegen-llvm/trailing_zeros.rs diff --git a/tests/codegen/transmute-optimized.rs b/tests/codegen-llvm/transmute-optimized.rs similarity index 100% rename from tests/codegen/transmute-optimized.rs rename to tests/codegen-llvm/transmute-optimized.rs diff --git a/tests/codegen/transmute-scalar.rs b/tests/codegen-llvm/transmute-scalar.rs similarity index 100% rename from tests/codegen/transmute-scalar.rs rename to tests/codegen-llvm/transmute-scalar.rs diff --git a/tests/codegen/try_question_mark_nop.rs b/tests/codegen-llvm/try_question_mark_nop.rs similarity index 100% rename from tests/codegen/try_question_mark_nop.rs rename to tests/codegen-llvm/try_question_mark_nop.rs diff --git a/tests/codegen/tune-cpu-on-functions.rs b/tests/codegen-llvm/tune-cpu-on-functions.rs similarity index 100% rename from tests/codegen/tune-cpu-on-functions.rs rename to tests/codegen-llvm/tune-cpu-on-functions.rs diff --git a/tests/codegen/tuple-layout-opt.rs b/tests/codegen-llvm/tuple-layout-opt.rs similarity index 100% rename from tests/codegen/tuple-layout-opt.rs rename to tests/codegen-llvm/tuple-layout-opt.rs diff --git a/tests/codegen/ub-checks.rs b/tests/codegen-llvm/ub-checks.rs similarity index 100% rename from tests/codegen/ub-checks.rs rename to tests/codegen-llvm/ub-checks.rs diff --git a/tests/codegen/unchecked-float-casts.rs b/tests/codegen-llvm/unchecked-float-casts.rs similarity index 100% rename from tests/codegen/unchecked-float-casts.rs rename to tests/codegen-llvm/unchecked-float-casts.rs diff --git a/tests/codegen/unchecked_shifts.rs b/tests/codegen-llvm/unchecked_shifts.rs similarity index 100% rename from tests/codegen/unchecked_shifts.rs rename to tests/codegen-llvm/unchecked_shifts.rs diff --git a/tests/codegen/uninhabited-transparent-return-abi.rs b/tests/codegen-llvm/uninhabited-transparent-return-abi.rs similarity index 100% rename from tests/codegen/uninhabited-transparent-return-abi.rs rename to tests/codegen-llvm/uninhabited-transparent-return-abi.rs diff --git a/tests/codegen/uninit-consts.rs b/tests/codegen-llvm/uninit-consts.rs similarity index 100% rename from tests/codegen/uninit-consts.rs rename to tests/codegen-llvm/uninit-consts.rs diff --git a/tests/codegen/uninit-repeat-in-aggregate.rs b/tests/codegen-llvm/uninit-repeat-in-aggregate.rs similarity index 100% rename from tests/codegen/uninit-repeat-in-aggregate.rs rename to tests/codegen-llvm/uninit-repeat-in-aggregate.rs diff --git a/tests/codegen/union-abi.rs b/tests/codegen-llvm/union-abi.rs similarity index 100% rename from tests/codegen/union-abi.rs rename to tests/codegen-llvm/union-abi.rs diff --git a/tests/codegen/union-aggregate.rs b/tests/codegen-llvm/union-aggregate.rs similarity index 100% rename from tests/codegen/union-aggregate.rs rename to tests/codegen-llvm/union-aggregate.rs diff --git a/tests/codegen/unwind-abis/aapcs-unwind-abi.rs b/tests/codegen-llvm/unwind-abis/aapcs-unwind-abi.rs similarity index 100% rename from tests/codegen/unwind-abis/aapcs-unwind-abi.rs rename to tests/codegen-llvm/unwind-abis/aapcs-unwind-abi.rs diff --git a/tests/codegen/unwind-abis/c-unwind-abi-panic-abort.rs b/tests/codegen-llvm/unwind-abis/c-unwind-abi-panic-abort.rs similarity index 100% rename from tests/codegen/unwind-abis/c-unwind-abi-panic-abort.rs rename to tests/codegen-llvm/unwind-abis/c-unwind-abi-panic-abort.rs diff --git a/tests/codegen/unwind-abis/c-unwind-abi.rs b/tests/codegen-llvm/unwind-abis/c-unwind-abi.rs similarity index 100% rename from tests/codegen/unwind-abis/c-unwind-abi.rs rename to tests/codegen-llvm/unwind-abis/c-unwind-abi.rs diff --git a/tests/codegen/unwind-abis/cdecl-unwind-abi.rs b/tests/codegen-llvm/unwind-abis/cdecl-unwind-abi.rs similarity index 100% rename from tests/codegen/unwind-abis/cdecl-unwind-abi.rs rename to tests/codegen-llvm/unwind-abis/cdecl-unwind-abi.rs diff --git a/tests/codegen/unwind-abis/fastcall-unwind-abi.rs b/tests/codegen-llvm/unwind-abis/fastcall-unwind-abi.rs similarity index 100% rename from tests/codegen/unwind-abis/fastcall-unwind-abi.rs rename to tests/codegen-llvm/unwind-abis/fastcall-unwind-abi.rs diff --git a/tests/codegen/unwind-abis/nounwind-on-stable-panic-abort.rs b/tests/codegen-llvm/unwind-abis/nounwind-on-stable-panic-abort.rs similarity index 100% rename from tests/codegen/unwind-abis/nounwind-on-stable-panic-abort.rs rename to tests/codegen-llvm/unwind-abis/nounwind-on-stable-panic-abort.rs diff --git a/tests/codegen/unwind-abis/nounwind.rs b/tests/codegen-llvm/unwind-abis/nounwind.rs similarity index 100% rename from tests/codegen/unwind-abis/nounwind.rs rename to tests/codegen-llvm/unwind-abis/nounwind.rs diff --git a/tests/codegen/unwind-abis/stdcall-unwind-abi.rs b/tests/codegen-llvm/unwind-abis/stdcall-unwind-abi.rs similarity index 100% rename from tests/codegen/unwind-abis/stdcall-unwind-abi.rs rename to tests/codegen-llvm/unwind-abis/stdcall-unwind-abi.rs diff --git a/tests/codegen/unwind-abis/system-unwind-abi.rs b/tests/codegen-llvm/unwind-abis/system-unwind-abi.rs similarity index 100% rename from tests/codegen/unwind-abis/system-unwind-abi.rs rename to tests/codegen-llvm/unwind-abis/system-unwind-abi.rs diff --git a/tests/codegen/unwind-abis/sysv64-unwind-abi.rs b/tests/codegen-llvm/unwind-abis/sysv64-unwind-abi.rs similarity index 100% rename from tests/codegen/unwind-abis/sysv64-unwind-abi.rs rename to tests/codegen-llvm/unwind-abis/sysv64-unwind-abi.rs diff --git a/tests/codegen/unwind-abis/thiscall-unwind-abi.rs b/tests/codegen-llvm/unwind-abis/thiscall-unwind-abi.rs similarity index 100% rename from tests/codegen/unwind-abis/thiscall-unwind-abi.rs rename to tests/codegen-llvm/unwind-abis/thiscall-unwind-abi.rs diff --git a/tests/codegen/unwind-abis/vectorcall-unwind-abi.rs b/tests/codegen-llvm/unwind-abis/vectorcall-unwind-abi.rs similarity index 100% rename from tests/codegen/unwind-abis/vectorcall-unwind-abi.rs rename to tests/codegen-llvm/unwind-abis/vectorcall-unwind-abi.rs diff --git a/tests/codegen/unwind-abis/win64-unwind-abi.rs b/tests/codegen-llvm/unwind-abis/win64-unwind-abi.rs similarity index 100% rename from tests/codegen/unwind-abis/win64-unwind-abi.rs rename to tests/codegen-llvm/unwind-abis/win64-unwind-abi.rs diff --git a/tests/codegen/unwind-and-panic-abort.rs b/tests/codegen-llvm/unwind-and-panic-abort.rs similarity index 100% rename from tests/codegen/unwind-and-panic-abort.rs rename to tests/codegen-llvm/unwind-and-panic-abort.rs diff --git a/tests/codegen/unwind-extern-exports.rs b/tests/codegen-llvm/unwind-extern-exports.rs similarity index 100% rename from tests/codegen/unwind-extern-exports.rs rename to tests/codegen-llvm/unwind-extern-exports.rs diff --git a/tests/codegen/unwind-extern-imports.rs b/tests/codegen-llvm/unwind-extern-imports.rs similarity index 100% rename from tests/codegen/unwind-extern-imports.rs rename to tests/codegen-llvm/unwind-extern-imports.rs diff --git a/tests/codegen/unwind-landingpad-cold.rs b/tests/codegen-llvm/unwind-landingpad-cold.rs similarity index 100% rename from tests/codegen/unwind-landingpad-cold.rs rename to tests/codegen-llvm/unwind-landingpad-cold.rs diff --git a/tests/codegen/unwind-landingpad-inline.rs b/tests/codegen-llvm/unwind-landingpad-inline.rs similarity index 100% rename from tests/codegen/unwind-landingpad-inline.rs rename to tests/codegen-llvm/unwind-landingpad-inline.rs diff --git a/tests/codegen/used_with_arg.rs b/tests/codegen-llvm/used_with_arg.rs similarity index 100% rename from tests/codegen/used_with_arg.rs rename to tests/codegen-llvm/used_with_arg.rs diff --git a/tests/codegen/var-names.rs b/tests/codegen-llvm/var-names.rs similarity index 100% rename from tests/codegen/var-names.rs rename to tests/codegen-llvm/var-names.rs diff --git a/tests/codegen/vec-as-ptr.rs b/tests/codegen-llvm/vec-as-ptr.rs similarity index 100% rename from tests/codegen/vec-as-ptr.rs rename to tests/codegen-llvm/vec-as-ptr.rs diff --git a/tests/codegen/vec-calloc.rs b/tests/codegen-llvm/vec-calloc.rs similarity index 100% rename from tests/codegen/vec-calloc.rs rename to tests/codegen-llvm/vec-calloc.rs diff --git a/tests/codegen/vec-in-place.rs b/tests/codegen-llvm/vec-in-place.rs similarity index 100% rename from tests/codegen/vec-in-place.rs rename to tests/codegen-llvm/vec-in-place.rs diff --git a/tests/codegen/vec-iter-collect-len.rs b/tests/codegen-llvm/vec-iter-collect-len.rs similarity index 100% rename from tests/codegen/vec-iter-collect-len.rs rename to tests/codegen-llvm/vec-iter-collect-len.rs diff --git a/tests/codegen/vec-iter.rs b/tests/codegen-llvm/vec-iter.rs similarity index 100% rename from tests/codegen/vec-iter.rs rename to tests/codegen-llvm/vec-iter.rs diff --git a/tests/codegen/vec-len-invariant.rs b/tests/codegen-llvm/vec-len-invariant.rs similarity index 100% rename from tests/codegen/vec-len-invariant.rs rename to tests/codegen-llvm/vec-len-invariant.rs diff --git a/tests/codegen/vec-optimizes-away.rs b/tests/codegen-llvm/vec-optimizes-away.rs similarity index 100% rename from tests/codegen/vec-optimizes-away.rs rename to tests/codegen-llvm/vec-optimizes-away.rs diff --git a/tests/codegen/vec-reserve-extend.rs b/tests/codegen-llvm/vec-reserve-extend.rs similarity index 100% rename from tests/codegen/vec-reserve-extend.rs rename to tests/codegen-llvm/vec-reserve-extend.rs diff --git a/tests/codegen/vec-shrink-panik.rs b/tests/codegen-llvm/vec-shrink-panik.rs similarity index 100% rename from tests/codegen/vec-shrink-panik.rs rename to tests/codegen-llvm/vec-shrink-panik.rs diff --git a/tests/codegen/vec-with-capacity.rs b/tests/codegen-llvm/vec-with-capacity.rs similarity index 100% rename from tests/codegen/vec-with-capacity.rs rename to tests/codegen-llvm/vec-with-capacity.rs diff --git a/tests/codegen/vec_pop_push_noop.rs b/tests/codegen-llvm/vec_pop_push_noop.rs similarity index 100% rename from tests/codegen/vec_pop_push_noop.rs rename to tests/codegen-llvm/vec_pop_push_noop.rs diff --git a/tests/codegen/vecdeque-drain.rs b/tests/codegen-llvm/vecdeque-drain.rs similarity index 100% rename from tests/codegen/vecdeque-drain.rs rename to tests/codegen-llvm/vecdeque-drain.rs diff --git a/tests/codegen/vecdeque-nonempty-get-no-panic.rs b/tests/codegen-llvm/vecdeque-nonempty-get-no-panic.rs similarity index 100% rename from tests/codegen/vecdeque-nonempty-get-no-panic.rs rename to tests/codegen-llvm/vecdeque-nonempty-get-no-panic.rs diff --git a/tests/codegen/vecdeque_no_panic.rs b/tests/codegen-llvm/vecdeque_no_panic.rs similarity index 100% rename from tests/codegen/vecdeque_no_panic.rs rename to tests/codegen-llvm/vecdeque_no_panic.rs diff --git a/tests/codegen/vecdeque_pop_push.rs b/tests/codegen-llvm/vecdeque_pop_push.rs similarity index 100% rename from tests/codegen/vecdeque_pop_push.rs rename to tests/codegen-llvm/vecdeque_pop_push.rs diff --git a/tests/codegen/virtual-call-attrs-issue-137646.rs b/tests/codegen-llvm/virtual-call-attrs-issue-137646.rs similarity index 100% rename from tests/codegen/virtual-call-attrs-issue-137646.rs rename to tests/codegen-llvm/virtual-call-attrs-issue-137646.rs diff --git a/tests/codegen/virtual-function-elimination-32bit.rs b/tests/codegen-llvm/virtual-function-elimination-32bit.rs similarity index 100% rename from tests/codegen/virtual-function-elimination-32bit.rs rename to tests/codegen-llvm/virtual-function-elimination-32bit.rs diff --git a/tests/codegen/virtual-function-elimination.rs b/tests/codegen-llvm/virtual-function-elimination.rs similarity index 100% rename from tests/codegen/virtual-function-elimination.rs rename to tests/codegen-llvm/virtual-function-elimination.rs diff --git a/tests/codegen/vtable-loads.rs b/tests/codegen-llvm/vtable-loads.rs similarity index 100% rename from tests/codegen/vtable-loads.rs rename to tests/codegen-llvm/vtable-loads.rs diff --git a/tests/codegen/vtable-upcast.rs b/tests/codegen-llvm/vtable-upcast.rs similarity index 100% rename from tests/codegen/vtable-upcast.rs rename to tests/codegen-llvm/vtable-upcast.rs diff --git a/tests/codegen/wasm_casts_trapping.rs b/tests/codegen-llvm/wasm_casts_trapping.rs similarity index 100% rename from tests/codegen/wasm_casts_trapping.rs rename to tests/codegen-llvm/wasm_casts_trapping.rs diff --git a/tests/codegen/wasm_exceptions.rs b/tests/codegen-llvm/wasm_exceptions.rs similarity index 100% rename from tests/codegen/wasm_exceptions.rs rename to tests/codegen-llvm/wasm_exceptions.rs diff --git a/tests/codegen/zip.rs b/tests/codegen-llvm/zip.rs similarity index 100% rename from tests/codegen/zip.rs rename to tests/codegen-llvm/zip.rs diff --git a/tests/codegen/zst-offset.rs b/tests/codegen-llvm/zst-offset.rs similarity index 100% rename from tests/codegen/zst-offset.rs rename to tests/codegen-llvm/zst-offset.rs diff --git a/tests/run-make/llvm-ident/rmake.rs b/tests/run-make/llvm-ident/rmake.rs index 47e6fc4de15b..b4d30ee7bfbe 100644 --- a/tests/run-make/llvm-ident/rmake.rs +++ b/tests/run-make/llvm-ident/rmake.rs @@ -27,7 +27,7 @@ fn main() { // Check LLVM IR files (including temporary outputs) have `!llvm.ident` // named metadata, reusing the related codegen test. - let llvm_ident_path = source_root().join("tests/codegen/llvm-ident.rs"); + let llvm_ident_path = source_root().join("tests/codegen-llvm/llvm-ident.rs"); let files = shallow_find_files(".", |path| has_extension(path, "ll")); for file in files { llvm_filecheck().input_file(file).arg(&llvm_ident_path).run(); diff --git a/tests/ui/abi/fixed_x18.rs b/tests/ui/abi/fixed_x18.rs index 09d163030335..baf215ba9031 100644 --- a/tests/ui/abi/fixed_x18.rs +++ b/tests/ui/abi/fixed_x18.rs @@ -1,5 +1,5 @@ // This tests that -Zfixed-x18 causes a compilation failure on targets other than aarch64. -// Behavior on aarch64 is tested by tests/codegen/fixed-x18.rs. +// Behavior on aarch64 is tested by tests/codegen-llvm/fixed-x18.rs. // //@ revisions: x64 i686 arm riscv32 riscv64 //@ dont-check-compiler-stderr diff --git a/triagebot.toml b/triagebot.toml index e34e4a88f42d..162e244c0add 100644 --- a/triagebot.toml +++ b/triagebot.toml @@ -304,7 +304,7 @@ trigger_files = [ # Tests "tests/assembly-llvm", "tests/auxiliary", - "tests/codegen", + "tests/codegen-llvm", "tests/codegen-units", "tests/COMPILER_TESTS.md", "tests/coverage", @@ -558,10 +558,10 @@ trigger_files = [ "src/doc/unstable-book/src/language-features/cfg-sanitize.md", "src/doc/unstable-book/src/language-features/cfi-encoding.md", "src/doc/unstable-book/src/language-features/no-sanitize.md", - "tests/codegen/sanitizer", - "tests/codegen/split-lto-unit.rs", - "tests/codegen/stack-probes-inline.rs", - "tests/codegen/stack-protector.rs", + "tests/codegen-llvm/sanitizer", + "tests/codegen-llvm/split-lto-unit.rs", + "tests/codegen-llvm/stack-probes-inline.rs", + "tests/codegen-llvm/stack-protector.rs", "tests/ui/sanitizer", "tests/ui/stack-protector" ] @@ -1183,16 +1183,16 @@ cc = ["@Urgau"] [mentions."src/doc/rustc/src/platform-support"] cc = ["@Noratrieb"] -[mentions."tests/codegen/sanitizer"] +[mentions."tests/codegen-llvm/sanitizer"] cc = ["@rcvalle"] -[mentions."tests/codegen/split-lto-unit.rs"] +[mentions."tests/codegen-llvm/split-lto-unit.rs"] cc = ["@rust-lang/project-exploit-mitigations", "@rcvalle"] -[mentions."tests/codegen/stack-probes-inline.rs"] +[mentions."tests/codegen-llvm/stack-probes-inline.rs"] cc = ["@rust-lang/project-exploit-mitigations", "@rcvalle"] -[mentions."tests/codegen/stack-protector.rs"] +[mentions."tests/codegen-llvm/stack-protector.rs"] cc = ["@rust-lang/project-exploit-mitigations", "@rcvalle"] [mentions."tests/ui/sanitizer"] From 0aa617001aa5a0d6945079dd084c0bd4a13f3189 Mon Sep 17 00:00:00 2001 From: yuk1ty Date: Mon, 21 Jul 2025 14:51:55 +0900 Subject: [PATCH 097/139] Add a test case for ui test false-sealed-traits-note.rs --- .../sealed-traits/false-sealed-traits-note.rs | 12 ++++++++- .../false-sealed-traits-note.stderr | 25 ++++++++++++++++--- 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/tests/ui/privacy/sealed-traits/false-sealed-traits-note.rs b/tests/ui/privacy/sealed-traits/false-sealed-traits-note.rs index 13f3065e442e..d5065a6b55b2 100644 --- a/tests/ui/privacy/sealed-traits/false-sealed-traits-note.rs +++ b/tests/ui/privacy/sealed-traits/false-sealed-traits-note.rs @@ -1,5 +1,6 @@ -// We should not emit sealed traits note, see issue #143392 +// We should not emit sealed traits note, see issue #143392 and #143121 +/// Reported in #143392 mod inner { pub trait TraitA {} @@ -10,4 +11,13 @@ struct Struct; impl inner::TraitB for Struct {} //~ ERROR the trait bound `Struct: TraitA` is not satisfied [E0277] +/// Reported in #143121 +mod x { + pub trait A {} + pub trait B: A {} + + pub struct C; + impl B for C {} //~ ERROR the trait bound `C: A` is not satisfied [E0277] +} + fn main(){} diff --git a/tests/ui/privacy/sealed-traits/false-sealed-traits-note.stderr b/tests/ui/privacy/sealed-traits/false-sealed-traits-note.stderr index f80d985ad6e6..df8016565da4 100644 --- a/tests/ui/privacy/sealed-traits/false-sealed-traits-note.stderr +++ b/tests/ui/privacy/sealed-traits/false-sealed-traits-note.stderr @@ -1,20 +1,37 @@ error[E0277]: the trait bound `Struct: TraitA` is not satisfied - --> $DIR/false-sealed-traits-note.rs:11:24 + --> $DIR/false-sealed-traits-note.rs:12:24 | LL | impl inner::TraitB for Struct {} | ^^^^^^ the trait `TraitA` is not implemented for `Struct` | help: this trait has no implementations, consider adding one - --> $DIR/false-sealed-traits-note.rs:4:5 + --> $DIR/false-sealed-traits-note.rs:5:5 | LL | pub trait TraitA {} | ^^^^^^^^^^^^^^^^ note: required by a bound in `TraitB` - --> $DIR/false-sealed-traits-note.rs:6:23 + --> $DIR/false-sealed-traits-note.rs:7:23 | LL | pub trait TraitB: TraitA {} | ^^^^^^ required by this bound in `TraitB` -error: aborting due to 1 previous error +error[E0277]: the trait bound `C: A` is not satisfied + --> $DIR/false-sealed-traits-note.rs:20:16 + | +LL | impl B for C {} + | ^ the trait `A` is not implemented for `C` + | +help: this trait has no implementations, consider adding one + --> $DIR/false-sealed-traits-note.rs:16:5 + | +LL | pub trait A {} + | ^^^^^^^^^^^ +note: required by a bound in `B` + --> $DIR/false-sealed-traits-note.rs:17:18 + | +LL | pub trait B: A {} + | ^ required by this bound in `B` + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0277`. From 6bfa00816d7e4dcb0aee9fe547bc75dfe59dc613 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Mon, 21 Jul 2025 11:51:36 +0200 Subject: [PATCH 098/139] Only run `tests/assembly-*` and `tests/codegen-*` tests if they match the current codegen backend --- src/tools/compiletest/src/common.rs | 4 ++-- src/tools/compiletest/src/lib.rs | 19 ++++++++++++++++++- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/tools/compiletest/src/common.rs b/src/tools/compiletest/src/common.rs index 12084fa0b15d..aceae3e3a3b9 100644 --- a/src/tools/compiletest/src/common.rs +++ b/src/tools/compiletest/src/common.rs @@ -57,8 +57,8 @@ impl TestMode { string_enum! { #[derive(Clone, Copy, PartialEq, Debug)] pub enum TestSuite { - Assembly => "assembly", - Codegen => "codegen", + AssemblyLlvm => "assembly-llvm", + CodegenLlvm => "codegen-llvm", CodegenUnits => "codegen-units", Coverage => "coverage", CoverageRunRustdoc => "coverage-run-rustdoc", diff --git a/src/tools/compiletest/src/lib.rs b/src/tools/compiletest/src/lib.rs index 41bed8ed8a0a..c712185733c6 100644 --- a/src/tools/compiletest/src/lib.rs +++ b/src/tools/compiletest/src/lib.rs @@ -31,7 +31,7 @@ use std::time::SystemTime; use std::{env, fs, vec}; use build_helper::git::{get_git_modified_files, get_git_untracked_files}; -use camino::{Utf8Path, Utf8PathBuf}; +use camino::{Utf8Component, Utf8Path, Utf8PathBuf}; use getopts::Options; use rayon::iter::{ParallelBridge, ParallelIterator}; use tracing::debug; @@ -799,6 +799,23 @@ fn collect_tests_from_dir( return Ok(TestCollector::new()); } + let mut components = dir.components().rev(); + if let Some(Utf8Component::Normal(last)) = components.next() + && let Some(("assembly" | "codegen", backend)) = last.split_once('-') + && let Some(Utf8Component::Normal(parent)) = components.next() + && parent == "tests" + && let Ok(backend) = CodegenBackend::try_from(backend) + && backend != cx.config.codegen_backend + { + // We ignore asm tests which don't match the current codegen backend. + warning!( + "Ignoring tests in `{dir}` because they don't match the configured codegen \ + backend (`{}`)", + cx.config.codegen_backend.as_str(), + ); + return Ok(TestCollector::new()); + } + // For run-make tests, a "test file" is actually a directory that contains an `rmake.rs`. if cx.config.mode == TestMode::RunMake { let mut collector = TestCollector::new(); From f5a33e88970ef3863a373682b72b533b0648ad63 Mon Sep 17 00:00:00 2001 From: Jens Reidel Date: Tue, 22 Jul 2025 17:31:47 +0200 Subject: [PATCH 099/139] Add powerpc64le-unknown-linux-musl to CI rustc targets I missed this in the promotion to tier 2 with host tools. Signed-off-by: Jens Reidel --- src/bootstrap/src/core/download.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/bootstrap/src/core/download.rs b/src/bootstrap/src/core/download.rs index d7c6d8dbcc3f..373fcd52052e 100644 --- a/src/bootstrap/src/core/download.rs +++ b/src/bootstrap/src/core/download.rs @@ -875,6 +875,7 @@ pub(crate) fn is_download_ci_available(target_triple: &str, llvm_assertions: boo "powerpc-unknown-linux-gnu", "powerpc64-unknown-linux-gnu", "powerpc64le-unknown-linux-gnu", + "powerpc64le-unknown-linux-musl", "riscv64gc-unknown-linux-gnu", "s390x-unknown-linux-gnu", "x86_64-apple-darwin", From 25bbaf0d5cb212d2d163c244a3ead678bd93f462 Mon Sep 17 00:00:00 2001 From: binarycat Date: Tue, 22 Jul 2025 11:58:34 -0500 Subject: [PATCH 100/139] bootstrap: add package.json and package-lock.json to dist tarball this ensures that js-related tests can still be run from within such a dist tarball. --- src/bootstrap/src/core/build_steps/dist.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/bootstrap/src/core/build_steps/dist.rs b/src/bootstrap/src/core/build_steps/dist.rs index 39e4fb2ac01e..c8a54ad250cb 100644 --- a/src/bootstrap/src/core/build_steps/dist.rs +++ b/src/bootstrap/src/core/build_steps/dist.rs @@ -1068,6 +1068,8 @@ impl Step for PlainSourceTarball { "bootstrap.example.toml", "configure", "license-metadata.json", + "package-lock.json", + "package.json", "x", "x.ps1", "x.py", From 2d1fccd7a1fb713d0d2cea6cb33ad245a6b1f383 Mon Sep 17 00:00:00 2001 From: binarycat Date: Tue, 22 Jul 2025 12:21:14 -0500 Subject: [PATCH 101/139] pass build.npm from bootstrap to tidy and use it for npm install --- src/bootstrap/src/core/build_steps/test.rs | 6 ++++++ src/tools/tidy/src/ext_tool_checks.rs | 5 ++++- src/tools/tidy/src/ext_tool_checks/rustdoc_js.rs | 5 ++--- src/tools/tidy/src/main.rs | 2 ++ 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/bootstrap/src/core/build_steps/test.rs b/src/bootstrap/src/core/build_steps/test.rs index 8344b0e03b48..1022faa09218 100644 --- a/src/bootstrap/src/core/build_steps/test.rs +++ b/src/bootstrap/src/core/build_steps/test.rs @@ -1113,6 +1113,12 @@ impl Step for Tidy { 8 * std::thread::available_parallelism().map_or(1, std::num::NonZeroUsize::get) as u32 }); cmd.arg(jobs.to_string()); + // pass the path to the npm command used for installing js deps. + if let Some(npm) = &builder.config.npm { + cmd.arg(npm); + } else { + cmd.arg("npm"); + } if builder.is_verbose() { cmd.arg("--verbose"); } diff --git a/src/tools/tidy/src/ext_tool_checks.rs b/src/tools/tidy/src/ext_tool_checks.rs index 911d4daae5cd..8121eb057db5 100644 --- a/src/tools/tidy/src/ext_tool_checks.rs +++ b/src/tools/tidy/src/ext_tool_checks.rs @@ -50,6 +50,7 @@ pub fn check( ci_info: &CiInfo, librustdoc_path: &Path, tools_path: &Path, + npm: &Path, bless: bool, extra_checks: Option<&str>, pos_args: &[String], @@ -61,6 +62,7 @@ pub fn check( ci_info, librustdoc_path, tools_path, + npm, bless, extra_checks, pos_args, @@ -75,6 +77,7 @@ fn check_impl( ci_info: &CiInfo, librustdoc_path: &Path, tools_path: &Path, + npm: &Path, bless: bool, extra_checks: Option<&str>, pos_args: &[String], @@ -293,7 +296,7 @@ fn check_impl( } if js_lint || js_typecheck { - rustdoc_js::npm_install(root_path, outdir)?; + rustdoc_js::npm_install(root_path, outdir, npm)?; } if js_lint { diff --git a/src/tools/tidy/src/ext_tool_checks/rustdoc_js.rs b/src/tools/tidy/src/ext_tool_checks/rustdoc_js.rs index c1a62cedd331..7708b128e23d 100644 --- a/src/tools/tidy/src/ext_tool_checks/rustdoc_js.rs +++ b/src/tools/tidy/src/ext_tool_checks/rustdoc_js.rs @@ -23,9 +23,8 @@ fn spawn_cmd(cmd: &mut Command) -> Result { } /// install all js dependencies from package.json. -pub(super) fn npm_install(root_path: &Path, outdir: &Path) -> Result<(), super::Error> { - // FIXME(lolbinarycat): make this obey build.npm bootstrap option - npm::install(root_path, outdir, Path::new("npm"))?; +pub(super) fn npm_install(root_path: &Path, outdir: &Path, npm: &Path) -> Result<(), super::Error> { + npm::install(root_path, outdir, npm)?; Ok(()) } diff --git a/src/tools/tidy/src/main.rs b/src/tools/tidy/src/main.rs index 13b20f33bd0f..11ee2ae688d8 100644 --- a/src/tools/tidy/src/main.rs +++ b/src/tools/tidy/src/main.rs @@ -29,6 +29,7 @@ fn main() { let concurrency: NonZeroUsize = FromStr::from_str(&env::args().nth(4).expect("need concurrency")) .expect("concurrency must be a number"); + let npm: PathBuf = env::args_os().nth(5).expect("need name/path of npm command").into(); let root_manifest = root_path.join("Cargo.toml"); let src_path = root_path.join("src"); @@ -182,6 +183,7 @@ fn main() { &ci_info, &librustdoc_path, &tools_path, + &npm, bless, extra_checks, pos_args From 5b2de8ab27e4a319e23817b61830a5cc6fd1745e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Fri, 4 Jul 2025 09:26:12 +0200 Subject: [PATCH 102/139] Move `std_detect` from `library/stdarch` to `library` --- library/{stdarch/crates => }/std_detect/Cargo.toml | 0 .../{stdarch/crates => }/std_detect/LICENSE-APACHE | 0 library/{stdarch/crates => }/std_detect/LICENSE-MIT | 0 library/{stdarch/crates => }/std_detect/README.md | 0 .../std_detect/src/detect/arch/aarch64.rs | 0 .../crates => }/std_detect/src/detect/arch/arm.rs | 0 .../std_detect/src/detect/arch/loongarch.rs | 0 .../crates => }/std_detect/src/detect/arch/mips.rs | 0 .../std_detect/src/detect/arch/mips64.rs | 0 .../crates => }/std_detect/src/detect/arch/mod.rs | 0 .../std_detect/src/detect/arch/powerpc.rs | 0 .../std_detect/src/detect/arch/powerpc64.rs | 0 .../crates => }/std_detect/src/detect/arch/riscv.rs | 0 .../crates => }/std_detect/src/detect/arch/s390x.rs | 0 .../crates => }/std_detect/src/detect/arch/x86.rs | 0 .../crates => }/std_detect/src/detect/bit.rs | 0 .../crates => }/std_detect/src/detect/cache.rs | 0 .../crates => }/std_detect/src/detect/macros.rs | 0 .../crates => }/std_detect/src/detect/mod.rs | 0 .../crates => }/std_detect/src/detect/os/aarch64.rs | 0 .../std_detect/src/detect/os/darwin/aarch64.rs | 0 .../std_detect/src/detect/os/freebsd/aarch64.rs | 0 .../std_detect/src/detect/os/freebsd/arm.rs | 0 .../std_detect/src/detect/os/freebsd/auxvec.rs | 0 .../std_detect/src/detect/os/freebsd/mod.rs | 0 .../std_detect/src/detect/os/freebsd/powerpc.rs | 0 .../std_detect/src/detect/os/linux/aarch64.rs | 0 .../std_detect/src/detect/os/linux/arm.rs | 0 .../std_detect/src/detect/os/linux/auxvec.rs | 0 .../std_detect/src/detect/os/linux/loongarch.rs | 0 .../std_detect/src/detect/os/linux/mips.rs | 0 .../std_detect/src/detect/os/linux/mod.rs | 0 .../std_detect/src/detect/os/linux/powerpc.rs | 0 .../std_detect/src/detect/os/linux/riscv.rs | 0 .../std_detect/src/detect/os/linux/s390x.rs | 0 .../std_detect/src/detect/os/openbsd/aarch64.rs | 0 .../crates => }/std_detect/src/detect/os/other.rs | 0 .../crates => }/std_detect/src/detect/os/riscv.rs | 0 .../std_detect/src/detect/os/windows/aarch64.rs | 0 .../crates => }/std_detect/src/detect/os/x86.rs | 0 .../detect/test_data/linux-artificial-aarch64.auxv | Bin .../test_data/linux-empty-hwcap2-aarch64.auxv | Bin .../src/detect/test_data/linux-hwcap2-aarch64.auxv | Bin .../detect/test_data/linux-no-hwcap2-aarch64.auxv | Bin .../std_detect/src/detect/test_data/linux-rpi3.auxv | Bin .../macos-virtualbox-linux-x86-4850HQ.auxv | Bin library/{stdarch/crates => }/std_detect/src/lib.rs | 0 .../crates => }/std_detect/tests/cpu-detection.rs | 0 .../std_detect/tests/macro_trailing_commas.rs | 0 .../crates => }/std_detect/tests/x86-specific.rs | 0 50 files changed, 0 insertions(+), 0 deletions(-) rename library/{stdarch/crates => }/std_detect/Cargo.toml (100%) rename library/{stdarch/crates => }/std_detect/LICENSE-APACHE (100%) rename library/{stdarch/crates => }/std_detect/LICENSE-MIT (100%) rename library/{stdarch/crates => }/std_detect/README.md (100%) rename library/{stdarch/crates => }/std_detect/src/detect/arch/aarch64.rs (100%) rename library/{stdarch/crates => }/std_detect/src/detect/arch/arm.rs (100%) rename library/{stdarch/crates => }/std_detect/src/detect/arch/loongarch.rs (100%) rename library/{stdarch/crates => }/std_detect/src/detect/arch/mips.rs (100%) rename library/{stdarch/crates => }/std_detect/src/detect/arch/mips64.rs (100%) rename library/{stdarch/crates => }/std_detect/src/detect/arch/mod.rs (100%) rename library/{stdarch/crates => }/std_detect/src/detect/arch/powerpc.rs (100%) rename library/{stdarch/crates => }/std_detect/src/detect/arch/powerpc64.rs (100%) rename library/{stdarch/crates => }/std_detect/src/detect/arch/riscv.rs (100%) rename library/{stdarch/crates => }/std_detect/src/detect/arch/s390x.rs (100%) rename library/{stdarch/crates => }/std_detect/src/detect/arch/x86.rs (100%) rename library/{stdarch/crates => }/std_detect/src/detect/bit.rs (100%) rename library/{stdarch/crates => }/std_detect/src/detect/cache.rs (100%) rename library/{stdarch/crates => }/std_detect/src/detect/macros.rs (100%) rename library/{stdarch/crates => }/std_detect/src/detect/mod.rs (100%) rename library/{stdarch/crates => }/std_detect/src/detect/os/aarch64.rs (100%) rename library/{stdarch/crates => }/std_detect/src/detect/os/darwin/aarch64.rs (100%) rename library/{stdarch/crates => }/std_detect/src/detect/os/freebsd/aarch64.rs (100%) rename library/{stdarch/crates => }/std_detect/src/detect/os/freebsd/arm.rs (100%) rename library/{stdarch/crates => }/std_detect/src/detect/os/freebsd/auxvec.rs (100%) rename library/{stdarch/crates => }/std_detect/src/detect/os/freebsd/mod.rs (100%) rename library/{stdarch/crates => }/std_detect/src/detect/os/freebsd/powerpc.rs (100%) rename library/{stdarch/crates => }/std_detect/src/detect/os/linux/aarch64.rs (100%) rename library/{stdarch/crates => }/std_detect/src/detect/os/linux/arm.rs (100%) rename library/{stdarch/crates => }/std_detect/src/detect/os/linux/auxvec.rs (100%) rename library/{stdarch/crates => }/std_detect/src/detect/os/linux/loongarch.rs (100%) rename library/{stdarch/crates => }/std_detect/src/detect/os/linux/mips.rs (100%) rename library/{stdarch/crates => }/std_detect/src/detect/os/linux/mod.rs (100%) rename library/{stdarch/crates => }/std_detect/src/detect/os/linux/powerpc.rs (100%) rename library/{stdarch/crates => }/std_detect/src/detect/os/linux/riscv.rs (100%) rename library/{stdarch/crates => }/std_detect/src/detect/os/linux/s390x.rs (100%) rename library/{stdarch/crates => }/std_detect/src/detect/os/openbsd/aarch64.rs (100%) rename library/{stdarch/crates => }/std_detect/src/detect/os/other.rs (100%) rename library/{stdarch/crates => }/std_detect/src/detect/os/riscv.rs (100%) rename library/{stdarch/crates => }/std_detect/src/detect/os/windows/aarch64.rs (100%) rename library/{stdarch/crates => }/std_detect/src/detect/os/x86.rs (100%) rename library/{stdarch/crates => }/std_detect/src/detect/test_data/linux-artificial-aarch64.auxv (100%) rename library/{stdarch/crates => }/std_detect/src/detect/test_data/linux-empty-hwcap2-aarch64.auxv (100%) rename library/{stdarch/crates => }/std_detect/src/detect/test_data/linux-hwcap2-aarch64.auxv (100%) rename library/{stdarch/crates => }/std_detect/src/detect/test_data/linux-no-hwcap2-aarch64.auxv (100%) rename library/{stdarch/crates => }/std_detect/src/detect/test_data/linux-rpi3.auxv (100%) rename library/{stdarch/crates => }/std_detect/src/detect/test_data/macos-virtualbox-linux-x86-4850HQ.auxv (100%) rename library/{stdarch/crates => }/std_detect/src/lib.rs (100%) rename library/{stdarch/crates => }/std_detect/tests/cpu-detection.rs (100%) rename library/{stdarch/crates => }/std_detect/tests/macro_trailing_commas.rs (100%) rename library/{stdarch/crates => }/std_detect/tests/x86-specific.rs (100%) diff --git a/library/stdarch/crates/std_detect/Cargo.toml b/library/std_detect/Cargo.toml similarity index 100% rename from library/stdarch/crates/std_detect/Cargo.toml rename to library/std_detect/Cargo.toml diff --git a/library/stdarch/crates/std_detect/LICENSE-APACHE b/library/std_detect/LICENSE-APACHE similarity index 100% rename from library/stdarch/crates/std_detect/LICENSE-APACHE rename to library/std_detect/LICENSE-APACHE diff --git a/library/stdarch/crates/std_detect/LICENSE-MIT b/library/std_detect/LICENSE-MIT similarity index 100% rename from library/stdarch/crates/std_detect/LICENSE-MIT rename to library/std_detect/LICENSE-MIT diff --git a/library/stdarch/crates/std_detect/README.md b/library/std_detect/README.md similarity index 100% rename from library/stdarch/crates/std_detect/README.md rename to library/std_detect/README.md diff --git a/library/stdarch/crates/std_detect/src/detect/arch/aarch64.rs b/library/std_detect/src/detect/arch/aarch64.rs similarity index 100% rename from library/stdarch/crates/std_detect/src/detect/arch/aarch64.rs rename to library/std_detect/src/detect/arch/aarch64.rs diff --git a/library/stdarch/crates/std_detect/src/detect/arch/arm.rs b/library/std_detect/src/detect/arch/arm.rs similarity index 100% rename from library/stdarch/crates/std_detect/src/detect/arch/arm.rs rename to library/std_detect/src/detect/arch/arm.rs diff --git a/library/stdarch/crates/std_detect/src/detect/arch/loongarch.rs b/library/std_detect/src/detect/arch/loongarch.rs similarity index 100% rename from library/stdarch/crates/std_detect/src/detect/arch/loongarch.rs rename to library/std_detect/src/detect/arch/loongarch.rs diff --git a/library/stdarch/crates/std_detect/src/detect/arch/mips.rs b/library/std_detect/src/detect/arch/mips.rs similarity index 100% rename from library/stdarch/crates/std_detect/src/detect/arch/mips.rs rename to library/std_detect/src/detect/arch/mips.rs diff --git a/library/stdarch/crates/std_detect/src/detect/arch/mips64.rs b/library/std_detect/src/detect/arch/mips64.rs similarity index 100% rename from library/stdarch/crates/std_detect/src/detect/arch/mips64.rs rename to library/std_detect/src/detect/arch/mips64.rs diff --git a/library/stdarch/crates/std_detect/src/detect/arch/mod.rs b/library/std_detect/src/detect/arch/mod.rs similarity index 100% rename from library/stdarch/crates/std_detect/src/detect/arch/mod.rs rename to library/std_detect/src/detect/arch/mod.rs diff --git a/library/stdarch/crates/std_detect/src/detect/arch/powerpc.rs b/library/std_detect/src/detect/arch/powerpc.rs similarity index 100% rename from library/stdarch/crates/std_detect/src/detect/arch/powerpc.rs rename to library/std_detect/src/detect/arch/powerpc.rs diff --git a/library/stdarch/crates/std_detect/src/detect/arch/powerpc64.rs b/library/std_detect/src/detect/arch/powerpc64.rs similarity index 100% rename from library/stdarch/crates/std_detect/src/detect/arch/powerpc64.rs rename to library/std_detect/src/detect/arch/powerpc64.rs diff --git a/library/stdarch/crates/std_detect/src/detect/arch/riscv.rs b/library/std_detect/src/detect/arch/riscv.rs similarity index 100% rename from library/stdarch/crates/std_detect/src/detect/arch/riscv.rs rename to library/std_detect/src/detect/arch/riscv.rs diff --git a/library/stdarch/crates/std_detect/src/detect/arch/s390x.rs b/library/std_detect/src/detect/arch/s390x.rs similarity index 100% rename from library/stdarch/crates/std_detect/src/detect/arch/s390x.rs rename to library/std_detect/src/detect/arch/s390x.rs diff --git a/library/stdarch/crates/std_detect/src/detect/arch/x86.rs b/library/std_detect/src/detect/arch/x86.rs similarity index 100% rename from library/stdarch/crates/std_detect/src/detect/arch/x86.rs rename to library/std_detect/src/detect/arch/x86.rs diff --git a/library/stdarch/crates/std_detect/src/detect/bit.rs b/library/std_detect/src/detect/bit.rs similarity index 100% rename from library/stdarch/crates/std_detect/src/detect/bit.rs rename to library/std_detect/src/detect/bit.rs diff --git a/library/stdarch/crates/std_detect/src/detect/cache.rs b/library/std_detect/src/detect/cache.rs similarity index 100% rename from library/stdarch/crates/std_detect/src/detect/cache.rs rename to library/std_detect/src/detect/cache.rs diff --git a/library/stdarch/crates/std_detect/src/detect/macros.rs b/library/std_detect/src/detect/macros.rs similarity index 100% rename from library/stdarch/crates/std_detect/src/detect/macros.rs rename to library/std_detect/src/detect/macros.rs diff --git a/library/stdarch/crates/std_detect/src/detect/mod.rs b/library/std_detect/src/detect/mod.rs similarity index 100% rename from library/stdarch/crates/std_detect/src/detect/mod.rs rename to library/std_detect/src/detect/mod.rs diff --git a/library/stdarch/crates/std_detect/src/detect/os/aarch64.rs b/library/std_detect/src/detect/os/aarch64.rs similarity index 100% rename from library/stdarch/crates/std_detect/src/detect/os/aarch64.rs rename to library/std_detect/src/detect/os/aarch64.rs diff --git a/library/stdarch/crates/std_detect/src/detect/os/darwin/aarch64.rs b/library/std_detect/src/detect/os/darwin/aarch64.rs similarity index 100% rename from library/stdarch/crates/std_detect/src/detect/os/darwin/aarch64.rs rename to library/std_detect/src/detect/os/darwin/aarch64.rs diff --git a/library/stdarch/crates/std_detect/src/detect/os/freebsd/aarch64.rs b/library/std_detect/src/detect/os/freebsd/aarch64.rs similarity index 100% rename from library/stdarch/crates/std_detect/src/detect/os/freebsd/aarch64.rs rename to library/std_detect/src/detect/os/freebsd/aarch64.rs diff --git a/library/stdarch/crates/std_detect/src/detect/os/freebsd/arm.rs b/library/std_detect/src/detect/os/freebsd/arm.rs similarity index 100% rename from library/stdarch/crates/std_detect/src/detect/os/freebsd/arm.rs rename to library/std_detect/src/detect/os/freebsd/arm.rs diff --git a/library/stdarch/crates/std_detect/src/detect/os/freebsd/auxvec.rs b/library/std_detect/src/detect/os/freebsd/auxvec.rs similarity index 100% rename from library/stdarch/crates/std_detect/src/detect/os/freebsd/auxvec.rs rename to library/std_detect/src/detect/os/freebsd/auxvec.rs diff --git a/library/stdarch/crates/std_detect/src/detect/os/freebsd/mod.rs b/library/std_detect/src/detect/os/freebsd/mod.rs similarity index 100% rename from library/stdarch/crates/std_detect/src/detect/os/freebsd/mod.rs rename to library/std_detect/src/detect/os/freebsd/mod.rs diff --git a/library/stdarch/crates/std_detect/src/detect/os/freebsd/powerpc.rs b/library/std_detect/src/detect/os/freebsd/powerpc.rs similarity index 100% rename from library/stdarch/crates/std_detect/src/detect/os/freebsd/powerpc.rs rename to library/std_detect/src/detect/os/freebsd/powerpc.rs diff --git a/library/stdarch/crates/std_detect/src/detect/os/linux/aarch64.rs b/library/std_detect/src/detect/os/linux/aarch64.rs similarity index 100% rename from library/stdarch/crates/std_detect/src/detect/os/linux/aarch64.rs rename to library/std_detect/src/detect/os/linux/aarch64.rs diff --git a/library/stdarch/crates/std_detect/src/detect/os/linux/arm.rs b/library/std_detect/src/detect/os/linux/arm.rs similarity index 100% rename from library/stdarch/crates/std_detect/src/detect/os/linux/arm.rs rename to library/std_detect/src/detect/os/linux/arm.rs diff --git a/library/stdarch/crates/std_detect/src/detect/os/linux/auxvec.rs b/library/std_detect/src/detect/os/linux/auxvec.rs similarity index 100% rename from library/stdarch/crates/std_detect/src/detect/os/linux/auxvec.rs rename to library/std_detect/src/detect/os/linux/auxvec.rs diff --git a/library/stdarch/crates/std_detect/src/detect/os/linux/loongarch.rs b/library/std_detect/src/detect/os/linux/loongarch.rs similarity index 100% rename from library/stdarch/crates/std_detect/src/detect/os/linux/loongarch.rs rename to library/std_detect/src/detect/os/linux/loongarch.rs diff --git a/library/stdarch/crates/std_detect/src/detect/os/linux/mips.rs b/library/std_detect/src/detect/os/linux/mips.rs similarity index 100% rename from library/stdarch/crates/std_detect/src/detect/os/linux/mips.rs rename to library/std_detect/src/detect/os/linux/mips.rs diff --git a/library/stdarch/crates/std_detect/src/detect/os/linux/mod.rs b/library/std_detect/src/detect/os/linux/mod.rs similarity index 100% rename from library/stdarch/crates/std_detect/src/detect/os/linux/mod.rs rename to library/std_detect/src/detect/os/linux/mod.rs diff --git a/library/stdarch/crates/std_detect/src/detect/os/linux/powerpc.rs b/library/std_detect/src/detect/os/linux/powerpc.rs similarity index 100% rename from library/stdarch/crates/std_detect/src/detect/os/linux/powerpc.rs rename to library/std_detect/src/detect/os/linux/powerpc.rs diff --git a/library/stdarch/crates/std_detect/src/detect/os/linux/riscv.rs b/library/std_detect/src/detect/os/linux/riscv.rs similarity index 100% rename from library/stdarch/crates/std_detect/src/detect/os/linux/riscv.rs rename to library/std_detect/src/detect/os/linux/riscv.rs diff --git a/library/stdarch/crates/std_detect/src/detect/os/linux/s390x.rs b/library/std_detect/src/detect/os/linux/s390x.rs similarity index 100% rename from library/stdarch/crates/std_detect/src/detect/os/linux/s390x.rs rename to library/std_detect/src/detect/os/linux/s390x.rs diff --git a/library/stdarch/crates/std_detect/src/detect/os/openbsd/aarch64.rs b/library/std_detect/src/detect/os/openbsd/aarch64.rs similarity index 100% rename from library/stdarch/crates/std_detect/src/detect/os/openbsd/aarch64.rs rename to library/std_detect/src/detect/os/openbsd/aarch64.rs diff --git a/library/stdarch/crates/std_detect/src/detect/os/other.rs b/library/std_detect/src/detect/os/other.rs similarity index 100% rename from library/stdarch/crates/std_detect/src/detect/os/other.rs rename to library/std_detect/src/detect/os/other.rs diff --git a/library/stdarch/crates/std_detect/src/detect/os/riscv.rs b/library/std_detect/src/detect/os/riscv.rs similarity index 100% rename from library/stdarch/crates/std_detect/src/detect/os/riscv.rs rename to library/std_detect/src/detect/os/riscv.rs diff --git a/library/stdarch/crates/std_detect/src/detect/os/windows/aarch64.rs b/library/std_detect/src/detect/os/windows/aarch64.rs similarity index 100% rename from library/stdarch/crates/std_detect/src/detect/os/windows/aarch64.rs rename to library/std_detect/src/detect/os/windows/aarch64.rs diff --git a/library/stdarch/crates/std_detect/src/detect/os/x86.rs b/library/std_detect/src/detect/os/x86.rs similarity index 100% rename from library/stdarch/crates/std_detect/src/detect/os/x86.rs rename to library/std_detect/src/detect/os/x86.rs diff --git a/library/stdarch/crates/std_detect/src/detect/test_data/linux-artificial-aarch64.auxv b/library/std_detect/src/detect/test_data/linux-artificial-aarch64.auxv similarity index 100% rename from library/stdarch/crates/std_detect/src/detect/test_data/linux-artificial-aarch64.auxv rename to library/std_detect/src/detect/test_data/linux-artificial-aarch64.auxv diff --git a/library/stdarch/crates/std_detect/src/detect/test_data/linux-empty-hwcap2-aarch64.auxv b/library/std_detect/src/detect/test_data/linux-empty-hwcap2-aarch64.auxv similarity index 100% rename from library/stdarch/crates/std_detect/src/detect/test_data/linux-empty-hwcap2-aarch64.auxv rename to library/std_detect/src/detect/test_data/linux-empty-hwcap2-aarch64.auxv diff --git a/library/stdarch/crates/std_detect/src/detect/test_data/linux-hwcap2-aarch64.auxv b/library/std_detect/src/detect/test_data/linux-hwcap2-aarch64.auxv similarity index 100% rename from library/stdarch/crates/std_detect/src/detect/test_data/linux-hwcap2-aarch64.auxv rename to library/std_detect/src/detect/test_data/linux-hwcap2-aarch64.auxv diff --git a/library/stdarch/crates/std_detect/src/detect/test_data/linux-no-hwcap2-aarch64.auxv b/library/std_detect/src/detect/test_data/linux-no-hwcap2-aarch64.auxv similarity index 100% rename from library/stdarch/crates/std_detect/src/detect/test_data/linux-no-hwcap2-aarch64.auxv rename to library/std_detect/src/detect/test_data/linux-no-hwcap2-aarch64.auxv diff --git a/library/stdarch/crates/std_detect/src/detect/test_data/linux-rpi3.auxv b/library/std_detect/src/detect/test_data/linux-rpi3.auxv similarity index 100% rename from library/stdarch/crates/std_detect/src/detect/test_data/linux-rpi3.auxv rename to library/std_detect/src/detect/test_data/linux-rpi3.auxv diff --git a/library/stdarch/crates/std_detect/src/detect/test_data/macos-virtualbox-linux-x86-4850HQ.auxv b/library/std_detect/src/detect/test_data/macos-virtualbox-linux-x86-4850HQ.auxv similarity index 100% rename from library/stdarch/crates/std_detect/src/detect/test_data/macos-virtualbox-linux-x86-4850HQ.auxv rename to library/std_detect/src/detect/test_data/macos-virtualbox-linux-x86-4850HQ.auxv diff --git a/library/stdarch/crates/std_detect/src/lib.rs b/library/std_detect/src/lib.rs similarity index 100% rename from library/stdarch/crates/std_detect/src/lib.rs rename to library/std_detect/src/lib.rs diff --git a/library/stdarch/crates/std_detect/tests/cpu-detection.rs b/library/std_detect/tests/cpu-detection.rs similarity index 100% rename from library/stdarch/crates/std_detect/tests/cpu-detection.rs rename to library/std_detect/tests/cpu-detection.rs diff --git a/library/stdarch/crates/std_detect/tests/macro_trailing_commas.rs b/library/std_detect/tests/macro_trailing_commas.rs similarity index 100% rename from library/stdarch/crates/std_detect/tests/macro_trailing_commas.rs rename to library/std_detect/tests/macro_trailing_commas.rs diff --git a/library/stdarch/crates/std_detect/tests/x86-specific.rs b/library/std_detect/tests/x86-specific.rs similarity index 100% rename from library/stdarch/crates/std_detect/tests/x86-specific.rs rename to library/std_detect/tests/x86-specific.rs From b23ab7888a06f548e8d9a5951e97cb68399e31b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Fri, 4 Jul 2025 09:51:28 +0200 Subject: [PATCH 103/139] Make `std_detect` a direct dependency of `std` --- library/Cargo.lock | 4 ++-- library/std/Cargo.toml | 7 ++----- library/std_detect/Cargo.toml | 12 +++--------- 3 files changed, 7 insertions(+), 16 deletions(-) diff --git a/library/Cargo.lock b/library/Cargo.lock index 8b5275e5065e..94155e083981 100644 --- a/library/Cargo.lock +++ b/library/Cargo.lock @@ -340,10 +340,10 @@ dependencies = [ name = "std_detect" version = "0.1.5" dependencies = [ + "alloc", "cfg-if", + "core", "libc", - "rustc-std-workspace-alloc", - "rustc-std-workspace-core", ] [[package]] diff --git a/library/std/Cargo.toml b/library/std/Cargo.toml index 5c3132a7375a..ba1e1f5218af 100644 --- a/library/std/Cargo.toml +++ b/library/std/Cargo.toml @@ -23,9 +23,7 @@ unwind = { path = "../unwind" } hashbrown = { version = "0.15", default-features = false, features = [ 'rustc-dep-of-std', ] } -std_detect = { path = "../stdarch/crates/std_detect", public = true, default-features = false, features = [ - 'rustc-dep-of-std', -] } +std_detect = { path = "../std_detect", public = true } # Dependencies of the `backtrace` crate rustc-demangle = { version = "0.1.24", features = ['rustc-dep-of-std'] } @@ -118,8 +116,7 @@ optimize_for_size = ["core/optimize_for_size", "alloc/optimize_for_size"] debug_refcell = ["core/debug_refcell"] -# Enable std_detect default features for stdarch/crates/std_detect: -# https://github.com/rust-lang/stdarch/blob/master/crates/std_detect/Cargo.toml +# Enable std_detect features: std_detect_file_io = ["std_detect/std_detect_file_io"] std_detect_dlsym_getauxval = ["std_detect/std_detect_dlsym_getauxval"] diff --git a/library/std_detect/Cargo.toml b/library/std_detect/Cargo.toml index f990e7241252..8d91454726bc 100644 --- a/library/std_detect/Cargo.toml +++ b/library/std_detect/Cargo.toml @@ -22,20 +22,14 @@ maintenance = { status = "experimental" } [dependencies] cfg-if = "1.0.0" - -# When built as part of libstd -core = { version = "1.0.0", optional = true, package = "rustc-std-workspace-core" } -alloc = { version = "1.0.0", optional = true, package = "rustc-std-workspace-alloc" } +core = { path = "../core" } +alloc = { path = "../alloc" } [target.'cfg(not(windows))'.dependencies] libc = { version = "0.2.0", optional = true, default-features = false } [features] -default = [ "std_detect_dlsym_getauxval", "std_detect_file_io" ] +default = [] std_detect_file_io = [ "libc" ] std_detect_dlsym_getauxval = [ "libc" ] std_detect_env_override = [ "libc" ] -rustc-dep-of-std = [ - "core", - "alloc", -] From 1057a2213af6fd273da86f13edeae559bfdd587d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Fri, 4 Jul 2025 10:08:50 +0200 Subject: [PATCH 104/139] Allow platform-specific code in `std_detect` --- src/tools/tidy/src/pal.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/tools/tidy/src/pal.rs b/src/tools/tidy/src/pal.rs index b7d4a331891a..5b8b44429bbc 100644 --- a/src/tools/tidy/src/pal.rs +++ b/src/tools/tidy/src/pal.rs @@ -37,6 +37,7 @@ use crate::walk::{filter_dirs, walk}; // Paths that may contain platform-specific code. const EXCEPTION_PATHS: &[&str] = &[ "library/compiler-builtins", + "library/std_detect", "library/windows_targets", "library/panic_abort", "library/panic_unwind", From ee6f2c5276c3e19b919abb61693e66b0ded9c8ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Fri, 4 Jul 2025 10:08:58 +0200 Subject: [PATCH 105/139] Reformat `std_detect` --- library/std_detect/src/detect/cache.rs | 38 +++----------- library/std_detect/src/detect/mod.rs | 1 - library/std_detect/src/detect/os/aarch64.rs | 8 ++- .../src/detect/os/darwin/aarch64.rs | 11 ++-- .../src/detect/os/freebsd/auxvec.rs | 7 +-- .../std_detect/src/detect/os/linux/aarch64.rs | 10 +--- .../src/detect/os/linux/loongarch.rs | 15 ++---- .../std_detect/src/detect/os/linux/riscv.rs | 11 +--- .../src/detect/os/openbsd/aarch64.rs | 4 +- library/std_detect/src/detect/os/x86.rs | 39 ++++----------- library/std_detect/tests/cpu-detection.rs | 50 ++++--------------- library/std_detect/tests/x86-specific.rs | 42 +++------------- 12 files changed, 54 insertions(+), 182 deletions(-) diff --git a/library/std_detect/src/detect/cache.rs b/library/std_detect/src/detect/cache.rs index 83bcedea612e..1a42e0914631 100644 --- a/library/std_detect/src/detect/cache.rs +++ b/library/std_detect/src/detect/cache.rs @@ -3,9 +3,7 @@ #![allow(dead_code)] // not used on all platforms -use core::sync::atomic::Ordering; - -use core::sync::atomic::AtomicUsize; +use core::sync::atomic::{AtomicUsize, Ordering}; /// Sets the `bit` of `x`. #[inline] @@ -40,20 +38,14 @@ impl Initializer { /// Tests the `bit` of the cache. #[inline] pub(crate) fn test(self, bit: u32) -> bool { - debug_assert!( - bit < CACHE_CAPACITY, - "too many features, time to increase the cache size!" - ); + debug_assert!(bit < CACHE_CAPACITY, "too many features, time to increase the cache size!"); test_bit(self.0, bit) } /// Sets the `bit` of the cache. #[inline] pub(crate) fn set(&mut self, bit: u32) { - debug_assert!( - bit < CACHE_CAPACITY, - "too many features, time to increase the cache size!" - ); + debug_assert!(bit < CACHE_CAPACITY, "too many features, time to increase the cache size!"); let v = self.0; self.0 = set_bit(v, bit); } @@ -61,10 +53,7 @@ impl Initializer { /// Unsets the `bit` of the cache. #[inline] pub(crate) fn unset(&mut self, bit: u32) { - debug_assert!( - bit < CACHE_CAPACITY, - "too many features, time to increase the cache size!" - ); + debug_assert!(bit < CACHE_CAPACITY, "too many features, time to increase the cache size!"); let v = self.0; self.0 = unset_bit(v, bit); } @@ -73,11 +62,7 @@ impl Initializer { /// This global variable is a cache of the features supported by the CPU. // Note: the third slot is only used in x86 // Another Slot can be added if needed without any change to `Initializer` -static CACHE: [Cache; 3] = [ - Cache::uninitialized(), - Cache::uninitialized(), - Cache::uninitialized(), -]; +static CACHE: [Cache; 3] = [Cache::uninitialized(), Cache::uninitialized(), Cache::uninitialized()]; /// Feature cache with capacity for `size_of::() * 8 - 1` features. /// @@ -104,19 +89,14 @@ impl Cache { #[inline] pub(crate) fn test(&self, bit: u32) -> Option { let cached = self.0.load(Ordering::Relaxed); - if cached == 0 { - None - } else { - Some(test_bit(cached as u128, bit)) - } + if cached == 0 { None } else { Some(test_bit(cached as u128, bit)) } } /// Initializes the cache. #[inline] fn initialize(&self, value: usize) -> usize { debug_assert_eq!((value & !Cache::MASK), 0); - self.0 - .store(value | Cache::INITIALIZED_BIT, Ordering::Relaxed); + self.0.store(value | Cache::INITIALIZED_BIT, Ordering::Relaxed); value } } @@ -217,7 +197,5 @@ pub(crate) fn test(bit: u32) -> bool { } else { (bit - 2 * Cache::CAPACITY, 2) }; - CACHE[idx] - .test(relative_bit) - .unwrap_or_else(|| detect_and_initialize().test(bit)) + CACHE[idx].test(relative_bit).unwrap_or_else(|| detect_and_initialize().test(bit)) } diff --git a/library/std_detect/src/detect/mod.rs b/library/std_detect/src/detect/mod.rs index a9e9709c1f67..f936a5a1345d 100644 --- a/library/std_detect/src/detect/mod.rs +++ b/library/std_detect/src/detect/mod.rs @@ -29,7 +29,6 @@ mod arch; #[doc(hidden)] #[unstable(feature = "stdarch_internal", issue = "none")] pub use self::arch::__is_feature_detected; - pub(crate) use self::arch::Feature; mod bit; diff --git a/library/std_detect/src/detect/os/aarch64.rs b/library/std_detect/src/detect/os/aarch64.rs index 1ff2a17e6e1e..c2c754ccf8db 100644 --- a/library/std_detect/src/detect/os/aarch64.rs +++ b/library/std_detect/src/detect/os/aarch64.rs @@ -17,9 +17,10 @@ //! - [Linux documentation](https://www.kernel.org/doc/Documentation/arm64/cpu-feature-registers.txt) //! - [ARM documentation](https://developer.arm.com/documentation/ddi0601/2022-12/AArch64-Registers?lang=en) -use crate::detect::{Feature, cache}; use core::arch::asm; +use crate::detect::{Feature, cache}; + /// Try to read the features from the system registers. /// /// This will cause SIGILL if the current OS is not trapping the mrs instruction. @@ -104,10 +105,7 @@ pub(crate) fn parse_system_registers( let sha2 = bits_shift(aa64isar0, 15, 12) >= 1; enable_feature(Feature::sha2, asimd && sha1 && sha2); enable_feature(Feature::rdm, asimd && bits_shift(aa64isar0, 31, 28) >= 1); - enable_feature( - Feature::dotprod, - asimd && bits_shift(aa64isar0, 47, 44) >= 1, - ); + enable_feature(Feature::dotprod, asimd && bits_shift(aa64isar0, 47, 44) >= 1); enable_feature(Feature::sve, asimd && bits_shift(aa64pfr0, 35, 32) >= 1); } diff --git a/library/std_detect/src/detect/os/darwin/aarch64.rs b/library/std_detect/src/detect/os/darwin/aarch64.rs index 44d921689e5a..f5409361d93b 100644 --- a/library/std_detect/src/detect/os/darwin/aarch64.rs +++ b/library/std_detect/src/detect/os/darwin/aarch64.rs @@ -2,9 +2,10 @@ //! //! -use crate::detect::{Feature, cache}; use core::ffi::CStr; +use crate::detect::{Feature, cache}; + #[inline] fn _sysctlbyname(name: &CStr) -> bool { use libc; @@ -14,13 +15,7 @@ fn _sysctlbyname(name: &CStr) -> bool { let enabled_ptr = &mut enabled as *mut i32 as *mut libc::c_void; let ret = unsafe { - libc::sysctlbyname( - name.as_ptr(), - enabled_ptr, - &mut enabled_len, - core::ptr::null_mut(), - 0, - ) + libc::sysctlbyname(name.as_ptr(), enabled_ptr, &mut enabled_len, core::ptr::null_mut(), 0) }; match ret { diff --git a/library/std_detect/src/detect/os/freebsd/auxvec.rs b/library/std_detect/src/detect/os/freebsd/auxvec.rs index 4e72bf22d76c..2a7b87c05d1c 100644 --- a/library/std_detect/src/detect/os/freebsd/auxvec.rs +++ b/library/std_detect/src/detect/os/freebsd/auxvec.rs @@ -54,11 +54,8 @@ fn archauxv(key: libc::c_int) -> usize { // https://github.com/freebsd/freebsd-src/blob/release/11.4.0/sys/sys/auxv.h // FreeBSD 11 support in std has been removed in Rust 1.75 (https://github.com/rust-lang/rust/pull/114521), // so we can safely use this function. - let res = libc::elf_aux_info( - key, - &mut out as *mut libc::c_ulong as *mut libc::c_void, - OUT_LEN, - ); + let res = + libc::elf_aux_info(key, &mut out as *mut libc::c_ulong as *mut libc::c_void, OUT_LEN); // If elf_aux_info fails, `out` will be left at zero (which is the proper default value). debug_assert!(res == 0 || out == 0); } diff --git a/library/std_detect/src/detect/os/linux/aarch64.rs b/library/std_detect/src/detect/os/linux/aarch64.rs index 22a9cefff7b8..0de4beeae8b3 100644 --- a/library/std_detect/src/detect/os/linux/aarch64.rs +++ b/library/std_detect/src/detect/os/linux/aarch64.rs @@ -343,14 +343,8 @@ impl AtHwcap { enable_feature(Feature::sve2, sve2); enable_feature(Feature::sve2p1, self.sve2p1 && sve2); // SVE2 extensions require SVE2 and crypto features - enable_feature( - Feature::sve2_aes, - self.sveaes && self.svepmull && sve2 && self.aes, - ); - enable_feature( - Feature::sve2_sm4, - self.svesm4 && sve2 && self.sm3 && self.sm4, - ); + enable_feature(Feature::sve2_aes, self.sveaes && self.svepmull && sve2 && self.aes); + enable_feature(Feature::sve2_sm4, self.svesm4 && sve2 && self.sm3 && self.sm4); enable_feature( Feature::sve2_sha3, self.svesha3 && sve2 && self.sha512 && self.sha3 && self.sha1 && self.sha2, diff --git a/library/std_detect/src/detect/os/linux/loongarch.rs b/library/std_detect/src/detect/os/linux/loongarch.rs index 14cc7a731835..e97fda11d08f 100644 --- a/library/std_detect/src/detect/os/linux/loongarch.rs +++ b/library/std_detect/src/detect/os/linux/loongarch.rs @@ -1,8 +1,9 @@ //! Run-time feature detection for LoongArch on Linux. +use core::arch::asm; + use super::auxvec; use crate::detect::{Feature, bit, cache}; -use core::arch::asm; /// Try to read the features from the auxiliary vector. pub(crate) fn detect_features() -> cache::Initializer { @@ -43,16 +44,8 @@ pub(crate) fn detect_features() -> cache::Initializer { // // [hwcap]: https://github.com/torvalds/linux/blob/master/arch/loongarch/include/uapi/asm/hwcap.h if let Ok(auxv) = auxvec::auxv() { - enable_feature( - &mut value, - Feature::f, - bit::test(cpucfg2, 1) && bit::test(auxv.hwcap, 3), - ); - enable_feature( - &mut value, - Feature::d, - bit::test(cpucfg2, 2) && bit::test(auxv.hwcap, 3), - ); + enable_feature(&mut value, Feature::f, bit::test(cpucfg2, 1) && bit::test(auxv.hwcap, 3)); + enable_feature(&mut value, Feature::d, bit::test(cpucfg2, 2) && bit::test(auxv.hwcap, 3)); enable_feature(&mut value, Feature::lsx, bit::test(auxv.hwcap, 4)); enable_feature(&mut value, Feature::lasx, bit::test(auxv.hwcap, 5)); enable_feature( diff --git a/library/std_detect/src/detect/os/linux/riscv.rs b/library/std_detect/src/detect/os/linux/riscv.rs index db20538af951..dbb3664890e5 100644 --- a/library/std_detect/src/detect/os/linux/riscv.rs +++ b/library/std_detect/src/detect/os/linux/riscv.rs @@ -119,16 +119,7 @@ fn _riscv_hwprobe(out: &mut [riscv_hwprobe]) -> bool { cpus: *mut libc::c_ulong, flags: libc::c_uint, ) -> libc::c_long { - unsafe { - libc::syscall( - __NR_riscv_hwprobe, - pairs, - pair_count, - cpu_set_size, - cpus, - flags, - ) - } + unsafe { libc::syscall(__NR_riscv_hwprobe, pairs, pair_count, cpu_set_size, cpus, flags) } } unsafe { __riscv_hwprobe(out.as_mut_ptr(), out.len(), 0, ptr::null_mut(), 0) == 0 } diff --git a/library/std_detect/src/detect/os/openbsd/aarch64.rs b/library/std_detect/src/detect/os/openbsd/aarch64.rs index cfe4ad10ad64..2fae47b05c40 100644 --- a/library/std_detect/src/detect/os/openbsd/aarch64.rs +++ b/library/std_detect/src/detect/os/openbsd/aarch64.rs @@ -4,8 +4,10 @@ //! https://github.com/openbsd/src/commit/d335af936b9d7dd9cf655cae1ce19560c45de6c8 //! https://github.com/golang/go/commit/cd54ef1f61945459486e9eea2f016d99ef1da925 +use core::mem::MaybeUninit; +use core::ptr; + use crate::detect::cache; -use core::{mem::MaybeUninit, ptr}; // Defined in machine/cpu.h. // https://github.com/openbsd/src/blob/72ccc03bd11da614f31f7ff76e3f6fce99bc1c79/sys/arch/arm64/include/cpu.h#L25-L40 diff --git a/library/std_detect/src/detect/os/x86.rs b/library/std_detect/src/detect/os/x86.rs index 8565c2f85e24..20f848ab05ca 100644 --- a/library/std_detect/src/detect/os/x86.rs +++ b/library/std_detect/src/detect/os/x86.rs @@ -4,7 +4,6 @@ use core::arch::x86::*; #[cfg(target_arch = "x86_64")] use core::arch::x86_64::*; - use core::mem; use crate::detect::{Feature, bit, cache}; @@ -42,12 +41,7 @@ pub(crate) fn detect_features() -> cache::Initializer { // 0x8000_0000]. - The vendor ID is stored in 12 u8 ascii chars, // returned in EBX, EDX, and ECX (in that order): let (max_basic_leaf, vendor_id) = unsafe { - let CpuidResult { - eax: max_basic_leaf, - ebx, - ecx, - edx, - } = __cpuid(0); + let CpuidResult { eax: max_basic_leaf, ebx, ecx, edx } = __cpuid(0); let vendor_id: [[u8; 4]; 3] = [ebx.to_ne_bytes(), edx.to_ne_bytes(), ecx.to_ne_bytes()]; let vendor_id: [u8; 12] = mem::transmute(vendor_id); (max_basic_leaf, vendor_id) @@ -60,11 +54,8 @@ pub(crate) fn detect_features() -> cache::Initializer { // EAX = 1, ECX = 0: Queries "Processor Info and Feature Bits"; // Contains information about most x86 features. - let CpuidResult { - ecx: proc_info_ecx, - edx: proc_info_edx, - .. - } = unsafe { __cpuid(0x0000_0001_u32) }; + let CpuidResult { ecx: proc_info_ecx, edx: proc_info_edx, .. } = + unsafe { __cpuid(0x0000_0001_u32) }; // EAX = 7: Queries "Extended Features"; // Contains information about bmi,bmi2, and avx2 support. @@ -76,11 +67,8 @@ pub(crate) fn detect_features() -> cache::Initializer { extended_features_edx_leaf_1, ) = if max_basic_leaf >= 7 { let CpuidResult { ebx, ecx, edx, .. } = unsafe { __cpuid(0x0000_0007_u32) }; - let CpuidResult { - eax: eax_1, - edx: edx_1, - .. - } = unsafe { __cpuid_count(0x0000_0007_u32, 0x0000_0001_u32) }; + let CpuidResult { eax: eax_1, edx: edx_1, .. } = + unsafe { __cpuid_count(0x0000_0007_u32, 0x0000_0001_u32) }; (ebx, ecx, edx, eax_1, edx_1) } else { (0, 0, 0, 0, 0) // CPUID does not support "Extended Features" @@ -89,10 +77,7 @@ pub(crate) fn detect_features() -> cache::Initializer { // EAX = 0x8000_0000, ECX = 0: Get Highest Extended Function Supported // - EAX returns the max leaf value for extended information, that is, // `cpuid` calls in range [0x8000_0000; u32::MAX]: - let CpuidResult { - eax: extended_max_basic_leaf, - .. - } = unsafe { __cpuid(0x8000_0000_u32) }; + let CpuidResult { eax: extended_max_basic_leaf, .. } = unsafe { __cpuid(0x8000_0000_u32) }; // EAX = 0x8000_0001, ECX=0: Queries "Extended Processor Info and Feature // Bits" @@ -208,10 +193,8 @@ pub(crate) fn detect_features() -> cache::Initializer { // Processor Extended State Enumeration Sub-leaf (EAX = 0DH, // ECX = 1): if max_basic_leaf >= 0xd { - let CpuidResult { - eax: proc_extended_state1_eax, - .. - } = unsafe { __cpuid_count(0xd_u32, 1) }; + let CpuidResult { eax: proc_extended_state1_eax, .. } = + unsafe { __cpuid_count(0xd_u32, 1) }; enable(proc_extended_state1_eax, 0, Feature::xsaveopt); enable(proc_extended_state1_eax, 1, Feature::xsavec); enable(proc_extended_state1_eax, 3, Feature::xsaves); @@ -269,10 +252,8 @@ pub(crate) fn detect_features() -> cache::Initializer { enable(extended_features_edx_leaf_1, 8, Feature::amx_complex); if max_basic_leaf >= 0x1e { - let CpuidResult { - eax: amx_feature_flags_eax, - .. - } = unsafe { __cpuid_count(0x1e_u32, 1) }; + let CpuidResult { eax: amx_feature_flags_eax, .. } = + unsafe { __cpuid_count(0x1e_u32, 1) }; enable(amx_feature_flags_eax, 4, Feature::amx_fp8); enable(amx_feature_flags_eax, 5, Feature::amx_transpose); diff --git a/library/std_detect/tests/cpu-detection.rs b/library/std_detect/tests/cpu-detection.rs index 7976aedc7585..09a73572c1fd 100644 --- a/library/std_detect/tests/cpu-detection.rs +++ b/library/std_detect/tests/cpu-detection.rs @@ -59,10 +59,7 @@ fn arm_linux() { } #[test] -#[cfg(all( - target_arch = "aarch64", - any(target_os = "linux", target_os = "android") -))] +#[cfg(all(target_arch = "aarch64", any(target_os = "linux", target_os = "android")))] fn aarch64_linux() { println!("asimd: {}", is_aarch64_feature_detected!("asimd")); println!("neon: {}", is_aarch64_feature_detected!("neon")); @@ -97,10 +94,7 @@ fn aarch64_linux() { println!("sve2-aes: {}", is_aarch64_feature_detected!("sve2-aes")); println!("sve2-sm4: {}", is_aarch64_feature_detected!("sve2-sm4")); println!("sve2-sha3: {}", is_aarch64_feature_detected!("sve2-sha3")); - println!( - "sve2-bitperm: {}", - is_aarch64_feature_detected!("sve2-bitperm") - ); + println!("sve2-bitperm: {}", is_aarch64_feature_detected!("sve2-bitperm")); println!("frintts: {}", is_aarch64_feature_detected!("frintts")); println!("i8mm: {}", is_aarch64_feature_detected!("i8mm")); println!("f32mm: {}", is_aarch64_feature_detected!("f32mm")); @@ -138,25 +132,13 @@ fn aarch64_linux() { println!("sme-lutv2: {}", is_aarch64_feature_detected!("sme-lutv2")); println!("sme-f8f16: {}", is_aarch64_feature_detected!("sme-f8f16")); println!("sme-f8f32: {}", is_aarch64_feature_detected!("sme-f8f32")); - println!( - "ssve-fp8fma: {}", - is_aarch64_feature_detected!("ssve-fp8fma") - ); - println!( - "ssve-fp8dot4: {}", - is_aarch64_feature_detected!("ssve-fp8dot4") - ); - println!( - "ssve-fp8dot2: {}", - is_aarch64_feature_detected!("ssve-fp8dot2") - ); + println!("ssve-fp8fma: {}", is_aarch64_feature_detected!("ssve-fp8fma")); + println!("ssve-fp8dot4: {}", is_aarch64_feature_detected!("ssve-fp8dot4")); + println!("ssve-fp8dot2: {}", is_aarch64_feature_detected!("ssve-fp8dot2")); } #[test] -#[cfg(all( - any(target_arch = "aarch64", target_arch = "arm64ec"), - target_os = "windows" -))] +#[cfg(all(any(target_arch = "aarch64", target_arch = "arm64ec"), target_os = "windows"))] fn aarch64_windows() { println!("asimd: {:?}", is_aarch64_feature_detected!("asimd")); println!("fp: {:?}", is_aarch64_feature_detected!("fp")); @@ -171,10 +153,7 @@ fn aarch64_windows() { } #[test] -#[cfg(all( - target_arch = "aarch64", - any(target_os = "freebsd", target_os = "openbsd") -))] +#[cfg(all(target_arch = "aarch64", any(target_os = "freebsd", target_os = "openbsd")))] fn aarch64_bsd() { println!("asimd: {:?}", is_aarch64_feature_detected!("asimd")); println!("pmull: {:?}", is_aarch64_feature_detected!("pmull")); @@ -236,14 +215,8 @@ fn riscv_linux() { println!("rv32e: {}", is_riscv_feature_detected!("rv32e")); println!("rv64i: {}", is_riscv_feature_detected!("rv64i")); println!("rv128i: {}", is_riscv_feature_detected!("rv128i")); - println!( - "unaligned-scalar-mem: {}", - is_riscv_feature_detected!("unaligned-scalar-mem") - ); - println!( - "unaligned-vector-mem: {}", - is_riscv_feature_detected!("unaligned-vector-mem") - ); + println!("unaligned-scalar-mem: {}", is_riscv_feature_detected!("unaligned-scalar-mem")); + println!("unaligned-vector-mem: {}", is_riscv_feature_detected!("unaligned-vector-mem")); println!("zicsr: {}", is_riscv_feature_detected!("zicsr")); println!("zicntr: {}", is_riscv_feature_detected!("zicntr")); println!("zihpm: {}", is_riscv_feature_detected!("zihpm")); @@ -336,10 +309,7 @@ fn powerpc_linux() { } #[test] -#[cfg(all( - target_arch = "powerpc64", - any(target_os = "linux", target_os = "freebsd"), -))] +#[cfg(all(target_arch = "powerpc64", any(target_os = "linux", target_os = "freebsd"),))] fn powerpc64_linux_or_freebsd() { println!("altivec: {}", is_powerpc64_feature_detected!("altivec")); println!("vsx: {}", is_powerpc64_feature_detected!("vsx")); diff --git a/library/std_detect/tests/x86-specific.rs b/library/std_detect/tests/x86-specific.rs index d9ec79821baf..2ed2bb2a99ec 100644 --- a/library/std_detect/tests/x86-specific.rs +++ b/library/std_detect/tests/x86-specific.rs @@ -1,11 +1,6 @@ #![cfg(any(target_arch = "x86", target_arch = "x86_64"))] #![allow(internal_features)] -#![feature( - stdarch_internal, - x86_amx_intrinsics, - xop_target_feature, - movrs_target_feature -)] +#![feature(stdarch_internal, x86_amx_intrinsics, xop_target_feature, movrs_target_feature)] #[macro_use] extern crate std_detect; @@ -40,24 +35,15 @@ fn dump() { println!("avx512vl: {:?}", is_x86_feature_detected!("avx512vl")); println!("avx512_ifma: {:?}", is_x86_feature_detected!("avx512ifma")); println!("avx512vbmi {:?}", is_x86_feature_detected!("avx512vbmi")); - println!( - "avx512_vpopcntdq: {:?}", - is_x86_feature_detected!("avx512vpopcntdq") - ); + println!("avx512_vpopcntdq: {:?}", is_x86_feature_detected!("avx512vpopcntdq")); println!("avx512vbmi2: {:?}", is_x86_feature_detected!("avx512vbmi2")); println!("gfni: {:?}", is_x86_feature_detected!("gfni")); println!("vaes: {:?}", is_x86_feature_detected!("vaes")); println!("vpclmulqdq: {:?}", is_x86_feature_detected!("vpclmulqdq")); println!("avx512vnni: {:?}", is_x86_feature_detected!("avx512vnni")); - println!( - "avx512bitalg: {:?}", - is_x86_feature_detected!("avx512bitalg") - ); + println!("avx512bitalg: {:?}", is_x86_feature_detected!("avx512bitalg")); println!("avx512bf16: {:?}", is_x86_feature_detected!("avx512bf16")); - println!( - "avx512vp2intersect: {:?}", - is_x86_feature_detected!("avx512vp2intersect") - ); + println!("avx512vp2intersect: {:?}", is_x86_feature_detected!("avx512vp2intersect")); println!("avx512fp16: {:?}", is_x86_feature_detected!("avx512fp16")); println!("fma: {:?}", is_x86_feature_detected!("fma")); println!("abm: {:?}", is_x86_feature_detected!("abm")); @@ -77,15 +63,9 @@ fn dump() { println!("movbe: {:?}", is_x86_feature_detected!("movbe")); println!("avxvnni: {:?}", is_x86_feature_detected!("avxvnni")); println!("avxvnniint8: {:?}", is_x86_feature_detected!("avxvnniint8")); - println!( - "avxneconvert: {:?}", - is_x86_feature_detected!("avxneconvert") - ); + println!("avxneconvert: {:?}", is_x86_feature_detected!("avxneconvert")); println!("avxifma: {:?}", is_x86_feature_detected!("avxifma")); - println!( - "avxvnniint16: {:?}", - is_x86_feature_detected!("avxvnniint16") - ); + println!("avxvnniint16: {:?}", is_x86_feature_detected!("avxvnniint16")); println!("amx-bf16: {:?}", is_x86_feature_detected!("amx-bf16")); println!("amx-tile: {:?}", is_x86_feature_detected!("amx-tile")); println!("amx-int8: {:?}", is_x86_feature_detected!("amx-int8")); @@ -96,10 +76,7 @@ fn dump() { println!("widekl: {:?}", is_x86_feature_detected!("widekl")); println!("movrs: {:?}", is_x86_feature_detected!("movrs")); println!("amx-fp8: {:?}", is_x86_feature_detected!("amx-fp8")); - println!( - "amx-transpose: {:?}", - is_x86_feature_detected!("amx-transpose") - ); + println!("amx-transpose: {:?}", is_x86_feature_detected!("amx-transpose")); println!("amx-tf32: {:?}", is_x86_feature_detected!("amx-tf32")); println!("amx-avx512: {:?}", is_x86_feature_detected!("amx-avx512")); println!("amx-movrs: {:?}", is_x86_feature_detected!("amx-movrs")); @@ -110,8 +87,5 @@ fn dump() { fn x86_deprecated() { println!("avx512gfni {:?}", is_x86_feature_detected!("avx512gfni")); println!("avx512vaes {:?}", is_x86_feature_detected!("avx512vaes")); - println!( - "avx512vpclmulqdq {:?}", - is_x86_feature_detected!("avx512vpclmulqdq") - ); + println!("avx512vpclmulqdq {:?}", is_x86_feature_detected!("avx512vpclmulqdq")); } From 8dc2abb5c3a8de5982dd979ddaf722b4b6cc40fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Fri, 4 Jul 2025 10:15:38 +0200 Subject: [PATCH 106/139] Update stdarch README --- library/stdarch/README.md | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/library/stdarch/README.md b/library/stdarch/README.md index 9a35f4cd6ff5..50905b49e80d 100644 --- a/library/stdarch/README.md +++ b/library/stdarch/README.md @@ -4,16 +4,8 @@ stdarch - Rust's standard library SIMD components [![Actions Status](https://github.com/rust-lang/stdarch/workflows/CI/badge.svg)](https://github.com/rust-lang/stdarch/actions) -# Crates - -This repository contains two main crates: - -* [`core_arch`](crates/core_arch/README.md) implements `core::arch` - Rust's - core library architecture-specific intrinsics, and +This repository contains the [`core_arch`](crates/core_arch/README.md) crate, which implements `core::arch` - Rust's core library architecture-specific intrinsics. -* [`std_detect`](crates/std_detect/README.md) implements `std::detect` - Rust's - standard library run-time CPU feature detection. - The `std::simd` component now lives in the [`packed_simd_2`](https://github.com/rust-lang/packed_simd) crate. From e07a1bbb79fc3fb400ac4a2f25bb37cd8a0c245b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Fri, 4 Jul 2025 10:23:36 +0200 Subject: [PATCH 107/139] Move tests around to appease `tidy` --- library/std_detect/src/detect/macros.rs | 2 +- .../std_detect/src/detect/os/linux/aarch64.rs | 82 +------------ .../src/detect/os/linux/aarch64/tests.rs | 77 ++++++++++++ .../std_detect/src/detect/os/linux/auxvec.rs | 114 +----------------- .../src/detect/os/linux/auxvec/tests.rs | 111 +++++++++++++++++ library/std_detect/src/detect/os/riscv.rs | 67 +--------- .../std_detect/src/detect/os/riscv/tests.rs | 64 ++++++++++ src/tools/tidy/src/unit_tests.rs | 3 +- 8 files changed, 258 insertions(+), 262 deletions(-) create mode 100644 library/std_detect/src/detect/os/linux/aarch64/tests.rs create mode 100644 library/std_detect/src/detect/os/linux/auxvec/tests.rs create mode 100644 library/std_detect/src/detect/os/riscv/tests.rs diff --git a/library/std_detect/src/detect/macros.rs b/library/std_detect/src/detect/macros.rs index a2994fb7daa7..c2a006d3753a 100644 --- a/library/std_detect/src/detect/macros.rs +++ b/library/std_detect/src/detect/macros.rs @@ -131,7 +131,7 @@ macro_rules! features { }; } - #[test] + #[test] //tidy:skip #[deny(unexpected_cfgs)] #[deny(unfulfilled_lint_expectations)] fn unexpected_cfgs() { diff --git a/library/std_detect/src/detect/os/linux/aarch64.rs b/library/std_detect/src/detect/os/linux/aarch64.rs index 0de4beeae8b3..87a9d6ebb887 100644 --- a/library/std_detect/src/detect/os/linux/aarch64.rs +++ b/library/std_detect/src/detect/os/linux/aarch64.rs @@ -395,84 +395,4 @@ impl AtHwcap { #[cfg(target_endian = "little")] #[cfg(test)] -mod tests { - use super::*; - - #[cfg(feature = "std_detect_file_io")] - mod auxv_from_file { - use super::auxvec::auxv_from_file; - use super::*; - // The baseline hwcaps used in the (artificial) auxv test files. - fn baseline_hwcaps() -> AtHwcap { - AtHwcap { - fp: true, - asimd: true, - aes: true, - pmull: true, - sha1: true, - sha2: true, - crc32: true, - atomics: true, - fphp: true, - asimdhp: true, - asimdrdm: true, - lrcpc: true, - dcpop: true, - asimddp: true, - ssbs: true, - ..AtHwcap::default() - } - } - - #[test] - fn linux_empty_hwcap2_aarch64() { - let file = concat!( - env!("CARGO_MANIFEST_DIR"), - "/src/detect/test_data/linux-empty-hwcap2-aarch64.auxv" - ); - println!("file: {file}"); - let v = auxv_from_file(file).unwrap(); - println!("HWCAP : 0x{:0x}", v.hwcap); - println!("HWCAP2: 0x{:0x}", v.hwcap2); - assert_eq!(AtHwcap::from(v), baseline_hwcaps()); - } - #[test] - fn linux_no_hwcap2_aarch64() { - let file = concat!( - env!("CARGO_MANIFEST_DIR"), - "/src/detect/test_data/linux-no-hwcap2-aarch64.auxv" - ); - println!("file: {file}"); - let v = auxv_from_file(file).unwrap(); - println!("HWCAP : 0x{:0x}", v.hwcap); - println!("HWCAP2: 0x{:0x}", v.hwcap2); - assert_eq!(AtHwcap::from(v), baseline_hwcaps()); - } - #[test] - fn linux_hwcap2_aarch64() { - let file = concat!( - env!("CARGO_MANIFEST_DIR"), - "/src/detect/test_data/linux-hwcap2-aarch64.auxv" - ); - println!("file: {file}"); - let v = auxv_from_file(file).unwrap(); - println!("HWCAP : 0x{:0x}", v.hwcap); - println!("HWCAP2: 0x{:0x}", v.hwcap2); - assert_eq!( - AtHwcap::from(v), - AtHwcap { - // Some other HWCAP bits. - paca: true, - pacg: true, - // HWCAP2-only bits. - dcpodp: true, - frint: true, - rng: true, - bti: true, - mte: true, - ..baseline_hwcaps() - } - ); - } - } -} +mod tests; diff --git a/library/std_detect/src/detect/os/linux/aarch64/tests.rs b/library/std_detect/src/detect/os/linux/aarch64/tests.rs new file mode 100644 index 000000000000..a3562f2fd936 --- /dev/null +++ b/library/std_detect/src/detect/os/linux/aarch64/tests.rs @@ -0,0 +1,77 @@ +use super::*; + +#[cfg(feature = "std_detect_file_io")] +mod auxv_from_file { + use super::auxvec::auxv_from_file; + use super::*; + // The baseline hwcaps used in the (artificial) auxv test files. + fn baseline_hwcaps() -> AtHwcap { + AtHwcap { + fp: true, + asimd: true, + aes: true, + pmull: true, + sha1: true, + sha2: true, + crc32: true, + atomics: true, + fphp: true, + asimdhp: true, + asimdrdm: true, + lrcpc: true, + dcpop: true, + asimddp: true, + ssbs: true, + ..AtHwcap::default() + } + } + + #[test] + fn linux_empty_hwcap2_aarch64() { + let file = concat!( + env!("CARGO_MANIFEST_DIR"), + "/src/detect/test_data/linux-empty-hwcap2-aarch64.auxv" + ); + println!("file: {file}"); + let v = auxv_from_file(file).unwrap(); + println!("HWCAP : 0x{:0x}", v.hwcap); + println!("HWCAP2: 0x{:0x}", v.hwcap2); + assert_eq!(AtHwcap::from(v), baseline_hwcaps()); + } + #[test] + fn linux_no_hwcap2_aarch64() { + let file = concat!( + env!("CARGO_MANIFEST_DIR"), + "/src/detect/test_data/linux-no-hwcap2-aarch64.auxv" + ); + println!("file: {file}"); + let v = auxv_from_file(file).unwrap(); + println!("HWCAP : 0x{:0x}", v.hwcap); + println!("HWCAP2: 0x{:0x}", v.hwcap2); + assert_eq!(AtHwcap::from(v), baseline_hwcaps()); + } + #[test] + fn linux_hwcap2_aarch64() { + let file = + concat!(env!("CARGO_MANIFEST_DIR"), "/src/detect/test_data/linux-hwcap2-aarch64.auxv"); + println!("file: {file}"); + let v = auxv_from_file(file).unwrap(); + println!("HWCAP : 0x{:0x}", v.hwcap); + println!("HWCAP2: 0x{:0x}", v.hwcap2); + assert_eq!( + AtHwcap::from(v), + AtHwcap { + // Some other HWCAP bits. + paca: true, + pacg: true, + // HWCAP2-only bits. + dcpodp: true, + frint: true, + rng: true, + bti: true, + mte: true, + ..baseline_hwcaps() + } + ); + } +} diff --git a/library/std_detect/src/detect/os/linux/auxvec.rs b/library/std_detect/src/detect/os/linux/auxvec.rs index 54f52aa75330..1ed395f45b9e 100644 --- a/library/std_detect/src/detect/os/linux/auxvec.rs +++ b/library/std_detect/src/detect/os/linux/auxvec.rs @@ -226,116 +226,4 @@ fn auxv_from_buf(buf: &[usize]) -> Result { } #[cfg(test)] -mod tests { - use super::*; - - // FIXME: on mips/mips64 getauxval returns 0, and /proc/self/auxv - // does not always contain the AT_HWCAP key under qemu. - #[cfg(any( - target_arch = "arm", - target_arch = "powerpc", - target_arch = "powerpc64", - target_arch = "s390x", - ))] - #[test] - fn auxv_crate() { - let v = auxv(); - if let Ok(hwcap) = getauxval(AT_HWCAP) { - let rt_hwcap = v.expect("failed to find hwcap key").hwcap; - assert_eq!(rt_hwcap, hwcap); - } - - // Targets with AT_HWCAP and AT_HWCAP2: - #[cfg(any( - target_arch = "aarch64", - target_arch = "arm", - target_arch = "powerpc", - target_arch = "powerpc64", - target_arch = "s390x", - ))] - { - if let Ok(hwcap2) = getauxval(AT_HWCAP2) { - let rt_hwcap2 = v.expect("failed to find hwcap2 key").hwcap2; - assert_eq!(rt_hwcap2, hwcap2); - } - } - } - - #[test] - fn auxv_dump() { - if let Ok(auxvec) = auxv() { - println!("{:?}", auxvec); - } else { - println!("both getauxval() and reading /proc/self/auxv failed!"); - } - } - - #[cfg(feature = "std_detect_file_io")] - cfg_if::cfg_if! { - if #[cfg(target_arch = "arm")] { - #[test] - fn linux_rpi3() { - let file = concat!(env!("CARGO_MANIFEST_DIR"), "/src/detect/test_data/linux-rpi3.auxv"); - println!("file: {file}"); - let v = auxv_from_file(file).unwrap(); - assert_eq!(v.hwcap, 4174038); - assert_eq!(v.hwcap2, 16); - } - - #[test] - fn linux_macos_vb() { - let file = concat!(env!("CARGO_MANIFEST_DIR"), "/src/detect/test_data/macos-virtualbox-linux-x86-4850HQ.auxv"); - println!("file: {file}"); - // The file contains HWCAP but not HWCAP2. In that case, we treat HWCAP2 as zero. - let v = auxv_from_file(file).unwrap(); - assert_eq!(v.hwcap, 126614527); - assert_eq!(v.hwcap2, 0); - } - } else if #[cfg(target_arch = "aarch64")] { - #[cfg(target_endian = "little")] - #[test] - fn linux_artificial_aarch64() { - let file = concat!(env!("CARGO_MANIFEST_DIR"), "/src/detect/test_data/linux-artificial-aarch64.auxv"); - println!("file: {file}"); - let v = auxv_from_file(file).unwrap(); - assert_eq!(v.hwcap, 0x0123456789abcdef); - assert_eq!(v.hwcap2, 0x02468ace13579bdf); - } - #[cfg(target_endian = "little")] - #[test] - fn linux_no_hwcap2_aarch64() { - let file = concat!(env!("CARGO_MANIFEST_DIR"), "/src/detect/test_data/linux-no-hwcap2-aarch64.auxv"); - println!("file: {file}"); - let v = auxv_from_file(file).unwrap(); - // An absent HWCAP2 is treated as zero, and does not prevent acceptance of HWCAP. - assert_ne!(v.hwcap, 0); - assert_eq!(v.hwcap2, 0); - } - } - } - - #[test] - #[cfg(feature = "std_detect_file_io")] - fn auxv_dump_procfs() { - if let Ok(auxvec) = auxv_from_file("/proc/self/auxv") { - println!("{:?}", auxvec); - } else { - println!("reading /proc/self/auxv failed!"); - } - } - - #[cfg(any( - target_arch = "aarch64", - target_arch = "arm", - target_arch = "powerpc", - target_arch = "powerpc64", - target_arch = "s390x", - ))] - #[test] - #[cfg(feature = "std_detect_file_io")] - fn auxv_crate_procfs() { - if let Ok(procfs_auxv) = auxv_from_file("/proc/self/auxv") { - assert_eq!(auxv().unwrap(), procfs_auxv); - } - } -} +mod tests; diff --git a/library/std_detect/src/detect/os/linux/auxvec/tests.rs b/library/std_detect/src/detect/os/linux/auxvec/tests.rs new file mode 100644 index 000000000000..c0e0ae12a05f --- /dev/null +++ b/library/std_detect/src/detect/os/linux/auxvec/tests.rs @@ -0,0 +1,111 @@ +use super::*; + +// FIXME: on mips/mips64 getauxval returns 0, and /proc/self/auxv +// does not always contain the AT_HWCAP key under qemu. +#[cfg(any( + target_arch = "arm", + target_arch = "powerpc", + target_arch = "powerpc64", + target_arch = "s390x", +))] +#[test] +fn auxv_crate() { + let v = auxv(); + if let Ok(hwcap) = getauxval(AT_HWCAP) { + let rt_hwcap = v.expect("failed to find hwcap key").hwcap; + assert_eq!(rt_hwcap, hwcap); + } + + // Targets with AT_HWCAP and AT_HWCAP2: + #[cfg(any( + target_arch = "aarch64", + target_arch = "arm", + target_arch = "powerpc", + target_arch = "powerpc64", + target_arch = "s390x", + ))] + { + if let Ok(hwcap2) = getauxval(AT_HWCAP2) { + let rt_hwcap2 = v.expect("failed to find hwcap2 key").hwcap2; + assert_eq!(rt_hwcap2, hwcap2); + } + } +} + +#[test] +fn auxv_dump() { + if let Ok(auxvec) = auxv() { + println!("{:?}", auxvec); + } else { + println!("both getauxval() and reading /proc/self/auxv failed!"); + } +} + +#[cfg(feature = "std_detect_file_io")] +cfg_if::cfg_if! { + if #[cfg(target_arch = "arm")] { + #[test] + fn linux_rpi3() { + let file = concat!(env!("CARGO_MANIFEST_DIR"), "/src/detect/test_data/linux-rpi3.auxv"); + println!("file: {file}"); + let v = auxv_from_file(file).unwrap(); + assert_eq!(v.hwcap, 4174038); + assert_eq!(v.hwcap2, 16); + } + + #[test] + fn linux_macos_vb() { + let file = concat!(env!("CARGO_MANIFEST_DIR"), "/src/detect/test_data/macos-virtualbox-linux-x86-4850HQ.auxv"); + println!("file: {file}"); + // The file contains HWCAP but not HWCAP2. In that case, we treat HWCAP2 as zero. + let v = auxv_from_file(file).unwrap(); + assert_eq!(v.hwcap, 126614527); + assert_eq!(v.hwcap2, 0); + } + } else if #[cfg(target_arch = "aarch64")] { + #[cfg(target_endian = "little")] + #[test] + fn linux_artificial_aarch64() { + let file = concat!(env!("CARGO_MANIFEST_DIR"), "/src/detect/test_data/linux-artificial-aarch64.auxv"); + println!("file: {file}"); + let v = auxv_from_file(file).unwrap(); + assert_eq!(v.hwcap, 0x0123456789abcdef); + assert_eq!(v.hwcap2, 0x02468ace13579bdf); + } + #[cfg(target_endian = "little")] + #[test] + fn linux_no_hwcap2_aarch64() { + let file = concat!(env!("CARGO_MANIFEST_DIR"), "/src/detect/test_data/linux-no-hwcap2-aarch64.auxv"); + println!("file: {file}"); + let v = auxv_from_file(file).unwrap(); + // An absent HWCAP2 is treated as zero, and does not prevent acceptance of HWCAP. + assert_ne!(v.hwcap, 0); + assert_eq!(v.hwcap2, 0); + } + } +} + +#[test] +#[cfg(feature = "std_detect_file_io")] +fn auxv_dump_procfs() { + if let Ok(auxvec) = auxv_from_file("/proc/self/auxv") { + println!("{:?}", auxvec); + } else { + println!("reading /proc/self/auxv failed!"); + } +} + +#[cfg(any( + target_arch = "aarch64", + target_arch = "arm", + target_arch = "powerpc", + target_arch = "powerpc64", + target_arch = "s390x", +))] +#[test] +#[cfg(feature = "std_detect_file_io")] +fn auxv_crate_procfs() { + if let Ok(procfs_auxv) = auxv_from_file("/proc/self/auxv") { + assert_eq!(auxv().unwrap(), procfs_auxv); + } +} diff --git a/library/std_detect/src/detect/os/riscv.rs b/library/std_detect/src/detect/os/riscv.rs index 4c59ede80293..46b7dd71eb35 100644 --- a/library/std_detect/src/detect/os/riscv.rs +++ b/library/std_detect/src/detect/os/riscv.rs @@ -135,69 +135,4 @@ pub(crate) fn imply_features(mut value: cache::Initializer) -> cache::Initialize } #[cfg(test)] -mod tests { - use super::*; - - #[test] - fn simple_direct() { - let mut value = cache::Initializer::default(); - value.set(Feature::f as u32); - // F (and other extensions with CSRs) -> Zicsr - assert!(imply_features(value).test(Feature::zicsr as u32)); - } - - #[test] - fn simple_indirect() { - let mut value = cache::Initializer::default(); - value.set(Feature::q as u32); - // Q -> D, D -> F, F -> Zicsr - assert!(imply_features(value).test(Feature::zicsr as u32)); - } - - #[test] - fn complex_zcd() { - let mut value = cache::Initializer::default(); - // C & D -> Zcd - value.set(Feature::c as u32); - assert!(!imply_features(value).test(Feature::zcd as u32)); - value.set(Feature::d as u32); - assert!(imply_features(value).test(Feature::zcd as u32)); - } - - #[test] - fn group_simple_forward() { - let mut value = cache::Initializer::default(); - // A -> Zalrsc & Zaamo (forward implication) - value.set(Feature::a as u32); - let value = imply_features(value); - assert!(value.test(Feature::zalrsc as u32)); - assert!(value.test(Feature::zaamo as u32)); - } - - #[test] - fn group_simple_backward() { - let mut value = cache::Initializer::default(); - // Zalrsc & Zaamo -> A (reverse implication) - value.set(Feature::zalrsc as u32); - value.set(Feature::zaamo as u32); - assert!(imply_features(value).test(Feature::a as u32)); - } - - #[test] - fn group_complex_convergence() { - let mut value = cache::Initializer::default(); - // Needs 3 iterations to converge - // (and 4th iteration for convergence checking): - // 1. [Zvksc] -> Zvks & Zvbc - // 2. Zvks -> Zvksed & Zvksh & Zvkb & Zvkt - // 3a. [Zvkned] & [Zvknhb] & [Zvkb] & Zvkt -> {Zvkn} - // 3b. Zvkn & Zvbc -> {Zvknc} - value.set(Feature::zvksc as u32); - value.set(Feature::zvkned as u32); - value.set(Feature::zvknhb as u32); - value.set(Feature::zvkb as u32); - let value = imply_features(value); - assert!(value.test(Feature::zvkn as u32)); - assert!(value.test(Feature::zvknc as u32)); - } -} +mod tests; diff --git a/library/std_detect/src/detect/os/riscv/tests.rs b/library/std_detect/src/detect/os/riscv/tests.rs new file mode 100644 index 000000000000..99a81dee05a6 --- /dev/null +++ b/library/std_detect/src/detect/os/riscv/tests.rs @@ -0,0 +1,64 @@ +use super::*; + +#[test] +fn simple_direct() { + let mut value = cache::Initializer::default(); + value.set(Feature::f as u32); + // F (and other extensions with CSRs) -> Zicsr + assert!(imply_features(value).test(Feature::zicsr as u32)); +} + +#[test] +fn simple_indirect() { + let mut value = cache::Initializer::default(); + value.set(Feature::q as u32); + // Q -> D, D -> F, F -> Zicsr + assert!(imply_features(value).test(Feature::zicsr as u32)); +} + +#[test] +fn complex_zcd() { + let mut value = cache::Initializer::default(); + // C & D -> Zcd + value.set(Feature::c as u32); + assert!(!imply_features(value).test(Feature::zcd as u32)); + value.set(Feature::d as u32); + assert!(imply_features(value).test(Feature::zcd as u32)); +} + +#[test] +fn group_simple_forward() { + let mut value = cache::Initializer::default(); + // A -> Zalrsc & Zaamo (forward implication) + value.set(Feature::a as u32); + let value = imply_features(value); + assert!(value.test(Feature::zalrsc as u32)); + assert!(value.test(Feature::zaamo as u32)); +} + +#[test] +fn group_simple_backward() { + let mut value = cache::Initializer::default(); + // Zalrsc & Zaamo -> A (reverse implication) + value.set(Feature::zalrsc as u32); + value.set(Feature::zaamo as u32); + assert!(imply_features(value).test(Feature::a as u32)); +} + +#[test] +fn group_complex_convergence() { + let mut value = cache::Initializer::default(); + // Needs 3 iterations to converge + // (and 4th iteration for convergence checking): + // 1. [Zvksc] -> Zvks & Zvbc + // 2. Zvks -> Zvksed & Zvksh & Zvkb & Zvkt + // 3a. [Zvkned] & [Zvknhb] & [Zvkb] & Zvkt -> {Zvkn} + // 3b. Zvkn & Zvbc -> {Zvknc} + value.set(Feature::zvksc as u32); + value.set(Feature::zvkned as u32); + value.set(Feature::zvknhb as u32); + value.set(Feature::zvkb as u32); + let value = imply_features(value); + assert!(value.test(Feature::zvkn as u32)); + assert!(value.test(Feature::zvknc as u32)); +} diff --git a/src/tools/tidy/src/unit_tests.rs b/src/tools/tidy/src/unit_tests.rs index 90ef36d5882d..df9146b51474 100644 --- a/src/tools/tidy/src/unit_tests.rs +++ b/src/tools/tidy/src/unit_tests.rs @@ -56,7 +56,8 @@ pub fn check(root_path: &Path, bad: &mut bool) { let line = line.trim(); let is_test = || line.contains("#[test]") && !line.contains("`#[test]"); let is_bench = || line.contains("#[bench]") && !line.contains("`#[bench]"); - if !line.starts_with("//") && (is_test() || is_bench()) { + let manual_skip = line.contains("//tidy:skip"); + if !line.starts_with("//") && (is_test() || is_bench()) && !manual_skip { let explanation = if is_core { "`core` unit tests and benchmarks must be placed into `coretests`" } else if is_alloc { From ffa97a647e3786add894093aa2cc7561c7c64607 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Fri, 4 Jul 2025 15:25:28 +0200 Subject: [PATCH 108/139] Fix warning --- library/std_detect/tests/cpu-detection.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/library/std_detect/tests/cpu-detection.rs b/library/std_detect/tests/cpu-detection.rs index 09a73572c1fd..5ad32d83237c 100644 --- a/library/std_detect/tests/cpu-detection.rs +++ b/library/std_detect/tests/cpu-detection.rs @@ -27,6 +27,16 @@ ), macro_use )] +#[cfg(any( + target_arch = "arm", + target_arch = "aarch64", + target_arch = "arm64ec", + target_arch = "riscv32", + target_arch = "riscv64", + target_arch = "powerpc", + target_arch = "powerpc64", + target_arch = "s390x", +))] extern crate std_detect; #[test] From 608297247a776a32c4aca08f1784caca8a3c33e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Sun, 13 Jul 2025 13:08:17 +0200 Subject: [PATCH 109/139] Remove `std_detect` from stdarch examples --- library/stdarch/Cargo.lock | 23 ----------------------- library/stdarch/examples/Cargo.toml | 1 - library/stdarch/examples/connect5.rs | 16 ++++++++++++---- library/stdarch/examples/hex.rs | 8 ++++++-- 4 files changed, 18 insertions(+), 30 deletions(-) diff --git a/library/stdarch/Cargo.lock b/library/stdarch/Cargo.lock index 4806682e6e0a..21ce304db0d8 100644 --- a/library/stdarch/Cargo.lock +++ b/library/stdarch/Cargo.lock @@ -580,18 +580,6 @@ version = "0.1.25" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "989e6739f80c4ad5b13e0fd7fe89531180375b18520cc8c82080e4dc4035b84f" -[[package]] -name = "rustc-std-workspace-alloc" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9d441c3b2ebf55cebf796bfdc265d67fa09db17b7bb6bd4be75c509e1e8fec3" - -[[package]] -name = "rustc-std-workspace-core" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa9c45b374136f52f2d6311062c7146bff20fec063c3f5d46a410bd937746955" - [[package]] name = "ryu" version = "1.0.20" @@ -694,16 +682,6 @@ dependencies = [ "syn 2.0.104", ] -[[package]] -name = "std_detect" -version = "0.1.5" -dependencies = [ - "cfg-if", - "libc", - "rustc-std-workspace-alloc", - "rustc-std-workspace-core", -] - [[package]] name = "stdarch-gen-arm" version = "0.1.0" @@ -756,7 +734,6 @@ dependencies = [ "core_arch", "quickcheck", "rand", - "std_detect", ] [[package]] diff --git a/library/stdarch/examples/Cargo.toml b/library/stdarch/examples/Cargo.toml index 61184494e157..61451edee841 100644 --- a/library/stdarch/examples/Cargo.toml +++ b/library/stdarch/examples/Cargo.toml @@ -12,7 +12,6 @@ default-run = "hex" [dependencies] core_arch = { path = "../crates/core_arch" } -std_detect = { path = "../crates/std_detect" } quickcheck = "1.0" rand = "0.8" diff --git a/library/stdarch/examples/connect5.rs b/library/stdarch/examples/connect5.rs index 1d8e0f0990a6..371b28552b32 100644 --- a/library/stdarch/examples/connect5.rs +++ b/library/stdarch/examples/connect5.rs @@ -40,9 +40,13 @@ use std::cmp; use std::time::Instant; #[cfg(target_arch = "x86")] -use {core_arch::arch::x86::*, std_detect::is_x86_feature_detected}; +use core_arch::arch::x86::*; #[cfg(target_arch = "x86_64")] -use {core_arch::arch::x86_64::*, std_detect::is_x86_feature_detected}; +use core_arch::arch::x86_64::*; +#[cfg(target_arch = "x86")] +use std::is_x86_feature_detected; +#[cfg(target_arch = "x86_64")] +use std::is_x86_feature_detected; // types @@ -558,8 +562,12 @@ fn search(pos: &Pos, alpha: i32, beta: i32, depth: i32, _ply: i32) -> i32 { assert_ne!(bm, MOVE_NONE); assert!(bs >= -EVAL_INF && bs <= EVAL_INF); - // best move at the root node, best score elsewhere - if _ply == 0 { bm } else { bs } + //best move at the root node, best score elsewhere + if _ply == 0 { + bm + } else { + bs + } } /// Evaluation function: give different scores to different patterns after a fixed depth. diff --git a/library/stdarch/examples/hex.rs b/library/stdarch/examples/hex.rs index e393ad727168..95ffbaf666ce 100644 --- a/library/stdarch/examples/hex.rs +++ b/library/stdarch/examples/hex.rs @@ -36,9 +36,13 @@ use std::{ }; #[cfg(target_arch = "x86")] -use {core_arch::arch::x86::*, std_detect::is_x86_feature_detected}; +use core_arch::arch::x86::*; #[cfg(target_arch = "x86_64")] -use {core_arch::arch::x86_64::*, std_detect::is_x86_feature_detected}; +use core_arch::arch::x86_64::*; +#[cfg(target_arch = "x86")] +use std::is_x86_feature_detected; +#[cfg(target_arch = "x86_64")] +use std::is_x86_feature_detected; fn main() { let mut input = Vec::new(); From 847f8db5ad2d3b369ce97935dd770a15280ddf96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Sun, 13 Jul 2025 13:41:22 +0200 Subject: [PATCH 110/139] Remove `std_detect` from stdarch's CI --- library/stdarch/.github/workflows/main.yml | 13 +----- library/stdarch/ci/build-std-detect.sh | 46 ---------------------- library/stdarch/ci/dox.sh | 3 -- library/stdarch/ci/run-docker.sh | 1 - library/stdarch/ci/run.sh | 10 +---- 5 files changed, 2 insertions(+), 71 deletions(-) delete mode 100755 library/stdarch/ci/build-std-detect.sh diff --git a/library/stdarch/.github/workflows/main.yml b/library/stdarch/.github/workflows/main.yml index 59aad0b5d014..048ce9864604 100644 --- a/library/stdarch/.github/workflows/main.yml +++ b/library/stdarch/.github/workflows/main.yml @@ -258,7 +258,7 @@ jobs: # Check that the generated files agree with the checked-in versions. check-stdarch-gen: needs: [style] - name: Check stdarch-gen-{arm, loongarch} output + name: Check stdarch-gen-{arm, loongarch} output runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -277,22 +277,11 @@ jobs: cargo run --bin=stdarch-gen-loongarch --release -- crates/stdarch-gen-loongarch/lasx.spec git diff --exit-code - build-std-detect: - needs: [style] - name: Build std_detect - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Install Rust - run: rustup update nightly && rustup default nightly - - run: ./ci/build-std-detect.sh - conclusion: needs: - docs - verify - test - - build-std-detect - check-stdarch-gen runs-on: ubuntu-latest # We need to ensure this job does *not* get skipped if its dependencies fail, diff --git a/library/stdarch/ci/build-std-detect.sh b/library/stdarch/ci/build-std-detect.sh deleted file mode 100755 index e79a497cc359..000000000000 --- a/library/stdarch/ci/build-std-detect.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/env bash - -# Build std_detect on non-Linux & non-x86 targets. -# -# In std_detect, non-x86 targets have OS-specific implementations, -# but we can test only Linux in CI. This script builds targets supported -# by std_detect but cannot be tested in CI. - -set -ex -cd "$(dirname "$0")"/.. - -targets=( - # Linux - aarch64-unknown-linux-musl - armv5te-unknown-linux-musleabi - aarch64-unknown-linux-ohos - armv7-unknown-linux-ohos - - # Android - aarch64-linux-android - arm-linux-androideabi - - # FreeBSD - aarch64-unknown-freebsd - armv6-unknown-freebsd - powerpc-unknown-freebsd - powerpc64-unknown-freebsd - - # OpenBSD - aarch64-unknown-openbsd - - # Windows - aarch64-pc-windows-msvc -) - -rustup component add rust-src # for -Z build-std - -cd crates/std_detect -for target in "${targets[@]}"; do - if rustup target add "${target}" &>/dev/null; then - cargo build --target "${target}" - else - # tier 3 targets requires -Z build-std. - cargo build -Z build-std="core,alloc" --target "${target}" - fi -done diff --git a/library/stdarch/ci/dox.sh b/library/stdarch/ci/dox.sh index 910265fad84d..94d76d430472 100755 --- a/library/stdarch/ci/dox.sh +++ b/library/stdarch/ci/dox.sh @@ -16,10 +16,7 @@ dox() { cargo clean --target "${1}" cargo build --verbose --target "${1}" --manifest-path crates/core_arch/Cargo.toml - cargo build --verbose --target "${1}" --manifest-path crates/std_detect/Cargo.toml - cargo doc --verbose --target "${1}" --manifest-path crates/core_arch/Cargo.toml - cargo doc --verbose --target "${1}" --manifest-path crates/std_detect/Cargo.toml } if [ -z "$1" ]; then diff --git a/library/stdarch/ci/run-docker.sh b/library/stdarch/ci/run-docker.sh index 657353004dcb..d7aa50a8c96f 100755 --- a/library/stdarch/ci/run-docker.sh +++ b/library/stdarch/ci/run-docker.sh @@ -37,7 +37,6 @@ run() { --env NORUN \ --env RUSTFLAGS \ --env CARGO_UNSTABLE_BUILD_STD \ - --env RUST_STD_DETECT_UNSTABLE \ --volume "${HOME}/.cargo":/cargo \ --volume "$(rustc --print sysroot)":/rust:ro \ --volume "$(pwd)":/checkout:ro \ diff --git a/library/stdarch/ci/run.sh b/library/stdarch/ci/run.sh index 78a808b46a04..aa4479395d5b 100755 --- a/library/stdarch/ci/run.sh +++ b/library/stdarch/ci/run.sh @@ -78,20 +78,12 @@ cargo_test() { } CORE_ARCH="--manifest-path=crates/core_arch/Cargo.toml" -STD_DETECT="--manifest-path=crates/std_detect/Cargo.toml" STDARCH_EXAMPLES="--manifest-path=examples/Cargo.toml" INTRINSIC_TEST="--manifest-path=crates/intrinsic-test/Cargo.toml" cargo_test "${CORE_ARCH} ${PROFILE}" if [ "$NOSTD" != "1" ]; then - cargo_test "${STD_DETECT} ${PROFILE}" - - cargo_test "${STD_DETECT} --no-default-features" - cargo_test "${STD_DETECT} --no-default-features --features=std_detect_file_io" - cargo_test "${STD_DETECT} --no-default-features --features=std_detect_dlsym_getauxval" - cargo_test "${STD_DETECT} --no-default-features --features=std_detect_dlsym_getauxval,std_detect_file_io" - cargo_test "${STDARCH_EXAMPLES} ${PROFILE}" fi @@ -139,7 +131,7 @@ case ${TARGET} in cargo_test "${PROFILE}" ;; - # Setup aarch64 & armv7 specific variables, the runner, along with some + # Setup aarch64 & armv7 specific variables, the runner, along with some # tests to skip aarch64-unknown-linux-gnu*) TEST_CPPFLAGS="-fuse-ld=lld -I/usr/aarch64-linux-gnu/include/ -I/usr/aarch64-linux-gnu/include/c++/9/aarch64-linux-gnu/" From cbd9fe012acad68ce8ea2cb90b23589cd2bb0c31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Sun, 13 Jul 2025 14:37:28 +0200 Subject: [PATCH 111/139] Bless bootstrap tests --- src/bootstrap/src/core/builder/tests.rs | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/bootstrap/src/core/builder/tests.rs b/src/bootstrap/src/core/builder/tests.rs index 105d4229e75e..6ea5d4e65532 100644 --- a/src/bootstrap/src/core/builder/tests.rs +++ b/src/bootstrap/src/core/builder/tests.rs @@ -999,7 +999,7 @@ mod snapshot { [build] llvm [build] rustc 0 -> rustc 1 [build] rustdoc 0 - [doc] std 1 crates=[alloc,compiler_builtins,core,panic_abort,panic_unwind,proc_macro,std,sysroot,test,unwind] + [doc] std 1 crates=[alloc,compiler_builtins,core,panic_abort,panic_unwind,proc_macro,std,std_detect,sysroot,test,unwind] "); } @@ -1048,7 +1048,7 @@ mod snapshot { [build] rustc 1 -> std 1 [build] rustc 1 -> rustc 2 [build] rustdoc 1 - [doc] std 2 crates=[alloc,compiler_builtins,core,panic_abort,panic_unwind,proc_macro,std,sysroot,test,unwind] + [doc] std 2 crates=[alloc,compiler_builtins,core,panic_abort,panic_unwind,proc_macro,std,std_detect,sysroot,test,unwind] [build] rustc 2 -> std 2 [build] rustc 0 -> LintDocs 1 [build] rustc 0 -> RustInstaller 1 @@ -1090,7 +1090,7 @@ mod snapshot { [build] rustc 1 -> WasmComponentLd 2 [build] rustc 1 -> LlvmBitcodeLinker 2 [build] rustdoc 1 - [doc] std 2 crates=[alloc,compiler_builtins,core,panic_abort,panic_unwind,proc_macro,std,sysroot,test,unwind] + [doc] std 2 crates=[alloc,compiler_builtins,core,panic_abort,panic_unwind,proc_macro,std,std_detect,sysroot,test,unwind] [build] rustc 2 -> std 2 [build] rustc 0 -> LintDocs 1 [build] rustc 0 -> RustInstaller 1 @@ -1126,8 +1126,8 @@ mod snapshot { [build] rustc 1 -> std 1 [build] rustc 1 -> rustc 2 [build] rustdoc 1 - [doc] std 2 crates=[alloc,compiler_builtins,core,panic_abort,panic_unwind,proc_macro,std,sysroot,test,unwind] - [doc] std 2 crates=[alloc,compiler_builtins,core,panic_abort,panic_unwind,proc_macro,std,sysroot,test,unwind] + [doc] std 2 crates=[alloc,compiler_builtins,core,panic_abort,panic_unwind,proc_macro,std,std_detect,sysroot,test,unwind] + [doc] std 2 crates=[alloc,compiler_builtins,core,panic_abort,panic_unwind,proc_macro,std,std_detect,sysroot,test,unwind] [build] rustc 2 -> std 2 [build] rustc 0 -> LintDocs 1 [build] rustc 0 -> RustInstaller 1 @@ -1163,7 +1163,7 @@ mod snapshot { [build] rustc 1 -> std 1 [build] rustc 1 -> rustc 2 [build] rustdoc 1 - [doc] std 2 crates=[alloc,compiler_builtins,core,panic_abort,panic_unwind,proc_macro,std,sysroot,test,unwind] + [doc] std 2 crates=[alloc,compiler_builtins,core,panic_abort,panic_unwind,proc_macro,std,std_detect,sysroot,test,unwind] [build] rustc 2 -> std 2 [build] rustc 0 -> LintDocs 1 [build] rustc 1 -> std 1 @@ -1200,8 +1200,8 @@ mod snapshot { [build] rustc 1 -> std 1 [build] rustc 1 -> rustc 2 [build] rustdoc 1 - [doc] std 2 crates=[alloc,compiler_builtins,core,panic_abort,panic_unwind,proc_macro,std,sysroot,test,unwind] - [doc] std 2 crates=[alloc,compiler_builtins,core,panic_abort,panic_unwind,proc_macro,std,sysroot,test,unwind] + [doc] std 2 crates=[alloc,compiler_builtins,core,panic_abort,panic_unwind,proc_macro,std,std_detect,sysroot,test,unwind] + [doc] std 2 crates=[alloc,compiler_builtins,core,panic_abort,panic_unwind,proc_macro,std,std_detect,sysroot,test,unwind] [build] rustc 2 -> std 2 [build] rustc 0 -> LintDocs 1 [build] rustc 1 -> std 1 @@ -1242,7 +1242,7 @@ mod snapshot { [build] rustc 1 -> std 1 [build] rustc 1 -> rustc 2 [build] rustdoc 1 - [doc] std 2 crates=[alloc,compiler_builtins,core,panic_abort,panic_unwind,proc_macro,std,sysroot,test,unwind] + [doc] std 2 crates=[alloc,compiler_builtins,core,panic_abort,panic_unwind,proc_macro,std,std_detect,sysroot,test,unwind] [build] rustc 2 -> std 2 [build] rustc 0 -> RustInstaller 1 [dist] docs @@ -1274,7 +1274,7 @@ mod snapshot { [build] rustc 1 -> rustc 2 [build] rustc 1 -> WasmComponentLd 2 [build] rustdoc 1 - [doc] std 2 crates=[alloc,compiler_builtins,core,panic_abort,panic_unwind,proc_macro,std,sysroot,test,unwind] + [doc] std 2 crates=[alloc,compiler_builtins,core,panic_abort,panic_unwind,proc_macro,std,std_detect,sysroot,test,unwind] [build] rustc 2 -> std 2 [build] rustc 1 -> std 1 [build] rustc 2 -> std 2 @@ -1620,7 +1620,7 @@ mod snapshot { [build] llvm [build] rustc 0 -> rustc 1 [build] rustdoc 0 - [doc] std 1 crates=[alloc,compiler_builtins,core,panic_abort,panic_unwind,proc_macro,std,sysroot,test,unwind] + [doc] std 1 crates=[alloc,compiler_builtins,core,panic_abort,panic_unwind,proc_macro,std,std_detect,sysroot,test,unwind] "); } From 5e52677a82c6c146469561c97ca4c63a75242102 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Mon, 14 Jul 2025 21:57:08 +0200 Subject: [PATCH 112/139] Remove licenses from std-detect They are subsumed by the main repo licenses. --- library/std_detect/LICENSE-APACHE | 201 ------------------------------ library/std_detect/LICENSE-MIT | 25 ---- 2 files changed, 226 deletions(-) delete mode 100644 library/std_detect/LICENSE-APACHE delete mode 100644 library/std_detect/LICENSE-MIT diff --git a/library/std_detect/LICENSE-APACHE b/library/std_detect/LICENSE-APACHE deleted file mode 100644 index 16fe87b06e80..000000000000 --- a/library/std_detect/LICENSE-APACHE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - -2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - -3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - -4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - -5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - -6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - -8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS - -APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - -Copyright [yyyy] [name of copyright owner] - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. diff --git a/library/std_detect/LICENSE-MIT b/library/std_detect/LICENSE-MIT deleted file mode 100644 index 52d82415d8b6..000000000000 --- a/library/std_detect/LICENSE-MIT +++ /dev/null @@ -1,25 +0,0 @@ -Copyright (c) 2017 The Rust Project Developers - -Permission is hereby granted, free of charge, to any -person obtaining a copy of this software and associated -documentation files (the "Software"), to deal in the -Software without restriction, including without -limitation the rights to use, copy, modify, merge, -publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software -is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice -shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF -ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED -TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT -SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR -IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. From 81d90d8257e59bc27acd6ec98f3cce3d27de6755 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Fri, 18 Jul 2025 08:49:28 +0200 Subject: [PATCH 113/139] Improve error messages of auxv loading --- .../std_detect/src/detect/os/linux/auxvec.rs | 17 +++++++++++------ library/std_detect/src/detect/os/linux/mod.rs | 10 ++++++---- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/library/std_detect/src/detect/os/linux/auxvec.rs b/library/std_detect/src/detect/os/linux/auxvec.rs index 1ed395f45b9e..443caaaa1863 100644 --- a/library/std_detect/src/detect/os/linux/auxvec.rs +++ b/library/std_detect/src/detect/os/linux/auxvec.rs @@ -119,7 +119,7 @@ pub(crate) fn auxv() -> Result { { // If calling getauxval fails, try to read the auxiliary vector from // its file: - auxv_from_file("/proc/self/auxv") + auxv_from_file("/proc/self/auxv").map_err(|_| ()) } #[cfg(not(feature = "std_detect_file_io"))] { @@ -157,17 +157,22 @@ fn getauxval(key: usize) -> Result { /// Tries to read the auxiliary vector from the `file`. If this fails, this /// function returns `Err`. #[cfg(feature = "std_detect_file_io")] -pub(super) fn auxv_from_file(file: &str) -> Result { +pub(super) fn auxv_from_file(file: &str) -> Result { let file = super::read_file(file)?; + auxv_from_file_bytes(&file) +} +/// Read auxiliary vector from a slice of bytes. +#[cfg(feature = "std_detect_file_io")] +pub(super) fn auxv_from_file_bytes(bytes: &[u8]) -> Result { // See . // // The auxiliary vector contains at most 34 (key,value) fields: from // `AT_MINSIGSTKSZ` to `AT_NULL`, but its number may increase. - let len = file.len(); + let len = bytes.len(); let mut buf = alloc::vec![0_usize; 1 + len / core::mem::size_of::()]; unsafe { - core::ptr::copy_nonoverlapping(file.as_ptr(), buf.as_mut_ptr() as *mut u8, len); + core::ptr::copy_nonoverlapping(bytes.as_ptr(), buf.as_mut_ptr() as *mut u8, len); } auxv_from_buf(&buf) @@ -176,7 +181,7 @@ pub(super) fn auxv_from_file(file: &str) -> Result { /// Tries to interpret the `buffer` as an auxiliary vector. If that fails, this /// function returns `Err`. #[cfg(feature = "std_detect_file_io")] -fn auxv_from_buf(buf: &[usize]) -> Result { +fn auxv_from_buf(buf: &[usize]) -> Result { // Targets with only AT_HWCAP: #[cfg(any( target_arch = "riscv32", @@ -222,7 +227,7 @@ fn auxv_from_buf(buf: &[usize]) -> Result { } // Suppress unused variable let _ = buf; - Err(()) + Err(alloc::string::String::from("hwcap not found")) } #[cfg(test)] diff --git a/library/std_detect/src/detect/os/linux/mod.rs b/library/std_detect/src/detect/os/linux/mod.rs index 9accd41717b9..5ae2aaeab5b8 100644 --- a/library/std_detect/src/detect/os/linux/mod.rs +++ b/library/std_detect/src/detect/os/linux/mod.rs @@ -6,14 +6,16 @@ use alloc::vec::Vec; mod auxvec; #[cfg(feature = "std_detect_file_io")] -fn read_file(path: &str) -> Result, ()> { - let mut path = Vec::from(path.as_bytes()); +fn read_file(orig_path: &str) -> Result, alloc::string::String> { + use alloc::format; + + let mut path = Vec::from(orig_path.as_bytes()); path.push(0); unsafe { let file = libc::open(path.as_ptr() as *const libc::c_char, libc::O_RDONLY); if file == -1 { - return Err(()); + return Err(format!("Cannot open file at {orig_path}")); } let mut data = Vec::new(); @@ -23,7 +25,7 @@ fn read_file(path: &str) -> Result, ()> { match libc::read(file, spare.as_mut_ptr() as *mut _, spare.len()) { -1 => { libc::close(file); - return Err(()); + return Err(format!("Error while reading from file at {orig_path}")); } 0 => break, n => data.set_len(data.len() + n as usize), From 9a1179c4de485759d8d8f3bf978e26fc4e86af64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Fri, 18 Jul 2025 08:49:59 +0200 Subject: [PATCH 114/139] Embed auxv files directly into the test binary --- .../src/detect/os/linux/auxvec/tests.rs | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/library/std_detect/src/detect/os/linux/auxvec/tests.rs b/library/std_detect/src/detect/os/linux/auxvec/tests.rs index c0e0ae12a05f..536615fa2725 100644 --- a/library/std_detect/src/detect/os/linux/auxvec/tests.rs +++ b/library/std_detect/src/detect/os/linux/auxvec/tests.rs @@ -44,21 +44,21 @@ fn auxv_dump() { #[cfg(feature = "std_detect_file_io")] cfg_if::cfg_if! { if #[cfg(target_arch = "arm")] { + // The tests below can be executed under qemu, where we do not have access to the test + // files on disk, so we need to embed them with `include_bytes!`. #[test] fn linux_rpi3() { - let file = concat!(env!("CARGO_MANIFEST_DIR"), "/src/detect/test_data/linux-rpi3.auxv"); - println!("file: {file}"); - let v = auxv_from_file(file).unwrap(); + let auxv = include_bytes!(concat!(env!("CARGO_MANIFEST_DIR"), "/src/detect/test_data/linux-rpi3.auxv")); + let v = auxv_from_file_bytes(auxv).unwrap(); assert_eq!(v.hwcap, 4174038); assert_eq!(v.hwcap2, 16); } #[test] fn linux_macos_vb() { - let file = concat!(env!("CARGO_MANIFEST_DIR"), "/src/detect/test_data/macos-virtualbox-linux-x86-4850HQ.auxv"); - println!("file: {file}"); + let auxv = include_bytes!(concat!(env!("CARGO_MANIFEST_DIR"), "/src/detect/test_data/macos-virtualbox-linux-x86-4850HQ.auxv")); // The file contains HWCAP but not HWCAP2. In that case, we treat HWCAP2 as zero. - let v = auxv_from_file(file).unwrap(); + let v = auxv_from_file_bytes(auxv).unwrap(); assert_eq!(v.hwcap, 126614527); assert_eq!(v.hwcap2, 0); } @@ -66,18 +66,16 @@ cfg_if::cfg_if! { #[cfg(target_endian = "little")] #[test] fn linux_artificial_aarch64() { - let file = concat!(env!("CARGO_MANIFEST_DIR"), "/src/detect/test_data/linux-artificial-aarch64.auxv"); - println!("file: {file}"); - let v = auxv_from_file(file).unwrap(); + let auxv = include_bytes!(concat!(env!("CARGO_MANIFEST_DIR"), "/src/detect/test_data/linux-artificial-aarch64.auxv")); + let v = auxv_from_file_bytes(auxv).unwrap(); assert_eq!(v.hwcap, 0x0123456789abcdef); assert_eq!(v.hwcap2, 0x02468ace13579bdf); } #[cfg(target_endian = "little")] #[test] fn linux_no_hwcap2_aarch64() { - let file = concat!(env!("CARGO_MANIFEST_DIR"), "/src/detect/test_data/linux-no-hwcap2-aarch64.auxv"); - println!("file: {file}"); - let v = auxv_from_file(file).unwrap(); + let auxv = include_bytes!(concat!(env!("CARGO_MANIFEST_DIR"), "/src/detect/test_data/linux-no-hwcap2-aarch64.auxv")); + let v = auxv_from_file_bytes(auxv).unwrap(); // An absent HWCAP2 is treated as zero, and does not prevent acceptance of HWCAP. assert_ne!(v.hwcap, 0); assert_eq!(v.hwcap2, 0); From 9e75032a9dc06d8286aebcb4ed00ad5d81bbf0e9 Mon Sep 17 00:00:00 2001 From: binarycat Date: Tue, 22 Jul 2025 13:38:08 -0500 Subject: [PATCH 115/139] rustdoc: avoid allocating a temp String for aliases in search index --- src/librustdoc/html/render/search_index.rs | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/librustdoc/html/render/search_index.rs b/src/librustdoc/html/render/search_index.rs index 3c9be29ccc35..e2f86b8a8549 100644 --- a/src/librustdoc/html/render/search_index.rs +++ b/src/librustdoc/html/render/search_index.rs @@ -100,9 +100,22 @@ pub(crate) fn build_index( let crate_doc = short_markdown_summary(&krate.module.doc_value(), &krate.module.link_names(cache)); + #[derive(Eq, Ord, PartialEq, PartialOrd)] + struct SerSymbolAsStr(Symbol); + + impl Serialize for SerSymbolAsStr { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + self.0.as_str().serialize(serializer) + } + } + + type AliasMap = BTreeMap>; // Aliases added through `#[doc(alias = "...")]`. Since a few items can have the same alias, // we need the alias element to have an array of items. - let mut aliases: BTreeMap> = BTreeMap::new(); + let mut aliases: AliasMap = BTreeMap::new(); // Sort search index items. This improves the compressibility of the search index. cache.search_index.sort_unstable_by(|k1, k2| { @@ -116,7 +129,7 @@ pub(crate) fn build_index( // Set up alias indexes. for (i, item) in cache.search_index.iter().enumerate() { for alias in &item.aliases[..] { - aliases.entry(alias.to_string()).or_default().push(i); + aliases.entry(SerSymbolAsStr(*alias)).or_default().push(i); } } @@ -474,7 +487,7 @@ pub(crate) fn build_index( // The String is alias name and the vec is the list of the elements with this alias. // // To be noted: the `usize` elements are indexes to `items`. - aliases: &'a BTreeMap>, + aliases: &'a AliasMap, // Used when a type has more than one impl with an associated item with the same name. associated_item_disambiguators: &'a Vec<(usize, String)>, // A list of shard lengths encoded as vlqhex. See the comment in write_vlqhex_to_string From 3440bc92f90366a9f65ec2b86e3e1b5fe3922aa6 Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Thu, 3 Jul 2025 13:30:59 +0000 Subject: [PATCH 116/139] Unquerify extern_mod_stmt_cnum. --- compiler/rustc_middle/src/query/mod.rs | 3 --- compiler/rustc_middle/src/ty/context.rs | 7 +++++-- compiler/rustc_passes/src/check_attr.rs | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/compiler/rustc_middle/src/query/mod.rs b/compiler/rustc_middle/src/query/mod.rs index ad7f4973e235..a80b323f4aea 100644 --- a/compiler/rustc_middle/src/query/mod.rs +++ b/compiler/rustc_middle/src/query/mod.rs @@ -2152,9 +2152,6 @@ rustc_queries! { desc { |tcx| "collecting child items of module `{}`", tcx.def_path_str(def_id) } separate_provide_extern } - query extern_mod_stmt_cnum(def_id: LocalDefId) -> Option { - desc { |tcx| "computing crate imported by `{}`", tcx.def_path_str(def_id) } - } /// Gets the number of definitions in a foreign crate. /// diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs index 51db92ecd78f..aa1e753538c3 100644 --- a/compiler/rustc_middle/src/ty/context.rs +++ b/compiler/rustc_middle/src/ty/context.rs @@ -3373,6 +3373,11 @@ impl<'tcx> TyCtxt<'tcx> { self.resolutions(()).module_children.get(&def_id).map_or(&[], |v| &v[..]) } + /// Return the crate imported by given use item. + pub fn extern_mod_stmt_cnum(self, def_id: LocalDefId) -> Option { + self.resolutions(()).extern_crate_map.get(&def_id).copied() + } + pub fn resolver_for_lowering(self) -> &'tcx Steal<(ty::ResolverAstLowering, Arc)> { self.resolver_for_lowering_raw(()).0 } @@ -3428,8 +3433,6 @@ pub struct DeducedParamAttrs { } pub fn provide(providers: &mut Providers) { - providers.extern_mod_stmt_cnum = - |tcx, id| tcx.resolutions(()).extern_crate_map.get(&id).cloned(); providers.is_panic_runtime = |tcx, LocalCrate| contains_name(tcx.hir_krate_attrs(), sym::panic_runtime); providers.is_compiler_builtins = diff --git a/compiler/rustc_passes/src/check_attr.rs b/compiler/rustc_passes/src/check_attr.rs index 96c895e71dfe..22092521fd8d 100644 --- a/compiler/rustc_passes/src/check_attr.rs +++ b/compiler/rustc_passes/src/check_attr.rs @@ -1255,7 +1255,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> { return; } - if self.tcx.extern_mod_stmt_cnum(hir_id.owner).is_none() { + if self.tcx.extern_mod_stmt_cnum(hir_id.owner.def_id).is_none() { self.tcx.emit_node_span_lint( INVALID_DOC_ATTRIBUTES, hir_id, From 95de0aaed3a01d6c3f09931ba9d2a5b1ac492a19 Mon Sep 17 00:00:00 2001 From: binarycat Date: Tue, 22 Jul 2025 18:36:09 -0500 Subject: [PATCH 117/139] rustc_resolve: get rid of unused rustdoc::span_of_fragments_with_expansion This function can cause false negatives if used incorrectly (usually "do any of the doc fragments come from a macro" is the wrong question to ask), and thus it is unused. --- compiler/rustc_resolve/src/rustdoc.rs | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/compiler/rustc_resolve/src/rustdoc.rs b/compiler/rustc_resolve/src/rustdoc.rs index 24e15ded94fe..6450f63472ca 100644 --- a/compiler/rustc_resolve/src/rustdoc.rs +++ b/compiler/rustc_resolve/src/rustdoc.rs @@ -509,9 +509,8 @@ fn collect_link_data<'input, F: BrokenLinkCallback<'input>>( display_text.map(String::into_boxed_str) } -/// Returns a tuple containing a span encompassing all the document fragments and a boolean that is -/// `true` if any of the fragments are from a macro expansion. -pub fn span_of_fragments_with_expansion(fragments: &[DocFragment]) -> Option<(Span, bool)> { +/// Returns a span encompassing all the document fragments. +pub fn span_of_fragments(fragments: &[DocFragment]) -> Option { let (first_fragment, last_fragment) = match fragments { [] => return None, [first, .., last] => (first, last), @@ -520,15 +519,7 @@ pub fn span_of_fragments_with_expansion(fragments: &[DocFragment]) -> Option<(Sp if first_fragment.span == DUMMY_SP { return None; } - Some(( - first_fragment.span.to(last_fragment.span), - fragments.iter().any(|frag| frag.from_expansion), - )) -} - -/// Returns a span encompassing all the document fragments. -pub fn span_of_fragments(fragments: &[DocFragment]) -> Option { - span_of_fragments_with_expansion(fragments).map(|(sp, _)| sp) + Some(first_fragment.span.to(last_fragment.span)) } /// Attempts to match a range of bytes from parsed markdown to a `Span` in the source code. @@ -686,7 +677,7 @@ pub fn source_span_for_markdown_range_inner( } } - let (span, _) = span_of_fragments_with_expansion(fragments)?; + let span = span_of_fragments(fragments)?; let src_span = span.from_inner(InnerSpan::new( md_range.start + start_bytes, md_range.end + start_bytes + end_bytes, From 9bb9c39fa5c5f5ea38c5173aa7c23c290a9cac88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Le=C3=B3n=20Orell=20Valerian=20Liehr?= Date: Wed, 23 Jul 2025 01:48:54 +0200 Subject: [PATCH 118/139] Don't suggest assoc ty bound on non-angle-bracketed problematic assoc ty binding --- .../src/hir_ty_lowering/lint.rs | 19 ++++++++++++++++--- .../suggest-assoc-ty-bound-on-eq-bound.rs | 9 ++++++++- .../suggest-assoc-ty-bound-on-eq-bound.stderr | 13 ++++++++++++- 3 files changed, 36 insertions(+), 5 deletions(-) diff --git a/compiler/rustc_hir_analysis/src/hir_ty_lowering/lint.rs b/compiler/rustc_hir_analysis/src/hir_ty_lowering/lint.rs index 9abae33ffdbb..646ff3ca08d2 100644 --- a/compiler/rustc_hir_analysis/src/hir_ty_lowering/lint.rs +++ b/compiler/rustc_hir_analysis/src/hir_ty_lowering/lint.rs @@ -447,17 +447,30 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ { fn maybe_suggest_assoc_ty_bound(&self, self_ty: &hir::Ty<'_>, diag: &mut Diag<'_>) { let mut parents = self.tcx().hir_parent_iter(self_ty.hir_id); - if let Some((_, hir::Node::AssocItemConstraint(constraint))) = parents.next() + if let Some((c_hir_id, hir::Node::AssocItemConstraint(constraint))) = parents.next() && let Some(obj_ty) = constraint.ty() + && let Some((_, hir::Node::TraitRef(trait_ref))) = parents.next() { - if let Some((_, hir::Node::TraitRef(..))) = parents.next() - && let Some((_, hir::Node::Ty(ty))) = parents.next() + if let Some((_, hir::Node::Ty(ty))) = parents.next() && let hir::TyKind::TraitObject(..) = ty.kind { // Assoc ty bounds aren't permitted inside trait object types. return; } + if trait_ref + .path + .segments + .iter() + .find_map(|seg| { + seg.args.filter(|args| args.constraints.iter().any(|c| c.hir_id == c_hir_id)) + }) + .is_none_or(|args| args.parenthesized != hir::GenericArgsParentheses::No) + { + // Only consider angle-bracketed args (where we have a `=` to replace with `:`). + return; + } + let lo = if constraint.gen_args.span_ext.is_dummy() { constraint.ident.span } else { diff --git a/tests/ui/associated-type-bounds/suggest-assoc-ty-bound-on-eq-bound.rs b/tests/ui/associated-type-bounds/suggest-assoc-ty-bound-on-eq-bound.rs index c8bb0ebd5744..49e46f44cb2f 100644 --- a/tests/ui/associated-type-bounds/suggest-assoc-ty-bound-on-eq-bound.rs +++ b/tests/ui/associated-type-bounds/suggest-assoc-ty-bound-on-eq-bound.rs @@ -1,4 +1,4 @@ -// Regression test for issue #105056. +// issue: //@ edition: 2021 fn f(_: impl Trait) {} @@ -23,4 +23,11 @@ type Obj = dyn Trait; trait Trait { type T; } +// Don't suggest assoc ty bounds when we have parenthesized args (the underlying assoc type +// binding `Output` isn't introduced by `=` but by `->`, suggesting `:` wouldn't be valid). +// issue: +fn i(_: impl Fn() -> std::fmt::Debug) {} +//~^ ERROR expected a type, found a trait +//~| HELP you can add the `dyn` keyword if you want a trait object + fn main() {} diff --git a/tests/ui/associated-type-bounds/suggest-assoc-ty-bound-on-eq-bound.stderr b/tests/ui/associated-type-bounds/suggest-assoc-ty-bound-on-eq-bound.stderr index 6eb8fabb1852..ea9f25f07194 100644 --- a/tests/ui/associated-type-bounds/suggest-assoc-ty-bound-on-eq-bound.stderr +++ b/tests/ui/associated-type-bounds/suggest-assoc-ty-bound-on-eq-bound.stderr @@ -57,6 +57,17 @@ help: you can add the `dyn` keyword if you want a trait object LL | type Obj = dyn Trait; | +++ -error: aborting due to 4 previous errors +error[E0782]: expected a type, found a trait + --> $DIR/suggest-assoc-ty-bound-on-eq-bound.rs:29:22 + | +LL | fn i(_: impl Fn() -> std::fmt::Debug) {} + | ^^^^^^^^^^^^^^^ + | +help: you can add the `dyn` keyword if you want a trait object + | +LL | fn i(_: impl Fn() -> dyn std::fmt::Debug) {} + | +++ + +error: aborting due to 5 previous errors For more information about this error, try `rustc --explain E0782`. From eb9c65476c9dbcf90d67e938218731f58e6c699a Mon Sep 17 00:00:00 2001 From: Ayush Singh Date: Sat, 12 Jul 2025 18:47:19 +0530 Subject: [PATCH 119/139] std: net: uefi: Add support to query connection data - Use EFI_TCP4_GET_MODE_DATA to be able to query for ttl, nodelay, peer_addr and socket_addr. - peer_addr is needed for implementation of `accept`. Signed-off-by: Ayush Singh --- .../std/src/sys/net/connection/uefi/mod.rs | 32 +++++++------- .../std/src/sys/net/connection/uefi/tcp.rs | 42 +++++++++++++++++++ .../std/src/sys/net/connection/uefi/tcp4.rs | 18 ++++++++ library/std/src/sys/pal/uefi/helpers.rs | 4 ++ 4 files changed, 81 insertions(+), 15 deletions(-) diff --git a/library/std/src/sys/net/connection/uefi/mod.rs b/library/std/src/sys/net/connection/uefi/mod.rs index 884cbd4ac1dc..16e3487a1747 100644 --- a/library/std/src/sys/net/connection/uefi/mod.rs +++ b/library/std/src/sys/net/connection/uefi/mod.rs @@ -86,11 +86,11 @@ impl TcpStream { } pub fn peer_addr(&self) -> io::Result { - unsupported() + self.inner.peer_addr() } pub fn socket_addr(&self) -> io::Result { - unsupported() + self.inner.socket_addr() } pub fn shutdown(&self, _: Shutdown) -> io::Result<()> { @@ -114,7 +114,7 @@ impl TcpStream { } pub fn nodelay(&self) -> io::Result { - unsupported() + self.inner.nodelay() } pub fn set_ttl(&self, _: u32) -> io::Result<()> { @@ -122,7 +122,7 @@ impl TcpStream { } pub fn ttl(&self) -> io::Result { - unsupported() + self.inner.ttl() } pub fn take_error(&self) -> io::Result> { @@ -140,7 +140,9 @@ impl fmt::Debug for TcpStream { } } -pub struct TcpListener(!); +pub struct TcpListener { + inner: tcp::Tcp, +} impl TcpListener { pub fn bind(_: io::Result<&SocketAddr>) -> io::Result { @@ -148,45 +150,45 @@ impl TcpListener { } pub fn socket_addr(&self) -> io::Result { - self.0 + unsupported() } pub fn accept(&self) -> io::Result<(TcpStream, SocketAddr)> { - self.0 + unsupported() } pub fn duplicate(&self) -> io::Result { - self.0 + unsupported() } pub fn set_ttl(&self, _: u32) -> io::Result<()> { - self.0 + unsupported() } pub fn ttl(&self) -> io::Result { - self.0 + self.inner.ttl() } pub fn set_only_v6(&self, _: bool) -> io::Result<()> { - self.0 + unsupported() } pub fn only_v6(&self) -> io::Result { - self.0 + unsupported() } pub fn take_error(&self) -> io::Result> { - self.0 + unsupported() } pub fn set_nonblocking(&self, _: bool) -> io::Result<()> { - self.0 + unsupported() } } impl fmt::Debug for TcpListener { fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result { - self.0 + todo!() } } diff --git a/library/std/src/sys/net/connection/uefi/tcp.rs b/library/std/src/sys/net/connection/uefi/tcp.rs index 1152f69446e4..aac97007bbfe 100644 --- a/library/std/src/sys/net/connection/uefi/tcp.rs +++ b/library/std/src/sys/net/connection/uefi/tcp.rs @@ -1,6 +1,8 @@ use super::tcp4; use crate::io; use crate::net::SocketAddr; +use crate::ptr::NonNull; +use crate::sys::{helpers, unsupported}; use crate::time::Duration; pub(crate) enum Tcp { @@ -31,4 +33,44 @@ impl Tcp { Self::V4(client) => client.read(buf, timeout), } } + + pub(crate) fn ttl(&self) -> io::Result { + match self { + Self::V4(client) => client.get_mode_data().map(|x| x.time_to_live.into()), + } + } + + pub(crate) fn nodelay(&self) -> io::Result { + match self { + Self::V4(client) => { + let temp = client.get_mode_data()?; + match NonNull::new(temp.control_option) { + Some(x) => unsafe { Ok(x.as_ref().enable_nagle.into()) }, + None => unsupported(), + } + } + } + } + + pub fn peer_addr(&self) -> io::Result { + match self { + Self::V4(client) => client.get_mode_data().map(|x| { + SocketAddr::new( + helpers::ipv4_from_r_efi(x.access_point.remote_address).into(), + x.access_point.remote_port, + ) + }), + } + } + + pub fn socket_addr(&self) -> io::Result { + match self { + Self::V4(client) => client.get_mode_data().map(|x| { + SocketAddr::new( + helpers::ipv4_from_r_efi(x.access_point.station_address).into(), + x.access_point.station_port, + ) + }), + } + } } diff --git a/library/std/src/sys/net/connection/uefi/tcp4.rs b/library/std/src/sys/net/connection/uefi/tcp4.rs index 6342718929a7..75862ff247b4 100644 --- a/library/std/src/sys/net/connection/uefi/tcp4.rs +++ b/library/std/src/sys/net/connection/uefi/tcp4.rs @@ -67,6 +67,24 @@ impl Tcp4 { if r.is_error() { Err(crate::io::Error::from_raw_os_error(r.as_usize())) } else { Ok(()) } } + pub(crate) fn get_mode_data(&self) -> io::Result { + let mut config_data = tcp4::ConfigData::default(); + let protocol = self.protocol.as_ptr(); + + let r = unsafe { + ((*protocol).get_mode_data)( + protocol, + crate::ptr::null_mut(), + &mut config_data, + crate::ptr::null_mut(), + crate::ptr::null_mut(), + crate::ptr::null_mut(), + ) + }; + + if r.is_error() { Err(io::Error::from_raw_os_error(r.as_usize())) } else { Ok(config_data) } + } + pub(crate) fn connect(&self, timeout: Option) -> io::Result<()> { let evt = unsafe { self.create_evt() }?; let completion_token = diff --git a/library/std/src/sys/pal/uefi/helpers.rs b/library/std/src/sys/pal/uefi/helpers.rs index 420481648a7d..271dc4d11de7 100644 --- a/library/std/src/sys/pal/uefi/helpers.rs +++ b/library/std/src/sys/pal/uefi/helpers.rs @@ -761,3 +761,7 @@ impl Drop for OwnedEvent { pub(crate) const fn ipv4_to_r_efi(addr: crate::net::Ipv4Addr) -> efi::Ipv4Address { efi::Ipv4Address { addr: addr.octets() } } + +pub(crate) const fn ipv4_from_r_efi(ip: efi::Ipv4Address) -> crate::net::Ipv4Addr { + crate::net::Ipv4Addr::new(ip.addr[0], ip.addr[1], ip.addr[2], ip.addr[3]) +} From 01fdafc9aac788e96af33f8daada26809ea2bff7 Mon Sep 17 00:00:00 2001 From: Kornel Date: Tue, 22 Jul 2025 17:07:16 +0100 Subject: [PATCH 120/139] Hint that choose_pivot returns index in bounds --- library/core/src/slice/sort/select.rs | 3 +-- library/core/src/slice/sort/shared/pivot.rs | 10 ++++++++-- library/core/src/slice/sort/stable/quicksort.rs | 4 ---- library/core/src/slice/sort/unstable/quicksort.rs | 3 +-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/library/core/src/slice/sort/select.rs b/library/core/src/slice/sort/select.rs index 82194db7fd86..fc31013caf88 100644 --- a/library/core/src/slice/sort/select.rs +++ b/library/core/src/slice/sort/select.rs @@ -101,8 +101,7 @@ fn partition_at_index_loop<'a, T, F>( // slice. Partition the slice into elements equal to and elements greater than the pivot. // This case is usually hit when the slice contains many duplicate elements. if let Some(p) = ancestor_pivot { - // SAFETY: choose_pivot promises to return a valid pivot position. - let pivot = unsafe { v.get_unchecked(pivot_pos) }; + let pivot = &v[pivot_pos]; if !is_less(p, pivot) { let num_lt = partition(v, pivot_pos, &mut |a, b| !is_less(b, a)); diff --git a/library/core/src/slice/sort/shared/pivot.rs b/library/core/src/slice/sort/shared/pivot.rs index 3aace484b6a8..9eb60f854ce2 100644 --- a/library/core/src/slice/sort/shared/pivot.rs +++ b/library/core/src/slice/sort/shared/pivot.rs @@ -1,6 +1,6 @@ //! This module contains the logic for pivot selection. -use crate::intrinsics; +use crate::{hint, intrinsics}; // Recursively select a pseudomedian if above this threshold. const PSEUDO_MEDIAN_REC_THRESHOLD: usize = 64; @@ -9,6 +9,7 @@ const PSEUDO_MEDIAN_REC_THRESHOLD: usize = 64; /// /// This chooses a pivot by sampling an adaptive amount of points, approximating /// the quality of a median of sqrt(n) elements. +#[inline] pub fn choose_pivot bool>(v: &[T], is_less: &mut F) -> usize { // We use unsafe code and raw pointers here because we're dealing with // heavy recursion. Passing safe slices around would involve a lot of @@ -22,7 +23,7 @@ pub fn choose_pivot bool>(v: &[T], is_less: &mut F) -> us // SAFETY: a, b, c point to initialized regions of len_div_8 elements, // satisfying median3 and median3_rec's preconditions as v_base points // to an initialized region of n = len elements. - unsafe { + let index = unsafe { let v_base = v.as_ptr(); let len_div_8 = len / 8; @@ -35,6 +36,11 @@ pub fn choose_pivot bool>(v: &[T], is_less: &mut F) -> us } else { median3_rec(a, b, c, len_div_8, is_less).offset_from_unsigned(v_base) } + }; + // SAFETY: preconditions must have been met for offset_from_unsigned() + unsafe { + hint::assert_unchecked(index < v.len()); + index } } diff --git a/library/core/src/slice/sort/stable/quicksort.rs b/library/core/src/slice/sort/stable/quicksort.rs index 3c9688790c40..0439ba870bd2 100644 --- a/library/core/src/slice/sort/stable/quicksort.rs +++ b/library/core/src/slice/sort/stable/quicksort.rs @@ -37,10 +37,6 @@ pub fn quicksort bool>( limit -= 1; let pivot_pos = choose_pivot(v, is_less); - // SAFETY: choose_pivot promises to return a valid pivot index. - unsafe { - intrinsics::assume(pivot_pos < v.len()); - } // SAFETY: We only access the temporary copy for Freeze types, otherwise // self-modifications via `is_less` would not be observed and this would diff --git a/library/core/src/slice/sort/unstable/quicksort.rs b/library/core/src/slice/sort/unstable/quicksort.rs index 98efee242eba..bdf56a808030 100644 --- a/library/core/src/slice/sort/unstable/quicksort.rs +++ b/library/core/src/slice/sort/unstable/quicksort.rs @@ -48,8 +48,7 @@ pub(crate) fn quicksort<'a, T, F>( // slice. Partition the slice into elements equal to and elements greater than the pivot. // This case is usually hit when the slice contains many duplicate elements. if let Some(p) = ancestor_pivot { - // SAFETY: We assume choose_pivot yields an in-bounds position. - if !is_less(p, unsafe { v.get_unchecked(pivot_pos) }) { + if !is_less(p, &v[pivot_pos]) { let num_lt = partition(v, pivot_pos, &mut |a, b| !is_less(b, a)); // Continue sorting elements greater than the pivot. We know that `num_lt` contains From a460b46d0f7d95a0a07bad444606f6fd53aea62c Mon Sep 17 00:00:00 2001 From: Jonathan Brouwer Date: Sat, 12 Jul 2025 17:42:39 +0200 Subject: [PATCH 121/139] Ports `#[macro_use]` and `#[macro_escape]` to the new attribute parsing infrastructure --- .../src/attributes.rs | 19 +++ .../src/encode_cross_crate.rs | 2 + .../rustc_attr_data_structures/src/lib.rs | 4 +- .../src/attributes/macro_attrs.rs | 115 ++++++++++++++++++ .../rustc_attr_parsing/src/attributes/mod.rs | 1 + .../src/attributes/must_use.rs | 2 +- compiler/rustc_attr_parsing/src/context.rs | 14 +++ .../src/session_diagnostics.rs | 10 +- compiler/rustc_hir/src/hir.rs | 1 + compiler/rustc_parse/src/validate_attr.rs | 2 + compiler/rustc_passes/src/check_attr.rs | 17 ++- compiler/rustc_resolve/messages.ftl | 2 - .../rustc_resolve/src/build_reduced_graph.rs | 67 +++++----- compiler/rustc_resolve/src/errors.rs | 7 -- .../clippy/clippy_lints/src/macro_use.rs | 8 +- 15 files changed, 206 insertions(+), 65 deletions(-) create mode 100644 compiler/rustc_attr_parsing/src/attributes/macro_attrs.rs diff --git a/compiler/rustc_attr_data_structures/src/attributes.rs b/compiler/rustc_attr_data_structures/src/attributes.rs index 9f99b33adcc4..1e2576bef2c7 100644 --- a/compiler/rustc_attr_data_structures/src/attributes.rs +++ b/compiler/rustc_attr_data_structures/src/attributes.rs @@ -157,6 +157,19 @@ pub enum UsedBy { Linker, } +#[derive(Encodable, Decodable, Clone, Debug, PartialEq, Eq, Hash)] +#[derive(HashStable_Generic, PrintAttribute)] +pub enum MacroUseArgs { + UseAll, + UseSpecific(ThinVec), +} + +impl Default for MacroUseArgs { + fn default() -> Self { + Self::UseSpecific(ThinVec::new()) + } +} + #[derive(Debug, Clone, Encodable, Decodable, HashStable_Generic)] pub struct StrippedCfgItem { pub parent_module: ModId, @@ -351,9 +364,15 @@ pub enum AttributeKind { /// Represents `#[loop_match]`. LoopMatch(Span), + /// Represents `#[macro_escape]`. + MacroEscape(Span), + /// Represents `#[rustc_macro_transparency]`. MacroTransparency(Transparency), + /// Represents `#[macro_use]`. + MacroUse { span: Span, arguments: MacroUseArgs }, + /// Represents `#[marker]`. Marker(Span), diff --git a/compiler/rustc_attr_data_structures/src/encode_cross_crate.rs b/compiler/rustc_attr_data_structures/src/encode_cross_crate.rs index 86d9ddba4d23..159b807a3b2b 100644 --- a/compiler/rustc_attr_data_structures/src/encode_cross_crate.rs +++ b/compiler/rustc_attr_data_structures/src/encode_cross_crate.rs @@ -45,7 +45,9 @@ impl AttributeKind { LinkOrdinal { .. } => No, LinkSection { .. } => Yes, // Needed for rustdoc LoopMatch(..) => No, + MacroEscape(..) => No, MacroTransparency(..) => Yes, + MacroUse { .. } => No, Marker(..) => No, MayDangle(..) => No, MustUse { .. } => Yes, diff --git a/compiler/rustc_attr_data_structures/src/lib.rs b/compiler/rustc_attr_data_structures/src/lib.rs index ecca0e390638..4c5af805ca90 100644 --- a/compiler/rustc_attr_data_structures/src/lib.rs +++ b/compiler/rustc_attr_data_structures/src/lib.rs @@ -24,7 +24,7 @@ use rustc_ast::token::CommentKind; use rustc_ast::{AttrStyle, IntTy, UintTy}; use rustc_ast_pretty::pp::Printer; use rustc_span::hygiene::Transparency; -use rustc_span::{ErrorGuaranteed, Span, Symbol}; +use rustc_span::{ErrorGuaranteed, Ident, Span, Symbol}; pub use stability::*; use thin_vec::ThinVec; pub use version::*; @@ -172,7 +172,7 @@ macro_rules! print_tup { print_tup!(A B C D E F G H); print_skip!(Span, (), ErrorGuaranteed); print_disp!(u16, bool, NonZero); -print_debug!(Symbol, UintTy, IntTy, Align, AttrStyle, CommentKind, Transparency); +print_debug!(Symbol, Ident, UintTy, IntTy, Align, AttrStyle, CommentKind, Transparency); /// Finds attributes in sequences of attributes by pattern matching. /// diff --git a/compiler/rustc_attr_parsing/src/attributes/macro_attrs.rs b/compiler/rustc_attr_parsing/src/attributes/macro_attrs.rs new file mode 100644 index 000000000000..eade49180ace --- /dev/null +++ b/compiler/rustc_attr_parsing/src/attributes/macro_attrs.rs @@ -0,0 +1,115 @@ +use rustc_attr_data_structures::{AttributeKind, MacroUseArgs}; +use rustc_errors::DiagArgValue; +use rustc_feature::{AttributeTemplate, template}; +use rustc_span::{Span, Symbol, sym}; +use thin_vec::ThinVec; + +use crate::attributes::{AcceptMapping, AttributeParser, NoArgsAttributeParser, OnDuplicate}; +use crate::context::{AcceptContext, FinalizeContext, Stage}; +use crate::parser::ArgParser; +use crate::session_diagnostics; + +pub(crate) struct MacroEscapeParser; +impl NoArgsAttributeParser for MacroEscapeParser { + const PATH: &[Symbol] = &[sym::macro_escape]; + const ON_DUPLICATE: OnDuplicate = OnDuplicate::Warn; + const CREATE: fn(Span) -> AttributeKind = AttributeKind::MacroEscape; +} + +/// `#[macro_use]` attributes can either: +/// - Use all macros from a crate, if provided without arguments +/// - Use specific macros from a crate, if provided with arguments `#[macro_use(macro1, macro2)]` +/// A warning should be provided if an use all is combined with specific uses, or if multiple use-alls are used. +#[derive(Default)] +pub(crate) struct MacroUseParser { + state: MacroUseArgs, + + /// Spans of all `#[macro_use]` arguments with arguments, used for linting + uses_attr_spans: ThinVec, + /// If `state` is `UseSpecific`, stores the span of the first `#[macro_use]` argument, used as the span for this attribute + /// If `state` is `UseAll`, stores the span of the first `#[macro_use]` arguments without arguments + first_span: Option, +} + +const MACRO_USE_TEMPLATE: AttributeTemplate = template!(Word, List: "name1, name2, ..."); + +impl AttributeParser for MacroUseParser { + const ATTRIBUTES: AcceptMapping = &[( + &[sym::macro_use], + MACRO_USE_TEMPLATE, + |group: &mut Self, cx: &mut AcceptContext<'_, '_, S>, args| { + let span = cx.attr_span; + group.first_span.get_or_insert(span); + match args { + ArgParser::NoArgs => { + match group.state { + MacroUseArgs::UseAll => { + let first_span = group.first_span.expect( + "State is UseAll is some so this is not the first attribute", + ); + // Since there is a `#[macro_use]` import already, give a warning + cx.warn_unused_duplicate(first_span, span); + } + MacroUseArgs::UseSpecific(_) => { + group.state = MacroUseArgs::UseAll; + group.first_span = Some(span); + // If there is a `#[macro_use]` attribute, warn on all `#[macro_use(...)]` attributes since everything is already imported + for specific_use in group.uses_attr_spans.drain(..) { + cx.warn_unused_duplicate(span, specific_use); + } + } + } + } + ArgParser::List(list) => { + if list.is_empty() { + cx.warn_empty_attribute(list.span); + return; + } + + match &mut group.state { + MacroUseArgs::UseAll => { + let first_span = group.first_span.expect( + "State is UseAll is some so this is not the first attribute", + ); + cx.warn_unused_duplicate(first_span, span); + } + MacroUseArgs::UseSpecific(arguments) => { + // Store here so if we encounter a `UseAll` later we can still lint this attribute + group.uses_attr_spans.push(cx.attr_span); + + for item in list.mixed() { + let Some(item) = item.meta_item() else { + cx.expected_identifier(item.span()); + continue; + }; + if let Err(err_span) = item.args().no_args() { + cx.expected_no_args(err_span); + continue; + } + let Some(item) = item.path().word() else { + cx.expected_identifier(item.span()); + continue; + }; + arguments.push(item); + } + } + } + } + ArgParser::NameValue(_) => { + let suggestions = MACRO_USE_TEMPLATE.suggestions(false, sym::macro_use); + cx.emit_err(session_diagnostics::IllFormedAttributeInputLint { + num_suggestions: suggestions.len(), + suggestions: DiagArgValue::StrListSepByAnd( + suggestions.into_iter().map(|s| format!("`{s}`").into()).collect(), + ), + span, + }); + } + } + }, + )]; + + fn finalize(self, _cx: &FinalizeContext<'_, '_, S>) -> Option { + Some(AttributeKind::MacroUse { span: self.first_span?, arguments: self.state }) + } +} diff --git a/compiler/rustc_attr_parsing/src/attributes/mod.rs b/compiler/rustc_attr_parsing/src/attributes/mod.rs index 200f13819602..15b90bd2ed72 100644 --- a/compiler/rustc_attr_parsing/src/attributes/mod.rs +++ b/compiler/rustc_attr_parsing/src/attributes/mod.rs @@ -36,6 +36,7 @@ pub(crate) mod inline; pub(crate) mod link_attrs; pub(crate) mod lint_helpers; pub(crate) mod loop_match; +pub(crate) mod macro_attrs; pub(crate) mod must_use; pub(crate) mod no_implicit_prelude; pub(crate) mod non_exhaustive; diff --git a/compiler/rustc_attr_parsing/src/attributes/must_use.rs b/compiler/rustc_attr_parsing/src/attributes/must_use.rs index e0a3e6755099..42af3ed0bfab 100644 --- a/compiler/rustc_attr_parsing/src/attributes/must_use.rs +++ b/compiler/rustc_attr_parsing/src/attributes/must_use.rs @@ -34,7 +34,7 @@ impl SingleAttributeParser for MustUseParser { ArgParser::List(_) => { let suggestions = >::TEMPLATE.suggestions(false, "must_use"); - cx.emit_err(session_diagnostics::MustUseIllFormedAttributeInput { + cx.emit_err(session_diagnostics::IllFormedAttributeInputLint { num_suggestions: suggestions.len(), suggestions: DiagArgValue::StrListSepByAnd( suggestions.into_iter().map(|s| format!("`{s}`").into()).collect(), diff --git a/compiler/rustc_attr_parsing/src/context.rs b/compiler/rustc_attr_parsing/src/context.rs index 4d692d9562c1..45bfe3452071 100644 --- a/compiler/rustc_attr_parsing/src/context.rs +++ b/compiler/rustc_attr_parsing/src/context.rs @@ -33,6 +33,7 @@ use crate::attributes::lint_helpers::{ AsPtrParser, AutomaticallyDerivedParser, PassByValueParser, PubTransparentParser, }; use crate::attributes::loop_match::{ConstContinueParser, LoopMatchParser}; +use crate::attributes::macro_attrs::{MacroEscapeParser, MacroUseParser}; use crate::attributes::must_use::MustUseParser; use crate::attributes::no_implicit_prelude::NoImplicitPreludeParser; use crate::attributes::non_exhaustive::NonExhaustiveParser; @@ -126,6 +127,7 @@ attribute_parsers!( BodyStabilityParser, ConfusablesParser, ConstStabilityParser, + MacroUseParser, NakedParser, StabilityParser, UsedParser, @@ -174,6 +176,7 @@ attribute_parsers!( Single>, Single>, Single>, + Single>, Single>, Single>, Single>, @@ -386,6 +389,17 @@ impl<'f, 'sess: 'f, S: Stage> AcceptContext<'f, 'sess, S> { }) } + /// emit an error that a `name` was expected here + pub(crate) fn expected_identifier(&self, span: Span) -> ErrorGuaranteed { + self.emit_err(AttributeParseError { + span, + attr_span: self.attr_span, + template: self.template.clone(), + attribute: self.attr_path.clone(), + reason: AttributeParseErrorReason::ExpectedIdentifier, + }) + } + /// emit an error that a `name = value` pair was expected at this span. The symbol can be given for /// a nicer error message talking about the specific name that was found lacking a value. pub(crate) fn expected_name_value(&self, span: Span, name: Option) -> ErrorGuaranteed { diff --git a/compiler/rustc_attr_parsing/src/session_diagnostics.rs b/compiler/rustc_attr_parsing/src/session_diagnostics.rs index 9a400e0fe104..1de25ca252b8 100644 --- a/compiler/rustc_attr_parsing/src/session_diagnostics.rs +++ b/compiler/rustc_attr_parsing/src/session_diagnostics.rs @@ -438,7 +438,7 @@ pub(crate) struct IllFormedAttributeInput { #[derive(Diagnostic)] #[diag(attr_parsing_ill_formed_attribute_input)] -pub(crate) struct MustUseIllFormedAttributeInput { +pub(crate) struct IllFormedAttributeInputLint { #[primary_span] pub span: Span, pub num_suggestions: usize, @@ -549,6 +549,7 @@ pub(crate) enum AttributeParseErrorReason { /// Should we tell the user to write a list when they didn't? list: bool, }, + ExpectedIdentifier, } pub(crate) struct AttributeParseError { @@ -600,11 +601,11 @@ impl<'a, G: EmissionGuarantee> Diagnostic<'a, G> for AttributeParseError { diag.code(E0538); } AttributeParseErrorReason::UnexpectedLiteral => { - diag.span_label(self.span, format!("didn't expect a literal here")); + diag.span_label(self.span, "didn't expect a literal here"); diag.code(E0565); } AttributeParseErrorReason::ExpectedNoArgs => { - diag.span_label(self.span, format!("didn't expect any arguments here")); + diag.span_label(self.span, "didn't expect any arguments here"); diag.code(E0565); } AttributeParseErrorReason::ExpectedNameValue(None) => { @@ -684,6 +685,9 @@ impl<'a, G: EmissionGuarantee> Diagnostic<'a, G> for AttributeParseError { } } } + AttributeParseErrorReason::ExpectedIdentifier => { + diag.span_label(self.span, "expected a valid identifier here"); + } } let suggestions = self.template.suggestions(false, &name); diff --git a/compiler/rustc_hir/src/hir.rs b/compiler/rustc_hir/src/hir.rs index e7898648c2b0..e83f6a1df720 100644 --- a/compiler/rustc_hir/src/hir.rs +++ b/compiler/rustc_hir/src/hir.rs @@ -1302,6 +1302,7 @@ impl AttributeExt for Attribute { // FIXME: should not be needed anymore when all attrs are parsed Attribute::Parsed(AttributeKind::Deprecation { span, .. }) => *span, Attribute::Parsed(AttributeKind::DocComment { span, .. }) => *span, + Attribute::Parsed(AttributeKind::MacroUse { span, .. }) => *span, Attribute::Parsed(AttributeKind::MayDangle(span)) => *span, Attribute::Parsed(AttributeKind::Ignore { span, .. }) => *span, Attribute::Parsed(AttributeKind::AutomaticallyDerived(span)) => *span, diff --git a/compiler/rustc_parse/src/validate_attr.rs b/compiler/rustc_parse/src/validate_attr.rs index cca621103b5d..ed7fb774908a 100644 --- a/compiler/rustc_parse/src/validate_attr.rs +++ b/compiler/rustc_parse/src/validate_attr.rs @@ -303,6 +303,8 @@ pub fn check_builtin_meta_item( | sym::cold | sym::target_feature | sym::rustc_allow_const_fn_unstable + | sym::macro_use + | sym::macro_escape | sym::naked | sym::no_mangle | sym::non_exhaustive diff --git a/compiler/rustc_passes/src/check_attr.rs b/compiler/rustc_passes/src/check_attr.rs index 96c895e71dfe..04c1933f243a 100644 --- a/compiler/rustc_passes/src/check_attr.rs +++ b/compiler/rustc_passes/src/check_attr.rs @@ -227,6 +227,12 @@ impl<'tcx> CheckAttrVisitor<'tcx> { Attribute::Parsed(AttributeKind::LinkSection { span: attr_span, .. }) => { self.check_link_section(hir_id, *attr_span, span, target) } + Attribute::Parsed(AttributeKind::MacroUse { span, .. }) => { + self.check_macro_use(hir_id, sym::macro_use, *span, target) + } + Attribute::Parsed(AttributeKind::MacroEscape(span)) => { + self.check_macro_use(hir_id, sym::macro_escape, *span, target) + } Attribute::Parsed(AttributeKind::Naked(attr_span)) => { self.check_naked(hir_id, *attr_span, span, target) } @@ -362,9 +368,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> { [sym::ffi_pure, ..] => self.check_ffi_pure(attr.span(), attrs, target), [sym::ffi_const, ..] => self.check_ffi_const(attr.span(), target), [sym::link, ..] => self.check_link(hir_id, attr, span, target), - [sym::macro_use, ..] | [sym::macro_escape, ..] => { - self.check_macro_use(hir_id, attr, target) - } [sym::path, ..] => self.check_generic_attr_unparsed(hir_id, attr, target, Target::Mod), [sym::macro_export, ..] => self.check_macro_export(hir_id, attr, target), [sym::should_panic, ..] => { @@ -2411,17 +2414,14 @@ impl<'tcx> CheckAttrVisitor<'tcx> { } } - fn check_macro_use(&self, hir_id: HirId, attr: &Attribute, target: Target) { - let Some(name) = attr.name() else { - return; - }; + fn check_macro_use(&self, hir_id: HirId, name: Symbol, attr_span: Span, target: Target) { match target { Target::ExternCrate | Target::Mod => {} _ => { self.tcx.emit_node_span_lint( UNUSED_ATTRIBUTES, hir_id, - attr.span(), + attr_span, errors::MacroUse { name }, ); } @@ -2474,7 +2474,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> { // Warn on useless empty attributes. // FIXME(jdonszelmann): this lint should be moved to attribute parsing, see `AcceptContext::warn_empty_attribute` let note = if attr.has_any_name(&[ - sym::macro_use, sym::allow, sym::expect, sym::warn, diff --git a/compiler/rustc_resolve/messages.ftl b/compiler/rustc_resolve/messages.ftl index aa818cc9c464..39e9a9cc58af 100644 --- a/compiler/rustc_resolve/messages.ftl +++ b/compiler/rustc_resolve/messages.ftl @@ -41,8 +41,6 @@ resolve_attempt_to_use_non_constant_value_in_constant_without_suggestion = resolve_attributes_starting_with_rustc_are_reserved = attributes starting with `rustc` are reserved for use by the `rustc` compiler -resolve_bad_macro_import = bad macro import - resolve_binding_in_never_pattern = never patterns cannot contain variable bindings .suggestion = use a wildcard `_` instead diff --git a/compiler/rustc_resolve/src/build_reduced_graph.rs b/compiler/rustc_resolve/src/build_reduced_graph.rs index 737577baa7ad..fe7fa71a7fcb 100644 --- a/compiler/rustc_resolve/src/build_reduced_graph.rs +++ b/compiler/rustc_resolve/src/build_reduced_graph.rs @@ -11,11 +11,14 @@ use std::sync::Arc; use rustc_ast::visit::{self, AssocCtxt, Visitor, WalkItemKind}; use rustc_ast::{ self as ast, AssocItem, AssocItemKind, Block, ConstItem, Delegation, Fn, ForeignItem, - ForeignItemKind, Impl, Item, ItemKind, MetaItemKind, NodeId, StaticItem, StmtKind, TyAlias, + ForeignItemKind, Impl, Item, ItemKind, NodeId, StaticItem, StmtKind, TyAlias, }; +use rustc_attr_data_structures::{AttributeKind, MacroUseArgs}; use rustc_attr_parsing as attr; +use rustc_attr_parsing::AttributeParser; use rustc_expand::base::ResolverExpand; use rustc_expand::expand::AstFragment; +use rustc_hir::Attribute; use rustc_hir::def::{self, *}; use rustc_hir::def_id::{CRATE_DEF_ID, DefId, LocalDefId}; use rustc_index::bit_set::DenseBitSet; @@ -25,6 +28,7 @@ use rustc_middle::metadata::ModChild; use rustc_middle::ty::{Feed, Visibility}; use rustc_span::hygiene::{ExpnId, LocalExpnId, MacroKind}; use rustc_span::{Ident, Span, Symbol, kw, sym}; +use thin_vec::ThinVec; use tracing::debug; use crate::Namespace::{MacroNS, TypeNS, ValueNS}; @@ -1019,42 +1023,31 @@ impl<'a, 'ra, 'tcx> BuildReducedGraphVisitor<'a, 'ra, 'tcx> { /// Returns `true` if we should consider the underlying `extern crate` to be used. fn process_macro_use_imports(&mut self, item: &Item, module: Module<'ra>) -> bool { let mut import_all = None; - let mut single_imports = Vec::new(); - for attr in &item.attrs { - if attr.has_name(sym::macro_use) { - if self.parent_scope.module.parent.is_some() { - self.r.dcx().emit_err(errors::ExternCrateLoadingMacroNotAtCrateRoot { - span: item.span, - }); - } - if let ItemKind::ExternCrate(Some(orig_name), _) = item.kind - && orig_name == kw::SelfLower - { - self.r.dcx().emit_err(errors::MacroUseExternCrateSelf { span: attr.span }); - } - let ill_formed = |span| { - self.r.dcx().emit_err(errors::BadMacroImport { span }); - }; - match attr.meta() { - Some(meta) => match meta.kind { - MetaItemKind::Word => { - import_all = Some(meta.span); - break; - } - MetaItemKind::List(meta_item_inners) => { - for meta_item_inner in meta_item_inners { - match meta_item_inner.ident() { - Some(ident) if meta_item_inner.is_word() => { - single_imports.push(ident) - } - _ => ill_formed(meta_item_inner.span()), - } - } - } - MetaItemKind::NameValue(..) => ill_formed(meta.span), - }, - None => ill_formed(attr.span), - } + let mut single_imports = ThinVec::new(); + if let Some(Attribute::Parsed(AttributeKind::MacroUse { span, arguments })) = + AttributeParser::parse_limited( + self.r.tcx.sess, + &item.attrs, + sym::macro_use, + item.span, + item.id, + None, + ) + { + if self.parent_scope.module.parent.is_some() { + self.r + .dcx() + .emit_err(errors::ExternCrateLoadingMacroNotAtCrateRoot { span: item.span }); + } + if let ItemKind::ExternCrate(Some(orig_name), _) = item.kind + && orig_name == kw::SelfLower + { + self.r.dcx().emit_err(errors::MacroUseExternCrateSelf { span }); + } + + match arguments { + MacroUseArgs::UseAll => import_all = Some(span), + MacroUseArgs::UseSpecific(imports) => single_imports = imports, } } diff --git a/compiler/rustc_resolve/src/errors.rs b/compiler/rustc_resolve/src/errors.rs index b34bcb38f844..d6b1e4de6ea1 100644 --- a/compiler/rustc_resolve/src/errors.rs +++ b/compiler/rustc_resolve/src/errors.rs @@ -815,13 +815,6 @@ pub(crate) struct ExternCrateLoadingMacroNotAtCrateRoot { pub(crate) span: Span, } -#[derive(Diagnostic)] -#[diag(resolve_bad_macro_import, code = E0466)] -pub(crate) struct BadMacroImport { - #[primary_span] - pub(crate) span: Span, -} - #[derive(Diagnostic)] #[diag(resolve_extern_crate_self_requires_renaming)] pub(crate) struct ExternCrateSelfRequiresRenaming { diff --git a/src/tools/clippy/clippy_lints/src/macro_use.rs b/src/tools/clippy/clippy_lints/src/macro_use.rs index c1a26c5a9c73..d1a54df988f5 100644 --- a/src/tools/clippy/clippy_lints/src/macro_use.rs +++ b/src/tools/clippy/clippy_lints/src/macro_use.rs @@ -7,8 +7,9 @@ use rustc_hir::{self as hir, AmbigArg}; use rustc_lint::{LateContext, LateLintPass, LintContext}; use rustc_session::impl_lint_pass; use rustc_span::edition::Edition; -use rustc_span::{Span, sym}; +use rustc_span::{Span}; use std::collections::BTreeMap; +use rustc_attr_data_structures::{AttributeKind, find_attr}; declare_clippy_lint! { /// ### What it does @@ -99,15 +100,14 @@ impl LateLintPass<'_> for MacroUseImports { && let hir::ItemKind::Use(path, _kind) = &item.kind && let hir_id = item.hir_id() && let attrs = cx.tcx.hir_attrs(hir_id) - && let Some(mac_attr) = attrs.iter().find(|attr| attr.has_name(sym::macro_use)) + && let Some(mac_attr_span) = find_attr!(attrs, AttributeKind::MacroUse {span, ..} => *span) && let Some(Res::Def(DefKind::Mod, id)) = path.res.type_ns && !id.is_local() { for kid in cx.tcx.module_children(id) { if let Res::Def(DefKind::Macro(_mac_type), mac_id) = kid.res { - let span = mac_attr.span(); let def_path = cx.tcx.def_path_str(mac_id); - self.imports.push((def_path, span, hir_id)); + self.imports.push((def_path, mac_attr_span, hir_id)); } } } else if item.span.from_expansion() { From 3303534dc8825258f8a5d3a1b1e4572d55cccd9a Mon Sep 17 00:00:00 2001 From: Jonathan Brouwer Date: Sat, 12 Jul 2025 17:34:43 +0200 Subject: [PATCH 122/139] Update uitest stderrs Signed-off-by: Jonathan Brouwer --- .../src/error_codes/E0466.md | 4 +- tests/pretty/hir-delegation.pp | 2 +- tests/pretty/hir-fn-params.pp | 2 +- tests/pretty/hir-fn-variadic.pp | 2 +- tests/pretty/hir-if-else.pp | 2 +- tests/pretty/hir-lifetimes.pp | 2 +- tests/pretty/hir-pretty-attr.pp | 2 +- tests/pretty/hir-pretty-loop.pp | 2 +- tests/pretty/hir-struct-expr.pp | 2 +- tests/pretty/issue-4264.pp | 2 +- tests/pretty/issue-85089.pp | 2 +- tests/pretty/pin-ergonomics-hir.pp | 2 +- tests/ui/attributes/invalid-macro-use.rs | 53 +++++++ tests/ui/attributes/invalid-macro-use.stderr | 131 ++++++++++++++++++ tests/ui/attributes/malformed-attrs.rs | 2 +- tests/ui/attributes/malformed-attrs.stderr | 21 +-- .../issue-43106-gating-of-macro_use.rs | 2 +- .../issue-43106-gating-of-macro_use.stderr | 11 +- .../lint/unused/unused-attr-duplicate.stderr | 24 ++-- .../unused/unused-attr-macro-rules.stderr | 16 +-- .../genercs-in-path-with-prettry-hir.stdout | 2 +- tests/ui/macros/macro-use-all-and-none.stderr | 5 +- tests/ui/macros/macro-use-bad-args-1.rs | 2 +- tests/ui/macros/macro-use-bad-args-1.stderr | 19 ++- tests/ui/macros/macro-use-bad-args-2.rs | 2 +- tests/ui/macros/macro-use-bad-args-2.stderr | 19 ++- tests/ui/match/issue-82392.stdout | 2 +- .../type-alias-impl-trait/issue-60662.stdout | 2 +- tests/ui/unpretty/bad-literal.stdout | 2 +- tests/ui/unpretty/debug-fmt-hir.stdout | 2 +- tests/ui/unpretty/deprecated-attr.stdout | 2 +- tests/ui/unpretty/diagnostic-attr.stdout | 2 +- tests/ui/unpretty/exhaustive-asm.hir.stdout | 2 +- tests/ui/unpretty/exhaustive.hir.stdout | 2 +- .../ui/unpretty/flattened-format-args.stdout | 2 +- tests/ui/unpretty/let-else-hir.stdout | 2 +- tests/ui/unpretty/self-hir.stdout | 2 +- tests/ui/unpretty/unpretty-expr-fn-arg.stdout | 2 +- 38 files changed, 274 insertions(+), 85 deletions(-) create mode 100644 tests/ui/attributes/invalid-macro-use.rs create mode 100644 tests/ui/attributes/invalid-macro-use.stderr diff --git a/compiler/rustc_error_codes/src/error_codes/E0466.md b/compiler/rustc_error_codes/src/error_codes/E0466.md index 7aefedbc0875..28016eb395e9 100644 --- a/compiler/rustc_error_codes/src/error_codes/E0466.md +++ b/compiler/rustc_error_codes/src/error_codes/E0466.md @@ -1,8 +1,10 @@ +#### Note: this error code is no longer emitted by the compiler. + Macro import declaration was malformed. Erroneous code examples: -```compile_fail,E0466 +```compile_fail #[macro_use(a_macro(another_macro))] // error: invalid import declaration extern crate core as some_crate; diff --git a/tests/pretty/hir-delegation.pp b/tests/pretty/hir-delegation.pp index e452cee63659..c0d724cccb51 100644 --- a/tests/pretty/hir-delegation.pp +++ b/tests/pretty/hir-delegation.pp @@ -6,7 +6,7 @@ #![feature(fn_delegation)] #[prelude_import] use ::std::prelude::rust_2015::*; -#[macro_use] +#[attr = MacroUse {arguments: UseAll}] extern crate std; fn b(e: C) { } diff --git a/tests/pretty/hir-fn-params.pp b/tests/pretty/hir-fn-params.pp index 3799c8a3c3b7..cfb33cc93eba 100644 --- a/tests/pretty/hir-fn-params.pp +++ b/tests/pretty/hir-fn-params.pp @@ -1,6 +1,6 @@ #[prelude_import] use ::std::prelude::rust_2015::*; -#[macro_use] +#[attr = MacroUse {arguments: UseAll}] extern crate std; //@ pretty-compare-only //@ pretty-mode:hir diff --git a/tests/pretty/hir-fn-variadic.pp b/tests/pretty/hir-fn-variadic.pp index b6bc8e95127f..99919e7fc6b2 100644 --- a/tests/pretty/hir-fn-variadic.pp +++ b/tests/pretty/hir-fn-variadic.pp @@ -5,7 +5,7 @@ #![feature(c_variadic)] #[prelude_import] use ::std::prelude::rust_2015::*; -#[macro_use] +#[attr = MacroUse {arguments: UseAll}] extern crate std; extern "C" { diff --git a/tests/pretty/hir-if-else.pp b/tests/pretty/hir-if-else.pp index 200e34ac4f5a..4bccde663eb5 100644 --- a/tests/pretty/hir-if-else.pp +++ b/tests/pretty/hir-if-else.pp @@ -1,6 +1,6 @@ #[prelude_import] use ::std::prelude::rust_2015::*; -#[macro_use] +#[attr = MacroUse {arguments: UseAll}] extern crate std; //@ pretty-compare-only //@ pretty-mode:hir diff --git a/tests/pretty/hir-lifetimes.pp b/tests/pretty/hir-lifetimes.pp index 58de6d819158..1bb2f17cdfb4 100644 --- a/tests/pretty/hir-lifetimes.pp +++ b/tests/pretty/hir-lifetimes.pp @@ -7,7 +7,7 @@ #![allow(unused)] #[prelude_import] use ::std::prelude::rust_2015::*; -#[macro_use] +#[attr = MacroUse {arguments: UseAll}] extern crate std; struct Foo<'a> { diff --git a/tests/pretty/hir-pretty-attr.pp b/tests/pretty/hir-pretty-attr.pp index db7489c12641..c780f8e3639f 100644 --- a/tests/pretty/hir-pretty-attr.pp +++ b/tests/pretty/hir-pretty-attr.pp @@ -1,6 +1,6 @@ #[prelude_import] use ::std::prelude::rust_2015::*; -#[macro_use] +#[attr = MacroUse {arguments: UseAll}] extern crate std; //@ pretty-compare-only //@ pretty-mode:hir diff --git a/tests/pretty/hir-pretty-loop.pp b/tests/pretty/hir-pretty-loop.pp index 15f1677885ae..c07120273c90 100644 --- a/tests/pretty/hir-pretty-loop.pp +++ b/tests/pretty/hir-pretty-loop.pp @@ -1,6 +1,6 @@ #[prelude_import] use ::std::prelude::rust_2015::*; -#[macro_use] +#[attr = MacroUse {arguments: UseAll}] extern crate std; //@ pretty-compare-only //@ pretty-mode:hir diff --git a/tests/pretty/hir-struct-expr.pp b/tests/pretty/hir-struct-expr.pp index f85d17542dff..177eb5e8631f 100644 --- a/tests/pretty/hir-struct-expr.pp +++ b/tests/pretty/hir-struct-expr.pp @@ -1,6 +1,6 @@ #[prelude_import] use ::std::prelude::rust_2015::*; -#[macro_use] +#[attr = MacroUse {arguments: UseAll}] extern crate std; //@ pretty-compare-only //@ pretty-mode:hir diff --git a/tests/pretty/issue-4264.pp b/tests/pretty/issue-4264.pp index eb808f7122a9..f4b641335d1d 100644 --- a/tests/pretty/issue-4264.pp +++ b/tests/pretty/issue-4264.pp @@ -1,6 +1,6 @@ #[prelude_import] use ::std::prelude::rust_2015::*; -#[macro_use] +#[attr = MacroUse {arguments: UseAll}] extern crate std; //@ pretty-compare-only //@ pretty-mode:hir,typed diff --git a/tests/pretty/issue-85089.pp b/tests/pretty/issue-85089.pp index f4e0eb3dd5ff..31c0f90bf27e 100644 --- a/tests/pretty/issue-85089.pp +++ b/tests/pretty/issue-85089.pp @@ -1,6 +1,6 @@ #[prelude_import] use ::std::prelude::rust_2015::*; -#[macro_use] +#[attr = MacroUse {arguments: UseAll}] extern crate std; // Test to print lifetimes on HIR pretty-printing. diff --git a/tests/pretty/pin-ergonomics-hir.pp b/tests/pretty/pin-ergonomics-hir.pp index 212e0e174dae..58a1c62f712c 100644 --- a/tests/pretty/pin-ergonomics-hir.pp +++ b/tests/pretty/pin-ergonomics-hir.pp @@ -6,7 +6,7 @@ #![allow(dead_code, incomplete_features)] #[prelude_import] use ::std::prelude::rust_2015::*; -#[macro_use] +#[attr = MacroUse {arguments: UseAll}] extern crate std; use std::pin::Pin; diff --git a/tests/ui/attributes/invalid-macro-use.rs b/tests/ui/attributes/invalid-macro-use.rs new file mode 100644 index 000000000000..cfb13fd183c7 --- /dev/null +++ b/tests/ui/attributes/invalid-macro-use.rs @@ -0,0 +1,53 @@ +#![deny(unused_attributes)] +//~^ NOTE the lint level is defined here + +#[macro_use = 5] +//~^ ERROR valid forms for the attribute are `#[macro_use(name1, name2, ...)]` and `#[macro_use]` +extern crate std as s1; + +#[macro_use(5)] +//~^ ERROR malformed `macro_use` attribute input +//~| NOTE expected a valid identifier here +extern crate std as s2; + +#[macro_use(a = "b")] +//~^ ERROR malformed `macro_use` attribute input +//~| NOTE didn't expect any arguments here +extern crate std as s3; + +#[macro_use(a(b))] +//~^ ERROR malformed `macro_use` attribute input +//~| NOTE didn't expect any arguments here +extern crate std as s4; + +#[macro_use(a::b)] +//~^ ERROR malformed `macro_use` attribute input +//~| NOTE expected a valid identifier here +extern crate std as s5; + +#[macro_use(a)] +//~^ ERROR unused attribute +#[macro_use] +//~^ NOTE attribute also specified here +extern crate std as s6; + +#[macro_use] +//~^ NOTE attribute also specified here +#[macro_use(a)] +//~^ ERROR unused attribute +extern crate std as s7; + +#[macro_use] +//~^ NOTE attribute also specified here +#[macro_use] +//~^ ERROR unused attribute +extern crate std as s8; + +// This is fine, both are importing different names +#[macro_use(a)] +//~^ ERROR imported macro not found +#[macro_use(b)] +//~^ ERROR imported macro not found +extern crate std as s9; + +fn main() {} diff --git a/tests/ui/attributes/invalid-macro-use.stderr b/tests/ui/attributes/invalid-macro-use.stderr new file mode 100644 index 000000000000..4f5db5c558a5 --- /dev/null +++ b/tests/ui/attributes/invalid-macro-use.stderr @@ -0,0 +1,131 @@ +error[E0469]: imported macro not found + --> $DIR/invalid-macro-use.rs:47:13 + | +LL | #[macro_use(a)] + | ^ + +error[E0469]: imported macro not found + --> $DIR/invalid-macro-use.rs:49:13 + | +LL | #[macro_use(b)] + | ^ + +error: valid forms for the attribute are `#[macro_use(name1, name2, ...)]` and `#[macro_use]` + --> $DIR/invalid-macro-use.rs:4:1 + | +LL | #[macro_use = 5] + | ^^^^^^^^^^^^^^^^ + +error[E0539]: malformed `macro_use` attribute input + --> $DIR/invalid-macro-use.rs:8:1 + | +LL | #[macro_use(5)] + | ^^^^^^^^^^^^-^^ + | | + | expected a valid identifier here + | +help: try changing it to one of the following valid forms of the attribute + | +LL - #[macro_use(5)] +LL + #[macro_use(name1, name2, ...)] + | +LL - #[macro_use(5)] +LL + #[macro_use] + | + +error[E0565]: malformed `macro_use` attribute input + --> $DIR/invalid-macro-use.rs:13:1 + | +LL | #[macro_use(a = "b")] + | ^^^^^^^^^^^^^^-----^^ + | | + | didn't expect any arguments here + | +help: try changing it to one of the following valid forms of the attribute + | +LL - #[macro_use(a = "b")] +LL + #[macro_use(name1, name2, ...)] + | +LL - #[macro_use(a = "b")] +LL + #[macro_use] + | + +error[E0565]: malformed `macro_use` attribute input + --> $DIR/invalid-macro-use.rs:18:1 + | +LL | #[macro_use(a(b))] + | ^^^^^^^^^^^^^---^^ + | | + | didn't expect any arguments here + | +help: try changing it to one of the following valid forms of the attribute + | +LL - #[macro_use(a(b))] +LL + #[macro_use(name1, name2, ...)] + | +LL - #[macro_use(a(b))] +LL + #[macro_use] + | + +error[E0539]: malformed `macro_use` attribute input + --> $DIR/invalid-macro-use.rs:23:1 + | +LL | #[macro_use(a::b)] + | ^^^^^^^^^^^^----^^ + | | + | expected a valid identifier here + | +help: try changing it to one of the following valid forms of the attribute + | +LL - #[macro_use(a::b)] +LL + #[macro_use(name1, name2, ...)] + | +LL - #[macro_use(a::b)] +LL + #[macro_use] + | + +error: unused attribute + --> $DIR/invalid-macro-use.rs:28:1 + | +LL | #[macro_use(a)] + | ^^^^^^^^^^^^^^^ help: remove this attribute + | +note: attribute also specified here + --> $DIR/invalid-macro-use.rs:30:1 + | +LL | #[macro_use] + | ^^^^^^^^^^^^ +note: the lint level is defined here + --> $DIR/invalid-macro-use.rs:1:9 + | +LL | #![deny(unused_attributes)] + | ^^^^^^^^^^^^^^^^^ + +error: unused attribute + --> $DIR/invalid-macro-use.rs:36:1 + | +LL | #[macro_use(a)] + | ^^^^^^^^^^^^^^^ help: remove this attribute + | +note: attribute also specified here + --> $DIR/invalid-macro-use.rs:34:1 + | +LL | #[macro_use] + | ^^^^^^^^^^^^ + +error: unused attribute + --> $DIR/invalid-macro-use.rs:42:1 + | +LL | #[macro_use] + | ^^^^^^^^^^^^ help: remove this attribute + | +note: attribute also specified here + --> $DIR/invalid-macro-use.rs:40:1 + | +LL | #[macro_use] + | ^^^^^^^^^^^^ + +error: aborting due to 10 previous errors + +Some errors have detailed explanations: E0469, E0539, E0565. +For more information about an error, try `rustc --explain E0469`. diff --git a/tests/ui/attributes/malformed-attrs.rs b/tests/ui/attributes/malformed-attrs.rs index d4c6ecaa1892..2a8b7b41e58f 100644 --- a/tests/ui/attributes/malformed-attrs.rs +++ b/tests/ui/attributes/malformed-attrs.rs @@ -208,7 +208,7 @@ static mut TLS: u8 = 42; #[no_link()] //~^ ERROR malformed #[macro_use = 1] -//~^ ERROR malformed +//~^ ERROR valid forms for the attribute are `#[macro_use(name1, name2, ...)]` and `#[macro_use]` extern crate wloop; //~^ ERROR can't find crate for `wloop` [E0463] diff --git a/tests/ui/attributes/malformed-attrs.stderr b/tests/ui/attributes/malformed-attrs.stderr index de53af851a3e..7ae24db8b5fe 100644 --- a/tests/ui/attributes/malformed-attrs.stderr +++ b/tests/ui/attributes/malformed-attrs.stderr @@ -154,21 +154,6 @@ error: malformed `no_link` attribute input LL | #[no_link()] | ^^^^^^^^^^^^ help: must be of the form: `#[no_link]` -error: malformed `macro_use` attribute input - --> $DIR/malformed-attrs.rs:210:1 - | -LL | #[macro_use = 1] - | ^^^^^^^^^^^^^^^^ - | -help: the following are the possible correct uses - | -LL - #[macro_use = 1] -LL + #[macro_use(name1, name2, ...)] - | -LL - #[macro_use = 1] -LL + #[macro_use] - | - error: malformed `macro_export` attribute input --> $DIR/malformed-attrs.rs:215:1 | @@ -567,6 +552,12 @@ LL | #[non_exhaustive = 1] | | didn't expect any arguments here | help: must be of the form: `#[non_exhaustive]` +error: valid forms for the attribute are `#[macro_use(name1, name2, ...)]` and `#[macro_use]` + --> $DIR/malformed-attrs.rs:210:1 + | +LL | #[macro_use = 1] + | ^^^^^^^^^^^^^^^^ + error[E0565]: malformed `type_const` attribute input --> $DIR/malformed-attrs.rs:144:5 | diff --git a/tests/ui/feature-gates/issue-43106-gating-of-macro_use.rs b/tests/ui/feature-gates/issue-43106-gating-of-macro_use.rs index 6a7ef793924a..0438152ff35f 100644 --- a/tests/ui/feature-gates/issue-43106-gating-of-macro_use.rs +++ b/tests/ui/feature-gates/issue-43106-gating-of-macro_use.rs @@ -13,7 +13,7 @@ mod macro_escape { //~^ ERROR arguments to `macro_use` are not allowed here #[macro_use = "2700"] struct S; - //~^ ERROR malformed `macro_use` attribute + //~^ ERROR valid forms for the attribute are `#[macro_use(name1, name2, ...)]` and `#[macro_use]` #[macro_use] fn f() { } diff --git a/tests/ui/feature-gates/issue-43106-gating-of-macro_use.stderr b/tests/ui/feature-gates/issue-43106-gating-of-macro_use.stderr index 8987b87f84e9..4da717668379 100644 --- a/tests/ui/feature-gates/issue-43106-gating-of-macro_use.stderr +++ b/tests/ui/feature-gates/issue-43106-gating-of-macro_use.stderr @@ -16,20 +16,11 @@ error: arguments to `macro_use` are not allowed here LL | #![macro_use(my_macro)] | ^^^^^^^^^^^^^^^^^^^^^^^ -error: malformed `macro_use` attribute input +error: valid forms for the attribute are `#[macro_use(name1, name2, ...)]` and `#[macro_use]` --> $DIR/issue-43106-gating-of-macro_use.rs:15:5 | LL | #[macro_use = "2700"] struct S; | ^^^^^^^^^^^^^^^^^^^^^ - | -help: the following are the possible correct uses - | -LL - #[macro_use = "2700"] struct S; -LL + #[macro_use(name1, name2, ...)] struct S; - | -LL - #[macro_use = "2700"] struct S; -LL + #[macro_use] struct S; - | error: aborting due to 4 previous errors diff --git a/tests/ui/lint/unused/unused-attr-duplicate.stderr b/tests/ui/lint/unused/unused-attr-duplicate.stderr index ecc1b7ff5a46..e277f5203c69 100644 --- a/tests/ui/lint/unused/unused-attr-duplicate.stderr +++ b/tests/ui/lint/unused/unused-attr-duplicate.stderr @@ -15,18 +15,6 @@ note: the lint level is defined here LL | #![deny(unused_attributes)] | ^^^^^^^^^^^^^^^^^ -error: unused attribute - --> $DIR/unused-attr-duplicate.rs:37:1 - | -LL | #[macro_use] - | ^^^^^^^^^^^^ help: remove this attribute - | -note: attribute also specified here - --> $DIR/unused-attr-duplicate.rs:36:1 - | -LL | #[macro_use] - | ^^^^^^^^^^^^ - error: unused attribute --> $DIR/unused-attr-duplicate.rs:55:1 | @@ -128,6 +116,18 @@ note: attribute also specified here LL | #[macro_export] | ^^^^^^^^^^^^^^^ +error: unused attribute + --> $DIR/unused-attr-duplicate.rs:37:1 + | +LL | #[macro_use] + | ^^^^^^^^^^^^ help: remove this attribute + | +note: attribute also specified here + --> $DIR/unused-attr-duplicate.rs:36:1 + | +LL | #[macro_use] + | ^^^^^^^^^^^^ + error: unused attribute --> $DIR/unused-attr-duplicate.rs:47:1 | diff --git a/tests/ui/lint/unused/unused-attr-macro-rules.stderr b/tests/ui/lint/unused/unused-attr-macro-rules.stderr index 4698e3814258..1e1211af5e29 100644 --- a/tests/ui/lint/unused/unused-attr-macro-rules.stderr +++ b/tests/ui/lint/unused/unused-attr-macro-rules.stderr @@ -1,8 +1,8 @@ -error: `#[macro_use]` only has an effect on `extern crate` and modules - --> $DIR/unused-attr-macro-rules.rs:7:1 +error: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` + --> $DIR/unused-attr-macro-rules.rs:9:1 | -LL | #[macro_use] - | ^^^^^^^^^^^^ +LL | #[recursion_limit="1"] + | ^^^^^^^^^^^^^^^^^^^^^^ | note: the lint level is defined here --> $DIR/unused-attr-macro-rules.rs:1:9 @@ -10,11 +10,11 @@ note: the lint level is defined here LL | #![deny(unused_attributes)] | ^^^^^^^^^^^^^^^^^ -error: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` - --> $DIR/unused-attr-macro-rules.rs:9:1 +error: `#[macro_use]` only has an effect on `extern crate` and modules + --> $DIR/unused-attr-macro-rules.rs:7:1 | -LL | #[recursion_limit="1"] - | ^^^^^^^^^^^^^^^^^^^^^^ +LL | #[macro_use] + | ^^^^^^^^^^^^ error: `#[path]` only has an effect on modules --> $DIR/unused-attr-macro-rules.rs:8:1 diff --git a/tests/ui/macros/genercs-in-path-with-prettry-hir.stdout b/tests/ui/macros/genercs-in-path-with-prettry-hir.stdout index 7c41225f95e6..6b0300132b5f 100644 --- a/tests/ui/macros/genercs-in-path-with-prettry-hir.stdout +++ b/tests/ui/macros/genercs-in-path-with-prettry-hir.stdout @@ -1,6 +1,6 @@ #[prelude_import] use ::std::prelude::rust_2015::*; -#[macro_use] +#[attr = MacroUse {arguments: UseAll}] extern crate std; //@ compile-flags: -Zunpretty=hir //@ edition: 2015 diff --git a/tests/ui/macros/macro-use-all-and-none.stderr b/tests/ui/macros/macro-use-all-and-none.stderr index 00b10dccd001..a5efb065a21b 100644 --- a/tests/ui/macros/macro-use-all-and-none.stderr +++ b/tests/ui/macros/macro-use-all-and-none.stderr @@ -1,10 +1,9 @@ warning: unused attribute - --> $DIR/macro-use-all-and-none.rs:7:1 + --> $DIR/macro-use-all-and-none.rs:7:12 | LL | #[macro_use()] - | ^^^^^^^^^^^^^^ help: remove this attribute + | ^^ help: remove this attribute | - = note: attribute `macro_use` with an empty list has no effect note: the lint level is defined here --> $DIR/macro-use-all-and-none.rs:4:9 | diff --git a/tests/ui/macros/macro-use-bad-args-1.rs b/tests/ui/macros/macro-use-bad-args-1.rs index ec0b64a10953..bfc19981804d 100644 --- a/tests/ui/macros/macro-use-bad-args-1.rs +++ b/tests/ui/macros/macro-use-bad-args-1.rs @@ -1,6 +1,6 @@ #![no_std] -#[macro_use(foo(bar))] //~ ERROR bad macro import +#[macro_use(foo(bar))] //~ ERROR malformed `macro_use` attribute input extern crate std; fn main() {} diff --git a/tests/ui/macros/macro-use-bad-args-1.stderr b/tests/ui/macros/macro-use-bad-args-1.stderr index 6d2f159a5740..2f43d0997df5 100644 --- a/tests/ui/macros/macro-use-bad-args-1.stderr +++ b/tests/ui/macros/macro-use-bad-args-1.stderr @@ -1,9 +1,20 @@ -error[E0466]: bad macro import - --> $DIR/macro-use-bad-args-1.rs:3:13 +error[E0565]: malformed `macro_use` attribute input + --> $DIR/macro-use-bad-args-1.rs:3:1 | LL | #[macro_use(foo(bar))] - | ^^^^^^^^ + | ^^^^^^^^^^^^^^^-----^^ + | | + | didn't expect any arguments here + | +help: try changing it to one of the following valid forms of the attribute + | +LL - #[macro_use(foo(bar))] +LL + #[macro_use(name1, name2, ...)] + | +LL - #[macro_use(foo(bar))] +LL + #[macro_use] + | error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0466`. +For more information about this error, try `rustc --explain E0565`. diff --git a/tests/ui/macros/macro-use-bad-args-2.rs b/tests/ui/macros/macro-use-bad-args-2.rs index c5f8f62c1868..e328b6285d91 100644 --- a/tests/ui/macros/macro-use-bad-args-2.rs +++ b/tests/ui/macros/macro-use-bad-args-2.rs @@ -1,6 +1,6 @@ #![no_std] -#[macro_use(foo="bar")] //~ ERROR bad macro import +#[macro_use(foo="bar")] //~ ERROR malformed `macro_use` attribute input extern crate std; fn main() {} diff --git a/tests/ui/macros/macro-use-bad-args-2.stderr b/tests/ui/macros/macro-use-bad-args-2.stderr index 364f3da6e15a..d7b03c935886 100644 --- a/tests/ui/macros/macro-use-bad-args-2.stderr +++ b/tests/ui/macros/macro-use-bad-args-2.stderr @@ -1,9 +1,20 @@ -error[E0466]: bad macro import - --> $DIR/macro-use-bad-args-2.rs:3:13 +error[E0565]: malformed `macro_use` attribute input + --> $DIR/macro-use-bad-args-2.rs:3:1 | LL | #[macro_use(foo="bar")] - | ^^^^^^^^^ + | ^^^^^^^^^^^^^^^------^^ + | | + | didn't expect any arguments here + | +help: try changing it to one of the following valid forms of the attribute + | +LL - #[macro_use(foo="bar")] +LL + #[macro_use(name1, name2, ...)] + | +LL - #[macro_use(foo="bar")] +LL + #[macro_use] + | error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0466`. +For more information about this error, try `rustc --explain E0565`. diff --git a/tests/ui/match/issue-82392.stdout b/tests/ui/match/issue-82392.stdout index a0d83d962e73..3efc964e053b 100644 --- a/tests/ui/match/issue-82392.stdout +++ b/tests/ui/match/issue-82392.stdout @@ -1,6 +1,6 @@ #[prelude_import] use ::std::prelude::rust_2015::*; -#[macro_use] +#[attr = MacroUse {arguments: UseAll}] extern crate std; // https://github.com/rust-lang/rust/issues/82329 //@ compile-flags: -Zunpretty=hir,typed diff --git a/tests/ui/type-alias-impl-trait/issue-60662.stdout b/tests/ui/type-alias-impl-trait/issue-60662.stdout index 56fef852e37b..52152a73affe 100644 --- a/tests/ui/type-alias-impl-trait/issue-60662.stdout +++ b/tests/ui/type-alias-impl-trait/issue-60662.stdout @@ -5,7 +5,7 @@ #![feature(type_alias_impl_trait)] #[prelude_import] use ::std::prelude::rust_2015::*; -#[macro_use] +#[attr = MacroUse {arguments: UseAll}] extern crate std; trait Animal { } diff --git a/tests/ui/unpretty/bad-literal.stdout b/tests/ui/unpretty/bad-literal.stdout index 06116a4ab553..ba8467359cd6 100644 --- a/tests/ui/unpretty/bad-literal.stdout +++ b/tests/ui/unpretty/bad-literal.stdout @@ -1,6 +1,6 @@ #[prelude_import] use ::std::prelude::rust_2015::*; -#[macro_use] +#[attr = MacroUse {arguments: UseAll}] extern crate std; //@ compile-flags: -Zunpretty=hir //@ check-fail diff --git a/tests/ui/unpretty/debug-fmt-hir.stdout b/tests/ui/unpretty/debug-fmt-hir.stdout index dc18675ea803..1d224c9e91ff 100644 --- a/tests/ui/unpretty/debug-fmt-hir.stdout +++ b/tests/ui/unpretty/debug-fmt-hir.stdout @@ -1,6 +1,6 @@ #[prelude_import] use ::std::prelude::rust_2015::*; -#[macro_use] +#[attr = MacroUse {arguments: UseAll}] extern crate std; //@ compile-flags: -Zunpretty=hir //@ check-pass diff --git a/tests/ui/unpretty/deprecated-attr.stdout b/tests/ui/unpretty/deprecated-attr.stdout index 042c2f61bd4c..0abeef6f61e0 100644 --- a/tests/ui/unpretty/deprecated-attr.stdout +++ b/tests/ui/unpretty/deprecated-attr.stdout @@ -1,6 +1,6 @@ #[prelude_import] use ::std::prelude::rust_2015::*; -#[macro_use] +#[attr = MacroUse {arguments: UseAll}] extern crate std; //@ compile-flags: -Zunpretty=hir //@ check-pass diff --git a/tests/ui/unpretty/diagnostic-attr.stdout b/tests/ui/unpretty/diagnostic-attr.stdout index 3b15a845d68f..a1325c61ca73 100644 --- a/tests/ui/unpretty/diagnostic-attr.stdout +++ b/tests/ui/unpretty/diagnostic-attr.stdout @@ -1,6 +1,6 @@ #[prelude_import] use ::std::prelude::rust_2015::*; -#[macro_use] +#[attr = MacroUse {arguments: UseAll}] extern crate std; //@ compile-flags: -Zunpretty=hir //@ check-pass diff --git a/tests/ui/unpretty/exhaustive-asm.hir.stdout b/tests/ui/unpretty/exhaustive-asm.hir.stdout index ec9bda573312..bbd846a88454 100644 --- a/tests/ui/unpretty/exhaustive-asm.hir.stdout +++ b/tests/ui/unpretty/exhaustive-asm.hir.stdout @@ -1,6 +1,6 @@ #[prelude_import] use std::prelude::rust_2024::*; -#[macro_use] +#[attr = MacroUse {arguments: UseAll}] extern crate std; //@ revisions: expanded hir //@[expanded]compile-flags: -Zunpretty=expanded diff --git a/tests/ui/unpretty/exhaustive.hir.stdout b/tests/ui/unpretty/exhaustive.hir.stdout index a559d51ed5d6..77807728c9d3 100644 --- a/tests/ui/unpretty/exhaustive.hir.stdout +++ b/tests/ui/unpretty/exhaustive.hir.stdout @@ -30,7 +30,7 @@ #![allow(incomplete_features)] #[prelude_import] use std::prelude::rust_2024::*; -#[macro_use] +#[attr = MacroUse {arguments: UseAll}] extern crate std; #[prelude_import] diff --git a/tests/ui/unpretty/flattened-format-args.stdout b/tests/ui/unpretty/flattened-format-args.stdout index 4af82924c7b4..3cd027346655 100644 --- a/tests/ui/unpretty/flattened-format-args.stdout +++ b/tests/ui/unpretty/flattened-format-args.stdout @@ -1,6 +1,6 @@ #[prelude_import] use ::std::prelude::rust_2015::*; -#[macro_use] +#[attr = MacroUse {arguments: UseAll}] extern crate std; //@ compile-flags: -Zunpretty=hir -Zflatten-format-args=yes //@ check-pass diff --git a/tests/ui/unpretty/let-else-hir.stdout b/tests/ui/unpretty/let-else-hir.stdout index a6dd943ec1b7..a83790d8bee5 100644 --- a/tests/ui/unpretty/let-else-hir.stdout +++ b/tests/ui/unpretty/let-else-hir.stdout @@ -1,6 +1,6 @@ #[prelude_import] use ::std::prelude::rust_2015::*; -#[macro_use] +#[attr = MacroUse {arguments: UseAll}] extern crate std; //@ compile-flags: -Zunpretty=hir //@ check-pass diff --git a/tests/ui/unpretty/self-hir.stdout b/tests/ui/unpretty/self-hir.stdout index a9e80b1f5920..1eafc3c8b46b 100644 --- a/tests/ui/unpretty/self-hir.stdout +++ b/tests/ui/unpretty/self-hir.stdout @@ -1,6 +1,6 @@ #[prelude_import] use ::std::prelude::rust_2015::*; -#[macro_use] +#[attr = MacroUse {arguments: UseAll}] extern crate std; //@ compile-flags: -Zunpretty=hir //@ check-pass diff --git a/tests/ui/unpretty/unpretty-expr-fn-arg.stdout b/tests/ui/unpretty/unpretty-expr-fn-arg.stdout index fd2e794fcac8..e9fd2222a8d2 100644 --- a/tests/ui/unpretty/unpretty-expr-fn-arg.stdout +++ b/tests/ui/unpretty/unpretty-expr-fn-arg.stdout @@ -10,7 +10,7 @@ #![allow(dead_code)] #[prelude_import] use ::std::prelude::rust_2015::*; -#[macro_use] +#[attr = MacroUse {arguments: UseAll}] extern crate std; fn main() ({ } as ()) From af06bb925f2a3cd24ab2c623d75b5ea2847dc171 Mon Sep 17 00:00:00 2001 From: Jonathan Brouwer Date: Wed, 23 Jul 2025 14:31:50 +0200 Subject: [PATCH 123/139] Stop using the old `validate_attr` logic for stability attributes --- .../src/attributes/stability.rs | 26 ++++++++++++--- compiler/rustc_parse/src/validate_attr.rs | 3 ++ .../stability-attribute-sanity-4.stderr | 32 +++++++++++++------ 3 files changed, 47 insertions(+), 14 deletions(-) diff --git a/compiler/rustc_attr_parsing/src/attributes/stability.rs b/compiler/rustc_attr_parsing/src/attributes/stability.rs index 59337749c877..c54fc6b41f8e 100644 --- a/compiler/rustc_attr_parsing/src/attributes/stability.rs +++ b/compiler/rustc_attr_parsing/src/attributes/stability.rs @@ -74,8 +74,15 @@ impl AttributeParser for StabilityParser { template!(NameValueStr: "deprecation message"), |this, cx, args| { reject_outside_std!(cx); - this.allowed_through_unstable_modules = - args.name_value().and_then(|i| i.value_as_str()) + let Some(nv) = args.name_value() else { + cx.expected_name_value(cx.attr_span, None); + return; + }; + let Some(value_str) = nv.value_as_str() else { + cx.expected_string_literal(nv.value_span, Some(nv.value_as_lit())); + return; + }; + this.allowed_through_unstable_modules = Some(value_str); }, ), ]; @@ -247,7 +254,12 @@ pub(crate) fn parse_stability( let mut feature = None; let mut since = None; - for param in args.list()?.mixed() { + let ArgParser::List(list) = args else { + cx.expected_list(cx.attr_span); + return None; + }; + + for param in list.mixed() { let param_span = param.span(); let Some(param) = param.meta_item() else { cx.emit_err(session_diagnostics::UnsupportedLiteral { @@ -322,7 +334,13 @@ pub(crate) fn parse_unstability( let mut is_soft = false; let mut implied_by = None; let mut old_name = None; - for param in args.list()?.mixed() { + + let ArgParser::List(list) = args else { + cx.expected_list(cx.attr_span); + return None; + }; + + for param in list.mixed() { let Some(param) = param.meta_item() else { cx.emit_err(session_diagnostics::UnsupportedLiteral { span: param.span(), diff --git a/compiler/rustc_parse/src/validate_attr.rs b/compiler/rustc_parse/src/validate_attr.rs index cca621103b5d..f040fed7162f 100644 --- a/compiler/rustc_parse/src/validate_attr.rs +++ b/compiler/rustc_parse/src/validate_attr.rs @@ -285,6 +285,9 @@ pub fn check_builtin_meta_item( | sym::rustc_do_not_implement_via_object | sym::rustc_coinductive | sym::const_trait + | sym::stable + | sym::unstable + | sym::rustc_allowed_through_unstable_modules | sym::rustc_specialization_trait | sym::rustc_unsafe_specialization_marker | sym::rustc_allow_incoherent_impl diff --git a/tests/ui/stability-attribute/stability-attribute-sanity-4.stderr b/tests/ui/stability-attribute/stability-attribute-sanity-4.stderr index 8ead943ffe3a..f656aeaa16c7 100644 --- a/tests/ui/stability-attribute/stability-attribute-sanity-4.stderr +++ b/tests/ui/stability-attribute/stability-attribute-sanity-4.stderr @@ -1,26 +1,38 @@ -error: malformed `unstable` attribute input +error[E0539]: malformed `unstable` attribute input --> $DIR/stability-attribute-sanity-4.rs:8:5 | LL | #[unstable] - | ^^^^^^^^^^^ help: must be of the form: `#[unstable(feature = "name", reason = "...", issue = "N")]` + | ^^^^^^^^^^^ + | | + | expected this to be a list + | help: must be of the form: `#[unstable(feature = "name", reason = "...", issue = "N")]` -error: malformed `unstable` attribute input +error[E0539]: malformed `unstable` attribute input --> $DIR/stability-attribute-sanity-4.rs:11:5 | LL | #[unstable = "b"] - | ^^^^^^^^^^^^^^^^^ help: must be of the form: `#[unstable(feature = "name", reason = "...", issue = "N")]` + | ^^^^^^^^^^^^^^^^^ + | | + | expected this to be a list + | help: must be of the form: `#[unstable(feature = "name", reason = "...", issue = "N")]` -error: malformed `stable` attribute input +error[E0539]: malformed `stable` attribute input --> $DIR/stability-attribute-sanity-4.rs:14:5 | LL | #[stable] - | ^^^^^^^^^ help: must be of the form: `#[stable(feature = "name", since = "version")]` + | ^^^^^^^^^ + | | + | expected this to be a list + | help: must be of the form: `#[stable(feature = "name", since = "version")]` -error: malformed `stable` attribute input +error[E0539]: malformed `stable` attribute input --> $DIR/stability-attribute-sanity-4.rs:17:5 | LL | #[stable = "a"] - | ^^^^^^^^^^^^^^^ help: must be of the form: `#[stable(feature = "name", since = "version")]` + | ^^^^^^^^^^^^^^^ + | | + | expected this to be a list + | help: must be of the form: `#[stable(feature = "name", since = "version")]` error[E0542]: missing 'since' --> $DIR/stability-attribute-sanity-4.rs:21:5 @@ -42,5 +54,5 @@ LL | #[deprecated = "a"] error: aborting due to 7 previous errors -Some errors have detailed explanations: E0542, E0543. -For more information about an error, try `rustc --explain E0542`. +Some errors have detailed explanations: E0539, E0542, E0543. +For more information about an error, try `rustc --explain E0539`. From 67b57f69cac1ccf7fad3986fc0c6ee2022eebd06 Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Tue, 15 Jul 2025 23:42:35 +0300 Subject: [PATCH 124/139] resolve: Make disambiguators for underscore bindings module-local --- .../rustc_resolve/src/build_reduced_graph.rs | 30 ++++++++------- compiler/rustc_resolve/src/imports.rs | 38 ++++++++++++------- compiler/rustc_resolve/src/lib.rs | 33 ++++++++-------- compiler/rustc_resolve/src/macros.rs | 2 +- 4 files changed, 58 insertions(+), 45 deletions(-) diff --git a/compiler/rustc_resolve/src/build_reduced_graph.rs b/compiler/rustc_resolve/src/build_reduced_graph.rs index 737577baa7ad..c3bfd759f4c0 100644 --- a/compiler/rustc_resolve/src/build_reduced_graph.rs +++ b/compiler/rustc_resolve/src/build_reduced_graph.rs @@ -49,8 +49,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { ns: Namespace, binding: NameBinding<'ra>, ) { - let key = self.new_disambiguated_key(ident, ns); - if let Err(old_binding) = self.try_define(parent, key, binding, false) { + if let Err(old_binding) = self.try_define(parent, ident, ns, binding, false) { self.report_conflict(parent, ident, ns, old_binding, binding); } } @@ -442,16 +441,18 @@ impl<'a, 'ra, 'tcx> BuildReducedGraphVisitor<'a, 'ra, 'tcx> { self.r.indeterminate_imports.push(import); match import.kind { - // Don't add unresolved underscore imports to modules - ImportKind::Single { target: Ident { name: kw::Underscore, .. }, .. } => {} ImportKind::Single { target, type_ns_only, .. } => { - self.r.per_ns(|this, ns| { - if !type_ns_only || ns == TypeNS { - let key = BindingKey::new(target, ns); - let mut resolution = this.resolution(current_module, key).borrow_mut(); - resolution.single_imports.insert(import); - } - }); + // Don't add underscore imports to `single_imports` + // because they cannot define any usable names. + if target.name != kw::Underscore { + self.r.per_ns(|this, ns| { + if !type_ns_only || ns == TypeNS { + let key = BindingKey::new(target, ns); + let mut resolution = this.resolution(current_module, key).borrow_mut(); + resolution.single_imports.insert(import); + } + }); + } } // We don't add prelude imports to the globs since they only affect lexical scopes, // which are not relevant to import resolution. @@ -1408,9 +1409,12 @@ impl<'a, 'ra, 'tcx> Visitor<'a> for BuildReducedGraphVisitor<'a, 'ra, 'tcx> { let parent = self.parent_scope.module; let expansion = self.parent_scope.expansion; self.r.define(parent, ident, ns, self.res(def_id), vis, item.span, expansion); - } else if !matches!(&item.kind, AssocItemKind::Delegation(deleg) if deleg.from_glob) { + } else if !matches!(&item.kind, AssocItemKind::Delegation(deleg) if deleg.from_glob) + && ident.name != kw::Underscore + { + // Don't add underscore names, they cannot be looked up anyway. let impl_def_id = self.r.tcx.local_parent(local_def_id); - let key = BindingKey::new(ident.normalize_to_macros_2_0(), ns); + let key = BindingKey::new(ident, ns); self.r.impl_binding_keys.entry(impl_def_id).or_default().insert(key); } diff --git a/compiler/rustc_resolve/src/imports.rs b/compiler/rustc_resolve/src/imports.rs index 0a4c25b0eb05..b4c15ed1ca7e 100644 --- a/compiler/rustc_resolve/src/imports.rs +++ b/compiler/rustc_resolve/src/imports.rs @@ -25,7 +25,7 @@ use rustc_span::{Ident, Span, Symbol, kw, sym}; use smallvec::SmallVec; use tracing::debug; -use crate::Namespace::*; +use crate::Namespace::{self, *}; use crate::diagnostics::{DiagMode, Suggestion, import_candidates}; use crate::errors::{ CannotBeReexportedCratePublic, CannotBeReexportedCratePublicNS, CannotBeReexportedPrivate, @@ -338,13 +338,20 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { pub(crate) fn try_define( &mut self, module: Module<'ra>, - key: BindingKey, + ident: Ident, + ns: Namespace, binding: NameBinding<'ra>, warn_ambiguity: bool, ) -> Result<(), NameBinding<'ra>> { let res = binding.res(); - self.check_reserved_macro_name(key.ident, res); + self.check_reserved_macro_name(ident, res); self.set_binding_parent_module(binding, module); + // Even if underscore names cannot be looked up, we still need to add them to modules, + // because they can be fetched by glob imports from those modules, and bring traits + // into scope both directly and through glob imports. + let key = BindingKey::new_disambiguated(ident, ns, || { + (module.0.0.lazy_resolutions.borrow().len() + 1).try_into().unwrap() + }); self.update_resolution(module, key, warn_ambiguity, |this, resolution| { if let Some(old_binding) = resolution.best_binding() { if res == Res::Err && old_binding.res() != Res::Err { @@ -383,7 +390,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { (old_glob @ true, false) | (old_glob @ false, true) => { let (glob_binding, non_glob_binding) = if old_glob { (old_binding, binding) } else { (binding, old_binding) }; - if key.ns == MacroNS + if ns == MacroNS && non_glob_binding.expansion != LocalExpnId::ROOT && glob_binding.res() != non_glob_binding.res() { @@ -489,10 +496,10 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { }; if self.is_accessible_from(binding.vis, scope) { let imported_binding = self.import(binding, *import); - let key = BindingKey { ident, ..key }; let _ = self.try_define( import.parent_scope.module, - key, + ident, + key.ns, imported_binding, warn_ambiguity, ); @@ -514,11 +521,15 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { let dummy_binding = self.dummy_binding; let dummy_binding = self.import(dummy_binding, import); self.per_ns(|this, ns| { - let key = BindingKey::new(target, ns); - let _ = this.try_define(import.parent_scope.module, key, dummy_binding, false); - this.update_resolution(import.parent_scope.module, key, false, |_, resolution| { - resolution.single_imports.swap_remove(&import); - }) + let module = import.parent_scope.module; + let _ = this.try_define(module, target, ns, dummy_binding, false); + // Don't remove underscores from `single_imports`, they were never added. + if target.name != kw::Underscore { + let key = BindingKey::new(target, ns); + this.update_resolution(module, key, false, |_, resolution| { + resolution.single_imports.swap_remove(&import); + }) + } }); self.record_use(target, dummy_binding, Used::Other); } else if import.imported_module.get().is_none() { @@ -895,7 +906,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { PendingBinding::Ready(Some(imported_binding)) } Err(Determinacy::Determined) => { - // Don't update the resolution for underscores, because it was never added. + // Don't remove underscores from `single_imports`, they were never added. if target.name != kw::Underscore { let key = BindingKey::new(target, ns); this.update_resolution(parent, key, false, |_, resolution| { @@ -1510,7 +1521,8 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { .is_some_and(|binding| binding.warn_ambiguity_recursive()); let _ = self.try_define( import.parent_scope.module, - key, + key.ident, + key.ns, imported_binding, warn_ambiguity, ); diff --git a/compiler/rustc_resolve/src/lib.rs b/compiler/rustc_resolve/src/lib.rs index 0d41a822e8a8..948b67a37985 100644 --- a/compiler/rustc_resolve/src/lib.rs +++ b/compiler/rustc_resolve/src/lib.rs @@ -532,15 +532,26 @@ struct BindingKey { /// identifier. ident: Ident, ns: Namespace, - /// 0 if ident is not `_`, otherwise a value that's unique to the specific - /// `_` in the expanded AST that introduced this binding. + /// When we add an underscore binding (with ident `_`) to some module, this field has + /// a non-zero value that uniquely identifies this binding in that module. + /// For non-underscore bindings this field is zero. + /// When a key is constructed for name lookup (as opposed to name definition), this field is + /// also zero, even for underscore names, so for underscores the lookup will never succeed. disambiguator: u32, } impl BindingKey { fn new(ident: Ident, ns: Namespace) -> Self { - let ident = ident.normalize_to_macros_2_0(); - BindingKey { ident, ns, disambiguator: 0 } + BindingKey { ident: ident.normalize_to_macros_2_0(), ns, disambiguator: 0 } + } + + fn new_disambiguated( + ident: Ident, + ns: Namespace, + disambiguator: impl FnOnce() -> u32, + ) -> BindingKey { + let disambiguator = if ident.name == kw::Underscore { disambiguator() } else { 0 }; + BindingKey { ident: ident.normalize_to_macros_2_0(), ns, disambiguator } } } @@ -1087,8 +1098,6 @@ pub struct Resolver<'ra, 'tcx> { extern_module_map: RefCell>>, binding_parent_modules: FxHashMap, Module<'ra>>, - underscore_disambiguator: u32, - /// Maps glob imports to the names of items actually imported. glob_map: FxIndexMap>, glob_error: Option, @@ -1500,7 +1509,6 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { extern_crate_map: Default::default(), module_children: Default::default(), trait_map: NodeMap::default(), - underscore_disambiguator: 0, empty_module, local_module_map, extern_module_map: Default::default(), @@ -1881,17 +1889,6 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { import_ids } - fn new_disambiguated_key(&mut self, ident: Ident, ns: Namespace) -> BindingKey { - let ident = ident.normalize_to_macros_2_0(); - let disambiguator = if ident.name == kw::Underscore { - self.underscore_disambiguator += 1; - self.underscore_disambiguator - } else { - 0 - }; - BindingKey { ident, ns, disambiguator } - } - fn resolutions(&mut self, module: Module<'ra>) -> &'ra Resolutions<'ra> { if module.populate_on_access.get() { module.populate_on_access.set(false); diff --git a/compiler/rustc_resolve/src/macros.rs b/compiler/rustc_resolve/src/macros.rs index 77ef7f56c094..0e8904a7deab 100644 --- a/compiler/rustc_resolve/src/macros.rs +++ b/compiler/rustc_resolve/src/macros.rs @@ -530,7 +530,7 @@ impl<'ra, 'tcx> ResolverExpand for Resolver<'ra, 'tcx> { target_trait.for_each_child(self, |this, ident, ns, _binding| { // FIXME: Adjust hygiene for idents from globs, like for glob imports. if let Some(overriding_keys) = this.impl_binding_keys.get(&impl_def_id) - && overriding_keys.contains(&BindingKey::new(ident.normalize_to_macros_2_0(), ns)) + && overriding_keys.contains(&BindingKey::new(ident, ns)) { // The name is overridden, do not produce it from the glob delegation. } else { From 4b557912af68afa5344e29922457c5df2e784078 Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Mon, 21 Jul 2025 22:55:44 +0300 Subject: [PATCH 125/139] resolve: Change the underscore disambiguator to avoid regressions --- compiler/rustc_resolve/src/imports.rs | 3 ++- compiler/rustc_resolve/src/lib.rs | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/compiler/rustc_resolve/src/imports.rs b/compiler/rustc_resolve/src/imports.rs index b4c15ed1ca7e..783c5005cca9 100644 --- a/compiler/rustc_resolve/src/imports.rs +++ b/compiler/rustc_resolve/src/imports.rs @@ -350,7 +350,8 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { // because they can be fetched by glob imports from those modules, and bring traits // into scope both directly and through glob imports. let key = BindingKey::new_disambiguated(ident, ns, || { - (module.0.0.lazy_resolutions.borrow().len() + 1).try_into().unwrap() + module.underscore_disambiguator.update(|d| d + 1); + module.underscore_disambiguator.get() }); self.update_resolution(module, key, warn_ambiguity, |this, resolution| { if let Some(old_binding) = resolution.best_binding() { diff --git a/compiler/rustc_resolve/src/lib.rs b/compiler/rustc_resolve/src/lib.rs index 948b67a37985..08f1f61ea86e 100644 --- a/compiler/rustc_resolve/src/lib.rs +++ b/compiler/rustc_resolve/src/lib.rs @@ -579,6 +579,8 @@ struct ModuleData<'ra> { lazy_resolutions: Resolutions<'ra>, /// True if this is a module from other crate that needs to be populated on access. populate_on_access: Cell, + /// Used to disambiguate underscore items (`const _: T = ...`) in the module. + underscore_disambiguator: Cell, /// Macro invocations that can expand into items in this module. unexpanded_invocations: RefCell>, @@ -639,6 +641,7 @@ impl<'ra> ModuleData<'ra> { kind, lazy_resolutions: Default::default(), populate_on_access: Cell::new(is_foreign), + underscore_disambiguator: Cell::new(0), unexpanded_invocations: Default::default(), no_implicit_prelude, glob_importers: RefCell::new(Vec::new()), From 37480bc9e6fef8b2a455b07742a1ee4f364f972c Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Mon, 21 Jul 2025 11:20:38 +0200 Subject: [PATCH 126/139] coretests/num: use ldexp instead of hard-coding a power of 2 --- library/coretests/tests/num/dec2flt/float.rs | 11 +++--- .../coretests/tests/num/flt2dec/estimator.rs | 4 ++- library/coretests/tests/num/flt2dec/mod.rs | 34 +++++-------------- library/coretests/tests/num/mod.rs | 21 ++++++++++++ 4 files changed, 38 insertions(+), 32 deletions(-) diff --git a/library/coretests/tests/num/dec2flt/float.rs b/library/coretests/tests/num/dec2flt/float.rs index 193d5887749a..8bf4094ced72 100644 --- a/library/coretests/tests/num/dec2flt/float.rs +++ b/library/coretests/tests/num/dec2flt/float.rs @@ -1,13 +1,14 @@ use core::num::dec2flt::float::RawFloat; +use crate::num::{ldexp_f32, ldexp_f64}; + // FIXME(f16_f128): enable on all targets once possible. #[test] #[cfg(target_has_reliable_f16)] fn test_f16_integer_decode() { assert_eq!(3.14159265359f16.integer_decode(), (1608, -9, 1)); assert_eq!((-8573.5918555f16).integer_decode(), (1072, 3, -1)); - #[cfg(not(miri))] // miri doesn't have powf16 - assert_eq!(2f16.powf(14.0).integer_decode(), (1 << 10, 4, 1)); + assert_eq!(crate::num::ldexp_f16(1.0, 14).integer_decode(), (1 << 10, 4, 1)); assert_eq!(0f16.integer_decode(), (0, -25, 1)); assert_eq!((-0f16).integer_decode(), (0, -25, -1)); assert_eq!(f16::INFINITY.integer_decode(), (1 << 10, 6, 1)); @@ -23,8 +24,7 @@ fn test_f16_integer_decode() { fn test_f32_integer_decode() { assert_eq!(3.14159265359f32.integer_decode(), (13176795, -22, 1)); assert_eq!((-8573.5918555f32).integer_decode(), (8779358, -10, -1)); - // Set 2^100 directly instead of using powf, because it doesn't guarantee precision - assert_eq!(1.2676506e30_f32.integer_decode(), (8388608, 77, 1)); + assert_eq!(ldexp_f32(1.0, 100).integer_decode(), (8388608, 77, 1)); assert_eq!(0f32.integer_decode(), (0, -150, 1)); assert_eq!((-0f32).integer_decode(), (0, -150, -1)); assert_eq!(f32::INFINITY.integer_decode(), (8388608, 105, 1)); @@ -40,8 +40,7 @@ fn test_f32_integer_decode() { fn test_f64_integer_decode() { assert_eq!(3.14159265359f64.integer_decode(), (7074237752028906, -51, 1)); assert_eq!((-8573.5918555f64).integer_decode(), (4713381968463931, -39, -1)); - // Set 2^100 directly instead of using powf, because it doesn't guarantee precision - assert_eq!(1.2676506002282294e30_f64.integer_decode(), (4503599627370496, 48, 1)); + assert_eq!(ldexp_f64(1.0, 100).integer_decode(), (4503599627370496, 48, 1)); assert_eq!(0f64.integer_decode(), (0, -1075, 1)); assert_eq!((-0f64).integer_decode(), (0, -1075, -1)); assert_eq!(f64::INFINITY.integer_decode(), (4503599627370496, 972, 1)); diff --git a/library/coretests/tests/num/flt2dec/estimator.rs b/library/coretests/tests/num/flt2dec/estimator.rs index da203b5f3620..f53282611f68 100644 --- a/library/coretests/tests/num/flt2dec/estimator.rs +++ b/library/coretests/tests/num/flt2dec/estimator.rs @@ -1,5 +1,7 @@ use core::num::flt2dec::estimator::*; +use crate::num::ldexp_f64; + #[test] fn test_estimate_scaling_factor() { macro_rules! assert_almost_eq { @@ -56,7 +58,7 @@ fn test_estimate_scaling_factor() { let step = if cfg!(miri) { 37 } else { 1 }; for i in (-1074..972).step_by(step) { - let expected = super::ldexp_f64(1.0, i).log10().ceil(); + let expected = ldexp_f64(1.0, i).log10().ceil(); assert_almost_eq!(estimate_scaling_factor(1, i as i16), expected as i16); } } diff --git a/library/coretests/tests/num/flt2dec/mod.rs b/library/coretests/tests/num/flt2dec/mod.rs index ce36db33d05f..4e73bd1f12ee 100644 --- a/library/coretests/tests/num/flt2dec/mod.rs +++ b/library/coretests/tests/num/flt2dec/mod.rs @@ -6,6 +6,8 @@ use core::num::fmt::{Formatted, Part}; use std::mem::MaybeUninit; use std::{fmt, str}; +use crate::num::{ldexp_f32, ldexp_f64}; + mod estimator; mod strategy { mod dragon; @@ -75,24 +77,6 @@ macro_rules! try_fixed { }) } -#[cfg(target_has_reliable_f16)] -fn ldexp_f16(a: f16, b: i32) -> f16 { - ldexp_f64(a as f64, b) as f16 -} - -fn ldexp_f32(a: f32, b: i32) -> f32 { - ldexp_f64(a as f64, b) as f32 -} - -fn ldexp_f64(a: f64, b: i32) -> f64 { - unsafe extern "C" { - fn ldexp(x: f64, n: i32) -> f64; - } - // SAFETY: assuming a correct `ldexp` has been supplied, the given arguments cannot possibly - // cause undefined behavior - unsafe { ldexp(a, b) } -} - fn check_exact(mut f: F, v: T, vstr: &str, expected: &[u8], expectedk: i16) where T: DecodableFloat, @@ -268,7 +252,7 @@ where // 10^2 * 0.31984375 // 10^2 * 0.32 // 10^2 * 0.3203125 - check_shortest!(f(ldexp_f16(1.0, 5)) => b"32", 2); + check_shortest!(f(crate::num::ldexp_f16(1.0, 5)) => b"32", 2); // 10^5 * 0.65472 // 10^5 * 0.65504 @@ -283,7 +267,7 @@ where // 10^-9 * 0 // 10^-9 * 0.59604644775390625 // 10^-8 * 0.11920928955078125 - let minf16 = ldexp_f16(1.0, -24); + let minf16 = crate::num::ldexp_f16(1.0, -24); check_shortest!(f(minf16) => b"6", -7); } @@ -292,7 +276,7 @@ pub fn f16_exact_sanity_test(mut f: F) where F: for<'a> FnMut(&Decoded, &'a mut [MaybeUninit], i16) -> (&'a [u8], i16), { - let minf16 = ldexp_f16(1.0, -24); + let minf16 = crate::num::ldexp_f16(1.0, -24); check_exact!(f(0.1f16) => b"999755859375 ", -1); check_exact!(f(0.5f16) => b"5 ", 0); @@ -642,7 +626,7 @@ where assert_eq!(to_string(f, f16::MAX, Minus, 1), "65500.0"); assert_eq!(to_string(f, f16::MAX, Minus, 8), "65500.00000000"); - let minf16 = ldexp_f16(1.0, -24); + let minf16 = crate::num::ldexp_f16(1.0, -24); assert_eq!(to_string(f, minf16, Minus, 0), "0.00000006"); assert_eq!(to_string(f, minf16, Minus, 8), "0.00000006"); assert_eq!(to_string(f, minf16, Minus, 9), "0.000000060"); @@ -766,7 +750,7 @@ where assert_eq!(to_string(f, f16::MAX, Minus, (-4, 4), false), "6.55e4"); assert_eq!(to_string(f, f16::MAX, Minus, (-5, 5), false), "65500"); - let minf16 = ldexp_f16(1.0, -24); + let minf16 = crate::num::ldexp_f16(1.0, -24); assert_eq!(to_string(f, minf16, Minus, (-2, 2), false), "6e-8"); assert_eq!(to_string(f, minf16, Minus, (-7, 7), false), "6e-8"); assert_eq!(to_string(f, minf16, Minus, (-8, 8), false), "0.00000006"); @@ -922,7 +906,7 @@ where assert_eq!(to_string(f, f16::MAX, Minus, 6, false), "6.55040e4"); assert_eq!(to_string(f, f16::MAX, Minus, 16, false), "6.550400000000000e4"); - let minf16 = ldexp_f16(1.0, -24); + let minf16 = crate::num::ldexp_f16(1.0, -24); assert_eq!(to_string(f, minf16, Minus, 1, false), "6e-8"); assert_eq!(to_string(f, minf16, Minus, 2, false), "6.0e-8"); assert_eq!(to_string(f, minf16, Minus, 4, false), "5.960e-8"); @@ -1229,7 +1213,7 @@ where #[cfg(target_has_reliable_f16)] { - let minf16 = ldexp_f16(1.0, -24); + let minf16 = crate::num::ldexp_f16(1.0, -24); assert_eq!(to_string(f, minf16, Minus, 0), "0"); assert_eq!(to_string(f, minf16, Minus, 1), "0.0"); assert_eq!(to_string(f, minf16, Minus, 2), "0.00"); diff --git a/library/coretests/tests/num/mod.rs b/library/coretests/tests/num/mod.rs index f340926292c8..54e54f734f64 100644 --- a/library/coretests/tests/num/mod.rs +++ b/library/coretests/tests/num/mod.rs @@ -54,6 +54,27 @@ macro_rules! assume_usize_width { } } +/// Return `a * 2^b`. +#[cfg(target_has_reliable_f16)] +fn ldexp_f16(a: f16, b: i32) -> f16 { + ldexp_f64(a as f64, b) as f16 +} + +/// Return `a * 2^b`. +fn ldexp_f32(a: f32, b: i32) -> f32 { + ldexp_f64(a as f64, b) as f32 +} + +/// Return `a * 2^b`. +fn ldexp_f64(a: f64, b: i32) -> f64 { + unsafe extern "C" { + fn ldexp(x: f64, n: i32) -> f64; + } + // SAFETY: assuming a correct `ldexp` has been supplied, the given arguments cannot possibly + // cause undefined behavior + unsafe { ldexp(a, b) } +} + /// Helper function for testing numeric operations pub fn test_num(ten: T, two: T) where From 6237e735c4dc165b3efec236e11a44bdccf1dfd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Mon, 21 Jul 2025 16:53:31 +0000 Subject: [PATCH 127/139] Point at the type that doesn't impl `Clone` in more cases beyond closures --- .../rustc_borrowck/src/diagnostics/move_errors.rs | 15 +++++---------- .../closure-shim-borrowck-error.stderr | 7 +++---- .../async-closures/move-out-of-ref.stderr | 5 ++++- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/compiler/rustc_borrowck/src/diagnostics/move_errors.rs b/compiler/rustc_borrowck/src/diagnostics/move_errors.rs index 67dce7615c0d..a0c1f66d35c2 100644 --- a/compiler/rustc_borrowck/src/diagnostics/move_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/move_errors.rs @@ -596,9 +596,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { self.add_move_error_details(err, &binds_to); } // No binding. Nothing to suggest. - GroupedMoveError::OtherIllegalMove { - ref original_path, use_spans, ref kind, .. - } => { + GroupedMoveError::OtherIllegalMove { ref original_path, use_spans, .. } => { let mut use_span = use_spans.var_or_use(); let place_ty = original_path.ty(self.body, self.infcx.tcx).ty; let place_desc = match self.describe_place(original_path.as_ref()) { @@ -616,14 +614,11 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { ); } - if let IllegalMoveOriginKind::BorrowedContent { target_place } = &kind - && let ty = target_place.ty(self.body, self.infcx.tcx).ty - && let ty::Closure(def_id, _) = ty.kind() - && def_id.as_local() == Some(self.mir_def_id()) - && let Some(upvar_field) = self - .prefixes(original_path.as_ref(), PrefixSet::All) - .find_map(|p| self.is_upvar_field_projection(p)) + if let Some(upvar_field) = self + .prefixes(original_path.as_ref(), PrefixSet::All) + .find_map(|p| self.is_upvar_field_projection(p)) { + // Look for the introduction of the original binding being moved. let upvar = &self.upvars[upvar_field.index()]; let upvar_hir_id = upvar.get_root_variable(); use_span = match self.infcx.tcx.parent_hir_node(upvar_hir_id) { diff --git a/tests/ui/async-await/async-closures/closure-shim-borrowck-error.stderr b/tests/ui/async-await/async-closures/closure-shim-borrowck-error.stderr index 03fa220b0bfa..3fe1431fda71 100644 --- a/tests/ui/async-await/async-closures/closure-shim-borrowck-error.stderr +++ b/tests/ui/async-await/async-closures/closure-shim-borrowck-error.stderr @@ -1,14 +1,13 @@ error[E0507]: cannot move out of `x` which is behind a mutable reference --> $DIR/closure-shim-borrowck-error.rs:11:18 | +LL | fn hello(x: Ty) { + | -- move occurs because `x` has type `Ty`, which does not implement the `Copy` trait LL | needs_fn_mut(async || { | ^^^^^^^^ `x` is moved here LL | LL | x.hello(); - | - - | | - | variable moved due to use in coroutine - | move occurs because `x` has type `Ty`, which does not implement the `Copy` trait + | - variable moved due to use in coroutine | note: if `Ty` implemented `Clone`, you could clone the value --> $DIR/closure-shim-borrowck-error.rs:17:1 diff --git a/tests/ui/async-await/async-closures/move-out-of-ref.stderr b/tests/ui/async-await/async-closures/move-out-of-ref.stderr index 8a63515a8a90..d443dc9d4831 100644 --- a/tests/ui/async-await/async-closures/move-out-of-ref.stderr +++ b/tests/ui/async-await/async-closures/move-out-of-ref.stderr @@ -1,8 +1,11 @@ error[E0507]: cannot move out of `*x` which is behind a shared reference --> $DIR/move-out-of-ref.rs:9:9 | +LL | fn hello(x: &Ty) { + | --- move occurs because `*x` has type `Ty`, which does not implement the `Copy` trait +LL | let c = async || { LL | *x; - | ^^ move occurs because `*x` has type `Ty`, which does not implement the `Copy` trait + | ^^ `*x` is moved here | note: if `Ty` implemented `Clone`, you could clone the value --> $DIR/move-out-of-ref.rs:5:1 From a93a9aa2d57564660b2c28e5c1cdda7943989f17 Mon Sep 17 00:00:00 2001 From: Scott McMurray Date: Sun, 20 Jul 2025 00:17:22 -0700 Subject: [PATCH 128/139] Don't emit two `assume`s in transmutes when one is a subset of the other For example, transmuting between `bool` and `Ordering` doesn't need two `assume`s because one range is a superset of the other. Multiple are still used for things like `char` <-> `NonZero`, which overlap but where neither fully contains the other. --- compiler/rustc_abi/src/lib.rs | 22 +++++++ compiler/rustc_abi/src/tests.rs | 63 +++++++++++++++++++ compiler/rustc_codegen_ssa/src/mir/rvalue.rs | 28 +++++++-- .../intrinsics/transmute-niched.rs | 49 ++++++++++++--- 4 files changed, 150 insertions(+), 12 deletions(-) diff --git a/compiler/rustc_abi/src/lib.rs b/compiler/rustc_abi/src/lib.rs index 5bd73502d980..8e346706877d 100644 --- a/compiler/rustc_abi/src/lib.rs +++ b/compiler/rustc_abi/src/lib.rs @@ -1376,6 +1376,28 @@ impl WrappingRange { } } + /// Returns `true` if all the values in `other` are contained in this range, + /// when the values are considered as having width `size`. + #[inline(always)] + pub fn contains_range(&self, other: Self, size: Size) -> bool { + if self.is_full_for(size) { + true + } else { + let trunc = |x| size.truncate(x); + + let delta = self.start; + let max = trunc(self.end.wrapping_sub(delta)); + + let other_start = trunc(other.start.wrapping_sub(delta)); + let other_end = trunc(other.end.wrapping_sub(delta)); + + // Having shifted both input ranges by `delta`, now we only need to check + // whether `0..=max` contains `other_start..=other_end`, which can only + // happen if the other doesn't wrap since `self` isn't everything. + (other_start <= other_end) && (other_end <= max) + } + } + /// Returns `self` with replaced `start` #[inline(always)] fn with_start(mut self, start: u128) -> Self { diff --git a/compiler/rustc_abi/src/tests.rs b/compiler/rustc_abi/src/tests.rs index d993012378c8..d49c2d44af84 100644 --- a/compiler/rustc_abi/src/tests.rs +++ b/compiler/rustc_abi/src/tests.rs @@ -5,3 +5,66 @@ fn align_constants() { assert_eq!(Align::ONE, Align::from_bytes(1).unwrap()); assert_eq!(Align::EIGHT, Align::from_bytes(8).unwrap()); } + +#[test] +fn wrapping_range_contains_range() { + let size16 = Size::from_bytes(16); + + let a = WrappingRange { start: 10, end: 20 }; + assert!(a.contains_range(a, size16)); + assert!(a.contains_range(WrappingRange { start: 11, end: 19 }, size16)); + assert!(a.contains_range(WrappingRange { start: 10, end: 10 }, size16)); + assert!(a.contains_range(WrappingRange { start: 20, end: 20 }, size16)); + assert!(!a.contains_range(WrappingRange { start: 10, end: 21 }, size16)); + assert!(!a.contains_range(WrappingRange { start: 9, end: 20 }, size16)); + assert!(!a.contains_range(WrappingRange { start: 4, end: 6 }, size16)); + assert!(!a.contains_range(WrappingRange { start: 24, end: 26 }, size16)); + + assert!(!a.contains_range(WrappingRange { start: 16, end: 14 }, size16)); + + let b = WrappingRange { start: 20, end: 10 }; + assert!(b.contains_range(b, size16)); + assert!(b.contains_range(WrappingRange { start: 20, end: 20 }, size16)); + assert!(b.contains_range(WrappingRange { start: 10, end: 10 }, size16)); + assert!(b.contains_range(WrappingRange { start: 0, end: 10 }, size16)); + assert!(b.contains_range(WrappingRange { start: 20, end: 30 }, size16)); + assert!(b.contains_range(WrappingRange { start: 20, end: 9 }, size16)); + assert!(b.contains_range(WrappingRange { start: 21, end: 10 }, size16)); + assert!(b.contains_range(WrappingRange { start: 999, end: 9999 }, size16)); + assert!(b.contains_range(WrappingRange { start: 999, end: 9 }, size16)); + assert!(!b.contains_range(WrappingRange { start: 19, end: 19 }, size16)); + assert!(!b.contains_range(WrappingRange { start: 11, end: 11 }, size16)); + assert!(!b.contains_range(WrappingRange { start: 19, end: 11 }, size16)); + assert!(!b.contains_range(WrappingRange { start: 11, end: 19 }, size16)); + + let f = WrappingRange { start: 0, end: u128::MAX }; + assert!(f.contains_range(WrappingRange { start: 10, end: 20 }, size16)); + assert!(f.contains_range(WrappingRange { start: 20, end: 10 }, size16)); + + let g = WrappingRange { start: 2, end: 1 }; + assert!(g.contains_range(WrappingRange { start: 10, end: 20 }, size16)); + assert!(g.contains_range(WrappingRange { start: 20, end: 10 }, size16)); + + let size1 = Size::from_bytes(1); + let u8r = WrappingRange { start: 0, end: 255 }; + let i8r = WrappingRange { start: 128, end: 127 }; + assert!(u8r.contains_range(i8r, size1)); + assert!(i8r.contains_range(u8r, size1)); + assert!(!u8r.contains_range(i8r, size16)); + assert!(i8r.contains_range(u8r, size16)); + + let boolr = WrappingRange { start: 0, end: 1 }; + assert!(u8r.contains_range(boolr, size1)); + assert!(i8r.contains_range(boolr, size1)); + assert!(!boolr.contains_range(u8r, size1)); + assert!(!boolr.contains_range(i8r, size1)); + + let cmpr = WrappingRange { start: 255, end: 1 }; + assert!(u8r.contains_range(cmpr, size1)); + assert!(i8r.contains_range(cmpr, size1)); + assert!(!cmpr.contains_range(u8r, size1)); + assert!(!cmpr.contains_range(i8r, size1)); + + assert!(!boolr.contains_range(cmpr, size1)); + assert!(cmpr.contains_range(boolr, size1)); +} diff --git a/compiler/rustc_codegen_ssa/src/mir/rvalue.rs b/compiler/rustc_codegen_ssa/src/mir/rvalue.rs index 610e2fd23111..a5759b79be45 100644 --- a/compiler/rustc_codegen_ssa/src/mir/rvalue.rs +++ b/compiler/rustc_codegen_ssa/src/mir/rvalue.rs @@ -288,7 +288,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { // valid ranges. For example, `char`s are passed as just `i32`, with no // way for LLVM to know that they're 0x10FFFF at most. Thus we assume // the range of the input value too, not just the output range. - assume_scalar_range(bx, imm, from_scalar, from_backend_ty); + assume_scalar_range(bx, imm, from_scalar, from_backend_ty, None); imm = match (from_scalar.primitive(), to_scalar.primitive()) { (Int(_, is_signed), Int(..)) => bx.intcast(imm, to_backend_ty, is_signed), @@ -1064,7 +1064,7 @@ pub(super) fn transmute_scalar<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( // That said, last time we tried removing this, it didn't actually help // the rustc-perf results, so might as well keep doing it // - assume_scalar_range(bx, imm, from_scalar, from_backend_ty); + assume_scalar_range(bx, imm, from_scalar, from_backend_ty, Some(&to_scalar)); imm = match (from_scalar.primitive(), to_scalar.primitive()) { (Int(..) | Float(_), Int(..) | Float(_)) => bx.bitcast(imm, to_backend_ty), @@ -1092,22 +1092,42 @@ pub(super) fn transmute_scalar<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( // since it's never passed to something with parameter metadata (especially // after MIR inlining) so the only way to tell the backend about the // constraint that the `transmute` introduced is to `assume` it. - assume_scalar_range(bx, imm, to_scalar, to_backend_ty); + assume_scalar_range(bx, imm, to_scalar, to_backend_ty, Some(&from_scalar)); imm = bx.to_immediate_scalar(imm, to_scalar); imm } +/// Emits an `assume` call that `imm`'s value is within the known range of `scalar`. +/// +/// If `known` is `Some`, only emits the assume if it's more specific than +/// whatever is already known from the range of *that* scalar. fn assume_scalar_range<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( bx: &mut Bx, imm: Bx::Value, scalar: abi::Scalar, backend_ty: Bx::Type, + known: Option<&abi::Scalar>, ) { - if matches!(bx.cx().sess().opts.optimize, OptLevel::No) || scalar.is_always_valid(bx.cx()) { + if matches!(bx.cx().sess().opts.optimize, OptLevel::No) { return; } + match (scalar, known) { + (abi::Scalar::Union { .. }, _) => return, + (_, None) => { + if scalar.is_always_valid(bx.cx()) { + return; + } + } + (abi::Scalar::Initialized { valid_range, .. }, Some(known)) => { + let known_range = known.valid_range(bx.cx()); + if valid_range.contains_range(known_range, scalar.size(bx.cx())) { + return; + } + } + } + match scalar.primitive() { abi::Primitive::Int(..) => { let range = scalar.valid_range(bx.cx()); diff --git a/tests/codegen-llvm/intrinsics/transmute-niched.rs b/tests/codegen-llvm/intrinsics/transmute-niched.rs index 8ff5cc8ee4f4..a886d9eee590 100644 --- a/tests/codegen-llvm/intrinsics/transmute-niched.rs +++ b/tests/codegen-llvm/intrinsics/transmute-niched.rs @@ -163,11 +163,8 @@ pub unsafe fn check_swap_pair(x: (char, NonZero)) -> (NonZero, char) { pub unsafe fn check_bool_from_ordering(x: std::cmp::Ordering) -> bool { // CHECK-NOT: icmp // CHECK-NOT: assume - // OPT: %0 = sub i8 %x, -1 - // OPT: %1 = icmp ule i8 %0, 2 - // OPT: call void @llvm.assume(i1 %1) - // OPT: %2 = icmp ule i8 %x, 1 - // OPT: call void @llvm.assume(i1 %2) + // OPT: %0 = icmp ule i8 %x, 1 + // OPT: call void @llvm.assume(i1 %0) // CHECK-NOT: icmp // CHECK-NOT: assume // CHECK: %[[R:.+]] = trunc{{( nuw)?}} i8 %x to i1 @@ -184,9 +181,6 @@ pub unsafe fn check_bool_to_ordering(x: bool) -> std::cmp::Ordering { // CHECK-NOT: assume // OPT: %0 = icmp ule i8 %_0, 1 // OPT: call void @llvm.assume(i1 %0) - // OPT: %1 = sub i8 %_0, -1 - // OPT: %2 = icmp ule i8 %1, 2 - // OPT: call void @llvm.assume(i1 %2) // CHECK-NOT: icmp // CHECK-NOT: assume // CHECK: ret i8 %_0 @@ -221,3 +215,42 @@ pub unsafe fn check_ptr_to_nonnull(x: *const u8) -> NonNull { transmute(x) } + +#[repr(usize)] +pub enum FourOrEight { + Four = 4, + Eight = 8, +} + +// CHECK-LABEL: @check_nonnull_to_four_or_eight( +#[no_mangle] +pub unsafe fn check_nonnull_to_four_or_eight(x: NonNull) -> FourOrEight { + // CHECK: start + // CHECK-NEXT: %[[RET:.+]] = ptrtoint ptr %x to i64 + // CHECK-NOT: icmp + // CHECK-NOT: assume + // OPT: %0 = sub i64 %[[RET]], 4 + // OPT: %1 = icmp ule i64 %0, 4 + // OPT: call void @llvm.assume(i1 %1) + // CHECK-NOT: icmp + // CHECK-NOT: assume + // CHECK: ret i64 %[[RET]] + + transmute(x) +} + +// CHECK-LABEL: @check_four_or_eight_to_nonnull( +#[no_mangle] +pub unsafe fn check_four_or_eight_to_nonnull(x: FourOrEight) -> NonNull { + // CHECK-NOT: icmp + // CHECK-NOT: assume + // OPT: %0 = sub i64 %x, 4 + // OPT: %1 = icmp ule i64 %0, 4 + // OPT: call void @llvm.assume(i1 %1) + // CHECK-NOT: icmp + // CHECK-NOT: assume + // CHECK: %[[RET:.+]] = getelementptr i8, ptr null, i64 %x + // CHECK-NEXT: ret ptr %[[RET]] + + transmute(x) +} From 9ff071219bca913e45235568defadd5ab840c50a Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Fri, 13 Oct 2023 20:20:57 +0000 Subject: [PATCH 129/139] Give an AllocId to ConstValue::Slice. --- .../rustc_codegen_cranelift/src/constant.rs | 3 +- compiler/rustc_codegen_ssa/src/mir/operand.rs | 7 +-- .../src/const_eval/eval_queries.rs | 3 +- .../src/interpret/intrinsics.rs | 20 +++---- .../rustc_const_eval/src/interpret/operand.rs | 3 +- compiler/rustc_middle/src/mir/consts.rs | 54 ++++++++++--------- compiler/rustc_middle/src/mir/pretty.rs | 6 +-- compiler/rustc_middle/src/ty/context.rs | 8 ++- .../rustc_middle/src/ty/structural_impls.rs | 8 +++ .../src/builder/expr/as_constant.rs | 41 +++++++++----- compiler/rustc_monomorphize/src/collector.rs | 6 +-- compiler/rustc_public/src/alloc.rs | 4 +- compiler/rustc_public_bridge/src/alloc.rs | 3 +- .../issue_101867.main.built.after.mir | 4 ++ ...e_live_dead_in_statics.XXX.built.after.mir | 4 ++ ..._type_annotations.let_else.built.after.mir | 6 +++ ...otations.let_else_bindless.built.after.mir | 6 +++ .../const_debuginfo.main.SingleUseConsts.diff | 2 + ..._simplification.hello.GVN.panic-abort.diff | 4 ++ ...simplification.hello.GVN.panic-unwind.diff | 4 ++ ...ion.main.DeadStoreElimination-initial.diff | 8 +++ .../gvn.duplicate_slice.GVN.panic-abort.diff | 20 ++++--- .../gvn.duplicate_slice.GVN.panic-unwind.diff | 20 ++++--- .../gvn.fn_pointers.GVN.panic-abort.diff | 18 +++---- .../gvn.fn_pointers.GVN.panic-unwind.diff | 18 +++---- tests/mir-opt/gvn.rs | 19 +++---- tests/mir-opt/gvn.slices.GVN.panic-abort.diff | 14 +++-- .../mir-opt/gvn.slices.GVN.panic-unwind.diff | 14 +++-- .../gvn.wrap_unwrap.GVN.panic-abort.diff | 2 + .../gvn.wrap_unwrap.GVN.panic-unwind.diff | 2 + ...inline_diverging.g.Inline.panic-abort.diff | 4 ++ ...nline_diverging.g.Inline.panic-unwind.diff | 4 ++ ...y.run2-{closure#0}.Inline.panic-abort.diff | 9 +++- ....run2-{closure#0}.Inline.panic-unwind.diff | 9 +++- ...y.strs.InstSimplify-after-simplifycfg.diff | 4 ++ ...implifyComparisonIntegral.panic-abort.diff | 6 +++ ...mplifyComparisonIntegral.panic-unwind.diff | 6 +++ ...fg-pre-optimizations.after.panic-abort.mir | 4 ++ ...g-pre-optimizations.after.panic-unwind.mir | 4 ++ ...main.ElaborateDrops.before.panic-abort.mir | 2 + ...ain.ElaborateDrops.before.panic-unwind.mir | 2 + ...d_constant.main.GVN.32bit.panic-abort.diff | 15 ++++-- ...d_constant.main.GVN.64bit.panic-abort.diff | 15 ++++-- ...tch_const.SingleUseConsts.panic-abort.diff | 12 +++++ ...ch_const.SingleUseConsts.panic-unwind.diff | 12 +++++ ...nst_debug.SingleUseConsts.panic-abort.diff | 12 +++++ ...st_debug.SingleUseConsts.panic-unwind.diff | 12 +++++ ...ts.flat.ScalarReplacementOfAggregates.diff | 4 ++ ....UnreachableEnumBranching.panic-abort.diff | 16 ++++++ ...UnreachableEnumBranching.panic-unwind.diff | 16 ++++++ ....UnreachableEnumBranching.panic-abort.diff | 8 +++ ...UnreachableEnumBranching.panic-unwind.diff | 8 +++ ....UnreachableEnumBranching.panic-abort.diff | 12 +++++ ...UnreachableEnumBranching.panic-unwind.diff | 12 +++++ ....UnreachableEnumBranching.panic-abort.diff | 8 +++ ...UnreachableEnumBranching.panic-unwind.diff | 8 +++ ....UnreachableEnumBranching.panic-abort.diff | 12 +++++ ...UnreachableEnumBranching.panic-unwind.diff | 12 +++++ ....UnreachableEnumBranching.panic-abort.diff | 12 +++++ ...UnreachableEnumBranching.panic-unwind.diff | 12 +++++ ....UnreachableEnumBranching.panic-abort.diff | 16 ++++++ ...UnreachableEnumBranching.panic-unwind.diff | 16 ++++++ ....UnreachableEnumBranching.panic-abort.diff | 20 +++++++ ...UnreachableEnumBranching.panic-unwind.diff | 20 +++++++ ....UnreachableEnumBranching.panic-abort.diff | 16 ++++++ ...UnreachableEnumBranching.panic-unwind.diff | 16 ++++++ ....UnreachableEnumBranching.panic-abort.diff | 12 +++++ ...UnreachableEnumBranching.panic-unwind.diff | 12 +++++ 68 files changed, 595 insertions(+), 136 deletions(-) diff --git a/compiler/rustc_codegen_cranelift/src/constant.rs b/compiler/rustc_codegen_cranelift/src/constant.rs index 85adf0f3716b..a7e9d7c7bae5 100644 --- a/compiler/rustc_codegen_cranelift/src/constant.rs +++ b/compiler/rustc_codegen_cranelift/src/constant.rs @@ -210,8 +210,7 @@ pub(crate) fn codegen_const_value<'tcx>( .offset_i64(fx, i64::try_from(offset.bytes()).unwrap()), layout, ), - ConstValue::Slice { data, meta } => { - let alloc_id = fx.tcx.reserve_and_set_memory_alloc(data); + ConstValue::Slice { alloc_id, meta, phantom: _ } => { let ptr = pointer_for_allocation(fx, alloc_id).get_addr(fx); let len = fx.bcx.ins().iconst(fx.pointer_type, meta as i64); CValue::by_val_pair(ptr, len, layout) diff --git a/compiler/rustc_codegen_ssa/src/mir/operand.rs b/compiler/rustc_codegen_ssa/src/mir/operand.rs index 06bedaaa4a27..41cdd4dd980a 100644 --- a/compiler/rustc_codegen_ssa/src/mir/operand.rs +++ b/compiler/rustc_codegen_ssa/src/mir/operand.rs @@ -154,14 +154,11 @@ impl<'a, 'tcx, V: CodegenObject> OperandRef<'tcx, V> { OperandValue::Immediate(llval) } ConstValue::ZeroSized => return OperandRef::zero_sized(layout), - ConstValue::Slice { data, meta } => { + ConstValue::Slice { alloc_id, meta, phantom: _ } => { let BackendRepr::ScalarPair(a_scalar, _) = layout.backend_repr else { bug!("from_const: invalid ScalarPair layout: {:#?}", layout); }; - let a = Scalar::from_pointer( - Pointer::new(bx.tcx().reserve_and_set_memory_alloc(data).into(), Size::ZERO), - &bx.tcx(), - ); + let a = Scalar::from_pointer(Pointer::new(alloc_id.into(), Size::ZERO), &bx.tcx()); let a_llval = bx.scalar_to_backend( a, a_scalar, diff --git a/compiler/rustc_const_eval/src/const_eval/eval_queries.rs b/compiler/rustc_const_eval/src/const_eval/eval_queries.rs index f584f6c948e5..0b311d36975b 100644 --- a/compiler/rustc_const_eval/src/const_eval/eval_queries.rs +++ b/compiler/rustc_const_eval/src/const_eval/eval_queries.rs @@ -241,10 +241,9 @@ pub(super) fn op_to_const<'tcx>( let (prov, offset) = ptr.into_pointer_or_addr().expect(msg).prov_and_relative_offset(); let alloc_id = prov.alloc_id(); - let data = ecx.tcx.global_alloc(alloc_id).unwrap_memory(); assert!(offset == abi::Size::ZERO, "{}", msg); let meta = b.to_target_usize(ecx).expect(msg); - ConstValue::Slice { data, meta } + ConstValue::Slice { alloc_id, meta, phantom: std::marker::PhantomData } } Immediate::Uninit => bug!("`Uninit` is not a valid value for {}", op.layout.ty), }, diff --git a/compiler/rustc_const_eval/src/interpret/intrinsics.rs b/compiler/rustc_const_eval/src/interpret/intrinsics.rs index e24a355891db..b1e9f1e8bd26 100644 --- a/compiler/rustc_const_eval/src/interpret/intrinsics.rs +++ b/compiler/rustc_const_eval/src/interpret/intrinsics.rs @@ -3,10 +3,11 @@ //! and miri. use std::assert_matches::assert_matches; +use std::marker::PhantomData; use rustc_abi::{FieldIdx, HasDataLayout, Size}; use rustc_apfloat::ieee::{Double, Half, Quad, Single}; -use rustc_middle::mir::interpret::{read_target_uint, write_target_uint}; +use rustc_middle::mir::interpret::{CTFE_ALLOC_SALT, read_target_uint, write_target_uint}; use rustc_middle::mir::{self, BinOp, ConstValue, NonDivergingIntrinsic}; use rustc_middle::ty::layout::TyAndLayout; use rustc_middle::ty::{Ty, TyCtxt}; @@ -17,17 +18,18 @@ use tracing::trace; use super::memory::MemoryKind; use super::util::ensure_monomorphic_enough; use super::{ - Allocation, CheckInAllocMsg, ConstAllocation, ImmTy, InterpCx, InterpResult, Machine, OpTy, - PlaceTy, Pointer, PointerArithmetic, Provenance, Scalar, err_ub_custom, err_unsup_format, - interp_ok, throw_inval, throw_ub_custom, throw_ub_format, + AllocId, CheckInAllocMsg, ImmTy, InterpCx, InterpResult, Machine, OpTy, PlaceTy, Pointer, + PointerArithmetic, Provenance, Scalar, err_ub_custom, err_unsup_format, interp_ok, throw_inval, + throw_ub_custom, throw_ub_format, }; use crate::fluent_generated as fluent; /// Directly returns an `Allocation` containing an absolute path representation of the given type. -pub(crate) fn alloc_type_name<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> ConstAllocation<'tcx> { +pub(crate) fn alloc_type_name<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> (AllocId, u64) { let path = crate::util::type_name(tcx, ty); - let alloc = Allocation::from_bytes_byte_aligned_immutable(path.into_bytes(), ()); - tcx.mk_const_alloc(alloc) + let bytes = path.into_bytes(); + let len = bytes.len().try_into().unwrap(); + (tcx.allocate_bytes_dedup(bytes, CTFE_ALLOC_SALT), len) } impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> { /// Generates a value of `TypeId` for `ty` in-place. @@ -126,8 +128,8 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> { sym::type_name => { let tp_ty = instance.args.type_at(0); ensure_monomorphic_enough(tcx, tp_ty)?; - let alloc = alloc_type_name(tcx, tp_ty); - let val = ConstValue::Slice { data: alloc, meta: alloc.inner().size().bytes() }; + let (alloc_id, meta) = alloc_type_name(tcx, tp_ty); + let val = ConstValue::Slice { alloc_id, meta, phantom: PhantomData }; let val = self.const_val_to_op(val, dest.layout.ty, Some(dest.layout))?; self.copy_op(&val, dest)?; } diff --git a/compiler/rustc_const_eval/src/interpret/operand.rs b/compiler/rustc_const_eval/src/interpret/operand.rs index 62cbbae24a8f..ed48e6799e67 100644 --- a/compiler/rustc_const_eval/src/interpret/operand.rs +++ b/compiler/rustc_const_eval/src/interpret/operand.rs @@ -860,9 +860,8 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> { } mir::ConstValue::Scalar(x) => adjust_scalar(x)?.into(), mir::ConstValue::ZeroSized => Immediate::Uninit, - mir::ConstValue::Slice { data, meta } => { + mir::ConstValue::Slice { alloc_id, meta, phantom: _ } => { // This is const data, no mutation allowed. - let alloc_id = self.tcx.reserve_and_set_memory_alloc(data); let ptr = Pointer::new(CtfeProvenance::from(alloc_id).as_immutable(), Size::ZERO); Immediate::new_slice(self.global_root_pointer(ptr)?.into(), meta, self) } diff --git a/compiler/rustc_middle/src/mir/consts.rs b/compiler/rustc_middle/src/mir/consts.rs index fb941977528d..0be274511dca 100644 --- a/compiler/rustc_middle/src/mir/consts.rs +++ b/compiler/rustc_middle/src/mir/consts.rs @@ -9,9 +9,7 @@ use rustc_span::{DUMMY_SP, Span, Symbol}; use rustc_type_ir::TypeVisitableExt; use super::interpret::ReportedErrorInfo; -use crate::mir::interpret::{ - AllocId, AllocRange, ConstAllocation, ErrorHandled, GlobalAlloc, Scalar, alloc_range, -}; +use crate::mir::interpret::{AllocId, AllocRange, ErrorHandled, GlobalAlloc, Scalar, alloc_range}; use crate::mir::{Promoted, pretty_print_const_value}; use crate::ty::print::{pretty_print_const, with_no_trimmed_paths}; use crate::ty::{self, ConstKind, GenericArgsRef, ScalarInt, Ty, TyCtxt}; @@ -32,8 +30,8 @@ pub struct ConstAlloc<'tcx> { /// Represents a constant value in Rust. `Scalar` and `Slice` are optimizations for /// array length computations, enum discriminants and the pattern matching logic. -#[derive(Copy, Clone, Debug, Eq, PartialEq, TyEncodable, TyDecodable, Hash)] -#[derive(HashStable, Lift)] +#[derive(Copy, Clone, Debug, Eq, PartialEq, TyEncodable, TyDecodable, Lift, Hash)] +#[derive(HashStable)] pub enum ConstValue<'tcx> { /// Used for types with `layout::abi::Scalar` ABI. /// @@ -52,10 +50,11 @@ pub enum ConstValue<'tcx> { Slice { /// The allocation storing the slice contents. /// This always points to the beginning of the allocation. - data: ConstAllocation<'tcx>, + alloc_id: AllocId, /// The metadata field of the reference. /// This is a "target usize", so we use `u64` as in the interpreter. meta: u64, + phantom: std::marker::PhantomData<&'tcx ()>, }, /// A value not representable by the other variants; needs to be stored in-memory. @@ -77,7 +76,7 @@ pub enum ConstValue<'tcx> { #[cfg(target_pointer_width = "64")] rustc_data_structures::static_assert_size!(ConstValue<'_>, 24); -impl<'tcx> ConstValue<'tcx> { +impl ConstValue<'_> { #[inline] pub fn try_to_scalar(&self) -> Option { match *self { @@ -98,11 +97,11 @@ impl<'tcx> ConstValue<'tcx> { self.try_to_scalar_int()?.try_into().ok() } - pub fn try_to_target_usize(&self, tcx: TyCtxt<'tcx>) -> Option { + pub fn try_to_target_usize(&self, tcx: TyCtxt<'_>) -> Option { Some(self.try_to_scalar_int()?.to_target_usize(tcx)) } - pub fn try_to_bits_for_ty( + pub fn try_to_bits_for_ty<'tcx>( &self, tcx: TyCtxt<'tcx>, typing_env: ty::TypingEnv<'tcx>, @@ -132,12 +131,15 @@ impl<'tcx> ConstValue<'tcx> { } /// Must only be called on constants of type `&str` or `&[u8]`! - pub fn try_get_slice_bytes_for_diagnostics(&self, tcx: TyCtxt<'tcx>) -> Option<&'tcx [u8]> { - let (data, start, end) = match self { + pub fn try_get_slice_bytes_for_diagnostics<'tcx>( + &self, + tcx: TyCtxt<'tcx>, + ) -> Option<&'tcx [u8]> { + let (alloc_id, start, len) = match self { ConstValue::Scalar(_) | ConstValue::ZeroSized => { bug!("`try_get_slice_bytes` on non-slice constant") } - &ConstValue::Slice { data, meta } => (data, 0, meta), + &ConstValue::Slice { alloc_id, meta, phantom: _ } => (alloc_id, 0, meta), &ConstValue::Indirect { alloc_id, offset } => { // The reference itself is stored behind an indirection. // Load the reference, and then load the actual slice contents. @@ -170,26 +172,29 @@ impl<'tcx> ConstValue<'tcx> { // Non-empty slice, must have memory. We know this is a relative pointer. let (inner_prov, offset) = ptr.into_pointer_or_addr().ok()?.prov_and_relative_offset(); - let data = tcx.global_alloc(inner_prov.alloc_id()).unwrap_memory(); - (data, offset.bytes(), offset.bytes() + len) + (inner_prov.alloc_id(), offset.bytes(), len) } }; + let data = tcx.global_alloc(alloc_id).unwrap_memory(); + // This is for diagnostics only, so we are okay to use `inspect_with_uninit_and_ptr_outside_interpreter`. let start = start.try_into().unwrap(); - let end = end.try_into().unwrap(); + let end = start + usize::try_from(len).unwrap(); Some(data.inner().inspect_with_uninit_and_ptr_outside_interpreter(start..end)) } /// Check if a constant may contain provenance information. This is used by MIR opts. /// Can return `true` even if there is no provenance. - pub fn may_have_provenance(&self, tcx: TyCtxt<'tcx>, size: Size) -> bool { + pub fn may_have_provenance(&self, tcx: TyCtxt<'_>, size: Size) -> bool { match *self { ConstValue::ZeroSized | ConstValue::Scalar(Scalar::Int(_)) => return false, ConstValue::Scalar(Scalar::Ptr(..)) => return true, // It's hard to find out the part of the allocation we point to; // just conservatively check everything. - ConstValue::Slice { data, meta: _ } => !data.inner().provenance().ptrs().is_empty(), + ConstValue::Slice { alloc_id, meta: _, phantom: _ } => { + !tcx.global_alloc(alloc_id).unwrap_memory().inner().provenance().ptrs().is_empty() + } ConstValue::Indirect { alloc_id, offset } => !tcx .global_alloc(alloc_id) .unwrap_memory() @@ -200,7 +205,7 @@ impl<'tcx> ConstValue<'tcx> { } /// Check if a constant only contains uninitialized bytes. - pub fn all_bytes_uninit(&self, tcx: TyCtxt<'tcx>) -> bool { + pub fn all_bytes_uninit(&self, tcx: TyCtxt<'_>) -> bool { let ConstValue::Indirect { alloc_id, .. } = self else { return false; }; @@ -487,9 +492,8 @@ impl<'tcx> Const<'tcx> { /// taking into account even pointer identity tests. pub fn is_deterministic(&self) -> bool { // Some constants may generate fresh allocations for pointers they contain, - // so using the same constant twice can yield two different results: - // - valtrees purposefully generate new allocations - // - ConstValue::Slice also generate new allocations + // so using the same constant twice can yield two different results. + // Notably, valtrees purposefully generate new allocations. match self { Const::Ty(_, c) => match c.kind() { ty::ConstKind::Param(..) => true, @@ -507,11 +511,11 @@ impl<'tcx> Const<'tcx> { | ty::ConstKind::Placeholder(..) => bug!(), }, Const::Unevaluated(..) => false, - // If the same slice appears twice in the MIR, we cannot guarantee that we will - // give the same `AllocId` to the data. - Const::Val(ConstValue::Slice { .. }, _) => false, Const::Val( - ConstValue::ZeroSized | ConstValue::Scalar(_) | ConstValue::Indirect { .. }, + ConstValue::Slice { .. } + | ConstValue::ZeroSized + | ConstValue::Scalar(_) + | ConstValue::Indirect { .. }, _, ) => true, } diff --git a/compiler/rustc_middle/src/mir/pretty.rs b/compiler/rustc_middle/src/mir/pretty.rs index 8e403dfddaed..045b27396f11 100644 --- a/compiler/rustc_middle/src/mir/pretty.rs +++ b/compiler/rustc_middle/src/mir/pretty.rs @@ -1567,11 +1567,7 @@ pub fn write_allocations<'tcx>( ConstValue::Scalar(interpret::Scalar::Ptr(ptr, _)) => Some(ptr.provenance.alloc_id()), ConstValue::Scalar(interpret::Scalar::Int { .. }) => None, ConstValue::ZeroSized => None, - ConstValue::Slice { .. } => { - // `u8`/`str` slices, shouldn't contain pointers that we want to print. - None - } - ConstValue::Indirect { alloc_id, .. } => { + ConstValue::Slice { alloc_id, .. } | ConstValue::Indirect { alloc_id, .. } => { // FIXME: we don't actually want to print all of these, since some are printed nicely directly as values inline in MIR. // Really we'd want `pretty_print_const_value` to decide which allocations to print, instead of having a separate visitor. Some(alloc_id) diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs index 51db92ecd78f..aa2494a4f61b 100644 --- a/compiler/rustc_middle/src/ty/context.rs +++ b/compiler/rustc_middle/src/ty/context.rs @@ -5,7 +5,7 @@ pub mod tls; use std::assert_matches::debug_assert_matches; -use std::borrow::Borrow; +use std::borrow::{Borrow, Cow}; use std::cmp::Ordering; use std::env::VarError; use std::ffi::OsStr; @@ -1625,7 +1625,11 @@ impl<'tcx> TyCtxt<'tcx> { /// Allocates a read-only byte or string literal for `mir::interpret` with alignment 1. /// Returns the same `AllocId` if called again with the same bytes. - pub fn allocate_bytes_dedup(self, bytes: &[u8], salt: usize) -> interpret::AllocId { + pub fn allocate_bytes_dedup<'a>( + self, + bytes: impl Into>, + salt: usize, + ) -> interpret::AllocId { // Create an allocation that just contains these bytes. let alloc = interpret::Allocation::from_bytes_byte_aligned_immutable(bytes, ()); let alloc = self.mk_const_alloc(alloc); diff --git a/compiler/rustc_middle/src/ty/structural_impls.rs b/compiler/rustc_middle/src/ty/structural_impls.rs index ab31d9434080..2dfc2a2190fa 100644 --- a/compiler/rustc_middle/src/ty/structural_impls.rs +++ b/compiler/rustc_middle/src/ty/structural_impls.rs @@ -4,6 +4,7 @@ //! to help with the tedium. use std::fmt::{self, Debug}; +use std::marker::PhantomData; use rustc_abi::TyAndLayout; use rustc_hir::def::Namespace; @@ -311,6 +312,13 @@ TrivialTypeTraversalAndLiftImpls! { /////////////////////////////////////////////////////////////////////////// // Lift implementations +impl<'tcx> Lift> for PhantomData<&()> { + type Lifted = PhantomData<&'tcx ()>; + fn lift_to_interner(self, _: TyCtxt<'tcx>) -> Option { + Some(PhantomData) + } +} + impl<'tcx, T: Lift>> Lift> for Option { type Lifted = Option; fn lift_to_interner(self, tcx: TyCtxt<'tcx>) -> Option { diff --git a/compiler/rustc_mir_build/src/builder/expr/as_constant.rs b/compiler/rustc_mir_build/src/builder/expr/as_constant.rs index d0d0c21463f8..4a532c3bb2db 100644 --- a/compiler/rustc_mir_build/src/builder/expr/as_constant.rs +++ b/compiler/rustc_mir_build/src/builder/expr/as_constant.rs @@ -1,9 +1,11 @@ //! See docs in build/expr/mod.rs +use std::marker::PhantomData; + use rustc_abi::Size; use rustc_ast as ast; use rustc_hir::LangItem; -use rustc_middle::mir::interpret::{Allocation, CTFE_ALLOC_SALT, LitToConstInput, Scalar}; +use rustc_middle::mir::interpret::{CTFE_ALLOC_SALT, LitToConstInput, Scalar}; use rustc_middle::mir::*; use rustc_middle::thir::*; use rustc_middle::ty::{ @@ -120,17 +122,26 @@ fn lit_to_mir_constant<'tcx>(tcx: TyCtxt<'tcx>, lit_input: LitToConstInput<'tcx> let value = match (lit, lit_ty.kind()) { (ast::LitKind::Str(s, _), ty::Ref(_, inner_ty, _)) if inner_ty.is_str() => { - let s = s.as_str(); - let allocation = Allocation::from_bytes_byte_aligned_immutable(s.as_bytes(), ()); - let allocation = tcx.mk_const_alloc(allocation); - ConstValue::Slice { data: allocation, meta: allocation.inner().size().bytes() } + let s = s.as_str().as_bytes(); + let len = s.len(); + let allocation = tcx.allocate_bytes_dedup(s, CTFE_ALLOC_SALT); + ConstValue::Slice { + alloc_id: allocation, + meta: len.try_into().unwrap(), + phantom: PhantomData, + } } - (ast::LitKind::ByteStr(data, _), ty::Ref(_, inner_ty, _)) + (ast::LitKind::ByteStr(byte_sym, _), ty::Ref(_, inner_ty, _)) if matches!(inner_ty.kind(), ty::Slice(_)) => { - let allocation = Allocation::from_bytes_byte_aligned_immutable(data.as_byte_str(), ()); - let allocation = tcx.mk_const_alloc(allocation); - ConstValue::Slice { data: allocation, meta: allocation.inner().size().bytes() } + let data = byte_sym.as_byte_str(); + let len = data.len(); + let allocation = tcx.allocate_bytes_dedup(data, CTFE_ALLOC_SALT); + ConstValue::Slice { + alloc_id: allocation, + meta: len.try_into().unwrap(), + phantom: PhantomData, + } } (ast::LitKind::ByteStr(byte_sym, _), ty::Ref(_, inner_ty, _)) if inner_ty.is_array() => { let id = tcx.allocate_bytes_dedup(byte_sym.as_byte_str(), CTFE_ALLOC_SALT); @@ -138,10 +149,14 @@ fn lit_to_mir_constant<'tcx>(tcx: TyCtxt<'tcx>, lit_input: LitToConstInput<'tcx> } (ast::LitKind::CStr(byte_sym, _), ty::Ref(_, inner_ty, _)) if matches!(inner_ty.kind(), ty::Adt(def, _) if tcx.is_lang_item(def.did(), LangItem::CStr)) => { - let allocation = - Allocation::from_bytes_byte_aligned_immutable(byte_sym.as_byte_str(), ()); - let allocation = tcx.mk_const_alloc(allocation); - ConstValue::Slice { data: allocation, meta: allocation.inner().size().bytes() } + let data = byte_sym.as_byte_str(); + let len = data.len(); + let allocation = tcx.allocate_bytes_dedup(data, CTFE_ALLOC_SALT); + ConstValue::Slice { + alloc_id: allocation, + meta: len.try_into().unwrap(), + phantom: PhantomData, + } } (ast::LitKind::Byte(n), ty::Uint(ty::UintTy::U8)) => { ConstValue::Scalar(Scalar::from_uint(n, Size::from_bytes(1))) diff --git a/compiler/rustc_monomorphize/src/collector.rs b/compiler/rustc_monomorphize/src/collector.rs index 91c8e64ce9af..41457f417f2c 100644 --- a/compiler/rustc_monomorphize/src/collector.rs +++ b/compiler/rustc_monomorphize/src/collector.rs @@ -1363,10 +1363,8 @@ fn collect_const_value<'tcx>( collect_alloc(tcx, ptr.provenance.alloc_id(), output) } mir::ConstValue::Indirect { alloc_id, .. } => collect_alloc(tcx, alloc_id, output), - mir::ConstValue::Slice { data, meta: _ } => { - for &prov in data.inner().provenance().ptrs().values() { - collect_alloc(tcx, prov.alloc_id(), output); - } + mir::ConstValue::Slice { alloc_id, meta: _, phantom: _ } => { + collect_alloc(tcx, alloc_id, output); } _ => {} } diff --git a/compiler/rustc_public/src/alloc.rs b/compiler/rustc_public/src/alloc.rs index 75ad31022ff5..0174e2e00985 100644 --- a/compiler/rustc_public/src/alloc.rs +++ b/compiler/rustc_public/src/alloc.rs @@ -54,8 +54,8 @@ pub(crate) fn try_new_allocation<'tcx>( alloc::try_new_scalar(layout, scalar, cx).map(|alloc| alloc.stable(tables, cx)) } ConstValue::ZeroSized => Ok(new_empty_allocation(layout.align.abi)), - ConstValue::Slice { data, meta } => { - alloc::try_new_slice(layout, data, meta, cx).map(|alloc| alloc.stable(tables, cx)) + ConstValue::Slice { alloc_id, meta, phantom: _ } => { + alloc::try_new_slice(layout, alloc_id, meta, cx).map(|alloc| alloc.stable(tables, cx)) } ConstValue::Indirect { alloc_id, offset } => { let alloc = alloc::try_new_indirect(alloc_id, cx); diff --git a/compiler/rustc_public_bridge/src/alloc.rs b/compiler/rustc_public_bridge/src/alloc.rs index ecf9004562c2..7e6af3425465 100644 --- a/compiler/rustc_public_bridge/src/alloc.rs +++ b/compiler/rustc_public_bridge/src/alloc.rs @@ -38,11 +38,10 @@ pub fn try_new_scalar<'tcx, B: Bridge>( pub fn try_new_slice<'tcx, B: Bridge>( layout: TyAndLayout<'tcx, Ty<'tcx>>, - data: ConstAllocation<'tcx>, + alloc_id: AllocId, meta: u64, cx: &CompilerCtxt<'tcx, B>, ) -> Result { - let alloc_id = cx.tcx.reserve_and_set_memory_alloc(data); let ptr = Pointer::new(alloc_id.into(), Size::ZERO); let scalar_ptr = Scalar::from_pointer(ptr, &cx.tcx); let scalar_meta: Scalar = Scalar::from_target_usize(meta, &cx.tcx); diff --git a/tests/mir-opt/building/issue_101867.main.built.after.mir b/tests/mir-opt/building/issue_101867.main.built.after.mir index dd1d093c4dba..e59b23fdd20b 100644 --- a/tests/mir-opt/building/issue_101867.main.built.after.mir +++ b/tests/mir-opt/building/issue_101867.main.built.after.mir @@ -71,3 +71,7 @@ fn main() -> () { resume; } } + +ALLOC0 (size: 14, align: 1) { + 65 78 70 6c 69 63 69 74 20 70 61 6e 69 63 │ explicit panic +} diff --git a/tests/mir-opt/building/storage_live_dead_in_statics.XXX.built.after.mir b/tests/mir-opt/building/storage_live_dead_in_statics.XXX.built.after.mir index 73ead005f8c6..4ec120326908 100644 --- a/tests/mir-opt/building/storage_live_dead_in_statics.XXX.built.after.mir +++ b/tests/mir-opt/building/storage_live_dead_in_statics.XXX.built.after.mir @@ -198,3 +198,7 @@ static XXX: &Foo = { return; } } + +ALLOC0 (size: 2, align: 1) { + 68 69 │ hi +} diff --git a/tests/mir-opt/building/user_type_annotations.let_else.built.after.mir b/tests/mir-opt/building/user_type_annotations.let_else.built.after.mir index 3a515787c10b..6369dbec7506 100644 --- a/tests/mir-opt/building/user_type_annotations.let_else.built.after.mir +++ b/tests/mir-opt/building/user_type_annotations.let_else.built.after.mir @@ -78,3 +78,9 @@ fn let_else() -> () { resume; } } + +ALLOC0 (size: 40, align: 1) { + 0x00 │ 69 6e 74 65 72 6e 61 6c 20 65 72 72 6f 72 3a 20 │ internal error: + 0x10 │ 65 6e 74 65 72 65 64 20 75 6e 72 65 61 63 68 61 │ entered unreacha + 0x20 │ 62 6c 65 20 63 6f 64 65 │ ble code +} diff --git a/tests/mir-opt/building/user_type_annotations.let_else_bindless.built.after.mir b/tests/mir-opt/building/user_type_annotations.let_else_bindless.built.after.mir index 52a6d904d458..b2a06ae53a8a 100644 --- a/tests/mir-opt/building/user_type_annotations.let_else_bindless.built.after.mir +++ b/tests/mir-opt/building/user_type_annotations.let_else_bindless.built.after.mir @@ -60,3 +60,9 @@ fn let_else_bindless() -> () { resume; } } + +ALLOC0 (size: 40, align: 1) { + 0x00 │ 69 6e 74 65 72 6e 61 6c 20 65 72 72 6f 72 3a 20 │ internal error: + 0x10 │ 65 6e 74 65 72 65 64 20 75 6e 72 65 61 63 68 61 │ entered unreacha + 0x20 │ 62 6c 65 20 63 6f 64 65 │ ble code +} diff --git a/tests/mir-opt/const_debuginfo.main.SingleUseConsts.diff b/tests/mir-opt/const_debuginfo.main.SingleUseConsts.diff index 8088984bc77a..9baf8439e59f 100644 --- a/tests/mir-opt/const_debuginfo.main.SingleUseConsts.diff +++ b/tests/mir-opt/const_debuginfo.main.SingleUseConsts.diff @@ -123,3 +123,5 @@ ALLOC1 (size: 4, align: 2) { .. } + ALLOC2 (size: 13, align: 1) { .. } + diff --git a/tests/mir-opt/const_prop/control_flow_simplification.hello.GVN.panic-abort.diff b/tests/mir-opt/const_prop/control_flow_simplification.hello.GVN.panic-abort.diff index 417406de39b6..24b10217865b 100644 --- a/tests/mir-opt/const_prop/control_flow_simplification.hello.GVN.panic-abort.diff +++ b/tests/mir-opt/const_prop/control_flow_simplification.hello.GVN.panic-abort.diff @@ -24,3 +24,7 @@ } } + ALLOC0 (size: 14, align: 1) { + 65 78 70 6c 69 63 69 74 20 70 61 6e 69 63 │ explicit panic + } + diff --git a/tests/mir-opt/const_prop/control_flow_simplification.hello.GVN.panic-unwind.diff b/tests/mir-opt/const_prop/control_flow_simplification.hello.GVN.panic-unwind.diff index 63ba2c6865f0..a73485e7944d 100644 --- a/tests/mir-opt/const_prop/control_flow_simplification.hello.GVN.panic-unwind.diff +++ b/tests/mir-opt/const_prop/control_flow_simplification.hello.GVN.panic-unwind.diff @@ -24,3 +24,7 @@ } } + ALLOC0 (size: 14, align: 1) { + 65 78 70 6c 69 63 69 74 20 70 61 6e 69 63 │ explicit panic + } + diff --git a/tests/mir-opt/dead-store-elimination/place_mention.main.DeadStoreElimination-initial.diff b/tests/mir-opt/dead-store-elimination/place_mention.main.DeadStoreElimination-initial.diff index 5a5502858712..8e224e0533a5 100644 --- a/tests/mir-opt/dead-store-elimination/place_mention.main.DeadStoreElimination-initial.diff +++ b/tests/mir-opt/dead-store-elimination/place_mention.main.DeadStoreElimination-initial.diff @@ -17,3 +17,11 @@ } } + ALLOC0 (size: 5, align: 1) { + 57 6f 72 6c 64 │ World + } + + ALLOC1 (size: 5, align: 1) { + 48 65 6c 6c 6f │ Hello + } + diff --git a/tests/mir-opt/gvn.duplicate_slice.GVN.panic-abort.diff b/tests/mir-opt/gvn.duplicate_slice.GVN.panic-abort.diff index 18c2897d5287..3bde339a8394 100644 --- a/tests/mir-opt/gvn.duplicate_slice.GVN.panic-abort.diff +++ b/tests/mir-opt/gvn.duplicate_slice.GVN.panic-abort.diff @@ -16,23 +16,31 @@ bb0: { _7 = (const "a",); - _1 = copy (_7.0: &str) as u128 (Transmute); - _5 = identity::<&str>(copy (_7.0: &str)) -> [return: bb1, unwind unreachable]; +- _1 = copy (_7.0: &str) as u128 (Transmute); +- _5 = identity::<&str>(copy (_7.0: &str)) -> [return: bb1, unwind unreachable]; ++ _1 = const "a" as u128 (Transmute); ++ _5 = identity::<&str>(const "a") -> [return: bb1, unwind unreachable]; } bb1: { _3 = copy _5 as u128 (Transmute); _8 = const "a"; - _2 = copy _8 as u128 (Transmute); - _6 = identity::<&str>(copy _8) -> [return: bb2, unwind unreachable]; +- _2 = copy _8 as u128 (Transmute); +- _6 = identity::<&str>(copy _8) -> [return: bb2, unwind unreachable]; ++ _2 = copy _1; ++ _6 = identity::<&str>(const "a") -> [return: bb2, unwind unreachable]; } bb2: { _4 = copy _6 as u128 (Transmute); - _9 = Eq(copy _1, copy _2); +- _9 = Eq(copy _1, copy _2); ++ _9 = const true; _10 = Eq(copy _3, copy _4); - _0 = (copy _9, copy _10); +- _0 = (copy _9, copy _10); ++ _0 = (const true, copy _10); return; } } + ALLOC0 (size: 1, align: 1) { .. } + diff --git a/tests/mir-opt/gvn.duplicate_slice.GVN.panic-unwind.diff b/tests/mir-opt/gvn.duplicate_slice.GVN.panic-unwind.diff index 55f382e926e7..cccfbf60585e 100644 --- a/tests/mir-opt/gvn.duplicate_slice.GVN.panic-unwind.diff +++ b/tests/mir-opt/gvn.duplicate_slice.GVN.panic-unwind.diff @@ -16,23 +16,31 @@ bb0: { _7 = (const "a",); - _1 = copy (_7.0: &str) as u128 (Transmute); - _5 = identity::<&str>(copy (_7.0: &str)) -> [return: bb1, unwind continue]; +- _1 = copy (_7.0: &str) as u128 (Transmute); +- _5 = identity::<&str>(copy (_7.0: &str)) -> [return: bb1, unwind continue]; ++ _1 = const "a" as u128 (Transmute); ++ _5 = identity::<&str>(const "a") -> [return: bb1, unwind continue]; } bb1: { _3 = copy _5 as u128 (Transmute); _8 = const "a"; - _2 = copy _8 as u128 (Transmute); - _6 = identity::<&str>(copy _8) -> [return: bb2, unwind continue]; +- _2 = copy _8 as u128 (Transmute); +- _6 = identity::<&str>(copy _8) -> [return: bb2, unwind continue]; ++ _2 = copy _1; ++ _6 = identity::<&str>(const "a") -> [return: bb2, unwind continue]; } bb2: { _4 = copy _6 as u128 (Transmute); - _9 = Eq(copy _1, copy _2); +- _9 = Eq(copy _1, copy _2); ++ _9 = const true; _10 = Eq(copy _3, copy _4); - _0 = (copy _9, copy _10); +- _0 = (copy _9, copy _10); ++ _0 = (const true, copy _10); return; } } + ALLOC0 (size: 1, align: 1) { .. } + diff --git a/tests/mir-opt/gvn.fn_pointers.GVN.panic-abort.diff b/tests/mir-opt/gvn.fn_pointers.GVN.panic-abort.diff index 3cce35d34e90..f3f631956374 100644 --- a/tests/mir-opt/gvn.fn_pointers.GVN.panic-abort.diff +++ b/tests/mir-opt/gvn.fn_pointers.GVN.panic-abort.diff @@ -8,10 +8,10 @@ let mut _3: fn(u8) -> u8; let _5: (); let mut _6: fn(u8) -> u8; - let mut _9: {closure@$DIR/gvn.rs:620:19: 620:21}; + let mut _9: {closure@$DIR/gvn.rs:617:19: 617:21}; let _10: (); let mut _11: fn(); - let mut _13: {closure@$DIR/gvn.rs:620:19: 620:21}; + let mut _13: {closure@$DIR/gvn.rs:617:19: 617:21}; let _14: (); let mut _15: fn(); scope 1 { @@ -19,7 +19,7 @@ let _4: fn(u8) -> u8; scope 2 { debug g => _4; - let _7: {closure@$DIR/gvn.rs:620:19: 620:21}; + let _7: {closure@$DIR/gvn.rs:617:19: 617:21}; scope 3 { debug closure => _7; let _8: fn(); @@ -62,16 +62,16 @@ StorageDead(_6); StorageDead(_5); - StorageLive(_7); -- _7 = {closure@$DIR/gvn.rs:620:19: 620:21}; +- _7 = {closure@$DIR/gvn.rs:617:19: 617:21}; - StorageLive(_8); + nop; -+ _7 = const ZeroSized: {closure@$DIR/gvn.rs:620:19: 620:21}; ++ _7 = const ZeroSized: {closure@$DIR/gvn.rs:617:19: 617:21}; + nop; StorageLive(_9); - _9 = copy _7; - _8 = move _9 as fn() (PointerCoercion(ClosureFnPointer(Safe), AsCast)); -+ _9 = const ZeroSized: {closure@$DIR/gvn.rs:620:19: 620:21}; -+ _8 = const ZeroSized: {closure@$DIR/gvn.rs:620:19: 620:21} as fn() (PointerCoercion(ClosureFnPointer(Safe), AsCast)); ++ _9 = const ZeroSized: {closure@$DIR/gvn.rs:617:19: 617:21}; ++ _8 = const ZeroSized: {closure@$DIR/gvn.rs:617:19: 617:21} as fn() (PointerCoercion(ClosureFnPointer(Safe), AsCast)); StorageDead(_9); StorageLive(_10); StorageLive(_11); @@ -88,8 +88,8 @@ StorageLive(_13); - _13 = copy _7; - _12 = move _13 as fn() (PointerCoercion(ClosureFnPointer(Safe), AsCast)); -+ _13 = const ZeroSized: {closure@$DIR/gvn.rs:620:19: 620:21}; -+ _12 = const ZeroSized: {closure@$DIR/gvn.rs:620:19: 620:21} as fn() (PointerCoercion(ClosureFnPointer(Safe), AsCast)); ++ _13 = const ZeroSized: {closure@$DIR/gvn.rs:617:19: 617:21}; ++ _12 = const ZeroSized: {closure@$DIR/gvn.rs:617:19: 617:21} as fn() (PointerCoercion(ClosureFnPointer(Safe), AsCast)); StorageDead(_13); StorageLive(_14); StorageLive(_15); diff --git a/tests/mir-opt/gvn.fn_pointers.GVN.panic-unwind.diff b/tests/mir-opt/gvn.fn_pointers.GVN.panic-unwind.diff index d85aca040fe6..029e736a9795 100644 --- a/tests/mir-opt/gvn.fn_pointers.GVN.panic-unwind.diff +++ b/tests/mir-opt/gvn.fn_pointers.GVN.panic-unwind.diff @@ -8,10 +8,10 @@ let mut _3: fn(u8) -> u8; let _5: (); let mut _6: fn(u8) -> u8; - let mut _9: {closure@$DIR/gvn.rs:620:19: 620:21}; + let mut _9: {closure@$DIR/gvn.rs:617:19: 617:21}; let _10: (); let mut _11: fn(); - let mut _13: {closure@$DIR/gvn.rs:620:19: 620:21}; + let mut _13: {closure@$DIR/gvn.rs:617:19: 617:21}; let _14: (); let mut _15: fn(); scope 1 { @@ -19,7 +19,7 @@ let _4: fn(u8) -> u8; scope 2 { debug g => _4; - let _7: {closure@$DIR/gvn.rs:620:19: 620:21}; + let _7: {closure@$DIR/gvn.rs:617:19: 617:21}; scope 3 { debug closure => _7; let _8: fn(); @@ -62,16 +62,16 @@ StorageDead(_6); StorageDead(_5); - StorageLive(_7); -- _7 = {closure@$DIR/gvn.rs:620:19: 620:21}; +- _7 = {closure@$DIR/gvn.rs:617:19: 617:21}; - StorageLive(_8); + nop; -+ _7 = const ZeroSized: {closure@$DIR/gvn.rs:620:19: 620:21}; ++ _7 = const ZeroSized: {closure@$DIR/gvn.rs:617:19: 617:21}; + nop; StorageLive(_9); - _9 = copy _7; - _8 = move _9 as fn() (PointerCoercion(ClosureFnPointer(Safe), AsCast)); -+ _9 = const ZeroSized: {closure@$DIR/gvn.rs:620:19: 620:21}; -+ _8 = const ZeroSized: {closure@$DIR/gvn.rs:620:19: 620:21} as fn() (PointerCoercion(ClosureFnPointer(Safe), AsCast)); ++ _9 = const ZeroSized: {closure@$DIR/gvn.rs:617:19: 617:21}; ++ _8 = const ZeroSized: {closure@$DIR/gvn.rs:617:19: 617:21} as fn() (PointerCoercion(ClosureFnPointer(Safe), AsCast)); StorageDead(_9); StorageLive(_10); StorageLive(_11); @@ -88,8 +88,8 @@ StorageLive(_13); - _13 = copy _7; - _12 = move _13 as fn() (PointerCoercion(ClosureFnPointer(Safe), AsCast)); -+ _13 = const ZeroSized: {closure@$DIR/gvn.rs:620:19: 620:21}; -+ _12 = const ZeroSized: {closure@$DIR/gvn.rs:620:19: 620:21} as fn() (PointerCoercion(ClosureFnPointer(Safe), AsCast)); ++ _13 = const ZeroSized: {closure@$DIR/gvn.rs:617:19: 617:21}; ++ _12 = const ZeroSized: {closure@$DIR/gvn.rs:617:19: 617:21} as fn() (PointerCoercion(ClosureFnPointer(Safe), AsCast)); StorageDead(_13); StorageLive(_14); StorageLive(_15); diff --git a/tests/mir-opt/gvn.rs b/tests/mir-opt/gvn.rs index 5d348bc3c1e4..407980fd0fd4 100644 --- a/tests/mir-opt/gvn.rs +++ b/tests/mir-opt/gvn.rs @@ -533,10 +533,10 @@ fn dereferences(t: &mut u32, u: &impl Copy, s: &S) { fn slices() { // CHECK-LABEL: fn slices( // CHECK: {{_.*}} = const " - // CHECK-NOT: {{_.*}} = const " - let s = "my favourite slice"; // This is a `Const::Slice` in MIR. + // CHECK: {{_.*}} = const " + let s = "my favourite slice"; opaque(s); - let t = s; // This should be the same pointer, so cannot be a `Const::Slice`. + let t = s; // This should be the same pointer. opaque(t); assert_eq!(s.as_ptr(), t.as_ptr()); let u = unsafe { transmute::<&str, &[u8]>(s) }; @@ -556,12 +556,12 @@ fn duplicate_slice() -> (bool, bool) { let d: &str; { // CHECK: [[a:_.*]] = (const "a",); - // CHECK: [[au:_.*]] = copy ([[a]].0: &str) as u128 (Transmute); + // CHECK: [[au:_.*]] = const "a" as u128 (Transmute); let a = ("a",); Call(au = transmute::<_, u128>(a.0), ReturnTo(bb1), UnwindContinue()) } bb1 = { - // CHECK: [[c:_.*]] = identity::<&str>(copy ([[a]].0: &str)) + // CHECK: [[c:_.*]] = identity::<&str>(const "a") Call(c = identity(a.0), ReturnTo(bb2), UnwindContinue()) } bb2 = { @@ -569,15 +569,13 @@ fn duplicate_slice() -> (bool, bool) { Call(cu = transmute::<_, u128>(c), ReturnTo(bb3), UnwindContinue()) } bb3 = { - // This slice is different from `a.0`. Hence `bu` is not `au`. // CHECK: [[b:_.*]] = const "a"; - // CHECK: [[bu:_.*]] = copy [[b]] as u128 (Transmute); + // CHECK: [[bu:_.*]] = copy [[au]]; let b = "a"; Call(bu = transmute::<_, u128>(b), ReturnTo(bb4), UnwindContinue()) } bb4 = { - // This returns a copy of `b`, which is not `a`. - // CHECK: [[d:_.*]] = identity::<&str>(copy [[b]]) + // CHECK: [[d:_.*]] = identity::<&str>(const "a") Call(d = identity(b), ReturnTo(bb5), UnwindContinue()) } bb5 = { @@ -585,8 +583,7 @@ fn duplicate_slice() -> (bool, bool) { Call(du = transmute::<_, u128>(d), ReturnTo(bb6), UnwindContinue()) } bb6 = { - // `direct` must not fold to `true`, as `indirect` will not. - // CHECK: = Eq(copy [[au]], copy [[bu]]); + // CHECK: = const true; // CHECK: = Eq(copy [[cu]], copy [[du]]); let direct = au == bu; let indirect = cu == du; diff --git a/tests/mir-opt/gvn.slices.GVN.panic-abort.diff b/tests/mir-opt/gvn.slices.GVN.panic-abort.diff index e8e99b44e721..091c3bd5c7b2 100644 --- a/tests/mir-opt/gvn.slices.GVN.panic-abort.diff +++ b/tests/mir-opt/gvn.slices.GVN.panic-abort.diff @@ -87,22 +87,24 @@ _1 = const "my favourite slice"; StorageLive(_2); StorageLive(_3); - _3 = copy _1; +- _3 = copy _1; - _2 = opaque::<&str>(move _3) -> [return: bb1, unwind unreachable]; -+ _2 = opaque::<&str>(copy _1) -> [return: bb1, unwind unreachable]; ++ _3 = const "my favourite slice"; ++ _2 = opaque::<&str>(const "my favourite slice") -> [return: bb1, unwind unreachable]; } bb1: { StorageDead(_3); StorageDead(_2); StorageLive(_4); - _4 = copy _1; +- _4 = copy _1; ++ _4 = const "my favourite slice"; StorageLive(_5); StorageLive(_6); - _6 = copy _4; - _5 = opaque::<&str>(move _6) -> [return: bb2, unwind unreachable]; -+ _6 = copy _1; -+ _5 = opaque::<&str>(copy _1) -> [return: bb2, unwind unreachable]; ++ _6 = const "my favourite slice"; ++ _5 = opaque::<&str>(const "my favourite slice") -> [return: bb2, unwind unreachable]; } bb2: { @@ -315,3 +317,5 @@ } } + ALLOC0 (size: 18, align: 1) { .. } + diff --git a/tests/mir-opt/gvn.slices.GVN.panic-unwind.diff b/tests/mir-opt/gvn.slices.GVN.panic-unwind.diff index 4296d4d4a594..9768956c9c87 100644 --- a/tests/mir-opt/gvn.slices.GVN.panic-unwind.diff +++ b/tests/mir-opt/gvn.slices.GVN.panic-unwind.diff @@ -87,22 +87,24 @@ _1 = const "my favourite slice"; StorageLive(_2); StorageLive(_3); - _3 = copy _1; +- _3 = copy _1; - _2 = opaque::<&str>(move _3) -> [return: bb1, unwind continue]; -+ _2 = opaque::<&str>(copy _1) -> [return: bb1, unwind continue]; ++ _3 = const "my favourite slice"; ++ _2 = opaque::<&str>(const "my favourite slice") -> [return: bb1, unwind continue]; } bb1: { StorageDead(_3); StorageDead(_2); StorageLive(_4); - _4 = copy _1; +- _4 = copy _1; ++ _4 = const "my favourite slice"; StorageLive(_5); StorageLive(_6); - _6 = copy _4; - _5 = opaque::<&str>(move _6) -> [return: bb2, unwind continue]; -+ _6 = copy _1; -+ _5 = opaque::<&str>(copy _1) -> [return: bb2, unwind continue]; ++ _6 = const "my favourite slice"; ++ _5 = opaque::<&str>(const "my favourite slice") -> [return: bb2, unwind continue]; } bb2: { @@ -315,3 +317,5 @@ } } + ALLOC0 (size: 18, align: 1) { .. } + diff --git a/tests/mir-opt/gvn.wrap_unwrap.GVN.panic-abort.diff b/tests/mir-opt/gvn.wrap_unwrap.GVN.panic-abort.diff index 0433152bb4f2..3bbfd3a891eb 100644 --- a/tests/mir-opt/gvn.wrap_unwrap.GVN.panic-abort.diff +++ b/tests/mir-opt/gvn.wrap_unwrap.GVN.panic-abort.diff @@ -47,3 +47,5 @@ } } + ALLOC0 (size: 14, align: 1) { .. } + diff --git a/tests/mir-opt/gvn.wrap_unwrap.GVN.panic-unwind.diff b/tests/mir-opt/gvn.wrap_unwrap.GVN.panic-unwind.diff index 5722c865c2f9..03464f43f81e 100644 --- a/tests/mir-opt/gvn.wrap_unwrap.GVN.panic-unwind.diff +++ b/tests/mir-opt/gvn.wrap_unwrap.GVN.panic-unwind.diff @@ -47,3 +47,5 @@ } } + ALLOC0 (size: 14, align: 1) { .. } + diff --git a/tests/mir-opt/inline/inline_diverging.g.Inline.panic-abort.diff b/tests/mir-opt/inline/inline_diverging.g.Inline.panic-abort.diff index bda855865153..423de59e5754 100644 --- a/tests/mir-opt/inline/inline_diverging.g.Inline.panic-abort.diff +++ b/tests/mir-opt/inline/inline_diverging.g.Inline.panic-abort.diff @@ -38,5 +38,9 @@ + StorageLive(_7); + _7 = begin_panic::<&str>(const "explicit panic") -> unwind unreachable; } ++ } ++ ++ ALLOC0 (size: 14, align: 1) { ++ 65 78 70 6c 69 63 69 74 20 70 61 6e 69 63 │ explicit panic } diff --git a/tests/mir-opt/inline/inline_diverging.g.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_diverging.g.Inline.panic-unwind.diff index ecd72d2b37fa..3689744dcb04 100644 --- a/tests/mir-opt/inline/inline_diverging.g.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/inline_diverging.g.Inline.panic-unwind.diff @@ -38,5 +38,9 @@ + StorageLive(_7); + _7 = begin_panic::<&str>(const "explicit panic") -> unwind continue; } ++ } ++ ++ ALLOC0 (size: 14, align: 1) { ++ 65 78 70 6c 69 63 69 74 20 70 61 6e 69 63 │ explicit panic } diff --git a/tests/mir-opt/inline_coroutine_body.run2-{closure#0}.Inline.panic-abort.diff b/tests/mir-opt/inline_coroutine_body.run2-{closure#0}.Inline.panic-abort.diff index 1e9a6dd4f5c8..169a6768448f 100644 --- a/tests/mir-opt/inline_coroutine_body.run2-{closure#0}.Inline.panic-abort.diff +++ b/tests/mir-opt/inline_coroutine_body.run2-{closure#0}.Inline.panic-abort.diff @@ -251,7 +251,7 @@ + StorageLive(_50); + _50 = discriminant(_43); + switchInt(move _50) -> [0: bb11, 1: bb12, otherwise: bb5]; -+ } + } + + bb5: { + unreachable; @@ -329,6 +329,11 @@ + StorageDead(_19); + _25 = discriminant(_18); + switchInt(move _25) -> [0: bb7, 1: bb6, otherwise: bb5]; - } ++ } ++ } ++ ++ ALLOC0 (size: 31, align: 1) { ++ 0x00 │ 60 52 65 61 64 79 60 20 70 6f 6c 6c 65 64 20 61 │ `Ready` polled a ++ 0x10 │ 66 74 65 72 20 63 6f 6d 70 6c 65 74 69 6f 6e │ fter completion } diff --git a/tests/mir-opt/inline_coroutine_body.run2-{closure#0}.Inline.panic-unwind.diff b/tests/mir-opt/inline_coroutine_body.run2-{closure#0}.Inline.panic-unwind.diff index 94b89a310baa..14ba3311d2dc 100644 --- a/tests/mir-opt/inline_coroutine_body.run2-{closure#0}.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline_coroutine_body.run2-{closure#0}.Inline.panic-unwind.diff @@ -274,7 +274,7 @@ - resume; + bb7: { + unreachable; -+ } + } + + bb8: { + _17 = const (); @@ -370,6 +370,11 @@ + StorageDead(_19); + _25 = discriminant(_18); + switchInt(move _25) -> [0: bb9, 1: bb8, otherwise: bb7]; - } ++ } ++ } ++ ++ ALLOC0 (size: 31, align: 1) { ++ 0x00 │ 60 52 65 61 64 79 60 20 70 6f 6c 6c 65 64 20 61 │ `Ready` polled a ++ 0x10 │ 66 74 65 72 20 63 6f 6d 70 6c 65 74 69 6f 6e │ fter completion } diff --git a/tests/mir-opt/instsimplify/aggregate_array.strs.InstSimplify-after-simplifycfg.diff b/tests/mir-opt/instsimplify/aggregate_array.strs.InstSimplify-after-simplifycfg.diff index f88848817560..ca5573cf97f4 100644 --- a/tests/mir-opt/instsimplify/aggregate_array.strs.InstSimplify-after-simplifycfg.diff +++ b/tests/mir-opt/instsimplify/aggregate_array.strs.InstSimplify-after-simplifycfg.diff @@ -11,3 +11,7 @@ } } + ALLOC0 (size: 1, align: 1) { + 61 │ a + } + diff --git a/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-abort.diff b/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-abort.diff index c02bab3524bc..08dee3697e07 100644 --- a/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-abort.diff +++ b/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-abort.diff @@ -51,3 +51,9 @@ } } + ALLOC0 (size: 40, align: 1) { + 0x00 │ 69 6e 74 65 72 6e 61 6c 20 65 72 72 6f 72 3a 20 │ internal error: + 0x10 │ 65 6e 74 65 72 65 64 20 75 6e 72 65 61 63 68 61 │ entered unreacha + 0x20 │ 62 6c 65 20 63 6f 64 65 │ ble code + } + diff --git a/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-unwind.diff b/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-unwind.diff index 49be042588cb..aa44a2ad532b 100644 --- a/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-unwind.diff +++ b/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-unwind.diff @@ -51,3 +51,9 @@ } } + ALLOC0 (size: 40, align: 1) { + 0x00 │ 69 6e 74 65 72 6e 61 6c 20 65 72 72 6f 72 3a 20 │ internal error: + 0x10 │ 65 6e 74 65 72 65 64 20 75 6e 72 65 61 63 68 61 │ entered unreacha + 0x20 │ 62 6c 65 20 63 6f 64 65 │ ble code + } + diff --git a/tests/mir-opt/no_drop_for_inactive_variant.unwrap.SimplifyCfg-pre-optimizations.after.panic-abort.mir b/tests/mir-opt/no_drop_for_inactive_variant.unwrap.SimplifyCfg-pre-optimizations.after.panic-abort.mir index fa6c6ce8e575..6e5f6dc9ea89 100644 --- a/tests/mir-opt/no_drop_for_inactive_variant.unwrap.SimplifyCfg-pre-optimizations.after.panic-abort.mir +++ b/tests/mir-opt/no_drop_for_inactive_variant.unwrap.SimplifyCfg-pre-optimizations.after.panic-abort.mir @@ -36,3 +36,7 @@ fn unwrap(_1: Option) -> T { return; } } + +ALLOC0 (size: 14, align: 1) { + 65 78 70 6c 69 63 69 74 20 70 61 6e 69 63 │ explicit panic +} diff --git a/tests/mir-opt/no_drop_for_inactive_variant.unwrap.SimplifyCfg-pre-optimizations.after.panic-unwind.mir b/tests/mir-opt/no_drop_for_inactive_variant.unwrap.SimplifyCfg-pre-optimizations.after.panic-unwind.mir index 54fec3c0f984..758aa45f2a2b 100644 --- a/tests/mir-opt/no_drop_for_inactive_variant.unwrap.SimplifyCfg-pre-optimizations.after.panic-unwind.mir +++ b/tests/mir-opt/no_drop_for_inactive_variant.unwrap.SimplifyCfg-pre-optimizations.after.panic-unwind.mir @@ -41,3 +41,7 @@ fn unwrap(_1: Option) -> T { resume; } } + +ALLOC0 (size: 14, align: 1) { + 65 78 70 6c 69 63 69 74 20 70 61 6e 69 63 │ explicit panic +} diff --git a/tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.panic-abort.mir b/tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.panic-abort.mir index 99a7a6b6154d..404de884ab56 100644 --- a/tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.panic-abort.mir +++ b/tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.panic-abort.mir @@ -38,3 +38,5 @@ fn main() -> () { resume; } } + +ALLOC0 (size: 0, align: 1) {} diff --git a/tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.panic-unwind.mir b/tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.panic-unwind.mir index 7364b329e123..47a0878ffae1 100644 --- a/tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.panic-unwind.mir +++ b/tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.panic-unwind.mir @@ -38,3 +38,5 @@ fn main() -> () { resume; } } + +ALLOC0 (size: 0, align: 1) {} diff --git a/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-abort.diff b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-abort.diff index 027c71dfaae4..c2d144c98c3a 100644 --- a/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-abort.diff +++ b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-abort.diff @@ -110,9 +110,16 @@ + nop; return; } -+ } -+ -+ ALLOC0 (size: 8, align: 4) { -+ 00 00 00 00 __ __ __ __ │ ....░░░░ + } + +- ALLOC0 (size: 43, align: 1) { ++ ALLOC0 (size: 8, align: 4) { ++ 00 00 00 00 __ __ __ __ │ ....░░░░ ++ } ++ ++ ALLOC1 (size: 43, align: 1) { + 0x00 │ 63 61 6c 6c 65 64 20 60 52 65 73 75 6c 74 3a 3a │ called `Result:: + 0x10 │ 75 6e 77 72 61 70 28 29 60 20 6f 6e 20 61 6e 20 │ unwrap()` on an + 0x20 │ 60 45 72 72 60 20 76 61 6c 75 65 │ `Err` value } diff --git a/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-abort.diff b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-abort.diff index ebf305a6f1b1..8641d2d6fa85 100644 --- a/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-abort.diff +++ b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-abort.diff @@ -110,9 +110,16 @@ + nop; return; } -+ } -+ -+ ALLOC0 (size: 16, align: 8) { -+ 00 00 00 00 00 00 00 00 __ __ __ __ __ __ __ __ │ ........░░░░░░░░ + } + +- ALLOC0 (size: 43, align: 1) { ++ ALLOC0 (size: 16, align: 8) { ++ 00 00 00 00 00 00 00 00 __ __ __ __ __ __ __ __ │ ........░░░░░░░░ ++ } ++ ++ ALLOC1 (size: 43, align: 1) { + 0x00 │ 63 61 6c 6c 65 64 20 60 52 65 73 75 6c 74 3a 3a │ called `Result:: + 0x10 │ 75 6e 77 72 61 70 28 29 60 20 6f 6e 20 61 6e 20 │ unwrap()` on an + 0x20 │ 60 45 72 72 60 20 76 61 6c 75 65 │ `Err` value } diff --git a/tests/mir-opt/single_use_consts.match_const.SingleUseConsts.panic-abort.diff b/tests/mir-opt/single_use_consts.match_const.SingleUseConsts.panic-abort.diff index 354e0988a006..1ba5e47b81b6 100644 --- a/tests/mir-opt/single_use_consts.match_const.SingleUseConsts.panic-abort.diff +++ b/tests/mir-opt/single_use_consts.match_const.SingleUseConsts.panic-abort.diff @@ -34,3 +34,15 @@ } } + ALLOC0 (size: 5, align: 1) { + 77 6f 72 6c 64 │ world + } + + ALLOC1 (size: 5, align: 1) { + 74 6f 77 65 6c │ towel + } + + ALLOC2 (size: 5, align: 1) { + 68 65 6c 6c 6f │ hello + } + diff --git a/tests/mir-opt/single_use_consts.match_const.SingleUseConsts.panic-unwind.diff b/tests/mir-opt/single_use_consts.match_const.SingleUseConsts.panic-unwind.diff index 354e0988a006..1ba5e47b81b6 100644 --- a/tests/mir-opt/single_use_consts.match_const.SingleUseConsts.panic-unwind.diff +++ b/tests/mir-opt/single_use_consts.match_const.SingleUseConsts.panic-unwind.diff @@ -34,3 +34,15 @@ } } + ALLOC0 (size: 5, align: 1) { + 77 6f 72 6c 64 │ world + } + + ALLOC1 (size: 5, align: 1) { + 74 6f 77 65 6c │ towel + } + + ALLOC2 (size: 5, align: 1) { + 68 65 6c 6c 6f │ hello + } + diff --git a/tests/mir-opt/single_use_consts.match_const_debug.SingleUseConsts.panic-abort.diff b/tests/mir-opt/single_use_consts.match_const_debug.SingleUseConsts.panic-abort.diff index 5cf37dc97cbf..e0fabe5a90e4 100644 --- a/tests/mir-opt/single_use_consts.match_const_debug.SingleUseConsts.panic-abort.diff +++ b/tests/mir-opt/single_use_consts.match_const_debug.SingleUseConsts.panic-abort.diff @@ -45,3 +45,15 @@ } } + ALLOC0 (size: 5, align: 1) { + 77 6f 72 6c 64 │ world + } + + ALLOC1 (size: 5, align: 1) { + 74 6f 77 65 6c │ towel + } + + ALLOC2 (size: 5, align: 1) { + 68 65 6c 6c 6f │ hello + } + diff --git a/tests/mir-opt/single_use_consts.match_const_debug.SingleUseConsts.panic-unwind.diff b/tests/mir-opt/single_use_consts.match_const_debug.SingleUseConsts.panic-unwind.diff index bdcf086e8d96..26799ae66293 100644 --- a/tests/mir-opt/single_use_consts.match_const_debug.SingleUseConsts.panic-unwind.diff +++ b/tests/mir-opt/single_use_consts.match_const_debug.SingleUseConsts.panic-unwind.diff @@ -45,3 +45,15 @@ } } + ALLOC0 (size: 5, align: 1) { + 77 6f 72 6c 64 │ world + } + + ALLOC1 (size: 5, align: 1) { + 74 6f 77 65 6c │ towel + } + + ALLOC2 (size: 5, align: 1) { + 68 65 6c 6c 6f │ hello + } + diff --git a/tests/mir-opt/sroa/structs.flat.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa/structs.flat.ScalarReplacementOfAggregates.diff index 77c7c1a90123..ecd89d14ace8 100644 --- a/tests/mir-opt/sroa/structs.flat.ScalarReplacementOfAggregates.diff +++ b/tests/mir-opt/sroa/structs.flat.ScalarReplacementOfAggregates.diff @@ -75,3 +75,7 @@ } } + ALLOC0 (size: 1, align: 1) { + 61 │ a + } + diff --git a/tests/mir-opt/unreachable_enum_branching.byref.UnreachableEnumBranching.panic-abort.diff b/tests/mir-opt/unreachable_enum_branching.byref.UnreachableEnumBranching.panic-abort.diff index ed54a38f70bd..610a1a4624f7 100644 --- a/tests/mir-opt/unreachable_enum_branching.byref.UnreachableEnumBranching.panic-abort.diff +++ b/tests/mir-opt/unreachable_enum_branching.byref.UnreachableEnumBranching.panic-abort.diff @@ -113,3 +113,19 @@ } } + ALLOC0 (size: 1, align: 1) { + 44 │ D + } + + ALLOC1 (size: 1, align: 1) { + 43 │ C + } + + ALLOC2 (size: 8, align: 1) { + 42 28 45 6d 70 74 79 29 │ B(Empty) + } + + ALLOC3 (size: 8, align: 1) { + 41 28 45 6d 70 74 79 29 │ A(Empty) + } + diff --git a/tests/mir-opt/unreachable_enum_branching.byref.UnreachableEnumBranching.panic-unwind.diff b/tests/mir-opt/unreachable_enum_branching.byref.UnreachableEnumBranching.panic-unwind.diff index ed54a38f70bd..610a1a4624f7 100644 --- a/tests/mir-opt/unreachable_enum_branching.byref.UnreachableEnumBranching.panic-unwind.diff +++ b/tests/mir-opt/unreachable_enum_branching.byref.UnreachableEnumBranching.panic-unwind.diff @@ -113,3 +113,19 @@ } } + ALLOC0 (size: 1, align: 1) { + 44 │ D + } + + ALLOC1 (size: 1, align: 1) { + 43 │ C + } + + ALLOC2 (size: 8, align: 1) { + 42 28 45 6d 70 74 79 29 │ B(Empty) + } + + ALLOC3 (size: 8, align: 1) { + 41 28 45 6d 70 74 79 29 │ A(Empty) + } + diff --git a/tests/mir-opt/unreachable_enum_branching.custom_discriminant.UnreachableEnumBranching.panic-abort.diff b/tests/mir-opt/unreachable_enum_branching.custom_discriminant.UnreachableEnumBranching.panic-abort.diff index ea6cdbfbe661..97c71762f22e 100644 --- a/tests/mir-opt/unreachable_enum_branching.custom_discriminant.UnreachableEnumBranching.panic-abort.diff +++ b/tests/mir-opt/unreachable_enum_branching.custom_discriminant.UnreachableEnumBranching.panic-abort.diff @@ -41,3 +41,11 @@ } } + ALLOC0 (size: 1, align: 1) { + 45 │ E + } + + ALLOC1 (size: 1, align: 1) { + 44 │ D + } + diff --git a/tests/mir-opt/unreachable_enum_branching.custom_discriminant.UnreachableEnumBranching.panic-unwind.diff b/tests/mir-opt/unreachable_enum_branching.custom_discriminant.UnreachableEnumBranching.panic-unwind.diff index ea6cdbfbe661..97c71762f22e 100644 --- a/tests/mir-opt/unreachable_enum_branching.custom_discriminant.UnreachableEnumBranching.panic-unwind.diff +++ b/tests/mir-opt/unreachable_enum_branching.custom_discriminant.UnreachableEnumBranching.panic-unwind.diff @@ -41,3 +41,11 @@ } } + ALLOC0 (size: 1, align: 1) { + 45 │ E + } + + ALLOC1 (size: 1, align: 1) { + 44 │ D + } + diff --git a/tests/mir-opt/unreachable_enum_branching.otherwise_t1.UnreachableEnumBranching.panic-abort.diff b/tests/mir-opt/unreachable_enum_branching.otherwise_t1.UnreachableEnumBranching.panic-abort.diff index be934ac688bb..7e798abcd4ed 100644 --- a/tests/mir-opt/unreachable_enum_branching.otherwise_t1.UnreachableEnumBranching.panic-abort.diff +++ b/tests/mir-opt/unreachable_enum_branching.otherwise_t1.UnreachableEnumBranching.panic-abort.diff @@ -51,3 +51,15 @@ } } + ALLOC0 (size: 1, align: 1) { + 43 │ C + } + + ALLOC1 (size: 8, align: 1) { + 42 28 45 6d 70 74 79 29 │ B(Empty) + } + + ALLOC2 (size: 8, align: 1) { + 41 28 45 6d 70 74 79 29 │ A(Empty) + } + diff --git a/tests/mir-opt/unreachable_enum_branching.otherwise_t1.UnreachableEnumBranching.panic-unwind.diff b/tests/mir-opt/unreachable_enum_branching.otherwise_t1.UnreachableEnumBranching.panic-unwind.diff index be934ac688bb..7e798abcd4ed 100644 --- a/tests/mir-opt/unreachable_enum_branching.otherwise_t1.UnreachableEnumBranching.panic-unwind.diff +++ b/tests/mir-opt/unreachable_enum_branching.otherwise_t1.UnreachableEnumBranching.panic-unwind.diff @@ -51,3 +51,15 @@ } } + ALLOC0 (size: 1, align: 1) { + 43 │ C + } + + ALLOC1 (size: 8, align: 1) { + 42 28 45 6d 70 74 79 29 │ B(Empty) + } + + ALLOC2 (size: 8, align: 1) { + 41 28 45 6d 70 74 79 29 │ A(Empty) + } + diff --git a/tests/mir-opt/unreachable_enum_branching.otherwise_t2.UnreachableEnumBranching.panic-abort.diff b/tests/mir-opt/unreachable_enum_branching.otherwise_t2.UnreachableEnumBranching.panic-abort.diff index a6d6e0861b1b..ac9b047624b1 100644 --- a/tests/mir-opt/unreachable_enum_branching.otherwise_t2.UnreachableEnumBranching.panic-abort.diff +++ b/tests/mir-opt/unreachable_enum_branching.otherwise_t2.UnreachableEnumBranching.panic-abort.diff @@ -42,3 +42,11 @@ } } + ALLOC0 (size: 1, align: 1) { + 45 │ E + } + + ALLOC1 (size: 1, align: 1) { + 44 │ D + } + diff --git a/tests/mir-opt/unreachable_enum_branching.otherwise_t2.UnreachableEnumBranching.panic-unwind.diff b/tests/mir-opt/unreachable_enum_branching.otherwise_t2.UnreachableEnumBranching.panic-unwind.diff index a6d6e0861b1b..ac9b047624b1 100644 --- a/tests/mir-opt/unreachable_enum_branching.otherwise_t2.UnreachableEnumBranching.panic-unwind.diff +++ b/tests/mir-opt/unreachable_enum_branching.otherwise_t2.UnreachableEnumBranching.panic-unwind.diff @@ -42,3 +42,11 @@ } } + ALLOC0 (size: 1, align: 1) { + 45 │ E + } + + ALLOC1 (size: 1, align: 1) { + 44 │ D + } + diff --git a/tests/mir-opt/unreachable_enum_branching.otherwise_t3.UnreachableEnumBranching.panic-abort.diff b/tests/mir-opt/unreachable_enum_branching.otherwise_t3.UnreachableEnumBranching.panic-abort.diff index 120061841a02..9e85e56c583b 100644 --- a/tests/mir-opt/unreachable_enum_branching.otherwise_t3.UnreachableEnumBranching.panic-abort.diff +++ b/tests/mir-opt/unreachable_enum_branching.otherwise_t3.UnreachableEnumBranching.panic-abort.diff @@ -51,3 +51,15 @@ } } + ALLOC0 (size: 1, align: 1) { + 43 │ C + } + + ALLOC1 (size: 8, align: 1) { + 42 28 45 6d 70 74 79 29 │ B(Empty) + } + + ALLOC2 (size: 8, align: 1) { + 41 28 45 6d 70 74 79 29 │ A(Empty) + } + diff --git a/tests/mir-opt/unreachable_enum_branching.otherwise_t3.UnreachableEnumBranching.panic-unwind.diff b/tests/mir-opt/unreachable_enum_branching.otherwise_t3.UnreachableEnumBranching.panic-unwind.diff index 120061841a02..9e85e56c583b 100644 --- a/tests/mir-opt/unreachable_enum_branching.otherwise_t3.UnreachableEnumBranching.panic-unwind.diff +++ b/tests/mir-opt/unreachable_enum_branching.otherwise_t3.UnreachableEnumBranching.panic-unwind.diff @@ -51,3 +51,15 @@ } } + ALLOC0 (size: 1, align: 1) { + 43 │ C + } + + ALLOC1 (size: 8, align: 1) { + 42 28 45 6d 70 74 79 29 │ B(Empty) + } + + ALLOC2 (size: 8, align: 1) { + 41 28 45 6d 70 74 79 29 │ A(Empty) + } + diff --git a/tests/mir-opt/unreachable_enum_branching.otherwise_t4.UnreachableEnumBranching.panic-abort.diff b/tests/mir-opt/unreachable_enum_branching.otherwise_t4.UnreachableEnumBranching.panic-abort.diff index b86814d61193..e83c6131fa58 100644 --- a/tests/mir-opt/unreachable_enum_branching.otherwise_t4.UnreachableEnumBranching.panic-abort.diff +++ b/tests/mir-opt/unreachable_enum_branching.otherwise_t4.UnreachableEnumBranching.panic-abort.diff @@ -46,3 +46,15 @@ } } + ALLOC0 (size: 2, align: 1) { + 43 44 │ CD + } + + ALLOC1 (size: 6, align: 1) { + 42 28 69 33 32 29 │ B(i32) + } + + ALLOC2 (size: 6, align: 1) { + 41 28 69 33 32 29 │ A(i32) + } + diff --git a/tests/mir-opt/unreachable_enum_branching.otherwise_t4.UnreachableEnumBranching.panic-unwind.diff b/tests/mir-opt/unreachable_enum_branching.otherwise_t4.UnreachableEnumBranching.panic-unwind.diff index b86814d61193..e83c6131fa58 100644 --- a/tests/mir-opt/unreachable_enum_branching.otherwise_t4.UnreachableEnumBranching.panic-unwind.diff +++ b/tests/mir-opt/unreachable_enum_branching.otherwise_t4.UnreachableEnumBranching.panic-unwind.diff @@ -46,3 +46,15 @@ } } + ALLOC0 (size: 2, align: 1) { + 43 44 │ CD + } + + ALLOC1 (size: 6, align: 1) { + 42 28 69 33 32 29 │ B(i32) + } + + ALLOC2 (size: 6, align: 1) { + 41 28 69 33 32 29 │ A(i32) + } + diff --git a/tests/mir-opt/unreachable_enum_branching.otherwise_t4_unreachable_default.UnreachableEnumBranching.panic-abort.diff b/tests/mir-opt/unreachable_enum_branching.otherwise_t4_unreachable_default.UnreachableEnumBranching.panic-abort.diff index 424ac6ba651c..33e33ebddec6 100644 --- a/tests/mir-opt/unreachable_enum_branching.otherwise_t4_unreachable_default.UnreachableEnumBranching.panic-abort.diff +++ b/tests/mir-opt/unreachable_enum_branching.otherwise_t4_unreachable_default.UnreachableEnumBranching.panic-abort.diff @@ -60,3 +60,19 @@ } } + ALLOC0 (size: 6, align: 1) { + 42 28 69 33 32 29 │ B(i32) + } + + ALLOC1 (size: 6, align: 1) { + 41 28 69 33 32 29 │ A(i32) + } + + ALLOC2 (size: 1, align: 1) { + 44 │ D + } + + ALLOC3 (size: 1, align: 1) { + 43 │ C + } + diff --git a/tests/mir-opt/unreachable_enum_branching.otherwise_t4_unreachable_default.UnreachableEnumBranching.panic-unwind.diff b/tests/mir-opt/unreachable_enum_branching.otherwise_t4_unreachable_default.UnreachableEnumBranching.panic-unwind.diff index 424ac6ba651c..33e33ebddec6 100644 --- a/tests/mir-opt/unreachable_enum_branching.otherwise_t4_unreachable_default.UnreachableEnumBranching.panic-unwind.diff +++ b/tests/mir-opt/unreachable_enum_branching.otherwise_t4_unreachable_default.UnreachableEnumBranching.panic-unwind.diff @@ -60,3 +60,19 @@ } } + ALLOC0 (size: 6, align: 1) { + 42 28 69 33 32 29 │ B(i32) + } + + ALLOC1 (size: 6, align: 1) { + 41 28 69 33 32 29 │ A(i32) + } + + ALLOC2 (size: 1, align: 1) { + 44 │ D + } + + ALLOC3 (size: 1, align: 1) { + 43 │ C + } + diff --git a/tests/mir-opt/unreachable_enum_branching.otherwise_t4_unreachable_default_2.UnreachableEnumBranching.panic-abort.diff b/tests/mir-opt/unreachable_enum_branching.otherwise_t4_unreachable_default_2.UnreachableEnumBranching.panic-abort.diff index 17e01f38f4eb..d11c07c4ba30 100644 --- a/tests/mir-opt/unreachable_enum_branching.otherwise_t4_unreachable_default_2.UnreachableEnumBranching.panic-abort.diff +++ b/tests/mir-opt/unreachable_enum_branching.otherwise_t4_unreachable_default_2.UnreachableEnumBranching.panic-abort.diff @@ -73,3 +73,23 @@ } } + ALLOC0 (size: 9, align: 1) { + 41 28 6f 74 68 65 72 29 44 │ A(other)D + } + + ALLOC1 (size: 4, align: 1) { + 41 28 32 29 │ A(2) + } + + ALLOC2 (size: 4, align: 1) { + 41 28 31 29 │ A(1) + } + + ALLOC3 (size: 6, align: 1) { + 42 28 69 33 32 29 │ B(i32) + } + + ALLOC4 (size: 1, align: 1) { + 43 │ C + } + diff --git a/tests/mir-opt/unreachable_enum_branching.otherwise_t4_unreachable_default_2.UnreachableEnumBranching.panic-unwind.diff b/tests/mir-opt/unreachable_enum_branching.otherwise_t4_unreachable_default_2.UnreachableEnumBranching.panic-unwind.diff index 17e01f38f4eb..d11c07c4ba30 100644 --- a/tests/mir-opt/unreachable_enum_branching.otherwise_t4_unreachable_default_2.UnreachableEnumBranching.panic-unwind.diff +++ b/tests/mir-opt/unreachable_enum_branching.otherwise_t4_unreachable_default_2.UnreachableEnumBranching.panic-unwind.diff @@ -73,3 +73,23 @@ } } + ALLOC0 (size: 9, align: 1) { + 41 28 6f 74 68 65 72 29 44 │ A(other)D + } + + ALLOC1 (size: 4, align: 1) { + 41 28 32 29 │ A(2) + } + + ALLOC2 (size: 4, align: 1) { + 41 28 31 29 │ A(1) + } + + ALLOC3 (size: 6, align: 1) { + 42 28 69 33 32 29 │ B(i32) + } + + ALLOC4 (size: 1, align: 1) { + 43 │ C + } + diff --git a/tests/mir-opt/unreachable_enum_branching.otherwise_t5_unreachable_default.UnreachableEnumBranching.panic-abort.diff b/tests/mir-opt/unreachable_enum_branching.otherwise_t5_unreachable_default.UnreachableEnumBranching.panic-abort.diff index 2de1f77eeec9..ae1ca6efd434 100644 --- a/tests/mir-opt/unreachable_enum_branching.otherwise_t5_unreachable_default.UnreachableEnumBranching.panic-abort.diff +++ b/tests/mir-opt/unreachable_enum_branching.otherwise_t5_unreachable_default.UnreachableEnumBranching.panic-abort.diff @@ -64,3 +64,19 @@ } } + ALLOC0 (size: 4, align: 1) { + 42 28 54 29 │ B(T) + } + + ALLOC1 (size: 4, align: 1) { + 41 28 54 29 │ A(T) + } + + ALLOC2 (size: 1, align: 1) { + 44 │ D + } + + ALLOC3 (size: 1, align: 1) { + 43 │ C + } + diff --git a/tests/mir-opt/unreachable_enum_branching.otherwise_t5_unreachable_default.UnreachableEnumBranching.panic-unwind.diff b/tests/mir-opt/unreachable_enum_branching.otherwise_t5_unreachable_default.UnreachableEnumBranching.panic-unwind.diff index 5afb78c58a3c..1e660036e46a 100644 --- a/tests/mir-opt/unreachable_enum_branching.otherwise_t5_unreachable_default.UnreachableEnumBranching.panic-unwind.diff +++ b/tests/mir-opt/unreachable_enum_branching.otherwise_t5_unreachable_default.UnreachableEnumBranching.panic-unwind.diff @@ -68,3 +68,19 @@ } } + ALLOC0 (size: 4, align: 1) { + 42 28 54 29 │ B(T) + } + + ALLOC1 (size: 4, align: 1) { + 41 28 54 29 │ A(T) + } + + ALLOC2 (size: 1, align: 1) { + 44 │ D + } + + ALLOC3 (size: 1, align: 1) { + 43 │ C + } + diff --git a/tests/mir-opt/unreachable_enum_branching.simple.UnreachableEnumBranching.panic-abort.diff b/tests/mir-opt/unreachable_enum_branching.simple.UnreachableEnumBranching.panic-abort.diff index 5c08648fac3b..c24bd7e7446d 100644 --- a/tests/mir-opt/unreachable_enum_branching.simple.UnreachableEnumBranching.panic-abort.diff +++ b/tests/mir-opt/unreachable_enum_branching.simple.UnreachableEnumBranching.panic-abort.diff @@ -51,3 +51,15 @@ } } + ALLOC0 (size: 1, align: 1) { + 43 │ C + } + + ALLOC1 (size: 8, align: 1) { + 42 28 45 6d 70 74 79 29 │ B(Empty) + } + + ALLOC2 (size: 8, align: 1) { + 41 28 45 6d 70 74 79 29 │ A(Empty) + } + diff --git a/tests/mir-opt/unreachable_enum_branching.simple.UnreachableEnumBranching.panic-unwind.diff b/tests/mir-opt/unreachable_enum_branching.simple.UnreachableEnumBranching.panic-unwind.diff index 5c08648fac3b..c24bd7e7446d 100644 --- a/tests/mir-opt/unreachable_enum_branching.simple.UnreachableEnumBranching.panic-unwind.diff +++ b/tests/mir-opt/unreachable_enum_branching.simple.UnreachableEnumBranching.panic-unwind.diff @@ -51,3 +51,15 @@ } } + ALLOC0 (size: 1, align: 1) { + 43 │ C + } + + ALLOC1 (size: 8, align: 1) { + 42 28 45 6d 70 74 79 29 │ B(Empty) + } + + ALLOC2 (size: 8, align: 1) { + 41 28 45 6d 70 74 79 29 │ A(Empty) + } + From 0460c92d527dbada3fde227d3f01e6d1e132a186 Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Thu, 3 Jul 2025 18:41:12 +0000 Subject: [PATCH 130/139] Remove useless lifetime parameter. --- .../rustc_codegen_cranelift/src/constant.rs | 6 +++--- compiler/rustc_codegen_ssa/src/common.rs | 2 +- .../rustc_codegen_ssa/src/mir/constant.rs | 2 +- compiler/rustc_codegen_ssa/src/mir/operand.rs | 4 ++-- .../src/const_eval/eval_queries.rs | 8 +++---- .../rustc_const_eval/src/const_eval/mod.rs | 2 +- .../src/const_eval/valtrees.rs | 2 +- .../src/interpret/intrinsics.rs | 3 +-- .../rustc_const_eval/src/interpret/operand.rs | 4 ++-- .../src/util/caller_location.rs | 2 +- compiler/rustc_middle/src/hooks/mod.rs | 4 ++-- compiler/rustc_middle/src/mir/consts.rs | 21 +++++++++---------- .../rustc_middle/src/mir/interpret/error.rs | 2 +- compiler/rustc_middle/src/mir/pretty.rs | 12 +++++------ compiler/rustc_middle/src/mir/query.rs | 2 +- compiler/rustc_middle/src/query/erase.rs | 6 +++--- compiler/rustc_middle/src/query/mod.rs | 2 +- .../rustc_middle/src/ty/structural_impls.rs | 3 ++- .../src/builder/expr/as_constant.rs | 20 +++--------------- compiler/rustc_mir_build/src/builder/mod.rs | 6 +----- compiler/rustc_mir_transform/src/gvn.rs | 2 +- compiler/rustc_monomorphize/src/collector.rs | 13 ++++-------- compiler/rustc_public/src/alloc.rs | 6 +++--- .../rustc_public_bridge/src/context/impls.rs | 7 ++----- .../clippy/clippy_lints/src/non_copy_const.rs | 4 ++-- 25 files changed, 59 insertions(+), 86 deletions(-) diff --git a/compiler/rustc_codegen_cranelift/src/constant.rs b/compiler/rustc_codegen_cranelift/src/constant.rs index a7e9d7c7bae5..a04cfa272376 100644 --- a/compiler/rustc_codegen_cranelift/src/constant.rs +++ b/compiler/rustc_codegen_cranelift/src/constant.rs @@ -74,7 +74,7 @@ pub(crate) fn codegen_tls_ref<'tcx>( pub(crate) fn eval_mir_constant<'tcx>( fx: &FunctionCx<'_, '_, 'tcx>, constant: &ConstOperand<'tcx>, -) -> (ConstValue<'tcx>, Ty<'tcx>) { +) -> (ConstValue, Ty<'tcx>) { let cv = fx.monomorphize(constant.const_); // This cannot fail because we checked all required_consts in advance. let val = cv @@ -93,7 +93,7 @@ pub(crate) fn codegen_constant_operand<'tcx>( pub(crate) fn codegen_const_value<'tcx>( fx: &mut FunctionCx<'_, '_, 'tcx>, - const_val: ConstValue<'tcx>, + const_val: ConstValue, ty: Ty<'tcx>, ) -> CValue<'tcx> { let layout = fx.layout_of(ty); @@ -210,7 +210,7 @@ pub(crate) fn codegen_const_value<'tcx>( .offset_i64(fx, i64::try_from(offset.bytes()).unwrap()), layout, ), - ConstValue::Slice { alloc_id, meta, phantom: _ } => { + ConstValue::Slice { alloc_id, meta } => { let ptr = pointer_for_allocation(fx, alloc_id).get_addr(fx); let len = fx.bcx.ins().iconst(fx.pointer_type, meta as i64); CValue::by_val_pair(ptr, len, layout) diff --git a/compiler/rustc_codegen_ssa/src/common.rs b/compiler/rustc_codegen_ssa/src/common.rs index 48565e0b4de4..a6fd6c763edd 100644 --- a/compiler/rustc_codegen_ssa/src/common.rs +++ b/compiler/rustc_codegen_ssa/src/common.rs @@ -148,7 +148,7 @@ pub(crate) fn shift_mask_val<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( pub fn asm_const_to_str<'tcx>( tcx: TyCtxt<'tcx>, sp: Span, - const_value: mir::ConstValue<'tcx>, + const_value: mir::ConstValue, ty_and_layout: TyAndLayout<'tcx>, ) -> String { let mir::ConstValue::Scalar(scalar) = const_value else { diff --git a/compiler/rustc_codegen_ssa/src/mir/constant.rs b/compiler/rustc_codegen_ssa/src/mir/constant.rs index 68a56044a07c..11b6ab3cdf1a 100644 --- a/compiler/rustc_codegen_ssa/src/mir/constant.rs +++ b/compiler/rustc_codegen_ssa/src/mir/constant.rs @@ -20,7 +20,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { OperandRef::from_const(bx, val, ty) } - pub fn eval_mir_constant(&self, constant: &mir::ConstOperand<'tcx>) -> mir::ConstValue<'tcx> { + pub fn eval_mir_constant(&self, constant: &mir::ConstOperand<'tcx>) -> mir::ConstValue { // `MirUsedCollector` visited all required_consts before codegen began, so if we got here // there can be no more constants that fail to evaluate. self.monomorphize(constant.const_) diff --git a/compiler/rustc_codegen_ssa/src/mir/operand.rs b/compiler/rustc_codegen_ssa/src/mir/operand.rs index 41cdd4dd980a..8e308aac769b 100644 --- a/compiler/rustc_codegen_ssa/src/mir/operand.rs +++ b/compiler/rustc_codegen_ssa/src/mir/operand.rs @@ -140,7 +140,7 @@ impl<'a, 'tcx, V: CodegenObject> OperandRef<'tcx, V> { pub(crate) fn from_const>( bx: &mut Bx, - val: mir::ConstValue<'tcx>, + val: mir::ConstValue, ty: Ty<'tcx>, ) -> Self { let layout = bx.layout_of(ty); @@ -154,7 +154,7 @@ impl<'a, 'tcx, V: CodegenObject> OperandRef<'tcx, V> { OperandValue::Immediate(llval) } ConstValue::ZeroSized => return OperandRef::zero_sized(layout), - ConstValue::Slice { alloc_id, meta, phantom: _ } => { + ConstValue::Slice { alloc_id, meta } => { let BackendRepr::ScalarPair(a_scalar, _) = layout.backend_repr else { bug!("from_const: invalid ScalarPair layout: {:#?}", layout); }; diff --git a/compiler/rustc_const_eval/src/const_eval/eval_queries.rs b/compiler/rustc_const_eval/src/const_eval/eval_queries.rs index 0b311d36975b..5835660e1c38 100644 --- a/compiler/rustc_const_eval/src/const_eval/eval_queries.rs +++ b/compiler/rustc_const_eval/src/const_eval/eval_queries.rs @@ -152,7 +152,7 @@ pub(crate) fn mk_eval_cx_to_read_const_val<'tcx>( pub fn mk_eval_cx_for_const_val<'tcx>( tcx: TyCtxtAt<'tcx>, typing_env: ty::TypingEnv<'tcx>, - val: mir::ConstValue<'tcx>, + val: mir::ConstValue, ty: Ty<'tcx>, ) -> Option<(CompileTimeInterpCx<'tcx>, OpTy<'tcx>)> { let ecx = mk_eval_cx_to_read_const_val(tcx.tcx, tcx.span, typing_env, CanAccessMutGlobal::No); @@ -172,7 +172,7 @@ pub(super) fn op_to_const<'tcx>( ecx: &CompileTimeInterpCx<'tcx>, op: &OpTy<'tcx>, for_diagnostics: bool, -) -> ConstValue<'tcx> { +) -> ConstValue { // Handle ZST consistently and early. if op.layout.is_zst() { return ConstValue::ZeroSized; @@ -243,7 +243,7 @@ pub(super) fn op_to_const<'tcx>( let alloc_id = prov.alloc_id(); assert!(offset == abi::Size::ZERO, "{}", msg); let meta = b.to_target_usize(ecx).expect(msg); - ConstValue::Slice { alloc_id, meta, phantom: std::marker::PhantomData } + ConstValue::Slice { alloc_id, meta } } Immediate::Uninit => bug!("`Uninit` is not a valid value for {}", op.layout.ty), }, @@ -255,7 +255,7 @@ pub(crate) fn turn_into_const_value<'tcx>( tcx: TyCtxt<'tcx>, constant: ConstAlloc<'tcx>, key: ty::PseudoCanonicalInput<'tcx, GlobalId<'tcx>>, -) -> ConstValue<'tcx> { +) -> ConstValue { let cid = key.value; let def_id = cid.instance.def.def_id(); let is_static = tcx.is_static(def_id); diff --git a/compiler/rustc_const_eval/src/const_eval/mod.rs b/compiler/rustc_const_eval/src/const_eval/mod.rs index 0082f90f3b8c..624ca1dd2da0 100644 --- a/compiler/rustc_const_eval/src/const_eval/mod.rs +++ b/compiler/rustc_const_eval/src/const_eval/mod.rs @@ -28,7 +28,7 @@ const VALTREE_MAX_NODES: usize = 100000; #[instrument(skip(tcx), level = "debug")] pub(crate) fn try_destructure_mir_constant_for_user_output<'tcx>( tcx: TyCtxt<'tcx>, - val: mir::ConstValue<'tcx>, + val: mir::ConstValue, ty: Ty<'tcx>, ) -> Option> { let typing_env = ty::TypingEnv::fully_monomorphized(); diff --git a/compiler/rustc_const_eval/src/const_eval/valtrees.rs b/compiler/rustc_const_eval/src/const_eval/valtrees.rs index 5ab72c853c4f..37c6c4a61d8d 100644 --- a/compiler/rustc_const_eval/src/const_eval/valtrees.rs +++ b/compiler/rustc_const_eval/src/const_eval/valtrees.rs @@ -259,7 +259,7 @@ pub fn valtree_to_const_value<'tcx>( tcx: TyCtxt<'tcx>, typing_env: ty::TypingEnv<'tcx>, cv: ty::Value<'tcx>, -) -> mir::ConstValue<'tcx> { +) -> mir::ConstValue { // Basic idea: We directly construct `Scalar` values from trivial `ValTree`s // (those for constants with type bool, int, uint, float or char). // For all other types we create an `MPlace` and fill that by walking diff --git a/compiler/rustc_const_eval/src/interpret/intrinsics.rs b/compiler/rustc_const_eval/src/interpret/intrinsics.rs index b1e9f1e8bd26..5e3d0a15d8bc 100644 --- a/compiler/rustc_const_eval/src/interpret/intrinsics.rs +++ b/compiler/rustc_const_eval/src/interpret/intrinsics.rs @@ -3,7 +3,6 @@ //! and miri. use std::assert_matches::assert_matches; -use std::marker::PhantomData; use rustc_abi::{FieldIdx, HasDataLayout, Size}; use rustc_apfloat::ieee::{Double, Half, Quad, Single}; @@ -129,7 +128,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> { let tp_ty = instance.args.type_at(0); ensure_monomorphic_enough(tcx, tp_ty)?; let (alloc_id, meta) = alloc_type_name(tcx, tp_ty); - let val = ConstValue::Slice { alloc_id, meta, phantom: PhantomData }; + let val = ConstValue::Slice { alloc_id, meta }; let val = self.const_val_to_op(val, dest.layout.ty, Some(dest.layout))?; self.copy_op(&val, dest)?; } diff --git a/compiler/rustc_const_eval/src/interpret/operand.rs b/compiler/rustc_const_eval/src/interpret/operand.rs index ed48e6799e67..21afd082a055 100644 --- a/compiler/rustc_const_eval/src/interpret/operand.rs +++ b/compiler/rustc_const_eval/src/interpret/operand.rs @@ -836,7 +836,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> { pub(crate) fn const_val_to_op( &self, - val_val: mir::ConstValue<'tcx>, + val_val: mir::ConstValue, ty: Ty<'tcx>, layout: Option>, ) -> InterpResult<'tcx, OpTy<'tcx, M::Provenance>> { @@ -860,7 +860,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> { } mir::ConstValue::Scalar(x) => adjust_scalar(x)?.into(), mir::ConstValue::ZeroSized => Immediate::Uninit, - mir::ConstValue::Slice { alloc_id, meta, phantom: _ } => { + mir::ConstValue::Slice { alloc_id, meta } => { // This is const data, no mutation allowed. let ptr = Pointer::new(CtfeProvenance::from(alloc_id).as_immutable(), Size::ZERO); Immediate::new_slice(self.global_root_pointer(ptr)?.into(), meta, self) diff --git a/compiler/rustc_const_eval/src/util/caller_location.rs b/compiler/rustc_const_eval/src/util/caller_location.rs index f489b05fbbd7..c437934eaabe 100644 --- a/compiler/rustc_const_eval/src/util/caller_location.rs +++ b/compiler/rustc_const_eval/src/util/caller_location.rs @@ -57,7 +57,7 @@ pub(crate) fn const_caller_location_provider( file: Symbol, line: u32, col: u32, -) -> mir::ConstValue<'_> { +) -> mir::ConstValue { trace!("const_caller_location: {}:{}:{}", file, line, col); let mut ecx = mk_eval_cx_to_read_const_val( tcx, diff --git a/compiler/rustc_middle/src/hooks/mod.rs b/compiler/rustc_middle/src/hooks/mod.rs index c5ce6efcb817..9d2f0a452371 100644 --- a/compiler/rustc_middle/src/hooks/mod.rs +++ b/compiler/rustc_middle/src/hooks/mod.rs @@ -50,10 +50,10 @@ macro_rules! declare_hooks { declare_hooks! { /// Tries to destructure an `mir::Const` ADT or array into its variant index /// and its field values. This should only be used for pretty printing. - hook try_destructure_mir_constant_for_user_output(val: mir::ConstValue<'tcx>, ty: Ty<'tcx>) -> Option>; + hook try_destructure_mir_constant_for_user_output(val: mir::ConstValue, ty: Ty<'tcx>) -> Option>; /// Getting a &core::panic::Location referring to a span. - hook const_caller_location(file: rustc_span::Symbol, line: u32, col: u32) -> mir::ConstValue<'tcx>; + hook const_caller_location(file: rustc_span::Symbol, line: u32, col: u32) -> mir::ConstValue; /// Returns `true` if this def is a function-like thing that is eligible for /// coverage instrumentation under `-Cinstrument-coverage`. diff --git a/compiler/rustc_middle/src/mir/consts.rs b/compiler/rustc_middle/src/mir/consts.rs index 0be274511dca..96131d47a177 100644 --- a/compiler/rustc_middle/src/mir/consts.rs +++ b/compiler/rustc_middle/src/mir/consts.rs @@ -30,9 +30,9 @@ pub struct ConstAlloc<'tcx> { /// Represents a constant value in Rust. `Scalar` and `Slice` are optimizations for /// array length computations, enum discriminants and the pattern matching logic. -#[derive(Copy, Clone, Debug, Eq, PartialEq, TyEncodable, TyDecodable, Lift, Hash)] +#[derive(Copy, Clone, Debug, Eq, PartialEq, TyEncodable, TyDecodable, Hash)] #[derive(HashStable)] -pub enum ConstValue<'tcx> { +pub enum ConstValue { /// Used for types with `layout::abi::Scalar` ABI. /// /// Not using the enum `Value` to encode that this must not be `Uninit`. @@ -54,7 +54,6 @@ pub enum ConstValue<'tcx> { /// The metadata field of the reference. /// This is a "target usize", so we use `u64` as in the interpreter. meta: u64, - phantom: std::marker::PhantomData<&'tcx ()>, }, /// A value not representable by the other variants; needs to be stored in-memory. @@ -74,9 +73,9 @@ pub enum ConstValue<'tcx> { } #[cfg(target_pointer_width = "64")] -rustc_data_structures::static_assert_size!(ConstValue<'_>, 24); +rustc_data_structures::static_assert_size!(ConstValue, 24); -impl ConstValue<'_> { +impl ConstValue { #[inline] pub fn try_to_scalar(&self) -> Option { match *self { @@ -139,7 +138,7 @@ impl ConstValue<'_> { ConstValue::Scalar(_) | ConstValue::ZeroSized => { bug!("`try_get_slice_bytes` on non-slice constant") } - &ConstValue::Slice { alloc_id, meta, phantom: _ } => (alloc_id, 0, meta), + &ConstValue::Slice { alloc_id, meta } => (alloc_id, 0, meta), &ConstValue::Indirect { alloc_id, offset } => { // The reference itself is stored behind an indirection. // Load the reference, and then load the actual slice contents. @@ -192,7 +191,7 @@ impl ConstValue<'_> { ConstValue::Scalar(Scalar::Ptr(..)) => return true, // It's hard to find out the part of the allocation we point to; // just conservatively check everything. - ConstValue::Slice { alloc_id, meta: _, phantom: _ } => { + ConstValue::Slice { alloc_id, meta: _ } => { !tcx.global_alloc(alloc_id).unwrap_memory().inner().provenance().ptrs().is_empty() } ConstValue::Indirect { alloc_id, offset } => !tcx @@ -252,7 +251,7 @@ pub enum Const<'tcx> { /// This constant cannot go back into the type system, as it represents /// something the type system cannot handle (e.g. pointers). - Val(ConstValue<'tcx>, Ty<'tcx>), + Val(ConstValue, Ty<'tcx>), } impl<'tcx> Const<'tcx> { @@ -348,7 +347,7 @@ impl<'tcx> Const<'tcx> { tcx: TyCtxt<'tcx>, typing_env: ty::TypingEnv<'tcx>, span: Span, - ) -> Result, ErrorHandled> { + ) -> Result { match self { Const::Ty(_, c) => { if c.has_non_region_param() { @@ -445,7 +444,7 @@ impl<'tcx> Const<'tcx> { } #[inline] - pub fn from_value(val: ConstValue<'tcx>, ty: Ty<'tcx>) -> Self { + pub fn from_value(val: ConstValue, ty: Ty<'tcx>) -> Self { Self::Val(val, ty) } @@ -578,7 +577,7 @@ impl<'tcx> Display for Const<'tcx> { /// Const-related utilities impl<'tcx> TyCtxt<'tcx> { - pub fn span_as_caller_location(self, span: Span) -> ConstValue<'tcx> { + pub fn span_as_caller_location(self, span: Span) -> ConstValue { let topmost = span.ctxt().outer_expn().expansion_cause().unwrap_or(span); let caller = self.sess.source_map().lookup_char_pos(topmost.lo()); self.const_caller_location( diff --git a/compiler/rustc_middle/src/mir/interpret/error.rs b/compiler/rustc_middle/src/mir/interpret/error.rs index 3e68afbfabd0..2b0cfb865645 100644 --- a/compiler/rustc_middle/src/mir/interpret/error.rs +++ b/compiler/rustc_middle/src/mir/interpret/error.rs @@ -137,7 +137,7 @@ impl<'tcx> ValTreeCreationError<'tcx> { pub type EvalToAllocationRawResult<'tcx> = Result, ErrorHandled>; pub type EvalStaticInitializerRawResult<'tcx> = Result, ErrorHandled>; -pub type EvalToConstValueResult<'tcx> = Result, ErrorHandled>; +pub type EvalToConstValueResult<'tcx> = Result; pub type EvalToValTreeResult<'tcx> = Result, ValTreeCreationError<'tcx>>; #[cfg(target_pointer_width = "64")] diff --git a/compiler/rustc_middle/src/mir/pretty.rs b/compiler/rustc_middle/src/mir/pretty.rs index 045b27396f11..809cdb329f79 100644 --- a/compiler/rustc_middle/src/mir/pretty.rs +++ b/compiler/rustc_middle/src/mir/pretty.rs @@ -1465,7 +1465,7 @@ impl<'tcx> Visitor<'tcx> for ExtraComments<'tcx> { self.push(&format!("+ user_ty: {user_ty:?}")); } - let fmt_val = |val: ConstValue<'tcx>, ty: Ty<'tcx>| { + let fmt_val = |val: ConstValue, ty: Ty<'tcx>| { let tcx = self.tcx; rustc_data_structures::make_display(move |fmt| { pretty_print_const_value_tcx(tcx, val, ty, fmt) @@ -1562,7 +1562,7 @@ pub fn write_allocations<'tcx>( alloc.inner().provenance().ptrs().values().map(|p| p.alloc_id()) } - fn alloc_id_from_const_val(val: ConstValue<'_>) -> Option { + fn alloc_id_from_const_val(val: ConstValue) -> Option { match val { ConstValue::Scalar(interpret::Scalar::Ptr(ptr, _)) => Some(ptr.provenance.alloc_id()), ConstValue::Scalar(interpret::Scalar::Int { .. }) => None, @@ -1881,7 +1881,7 @@ fn pretty_print_byte_str(fmt: &mut Formatter<'_>, byte_str: &[u8]) -> fmt::Resul fn comma_sep<'tcx>( tcx: TyCtxt<'tcx>, fmt: &mut Formatter<'_>, - elems: Vec<(ConstValue<'tcx>, Ty<'tcx>)>, + elems: Vec<(ConstValue, Ty<'tcx>)>, ) -> fmt::Result { let mut first = true; for (ct, ty) in elems { @@ -1896,7 +1896,7 @@ fn comma_sep<'tcx>( fn pretty_print_const_value_tcx<'tcx>( tcx: TyCtxt<'tcx>, - ct: ConstValue<'tcx>, + ct: ConstValue, ty: Ty<'tcx>, fmt: &mut Formatter<'_>, ) -> fmt::Result { @@ -1943,7 +1943,7 @@ fn pretty_print_const_value_tcx<'tcx>( let ct = tcx.lift(ct).unwrap(); let ty = tcx.lift(ty).unwrap(); if let Some(contents) = tcx.try_destructure_mir_constant_for_user_output(ct, ty) { - let fields: Vec<(ConstValue<'_>, Ty<'_>)> = contents.fields.to_vec(); + let fields: Vec<(ConstValue, Ty<'_>)> = contents.fields.to_vec(); match *ty.kind() { ty::Array(..) => { fmt.write_str("[")?; @@ -2024,7 +2024,7 @@ fn pretty_print_const_value_tcx<'tcx>( } pub(crate) fn pretty_print_const_value<'tcx>( - ct: ConstValue<'tcx>, + ct: ConstValue, ty: Ty<'tcx>, fmt: &mut Formatter<'_>, ) -> fmt::Result { diff --git a/compiler/rustc_middle/src/mir/query.rs b/compiler/rustc_middle/src/mir/query.rs index 3fc05f2caf2a..a8a95c699d88 100644 --- a/compiler/rustc_middle/src/mir/query.rs +++ b/compiler/rustc_middle/src/mir/query.rs @@ -173,5 +173,5 @@ pub enum AnnotationSource { #[derive(Copy, Clone, Debug, HashStable)] pub struct DestructuredConstant<'tcx> { pub variant: Option, - pub fields: &'tcx [(ConstValue<'tcx>, Ty<'tcx>)], + pub fields: &'tcx [(ConstValue, Ty<'tcx>)], } diff --git a/compiler/rustc_middle/src/query/erase.rs b/compiler/rustc_middle/src/query/erase.rs index f138c5ca039e..dab5900b4ab1 100644 --- a/compiler/rustc_middle/src/query/erase.rs +++ b/compiler/rustc_middle/src/query/erase.rs @@ -153,8 +153,8 @@ impl EraseType for Result, mir::interpret::ErrorHandled> { type Result = [u8; size_of::, mir::interpret::ErrorHandled>>()]; } -impl EraseType for Result, mir::interpret::ErrorHandled> { - type Result = [u8; size_of::, mir::interpret::ErrorHandled>>()]; +impl EraseType for Result { + type Result = [u8; size_of::>()]; } impl EraseType for EvalToValTreeResult<'_> { @@ -301,6 +301,7 @@ trivial! { rustc_middle::middle::resolve_bound_vars::ResolvedArg, rustc_middle::middle::stability::DeprecationEntry, rustc_middle::mir::ConstQualifs, + rustc_middle::mir::ConstValue, rustc_middle::mir::interpret::AllocId, rustc_middle::mir::interpret::CtfeProvenance, rustc_middle::mir::interpret::ErrorHandled, @@ -362,7 +363,6 @@ tcx_lifetime! { rustc_middle::mir::Const, rustc_middle::mir::DestructuredConstant, rustc_middle::mir::ConstAlloc, - rustc_middle::mir::ConstValue, rustc_middle::mir::interpret::GlobalId, rustc_middle::mir::interpret::LitToConstInput, rustc_middle::mir::interpret::EvalStaticInitializerRawResult, diff --git a/compiler/rustc_middle/src/query/mod.rs b/compiler/rustc_middle/src/query/mod.rs index ad7f4973e235..638dc2c78e4d 100644 --- a/compiler/rustc_middle/src/query/mod.rs +++ b/compiler/rustc_middle/src/query/mod.rs @@ -1363,7 +1363,7 @@ rustc_queries! { } /// Converts a type-level constant value into a MIR constant value. - query valtree_to_const_val(key: ty::Value<'tcx>) -> mir::ConstValue<'tcx> { + query valtree_to_const_val(key: ty::Value<'tcx>) -> mir::ConstValue { desc { "converting type-level constant value to MIR constant value"} } diff --git a/compiler/rustc_middle/src/ty/structural_impls.rs b/compiler/rustc_middle/src/ty/structural_impls.rs index 2dfc2a2190fa..a5fdce93e4b2 100644 --- a/compiler/rustc_middle/src/ty/structural_impls.rs +++ b/compiler/rustc_middle/src/ty/structural_impls.rs @@ -235,6 +235,7 @@ TrivialLiftImpls! { rustc_abi::ExternAbi, rustc_abi::Size, rustc_hir::Safety, + rustc_middle::mir::ConstValue, rustc_type_ir::BoundConstness, rustc_type_ir::PredicatePolarity, // tidy-alphabetical-end @@ -251,7 +252,7 @@ TrivialTypeTraversalImpls! { crate::mir::BlockTailInfo, crate::mir::BorrowKind, crate::mir::CastKind, - crate::mir::ConstValue<'tcx>, + crate::mir::ConstValue, crate::mir::CoroutineSavedLocal, crate::mir::FakeReadCause, crate::mir::Local, diff --git a/compiler/rustc_mir_build/src/builder/expr/as_constant.rs b/compiler/rustc_mir_build/src/builder/expr/as_constant.rs index 4a532c3bb2db..0e0c7a7fa4f0 100644 --- a/compiler/rustc_mir_build/src/builder/expr/as_constant.rs +++ b/compiler/rustc_mir_build/src/builder/expr/as_constant.rs @@ -1,7 +1,5 @@ //! See docs in build/expr/mod.rs -use std::marker::PhantomData; - use rustc_abi::Size; use rustc_ast as ast; use rustc_hir::LangItem; @@ -125,11 +123,7 @@ fn lit_to_mir_constant<'tcx>(tcx: TyCtxt<'tcx>, lit_input: LitToConstInput<'tcx> let s = s.as_str().as_bytes(); let len = s.len(); let allocation = tcx.allocate_bytes_dedup(s, CTFE_ALLOC_SALT); - ConstValue::Slice { - alloc_id: allocation, - meta: len.try_into().unwrap(), - phantom: PhantomData, - } + ConstValue::Slice { alloc_id: allocation, meta: len.try_into().unwrap() } } (ast::LitKind::ByteStr(byte_sym, _), ty::Ref(_, inner_ty, _)) if matches!(inner_ty.kind(), ty::Slice(_)) => @@ -137,11 +131,7 @@ fn lit_to_mir_constant<'tcx>(tcx: TyCtxt<'tcx>, lit_input: LitToConstInput<'tcx> let data = byte_sym.as_byte_str(); let len = data.len(); let allocation = tcx.allocate_bytes_dedup(data, CTFE_ALLOC_SALT); - ConstValue::Slice { - alloc_id: allocation, - meta: len.try_into().unwrap(), - phantom: PhantomData, - } + ConstValue::Slice { alloc_id: allocation, meta: len.try_into().unwrap() } } (ast::LitKind::ByteStr(byte_sym, _), ty::Ref(_, inner_ty, _)) if inner_ty.is_array() => { let id = tcx.allocate_bytes_dedup(byte_sym.as_byte_str(), CTFE_ALLOC_SALT); @@ -152,11 +142,7 @@ fn lit_to_mir_constant<'tcx>(tcx: TyCtxt<'tcx>, lit_input: LitToConstInput<'tcx> let data = byte_sym.as_byte_str(); let len = data.len(); let allocation = tcx.allocate_bytes_dedup(data, CTFE_ALLOC_SALT); - ConstValue::Slice { - alloc_id: allocation, - meta: len.try_into().unwrap(), - phantom: PhantomData, - } + ConstValue::Slice { alloc_id: allocation, meta: len.try_into().unwrap() } } (ast::LitKind::Byte(n), ty::Uint(ty::UintTy::U8)) => { ConstValue::Scalar(Scalar::from_uint(n, Size::from_bytes(1))) diff --git a/compiler/rustc_mir_build/src/builder/mod.rs b/compiler/rustc_mir_build/src/builder/mod.rs index 3d5f6f4cf451..855cd2f3bc0a 100644 --- a/compiler/rustc_mir_build/src/builder/mod.rs +++ b/compiler/rustc_mir_build/src/builder/mod.rs @@ -1045,11 +1045,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { } } -fn parse_float_into_constval<'tcx>( - num: Symbol, - float_ty: ty::FloatTy, - neg: bool, -) -> Option> { +fn parse_float_into_constval(num: Symbol, float_ty: ty::FloatTy, neg: bool) -> Option { parse_float_into_scalar(num, float_ty, neg).map(|s| ConstValue::Scalar(s.into())) } diff --git a/compiler/rustc_mir_transform/src/gvn.rs b/compiler/rustc_mir_transform/src/gvn.rs index 6657f89ceb59..dc99b67a1e8c 100644 --- a/compiler/rustc_mir_transform/src/gvn.rs +++ b/compiler/rustc_mir_transform/src/gvn.rs @@ -1542,7 +1542,7 @@ impl<'body, 'tcx> VnState<'body, 'tcx> { fn op_to_prop_const<'tcx>( ecx: &mut InterpCx<'tcx, DummyMachine>, op: &OpTy<'tcx>, -) -> Option> { +) -> Option { // Do not attempt to propagate unsized locals. if op.layout.is_unsized() { return None; diff --git a/compiler/rustc_monomorphize/src/collector.rs b/compiler/rustc_monomorphize/src/collector.rs index 41457f417f2c..d435e4e77b9b 100644 --- a/compiler/rustc_monomorphize/src/collector.rs +++ b/compiler/rustc_monomorphize/src/collector.rs @@ -659,10 +659,7 @@ impl<'a, 'tcx> MirUsedCollector<'a, 'tcx> { } /// Evaluates a *not yet monomorphized* constant. - fn eval_constant( - &mut self, - constant: &mir::ConstOperand<'tcx>, - ) -> Option> { + fn eval_constant(&mut self, constant: &mir::ConstOperand<'tcx>) -> Option { let const_ = self.monomorphize(constant.const_); // Evaluate the constant. This makes const eval failure a collection-time error (rather than // a codegen-time error). rustc stops after collection if there was an error, so this @@ -1355,17 +1352,15 @@ fn visit_mentioned_item<'tcx>( #[instrument(skip(tcx, output), level = "debug")] fn collect_const_value<'tcx>( tcx: TyCtxt<'tcx>, - value: mir::ConstValue<'tcx>, + value: mir::ConstValue, output: &mut MonoItems<'tcx>, ) { match value { mir::ConstValue::Scalar(Scalar::Ptr(ptr, _size)) => { collect_alloc(tcx, ptr.provenance.alloc_id(), output) } - mir::ConstValue::Indirect { alloc_id, .. } => collect_alloc(tcx, alloc_id, output), - mir::ConstValue::Slice { alloc_id, meta: _, phantom: _ } => { - collect_alloc(tcx, alloc_id, output); - } + mir::ConstValue::Indirect { alloc_id, .. } + | mir::ConstValue::Slice { alloc_id, meta: _ } => collect_alloc(tcx, alloc_id, output), _ => {} } } diff --git a/compiler/rustc_public/src/alloc.rs b/compiler/rustc_public/src/alloc.rs index 0174e2e00985..0c35b3b25dfc 100644 --- a/compiler/rustc_public/src/alloc.rs +++ b/compiler/rustc_public/src/alloc.rs @@ -33,7 +33,7 @@ fn new_empty_allocation(align: Align) -> Allocation { #[allow(rustc::usage_of_qualified_ty)] pub(crate) fn new_allocation<'tcx>( ty: rustc_middle::ty::Ty<'tcx>, - const_value: ConstValue<'tcx>, + const_value: ConstValue, tables: &mut Tables<'tcx, BridgeTys>, cx: &CompilerCtxt<'tcx, BridgeTys>, ) -> Allocation { @@ -44,7 +44,7 @@ pub(crate) fn new_allocation<'tcx>( #[allow(rustc::usage_of_qualified_ty)] pub(crate) fn try_new_allocation<'tcx>( ty: rustc_middle::ty::Ty<'tcx>, - const_value: ConstValue<'tcx>, + const_value: ConstValue, tables: &mut Tables<'tcx, BridgeTys>, cx: &CompilerCtxt<'tcx, BridgeTys>, ) -> Result { @@ -54,7 +54,7 @@ pub(crate) fn try_new_allocation<'tcx>( alloc::try_new_scalar(layout, scalar, cx).map(|alloc| alloc.stable(tables, cx)) } ConstValue::ZeroSized => Ok(new_empty_allocation(layout.align.abi)), - ConstValue::Slice { alloc_id, meta, phantom: _ } => { + ConstValue::Slice { alloc_id, meta } => { alloc::try_new_slice(layout, alloc_id, meta, cx).map(|alloc| alloc.stable(tables, cx)) } ConstValue::Indirect { alloc_id, offset } => { diff --git a/compiler/rustc_public_bridge/src/context/impls.rs b/compiler/rustc_public_bridge/src/context/impls.rs index 612e44b56b1a..9b3948d232d7 100644 --- a/compiler/rustc_public_bridge/src/context/impls.rs +++ b/compiler/rustc_public_bridge/src/context/impls.rs @@ -63,7 +63,7 @@ impl<'tcx, B: Bridge> CompilerCtxt<'tcx, B> { self.tcx.coroutine_movability(def_id) } - pub fn valtree_to_const_val(&self, key: ty::Value<'tcx>) -> ConstValue<'tcx> { + pub fn valtree_to_const_val(&self, key: ty::Value<'tcx>) -> ConstValue { self.tcx.valtree_to_const_val(key) } @@ -675,10 +675,7 @@ impl<'tcx, B: Bridge> CompilerCtxt<'tcx, B> { } /// Try to evaluate an instance into a constant. - pub fn eval_instance( - &self, - instance: ty::Instance<'tcx>, - ) -> Result, ErrorHandled> { + pub fn eval_instance(&self, instance: ty::Instance<'tcx>) -> Result { self.tcx.const_eval_instance( self.fully_monomorphized(), instance, diff --git a/src/tools/clippy/clippy_lints/src/non_copy_const.rs b/src/tools/clippy/clippy_lints/src/non_copy_const.rs index 5f10e1968f1d..388c029c9ef4 100644 --- a/src/tools/clippy/clippy_lints/src/non_copy_const.rs +++ b/src/tools/clippy/clippy_lints/src/non_copy_const.rs @@ -338,7 +338,7 @@ impl<'tcx> NonCopyConst<'tcx> { tcx: TyCtxt<'tcx>, typing_env: TypingEnv<'tcx>, ty: Ty<'tcx>, - val: ConstValue<'tcx>, + val: ConstValue, ) -> Result { let ty = tcx.try_normalize_erasing_regions(typing_env, ty).unwrap_or(ty); match self.is_ty_freeze(tcx, typing_env, ty) { @@ -477,7 +477,7 @@ impl<'tcx> NonCopyConst<'tcx> { typing_env: TypingEnv<'tcx>, typeck: &'tcx TypeckResults<'tcx>, mut src_expr: &'tcx Expr<'tcx>, - mut val: ConstValue<'tcx>, + mut val: ConstValue, ) -> Result>, ()> { let mut parents = tcx.hir_parent_iter(src_expr.hir_id); let mut ty = typeck.expr_ty(src_expr); From 967ba2f93d4874f920cb8732724a045b18f525c8 Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Mon, 14 Jul 2025 22:48:24 +0000 Subject: [PATCH 131/139] Remove const deduplication from the interpreter. --- .../src/interpret/eval_context.rs | 8 ++-- .../rustc_const_eval/src/interpret/machine.rs | 22 --------- src/tools/miri/src/machine.rs | 45 ------------------- src/tools/miri/tests/pass/const-addrs.rs | 20 +++------ 4 files changed, 10 insertions(+), 85 deletions(-) diff --git a/compiler/rustc_const_eval/src/interpret/eval_context.rs b/compiler/rustc_const_eval/src/interpret/eval_context.rs index 11e7706fe605..0c888694e49b 100644 --- a/compiler/rustc_const_eval/src/interpret/eval_context.rs +++ b/compiler/rustc_const_eval/src/interpret/eval_context.rs @@ -582,8 +582,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> { span: Span, layout: Option>, ) -> InterpResult<'tcx, OpTy<'tcx, M::Provenance>> { - M::eval_mir_constant(self, *val, span, layout, |ecx, val, span, layout| { - let const_val = val.eval(*ecx.tcx, ecx.typing_env, span).map_err(|err| { + let const_val = val.eval(*self.tcx, self.typing_env, span).map_err(|err| { if M::ALL_CONSTS_ARE_PRECHECKED { match err { ErrorHandled::TooGeneric(..) => {}, @@ -599,11 +598,10 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> { } } } - err.emit_note(*ecx.tcx); + err.emit_note(*self.tcx); err })?; - ecx.const_val_to_op(const_val, val.ty(), layout) - }) + self.const_val_to_op(const_val, val.ty(), layout) } #[must_use] diff --git a/compiler/rustc_const_eval/src/interpret/machine.rs b/compiler/rustc_const_eval/src/interpret/machine.rs index e981f3973ae6..e22629993fba 100644 --- a/compiler/rustc_const_eval/src/interpret/machine.rs +++ b/compiler/rustc_const_eval/src/interpret/machine.rs @@ -12,7 +12,6 @@ use rustc_middle::query::TyCtxtAt; use rustc_middle::ty::Ty; use rustc_middle::ty::layout::TyAndLayout; use rustc_middle::{mir, ty}; -use rustc_span::Span; use rustc_span::def_id::DefId; use rustc_target::callconv::FnAbi; @@ -587,27 +586,6 @@ pub trait Machine<'tcx>: Sized { interp_ok(()) } - /// Evaluate the given constant. The `eval` function will do all the required evaluation, - /// but this hook has the chance to do some pre/postprocessing. - #[inline(always)] - fn eval_mir_constant( - ecx: &InterpCx<'tcx, Self>, - val: mir::Const<'tcx>, - span: Span, - layout: Option>, - eval: F, - ) -> InterpResult<'tcx, OpTy<'tcx, Self::Provenance>> - where - F: Fn( - &InterpCx<'tcx, Self>, - mir::Const<'tcx>, - Span, - Option>, - ) -> InterpResult<'tcx, OpTy<'tcx, Self::Provenance>>, - { - eval(ecx, val, span, layout) - } - /// Returns the salt to be used for a deduplicated global alloation. /// If the allocation is for a function, the instance is provided as well /// (this lets Miri ensure unique addresses for some functions). diff --git a/src/tools/miri/src/machine.rs b/src/tools/miri/src/machine.rs index ce33c870b4b5..7271d3f619c7 100644 --- a/src/tools/miri/src/machine.rs +++ b/src/tools/miri/src/machine.rs @@ -4,7 +4,6 @@ use std::any::Any; use std::borrow::Cow; use std::cell::{Cell, RefCell}; -use std::collections::hash_map::Entry; use std::path::Path; use std::rc::Rc; use std::{fmt, process}; @@ -70,12 +69,6 @@ pub struct FrameExtra<'tcx> { /// This is used by `MiriMachine::current_span` and `MiriMachine::caller_span` pub is_user_relevant: bool, - /// We have a cache for the mapping from [`mir::Const`] to resulting [`AllocId`]. - /// However, we don't want all frames to always get the same result, so we insert - /// an additional bit of "salt" into the cache key. This salt is fixed per-frame - /// so that within a call, a const will have a stable address. - salt: usize, - /// Data race detector per-frame data. pub data_race: Option, } @@ -88,14 +81,12 @@ impl<'tcx> std::fmt::Debug for FrameExtra<'tcx> { catch_unwind, timing: _, is_user_relevant, - salt, data_race, } = self; f.debug_struct("FrameData") .field("borrow_tracker", borrow_tracker) .field("catch_unwind", catch_unwind) .field("is_user_relevant", is_user_relevant) - .field("salt", salt) .field("data_race", data_race) .finish() } @@ -108,7 +99,6 @@ impl VisitProvenance for FrameExtra<'_> { borrow_tracker, timing: _, is_user_relevant: _, - salt: _, data_race: _, } = self; @@ -578,11 +568,6 @@ pub struct MiriMachine<'tcx> { /// diagnostics. pub(crate) allocation_spans: RefCell)>>, - /// Maps MIR consts to their evaluated result. We combine the const with a "salt" (`usize`) - /// that is fixed per stack frame; this lets us have sometimes different results for the - /// same const while ensuring consistent results within a single call. - const_cache: RefCell, usize), OpTy<'tcx>>>, - /// For each allocation, an offset inside that allocation that was deemed aligned even for /// symbolic alignment checks. This cannot be stored in `AllocExtra` since it needs to be /// tracked for vtables and function allocations as well as regular allocations. @@ -764,7 +749,6 @@ impl<'tcx> MiriMachine<'tcx> { stack_size, collect_leak_backtraces: config.collect_leak_backtraces, allocation_spans: RefCell::new(FxHashMap::default()), - const_cache: RefCell::new(FxHashMap::default()), symbolic_alignment: RefCell::new(FxHashMap::default()), union_data_ranges: FxHashMap::default(), pthread_mutex_sanity: Cell::new(false), @@ -941,7 +925,6 @@ impl VisitProvenance for MiriMachine<'_> { stack_size: _, collect_leak_backtraces: _, allocation_spans: _, - const_cache: _, symbolic_alignment: _, union_data_ranges: _, pthread_mutex_sanity: _, @@ -1578,7 +1561,6 @@ impl<'tcx> Machine<'tcx> for MiriMachine<'tcx> { catch_unwind: None, timing, is_user_relevant: ecx.machine.is_user_relevant(&frame), - salt: ecx.machine.rng.borrow_mut().random_range(0..ADDRS_PER_ANON_GLOBAL), data_race: ecx .machine .data_race @@ -1737,33 +1719,6 @@ impl<'tcx> Machine<'tcx> for MiriMachine<'tcx> { interp_ok(()) } - fn eval_mir_constant( - ecx: &InterpCx<'tcx, Self>, - val: mir::Const<'tcx>, - span: Span, - layout: Option>, - eval: F, - ) -> InterpResult<'tcx, OpTy<'tcx>> - where - F: Fn( - &InterpCx<'tcx, Self>, - mir::Const<'tcx>, - Span, - Option>, - ) -> InterpResult<'tcx, OpTy<'tcx>>, - { - let frame = ecx.active_thread_stack().last().unwrap(); - let mut cache = ecx.machine.const_cache.borrow_mut(); - match cache.entry((val, frame.extra.salt)) { - Entry::Vacant(ve) => { - let op = eval(ecx, val, span, layout)?; - ve.insert(op.clone()); - interp_ok(op) - } - Entry::Occupied(oe) => interp_ok(oe.get().clone()), - } - } - fn get_global_alloc_salt( ecx: &InterpCx<'tcx, Self>, instance: Option>, diff --git a/src/tools/miri/tests/pass/const-addrs.rs b/src/tools/miri/tests/pass/const-addrs.rs index af68b28b2b8c..0d1531c73cd0 100644 --- a/src/tools/miri/tests/pass/const-addrs.rs +++ b/src/tools/miri/tests/pass/const-addrs.rs @@ -1,14 +1,10 @@ -// The const fn interpreter creates a new AllocId every time it evaluates any const. -// If we do that in Miri, repeatedly evaluating a const causes unbounded memory use -// we need to keep track of the base address for that AllocId, and the allocation is never -// deallocated. -// In Miri we explicitly store previously-assigned AllocIds for each const and ensure -// that we only hand out a finite number of AllocIds per const. -// MIR inlining will put every evaluation of the const we're repeatedly evaluating into the same -// stack frame, breaking this test. +// The interpreter used to create a new AllocId every time it evaluates any const. +// This caused unbounded memory use in Miri. +// This test verifies that we only create a bounded amount of addresses for any given const. +// In practice, the interpreter always returns the same address, but we *do not guarantee* that. //@compile-flags: -Zinline-mir=no -const EVALS: usize = 256; +const EVALS: usize = 64; use std::collections::HashSet; fn main() { @@ -16,10 +12,8 @@ fn main() { for _ in 0..EVALS { addrs.insert(const_addr()); } - // Check that the const allocation has multiple base addresses - assert!(addrs.len() > 1); - // But also that we get a limited number of unique base addresses - assert!(addrs.len() < EVALS); + // Check that we always return the same base address for the const allocation. + assert_eq!(addrs.len(), 1); // Check that within a call we always produce the same address let mut prev = 0; From e44a7386c27f821515804fa90ed39ca1e931f8de Mon Sep 17 00:00:00 2001 From: Oli Scherer Date: Thu, 24 Jul 2025 08:15:03 +0000 Subject: [PATCH 132/139] Remove dead code and extend test coverage and diagnostics around it We lost the following comment during refactorings: The current code for niche-filling relies on variant indices instead of actual discriminants, so enums with explicit discriminants (RFC 2363) would misbehave. --- compiler/rustc_abi/src/layout.rs | 12 +----- .../rustc_hir_analysis/src/check/check.rs | 38 ++++++++++++++----- compiler/rustc_ty_utils/src/layout.rs | 8 ---- .../crates/hir-ty/src/layout/adt.rs | 16 ++------ .../arbitrary_enum_discriminant-no-repr.rs | 19 +++++++--- ...arbitrary_enum_discriminant-no-repr.stderr | 20 ++++++++-- 6 files changed, 65 insertions(+), 48 deletions(-) diff --git a/compiler/rustc_abi/src/layout.rs b/compiler/rustc_abi/src/layout.rs index 80b44e432eeb..716bb716cdb5 100644 --- a/compiler/rustc_abi/src/layout.rs +++ b/compiler/rustc_abi/src/layout.rs @@ -313,7 +313,6 @@ impl LayoutCalculator { scalar_valid_range: (Bound, Bound), discr_range_of_repr: impl Fn(i128, i128) -> (Integer, bool), discriminants: impl Iterator, - dont_niche_optimize_enum: bool, always_sized: bool, ) -> LayoutCalculatorResult { let (present_first, present_second) = { @@ -352,13 +351,7 @@ impl LayoutCalculator { // structs. (We have also handled univariant enums // that allow representation optimization.) assert!(is_enum); - self.layout_of_enum( - repr, - variants, - discr_range_of_repr, - discriminants, - dont_niche_optimize_enum, - ) + self.layout_of_enum(repr, variants, discr_range_of_repr, discriminants) } } @@ -599,7 +592,6 @@ impl LayoutCalculator { variants: &IndexSlice>, discr_range_of_repr: impl Fn(i128, i128) -> (Integer, bool), discriminants: impl Iterator, - dont_niche_optimize_enum: bool, ) -> LayoutCalculatorResult { // Until we've decided whether to use the tagged or // niche filling LayoutData, we don't want to intern the @@ -618,7 +610,7 @@ impl LayoutCalculator { } let calculate_niche_filling_layout = || -> Option> { - if dont_niche_optimize_enum { + if repr.inhibit_enum_layout_opt() { return None; } diff --git a/compiler/rustc_hir_analysis/src/check/check.rs b/compiler/rustc_hir_analysis/src/check/check.rs index 03c026cd6c89..bb1de5bcfc3b 100644 --- a/compiler/rustc_hir_analysis/src/check/check.rs +++ b/compiler/rustc_hir_analysis/src/check/check.rs @@ -1642,20 +1642,40 @@ fn check_enum(tcx: TyCtxt<'_>, def_id: LocalDefId) { if def.repr().int.is_none() { let is_unit = |var: &ty::VariantDef| matches!(var.ctor_kind(), Some(CtorKind::Const)); - let has_disr = |var: &ty::VariantDef| matches!(var.discr, ty::VariantDiscr::Explicit(_)); + let get_disr = |var: &ty::VariantDef| match var.discr { + ty::VariantDiscr::Explicit(disr) => Some(disr), + ty::VariantDiscr::Relative(_) => None, + }; - let has_non_units = def.variants().iter().any(|var| !is_unit(var)); - let disr_units = def.variants().iter().any(|var| is_unit(var) && has_disr(var)); - let disr_non_unit = def.variants().iter().any(|var| !is_unit(var) && has_disr(var)); + let non_unit = def.variants().iter().find(|var| !is_unit(var)); + let disr_unit = + def.variants().iter().filter(|var| is_unit(var)).find_map(|var| get_disr(var)); + let disr_non_unit = + def.variants().iter().filter(|var| !is_unit(var)).find_map(|var| get_disr(var)); - if disr_non_unit || (disr_units && has_non_units) { - struct_span_code_err!( + if disr_non_unit.is_some() || (disr_unit.is_some() && non_unit.is_some()) { + let mut err = struct_span_code_err!( tcx.dcx(), tcx.def_span(def_id), E0732, - "`#[repr(inttype)]` must be specified" - ) - .emit(); + "`#[repr(inttype)]` must be specified for enums with explicit discriminants and non-unit variants" + ); + if let Some(disr_non_unit) = disr_non_unit { + err.span_label( + tcx.def_span(disr_non_unit), + "explicit discriminant on non-unit variant specified here", + ); + } else { + err.span_label( + tcx.def_span(disr_unit.unwrap()), + "explicit discriminant specified here", + ); + err.span_label( + tcx.def_span(non_unit.unwrap().def_id), + "non-unit discriminant declared here", + ); + } + err.emit(); } } diff --git a/compiler/rustc_ty_utils/src/layout.rs b/compiler/rustc_ty_utils/src/layout.rs index 163e2b308837..79f7e228e2ad 100644 --- a/compiler/rustc_ty_utils/src/layout.rs +++ b/compiler/rustc_ty_utils/src/layout.rs @@ -603,12 +603,6 @@ fn layout_of_uncached<'tcx>( .flatten() }; - let dont_niche_optimize_enum = def.repr().inhibit_enum_layout_opt() - || def - .variants() - .iter_enumerated() - .any(|(i, v)| v.discr != ty::VariantDiscr::Relative(i.as_u32())); - let maybe_unsized = def.is_struct() && def.non_enum_variant().tail_opt().is_some_and(|last_field| { let typing_env = ty::TypingEnv::post_analysis(tcx, def.did()); @@ -625,7 +619,6 @@ fn layout_of_uncached<'tcx>( tcx.layout_scalar_valid_range(def.did()), get_discriminant_type, discriminants_iter(), - dont_niche_optimize_enum, !maybe_unsized, ) .map_err(|err| map_error(cx, ty, err))?; @@ -651,7 +644,6 @@ fn layout_of_uncached<'tcx>( tcx.layout_scalar_valid_range(def.did()), get_discriminant_type, discriminants_iter(), - dont_niche_optimize_enum, !maybe_unsized, ) else { bug!("failed to compute unsized layout of {ty:?}"); diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/layout/adt.rs b/src/tools/rust-analyzer/crates/hir-ty/src/layout/adt.rs index 236f316366dc..372a9dfc43d2 100644 --- a/src/tools/rust-analyzer/crates/hir-ty/src/layout/adt.rs +++ b/src/tools/rust-analyzer/crates/hir-ty/src/layout/adt.rs @@ -3,9 +3,9 @@ use std::{cmp, ops::Bound}; use hir_def::{ - AdtId, VariantId, layout::{Integer, ReprOptions, TargetDataLayout}, signatures::{StructFlags, VariantFields}, + AdtId, VariantId, }; use intern::sym; use rustc_index::IndexVec; @@ -13,9 +13,9 @@ use smallvec::SmallVec; use triomphe::Arc; use crate::{ - Substitution, TraitEnvironment, db::HirDatabase, - layout::{Layout, LayoutError, field_ty}, + layout::{field_ty, Layout, LayoutError}, + Substitution, TraitEnvironment, }; use super::LayoutCx; @@ -85,16 +85,6 @@ pub fn layout_of_adt_query( let d = db.const_eval_discriminant(e.enum_variants(db).variants[id.0].0).ok()?; Some((id, d)) }), - // FIXME: The current code for niche-filling relies on variant indices - // instead of actual discriminants, so enums with - // explicit discriminants (RFC #2363) would misbehave and we should disable - // niche optimization for them. - // The code that do it in rustc: - // repr.inhibit_enum_layout_opt() || def - // .variants() - // .iter_enumerated() - // .any(|(i, v)| v.discr != ty::VariantDiscr::Relative(i.as_u32())) - repr.inhibit_enum_layout_opt(), !matches!(def, AdtId::EnumId(..)) && variants .iter() diff --git a/tests/ui/enum-discriminant/arbitrary_enum_discriminant-no-repr.rs b/tests/ui/enum-discriminant/arbitrary_enum_discriminant-no-repr.rs index a6e5f70fdefa..6bbafbf1434e 100644 --- a/tests/ui/enum-discriminant/arbitrary_enum_discriminant-no-repr.rs +++ b/tests/ui/enum-discriminant/arbitrary_enum_discriminant-no-repr.rs @@ -1,8 +1,17 @@ -#![crate_type="lib"] +#![crate_type = "lib"] +// Test that if any variant is non-unit, +// we need a repr. enum Enum { -//~^ ERROR `#[repr(inttype)]` must be specified - Unit = 1, - Tuple() = 2, - Struct{} = 3, + //~^ ERROR `#[repr(inttype)]` must be specified + Unit = 1, + Tuple(), + Struct {}, +} + +// Test that if any non-unit variant has an explicit +// discriminant we need a repr. +enum Enum2 { + //~^ ERROR `#[repr(inttype)]` must be specified + Tuple() = 2, } diff --git a/tests/ui/enum-discriminant/arbitrary_enum_discriminant-no-repr.stderr b/tests/ui/enum-discriminant/arbitrary_enum_discriminant-no-repr.stderr index 3b718c6465bd..35c0208951ae 100644 --- a/tests/ui/enum-discriminant/arbitrary_enum_discriminant-no-repr.stderr +++ b/tests/ui/enum-discriminant/arbitrary_enum_discriminant-no-repr.stderr @@ -1,9 +1,23 @@ -error[E0732]: `#[repr(inttype)]` must be specified - --> $DIR/arbitrary_enum_discriminant-no-repr.rs:3:1 +error[E0732]: `#[repr(inttype)]` must be specified for enums with explicit discriminants and non-unit variants + --> $DIR/arbitrary_enum_discriminant-no-repr.rs:5:1 | LL | enum Enum { | ^^^^^^^^^ +LL | +LL | Unit = 1, + | - explicit discriminant specified here +LL | Tuple(), + | ----- non-unit discriminant declared here -error: aborting due to 1 previous error +error[E0732]: `#[repr(inttype)]` must be specified for enums with explicit discriminants and non-unit variants + --> $DIR/arbitrary_enum_discriminant-no-repr.rs:14:1 + | +LL | enum Enum2 { + | ^^^^^^^^^^ +LL | +LL | Tuple() = 2, + | - explicit discriminant on non-unit variant specified here + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0732`. From 642deb3c8f88073b8417a067e8de6b4dc5b84a6a Mon Sep 17 00:00:00 2001 From: Makai Date: Thu, 24 Jul 2025 18:26:08 +0800 Subject: [PATCH 133/139] remove movability from `RigidTy::Coroutine` and `AggregateKind::Coroutine` --- compiler/rustc_public/src/mir/body.rs | 7 ++----- compiler/rustc_public/src/mir/pretty.rs | 2 +- compiler/rustc_public/src/ty.rs | 7 +++---- compiler/rustc_public/src/unstable/convert/internal.rs | 2 +- compiler/rustc_public/src/unstable/convert/stable/mir.rs | 1 - compiler/rustc_public/src/unstable/convert/stable/ty.rs | 1 - compiler/rustc_public/src/visitor.rs | 2 +- 7 files changed, 8 insertions(+), 14 deletions(-) diff --git a/compiler/rustc_public/src/mir/body.rs b/compiler/rustc_public/src/mir/body.rs index 3320b98cd610..3d595286041c 100644 --- a/compiler/rustc_public/src/mir/body.rs +++ b/compiler/rustc_public/src/mir/body.rs @@ -654,9 +654,7 @@ impl Rvalue { )), AggregateKind::Adt(def, _, ref args, _, _) => Ok(def.ty_with_args(args)), AggregateKind::Closure(def, ref args) => Ok(Ty::new_closure(def, args.clone())), - AggregateKind::Coroutine(def, ref args, mov) => { - Ok(Ty::new_coroutine(def, args.clone(), mov)) - } + AggregateKind::Coroutine(def, ref args) => Ok(Ty::new_coroutine(def, args.clone())), AggregateKind::CoroutineClosure(def, ref args) => { Ok(Ty::new_coroutine_closure(def, args.clone())) } @@ -674,8 +672,7 @@ pub enum AggregateKind { Tuple, Adt(AdtDef, VariantIdx, GenericArgs, Option, Option), Closure(ClosureDef, GenericArgs), - // FIXME(rustc_public): Movability here is redundant - Coroutine(CoroutineDef, GenericArgs, Movability), + Coroutine(CoroutineDef, GenericArgs), CoroutineClosure(CoroutineClosureDef, GenericArgs), RawPtr(Ty, Mutability), } diff --git a/compiler/rustc_public/src/mir/pretty.rs b/compiler/rustc_public/src/mir/pretty.rs index a433df2dba1a..3183c020772a 100644 --- a/compiler/rustc_public/src/mir/pretty.rs +++ b/compiler/rustc_public/src/mir/pretty.rs @@ -428,7 +428,7 @@ fn pretty_aggregate( write!(writer, "{{closure@{}}}(", def.span().diagnostic())?; ")" } - AggregateKind::Coroutine(def, _, _) => { + AggregateKind::Coroutine(def, _) => { write!(writer, "{{coroutine@{}}}(", def.span().diagnostic())?; ")" } diff --git a/compiler/rustc_public/src/ty.rs b/compiler/rustc_public/src/ty.rs index bc67a2f987d9..de4b21b17647 100644 --- a/compiler/rustc_public/src/ty.rs +++ b/compiler/rustc_public/src/ty.rs @@ -60,8 +60,8 @@ impl Ty { } /// Create a new coroutine type. - pub fn new_coroutine(def: CoroutineDef, args: GenericArgs, mov: Movability) -> Ty { - Ty::from_rigid_kind(RigidTy::Coroutine(def, args, mov)) + pub fn new_coroutine(def: CoroutineDef, args: GenericArgs) -> Ty { + Ty::from_rigid_kind(RigidTy::Coroutine(def, args)) } /// Create a new closure type. @@ -560,8 +560,7 @@ pub enum RigidTy { FnDef(FnDef, GenericArgs), FnPtr(PolyFnSig), Closure(ClosureDef, GenericArgs), - // FIXME(rustc_public): Movability here is redundant - Coroutine(CoroutineDef, GenericArgs, Movability), + Coroutine(CoroutineDef, GenericArgs), CoroutineClosure(CoroutineClosureDef, GenericArgs), Dynamic(Vec>, Region, DynKind), Never, diff --git a/compiler/rustc_public/src/unstable/convert/internal.rs b/compiler/rustc_public/src/unstable/convert/internal.rs index b2d38e497bc8..66f767a98f5b 100644 --- a/compiler/rustc_public/src/unstable/convert/internal.rs +++ b/compiler/rustc_public/src/unstable/convert/internal.rs @@ -177,7 +177,7 @@ impl RustcInternal for RigidTy { RigidTy::Closure(def, args) => { rustc_ty::TyKind::Closure(def.0.internal(tables, tcx), args.internal(tables, tcx)) } - RigidTy::Coroutine(def, args, _mov) => { + RigidTy::Coroutine(def, args) => { rustc_ty::TyKind::Coroutine(def.0.internal(tables, tcx), args.internal(tables, tcx)) } RigidTy::CoroutineClosure(def, args) => rustc_ty::TyKind::CoroutineClosure( diff --git a/compiler/rustc_public/src/unstable/convert/stable/mir.rs b/compiler/rustc_public/src/unstable/convert/stable/mir.rs index 8dee579e598b..be8ee80bed3c 100644 --- a/compiler/rustc_public/src/unstable/convert/stable/mir.rs +++ b/compiler/rustc_public/src/unstable/convert/stable/mir.rs @@ -653,7 +653,6 @@ impl<'tcx> Stable<'tcx> for mir::AggregateKind<'tcx> { crate::mir::AggregateKind::Coroutine( tables.coroutine_def(*def_id), generic_arg.stable(tables, cx), - cx.coroutine_movability(*def_id).stable(tables, cx), ) } mir::AggregateKind::CoroutineClosure(def_id, generic_args) => { diff --git a/compiler/rustc_public/src/unstable/convert/stable/ty.rs b/compiler/rustc_public/src/unstable/convert/stable/ty.rs index d679615b3bdc..5a661072bc7e 100644 --- a/compiler/rustc_public/src/unstable/convert/stable/ty.rs +++ b/compiler/rustc_public/src/unstable/convert/stable/ty.rs @@ -457,7 +457,6 @@ impl<'tcx> Stable<'tcx> for ty::TyKind<'tcx> { ty::Coroutine(def_id, generic_args) => TyKind::RigidTy(RigidTy::Coroutine( tables.coroutine_def(*def_id), generic_args.stable(tables, cx), - cx.coroutine_movability(*def_id).stable(tables, cx), )), ty::Never => TyKind::RigidTy(RigidTy::Never), ty::Tuple(fields) => TyKind::RigidTy(RigidTy::Tuple( diff --git a/compiler/rustc_public/src/visitor.rs b/compiler/rustc_public/src/visitor.rs index 45e2a8154708..87f1cc6ae69d 100644 --- a/compiler/rustc_public/src/visitor.rs +++ b/compiler/rustc_public/src/visitor.rs @@ -166,7 +166,7 @@ impl Visitable for RigidTy { } RigidTy::Adt(_, args) | RigidTy::Closure(_, args) - | RigidTy::Coroutine(_, args, _) + | RigidTy::Coroutine(_, args) | RigidTy::CoroutineWitness(_, args) | RigidTy::CoroutineClosure(_, args) | RigidTy::FnDef(_, args) => args.visit(visitor), From e31876c143625a23c95bdf342444f1f1f100c57f Mon Sep 17 00:00:00 2001 From: usamoi Date: Sun, 20 Jul 2025 21:40:36 +0800 Subject: [PATCH 134/139] generate elf symbol version in raw-dylib --- .../src/back/link/raw_dylib.rs | 176 +++++++++++++----- compiler/rustc_metadata/messages.ftl | 3 + compiler/rustc_metadata/src/errors.rs | 7 + compiler/rustc_metadata/src/native_libs.rs | 15 +- tests/ui/linkage-attr/raw-dylib/elf/empty.rs | 11 ++ .../raw-dylib/elf/glibc-x86_64.rs | 80 ++++++++ .../raw-dylib/elf/malformed-link-name.rs | 20 ++ .../raw-dylib/elf/malformed-link-name.stderr | 26 +++ 8 files changed, 288 insertions(+), 50 deletions(-) create mode 100644 tests/ui/linkage-attr/raw-dylib/elf/empty.rs create mode 100644 tests/ui/linkage-attr/raw-dylib/elf/glibc-x86_64.rs create mode 100644 tests/ui/linkage-attr/raw-dylib/elf/malformed-link-name.rs create mode 100644 tests/ui/linkage-attr/raw-dylib/elf/malformed-link-name.stderr diff --git a/compiler/rustc_codegen_ssa/src/back/link/raw_dylib.rs b/compiler/rustc_codegen_ssa/src/back/link/raw_dylib.rs index 74f39022afb7..b9e0c9573633 100644 --- a/compiler/rustc_codegen_ssa/src/back/link/raw_dylib.rs +++ b/compiler/rustc_codegen_ssa/src/back/link/raw_dylib.rs @@ -4,7 +4,7 @@ use std::path::{Path, PathBuf}; use rustc_abi::Endian; use rustc_data_structures::base_n::{CASE_INSENSITIVE, ToBaseN}; -use rustc_data_structures::fx::FxIndexMap; +use rustc_data_structures::fx::{FxHashMap, FxIndexMap}; use rustc_data_structures::stable_hasher::StableHasher; use rustc_hashes::Hash128; use rustc_session::Session; @@ -214,7 +214,7 @@ pub(super) fn create_raw_dylib_elf_stub_shared_objects<'a>( /// It exports all the provided symbols, but is otherwise empty. fn create_elf_raw_dylib_stub(sess: &Session, soname: &str, symbols: &[DllImport]) -> Vec { use object::write::elf as write; - use object::{Architecture, elf}; + use object::{AddressSize, Architecture, elf}; let mut stub_buf = Vec::new(); @@ -226,47 +226,6 @@ fn create_elf_raw_dylib_stub(sess: &Session, soname: &str, symbols: &[DllImport] // It is important that the order of reservation matches the order of writing. // The object crate contains many debug asserts that fire if you get this wrong. - let endianness = match sess.target.options.endian { - Endian::Little => object::Endianness::Little, - Endian::Big => object::Endianness::Big, - }; - let mut stub = write::Writer::new(endianness, true, &mut stub_buf); - - // These initial reservations don't reserve any bytes in the binary yet, - // they just allocate in the internal data structures. - - // First, we crate the dynamic symbol table. It starts with a null symbol - // and then all the symbols and their dynamic strings. - stub.reserve_null_dynamic_symbol_index(); - - let dynstrs = symbols - .iter() - .map(|sym| { - stub.reserve_dynamic_symbol_index(); - (sym, stub.add_dynamic_string(sym.name.as_str().as_bytes())) - }) - .collect::>(); - - let soname = stub.add_dynamic_string(soname.as_bytes()); - - // Reserve the sections. - // We have the minimal sections for a dynamic SO and .text where we point our dummy symbols to. - stub.reserve_shstrtab_section_index(); - let text_section_name = stub.add_section_name(".text".as_bytes()); - let text_section = stub.reserve_section_index(); - stub.reserve_dynstr_section_index(); - stub.reserve_dynsym_section_index(); - stub.reserve_dynamic_section_index(); - - // These reservations now determine the actual layout order of the object file. - stub.reserve_file_header(); - stub.reserve_shstrtab(); - stub.reserve_section_headers(); - stub.reserve_dynstr(); - stub.reserve_dynsym(); - stub.reserve_dynamic(2); // DT_SONAME, DT_NULL - - // First write the ELF header with the arch information. let Some((arch, sub_arch)) = sess.target.object_architecture(&sess.unstable_target_features) else { sess.dcx().fatal(format!( @@ -274,6 +233,87 @@ fn create_elf_raw_dylib_stub(sess: &Session, soname: &str, symbols: &[DllImport] sess.target.arch )); }; + + let endianness = match sess.target.options.endian { + Endian::Little => object::Endianness::Little, + Endian::Big => object::Endianness::Big, + }; + + let is_64 = match arch.address_size() { + Some(AddressSize::U8 | AddressSize::U16 | AddressSize::U32) => false, + Some(AddressSize::U64) => true, + _ => sess.dcx().fatal(format!( + "raw-dylib is not supported for the architecture `{}`", + sess.target.arch + )), + }; + + let mut stub = write::Writer::new(endianness, is_64, &mut stub_buf); + + let mut vers = Vec::new(); + let mut vers_map = FxHashMap::default(); + let mut syms = Vec::new(); + + for symbol in symbols { + let symbol_name = symbol.name.as_str(); + if let Some((name, version_name)) = symbol_name.split_once('@') { + assert!(!version_name.contains('@')); + let dynstr = stub.add_dynamic_string(name.as_bytes()); + let ver = if let Some(&ver_id) = vers_map.get(version_name) { + ver_id + } else { + let id = vers.len(); + vers_map.insert(version_name, id); + let dynstr = stub.add_dynamic_string(version_name.as_bytes()); + vers.push((version_name, dynstr)); + id + }; + syms.push((name, dynstr, Some(ver))); + } else { + let dynstr = stub.add_dynamic_string(symbol_name.as_bytes()); + syms.push((symbol_name, dynstr, None)); + } + } + + let soname = stub.add_dynamic_string(soname.as_bytes()); + + // These initial reservations don't reserve any bytes in the binary yet, + // they just allocate in the internal data structures. + + // First, we create the dynamic symbol table. It starts with a null symbol + // and then all the symbols and their dynamic strings. + stub.reserve_null_dynamic_symbol_index(); + + for _ in syms.iter() { + stub.reserve_dynamic_symbol_index(); + } + + // Reserve the sections. + // We have the minimal sections for a dynamic SO and .text where we point our dummy symbols to. + stub.reserve_shstrtab_section_index(); + let text_section_name = stub.add_section_name(".text".as_bytes()); + let text_section = stub.reserve_section_index(); + stub.reserve_dynsym_section_index(); + stub.reserve_dynstr_section_index(); + if !vers.is_empty() { + stub.reserve_gnu_versym_section_index(); + stub.reserve_gnu_verdef_section_index(); + } + stub.reserve_dynamic_section_index(); + + // These reservations now determine the actual layout order of the object file. + stub.reserve_file_header(); + stub.reserve_shstrtab(); + stub.reserve_section_headers(); + stub.reserve_dynsym(); + stub.reserve_dynstr(); + if !vers.is_empty() { + stub.reserve_gnu_versym(); + stub.reserve_gnu_verdef(1 + vers.len(), 1 + vers.len()); + } + stub.reserve_dynamic(2); // DT_SONAME, DT_NULL + + // First write the ELF header with the arch information. let e_machine = match (arch, sub_arch) { (Architecture::Aarch64, None) => elf::EM_AARCH64, (Architecture::Aarch64_Ilp32, None) => elf::EM_AARCH64, @@ -342,18 +382,19 @@ fn create_elf_raw_dylib_stub(sess: &Session, soname: &str, symbols: &[DllImport] sh_addralign: 1, sh_entsize: 0, }); - stub.write_dynstr_section_header(0); stub.write_dynsym_section_header(0, 1); + stub.write_dynstr_section_header(0); + if !vers.is_empty() { + stub.write_gnu_versym_section_header(0); + stub.write_gnu_verdef_section_header(0); + } stub.write_dynamic_section_header(0); - // .dynstr - stub.write_dynstr(); - // .dynsym stub.write_null_dynamic_symbol(); - for (_, name) in dynstrs { + for (_name, dynstr, _ver) in syms.iter().copied() { stub.write_dynamic_symbol(&write::Sym { - name: Some(name), + name: Some(dynstr), st_info: (elf::STB_GLOBAL << 4) | elf::STT_NOTYPE, st_other: elf::STV_DEFAULT, section: Some(text_section), @@ -363,10 +404,47 @@ fn create_elf_raw_dylib_stub(sess: &Session, soname: &str, symbols: &[DllImport] }); } + // .dynstr + stub.write_dynstr(); + + // ld.bfd is unhappy if these sections exist without any symbols, so we only generate them when necessary. + if !vers.is_empty() { + // .gnu_version + stub.write_null_gnu_versym(); + for (_name, _dynstr, ver) in syms.iter().copied() { + stub.write_gnu_versym(if let Some(ver) = ver { + assert!((2 + ver as u16) < elf::VERSYM_HIDDEN); + elf::VERSYM_HIDDEN | (2 + ver as u16) + } else { + 1 + }); + } + + // .gnu_version_d + stub.write_align_gnu_verdef(); + stub.write_gnu_verdef(&write::Verdef { + version: elf::VER_DEF_CURRENT, + flags: elf::VER_FLG_BASE, + index: 1, + aux_count: 1, + name: soname, + }); + for (ver, (_name, dynstr)) in vers.into_iter().enumerate() { + stub.write_gnu_verdef(&write::Verdef { + version: elf::VER_DEF_CURRENT, + flags: 0, + index: 2 + ver as u16, + aux_count: 1, + name: dynstr, + }); + } + } + // .dynamic // the DT_SONAME will be used by the linker to populate DT_NEEDED // which the loader uses to find the library. // DT_NULL terminates the .dynamic table. + stub.write_align_dynamic(); stub.write_dynamic_string(elf::DT_SONAME, soname); stub.write_dynamic(elf::DT_NULL, 0); diff --git a/compiler/rustc_metadata/messages.ftl b/compiler/rustc_metadata/messages.ftl index 3bef5ca114b8..4d3e879a098f 100644 --- a/compiler/rustc_metadata/messages.ftl +++ b/compiler/rustc_metadata/messages.ftl @@ -330,3 +330,6 @@ metadata_wasm_import_form = metadata_whole_archive_needs_static = linking modifier `whole-archive` is only compatible with `static` linking kind + +metadata_raw_dylib_malformed = + link name must be well-formed if link kind is `raw-dylib` diff --git a/compiler/rustc_metadata/src/errors.rs b/compiler/rustc_metadata/src/errors.rs index 4a3b43167cfa..0332dba1077c 100644 --- a/compiler/rustc_metadata/src/errors.rs +++ b/compiler/rustc_metadata/src/errors.rs @@ -815,3 +815,10 @@ pub struct AsyncDropTypesInDependency { pub extern_crate: Symbol, pub local_crate: Symbol, } + +#[derive(Diagnostic)] +#[diag(metadata_raw_dylib_malformed)] +pub struct RawDylibMalformed { + #[primary_span] + pub span: Span, +} diff --git a/compiler/rustc_metadata/src/native_libs.rs b/compiler/rustc_metadata/src/native_libs.rs index 4d276f814ef2..ed0f084ea83c 100644 --- a/compiler/rustc_metadata/src/native_libs.rs +++ b/compiler/rustc_metadata/src/native_libs.rs @@ -700,8 +700,21 @@ impl<'tcx> Collector<'tcx> { .link_ordinal .map_or(import_name_type, |ord| Some(PeImportNameType::Ordinal(ord))); + let name = codegen_fn_attrs.link_name.unwrap_or_else(|| self.tcx.item_name(item)); + + if self.tcx.sess.target.binary_format == BinaryFormat::Elf { + let name = name.as_str(); + if name.contains('\0') { + self.tcx.dcx().emit_err(errors::RawDylibMalformed { span }); + } else if let Some((left, right)) = name.split_once('@') + && (left.is_empty() || right.is_empty() || right.contains('@')) + { + self.tcx.dcx().emit_err(errors::RawDylibMalformed { span }); + } + } + DllImport { - name: codegen_fn_attrs.link_name.unwrap_or_else(|| self.tcx.item_name(item)), + name, import_name_type, calling_convention, span, diff --git a/tests/ui/linkage-attr/raw-dylib/elf/empty.rs b/tests/ui/linkage-attr/raw-dylib/elf/empty.rs new file mode 100644 index 000000000000..2e48a5f05269 --- /dev/null +++ b/tests/ui/linkage-attr/raw-dylib/elf/empty.rs @@ -0,0 +1,11 @@ +//@ only-x86_64-unknown-linux-gnu +//@ needs-dynamic-linking +//@ build-pass + +#![allow(incomplete_features)] +#![feature(raw_dylib_elf)] + +#[link(name = "hack", kind = "raw-dylib")] +unsafe extern "C" {} + +fn main() {} diff --git a/tests/ui/linkage-attr/raw-dylib/elf/glibc-x86_64.rs b/tests/ui/linkage-attr/raw-dylib/elf/glibc-x86_64.rs new file mode 100644 index 000000000000..57492ed2d0e1 --- /dev/null +++ b/tests/ui/linkage-attr/raw-dylib/elf/glibc-x86_64.rs @@ -0,0 +1,80 @@ +//@ only-x86_64-unknown-linux-gnu +//@ needs-dynamic-linking +//@ run-pass +//@ compile-flags: -Cpanic=abort +//@ edition: 2024 + +#![allow(incomplete_features)] +#![feature(raw_dylib_elf)] +#![no_std] +#![no_main] + +use core::ffi::{c_char, c_int}; + +extern "C" fn callback( + _fpath: *const c_char, + _sb: *const (), + _tflag: c_int, + _ftwbuf: *const (), +) -> c_int { + 0 +} + +// `libc.so` is a linker script that provides the paths to `libc.so.6` and `libc_nonshared.a`. +// In earlier versions of glibc, `libc_nonshared.a` provides the symbols `__libc_csu_init` and +// `__libc_csu_fini` required by `Scrt1.o`. +#[link(name = "c_nonshared", kind = "static")] +unsafe extern "C" {} + +#[link(name = "libc.so.6", kind = "raw-dylib", modifiers = "+verbatim")] +unsafe extern "C" { + #[link_name = "nftw@GLIBC_2.2.5"] + unsafe fn nftw_2_2_5( + dirpath: *const c_char, + f: extern "C" fn(*const c_char, *const (), c_int, *const ()) -> c_int, + nopenfd: c_int, + flags: c_int, + ) -> c_int; + #[link_name = "nftw@GLIBC_2.3.3"] + unsafe fn nftw_2_3_3( + dirpath: *const c_char, + f: extern "C" fn(*const c_char, *const (), c_int, *const ()) -> c_int, + nopenfd: c_int, + flags: c_int, + ) -> c_int; + #[link_name = "exit@GLIBC_2.2.5"] + safe fn exit(status: i32) -> !; + unsafe fn __libc_start_main() -> c_int; +} + +#[unsafe(no_mangle)] +extern "C" fn main() -> ! { + unsafe { + // The old `nftw` does not check whether unknown flags are set. + let res = nftw_2_2_5(c".".as_ptr(), callback, 20, 1 << 30); + assert_eq!(res, 0); + } + unsafe { + // The new `nftw` does. + let res = nftw_2_3_3(c".".as_ptr(), callback, 20, 1 << 30); + assert_eq!(res, -1); + } + exit(0); +} + +#[cfg(not(test))] +#[panic_handler] +fn panic_handler(_: &core::panic::PanicInfo<'_>) -> ! { + exit(1); +} + +#[unsafe(no_mangle)] +extern "C" fn rust_eh_personality( + _version: i32, + _actions: i32, + _exception_class: u64, + _exception_object: *mut (), + _context: *mut (), +) -> i32 { + exit(1); +} diff --git a/tests/ui/linkage-attr/raw-dylib/elf/malformed-link-name.rs b/tests/ui/linkage-attr/raw-dylib/elf/malformed-link-name.rs new file mode 100644 index 000000000000..46e3798284b2 --- /dev/null +++ b/tests/ui/linkage-attr/raw-dylib/elf/malformed-link-name.rs @@ -0,0 +1,20 @@ +//@ only-elf +//@ needs-dynamic-linking +//@ check-fail + +#![feature(raw_dylib_elf)] +#![allow(incomplete_features)] + +#[link(name = "libc.so.6", kind = "raw-dylib", modifiers = "+verbatim")] +unsafe extern "C" { + #[link_name = "exit@"] + pub safe fn exit_0(status: i32) -> !; //~ ERROR link name must be well-formed if link kind is `raw-dylib` + #[link_name = "@GLIBC_2.2.5"] + pub safe fn exit_1(status: i32) -> !; //~ ERROR link name must be well-formed if link kind is `raw-dylib` + #[link_name = "ex\0it@GLIBC_2.2.5"] + pub safe fn exit_2(status: i32) -> !; //~ ERROR link name must be well-formed if link kind is `raw-dylib` + #[link_name = "exit@@GLIBC_2.2.5"] + pub safe fn exit_3(status: i32) -> !; //~ ERROR link name must be well-formed if link kind is `raw-dylib` +} + +fn main() {} diff --git a/tests/ui/linkage-attr/raw-dylib/elf/malformed-link-name.stderr b/tests/ui/linkage-attr/raw-dylib/elf/malformed-link-name.stderr new file mode 100644 index 000000000000..5a979e7a3b1a --- /dev/null +++ b/tests/ui/linkage-attr/raw-dylib/elf/malformed-link-name.stderr @@ -0,0 +1,26 @@ +error: link name must be well-formed if link kind is `raw-dylib` + --> $DIR/malformed-link-name.rs:11:5 + | +LL | pub safe fn exit_0(status: i32) -> !; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: link name must be well-formed if link kind is `raw-dylib` + --> $DIR/malformed-link-name.rs:13:5 + | +LL | pub safe fn exit_1(status: i32) -> !; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: link name must be well-formed if link kind is `raw-dylib` + --> $DIR/malformed-link-name.rs:15:5 + | +LL | pub safe fn exit_2(status: i32) -> !; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: link name must be well-formed if link kind is `raw-dylib` + --> $DIR/malformed-link-name.rs:17:5 + | +LL | pub safe fn exit_3(status: i32) -> !; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 4 previous errors + From 9ffa77523284d9301a2dacdf0e1064844d640592 Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Tue, 22 Jul 2025 23:13:09 +0300 Subject: [PATCH 135/139] resolve: Remove `Scope::CrateRoot` Use `Scope::Module` with the crate root module inside instead, which should be identical. --- compiler/rustc_resolve/src/diagnostics.rs | 5 -- compiler/rustc_resolve/src/ident.rs | 72 +++++++++-------------- compiler/rustc_resolve/src/imports.rs | 8 +-- compiler/rustc_resolve/src/lib.rs | 11 ++-- 4 files changed, 39 insertions(+), 57 deletions(-) diff --git a/compiler/rustc_resolve/src/diagnostics.rs b/compiler/rustc_resolve/src/diagnostics.rs index d72fbc189e70..75eed1e9ad3f 100644 --- a/compiler/rustc_resolve/src/diagnostics.rs +++ b/compiler/rustc_resolve/src/diagnostics.rs @@ -1076,11 +1076,6 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { } } } - Scope::CrateRoot => { - let root_ident = Ident::new(kw::PathRoot, ident.span); - let root_module = this.resolve_crate_root(root_ident); - this.add_module_candidates(root_module, &mut suggestions, filter_fn, None); - } Scope::Module(module, _) => { this.add_module_candidates(module, &mut suggestions, filter_fn, None); } diff --git a/compiler/rustc_resolve/src/ident.rs b/compiler/rustc_resolve/src/ident.rs index 34941398a2bb..71cc68af499d 100644 --- a/compiler/rustc_resolve/src/ident.rs +++ b/compiler/rustc_resolve/src/ident.rs @@ -93,20 +93,21 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { // 6. Language prelude: builtin attributes (closed, controlled). let rust_2015 = ctxt.edition().is_rust_2015(); - let (ns, macro_kind, is_absolute_path) = match scope_set { - ScopeSet::All(ns) => (ns, None, false), - ScopeSet::AbsolutePath(ns) => (ns, None, true), - ScopeSet::Macro(macro_kind) => (MacroNS, Some(macro_kind), false), - ScopeSet::Late(ns, ..) => (ns, None, false), + let (ns, macro_kind) = match scope_set { + ScopeSet::All(ns) + | ScopeSet::ModuleAndExternPrelude(ns, _) + | ScopeSet::Late(ns, ..) => (ns, None), + ScopeSet::Macro(macro_kind) => (MacroNS, Some(macro_kind)), }; let module = match scope_set { // Start with the specified module. - ScopeSet::Late(_, module, _) => module, + ScopeSet::Late(_, module, _) | ScopeSet::ModuleAndExternPrelude(_, module) => module, // Jump out of trait or enum modules, they do not act as scopes. _ => parent_scope.module.nearest_item_scope(), }; + let module_and_extern_prelude = matches!(scope_set, ScopeSet::ModuleAndExternPrelude(..)); let mut scope = match ns { - _ if is_absolute_path => Scope::CrateRoot, + _ if module_and_extern_prelude => Scope::Module(module, None), TypeNS | ValueNS => Scope::Module(module, None), MacroNS => Scope::DeriveHelpers(parent_scope.expansion), }; @@ -134,11 +135,10 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { } true } - Scope::CrateRoot => true, Scope::Module(..) => true, Scope::MacroUsePrelude => use_prelude || rust_2015, Scope::BuiltinAttrs => true, - Scope::ExternPrelude => use_prelude || is_absolute_path, + Scope::ExternPrelude => use_prelude || module_and_extern_prelude, Scope::ToolPrelude => use_prelude, Scope::StdLibPrelude => use_prelude || ns == MacroNS, Scope::BuiltinTypes => true, @@ -174,7 +174,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { } MacroRulesScope::Empty => Scope::Module(module, None), }, - Scope::CrateRoot => match ns { + Scope::Module(..) if module_and_extern_prelude => match ns { TypeNS => { ctxt.adjust(ExpnId::root()); Scope::ExternPrelude @@ -203,7 +203,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { } Scope::MacroUsePrelude => Scope::StdLibPrelude, Scope::BuiltinAttrs => break, // nowhere else to search - Scope::ExternPrelude if is_absolute_path => break, + Scope::ExternPrelude if module_and_extern_prelude => break, Scope::ExternPrelude => Scope::ToolPrelude, Scope::ToolPrelude => Scope::StdLibPrelude, Scope::StdLibPrelude => match ns { @@ -404,10 +404,10 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { } let (ns, macro_kind) = match scope_set { - ScopeSet::All(ns) => (ns, None), - ScopeSet::AbsolutePath(ns) => (ns, None), + ScopeSet::All(ns) + | ScopeSet::ModuleAndExternPrelude(ns, _) + | ScopeSet::Late(ns, ..) => (ns, None), ScopeSet::Macro(macro_kind) => (MacroNS, Some(macro_kind)), - ScopeSet::Late(ns, ..) => (ns, None), }; // This is *the* result, resolution from the scope closest to the resolved identifier. @@ -487,31 +487,16 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { MacroRulesScope::Invocation(_) => Err(Determinacy::Undetermined), _ => Err(Determinacy::Determined), }, - Scope::CrateRoot => { - let root_ident = Ident::new(kw::PathRoot, ident.span); - let root_module = this.resolve_crate_root(root_ident); - let binding = this.resolve_ident_in_module( - ModuleOrUniformRoot::Module(root_module), - ident, - ns, - parent_scope, - finalize, - ignore_binding, - ignore_import, - ); - match binding { - Ok(binding) => Ok((binding, Flags::MODULE | Flags::MISC_SUGGEST_CRATE)), - Err((Determinacy::Undetermined, Weak::No)) => { - return Some(Err(Determinacy::determined(force))); - } - Err((Determinacy::Undetermined, Weak::Yes)) => { - Err(Determinacy::Undetermined) - } - Err((Determinacy::Determined, _)) => Err(Determinacy::Determined), - } - } Scope::Module(module, derive_fallback_lint_id) => { - let adjusted_parent_scope = &ParentScope { module, ..*parent_scope }; + let (adjusted_parent_scope, finalize) = + if matches!(scope_set, ScopeSet::ModuleAndExternPrelude(..)) { + (parent_scope, finalize) + } else { + ( + &ParentScope { module, ..*parent_scope }, + finalize.map(|f| Finalize { used: Used::Scope, ..f }), + ) + }; let binding = this.resolve_ident_in_module_unadjusted( ModuleOrUniformRoot::Module(module), ident, @@ -522,7 +507,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { } else { Shadowing::Restricted }, - finalize.map(|finalize| Finalize { used: Used::Scope, ..finalize }), + finalize, ignore_binding, ignore_import, ); @@ -776,7 +761,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { ModuleOrUniformRoot::ExternPrelude => { ident.span.normalize_to_macros_2_0_and_adjust(ExpnId::root()); } - ModuleOrUniformRoot::CrateRootAndExternPrelude | ModuleOrUniformRoot::CurrentScope => { + ModuleOrUniformRoot::ModuleAndExternPrelude(..) | ModuleOrUniformRoot::CurrentScope => { // No adjustments } } @@ -810,11 +795,11 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { ) -> Result, (Determinacy, Weak)> { let module = match module { ModuleOrUniformRoot::Module(module) => module, - ModuleOrUniformRoot::CrateRootAndExternPrelude => { + ModuleOrUniformRoot::ModuleAndExternPrelude(module) => { assert_eq!(shadowing, Shadowing::Unrestricted); let binding = self.early_resolve_ident_in_lexical_scope( ident, - ScopeSet::AbsolutePath(ns), + ScopeSet::ModuleAndExternPrelude(ns, module), parent_scope, finalize, finalize.is_some(), @@ -1531,7 +1516,8 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { && self.tcx.sess.at_least_rust_2018() { // `::a::b` from 2015 macro on 2018 global edition - module = Some(ModuleOrUniformRoot::CrateRootAndExternPrelude); + let crate_root = self.resolve_crate_root(ident); + module = Some(ModuleOrUniformRoot::ModuleAndExternPrelude(crate_root)); continue; } if name == kw::PathRoot || name == kw::Crate || name == kw::DollarCrate { diff --git a/compiler/rustc_resolve/src/imports.rs b/compiler/rustc_resolve/src/imports.rs index 783c5005cca9..986e703c0d23 100644 --- a/compiler/rustc_resolve/src/imports.rs +++ b/compiler/rustc_resolve/src/imports.rs @@ -181,10 +181,10 @@ pub(crate) struct ImportData<'ra> { /// /// | `module_path` | `imported_module` | remark | /// |-|-|-| - /// |`use prefix::foo`| `ModuleOrUniformRoot::Module(prefix)` | - | - /// |`use ::foo` | `ModuleOrUniformRoot::ExternPrelude` | 2018+ editions | - /// |`use ::foo` | `ModuleOrUniformRoot::CrateRootAndExternPrelude` | a special case in 2015 edition | - /// |`use foo` | `ModuleOrUniformRoot::CurrentScope` | - | + /// |`use prefix::foo`| `ModuleOrUniformRoot::Module(prefix)` | - | + /// |`use ::foo` | `ModuleOrUniformRoot::ExternPrelude` | 2018+ editions | + /// |`use ::foo` | `ModuleOrUniformRoot::ModuleAndExternPrelude` | a special case in 2015 edition | + /// |`use foo` | `ModuleOrUniformRoot::CurrentScope` | - | pub imported_module: Cell>>, pub vis: Visibility, } diff --git a/compiler/rustc_resolve/src/lib.rs b/compiler/rustc_resolve/src/lib.rs index 08f1f61ea86e..27e14e0e62bf 100644 --- a/compiler/rustc_resolve/src/lib.rs +++ b/compiler/rustc_resolve/src/lib.rs @@ -119,7 +119,6 @@ enum Scope<'ra> { DeriveHelpers(LocalExpnId), DeriveHelpersCompat, MacroRules(MacroRulesScopeRef<'ra>), - CrateRoot, // The node ID is for reporting the `PROC_MACRO_DERIVE_RESOLUTION_FALLBACK` // lint if it should be reported. Module(Module<'ra>, Option), @@ -139,8 +138,8 @@ enum Scope<'ra> { enum ScopeSet<'ra> { /// All scopes with the given namespace. All(Namespace), - /// Crate root, then extern prelude (used for mixed 2015-2018 mode in macros). - AbsolutePath(Namespace), + /// A module, then extern prelude (used for mixed 2015-2018 mode in macros). + ModuleAndExternPrelude(Namespace, Module<'ra>), /// All scopes with macro namespace and the given macro kind restriction. Macro(MacroKind), /// All scopes with the given namespace, used for partially performing late resolution. @@ -419,8 +418,10 @@ enum ModuleOrUniformRoot<'ra> { /// Regular module. Module(Module<'ra>), - /// Virtual module that denotes resolution in crate root with fallback to extern prelude. - CrateRootAndExternPrelude, + /// Virtual module that denotes resolution in a module with fallback to extern prelude. + /// Used for paths starting with `::` coming from 2015 edition macros + /// used in 2018+ edition crates. + ModuleAndExternPrelude(Module<'ra>), /// Virtual module that denotes resolution in extern prelude. /// Used for paths starting with `::` on 2018 edition. From 01524abb05a4a60d0015972811b8bbb9bd2a73d3 Mon Sep 17 00:00:00 2001 From: Scott McMurray Date: Wed, 23 Jul 2025 22:13:05 -0700 Subject: [PATCH 136/139] MIR-build: No longer emit assumes in enum-as casting This just uses the `valid_range` from the backend, so it's duplicating the range metadata that now we include on parameters and loads. --- .../src/builder/expr/as_rvalue.rs | 80 +------------------ tests/crashes/121097.rs | 10 --- .../building/enum_cast.bar.built.after.mir | 5 -- .../building/enum_cast.boo.built.after.mir | 5 -- .../building/enum_cast.far.built.after.mir | 5 -- .../enum_cast.offsetty.built.after.mir | 9 --- tests/mir-opt/building/enum_cast.rs | 7 ++ .../building/enum_cast.signy.built.after.mir | 9 --- tests/ui/simd/repr-simd-on-enum.rs | 15 ++++ tests/ui/simd/repr-simd-on-enum.stderr | 14 ++++ .../self-in-enum-definition.stderr | 30 ------- 11 files changed, 38 insertions(+), 151 deletions(-) delete mode 100644 tests/crashes/121097.rs create mode 100644 tests/ui/simd/repr-simd-on-enum.rs create mode 100644 tests/ui/simd/repr-simd-on-enum.stderr diff --git a/compiler/rustc_mir_build/src/builder/expr/as_rvalue.rs b/compiler/rustc_mir_build/src/builder/expr/as_rvalue.rs index daf8fa5f19ee..a4ef6e927392 100644 --- a/compiler/rustc_mir_build/src/builder/expr/as_rvalue.rs +++ b/compiler/rustc_mir_build/src/builder/expr/as_rvalue.rs @@ -1,6 +1,6 @@ //! See docs in `build/expr/mod.rs`. -use rustc_abi::{BackendRepr, FieldIdx, Primitive}; +use rustc_abi::FieldIdx; use rustc_hir::lang_items::LangItem; use rustc_index::{Idx, IndexVec}; use rustc_middle::bug; @@ -9,7 +9,6 @@ use rustc_middle::mir::interpret::Scalar; use rustc_middle::mir::*; use rustc_middle::thir::*; use rustc_middle::ty::cast::{CastTy, mir_cast_kind}; -use rustc_middle::ty::layout::IntegerExt; use rustc_middle::ty::util::IntTypeExt; use rustc_middle::ty::{self, Ty, UpvarArgs}; use rustc_span::source_map::Spanned; @@ -200,8 +199,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { { let discr_ty = adt_def.repr().discr_type().to_ty(this.tcx); let temp = unpack!(block = this.as_temp(block, scope, source, Mutability::Not)); - let layout = - this.tcx.layout_of(this.typing_env().as_query_input(source_expr.ty)); let discr = this.temp(discr_ty, source_expr.span); this.cfg.push_assign( block, @@ -209,80 +206,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { discr, Rvalue::Discriminant(temp.into()), ); - let (op, ty) = (Operand::Move(discr), discr_ty); - - if let BackendRepr::Scalar(scalar) = layout.unwrap().backend_repr - && !scalar.is_always_valid(&this.tcx) - && let Primitive::Int(int_width, _signed) = scalar.primitive() - { - let unsigned_ty = int_width.to_ty(this.tcx, false); - let unsigned_place = this.temp(unsigned_ty, expr_span); - this.cfg.push_assign( - block, - source_info, - unsigned_place, - Rvalue::Cast(CastKind::IntToInt, Operand::Copy(discr), unsigned_ty), - ); - - let bool_ty = this.tcx.types.bool; - let range = scalar.valid_range(&this.tcx); - let merge_op = - if range.start <= range.end { BinOp::BitAnd } else { BinOp::BitOr }; - - let mut comparer = |range: u128, bin_op: BinOp| -> Place<'tcx> { - // We can use `ty::TypingEnv::fully_monomorphized()` here - // as we only need it to compute the layout of a primitive. - let range_val = Const::from_bits( - this.tcx, - range, - ty::TypingEnv::fully_monomorphized(), - unsigned_ty, - ); - let lit_op = this.literal_operand(expr.span, range_val); - let is_bin_op = this.temp(bool_ty, expr_span); - this.cfg.push_assign( - block, - source_info, - is_bin_op, - Rvalue::BinaryOp( - bin_op, - Box::new((Operand::Copy(unsigned_place), lit_op)), - ), - ); - is_bin_op - }; - let assert_place = if range.start == 0 { - comparer(range.end, BinOp::Le) - } else { - let start_place = comparer(range.start, BinOp::Ge); - let end_place = comparer(range.end, BinOp::Le); - let merge_place = this.temp(bool_ty, expr_span); - this.cfg.push_assign( - block, - source_info, - merge_place, - Rvalue::BinaryOp( - merge_op, - Box::new(( - Operand::Move(start_place), - Operand::Move(end_place), - )), - ), - ); - merge_place - }; - this.cfg.push( - block, - Statement::new( - source_info, - StatementKind::Intrinsic(Box::new(NonDivergingIntrinsic::Assume( - Operand::Move(assert_place), - ))), - ), - ); - } - - (op, ty) + (Operand::Move(discr), discr_ty) } else { let ty = source_expr.ty; let source = unpack!( diff --git a/tests/crashes/121097.rs b/tests/crashes/121097.rs deleted file mode 100644 index 65c6028e03e3..000000000000 --- a/tests/crashes/121097.rs +++ /dev/null @@ -1,10 +0,0 @@ -//@ known-bug: #121097 -#[repr(simd)] -enum Aligned { - Zero = 0, - One = 1, -} - -fn tou8(al: Aligned) -> u8 { - al as u8 -} diff --git a/tests/mir-opt/building/enum_cast.bar.built.after.mir b/tests/mir-opt/building/enum_cast.bar.built.after.mir index 72d0cf5d1e82..0dc6448ffad0 100644 --- a/tests/mir-opt/building/enum_cast.bar.built.after.mir +++ b/tests/mir-opt/building/enum_cast.bar.built.after.mir @@ -5,16 +5,11 @@ fn bar(_1: Bar) -> usize { let mut _0: usize; let _2: Bar; let mut _3: isize; - let mut _4: u8; - let mut _5: bool; bb0: { StorageLive(_2); _2 = move _1; _3 = discriminant(_2); - _4 = copy _3 as u8 (IntToInt); - _5 = Le(copy _4, const 1_u8); - assume(move _5); _0 = move _3 as usize (IntToInt); StorageDead(_2); return; diff --git a/tests/mir-opt/building/enum_cast.boo.built.after.mir b/tests/mir-opt/building/enum_cast.boo.built.after.mir index 91e06dc88629..3540a2b1e2e4 100644 --- a/tests/mir-opt/building/enum_cast.boo.built.after.mir +++ b/tests/mir-opt/building/enum_cast.boo.built.after.mir @@ -5,16 +5,11 @@ fn boo(_1: Boo) -> usize { let mut _0: usize; let _2: Boo; let mut _3: u8; - let mut _4: u8; - let mut _5: bool; bb0: { StorageLive(_2); _2 = move _1; _3 = discriminant(_2); - _4 = copy _3 as u8 (IntToInt); - _5 = Le(copy _4, const 1_u8); - assume(move _5); _0 = move _3 as usize (IntToInt); StorageDead(_2); return; diff --git a/tests/mir-opt/building/enum_cast.far.built.after.mir b/tests/mir-opt/building/enum_cast.far.built.after.mir index 14eaf3441903..da34b7ba6c28 100644 --- a/tests/mir-opt/building/enum_cast.far.built.after.mir +++ b/tests/mir-opt/building/enum_cast.far.built.after.mir @@ -5,16 +5,11 @@ fn far(_1: Far) -> isize { let mut _0: isize; let _2: Far; let mut _3: i16; - let mut _4: u16; - let mut _5: bool; bb0: { StorageLive(_2); _2 = move _1; _3 = discriminant(_2); - _4 = copy _3 as u16 (IntToInt); - _5 = Le(copy _4, const 1_u16); - assume(move _5); _0 = move _3 as isize (IntToInt); StorageDead(_2); return; diff --git a/tests/mir-opt/building/enum_cast.offsetty.built.after.mir b/tests/mir-opt/building/enum_cast.offsetty.built.after.mir index 1c2acbe3023f..b84ce0de9a0a 100644 --- a/tests/mir-opt/building/enum_cast.offsetty.built.after.mir +++ b/tests/mir-opt/building/enum_cast.offsetty.built.after.mir @@ -5,20 +5,11 @@ fn offsetty(_1: NotStartingAtZero) -> u32 { let mut _0: u32; let _2: NotStartingAtZero; let mut _3: isize; - let mut _4: u8; - let mut _5: bool; - let mut _6: bool; - let mut _7: bool; bb0: { StorageLive(_2); _2 = move _1; _3 = discriminant(_2); - _4 = copy _3 as u8 (IntToInt); - _5 = Ge(copy _4, const 4_u8); - _6 = Le(copy _4, const 8_u8); - _7 = BitAnd(move _5, move _6); - assume(move _7); _0 = move _3 as u32 (IntToInt); StorageDead(_2); return; diff --git a/tests/mir-opt/building/enum_cast.rs b/tests/mir-opt/building/enum_cast.rs index 4fb9a27e3093..eaf5537e0ab4 100644 --- a/tests/mir-opt/building/enum_cast.rs +++ b/tests/mir-opt/building/enum_cast.rs @@ -4,6 +4,13 @@ // EMIT_MIR enum_cast.boo.built.after.mir // EMIT_MIR enum_cast.far.built.after.mir +// Previously MIR building included range `Assume`s in the MIR statements, +// which these tests demonstrated, but now that we have range metadata on +// parameters in LLVM (in addition to !range metadata on loads) the impact +// of the extra volume of MIR is worse than its value. +// Thus these are now about the discriminant type and the cast type, +// both of which might be different from the backend type of the tag. + enum Foo { A, } diff --git a/tests/mir-opt/building/enum_cast.signy.built.after.mir b/tests/mir-opt/building/enum_cast.signy.built.after.mir index 39b6dfaf005e..503c506748ff 100644 --- a/tests/mir-opt/building/enum_cast.signy.built.after.mir +++ b/tests/mir-opt/building/enum_cast.signy.built.after.mir @@ -5,20 +5,11 @@ fn signy(_1: SignedAroundZero) -> i16 { let mut _0: i16; let _2: SignedAroundZero; let mut _3: i16; - let mut _4: u16; - let mut _5: bool; - let mut _6: bool; - let mut _7: bool; bb0: { StorageLive(_2); _2 = move _1; _3 = discriminant(_2); - _4 = copy _3 as u16 (IntToInt); - _5 = Ge(copy _4, const 65534_u16); - _6 = Le(copy _4, const 2_u16); - _7 = BitOr(move _5, move _6); - assume(move _7); _0 = move _3 as i16 (IntToInt); StorageDead(_2); return; diff --git a/tests/ui/simd/repr-simd-on-enum.rs b/tests/ui/simd/repr-simd-on-enum.rs new file mode 100644 index 000000000000..49cf9e92d36c --- /dev/null +++ b/tests/ui/simd/repr-simd-on-enum.rs @@ -0,0 +1,15 @@ +// Used to ICE; see + +#![feature(repr_simd)] + +#[repr(simd)] //~ ERROR attribute should be applied to a struct +enum Aligned { + Zero = 0, + One = 1, +} + +fn tou8(al: Aligned) -> u8 { + al as u8 +} + +fn main() {} diff --git a/tests/ui/simd/repr-simd-on-enum.stderr b/tests/ui/simd/repr-simd-on-enum.stderr new file mode 100644 index 000000000000..6a19a16e8eae --- /dev/null +++ b/tests/ui/simd/repr-simd-on-enum.stderr @@ -0,0 +1,14 @@ +error[E0517]: attribute should be applied to a struct + --> $DIR/repr-simd-on-enum.rs:5:8 + | +LL | #[repr(simd)] + | ^^^^ +LL | / enum Aligned { +LL | | Zero = 0, +LL | | One = 1, +LL | | } + | |_- not a struct + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0517`. diff --git a/tests/ui/type-alias-enum-variants/self-in-enum-definition.stderr b/tests/ui/type-alias-enum-variants/self-in-enum-definition.stderr index 084008d8b2a4..13ae6dfcaa35 100644 --- a/tests/ui/type-alias-enum-variants/self-in-enum-definition.stderr +++ b/tests/ui/type-alias-enum-variants/self-in-enum-definition.stderr @@ -7,36 +7,6 @@ LL | V3 = Self::V1 {} as u8 + 2, note: ...which requires const-evaluating + checking `Alpha::V3::{constant#0}`... --> $DIR/self-in-enum-definition.rs:5:10 | -LL | V3 = Self::V1 {} as u8 + 2, - | ^^^^^^^^^^^^^^^^^^^^^ -note: ...which requires caching mir of `Alpha::V3::{constant#0}` for CTFE... - --> $DIR/self-in-enum-definition.rs:5:10 - | -LL | V3 = Self::V1 {} as u8 + 2, - | ^^^^^^^^^^^^^^^^^^^^^ -note: ...which requires elaborating drops for `Alpha::V3::{constant#0}`... - --> $DIR/self-in-enum-definition.rs:5:10 - | -LL | V3 = Self::V1 {} as u8 + 2, - | ^^^^^^^^^^^^^^^^^^^^^ -note: ...which requires borrow-checking `Alpha::V3::{constant#0}`... - --> $DIR/self-in-enum-definition.rs:5:10 - | -LL | V3 = Self::V1 {} as u8 + 2, - | ^^^^^^^^^^^^^^^^^^^^^ -note: ...which requires promoting constants in MIR for `Alpha::V3::{constant#0}`... - --> $DIR/self-in-enum-definition.rs:5:10 - | -LL | V3 = Self::V1 {} as u8 + 2, - | ^^^^^^^^^^^^^^^^^^^^^ -note: ...which requires const checking `Alpha::V3::{constant#0}`... - --> $DIR/self-in-enum-definition.rs:5:10 - | -LL | V3 = Self::V1 {} as u8 + 2, - | ^^^^^^^^^^^^^^^^^^^^^ -note: ...which requires building MIR for `Alpha::V3::{constant#0}`... - --> $DIR/self-in-enum-definition.rs:5:10 - | LL | V3 = Self::V1 {} as u8 + 2, | ^^^^^^^^^^^^^^^^^^^^^ = note: ...which requires computing layout of `Alpha`... From 94c0cf891e4427083072b9050b89dd0332a616ae Mon Sep 17 00:00:00 2001 From: Oneirical Date: Tue, 22 Jul 2025 21:42:50 -0400 Subject: [PATCH 137/139] Rename tests/ui/SUMMARY.md and update rustc dev guide on error-pattern --- src/doc/rustc-dev-guide/src/tests/ui.md | 8 ++++---- tests/ui/{SUMMARY.md => README.md} | 0 2 files changed, 4 insertions(+), 4 deletions(-) rename tests/ui/{SUMMARY.md => README.md} (100%) diff --git a/src/doc/rustc-dev-guide/src/tests/ui.md b/src/doc/rustc-dev-guide/src/tests/ui.md index 9bfc60e08a6e..b1feef9ed0cc 100644 --- a/src/doc/rustc-dev-guide/src/tests/ui.md +++ b/src/doc/rustc-dev-guide/src/tests/ui.md @@ -309,7 +309,8 @@ fn main((ؼ Use `//~?` to match an error without line information. `//~?` is precise and will not match errors if their line information is available. -It should be preferred to using `error-pattern`, which is imprecise and non-exhaustive. +For tests wishing to match against compiler diagnostics, error annotations should +be preferred over //@ error-pattern, //@ error-pattern is imprecise and non-exhaustive. ```rust,ignore //@ compile-flags: --print yyyy @@ -347,8 +348,6 @@ fn main() { } ``` -Use of `error-pattern` is not recommended in general. - For strict testing of compile time output, try to use the line annotations `//~` as much as possible, including `//~?` annotations for diagnostics without spans. @@ -359,7 +358,8 @@ Some of the compiler messages can stay uncovered by annotations in this mode. For checking runtime output, `//@ check-run-results` may be preferable. -Only use `error-pattern` if none of the above works. +Only use `error-pattern` if none of the above works, such as when finding a +specific string pattern in a runtime panic output. Line annotations `//~` and `error-pattern` are compatible and can be used in the same test. diff --git a/tests/ui/SUMMARY.md b/tests/ui/README.md similarity index 100% rename from tests/ui/SUMMARY.md rename to tests/ui/README.md From a076bd8a61841941f52a43a31c9c77def961227e Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Fri, 25 Jul 2025 17:08:57 -0500 Subject: [PATCH 138/139] Remove `compiler-builtins-no-asm` This feature used to be for when Cranelift didn't support inline assembly, but its last uses were removed in 52933e0bd200 ("Don't disable inline asm usage in compiler-builtins when the cranelift backend is enabled"). and cba05a7a14b3 ("Support naked functions"). This doesn't remove the feature from the `compiler-builtins` crate, that will be done separately in the subtree repo. --- library/alloc/Cargo.toml | 1 - library/std/Cargo.toml | 1 - library/sysroot/Cargo.toml | 1 - 3 files changed, 3 deletions(-) diff --git a/library/alloc/Cargo.toml b/library/alloc/Cargo.toml index 017c790ecac3..49f5c42d1e13 100644 --- a/library/alloc/Cargo.toml +++ b/library/alloc/Cargo.toml @@ -21,7 +21,6 @@ compiler_builtins = { path = "../compiler-builtins/compiler-builtins", features [features] compiler-builtins-mem = ['compiler_builtins/mem'] compiler-builtins-c = ["compiler_builtins/c"] -compiler-builtins-no-asm = ["compiler_builtins/no-asm"] compiler-builtins-no-f16-f128 = ["compiler_builtins/no-f16-f128"] compiler-builtins-mangled-names = ["compiler_builtins/mangled-names"] # Make panics and failed asserts immediately abort without formatting any message diff --git a/library/std/Cargo.toml b/library/std/Cargo.toml index ba1e1f5218af..7015b707759c 100644 --- a/library/std/Cargo.toml +++ b/library/std/Cargo.toml @@ -97,7 +97,6 @@ backtrace-trace-only = [] panic-unwind = ["dep:panic_unwind"] compiler-builtins-c = ["alloc/compiler-builtins-c"] compiler-builtins-mem = ["alloc/compiler-builtins-mem"] -compiler-builtins-no-asm = ["alloc/compiler-builtins-no-asm"] compiler-builtins-no-f16-f128 = ["alloc/compiler-builtins-no-f16-f128"] compiler-builtins-mangled-names = ["alloc/compiler-builtins-mangled-names"] llvm-libunwind = ["unwind/llvm-libunwind"] diff --git a/library/sysroot/Cargo.toml b/library/sysroot/Cargo.toml index 032f5272a9cd..4a151a4264d7 100644 --- a/library/sysroot/Cargo.toml +++ b/library/sysroot/Cargo.toml @@ -23,7 +23,6 @@ backtrace = ["std/backtrace"] backtrace-trace-only = ["std/backtrace-trace-only"] compiler-builtins-c = ["std/compiler-builtins-c"] compiler-builtins-mem = ["std/compiler-builtins-mem"] -compiler-builtins-no-asm = ["std/compiler-builtins-no-asm"] compiler-builtins-no-f16-f128 = ["std/compiler-builtins-no-f16-f128"] compiler-builtins-mangled-names = ["std/compiler-builtins-mangled-names"] debug_refcell = ["std/debug_refcell"] From 51c5f191dec8b78b8a1b6e26eec26c26556125e3 Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Fri, 25 Jul 2025 19:21:20 -0500 Subject: [PATCH 139/139] Remove `compiler-builtins-mangled-names` This config was added in 207de019dc67 ("libary: Forward compiler-builtins "asm" and "mangled-names" feature") but it does not appear this has ever been used. The PR adding it (RUST-78472) says that this was exposed to help with configuration and points at the [Hermit Cargo config], but as far as I can tell, this feature name has never been mentioned in that repository's git history. Thus, clean up a seemingly unneeded feature. [Hermit Cargo config]: https://github.com/hermit-os/hermit-rs/blob/ab2b830930e6a9a98c8294997a8183feeabeda4a/.cargo/config --- library/alloc/Cargo.toml | 1 - library/std/Cargo.toml | 1 - library/sysroot/Cargo.toml | 1 - 3 files changed, 3 deletions(-) diff --git a/library/alloc/Cargo.toml b/library/alloc/Cargo.toml index 49f5c42d1e13..9ba7c5bd28a1 100644 --- a/library/alloc/Cargo.toml +++ b/library/alloc/Cargo.toml @@ -22,7 +22,6 @@ compiler_builtins = { path = "../compiler-builtins/compiler-builtins", features compiler-builtins-mem = ['compiler_builtins/mem'] compiler-builtins-c = ["compiler_builtins/c"] compiler-builtins-no-f16-f128 = ["compiler_builtins/no-f16-f128"] -compiler-builtins-mangled-names = ["compiler_builtins/mangled-names"] # Make panics and failed asserts immediately abort without formatting any message panic_immediate_abort = ["core/panic_immediate_abort"] # Choose algorithms that are optimized for binary size instead of runtime performance diff --git a/library/std/Cargo.toml b/library/std/Cargo.toml index 7015b707759c..d77f742e11b6 100644 --- a/library/std/Cargo.toml +++ b/library/std/Cargo.toml @@ -98,7 +98,6 @@ panic-unwind = ["dep:panic_unwind"] compiler-builtins-c = ["alloc/compiler-builtins-c"] compiler-builtins-mem = ["alloc/compiler-builtins-mem"] compiler-builtins-no-f16-f128 = ["alloc/compiler-builtins-no-f16-f128"] -compiler-builtins-mangled-names = ["alloc/compiler-builtins-mangled-names"] llvm-libunwind = ["unwind/llvm-libunwind"] system-llvm-libunwind = ["unwind/system-llvm-libunwind"] diff --git a/library/sysroot/Cargo.toml b/library/sysroot/Cargo.toml index 4a151a4264d7..82b93682c610 100644 --- a/library/sysroot/Cargo.toml +++ b/library/sysroot/Cargo.toml @@ -24,7 +24,6 @@ backtrace-trace-only = ["std/backtrace-trace-only"] compiler-builtins-c = ["std/compiler-builtins-c"] compiler-builtins-mem = ["std/compiler-builtins-mem"] compiler-builtins-no-f16-f128 = ["std/compiler-builtins-no-f16-f128"] -compiler-builtins-mangled-names = ["std/compiler-builtins-mangled-names"] debug_refcell = ["std/debug_refcell"] llvm-libunwind = ["std/llvm-libunwind"] system-llvm-libunwind = ["std/system-llvm-libunwind"]