From a24022ad4e98bfc5adc47cc114db57b68c8511d2 Mon Sep 17 00:00:00 2001 From: sayantn Date: Mon, 2 Mar 2026 00:32:24 +0530 Subject: [PATCH 01/35] Fix LLVM intrinsic signatures for AVX-VNNI --- .../crates/core_arch/src/x86/avx512vnni.rs | 160 +++++++++--------- 1 file changed, 80 insertions(+), 80 deletions(-) diff --git a/library/stdarch/crates/core_arch/src/x86/avx512vnni.rs b/library/stdarch/crates/core_arch/src/x86/avx512vnni.rs index 49b790b151049..8cd8764f24868 100644 --- a/library/stdarch/crates/core_arch/src/x86/avx512vnni.rs +++ b/library/stdarch/crates/core_arch/src/x86/avx512vnni.rs @@ -12,7 +12,7 @@ use stdarch_test::assert_instr; #[stable(feature = "stdarch_x86_avx512", since = "1.89")] #[cfg_attr(test, assert_instr(vpdpwssd))] pub fn _mm512_dpwssd_epi32(src: __m512i, a: __m512i, b: __m512i) -> __m512i { - unsafe { transmute(vpdpwssd(src.as_i32x16(), a.as_i32x16(), b.as_i32x16())) } + unsafe { transmute(vpdpwssd(src.as_i32x16(), a.as_i16x32(), b.as_i16x32())) } } /// Multiply groups of 2 adjacent pairs of signed 16-bit integers in a with corresponding 16-bit integers in b, producing 2 intermediate signed 32-bit results. Sum these 2 results with the corresponding 32-bit integer in src, and store the packed 32-bit results in dst using writemask k (elements are copied from src when the corresponding mask bit is not set). @@ -51,7 +51,7 @@ pub fn _mm512_maskz_dpwssd_epi32(k: __mmask16, src: __m512i, a: __m512i, b: __m5 #[stable(feature = "stdarch_x86_avx512", since = "1.89")] #[cfg_attr(test, assert_instr(vpdpwssd))] pub fn _mm256_dpwssd_avx_epi32(src: __m256i, a: __m256i, b: __m256i) -> __m256i { - unsafe { transmute(vpdpwssd256(src.as_i32x8(), a.as_i32x8(), b.as_i32x8())) } + unsafe { transmute(vpdpwssd256(src.as_i32x8(), a.as_i16x16(), b.as_i16x16())) } } /// Multiply groups of 2 adjacent pairs of signed 16-bit integers in a with corresponding 16-bit integers in b, producing 2 intermediate signed 32-bit results. Sum these 2 results with the corresponding 32-bit integer in src, and store the packed 32-bit results in dst. @@ -62,7 +62,7 @@ pub fn _mm256_dpwssd_avx_epi32(src: __m256i, a: __m256i, b: __m256i) -> __m256i #[stable(feature = "stdarch_x86_avx512", since = "1.89")] #[cfg_attr(test, assert_instr(vpdpwssd))] pub fn _mm256_dpwssd_epi32(src: __m256i, a: __m256i, b: __m256i) -> __m256i { - unsafe { transmute(vpdpwssd256(src.as_i32x8(), a.as_i32x8(), b.as_i32x8())) } + unsafe { transmute(vpdpwssd256(src.as_i32x8(), a.as_i16x16(), b.as_i16x16())) } } /// Multiply groups of 2 adjacent pairs of signed 16-bit integers in a with corresponding 16-bit integers in b, producing 2 intermediate signed 32-bit results. Sum these 2 results with the corresponding 32-bit integer in src, and store the packed 32-bit results in dst using writemask k (elements are copied from src when the corresponding mask bit is not set). @@ -101,7 +101,7 @@ pub fn _mm256_maskz_dpwssd_epi32(k: __mmask8, src: __m256i, a: __m256i, b: __m25 #[stable(feature = "stdarch_x86_avx512", since = "1.89")] #[cfg_attr(test, assert_instr(vpdpwssd))] pub fn _mm_dpwssd_avx_epi32(src: __m128i, a: __m128i, b: __m128i) -> __m128i { - unsafe { transmute(vpdpwssd128(src.as_i32x4(), a.as_i32x4(), b.as_i32x4())) } + unsafe { transmute(vpdpwssd128(src.as_i32x4(), a.as_i16x8(), b.as_i16x8())) } } /// Multiply groups of 2 adjacent pairs of signed 16-bit integers in a with corresponding 16-bit integers in b, producing 2 intermediate signed 32-bit results. Sum these 2 results with the corresponding 32-bit integer in src, and store the packed 32-bit results in dst. @@ -112,7 +112,7 @@ pub fn _mm_dpwssd_avx_epi32(src: __m128i, a: __m128i, b: __m128i) -> __m128i { #[stable(feature = "stdarch_x86_avx512", since = "1.89")] #[cfg_attr(test, assert_instr(vpdpwssd))] pub fn _mm_dpwssd_epi32(src: __m128i, a: __m128i, b: __m128i) -> __m128i { - unsafe { transmute(vpdpwssd128(src.as_i32x4(), a.as_i32x4(), b.as_i32x4())) } + unsafe { transmute(vpdpwssd128(src.as_i32x4(), a.as_i16x8(), b.as_i16x8())) } } /// Multiply groups of 2 adjacent pairs of signed 16-bit integers in a with corresponding 16-bit integers in b, producing 2 intermediate signed 32-bit results. Sum these 2 results with the corresponding 32-bit integer in src, and store the packed 32-bit results in dst using writemask k (elements are copied from src when the corresponding mask bit is not set). @@ -151,7 +151,7 @@ pub fn _mm_maskz_dpwssd_epi32(k: __mmask8, src: __m128i, a: __m128i, b: __m128i) #[stable(feature = "stdarch_x86_avx512", since = "1.89")] #[cfg_attr(test, assert_instr(vpdpwssds))] pub fn _mm512_dpwssds_epi32(src: __m512i, a: __m512i, b: __m512i) -> __m512i { - unsafe { transmute(vpdpwssds(src.as_i32x16(), a.as_i32x16(), b.as_i32x16())) } + unsafe { transmute(vpdpwssds(src.as_i32x16(), a.as_i16x32(), b.as_i16x32())) } } /// Multiply groups of 2 adjacent pairs of signed 16-bit integers in a with corresponding 16-bit integers in b, producing 2 intermediate signed 32-bit results. Sum these 2 results with the corresponding 32-bit integer in src using signed saturation, and store the packed 32-bit results in dst using writemask k (elements are copied from src when the corresponding mask bit is not set). @@ -190,7 +190,7 @@ pub fn _mm512_maskz_dpwssds_epi32(k: __mmask16, src: __m512i, a: __m512i, b: __m #[stable(feature = "stdarch_x86_avx512", since = "1.89")] #[cfg_attr(test, assert_instr(vpdpwssds))] pub fn _mm256_dpwssds_avx_epi32(src: __m256i, a: __m256i, b: __m256i) -> __m256i { - unsafe { transmute(vpdpwssds256(src.as_i32x8(), a.as_i32x8(), b.as_i32x8())) } + unsafe { transmute(vpdpwssds256(src.as_i32x8(), a.as_i16x16(), b.as_i16x16())) } } /// Multiply groups of 2 adjacent pairs of signed 16-bit integers in a with corresponding 16-bit integers in b, producing 2 intermediate signed 32-bit results. Sum these 2 results with the corresponding 32-bit integer in src using signed saturation, and store the packed 32-bit results in dst. @@ -201,7 +201,7 @@ pub fn _mm256_dpwssds_avx_epi32(src: __m256i, a: __m256i, b: __m256i) -> __m256i #[stable(feature = "stdarch_x86_avx512", since = "1.89")] #[cfg_attr(test, assert_instr(vpdpwssds))] pub fn _mm256_dpwssds_epi32(src: __m256i, a: __m256i, b: __m256i) -> __m256i { - unsafe { transmute(vpdpwssds256(src.as_i32x8(), a.as_i32x8(), b.as_i32x8())) } + unsafe { transmute(vpdpwssds256(src.as_i32x8(), a.as_i16x16(), b.as_i16x16())) } } /// Multiply groups of 2 adjacent pairs of signed 16-bit integers in a with corresponding 16-bit integers in b, producing 2 intermediate signed 32-bit results. Sum these 2 results with the corresponding 32-bit integer in src using signed saturation, and store the packed 32-bit results in dst using writemask k (elements are copied from src when the corresponding mask bit is not set). @@ -240,7 +240,7 @@ pub fn _mm256_maskz_dpwssds_epi32(k: __mmask8, src: __m256i, a: __m256i, b: __m2 #[stable(feature = "stdarch_x86_avx512", since = "1.89")] #[cfg_attr(test, assert_instr(vpdpwssds))] pub fn _mm_dpwssds_avx_epi32(src: __m128i, a: __m128i, b: __m128i) -> __m128i { - unsafe { transmute(vpdpwssds128(src.as_i32x4(), a.as_i32x4(), b.as_i32x4())) } + unsafe { transmute(vpdpwssds128(src.as_i32x4(), a.as_i16x8(), b.as_i16x8())) } } /// Multiply groups of 2 adjacent pairs of signed 16-bit integers in a with corresponding 16-bit integers in b, producing 2 intermediate signed 32-bit results. Sum these 2 results with the corresponding 32-bit integer in src using signed saturation, and store the packed 32-bit results in dst. @@ -251,7 +251,7 @@ pub fn _mm_dpwssds_avx_epi32(src: __m128i, a: __m128i, b: __m128i) -> __m128i { #[stable(feature = "stdarch_x86_avx512", since = "1.89")] #[cfg_attr(test, assert_instr(vpdpwssds))] pub fn _mm_dpwssds_epi32(src: __m128i, a: __m128i, b: __m128i) -> __m128i { - unsafe { transmute(vpdpwssds128(src.as_i32x4(), a.as_i32x4(), b.as_i32x4())) } + unsafe { transmute(vpdpwssds128(src.as_i32x4(), a.as_i16x8(), b.as_i16x8())) } } /// Multiply groups of 2 adjacent pairs of signed 16-bit integers in a with corresponding 16-bit integers in b, producing 2 intermediate signed 32-bit results. Sum these 2 results with the corresponding 32-bit integer in src using signed saturation, and store the packed 32-bit results in dst using writemask k (elements are copied from src when the corresponding mask bit is not set). @@ -290,7 +290,7 @@ pub fn _mm_maskz_dpwssds_epi32(k: __mmask8, src: __m128i, a: __m128i, b: __m128i #[stable(feature = "stdarch_x86_avx512", since = "1.89")] #[cfg_attr(test, assert_instr(vpdpbusd))] pub fn _mm512_dpbusd_epi32(src: __m512i, a: __m512i, b: __m512i) -> __m512i { - unsafe { transmute(vpdpbusd(src.as_i32x16(), a.as_i32x16(), b.as_i32x16())) } + unsafe { transmute(vpdpbusd(src.as_i32x16(), a.as_u8x64(), b.as_i8x64())) } } /// Multiply groups of 4 adjacent pairs of unsigned 8-bit integers in a with corresponding signed 8-bit integers in b, producing 4 intermediate signed 16-bit results. Sum these 4 results with the corresponding 32-bit integer in src, and store the packed 32-bit results in dst using writemask k (elements are copied from src when the corresponding mask bit is not set). @@ -329,7 +329,7 @@ pub fn _mm512_maskz_dpbusd_epi32(k: __mmask16, src: __m512i, a: __m512i, b: __m5 #[stable(feature = "stdarch_x86_avx512", since = "1.89")] #[cfg_attr(test, assert_instr(vpdpbusd))] pub fn _mm256_dpbusd_avx_epi32(src: __m256i, a: __m256i, b: __m256i) -> __m256i { - unsafe { transmute(vpdpbusd256(src.as_i32x8(), a.as_i32x8(), b.as_i32x8())) } + unsafe { transmute(vpdpbusd256(src.as_i32x8(), a.as_u8x32(), b.as_i8x32())) } } /// Multiply groups of 4 adjacent pairs of unsigned 8-bit integers in a with corresponding signed 8-bit integers in b, producing 4 intermediate signed 16-bit results. Sum these 4 results with the corresponding 32-bit integer in src, and store the packed 32-bit results in dst. @@ -340,7 +340,7 @@ pub fn _mm256_dpbusd_avx_epi32(src: __m256i, a: __m256i, b: __m256i) -> __m256i #[stable(feature = "stdarch_x86_avx512", since = "1.89")] #[cfg_attr(test, assert_instr(vpdpbusd))] pub fn _mm256_dpbusd_epi32(src: __m256i, a: __m256i, b: __m256i) -> __m256i { - unsafe { transmute(vpdpbusd256(src.as_i32x8(), a.as_i32x8(), b.as_i32x8())) } + unsafe { transmute(vpdpbusd256(src.as_i32x8(), a.as_u8x32(), b.as_i8x32())) } } /// Multiply groups of 4 adjacent pairs of unsigned 8-bit integers in a with corresponding signed 8-bit integers in b, producing 4 intermediate signed 16-bit results. Sum these 4 results with the corresponding 32-bit integer in src, and store the packed 32-bit results in dst using writemask k (elements are copied from src when the corresponding mask bit is not set). @@ -379,7 +379,7 @@ pub fn _mm256_maskz_dpbusd_epi32(k: __mmask8, src: __m256i, a: __m256i, b: __m25 #[stable(feature = "stdarch_x86_avx512", since = "1.89")] #[cfg_attr(test, assert_instr(vpdpbusd))] pub fn _mm_dpbusd_avx_epi32(src: __m128i, a: __m128i, b: __m128i) -> __m128i { - unsafe { transmute(vpdpbusd128(src.as_i32x4(), a.as_i32x4(), b.as_i32x4())) } + unsafe { transmute(vpdpbusd128(src.as_i32x4(), a.as_u8x16(), b.as_i8x16())) } } /// Multiply groups of 4 adjacent pairs of unsigned 8-bit integers in a with corresponding signed 8-bit integers in b, producing 4 intermediate signed 16-bit results. Sum these 4 results with the corresponding 32-bit integer in src, and store the packed 32-bit results in dst. @@ -390,7 +390,7 @@ pub fn _mm_dpbusd_avx_epi32(src: __m128i, a: __m128i, b: __m128i) -> __m128i { #[stable(feature = "stdarch_x86_avx512", since = "1.89")] #[cfg_attr(test, assert_instr(vpdpbusd))] pub fn _mm_dpbusd_epi32(src: __m128i, a: __m128i, b: __m128i) -> __m128i { - unsafe { transmute(vpdpbusd128(src.as_i32x4(), a.as_i32x4(), b.as_i32x4())) } + unsafe { transmute(vpdpbusd128(src.as_i32x4(), a.as_u8x16(), b.as_i8x16())) } } /// Multiply groups of 4 adjacent pairs of unsigned 8-bit integers in a with corresponding signed 8-bit integers in b, producing 4 intermediate signed 16-bit results. Sum these 4 results with the corresponding 32-bit integer in src, and store the packed 32-bit results in dst using writemask k (elements are copied from src when the corresponding mask bit is not set). @@ -429,7 +429,7 @@ pub fn _mm_maskz_dpbusd_epi32(k: __mmask8, src: __m128i, a: __m128i, b: __m128i) #[stable(feature = "stdarch_x86_avx512", since = "1.89")] #[cfg_attr(test, assert_instr(vpdpbusds))] pub fn _mm512_dpbusds_epi32(src: __m512i, a: __m512i, b: __m512i) -> __m512i { - unsafe { transmute(vpdpbusds(src.as_i32x16(), a.as_i32x16(), b.as_i32x16())) } + unsafe { transmute(vpdpbusds(src.as_i32x16(), a.as_u8x64(), b.as_i8x64())) } } /// Multiply groups of 4 adjacent pairs of unsigned 8-bit integers in a with corresponding signed 8-bit integers in b, producing 4 intermediate signed 16-bit results. Sum these 4 results with the corresponding 32-bit integer in src using signed saturation, and store the packed 32-bit results in dst using writemask k (elements are copied from src when the corresponding mask bit is not set). @@ -468,7 +468,7 @@ pub fn _mm512_maskz_dpbusds_epi32(k: __mmask16, src: __m512i, a: __m512i, b: __m #[stable(feature = "stdarch_x86_avx512", since = "1.89")] #[cfg_attr(test, assert_instr(vpdpbusds))] pub fn _mm256_dpbusds_avx_epi32(src: __m256i, a: __m256i, b: __m256i) -> __m256i { - unsafe { transmute(vpdpbusds256(src.as_i32x8(), a.as_i32x8(), b.as_i32x8())) } + unsafe { transmute(vpdpbusds256(src.as_i32x8(), a.as_u8x32(), b.as_i8x32())) } } /// Multiply groups of 4 adjacent pairs of unsigned 8-bit integers in a with corresponding signed 8-bit integers in b, producing 4 intermediate signed 16-bit results. Sum these 4 results with the corresponding 32-bit integer in src using signed saturation, and store the packed 32-bit results in dst. @@ -479,7 +479,7 @@ pub fn _mm256_dpbusds_avx_epi32(src: __m256i, a: __m256i, b: __m256i) -> __m256i #[stable(feature = "stdarch_x86_avx512", since = "1.89")] #[cfg_attr(test, assert_instr(vpdpbusds))] pub fn _mm256_dpbusds_epi32(src: __m256i, a: __m256i, b: __m256i) -> __m256i { - unsafe { transmute(vpdpbusds256(src.as_i32x8(), a.as_i32x8(), b.as_i32x8())) } + unsafe { transmute(vpdpbusds256(src.as_i32x8(), a.as_u8x32(), b.as_i8x32())) } } /// Multiply groups of 4 adjacent pairs of unsigned 8-bit integers in a with corresponding signed 8-bit integers in b, producing 4 intermediate signed 16-bit results. Sum these 4 results with the corresponding 32-bit integer in src using signed saturation, and store the packed 32-bit results in dst using writemask k (elements are copied from src when the corresponding mask bit is not set). @@ -518,7 +518,7 @@ pub fn _mm256_maskz_dpbusds_epi32(k: __mmask8, src: __m256i, a: __m256i, b: __m2 #[stable(feature = "stdarch_x86_avx512", since = "1.89")] #[cfg_attr(test, assert_instr(vpdpbusds))] pub fn _mm_dpbusds_avx_epi32(src: __m128i, a: __m128i, b: __m128i) -> __m128i { - unsafe { transmute(vpdpbusds128(src.as_i32x4(), a.as_i32x4(), b.as_i32x4())) } + unsafe { transmute(vpdpbusds128(src.as_i32x4(), a.as_u8x16(), b.as_i8x16())) } } /// Multiply groups of 4 adjacent pairs of unsigned 8-bit integers in a with corresponding signed 8-bit integers in b, producing 4 intermediate signed 16-bit results. Sum these 4 results with the corresponding 32-bit integer in src using signed saturation, and store the packed 32-bit results in dst. @@ -529,7 +529,7 @@ pub fn _mm_dpbusds_avx_epi32(src: __m128i, a: __m128i, b: __m128i) -> __m128i { #[stable(feature = "stdarch_x86_avx512", since = "1.89")] #[cfg_attr(test, assert_instr(vpdpbusds))] pub fn _mm_dpbusds_epi32(src: __m128i, a: __m128i, b: __m128i) -> __m128i { - unsafe { transmute(vpdpbusds128(src.as_i32x4(), a.as_i32x4(), b.as_i32x4())) } + unsafe { transmute(vpdpbusds128(src.as_i32x4(), a.as_u8x16(), b.as_i8x16())) } } /// Multiply groups of 4 adjacent pairs of unsigned 8-bit integers in a with corresponding signed 8-bit integers in b, producing 4 intermediate signed 16-bit results. Sum these 4 results with the corresponding 32-bit integer in src using signed saturation, and store the packed 32-bit results in dst using writemask k (elements are copied from src when the corresponding mask bit is not set). @@ -570,7 +570,7 @@ pub fn _mm_maskz_dpbusds_epi32(k: __mmask8, src: __m128i, a: __m128i, b: __m128i #[cfg_attr(test, assert_instr(vpdpbssd))] #[stable(feature = "stdarch_x86_avx512", since = "1.89")] pub fn _mm_dpbssd_epi32(src: __m128i, a: __m128i, b: __m128i) -> __m128i { - unsafe { transmute(vpdpbssd_128(src.as_i32x4(), a.as_i32x4(), b.as_i32x4())) } + unsafe { transmute(vpdpbssd_128(src.as_i32x4(), a.as_i8x16(), b.as_i8x16())) } } /// Multiply groups of 4 adjacent pairs of signed 8-bit integers in a with corresponding signed 8-bit @@ -583,7 +583,7 @@ pub fn _mm_dpbssd_epi32(src: __m128i, a: __m128i, b: __m128i) -> __m128i { #[cfg_attr(test, assert_instr(vpdpbssd))] #[stable(feature = "stdarch_x86_avx512", since = "1.89")] pub fn _mm256_dpbssd_epi32(src: __m256i, a: __m256i, b: __m256i) -> __m256i { - unsafe { transmute(vpdpbssd_256(src.as_i32x8(), a.as_i32x8(), b.as_i32x8())) } + unsafe { transmute(vpdpbssd_256(src.as_i32x8(), a.as_i8x32(), b.as_i8x32())) } } /// Multiply groups of 4 adjacent pairs of signed 8-bit integers in a with corresponding signed 8-bit @@ -596,7 +596,7 @@ pub fn _mm256_dpbssd_epi32(src: __m256i, a: __m256i, b: __m256i) -> __m256i { #[cfg_attr(test, assert_instr(vpdpbssds))] #[stable(feature = "stdarch_x86_avx512", since = "1.89")] pub fn _mm_dpbssds_epi32(src: __m128i, a: __m128i, b: __m128i) -> __m128i { - unsafe { transmute(vpdpbssds_128(src.as_i32x4(), a.as_i32x4(), b.as_i32x4())) } + unsafe { transmute(vpdpbssds_128(src.as_i32x4(), a.as_i8x16(), b.as_i8x16())) } } /// Multiply groups of 4 adjacent pairs of signed 8-bit integers in a with corresponding signed 8-bit @@ -609,7 +609,7 @@ pub fn _mm_dpbssds_epi32(src: __m128i, a: __m128i, b: __m128i) -> __m128i { #[cfg_attr(test, assert_instr(vpdpbssds))] #[stable(feature = "stdarch_x86_avx512", since = "1.89")] pub fn _mm256_dpbssds_epi32(src: __m256i, a: __m256i, b: __m256i) -> __m256i { - unsafe { transmute(vpdpbssds_256(src.as_i32x8(), a.as_i32x8(), b.as_i32x8())) } + unsafe { transmute(vpdpbssds_256(src.as_i32x8(), a.as_i8x32(), b.as_i8x32())) } } /// Multiply groups of 4 adjacent pairs of signed 8-bit integers in a with corresponding unsigned 8-bit @@ -622,7 +622,7 @@ pub fn _mm256_dpbssds_epi32(src: __m256i, a: __m256i, b: __m256i) -> __m256i { #[cfg_attr(test, assert_instr(vpdpbsud))] #[stable(feature = "stdarch_x86_avx512", since = "1.89")] pub fn _mm_dpbsud_epi32(src: __m128i, a: __m128i, b: __m128i) -> __m128i { - unsafe { transmute(vpdpbsud_128(src.as_i32x4(), a.as_i32x4(), b.as_i32x4())) } + unsafe { transmute(vpdpbsud_128(src.as_i32x4(), a.as_i8x16(), b.as_u8x16())) } } /// Multiply groups of 4 adjacent pairs of signed 8-bit integers in a with corresponding unsigned 8-bit @@ -635,7 +635,7 @@ pub fn _mm_dpbsud_epi32(src: __m128i, a: __m128i, b: __m128i) -> __m128i { #[cfg_attr(test, assert_instr(vpdpbsud))] #[stable(feature = "stdarch_x86_avx512", since = "1.89")] pub fn _mm256_dpbsud_epi32(src: __m256i, a: __m256i, b: __m256i) -> __m256i { - unsafe { transmute(vpdpbsud_256(src.as_i32x8(), a.as_i32x8(), b.as_i32x8())) } + unsafe { transmute(vpdpbsud_256(src.as_i32x8(), a.as_i8x32(), b.as_u8x32())) } } /// Multiply groups of 4 adjacent pairs of signed 8-bit integers in a with corresponding unsigned 8-bit @@ -648,7 +648,7 @@ pub fn _mm256_dpbsud_epi32(src: __m256i, a: __m256i, b: __m256i) -> __m256i { #[cfg_attr(test, assert_instr(vpdpbsuds))] #[stable(feature = "stdarch_x86_avx512", since = "1.89")] pub fn _mm_dpbsuds_epi32(src: __m128i, a: __m128i, b: __m128i) -> __m128i { - unsafe { transmute(vpdpbsuds_128(src.as_i32x4(), a.as_i32x4(), b.as_i32x4())) } + unsafe { transmute(vpdpbsuds_128(src.as_i32x4(), a.as_i8x16(), b.as_u8x16())) } } /// Multiply groups of 4 adjacent pairs of signed 8-bit integers in a with corresponding unsigned 8-bit @@ -661,7 +661,7 @@ pub fn _mm_dpbsuds_epi32(src: __m128i, a: __m128i, b: __m128i) -> __m128i { #[cfg_attr(test, assert_instr(vpdpbsuds))] #[stable(feature = "stdarch_x86_avx512", since = "1.89")] pub fn _mm256_dpbsuds_epi32(src: __m256i, a: __m256i, b: __m256i) -> __m256i { - unsafe { transmute(vpdpbsuds_256(src.as_i32x8(), a.as_i32x8(), b.as_i32x8())) } + unsafe { transmute(vpdpbsuds_256(src.as_i32x8(), a.as_i8x32(), b.as_u8x32())) } } /// Multiply groups of 4 adjacent pairs of unsigned 8-bit integers in a with corresponding unsigned 8-bit @@ -674,7 +674,7 @@ pub fn _mm256_dpbsuds_epi32(src: __m256i, a: __m256i, b: __m256i) -> __m256i { #[cfg_attr(test, assert_instr(vpdpbuud))] #[stable(feature = "stdarch_x86_avx512", since = "1.89")] pub fn _mm_dpbuud_epi32(src: __m128i, a: __m128i, b: __m128i) -> __m128i { - unsafe { transmute(vpdpbuud_128(src.as_i32x4(), a.as_i32x4(), b.as_i32x4())) } + unsafe { transmute(vpdpbuud_128(src.as_i32x4(), a.as_u8x16(), b.as_u8x16())) } } /// Multiply groups of 4 adjacent pairs of unsigned 8-bit integers in a with corresponding unsigned 8-bit @@ -687,7 +687,7 @@ pub fn _mm_dpbuud_epi32(src: __m128i, a: __m128i, b: __m128i) -> __m128i { #[cfg_attr(test, assert_instr(vpdpbuud))] #[stable(feature = "stdarch_x86_avx512", since = "1.89")] pub fn _mm256_dpbuud_epi32(src: __m256i, a: __m256i, b: __m256i) -> __m256i { - unsafe { transmute(vpdpbuud_256(src.as_i32x8(), a.as_i32x8(), b.as_i32x8())) } + unsafe { transmute(vpdpbuud_256(src.as_i32x8(), a.as_u8x32(), b.as_u8x32())) } } /// Multiply groups of 4 adjacent pairs of unsigned 8-bit integers in a with corresponding unsigned 8-bit @@ -700,7 +700,7 @@ pub fn _mm256_dpbuud_epi32(src: __m256i, a: __m256i, b: __m256i) -> __m256i { #[cfg_attr(test, assert_instr(vpdpbuuds))] #[stable(feature = "stdarch_x86_avx512", since = "1.89")] pub fn _mm_dpbuuds_epi32(src: __m128i, a: __m128i, b: __m128i) -> __m128i { - unsafe { transmute(vpdpbuuds_128(src.as_i32x4(), a.as_i32x4(), b.as_i32x4())) } + unsafe { transmute(vpdpbuuds_128(src.as_i32x4(), a.as_u8x16(), b.as_u8x16())) } } /// Multiply groups of 4 adjacent pairs of unsigned 8-bit integers in a with corresponding unsigned 8-bit @@ -713,7 +713,7 @@ pub fn _mm_dpbuuds_epi32(src: __m128i, a: __m128i, b: __m128i) -> __m128i { #[cfg_attr(test, assert_instr(vpdpbuuds))] #[stable(feature = "stdarch_x86_avx512", since = "1.89")] pub fn _mm256_dpbuuds_epi32(src: __m256i, a: __m256i, b: __m256i) -> __m256i { - unsafe { transmute(vpdpbuuds_256(src.as_i32x8(), a.as_i32x8(), b.as_i32x8())) } + unsafe { transmute(vpdpbuuds_256(src.as_i32x8(), a.as_u8x32(), b.as_u8x32())) } } /// Multiply groups of 2 adjacent pairs of signed 16-bit integers in a with corresponding unsigned 16-bit @@ -726,7 +726,7 @@ pub fn _mm256_dpbuuds_epi32(src: __m256i, a: __m256i, b: __m256i) -> __m256i { #[cfg_attr(test, assert_instr(vpdpwsud))] #[stable(feature = "stdarch_x86_avx512", since = "1.89")] pub fn _mm_dpwsud_epi32(src: __m128i, a: __m128i, b: __m128i) -> __m128i { - unsafe { transmute(vpdpwsud_128(src.as_i32x4(), a.as_i32x4(), b.as_i32x4())) } + unsafe { transmute(vpdpwsud_128(src.as_i32x4(), a.as_i16x8(), b.as_u16x8())) } } /// Multiply groups of 2 adjacent pairs of signed 16-bit integers in a with corresponding unsigned 16-bit @@ -739,7 +739,7 @@ pub fn _mm_dpwsud_epi32(src: __m128i, a: __m128i, b: __m128i) -> __m128i { #[cfg_attr(test, assert_instr(vpdpwsud))] #[stable(feature = "stdarch_x86_avx512", since = "1.89")] pub fn _mm256_dpwsud_epi32(src: __m256i, a: __m256i, b: __m256i) -> __m256i { - unsafe { transmute(vpdpwsud_256(src.as_i32x8(), a.as_i32x8(), b.as_i32x8())) } + unsafe { transmute(vpdpwsud_256(src.as_i32x8(), a.as_i16x16(), b.as_u16x16())) } } /// Multiply groups of 2 adjacent pairs of signed 16-bit integers in a with corresponding unsigned 16-bit @@ -752,7 +752,7 @@ pub fn _mm256_dpwsud_epi32(src: __m256i, a: __m256i, b: __m256i) -> __m256i { #[cfg_attr(test, assert_instr(vpdpwsuds))] #[stable(feature = "stdarch_x86_avx512", since = "1.89")] pub fn _mm_dpwsuds_epi32(src: __m128i, a: __m128i, b: __m128i) -> __m128i { - unsafe { transmute(vpdpwsuds_128(src.as_i32x4(), a.as_i32x4(), b.as_i32x4())) } + unsafe { transmute(vpdpwsuds_128(src.as_i32x4(), a.as_i16x8(), b.as_u16x8())) } } /// Multiply groups of 2 adjacent pairs of signed 16-bit integers in a with corresponding unsigned 16-bit @@ -765,7 +765,7 @@ pub fn _mm_dpwsuds_epi32(src: __m128i, a: __m128i, b: __m128i) -> __m128i { #[cfg_attr(test, assert_instr(vpdpwsuds))] #[stable(feature = "stdarch_x86_avx512", since = "1.89")] pub fn _mm256_dpwsuds_epi32(src: __m256i, a: __m256i, b: __m256i) -> __m256i { - unsafe { transmute(vpdpwsuds_256(src.as_i32x8(), a.as_i32x8(), b.as_i32x8())) } + unsafe { transmute(vpdpwsuds_256(src.as_i32x8(), a.as_i16x16(), b.as_u16x16())) } } /// Multiply groups of 2 adjacent pairs of unsigned 16-bit integers in a with corresponding signed 16-bit @@ -778,7 +778,7 @@ pub fn _mm256_dpwsuds_epi32(src: __m256i, a: __m256i, b: __m256i) -> __m256i { #[cfg_attr(test, assert_instr(vpdpwusd))] #[stable(feature = "stdarch_x86_avx512", since = "1.89")] pub fn _mm_dpwusd_epi32(src: __m128i, a: __m128i, b: __m128i) -> __m128i { - unsafe { transmute(vpdpwusd_128(src.as_i32x4(), a.as_i32x4(), b.as_i32x4())) } + unsafe { transmute(vpdpwusd_128(src.as_i32x4(), a.as_u16x8(), b.as_i16x8())) } } /// Multiply groups of 2 adjacent pairs of unsigned 16-bit integers in a with corresponding signed 16-bit @@ -791,7 +791,7 @@ pub fn _mm_dpwusd_epi32(src: __m128i, a: __m128i, b: __m128i) -> __m128i { #[cfg_attr(test, assert_instr(vpdpwusd))] #[stable(feature = "stdarch_x86_avx512", since = "1.89")] pub fn _mm256_dpwusd_epi32(src: __m256i, a: __m256i, b: __m256i) -> __m256i { - unsafe { transmute(vpdpwusd_256(src.as_i32x8(), a.as_i32x8(), b.as_i32x8())) } + unsafe { transmute(vpdpwusd_256(src.as_i32x8(), a.as_u16x16(), b.as_i16x16())) } } /// Multiply groups of 2 adjacent pairs of unsigned 16-bit integers in a with corresponding signed 16-bit @@ -804,7 +804,7 @@ pub fn _mm256_dpwusd_epi32(src: __m256i, a: __m256i, b: __m256i) -> __m256i { #[cfg_attr(test, assert_instr(vpdpwusds))] #[stable(feature = "stdarch_x86_avx512", since = "1.89")] pub fn _mm_dpwusds_epi32(src: __m128i, a: __m128i, b: __m128i) -> __m128i { - unsafe { transmute(vpdpwusds_128(src.as_i32x4(), a.as_i32x4(), b.as_i32x4())) } + unsafe { transmute(vpdpwusds_128(src.as_i32x4(), a.as_u16x8(), b.as_i16x8())) } } /// Multiply groups of 2 adjacent pairs of unsigned 16-bit integers in a with corresponding signed 16-bit @@ -817,7 +817,7 @@ pub fn _mm_dpwusds_epi32(src: __m128i, a: __m128i, b: __m128i) -> __m128i { #[cfg_attr(test, assert_instr(vpdpwusds))] #[stable(feature = "stdarch_x86_avx512", since = "1.89")] pub fn _mm256_dpwusds_epi32(src: __m256i, a: __m256i, b: __m256i) -> __m256i { - unsafe { transmute(vpdpwusds_256(src.as_i32x8(), a.as_i32x8(), b.as_i32x8())) } + unsafe { transmute(vpdpwusds_256(src.as_i32x8(), a.as_u16x16(), b.as_i16x16())) } } /// Multiply groups of 2 adjacent pairs of unsigned 16-bit integers in a with corresponding unsigned 16-bit @@ -830,7 +830,7 @@ pub fn _mm256_dpwusds_epi32(src: __m256i, a: __m256i, b: __m256i) -> __m256i { #[cfg_attr(test, assert_instr(vpdpwuud))] #[stable(feature = "stdarch_x86_avx512", since = "1.89")] pub fn _mm_dpwuud_epi32(src: __m128i, a: __m128i, b: __m128i) -> __m128i { - unsafe { transmute(vpdpwuud_128(src.as_i32x4(), a.as_i32x4(), b.as_i32x4())) } + unsafe { transmute(vpdpwuud_128(src.as_i32x4(), a.as_u16x8(), b.as_u16x8())) } } /// Multiply groups of 2 adjacent pairs of unsigned 16-bit integers in a with corresponding unsigned 16-bit @@ -843,7 +843,7 @@ pub fn _mm_dpwuud_epi32(src: __m128i, a: __m128i, b: __m128i) -> __m128i { #[cfg_attr(test, assert_instr(vpdpwuud))] #[stable(feature = "stdarch_x86_avx512", since = "1.89")] pub fn _mm256_dpwuud_epi32(src: __m256i, a: __m256i, b: __m256i) -> __m256i { - unsafe { transmute(vpdpwuud_256(src.as_i32x8(), a.as_i32x8(), b.as_i32x8())) } + unsafe { transmute(vpdpwuud_256(src.as_i32x8(), a.as_u16x16(), b.as_u16x16())) } } /// Multiply groups of 2 adjacent pairs of unsigned 16-bit integers in a with corresponding unsigned 16-bit @@ -856,7 +856,7 @@ pub fn _mm256_dpwuud_epi32(src: __m256i, a: __m256i, b: __m256i) -> __m256i { #[cfg_attr(test, assert_instr(vpdpwuuds))] #[stable(feature = "stdarch_x86_avx512", since = "1.89")] pub fn _mm_dpwuuds_epi32(src: __m128i, a: __m128i, b: __m128i) -> __m128i { - unsafe { transmute(vpdpwuuds_128(src.as_i32x4(), a.as_i32x4(), b.as_i32x4())) } + unsafe { transmute(vpdpwuuds_128(src.as_i32x4(), a.as_u16x8(), b.as_u16x8())) } } /// Multiply groups of 2 adjacent pairs of unsigned 16-bit integers in a with corresponding unsigned 16-bit @@ -869,98 +869,98 @@ pub fn _mm_dpwuuds_epi32(src: __m128i, a: __m128i, b: __m128i) -> __m128i { #[cfg_attr(test, assert_instr(vpdpwuuds))] #[stable(feature = "stdarch_x86_avx512", since = "1.89")] pub fn _mm256_dpwuuds_epi32(src: __m256i, a: __m256i, b: __m256i) -> __m256i { - unsafe { transmute(vpdpwuuds_256(src.as_i32x8(), a.as_i32x8(), b.as_i32x8())) } + unsafe { transmute(vpdpwuuds_256(src.as_i32x8(), a.as_u16x16(), b.as_u16x16())) } } #[allow(improper_ctypes)] unsafe extern "C" { #[link_name = "llvm.x86.avx512.vpdpwssd.512"] - fn vpdpwssd(src: i32x16, a: i32x16, b: i32x16) -> i32x16; + fn vpdpwssd(src: i32x16, a: i16x32, b: i16x32) -> i32x16; #[link_name = "llvm.x86.avx512.vpdpwssd.256"] - fn vpdpwssd256(src: i32x8, a: i32x8, b: i32x8) -> i32x8; + fn vpdpwssd256(src: i32x8, a: i16x16, b: i16x16) -> i32x8; #[link_name = "llvm.x86.avx512.vpdpwssd.128"] - fn vpdpwssd128(src: i32x4, a: i32x4, b: i32x4) -> i32x4; + fn vpdpwssd128(src: i32x4, a: i16x8, b: i16x8) -> i32x4; #[link_name = "llvm.x86.avx512.vpdpwssds.512"] - fn vpdpwssds(src: i32x16, a: i32x16, b: i32x16) -> i32x16; + fn vpdpwssds(src: i32x16, a: i16x32, b: i16x32) -> i32x16; #[link_name = "llvm.x86.avx512.vpdpwssds.256"] - fn vpdpwssds256(src: i32x8, a: i32x8, b: i32x8) -> i32x8; + fn vpdpwssds256(src: i32x8, a: i16x16, b: i16x16) -> i32x8; #[link_name = "llvm.x86.avx512.vpdpwssds.128"] - fn vpdpwssds128(src: i32x4, a: i32x4, b: i32x4) -> i32x4; + fn vpdpwssds128(src: i32x4, a: i16x8, b: i16x8) -> i32x4; #[link_name = "llvm.x86.avx512.vpdpbusd.512"] - fn vpdpbusd(src: i32x16, a: i32x16, b: i32x16) -> i32x16; + fn vpdpbusd(src: i32x16, a: u8x64, b: i8x64) -> i32x16; #[link_name = "llvm.x86.avx512.vpdpbusd.256"] - fn vpdpbusd256(src: i32x8, a: i32x8, b: i32x8) -> i32x8; + fn vpdpbusd256(src: i32x8, a: u8x32, b: i8x32) -> i32x8; #[link_name = "llvm.x86.avx512.vpdpbusd.128"] - fn vpdpbusd128(src: i32x4, a: i32x4, b: i32x4) -> i32x4; + fn vpdpbusd128(src: i32x4, a: u8x16, b: i8x16) -> i32x4; #[link_name = "llvm.x86.avx512.vpdpbusds.512"] - fn vpdpbusds(src: i32x16, a: i32x16, b: i32x16) -> i32x16; + fn vpdpbusds(src: i32x16, a: u8x64, b: i8x64) -> i32x16; #[link_name = "llvm.x86.avx512.vpdpbusds.256"] - fn vpdpbusds256(src: i32x8, a: i32x8, b: i32x8) -> i32x8; + fn vpdpbusds256(src: i32x8, a: u8x32, b: i8x32) -> i32x8; #[link_name = "llvm.x86.avx512.vpdpbusds.128"] - fn vpdpbusds128(src: i32x4, a: i32x4, b: i32x4) -> i32x4; + fn vpdpbusds128(src: i32x4, a: u8x16, b: i8x16) -> i32x4; #[link_name = "llvm.x86.avx2.vpdpbssd.128"] - fn vpdpbssd_128(src: i32x4, a: i32x4, b: i32x4) -> i32x4; + fn vpdpbssd_128(src: i32x4, a: i8x16, b: i8x16) -> i32x4; #[link_name = "llvm.x86.avx2.vpdpbssd.256"] - fn vpdpbssd_256(src: i32x8, a: i32x8, b: i32x8) -> i32x8; + fn vpdpbssd_256(src: i32x8, a: i8x32, b: i8x32) -> i32x8; #[link_name = "llvm.x86.avx2.vpdpbssds.128"] - fn vpdpbssds_128(src: i32x4, a: i32x4, b: i32x4) -> i32x4; + fn vpdpbssds_128(src: i32x4, a: i8x16, b: i8x16) -> i32x4; #[link_name = "llvm.x86.avx2.vpdpbssds.256"] - fn vpdpbssds_256(src: i32x8, a: i32x8, b: i32x8) -> i32x8; + fn vpdpbssds_256(src: i32x8, a: i8x32, b: i8x32) -> i32x8; #[link_name = "llvm.x86.avx2.vpdpbsud.128"] - fn vpdpbsud_128(src: i32x4, a: i32x4, b: i32x4) -> i32x4; + fn vpdpbsud_128(src: i32x4, a: i8x16, b: u8x16) -> i32x4; #[link_name = "llvm.x86.avx2.vpdpbsud.256"] - fn vpdpbsud_256(src: i32x8, a: i32x8, b: i32x8) -> i32x8; + fn vpdpbsud_256(src: i32x8, a: i8x32, b: u8x32) -> i32x8; #[link_name = "llvm.x86.avx2.vpdpbsuds.128"] - fn vpdpbsuds_128(src: i32x4, a: i32x4, b: i32x4) -> i32x4; + fn vpdpbsuds_128(src: i32x4, a: i8x16, b: u8x16) -> i32x4; #[link_name = "llvm.x86.avx2.vpdpbsuds.256"] - fn vpdpbsuds_256(src: i32x8, a: i32x8, b: i32x8) -> i32x8; + fn vpdpbsuds_256(src: i32x8, a: i8x32, b: u8x32) -> i32x8; #[link_name = "llvm.x86.avx2.vpdpbuud.128"] - fn vpdpbuud_128(src: i32x4, a: i32x4, b: i32x4) -> i32x4; + fn vpdpbuud_128(src: i32x4, a: u8x16, b: u8x16) -> i32x4; #[link_name = "llvm.x86.avx2.vpdpbuud.256"] - fn vpdpbuud_256(src: i32x8, a: i32x8, b: i32x8) -> i32x8; + fn vpdpbuud_256(src: i32x8, a: u8x32, b: u8x32) -> i32x8; #[link_name = "llvm.x86.avx2.vpdpbuuds.128"] - fn vpdpbuuds_128(src: i32x4, a: i32x4, b: i32x4) -> i32x4; + fn vpdpbuuds_128(src: i32x4, a: u8x16, b: u8x16) -> i32x4; #[link_name = "llvm.x86.avx2.vpdpbuuds.256"] - fn vpdpbuuds_256(src: i32x8, a: i32x8, b: i32x8) -> i32x8; + fn vpdpbuuds_256(src: i32x8, a: u8x32, b: u8x32) -> i32x8; #[link_name = "llvm.x86.avx2.vpdpwsud.128"] - fn vpdpwsud_128(src: i32x4, a: i32x4, b: i32x4) -> i32x4; + fn vpdpwsud_128(src: i32x4, a: i16x8, b: u16x8) -> i32x4; #[link_name = "llvm.x86.avx2.vpdpwsud.256"] - fn vpdpwsud_256(src: i32x8, a: i32x8, b: i32x8) -> i32x8; + fn vpdpwsud_256(src: i32x8, a: i16x16, b: u16x16) -> i32x8; #[link_name = "llvm.x86.avx2.vpdpwsuds.128"] - fn vpdpwsuds_128(src: i32x4, a: i32x4, b: i32x4) -> i32x4; + fn vpdpwsuds_128(src: i32x4, a: i16x8, b: u16x8) -> i32x4; #[link_name = "llvm.x86.avx2.vpdpwsuds.256"] - fn vpdpwsuds_256(src: i32x8, a: i32x8, b: i32x8) -> i32x8; + fn vpdpwsuds_256(src: i32x8, a: i16x16, b: u16x16) -> i32x8; #[link_name = "llvm.x86.avx2.vpdpwusd.128"] - fn vpdpwusd_128(src: i32x4, a: i32x4, b: i32x4) -> i32x4; + fn vpdpwusd_128(src: i32x4, a: u16x8, b: i16x8) -> i32x4; #[link_name = "llvm.x86.avx2.vpdpwusd.256"] - fn vpdpwusd_256(src: i32x8, a: i32x8, b: i32x8) -> i32x8; + fn vpdpwusd_256(src: i32x8, a: u16x16, b: i16x16) -> i32x8; #[link_name = "llvm.x86.avx2.vpdpwusds.128"] - fn vpdpwusds_128(src: i32x4, a: i32x4, b: i32x4) -> i32x4; + fn vpdpwusds_128(src: i32x4, a: u16x8, b: i16x8) -> i32x4; #[link_name = "llvm.x86.avx2.vpdpwusds.256"] - fn vpdpwusds_256(src: i32x8, a: i32x8, b: i32x8) -> i32x8; + fn vpdpwusds_256(src: i32x8, a: u16x16, b: i16x16) -> i32x8; #[link_name = "llvm.x86.avx2.vpdpwuud.128"] - fn vpdpwuud_128(src: i32x4, a: i32x4, b: i32x4) -> i32x4; + fn vpdpwuud_128(src: i32x4, a: u16x8, b: u16x8) -> i32x4; #[link_name = "llvm.x86.avx2.vpdpwuud.256"] - fn vpdpwuud_256(src: i32x8, a: i32x8, b: i32x8) -> i32x8; + fn vpdpwuud_256(src: i32x8, a: u16x16, b: u16x16) -> i32x8; #[link_name = "llvm.x86.avx2.vpdpwuuds.128"] - fn vpdpwuuds_128(src: i32x4, a: i32x4, b: i32x4) -> i32x4; + fn vpdpwuuds_128(src: i32x4, a: u16x8, b: u16x8) -> i32x4; #[link_name = "llvm.x86.avx2.vpdpwuuds.256"] - fn vpdpwuuds_256(src: i32x8, a: i32x8, b: i32x8) -> i32x8; + fn vpdpwuuds_256(src: i32x8, a: u16x16, b: u16x16) -> i32x8; } #[cfg(test)] From 35f7c8bc53e41c983f8e565dce99e16ed1e4994a Mon Sep 17 00:00:00 2001 From: sayantn Date: Thu, 5 Mar 2026 00:43:31 +0530 Subject: [PATCH 02/35] Correct stability attribute for avx512bw intrinsics --- .../crates/core_arch/src/x86/avx512bw.rs | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/library/stdarch/crates/core_arch/src/x86/avx512bw.rs b/library/stdarch/crates/core_arch/src/x86/avx512bw.rs index b41f8576cfe54..659d6c3be88e7 100644 --- a/library/stdarch/crates/core_arch/src/x86/avx512bw.rs +++ b/library/stdarch/crates/core_arch/src/x86/avx512bw.rs @@ -11753,7 +11753,7 @@ pub const fn _mm_maskz_cvtepi16_epi8(k: __mmask8, a: __m128i) -> __m128i { #[target_feature(enable = "avx512bw")] #[stable(feature = "stdarch_x86_avx512", since = "1.89")] #[cfg_attr(test, assert_instr(vpmovswb))] -#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")] +#[rustc_const_unstable(feature = "stdarch_const_x86", issue = "149298")] pub const fn _mm512_cvtsepi16_epi8(a: __m512i) -> __m256i { unsafe { simd_cast::<_, i8x32>(simd_imax( @@ -11771,7 +11771,7 @@ pub const fn _mm512_cvtsepi16_epi8(a: __m512i) -> __m256i { #[target_feature(enable = "avx512bw")] #[stable(feature = "stdarch_x86_avx512", since = "1.89")] #[cfg_attr(test, assert_instr(vpmovswb))] -#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")] +#[rustc_const_unstable(feature = "stdarch_const_x86", issue = "149298")] pub const fn _mm512_mask_cvtsepi16_epi8(src: __m256i, k: __mmask32, a: __m512i) -> __m256i { unsafe { simd_select_bitmask(k, _mm512_cvtsepi16_epi8(a).as_i8x32(), src.as_i8x32()).as_m256i() @@ -11785,7 +11785,7 @@ pub const fn _mm512_mask_cvtsepi16_epi8(src: __m256i, k: __mmask32, a: __m512i) #[target_feature(enable = "avx512bw")] #[stable(feature = "stdarch_x86_avx512", since = "1.89")] #[cfg_attr(test, assert_instr(vpmovswb))] -#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")] +#[rustc_const_unstable(feature = "stdarch_const_x86", issue = "149298")] pub const fn _mm512_maskz_cvtsepi16_epi8(k: __mmask32, a: __m512i) -> __m256i { unsafe { simd_select_bitmask(k, _mm512_cvtsepi16_epi8(a).as_i8x32(), i8x32::ZERO).as_m256i() } } @@ -11797,7 +11797,7 @@ pub const fn _mm512_maskz_cvtsepi16_epi8(k: __mmask32, a: __m512i) -> __m256i { #[target_feature(enable = "avx512bw,avx512vl")] #[stable(feature = "stdarch_x86_avx512", since = "1.89")] #[cfg_attr(test, assert_instr(vpmovswb))] -#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")] +#[rustc_const_unstable(feature = "stdarch_const_x86", issue = "149298")] pub const fn _mm256_cvtsepi16_epi8(a: __m256i) -> __m128i { unsafe { simd_cast::<_, i8x16>(simd_imax( @@ -11815,7 +11815,7 @@ pub const fn _mm256_cvtsepi16_epi8(a: __m256i) -> __m128i { #[target_feature(enable = "avx512bw,avx512vl")] #[stable(feature = "stdarch_x86_avx512", since = "1.89")] #[cfg_attr(test, assert_instr(vpmovswb))] -#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")] +#[rustc_const_unstable(feature = "stdarch_const_x86", issue = "149298")] pub const fn _mm256_mask_cvtsepi16_epi8(src: __m128i, k: __mmask16, a: __m256i) -> __m128i { unsafe { simd_select_bitmask(k, _mm256_cvtsepi16_epi8(a).as_i8x16(), src.as_i8x16()).as_m128i() @@ -11829,7 +11829,7 @@ pub const fn _mm256_mask_cvtsepi16_epi8(src: __m128i, k: __mmask16, a: __m256i) #[target_feature(enable = "avx512bw,avx512vl")] #[stable(feature = "stdarch_x86_avx512", since = "1.89")] #[cfg_attr(test, assert_instr(vpmovswb))] -#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")] +#[rustc_const_unstable(feature = "stdarch_const_x86", issue = "149298")] pub const fn _mm256_maskz_cvtsepi16_epi8(k: __mmask16, a: __m256i) -> __m128i { unsafe { simd_select_bitmask(k, _mm256_cvtsepi16_epi8(a).as_i8x16(), i8x16::ZERO).as_m128i() } } @@ -11874,7 +11874,7 @@ pub fn _mm_maskz_cvtsepi16_epi8(k: __mmask8, a: __m128i) -> __m128i { #[target_feature(enable = "avx512bw")] #[stable(feature = "stdarch_x86_avx512", since = "1.89")] #[cfg_attr(test, assert_instr(vpmovuswb))] -#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")] +#[rustc_const_unstable(feature = "stdarch_const_x86", issue = "149298")] pub const fn _mm512_cvtusepi16_epi8(a: __m512i) -> __m256i { unsafe { simd_cast::<_, u8x32>(simd_imin(a.as_u16x32(), u16x32::splat(u8::MAX as _))).as_m256i() @@ -11888,7 +11888,7 @@ pub const fn _mm512_cvtusepi16_epi8(a: __m512i) -> __m256i { #[target_feature(enable = "avx512bw")] #[stable(feature = "stdarch_x86_avx512", since = "1.89")] #[cfg_attr(test, assert_instr(vpmovuswb))] -#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")] +#[rustc_const_unstable(feature = "stdarch_const_x86", issue = "149298")] pub const fn _mm512_mask_cvtusepi16_epi8(src: __m256i, k: __mmask32, a: __m512i) -> __m256i { unsafe { simd_select_bitmask(k, _mm512_cvtusepi16_epi8(a).as_u8x32(), src.as_u8x32()).as_m256i() @@ -11902,7 +11902,7 @@ pub const fn _mm512_mask_cvtusepi16_epi8(src: __m256i, k: __mmask32, a: __m512i) #[target_feature(enable = "avx512bw")] #[stable(feature = "stdarch_x86_avx512", since = "1.89")] #[cfg_attr(test, assert_instr(vpmovuswb))] -#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")] +#[rustc_const_unstable(feature = "stdarch_const_x86", issue = "149298")] pub const fn _mm512_maskz_cvtusepi16_epi8(k: __mmask32, a: __m512i) -> __m256i { unsafe { simd_select_bitmask(k, _mm512_cvtusepi16_epi8(a).as_u8x32(), u8x32::ZERO).as_m256i() } } @@ -11914,7 +11914,7 @@ pub const fn _mm512_maskz_cvtusepi16_epi8(k: __mmask32, a: __m512i) -> __m256i { #[target_feature(enable = "avx512bw,avx512vl")] #[stable(feature = "stdarch_x86_avx512", since = "1.89")] #[cfg_attr(test, assert_instr(vpmovuswb))] -#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")] +#[rustc_const_unstable(feature = "stdarch_const_x86", issue = "149298")] pub const fn _mm256_cvtusepi16_epi8(a: __m256i) -> __m128i { unsafe { simd_cast::<_, u8x16>(simd_imin(a.as_u16x16(), u16x16::splat(u8::MAX as _))).as_m128i() @@ -11928,7 +11928,7 @@ pub const fn _mm256_cvtusepi16_epi8(a: __m256i) -> __m128i { #[target_feature(enable = "avx512bw,avx512vl")] #[stable(feature = "stdarch_x86_avx512", since = "1.89")] #[cfg_attr(test, assert_instr(vpmovuswb))] -#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")] +#[rustc_const_unstable(feature = "stdarch_const_x86", issue = "149298")] pub const fn _mm256_mask_cvtusepi16_epi8(src: __m128i, k: __mmask16, a: __m256i) -> __m128i { unsafe { simd_select_bitmask(k, _mm256_cvtusepi16_epi8(a).as_u8x16(), src.as_u8x16()).as_m128i() @@ -11942,7 +11942,7 @@ pub const fn _mm256_mask_cvtusepi16_epi8(src: __m128i, k: __mmask16, a: __m256i) #[target_feature(enable = "avx512bw,avx512vl")] #[stable(feature = "stdarch_x86_avx512", since = "1.89")] #[cfg_attr(test, assert_instr(vpmovuswb))] -#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")] +#[rustc_const_unstable(feature = "stdarch_const_x86", issue = "149298")] pub const fn _mm256_maskz_cvtusepi16_epi8(k: __mmask16, a: __m256i) -> __m128i { unsafe { simd_select_bitmask(k, _mm256_cvtusepi16_epi8(a).as_u8x16(), u8x16::ZERO).as_m128i() } } @@ -12678,7 +12678,7 @@ pub unsafe fn _mm_mask_cvtsepi16_storeu_epi8(mem_addr: *mut i8, k: __mmask8, a: #[target_feature(enable = "avx512bw")] #[stable(feature = "stdarch_x86_avx512", since = "1.89")] #[cfg_attr(test, assert_instr(vpmovwb))] -#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")] +#[rustc_const_unstable(feature = "stdarch_const_x86", issue = "149298")] pub const unsafe fn _mm512_mask_cvtepi16_storeu_epi8(mem_addr: *mut i8, k: __mmask32, a: __m512i) { let result = _mm512_cvtepi16_epi8(a).as_i8x32(); let mask = simd_select_bitmask(k, i8x32::splat(!0), i8x32::ZERO); @@ -12692,7 +12692,7 @@ pub const unsafe fn _mm512_mask_cvtepi16_storeu_epi8(mem_addr: *mut i8, k: __mma #[target_feature(enable = "avx512bw,avx512vl")] #[stable(feature = "stdarch_x86_avx512", since = "1.89")] #[cfg_attr(test, assert_instr(vpmovwb))] -#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")] +#[rustc_const_unstable(feature = "stdarch_const_x86", issue = "149298")] pub const unsafe fn _mm256_mask_cvtepi16_storeu_epi8(mem_addr: *mut i8, k: __mmask16, a: __m256i) { let result = _mm256_cvtepi16_epi8(a).as_i8x16(); let mask = simd_select_bitmask(k, i8x16::splat(!0), i8x16::ZERO); @@ -12706,7 +12706,7 @@ pub const unsafe fn _mm256_mask_cvtepi16_storeu_epi8(mem_addr: *mut i8, k: __mma #[target_feature(enable = "avx512bw,avx512vl")] #[stable(feature = "stdarch_x86_avx512", since = "1.89")] #[cfg_attr(test, assert_instr(vpmovwb))] -#[rustc_const_unstable(feature = "stdarch_const_helpers", issue = "none")] +#[rustc_const_unstable(feature = "stdarch_const_x86", issue = "149298")] pub const unsafe fn _mm_mask_cvtepi16_storeu_epi8(mem_addr: *mut i8, k: __mmask8, a: __m128i) { let result: i8x8 = simd_shuffle!( _mm_cvtepi16_epi8(a).as_i8x16(), From 985cd2399ac618bc409b0401c9aac36688b8a580 Mon Sep 17 00:00:00 2001 From: sayantn Date: Mon, 2 Mar 2026 00:27:37 +0530 Subject: [PATCH 03/35] Add immediate AMX intrinsics --- .../crates/core_arch/src/x86_64/amx.rs | 181 ++++++++++++++++++ 1 file changed, 181 insertions(+) diff --git a/library/stdarch/crates/core_arch/src/x86_64/amx.rs b/library/stdarch/crates/core_arch/src/x86_64/amx.rs index 4e20e014cf20a..03bbe3e449258 100644 --- a/library/stdarch/crates/core_arch/src/x86_64/amx.rs +++ b/library/stdarch/crates/core_arch/src/x86_64/amx.rs @@ -398,6 +398,22 @@ pub unsafe fn _tile_cvtrowd2ps(row: u32) -> __m512 { tcvtrowd2ps(TILE as i8, row).as_m512() } +/// Moves a row from a tile register to a zmm register, converting the packed 32-bit signed integer +/// elements to packed single-precision (32-bit) floating-point elements. +#[inline] +#[rustc_legacy_const_generics(0, 1)] +#[target_feature(enable = "amx-avx512,avx10.2")] +#[cfg_attr( + all(test, any(target_os = "linux", target_env = "msvc")), + assert_instr(tcvtrowd2ps, TILE = 0, ROW = 0) +)] +#[unstable(feature = "x86_amx_intrinsics", issue = "126622")] +pub unsafe fn _tile_cvtrowd2psi() -> __m512 { + static_assert_uimm_bits!(TILE, 3); + static_assert_uimm_bits!(ROW, 6); + tcvtrowd2psi(TILE as i8, ROW as u32).as_m512() +} + /// Moves a row from a tile register to a zmm register, converting the packed single-precision (32-bit) /// floating-point elements to packed half-precision (16-bit) floating-point elements. The resulting /// 16-bit elements are placed in the high 16-bits within each 32-bit element of the returned vector. @@ -414,6 +430,23 @@ pub unsafe fn _tile_cvtrowps2phh(row: u32) -> __m512h { tcvtrowps2phh(TILE as i8, row).as_m512h() } +/// Moves a row from a tile register to a zmm register, converting the packed single-precision (32-bit) +/// floating-point elements to packed half-precision (16-bit) floating-point elements. The resulting +/// 16-bit elements are placed in the high 16-bits within each 32-bit element of the returned vector. +#[inline] +#[rustc_legacy_const_generics(0, 1)] +#[target_feature(enable = "amx-avx512,avx10.2")] +#[cfg_attr( + all(test, any(target_os = "linux", target_env = "msvc")), + assert_instr(tcvtrowps2phh, TILE = 0, ROW = 0) +)] +#[unstable(feature = "x86_amx_intrinsics", issue = "126622")] +pub unsafe fn _tile_cvtrowps2phhi() -> __m512h { + static_assert_uimm_bits!(TILE, 3); + static_assert_uimm_bits!(ROW, 6); + tcvtrowps2phhi(TILE as i8, ROW as u32).as_m512h() +} + /// Moves a row from a tile register to a zmm register, converting the packed single-precision (32-bit) /// floating-point elements to packed half-precision (16-bit) floating-point elements. The resulting /// 16-bit elements are placed in the low 16-bits within each 32-bit element of the returned vector. @@ -430,6 +463,23 @@ pub unsafe fn _tile_cvtrowps2phl(row: u32) -> __m512h { tcvtrowps2phl(TILE as i8, row).as_m512h() } +/// Moves a row from a tile register to a zmm register, converting the packed single-precision (32-bit) +/// floating-point elements to packed half-precision (16-bit) floating-point elements. The resulting +/// 16-bit elements are placed in the low 16-bits within each 32-bit element of the returned vector. +#[inline] +#[rustc_legacy_const_generics(0, 1)] +#[target_feature(enable = "amx-avx512,avx10.2")] +#[cfg_attr( + all(test, any(target_os = "linux", target_env = "msvc")), + assert_instr(tcvtrowps2phl, TILE = 0, ROW = 0) +)] +#[unstable(feature = "x86_amx_intrinsics", issue = "126622")] +pub unsafe fn _tile_cvtrowps2phli() -> __m512h { + static_assert_uimm_bits!(TILE, 3); + static_assert_uimm_bits!(ROW, 6); + tcvtrowps2phli(TILE as i8, ROW as u32).as_m512h() +} + /// Moves one row of tile data into a zmm vector register #[inline] #[rustc_legacy_const_generics(0)] @@ -444,6 +494,21 @@ pub unsafe fn _tile_movrow(row: u32) -> __m512i { tilemovrow(TILE as i8, row).as_m512i() } +/// Moves one row of tile data into a zmm vector register +#[inline] +#[rustc_legacy_const_generics(0, 1)] +#[target_feature(enable = "amx-avx512,avx10.2")] +#[cfg_attr( + all(test, any(target_os = "linux", target_env = "msvc")), + assert_instr(tilemovrow, TILE = 0, ROW = 0) +)] +#[unstable(feature = "x86_amx_intrinsics", issue = "126622")] +pub unsafe fn _tile_movrowi() -> __m512i { + static_assert_uimm_bits!(TILE, 3); + static_assert_uimm_bits!(ROW, 6); + tilemovrowi(TILE as i8, ROW as u32).as_m512i() +} + #[allow(improper_ctypes)] unsafe extern "C" { #[link_name = "llvm.x86.ldtilecfg"] @@ -492,12 +557,20 @@ unsafe extern "C" { fn tmmultf32ps(dst: i8, a: i8, b: i8); #[link_name = "llvm.x86.tcvtrowd2ps"] fn tcvtrowd2ps(tile: i8, row: u32) -> f32x16; + #[link_name = "llvm.x86.tcvtrowd2psi"] + fn tcvtrowd2psi(tile: i8, row: u32) -> f32x16; #[link_name = "llvm.x86.tcvtrowps2phh"] fn tcvtrowps2phh(tile: i8, row: u32) -> f16x32; + #[link_name = "llvm.x86.tcvtrowps2phhi"] + fn tcvtrowps2phhi(tile: i8, row: u32) -> f16x32; #[link_name = "llvm.x86.tcvtrowps2phl"] fn tcvtrowps2phl(tile: i8, row: u32) -> f16x32; + #[link_name = "llvm.x86.tcvtrowps2phli"] + fn tcvtrowps2phli(tile: i8, row: u32) -> f16x32; #[link_name = "llvm.x86.tilemovrow"] fn tilemovrow(tile: i8, row: u32) -> i32x16; + #[link_name = "llvm.x86.tilemovrowi"] + fn tilemovrowi(tile: i8, row: u32) -> i32x16; } #[cfg(test)] @@ -1032,6 +1105,50 @@ mod tests { } } + macro_rules! wrap_imm4 { + ($name:ident :: <$TILE:literal>, $row:expr) => { + match $row { + 0 => $name::<$TILE, 0>(), + 1 => $name::<$TILE, 1>(), + 2 => $name::<$TILE, 2>(), + 3 => $name::<$TILE, 3>(), + 4 => $name::<$TILE, 4>(), + 5 => $name::<$TILE, 5>(), + 6 => $name::<$TILE, 6>(), + 7 => $name::<$TILE, 7>(), + 8 => $name::<$TILE, 8>(), + 9 => $name::<$TILE, 9>(), + 10 => $name::<$TILE, 10>(), + 11 => $name::<$TILE, 11>(), + 12 => $name::<$TILE, 12>(), + 13 => $name::<$TILE, 13>(), + 14 => $name::<$TILE, 14>(), + 15 => $name::<$TILE, 15>(), + _ => panic!("row index out of range"), + } + }; + } + + #[simd_test(enable = "amx-avx512,avx10.2")] + fn test_tile_movrowi() { + unsafe { + _init_amx(); + let array: [[u8; 64]; 16] = array::from_fn(|i| [i as _; _]); + + let mut config = __tilecfg::default(); + config.palette = 1; + config.colsb[0] = 64; + config.rows[0] = 16; + _tile_loadconfig(config.as_ptr()); + _tile_loadd::<0>(array.as_ptr().cast(), 64); + + for i in 0..16 { + let row = wrap_imm4!(_tile_movrowi::<0>, i); + assert_eq!(*row.as_u8x64().as_array(), [i as _; _]); + } + } + } + #[simd_test(enable = "amx-avx512,avx10.2")] fn test_tile_cvtrowd2ps() { unsafe { @@ -1051,6 +1168,26 @@ mod tests { } } + #[simd_test(enable = "amx-avx512,avx10.2")] + fn test_tile_cvtrowd2psi() { + unsafe { + _init_amx(); + let array: [[u32; 16]; 16] = array::from_fn(|i| [i as _; _]); + + let mut config = __tilecfg::default(); + config.palette = 1; + config.colsb[0] = 64; + config.rows[0] = 16; + _tile_loadconfig(config.as_ptr()); + _tile_loadd::<0>(array.as_ptr().cast(), 64); + + for i in 0..16 { + let row = wrap_imm4!(_tile_cvtrowd2psi::<0>, i); + assert_eq!(*row.as_f32x16().as_array(), [i as _; _]); + } + } + } + #[simd_test(enable = "amx-avx512,avx10.2")] fn test_tile_cvtrowps2phh() { unsafe { @@ -1073,6 +1210,28 @@ mod tests { } } + #[simd_test(enable = "amx-avx512,avx10.2")] + fn test_tile_cvtrowps2phhi() { + unsafe { + _init_amx(); + let array: [[f32; 16]; 16] = array::from_fn(|i| [i as _; _]); + + let mut config = __tilecfg::default(); + config.palette = 1; + config.colsb[0] = 64; + config.rows[0] = 16; + _tile_loadconfig(config.as_ptr()); + _tile_loadd::<0>(array.as_ptr().cast(), 64); + for i in 0..16 { + let row = wrap_imm4!(_tile_cvtrowps2phhi::<0>, i); + assert_eq!( + *row.as_f16x32().as_array(), + array::from_fn(|j| if j & 1 == 0 { 0.0 } else { i as _ }) + ); + } + } + } + #[simd_test(enable = "amx-avx512,avx10.2")] fn test_tile_cvtrowps2phl() { unsafe { @@ -1095,6 +1254,28 @@ mod tests { } } + #[simd_test(enable = "amx-avx512,avx10.2")] + fn test_tile_cvtrowps2phli() { + unsafe { + _init_amx(); + let array: [[f32; 16]; 16] = array::from_fn(|i| [i as _; _]); + + let mut config = __tilecfg::default(); + config.palette = 1; + config.colsb[0] = 64; + config.rows[0] = 16; + _tile_loadconfig(config.as_ptr()); + _tile_loadd::<0>(array.as_ptr().cast(), 64); + for i in 0..16 { + let row = wrap_imm4!(_tile_cvtrowps2phli::<0>, i); + assert_eq!( + *row.as_f16x32().as_array(), + array::from_fn(|j| if j & 1 == 0 { i as _ } else { 0.0 }) + ); + } + } + } + #[simd_test(enable = "amx-tf32")] fn test_tile_mmultf32ps() { unsafe { From 48d573f8e5c5dc19c68d82b08af90275508bf65c Mon Sep 17 00:00:00 2001 From: sayantn Date: Thu, 5 Mar 2026 11:32:59 +0530 Subject: [PATCH 04/35] Add movrs intrinsics --- library/stdarch/crates/core_arch/src/lib.rs | 3 +- .../stdarch/crates/core_arch/src/x86/mod.rs | 4 + .../stdarch/crates/core_arch/src/x86/movrs.rs | 23 +++++ .../crates/core_arch/src/x86_64/mod.rs | 4 + .../crates/core_arch/src/x86_64/movrs.rs | 94 +++++++++++++++++++ .../crates/stdarch-verify/tests/x86-intel.rs | 3 +- 6 files changed, 129 insertions(+), 2 deletions(-) create mode 100644 library/stdarch/crates/core_arch/src/x86/movrs.rs create mode 100644 library/stdarch/crates/core_arch/src/x86_64/movrs.rs diff --git a/library/stdarch/crates/core_arch/src/lib.rs b/library/stdarch/crates/core_arch/src/lib.rs index 8a1bead7c4791..9255994e5ee81 100644 --- a/library/stdarch/crates/core_arch/src/lib.rs +++ b/library/stdarch/crates/core_arch/src/lib.rs @@ -39,7 +39,8 @@ const_trait_impl, const_cmp, const_eval_select, - maybe_uninit_as_bytes + maybe_uninit_as_bytes, + movrs_target_feature )] #![cfg_attr(test, feature(test, abi_vectorcall, stdarch_internal))] #![deny(clippy::missing_inline_in_public_items)] diff --git a/library/stdarch/crates/core_arch/src/x86/mod.rs b/library/stdarch/crates/core_arch/src/x86/mod.rs index 9396507f08045..68a963f65b7d4 100644 --- a/library/stdarch/crates/core_arch/src/x86/mod.rs +++ b/library/stdarch/crates/core_arch/src/x86/mod.rs @@ -774,3 +774,7 @@ pub use self::avx512fp16::*; mod kl; #[stable(feature = "keylocker_x86", since = "1.89.0")] pub use self::kl::*; + +mod movrs; +#[unstable(feature = "movrs_target_feature", issue = "137976")] +pub use self::movrs::*; diff --git a/library/stdarch/crates/core_arch/src/x86/movrs.rs b/library/stdarch/crates/core_arch/src/x86/movrs.rs new file mode 100644 index 0000000000000..d5f4d146c44aa --- /dev/null +++ b/library/stdarch/crates/core_arch/src/x86/movrs.rs @@ -0,0 +1,23 @@ +//! Read-shared move intrinsics + +#[cfg(test)] +use stdarch_test::assert_instr; + +unsafe extern "unadjusted" { + #[link_name = "llvm.x86.prefetchrs"] + fn prefetchrs(p: *const u8); +} + +/// Prefetches the cache line that contains address `p`, with an indication that the source memory +/// location is likely to become read-shared by multiple processors, i.e., read in the future by at +/// least one other processor before it is written, assuming it is ever written in the future. +/// +/// Note: this intrinsic is safe to use even though it takes a raw pointer argument. In general, this +/// cannot change the behavior of the program, including not trapping on invalid pointers. +#[inline] +#[target_feature(enable = "movrs")] +#[cfg_attr(all(test, not(target_vendor = "apple")), assert_instr(prefetchrst2))] +#[unstable(feature = "movrs_target_feature", issue = "137976")] +pub fn _m_prefetchrs(p: *const u8) { + unsafe { prefetchrs(p) } +} diff --git a/library/stdarch/crates/core_arch/src/x86_64/mod.rs b/library/stdarch/crates/core_arch/src/x86_64/mod.rs index 9caab44e46cd7..46384176e005e 100644 --- a/library/stdarch/crates/core_arch/src/x86_64/mod.rs +++ b/library/stdarch/crates/core_arch/src/x86_64/mod.rs @@ -81,3 +81,7 @@ pub use self::avx512fp16::*; mod amx; #[unstable(feature = "x86_amx_intrinsics", issue = "126622")] pub use self::amx::*; + +mod movrs; +#[unstable(feature = "movrs_target_feature", issue = "137976")] +pub use self::movrs::*; diff --git a/library/stdarch/crates/core_arch/src/x86_64/movrs.rs b/library/stdarch/crates/core_arch/src/x86_64/movrs.rs new file mode 100644 index 0000000000000..fc669bbb1ca59 --- /dev/null +++ b/library/stdarch/crates/core_arch/src/x86_64/movrs.rs @@ -0,0 +1,94 @@ +//! Read-shared Move instructions + +#[cfg(test)] +use stdarch_test::assert_instr; + +unsafe extern "unadjusted" { + #[link_name = "llvm.x86.movrsqi"] + fn movrsqi(src: *const i8) -> i8; + #[link_name = "llvm.x86.movrshi"] + fn movrshi(src: *const i16) -> i16; + #[link_name = "llvm.x86.movrssi"] + fn movrssi(src: *const i32) -> i32; + #[link_name = "llvm.x86.movrsdi"] + fn movrsdi(src: *const i64) -> i64; +} + +/// Moves a byte from the source to the destination, with an indication that the source memory +/// location is likely to become read-shared by multiple processors, i.e., read in the future by at +/// least one other processor before it is written, assuming it is ever written in the future. +#[inline] +#[target_feature(enable = "movrs")] +#[cfg_attr(all(test, not(target_vendor = "apple")), assert_instr(movrs))] +#[unstable(feature = "movrs_target_feature", issue = "137976")] +pub unsafe fn _movrs_i8(src: *const i8) -> i8 { + movrsqi(src) +} + +/// Moves a 16-bit word from the source to the destination, with an indication that the source memory +/// location is likely to become read-shared by multiple processors, i.e., read in the future by at +/// least one other processor before it is written, assuming it is ever written in the future. +#[inline] +#[target_feature(enable = "movrs")] +#[cfg_attr(all(test, not(target_vendor = "apple")), assert_instr(movrs))] +#[unstable(feature = "movrs_target_feature", issue = "137976")] +pub unsafe fn _movrs_i16(src: *const i16) -> i16 { + movrshi(src) +} + +/// Moves a 32-bit doubleword from the source to the destination, with an indication that the source +/// memory location is likely to become read-shared by multiple processors, i.e., read in the future +/// by at least one other processor before it is written, assuming it is ever written in the future. +#[inline] +#[target_feature(enable = "movrs")] +#[cfg_attr(all(test, not(target_vendor = "apple")), assert_instr(movrs))] +#[unstable(feature = "movrs_target_feature", issue = "137976")] +pub unsafe fn _movrs_i32(src: *const i32) -> i32 { + movrssi(src) +} + +/// Moves a 64-bit quadword from the source to the destination, with an indication that the source +/// memory location is likely to become read-shared by multiple processors, i.e., read in the future +/// by at least one other processor before it is written, assuming it is ever written in the future. +#[inline] +#[target_feature(enable = "movrs")] +#[cfg_attr(all(test, not(target_vendor = "apple")), assert_instr(movrs))] +#[unstable(feature = "movrs_target_feature", issue = "137976")] +pub unsafe fn _movrs_i64(src: *const i64) -> i64 { + movrsdi(src) +} + +#[cfg(test)] +mod tests { + use stdarch_test::simd_test; + + use super::*; + + #[simd_test(enable = "movrs")] + fn test_movrs_i8() { + let x: i8 = 42; + let y = unsafe { _movrs_i8(&x) }; + assert_eq!(x, y); + } + + #[simd_test(enable = "movrs")] + fn test_movrs_i16() { + let x: i16 = 42; + let y = unsafe { _movrs_i16(&x) }; + assert_eq!(x, y); + } + + #[simd_test(enable = "movrs")] + fn test_movrs_i32() { + let x: i32 = 42; + let y = unsafe { _movrs_i32(&x) }; + assert_eq!(x, y); + } + + #[simd_test(enable = "movrs")] + fn test_movrs_i64() { + let x: i64 = 42; + let y = unsafe { _movrs_i64(&x) }; + assert_eq!(x, y); + } +} diff --git a/library/stdarch/crates/stdarch-verify/tests/x86-intel.rs b/library/stdarch/crates/stdarch-verify/tests/x86-intel.rs index 2ac05e28cb4ce..7fc47be42e14b 100644 --- a/library/stdarch/crates/stdarch-verify/tests/x86-intel.rs +++ b/library/stdarch/crates/stdarch-verify/tests/x86-intel.rs @@ -211,6 +211,7 @@ fn verify_all_signatures() { "_rdseed64_step", // Prefetch "_mm_prefetch", + "_m_prefetchrs", // CMPXCHG "cmpxchg16b", // Undefined @@ -305,7 +306,7 @@ fn verify_all_signatures() { } // FIXME: these have not been added to Intrinsics Guide yet - if ["amx-avx512", "amx-fp8", "amx-movrs", "amx-tf32"] + if ["amx-avx512", "amx-fp8", "amx-movrs", "amx-tf32", "movrs"] .iter() .any(|f| feature.contains(f)) { From 6abb95cc00bf58dc6f9ce66c4c27934385f370bd Mon Sep 17 00:00:00 2001 From: Folkert de Vries Date: Fri, 6 Mar 2026 13:15:28 +0100 Subject: [PATCH 05/35] gate use of `wasm_target_feature` on wasm target arch --- library/stdarch/examples/hex.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/library/stdarch/examples/hex.rs b/library/stdarch/examples/hex.rs index 621f55bc0951f..21827b375adaf 100644 --- a/library/stdarch/examples/hex.rs +++ b/library/stdarch/examples/hex.rs @@ -13,7 +13,6 @@ //! and you should see `746573740a` get printed out. #![allow(internal_features)] -#![feature(wasm_target_feature)] #![cfg_attr(test, feature(test))] #![cfg_attr( any(target_arch = "x86", target_arch = "x86_64"), From 6c7d342e10d83a33da19da621fb2b5b34a875729 Mon Sep 17 00:00:00 2001 From: Folkert de Vries Date: Fri, 6 Mar 2026 21:26:59 +0100 Subject: [PATCH 06/35] add ACLE random number generation intrinsics --- .../crates/core_arch/src/aarch64/mod.rs | 4 ++ .../crates/core_arch/src/aarch64/rand.rs | 69 +++++++++++++++++++ .../crates/stdarch-verify/tests/arm.rs | 1 + 3 files changed, 74 insertions(+) create mode 100644 library/stdarch/crates/core_arch/src/aarch64/rand.rs diff --git a/library/stdarch/crates/core_arch/src/aarch64/mod.rs b/library/stdarch/crates/core_arch/src/aarch64/mod.rs index b48bdac57e7db..d7295659c3c9a 100644 --- a/library/stdarch/crates/core_arch/src/aarch64/mod.rs +++ b/library/stdarch/crates/core_arch/src/aarch64/mod.rs @@ -17,6 +17,10 @@ mod mte; #[unstable(feature = "stdarch_aarch64_mte", issue = "129010")] pub use self::mte::*; +mod rand; +#[unstable(feature = "stdarch_aarch64_rand", issue = "153514")] +pub use self::rand::*; + mod neon; #[stable(feature = "neon_intrinsics", since = "1.59.0")] pub use self::neon::*; diff --git a/library/stdarch/crates/core_arch/src/aarch64/rand.rs b/library/stdarch/crates/core_arch/src/aarch64/rand.rs new file mode 100644 index 0000000000000..5492fd014401a --- /dev/null +++ b/library/stdarch/crates/core_arch/src/aarch64/rand.rs @@ -0,0 +1,69 @@ +//! AArch64 Random Number intrinsics +//! +//! [ACLE documentation](https://arm-software.github.io/acle/main/acle.html#random-number-generation-intrinsics) + +unsafe extern "unadjusted" { + #[cfg_attr( + any(target_arch = "aarch64", target_arch = "arm64ec"), + link_name = "llvm.aarch64.rndr" + )] + fn rndr_() -> Tuple; + + #[cfg_attr( + any(target_arch = "aarch64", target_arch = "arm64ec"), + link_name = "llvm.aarch64.rndrrs" + )] + fn rndrrs_() -> Tuple; +} + +#[repr(C)] +struct Tuple { + bits: u64, + status: bool, +} + +/// Stores a 64-bit random number into the object pointed to by the argument and returns +/// zero. If the implementation could not generate a random number within a reasonable +/// period of time the object pointed to by the input is set to zero and a non-zero value +/// is returned. +#[inline] +#[target_feature(enable = "rand")] +#[unstable(feature = "stdarch_aarch64_rand", issue = "153514")] +pub unsafe fn __rndr(value: *mut u64) -> i32 { + let Tuple { bits, status } = rndr_(); + unsafe { *value = bits }; + status as i32 +} + +/// Reseeds the random number generator. After that stores a 64-bit random number into +/// the object pointed to by the argument and returns zero. If the implementation could +/// not generate a random number within a reasonable period of time the object pointed +/// to by the input is set to zero and a non-zero value is returned. +#[inline] +#[target_feature(enable = "rand")] +#[unstable(feature = "stdarch_aarch64_rand", issue = "153514")] +pub unsafe fn __rndrrs(value: *mut u64) -> i32 { + let Tuple { bits, status } = rndrrs_(); + unsafe { *value = bits }; + status as i32 +} + +#[cfg(test)] +mod test { + use super::*; + use stdarch_test::assert_instr; + + #[cfg_attr(test, assert_instr(mrs))] + #[allow(dead_code)] + #[target_feature(enable = "rand")] + unsafe fn test_rndr(value: &mut u64) -> i32 { + __rndr(value) + } + + #[cfg_attr(test, assert_instr(mrs))] + #[allow(dead_code)] + #[target_feature(enable = "rand")] + unsafe fn test_rndrrs(value: &mut u64) -> i32 { + __rndrrs(value) + } +} diff --git a/library/stdarch/crates/stdarch-verify/tests/arm.rs b/library/stdarch/crates/stdarch-verify/tests/arm.rs index 86897908e062c..3ef9ce2a38b69 100644 --- a/library/stdarch/crates/stdarch-verify/tests/arm.rs +++ b/library/stdarch/crates/stdarch-verify/tests/arm.rs @@ -445,6 +445,7 @@ fn verify_all_signatures() { && !rust.file.ends_with("v7.rs\"") && !rust.file.ends_with("v8.rs\"") && !rust.file.ends_with("mte.rs\"") + && !rust.file.ends_with("rand.rs\"") && !rust.file.ends_with("ex.rs\"") && !skip_intrinsic_verify.contains(&rust.name) { From dceeb20bbc73085a7dfdfd9eeec5918eeb92d60e Mon Sep 17 00:00:00 2001 From: Guillaume Date: Sat, 7 Mar 2026 10:26:23 +0100 Subject: [PATCH 07/35] Fix LegacyKeyValueFormat report from docker build: various --- .../host-x86_64/dist-various-1/Dockerfile | 10 ++++---- .../host-x86_64/dist-various-2/Dockerfile | 20 ++++++++-------- .../host-x86_64/test-various/Dockerfile | 23 +++++++++---------- 3 files changed, 24 insertions(+), 29 deletions(-) diff --git a/src/ci/docker/host-x86_64/dist-various-1/Dockerfile b/src/ci/docker/host-x86_64/dist-various-1/Dockerfile index ab29d0e80ac2a..ff80d0e3c2960 100644 --- a/src/ci/docker/host-x86_64/dist-various-1/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-various-1/Dockerfile @@ -152,16 +152,14 @@ ENV CFLAGS_armv5te_unknown_linux_musleabi="-march=armv5te -marm -mfloat-abi=soft CC_riscv64gc_unknown_none_elf=riscv64-unknown-elf-gcc \ CFLAGS_riscv64gc_unknown_none_elf=-march=rv64gc -mabi=lp64 -ENV RUST_CONFIGURE_ARGS \ - --musl-root-armv5te=/musl-armv5te \ +ENV RUST_CONFIGURE_ARGS="--musl-root-armv5te=/musl-armv5te \ --musl-root-arm=/musl-arm \ --musl-root-armhf=/musl-armhf \ --musl-root-armv7hf=/musl-armv7hf \ - --disable-docs + --disable-docs" -ENV SCRIPT \ - python3 ../x.py --stage 2 test --host='' --target $RUN_MAKE_TARGETS tests/run-make tests/run-make-cargo && \ - python3 ../x.py dist --host='' --target $TARGETS +ENV SCRIPT="python3 ../x.py --stage 2 test --host= --target $RUN_MAKE_TARGETS tests/run-make tests/run-make-cargo && \ + python3 ../x.py dist --host= --target $TARGETS" # sccache COPY scripts/sccache.sh /scripts/ diff --git a/src/ci/docker/host-x86_64/dist-various-2/Dockerfile b/src/ci/docker/host-x86_64/dist-various-2/Dockerfile index dacf3c0db2026..ac169d76ee864 100644 --- a/src/ci/docker/host-x86_64/dist-various-2/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-various-2/Dockerfile @@ -95,16 +95,14 @@ RUN /tmp/freebsd-toolchain.sh i686 COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh -ENV CARGO_TARGET_X86_64_UNKNOWN_FUCHSIA_AR /usr/local/bin/llvm-ar -ENV CARGO_TARGET_X86_64_UNKNOWN_FUCHSIA_RUSTFLAGS \ --C link-arg=--sysroot=/usr/local/core-linux-amd64-fuchsia-sdk/arch/x64/sysroot \ +ENV CARGO_TARGET_X86_64_UNKNOWN_FUCHSIA_AR="/usr/local/bin/llvm-ar" +ENV CARGO_TARGET_X86_64_UNKNOWN_FUCHSIA_RUSTFLAGS="-C link-arg=--sysroot=/usr/local/core-linux-amd64-fuchsia-sdk/arch/x64/sysroot \ -Lnative=/usr/local/core-linux-amd64-fuchsia-sdk/arch/x64/sysroot/lib \ --Lnative=/usr/local/core-linux-amd64-fuchsia-sdk/arch/x64/lib -ENV CARGO_TARGET_AARCH64_UNKNOWN_FUCHSIA_AR /usr/local/bin/llvm-ar -ENV CARGO_TARGET_AARCH64_UNKNOWN_FUCHSIA_RUSTFLAGS \ --C link-arg=--sysroot=/usr/local/core-linux-amd64-fuchsia-sdk/arch/arm64/sysroot \ +-Lnative=/usr/local/core-linux-amd64-fuchsia-sdk/arch/x64/lib" +ENV CARGO_TARGET_AARCH64_UNKNOWN_FUCHSIA_AR="/usr/local/bin/llvm-ar" +ENV CARGO_TARGET_AARCH64_UNKNOWN_FUCHSIA_RUSTFLAGS="-C link-arg=--sysroot=/usr/local/core-linux-amd64-fuchsia-sdk/arch/arm64/sysroot \ -Lnative=/usr/local/core-linux-amd64-fuchsia-sdk/arch/arm64/sysroot/lib \ --Lnative=/usr/local/core-linux-amd64-fuchsia-sdk/arch/arm64/lib +-Lnative=/usr/local/core-linux-amd64-fuchsia-sdk/arch/arm64/lib" ENV TARGETS=x86_64-unknown-fuchsia ENV TARGETS=$TARGETS,aarch64-unknown-fuchsia @@ -136,8 +134,8 @@ RUN ln -s /usr/include/x86_64-linux-gnu/asm /usr/local/include/asm # musl-gcc can't find libgcc_s.so.1 since it doesn't use the standard search paths. RUN ln -s /usr/riscv64-linux-gnu/lib/libgcc_s.so.1 /usr/lib/gcc-cross/riscv64-linux-gnu/11/ -ENV RUST_CONFIGURE_ARGS --enable-extended --enable-lld --enable-llvm-bitcode-linker --disable-docs \ +ENV RUST_CONFIGURE_ARGS="--enable-extended --enable-lld --enable-llvm-bitcode-linker --disable-docs \ --musl-root-armv7=/musl-armv7 \ - --musl-root-riscv64gc=/musl-riscv64gc + --musl-root-riscv64gc=/musl-riscv64gc" -ENV SCRIPT python3 ../x.py dist --host='' --target $TARGETS && python3 ../x.py dist --host='' --set build.sanitizers=true --target $TARGETS_SANITIZERS +ENV SCRIPT="python3 ../x.py dist --host= --target $TARGETS && python3 ../x.py dist --host= --set build.sanitizers=true --target $TARGETS_SANITIZERS" diff --git a/src/ci/docker/host-x86_64/test-various/Dockerfile b/src/ci/docker/host-x86_64/test-various/Dockerfile index 6512240730cc8..10ea2646bf3b9 100644 --- a/src/ci/docker/host-x86_64/test-various/Dockerfile +++ b/src/ci/docker/host-x86_64/test-various/Dockerfile @@ -45,9 +45,8 @@ RUN curl -L https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-3 tar -xz ENV WASI_SDK_PATH=/wasi-sdk-30.0-x86_64-linux -ENV RUST_CONFIGURE_ARGS \ - --musl-root-x86_64=/usr/local/x86_64-linux-musl \ - --set rust.lld +ENV RUST_CONFIGURE_ARGS="--musl-root-x86_64=/usr/local/x86_64-linux-musl \ + --set rust.lld" # Some run-make tests have assertions about code size, and enabling debug # assertions in libstd causes the binary to be much bigger than it would @@ -58,10 +57,10 @@ ENV NO_OVERFLOW_CHECKS=1 RUN curl -L https://github.com/bytecodealliance/wasmtime/releases/download/v38.0.4/wasmtime-v38.0.4-x86_64-linux.tar.xz | \ tar -xJ -ENV PATH "$PATH:/wasmtime-v38.0.4-x86_64-linux" +ENV PATH="$PATH:/wasmtime-v38.0.4-x86_64-linux" ENV WASM_WASIP_TARGET=wasm32-wasip1 -ENV WASM_WASIP_SCRIPT python3 /checkout/x.py --stage 2 test --host='' --target $WASM_WASIP_TARGET \ +ENV WASM_WASIP_SCRIPT="python3 /checkout/x.py --stage 2 test --host= --target $WASM_WASIP_TARGET \ tests/run-make \ tests/run-make-cargo \ tests/ui \ @@ -69,18 +68,18 @@ ENV WASM_WASIP_SCRIPT python3 /checkout/x.py --stage 2 test --host='' --target $ tests/codegen-units \ tests/codegen-llvm \ tests/assembly-llvm \ - library/core + library/core" ENV NVPTX_TARGETS=nvptx64-nvidia-cuda -ENV NVPTX_SCRIPT python3 /checkout/x.py --stage 2 test --host='' --target $NVPTX_TARGETS \ +ENV NVPTX_SCRIPT="python3 /checkout/x.py --stage 2 test --host= --target $NVPTX_TARGETS \ tests/run-make \ tests/run-make-cargo \ - tests/assembly-llvm + tests/assembly-llvm" ENV MUSL_TARGETS=x86_64-unknown-linux-musl \ CC_x86_64_unknown_linux_musl=x86_64-linux-musl-gcc \ CXX_x86_64_unknown_linux_musl=x86_64-linux-musl-g++ -ENV MUSL_SCRIPT python3 /checkout/x.py --stage 2 test --host='' --target $MUSL_TARGETS +ENV MUSL_SCRIPT="python3 /checkout/x.py --stage 2 test --host= --target $MUSL_TARGETS" ENV UEFI_TARGETS=aarch64-unknown-uefi,i686-unknown-uefi,x86_64-unknown-uefi \ CC_aarch64_unknown_uefi=clang-11 \ @@ -89,9 +88,9 @@ ENV UEFI_TARGETS=aarch64-unknown-uefi,i686-unknown-uefi,x86_64-unknown-uefi \ CXX_i686_unknown_uefi=clang++-11 \ CC_x86_64_unknown_uefi=clang-11 \ CXX_x86_64_unknown_uefi=clang++-11 -ENV UEFI_SCRIPT python3 /checkout/x.py --stage 2 build --host='' --target $UEFI_TARGETS && \ +ENV UEFI_SCRIPT="python3 /checkout/x.py --stage 2 build --host= --target $UEFI_TARGETS && \ python3 /checkout/x.py --stage 2 test tests/run-make-cargo/uefi-qemu/rmake.rs --target aarch64-unknown-uefi && \ python3 /checkout/x.py --stage 2 test tests/run-make-cargo/uefi-qemu/rmake.rs --target i686-unknown-uefi && \ - python3 /checkout/x.py --stage 2 test tests/run-make-cargo/uefi-qemu/rmake.rs --target x86_64-unknown-uefi + python3 /checkout/x.py --stage 2 test tests/run-make-cargo/uefi-qemu/rmake.rs --target x86_64-unknown-uefi" -ENV SCRIPT $WASM_WASIP_SCRIPT && $NVPTX_SCRIPT && $MUSL_SCRIPT && $UEFI_SCRIPT +ENV SCRIPT="$WASM_WASIP_SCRIPT && $NVPTX_SCRIPT && $MUSL_SCRIPT && $UEFI_SCRIPT" From 279c43e72724405c1a60db7d17e38c1096e3e04e Mon Sep 17 00:00:00 2001 From: The rustc-josh-sync Cronjob Bot Date: Mon, 9 Mar 2026 04:42:45 +0000 Subject: [PATCH 08/35] Prepare for merging from rust-lang/rust This updates the rust-version file to eda4fc7733ee89e484d7120cafbd80dcb2fce66e. --- library/stdarch/rust-version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/stdarch/rust-version b/library/stdarch/rust-version index b22c6c3869c62..db9492636f6ac 100644 --- a/library/stdarch/rust-version +++ b/library/stdarch/rust-version @@ -1 +1 @@ -139651428df86cf88443295542c12ea617cbb587 +eda4fc7733ee89e484d7120cafbd80dcb2fce66e From 59dfb9ef46bd43cbd26bba5de463fbaf77e39fac Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Mon, 9 Mar 2026 18:42:28 +0100 Subject: [PATCH 09/35] remove concept of soft-unstable features --- .../src/attributes/stability.rs | 17 +--- .../src/session_diagnostics.rs | 7 -- compiler/rustc_hir/src/stability.rs | 1 - compiler/rustc_lint/src/lib.rs | 1 + compiler/rustc_lint_defs/src/builtin.rs | 17 ---- compiler/rustc_middle/src/middle/stability.rs | 56 ++++--------- compiler/rustc_passes/src/stability.rs | 1 - compiler/rustc_resolve/src/errors.rs | 13 +--- compiler/rustc_resolve/src/macros.rs | 15 +--- compiler/rustc_span/src/symbol.rs | 1 - src/librustdoc/clean/types.rs | 2 +- .../issue-43106-gating-of-test.rs | 1 - .../issue-43106-gating-of-test.stderr | 2 +- tests/ui/imports/issue-28134.rs | 1 - tests/ui/imports/issue-28134.stderr | 2 +- tests/ui/where-clauses/cfg_attribute.a.stderr | 78 +++++++++---------- tests/ui/where-clauses/cfg_attribute.b.stderr | 78 +++++++++---------- tests/ui/where-clauses/cfg_attribute.rs | 1 - .../ui/where-clauses/unsupported_attribute.rs | 1 - .../unsupported_attribute.stderr | 40 +++++----- 20 files changed, 118 insertions(+), 217 deletions(-) diff --git a/compiler/rustc_attr_parsing/src/attributes/stability.rs b/compiler/rustc_attr_parsing/src/attributes/stability.rs index e35c10996ceb2..6ddd9f2c1fb5a 100644 --- a/compiler/rustc_attr_parsing/src/attributes/stability.rs +++ b/compiler/rustc_attr_parsing/src/attributes/stability.rs @@ -376,7 +376,6 @@ pub(crate) fn parse_unstability( let mut reason = None; let mut issue = None; let mut issue_num = None; - let mut is_soft = false; let mut implied_by = None; let mut old_name = None; @@ -423,12 +422,6 @@ pub(crate) fn parse_unstability( }, }; } - Some(sym::soft) => { - if let Err(span) = args.no_args() { - cx.emit_err(session_diagnostics::SoftNoArgs { span }); - } - is_soft = true; - } Some(sym::implied_by) => { insert_value_into_option_or_error(cx, ¶m, &mut implied_by, word.unwrap())? } @@ -438,14 +431,7 @@ pub(crate) fn parse_unstability( _ => { cx.expected_specific_argument( param.span(), - &[ - sym::feature, - sym::reason, - sym::issue, - sym::soft, - sym::implied_by, - sym::old_name, - ], + &[sym::feature, sym::reason, sym::issue, sym::implied_by, sym::old_name], ); return None; } @@ -468,7 +454,6 @@ pub(crate) fn parse_unstability( let level = StabilityLevel::Unstable { reason: UnstableReason::from_opt_reason(reason), issue: issue_num, - is_soft, implied_by, old_name, }; diff --git a/compiler/rustc_attr_parsing/src/session_diagnostics.rs b/compiler/rustc_attr_parsing/src/session_diagnostics.rs index 7c2044ec235a7..751b8f8646ab0 100644 --- a/compiler/rustc_attr_parsing/src/session_diagnostics.rs +++ b/compiler/rustc_attr_parsing/src/session_diagnostics.rs @@ -374,13 +374,6 @@ pub(crate) struct InvalidSince { pub span: Span, } -#[derive(Diagnostic)] -#[diag("`soft` should not have any arguments")] -pub(crate) struct SoftNoArgs { - #[primary_span] - pub span: Span, -} - #[derive(Diagnostic)] #[diag("unknown version literal format, assuming it refers to a future version")] pub(crate) struct UnknownVersionLiteral { diff --git a/compiler/rustc_hir/src/stability.rs b/compiler/rustc_hir/src/stability.rs index 9297f8e6cdcd0..d00e1f2d4e8cd 100644 --- a/compiler/rustc_hir/src/stability.rs +++ b/compiler/rustc_hir/src/stability.rs @@ -112,7 +112,6 @@ pub enum StabilityLevel { reason: UnstableReason, /// Relevant `rust-lang/rust` issue. issue: Option>, - is_soft: bool, /// If part of a feature is stabilized and a new feature is added for the remaining parts, /// then the `implied_by` attribute is used to indicate which now-stable feature previously /// contained an item. diff --git a/compiler/rustc_lint/src/lib.rs b/compiler/rustc_lint/src/lib.rs index 1790eac7bef5d..2f773b9e166c7 100644 --- a/compiler/rustc_lint/src/lib.rs +++ b/compiler/rustc_lint/src/lib.rs @@ -642,6 +642,7 @@ fn register_builtins(store: &mut LintStore) { see for more information", ); store.register_removed("wasm_c_abi", "the wasm C ABI has been fixed"); + store.register_removed("soft_unstable", "the general soft-unstable mechanism has been removed"); } fn register_internals(store: &mut LintStore) { diff --git a/compiler/rustc_lint_defs/src/builtin.rs b/compiler/rustc_lint_defs/src/builtin.rs index 38ffecbafa06b..0fcc6e4524a54 100644 --- a/compiler/rustc_lint_defs/src/builtin.rs +++ b/compiler/rustc_lint_defs/src/builtin.rs @@ -105,7 +105,6 @@ declare_lint_pass! { SEMICOLON_IN_EXPRESSIONS_FROM_MACROS, SHADOWING_SUPERTRAIT_ITEMS, SINGLE_USE_LIFETIMES, - SOFT_UNSTABLE, STABLE_FEATURES, TAIL_EXPR_DROP_ORDER, TEST_UNSTABLE_LINT, @@ -2317,22 +2316,6 @@ declare_lint! { }; } -declare_lint! { - /// The `soft_unstable` lint detects unstable features that were unintentionally allowed on - /// stable. This is a [future-incompatible] lint to transition this to a hard error in the - /// future. See [issue #64266] for more details. - /// - /// [issue #64266]: https://github.com/rust-lang/rust/issues/64266 - /// [future-incompatible]: ../index.md#future-incompatible-lints - pub SOFT_UNSTABLE, - Deny, - "a feature gate that doesn't break dependent crates", - @future_incompatible = FutureIncompatibleInfo { - reason: fcw!(FutureReleaseError #64266), - report_in_deps: true, - }; -} - declare_lint! { /// The `inline_no_sanitize` lint detects incompatible use of /// [`#[inline(always)]`][inline] and [`#[sanitize(xyz = "off")]`][sanitize]. diff --git a/compiler/rustc_middle/src/middle/stability.rs b/compiler/rustc_middle/src/middle/stability.rs index 06e4a287460b2..e76c9a8c0b5a1 100644 --- a/compiler/rustc_middle/src/middle/stability.rs +++ b/compiler/rustc_middle/src/middle/stability.rs @@ -11,7 +11,7 @@ use rustc_hir::def_id::{DefId, LocalDefId}; use rustc_hir::{self as hir, ConstStability, DefaultBodyStability, HirId, Stability}; use rustc_macros::{Decodable, Encodable, HashStable, Subdiagnostic}; use rustc_session::Session; -use rustc_session::lint::builtin::{DEPRECATED, DEPRECATED_IN_FUTURE, SOFT_UNSTABLE}; +use rustc_session::lint::builtin::{DEPRECATED, DEPRECATED_IN_FUTURE}; use rustc_session::lint::{BuiltinLintDiag, DeprecatedSinceKind, Level, Lint}; use rustc_session::parse::feature_err_issue; use rustc_span::{Span, Symbol, sym}; @@ -68,9 +68,7 @@ pub fn report_unstable( reason: Option, issue: Option>, suggestion: Option<(Span, String, String, Applicability)>, - is_soft: bool, span: Span, - soft_handler: impl FnOnce(&'static Lint, Span, String), kind: UnstableKind, ) { let qual = match kind { @@ -83,18 +81,14 @@ pub fn report_unstable( None => format!("use of unstable{qual} library feature `{feature}`"), }; - if is_soft { - soft_handler(SOFT_UNSTABLE, span, msg) - } else { - let mut err = feature_err_issue(sess, feature, span, GateIssue::Library(issue), msg); - if let Some((inner_types, msg, sugg, applicability)) = suggestion { - err.span_suggestion(inner_types, msg, sugg, applicability); - } - if let UnstableKind::Const(kw) = kind { - err.span_label(kw, "trait is not stable as const yet"); - } - err.emit(); + let mut err = feature_err_issue(sess, feature, span, GateIssue::Library(issue), msg); + if let Some((inner_types, msg, sugg, applicability)) = suggestion { + err.span_suggestion(inner_types, msg, sugg, applicability); } + if let UnstableKind::Const(kw) = kind { + err.span_label(kw, "trait is not stable as const yet"); + } + err.emit(); } fn deprecation_lint(is_in_effect: bool) -> &'static Lint { @@ -266,7 +260,6 @@ pub enum EvalResult { reason: Option, issue: Option>, suggestion: Option<(Span, String, String, Applicability)>, - is_soft: bool, }, /// The item does not have the `#[stable]` or `#[unstable]` marker assigned. Unmarked, @@ -386,7 +379,7 @@ impl<'tcx> TyCtxt<'tcx> { match stability { Some(Stability { - level: hir::StabilityLevel::Unstable { reason, issue, is_soft, implied_by, .. }, + level: hir::StabilityLevel::Unstable { reason, issue, implied_by, .. }, feature, .. }) => { @@ -428,13 +421,7 @@ impl<'tcx> TyCtxt<'tcx> { } let suggestion = suggestion_for_allocator_api(self, def_id, span, feature); - EvalResult::Deny { - feature, - reason: reason.to_opt_reason(), - issue, - suggestion, - is_soft, - } + EvalResult::Deny { feature, reason: reason.to_opt_reason(), issue, suggestion } } Some(_) => { // Stable APIs are always ok to call and deprecated APIs are @@ -469,7 +456,7 @@ impl<'tcx> TyCtxt<'tcx> { match stability { Some(DefaultBodyStability { - level: hir::StabilityLevel::Unstable { reason, issue, is_soft, .. }, + level: hir::StabilityLevel::Unstable { reason, issue, .. }, feature, }) => { if span.allows_unstable(feature) { @@ -485,7 +472,6 @@ impl<'tcx> TyCtxt<'tcx> { reason: reason.to_opt_reason(), issue, suggestion: None, - is_soft, } } Some(_) => { @@ -563,30 +549,18 @@ impl<'tcx> TyCtxt<'tcx> { allow_unstable: AllowUnstable, unmarked: impl FnOnce(Span, DefId), ) -> bool { - let soft_handler = |lint, span, msg: String| { - self.emit_node_span_lint( - lint, - id.unwrap_or(hir::CRATE_HIR_ID), - span, - rustc_errors::DiagDecorator(|lint| { - lint.primary_message(msg); - }), - ); - }; let eval_result = self.eval_stability_allow_unstable(def_id, id, span, method_span, allow_unstable); let is_allowed = matches!(eval_result, EvalResult::Allow); match eval_result { EvalResult::Allow => {} - EvalResult::Deny { feature, reason, issue, suggestion, is_soft } => report_unstable( + EvalResult::Deny { feature, reason, issue, suggestion } => report_unstable( self.sess, feature, reason, issue, suggestion, - is_soft, span, - soft_handler, UnstableKind::Regular, ), EvalResult::Unmarked => unmarked(span, def_id), @@ -623,12 +597,10 @@ impl<'tcx> TyCtxt<'tcx> { match stability { Some(ConstStability { - level: hir::StabilityLevel::Unstable { reason, issue, is_soft, implied_by, .. }, + level: hir::StabilityLevel::Unstable { reason, issue, implied_by, .. }, feature, .. }) => { - assert!(!is_soft); - if span.allows_unstable(feature) { debug!("body stability: skipping span={:?} since it is internal", span); return; @@ -652,9 +624,7 @@ impl<'tcx> TyCtxt<'tcx> { reason.to_opt_reason(), issue, None, - false, span, - |_, _, _| {}, UnstableKind::Const(const_kw_span), ); } diff --git a/compiler/rustc_passes/src/stability.rs b/compiler/rustc_passes/src/stability.rs index ec6d48cbea2e4..9b13e4841ea5a 100644 --- a/compiler/rustc_passes/src/stability.rs +++ b/compiler/rustc_passes/src/stability.rs @@ -131,7 +131,6 @@ const FORCE_UNSTABLE: Stability = Stability { level: StabilityLevel::Unstable { reason: UnstableReason::Default, issue: NonZero::new(27812), - is_soft: false, implied_by: None, old_name: None, }, diff --git a/compiler/rustc_resolve/src/errors.rs b/compiler/rustc_resolve/src/errors.rs index 63ffdbc37f7d1..a56d91492f679 100644 --- a/compiler/rustc_resolve/src/errors.rs +++ b/compiler/rustc_resolve/src/errors.rs @@ -1,7 +1,7 @@ use rustc_errors::codes::*; use rustc_errors::formatting::DiagMessageAddArg; use rustc_errors::{ - Applicability, Diag, DiagCtxtHandle, DiagMessage, Diagnostic, ElidedLifetimeInPathSubdiag, + Applicability, Diag, DiagCtxtHandle, Diagnostic, ElidedLifetimeInPathSubdiag, EmissionGuarantee, IntoDiagArg, Level, MultiSpan, Subdiagnostic, msg, }; use rustc_macros::{Diagnostic, Subdiagnostic}; @@ -1454,17 +1454,6 @@ pub(crate) struct MacroRuleNeverUsed { pub name: Symbol, } -pub(crate) struct UnstableFeature { - pub msg: DiagMessage, -} - -impl<'a> Diagnostic<'a, ()> for UnstableFeature { - fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a, ()> { - let Self { msg } = self; - Diag::new(dcx, level, msg) - } -} - #[derive(Diagnostic)] #[diag("`extern crate` is not idiomatic in the new edition")] pub(crate) struct ExternCrateNotIdiomatic { diff --git a/compiler/rustc_resolve/src/macros.rs b/compiler/rustc_resolve/src/macros.rs index 551d89ee6022a..dd38679f36e7e 100644 --- a/compiler/rustc_resolve/src/macros.rs +++ b/compiler/rustc_resolve/src/macros.rs @@ -1064,8 +1064,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { ) { let span = path.span; if let Some(stability) = &ext.stability - && let StabilityLevel::Unstable { reason, issue, is_soft, implied_by, .. } = - stability.level + && let StabilityLevel::Unstable { reason, issue, implied_by, .. } = stability.level { let feature = stability.feature; @@ -1073,25 +1072,13 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { |feature| self.tcx.features().enabled(feature) || span.allows_unstable(feature); let allowed_by_implication = implied_by.is_some_and(|feature| is_allowed(feature)); if !is_allowed(feature) && !allowed_by_implication { - let lint_buffer = &mut self.lint_buffer; - let soft_handler = |lint, span, msg: String| { - lint_buffer.buffer_lint( - lint, - node_id, - span, - // FIXME make this translatable - errors::UnstableFeature { msg: msg.into() }, - ) - }; stability::report_unstable( self.tcx.sess, feature, reason.to_opt_reason(), issue, None, - is_soft, span, - soft_handler, stability::UnstableKind::Regular, ); } diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs index 257ac3f51c2c1..135a4c16952d4 100644 --- a/compiler/rustc_span/src/symbol.rs +++ b/compiler/rustc_span/src/symbol.rs @@ -1914,7 +1914,6 @@ symbols! { slice_len_fn, slice_patterns, slicing_syntax, - soft, sparc, sparc64, sparc_target_feature, diff --git a/src/librustdoc/clean/types.rs b/src/librustdoc/clean/types.rs index c595a0ae2d485..431e9ff476f5f 100644 --- a/src/librustdoc/clean/types.rs +++ b/src/librustdoc/clean/types.rs @@ -2430,7 +2430,7 @@ mod size_asserts { static_assert_size!(GenericParamDef, 40); static_assert_size!(Generics, 16); static_assert_size!(Item, 8); - static_assert_size!(ItemInner, 144); + static_assert_size!(ItemInner, 136); static_assert_size!(ItemKind, 48); static_assert_size!(PathSegment, 32); static_assert_size!(Type, 32); diff --git a/tests/ui/feature-gates/issue-43106-gating-of-test.rs b/tests/ui/feature-gates/issue-43106-gating-of-test.rs index 38c92d933fdd8..cc4c73d916bd0 100644 --- a/tests/ui/feature-gates/issue-43106-gating-of-test.rs +++ b/tests/ui/feature-gates/issue-43106-gating-of-test.rs @@ -1,6 +1,5 @@ // The non-crate level cases are in issue-43106-gating-of-builtin-attrs.rs. -#![allow(soft_unstable)] #![test = "4200"] //~^ ERROR `test` attribute cannot be used at crate level fn main() {} diff --git a/tests/ui/feature-gates/issue-43106-gating-of-test.stderr b/tests/ui/feature-gates/issue-43106-gating-of-test.stderr index 2fc220dc47bd1..6e706b151b72f 100644 --- a/tests/ui/feature-gates/issue-43106-gating-of-test.stderr +++ b/tests/ui/feature-gates/issue-43106-gating-of-test.stderr @@ -1,5 +1,5 @@ error: `test` attribute cannot be used at crate level - --> $DIR/issue-43106-gating-of-test.rs:4:1 + --> $DIR/issue-43106-gating-of-test.rs:3:1 | LL | #![test = "4200"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/imports/issue-28134.rs b/tests/ui/imports/issue-28134.rs index aef2fe8facdcf..01d7274098cd6 100644 --- a/tests/ui/imports/issue-28134.rs +++ b/tests/ui/imports/issue-28134.rs @@ -1,5 +1,4 @@ //@ compile-flags: --test -#![allow(soft_unstable)] #![test] //~^ ERROR `test` attribute cannot be used at crate level diff --git a/tests/ui/imports/issue-28134.stderr b/tests/ui/imports/issue-28134.stderr index e47aa15e87a94..33df87e3a7474 100644 --- a/tests/ui/imports/issue-28134.stderr +++ b/tests/ui/imports/issue-28134.stderr @@ -1,5 +1,5 @@ error: `test` attribute cannot be used at crate level - --> $DIR/issue-28134.rs:4:1 + --> $DIR/issue-28134.rs:3:1 | LL | #![test] | ^^^^^^^^ diff --git a/tests/ui/where-clauses/cfg_attribute.a.stderr b/tests/ui/where-clauses/cfg_attribute.a.stderr index 0ede890eb44f2..ee81072e70062 100644 --- a/tests/ui/where-clauses/cfg_attribute.a.stderr +++ b/tests/ui/where-clauses/cfg_attribute.a.stderr @@ -1,83 +1,83 @@ error: expected non-macro attribute, found attribute macro `derive` - --> $DIR/cfg_attribute.rs:32:7 + --> $DIR/cfg_attribute.rs:31:7 | LL | #[derive(Clone)] ():, | ^^^^^^ not a non-macro attribute error: expected non-macro attribute, found attribute macro `derive` - --> $DIR/cfg_attribute.rs:43:11 + --> $DIR/cfg_attribute.rs:42:11 | LL | #[derive(Clone)] ():, | ^^^^^^ not a non-macro attribute error: expected non-macro attribute, found attribute macro `derive` - --> $DIR/cfg_attribute.rs:54:11 + --> $DIR/cfg_attribute.rs:53:11 | LL | #[derive(Clone)] ():, | ^^^^^^ not a non-macro attribute error: expected non-macro attribute, found attribute macro `derive` - --> $DIR/cfg_attribute.rs:66:7 + --> $DIR/cfg_attribute.rs:65:7 | LL | #[derive(Clone)] ():, | ^^^^^^ not a non-macro attribute error: expected non-macro attribute, found attribute macro `derive` - --> $DIR/cfg_attribute.rs:76:11 + --> $DIR/cfg_attribute.rs:75:11 | LL | #[derive(Clone)] ():, | ^^^^^^ not a non-macro attribute error: expected non-macro attribute, found attribute macro `derive` - --> $DIR/cfg_attribute.rs:87:11 + --> $DIR/cfg_attribute.rs:86:11 | LL | #[derive(Clone)] ():, | ^^^^^^ not a non-macro attribute error: expected non-macro attribute, found attribute macro `derive` - --> $DIR/cfg_attribute.rs:100:7 + --> $DIR/cfg_attribute.rs:99:7 | LL | #[derive(Clone)] ():, | ^^^^^^ not a non-macro attribute error: expected non-macro attribute, found attribute macro `derive` - --> $DIR/cfg_attribute.rs:114:7 + --> $DIR/cfg_attribute.rs:113:7 | LL | #[derive(Clone)] ():, | ^^^^^^ not a non-macro attribute error: expected non-macro attribute, found attribute macro `derive` - --> $DIR/cfg_attribute.rs:129:7 + --> $DIR/cfg_attribute.rs:128:7 | LL | #[derive(Clone)] ():, | ^^^^^^ not a non-macro attribute error: expected non-macro attribute, found attribute macro `derive` - --> $DIR/cfg_attribute.rs:144:7 + --> $DIR/cfg_attribute.rs:143:7 | LL | #[derive(Clone)] ():, | ^^^^^^ not a non-macro attribute error: expected non-macro attribute, found attribute macro `derive` - --> $DIR/cfg_attribute.rs:155:7 + --> $DIR/cfg_attribute.rs:154:7 | LL | #[derive(Clone)] ():, | ^^^^^^ not a non-macro attribute error: expected non-macro attribute, found attribute macro `derive` - --> $DIR/cfg_attribute.rs:165:11 + --> $DIR/cfg_attribute.rs:164:11 | LL | #[derive(Clone)] ():, | ^^^^^^ not a non-macro attribute error: expected non-macro attribute, found attribute macro `derive` - --> $DIR/cfg_attribute.rs:178:7 + --> $DIR/cfg_attribute.rs:177:7 | LL | #[derive(Clone)] ():, | ^^^^^^ not a non-macro attribute error: most attributes are not supported in `where` clauses - --> $DIR/cfg_attribute.rs:32:5 + --> $DIR/cfg_attribute.rs:31:5 | LL | #[derive(Clone)] ():, | ^^^^^^^^^^^^^^^^ @@ -85,7 +85,7 @@ LL | #[derive(Clone)] ():, = help: only `#[cfg]` and `#[cfg_attr]` are supported error: most attributes are not supported in `where` clauses - --> $DIR/cfg_attribute.rs:35:5 + --> $DIR/cfg_attribute.rs:34:5 | LL | #[rustfmt::skip] ():, | ^^^^^^^^^^^^^^^^ @@ -93,7 +93,7 @@ LL | #[rustfmt::skip] ():, = help: only `#[cfg]` and `#[cfg_attr]` are supported error: most attributes are not supported in `where` clauses - --> $DIR/cfg_attribute.rs:66:5 + --> $DIR/cfg_attribute.rs:65:5 | LL | #[derive(Clone)] ():, | ^^^^^^^^^^^^^^^^ @@ -101,7 +101,7 @@ LL | #[derive(Clone)] ():, = help: only `#[cfg]` and `#[cfg_attr]` are supported error: most attributes are not supported in `where` clauses - --> $DIR/cfg_attribute.rs:69:5 + --> $DIR/cfg_attribute.rs:68:5 | LL | #[rustfmt::skip] ():, | ^^^^^^^^^^^^^^^^ @@ -109,7 +109,7 @@ LL | #[rustfmt::skip] ():, = help: only `#[cfg]` and `#[cfg_attr]` are supported error: most attributes are not supported in `where` clauses - --> $DIR/cfg_attribute.rs:100:5 + --> $DIR/cfg_attribute.rs:99:5 | LL | #[derive(Clone)] ():, | ^^^^^^^^^^^^^^^^ @@ -117,7 +117,7 @@ LL | #[derive(Clone)] ():, = help: only `#[cfg]` and `#[cfg_attr]` are supported error: most attributes are not supported in `where` clauses - --> $DIR/cfg_attribute.rs:103:5 + --> $DIR/cfg_attribute.rs:102:5 | LL | #[rustfmt::skip] ():, | ^^^^^^^^^^^^^^^^ @@ -125,7 +125,7 @@ LL | #[rustfmt::skip] ():, = help: only `#[cfg]` and `#[cfg_attr]` are supported error: most attributes are not supported in `where` clauses - --> $DIR/cfg_attribute.rs:114:5 + --> $DIR/cfg_attribute.rs:113:5 | LL | #[derive(Clone)] ():, | ^^^^^^^^^^^^^^^^ @@ -133,7 +133,7 @@ LL | #[derive(Clone)] ():, = help: only `#[cfg]` and `#[cfg_attr]` are supported error: most attributes are not supported in `where` clauses - --> $DIR/cfg_attribute.rs:117:5 + --> $DIR/cfg_attribute.rs:116:5 | LL | #[rustfmt::skip] ():, | ^^^^^^^^^^^^^^^^ @@ -141,7 +141,7 @@ LL | #[rustfmt::skip] ():, = help: only `#[cfg]` and `#[cfg_attr]` are supported error: most attributes are not supported in `where` clauses - --> $DIR/cfg_attribute.rs:129:5 + --> $DIR/cfg_attribute.rs:128:5 | LL | #[derive(Clone)] ():, | ^^^^^^^^^^^^^^^^ @@ -149,7 +149,7 @@ LL | #[derive(Clone)] ():, = help: only `#[cfg]` and `#[cfg_attr]` are supported error: most attributes are not supported in `where` clauses - --> $DIR/cfg_attribute.rs:132:5 + --> $DIR/cfg_attribute.rs:131:5 | LL | #[rustfmt::skip] ():, | ^^^^^^^^^^^^^^^^ @@ -157,7 +157,7 @@ LL | #[rustfmt::skip] ():, = help: only `#[cfg]` and `#[cfg_attr]` are supported error: most attributes are not supported in `where` clauses - --> $DIR/cfg_attribute.rs:144:5 + --> $DIR/cfg_attribute.rs:143:5 | LL | #[derive(Clone)] ():, | ^^^^^^^^^^^^^^^^ @@ -165,7 +165,7 @@ LL | #[derive(Clone)] ():, = help: only `#[cfg]` and `#[cfg_attr]` are supported error: most attributes are not supported in `where` clauses - --> $DIR/cfg_attribute.rs:147:5 + --> $DIR/cfg_attribute.rs:146:5 | LL | #[rustfmt::skip] ():, | ^^^^^^^^^^^^^^^^ @@ -173,7 +173,7 @@ LL | #[rustfmt::skip] ():, = help: only `#[cfg]` and `#[cfg_attr]` are supported error: most attributes are not supported in `where` clauses - --> $DIR/cfg_attribute.rs:155:5 + --> $DIR/cfg_attribute.rs:154:5 | LL | #[derive(Clone)] ():, | ^^^^^^^^^^^^^^^^ @@ -181,7 +181,7 @@ LL | #[derive(Clone)] ():, = help: only `#[cfg]` and `#[cfg_attr]` are supported error: most attributes are not supported in `where` clauses - --> $DIR/cfg_attribute.rs:158:5 + --> $DIR/cfg_attribute.rs:157:5 | LL | #[rustfmt::skip] ():, | ^^^^^^^^^^^^^^^^ @@ -189,7 +189,7 @@ LL | #[rustfmt::skip] ():, = help: only `#[cfg]` and `#[cfg_attr]` are supported error: most attributes are not supported in `where` clauses - --> $DIR/cfg_attribute.rs:178:5 + --> $DIR/cfg_attribute.rs:177:5 | LL | #[derive(Clone)] ():, | ^^^^^^^^^^^^^^^^ @@ -197,7 +197,7 @@ LL | #[derive(Clone)] ():, = help: only `#[cfg]` and `#[cfg_attr]` are supported error: most attributes are not supported in `where` clauses - --> $DIR/cfg_attribute.rs:181:5 + --> $DIR/cfg_attribute.rs:180:5 | LL | #[rustfmt::skip] ():, | ^^^^^^^^^^^^^^^^ @@ -205,7 +205,7 @@ LL | #[rustfmt::skip] ():, = help: only `#[cfg]` and `#[cfg_attr]` are supported error: most attributes are not supported in `where` clauses - --> $DIR/cfg_attribute.rs:43:9 + --> $DIR/cfg_attribute.rs:42:9 | LL | #[derive(Clone)] ():, | ^^^^^^^^^^^^^^^^ @@ -213,7 +213,7 @@ LL | #[derive(Clone)] ():, = help: only `#[cfg]` and `#[cfg_attr]` are supported error: most attributes are not supported in `where` clauses - --> $DIR/cfg_attribute.rs:46:9 + --> $DIR/cfg_attribute.rs:45:9 | LL | #[rustfmt::skip] ():; | ^^^^^^^^^^^^^^^^ @@ -221,7 +221,7 @@ LL | #[rustfmt::skip] ():; = help: only `#[cfg]` and `#[cfg_attr]` are supported error: most attributes are not supported in `where` clauses - --> $DIR/cfg_attribute.rs:54:9 + --> $DIR/cfg_attribute.rs:53:9 | LL | #[derive(Clone)] ():, | ^^^^^^^^^^^^^^^^ @@ -229,7 +229,7 @@ LL | #[derive(Clone)] ():, = help: only `#[cfg]` and `#[cfg_attr]` are supported error: most attributes are not supported in `where` clauses - --> $DIR/cfg_attribute.rs:57:9 + --> $DIR/cfg_attribute.rs:56:9 | LL | #[rustfmt::skip] ():; | ^^^^^^^^^^^^^^^^ @@ -237,7 +237,7 @@ LL | #[rustfmt::skip] ():; = help: only `#[cfg]` and `#[cfg_attr]` are supported error: most attributes are not supported in `where` clauses - --> $DIR/cfg_attribute.rs:76:9 + --> $DIR/cfg_attribute.rs:75:9 | LL | #[derive(Clone)] ():, | ^^^^^^^^^^^^^^^^ @@ -245,7 +245,7 @@ LL | #[derive(Clone)] ():, = help: only `#[cfg]` and `#[cfg_attr]` are supported error: most attributes are not supported in `where` clauses - --> $DIR/cfg_attribute.rs:79:9 + --> $DIR/cfg_attribute.rs:78:9 | LL | #[rustfmt::skip] ():; | ^^^^^^^^^^^^^^^^ @@ -253,7 +253,7 @@ LL | #[rustfmt::skip] ():; = help: only `#[cfg]` and `#[cfg_attr]` are supported error: most attributes are not supported in `where` clauses - --> $DIR/cfg_attribute.rs:87:9 + --> $DIR/cfg_attribute.rs:86:9 | LL | #[derive(Clone)] ():, | ^^^^^^^^^^^^^^^^ @@ -261,7 +261,7 @@ LL | #[derive(Clone)] ():, = help: only `#[cfg]` and `#[cfg_attr]` are supported error: most attributes are not supported in `where` clauses - --> $DIR/cfg_attribute.rs:90:9 + --> $DIR/cfg_attribute.rs:89:9 | LL | #[rustfmt::skip] ():, | ^^^^^^^^^^^^^^^^ @@ -269,7 +269,7 @@ LL | #[rustfmt::skip] ():, = help: only `#[cfg]` and `#[cfg_attr]` are supported error: most attributes are not supported in `where` clauses - --> $DIR/cfg_attribute.rs:165:9 + --> $DIR/cfg_attribute.rs:164:9 | LL | #[derive(Clone)] ():, | ^^^^^^^^^^^^^^^^ @@ -277,7 +277,7 @@ LL | #[derive(Clone)] ():, = help: only `#[cfg]` and `#[cfg_attr]` are supported error: most attributes are not supported in `where` clauses - --> $DIR/cfg_attribute.rs:168:9 + --> $DIR/cfg_attribute.rs:167:9 | LL | #[rustfmt::skip] ():, | ^^^^^^^^^^^^^^^^ diff --git a/tests/ui/where-clauses/cfg_attribute.b.stderr b/tests/ui/where-clauses/cfg_attribute.b.stderr index 0ede890eb44f2..ee81072e70062 100644 --- a/tests/ui/where-clauses/cfg_attribute.b.stderr +++ b/tests/ui/where-clauses/cfg_attribute.b.stderr @@ -1,83 +1,83 @@ error: expected non-macro attribute, found attribute macro `derive` - --> $DIR/cfg_attribute.rs:32:7 + --> $DIR/cfg_attribute.rs:31:7 | LL | #[derive(Clone)] ():, | ^^^^^^ not a non-macro attribute error: expected non-macro attribute, found attribute macro `derive` - --> $DIR/cfg_attribute.rs:43:11 + --> $DIR/cfg_attribute.rs:42:11 | LL | #[derive(Clone)] ():, | ^^^^^^ not a non-macro attribute error: expected non-macro attribute, found attribute macro `derive` - --> $DIR/cfg_attribute.rs:54:11 + --> $DIR/cfg_attribute.rs:53:11 | LL | #[derive(Clone)] ():, | ^^^^^^ not a non-macro attribute error: expected non-macro attribute, found attribute macro `derive` - --> $DIR/cfg_attribute.rs:66:7 + --> $DIR/cfg_attribute.rs:65:7 | LL | #[derive(Clone)] ():, | ^^^^^^ not a non-macro attribute error: expected non-macro attribute, found attribute macro `derive` - --> $DIR/cfg_attribute.rs:76:11 + --> $DIR/cfg_attribute.rs:75:11 | LL | #[derive(Clone)] ():, | ^^^^^^ not a non-macro attribute error: expected non-macro attribute, found attribute macro `derive` - --> $DIR/cfg_attribute.rs:87:11 + --> $DIR/cfg_attribute.rs:86:11 | LL | #[derive(Clone)] ():, | ^^^^^^ not a non-macro attribute error: expected non-macro attribute, found attribute macro `derive` - --> $DIR/cfg_attribute.rs:100:7 + --> $DIR/cfg_attribute.rs:99:7 | LL | #[derive(Clone)] ():, | ^^^^^^ not a non-macro attribute error: expected non-macro attribute, found attribute macro `derive` - --> $DIR/cfg_attribute.rs:114:7 + --> $DIR/cfg_attribute.rs:113:7 | LL | #[derive(Clone)] ():, | ^^^^^^ not a non-macro attribute error: expected non-macro attribute, found attribute macro `derive` - --> $DIR/cfg_attribute.rs:129:7 + --> $DIR/cfg_attribute.rs:128:7 | LL | #[derive(Clone)] ():, | ^^^^^^ not a non-macro attribute error: expected non-macro attribute, found attribute macro `derive` - --> $DIR/cfg_attribute.rs:144:7 + --> $DIR/cfg_attribute.rs:143:7 | LL | #[derive(Clone)] ():, | ^^^^^^ not a non-macro attribute error: expected non-macro attribute, found attribute macro `derive` - --> $DIR/cfg_attribute.rs:155:7 + --> $DIR/cfg_attribute.rs:154:7 | LL | #[derive(Clone)] ():, | ^^^^^^ not a non-macro attribute error: expected non-macro attribute, found attribute macro `derive` - --> $DIR/cfg_attribute.rs:165:11 + --> $DIR/cfg_attribute.rs:164:11 | LL | #[derive(Clone)] ():, | ^^^^^^ not a non-macro attribute error: expected non-macro attribute, found attribute macro `derive` - --> $DIR/cfg_attribute.rs:178:7 + --> $DIR/cfg_attribute.rs:177:7 | LL | #[derive(Clone)] ():, | ^^^^^^ not a non-macro attribute error: most attributes are not supported in `where` clauses - --> $DIR/cfg_attribute.rs:32:5 + --> $DIR/cfg_attribute.rs:31:5 | LL | #[derive(Clone)] ():, | ^^^^^^^^^^^^^^^^ @@ -85,7 +85,7 @@ LL | #[derive(Clone)] ():, = help: only `#[cfg]` and `#[cfg_attr]` are supported error: most attributes are not supported in `where` clauses - --> $DIR/cfg_attribute.rs:35:5 + --> $DIR/cfg_attribute.rs:34:5 | LL | #[rustfmt::skip] ():, | ^^^^^^^^^^^^^^^^ @@ -93,7 +93,7 @@ LL | #[rustfmt::skip] ():, = help: only `#[cfg]` and `#[cfg_attr]` are supported error: most attributes are not supported in `where` clauses - --> $DIR/cfg_attribute.rs:66:5 + --> $DIR/cfg_attribute.rs:65:5 | LL | #[derive(Clone)] ():, | ^^^^^^^^^^^^^^^^ @@ -101,7 +101,7 @@ LL | #[derive(Clone)] ():, = help: only `#[cfg]` and `#[cfg_attr]` are supported error: most attributes are not supported in `where` clauses - --> $DIR/cfg_attribute.rs:69:5 + --> $DIR/cfg_attribute.rs:68:5 | LL | #[rustfmt::skip] ():, | ^^^^^^^^^^^^^^^^ @@ -109,7 +109,7 @@ LL | #[rustfmt::skip] ():, = help: only `#[cfg]` and `#[cfg_attr]` are supported error: most attributes are not supported in `where` clauses - --> $DIR/cfg_attribute.rs:100:5 + --> $DIR/cfg_attribute.rs:99:5 | LL | #[derive(Clone)] ():, | ^^^^^^^^^^^^^^^^ @@ -117,7 +117,7 @@ LL | #[derive(Clone)] ():, = help: only `#[cfg]` and `#[cfg_attr]` are supported error: most attributes are not supported in `where` clauses - --> $DIR/cfg_attribute.rs:103:5 + --> $DIR/cfg_attribute.rs:102:5 | LL | #[rustfmt::skip] ():, | ^^^^^^^^^^^^^^^^ @@ -125,7 +125,7 @@ LL | #[rustfmt::skip] ():, = help: only `#[cfg]` and `#[cfg_attr]` are supported error: most attributes are not supported in `where` clauses - --> $DIR/cfg_attribute.rs:114:5 + --> $DIR/cfg_attribute.rs:113:5 | LL | #[derive(Clone)] ():, | ^^^^^^^^^^^^^^^^ @@ -133,7 +133,7 @@ LL | #[derive(Clone)] ():, = help: only `#[cfg]` and `#[cfg_attr]` are supported error: most attributes are not supported in `where` clauses - --> $DIR/cfg_attribute.rs:117:5 + --> $DIR/cfg_attribute.rs:116:5 | LL | #[rustfmt::skip] ():, | ^^^^^^^^^^^^^^^^ @@ -141,7 +141,7 @@ LL | #[rustfmt::skip] ():, = help: only `#[cfg]` and `#[cfg_attr]` are supported error: most attributes are not supported in `where` clauses - --> $DIR/cfg_attribute.rs:129:5 + --> $DIR/cfg_attribute.rs:128:5 | LL | #[derive(Clone)] ():, | ^^^^^^^^^^^^^^^^ @@ -149,7 +149,7 @@ LL | #[derive(Clone)] ():, = help: only `#[cfg]` and `#[cfg_attr]` are supported error: most attributes are not supported in `where` clauses - --> $DIR/cfg_attribute.rs:132:5 + --> $DIR/cfg_attribute.rs:131:5 | LL | #[rustfmt::skip] ():, | ^^^^^^^^^^^^^^^^ @@ -157,7 +157,7 @@ LL | #[rustfmt::skip] ():, = help: only `#[cfg]` and `#[cfg_attr]` are supported error: most attributes are not supported in `where` clauses - --> $DIR/cfg_attribute.rs:144:5 + --> $DIR/cfg_attribute.rs:143:5 | LL | #[derive(Clone)] ():, | ^^^^^^^^^^^^^^^^ @@ -165,7 +165,7 @@ LL | #[derive(Clone)] ():, = help: only `#[cfg]` and `#[cfg_attr]` are supported error: most attributes are not supported in `where` clauses - --> $DIR/cfg_attribute.rs:147:5 + --> $DIR/cfg_attribute.rs:146:5 | LL | #[rustfmt::skip] ():, | ^^^^^^^^^^^^^^^^ @@ -173,7 +173,7 @@ LL | #[rustfmt::skip] ():, = help: only `#[cfg]` and `#[cfg_attr]` are supported error: most attributes are not supported in `where` clauses - --> $DIR/cfg_attribute.rs:155:5 + --> $DIR/cfg_attribute.rs:154:5 | LL | #[derive(Clone)] ():, | ^^^^^^^^^^^^^^^^ @@ -181,7 +181,7 @@ LL | #[derive(Clone)] ():, = help: only `#[cfg]` and `#[cfg_attr]` are supported error: most attributes are not supported in `where` clauses - --> $DIR/cfg_attribute.rs:158:5 + --> $DIR/cfg_attribute.rs:157:5 | LL | #[rustfmt::skip] ():, | ^^^^^^^^^^^^^^^^ @@ -189,7 +189,7 @@ LL | #[rustfmt::skip] ():, = help: only `#[cfg]` and `#[cfg_attr]` are supported error: most attributes are not supported in `where` clauses - --> $DIR/cfg_attribute.rs:178:5 + --> $DIR/cfg_attribute.rs:177:5 | LL | #[derive(Clone)] ():, | ^^^^^^^^^^^^^^^^ @@ -197,7 +197,7 @@ LL | #[derive(Clone)] ():, = help: only `#[cfg]` and `#[cfg_attr]` are supported error: most attributes are not supported in `where` clauses - --> $DIR/cfg_attribute.rs:181:5 + --> $DIR/cfg_attribute.rs:180:5 | LL | #[rustfmt::skip] ():, | ^^^^^^^^^^^^^^^^ @@ -205,7 +205,7 @@ LL | #[rustfmt::skip] ():, = help: only `#[cfg]` and `#[cfg_attr]` are supported error: most attributes are not supported in `where` clauses - --> $DIR/cfg_attribute.rs:43:9 + --> $DIR/cfg_attribute.rs:42:9 | LL | #[derive(Clone)] ():, | ^^^^^^^^^^^^^^^^ @@ -213,7 +213,7 @@ LL | #[derive(Clone)] ():, = help: only `#[cfg]` and `#[cfg_attr]` are supported error: most attributes are not supported in `where` clauses - --> $DIR/cfg_attribute.rs:46:9 + --> $DIR/cfg_attribute.rs:45:9 | LL | #[rustfmt::skip] ():; | ^^^^^^^^^^^^^^^^ @@ -221,7 +221,7 @@ LL | #[rustfmt::skip] ():; = help: only `#[cfg]` and `#[cfg_attr]` are supported error: most attributes are not supported in `where` clauses - --> $DIR/cfg_attribute.rs:54:9 + --> $DIR/cfg_attribute.rs:53:9 | LL | #[derive(Clone)] ():, | ^^^^^^^^^^^^^^^^ @@ -229,7 +229,7 @@ LL | #[derive(Clone)] ():, = help: only `#[cfg]` and `#[cfg_attr]` are supported error: most attributes are not supported in `where` clauses - --> $DIR/cfg_attribute.rs:57:9 + --> $DIR/cfg_attribute.rs:56:9 | LL | #[rustfmt::skip] ():; | ^^^^^^^^^^^^^^^^ @@ -237,7 +237,7 @@ LL | #[rustfmt::skip] ():; = help: only `#[cfg]` and `#[cfg_attr]` are supported error: most attributes are not supported in `where` clauses - --> $DIR/cfg_attribute.rs:76:9 + --> $DIR/cfg_attribute.rs:75:9 | LL | #[derive(Clone)] ():, | ^^^^^^^^^^^^^^^^ @@ -245,7 +245,7 @@ LL | #[derive(Clone)] ():, = help: only `#[cfg]` and `#[cfg_attr]` are supported error: most attributes are not supported in `where` clauses - --> $DIR/cfg_attribute.rs:79:9 + --> $DIR/cfg_attribute.rs:78:9 | LL | #[rustfmt::skip] ():; | ^^^^^^^^^^^^^^^^ @@ -253,7 +253,7 @@ LL | #[rustfmt::skip] ():; = help: only `#[cfg]` and `#[cfg_attr]` are supported error: most attributes are not supported in `where` clauses - --> $DIR/cfg_attribute.rs:87:9 + --> $DIR/cfg_attribute.rs:86:9 | LL | #[derive(Clone)] ():, | ^^^^^^^^^^^^^^^^ @@ -261,7 +261,7 @@ LL | #[derive(Clone)] ():, = help: only `#[cfg]` and `#[cfg_attr]` are supported error: most attributes are not supported in `where` clauses - --> $DIR/cfg_attribute.rs:90:9 + --> $DIR/cfg_attribute.rs:89:9 | LL | #[rustfmt::skip] ():, | ^^^^^^^^^^^^^^^^ @@ -269,7 +269,7 @@ LL | #[rustfmt::skip] ():, = help: only `#[cfg]` and `#[cfg_attr]` are supported error: most attributes are not supported in `where` clauses - --> $DIR/cfg_attribute.rs:165:9 + --> $DIR/cfg_attribute.rs:164:9 | LL | #[derive(Clone)] ():, | ^^^^^^^^^^^^^^^^ @@ -277,7 +277,7 @@ LL | #[derive(Clone)] ():, = help: only `#[cfg]` and `#[cfg_attr]` are supported error: most attributes are not supported in `where` clauses - --> $DIR/cfg_attribute.rs:168:9 + --> $DIR/cfg_attribute.rs:167:9 | LL | #[rustfmt::skip] ():, | ^^^^^^^^^^^^^^^^ diff --git a/tests/ui/where-clauses/cfg_attribute.rs b/tests/ui/where-clauses/cfg_attribute.rs index 8cbca0bee75dd..13ba070990b74 100644 --- a/tests/ui/where-clauses/cfg_attribute.rs +++ b/tests/ui/where-clauses/cfg_attribute.rs @@ -7,7 +7,6 @@ #![feature(custom_test_frameworks)] #![feature(derive_const)] #![feature(where_clause_attrs)] -#![allow(soft_unstable)] use std::marker::PhantomData; diff --git a/tests/ui/where-clauses/unsupported_attribute.rs b/tests/ui/where-clauses/unsupported_attribute.rs index 75213e176610e..e86274f3ed5e7 100644 --- a/tests/ui/where-clauses/unsupported_attribute.rs +++ b/tests/ui/where-clauses/unsupported_attribute.rs @@ -5,7 +5,6 @@ #![feature(custom_test_frameworks)] #![feature(derive_const)] #![feature(where_clause_attrs)] -#![allow(soft_unstable)] trait Trait {} diff --git a/tests/ui/where-clauses/unsupported_attribute.stderr b/tests/ui/where-clauses/unsupported_attribute.stderr index e69eff976c3f1..e55a7c380c2be 100644 --- a/tests/ui/where-clauses/unsupported_attribute.stderr +++ b/tests/ui/where-clauses/unsupported_attribute.stderr @@ -1,17 +1,17 @@ error: expected non-macro attribute, found attribute macro `derive` - --> $DIR/unsupported_attribute.rs:28:7 + --> $DIR/unsupported_attribute.rs:27:7 | LL | #[derive(Clone)] T: Trait, | ^^^^^^ not a non-macro attribute error: expected non-macro attribute, found attribute macro `derive` - --> $DIR/unsupported_attribute.rs:31:7 + --> $DIR/unsupported_attribute.rs:30:7 | LL | #[derive(Clone)] 'a: 'static, | ^^^^^^ not a non-macro attribute error: `#[ignore]` attribute cannot be used on where predicates - --> $DIR/unsupported_attribute.rs:16:5 + --> $DIR/unsupported_attribute.rs:15:5 | LL | #[ignore] T: Trait, | ^^^^^^^^^ @@ -19,7 +19,7 @@ LL | #[ignore] T: Trait, = help: `#[ignore]` can only be applied to functions error: `#[ignore]` attribute cannot be used on where predicates - --> $DIR/unsupported_attribute.rs:17:5 + --> $DIR/unsupported_attribute.rs:16:5 | LL | #[ignore] 'a: 'static, | ^^^^^^^^^ @@ -27,7 +27,7 @@ LL | #[ignore] 'a: 'static, = help: `#[ignore]` can only be applied to functions error: `#[should_panic]` attribute cannot be used on where predicates - --> $DIR/unsupported_attribute.rs:18:5 + --> $DIR/unsupported_attribute.rs:17:5 | LL | #[should_panic] T: Trait, | ^^^^^^^^^^^^^^^ @@ -35,7 +35,7 @@ LL | #[should_panic] T: Trait, = help: `#[should_panic]` can only be applied to functions error: `#[should_panic]` attribute cannot be used on where predicates - --> $DIR/unsupported_attribute.rs:19:5 + --> $DIR/unsupported_attribute.rs:18:5 | LL | #[should_panic] 'a: 'static, | ^^^^^^^^^^^^^^^ @@ -43,7 +43,7 @@ LL | #[should_panic] 'a: 'static, = help: `#[should_panic]` can only be applied to functions error: `#[macro_use]` attribute cannot be used on where predicates - --> $DIR/unsupported_attribute.rs:20:5 + --> $DIR/unsupported_attribute.rs:19:5 | LL | #[macro_use] T: Trait, | ^^^^^^^^^^^^ @@ -51,7 +51,7 @@ LL | #[macro_use] T: Trait, = help: `#[macro_use]` can be applied to crates, extern crates, and modules error: `#[macro_use]` attribute cannot be used on where predicates - --> $DIR/unsupported_attribute.rs:21:5 + --> $DIR/unsupported_attribute.rs:20:5 | LL | #[macro_use] 'a: 'static, | ^^^^^^^^^^^^ @@ -59,7 +59,7 @@ LL | #[macro_use] 'a: 'static, = help: `#[macro_use]` can be applied to crates, extern crates, and modules error: `#[deprecated]` attribute cannot be used on where predicates - --> $DIR/unsupported_attribute.rs:24:5 + --> $DIR/unsupported_attribute.rs:23:5 | LL | #[deprecated] T: Trait, | ^^^^^^^^^^^^^ @@ -67,7 +67,7 @@ LL | #[deprecated] T: Trait, = help: `#[deprecated]` can be applied to associated consts, associated types, constants, crates, data types, enum variants, foreign statics, functions, inherent impl blocks, macro defs, modules, statics, struct fields, traits, type aliases, and use statements error: `#[deprecated]` attribute cannot be used on where predicates - --> $DIR/unsupported_attribute.rs:25:5 + --> $DIR/unsupported_attribute.rs:24:5 | LL | #[deprecated] 'a: 'static, | ^^^^^^^^^^^^^ @@ -75,7 +75,7 @@ LL | #[deprecated] 'a: 'static, = help: `#[deprecated]` can be applied to associated consts, associated types, constants, crates, data types, enum variants, foreign statics, functions, inherent impl blocks, macro defs, modules, statics, struct fields, traits, type aliases, and use statements error: `#[automatically_derived]` attribute cannot be used on where predicates - --> $DIR/unsupported_attribute.rs:26:5 + --> $DIR/unsupported_attribute.rs:25:5 | LL | #[automatically_derived] T: Trait, | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -83,7 +83,7 @@ LL | #[automatically_derived] T: Trait, = help: `#[automatically_derived]` can only be applied to trait impl blocks error: `#[automatically_derived]` attribute cannot be used on where predicates - --> $DIR/unsupported_attribute.rs:27:5 + --> $DIR/unsupported_attribute.rs:26:5 | LL | #[automatically_derived] 'a: 'static, | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -91,7 +91,7 @@ LL | #[automatically_derived] 'a: 'static, = help: `#[automatically_derived]` can only be applied to trait impl blocks error: most attributes are not supported in `where` clauses - --> $DIR/unsupported_attribute.rs:14:5 + --> $DIR/unsupported_attribute.rs:13:5 | LL | #[doc = "doc"] T: Trait, | ^^^^^^^^^^^^^^ @@ -99,7 +99,7 @@ LL | #[doc = "doc"] T: Trait, = help: only `#[cfg]` and `#[cfg_attr]` are supported error: most attributes are not supported in `where` clauses - --> $DIR/unsupported_attribute.rs:15:5 + --> $DIR/unsupported_attribute.rs:14:5 | LL | #[doc = "doc"] 'a: 'static, | ^^^^^^^^^^^^^^ @@ -107,7 +107,7 @@ LL | #[doc = "doc"] 'a: 'static, = help: only `#[cfg]` and `#[cfg_attr]` are supported error: most attributes are not supported in `where` clauses - --> $DIR/unsupported_attribute.rs:22:5 + --> $DIR/unsupported_attribute.rs:21:5 | LL | #[allow(unused)] T: Trait, | ^^^^^^^^^^^^^^^^ @@ -115,7 +115,7 @@ LL | #[allow(unused)] T: Trait, = help: only `#[cfg]` and `#[cfg_attr]` are supported error: most attributes are not supported in `where` clauses - --> $DIR/unsupported_attribute.rs:23:5 + --> $DIR/unsupported_attribute.rs:22:5 | LL | #[allow(unused)] 'a: 'static, | ^^^^^^^^^^^^^^^^ @@ -123,7 +123,7 @@ LL | #[allow(unused)] 'a: 'static, = help: only `#[cfg]` and `#[cfg_attr]` are supported error: most attributes are not supported in `where` clauses - --> $DIR/unsupported_attribute.rs:28:5 + --> $DIR/unsupported_attribute.rs:27:5 | LL | #[derive(Clone)] T: Trait, | ^^^^^^^^^^^^^^^^ @@ -131,7 +131,7 @@ LL | #[derive(Clone)] T: Trait, = help: only `#[cfg]` and `#[cfg_attr]` are supported error: most attributes are not supported in `where` clauses - --> $DIR/unsupported_attribute.rs:31:5 + --> $DIR/unsupported_attribute.rs:30:5 | LL | #[derive(Clone)] 'a: 'static, | ^^^^^^^^^^^^^^^^ @@ -139,7 +139,7 @@ LL | #[derive(Clone)] 'a: 'static, = help: only `#[cfg]` and `#[cfg_attr]` are supported error: most attributes are not supported in `where` clauses - --> $DIR/unsupported_attribute.rs:34:5 + --> $DIR/unsupported_attribute.rs:33:5 | LL | #[rustfmt::skip] T: Trait, | ^^^^^^^^^^^^^^^^ @@ -147,7 +147,7 @@ LL | #[rustfmt::skip] T: Trait, = help: only `#[cfg]` and `#[cfg_attr]` are supported error: most attributes are not supported in `where` clauses - --> $DIR/unsupported_attribute.rs:35:5 + --> $DIR/unsupported_attribute.rs:34:5 | LL | #[rustfmt::skip] 'a: 'static, | ^^^^^^^^^^^^^^^^ From f1bd64704781317a8c37f183ba212aa6fc1ea5a7 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Tue, 10 Mar 2026 12:19:33 +0100 Subject: [PATCH 10/35] Revert "Merge pull request #1871 from folkertdev/aarch64-float-min-max" This reverts commit 6a8a764262df5e65c06bc5d9180046a636a53ce9, reversing changes made to a37563b5f8cec0c873864b786c33d00386189916. --- .../core_arch/src/aarch64/neon/generated.rs | 360 ++++++++++++++++-- .../src/arm_shared/neon/generated.rs | 80 +++- .../spec/neon/aarch64.spec.yml | 85 ++++- .../spec/neon/arm_shared.spec.yml | 32 +- 4 files changed, 491 insertions(+), 66 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 de64839661d6e..c4968a68c42f4 100644 --- a/library/stdarch/crates/core_arch/src/aarch64/neon/generated.rs +++ b/library/stdarch/crates/core_arch/src/aarch64/neon/generated.rs @@ -13532,7 +13532,14 @@ 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 { simd_fmax(a, b) } + 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) } } #[doc = "Floating-point Maximum Number (vector)"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vmaxnmq_f64)"] @@ -13541,7 +13548,14 @@ 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 { simd_fmax(a, b) } + 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) } } #[doc = "Floating-point Maximum Number"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vmaxnmh_f16)"] @@ -13551,7 +13565,14 @@ pub fn vmaxnmq_f64(a: float64x2_t, b: float64x2_t) -> float64x2_t { #[cfg(not(target_arch = "arm64ec"))] #[cfg_attr(test, assert_instr(fmaxnm))] pub fn vmaxnmh_f16(a: f16, b: f16) -> f16 { - f16::max(a, b) + 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) } } #[doc = "Floating-point maximum number across vector"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vmaxnmv_f16)"] @@ -13561,7 +13582,14 @@ pub fn vmaxnmh_f16(a: f16, b: f16) -> f16 { #[cfg(not(target_arch = "arm64ec"))] #[cfg_attr(test, assert_instr(fmaxnmv))] pub fn vmaxnmv_f16(a: float16x4_t) -> f16 { - unsafe { simd_reduce_max(a) } + 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) } } #[doc = "Floating-point maximum number across vector"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vmaxnmvq_f16)"] @@ -13571,7 +13599,14 @@ pub fn vmaxnmv_f16(a: float16x4_t) -> f16 { #[cfg(not(target_arch = "arm64ec"))] #[cfg_attr(test, assert_instr(fmaxnmv))] pub fn vmaxnmvq_f16(a: float16x8_t) -> f16 { - unsafe { simd_reduce_max(a) } + 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) } } #[doc = "Floating-point maximum number across vector"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vmaxnmv_f32)"] @@ -13580,7 +13615,14 @@ 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 { simd_reduce_max(a) } + 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) } } #[doc = "Floating-point maximum number across vector"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vmaxnmvq_f64)"] @@ -13589,7 +13631,14 @@ 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 { simd_reduce_max(a) } + 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) } } #[doc = "Floating-point maximum number across vector"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vmaxnmvq_f32)"] @@ -13598,7 +13647,14 @@ 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 { simd_reduce_max(a) } + 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) } } #[doc = "Floating-point maximum number across vector"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vmaxv_f16)"] @@ -13689,7 +13745,14 @@ 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 { simd_reduce_max(a) } + 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) } } #[doc = "Horizontal vector max."] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vmaxvq_s8)"] @@ -13698,7 +13761,14 @@ 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 { simd_reduce_max(a) } + 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) } } #[doc = "Horizontal vector max."] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vmaxv_s16)"] @@ -13707,7 +13777,14 @@ 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 { simd_reduce_max(a) } + 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) } } #[doc = "Horizontal vector max."] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vmaxvq_s16)"] @@ -13716,7 +13793,14 @@ 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 { simd_reduce_max(a) } + 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) } } #[doc = "Horizontal vector max."] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vmaxv_s32)"] @@ -13725,7 +13809,14 @@ 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 { simd_reduce_max(a) } + 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) } } #[doc = "Horizontal vector max."] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vmaxvq_s32)"] @@ -13734,7 +13825,14 @@ 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 { simd_reduce_max(a) } + 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) } } #[doc = "Horizontal vector max."] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vmaxv_u8)"] @@ -13743,7 +13841,14 @@ 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 { simd_reduce_max(a) } + 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) } } #[doc = "Horizontal vector max."] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vmaxvq_u8)"] @@ -13752,7 +13857,14 @@ 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 { simd_reduce_max(a) } + 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) } } #[doc = "Horizontal vector max."] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vmaxv_u16)"] @@ -13761,7 +13873,14 @@ 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 { simd_reduce_max(a) } + 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) } } #[doc = "Horizontal vector max."] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vmaxvq_u16)"] @@ -13770,7 +13889,14 @@ 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 { simd_reduce_max(a) } + 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) } } #[doc = "Horizontal vector max."] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vmaxv_u32)"] @@ -13779,7 +13905,14 @@ 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 { simd_reduce_max(a) } + 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) } } #[doc = "Horizontal vector max."] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vmaxvq_u32)"] @@ -13788,7 +13921,14 @@ 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 { simd_reduce_max(a) } + 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) } } #[doc = "Minimum (vector)"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vmin_f64)"] @@ -13846,7 +13986,14 @@ 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 { simd_fmin(a, b) } + 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) } } #[doc = "Floating-point Minimum Number (vector)"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vminnmq_f64)"] @@ -13855,7 +14002,14 @@ 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 { simd_fmin(a, b) } + 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) } } #[doc = "Floating-point Minimum Number"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vminnmh_f16)"] @@ -13865,7 +14019,14 @@ pub fn vminnmq_f64(a: float64x2_t, b: float64x2_t) -> float64x2_t { #[cfg(not(target_arch = "arm64ec"))] #[cfg_attr(test, assert_instr(fminnm))] pub fn vminnmh_f16(a: f16, b: f16) -> f16 { - f16::min(a, b) + 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) } } #[doc = "Floating-point minimum number across vector"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vminnmv_f16)"] @@ -13875,7 +14036,14 @@ pub fn vminnmh_f16(a: f16, b: f16) -> f16 { #[cfg(not(target_arch = "arm64ec"))] #[cfg_attr(test, assert_instr(fminnmv))] pub fn vminnmv_f16(a: float16x4_t) -> f16 { - unsafe { simd_reduce_min(a) } + 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) } } #[doc = "Floating-point minimum number across vector"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vminnmvq_f16)"] @@ -13885,7 +14053,14 @@ pub fn vminnmv_f16(a: float16x4_t) -> f16 { #[cfg(not(target_arch = "arm64ec"))] #[cfg_attr(test, assert_instr(fminnmv))] pub fn vminnmvq_f16(a: float16x8_t) -> f16 { - unsafe { simd_reduce_min(a) } + 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) } } #[doc = "Floating-point minimum number across vector"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vminnmv_f32)"] @@ -13894,7 +14069,14 @@ 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 { simd_reduce_min(a) } + 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) } } #[doc = "Floating-point minimum number across vector"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vminnmvq_f64)"] @@ -13903,7 +14085,14 @@ 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 { simd_reduce_min(a) } + 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) } } #[doc = "Floating-point minimum number across vector"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vminnmvq_f32)"] @@ -13912,7 +14101,14 @@ 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 { simd_reduce_min(a) } + 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) } } #[doc = "Floating-point minimum number across vector"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vminv_f16)"] @@ -14003,7 +14199,14 @@ 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 { simd_reduce_min(a) } + 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) } } #[doc = "Horizontal vector min."] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vminvq_s8)"] @@ -14012,7 +14215,14 @@ 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 { simd_reduce_min(a) } + 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) } } #[doc = "Horizontal vector min."] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vminv_s16)"] @@ -14021,7 +14231,14 @@ 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 { simd_reduce_min(a) } + 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) } } #[doc = "Horizontal vector min."] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vminvq_s16)"] @@ -14030,7 +14247,14 @@ 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 { simd_reduce_min(a) } + 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) } } #[doc = "Horizontal vector min."] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vminv_s32)"] @@ -14039,7 +14263,14 @@ 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 { simd_reduce_min(a) } + 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) } } #[doc = "Horizontal vector min."] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vminvq_s32)"] @@ -14048,7 +14279,14 @@ 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 { simd_reduce_min(a) } + 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) } } #[doc = "Horizontal vector min."] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vminv_u8)"] @@ -14057,7 +14295,14 @@ 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 { simd_reduce_min(a) } + 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) } } #[doc = "Horizontal vector min."] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vminvq_u8)"] @@ -14066,7 +14311,14 @@ 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 { simd_reduce_min(a) } + 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) } } #[doc = "Horizontal vector min."] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vminv_u16)"] @@ -14075,7 +14327,14 @@ 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 { simd_reduce_min(a) } + 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) } } #[doc = "Horizontal vector min."] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vminvq_u16)"] @@ -14084,7 +14343,14 @@ 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 { simd_reduce_min(a) } + 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) } } #[doc = "Horizontal vector min."] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vminv_u32)"] @@ -14093,7 +14359,14 @@ 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 { simd_reduce_min(a) } + 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) } } #[doc = "Horizontal vector min."] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vminvq_u32)"] @@ -14102,7 +14375,14 @@ 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 { simd_reduce_min(a) } + 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) } } #[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/core_arch/src/arm_shared/neon/generated.rs b/library/stdarch/crates/core_arch/src/arm_shared/neon/generated.rs index a7c33917a88cc..4a846e2877462 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 @@ -25891,7 +25891,15 @@ pub fn vmaxq_u32(a: uint32x4_t, b: uint32x4_t) -> uint32x4_t { )] #[cfg(not(target_arch = "arm64ec"))] pub fn vmaxnm_f16(a: float16x4_t, b: float16x4_t) -> float16x4_t { - unsafe { simd_fmax(a, b) } + 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) } } #[doc = "Floating-point Maximum Number (vector)"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vmaxnmq_f16)"] @@ -25913,7 +25921,15 @@ pub fn vmaxnm_f16(a: float16x4_t, b: float16x4_t) -> float16x4_t { )] #[cfg(not(target_arch = "arm64ec"))] pub fn vmaxnmq_f16(a: float16x8_t, b: float16x8_t) -> float16x8_t { - unsafe { simd_fmax(a, b) } + 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) } } #[doc = "Floating-point Maximum Number (vector)"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vmaxnm_f32)"] @@ -25934,7 +25950,15 @@ 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 { simd_fmax(a, b) } + 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) } } #[doc = "Floating-point Maximum Number (vector)"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vmaxnmq_f32)"] @@ -25955,7 +25979,15 @@ 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 { simd_fmax(a, b) } + 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) } } #[doc = "Minimum (vector)"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vmin_f16)"] @@ -26383,7 +26415,15 @@ pub fn vminq_u32(a: uint32x4_t, b: uint32x4_t) -> uint32x4_t { )] #[cfg(not(target_arch = "arm64ec"))] pub fn vminnm_f16(a: float16x4_t, b: float16x4_t) -> float16x4_t { - unsafe { simd_fmin(a, b) } + 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) } } #[doc = "Floating-point Minimum Number (vector)"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vminnmq_f16)"] @@ -26405,7 +26445,15 @@ pub fn vminnm_f16(a: float16x4_t, b: float16x4_t) -> float16x4_t { )] #[cfg(not(target_arch = "arm64ec"))] pub fn vminnmq_f16(a: float16x8_t, b: float16x8_t) -> float16x8_t { - unsafe { simd_fmin(a, b) } + 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) } } #[doc = "Floating-point Minimum Number (vector)"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vminnm_f32)"] @@ -26426,7 +26474,15 @@ 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 { simd_fmin(a, b) } + 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) } } #[doc = "Floating-point Minimum Number (vector)"] #[doc = "[Arm's documentation](https://developer.arm.com/architectures/instruction-sets/intrinsics/vminnmq_f32)"] @@ -26447,7 +26503,15 @@ 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 { simd_fmin(a, b) } + 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) } } #[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/aarch64.spec.yml b/library/stdarch/crates/stdarch-gen-arm/spec/neon/aarch64.spec.yml index 8574aacee6671..2b4282e8035b1 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 @@ -6625,6 +6625,7 @@ intrinsics: arch: aarch64,arm64ec + - name: "vmaxnm{neon_type.no}" doc: Floating-point Maximum Number (vector) arguments: ["a: {neon_type}", "b: {neon_type}"] @@ -6636,7 +6637,11 @@ intrinsics: - float64x1_t - float64x2_t compose: - - FnCall: [simd_fmax, [a, b]] + - LLVMLink: + name: "fmaxnm.{neon_type}" + links: + - link: "llvm.aarch64.neon.fmaxnm.{neon_type}" + arch: aarch64,arm64ec - name: "vmaxnmh_{type}" @@ -6652,7 +6657,11 @@ intrinsics: types: - f16 compose: - - FnCall: ["f16::max", [a, b]] + - LLVMLink: + name: "vmaxh.{neon_type}" + links: + - link: "llvm.aarch64.neon.fmaxnm.{type}" + arch: aarch64,arm64ec - name: "vminnmh_{type}" @@ -6668,7 +6677,11 @@ intrinsics: types: - f16 compose: - - FnCall: ["f16::min", [a, b]] + - LLVMLink: + name: "vminh.{neon_type}" + links: + - link: "llvm.aarch64.neon.fminnm.{type}" + arch: aarch64,arm64ec - name: "vmaxnmv{neon_type[0].no}" @@ -6682,7 +6695,11 @@ intrinsics: - [float32x2_t, f32] - [float64x2_t, f64] compose: - - FnCall: [simd_reduce_max, [a]] + - LLVMLink: + name: "fmaxnmv.{neon_type[0]}" + links: + - link: "llvm.aarch64.neon.fmaxnmv.{type[1]}.{neon_type[0]}" + arch: aarch64,arm64ec - name: "vmaxnmv{neon_type[0].no}" doc: Floating-point maximum number across vector @@ -6694,7 +6711,11 @@ intrinsics: types: - [float32x4_t, f32] compose: - - FnCall: [simd_reduce_max, [a]] + - LLVMLink: + name: "fmaxnmv.{neon_type[0]}" + links: + - link: "llvm.aarch64.neon.fmaxnmv.{type[1]}.{neon_type[0]}" + arch: aarch64,arm64ec - name: "vmaxnmv{neon_type[0].no}" @@ -6711,7 +6732,11 @@ intrinsics: - [float16x4_t, f16] - [float16x8_t, f16] compose: - - FnCall: [simd_reduce_max, [a]] + - LLVMLink: + name: "fmaxnmv.{neon_type[0]}" + links: + - link: "llvm.aarch64.neon.fmaxnmv.{type[1]}.{neon_type[0]}" + arch: aarch64,arm64ec - name: "vminnmv{neon_type[0].no}" @@ -6728,7 +6753,11 @@ intrinsics: - [float16x4_t, f16] - [float16x8_t, f16] compose: - - FnCall: [simd_reduce_min, [a]] + - LLVMLink: + name: "fminnmv.{neon_type[0]}" + links: + - link: "llvm.aarch64.neon.fminnmv.{type[1]}.{neon_type[0]}" + arch: aarch64,arm64ec - name: "vmaxv{neon_type[0].no}" @@ -6837,7 +6866,11 @@ intrinsics: - float64x1_t - float64x2_t compose: - - FnCall: [simd_fmin, [a, b]] + - LLVMLink: + name: "fminnm.{neon_type}" + links: + - link: "llvm.aarch64.neon.fminnm.{neon_type}" + arch: aarch64,arm64ec - name: "vminnmv{neon_type[0].no}" doc: "Floating-point minimum number across vector" @@ -6851,7 +6884,11 @@ intrinsics: - [float32x2_t, "f32"] - [float64x2_t, "f64"] compose: - - FnCall: [simd_reduce_min, [a]] + - LLVMLink: + name: "vminnmv.{neon_type[0]}" + links: + - link: "llvm.aarch64.neon.fminnmv.{type[1]}.{neon_type[0]}" + arch: aarch64,arm64ec - name: "vminnmv{neon_type[0].no}" doc: "Floating-point minimum number across vector" @@ -6864,7 +6901,11 @@ intrinsics: types: - [float32x4_t, "f32"] compose: - - FnCall: [simd_reduce_min, [a]] + - LLVMLink: + name: "vminnmv.{neon_type[0]}" + links: + - link: "llvm.aarch64.neon.fminnmv.{type[1]}.{neon_type[0]}" + arch: aarch64,arm64ec - name: "vmovl_high{neon_type[0].noq}" doc: Vector move @@ -13372,7 +13413,11 @@ intrinsics: - [int16x8_t, i16, 'smaxv'] - [int32x4_t, i32, 'smaxv'] compose: - - FnCall: [simd_reduce_max, [a]] + - LLVMLink: + name: "vmaxv{neon_type[0].no}" + links: + - link: "llvm.aarch64.neon.smaxv.{type[1]}.{neon_type[0]}" + arch: aarch64,arm64ec - name: "vmaxv{neon_type[0].no}" doc: "Horizontal vector max." @@ -13390,7 +13435,11 @@ intrinsics: - [uint16x8_t, u16, 'umaxv'] - [uint32x4_t, u32, 'umaxv'] compose: - - FnCall: [simd_reduce_max, [a]] + - LLVMLink: + name: "vmaxv{neon_type[0].no}" + links: + - link: "llvm.aarch64.neon.umaxv.{type[1]}.{neon_type[0]}" + arch: aarch64,arm64ec - name: "vmaxv{neon_type[0].no}" doc: "Horizontal vector max." @@ -13427,7 +13476,11 @@ intrinsics: - [int16x8_t, i16, 'sminv'] - [int32x4_t, i32, 'sminv'] compose: - - FnCall: [simd_reduce_min, [a]] + - LLVMLink: + name: "vminv{neon_type[0].no}" + links: + - link: "llvm.aarch64.neon.sminv.{type[1]}.{neon_type[0]}" + arch: aarch64,arm64ec - name: "vminv{neon_type[0].no}" doc: "Horizontal vector min." @@ -13445,7 +13498,11 @@ intrinsics: - [uint16x8_t, u16, 'uminv'] - [uint32x4_t, u32, 'uminv'] compose: - - FnCall: [simd_reduce_min, [a]] + - LLVMLink: + name: "vminv{neon_type[0].no}" + links: + - link: "llvm.aarch64.neon.uminv.{type[1]}.{neon_type[0]}" + arch: aarch64,arm64ec - name: "vminv{neon_type[0].no}" doc: "Horizontal vector min." 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 5104ae607ccff..56b2252c9ef0c 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 @@ -7324,7 +7324,13 @@ intrinsics: - float32x2_t - float32x4_t compose: - - FnCall: [simd_fmax, [a, b]] + - 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 - name: "vmaxnm{neon_type.no}" @@ -7344,7 +7350,13 @@ intrinsics: - float16x4_t - float16x8_t compose: - - FnCall: [simd_fmax, [a, b]] + - 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 - name: "vminnm{neon_type.no}" @@ -7364,7 +7376,13 @@ intrinsics: - float16x4_t - float16x8_t compose: - - FnCall: [simd_fmin, [a, b]] + - 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 - name: "vmin{neon_type.no}" @@ -7477,7 +7495,13 @@ intrinsics: - float32x2_t - float32x4_t compose: - - FnCall: [simd_fmin, [a, b]] + - 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 - name: "vpadd{neon_type.no}" doc: Floating-point add pairwise From 46bada398f1067c831f8ce0c45cef9348a216b17 Mon Sep 17 00:00:00 2001 From: Folkert de Vries Date: Tue, 10 Mar 2026 13:03:00 +0100 Subject: [PATCH 11/35] aarch64: use `simd_reduce_{min, max}` on 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 c4968a68c42f4..479a909a40a6e 100644 --- a/library/stdarch/crates/core_arch/src/aarch64/neon/generated.rs +++ b/library/stdarch/crates/core_arch/src/aarch64/neon/generated.rs @@ -13745,14 +13745,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)"] @@ -13761,14 +13754,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)"] @@ -13777,14 +13763,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)"] @@ -13793,14 +13772,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)"] @@ -13809,14 +13781,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)"] @@ -13825,14 +13790,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)"] @@ -13841,14 +13799,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)"] @@ -13857,14 +13808,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)"] @@ -13873,14 +13817,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)"] @@ -13889,14 +13826,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)"] @@ -13905,14 +13835,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)"] @@ -13921,14 +13844,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)"] @@ -14199,14 +14115,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)"] @@ -14215,14 +14124,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)"] @@ -14231,14 +14133,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)"] @@ -14247,14 +14142,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)"] @@ -14263,14 +14151,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)"] @@ -14279,14 +14160,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)"] @@ -14295,14 +14169,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)"] @@ -14311,14 +14178,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)"] @@ -14327,14 +14187,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)"] @@ -14343,14 +14196,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)"] @@ -14359,14 +14205,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)"] @@ -14375,14 +14214,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 2b4282e8035b1..f6f3e029f22e4 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 @@ -13413,11 +13413,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." @@ -13435,11 +13431,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." @@ -13476,11 +13468,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." @@ -13498,11 +13486,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 752a87fb4bc4b3ac702612c445b1869178caad85 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Tue, 10 Mar 2026 17:42:37 +0100 Subject: [PATCH 12/35] s390x: use llvm.s390 intrinsics instead of simd_fmin/fmax --- .../crates/core_arch/src/s390x/vector.rs | 37 +++++++++++++++++-- 1 file changed, 33 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 346cd674df665..2f31eb48f88e4 100644 --- a/library/stdarch/crates/core_arch/src/s390x/vector.rs +++ b/library/stdarch/crates/core_arch/src/s390x/vector.rs @@ -335,6 +335,11 @@ unsafe extern "unadjusted" { #[link_name = "llvm.s390.vcfn"] fn vcfn(a: vector_signed_short, immarg: i32) -> vector_signed_short; #[link_name = "llvm.s390.vcnf"] fn vcnf(a: vector_signed_short, immarg: i32) -> vector_signed_short; #[link_name = "llvm.s390.vcrnfs"] fn vcrnfs(a: vector_float, b: vector_float, immarg: i32) -> vector_signed_short; + + #[link_name = "llvm.s390.vfmaxsb"] fn vfmaxsb(a: vector_float, b: vector_float, mode: i32) -> vector_float; + #[link_name = "llvm.s390.vfmaxdb"] fn vfmaxdb(a: vector_double, b: vector_double, mode: i32) -> vector_double; + #[link_name = "llvm.s390.vfminsb"] fn vfminsb(a: vector_float, b: vector_float, mode: i32) -> vector_float; + #[link_name = "llvm.s390.vfmindb"] fn vfmindb(a: vector_double, b: vector_double, mode: i32) -> vector_double; } #[repr(simd)] @@ -780,8 +785,20 @@ mod sealed { impl_max!(vec_vmxslg, vector_unsigned_long_long, vmxlg); } - test_impl! { vec_vfmaxsb (a: vector_float, b: vector_float) -> vector_float [simd_fmax, "vector-enhancements-1" vfmaxsb ] } - test_impl! { vec_vfmaxdb (a: vector_double, b: vector_double) -> vector_double [simd_fmax, "vector-enhancements-1" vfmaxdb] } + #[inline] + #[target_feature(enable = "vector")] + unsafe fn vfmaxsb_m0(a: vector_float, b: vector_float) -> vector_float { + // clang uses mode 0 for `vec_max`, so we do the same. + vfmaxsb(a, b, const { 0 }) + } + #[inline] + #[target_feature(enable = "vector")] + unsafe fn vfmaxdb_m0(a: vector_double, b: vector_double) -> vector_double { + vfmaxdb(a, b, const { 0 }) + } + + test_impl! { vec_vfmaxsb (a: vector_float, b: vector_float) -> vector_float [vfmaxsb_m0, "vector-enhancements-1" vfmaxsb ] } + test_impl! { vec_vfmaxdb (a: vector_double, b: vector_double) -> vector_double [vfmaxdb_m0, "vector-enhancements-1" vfmaxdb] } impl_vec_trait!([VectorMax vec_max] vec_vfmaxsb (vector_float, vector_float) -> vector_float); impl_vec_trait!([VectorMax vec_max] vec_vfmaxdb (vector_double, vector_double) -> vector_double); @@ -827,8 +844,20 @@ mod sealed { impl_min!(vec_vmnslg, vector_unsigned_long_long, vmnlg); } - test_impl! { vec_vfminsb (a: vector_float, b: vector_float) -> vector_float [simd_fmin, "vector-enhancements-1" vfminsb] } - test_impl! { vec_vfmindb (a: vector_double, b: vector_double) -> vector_double [simd_fmin, "vector-enhancements-1" vfmindb] } + #[inline] + #[target_feature(enable = "vector")] + unsafe fn vfminsb_m0(a: vector_float, b: vector_float) -> vector_float { + // clang uses mode 0 for `vec_min`, so we do the same. + vfminsb(a, b, const { 0 }) + } + #[inline] + #[target_feature(enable = "vector")] + unsafe fn vfmindb_m0(a: vector_double, b: vector_double) -> vector_double { + vfmindb(a, b, const { 0 }) + } + + test_impl! { vec_vfminsb (a: vector_float, b: vector_float) -> vector_float [vfminsb_m0, "vector-enhancements-1" vfminsb] } + test_impl! { vec_vfmindb (a: vector_double, b: vector_double) -> vector_double [vfmindb_m0, "vector-enhancements-1" vfmindb] } impl_vec_trait!([VectorMin vec_min] vec_vfminsb (vector_float, vector_float) -> vector_float); impl_vec_trait!([VectorMin vec_min] vec_vfmindb (vector_double, vector_double) -> vector_double); From 47d82e245a2da73f9207ef476995a0c3b090e677 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Tue, 10 Mar 2026 23:26:51 +0100 Subject: [PATCH 13/35] add f32 min/max tests --- .../stdarch/crates/core_arch/src/s390x/vector.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/library/stdarch/crates/core_arch/src/s390x/vector.rs b/library/stdarch/crates/core_arch/src/s390x/vector.rs index 2f31eb48f88e4..33921eca5f2aa 100644 --- a/library/stdarch/crates/core_arch/src/s390x/vector.rs +++ b/library/stdarch/crates/core_arch/src/s390x/vector.rs @@ -7506,6 +7506,19 @@ mod tests { [0, !0, !0, !0] } + // f32 is the tricky case for max/min as that needs a fallback on z13 + test_vec_2! { test_vec_max, vec_max, f32x4, f32x4 -> f32x4, + [1.0, f32::NAN, f32::INFINITY, 2.0], + [-10.0, -10.0, 5.0, f32::NAN], + [1.0, -10.0, f32::INFINITY, 2.0] + } + + test_vec_2! { test_vec_min, vec_min, f32x4, f32x4 -> f32x4, + [1.0, f32::NAN, f32::INFINITY, 2.0], + [-10.0, -10.0, 5.0, f32::NAN], + [-10.0, -10.0, 5.0, 2.0] + } + #[simd_test(enable = "vector")] fn test_vec_meadd() { let a = vector_unsigned_short([1, 0, 2, 0, 3, 0, 4, 0]); From a6687175c9c177457602efc47c0d52e0e6a69d52 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Wed, 11 Mar 2026 08:52:03 +0100 Subject: [PATCH 14/35] go back to portable LLVM intrinsic to avoid fallback trouble --- .../crates/core_arch/src/s390x/vector.rs | 49 +++++++------------ 1 file changed, 17 insertions(+), 32 deletions(-) diff --git a/library/stdarch/crates/core_arch/src/s390x/vector.rs b/library/stdarch/crates/core_arch/src/s390x/vector.rs index 33921eca5f2aa..31b9dc5eac70b 100644 --- a/library/stdarch/crates/core_arch/src/s390x/vector.rs +++ b/library/stdarch/crates/core_arch/src/s390x/vector.rs @@ -336,10 +336,19 @@ unsafe extern "unadjusted" { #[link_name = "llvm.s390.vcnf"] fn vcnf(a: vector_signed_short, immarg: i32) -> vector_signed_short; #[link_name = "llvm.s390.vcrnfs"] fn vcrnfs(a: vector_float, b: vector_float, immarg: i32) -> vector_signed_short; - #[link_name = "llvm.s390.vfmaxsb"] fn vfmaxsb(a: vector_float, b: vector_float, mode: i32) -> vector_float; - #[link_name = "llvm.s390.vfmaxdb"] fn vfmaxdb(a: vector_double, b: vector_double, mode: i32) -> vector_double; - #[link_name = "llvm.s390.vfminsb"] fn vfminsb(a: vector_float, b: vector_float, mode: i32) -> vector_float; - #[link_name = "llvm.s390.vfmindb"] fn vfmindb(a: vector_double, b: vector_double, mode: i32) -> vector_double; + // These are the intrinsics we'd like to use (with mode 0). However, they require + // "vector-enhancements-1" and don't have a fallback, whereas `vec_min`/`vec_max` should be + // available with just "vector". Therefore, we cannot use them. + // #[link_name = "llvm.s390.vfmaxsb"] fn vfmaxsb(a: vector_float, b: vector_float, mode: i32) -> vector_float; + // #[link_name = "llvm.s390.vfmaxdb"] fn vfmaxdb(a: vector_double, b: vector_double, mode: i32) -> vector_double; + // #[link_name = "llvm.s390.vfminsb"] fn vfminsb(a: vector_float, b: vector_float, mode: i32) -> vector_float; + // #[link_name = "llvm.s390.vfmindb"] fn vfmindb(a: vector_double, b: vector_double, mode: i32) -> vector_double; + // Instead, we use "portable" LLVM intrinsics -- even though those have the wrong semantics + // (https://github.com/rust-lang/stdarch/issues/2060), they usually do the right thing. + #[link_name = "llvm.minnum.v4f32"] fn minnum_v4f32(a: vector_float, b: vector_float) -> vector_float; + #[link_name = "llvm.minnum.v2f64"] fn minnum_v2f64(a: vector_double, b: vector_double) -> vector_double; + #[link_name = "llvm.maxnum.v4f32"] fn maxnum_v4f32(a: vector_float, b: vector_float) -> vector_float; + #[link_name = "llvm.maxnum.v2f64"] fn maxnum_v2f64(a: vector_double, b: vector_double) -> vector_double; } #[repr(simd)] @@ -785,20 +794,8 @@ mod sealed { impl_max!(vec_vmxslg, vector_unsigned_long_long, vmxlg); } - #[inline] - #[target_feature(enable = "vector")] - unsafe fn vfmaxsb_m0(a: vector_float, b: vector_float) -> vector_float { - // clang uses mode 0 for `vec_max`, so we do the same. - vfmaxsb(a, b, const { 0 }) - } - #[inline] - #[target_feature(enable = "vector")] - unsafe fn vfmaxdb_m0(a: vector_double, b: vector_double) -> vector_double { - vfmaxdb(a, b, const { 0 }) - } - - test_impl! { vec_vfmaxsb (a: vector_float, b: vector_float) -> vector_float [vfmaxsb_m0, "vector-enhancements-1" vfmaxsb ] } - test_impl! { vec_vfmaxdb (a: vector_double, b: vector_double) -> vector_double [vfmaxdb_m0, "vector-enhancements-1" vfmaxdb] } + test_impl! { vec_vfmaxsb (a: vector_float, b: vector_float) -> vector_float [maxnum_v4f32, "vector-enhancements-1" vfmaxsb] } + test_impl! { vec_vfmaxdb (a: vector_double, b: vector_double) -> vector_double [maxnum_v2f64, "vector-enhancements-1" vfmaxdb] } impl_vec_trait!([VectorMax vec_max] vec_vfmaxsb (vector_float, vector_float) -> vector_float); impl_vec_trait!([VectorMax vec_max] vec_vfmaxdb (vector_double, vector_double) -> vector_double); @@ -844,20 +841,8 @@ mod sealed { impl_min!(vec_vmnslg, vector_unsigned_long_long, vmnlg); } - #[inline] - #[target_feature(enable = "vector")] - unsafe fn vfminsb_m0(a: vector_float, b: vector_float) -> vector_float { - // clang uses mode 0 for `vec_min`, so we do the same. - vfminsb(a, b, const { 0 }) - } - #[inline] - #[target_feature(enable = "vector")] - unsafe fn vfmindb_m0(a: vector_double, b: vector_double) -> vector_double { - vfmindb(a, b, const { 0 }) - } - - test_impl! { vec_vfminsb (a: vector_float, b: vector_float) -> vector_float [vfminsb_m0, "vector-enhancements-1" vfminsb] } - test_impl! { vec_vfmindb (a: vector_double, b: vector_double) -> vector_double [vfmindb_m0, "vector-enhancements-1" vfmindb] } + test_impl! { vec_vfminsb (a: vector_float, b: vector_float) -> vector_float [minnum_v4f32, "vector-enhancements-1" vfminsb] } + test_impl! { vec_vfmindb (a: vector_double, b: vector_double) -> vector_double [minnum_v2f64, "vector-enhancements-1" vfmindb] } impl_vec_trait!([VectorMin vec_min] vec_vfminsb (vector_float, vector_float) -> vector_float); impl_vec_trait!([VectorMin vec_min] vec_vfmindb (vector_double, vector_double) -> vector_double); From 80b869876a07179e400e3aba4e53465fc5ecd4c5 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Wed, 11 Mar 2026 18:31:49 +0100 Subject: [PATCH 15/35] s390x: add f64 tests for vec_min --- .../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 31b9dc5eac70b..376c912c04090 100644 --- a/library/stdarch/crates/core_arch/src/s390x/vector.rs +++ b/library/stdarch/crates/core_arch/src/s390x/vector.rs @@ -7491,19 +7491,30 @@ mod tests { [0, !0, !0, !0] } - // f32 is the tricky case for max/min as that needs a fallback on z13 - test_vec_2! { test_vec_max, vec_max, f32x4, f32x4 -> f32x4, + test_vec_2! { test_vec_max_f32, vec_max, f32x4, f32x4 -> f32x4, [1.0, f32::NAN, f32::INFINITY, 2.0], [-10.0, -10.0, 5.0, f32::NAN], [1.0, -10.0, f32::INFINITY, 2.0] } - test_vec_2! { test_vec_min, vec_min, f32x4, f32x4 -> f32x4, + test_vec_2! { test_vec_min_f32, vec_min, f32x4, f32x4 -> f32x4, [1.0, f32::NAN, f32::INFINITY, 2.0], [-10.0, -10.0, 5.0, f32::NAN], [-10.0, -10.0, 5.0, 2.0] } + test_vec_2! { test_vec_max_f64, vec_max, f64x2, f64x2 -> f64x2, + [f64::NAN, 2.0], + [-10.0, f64::NAN], + [-10.0, 2.0] + } + + test_vec_2! { test_vec_min_f64, vec_min, f64x2, f64x2 -> f64x2, + [f64::NAN, 2.0], + [-10.0, f64::NAN], + [-10.0, 2.0] + } + #[simd_test(enable = "vector")] fn test_vec_meadd() { let a = vector_unsigned_short([1, 0, 2, 0, 3, 0, 4, 0]); From 4f10c640d16e79e17924cfe6f2f60f45d43b1cac Mon Sep 17 00:00:00 2001 From: Folkert de Vries Date: Thu, 12 Mar 2026 10:37:52 +0100 Subject: [PATCH 16/35] remove `cfg_attr` on `aarch64`/`arm64ec` in the aarch64 module --- .../crates/core_arch/src/aarch64/mte.rs | 30 ++++--------------- .../crates/core_arch/src/aarch64/rand.rs | 10 ++----- 2 files changed, 8 insertions(+), 32 deletions(-) diff --git a/library/stdarch/crates/core_arch/src/aarch64/mte.rs b/library/stdarch/crates/core_arch/src/aarch64/mte.rs index c400f774bcce0..1b05eb3498efa 100644 --- a/library/stdarch/crates/core_arch/src/aarch64/mte.rs +++ b/library/stdarch/crates/core_arch/src/aarch64/mte.rs @@ -3,35 +3,17 @@ //! [ACLE documentation](https://arm-software.github.io/acle/main/acle.html#markdown-toc-mte-intrinsics) unsafe extern "unadjusted" { - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.irg" - )] + #[link_name = "llvm.aarch64.irg"] fn irg_(ptr: *const (), exclude: i64) -> *const (); - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.gmi" - )] + #[link_name = "llvm.aarch64.gmi"] fn gmi_(ptr: *const (), exclude: i64) -> i64; - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.ldg" - )] + #[link_name = "llvm.aarch64.ldg"] fn ldg_(ptr: *const (), tag_ptr: *const ()) -> *const (); - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.stg" - )] + #[link_name = "llvm.aarch64.stg"] fn stg_(tagged_ptr: *const (), addr_to_tag: *const ()); - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.addg" - )] + #[link_name = "llvm.aarch64.addg"] fn addg_(ptr: *const (), value: i64) -> *const (); - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.subp" - )] + #[link_name = "llvm.aarch64.subp"] fn subp_(ptr_a: *const (), ptr_b: *const ()) -> i64; } diff --git a/library/stdarch/crates/core_arch/src/aarch64/rand.rs b/library/stdarch/crates/core_arch/src/aarch64/rand.rs index 5492fd014401a..17b616f4ecf4c 100644 --- a/library/stdarch/crates/core_arch/src/aarch64/rand.rs +++ b/library/stdarch/crates/core_arch/src/aarch64/rand.rs @@ -3,16 +3,10 @@ //! [ACLE documentation](https://arm-software.github.io/acle/main/acle.html#random-number-generation-intrinsics) unsafe extern "unadjusted" { - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.rndr" - )] + #[link_name = "llvm.aarch64.rndr"] fn rndr_() -> Tuple; - #[cfg_attr( - any(target_arch = "aarch64", target_arch = "arm64ec"), - link_name = "llvm.aarch64.rndrrs" - )] + #[link_name = "llvm.aarch64.rndrrs"] fn rndrrs_() -> Tuple; } From 30c24f45301ae5636dc84c4336d62fa7b8134224 Mon Sep 17 00:00:00 2001 From: anonymous Date: Thu, 12 Mar 2026 16:05:20 -0700 Subject: [PATCH 17/35] ci: update to actions/checkout@v6 ci is showing a lot of warnings (72) right now. apparently actions/checkout@v4 uses Node.js 20, and all github actions are scheduled to be force opted-in to Node.js 24 on 2026-06-02. I don't anticipate bumping the checkout action to v6 / Node.js 24 to cause any issues (Node.js 24 drops support for ARM32 and macOS versions <= 13.4, but this shouldn't matter because we use Docker to test in those environments, not github runners natively) but if it does cause issues it's probably better to find out now rather than by surprise 3 months from now... :) --- library/stdarch/.github/workflows/main.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/library/stdarch/.github/workflows/main.yml b/library/stdarch/.github/workflows/main.yml index 0ec355aa3ca4f..3749ed1f6ac81 100644 --- a/library/stdarch/.github/workflows/main.yml +++ b/library/stdarch/.github/workflows/main.yml @@ -8,7 +8,7 @@ jobs: name: Check Style runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Install Rust run: rustup update nightly --no-self-update && rustup default nightly - run: ci/style.sh @@ -18,7 +18,7 @@ jobs: needs: [style] runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Install Rust run: rustup update nightly --no-self-update && rustup default nightly - run: ci/dox.sh @@ -30,7 +30,7 @@ jobs: needs: [style] runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Install Rust run: rustup update nightly --no-self-update && rustup default nightly - run: cargo test --manifest-path crates/stdarch-verify/Cargo.toml @@ -216,7 +216,7 @@ jobs: build_std: true steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Install Rust run: | rustup update nightly --no-self-update @@ -285,7 +285,7 @@ jobs: build_std: true steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Install Rust run: | rustup update nightly --no-self-update @@ -310,7 +310,7 @@ jobs: name: Check stdarch-gen-{arm, loongarch, hexagon} output runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Install Rust run: rustup update nightly && rustup default nightly && rustup component add rustfmt - name: Check arm spec From ccf7d4e978b1843ba6c6f448934791e35b0e2a7f Mon Sep 17 00:00:00 2001 From: Folkert de Vries Date: Thu, 12 Mar 2026 12:32:35 +0100 Subject: [PATCH 18/35] inline `assert_instr` tests --- .../crates/core_arch/src/aarch64/mte.rs | 16 +++++++----- .../crates/core_arch/src/aarch64/rand.rs | 25 ++++--------------- 2 files changed, 15 insertions(+), 26 deletions(-) diff --git a/library/stdarch/crates/core_arch/src/aarch64/mte.rs b/library/stdarch/crates/core_arch/src/aarch64/mte.rs index 1b05eb3498efa..a5031a45c1a0e 100644 --- a/library/stdarch/crates/core_arch/src/aarch64/mte.rs +++ b/library/stdarch/crates/core_arch/src/aarch64/mte.rs @@ -109,42 +109,46 @@ mod test { use super::*; use stdarch_test::assert_instr; - #[cfg_attr(all(test, not(target_env = "msvc")), assert_instr(irg))] // FIXME: MSVC `dumpbin` doesn't support MTE + // Instruction tests are separate because the functions use generics. + // + // FIXME: As of 2026 MSVC `dumpbin` doesn't support MTE. + + #[cfg_attr(not(target_env = "msvc"), assert_instr(irg))] #[allow(dead_code)] #[target_feature(enable = "mte")] unsafe fn test_arm_mte_create_random_tag(src: *const (), mask: u64) -> *const () { __arm_mte_create_random_tag(src, mask) } - #[cfg_attr(all(test, not(target_env = "msvc")), assert_instr(addg))] + #[cfg_attr(not(target_env = "msvc"), assert_instr(addg))] #[allow(dead_code)] #[target_feature(enable = "mte")] unsafe fn test_arm_mte_increment_tag(src: *const ()) -> *const () { __arm_mte_increment_tag::<1, _>(src) } - #[cfg_attr(all(test, not(target_env = "msvc")), assert_instr(gmi))] + #[cfg_attr(not(target_env = "msvc"), assert_instr(gmi))] #[allow(dead_code)] #[target_feature(enable = "mte")] unsafe fn test_arm_mte_exclude_tag(src: *const (), excluded: u64) -> u64 { __arm_mte_exclude_tag(src, excluded) } - #[cfg_attr(all(test, not(target_env = "msvc")), assert_instr(stg))] + #[cfg_attr(not(target_env = "msvc"), assert_instr(stg))] #[allow(dead_code)] #[target_feature(enable = "mte")] unsafe fn test_arm_mte_set_tag(src: *const ()) { __arm_mte_set_tag(src) } - #[cfg_attr(all(test, not(target_env = "msvc")), assert_instr(ldg))] + #[cfg_attr(not(target_env = "msvc"), assert_instr(ldg))] #[allow(dead_code)] #[target_feature(enable = "mte")] unsafe fn test_arm_mte_get_tag(src: *const ()) -> *const () { __arm_mte_get_tag(src) } - #[cfg_attr(all(test, not(target_env = "msvc")), assert_instr(subp))] + #[cfg_attr(not(target_env = "msvc"), assert_instr(subp))] #[allow(dead_code)] #[target_feature(enable = "mte")] unsafe fn test_arm_mte_ptrdiff(a: *const (), b: *const ()) -> i64 { diff --git a/library/stdarch/crates/core_arch/src/aarch64/rand.rs b/library/stdarch/crates/core_arch/src/aarch64/rand.rs index 17b616f4ecf4c..3f52cf2ce8657 100644 --- a/library/stdarch/crates/core_arch/src/aarch64/rand.rs +++ b/library/stdarch/crates/core_arch/src/aarch64/rand.rs @@ -2,6 +2,9 @@ //! //! [ACLE documentation](https://arm-software.github.io/acle/main/acle.html#random-number-generation-intrinsics) +#[cfg(test)] +use stdarch_test::assert_instr; + unsafe extern "unadjusted" { #[link_name = "llvm.aarch64.rndr"] fn rndr_() -> Tuple; @@ -22,6 +25,7 @@ struct Tuple { /// is returned. #[inline] #[target_feature(enable = "rand")] +#[cfg_attr(test, assert_instr(mrs))] #[unstable(feature = "stdarch_aarch64_rand", issue = "153514")] pub unsafe fn __rndr(value: *mut u64) -> i32 { let Tuple { bits, status } = rndr_(); @@ -35,29 +39,10 @@ pub unsafe fn __rndr(value: *mut u64) -> i32 { /// to by the input is set to zero and a non-zero value is returned. #[inline] #[target_feature(enable = "rand")] +#[cfg_attr(test, assert_instr(mrs))] #[unstable(feature = "stdarch_aarch64_rand", issue = "153514")] pub unsafe fn __rndrrs(value: *mut u64) -> i32 { let Tuple { bits, status } = rndrrs_(); unsafe { *value = bits }; status as i32 } - -#[cfg(test)] -mod test { - use super::*; - use stdarch_test::assert_instr; - - #[cfg_attr(test, assert_instr(mrs))] - #[allow(dead_code)] - #[target_feature(enable = "rand")] - unsafe fn test_rndr(value: &mut u64) -> i32 { - __rndr(value) - } - - #[cfg_attr(test, assert_instr(mrs))] - #[allow(dead_code)] - #[target_feature(enable = "rand")] - unsafe fn test_rndrrs(value: &mut u64) -> i32 { - __rndrrs(value) - } -} From 3eb071edf929794d455c116350f2845202c13dca Mon Sep 17 00:00:00 2001 From: khyperia <953151+khyperia@users.noreply.github.com> Date: Fri, 13 Mar 2026 17:03:58 +0100 Subject: [PATCH 19/35] Flip "region lattice" in RegionKind doc comment --- compiler/rustc_type_ir/src/region_kind.rs | 66 ++++++++++--------- .../src/early-late-parameters.md | 6 ++ 2 files changed, 42 insertions(+), 30 deletions(-) diff --git a/compiler/rustc_type_ir/src/region_kind.rs b/compiler/rustc_type_ir/src/region_kind.rs index e08c274f9f147..3df2d8c489c6b 100644 --- a/compiler/rustc_type_ir/src/region_kind.rs +++ b/compiler/rustc_type_ir/src/region_kind.rs @@ -34,26 +34,26 @@ rustc_index::newtype_index! { /// In general, the region lattice looks like /// /// ```text -/// static ----------+-----...------+ (greatest) +/// empty(Un) -------- (smallest) +/// | \ +/// ... \ +/// | \ +/// empty(U1) -- \ +/// | \ placeholder(Un) +/// | \ | +/// empty(root) placeholder(U1) | /// | | | -/// param regions | | /// | | | /// | | | +/// param regions | | /// | | | -/// empty(root) placeholder(U1) | -/// | / | -/// | / placeholder(Un) -/// empty(U1) -- / -/// | / -/// ... / -/// | / -/// empty(Un) -------- (smallest) +/// static ----------+-----...------+ (greatest) /// ``` /// -/// Early-bound/free regions are the named lifetimes in scope from the -/// function declaration. They have relationships to one another -/// determined based on the declared relationships from the -/// function. +/// Lifetimes in scope from a function declaration are represented via +/// [`RegionKind::ReEarlyParam`]/[`RegionKind::ReLateParam`]. They +/// have relationships to one another and `'static` based on the +/// declared relationships from the function. /// /// Note that inference variables and bound regions are not included /// in this diagram. In the case of inference variables, they should @@ -62,29 +62,36 @@ rustc_index::newtype_index! { /// include -- the diagram indicates the relationship between free /// regions. /// +/// You can read more about the distinction between early and late bound +/// parameters in the rustc dev guide: [Early vs Late bound parameters]. +/// +/// A note on subtyping: If we assume that references take their region +/// covariantly, and use that to define the subtyping relationship of regions, +/// it may be somewhat surprising that `'empty` is Top and `'static` is Bottom, +/// and that "`'a` is a subtype of `'b`" is defined as "`'a` is bigger than +/// `'b`" - good to keep in mind. +/// /// ## Inference variables /// /// During region inference, we sometimes create inference variables, -/// represented as `ReVar`. These will be inferred by the code in -/// `infer::lexical_region_resolve` to some free region from the -/// lattice above (the minimal region that meets the +/// represented as [`RegionKind::ReVar`]. These will be inferred by +/// the code in `infer::lexical_region_resolve` to some free region +/// from the lattice above (the minimal region that meets the /// constraints). /// /// During NLL checking, where regions are defined differently, we -/// also use `ReVar` -- in that case, the index is used to index into -/// the NLL region checker's data structures. The variable may in fact -/// represent either a free region or an inference variable, in that -/// case. +/// also use [`RegionKind::ReVar`] -- in that case, the index is used +/// to index into the NLL region checker's data structures. The +/// variable may in fact represent either a free region or an +/// inference variable, in that case. /// /// ## Bound Regions /// /// These are regions that are stored behind a binder and must be instantiated -/// with some concrete region before being used. There are two kind of -/// bound regions: early-bound, which are bound in an item's `Generics`, -/// and are instantiated by an `GenericArgs`, and late-bound, which are part of -/// higher-ranked types (e.g., `for<'a> fn(&'a ())`), and are instantiated by -/// the likes of `liberate_late_bound_regions`. The distinction exists -/// because higher-ranked lifetimes aren't supported in all places. See [1][2]. +/// with some concrete region before being used. A type can be wrapped in a +/// `Binder`, which introduces new type/const/lifetime variables (e.g., `for<'a> +/// fn(&'a ())`). These parameters are referred to via [`RegionKind::ReBound`]. +/// You can instantiate them by the likes of `liberate_late_bound_regions`. /// /// Unlike `Param`s, bound regions are not supposed to exist "in the wild" /// outside their binder, e.g., in types passed to type inference, and @@ -123,8 +130,7 @@ rustc_index::newtype_index! { /// happen, you can use `leak_check`. This is more clearly explained /// by the [rustc dev guide]. /// -/// [1]: https://smallcultfollowing.com/babysteps/blog/2013/10/29/intermingled-parameter-lists/ -/// [2]: https://smallcultfollowing.com/babysteps/blog/2013/11/04/intermingled-parameter-lists/ +/// [Early vs Late bound parameters]: https://rustc-dev-guide.rust-lang.org/early-late-parameters.html /// [rustc dev guide]: https://rustc-dev-guide.rust-lang.org/traits/hrtb.html #[derive_where(Clone, Copy, Hash, PartialEq; I: Interner)] #[derive(GenericTypeVisitable)] @@ -160,7 +166,7 @@ pub enum RegionKind { /// more info about early and late bound lifetime parameters. ReLateParam(I::LateParamRegion), - /// Static data that has an "infinite" lifetime. Top in the region lattice. + /// Static data that has an "infinite" lifetime. Bottom in the region lattice. ReStatic, /// A region variable. Should not exist outside of type inference. diff --git a/src/doc/rustc-dev-guide/src/early-late-parameters.md b/src/doc/rustc-dev-guide/src/early-late-parameters.md index c472bdc2c4812..7651dee4ae23e 100644 --- a/src/doc/rustc-dev-guide/src/early-late-parameters.md +++ b/src/doc/rustc-dev-guide/src/early-late-parameters.md @@ -3,6 +3,12 @@ > **NOTE**: This chapter largely talks about early/late bound as being solely relevant when discussing function item types/function definitions. This is potentially not completely true, async blocks and closures should likely be discussed somewhat in this chapter. +See also these blog posts from when the distinction between early and late bound parameters was +introduced: [Intermingled parameter lists] and [Intermingled parameter lists, take 2]. + +[Intermingled parameter lists]: https://smallcultfollowing.com/babysteps/blog/2013/10/29/intermingled-parameter-lists/ +[Intermingled parameter lists, take 2]: https://smallcultfollowing.com/babysteps/blog/2013/11/04/intermingled-parameter-lists/ + ## What does it mean to be "early" bound or "late" bound Every function definition has a corresponding ZST that implements the `Fn*` traits known as a [function item type][function_item_type]. This part of the chapter will talk a little bit about the "desugaring" of function item types as it is useful context for explaining the difference between early bound and late bound generic parameters. From 39631fdac191893a6eb4d000d5b258e92cae2304 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Sun, 15 Mar 2026 01:50:36 +0000 Subject: [PATCH 20/35] Point at unit structs on foreign crates in type errors when they are the pattern of a let binding Consts and unit structs in patterns can be confusing if they are mistaken for new bindings. We already provide some context for unit structs and consts that come from the current crate, we now also point at those from foreign crates, and we properly skip cases where the pattern has type parameters which can't be confused with a new binding. Make new binding suggestion verbose. --- compiler/rustc_hir_typeck/src/pat.rs | 122 +++++++-------- tests/ui/blind/blind-item-block-middle.stderr | 6 +- .../const_in_pattern/arrays-and-slices.stderr | 24 ++- tests/ui/issues/issue-33504.stderr | 7 +- tests/ui/issues/issue-5100.stderr | 3 - tests/ui/match/issue-12552.stderr | 14 +- .../match-const-tuple-type-mismatch.stderr | 6 +- tests/ui/match/match-tag-nullary.stderr | 3 - .../mismatched-types-in-match-7867.stderr | 3 - .../private-unit-struct-assignment.stderr | 3 - tests/ui/resolve/name-clash-nullary.stderr | 10 ++ .../const.stderr | 7 +- tests/ui/suggestions/field-access.stderr | 9 -- .../suggest-deref-in-match-issue-132784.rs | 8 + ...suggest-deref-in-match-issue-132784.stderr | 140 +++++++++++++++--- .../type/pattern_types/matching_fail.stderr | 6 +- 16 files changed, 260 insertions(+), 111 deletions(-) diff --git a/compiler/rustc_hir_typeck/src/pat.rs b/compiler/rustc_hir_typeck/src/pat.rs index 7b5f5f3f520e4..314b50a12fc37 100644 --- a/compiler/rustc_hir_typeck/src/pat.rs +++ b/compiler/rustc_hir_typeck/src/pat.rs @@ -1636,69 +1636,75 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { span_bug!(pat_span, "unexpected resolution for path pattern: {resolved_pat:?}"); }; - if let Some(span) = self.tcx.hir_res_span(pat_res) { + let span = match (self.tcx.hir_res_span(pat_res), res.opt_def_id()) { + (Some(span), _) => span, + (None, Some(def_id)) => self.tcx.def_span(def_id), + (None, None) => { + e.emit(); + return; + } + }; + if let [hir::PathSegment { ident, args: None, .. }] = segments { e.span_label(span, format!("{} defined here", res.descr())); - if let [hir::PathSegment { ident, .. }] = segments { - e.span_label( - pat_span, - format!( - "`{}` is interpreted as {} {}, not a new binding", - ident, - res.article(), - res.descr(), - ), - ); - match self.tcx.parent_hir_node(hir_id) { - hir::Node::PatField(..) => { + e.span_label( + pat_span, + format!( + "`{}` is interpreted as {} {}, not a new binding", + ident, + res.article(), + res.descr(), + ), + ); + match self.tcx.parent_hir_node(hir_id) { + hir::Node::PatField(..) => { + e.span_suggestion_verbose( + ident.span.shrink_to_hi(), + "bind the struct field to a different name instead", + format!(": other_{}", ident.as_str().to_lowercase()), + Applicability::HasPlaceholders, + ); + } + _ => { + let (type_def_id, item_def_id) = match resolved_pat.ty.kind() { + ty::Adt(def, _) => match res { + Res::Def(DefKind::Const { .. }, def_id) => { + (Some(def.did()), Some(def_id)) + } + _ => (None, None), + }, + _ => (None, None), + }; + + let is_range = matches!( + type_def_id.and_then(|id| self.tcx.as_lang_item(id)), + Some( + LangItem::Range + | LangItem::RangeFrom + | LangItem::RangeTo + | LangItem::RangeFull + | LangItem::RangeInclusiveStruct + | LangItem::RangeToInclusive, + ) + ); + if is_range { + if !self.maybe_suggest_range_literal(&mut e, item_def_id, *ident) { + let msg = "constants only support matching by type, \ + if you meant to match against a range of values, \ + consider using a range pattern like `min ..= max` in the match block"; + e.note(msg); + } + } else { + let msg = "introduce a new binding instead"; + let sugg = format!("other_{}", ident.as_str().to_lowercase()); e.span_suggestion_verbose( - ident.span.shrink_to_hi(), - "bind the struct field to a different name instead", - format!(": other_{}", ident.as_str().to_lowercase()), + ident.span, + msg, + sugg, Applicability::HasPlaceholders, ); } - _ => { - let (type_def_id, item_def_id) = match resolved_pat.ty.kind() { - ty::Adt(def, _) => match res { - Res::Def(DefKind::Const { .. }, def_id) => { - (Some(def.did()), Some(def_id)) - } - _ => (None, None), - }, - _ => (None, None), - }; - - let is_range = matches!( - type_def_id.and_then(|id| self.tcx.as_lang_item(id)), - Some( - LangItem::Range - | LangItem::RangeFrom - | LangItem::RangeTo - | LangItem::RangeFull - | LangItem::RangeInclusiveStruct - | LangItem::RangeToInclusive, - ) - ); - if is_range { - if !self.maybe_suggest_range_literal(&mut e, item_def_id, *ident) { - let msg = "constants only support matching by type, \ - if you meant to match against a range of values, \ - consider using a range pattern like `min ..= max` in the match block"; - e.note(msg); - } - } else { - let msg = "introduce a new binding instead"; - let sugg = format!("other_{}", ident.as_str().to_lowercase()); - e.span_suggestion( - ident.span, - msg, - sugg, - Applicability::HasPlaceholders, - ); - } - } - }; - } + } + }; } e.emit(); } diff --git a/tests/ui/blind/blind-item-block-middle.stderr b/tests/ui/blind/blind-item-block-middle.stderr index b2ae169013a62..5c05f31ab8953 100644 --- a/tests/ui/blind/blind-item-block-middle.stderr +++ b/tests/ui/blind/blind-item-block-middle.stderr @@ -9,7 +9,11 @@ LL | let bar = 5; | | | expected integer, found `bar` | `bar` is interpreted as a unit struct, not a new binding - | help: introduce a new binding instead: `other_bar` + | +help: introduce a new binding instead + | +LL | let other_bar = 5; + | ++++++ error: aborting due to 1 previous error diff --git a/tests/ui/consts/const_in_pattern/arrays-and-slices.stderr b/tests/ui/consts/const_in_pattern/arrays-and-slices.stderr index 412caf60f7d85..8aa86c8b05f53 100644 --- a/tests/ui/consts/const_in_pattern/arrays-and-slices.stderr +++ b/tests/ui/consts/const_in_pattern/arrays-and-slices.stderr @@ -11,10 +11,14 @@ LL | BSTR_SIZED => {} | | | expected `&[u8]`, found `&[u8; 3]` | `BSTR_SIZED` is interpreted as a constant, not a new binding - | help: introduce a new binding instead: `other_bstr_sized` | = note: expected reference `&[u8]` found reference `&'static [u8; 3]` +help: introduce a new binding instead + | +LL - BSTR_SIZED => {} +LL + other_bstr_sized => {} + | error[E0308]: mismatched types --> $DIR/arrays-and-slices.rs:23:9 @@ -29,10 +33,14 @@ LL | STRUCT_SIZED => {} | | | expected `&SomeStruct<[u8]>`, found `&SomeStruct<[u8; 3]>` | `STRUCT_SIZED` is interpreted as a constant, not a new binding - | help: introduce a new binding instead: `other_struct_sized` | = note: expected reference `&SomeStruct<[u8]>` found reference `&'static SomeStruct<[u8; 3]>` +help: introduce a new binding instead + | +LL - STRUCT_SIZED => {} +LL + other_struct_sized => {} + | error[E0308]: mismatched types --> $DIR/arrays-and-slices.rs:30:9 @@ -47,10 +55,14 @@ LL | BSTR_SIZED => {} | | | expected `&[u8]`, found `&[u8; 3]` | `BSTR_SIZED` is interpreted as a constant, not a new binding - | help: introduce a new binding instead: `other_bstr_sized` | = note: expected reference `&[u8]` found reference `&'static [u8; 3]` +help: introduce a new binding instead + | +LL - BSTR_SIZED => {} +LL + other_bstr_sized => {} + | error[E0308]: mismatched types --> $DIR/arrays-and-slices.rs:37:9 @@ -65,10 +77,14 @@ LL | STRUCT_SIZED => {} | | | expected `&SomeStruct<[u8]>`, found `&SomeStruct<[u8; 3]>` | `STRUCT_SIZED` is interpreted as a constant, not a new binding - | help: introduce a new binding instead: `other_struct_sized` | = note: expected reference `&SomeStruct<[u8]>` found reference `&'static SomeStruct<[u8; 3]>` +help: introduce a new binding instead + | +LL - STRUCT_SIZED => {} +LL + other_struct_sized => {} + | error: cannot use unsized non-slice type `SomeStruct<[u8]>` in constant patterns --> $DIR/arrays-and-slices.rs:47:9 diff --git a/tests/ui/issues/issue-33504.stderr b/tests/ui/issues/issue-33504.stderr index f3e1ca08b6fc3..e5a2eea751d0e 100644 --- a/tests/ui/issues/issue-33504.stderr +++ b/tests/ui/issues/issue-33504.stderr @@ -9,7 +9,12 @@ LL | let Test = 1; | | | expected integer, found `Test` | `Test` is interpreted as a unit struct, not a new binding - | help: introduce a new binding instead: `other_test` + | +help: introduce a new binding instead + | +LL - let Test = 1; +LL + let other_test = 1; + | error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-5100.stderr b/tests/ui/issues/issue-5100.stderr index 24d41a1a8afae..c545f70415c13 100644 --- a/tests/ui/issues/issue-5100.stderr +++ b/tests/ui/issues/issue-5100.stderr @@ -1,9 +1,6 @@ error[E0308]: mismatched types --> $DIR/issue-5100.rs:9:9 | -LL | enum A { B, C } - | - unit variant defined here -... LL | match (true, false) { | ------------- this expression has type `(bool, bool)` LL | A::B => (), diff --git a/tests/ui/match/issue-12552.stderr b/tests/ui/match/issue-12552.stderr index 195192fbd8240..397265cd540f1 100644 --- a/tests/ui/match/issue-12552.stderr +++ b/tests/ui/match/issue-12552.stderr @@ -20,7 +20,14 @@ LL | match t { | - this expression has type `Result<_, {integer}>` ... LL | None => () - | ^^^^ expected `Result<_, {integer}>`, found `Option<_>` + | ^^^^ + | | + | expected `Result<_, {integer}>`, found `Option<_>` + | `None` is interpreted as a unit variant, not a new binding + | + --> $SRC_DIR/core/src/option.rs:LL:COL + | + = note: unit variant defined here | = note: expected enum `Result<_, {integer}>` found enum `Option<_>` @@ -28,6 +35,11 @@ help: try wrapping the pattern in `Ok` | LL | Ok(None) => () | +++ + +help: introduce a new binding instead + | +LL - None => () +LL + other_none => () + | error: aborting due to 2 previous errors diff --git a/tests/ui/match/match-const-tuple-type-mismatch.stderr b/tests/ui/match/match-const-tuple-type-mismatch.stderr index e7dd97c4e9a60..06f65b257069d 100644 --- a/tests/ui/match/match-const-tuple-type-mismatch.stderr +++ b/tests/ui/match/match-const-tuple-type-mismatch.stderr @@ -11,10 +11,14 @@ LL | A => (), | | | expected integer, found `(isize, isize)` | `A` is interpreted as a constant, not a new binding - | help: introduce a new binding instead: `other_a` | = note: expected type `{integer}` found tuple `(isize, isize)` +help: introduce a new binding instead + | +LL - A => (), +LL + other_a => (), + | error: aborting due to 1 previous error diff --git a/tests/ui/match/match-tag-nullary.stderr b/tests/ui/match/match-tag-nullary.stderr index c9446d164337c..2822d715ab319 100644 --- a/tests/ui/match/match-tag-nullary.stderr +++ b/tests/ui/match/match-tag-nullary.stderr @@ -1,9 +1,6 @@ error[E0308]: mismatched types --> $DIR/match-tag-nullary.rs:4:40 | -LL | enum B { B } - | - unit variant defined here -LL | LL | fn main() { let x: A = A::A; match x { B::B => { } } } | - ^^^^ expected `A`, found `B` | | diff --git a/tests/ui/match/mismatched-types-in-match-7867.stderr b/tests/ui/match/mismatched-types-in-match-7867.stderr index e41a61e42f4b0..6f25175209dcc 100644 --- a/tests/ui/match/mismatched-types-in-match-7867.stderr +++ b/tests/ui/match/mismatched-types-in-match-7867.stderr @@ -1,9 +1,6 @@ error[E0308]: mismatched types --> $DIR/mismatched-types-in-match-7867.rs:10:9 | -LL | enum A { B, C } - | - unit variant defined here -... LL | match (true, false) { | ------------- this expression has type `(bool, bool)` LL | A::B => (), diff --git a/tests/ui/privacy/private-unit-struct-assignment.stderr b/tests/ui/privacy/private-unit-struct-assignment.stderr index 8c36a08846d81..110ee19d5ff4d 100644 --- a/tests/ui/privacy/private-unit-struct-assignment.stderr +++ b/tests/ui/privacy/private-unit-struct-assignment.stderr @@ -13,9 +13,6 @@ LL | struct C; error[E0308]: mismatched types --> $DIR/private-unit-struct-assignment.rs:8:5 | -LL | struct C; - | -------- unit struct defined here -... LL | A::C = 1; | ^^^^ - this expression has type `{integer}` | | diff --git a/tests/ui/resolve/name-clash-nullary.stderr b/tests/ui/resolve/name-clash-nullary.stderr index 08e7fe9a678a1..1a3f434b62770 100644 --- a/tests/ui/resolve/name-clash-nullary.stderr +++ b/tests/ui/resolve/name-clash-nullary.stderr @@ -5,9 +5,19 @@ LL | let None: isize = 42; | ^^^^ ----- expected due to this | | | expected `isize`, found `Option<_>` + | `None` is interpreted as a unit variant, not a new binding + | + --> $SRC_DIR/core/src/option.rs:LL:COL + | + = note: unit variant defined here | = note: expected type `isize` found enum `Option<_>` +help: introduce a new binding instead + | +LL - let None: isize = 42; +LL + let other_none: isize = 42; + | error: aborting due to 1 previous error diff --git a/tests/ui/rfcs/rfc-2005-default-binding-mode/const.stderr b/tests/ui/rfcs/rfc-2005-default-binding-mode/const.stderr index 1c8e8d5b0a7db..12b89ba10bfd1 100644 --- a/tests/ui/rfcs/rfc-2005-default-binding-mode/const.stderr +++ b/tests/ui/rfcs/rfc-2005-default-binding-mode/const.stderr @@ -11,7 +11,12 @@ LL | FOO => {}, | | | expected `&Foo`, found `Foo` | `FOO` is interpreted as a constant, not a new binding - | help: introduce a new binding instead: `other_foo` + | +help: introduce a new binding instead + | +LL - FOO => {}, +LL + other_foo => {}, + | error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/field-access.stderr b/tests/ui/suggestions/field-access.stderr index 362dae172c78f..36e126176ee96 100644 --- a/tests/ui/suggestions/field-access.stderr +++ b/tests/ui/suggestions/field-access.stderr @@ -1,9 +1,6 @@ error[E0308]: mismatched types --> $DIR/field-access.rs:20:12 | -LL | Fst, - | --- unit variant defined here -... LL | if let B::Fst = a {}; | ^^^^^^ - this expression has type `A` | | @@ -17,9 +14,6 @@ LL | if let B::Fst = a.b {}; error[E0308]: mismatched types --> $DIR/field-access.rs:25:9 | -LL | Fst, - | --- unit variant defined here -... LL | match a { | - this expression has type `A` ... @@ -34,9 +28,6 @@ LL | match a.b { error[E0308]: mismatched types --> $DIR/field-access.rs:26:9 | -LL | Snd, - | --- unit variant defined here -... LL | match a { | - this expression has type `A` ... diff --git a/tests/ui/suggestions/suggest-deref-in-match-issue-132784.rs b/tests/ui/suggestions/suggest-deref-in-match-issue-132784.rs index 205e57f4a9ff5..77074e8c3a3b1 100644 --- a/tests/ui/suggestions/suggest-deref-in-match-issue-132784.rs +++ b/tests/ui/suggestions/suggest-deref-in-match-issue-132784.rs @@ -8,6 +8,7 @@ fn main() { //~^ ERROR mismatched types None => {} //~^ ERROR mismatched types + //~| HELP introduce a new binding instead } match &x { @@ -17,6 +18,7 @@ fn main() { //~^ ERROR mismatched types None => {} //~^ ERROR mismatched types + //~| HELP introduce a new binding instead } let mut y = Box::new(Some(1)); @@ -27,6 +29,7 @@ fn main() { //~^ ERROR mismatched types None => {} //~^ ERROR mismatched types + //~| HELP introduce a new binding instead } let mut z = Arc::new(Some(1)); @@ -37,6 +40,7 @@ fn main() { //~^ ERROR mismatched types None => {} //~^ ERROR mismatched types + //~| HELP introduce a new binding instead } let z_const: &Arc> = &z; @@ -47,6 +51,7 @@ fn main() { //~^ ERROR mismatched types None => {} //~^ ERROR mismatched types + //~| HELP introduce a new binding instead } // Normal reference because Arc doesn't implement DerefMut. @@ -58,6 +63,7 @@ fn main() { //~^ ERROR mismatched types None => {} //~^ ERROR mismatched types + //~| HELP introduce a new binding instead } // Mutable reference because Box does implement DerefMut. @@ -69,6 +75,7 @@ fn main() { //~^ ERROR mismatched types None => {} //~^ ERROR mismatched types + //~| HELP introduce a new binding instead } // Difficult expression. @@ -80,5 +87,6 @@ fn main() { //~^ ERROR mismatched types None => {} //~^ ERROR mismatched types + //~| HELP introduce a new binding instead } } diff --git a/tests/ui/suggestions/suggest-deref-in-match-issue-132784.stderr b/tests/ui/suggestions/suggest-deref-in-match-issue-132784.stderr index 6092272aa8c5a..a5ce44b256004 100644 --- a/tests/ui/suggestions/suggest-deref-in-match-issue-132784.stderr +++ b/tests/ui/suggestions/suggest-deref-in-match-issue-132784.stderr @@ -21,7 +21,14 @@ LL | match x { | - this expression has type `Arc>` ... LL | None => {} - | ^^^^ expected `Arc>`, found `Option<_>` + | ^^^^ + | | + | expected `Arc>`, found `Option<_>` + | `None` is interpreted as a unit variant, not a new binding + | + --> $SRC_DIR/core/src/option.rs:LL:COL + | + = note: unit variant defined here | = note: expected struct `Arc>` found enum `Option<_>` @@ -29,9 +36,14 @@ help: consider dereferencing to access the inner value using the Deref trait | LL | match *x { | + +help: introduce a new binding instead + | +LL - None => {} +LL + other_none => {} + | error[E0308]: mismatched types - --> $DIR/suggest-deref-in-match-issue-132784.rs:16:9 + --> $DIR/suggest-deref-in-match-issue-132784.rs:17:9 | LL | match &x { | -- this expression has type `&Arc>` @@ -47,13 +59,20 @@ LL | match &*x { | + error[E0308]: mismatched types - --> $DIR/suggest-deref-in-match-issue-132784.rs:18:9 + --> $DIR/suggest-deref-in-match-issue-132784.rs:19:9 | LL | match &x { | -- this expression has type `&Arc>` ... LL | None => {} - | ^^^^ expected `Arc>`, found `Option<_>` + | ^^^^ + | | + | expected `Arc>`, found `Option<_>` + | `None` is interpreted as a unit variant, not a new binding + | + --> $SRC_DIR/core/src/option.rs:LL:COL + | + = note: unit variant defined here | = note: expected struct `Arc>` found enum `Option<_>` @@ -61,9 +80,14 @@ help: consider dereferencing to access the inner value using the Deref trait | LL | match &*x { | + +help: introduce a new binding instead + | +LL - None => {} +LL + other_none => {} + | error[E0308]: mismatched types - --> $DIR/suggest-deref-in-match-issue-132784.rs:26:9 + --> $DIR/suggest-deref-in-match-issue-132784.rs:28:9 | LL | match y { | - this expression has type `Box>` @@ -79,13 +103,20 @@ LL | match *y { | + error[E0308]: mismatched types - --> $DIR/suggest-deref-in-match-issue-132784.rs:28:9 + --> $DIR/suggest-deref-in-match-issue-132784.rs:30:9 | LL | match y { | - this expression has type `Box>` ... LL | None => {} - | ^^^^ expected `Box>`, found `Option<_>` + | ^^^^ + | | + | expected `Box>`, found `Option<_>` + | `None` is interpreted as a unit variant, not a new binding + | + --> $SRC_DIR/core/src/option.rs:LL:COL + | + = note: unit variant defined here | = note: expected struct `Box>` found enum `Option<_>` @@ -93,9 +124,14 @@ help: consider dereferencing to access the inner value using the Deref trait | LL | match *y { | + +help: introduce a new binding instead + | +LL - None => {} +LL + other_none => {} + | error[E0308]: mismatched types - --> $DIR/suggest-deref-in-match-issue-132784.rs:36:9 + --> $DIR/suggest-deref-in-match-issue-132784.rs:39:9 | LL | match z as Arc> { | --------------------- this expression has type `Arc>` @@ -112,13 +148,20 @@ LL + match *(z as Arc>) { | error[E0308]: mismatched types - --> $DIR/suggest-deref-in-match-issue-132784.rs:38:9 + --> $DIR/suggest-deref-in-match-issue-132784.rs:41:9 | LL | match z as Arc> { | --------------------- this expression has type `Arc>` ... LL | None => {} - | ^^^^ expected `Arc>`, found `Option<_>` + | ^^^^ + | | + | expected `Arc>`, found `Option<_>` + | `None` is interpreted as a unit variant, not a new binding + | + --> $SRC_DIR/core/src/option.rs:LL:COL + | + = note: unit variant defined here | = note: expected struct `Arc>` found enum `Option<_>` @@ -127,9 +170,14 @@ help: consider dereferencing to access the inner value using the Deref trait LL - match z as Arc> { LL + match *(z as Arc>) { | +help: introduce a new binding instead + | +LL - None => {} +LL + other_none => {} + | error[E0308]: mismatched types - --> $DIR/suggest-deref-in-match-issue-132784.rs:46:9 + --> $DIR/suggest-deref-in-match-issue-132784.rs:50:9 | LL | match z_const { | ------- this expression has type `&Arc>` @@ -145,13 +193,20 @@ LL | match &**z_const { | +++ error[E0308]: mismatched types - --> $DIR/suggest-deref-in-match-issue-132784.rs:48:9 + --> $DIR/suggest-deref-in-match-issue-132784.rs:52:9 | LL | match z_const { | ------- this expression has type `&Arc>` ... LL | None => {} - | ^^^^ expected `Arc>`, found `Option<_>` + | ^^^^ + | | + | expected `Arc>`, found `Option<_>` + | `None` is interpreted as a unit variant, not a new binding + | + --> $SRC_DIR/core/src/option.rs:LL:COL + | + = note: unit variant defined here | = note: expected struct `Arc>` found enum `Option<_>` @@ -159,9 +214,14 @@ help: consider dereferencing to access the inner value using the Deref trait | LL | match &**z_const { | +++ +help: introduce a new binding instead + | +LL - None => {} +LL + other_none => {} + | error[E0308]: mismatched types - --> $DIR/suggest-deref-in-match-issue-132784.rs:57:9 + --> $DIR/suggest-deref-in-match-issue-132784.rs:62:9 | LL | match z_mut { | ----- this expression has type `&mut Arc>` @@ -177,13 +237,20 @@ LL | match &**z_mut { | +++ error[E0308]: mismatched types - --> $DIR/suggest-deref-in-match-issue-132784.rs:59:9 + --> $DIR/suggest-deref-in-match-issue-132784.rs:64:9 | LL | match z_mut { | ----- this expression has type `&mut Arc>` ... LL | None => {} - | ^^^^ expected `Arc>`, found `Option<_>` + | ^^^^ + | | + | expected `Arc>`, found `Option<_>` + | `None` is interpreted as a unit variant, not a new binding + | + --> $SRC_DIR/core/src/option.rs:LL:COL + | + = note: unit variant defined here | = note: expected struct `Arc>` found enum `Option<_>` @@ -191,9 +258,14 @@ help: consider dereferencing to access the inner value using the Deref trait | LL | match &**z_mut { | +++ +help: introduce a new binding instead + | +LL - None => {} +LL + other_none => {} + | error[E0308]: mismatched types - --> $DIR/suggest-deref-in-match-issue-132784.rs:68:9 + --> $DIR/suggest-deref-in-match-issue-132784.rs:74:9 | LL | match y_mut { | ----- this expression has type `&mut Box>` @@ -209,13 +281,20 @@ LL | match &**y_mut { | +++ error[E0308]: mismatched types - --> $DIR/suggest-deref-in-match-issue-132784.rs:70:9 + --> $DIR/suggest-deref-in-match-issue-132784.rs:76:9 | LL | match y_mut { | ----- this expression has type `&mut Box>` ... LL | None => {} - | ^^^^ expected `Box>`, found `Option<_>` + | ^^^^ + | | + | expected `Box>`, found `Option<_>` + | `None` is interpreted as a unit variant, not a new binding + | + --> $SRC_DIR/core/src/option.rs:LL:COL + | + = note: unit variant defined here | = note: expected struct `Box>` found enum `Option<_>` @@ -223,9 +302,14 @@ help: consider dereferencing to access the inner value using the Deref trait | LL | match &**y_mut { | +++ +help: introduce a new binding instead + | +LL - None => {} +LL + other_none => {} + | error[E0308]: mismatched types - --> $DIR/suggest-deref-in-match-issue-132784.rs:79:9 + --> $DIR/suggest-deref-in-match-issue-132784.rs:86:9 | LL | match (& (&difficult) ) { | ------------------ this expression has type `&&Arc>` @@ -242,13 +326,20 @@ LL + match &*difficult { | error[E0308]: mismatched types - --> $DIR/suggest-deref-in-match-issue-132784.rs:81:9 + --> $DIR/suggest-deref-in-match-issue-132784.rs:88:9 | LL | match (& (&difficult) ) { | ------------------ this expression has type `&&Arc>` ... LL | None => {} - | ^^^^ expected `Arc>`, found `Option<_>` + | ^^^^ + | | + | expected `Arc>`, found `Option<_>` + | `None` is interpreted as a unit variant, not a new binding + | + --> $SRC_DIR/core/src/option.rs:LL:COL + | + = note: unit variant defined here | = note: expected struct `Arc>` found enum `Option<_>` @@ -257,6 +348,11 @@ help: consider dereferencing to access the inner value using the Deref trait LL - match (& (&difficult) ) { LL + match &*difficult { | +help: introduce a new binding instead + | +LL - None => {} +LL + other_none => {} + | error: aborting due to 16 previous errors diff --git a/tests/ui/type/pattern_types/matching_fail.stderr b/tests/ui/type/pattern_types/matching_fail.stderr index 446180d80f24b..495d739078782 100644 --- a/tests/ui/type/pattern_types/matching_fail.stderr +++ b/tests/ui/type/pattern_types/matching_fail.stderr @@ -33,10 +33,14 @@ LL | THREE => {} | | | expected integer, found `(u32) is 1..` | `THREE` is interpreted as a constant, not a new binding - | help: introduce a new binding instead: `other_three` | = note: expected type `{integer}` found pattern type `(u32) is 1..` +help: introduce a new binding instead + | +LL - THREE => {} +LL + other_three => {} + | error: aborting due to 3 previous errors From 408066f31094c0284d5c4684e9839ae3594100df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Sun, 15 Mar 2026 03:51:25 +0000 Subject: [PATCH 21/35] Do not suggest introducing new binding when other suggestions are present --- compiler/rustc_errors/src/lib.rs | 8 + compiler/rustc_hir_typeck/src/pat.rs | 4 +- .../compatible-variants-in-pat.rs | 2 - .../compatible-variants-in-pat.stderr | 28 +--- tests/ui/match/issue-12552.stderr | 14 +- .../suggest-deref-in-match-issue-132784.rs | 8 - ...suggest-deref-in-match-issue-132784.stderr | 140 +++--------------- 7 files changed, 37 insertions(+), 167 deletions(-) diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs index 9b3dba15f55e2..8c57544c54b8f 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -138,6 +138,14 @@ impl Suggestions { Suggestions::Disabled => Vec::new(), } } + + pub fn len(&self) -> usize { + match self { + Suggestions::Enabled(suggestions) => suggestions.len(), + Suggestions::Sealed(suggestions) => suggestions.len(), + Suggestions::Disabled => 0, + } + } } impl Default for Suggestions { diff --git a/compiler/rustc_hir_typeck/src/pat.rs b/compiler/rustc_hir_typeck/src/pat.rs index 314b50a12fc37..26f7d1ccffc93 100644 --- a/compiler/rustc_hir_typeck/src/pat.rs +++ b/compiler/rustc_hir_typeck/src/pat.rs @@ -1644,7 +1644,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { return; } }; - if let [hir::PathSegment { ident, args: None, .. }] = segments { + if let [hir::PathSegment { ident, args: None, .. }] = segments + && e.suggestions.len() == 0 + { e.span_label(span, format!("{} defined here", res.descr())); e.span_label( pat_span, diff --git a/tests/ui/did_you_mean/compatible-variants-in-pat.rs b/tests/ui/did_you_mean/compatible-variants-in-pat.rs index 09e12dab2d3fc..5633c28be208f 100644 --- a/tests/ui/did_you_mean/compatible-variants-in-pat.rs +++ b/tests/ui/did_you_mean/compatible-variants-in-pat.rs @@ -21,7 +21,6 @@ fn b(s: Option) { S => { //~^ ERROR mismatched types //~| HELP try wrapping - //~| HELP introduce a new binding instead } _ => {} } @@ -32,7 +31,6 @@ fn c(s: Result) { S => { //~^ ERROR mismatched types //~| HELP try wrapping - //~| HELP introduce a new binding instead } _ => {} } diff --git a/tests/ui/did_you_mean/compatible-variants-in-pat.stderr b/tests/ui/did_you_mean/compatible-variants-in-pat.stderr index 09cf094e6bd72..f18965f5d080c 100644 --- a/tests/ui/did_you_mean/compatible-variants-in-pat.stderr +++ b/tests/ui/did_you_mean/compatible-variants-in-pat.stderr @@ -14,16 +14,10 @@ LL | Foo::Bar(Bar { x }) => { error[E0308]: mismatched types --> $DIR/compatible-variants-in-pat.rs:21:9 | -LL | struct S; - | -------- unit struct defined here -... LL | match s { | - this expression has type `Option` LL | S => { - | ^ - | | - | expected `Option`, found `S` - | `S` is interpreted as a unit struct, not a new binding + | ^ expected `Option`, found `S` | = note: expected enum `Option` found struct `S` @@ -31,25 +25,14 @@ help: try wrapping the pattern in `Some` | LL | Some(S) => { | +++++ + -help: introduce a new binding instead - | -LL - S => { -LL + other_s => { - | error[E0308]: mismatched types - --> $DIR/compatible-variants-in-pat.rs:32:9 + --> $DIR/compatible-variants-in-pat.rs:31:9 | -LL | struct S; - | -------- unit struct defined here -... LL | match s { | - this expression has type `Result` LL | S => { - | ^ - | | - | expected `Result`, found `S` - | `S` is interpreted as a unit struct, not a new binding + | ^ expected `Result`, found `S` | = note: expected enum `Result` found struct `S` @@ -59,11 +42,6 @@ LL | Ok(S) => { | +++ + LL | Err(S) => { | ++++ + -help: introduce a new binding instead - | -LL - S => { -LL + other_s => { - | error: aborting due to 3 previous errors diff --git a/tests/ui/match/issue-12552.stderr b/tests/ui/match/issue-12552.stderr index 397265cd540f1..195192fbd8240 100644 --- a/tests/ui/match/issue-12552.stderr +++ b/tests/ui/match/issue-12552.stderr @@ -20,14 +20,7 @@ LL | match t { | - this expression has type `Result<_, {integer}>` ... LL | None => () - | ^^^^ - | | - | expected `Result<_, {integer}>`, found `Option<_>` - | `None` is interpreted as a unit variant, not a new binding - | - --> $SRC_DIR/core/src/option.rs:LL:COL - | - = note: unit variant defined here + | ^^^^ expected `Result<_, {integer}>`, found `Option<_>` | = note: expected enum `Result<_, {integer}>` found enum `Option<_>` @@ -35,11 +28,6 @@ help: try wrapping the pattern in `Ok` | LL | Ok(None) => () | +++ + -help: introduce a new binding instead - | -LL - None => () -LL + other_none => () - | error: aborting due to 2 previous errors diff --git a/tests/ui/suggestions/suggest-deref-in-match-issue-132784.rs b/tests/ui/suggestions/suggest-deref-in-match-issue-132784.rs index 77074e8c3a3b1..205e57f4a9ff5 100644 --- a/tests/ui/suggestions/suggest-deref-in-match-issue-132784.rs +++ b/tests/ui/suggestions/suggest-deref-in-match-issue-132784.rs @@ -8,7 +8,6 @@ fn main() { //~^ ERROR mismatched types None => {} //~^ ERROR mismatched types - //~| HELP introduce a new binding instead } match &x { @@ -18,7 +17,6 @@ fn main() { //~^ ERROR mismatched types None => {} //~^ ERROR mismatched types - //~| HELP introduce a new binding instead } let mut y = Box::new(Some(1)); @@ -29,7 +27,6 @@ fn main() { //~^ ERROR mismatched types None => {} //~^ ERROR mismatched types - //~| HELP introduce a new binding instead } let mut z = Arc::new(Some(1)); @@ -40,7 +37,6 @@ fn main() { //~^ ERROR mismatched types None => {} //~^ ERROR mismatched types - //~| HELP introduce a new binding instead } let z_const: &Arc> = &z; @@ -51,7 +47,6 @@ fn main() { //~^ ERROR mismatched types None => {} //~^ ERROR mismatched types - //~| HELP introduce a new binding instead } // Normal reference because Arc doesn't implement DerefMut. @@ -63,7 +58,6 @@ fn main() { //~^ ERROR mismatched types None => {} //~^ ERROR mismatched types - //~| HELP introduce a new binding instead } // Mutable reference because Box does implement DerefMut. @@ -75,7 +69,6 @@ fn main() { //~^ ERROR mismatched types None => {} //~^ ERROR mismatched types - //~| HELP introduce a new binding instead } // Difficult expression. @@ -87,6 +80,5 @@ fn main() { //~^ ERROR mismatched types None => {} //~^ ERROR mismatched types - //~| HELP introduce a new binding instead } } diff --git a/tests/ui/suggestions/suggest-deref-in-match-issue-132784.stderr b/tests/ui/suggestions/suggest-deref-in-match-issue-132784.stderr index a5ce44b256004..6092272aa8c5a 100644 --- a/tests/ui/suggestions/suggest-deref-in-match-issue-132784.stderr +++ b/tests/ui/suggestions/suggest-deref-in-match-issue-132784.stderr @@ -21,14 +21,7 @@ LL | match x { | - this expression has type `Arc>` ... LL | None => {} - | ^^^^ - | | - | expected `Arc>`, found `Option<_>` - | `None` is interpreted as a unit variant, not a new binding - | - --> $SRC_DIR/core/src/option.rs:LL:COL - | - = note: unit variant defined here + | ^^^^ expected `Arc>`, found `Option<_>` | = note: expected struct `Arc>` found enum `Option<_>` @@ -36,14 +29,9 @@ help: consider dereferencing to access the inner value using the Deref trait | LL | match *x { | + -help: introduce a new binding instead - | -LL - None => {} -LL + other_none => {} - | error[E0308]: mismatched types - --> $DIR/suggest-deref-in-match-issue-132784.rs:17:9 + --> $DIR/suggest-deref-in-match-issue-132784.rs:16:9 | LL | match &x { | -- this expression has type `&Arc>` @@ -59,20 +47,13 @@ LL | match &*x { | + error[E0308]: mismatched types - --> $DIR/suggest-deref-in-match-issue-132784.rs:19:9 + --> $DIR/suggest-deref-in-match-issue-132784.rs:18:9 | LL | match &x { | -- this expression has type `&Arc>` ... LL | None => {} - | ^^^^ - | | - | expected `Arc>`, found `Option<_>` - | `None` is interpreted as a unit variant, not a new binding - | - --> $SRC_DIR/core/src/option.rs:LL:COL - | - = note: unit variant defined here + | ^^^^ expected `Arc>`, found `Option<_>` | = note: expected struct `Arc>` found enum `Option<_>` @@ -80,14 +61,9 @@ help: consider dereferencing to access the inner value using the Deref trait | LL | match &*x { | + -help: introduce a new binding instead - | -LL - None => {} -LL + other_none => {} - | error[E0308]: mismatched types - --> $DIR/suggest-deref-in-match-issue-132784.rs:28:9 + --> $DIR/suggest-deref-in-match-issue-132784.rs:26:9 | LL | match y { | - this expression has type `Box>` @@ -103,20 +79,13 @@ LL | match *y { | + error[E0308]: mismatched types - --> $DIR/suggest-deref-in-match-issue-132784.rs:30:9 + --> $DIR/suggest-deref-in-match-issue-132784.rs:28:9 | LL | match y { | - this expression has type `Box>` ... LL | None => {} - | ^^^^ - | | - | expected `Box>`, found `Option<_>` - | `None` is interpreted as a unit variant, not a new binding - | - --> $SRC_DIR/core/src/option.rs:LL:COL - | - = note: unit variant defined here + | ^^^^ expected `Box>`, found `Option<_>` | = note: expected struct `Box>` found enum `Option<_>` @@ -124,14 +93,9 @@ help: consider dereferencing to access the inner value using the Deref trait | LL | match *y { | + -help: introduce a new binding instead - | -LL - None => {} -LL + other_none => {} - | error[E0308]: mismatched types - --> $DIR/suggest-deref-in-match-issue-132784.rs:39:9 + --> $DIR/suggest-deref-in-match-issue-132784.rs:36:9 | LL | match z as Arc> { | --------------------- this expression has type `Arc>` @@ -148,20 +112,13 @@ LL + match *(z as Arc>) { | error[E0308]: mismatched types - --> $DIR/suggest-deref-in-match-issue-132784.rs:41:9 + --> $DIR/suggest-deref-in-match-issue-132784.rs:38:9 | LL | match z as Arc> { | --------------------- this expression has type `Arc>` ... LL | None => {} - | ^^^^ - | | - | expected `Arc>`, found `Option<_>` - | `None` is interpreted as a unit variant, not a new binding - | - --> $SRC_DIR/core/src/option.rs:LL:COL - | - = note: unit variant defined here + | ^^^^ expected `Arc>`, found `Option<_>` | = note: expected struct `Arc>` found enum `Option<_>` @@ -170,14 +127,9 @@ help: consider dereferencing to access the inner value using the Deref trait LL - match z as Arc> { LL + match *(z as Arc>) { | -help: introduce a new binding instead - | -LL - None => {} -LL + other_none => {} - | error[E0308]: mismatched types - --> $DIR/suggest-deref-in-match-issue-132784.rs:50:9 + --> $DIR/suggest-deref-in-match-issue-132784.rs:46:9 | LL | match z_const { | ------- this expression has type `&Arc>` @@ -193,20 +145,13 @@ LL | match &**z_const { | +++ error[E0308]: mismatched types - --> $DIR/suggest-deref-in-match-issue-132784.rs:52:9 + --> $DIR/suggest-deref-in-match-issue-132784.rs:48:9 | LL | match z_const { | ------- this expression has type `&Arc>` ... LL | None => {} - | ^^^^ - | | - | expected `Arc>`, found `Option<_>` - | `None` is interpreted as a unit variant, not a new binding - | - --> $SRC_DIR/core/src/option.rs:LL:COL - | - = note: unit variant defined here + | ^^^^ expected `Arc>`, found `Option<_>` | = note: expected struct `Arc>` found enum `Option<_>` @@ -214,14 +159,9 @@ help: consider dereferencing to access the inner value using the Deref trait | LL | match &**z_const { | +++ -help: introduce a new binding instead - | -LL - None => {} -LL + other_none => {} - | error[E0308]: mismatched types - --> $DIR/suggest-deref-in-match-issue-132784.rs:62:9 + --> $DIR/suggest-deref-in-match-issue-132784.rs:57:9 | LL | match z_mut { | ----- this expression has type `&mut Arc>` @@ -237,20 +177,13 @@ LL | match &**z_mut { | +++ error[E0308]: mismatched types - --> $DIR/suggest-deref-in-match-issue-132784.rs:64:9 + --> $DIR/suggest-deref-in-match-issue-132784.rs:59:9 | LL | match z_mut { | ----- this expression has type `&mut Arc>` ... LL | None => {} - | ^^^^ - | | - | expected `Arc>`, found `Option<_>` - | `None` is interpreted as a unit variant, not a new binding - | - --> $SRC_DIR/core/src/option.rs:LL:COL - | - = note: unit variant defined here + | ^^^^ expected `Arc>`, found `Option<_>` | = note: expected struct `Arc>` found enum `Option<_>` @@ -258,14 +191,9 @@ help: consider dereferencing to access the inner value using the Deref trait | LL | match &**z_mut { | +++ -help: introduce a new binding instead - | -LL - None => {} -LL + other_none => {} - | error[E0308]: mismatched types - --> $DIR/suggest-deref-in-match-issue-132784.rs:74:9 + --> $DIR/suggest-deref-in-match-issue-132784.rs:68:9 | LL | match y_mut { | ----- this expression has type `&mut Box>` @@ -281,20 +209,13 @@ LL | match &**y_mut { | +++ error[E0308]: mismatched types - --> $DIR/suggest-deref-in-match-issue-132784.rs:76:9 + --> $DIR/suggest-deref-in-match-issue-132784.rs:70:9 | LL | match y_mut { | ----- this expression has type `&mut Box>` ... LL | None => {} - | ^^^^ - | | - | expected `Box>`, found `Option<_>` - | `None` is interpreted as a unit variant, not a new binding - | - --> $SRC_DIR/core/src/option.rs:LL:COL - | - = note: unit variant defined here + | ^^^^ expected `Box>`, found `Option<_>` | = note: expected struct `Box>` found enum `Option<_>` @@ -302,14 +223,9 @@ help: consider dereferencing to access the inner value using the Deref trait | LL | match &**y_mut { | +++ -help: introduce a new binding instead - | -LL - None => {} -LL + other_none => {} - | error[E0308]: mismatched types - --> $DIR/suggest-deref-in-match-issue-132784.rs:86:9 + --> $DIR/suggest-deref-in-match-issue-132784.rs:79:9 | LL | match (& (&difficult) ) { | ------------------ this expression has type `&&Arc>` @@ -326,20 +242,13 @@ LL + match &*difficult { | error[E0308]: mismatched types - --> $DIR/suggest-deref-in-match-issue-132784.rs:88:9 + --> $DIR/suggest-deref-in-match-issue-132784.rs:81:9 | LL | match (& (&difficult) ) { | ------------------ this expression has type `&&Arc>` ... LL | None => {} - | ^^^^ - | | - | expected `Arc>`, found `Option<_>` - | `None` is interpreted as a unit variant, not a new binding - | - --> $SRC_DIR/core/src/option.rs:LL:COL - | - = note: unit variant defined here + | ^^^^ expected `Arc>`, found `Option<_>` | = note: expected struct `Arc>` found enum `Option<_>` @@ -348,11 +257,6 @@ help: consider dereferencing to access the inner value using the Deref trait LL - match (& (&difficult) ) { LL + match &*difficult { | -help: introduce a new binding instead - | -LL - None => {} -LL + other_none => {} - | error: aborting due to 16 previous errors From 461038f0c9fd7a403b29d3ac0e384d410ab16f07 Mon Sep 17 00:00:00 2001 From: Folkert de Vries Date: Sun, 15 Mar 2026 17:04:38 +0100 Subject: [PATCH 22/35] improve `#[track_caller]` invalid ABI error --- .../rustc_ast_passes/src/ast_validation.rs | 20 ++++++++++++- compiler/rustc_ast_passes/src/errors.rs | 10 +++++++ .../rustc_codegen_ssa/src/codegen_attrs.rs | 3 +- compiler/rustc_codegen_ssa/src/errors.rs | 7 ----- .../error-with-invalid-abi.rs | 27 ++++++++++++++--- .../error-with-invalid-abi.stderr | 26 ++++++++++++---- .../rfc-2091-track-caller/error-with-naked.rs | 4 +-- .../error-with-naked.stderr | 30 +++++++++++-------- 8 files changed, 94 insertions(+), 33 deletions(-) diff --git a/compiler/rustc_ast_passes/src/ast_validation.rs b/compiler/rustc_ast_passes/src/ast_validation.rs index 2308502df0703..bdb0981311248 100644 --- a/compiler/rustc_ast_passes/src/ast_validation.rs +++ b/compiler/rustc_ast_passes/src/ast_validation.rs @@ -1487,6 +1487,15 @@ impl<'a> Visitor<'a> for AstValidator<'a> { ident, sig, ); + + if let Some(attr) = attr::find_by_name(fi.attrs(), sym::track_caller) + && self.extern_mod_abi != Some(ExternAbi::Rust) + { + self.dcx().emit_err(errors::RequiresRustAbi { + track_caller_span: attr.span, + extern_abi_span: self.current_extern_span(), + }); + } } ForeignItemKind::TyAlias(box TyAlias { defaultness, @@ -1672,10 +1681,19 @@ impl<'a> Visitor<'a> for AstValidator<'a> { } if let FnKind::Fn(ctxt, _, fun) = fk - && let Extern::Explicit(str_lit, _) = fun.sig.header.ext + && let Extern::Explicit(str_lit, extern_abi_span) = fun.sig.header.ext && let Ok(abi) = ExternAbi::from_str(str_lit.symbol.as_str()) { self.check_extern_fn_signature(abi, ctxt, &fun.ident, &fun.sig); + + if let Some(attr) = attr::find_by_name(attrs, sym::track_caller) + && abi != ExternAbi::Rust + { + self.dcx().emit_err(errors::RequiresRustAbi { + track_caller_span: attr.span, + extern_abi_span, + }); + } } self.check_c_variadic_type(fk, attrs); diff --git a/compiler/rustc_ast_passes/src/errors.rs b/compiler/rustc_ast_passes/src/errors.rs index 4a39e22ac220d..390c1556f191c 100644 --- a/compiler/rustc_ast_passes/src/errors.rs +++ b/compiler/rustc_ast_passes/src/errors.rs @@ -1140,3 +1140,13 @@ pub(crate) struct ScalableVectorBadArch { #[primary_span] pub span: Span, } + +#[derive(Diagnostic)] +#[diag("`#[track_caller]` can only be used with the Rust ABI", code = E0737)] +pub(crate) struct RequiresRustAbi { + #[primary_span] + #[label("using `#[track_caller]` here")] + pub track_caller_span: Span, + #[label("not using the Rust ABI because of this")] + pub extern_abi_span: Span, +} diff --git a/compiler/rustc_codegen_ssa/src/codegen_attrs.rs b/compiler/rustc_codegen_ssa/src/codegen_attrs.rs index b8a8bb3ad419d..6dd4f2d6b5925 100644 --- a/compiler/rustc_codegen_ssa/src/codegen_attrs.rs +++ b/compiler/rustc_codegen_ssa/src/codegen_attrs.rs @@ -150,7 +150,8 @@ fn process_builtin_attrs( && let Some(fn_sig) = try_fn_sig(tcx, did, *attr_span) && fn_sig.skip_binder().abi() != ExternAbi::Rust { - tcx.dcx().emit_err(errors::RequiresRustAbi { span: *attr_span }); + // This error is already reported in `rustc_ast_passes/src/ast_validation.rs`. + tcx.dcx().delayed_bug("`#[track_caller]` requires the Rust ABI"); } if is_closure && !tcx.features().closure_track_caller() diff --git a/compiler/rustc_codegen_ssa/src/errors.rs b/compiler/rustc_codegen_ssa/src/errors.rs index 41337fc21a7b7..0ec297252fce7 100644 --- a/compiler/rustc_codegen_ssa/src/errors.rs +++ b/compiler/rustc_codegen_ssa/src/errors.rs @@ -111,13 +111,6 @@ pub(crate) struct NoSavedObjectFile<'a> { pub cgu_name: &'a str, } -#[derive(Diagnostic)] -#[diag("`#[track_caller]` requires Rust ABI", code = E0737)] -pub(crate) struct RequiresRustAbi { - #[primary_span] - pub span: Span, -} - #[derive(Diagnostic)] #[diag("unable to copy {$source_file} to {$output_path}: {$error}")] pub(crate) struct CopyPathBuf { diff --git a/tests/ui/rfcs/rfc-2091-track-caller/error-with-invalid-abi.rs b/tests/ui/rfcs/rfc-2091-track-caller/error-with-invalid-abi.rs index 074e1ceb791ce..53f99760d88f3 100644 --- a/tests/ui/rfcs/rfc-2091-track-caller/error-with-invalid-abi.rs +++ b/tests/ui/rfcs/rfc-2091-track-caller/error-with-invalid-abi.rs @@ -1,11 +1,30 @@ #[track_caller] -extern "C" fn f() {} -//~^^ ERROR `#[track_caller]` requires Rust ABI +//~^ ERROR `#[track_caller]` can only be used with the Rust ABI +extern "C" fn c_fn() {} + +#[track_caller] +extern "Rust" fn rust_fn() {} extern "C" { #[track_caller] - fn g(); - //~^^ ERROR `#[track_caller]` requires Rust ABI + //~^ ERROR `#[track_caller]` can only be used with the Rust ABI + fn c_extern(); +} + +extern "Rust" { + #[track_caller] + fn rust_extern(); +} + +struct S; + +impl S { + #[track_caller] + //~^ ERROR `#[track_caller]` can only be used with the Rust ABI + extern "C" fn c_method() {} + + #[track_caller] + extern "Rust" fn rust_method() {} } fn main() {} diff --git a/tests/ui/rfcs/rfc-2091-track-caller/error-with-invalid-abi.stderr b/tests/ui/rfcs/rfc-2091-track-caller/error-with-invalid-abi.stderr index bcc0c8170e655..f5cba7b8a011c 100644 --- a/tests/ui/rfcs/rfc-2091-track-caller/error-with-invalid-abi.stderr +++ b/tests/ui/rfcs/rfc-2091-track-caller/error-with-invalid-abi.stderr @@ -1,15 +1,29 @@ -error[E0737]: `#[track_caller]` requires Rust ABI +error[E0737]: `#[track_caller]` can only be used with the Rust ABI --> $DIR/error-with-invalid-abi.rs:1:1 | LL | #[track_caller] - | ^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^ using `#[track_caller]` here +LL | +LL | extern "C" fn c_fn() {} + | ---------- not using the Rust ABI because of this -error[E0737]: `#[track_caller]` requires Rust ABI - --> $DIR/error-with-invalid-abi.rs:6:5 +error[E0737]: `#[track_caller]` can only be used with the Rust ABI + --> $DIR/error-with-invalid-abi.rs:9:5 | +LL | extern "C" { + | ---------- not using the Rust ABI because of this LL | #[track_caller] - | ^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^ using `#[track_caller]` here -error: aborting due to 2 previous errors +error[E0737]: `#[track_caller]` can only be used with the Rust ABI + --> $DIR/error-with-invalid-abi.rs:22:5 + | +LL | #[track_caller] + | ^^^^^^^^^^^^^^^ using `#[track_caller]` here +LL | +LL | extern "C" fn c_method() {} + | ---------- not using the Rust ABI because of this + +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0737`. diff --git a/tests/ui/rfcs/rfc-2091-track-caller/error-with-naked.rs b/tests/ui/rfcs/rfc-2091-track-caller/error-with-naked.rs index a4baf1fe4b97d..a136c3ffeefa4 100644 --- a/tests/ui/rfcs/rfc-2091-track-caller/error-with-naked.rs +++ b/tests/ui/rfcs/rfc-2091-track-caller/error-with-naked.rs @@ -3,7 +3,7 @@ use std::arch::naked_asm; #[track_caller] //~ ERROR [E0736] -//~^ ERROR `#[track_caller]` requires Rust ABI +//~^ ERROR `#[track_caller]` can only be used with the Rust ABI #[unsafe(naked)] extern "C" fn f() { unsafe { @@ -15,7 +15,7 @@ struct S; impl S { #[track_caller] //~ ERROR [E0736] - //~^ ERROR `#[track_caller]` requires Rust ABI + //~^ ERROR `#[track_caller]` can only be used with the Rust ABI #[unsafe(naked)] extern "C" fn g() { unsafe { diff --git a/tests/ui/rfcs/rfc-2091-track-caller/error-with-naked.stderr b/tests/ui/rfcs/rfc-2091-track-caller/error-with-naked.stderr index 3036080613882..90ed76e8b1b96 100644 --- a/tests/ui/rfcs/rfc-2091-track-caller/error-with-naked.stderr +++ b/tests/ui/rfcs/rfc-2091-track-caller/error-with-naked.stderr @@ -1,3 +1,21 @@ +error[E0737]: `#[track_caller]` can only be used with the Rust ABI + --> $DIR/error-with-naked.rs:5:1 + | +LL | #[track_caller] + | ^^^^^^^^^^^^^^^ using `#[track_caller]` here +... +LL | extern "C" fn f() { + | ---------- not using the Rust ABI because of this + +error[E0737]: `#[track_caller]` can only be used with the Rust ABI + --> $DIR/error-with-naked.rs:17:5 + | +LL | #[track_caller] + | ^^^^^^^^^^^^^^^ using `#[track_caller]` here +... +LL | extern "C" fn g() { + | ---------- not using the Rust ABI because of this + error[E0736]: attribute incompatible with `#[unsafe(naked)]` --> $DIR/error-with-naked.rs:5:3 | @@ -16,18 +34,6 @@ LL | LL | #[unsafe(naked)] | ---------------- function marked with `#[unsafe(naked)]` here -error[E0737]: `#[track_caller]` requires Rust ABI - --> $DIR/error-with-naked.rs:5:1 - | -LL | #[track_caller] - | ^^^^^^^^^^^^^^^ - -error[E0737]: `#[track_caller]` requires Rust ABI - --> $DIR/error-with-naked.rs:17:5 - | -LL | #[track_caller] - | ^^^^^^^^^^^^^^^ - error: aborting due to 4 previous errors Some errors have detailed explanations: E0736, E0737. From 93584fd50f6d629a3ea08b56c557725c4021a4cd Mon Sep 17 00:00:00 2001 From: cyrgani Date: Mon, 16 Mar 2026 10:21:35 +0000 Subject: [PATCH 23/35] dissolve `tests/ui/cross` --- tests/ui/README.md | 4 ---- .../coercion/no-implicit-box-to-ref-coercion.rs | 11 +++++++++++ .../no-implicit-box-to-ref-coercion.stderr} | 2 +- .../auxiliary/extern_macro_crate.rs | 0 .../cross-crate-macro-backtrace.rs} | 0 .../cross-crate-macro-backtrace.stderr} | 2 +- tests/ui/cross/cross-borrow-trait.rs | 15 --------------- .../main.rs => macros/cross-file-errors.rs} | 0 .../cross-file-errors.stderr} | 2 +- .../cross-file-errors => macros}/underscore.rs | 0 tests/ui/{cross => traits}/cross-fn-cache-hole.rs | 0 .../{cross => traits}/cross-fn-cache-hole.stderr | 0 12 files changed, 14 insertions(+), 22 deletions(-) create mode 100644 tests/ui/coercion/no-implicit-box-to-ref-coercion.rs rename tests/ui/{cross/cross-borrow-trait.stderr => coercion/no-implicit-box-to-ref-coercion.stderr} (88%) rename tests/ui/{cross/cross-crate-macro-backtrace => cross-crate}/auxiliary/extern_macro_crate.rs (100%) rename tests/ui/{cross/cross-crate-macro-backtrace/main.rs => cross-crate/cross-crate-macro-backtrace.rs} (100%) rename tests/ui/{cross/cross-crate-macro-backtrace/main.stderr => cross-crate/cross-crate-macro-backtrace.stderr} (88%) delete mode 100644 tests/ui/cross/cross-borrow-trait.rs rename tests/ui/{cross/cross-file-errors/main.rs => macros/cross-file-errors.rs} (100%) rename tests/ui/{cross/cross-file-errors/main.stderr => macros/cross-file-errors.stderr} (92%) rename tests/ui/{cross/cross-file-errors => macros}/underscore.rs (100%) rename tests/ui/{cross => traits}/cross-fn-cache-hole.rs (100%) rename tests/ui/{cross => traits}/cross-fn-cache-hole.stderr (100%) diff --git a/tests/ui/README.md b/tests/ui/README.md index 9911353af5cd0..848df58f27143 100644 --- a/tests/ui/README.md +++ b/tests/ui/README.md @@ -344,10 +344,6 @@ Tests for `#![feature(coverage_attribute)]`. See [Tracking issue for function at Tests for crate resolution and loading behavior, including `extern crate` declarations, `--extern` flags, or the `use` keyword. -## `tests/ui/cross/`: Various tests related to the concept of "cross" - -**FIXME**: The unifying topic of these tests appears to be that their filenames begin with the word "cross". The similarities end there - one test is about "cross-borrowing" a `Box` into `&T`, while another is about a global trait used "across" files. Some of this terminology is really outdated and does not match the current terminology. Additionally, "cross" is also way too generic, it's easy to confuse with cross-compile. - ## `tests/ui/cross-crate/`: Cross-Crate Interaction Tests for behavior spanning multiple crates, including visibility rules, trait implementations, and type resolution across crate boundaries. diff --git a/tests/ui/coercion/no-implicit-box-to-ref-coercion.rs b/tests/ui/coercion/no-implicit-box-to-ref-coercion.rs new file mode 100644 index 0000000000000..f061117d67ed8 --- /dev/null +++ b/tests/ui/coercion/no-implicit-box-to-ref-coercion.rs @@ -0,0 +1,11 @@ +// Test that implicitly converting from `Box` to `&T` is +// forbidden when `T` is a trait. + +struct Foo; +trait Trait { fn foo(&self) {} } +impl Trait for Foo {} + +pub fn main() { + let x: Box = Box::new(Foo); + let _y: &dyn Trait = x; //~ ERROR E0308 +} diff --git a/tests/ui/cross/cross-borrow-trait.stderr b/tests/ui/coercion/no-implicit-box-to-ref-coercion.stderr similarity index 88% rename from tests/ui/cross/cross-borrow-trait.stderr rename to tests/ui/coercion/no-implicit-box-to-ref-coercion.stderr index 5fe80b5a3eef6..da0b28b0149d2 100644 --- a/tests/ui/cross/cross-borrow-trait.stderr +++ b/tests/ui/coercion/no-implicit-box-to-ref-coercion.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/cross-borrow-trait.rs:12:26 + --> $DIR/no-implicit-box-to-ref-coercion.rs:10:26 | LL | let _y: &dyn Trait = x; | ---------- ^ expected `&dyn Trait`, found `Box` diff --git a/tests/ui/cross/cross-crate-macro-backtrace/auxiliary/extern_macro_crate.rs b/tests/ui/cross-crate/auxiliary/extern_macro_crate.rs similarity index 100% rename from tests/ui/cross/cross-crate-macro-backtrace/auxiliary/extern_macro_crate.rs rename to tests/ui/cross-crate/auxiliary/extern_macro_crate.rs diff --git a/tests/ui/cross/cross-crate-macro-backtrace/main.rs b/tests/ui/cross-crate/cross-crate-macro-backtrace.rs similarity index 100% rename from tests/ui/cross/cross-crate-macro-backtrace/main.rs rename to tests/ui/cross-crate/cross-crate-macro-backtrace.rs diff --git a/tests/ui/cross/cross-crate-macro-backtrace/main.stderr b/tests/ui/cross-crate/cross-crate-macro-backtrace.stderr similarity index 88% rename from tests/ui/cross/cross-crate-macro-backtrace/main.stderr rename to tests/ui/cross-crate/cross-crate-macro-backtrace.stderr index d6f20b1f8e9f2..9d6a2fbbf0026 100644 --- a/tests/ui/cross/cross-crate-macro-backtrace/main.stderr +++ b/tests/ui/cross-crate/cross-crate-macro-backtrace.stderr @@ -1,5 +1,5 @@ error: 1 positional argument in format string, but no arguments were given - --> $DIR/main.rs:6:5 + --> $DIR/cross-crate-macro-backtrace.rs:6:5 | LL | myprintln!("{}"); | ^^^^^^^^^^^^^^^^ diff --git a/tests/ui/cross/cross-borrow-trait.rs b/tests/ui/cross/cross-borrow-trait.rs deleted file mode 100644 index 88ea78e44b3a4..0000000000000 --- a/tests/ui/cross/cross-borrow-trait.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Test that cross-borrowing (implicitly converting from `Box` to `&T`) is -// forbidden when `T` is a trait. - -//@ dont-require-annotations: NOTE - -struct Foo; -trait Trait { fn foo(&self) {} } -impl Trait for Foo {} - -pub fn main() { - let x: Box = Box::new(Foo); - let _y: &dyn Trait = x; //~ ERROR E0308 - //~| NOTE expected reference `&dyn Trait` - //~| NOTE found struct `Box` -} diff --git a/tests/ui/cross/cross-file-errors/main.rs b/tests/ui/macros/cross-file-errors.rs similarity index 100% rename from tests/ui/cross/cross-file-errors/main.rs rename to tests/ui/macros/cross-file-errors.rs diff --git a/tests/ui/cross/cross-file-errors/main.stderr b/tests/ui/macros/cross-file-errors.stderr similarity index 92% rename from tests/ui/cross/cross-file-errors/main.stderr rename to tests/ui/macros/cross-file-errors.stderr index db7b3a84fc8b3..70db7d5185eac 100644 --- a/tests/ui/cross/cross-file-errors/main.stderr +++ b/tests/ui/macros/cross-file-errors.stderr @@ -4,7 +4,7 @@ error: in expressions, `_` can only be used on the left-hand side of an assignme LL | _ | ^ `_` not allowed here | - ::: $DIR/main.rs:5:5 + ::: $DIR/cross-file-errors.rs:5:5 | LL | underscore!(); | ------------- in this macro invocation diff --git a/tests/ui/cross/cross-file-errors/underscore.rs b/tests/ui/macros/underscore.rs similarity index 100% rename from tests/ui/cross/cross-file-errors/underscore.rs rename to tests/ui/macros/underscore.rs diff --git a/tests/ui/cross/cross-fn-cache-hole.rs b/tests/ui/traits/cross-fn-cache-hole.rs similarity index 100% rename from tests/ui/cross/cross-fn-cache-hole.rs rename to tests/ui/traits/cross-fn-cache-hole.rs diff --git a/tests/ui/cross/cross-fn-cache-hole.stderr b/tests/ui/traits/cross-fn-cache-hole.stderr similarity index 100% rename from tests/ui/cross/cross-fn-cache-hole.stderr rename to tests/ui/traits/cross-fn-cache-hole.stderr From 2d419b597c80c993c3731147b38c8c1fa93cf919 Mon Sep 17 00:00:00 2001 From: mu001999 Date: Mon, 16 Mar 2026 22:21:54 +0800 Subject: [PATCH 24/35] Rename `parent_module` to `parent_scope` --- compiler/rustc_hir/src/attrs/data_structures.rs | 10 +++++----- compiler/rustc_metadata/src/rmeta/decoder.rs | 2 +- compiler/rustc_metadata/src/rmeta/encoder.rs | 2 +- compiler/rustc_resolve/src/diagnostics.rs | 10 +++------- compiler/rustc_resolve/src/lib.rs | 6 +++--- compiler/rustc_resolve/src/macros.rs | 2 +- 6 files changed, 14 insertions(+), 18 deletions(-) diff --git a/compiler/rustc_hir/src/attrs/data_structures.rs b/compiler/rustc_hir/src/attrs/data_structures.rs index e8476c3d8c73b..b5b9da1e8e00c 100644 --- a/compiler/rustc_hir/src/attrs/data_structures.rs +++ b/compiler/rustc_hir/src/attrs/data_structures.rs @@ -277,15 +277,15 @@ impl Default for MacroUseArgs { } #[derive(Debug, Clone, Encodable, Decodable, HashStable_Generic)] -pub struct StrippedCfgItem { - pub parent_module: ModId, +pub struct StrippedCfgItem { + pub parent_scope: ScopeId, pub ident: Ident, pub cfg: (CfgEntry, Span), } -impl StrippedCfgItem { - pub fn map_mod_id(self, f: impl FnOnce(ModId) -> New) -> StrippedCfgItem { - StrippedCfgItem { parent_module: f(self.parent_module), ident: self.ident, cfg: self.cfg } +impl StrippedCfgItem { + pub fn map_scope_id(self, f: impl FnOnce(ScopeId) -> New) -> StrippedCfgItem { + StrippedCfgItem { parent_scope: f(self.parent_scope), ident: self.ident, cfg: self.cfg } } } diff --git a/compiler/rustc_metadata/src/rmeta/decoder.rs b/compiler/rustc_metadata/src/rmeta/decoder.rs index 2fa8e19984b4c..fc541f952d229 100644 --- a/compiler/rustc_metadata/src/rmeta/decoder.rs +++ b/compiler/rustc_metadata/src/rmeta/decoder.rs @@ -1223,7 +1223,7 @@ impl<'a> CrateMetadataRef<'a> { .root .stripped_cfg_items .decode((self, tcx)) - .map(|item| item.map_mod_id(|index| DefId { krate: cnum, index })); + .map(|item| item.map_scope_id(|index| DefId { krate: cnum, index })); tcx.arena.alloc_from_iter(item_names) } diff --git a/compiler/rustc_metadata/src/rmeta/encoder.rs b/compiler/rustc_metadata/src/rmeta/encoder.rs index fbc7232f3a27d..e554da362f83e 100644 --- a/compiler/rustc_metadata/src/rmeta/encoder.rs +++ b/compiler/rustc_metadata/src/rmeta/encoder.rs @@ -2145,7 +2145,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> { self.tcx .stripped_cfg_items(LOCAL_CRATE) .into_iter() - .map(|item| item.clone().map_mod_id(|def_id| def_id.index)), + .map(|item| item.clone().map_scope_id(|def_id| def_id.index)), ) } diff --git a/compiler/rustc_resolve/src/diagnostics.rs b/compiler/rustc_resolve/src/diagnostics.rs index 12cc5649c41dd..927269d749960 100644 --- a/compiler/rustc_resolve/src/diagnostics.rs +++ b/compiler/rustc_resolve/src/diagnostics.rs @@ -3083,12 +3083,8 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { .stripped_cfg_items .iter() .filter_map(|item| { - let parent_module = self.opt_local_def_id(item.parent_module)?.to_def_id(); - Some(StrippedCfgItem { - parent_module, - ident: item.ident, - cfg: item.cfg.clone(), - }) + let parent_scope = self.opt_local_def_id(item.parent_scope)?.to_def_id(); + Some(StrippedCfgItem { parent_scope, ident: item.ident, cfg: item.cfg.clone() }) }) .collect::>(); local_items.as_slice() @@ -3096,7 +3092,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { self.tcx.stripped_cfg_items(module.krate) }; - for &StrippedCfgItem { parent_module, ident, ref cfg } in symbols { + for &StrippedCfgItem { parent_scope, ident, ref cfg } in symbols { if ident.name != *segment { continue; } diff --git a/compiler/rustc_resolve/src/lib.rs b/compiler/rustc_resolve/src/lib.rs index ead69473b00d1..7c942191d467f 100644 --- a/compiler/rustc_resolve/src/lib.rs +++ b/compiler/rustc_resolve/src/lib.rs @@ -1817,9 +1817,9 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { .stripped_cfg_items .into_iter() .filter_map(|item| { - let parent_module = - self.node_id_to_def_id.get(&item.parent_module)?.key().to_def_id(); - Some(StrippedCfgItem { parent_module, ident: item.ident, cfg: item.cfg }) + let parent_scope = + self.node_id_to_def_id.get(&item.parent_scope)?.key().to_def_id(); + Some(StrippedCfgItem { parent_scope, ident: item.ident, cfg: item.cfg }) }) .collect(); diff --git a/compiler/rustc_resolve/src/macros.rs b/compiler/rustc_resolve/src/macros.rs index 551d89ee6022a..ddf305237f392 100644 --- a/compiler/rustc_resolve/src/macros.rs +++ b/compiler/rustc_resolve/src/macros.rs @@ -512,7 +512,7 @@ impl<'ra, 'tcx> ResolverExpand for Resolver<'ra, 'tcx> { cfg_span: Span, ) { self.stripped_cfg_items.push(StrippedCfgItem { - parent_module: parent_node, + parent_scope: parent_node, ident, cfg: (cfg, cfg_span), }); From 757f224bce0cea63228034e68ca593f9ad11c5da Mon Sep 17 00:00:00 2001 From: mu001999 Date: Mon, 16 Mar 2026 22:22:25 +0800 Subject: [PATCH 25/35] Use nearest non block module as the correct parent module --- compiler/rustc_resolve/src/diagnostics.rs | 2 ++ tests/ui/resolve/pub-in-path-153848.rs | 9 +++++++++ tests/ui/resolve/pub-in-path-153848.stderr | 21 +++++++++++++++++++++ 3 files changed, 32 insertions(+) create mode 100644 tests/ui/resolve/pub-in-path-153848.rs create mode 100644 tests/ui/resolve/pub-in-path-153848.stderr diff --git a/compiler/rustc_resolve/src/diagnostics.rs b/compiler/rustc_resolve/src/diagnostics.rs index 927269d749960..f114682396301 100644 --- a/compiler/rustc_resolve/src/diagnostics.rs +++ b/compiler/rustc_resolve/src/diagnostics.rs @@ -3097,6 +3097,8 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { continue; } + let parent_module = self.get_nearest_non_block_module(parent_scope).def_id(); + fn comes_from_same_module_for_glob( r: &Resolver<'_, '_>, parent_module: DefId, diff --git a/tests/ui/resolve/pub-in-path-153848.rs b/tests/ui/resolve/pub-in-path-153848.rs new file mode 100644 index 0000000000000..40045e96987fc --- /dev/null +++ b/tests/ui/resolve/pub-in-path-153848.rs @@ -0,0 +1,9 @@ +//@ edition: 2015 + +pub(in a) mod aa { //~ ERROR cannot find module or crate `a` in the crate root +} +mod test { + #[cfg(test)] + use super::a; +} +fn main() {} diff --git a/tests/ui/resolve/pub-in-path-153848.stderr b/tests/ui/resolve/pub-in-path-153848.stderr new file mode 100644 index 0000000000000..06973a4c0bf33 --- /dev/null +++ b/tests/ui/resolve/pub-in-path-153848.stderr @@ -0,0 +1,21 @@ +error[E0433]: cannot find module or crate `a` in the crate root + --> $DIR/pub-in-path-153848.rs:3:8 + | +LL | pub(in a) mod aa { + | ^ use of unresolved module or unlinked crate `a` + | +note: found an item that was configured out + --> $DIR/pub-in-path-153848.rs:7:16 + | +LL | #[cfg(test)] + | ---- the item is gated here +LL | use super::a; + | ^ +help: you might be missing a crate named `a`, add it to your project and import it in your code + | +LL + extern crate a; + | + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0433`. From ccd16408934e3d590192a1e310f75647ca8437ed Mon Sep 17 00:00:00 2001 From: Alice Ryhl Date: Mon, 16 Mar 2026 14:26:44 +0000 Subject: [PATCH 26/35] Add missing needs-sanitizer-kasan directive name Using kasan naming instead of kernel-address to match existing use in src/tools/compiletest/src/directives/needs.rs --- src/tools/compiletest/src/directives/directive_names.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/tools/compiletest/src/directives/directive_names.rs b/src/tools/compiletest/src/directives/directive_names.rs index 2fc5c0e8ec1ee..0c55cd6fe8a79 100644 --- a/src/tools/compiletest/src/directives/directive_names.rs +++ b/src/tools/compiletest/src/directives/directive_names.rs @@ -176,6 +176,7 @@ pub(crate) const KNOWN_DIRECTIVE_NAMES: &[&str] = &[ "needs-sanitizer-cfi", "needs-sanitizer-dataflow", "needs-sanitizer-hwaddress", + "needs-sanitizer-kasan", "needs-sanitizer-kcfi", "needs-sanitizer-leak", "needs-sanitizer-memory", From 9b1eb935bcab03b831bf2b952e49da293522c128 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Mon, 16 Mar 2026 17:47:09 +0000 Subject: [PATCH 27/35] Tweak wording of failed predicate in inference error Special case message talking about `Predicate` that couldn't be satisfied when in inference errors so that we don't say "cannot satisfy `_: Trait`" and instead say "type must implement `Trait`". --- .../src/error_reporting/traits/ambiguity.rs | 15 +++++++++++++-- tests/ui/const-generics/issues/issue-83249.stderr | 2 +- .../ambig-hr-projection-issue-93340.old.stderr | 2 +- .../bugs/issue-88382.stderr | 2 +- .../in-trait/not-inferred-generic.stderr | 2 +- .../opaque-cast-field-access-in-future.stderr | 2 +- tests/ui/impl-trait/where-allowed-2.stderr | 2 +- tests/ui/impl-trait/where-allowed.stderr | 2 +- tests/ui/imports/import-trait-method.stderr | 2 +- .../inference/erase-type-params-in-label.stderr | 4 ++-- tests/ui/inference/issue-86162-1.stderr | 2 +- tests/ui/inference/issue-86162-2.stderr | 2 +- ...incorrect-impl-trait-in-path-suggestion.stderr | 2 +- .../ui/inference/question-mark-type-infer.stderr | 6 +++--- .../question-mark-type-inference-in-chain.rs | 2 +- .../question-mark-type-inference-in-chain.stderr | 2 +- .../types/into-inference-needs-type.stderr | 2 +- .../argument-with-unnecessary-method-call.stderr | 2 +- .../runaway-impl-candidate-selection.stderr | 2 +- .../ui/traits/overflow-computing-ambiguity.stderr | 2 +- .../panic-with-unspecified-type.stderr | 2 +- tests/ui/type-inference/sort_by_key.stderr | 2 +- tests/ui/type/type-annotation-needed.rs | 2 +- tests/ui/type/type-annotation-needed.stderr | 2 +- 24 files changed, 39 insertions(+), 28 deletions(-) diff --git a/compiler/rustc_trait_selection/src/error_reporting/traits/ambiguity.rs b/compiler/rustc_trait_selection/src/error_reporting/traits/ambiguity.rs index 2afc1b040353e..7de8891196d85 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/traits/ambiguity.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/traits/ambiguity.rs @@ -11,6 +11,7 @@ use rustc_infer::traits::util::elaborate; use rustc_infer::traits::{ Obligation, ObligationCause, ObligationCauseCode, PolyTraitObligation, PredicateObligation, }; +use rustc_middle::ty::print::PrintPolyTraitPredicateExt; use rustc_middle::ty::{self, Ty, TyCtxt, TypeVisitable as _, TypeVisitableExt as _}; use rustc_session::parse::feature_err_unstable_feature_bound; use rustc_span::{DUMMY_SP, ErrorGuaranteed, Span}; @@ -306,8 +307,18 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { err.cancel(); return e; } - let pred = self.tcx.short_string(predicate, &mut err.long_ty_path()); - err.note(format!("cannot satisfy `{pred}`")); + if let Some(clause) = predicate.as_trait_clause() + && let ty::Infer(_) = clause.self_ty().skip_binder().kind() + { + let tr = self.tcx.short_string( + clause.print_modifiers_and_trait_path(), + &mut err.long_ty_path(), + ); + err.note(format!("the type must implement `{tr}`")); + } else { + let pred = self.tcx.short_string(predicate, &mut err.long_ty_path()); + err.note(format!("cannot satisfy `{pred}`")); + } let impl_candidates = self.find_similar_impl_candidates(predicate.as_trait_clause().unwrap()); if impl_candidates.len() < 40 { diff --git a/tests/ui/const-generics/issues/issue-83249.stderr b/tests/ui/const-generics/issues/issue-83249.stderr index 2d561dbd6b1cc..2668348613a40 100644 --- a/tests/ui/const-generics/issues/issue-83249.stderr +++ b/tests/ui/const-generics/issues/issue-83249.stderr @@ -6,7 +6,7 @@ LL | let _ = foo([0; 1]); | | | required by a bound introduced by this call | - = note: cannot satisfy `_: Foo` + = note: the type must implement `Foo` help: the trait `Foo` is implemented for `u8` --> $DIR/issue-83249.rs:8:1 | diff --git a/tests/ui/generic-associated-types/ambig-hr-projection-issue-93340.old.stderr b/tests/ui/generic-associated-types/ambig-hr-projection-issue-93340.old.stderr index d913b2e91ca0e..58ed71fad4a66 100644 --- a/tests/ui/generic-associated-types/ambig-hr-projection-issue-93340.old.stderr +++ b/tests/ui/generic-associated-types/ambig-hr-projection-issue-93340.old.stderr @@ -4,7 +4,7 @@ error[E0283]: type annotations needed LL | cmp_eq | ^^^^^^ cannot infer type of the type parameter `A` declared on the function `cmp_eq` | - = note: cannot satisfy `_: Scalar` + = note: the type must implement `Scalar` note: required by a bound in `cmp_eq` --> $DIR/ambig-hr-projection-issue-93340.rs:10:22 | diff --git a/tests/ui/generic-associated-types/bugs/issue-88382.stderr b/tests/ui/generic-associated-types/bugs/issue-88382.stderr index ce20a4eeac040..dcadd5ce8deb8 100644 --- a/tests/ui/generic-associated-types/bugs/issue-88382.stderr +++ b/tests/ui/generic-associated-types/bugs/issue-88382.stderr @@ -4,7 +4,7 @@ error[E0283]: type annotations needed LL | do_something(SomeImplementation(), test); | ^^^^ cannot infer type of the type parameter `I` declared on the function `test` | - = note: cannot satisfy `_: Iterable` + = note: the type must implement `Iterable` help: the trait `Iterable` is implemented for `SomeImplementation` --> $DIR/issue-88382.rs:13:1 | diff --git a/tests/ui/impl-trait/in-trait/not-inferred-generic.stderr b/tests/ui/impl-trait/in-trait/not-inferred-generic.stderr index c08fc511500c5..14baf94598577 100644 --- a/tests/ui/impl-trait/in-trait/not-inferred-generic.stderr +++ b/tests/ui/impl-trait/in-trait/not-inferred-generic.stderr @@ -4,7 +4,7 @@ error[E0283]: type annotations needed LL | ().publish_typed(); | ^^^^^^^^^^^^^ cannot infer type of the type parameter `F` declared on the method `publish_typed` | - = note: cannot satisfy `_: Clone` + = note: the type must implement `Clone` = note: opaque types cannot be accessed directly on a `trait`, they can only be accessed through a specific `impl` note: required by a bound in `TypedClient::publish_typed::{anon_assoc#0}` --> $DIR/not-inferred-generic.rs:4:12 diff --git a/tests/ui/impl-trait/opaque-cast-field-access-in-future.stderr b/tests/ui/impl-trait/opaque-cast-field-access-in-future.stderr index 6866f3f5350b3..8abced84ab86b 100644 --- a/tests/ui/impl-trait/opaque-cast-field-access-in-future.stderr +++ b/tests/ui/impl-trait/opaque-cast-field-access-in-future.stderr @@ -7,7 +7,7 @@ LL | LL | loop {} | ------- return type was inferred to be `!` here | - = note: cannot satisfy `_: Future` + = note: the type must implement `Future` error: aborting due to 1 previous error diff --git a/tests/ui/impl-trait/where-allowed-2.stderr b/tests/ui/impl-trait/where-allowed-2.stderr index 83364e6e7724f..d731e5ce9e577 100644 --- a/tests/ui/impl-trait/where-allowed-2.stderr +++ b/tests/ui/impl-trait/where-allowed-2.stderr @@ -4,7 +4,7 @@ error[E0283]: type annotations needed LL | fn in_adt_in_return() -> Vec { panic!() } | ^^^^^^^^^^ cannot infer type | - = note: cannot satisfy `_: Debug` + = note: the type must implement `Debug` error: aborting due to 1 previous error diff --git a/tests/ui/impl-trait/where-allowed.stderr b/tests/ui/impl-trait/where-allowed.stderr index 2d97215de3bbe..2d925165d583a 100644 --- a/tests/ui/impl-trait/where-allowed.stderr +++ b/tests/ui/impl-trait/where-allowed.stderr @@ -374,7 +374,7 @@ error[E0283]: type annotations needed LL | fn in_dyn_Fn_return_in_return() -> &'static dyn Fn() -> impl Debug { panic!() } | ^^^^^^^^^^ cannot infer type | - = note: cannot satisfy `_: Debug` + = note: the type must implement `Debug` error[E0283]: type annotations needed --> $DIR/where-allowed.rs:65:46 diff --git a/tests/ui/imports/import-trait-method.stderr b/tests/ui/imports/import-trait-method.stderr index 8fe774111b962..1cb2d734a9258 100644 --- a/tests/ui/imports/import-trait-method.stderr +++ b/tests/ui/imports/import-trait-method.stderr @@ -14,7 +14,7 @@ error[E0283]: type annotations needed LL | fn main() { foo(); } | ^^^^^ cannot infer type | - = note: cannot satisfy `_: Foo` + = note: the type must implement `Foo` error: aborting due to 2 previous errors diff --git a/tests/ui/inference/erase-type-params-in-label.stderr b/tests/ui/inference/erase-type-params-in-label.stderr index 1ec8a33eb8205..5056d63586861 100644 --- a/tests/ui/inference/erase-type-params-in-label.stderr +++ b/tests/ui/inference/erase-type-params-in-label.stderr @@ -4,7 +4,7 @@ error[E0283]: type annotations needed for `Foo` LL | let foo = foo(1, ""); | ^^^ ---------- type must be known at this point | - = note: cannot satisfy `_: Default` + = note: the type must implement `Default` note: required by a bound in `foo` --> $DIR/erase-type-params-in-label.rs:25:17 | @@ -21,7 +21,7 @@ error[E0283]: type annotations needed for `Bar` LL | let bar = bar(1, ""); | ^^^ ---------- type must be known at this point | - = note: cannot satisfy `_: Default` + = note: the type must implement `Default` note: required by a bound in `bar` --> $DIR/erase-type-params-in-label.rs:14:17 | diff --git a/tests/ui/inference/issue-86162-1.stderr b/tests/ui/inference/issue-86162-1.stderr index fe3cee771609c..d36ea12f6f041 100644 --- a/tests/ui/inference/issue-86162-1.stderr +++ b/tests/ui/inference/issue-86162-1.stderr @@ -6,7 +6,7 @@ LL | foo(gen()); //<- Do not suggest `foo::()`! | | | required by a bound introduced by this call | - = note: cannot satisfy `_: Clone` + = note: the type must implement `Clone` note: required by a bound in `foo` --> $DIR/issue-86162-1.rs:3:16 | diff --git a/tests/ui/inference/issue-86162-2.stderr b/tests/ui/inference/issue-86162-2.stderr index 7b45b196629ec..adbc585d46924 100644 --- a/tests/ui/inference/issue-86162-2.stderr +++ b/tests/ui/inference/issue-86162-2.stderr @@ -6,7 +6,7 @@ LL | Foo::bar(gen()); //<- Do not suggest `Foo::bar::()`! | | | required by a bound introduced by this call | - = note: cannot satisfy `_: Clone` + = note: the type must implement `Clone` note: required by a bound in `Foo::bar` --> $DIR/issue-86162-2.rs:8:20 | diff --git a/tests/ui/inference/need_type_info/issue-113264-incorrect-impl-trait-in-path-suggestion.stderr b/tests/ui/inference/need_type_info/issue-113264-incorrect-impl-trait-in-path-suggestion.stderr index 455304524edc4..bf67c10098d56 100644 --- a/tests/ui/inference/need_type_info/issue-113264-incorrect-impl-trait-in-path-suggestion.stderr +++ b/tests/ui/inference/need_type_info/issue-113264-incorrect-impl-trait-in-path-suggestion.stderr @@ -6,7 +6,7 @@ LL | (S {}).owo(None) | | | required by a bound introduced by this call | - = note: cannot satisfy `_: T` + = note: the type must implement `T` note: required by a bound in `S::owo` --> $DIR/issue-113264-incorrect-impl-trait-in-path-suggestion.rs:6:35 | diff --git a/tests/ui/inference/question-mark-type-infer.stderr b/tests/ui/inference/question-mark-type-infer.stderr index 9e1232cb4a6fa..b531d42ff93cf 100644 --- a/tests/ui/inference/question-mark-type-infer.stderr +++ b/tests/ui/inference/question-mark-type-infer.stderr @@ -4,7 +4,7 @@ error[E0283]: type annotations needed LL | l.iter().map(f).collect()? | ^^^^^^^ cannot infer type of the type parameter `B` declared on the method `collect` | - = note: cannot satisfy `_: FromIterator>` + = note: the type must implement `FromIterator>` note: required by a bound in `collect` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL help: consider specifying the generic argument @@ -18,7 +18,7 @@ error[E0283]: type annotations needed LL | let x = l.iter().map(f).collect()?; | ^^^^^^^ cannot infer type of the type parameter `B` declared on the method `collect` | - = note: cannot satisfy `_: FromIterator>` + = note: the type must implement `FromIterator>` note: required by a bound in `collect` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL help: consider specifying the generic argument @@ -32,7 +32,7 @@ error[E0283]: type annotations needed LL | let x: Vec = l.iter().map(f).collect()?; | ^^^^^^^ cannot infer type of the type parameter `B` declared on the method `collect` | - = note: cannot satisfy `_: FromIterator>` + = note: the type must implement `FromIterator>` note: required by a bound in `collect` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL help: consider specifying the generic argument diff --git a/tests/ui/inference/question-mark-type-inference-in-chain.rs b/tests/ui/inference/question-mark-type-inference-in-chain.rs index 47c41e52b9acc..f3e36b7c40167 100644 --- a/tests/ui/inference/question-mark-type-inference-in-chain.rs +++ b/tests/ui/inference/question-mark-type-inference-in-chain.rs @@ -41,7 +41,7 @@ pub fn error2(lines: &[&str]) -> Result> { let mut tags: Vec = lines.iter().map(|e| parse(e)).collect()?; //~^ ERROR: type annotations needed //~| NOTE: cannot infer type of the type parameter `B` - //~| NOTE: cannot satisfy `_: FromIterator>` + //~| NOTE: the type must implement `FromIterator>` //~| NOTE: required by a bound in `collect` //~| HELP: consider specifying the generic argument tags.sort(); diff --git a/tests/ui/inference/question-mark-type-inference-in-chain.stderr b/tests/ui/inference/question-mark-type-inference-in-chain.stderr index 0c11cdccd174f..af8a5c8aebadc 100644 --- a/tests/ui/inference/question-mark-type-inference-in-chain.stderr +++ b/tests/ui/inference/question-mark-type-inference-in-chain.stderr @@ -18,7 +18,7 @@ error[E0283]: type annotations needed LL | let mut tags: Vec = lines.iter().map(|e| parse(e)).collect()?; | ^^^^^^^ cannot infer type of the type parameter `B` declared on the method `collect` | - = note: cannot satisfy `_: FromIterator>` + = note: the type must implement `FromIterator>` note: required by a bound in `collect` --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL help: consider specifying the generic argument diff --git a/tests/ui/suggestions/types/into-inference-needs-type.stderr b/tests/ui/suggestions/types/into-inference-needs-type.stderr index dd688f9028982..5fbc281072047 100644 --- a/tests/ui/suggestions/types/into-inference-needs-type.stderr +++ b/tests/ui/suggestions/types/into-inference-needs-type.stderr @@ -4,7 +4,7 @@ error[E0283]: type annotations needed LL | .into()?; | ^^^^ | - = note: cannot satisfy `_: From, {closure@$DIR/into-inference-needs-type.rs:10:14: 10:17}>, fn(Option<&str>) -> Option> {Option::>::Some}>>` + = note: the type must implement `From, {closure@$DIR/into-inference-needs-type.rs:10:14: 10:17}>, fn(Option<&str>) -> Option> {Option::>::Some}>>` = note: required for `FilterMap, {closure@$DIR/into-inference-needs-type.rs:10:14: 10:17}>, fn(Option<&str>) -> Option> {Option::>::Some}>` to implement `Into<_>` help: try using a fully qualified path to specify the expected types | diff --git a/tests/ui/trait-bounds/argument-with-unnecessary-method-call.stderr b/tests/ui/trait-bounds/argument-with-unnecessary-method-call.stderr index f0c9931252792..870a865f02dd6 100644 --- a/tests/ui/trait-bounds/argument-with-unnecessary-method-call.stderr +++ b/tests/ui/trait-bounds/argument-with-unnecessary-method-call.stderr @@ -6,7 +6,7 @@ LL | qux(Bar.into()); | | | required by a bound introduced by this call | - = note: cannot satisfy `_: From` + = note: the type must implement `From` note: required by a bound in `qux` --> $DIR/argument-with-unnecessary-method-call.rs:6:16 | diff --git a/tests/ui/traits/next-solver/assembly/runaway-impl-candidate-selection.stderr b/tests/ui/traits/next-solver/assembly/runaway-impl-candidate-selection.stderr index 4bd55ee80c6bb..ac427c8f0cba7 100644 --- a/tests/ui/traits/next-solver/assembly/runaway-impl-candidate-selection.stderr +++ b/tests/ui/traits/next-solver/assembly/runaway-impl-candidate-selection.stderr @@ -4,7 +4,7 @@ error[E0283]: type annotations needed LL | println!("{:?}", iter::<_>()); | ^^^^^^^^^ cannot infer type of the type parameter `T` declared on the function `iter` | - = note: cannot satisfy `_: Iterator` + = note: the type must implement `Iterator` note: required by a bound in `iter` --> $DIR/runaway-impl-candidate-selection.rs:8:12 | diff --git a/tests/ui/traits/overflow-computing-ambiguity.stderr b/tests/ui/traits/overflow-computing-ambiguity.stderr index ab59f14cb6d0a..f52f2e60757cc 100644 --- a/tests/ui/traits/overflow-computing-ambiguity.stderr +++ b/tests/ui/traits/overflow-computing-ambiguity.stderr @@ -4,7 +4,7 @@ error[E0283]: type annotations needed LL | hello(); | ^^^^^ cannot infer type of the type parameter `T` declared on the function `hello` | - = note: cannot satisfy `_: Hello` + = note: the type must implement `Hello` help: the following types implement trait `Hello` --> $DIR/overflow-computing-ambiguity.rs:8:1 | diff --git a/tests/ui/type-inference/panic-with-unspecified-type.stderr b/tests/ui/type-inference/panic-with-unspecified-type.stderr index cd8485f392bc7..99c6e83ef3225 100644 --- a/tests/ui/type-inference/panic-with-unspecified-type.stderr +++ b/tests/ui/type-inference/panic-with-unspecified-type.stderr @@ -7,7 +7,7 @@ LL | panic!(std::default::Default::default()); | | cannot infer type | required by a bound introduced by this call | - = note: cannot satisfy `_: Any` + = note: the type must implement `Any` note: required by a bound in `std::rt::begin_panic` --> $SRC_DIR/std/src/panicking.rs:LL:COL diff --git a/tests/ui/type-inference/sort_by_key.stderr b/tests/ui/type-inference/sort_by_key.stderr index 3d2e0250dd21c..74d89b2459f95 100644 --- a/tests/ui/type-inference/sort_by_key.stderr +++ b/tests/ui/type-inference/sort_by_key.stderr @@ -6,7 +6,7 @@ LL | lst.sort_by_key(|&(v, _)| v.iter().sum()); | | | type must be known at this point | - = note: cannot satisfy `_: Ord` + = note: the type must implement `Ord` note: required by a bound in `slice::::sort_by_key` --> $SRC_DIR/alloc/src/slice.rs:LL:COL help: consider specifying the generic argument diff --git a/tests/ui/type/type-annotation-needed.rs b/tests/ui/type/type-annotation-needed.rs index 347887f4bcfd5..a063ad77742a1 100644 --- a/tests/ui/type/type-annotation-needed.rs +++ b/tests/ui/type/type-annotation-needed.rs @@ -6,5 +6,5 @@ fn main() { foo(42); //~^ ERROR type annotations needed //~| NOTE cannot infer type - //~| NOTE cannot satisfy + //~| NOTE the type must implement } diff --git a/tests/ui/type/type-annotation-needed.stderr b/tests/ui/type/type-annotation-needed.stderr index 521d25537f3b9..78726643a3ab0 100644 --- a/tests/ui/type/type-annotation-needed.stderr +++ b/tests/ui/type/type-annotation-needed.stderr @@ -4,7 +4,7 @@ error[E0283]: type annotations needed LL | foo(42); | ^^^ cannot infer type of the type parameter `T` declared on the function `foo` | - = note: cannot satisfy `_: Into` + = note: the type must implement `Into` note: required by a bound in `foo` --> $DIR/type-annotation-needed.rs:1:11 | From 8155209828619951db645443e720e3a33c4046b9 Mon Sep 17 00:00:00 2001 From: Folkert de Vries Date: Mon, 16 Mar 2026 23:28:20 +0100 Subject: [PATCH 28/35] enable the `movrs` target feature in `core` and `std` --- library/core/src/lib.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/library/core/src/lib.rs b/library/core/src/lib.rs index 29869dd91982d..6ce1432011b47 100644 --- a/library/core/src/lib.rs +++ b/library/core/src/lib.rs @@ -182,6 +182,7 @@ #![feature(hexagon_target_feature)] #![feature(loongarch_target_feature)] #![feature(mips_target_feature)] +#![feature(movrs_target_feature)] #![feature(nvptx_target_feature)] #![feature(powerpc_target_feature)] #![feature(riscv_target_feature)] From 19e9ec7560a3d1a81bae2daa8dc6c2e2ad382cde Mon Sep 17 00:00:00 2001 From: Folkert de Vries Date: Sat, 14 Mar 2026 20:34:28 +0100 Subject: [PATCH 29/35] test `classify-runtime-const` for `f16` --- tests/assembly-llvm/asm/aarch64-types.rs | 6 +++--- tests/ui/float/classify-runtime-const.rs | 15 ++++++++++++++- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/tests/assembly-llvm/asm/aarch64-types.rs b/tests/assembly-llvm/asm/aarch64-types.rs index a304bf8688daa..fde0aad946951 100644 --- a/tests/assembly-llvm/asm/aarch64-types.rs +++ b/tests/assembly-llvm/asm/aarch64-types.rs @@ -98,8 +98,8 @@ pub unsafe fn issue_75761() { macro_rules! check { ($func:ident $ty:ident $class:ident $mov:literal $modifier:literal) => { - // FIXME(f16_f128): Change back to `$func(x: $ty) -> $ty` once arm64ec can pass and return - // `f16` and `f128` without LLVM erroring. + // FIXME(f128): Change back to `$func(x: $ty) -> $ty` once arm64ec can pass and return + // `f128` without LLVM erroring. // LLVM issue: #[no_mangle] pub unsafe fn $func(inp: &$ty, out: &mut $ty) { @@ -117,7 +117,7 @@ macro_rules! check { macro_rules! check_reg { ($func:ident $ty:ident $reg:tt $mov:literal) => { - // FIXME(f16_f128): See FIXME in `check!` + // FIXME(f128): See FIXME in `check!` #[no_mangle] pub unsafe fn $func(inp: &$ty, out: &mut $ty) { let x = *inp; diff --git a/tests/ui/float/classify-runtime-const.rs b/tests/ui/float/classify-runtime-const.rs index fb7361f9cbad5..5727d5d7b859d 100644 --- a/tests/ui/float/classify-runtime-const.rs +++ b/tests/ui/float/classify-runtime-const.rs @@ -2,7 +2,11 @@ //@ revisions: opt noopt ctfe //@[opt] compile-flags: -O //@[noopt] compile-flags: -Zmir-opt-level=0 +//@ min-llvm-version: 22 +//@ compile-flags: --check-cfg=cfg(target_has_reliable_f16) // ignore-tidy-linelength +#![feature(cfg_target_has_reliable_f16_f128)] +#![cfg_attr(target_has_reliable_f16, feature(f16))] // This tests the float classification functions, for regular runtime code and for const evaluation. @@ -50,6 +54,13 @@ macro_rules! assert_test { macro_rules! suite { ( $tyname:ident => $( $tt:tt )* ) => { + #[cfg(target_has_reliable_f16)] + fn f16() { + #[allow(unused)] + type $tyname = f16; + suite_inner!(f16 => $($tt)*); + } + fn f32() { #[allow(unused)] type $tyname = f32; @@ -121,7 +132,9 @@ suite! { T => // type alias for the type we are testing } fn main() { + #[cfg(target_has_reliable_f16)] + f16(); f32(); f64(); - // FIXME(f16_f128): also test f16 and f128 + // FIXME(f128): also test f128 } From 1814df18ef865e73e214fb1fed9c6ec05389044e Mon Sep 17 00:00:00 2001 From: ywxt Date: Mon, 16 Mar 2026 18:31:05 +0800 Subject: [PATCH 30/35] Run ui tests on the parallel frontend --- .../rustc-dev-guide/src/tests/compiletest.md | 17 ++ .../rustc-dev-guide/src/tests/directives.md | 2 + src/tools/compiletest/src/common.rs | 19 ++ src/tools/compiletest/src/directives.rs | 170 ++++++++++-------- src/tools/compiletest/src/directives/cfg.rs | 1 + .../src/directives/directive_names.rs | 1 + src/tools/compiletest/src/lib.rs | 26 ++- src/tools/compiletest/src/runtest.rs | 44 +++-- src/tools/compiletest/src/rustdoc_gui_test.rs | 2 + 9 files changed, 188 insertions(+), 94 deletions(-) diff --git a/src/doc/rustc-dev-guide/src/tests/compiletest.md b/src/doc/rustc-dev-guide/src/tests/compiletest.md index 6ca9653c18540..a239310d124ec 100644 --- a/src/doc/rustc-dev-guide/src/tests/compiletest.md +++ b/src/doc/rustc-dev-guide/src/tests/compiletest.md @@ -836,3 +836,20 @@ In CI, compare modes are only used in one Linux builder, and only with the follo Note that compare modes are separate to [revisions](#revisions). All revisions are tested when running `./x test tests/ui`, however compare-modes must be manually run individually via the `--compare-mode` flag. + +## Parallel frontend + +Compiletest can be run with the `--parallel-frontend-threads` flag to run the compiler in parallel mode. +This can be used to check that the compiler produces the same output in parallel mode as in non-parallel mode, and to check for any issues that might arise in parallel mode. + +To run the tests in parallel mode, you need to pass the `--parallel-frontend-threads` CLI flag: + +```bash +./x test tests/ui -- --parallel-frontend-threads=N --iteration-count=M +``` + +Where `N` is the number of threads to use for the parallel frontend, and `M` is the number of times to run each test in parallel mode (to increase the chances of catching any non-determinism). + +Also, when running with `--parallel-frontend-threads`, the `compare-output-by-lines` directive would be implied for all tests, since the output from the parallel frontend can be non-deterministic in terms of the order of lines. + +The parallel frontend is available in UI tests only at the moment, and is not currently supported in other test suites. diff --git a/src/doc/rustc-dev-guide/src/tests/directives.md b/src/doc/rustc-dev-guide/src/tests/directives.md index ac76a2e15d9ad..f160f3fffc10e 100644 --- a/src/doc/rustc-dev-guide/src/tests/directives.md +++ b/src/doc/rustc-dev-guide/src/tests/directives.md @@ -148,6 +148,7 @@ Some examples of `X` in `ignore-X` or `only-X`: - When [remote testing] is used: `remote` - When particular debuggers are being tested: `cdb`, `gdb`, `lldb` - When particular debugger versions are matched: `ignore-gdb-version` +- When the [parallel frontend] is enabled: `ignore-parallel-frontend` - Specific [compare modes]: `compare-mode-polonius`, `compare-mode-chalk`, `compare-mode-split-dwarf`, `compare-mode-split-dwarf-single` - The two different test modes used by coverage tests: @@ -233,6 +234,7 @@ The following directives will check LLVM support: See also [Debuginfo tests](compiletest.md#debuginfo-tests) for directives for ignoring debuggers. [remote testing]: running.md#running-tests-on-a-remote-machine +[parallel frontend]: compiletest.md#parallel-frontend [compare modes]: ui.md#compare-modes [`x86_64-gnu-debug`]: https://github.com/rust-lang/rust/blob/ab3dba92db355b8d97db915a2dca161a117e959c/src/ci/docker/host-x86_64/x86_64-gnu-debug/Dockerfile#L32 [`aarch64-gnu-debug`]: https://github.com/rust-lang/rust/blob/20c909ff9cdd88d33768a4ddb8952927a675b0ad/src/ci/docker/host-aarch64/aarch64-gnu-debug/Dockerfile#L32 diff --git a/src/tools/compiletest/src/common.rs b/src/tools/compiletest/src/common.rs index 54c0f2ec74309..bc94a81ba3b52 100644 --- a/src/tools/compiletest/src/common.rs +++ b/src/tools/compiletest/src/common.rs @@ -721,9 +721,17 @@ pub struct Config { /// /// This is forwarded from bootstrap's `jobs` configuration. pub jobs: u32, + + /// Number of parallel threads to use for the frontend when building test artifacts. + pub parallel_frontend_threads: u32, + /// Number of times to execute each test. + pub iteration_count: u32, } impl Config { + pub const DEFAULT_PARALLEL_FRONTEND_THREADS: u32 = 1; + pub const DEFAULT_ITERATION_COUNT: u32 = 1; + /// FIXME: this run scheme is... confusing. pub fn run_enabled(&self) -> bool { self.run.unwrap_or_else(|| { @@ -834,6 +842,17 @@ impl Config { || self.target_cfg().os == "emscripten"; !unsupported_target } + + /// Whether the parallel frontend is enabled, + /// which is the case when `parallel_frontend_threads` is not set to `1`. + /// + /// - `0` means auto-detect: use the number of available hardware threads on the host. + /// But we treat it as the parallel frontend being enabled in this case. + /// - `1` means single-threaded (parallel frontend disabled). + /// - `>1` means an explicitly configured thread count. + pub fn parallel_frontend_enabled(&self) -> bool { + self.parallel_frontend_threads != 1 + } } /// Known widths of `target_has_atomic`. diff --git a/src/tools/compiletest/src/directives.rs b/src/tools/compiletest/src/directives.rs index 462d9ae626b0a..b6a9a5b1b9f5f 100644 --- a/src/tools/compiletest/src/directives.rs +++ b/src/tools/compiletest/src/directives.rs @@ -67,7 +67,7 @@ impl EarlyProps { let mut props = EarlyProps::default(); iter_directives( - config.mode, + config, file_directives, // (dummy comment to force args into vertical layout) &mut |ln: &DirectiveLine<'_>| { @@ -362,7 +362,7 @@ impl TestProps { let file_directives = FileDirectives::from_file_contents(testfile, &file_contents); iter_directives( - config.mode, + config, &file_directives, // (dummy comment to force args into vertical layout) &mut |ln: &DirectiveLine<'_>| { @@ -574,43 +574,51 @@ fn check_directive<'a>( } fn iter_directives( - mode: TestMode, + config: &Config, file_directives: &FileDirectives<'_>, it: &mut dyn FnMut(&DirectiveLine<'_>), ) { let testfile = file_directives.path; - // Coverage tests in coverage-run mode always have these extra directives, without needing to - // specify them manually in every test file. - // - // FIXME(jieyouxu): I feel like there's a better way to do this, leaving for later. - if mode == TestMode::CoverageRun { - let extra_directives: &[&str] = &[ - "//@ needs-profiler-runtime", - // FIXME(pietroalbini): this test currently does not work on cross-compiled targets - // because remote-test is not capable of sending back the *.profraw files generated by - // the LLVM instrumentation. - "//@ ignore-cross-compile", - ]; - // Process the extra implied directives, with a dummy line number of 0. - for directive_str in extra_directives { - let directive_line = line_directive(testfile, LineNumber::ZERO, directive_str) - .unwrap_or_else(|| panic!("bad extra-directive line: {directive_str:?}")); - it(&directive_line); + let extra_directives = match config.mode { + TestMode::CoverageRun => { + // Coverage tests in coverage-run mode always have these extra directives, without needing to + // specify them manually in every test file. + // + // FIXME(jieyouxu): I feel like there's a better way to do this, leaving for later. + vec![ + "//@ needs-profiler-runtime", + // FIXME(pietroalbini): this test currently does not work on cross-compiled targets + // because remote-test is not capable of sending back the *.profraw files generated by + // the LLVM instrumentation. + "//@ ignore-cross-compile", + ] + } + TestMode::Codegen if !file_directives.has_explicit_no_std_core_attribute => { + // Note: affects all codegen test suites under test mode `codegen`, e.g. `codegen-llvm`. + // + // Codegen tests automatically receive implied `//@ needs-target-std`, unless + // `#![no_std]`/`#![no_core]` attribute was explicitly seen. The rationale is basically to avoid + // having to manually maintain a bunch of `//@ needs-target-std` directives esp. for targets + // tested/built out-of-tree. + vec!["//@ needs-target-std"] + } + TestMode::Ui if config.parallel_frontend_enabled() => { + // UI tests in parallel-frontend mode always have this extra directive, without needing to + // specify it manually in every test file. + vec!["//@ compare-output-by-lines"] } - } - // Note: affects all codegen test suites under test mode `codegen`, e.g. `codegen-llvm`. - // - // Codegen tests automatically receive implied `//@ needs-target-std`, unless - // `#![no_std]`/`#![no_core]` attribute was explicitly seen. The rationale is basically to avoid - // having to manually maintain a bunch of `//@ needs-target-std` directives esp. for targets - // tested/built out-of-tree. - if mode == TestMode::Codegen && !file_directives.has_explicit_no_std_core_attribute { - let implied_needs_target_std_line = - line_directive(testfile, LineNumber::ZERO, "//@ needs-target-std") - .expect("valid `needs-target-std` directive line"); - it(&implied_needs_target_std_line); + _ => { + // No extra directives for other test modes. + vec![] + } + }; + + for directive_str in extra_directives { + let directive_line = line_directive(testfile, LineNumber::ZERO, directive_str) + .unwrap_or_else(|| panic!("bad extra-directive line: {directive_str:?}")); + it(&directive_line); } for directive_line in &file_directives.lines { @@ -951,55 +959,52 @@ pub(crate) fn make_test_description( let mut should_fail = false; // Scan through the test file to handle `ignore-*`, `only-*`, and `needs-*` directives. - iter_directives( - config.mode, - file_directives, - &mut |ln @ &DirectiveLine { line_number, .. }| { - if !ln.applies_to_test_revision(test_revision) { - return; - } + iter_directives(config, file_directives, &mut |ln @ &DirectiveLine { line_number, .. }| { + if !ln.applies_to_test_revision(test_revision) { + return; + } + + // Parse `aux-*` directives, for use by up-to-date checks. + parse_and_update_aux(config, ln, aux_props); - // Parse `aux-*` directives, for use by up-to-date checks. - parse_and_update_aux(config, ln, aux_props); - - macro_rules! decision { - ($e:expr) => { - match $e { - IgnoreDecision::Ignore { reason } => { - ignore = true; - ignore_message = Some(reason.into()); - } - IgnoreDecision::Error { message } => { - error!("{path}:{line_number}: {message}"); - *poisoned = true; - return; - } - IgnoreDecision::Continue => {} + macro_rules! decision { + ($e:expr) => { + match $e { + IgnoreDecision::Ignore { reason } => { + ignore = true; + ignore_message = Some(reason.into()); } - }; - } + IgnoreDecision::Error { message } => { + error!("{path}:{line_number}: {message}"); + *poisoned = true; + return; + } + IgnoreDecision::Continue => {} + } + }; + } - decision!(cfg::handle_ignore(&cache.cfg_conditions, ln)); - decision!(cfg::handle_only(&cache.cfg_conditions, ln)); - decision!(needs::handle_needs(&cache.needs, config, ln)); - decision!(ignore_llvm(config, ln)); - decision!(ignore_backends(config, ln)); - decision!(needs_backends(config, ln)); - decision!(ignore_cdb(config, ln)); - decision!(ignore_gdb(config, ln)); - decision!(ignore_lldb(config, ln)); - - if config.target == "wasm32-unknown-unknown" - && config.parse_name_directive(ln, directives::CHECK_RUN_RESULTS) - { - decision!(IgnoreDecision::Ignore { - reason: "ignored on WASM as the run results cannot be checked there".into(), - }); - } + decision!(cfg::handle_ignore(&cache.cfg_conditions, ln)); + decision!(cfg::handle_only(&cache.cfg_conditions, ln)); + decision!(needs::handle_needs(&cache.needs, config, ln)); + decision!(ignore_llvm(config, ln)); + decision!(ignore_backends(config, ln)); + decision!(needs_backends(config, ln)); + decision!(ignore_cdb(config, ln)); + decision!(ignore_gdb(config, ln)); + decision!(ignore_lldb(config, ln)); + decision!(ignore_parallel_frontend(config, ln)); + + if config.target == "wasm32-unknown-unknown" + && config.parse_name_directive(ln, directives::CHECK_RUN_RESULTS) + { + decision!(IgnoreDecision::Ignore { + reason: "ignored on WASM as the run results cannot be checked there".into(), + }); + } - should_fail |= config.parse_name_directive(ln, "should-fail"); - }, - ); + should_fail |= config.parse_name_directive(ln, "should-fail"); + }); // The `should-fail` annotation doesn't apply to pretty tests, // since we run the pretty printer across all tests by default. @@ -1270,6 +1275,17 @@ fn ignore_llvm(config: &Config, line: &DirectiveLine<'_>) -> IgnoreDecision { IgnoreDecision::Continue } +fn ignore_parallel_frontend(config: &Config, line: &DirectiveLine<'_>) -> IgnoreDecision { + if config.parallel_frontend_enabled() + && config.parse_name_directive(line, "ignore-parallel-frontend") + { + return IgnoreDecision::Ignore { + reason: "ignored when the parallel frontend is enabled".into(), + }; + } + IgnoreDecision::Continue +} + enum IgnoreDecision { Ignore { reason: String }, Continue, diff --git a/src/tools/compiletest/src/directives/cfg.rs b/src/tools/compiletest/src/directives/cfg.rs index 6431eb6b090b1..2587acb7fe106 100644 --- a/src/tools/compiletest/src/directives/cfg.rs +++ b/src/tools/compiletest/src/directives/cfg.rs @@ -11,6 +11,7 @@ const EXTERNAL_IGNORES_LIST: &[&str] = &[ "ignore-backends", "ignore-gdb-version", "ignore-llvm-version", + "ignore-parallel-frontend", "ignore-pass", // tidy-alphabetical-end ]; diff --git a/src/tools/compiletest/src/directives/directive_names.rs b/src/tools/compiletest/src/directives/directive_names.rs index 2fc5c0e8ec1ee..eaf91ff26158d 100644 --- a/src/tools/compiletest/src/directives/directive_names.rs +++ b/src/tools/compiletest/src/directives/directive_names.rs @@ -101,6 +101,7 @@ pub(crate) const KNOWN_DIRECTIVE_NAMES: &[&str] = &[ "ignore-nvptx64", "ignore-nvptx64-nvidia-cuda", "ignore-openbsd", + "ignore-parallel-frontend", "ignore-pass", "ignore-powerpc", "ignore-powerpc64", diff --git a/src/tools/compiletest/src/lib.rs b/src/tools/compiletest/src/lib.rs index 82e8a0da6b609..6dae2ca0b4759 100644 --- a/src/tools/compiletest/src/lib.rs +++ b/src/tools/compiletest/src/lib.rs @@ -219,7 +219,14 @@ fn parse_config(args: Vec) -> Config { "CODEGEN BACKEND [NAME | PATH]", ) .optflag("", "bypass-ignore-backends", "ignore `//@ ignore-backends` directives") - .reqopt("", "jobs", "number of parallel jobs bootstrap was configured with", "JOBS"); + .reqopt("", "jobs", "number of parallel jobs bootstrap was configured with", "JOBS") + .optopt( + "", + "parallel-frontend-threads", + "number of parallel threads to use for the frontend when building test artifacts", + "THREADS_COUNT", + ) + .optopt("", "iteration-count", "number of times to execute each test", "COUNT"); let (argv0, args_) = args.split_first().unwrap(); if args.len() == 1 || args[1] == "-h" || args[1] == "--help" { @@ -369,6 +376,20 @@ fn parse_config(args: Vec) -> Config { None => panic!("`--jobs` is required"), }; + let parallel_frontend_threads = match matches.opt_str("parallel-frontend-threads") { + Some(threads) => { + threads.parse::().expect("expected `--parallel-frontend-threads` to be an `u32`") + } + None => Config::DEFAULT_PARALLEL_FRONTEND_THREADS, + }; + let iteration_count = match matches.opt_str("iteration-count") { + Some(count) => { + count.parse::().expect("expected `--iteration-count` to be a positive integer") + } + None => Config::DEFAULT_ITERATION_COUNT, + }; + assert!(iteration_count > 0, "`--iteration-count` must be a positive integer"); + Config { bless: matches.opt_present("bless"), fail_fast: matches.opt_present("fail-fast") @@ -489,6 +510,9 @@ fn parse_config(args: Vec) -> Config { bypass_ignore_backends: matches.opt_present("bypass-ignore-backends"), jobs, + + parallel_frontend_threads, + iteration_count, } } diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 69a9e04afe1ca..b674c6e29d424 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -272,22 +272,26 @@ impl<'test> TestCx<'test> { { self.fatal("cannot use should-ice in a test that is not cfail"); } - match self.config.mode { - TestMode::Pretty => self.run_pretty_test(), - TestMode::DebugInfo => self.run_debuginfo_test(), - TestMode::Codegen => self.run_codegen_test(), - TestMode::RustdocHtml => self.run_rustdoc_html_test(), - TestMode::RustdocJson => self.run_rustdoc_json_test(), - TestMode::CodegenUnits => self.run_codegen_units_test(), - TestMode::Incremental => self.run_incremental_test(), - TestMode::RunMake => self.run_rmake_test(), - TestMode::Ui => self.run_ui_test(), - TestMode::MirOpt => self.run_mir_opt_test(), - TestMode::Assembly => self.run_assembly_test(), - TestMode::RustdocJs => self.run_rustdoc_js_test(), - TestMode::CoverageMap => self.run_coverage_map_test(), // see self::coverage - TestMode::CoverageRun => self.run_coverage_run_test(), // see self::coverage - TestMode::Crashes => self.run_crash_test(), + // Run the test multiple times if requested. + // This is useful for catching flaky tests under the parallel frontend. + for _ in 0..self.config.iteration_count { + match self.config.mode { + TestMode::Pretty => self.run_pretty_test(), + TestMode::DebugInfo => self.run_debuginfo_test(), + TestMode::Codegen => self.run_codegen_test(), + TestMode::RustdocHtml => self.run_rustdoc_html_test(), + TestMode::RustdocJson => self.run_rustdoc_json_test(), + TestMode::CodegenUnits => self.run_codegen_units_test(), + TestMode::Incremental => self.run_incremental_test(), + TestMode::RunMake => self.run_rmake_test(), + TestMode::Ui => self.run_ui_test(), + TestMode::MirOpt => self.run_mir_opt_test(), + TestMode::Assembly => self.run_assembly_test(), + TestMode::RustdocJs => self.run_rustdoc_js_test(), + TestMode::CoverageMap => self.run_coverage_map_test(), // see self::coverage + TestMode::CoverageRun => self.run_coverage_run_test(), // see self::coverage + TestMode::Crashes => self.run_crash_test(), + } } } @@ -1752,6 +1756,14 @@ impl<'test> TestCx<'test> { compiler.arg("-Zwrite-long-types-to-disk=no"); // FIXME: use this for other modes too, for perf? compiler.arg("-Cstrip=debuginfo"); + + if self.config.parallel_frontend_enabled() { + // Currently, we only use multiple threads for the UI test suite, + // because UI tests can effectively verify the parallel frontend and + // require minimal modification. The option will later be extended to + // other test suites. + compiler.arg(&format!("-Zthreads={}", self.config.parallel_frontend_threads)); + } } TestMode::MirOpt => { // We check passes under test to minimize the mir-opt test dump diff --git a/src/tools/compiletest/src/rustdoc_gui_test.rs b/src/tools/compiletest/src/rustdoc_gui_test.rs index f02918ae683b0..c71fd714aa660 100644 --- a/src/tools/compiletest/src/rustdoc_gui_test.rs +++ b/src/tools/compiletest/src/rustdoc_gui_test.rs @@ -140,5 +140,7 @@ fn incomplete_config_for_rustdoc_gui_test() -> Config { override_codegen_backend: None, bypass_ignore_backends: Default::default(), jobs: Default::default(), + parallel_frontend_threads: Config::DEFAULT_PARALLEL_FRONTEND_THREADS, + iteration_count: Config::DEFAULT_ITERATION_COUNT, } } From 45b5d5f9bf5c18157becbaf0374c0876fa065855 Mon Sep 17 00:00:00 2001 From: Daria Sukhonina Date: Tue, 17 Mar 2026 12:11:13 +0300 Subject: [PATCH 31/35] Small report_cycle refactor --- compiler/rustc_query_impl/src/job.rs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/compiler/rustc_query_impl/src/job.rs b/compiler/rustc_query_impl/src/job.rs index 0b989201a2e06..0fc129f26e7f0 100644 --- a/compiler/rustc_query_impl/src/job.rs +++ b/compiler/rustc_query_impl/src/job.rs @@ -472,13 +472,10 @@ pub(crate) fn report_cycle<'tcx>( cycle_stack.push(crate::error::CycleStack { span, desc: node.tagged_key.description(tcx) }); } - let mut cycle_usage = None; - if let Some(usage) = usage { - cycle_usage = Some(crate::error::CycleUsage { - span: usage.node.tagged_key.default_span(tcx, usage.span), - usage: usage.node.tagged_key.description(tcx), - }); - } + let cycle_usage = usage.as_ref().map(|usage| crate::error::CycleUsage { + span: usage.node.tagged_key.default_span(tcx, usage.span), + usage: usage.node.tagged_key.description(tcx), + }); let alias = if stack .iter() From 6a0ce1665407d1a194fb389408e45854c47c9c7b Mon Sep 17 00:00:00 2001 From: ywxt Date: Tue, 17 Mar 2026 17:39:59 +0800 Subject: [PATCH 32/35] Ignore tests for the parallel frontend --- tests/ui/abi/simd-abi-checks-avx.rs | 2 +- .../ui/async-await/mutually-recursive-async-impl-trait-type.rs | 2 +- tests/ui/const-generics/issues/issue-100313.rs | 2 +- tests/ui/const-generics/min_const_generics/invalid-patterns.rs | 2 +- tests/ui/const-ptr/forbidden_slices.rs | 2 +- tests/ui/const-ptr/out_of_bounds_read.rs | 2 +- tests/ui/consts/chained-constants-stackoverflow.rs | 2 +- tests/ui/consts/const-compare-bytes-ub.rs | 2 +- tests/ui/consts/const-err-enum-discriminant.rs | 2 +- tests/ui/consts/const-eval/c-variadic-fail.rs | 2 +- .../consts/const-eval/const-pointer-values-in-various-types.rs | 2 +- tests/ui/consts/const-eval/heap/alloc_intrinsic_uninit.rs | 2 +- tests/ui/consts/const-eval/heap/dealloc_intrinsic_dangling.rs | 2 +- tests/ui/consts/const-eval/heap/dealloc_intrinsic_duplicate.rs | 2 +- .../const-eval/heap/dealloc_intrinsic_incorrect_layout.rs | 2 +- tests/ui/consts/const-eval/heap/make-global-dangling.rs | 2 +- tests/ui/consts/const-eval/heap/make-global-other.rs | 2 +- tests/ui/consts/const-eval/heap/make-global-twice.rs | 2 +- tests/ui/consts/const-eval/heap/ptr_made_global_mutated.rs | 2 +- tests/ui/consts/const-eval/index-out-of-bounds-never-type.rs | 2 +- tests/ui/consts/const-eval/issue-49296.rs | 2 +- tests/ui/consts/const-eval/issue-50814-2.rs | 2 +- tests/ui/consts/const-eval/issue-50814.rs | 2 +- tests/ui/consts/const-eval/ptr_fragments_mixed.rs | 2 +- tests/ui/consts/const-eval/raw-bytes.rs | 2 +- tests/ui/consts/const-eval/raw-pointer-ub.rs | 2 +- tests/ui/consts/const-eval/read_partial_ptr.rs | 2 +- tests/ui/consts/const-eval/ub-enum-overwrite.rs | 2 +- tests/ui/consts/const-eval/ub-enum.rs | 2 +- tests/ui/consts/const-eval/ub-incorrect-vtable.rs | 2 +- tests/ui/consts/const-eval/ub-nonnull.rs | 2 +- tests/ui/consts/const-eval/ub-ref-ptr.rs | 2 +- tests/ui/consts/const-eval/ub-upvars.rs | 2 +- tests/ui/consts/const-eval/ub-wide-ptr.rs | 2 +- tests/ui/consts/const-eval/union-const-eval-field.rs | 2 +- tests/ui/consts/const-eval/union-ice.rs | 2 +- tests/ui/consts/const-eval/union-ub.rs | 2 +- tests/ui/consts/const-item-no-type/in-macro.rs | 2 +- tests/ui/consts/copy-intrinsic.rs | 2 +- tests/ui/consts/interior-mut-const-via-union.rs | 2 +- tests/ui/consts/issue-63952.rs | 2 +- tests/ui/consts/issue-79690.rs | 2 +- tests/ui/consts/miri_unleashed/static-no-inner-mut.rs | 2 +- tests/ui/consts/missing_span_in_backtrace.rs | 2 +- tests/ui/consts/mono-reachable-invalid-const.rs | 2 +- tests/ui/consts/offset_ub.rs | 2 +- tests/ui/consts/recursive-zst-static.rs | 2 +- tests/ui/consts/required-consts/collect-in-called-fn.rs | 2 +- tests/ui/consts/required-consts/collect-in-dead-closure.rs | 2 +- tests/ui/consts/required-consts/collect-in-dead-drop.rs | 2 +- .../required-consts/collect-in-dead-fn-behind-assoc-type.rs | 2 +- .../consts/required-consts/collect-in-dead-fn-behind-generic.rs | 2 +- .../required-consts/collect-in-dead-fn-behind-opaque-type.rs | 2 +- tests/ui/consts/required-consts/collect-in-dead-fn.rs | 2 +- .../ui/consts/required-consts/collect-in-dead-fnptr-in-const.rs | 2 +- tests/ui/consts/required-consts/collect-in-dead-fnptr.rs | 2 +- tests/ui/consts/required-consts/collect-in-dead-forget.rs | 2 +- tests/ui/consts/required-consts/collect-in-dead-move.rs | 2 +- tests/ui/consts/required-consts/collect-in-dead-vtable.rs | 2 +- tests/ui/consts/required-consts/collect-in-promoted-const.rs | 2 +- tests/ui/consts/required-consts/interpret-in-const-called-fn.rs | 2 +- tests/ui/consts/required-consts/interpret-in-promoted.rs | 2 +- tests/ui/consts/required-consts/interpret-in-static.rs | 2 +- tests/ui/cycle-trait/cycle-trait-supertrait-indirect.rs | 2 +- tests/ui/cycle-trait/issue-12511.rs | 2 +- tests/ui/delegation/unsupported.rs | 2 +- tests/ui/dep-graph/dep-graph-assoc-type-codegen.rs | 2 +- tests/ui/dep-graph/dep-graph-caller-callee.rs | 2 +- tests/ui/dep-graph/dep-graph-struct-signature.rs | 2 +- .../ui/dep-graph/dep-graph-trait-impl-two-traits-same-method.rs | 2 +- tests/ui/dep-graph/dep-graph-trait-impl.rs | 2 +- tests/ui/dep-graph/dep-graph-type-alias.rs | 2 +- tests/ui/dep-graph/dep-graph-variance-alias.rs | 2 +- tests/ui/error-emitter/multiline-removal-suggestion.rs | 1 + .../ui/generic-associated-types/unknown-lifetime-ice-119827.rs | 2 +- tests/ui/impl-trait/auto-trait-leakage/auto-trait-leak.rs | 2 +- tests/ui/infinite/infinite-trait-alias-recursion.rs | 2 +- tests/ui/infinite/infinite-type-alias-mutual-recursion.rs | 2 +- tests/ui/inline-const/required-const.rs | 2 +- tests/ui/intrinsics/intrinsic-raw_eq-const-bad.rs | 2 +- tests/ui/issues/issue-17252.rs | 2 +- tests/ui/issues/issue-34373.rs | 2 +- tests/ui/lint/large_assignments/copy_into_box_rc_arc.rs | 2 +- tests/ui/lint/large_assignments/copy_into_fn.rs | 2 +- tests/ui/lint/large_assignments/inline_mir.rs | 2 +- tests/ui/lint/large_assignments/large_future.rs | 2 +- tests/ui/lint/large_assignments/move_into_fn.rs | 2 +- tests/ui/lint/non-snake-case/lint-uppercase-variables.rs | 2 +- .../rfc-2383-lint-reason/force_warn_expected_lints_fulfilled.rs | 2 +- tests/ui/liveness/liveness-unused.rs | 2 +- tests/ui/pattern/non-structural-match-types-cycle-err.rs | 2 +- tests/ui/recursion/issue-23302-3.rs | 2 +- tests/ui/resolve/proc_macro_generated_packed.rs | 2 +- tests/ui/resolve/resolve-self-in-impl.rs | 2 +- .../edition-lint-infer-outlives-macro.fixed | 2 +- .../edition-lint-infer-outlives-macro.rs | 2 +- tests/ui/simd/const-err-trumps-simd-err.rs | 2 +- tests/ui/structs/default-field-values/post-mono.rs | 2 +- tests/ui/traits/alias/infinite_normalization.rs | 2 +- tests/ui/type/pattern_types/validity.rs | 2 +- tests/ui/wf/ice-hir-wf-check-anon-const-issue-122989.rs | 2 +- 101 files changed, 101 insertions(+), 100 deletions(-) diff --git a/tests/ui/abi/simd-abi-checks-avx.rs b/tests/ui/abi/simd-abi-checks-avx.rs index 7432381d15b72..c68ba2fb5f890 100644 --- a/tests/ui/abi/simd-abi-checks-avx.rs +++ b/tests/ui/abi/simd-abi-checks-avx.rs @@ -1,7 +1,7 @@ //@ only-x86_64 //@ build-fail //@ compile-flags: -C target-feature=-avx - +//@ ignore-parallel-frontend post-monomorphization errors #![feature(portable_simd)] #![feature(simd_ffi)] #![allow(improper_ctypes_definitions)] diff --git a/tests/ui/async-await/mutually-recursive-async-impl-trait-type.rs b/tests/ui/async-await/mutually-recursive-async-impl-trait-type.rs index 645a136eeb4ee..69c4777ecb443 100644 --- a/tests/ui/async-await/mutually-recursive-async-impl-trait-type.rs +++ b/tests/ui/async-await/mutually-recursive-async-impl-trait-type.rs @@ -1,7 +1,7 @@ //@ edition:2018 // Test that impl trait does not allow creating recursive types that are // otherwise forbidden when using `async` and `await`. - +//@ ignore-parallel-frontend query cycle async fn rec_1() { //~ ERROR recursion in an async fn rec_2().await; } diff --git a/tests/ui/const-generics/issues/issue-100313.rs b/tests/ui/const-generics/issues/issue-100313.rs index 1f61356162ca6..3eed2e71ae859 100644 --- a/tests/ui/const-generics/issues/issue-100313.rs +++ b/tests/ui/const-generics/issues/issue-100313.rs @@ -1,5 +1,5 @@ //@ dont-require-annotations: NOTE - +//@ ignore-parallel-frontend different alloc ids #![allow(incomplete_features)] #![feature(adt_const_params, unsized_const_params)] diff --git a/tests/ui/const-generics/min_const_generics/invalid-patterns.rs b/tests/ui/const-generics/min_const_generics/invalid-patterns.rs index 85f019adf6649..847b51abb6af5 100644 --- a/tests/ui/const-generics/min_const_generics/invalid-patterns.rs +++ b/tests/ui/const-generics/min_const_generics/invalid-patterns.rs @@ -1,6 +1,6 @@ //@ stderr-per-bitwidth //@ dont-require-annotations: NOTE - +//@ ignore-parallel-frontend different alloc ids use std::mem::transmute; fn get_flag() -> Option { diff --git a/tests/ui/const-ptr/forbidden_slices.rs b/tests/ui/const-ptr/forbidden_slices.rs index fcb0dccf750e3..b7c02e6735b4e 100644 --- a/tests/ui/const-ptr/forbidden_slices.rs +++ b/tests/ui/const-ptr/forbidden_slices.rs @@ -1,7 +1,7 @@ // Strip out raw byte dumps to make comparison platform-independent: //@ normalize-stderr: "(the raw bytes of the constant) \(size: [0-9]*, align: [0-9]*\)" -> "$1 (size: $$SIZE, align: $$ALIGN)" //@ normalize-stderr: "([0-9a-f][0-9a-f] |╾─*A(LLOC)?[0-9]+(\+[a-z0-9]+)?()?─*╼ )+ *│.*" -> "HEX_DUMP" - +//@ ignore-parallel-frontend different alloc ids #![feature( slice_from_ptr_range, const_slice_from_ptr_range, diff --git a/tests/ui/const-ptr/out_of_bounds_read.rs b/tests/ui/const-ptr/out_of_bounds_read.rs index b09978badde5f..51accc657b81f 100644 --- a/tests/ui/const-ptr/out_of_bounds_read.rs +++ b/tests/ui/const-ptr/out_of_bounds_read.rs @@ -1,6 +1,6 @@ fn main() { use std::ptr; - +//@ ignore-parallel-frontend different alloc ids const DATA: [u32; 1] = [42]; const PAST_END_PTR: *const u32 = unsafe { DATA.as_ptr().add(1) }; diff --git a/tests/ui/consts/chained-constants-stackoverflow.rs b/tests/ui/consts/chained-constants-stackoverflow.rs index 0f0ce40a1edcc..0775ea56bbe00 100644 --- a/tests/ui/consts/chained-constants-stackoverflow.rs +++ b/tests/ui/consts/chained-constants-stackoverflow.rs @@ -1,5 +1,5 @@ //@ run-pass - +//@ ignore-parallel-frontend queries overflow the depth limit // https://github.com/rust-lang/rust/issues/34997 pub const CST_1: u32 = 0; diff --git a/tests/ui/consts/const-compare-bytes-ub.rs b/tests/ui/consts/const-compare-bytes-ub.rs index 7e3df92a2bf5a..f30507858f209 100644 --- a/tests/ui/consts/const-compare-bytes-ub.rs +++ b/tests/ui/consts/const-compare-bytes-ub.rs @@ -1,5 +1,5 @@ //@ check-fail - +//@ ignore-parallel-frontend different alloc ids #![feature(core_intrinsics, const_cmp)] use std::intrinsics::compare_bytes; use std::mem::MaybeUninit; diff --git a/tests/ui/consts/const-err-enum-discriminant.rs b/tests/ui/consts/const-err-enum-discriminant.rs index 5567460058434..f6142707f9223 100644 --- a/tests/ui/consts/const-err-enum-discriminant.rs +++ b/tests/ui/consts/const-err-enum-discriminant.rs @@ -1,5 +1,5 @@ //@ stderr-per-bitwidth - +//@ ignore-parallel-frontend different alloc ids #[derive(Copy, Clone)] union Foo { a: isize, diff --git a/tests/ui/consts/const-eval/c-variadic-fail.rs b/tests/ui/consts/const-eval/c-variadic-fail.rs index b5a400a8bf255..2cf5d05cb248f 100644 --- a/tests/ui/consts/const-eval/c-variadic-fail.rs +++ b/tests/ui/consts/const-eval/c-variadic-fail.rs @@ -1,5 +1,5 @@ //@ build-fail - +//@ ignore-parallel-frontend different alloc ids #![feature(c_variadic)] #![feature(const_c_variadic)] #![feature(const_trait_impl)] diff --git a/tests/ui/consts/const-eval/const-pointer-values-in-various-types.rs b/tests/ui/consts/const-eval/const-pointer-values-in-various-types.rs index 5720d6ea91ed5..c6aae902c8bdb 100644 --- a/tests/ui/consts/const-eval/const-pointer-values-in-various-types.rs +++ b/tests/ui/consts/const-eval/const-pointer-values-in-various-types.rs @@ -1,7 +1,7 @@ //@ only-x86_64 //@ stderr-per-bitwidth //@ dont-require-annotations: NOTE - +//@ ignore-parallel-frontend different alloc ids #[repr(C)] union Nonsense { u: usize, diff --git a/tests/ui/consts/const-eval/heap/alloc_intrinsic_uninit.rs b/tests/ui/consts/const-eval/heap/alloc_intrinsic_uninit.rs index c54115de2045d..3ef18a5f43695 100644 --- a/tests/ui/consts/const-eval/heap/alloc_intrinsic_uninit.rs +++ b/tests/ui/consts/const-eval/heap/alloc_intrinsic_uninit.rs @@ -3,7 +3,7 @@ #![feature(core_intrinsics)] #![feature(const_heap)] use std::intrinsics; - +//@ ignore-parallel-frontend different alloc ids const BAR: &i32 = unsafe { //~ ERROR: uninitialized memory // Make the pointer immutable to avoid errors related to mutable pointers in constants. &*(intrinsics::const_make_global(intrinsics::const_allocate(4, 4)) as *const i32) diff --git a/tests/ui/consts/const-eval/heap/dealloc_intrinsic_dangling.rs b/tests/ui/consts/const-eval/heap/dealloc_intrinsic_dangling.rs index de9fc5d092137..a377ee35d92b2 100644 --- a/tests/ui/consts/const-eval/heap/dealloc_intrinsic_dangling.rs +++ b/tests/ui/consts/const-eval/heap/dealloc_intrinsic_dangling.rs @@ -1,6 +1,6 @@ #![feature(core_intrinsics)] #![feature(const_heap)] - +//@ ignore-parallel-frontend different alloc ids // Strip out raw byte dumps to make comparison platform-independent: //@ normalize-stderr: "(the raw bytes of the constant) \(size: [0-9]*, align: [0-9]*\)" -> "$1 (size: $$SIZE, align: $$ALIGN)" //@ normalize-stderr: "([0-9a-f][0-9a-f] |╾─*A(LLOC)?[0-9]+(\+[a-z0-9]+)?()?─*╼ )+ *│.*" -> "HEX_DUMP" diff --git a/tests/ui/consts/const-eval/heap/dealloc_intrinsic_duplicate.rs b/tests/ui/consts/const-eval/heap/dealloc_intrinsic_duplicate.rs index 5b7cd039b9baa..bc9227b31f807 100644 --- a/tests/ui/consts/const-eval/heap/dealloc_intrinsic_duplicate.rs +++ b/tests/ui/consts/const-eval/heap/dealloc_intrinsic_duplicate.rs @@ -1,6 +1,6 @@ #![feature(core_intrinsics)] #![feature(const_heap)] - +//@ ignore-parallel-frontend different alloc ids use std::intrinsics; const _X: () = unsafe { diff --git a/tests/ui/consts/const-eval/heap/dealloc_intrinsic_incorrect_layout.rs b/tests/ui/consts/const-eval/heap/dealloc_intrinsic_incorrect_layout.rs index 75c3601f2166e..8800188e9036c 100644 --- a/tests/ui/consts/const-eval/heap/dealloc_intrinsic_incorrect_layout.rs +++ b/tests/ui/consts/const-eval/heap/dealloc_intrinsic_incorrect_layout.rs @@ -1,6 +1,6 @@ #![feature(core_intrinsics)] #![feature(const_heap)] - +//@ ignore-parallel-frontend different alloc ids use std::intrinsics; const _X: () = unsafe { diff --git a/tests/ui/consts/const-eval/heap/make-global-dangling.rs b/tests/ui/consts/const-eval/heap/make-global-dangling.rs index f4c5929bc416d..12b9ca7a6980f 100644 --- a/tests/ui/consts/const-eval/heap/make-global-dangling.rs +++ b/tests/ui/consts/const-eval/heap/make-global-dangling.rs @@ -1,5 +1,5 @@ // Ensure that we can't call `const_make_global` on dangling pointers. - +//@ ignore-parallel-frontend different alloc ids #![feature(core_intrinsics)] #![feature(const_heap)] diff --git a/tests/ui/consts/const-eval/heap/make-global-other.rs b/tests/ui/consts/const-eval/heap/make-global-other.rs index 4e2a59de13edc..9250f7a55be41 100644 --- a/tests/ui/consts/const-eval/heap/make-global-other.rs +++ b/tests/ui/consts/const-eval/heap/make-global-other.rs @@ -1,5 +1,5 @@ // Ensure that we can't call `const_make_global` on pointers not in the current interpreter. - +//@ ignore-parallel-frontend different alloc ids #![feature(core_intrinsics)] #![feature(const_heap)] diff --git a/tests/ui/consts/const-eval/heap/make-global-twice.rs b/tests/ui/consts/const-eval/heap/make-global-twice.rs index 0cd617cea3e6e..a4d01170812cc 100644 --- a/tests/ui/consts/const-eval/heap/make-global-twice.rs +++ b/tests/ui/consts/const-eval/heap/make-global-twice.rs @@ -1,5 +1,5 @@ // Ensure that we can't call `const_make_global` twice. - +//@ ignore-parallel-frontend different alloc ids #![feature(core_intrinsics)] #![feature(const_heap)] diff --git a/tests/ui/consts/const-eval/heap/ptr_made_global_mutated.rs b/tests/ui/consts/const-eval/heap/ptr_made_global_mutated.rs index bea2a5949c261..c405f73160481 100644 --- a/tests/ui/consts/const-eval/heap/ptr_made_global_mutated.rs +++ b/tests/ui/consts/const-eval/heap/ptr_made_global_mutated.rs @@ -2,7 +2,7 @@ #![feature(core_intrinsics)] #![feature(const_heap)] use std::intrinsics; - +//@ ignore-parallel-frontend different alloc ids const A: &u8 = unsafe { let ptr = intrinsics::const_allocate(1, 1); *ptr = 1; diff --git a/tests/ui/consts/const-eval/index-out-of-bounds-never-type.rs b/tests/ui/consts/const-eval/index-out-of-bounds-never-type.rs index 6777bee050a16..dbe507e3cd137 100644 --- a/tests/ui/consts/const-eval/index-out-of-bounds-never-type.rs +++ b/tests/ui/consts/const-eval/index-out-of-bounds-never-type.rs @@ -1,5 +1,5 @@ //@ build-fail - +//@ ignore-parallel-frontend post-monomorphization errors // Regression test for #66975 #![warn(unconditional_panic)] #![feature(never_type)] diff --git a/tests/ui/consts/const-eval/issue-49296.rs b/tests/ui/consts/const-eval/issue-49296.rs index a427b642899a5..35797fbf248bf 100644 --- a/tests/ui/consts/const-eval/issue-49296.rs +++ b/tests/ui/consts/const-eval/issue-49296.rs @@ -1,5 +1,5 @@ // issue-49296: Unsafe shenigans in constants can result in missing errors - +//@ ignore-parallel-frontend different alloc ids use std::mem::transmute; const fn wat(x: u64) -> &'static u64 { diff --git a/tests/ui/consts/const-eval/issue-50814-2.rs b/tests/ui/consts/const-eval/issue-50814-2.rs index 1b917a0916da3..34a200e2887b9 100644 --- a/tests/ui/consts/const-eval/issue-50814-2.rs +++ b/tests/ui/consts/const-eval/issue-50814-2.rs @@ -2,7 +2,7 @@ //@ revisions: normal mir-opt //@ [mir-opt]compile-flags: -Zmir-opt-level=4 //@ dont-require-annotations: NOTE - +//@ ignore-parallel-frontend post-monomorphization errors trait C { const BOO: usize; } diff --git a/tests/ui/consts/const-eval/issue-50814.rs b/tests/ui/consts/const-eval/issue-50814.rs index 011f065ad814b..3901a2c0c9316 100644 --- a/tests/ui/consts/const-eval/issue-50814.rs +++ b/tests/ui/consts/const-eval/issue-50814.rs @@ -1,6 +1,6 @@ //@ build-fail //@ dont-require-annotations: NOTE - +//@ ignore-parallel-frontend post-monomorphization errors trait Unsigned { const MAX: u8; } diff --git a/tests/ui/consts/const-eval/ptr_fragments_mixed.rs b/tests/ui/consts/const-eval/ptr_fragments_mixed.rs index 24169eac4780d..471d464055960 100644 --- a/tests/ui/consts/const-eval/ptr_fragments_mixed.rs +++ b/tests/ui/consts/const-eval/ptr_fragments_mixed.rs @@ -1,6 +1,6 @@ //! This mixes fragments from different pointers, in a way that we should not accept. //! See . - +//@ ignore-parallel-frontend different alloc ids static A: u8 = 123; static B: u8 = 123; diff --git a/tests/ui/consts/const-eval/raw-bytes.rs b/tests/ui/consts/const-eval/raw-bytes.rs index 199f4d1ea0e10..274b1ae039fbc 100644 --- a/tests/ui/consts/const-eval/raw-bytes.rs +++ b/tests/ui/consts/const-eval/raw-bytes.rs @@ -3,7 +3,7 @@ // ignore-tidy-linelength //@ normalize-stderr: "╾─*ALLOC[0-9]+(\+[a-z0-9]+)?()?─*╼" -> "╾ALLOC_ID$1╼" //@ dont-require-annotations: NOTE - +//@ ignore-parallel-frontend different alloc ids #![allow(invalid_value, unnecessary_transmutes)] #![feature(never_type, rustc_attrs, ptr_metadata, slice_from_ptr_range, const_slice_from_ptr_range)] diff --git a/tests/ui/consts/const-eval/raw-pointer-ub.rs b/tests/ui/consts/const-eval/raw-pointer-ub.rs index df7bc2fe4fb18..0998617b5b71d 100644 --- a/tests/ui/consts/const-eval/raw-pointer-ub.rs +++ b/tests/ui/consts/const-eval/raw-pointer-ub.rs @@ -4,7 +4,7 @@ const MISALIGNED_LOAD: () = unsafe { let _val = *ptr; //~NOTE: failed here //~^ERROR: based on pointer with alignment 1, but alignment 4 is required }; - +//@ ignore-parallel-frontend different alloc ids const MISALIGNED_STORE: () = unsafe { let mut mem = [0u32; 8]; let ptr = mem.as_mut_ptr().byte_add(1); diff --git a/tests/ui/consts/const-eval/read_partial_ptr.rs b/tests/ui/consts/const-eval/read_partial_ptr.rs index bccef9c0bc6ca..5248f92a92db4 100644 --- a/tests/ui/consts/const-eval/read_partial_ptr.rs +++ b/tests/ui/consts/const-eval/read_partial_ptr.rs @@ -1,5 +1,5 @@ //! Ensure we error when trying to load from a pointer whose provenance has been messed with. - +//@ ignore-parallel-frontend different alloc ids const PARTIAL_OVERWRITE: () = { let mut p = &42; // Overwrite one byte with a no-provenance value. diff --git a/tests/ui/consts/const-eval/ub-enum-overwrite.rs b/tests/ui/consts/const-eval/ub-enum-overwrite.rs index 005f3c78c1d7d..a1bd49f53acea 100644 --- a/tests/ui/consts/const-eval/ub-enum-overwrite.rs +++ b/tests/ui/consts/const-eval/ub-enum-overwrite.rs @@ -2,7 +2,7 @@ enum E { A(u8), B, } - +//@ ignore-parallel-frontend different alloc ids const _: u8 = { let mut e = E::A(1); let p = if let E::A(x) = &mut e { x as *mut u8 } else { unreachable!() }; diff --git a/tests/ui/consts/const-eval/ub-enum.rs b/tests/ui/consts/const-eval/ub-enum.rs index 63029e17da229..61ab3581e3479 100644 --- a/tests/ui/consts/const-eval/ub-enum.rs +++ b/tests/ui/consts/const-eval/ub-enum.rs @@ -4,7 +4,7 @@ //@ normalize-stderr: "0x0+" -> "0x0" //@ normalize-stderr: "0x[0-9](\.\.|\])" -> "0x%$1" //@ dont-require-annotations: NOTE - +//@ ignore-parallel-frontend different alloc ids #![feature(never_type)] #![allow(invalid_value, unnecessary_transmutes)] diff --git a/tests/ui/consts/const-eval/ub-incorrect-vtable.rs b/tests/ui/consts/const-eval/ub-incorrect-vtable.rs index 4185b0261b296..09129012e083c 100644 --- a/tests/ui/consts/const-eval/ub-incorrect-vtable.rs +++ b/tests/ui/consts/const-eval/ub-incorrect-vtable.rs @@ -12,7 +12,7 @@ //@ stderr-per-bitwidth //@ dont-require-annotations: NOTE - +//@ ignore-parallel-frontend different alloc ids trait Trait {} const INVALID_VTABLE_ALIGNMENT: &dyn Trait = diff --git a/tests/ui/consts/const-eval/ub-nonnull.rs b/tests/ui/consts/const-eval/ub-nonnull.rs index 851f3996cd104..daa4c40f98a96 100644 --- a/tests/ui/consts/const-eval/ub-nonnull.rs +++ b/tests/ui/consts/const-eval/ub-nonnull.rs @@ -2,7 +2,7 @@ //@ normalize-stderr: "(the raw bytes of the constant) \(size: [0-9]*, align: [0-9]*\)" -> "$1 (size: $$SIZE, align: $$ALIGN)" //@ normalize-stderr: "([0-9a-f][0-9a-f] |╾─*ALLOC[0-9]+(\+[a-z0-9]+)?─*╼ )+ *│.*" -> "HEX_DUMP" //@ dont-require-annotations: NOTE - +//@ ignore-parallel-frontend different alloc ids #![allow(invalid_value)] // make sure we cannot allow away the errors tested here #![feature(rustc_attrs, ptr_metadata)] diff --git a/tests/ui/consts/const-eval/ub-ref-ptr.rs b/tests/ui/consts/const-eval/ub-ref-ptr.rs index a5fdde1f9a4e9..f7421ee344463 100644 --- a/tests/ui/consts/const-eval/ub-ref-ptr.rs +++ b/tests/ui/consts/const-eval/ub-ref-ptr.rs @@ -6,7 +6,7 @@ //@ normalize-stderr: "0x[0-9](\.\.|\])" -> "0x%$1" #![feature(rustc_attrs)] #![allow(invalid_value)] - +//@ ignore-parallel-frontend different alloc ids use std::mem; #[repr(C)] diff --git a/tests/ui/consts/const-eval/ub-upvars.rs b/tests/ui/consts/const-eval/ub-upvars.rs index c5bf074ec4626..7270d90bf7927 100644 --- a/tests/ui/consts/const-eval/ub-upvars.rs +++ b/tests/ui/consts/const-eval/ub-upvars.rs @@ -1,7 +1,7 @@ //@ edition:2015..2021 //@ stderr-per-bitwidth #![allow(invalid_value)] // make sure we cannot allow away the errors tested here - +//@ ignore-parallel-frontend different alloc ids use std::mem; const BAD_UPVAR: &dyn FnOnce() = &{ //~ ERROR null reference diff --git a/tests/ui/consts/const-eval/ub-wide-ptr.rs b/tests/ui/consts/const-eval/ub-wide-ptr.rs index 0bbb104c0322c..6297d2f3d3af3 100644 --- a/tests/ui/consts/const-eval/ub-wide-ptr.rs +++ b/tests/ui/consts/const-eval/ub-wide-ptr.rs @@ -3,7 +3,7 @@ #![feature(ptr_metadata)] use std::{ptr, mem}; - +//@ ignore-parallel-frontend different alloc ids // Strip out raw byte dumps to make comparison platform-independent: //@ normalize-stderr: "(the raw bytes of the constant) \(size: [0-9]*, align: [0-9]*\)" -> "$1 (size: $$SIZE, align: $$ALIGN)" //@ normalize-stderr: "([0-9a-f][0-9a-f] |__ |╾─*ALLOC[0-9]+(\+[a-z0-9]+)?()?─*╼ )+ *│.*" -> "HEX_DUMP" diff --git a/tests/ui/consts/const-eval/union-const-eval-field.rs b/tests/ui/consts/const-eval/union-const-eval-field.rs index 2c9061a7a50f8..92d056b3b1ef8 100644 --- a/tests/ui/consts/const-eval/union-const-eval-field.rs +++ b/tests/ui/consts/const-eval/union-const-eval-field.rs @@ -1,7 +1,7 @@ //@ dont-require-annotations: NOTE //@ normalize-stderr: "(the raw bytes of the constant) \(size: [0-9]*, align: [0-9]*\)" -> "$1 (size: $$SIZE, align: $$ALIGN)" //@ normalize-stderr: "([[:xdigit:]]{2}\s){4}(__\s){4}\s+│\s+([?|\.]){4}\W{4}" -> "HEX_DUMP" - +//@ ignore-parallel-frontend different alloc ids type Field1 = i32; type Field2 = f32; type Field3 = i64; diff --git a/tests/ui/consts/const-eval/union-ice.rs b/tests/ui/consts/const-eval/union-ice.rs index 7a4909e8ce281..055a130cf0e89 100644 --- a/tests/ui/consts/const-eval/union-ice.rs +++ b/tests/ui/consts/const-eval/union-ice.rs @@ -1,5 +1,5 @@ //@ only-x86_64 - +//@ ignore-parallel-frontend different alloc ids type Field1 = i32; type Field3 = i64; diff --git a/tests/ui/consts/const-eval/union-ub.rs b/tests/ui/consts/const-eval/union-ub.rs index 0fa5d31285604..8de54f5749f35 100644 --- a/tests/ui/consts/const-eval/union-ub.rs +++ b/tests/ui/consts/const-eval/union-ub.rs @@ -1,6 +1,6 @@ //@ stderr-per-bitwidth //@ dont-require-annotations: NOTE - +//@ ignore-parallel-frontend different alloc ids #[repr(C)] union DummyUnion { unit: (), diff --git a/tests/ui/consts/const-item-no-type/in-macro.rs b/tests/ui/consts/const-item-no-type/in-macro.rs index c200a1fd0b41e..49bd3862852ec 100644 --- a/tests/ui/consts/const-item-no-type/in-macro.rs +++ b/tests/ui/consts/const-item-no-type/in-macro.rs @@ -8,7 +8,7 @@ macro_rules! suite { )* } } - +//@ ignore-parallel-frontend different infer type: bool suite! { len; is_empty; diff --git a/tests/ui/consts/copy-intrinsic.rs b/tests/ui/consts/copy-intrinsic.rs index 480f1c5f460d0..5329e5bc242ed 100644 --- a/tests/ui/consts/copy-intrinsic.rs +++ b/tests/ui/consts/copy-intrinsic.rs @@ -1,6 +1,6 @@ // ignore-tidy-linelength #![feature(core_intrinsics)] - +//@ ignore-parallel-frontend different alloc ids use std::intrinsics::{copy, copy_nonoverlapping}; use std::mem; diff --git a/tests/ui/consts/interior-mut-const-via-union.rs b/tests/ui/consts/interior-mut-const-via-union.rs index 5e624671aee02..cba3b36bd98a0 100644 --- a/tests/ui/consts/interior-mut-const-via-union.rs +++ b/tests/ui/consts/interior-mut-const-via-union.rs @@ -3,7 +3,7 @@ // //@ build-fail //@ stderr-per-bitwidth - +//@ ignore-parallel-frontend different alloc ids use std::cell::Cell; use std::mem::ManuallyDrop; diff --git a/tests/ui/consts/issue-63952.rs b/tests/ui/consts/issue-63952.rs index fce6013b4d310..c0ee7a5dc1e7e 100644 --- a/tests/ui/consts/issue-63952.rs +++ b/tests/ui/consts/issue-63952.rs @@ -1,6 +1,6 @@ // Regression test for #63952, shouldn't hang. //@ stderr-per-bitwidth - +//@ ignore-parallel-frontend different alloc ids #[repr(C)] #[derive(Copy, Clone)] struct SliceRepr { diff --git a/tests/ui/consts/issue-79690.rs b/tests/ui/consts/issue-79690.rs index 24e3220155d18..5e1e65cdb8d57 100644 --- a/tests/ui/consts/issue-79690.rs +++ b/tests/ui/consts/issue-79690.rs @@ -1,7 +1,7 @@ //@ ignore-32bit // This test gives a different error on 32-bit architectures. //@ stderr-per-bitwidth - +//@ ignore-parallel-frontend different alloc ids union Transmute { t: T, u: U, diff --git a/tests/ui/consts/miri_unleashed/static-no-inner-mut.rs b/tests/ui/consts/miri_unleashed/static-no-inner-mut.rs index 0e87442f6a698..27eb9a6c7c344 100644 --- a/tests/ui/consts/miri_unleashed/static-no-inner-mut.rs +++ b/tests/ui/consts/miri_unleashed/static-no-inner-mut.rs @@ -1,6 +1,6 @@ //@ stderr-per-bitwidth //@ compile-flags: -Zunleash-the-miri-inside-of-you - +//@ ignore-parallel-frontend different alloc ids // All "inner" allocations that come with a `static` are interned immutably. This means it is // crucial that we do not accept any form of (interior) mutability there. use std::sync::atomic::*; diff --git a/tests/ui/consts/missing_span_in_backtrace.rs b/tests/ui/consts/missing_span_in_backtrace.rs index b679493eb08eb..897b37b3e65ae 100644 --- a/tests/ui/consts/missing_span_in_backtrace.rs +++ b/tests/ui/consts/missing_span_in_backtrace.rs @@ -1,7 +1,7 @@ //! Check what happens when the error occurs inside a std function that we can't print the span of. //@ ignore-backends: gcc //@ compile-flags: -Z ui-testing=no --diagnostic-width=80 - +//@ ignore-parallel-frontend different alloc ids use std::{ mem::{self, MaybeUninit}, ptr, diff --git a/tests/ui/consts/mono-reachable-invalid-const.rs b/tests/ui/consts/mono-reachable-invalid-const.rs index aba41dabe71f9..3d76e4a65a4e2 100644 --- a/tests/ui/consts/mono-reachable-invalid-const.rs +++ b/tests/ui/consts/mono-reachable-invalid-const.rs @@ -1,5 +1,5 @@ //@ build-fail - +//@ ignore-parallel-frontend post-monomorphization errors struct Bar; impl Bar { diff --git a/tests/ui/consts/offset_ub.rs b/tests/ui/consts/offset_ub.rs index 98a50156a9487..c9c34e19e4dd6 100644 --- a/tests/ui/consts/offset_ub.rs +++ b/tests/ui/consts/offset_ub.rs @@ -1,5 +1,5 @@ use std::ptr; - +//@ ignore-parallel-frontend different alloc ids //@ normalize-stderr: "0xf+" -> "0xf..f" //@ normalize-stderr: "0x7f+" -> "0x7f..f" //@ normalize-stderr: "\d+ bytes" -> "$$BYTES bytes" diff --git a/tests/ui/consts/recursive-zst-static.rs b/tests/ui/consts/recursive-zst-static.rs index 853af6d70eb09..003707aeeab6f 100644 --- a/tests/ui/consts/recursive-zst-static.rs +++ b/tests/ui/consts/recursive-zst-static.rs @@ -1,6 +1,6 @@ //@ revisions: default unleash //@[unleash]compile-flags: -Zunleash-the-miri-inside-of-you - +//@ ignore-parallel-frontend query cycle // This test ensures that we do not allow ZST statics to initialize themselves without ever // actually creating a value of that type. This is important, as the ZST may have private fields // that users can reasonably expect to only get initialized by their own code. Thus unsafe code diff --git a/tests/ui/consts/required-consts/collect-in-called-fn.rs b/tests/ui/consts/required-consts/collect-in-called-fn.rs index 2045b8266c792..d07c0927a16a9 100644 --- a/tests/ui/consts/required-consts/collect-in-called-fn.rs +++ b/tests/ui/consts/required-consts/collect-in-called-fn.rs @@ -4,7 +4,7 @@ //@[opt] compile-flags: -O //! Make sure we detect erroneous constants post-monomorphization even when they are unused. This is //! crucial, people rely on it for soundness. (https://github.com/rust-lang/rust/issues/112090) - +//@ ignore-parallel-frontend post-monomorphization errors struct Fail(T); impl Fail { const C: () = panic!(); //~ERROR evaluation panicked: explicit panic diff --git a/tests/ui/consts/required-consts/collect-in-dead-closure.rs b/tests/ui/consts/required-consts/collect-in-dead-closure.rs index 5f8b6bbb174c4..825336e9d3ef3 100644 --- a/tests/ui/consts/required-consts/collect-in-dead-closure.rs +++ b/tests/ui/consts/required-consts/collect-in-dead-closure.rs @@ -3,7 +3,7 @@ //@[noopt] compile-flags: -Copt-level=0 //@[opt] compile-flags: -O //! This fails without optimizations, so it should also fail with optimizations. - +//@ ignore-parallel-frontend post-monomorphization errors struct Fail(T); impl Fail { const C: () = panic!(); //~ERROR evaluation panicked: explicit panic diff --git a/tests/ui/consts/required-consts/collect-in-dead-drop.rs b/tests/ui/consts/required-consts/collect-in-dead-drop.rs index f7293d162df7b..fa9b8730c11c9 100644 --- a/tests/ui/consts/required-consts/collect-in-dead-drop.rs +++ b/tests/ui/consts/required-consts/collect-in-dead-drop.rs @@ -3,7 +3,7 @@ //@[noopt] compile-flags: -Copt-level=0 //@[opt] compile-flags: -O //! This fails without optimizations, so it should also fail with optimizations. - +//@ ignore-parallel-frontend post-monomorphization errors struct Fail(T); impl Fail { const C: () = panic!(); //~ERROR evaluation panicked: explicit panic diff --git a/tests/ui/consts/required-consts/collect-in-dead-fn-behind-assoc-type.rs b/tests/ui/consts/required-consts/collect-in-dead-fn-behind-assoc-type.rs index e6be9f56cb7a0..a76481b673132 100644 --- a/tests/ui/consts/required-consts/collect-in-dead-fn-behind-assoc-type.rs +++ b/tests/ui/consts/required-consts/collect-in-dead-fn-behind-assoc-type.rs @@ -4,7 +4,7 @@ //@[noopt] compile-flags: -Copt-level=0 //@[opt] compile-flags: -O //! This fails without optimizations, so it should also fail with optimizations. - +//@ ignore-parallel-frontend post-monomorphization errors struct Fail(T); impl Fail { const C: () = panic!(); //~ERROR evaluation panicked: explicit panic diff --git a/tests/ui/consts/required-consts/collect-in-dead-fn-behind-generic.rs b/tests/ui/consts/required-consts/collect-in-dead-fn-behind-generic.rs index a86902af52677..4fe05db34d78e 100644 --- a/tests/ui/consts/required-consts/collect-in-dead-fn-behind-generic.rs +++ b/tests/ui/consts/required-consts/collect-in-dead-fn-behind-generic.rs @@ -3,7 +3,7 @@ //@[noopt] compile-flags: -Copt-level=0 //@[opt] compile-flags: -O //! This fails without optimizations, so it should also fail with optimizations. - +//@ ignore-parallel-frontend post-monomorphization errors struct Fail(T); impl Fail { const C: () = panic!(); //~ERROR evaluation panicked: explicit panic diff --git a/tests/ui/consts/required-consts/collect-in-dead-fn-behind-opaque-type.rs b/tests/ui/consts/required-consts/collect-in-dead-fn-behind-opaque-type.rs index 4cdb27413540f..a6132ef1fe07e 100644 --- a/tests/ui/consts/required-consts/collect-in-dead-fn-behind-opaque-type.rs +++ b/tests/ui/consts/required-consts/collect-in-dead-fn-behind-opaque-type.rs @@ -4,7 +4,7 @@ //@[opt] compile-flags: -O //! This fails without optimizations, so it should also fail with optimizations. #![feature(type_alias_impl_trait)] - +//@ ignore-parallel-frontend post-monomorphization errors mod m { struct Fail(T); impl Fail { diff --git a/tests/ui/consts/required-consts/collect-in-dead-fn.rs b/tests/ui/consts/required-consts/collect-in-dead-fn.rs index 0c4795801068d..f4627323249d4 100644 --- a/tests/ui/consts/required-consts/collect-in-dead-fn.rs +++ b/tests/ui/consts/required-consts/collect-in-dead-fn.rs @@ -3,7 +3,7 @@ //@[noopt] compile-flags: -Copt-level=0 //@[opt] compile-flags: -O //! This fails without optimizations, so it should also fail with optimizations. - +//@ ignore-parallel-frontend post-monomorphization errors struct Fail(T); impl Fail { const C: () = panic!(); //~ERROR evaluation panicked: explicit panic diff --git a/tests/ui/consts/required-consts/collect-in-dead-fnptr-in-const.rs b/tests/ui/consts/required-consts/collect-in-dead-fnptr-in-const.rs index 04544cb413984..8808a4e26f0cb 100644 --- a/tests/ui/consts/required-consts/collect-in-dead-fnptr-in-const.rs +++ b/tests/ui/consts/required-consts/collect-in-dead-fnptr-in-const.rs @@ -3,7 +3,7 @@ //@[noopt] compile-flags: -Copt-level=0 //@[opt] compile-flags: -O //! This fails without optimizations, so it should also fail with optimizations. - +//@ ignore-parallel-frontend post-monomorphization errors struct Late(T); impl Late { const FAIL: () = panic!(); //~ERROR evaluation panicked: explicit panic diff --git a/tests/ui/consts/required-consts/collect-in-dead-fnptr.rs b/tests/ui/consts/required-consts/collect-in-dead-fnptr.rs index 4cdb50f4385a1..1a9b99f9868f6 100644 --- a/tests/ui/consts/required-consts/collect-in-dead-fnptr.rs +++ b/tests/ui/consts/required-consts/collect-in-dead-fnptr.rs @@ -3,7 +3,7 @@ //@[noopt] compile-flags: -Copt-level=0 //@[opt] compile-flags: -O //! This fails without optimizations, so it should also fail with optimizations. - +//@ ignore-parallel-frontend post-monomorphization errors struct Fail(T); impl Fail { const C: () = panic!(); //~ERROR evaluation panicked: explicit panic diff --git a/tests/ui/consts/required-consts/collect-in-dead-forget.rs b/tests/ui/consts/required-consts/collect-in-dead-forget.rs index 7586004116c36..bc717edbe73ee 100644 --- a/tests/ui/consts/required-consts/collect-in-dead-forget.rs +++ b/tests/ui/consts/required-consts/collect-in-dead-forget.rs @@ -3,7 +3,7 @@ //@[noopt] compile-flags: -Copt-level=0 //@[opt] compile-flags: -O //! This passes without optimizations, so it can (and should) also pass with optimizations. - +//@ ignore-parallel-frontend post-monomorphization errors struct Fail(T); impl Fail { const C: () = panic!(); diff --git a/tests/ui/consts/required-consts/collect-in-dead-move.rs b/tests/ui/consts/required-consts/collect-in-dead-move.rs index 4e2d959db32c7..05491136e8d5e 100644 --- a/tests/ui/consts/required-consts/collect-in-dead-move.rs +++ b/tests/ui/consts/required-consts/collect-in-dead-move.rs @@ -3,7 +3,7 @@ //@[noopt] compile-flags: -Copt-level=0 //@[opt] compile-flags: -O //! This fails without optimizations, so it should also fail with optimizations. - +//@ ignore-parallel-frontend post-monomorphization errors struct Fail(T); impl Fail { const C: () = panic!(); //~ERROR evaluation panicked: explicit panic diff --git a/tests/ui/consts/required-consts/collect-in-dead-vtable.rs b/tests/ui/consts/required-consts/collect-in-dead-vtable.rs index d4ad730837730..1ca52064a3fdd 100644 --- a/tests/ui/consts/required-consts/collect-in-dead-vtable.rs +++ b/tests/ui/consts/required-consts/collect-in-dead-vtable.rs @@ -3,7 +3,7 @@ //@[noopt] compile-flags: -Copt-level=0 //@[opt] compile-flags: -O //! This fails without optimizations, so it should also fail with optimizations. - +//@ ignore-parallel-frontend post-monomorphization errors struct Fail(T); impl Fail { const C: () = panic!(); //~ERROR evaluation panicked: explicit panic diff --git a/tests/ui/consts/required-consts/collect-in-promoted-const.rs b/tests/ui/consts/required-consts/collect-in-promoted-const.rs index c475720938697..415f22fd05dda 100644 --- a/tests/ui/consts/required-consts/collect-in-promoted-const.rs +++ b/tests/ui/consts/required-consts/collect-in-promoted-const.rs @@ -3,7 +3,7 @@ //@[noopt] compile-flags: -Copt-level=0 //@[opt] compile-flags: -O //! Make sure we error on erroneous consts even if they get promoted. - +//@ ignore-parallel-frontend post-monomorphization errors struct Fail(T); impl Fail { const C: () = panic!(); //~ERROR evaluation panicked: explicit panic diff --git a/tests/ui/consts/required-consts/interpret-in-const-called-fn.rs b/tests/ui/consts/required-consts/interpret-in-const-called-fn.rs index 9309457e22a46..2d63c620a0384 100644 --- a/tests/ui/consts/required-consts/interpret-in-const-called-fn.rs +++ b/tests/ui/consts/required-consts/interpret-in-const-called-fn.rs @@ -2,7 +2,7 @@ //@[noopt] compile-flags: -Copt-level=0 //@[opt] compile-flags: -O //! Make sure we error on erroneous consts even if they are unused. - +//@ ignore-parallel-frontend post-monomorphization errors struct Fail(T); impl Fail { const C: () = panic!(); //~ERROR explicit panic diff --git a/tests/ui/consts/required-consts/interpret-in-promoted.rs b/tests/ui/consts/required-consts/interpret-in-promoted.rs index b223e6d16aa12..cbb1a309006c5 100644 --- a/tests/ui/consts/required-consts/interpret-in-promoted.rs +++ b/tests/ui/consts/required-consts/interpret-in-promoted.rs @@ -2,7 +2,7 @@ //@[noopt] compile-flags: -Copt-level=0 //@[opt] compile-flags: -O //@ dont-require-annotations: NOTE - +//@ ignore-parallel-frontend post-monomorphization errors //! Make sure we evaluate const fn calls even if they get promoted and their result ignored. const unsafe fn ub() { diff --git a/tests/ui/consts/required-consts/interpret-in-static.rs b/tests/ui/consts/required-consts/interpret-in-static.rs index 19ad6be1c9fa7..edc7b1d01fd6c 100644 --- a/tests/ui/consts/required-consts/interpret-in-static.rs +++ b/tests/ui/consts/required-consts/interpret-in-static.rs @@ -2,7 +2,7 @@ //@[noopt] compile-flags: -Copt-level=0 //@[opt] compile-flags: -O //! Make sure we error on erroneous consts even if they are unused. - +//@ ignore-parallel-frontend post-monomorphization errors struct Fail(T); impl Fail { const C: () = panic!(); //~ERROR explicit panic diff --git a/tests/ui/cycle-trait/cycle-trait-supertrait-indirect.rs b/tests/ui/cycle-trait/cycle-trait-supertrait-indirect.rs index 9a72b65da883e..3324444d3351b 100644 --- a/tests/ui/cycle-trait/cycle-trait-supertrait-indirect.rs +++ b/tests/ui/cycle-trait/cycle-trait-supertrait-indirect.rs @@ -1,6 +1,6 @@ // Test a supertrait cycle where the first trait we find (`A`) is not // a direct participant in the cycle. - +//@ ignore-parallel-frontend query cycle trait A: B { } diff --git a/tests/ui/cycle-trait/issue-12511.rs b/tests/ui/cycle-trait/issue-12511.rs index ea83e3fd9dc2f..1d33b03c57a2c 100644 --- a/tests/ui/cycle-trait/issue-12511.rs +++ b/tests/ui/cycle-trait/issue-12511.rs @@ -1,7 +1,7 @@ trait T1 : T2 { //~^ ERROR cycle detected } - +//@ ignore-parallel-frontend query cycle trait T2 : T1 { } diff --git a/tests/ui/delegation/unsupported.rs b/tests/ui/delegation/unsupported.rs index adb798aab71d0..af3b87ee7c8c5 100644 --- a/tests/ui/delegation/unsupported.rs +++ b/tests/ui/delegation/unsupported.rs @@ -2,7 +2,7 @@ //@ ignore-compare-mode-next-solver (explicit revisions) //@[next] compile-flags: -Znext-solver //@ check-fail - +//@ ignore-parallel-frontend query cycle // Next solver revision included because of trait-system-refactor-initiative#234. // If we end up in a query cycle, it should be okay as long as results are the same. diff --git a/tests/ui/dep-graph/dep-graph-assoc-type-codegen.rs b/tests/ui/dep-graph/dep-graph-assoc-type-codegen.rs index 9a7a10529fa6f..e04975f9c99b0 100644 --- a/tests/ui/dep-graph/dep-graph-assoc-type-codegen.rs +++ b/tests/ui/dep-graph/dep-graph-assoc-type-codegen.rs @@ -1,6 +1,6 @@ // Test that when a trait impl changes, fns whose body uses that trait // must also be recompiled. - +//@ ignore-parallel-frontend dep graph //@ incremental //@ compile-flags: -Z query-dep-graph diff --git a/tests/ui/dep-graph/dep-graph-caller-callee.rs b/tests/ui/dep-graph/dep-graph-caller-callee.rs index b1318a169d9c9..df959a93c9c28 100644 --- a/tests/ui/dep-graph/dep-graph-caller-callee.rs +++ b/tests/ui/dep-graph/dep-graph-caller-callee.rs @@ -3,7 +3,7 @@ //@ incremental //@ compile-flags: -Z query-dep-graph - +//@ ignore-parallel-frontend dep graph #![feature(rustc_attrs)] #![allow(dead_code)] diff --git a/tests/ui/dep-graph/dep-graph-struct-signature.rs b/tests/ui/dep-graph/dep-graph-struct-signature.rs index eea81b26f9f6a..080a1b5c583d2 100644 --- a/tests/ui/dep-graph/dep-graph-struct-signature.rs +++ b/tests/ui/dep-graph/dep-graph-struct-signature.rs @@ -1,6 +1,6 @@ // Test cases where a changing struct appears in the signature of fns // and methods. - +//@ ignore-parallel-frontend dep graph //@ incremental //@ compile-flags: -Z query-dep-graph diff --git a/tests/ui/dep-graph/dep-graph-trait-impl-two-traits-same-method.rs b/tests/ui/dep-graph/dep-graph-trait-impl-two-traits-same-method.rs index eab4c79210579..397a8c6a39d41 100644 --- a/tests/ui/dep-graph/dep-graph-trait-impl-two-traits-same-method.rs +++ b/tests/ui/dep-graph/dep-graph-trait-impl-two-traits-same-method.rs @@ -1,6 +1,6 @@ // Test that adding an impl to a trait `Foo` DOES affect functions // that only use `Bar` if they have methods in common. - +//@ ignore-parallel-frontend dep graph //@ incremental //@ compile-flags: -Z query-dep-graph diff --git a/tests/ui/dep-graph/dep-graph-trait-impl.rs b/tests/ui/dep-graph/dep-graph-trait-impl.rs index 5cf0d34e0070a..80925ddfe0c0d 100644 --- a/tests/ui/dep-graph/dep-graph-trait-impl.rs +++ b/tests/ui/dep-graph/dep-graph-trait-impl.rs @@ -1,6 +1,6 @@ // Test that when a trait impl changes, fns whose body uses that trait // must also be recompiled. - +//@ ignore-parallel-frontend dep graph //@ incremental //@ compile-flags: -Z query-dep-graph diff --git a/tests/ui/dep-graph/dep-graph-type-alias.rs b/tests/ui/dep-graph/dep-graph-type-alias.rs index 30cef4b27ef06..1796ebda1fc76 100644 --- a/tests/ui/dep-graph/dep-graph-type-alias.rs +++ b/tests/ui/dep-graph/dep-graph-type-alias.rs @@ -1,5 +1,5 @@ // Test that changing what a `type` points to does not go unnoticed. - +//@ ignore-parallel-frontend dep graph //@ incremental //@ compile-flags: -Z query-dep-graph diff --git a/tests/ui/dep-graph/dep-graph-variance-alias.rs b/tests/ui/dep-graph/dep-graph-variance-alias.rs index 8a67fe6d7271d..5e86e77b24a27 100644 --- a/tests/ui/dep-graph/dep-graph-variance-alias.rs +++ b/tests/ui/dep-graph/dep-graph-variance-alias.rs @@ -1,6 +1,6 @@ // Test that changing what a `type` points to does not go unnoticed // by the variance analysis. - +//@ ignore-parallel-frontend dep graph //@ incremental //@ compile-flags: -Z query-dep-graph diff --git a/tests/ui/error-emitter/multiline-removal-suggestion.rs b/tests/ui/error-emitter/multiline-removal-suggestion.rs index 72e9ea357c9e6..36127ab13123a 100644 --- a/tests/ui/error-emitter/multiline-removal-suggestion.rs +++ b/tests/ui/error-emitter/multiline-removal-suggestion.rs @@ -56,3 +56,4 @@ fn bay() -> Vec<(bool, HashSet)> { .collect() } fn main() {} +//@ ignore-parallel-frontend invalid svg(multiple threads trying to write to the same file) diff --git a/tests/ui/generic-associated-types/unknown-lifetime-ice-119827.rs b/tests/ui/generic-associated-types/unknown-lifetime-ice-119827.rs index f74d7cf281116..94f832f494a2d 100644 --- a/tests/ui/generic-associated-types/unknown-lifetime-ice-119827.rs +++ b/tests/ui/generic-associated-types/unknown-lifetime-ice-119827.rs @@ -4,7 +4,7 @@ trait Foo { where Self: 'c; } - +//@ ignore-parallel-frontend query cycle impl Foo for Box {} fn main() {} diff --git a/tests/ui/impl-trait/auto-trait-leakage/auto-trait-leak.rs b/tests/ui/impl-trait/auto-trait-leakage/auto-trait-leak.rs index c2fab7d4c5f68..5f9fe0d141ffe 100644 --- a/tests/ui/impl-trait/auto-trait-leakage/auto-trait-leak.rs +++ b/tests/ui/impl-trait/auto-trait-leakage/auto-trait-leak.rs @@ -1,6 +1,6 @@ use std::cell::Cell; use std::rc::Rc; - +//@ ignore-parallel-frontend query cycle fn send(_: T) {} fn main() {} diff --git a/tests/ui/infinite/infinite-trait-alias-recursion.rs b/tests/ui/infinite/infinite-trait-alias-recursion.rs index 0bd4624de3f1e..df884cca22b77 100644 --- a/tests/ui/infinite/infinite-trait-alias-recursion.rs +++ b/tests/ui/infinite/infinite-trait-alias-recursion.rs @@ -1,5 +1,5 @@ #![feature(trait_alias)] - +//@ ignore-parallel-frontend query cycle trait T1 = T2; //~^ ERROR cycle detected when computing the implied predicates of `T1` diff --git a/tests/ui/infinite/infinite-type-alias-mutual-recursion.rs b/tests/ui/infinite/infinite-type-alias-mutual-recursion.rs index cf9ea0db4cbee..6a43c4ac78720 100644 --- a/tests/ui/infinite/infinite-type-alias-mutual-recursion.rs +++ b/tests/ui/infinite/infinite-type-alias-mutual-recursion.rs @@ -1,5 +1,5 @@ //@ revisions: feature gated - +//@ ignore-parallel-frontend query cycle #![cfg_attr(feature, feature(lazy_type_alias))] #![allow(incomplete_features)] diff --git a/tests/ui/inline-const/required-const.rs b/tests/ui/inline-const/required-const.rs index 8f640e933d019..437652532ec54 100644 --- a/tests/ui/inline-const/required-const.rs +++ b/tests/ui/inline-const/required-const.rs @@ -1,6 +1,6 @@ //@ build-fail //@ compile-flags: -Zmir-opt-level=3 - +//@ ignore-parallel-frontend post-monomorphization errors fn foo() { if false { const { panic!() } //~ ERROR E0080 diff --git a/tests/ui/intrinsics/intrinsic-raw_eq-const-bad.rs b/tests/ui/intrinsics/intrinsic-raw_eq-const-bad.rs index ed15f5bba9622..d2e5e158b7226 100644 --- a/tests/ui/intrinsics/intrinsic-raw_eq-const-bad.rs +++ b/tests/ui/intrinsics/intrinsic-raw_eq-const-bad.rs @@ -1,6 +1,6 @@ //@ normalize-stderr: "[[:xdigit:]]{2} __ ([[:xdigit:]]{2}\s){2}" -> "HEX_DUMP" #![feature(core_intrinsics)] - +//@ ignore-parallel-frontend different alloc ids const RAW_EQ_PADDING: bool = unsafe { std::intrinsics::raw_eq(&(1_u8, 2_u16), &(1_u8, 2_u16)) //~^ ERROR requires initialized memory diff --git a/tests/ui/issues/issue-17252.rs b/tests/ui/issues/issue-17252.rs index 5941e10f8b068..dd002bfd187a0 100644 --- a/tests/ui/issues/issue-17252.rs +++ b/tests/ui/issues/issue-17252.rs @@ -1,5 +1,5 @@ const FOO: usize = FOO; //~ ERROR E0391 - +//@ ignore-parallel-frontend query cycle fn main() { let _x: [u8; FOO]; // caused stack overflow prior to fix let _y: usize = 1 + { diff --git a/tests/ui/issues/issue-34373.rs b/tests/ui/issues/issue-34373.rs index a9bd79f6830b8..02e1048e5a330 100644 --- a/tests/ui/issues/issue-34373.rs +++ b/tests/ui/issues/issue-34373.rs @@ -1,5 +1,5 @@ #![allow(warnings)] - +//@ ignore-parallel-frontend query cycle trait Trait { fn foo(_: T) {} } diff --git a/tests/ui/lint/large_assignments/copy_into_box_rc_arc.rs b/tests/ui/lint/large_assignments/copy_into_box_rc_arc.rs index dfa0b8015d037..a8e23c0246eeb 100644 --- a/tests/ui/lint/large_assignments/copy_into_box_rc_arc.rs +++ b/tests/ui/lint/large_assignments/copy_into_box_rc_arc.rs @@ -3,7 +3,7 @@ #![move_size_limit = "1000"] //@ build-fail //@ only-64bit - +//@ ignore-parallel-frontend post-monomorphization errors //@ edition:2018 //@ compile-flags: -Zmir-opt-level=1 diff --git a/tests/ui/lint/large_assignments/copy_into_fn.rs b/tests/ui/lint/large_assignments/copy_into_fn.rs index 5222e833bcc8f..8f8e7f0822bbc 100644 --- a/tests/ui/lint/large_assignments/copy_into_fn.rs +++ b/tests/ui/lint/large_assignments/copy_into_fn.rs @@ -1,5 +1,5 @@ //@ build-fail - +//@ ignore-parallel-frontend post-monomorphization errors #![feature(large_assignments)] #![move_size_limit = "1000"] #![deny(large_assignments)] diff --git a/tests/ui/lint/large_assignments/inline_mir.rs b/tests/ui/lint/large_assignments/inline_mir.rs index d16aae6ab145b..68c5de4902f34 100644 --- a/tests/ui/lint/large_assignments/inline_mir.rs +++ b/tests/ui/lint/large_assignments/inline_mir.rs @@ -13,7 +13,7 @@ //! ``` //! //! We want the diagnostics to point to the relevant user code. - +//@ ignore-parallel-frontend post-monomorphization errors //@ build-fail //@ compile-flags: -Zmir-opt-level=1 -Zinline-mir diff --git a/tests/ui/lint/large_assignments/large_future.rs b/tests/ui/lint/large_assignments/large_future.rs index 28c358bdbf086..1be66f16313bb 100644 --- a/tests/ui/lint/large_assignments/large_future.rs +++ b/tests/ui/lint/large_assignments/large_future.rs @@ -5,7 +5,7 @@ //@ only-64bit //@ revisions: attribute option //@ [option]compile-flags: -Zmove-size-limit=1000 - +//@ ignore-parallel-frontend post-monomorphization errors //@ edition:2018 //@ compile-flags: -Zmir-opt-level=0 diff --git a/tests/ui/lint/large_assignments/move_into_fn.rs b/tests/ui/lint/large_assignments/move_into_fn.rs index b3b2160ca36e1..1e793a082e3ea 100644 --- a/tests/ui/lint/large_assignments/move_into_fn.rs +++ b/tests/ui/lint/large_assignments/move_into_fn.rs @@ -1,5 +1,5 @@ //@ build-fail - +//@ ignore-parallel-frontend post-monomorphization errors #![feature(large_assignments)] #![move_size_limit = "1000"] #![deny(large_assignments)] diff --git a/tests/ui/lint/non-snake-case/lint-uppercase-variables.rs b/tests/ui/lint/non-snake-case/lint-uppercase-variables.rs index aefbe63606a14..be3450494aaf2 100644 --- a/tests/ui/lint/non-snake-case/lint-uppercase-variables.rs +++ b/tests/ui/lint/non-snake-case/lint-uppercase-variables.rs @@ -1,7 +1,7 @@ #![warn(unused)] #![allow(dead_code)] #![deny(non_snake_case)] - +//@ ignore-parallel-frontend `note`s on different source lines mod foo { pub enum Foo { Foo } } diff --git a/tests/ui/lint/rfc-2383-lint-reason/force_warn_expected_lints_fulfilled.rs b/tests/ui/lint/rfc-2383-lint-reason/force_warn_expected_lints_fulfilled.rs index ad85a777ef9a2..3b8cbe99a65e3 100644 --- a/tests/ui/lint/rfc-2383-lint-reason/force_warn_expected_lints_fulfilled.rs +++ b/tests/ui/lint/rfc-2383-lint-reason/force_warn_expected_lints_fulfilled.rs @@ -2,7 +2,7 @@ //@ compile-flags: --force-warn unused_variables //@ compile-flags: --force-warn unused_mut //@ check-pass - +//@ ignore-parallel-frontend `note`s on different source lines fn expect_early_pass_lint() { #[expect(while_true)] while true { diff --git a/tests/ui/liveness/liveness-unused.rs b/tests/ui/liveness/liveness-unused.rs index a291d2489695f..95345c22b0411 100644 --- a/tests/ui/liveness/liveness-unused.rs +++ b/tests/ui/liveness/liveness-unused.rs @@ -3,7 +3,7 @@ #![deny(unused_assignments)] #![allow(dead_code, non_camel_case_types, trivial_numeric_casts, dropping_copy_types)] #![feature(intrinsics)] - +//@ ignore-parallel-frontend `note`s on different source lines use std::ops::AddAssign; fn f1(x: isize) { diff --git a/tests/ui/pattern/non-structural-match-types-cycle-err.rs b/tests/ui/pattern/non-structural-match-types-cycle-err.rs index a8e494c35b0c3..3bc1964eb21fc 100644 --- a/tests/ui/pattern/non-structural-match-types-cycle-err.rs +++ b/tests/ui/pattern/non-structural-match-types-cycle-err.rs @@ -1,5 +1,5 @@ //@ edition:2021 - +//@ ignore-parallel-frontend query cycle struct AnyOption(T); impl AnyOption { const NONE: Option = None; diff --git a/tests/ui/recursion/issue-23302-3.rs b/tests/ui/recursion/issue-23302-3.rs index da75f33079886..2e29433ae22d4 100644 --- a/tests/ui/recursion/issue-23302-3.rs +++ b/tests/ui/recursion/issue-23302-3.rs @@ -1,5 +1,5 @@ const A: i32 = B; //~ ERROR cycle detected - +//@ ignore-parallel-frontend query cycle const B: i32 = A; fn main() { } diff --git a/tests/ui/resolve/proc_macro_generated_packed.rs b/tests/ui/resolve/proc_macro_generated_packed.rs index a8175895af04b..e35f50911663c 100644 --- a/tests/ui/resolve/proc_macro_generated_packed.rs +++ b/tests/ui/resolve/proc_macro_generated_packed.rs @@ -1,6 +1,6 @@ //! This test ICEs because the `repr(packed)` attribute //! was generated by a proc macro, so `#[derive]` didn't see it. - +//@ ignore-parallel-frontend failed to collect active jobs //@proc-macro: proc_macro_generate_packed.rs //@known-bug: #120873 //@ failure-status: 101 diff --git a/tests/ui/resolve/resolve-self-in-impl.rs b/tests/ui/resolve/resolve-self-in-impl.rs index d0872d1b76f20..c05a7146fe08b 100644 --- a/tests/ui/resolve/resolve-self-in-impl.rs +++ b/tests/ui/resolve/resolve-self-in-impl.rs @@ -1,5 +1,5 @@ #![feature(associated_type_defaults)] - +//@ ignore-parallel-frontend query cycle struct S(T); trait Tr { type A = (); diff --git a/tests/ui/rust-2018/edition-lint-inter-outlives/edition-lint-infer-outlives-macro.fixed b/tests/ui/rust-2018/edition-lint-inter-outlives/edition-lint-infer-outlives-macro.fixed index 435857224ac31..e7c10f71b831a 100644 --- a/tests/ui/rust-2018/edition-lint-inter-outlives/edition-lint-infer-outlives-macro.fixed +++ b/tests/ui/rust-2018/edition-lint-inter-outlives/edition-lint-infer-outlives-macro.fixed @@ -1,7 +1,7 @@ //@ edition:2018 //@ aux-build:edition-lint-infer-outlives-macro.rs //@ run-rustfix - +//@ ignore-parallel-frontend `note`s on different source lines #![deny(explicit_outlives_requirements)] #![allow(dead_code)] diff --git a/tests/ui/rust-2018/edition-lint-inter-outlives/edition-lint-infer-outlives-macro.rs b/tests/ui/rust-2018/edition-lint-inter-outlives/edition-lint-infer-outlives-macro.rs index 6c879231a1681..a39d766263e9a 100644 --- a/tests/ui/rust-2018/edition-lint-inter-outlives/edition-lint-infer-outlives-macro.rs +++ b/tests/ui/rust-2018/edition-lint-inter-outlives/edition-lint-infer-outlives-macro.rs @@ -1,7 +1,7 @@ //@ edition:2018 //@ aux-build:edition-lint-infer-outlives-macro.rs //@ run-rustfix - +//@ ignore-parallel-frontend `note`s on different source lines #![deny(explicit_outlives_requirements)] #![allow(dead_code)] diff --git a/tests/ui/simd/const-err-trumps-simd-err.rs b/tests/ui/simd/const-err-trumps-simd-err.rs index 33f0abb06f3ea..282d5dabf72fa 100644 --- a/tests/ui/simd/const-err-trumps-simd-err.rs +++ b/tests/ui/simd/const-err-trumps-simd-err.rs @@ -1,6 +1,6 @@ //@build-fail //@ dont-require-annotations: NOTE - +//@ ignore-parallel-frontend post-monomorphization errors //! Make sure that monomorphization-time const errors from `static_assert` take priority over the //! error from simd_extract. Basically this checks that if a const fails to evaluate in some //! function, we don't bother codegen'ing the function. diff --git a/tests/ui/structs/default-field-values/post-mono.rs b/tests/ui/structs/default-field-values/post-mono.rs index 68dfa391bb485..57092083ca102 100644 --- a/tests/ui/structs/default-field-values/post-mono.rs +++ b/tests/ui/structs/default-field-values/post-mono.rs @@ -1,6 +1,6 @@ //@ build-fail //@ revisions: direct indirect - +//@ ignore-parallel-frontend post-monomorphization errors #![feature(default_field_values)] struct Z { diff --git a/tests/ui/traits/alias/infinite_normalization.rs b/tests/ui/traits/alias/infinite_normalization.rs index 848afc1efb23a..9e3b7df7085b6 100644 --- a/tests/ui/traits/alias/infinite_normalization.rs +++ b/tests/ui/traits/alias/infinite_normalization.rs @@ -2,7 +2,7 @@ //! recursion during normalization. //! //! issue: https://github.com/rust-lang/rust/issues/133901 - +//@ ignore-parallel-frontend query cycle #![feature(trait_alias)] fn foo>() {} trait Baz = Baz>; diff --git a/tests/ui/type/pattern_types/validity.rs b/tests/ui/type/pattern_types/validity.rs index 432aacb9be3fe..8323049188db7 100644 --- a/tests/ui/type/pattern_types/validity.rs +++ b/tests/ui/type/pattern_types/validity.rs @@ -1,7 +1,7 @@ //! Check that pattern types have their validity checked // Strip out raw byte dumps to make tests platform-independent: //@ normalize-stderr: "([[:xdigit:]]{2}\s){4,8}\s+│\s.{4,8}" -> "HEX_DUMP" - +//@ ignore-parallel-frontend different alloc ids #![feature(pattern_types, const_trait_impl, pattern_type_range_trait)] #![feature(pattern_type_macro)] diff --git a/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122989.rs b/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122989.rs index f2b9f037ea5f3..1948e76af7ec9 100644 --- a/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122989.rs +++ b/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122989.rs @@ -6,7 +6,7 @@ trait Foo> { //~| ERROR cycle detected when computing type of `Foo::N` fn func() {} } - +//@ ignore-parallel-frontend query cycle trait Bar> {} //~^ WARN trait objects without an explicit `dyn` are deprecated //~| WARN this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! From b5e53dc790bc594b69020af262bb796fd56702cd Mon Sep 17 00:00:00 2001 From: Daria Sukhonina Date: Mon, 16 Mar 2026 12:29:12 +0300 Subject: [PATCH 33/35] Cleanup from_cycle_error::variances_of. variances_of currently used search_for_cycle_permutation, which can fail and abort when constructed error result value does not match query input. This commit changes variances_of to receive a def_id which means it can compute a value without using search_for_cycle_permutation, avoiding the possible abort. Fixes #127971 --- .../rustc_query_impl/src/from_cycle_error.rs | 29 ++++--------------- 1 file changed, 6 insertions(+), 23 deletions(-) diff --git a/compiler/rustc_query_impl/src/from_cycle_error.rs b/compiler/rustc_query_impl/src/from_cycle_error.rs index f2a2e4f82c0b8..317b2482c05cc 100644 --- a/compiler/rustc_query_impl/src/from_cycle_error.rs +++ b/compiler/rustc_query_impl/src/from_cycle_error.rs @@ -8,12 +8,12 @@ use rustc_errors::codes::*; use rustc_errors::{Applicability, Diag, MultiSpan, pluralize, struct_span_code_err}; use rustc_hir as hir; use rustc_hir::def::{DefKind, Res}; +use rustc_middle::bug; use rustc_middle::queries::{QueryVTables, TaggedQueryKey}; use rustc_middle::query::CycleError; use rustc_middle::query::erase::erase_val; use rustc_middle::ty::layout::LayoutError; use rustc_middle::ty::{self, Ty, TyCtxt}; -use rustc_middle::{bug, span_bug}; use rustc_span::def_id::{DefId, LocalDefId}; use rustc_span::{ErrorGuaranteed, Span}; @@ -31,9 +31,9 @@ pub(crate) fn specialize_query_vtables<'tcx>(vtables: &mut QueryVTables<'tcx>) { vtables.check_representability_adt_ty.value_from_cycle_error = |tcx, _, cycle, _err| check_representability(tcx, cycle); - vtables.variances_of.value_from_cycle_error = |tcx, _, cycle, err| { + vtables.variances_of.value_from_cycle_error = |tcx, key, _, err| { let _guar = err.delay_as_bug(); - erase_val(variances_of(tcx, cycle)) + erase_val(variances_of(tcx, key)) }; vtables.layout_of.value_from_cycle_error = |tcx, _, cycle, err| { @@ -103,26 +103,9 @@ fn check_representability<'tcx>(tcx: TyCtxt<'tcx>, cycle_error: CycleError<'tcx> guar.raise_fatal() } -fn variances_of<'tcx>(tcx: TyCtxt<'tcx>, cycle_error: CycleError<'tcx>) -> &'tcx [ty::Variance] { - search_for_cycle_permutation( - &cycle_error.cycle, - |cycle| { - if let Some(frame) = cycle.get(0) - && let TaggedQueryKey::variances_of(def_id) = frame.node.tagged_key - { - let n = tcx.generics_of(def_id).own_params.len(); - ControlFlow::Break(tcx.arena.alloc_from_iter(iter::repeat_n(ty::Bivariant, n))) - } else { - ControlFlow::Continue(()) - } - }, - || { - span_bug!( - cycle_error.usage.as_ref().unwrap().span, - "only `variances_of` returns `&[ty::Variance]`" - ) - }, - ) +fn variances_of<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> &'tcx [ty::Variance] { + let n = tcx.generics_of(def_id).own_params.len(); + tcx.arena.alloc_from_iter(iter::repeat_n(ty::Bivariant, n)) } // Take a cycle of `Q` and try `try_cycle` on every permutation, falling back to `otherwise`. From a72aceea2b526dd098b8e80cf24ee7485f7429b8 Mon Sep 17 00:00:00 2001 From: Folkert de Vries Date: Tue, 17 Mar 2026 01:00:25 +0100 Subject: [PATCH 34/35] correct `vpdpbusd` asserts in miri in https://github.com/rust-lang/rust/commit/a24022ad4e98bfc5adc47cc114db57b68c8511d2 we changed the argument types to be more accurate, and now the miri asserts on the simd type/size need to reflect that --- src/tools/miri/src/shims/x86/avx512.rs | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/tools/miri/src/shims/x86/avx512.rs b/src/tools/miri/src/shims/x86/avx512.rs index b057a78b6c8ee..23538f0dea965 100644 --- a/src/tools/miri/src/shims/x86/avx512.rs +++ b/src/tools/miri/src/shims/x86/avx512.rs @@ -188,23 +188,26 @@ fn vpdpbusd<'tcx>( let (b, b_len) = ecx.project_to_simd(b)?; let (dest, dest_len) = ecx.project_to_simd(dest)?; - // fn vpdpbusd(src: i32x16, a: i32x16, b: i32x16) -> i32x16; - // fn vpdpbusd256(src: i32x8, a: i32x8, b: i32x8) -> i32x8; - // fn vpdpbusd128(src: i32x4, a: i32x4, b: i32x4) -> i32x4; + // fn vpdpbusd(src: i32x16, a: u8x64, b: i8x64) -> i32x16; + // fn vpdpbusd256(src: i32x8, a: u8x32, b: i8x32) -> i32x8; + // fn vpdpbusd128(src: i32x4, a: u8x16, b: i8x16) -> i32x4; assert_eq!(dest_len, src_len); - assert_eq!(dest_len, a_len); - assert_eq!(dest_len, b_len); + assert_eq!(dest_len * 4, a_len); + assert_eq!(a_len, b_len); for i in 0..dest_len { let src = ecx.read_scalar(&ecx.project_index(&src, i)?)?.to_i32()?; - let a = ecx.read_scalar(&ecx.project_index(&a, i)?)?.to_u32()?; - let b = ecx.read_scalar(&ecx.project_index(&b, i)?)?.to_u32()?; let dest = ecx.project_index(&dest, i)?; - let zipped = a.to_le_bytes().into_iter().zip(b.to_le_bytes()); - let intermediate_sum: i32 = zipped - .map(|(a, b)| i32::from(a).strict_mul(i32::from(b.cast_signed()))) - .fold(0, |x, y| x.strict_add(y)); + let mut intermediate_sum: i32 = 0; + for j in 0..4 { + let idx = i.strict_mul(4).strict_add(j); + let a = ecx.read_scalar(&ecx.project_index(&a, idx)?)?.to_u8()?; + let b = ecx.read_scalar(&ecx.project_index(&b, idx)?)?.to_i8()?; + + let product = i32::from(a).strict_mul(i32::from(b)); + intermediate_sum = intermediate_sum.strict_add(product); + } // Use `wrapping_add` because `src` is an arbitrary i32 and the addition can overflow. let res = Scalar::from_i32(intermediate_sum.wrapping_add(src)); From d81da4d691cf9f794a7cb6d29415f1e058357f9d Mon Sep 17 00:00:00 2001 From: Alice Ryhl Date: Mon, 16 Mar 2026 15:06:56 +0000 Subject: [PATCH 35/35] Fix missing kernel-address from error message list --- compiler/rustc_attr_parsing/src/attributes/codegen_attrs.rs | 1 + tests/ui/sanitize-attr/invalid-sanitize.stderr | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/compiler/rustc_attr_parsing/src/attributes/codegen_attrs.rs b/compiler/rustc_attr_parsing/src/attributes/codegen_attrs.rs index 4909e0d35173c..a8db114129ffd 100644 --- a/compiler/rustc_attr_parsing/src/attributes/codegen_attrs.rs +++ b/compiler/rustc_attr_parsing/src/attributes/codegen_attrs.rs @@ -671,6 +671,7 @@ impl SingleAttributeParser for SanitizeParser { item.path().span(), &[ sym::address, + sym::kernel_address, sym::cfi, sym::kcfi, sym::memory, diff --git a/tests/ui/sanitize-attr/invalid-sanitize.stderr b/tests/ui/sanitize-attr/invalid-sanitize.stderr index 26ef31603d887..00bb7746d05f3 100644 --- a/tests/ui/sanitize-attr/invalid-sanitize.stderr +++ b/tests/ui/sanitize-attr/invalid-sanitize.stderr @@ -4,7 +4,7 @@ error[E0539]: malformed `sanitize` attribute input LL | #[sanitize(brontosaurus = "off")] | ^^^^^^^^^^^------------^^^^^^^^^^ | | - | valid arguments are "address", "cfi", "kcfi", "memory", "memtag", "shadow_call_stack", "thread", "hwaddress" or "realtime" + | valid arguments are "address", "kernel_address", "cfi", "kcfi", "memory", "memtag", "shadow_call_stack", "thread", "hwaddress" or "realtime" error: multiple `sanitize` attributes --> $DIR/invalid-sanitize.rs:7:1