diff --git a/compiler/rustc_codegen_cranelift/example/mini_core.rs b/compiler/rustc_codegen_cranelift/example/mini_core.rs index 08adec96a079b..d6d82a9d2af69 100644 --- a/compiler/rustc_codegen_cranelift/example/mini_core.rs +++ b/compiler/rustc_codegen_cranelift/example/mini_core.rs @@ -497,7 +497,7 @@ pub trait FnMut: FnOnce { pub fn panic(_msg: &'static str) -> ! { unsafe { libc::puts("Panicking\n\0" as *const str as *const i8); - intrinsics::abort(); + intrinsics::abort_immediate(); } } @@ -539,7 +539,7 @@ fn panic_bounds_check(index: usize, len: usize) -> ! { len, index, ); - intrinsics::abort(); + intrinsics::abort_immediate(); } } @@ -548,7 +548,7 @@ fn panic_bounds_check(index: usize, len: usize) -> ! { fn panic_cannot_unwind() -> ! { unsafe { libc::puts("panic in a function that cannot unwind\n\0" as *const str as *const i8); - intrinsics::abort(); + intrinsics::abort_immediate(); } } @@ -688,7 +688,7 @@ pub union MaybeUninit { pub mod intrinsics { #[rustc_intrinsic] - pub fn abort() -> !; + pub fn abort_immediate() -> !; #[rustc_intrinsic] pub const fn size_of() -> usize; #[rustc_intrinsic] diff --git a/compiler/rustc_codegen_cranelift/example/mini_core_hello_world.rs b/compiler/rustc_codegen_cranelift/example/mini_core_hello_world.rs index 9a710caae9cd1..c53ec2ec6710d 100644 --- a/compiler/rustc_codegen_cranelift/example/mini_core_hello_world.rs +++ b/compiler/rustc_codegen_cranelift/example/mini_core_hello_world.rs @@ -602,11 +602,11 @@ pub enum E2 { #[allow(unreachable_patterns)] fn check_niche_behavior() { if let E1::V2 { .. } = (E1::V1 { f: true }) { - intrinsics::abort(); + intrinsics::abort_immediate(); } if let E2::V1 { .. } = E2::V3:: { - intrinsics::abort(); + intrinsics::abort_immediate(); } } diff --git a/compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs b/compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs index cf1c1f027e7f5..9c3182c944dc6 100644 --- a/compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs +++ b/compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs @@ -469,7 +469,7 @@ fn codegen_regular_intrinsic_call<'tcx>( let usize_layout = fx.layout_of(fx.tcx.types.usize); match intrinsic { - sym::abort => { + sym::abort_immediate => { fx.bcx.set_cold_block(fx.bcx.current_block().unwrap()); fx.bcx.ins().trap(TrapCode::user(2).unwrap()); return Ok(()); diff --git a/compiler/rustc_codegen_gcc/build_system/src/fuzz/reduce.rs b/compiler/rustc_codegen_gcc/build_system/src/fuzz/reduce.rs index 20715ab0e7c48..d1ed8fabbaf11 100644 --- a/compiler/rustc_codegen_gcc/build_system/src/fuzz/reduce.rs +++ b/compiler/rustc_codegen_gcc/build_system/src/fuzz/reduce.rs @@ -203,7 +203,7 @@ fn block_abort(file: &mut Vec, path: &PathBuf, cache: &mut ResultCache) // ..and insert an unconditional call to abort. file_copy.insert( block_starts, - "Call(tmp = core::intrinsics::abort(), ReturnTo(bb1), UnwindUnreachable())\n" + "Call(tmp = core::intrinsics::abort_immediate(), ReturnTo(bb1), UnwindUnreachable())\n" .to_string(), ); file_copy.insert(block_starts, "let tmp = ();\n".to_string()); diff --git a/compiler/rustc_codegen_gcc/example/alloc_example.rs b/compiler/rustc_codegen_gcc/example/alloc_example.rs index 9a0b46d5b221a..338057e1fcb87 100644 --- a/compiler/rustc_codegen_gcc/example/alloc_example.rs +++ b/compiler/rustc_codegen_gcc/example/alloc_example.rs @@ -20,12 +20,12 @@ extern "C" { #[panic_handler] fn panic_handler(_: &core::panic::PanicInfo<'_>) -> ! { - core::intrinsics::abort(); + core::intrinsics::abort_immediate(); } #[alloc_error_handler] fn alloc_error_handler(_: alloc::alloc::Layout) -> ! { - core::intrinsics::abort(); + core::intrinsics::abort_immediate(); } #[lang = "eh_personality"] diff --git a/compiler/rustc_codegen_gcc/example/mini_core.rs b/compiler/rustc_codegen_gcc/example/mini_core.rs index 2d5a29ceb8191..efc3e169678dc 100644 --- a/compiler/rustc_codegen_gcc/example/mini_core.rs +++ b/compiler/rustc_codegen_gcc/example/mini_core.rs @@ -509,7 +509,7 @@ pub trait FnMut: FnOnce { pub fn panic(_msg: &'static str) -> ! { unsafe { libc::puts("Panicking\n\0" as *const str as *const u8); - intrinsics::abort(); + intrinsics::abort_immediate(); } } @@ -546,7 +546,7 @@ panic_const! { fn panic_cannot_unwind() -> ! { unsafe { libc::puts("Panicking\n\0" as *const str as *const u8); - intrinsics::abort(); + intrinsics::abort_immediate(); } } @@ -555,7 +555,7 @@ fn panic_cannot_unwind() -> ! { fn panic_in_cleanup() -> ! { unsafe { libc::printf("panic in a destructor during cleanup\n\0" as *const str as *const i8); - intrinsics::abort(); + intrinsics::abort_immediate(); } } @@ -568,7 +568,7 @@ fn panic_bounds_check(index: usize, len: usize) -> ! { len, index, ); - intrinsics::abort(); + intrinsics::abort_immediate(); } } @@ -698,7 +698,7 @@ pub mod intrinsics { #[rustc_intrinsic] pub const fn black_box(_dummy: T) -> T; #[rustc_intrinsic] - pub fn abort() -> !; + pub fn abort_immediate() -> !; #[rustc_intrinsic] pub const fn size_of() -> usize; #[rustc_intrinsic] diff --git a/compiler/rustc_codegen_gcc/example/mini_core_hello_world.rs b/compiler/rustc_codegen_gcc/example/mini_core_hello_world.rs index ab841d51a7f53..a630c33e086d3 100644 --- a/compiler/rustc_codegen_gcc/example/mini_core_hello_world.rs +++ b/compiler/rustc_codegen_gcc/example/mini_core_hello_world.rs @@ -438,10 +438,10 @@ pub enum E2 { #[allow(unreachable_patterns)] fn check_niche_behavior () { if let E1::V2 { .. } = (E1::V1 { f: true }) { - intrinsics::abort(); + intrinsics::abort_immediate(); } if let E2::V1 { .. } = E2::V3:: { - intrinsics::abort(); + intrinsics::abort_immediate(); } } diff --git a/compiler/rustc_codegen_gcc/src/intrinsic/mod.rs b/compiler/rustc_codegen_gcc/src/intrinsic/mod.rs index 4d2590ac81e41..0f735172667ab 100644 --- a/compiler/rustc_codegen_gcc/src/intrinsic/mod.rs +++ b/compiler/rustc_codegen_gcc/src/intrinsic/mod.rs @@ -661,7 +661,7 @@ impl<'a, 'gcc, 'tcx> IntrinsicCallBuilderMethods<'tcx> for Builder<'a, 'gcc, 'tc llret } - fn abort(&mut self) { + fn abort_immediate(&mut self) { let func = self.context.get_builtin_function("__builtin_trap"); self.block.add_eval(self.location, self.context.new_call(self.location, func, &[])); } diff --git a/compiler/rustc_codegen_gcc/tests/run/abort1.rs b/compiler/rustc_codegen_gcc/tests/run/abort1.rs index ff2bb75ece22a..c9e3c27a0791d 100644 --- a/compiler/rustc_codegen_gcc/tests/run/abort1.rs +++ b/compiler/rustc_codegen_gcc/tests/run/abort1.rs @@ -12,7 +12,7 @@ extern crate mini_core; use mini_core::*; fn test_fail() -> ! { - unsafe { intrinsics::abort() }; + unsafe { intrinsics::abort_immediate() }; } #[no_mangle] diff --git a/compiler/rustc_codegen_gcc/tests/run/abort2.rs b/compiler/rustc_codegen_gcc/tests/run/abort2.rs index 781f518e0b222..51f55e9404c1f 100644 --- a/compiler/rustc_codegen_gcc/tests/run/abort2.rs +++ b/compiler/rustc_codegen_gcc/tests/run/abort2.rs @@ -12,7 +12,7 @@ extern crate mini_core; use mini_core::*; fn fail() -> i32 { - unsafe { intrinsics::abort() }; + unsafe { intrinsics::abort_immediate() }; 0 } diff --git a/compiler/rustc_codegen_gcc/tests/run/always_inline.rs b/compiler/rustc_codegen_gcc/tests/run/always_inline.rs index ebd741ee090c8..2a580fe79acaf 100644 --- a/compiler/rustc_codegen_gcc/tests/run/always_inline.rs +++ b/compiler/rustc_codegen_gcc/tests/run/always_inline.rs @@ -47,7 +47,7 @@ fn fib_a(n: u8) -> u8 { #[no_mangle] extern "C" fn main(argc: i32, _argv: *const *const u8) -> i32 { if fib(2) != fib_a(2) { - intrinsics::abort(); + intrinsics::abort_immediate(); } 0 } diff --git a/compiler/rustc_codegen_llvm/src/back/llvm_backend.rs b/compiler/rustc_codegen_llvm/src/back/llvm_backend.rs index 3f89777bb28db..8780af2f6d595 100644 --- a/compiler/rustc_codegen_llvm/src/back/llvm_backend.rs +++ b/compiler/rustc_codegen_llvm/src/back/llvm_backend.rs @@ -208,11 +208,12 @@ impl CodegenBackend for LlvmCodegenBackend { // Intrinsics whose fallback body will not be used by the LLVM backend. let replaced_intrinsics = { #[rustfmt::skip] - let mut will_not_use_fallback = vec![ + let will_not_use_fallback = vec![ // These are mapped to LLVM intrinsics instead. sym::unchecked_funnel_shl, sym::unchecked_funnel_shr, sym::carrying_mul_add, + sym::carryless_mul, sym::integer_max, sym::integer_min, @@ -235,10 +236,6 @@ impl CodegenBackend for LlvmCodegenBackend { sym::copysignf16, sym::copysignf32, sym::copysignf64, sym::copysignf128, ]; - if llvm_util::get_version() >= (22, 0, 0) { - will_not_use_fallback.push(sym::carryless_mul); - } - will_not_use_fallback }; diff --git a/compiler/rustc_codegen_llvm/src/builder.rs b/compiler/rustc_codegen_llvm/src/builder.rs index dc89414940620..b7c930502978e 100644 --- a/compiler/rustc_codegen_llvm/src/builder.rs +++ b/compiler/rustc_codegen_llvm/src/builder.rs @@ -919,9 +919,7 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> { self.set_metadata_node(store, llvm::MD_nontemporal, &[one]); } } - if flags.contains(MemFlags::CAPTURES_READ_ONLY) - && crate::llvm_util::get_version() >= (22, 0, 0) - { + if flags.contains(MemFlags::CAPTURES_READ_ONLY) { assert!( self.type_kind(self.val_ty(val)) == TypeKind::Pointer, "CAPTURED_READ_ONLY is only supported on pointer stores" @@ -1903,14 +1901,10 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> { return; } - if crate::llvm_util::get_version() >= (22, 0, 0) { - // LLVM 22 requires the lifetime intrinsic to act directly on the alloca, - // there can't be an addrspacecast in between. - let ptr = unsafe { llvm::LLVMRustStripPointerCasts(ptr) }; - self.call_intrinsic(intrinsic, &[self.val_ty(ptr)], &[ptr]); - } else { - self.call_intrinsic(intrinsic, &[self.val_ty(ptr)], &[self.cx.const_u64(size), ptr]); - } + // LLVM 22 requires the lifetime intrinsic to act directly on the alloca, + // there can't be an addrspacecast in between. + let ptr = unsafe { llvm::LLVMRustStripPointerCasts(ptr) }; + self.call_intrinsic(intrinsic, &[self.val_ty(ptr)], &[ptr]); } } impl<'a, 'll, CX: Borrow>> GenericBuilder<'a, 'll, CX> { @@ -2129,7 +2123,7 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> { self.unreachable(); } } else { - self.abort(); + self.abort_immediate(); self.unreachable(); } diff --git a/compiler/rustc_codegen_llvm/src/context.rs b/compiler/rustc_codegen_llvm/src/context.rs index 0ce3bfe07c413..d64c8de6ed7aa 100644 --- a/compiler/rustc_codegen_llvm/src/context.rs +++ b/compiler/rustc_codegen_llvm/src/context.rs @@ -195,33 +195,6 @@ pub(crate) unsafe fn create_module<'ll>( let mut target_data_layout = sess.target.data_layout.to_string(); let llvm_version = llvm_util::get_version(); - if llvm_version < (22, 0, 0) { - if sess.target.arch == Arch::Avr { - // LLVM 22.0 updated the default layout on avr: https://github.com/llvm/llvm-project/pull/153010 - target_data_layout = target_data_layout.replace("n8:16", "n8") - } - if sess.target.arch == Arch::Nvptx64 { - // LLVM 22 updated the NVPTX layout to indicate 256-bit vector load/store: https://github.com/llvm/llvm-project/pull/155198 - target_data_layout = target_data_layout.replace("-i256:256", ""); - } - if sess.target.arch == Arch::PowerPC64 { - // LLVM 22 updated the ABI alignment for double on AIX: https://github.com/llvm/llvm-project/pull/144673 - target_data_layout = target_data_layout.replace("-f64:32:64", ""); - - // LLVM 22 fixed the data layout calculation for targets that default to ELFv1 - // when the ABI is set to ELFv2. With LLVM 21, the ELFv1 datalayout must be used, - // which will overalign function entries. - // https://github.com/llvm/llvm-project/pull/149725 - if sess.target.llvm_target == "powerpc64-unknown-linux-gnu" { - target_data_layout = target_data_layout.replace("-Fn32", "-Fi64"); - } - } - if sess.target.arch == Arch::AmdGpu { - // LLVM 22 specified ELF mangling in the amdgpu data layout: - // https://github.com/llvm/llvm-project/pull/163011 - target_data_layout = target_data_layout.replace("-m:e", ""); - } - } if llvm_version < (23, 0, 0) { if sess.target.arch == Arch::S390x { // LLVM 23 updated the s390x layout to specify the stack alignment: https://github.com/llvm/llvm-project/pull/176041 diff --git a/compiler/rustc_codegen_llvm/src/intrinsic.rs b/compiler/rustc_codegen_llvm/src/intrinsic.rs index 3163139ba1f04..da0460b2a9290 100644 --- a/compiler/rustc_codegen_llvm/src/intrinsic.rs +++ b/compiler/rustc_codegen_llvm/src/intrinsic.rs @@ -192,7 +192,6 @@ impl<'ll, 'tcx> IntrinsicCallBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> { let simple = call_simple_intrinsic(self, name, args); let llval = match name { _ if simple.is_some() => simple.unwrap(), - // Need at least LLVM 22 for `min/maximumnum` to not crash LLVM. sym::minimum_number_nsz_f16 | sym::minimum_number_nsz_f32 | sym::minimum_number_nsz_f64 @@ -200,9 +199,7 @@ impl<'ll, 'tcx> IntrinsicCallBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> { | sym::maximum_number_nsz_f16 | sym::maximum_number_nsz_f32 | sym::maximum_number_nsz_f64 - | sym::maximum_number_nsz_f128 - if llvm_version >= (22, 0, 0) => - { + | sym::maximum_number_nsz_f128 => { let intrinsic_name = if name.as_str().starts_with("min") { "llvm.minimumnum" } else { @@ -457,26 +454,6 @@ impl<'ll, 'tcx> IntrinsicCallBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> { pair } - // FIXME move into the branch below when LLVM 22 is the lowest version we support. - sym::carryless_mul if llvm_version >= (22, 0, 0) => { - let ty = args[0].layout.ty; - if !ty.is_integral() { - let err = tcx.dcx().emit_err(InvalidMonomorphization::BasicIntegerType { - span, - name, - ty, - }); - return IntrinsicResult::Err(err); - } - let (size, _) = ty.int_size_and_signed(self.tcx); - let width = size.bits(); - let llty = self.type_ix(width); - - let lhs = args[0].immediate(); - let rhs = args[1].immediate(); - self.call_intrinsic("llvm.clmul", &[llty], &[lhs, rhs]) - } - sym::ctlz | sym::ctlz_nonzero | sym::cttz @@ -484,6 +461,7 @@ impl<'ll, 'tcx> IntrinsicCallBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> { | sym::ctpop | sym::bswap | sym::bitreverse + | sym::carryless_mul | sym::integer_max | sym::integer_min | sym::saturating_add @@ -530,6 +508,11 @@ impl<'ll, 'tcx> IntrinsicCallBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> { sym::bitreverse => { self.call_intrinsic("llvm.bitreverse", &[llty], &[args[0].immediate()]) } + sym::carryless_mul => { + let lhs = args[0].immediate(); + let rhs = args[1].immediate(); + self.call_intrinsic("llvm.clmul", &[llty], &[lhs, rhs]) + } sym::integer_min | sym::integer_max => { let lhs = args[0].immediate(); let rhs = args[1].immediate(); @@ -1040,7 +1023,7 @@ impl<'ll, 'tcx> IntrinsicCallBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> { autocast(self, llret, src_ty, dest_ty) } - fn abort(&mut self) { + fn abort_immediate(&mut self) { self.call_intrinsic("llvm.trap", &[], &[]); } @@ -2118,8 +2101,6 @@ fn generic_simd_intrinsic<'ll, 'tcx>( }; } - let llvm_version = crate::llvm_util::get_version(); - /// Converts a vector mask, where each element has a bit width equal to the data elements it is used with, /// down to an i1 based mask that can be used by llvm intrinsics. /// @@ -2666,22 +2647,16 @@ fn generic_simd_intrinsic<'ll, 'tcx>( // Type of the vector of elements: let llvm_elem_vec_ty = llvm_vector_ty(bx, element_ty0, in_len); - let args: &[&'ll Value] = if llvm_version < (22, 0, 0) { - let alignment = bx.const_i32(alignment as i32); - &[args[1].immediate(), alignment, mask, args[0].immediate()] - } else { - &[args[1].immediate(), mask, args[0].immediate()] - }; - - let call = - bx.call_intrinsic("llvm.masked.gather", &[llvm_elem_vec_ty, llvm_pointer_vec_ty], args); - if llvm_version >= (22, 0, 0) { - crate::attributes::apply_to_callsite( - call, - crate::llvm::AttributePlace::Argument(0), - &[crate::llvm::CreateAlignmentAttr(bx.llcx, alignment)], - ) - } + let call = bx.call_intrinsic( + "llvm.masked.gather", + &[llvm_elem_vec_ty, llvm_pointer_vec_ty], + &[args[1].immediate(), mask, args[0].immediate()], + ); + crate::attributes::apply_to_callsite( + call, + crate::llvm::AttributePlace::Argument(0), + &[crate::llvm::CreateAlignmentAttr(bx.llcx, alignment)], + ); return Ok(call); } @@ -2772,22 +2747,16 @@ fn generic_simd_intrinsic<'ll, 'tcx>( // Type of the vector of elements: let llvm_elem_vec_ty = llvm_vector_ty(bx, values_elem, values_len); - let args: &[&'ll Value] = if llvm_version < (22, 0, 0) { - let alignment = bx.const_i32(alignment as i32); - - &[args[1].immediate(), alignment, mask, args[2].immediate()] - } else { - &[args[1].immediate(), mask, args[2].immediate()] - }; - - let call = bx.call_intrinsic("llvm.masked.load", &[llvm_elem_vec_ty, llvm_pointer], args); - if llvm_version >= (22, 0, 0) { - crate::attributes::apply_to_callsite( - call, - crate::llvm::AttributePlace::Argument(0), - &[crate::llvm::CreateAlignmentAttr(bx.llcx, alignment)], - ) - } + let call = bx.call_intrinsic( + "llvm.masked.load", + &[llvm_elem_vec_ty, llvm_pointer], + &[args[1].immediate(), mask, args[2].immediate()], + ); + crate::attributes::apply_to_callsite( + call, + crate::llvm::AttributePlace::Argument(0), + &[crate::llvm::CreateAlignmentAttr(bx.llcx, alignment)], + ); return Ok(call); } @@ -2859,21 +2828,16 @@ fn generic_simd_intrinsic<'ll, 'tcx>( // Type of the vector of elements: let llvm_elem_vec_ty = llvm_vector_ty(bx, values_elem, values_len); - let args: &[&'ll Value] = if llvm_version < (22, 0, 0) { - let alignment = bx.const_i32(alignment as i32); - &[args[2].immediate(), args[1].immediate(), alignment, mask] - } else { - &[args[2].immediate(), args[1].immediate(), mask] - }; - - let call = bx.call_intrinsic("llvm.masked.store", &[llvm_elem_vec_ty, llvm_pointer], args); - if llvm_version >= (22, 0, 0) { - crate::attributes::apply_to_callsite( - call, - crate::llvm::AttributePlace::Argument(1), - &[crate::llvm::CreateAlignmentAttr(bx.llcx, alignment)], - ) - } + let call = bx.call_intrinsic( + "llvm.masked.store", + &[llvm_elem_vec_ty, llvm_pointer], + &[args[2].immediate(), args[1].immediate(), mask], + ); + crate::attributes::apply_to_callsite( + call, + crate::llvm::AttributePlace::Argument(1), + &[crate::llvm::CreateAlignmentAttr(bx.llcx, alignment)], + ); return Ok(call); } @@ -2949,24 +2913,17 @@ fn generic_simd_intrinsic<'ll, 'tcx>( // Type of the vector of elements: let llvm_elem_vec_ty = llvm_vector_ty(bx, element_ty0, in_len); - let args: &[&'ll Value] = if llvm_version < (22, 0, 0) { - let alignment = bx.const_i32(alignment as i32); - &[args[0].immediate(), args[1].immediate(), alignment, mask] - } else { - &[args[0].immediate(), args[1].immediate(), mask] - }; + let call = bx.call_intrinsic( "llvm.masked.scatter", &[llvm_elem_vec_ty, llvm_pointer_vec_ty], - args, + &[args[0].immediate(), args[1].immediate(), mask], + ); + crate::attributes::apply_to_callsite( + call, + crate::llvm::AttributePlace::Argument(1), + &[crate::llvm::CreateAlignmentAttr(bx.llcx, alignment)], ); - if llvm_version >= (22, 0, 0) { - crate::attributes::apply_to_callsite( - call, - crate::llvm::AttributePlace::Argument(1), - &[crate::llvm::CreateAlignmentAttr(bx.llcx, alignment)], - ) - } return Ok(call); } @@ -3448,17 +3405,11 @@ fn generic_simd_intrinsic<'ll, 'tcx>( &[vec_ty], &[args[0].immediate(), args[1].immediate(), args[2].immediate()], )), - sym::simd_carryless_mul => { - if crate::llvm_util::get_version() >= (22, 0, 0) { - Ok(bx.call_intrinsic( - llvm_intrinsic, - &[vec_ty], - &[args[0].immediate(), args[1].immediate()], - )) - } else { - span_bug!(span, "`simd_carryless_mul` needs LLVM 22 or higher"); - } - } + sym::simd_carryless_mul => Ok(bx.call_intrinsic( + llvm_intrinsic, + &[vec_ty], + &[args[0].immediate(), args[1].immediate()], + )), _ => unreachable!(), }; } diff --git a/compiler/rustc_codegen_llvm/src/llvm_util.rs b/compiler/rustc_codegen_llvm/src/llvm_util.rs index 4db534b978330..a582e897eef9c 100644 --- a/compiler/rustc_codegen_llvm/src/llvm_util.rs +++ b/compiler/rustc_codegen_llvm/src/llvm_util.rs @@ -262,7 +262,7 @@ pub(crate) fn to_llvm_features<'a>(target: &Target, s: &'a str) -> Option None, // only existed in 18 // Withdrawn by ARM; removed from LLVM in 22 - "tme" if major >= 22 => None, + "tme" => None, s => Some(LLVMFeature::new(s)), } } @@ -270,10 +270,6 @@ pub(crate) fn to_llvm_features<'a>(target: &Target, s: &'a str) -> Option Some(LLVMFeature::new("fullfp16")), s => Some(LLVMFeature::new(s)), }, - Arch::Bpf => match s { - "allows-misaligned-mem-access" if major < 22 => None, - s => Some(LLVMFeature::new(s)), - }, Arch::Nvptx64 => match s { "sm_101" if major >= 24 => Some(LLVMFeature::new("sm_110")), "sm_101a" if major >= 24 => Some(LLVMFeature::new("sm_110a")), @@ -294,43 +290,30 @@ pub(crate) fn to_llvm_features<'a>(target: &Target, s: &'a str) -> Option Some(LLVMFeature::new("hasleoncasa")), s => Some(LLVMFeature::new(s)), }, - Arch::Wasm32 | Arch::Wasm64 => match s { - "gc" if major < 22 => None, + Arch::X86 | Arch::X86_64 => match s { + "sse4.2" => Some(LLVMFeature::with_dependencies( + "sse4.2", + smallvec![TargetFeatureFoldStrength::EnableOnly("crc32")], + )), + "pclmulqdq" => Some(LLVMFeature::new("pclmul")), + "rdrand" => Some(LLVMFeature::new("rdrnd")), + "bmi1" => Some(LLVMFeature::new("bmi")), + "cmpxchg16b" => Some(LLVMFeature::new("cx16")), + "lahfsahf" => Some(LLVMFeature::new("sahf")), + "apxf" => Some(LLVMFeature::with_dependencies( + "egpr", + smallvec![ + TargetFeatureFoldStrength::Both("push2pop2"), + TargetFeatureFoldStrength::Both("ppx"), + TargetFeatureFoldStrength::Both("ndd"), + TargetFeatureFoldStrength::Both("ccmp"), + TargetFeatureFoldStrength::Both("cf"), + TargetFeatureFoldStrength::Both("nf"), + TargetFeatureFoldStrength::Both("zu"), + ], + )), s => Some(LLVMFeature::new(s)), }, - Arch::X86 | Arch::X86_64 => { - match s { - "sse4.2" => Some(LLVMFeature::with_dependencies( - "sse4.2", - smallvec![TargetFeatureFoldStrength::EnableOnly("crc32")], - )), - "pclmulqdq" => Some(LLVMFeature::new("pclmul")), - "rdrand" => Some(LLVMFeature::new("rdrnd")), - "bmi1" => Some(LLVMFeature::new("bmi")), - "cmpxchg16b" => Some(LLVMFeature::new("cx16")), - "lahfsahf" => Some(LLVMFeature::new("sahf")), - // Enable the evex512 target feature if an avx512 target feature is enabled. - s if s.starts_with("avx512") && major < 22 => Some(LLVMFeature::with_dependencies( - s, - smallvec![TargetFeatureFoldStrength::EnableOnly("evex512")], - )), - "avx10.1" if major < 22 => Some(LLVMFeature::new("avx10.1-512")), - "avx10.2" if major < 22 => Some(LLVMFeature::new("avx10.2-512")), - "apxf" => Some(LLVMFeature::with_dependencies( - "egpr", - smallvec![ - TargetFeatureFoldStrength::Both("push2pop2"), - TargetFeatureFoldStrength::Both("ppx"), - TargetFeatureFoldStrength::Both("ndd"), - TargetFeatureFoldStrength::Both("ccmp"), - TargetFeatureFoldStrength::Both("cf"), - TargetFeatureFoldStrength::Both("nf"), - TargetFeatureFoldStrength::Both("zu"), - ], - )), - s => Some(LLVMFeature::new(s)), - } - } _ => Some(LLVMFeature::new(s)), } } @@ -396,18 +379,11 @@ fn update_target_reliable_float_cfg(target: &Target, cfg: &mut TargetConfig) { let (major, _, _) = version; cfg.has_reliable_f16 = match (target_arch, target_os) { - // Unsupported (fixed in llvm22) - (Arch::Arm64EC, _) if major < 22 => false, // MinGW ABI bugs resolved in GCC 16 // but our toolchain hasn't been updated. (Arch::X86_64, Os::Windows) if *target_env == Env::Gnu && *target_abi != CfgAbi::Llvm => { false } - // Infinite recursion - (Arch::CSky, _) if major < 22 => false, // (fixed in llvm22) - (Arch::PowerPC | Arch::PowerPC64, _) if major < 22 => false, // (fixed in llvm22) - (Arch::Sparc | Arch::Sparc64, _) if major < 22 => false, // (fixed in llvm22) - (Arch::Wasm32 | Arch::Wasm64, _) if major < 22 => false, // (fixed in llvm22) // `f16` support only requires that symbols converting to and from `f32` are available. We // provide these in `compiler-builtins`, so `f16` should be available on all platforms that // do not have other ABI issues or LLVM crashes. @@ -447,8 +423,6 @@ fn update_target_reliable_float_cfg(target: &Target, cfg: &mut TargetConfig) { (Arch::PowerPC64, Os::Aix) => false, // ABI bugs on BE without +vsx . (Arch::PowerPC64, _) => cfg.internal_target_features.contains(&sym::vsx), - // ABI unsupported (fixed in llvm22) - (Arch::Sparc, _) if major < 22 => false, // MinGW ABI bugs (fixed in llvm23) (Arch::X86_64, Os::Windows) if *target_env == Env::Gnu && *target_abi != CfgAbi::Llvm && major < 23 => diff --git a/compiler/rustc_codegen_ssa/src/back/linker.rs b/compiler/rustc_codegen_ssa/src/back/linker.rs index e08a825aa7019..ffb9130ed1a08 100644 --- a/compiler/rustc_codegen_ssa/src/back/linker.rs +++ b/compiler/rustc_codegen_ssa/src/back/linker.rs @@ -900,7 +900,14 @@ impl<'a> Linker for GccLinker<'a> { fn linker_plugin_lto(&mut self) { match self.sess.opts.cg.linker_plugin_lto { LinkerPluginLto::Disabled => { - // Nothing to do + // GCC, when used as a linker, will perform LTO even without -flto when it sees + // object files with the GCC IR (which can happen when using rustc_codegen_gcc). + // Since the std is compiled with -Cembed-bitcode=yes, any program using the std + // will have the linker do LTO. + // So, we disable this with -fno-lto when linker plugin LTO is not requested. + if self.is_cc() && self.codegen_backend == "gcc" { + self.cc_arg("-fno-lto"); + } } LinkerPluginLto::LinkerPluginAuto => { self.push_linker_plugin_lto_args(None); diff --git a/compiler/rustc_codegen_ssa/src/mir/block.rs b/compiler/rustc_codegen_ssa/src/mir/block.rs index 8fa044a45de22..9db1dd700e95e 100644 --- a/compiler/rustc_codegen_ssa/src/mir/block.rs +++ b/compiler/rustc_codegen_ssa/src/mir/block.rs @@ -199,7 +199,7 @@ impl<'a, 'tcx> TerminatorCodegenHelper<'tcx> { "compiler_builtins call to diverging function {:?} replaced with abort", instance.def_id() ); - bx.abort(); + bx.abort_immediate(); bx.unreachable(); return MergingSucc::False; } @@ -587,7 +587,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { // so we should make sure that we never actually do. // We play it safe by using a well-defined `abort`, but we could go for immediate UB // if that turns out to be helpful. - bx.abort(); + bx.abort_immediate(); // `abort` does not terminate the block, so we still need to generate // an `unreachable` terminator after it. bx.unreachable(); @@ -1099,7 +1099,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { } // Also we need to terminate the block to avoid an LLVM assertion, // even though we're not going to actually use the IR. - bx.abort(); + bx.abort_immediate(); return MergingSucc::False; } IntrinsicResult::Fallback(instance) => { @@ -2398,7 +2398,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { let (fn_abi, fn_ptr, instance) = common::build_langcall(&bx, self.mir.span, reason.lang_item()); if is_call_from_compiler_builtins_to_upstream_monomorphization(bx.tcx(), instance) { - bx.abort(); + bx.abort_immediate(); } else { let fn_ty = bx.fn_decl_backend_type(fn_abi); diff --git a/compiler/rustc_codegen_ssa/src/mir/intrinsic.rs b/compiler/rustc_codegen_ssa/src/mir/intrinsic.rs index e6b70ce2ca77b..650b21bf78a9c 100644 --- a/compiler/rustc_codegen_ssa/src/mir/intrinsic.rs +++ b/compiler/rustc_codegen_ssa/src/mir/intrinsic.rs @@ -121,7 +121,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { if args.is_empty() { match name { - sym::abort + sym::abort_immediate | sym::unreachable | sym::cold_path | sym::gpu_launch_sized_workgroup_mem @@ -152,8 +152,8 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { } let op_val: OperandValue<_> = match name { - sym::abort => { - bx.abort(); + sym::abort_immediate => { + bx.abort_immediate(); OperandValue::ZeroSized } diff --git a/compiler/rustc_codegen_ssa/src/mir/place.rs b/compiler/rustc_codegen_ssa/src/mir/place.rs index 02e125fd31717..c74a5e788689f 100644 --- a/compiler/rustc_codegen_ssa/src/mir/place.rs +++ b/compiler/rustc_codegen_ssa/src/mir/place.rs @@ -264,7 +264,7 @@ impl<'a, 'tcx, V: CodegenObject> PlaceRef<'tcx, V> { Err(UninhabitedVariantError) => { // We play it safe by using a well-defined `abort`, but we could go for immediate UB // if that turns out to be helpful. - bx.abort(); + bx.abort_immediate(); } Ok(Some((tag_field, imm))) => { let tag_place = self.project_field(bx, tag_field.as_usize()); diff --git a/compiler/rustc_codegen_ssa/src/mir/rvalue.rs b/compiler/rustc_codegen_ssa/src/mir/rvalue.rs index 3b33cf5a17602..6391fcd58f4bb 100644 --- a/compiler/rustc_codegen_ssa/src/mir/rvalue.rs +++ b/compiler/rustc_codegen_ssa/src/mir/rvalue.rs @@ -834,8 +834,8 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { Err(super::place::UninhabitedVariantError) => { // Like codegen_set_discr we use a sound abort, but could // potentially `unreachable` or just return the poison for - // more optimizability, if that turns out to be helpful. - bx.abort(); + // optimizability, if that turns out to be helpful. + bx.abort_immediate(); let val = OperandValue::poison(bx, layout); OperandRef { val, layout, move_annotation: None } } diff --git a/compiler/rustc_codegen_ssa/src/traits/intrinsic.rs b/compiler/rustc_codegen_ssa/src/traits/intrinsic.rs index 47144834b5072..0aacbb3b5f7fb 100644 --- a/compiler/rustc_codegen_ssa/src/traits/intrinsic.rs +++ b/compiler/rustc_codegen_ssa/src/traits/intrinsic.rs @@ -38,7 +38,8 @@ pub trait IntrinsicCallBuilderMethods<'tcx>: BackendTypes { is_cleanup: bool, ) -> Self::Value; - fn abort(&mut self); + /// Ungracefully stop execution in the simplest way possible. + fn abort_immediate(&mut self); fn assume(&mut self, val: Self::Value); fn expect(&mut self, cond: Self::Value, expected: bool) -> Self::Value; /// Trait method used to load a function while testing if it is associated with a type diff --git a/compiler/rustc_const_eval/src/const_eval/machine.rs b/compiler/rustc_const_eval/src/const_eval/machine.rs index 55ddba1ec470f..1b99f54719fb4 100644 --- a/compiler/rustc_const_eval/src/const_eval/machine.rs +++ b/compiler/rustc_const_eval/src/const_eval/machine.rs @@ -484,8 +484,8 @@ impl<'tcx> interpret::Machine<'tcx> for CompileTimeMachine<'tcx> { // CTFE-specific intrinsics. match intrinsic_name { - sym::abort => { - // Note that `abort` is also hooked separately in Miri. + sym::abort_immediate => { + // Note that `abort_immediate` is also hooked separately in Miri. throw_machine_stop!(ConstEvalErrKind::Abort); } sym::ptr_guaranteed_cmp => { diff --git a/compiler/rustc_hir_analysis/src/check/intrinsic.rs b/compiler/rustc_hir_analysis/src/check/intrinsic.rs index 714aaaf876c7d..86e66f7658d65 100644 --- a/compiler/rustc_hir_analysis/src/check/intrinsic.rs +++ b/compiler/rustc_hir_analysis/src/check/intrinsic.rs @@ -67,7 +67,7 @@ fn intrinsic_operation_unsafety(tcx: TyCtxt<'_>, intrinsic_id: LocalDefId) -> hi // safe extern fns are otherwise unprecedented. // tidy-alphabetical-start - | sym::abort + | sym::abort_immediate | sym::add_with_overflow | sym::aggregate_raw_ptr | sym::align_of @@ -290,7 +290,7 @@ pub(crate) fn check_intrinsic_type( let n_lts = 0; let (n_tps, n_cts, inputs, output) = match intrinsic_name { sym::autodiff => (4, 0, vec![param(0), param(1), param(2)], param(3)), - sym::abort => (0, 0, vec![], tcx.types.never), + sym::abort_immediate => (0, 0, vec![], tcx.types.never), sym::amdgpu_dispatch_ptr => (0, 0, vec![], Ty::new_imm_ptr(tcx, tcx.types.unit)), sym::unreachable => (0, 0, vec![], tcx.types.never), sym::breakpoint => (0, 0, vec![], tcx.types.unit), diff --git a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp index d16d9db799be1..3873701ae09ac 100644 --- a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp +++ b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp @@ -5,10 +5,8 @@ #include "llvm/ADT/DenseSet.h" #include "llvm/ADT/SmallVector.h" #include "llvm/Analysis/Lint.h" -#include "llvm/Analysis/TargetLibraryInfo.h" -#if LLVM_VERSION_GE(22, 0) #include "llvm/Analysis/RuntimeLibcallInfo.h" -#endif +#include "llvm/Analysis/TargetLibraryInfo.h" #include "llvm/Bitcode/BitcodeWriter.h" #include "llvm/Bitcode/BitcodeWriterPass.h" #include "llvm/CodeGen/CommandFlags.h" @@ -24,12 +22,8 @@ #include "llvm/MC/TargetRegistry.h" #include "llvm/Object/ObjectFile.h" #include "llvm/Passes/PassBuilder.h" -#if LLVM_VERSION_GE(22, 0) -#include "llvm/Plugins/PassPlugin.h" -#else -#include "llvm/Passes/PassPlugin.h" -#endif #include "llvm/Passes/StandardInstrumentations.h" +#include "llvm/Plugins/PassPlugin.h" #include "llvm/Support/CBindingWrapping.h" #include "llvm/Support/FileSystem.h" #include "llvm/Support/Program.h" @@ -100,11 +94,7 @@ LLVMRustCreateMCSubtargetInfo(const char *TripleStr, const char *CPU, return nullptr; } -#if LLVM_VERSION_GE(22, 0) return TheTarget->createMCSubtargetInfo(Trip, CPU, Features); -#else - return TheTarget->createMCSubtargetInfo(Trip.str(), CPU, Features); -#endif } extern "C" bool LLVMRustMCSubtargetInfoCheckFeatures(MCSubtargetInfo *MCInfo, @@ -498,7 +488,7 @@ LLVMRustWriteOutputFile(LLVMTargetMachineRef Target, LLVMModuleRef M, // module flags respectively instead. PM->add(new RuntimeLibraryInfoWrapper(Options->MCOptions.ABIName, Options->VecLib)); -#elif LLVM_VERSION_GE(22, 0) +#else PM->add(new RuntimeLibraryInfoWrapper( TargetTriple, Options->ExceptionModel, Options->FloatABIType, Options->EABIVersion, Options->MCOptions.ABIName, Options->VecLib)); @@ -721,44 +711,25 @@ extern "C" LLVMRustResult LLVMRustOptimize( } std::optional PGOOpt; -#if LLVM_VERSION_LT(22, 0) - auto FS = vfs::getRealFileSystem(); -#endif if (PGOGenPath) { assert(!PGOUsePath && !PGOSampleUsePath); PGOOpt = PGOOptions( -#if LLVM_VERSION_GE(22, 0) PGOGenPath, "", "", "", PGOOptions::IRInstr, PGOOptions::NoCSAction, -#else - PGOGenPath, "", "", "", FS, PGOOptions::IRInstr, PGOOptions::NoCSAction, -#endif PGOOptions::ColdFuncOpt::Default, DebugInfoForProfiling); } else if (PGOUsePath) { assert(!PGOSampleUsePath); PGOOpt = PGOOptions( -#if LLVM_VERSION_GE(22, 0) PGOUsePath, "", "", "", PGOOptions::IRUse, PGOOptions::NoCSAction, -#else - PGOUsePath, "", "", "", FS, PGOOptions::IRUse, PGOOptions::NoCSAction, -#endif PGOOptions::ColdFuncOpt::Default, DebugInfoForProfiling); } else if (PGOSampleUsePath) { PGOOpt = -#if LLVM_VERSION_GE(22, 0) PGOOptions(PGOSampleUsePath, "", "", "", PGOOptions::SampleUse, -#else - PGOOptions(PGOSampleUsePath, "", "", "", FS, PGOOptions::SampleUse, -#endif PGOOptions::NoCSAction, PGOOptions::ColdFuncOpt::Default, DebugInfoForProfiling); } else if (DebugInfoForProfiling) { - PGOOpt = PGOOptions( -#if LLVM_VERSION_GE(22, 0) - "", "", "", "", PGOOptions::NoAction, PGOOptions::NoCSAction, -#else - "", "", "", "", FS, PGOOptions::NoAction, PGOOptions::NoCSAction, -#endif - PGOOptions::ColdFuncOpt::Default, DebugInfoForProfiling); + PGOOpt = + PGOOptions("", "", "", "", PGOOptions::NoAction, PGOOptions::NoCSAction, + PGOOptions::ColdFuncOpt::Default, DebugInfoForProfiling); } auto PB = PassBuilder(TM, PTO, PGOOpt, &PIC); @@ -1389,11 +1360,7 @@ LLVMRustCreateThinLTOData(LLVMRustThinLTOModule *modules, size_t num_modules, // being lifted from `lib/LTO/LTO.cpp` as well DenseMap PrevailingCopy; for (auto &I : Ret->Index) { -#if LLVM_VERSION_GE(22, 0) const auto &SummaryList = I.second.getSummaryList(); -#else - const auto &SummaryList = I.second.SummaryList; -#endif if (SummaryList.size() > 1) PrevailingCopy[I.first] = getFirstDefinitionForLinker(SummaryList); } @@ -1426,11 +1393,7 @@ LLVMRustCreateThinLTOData(LLVMRustThinLTOModule *modules, size_t num_modules, // linkage will stay as external, and internal will stay as internal. std::set ExportedGUIDs; for (auto &List : Ret->Index) { -#if LLVM_VERSION_GE(22, 0) const auto &SummaryList = List.second.getSummaryList(); -#else - const auto &SummaryList = List.second.SummaryList; -#endif for (auto &GVS : SummaryList) { if (GlobalValue::isLocalLinkage(GVS->linkage())) continue; diff --git a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp index bc8fa60b66a52..16c7daf66f095 100644 --- a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp +++ b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp @@ -1164,16 +1164,10 @@ LLVMRustDICreateVectorType(LLVMDIBuilderRef Builder, uint64_t Size, uint32_t AlignInBits, LLVMMetadataRef Type, LLVMMetadataRef Subscripts, LLVMMetadataRef BitStride) { -#if LLVM_VERSION_GE(22, 0) return wrap(unwrap(Builder)->createVectorType( Size, AlignInBits, unwrapDI(Type), DINodeArray(unwrapDI(Subscripts)), unwrapDI(BitStride))); -#else - return wrap(unwrap(Builder)->createVectorType( - Size, AlignInBits, unwrapDI(Type), - DINodeArray(unwrapDI(Subscripts)))); -#endif } extern "C" LLVMMetadataRef @@ -1562,13 +1556,11 @@ extern "C" void LLVMRustContextConfigureDiagnosticHandler( RemarkStreamer(std::move(RemarkStreamer)), LlvmRemarkStreamer(std::move(LlvmRemarkStreamer)) {} -#if LLVM_VERSION_GE(22, 0) ~RustDiagnosticHandler() { if (RemarkStreamer) { RemarkStreamer->releaseSerializer(); } } -#endif virtual bool handleDiagnostics(const DiagnosticInfo &DI) override { // If this diagnostic is one of the optimization remark kinds, we can @@ -1664,14 +1656,8 @@ extern "C" void LLVMRustContextConfigureDiagnosticHandler( // Do not delete the file after we gather remarks RemarkFile->keep(); -#if LLVM_VERSION_GE(22, 0) auto RemarkSerializer = remarks::createRemarkSerializer( llvm::remarks::Format::YAML, RemarkFile->os()); -#else - auto RemarkSerializer = remarks::createRemarkSerializer( - llvm::remarks::Format::YAML, remarks::SerializerMode::Separate, - RemarkFile->os()); -#endif if (Error E = RemarkSerializer.takeError()) { std::string Error = std::string("Cannot create remark serializer: ") + toString(std::move(E)); @@ -1777,16 +1763,12 @@ extern "C" LLVMValueRef LLVMRustConstPtrAuth(LLVMValueRef Ptr, uint32_t Key, AddrDiversity ? dyn_cast(unwrap(AddrDiversity)) : ConstantPointerNull::get(cast(C->getType())); assert(AddrDiv && "Failed to get Address Diversity"); -#if LLVM_VERSION_GE(22, 0) Constant *DeactivationSym = DeactivationSymbol ? dyn_cast(unwrap(DeactivationSymbol)) : ConstantPointerNull::get(PTy); assert(DeactivationSym && "Failed to get Deactivation Symbol"); return wrap(ConstantPtrAuth::get(C, KeyC, DiscC, AddrDiv, DeactivationSym)); -#else - return wrap(ConstantPtrAuth::get(C, KeyC, DiscC, AddrDiv)); -#endif } // Statically assert that the fixed metadata kind IDs declared in @@ -1885,7 +1867,6 @@ class RustSanitizerSpecialCaseList : public llvm::SpecialCaseList { std::vector SanitizerSections; -#if LLVM_VERSION_GE(22, 0) static bool matchSection(const Section &S, llvm::StringRef Name) { return S.matchName(Name); } @@ -1894,24 +1875,9 @@ class RustSanitizerSpecialCaseList : public llvm::SpecialCaseList { return S.getLastMatch(Prefix, Query, Category); } static unsigned getFileIndex(const Section &S) { return S.fileIndex(); } -#else - static bool matchSection(const Section &S, llvm::StringRef Name) { - return S.SectionMatcher && S.SectionMatcher->match(Name) != 0; - } - unsigned getLastMatch(const Section &S, llvm::StringRef Prefix, - llvm::StringRef Query, llvm::StringRef Category) const { - return llvm::SpecialCaseList::inSectionBlame(S.Entries, Prefix, Query, - Category); - } - static unsigned getFileIndex(const Section &S) { return S.FileIdx; } -#endif void createSanitizerSections() { -#if LLVM_VERSION_GE(22, 0) const auto &SecList = sections(); -#else - const auto &SecList = Sections; -#endif for (const auto &S : SecList) { uint32_t Mask = 0; diff --git a/compiler/rustc_middle/src/ty/predicate.rs b/compiler/rustc_middle/src/ty/predicate.rs index 983293e81e5f9..b82fe2ac0e5ee 100644 --- a/compiler/rustc_middle/src/ty/predicate.rs +++ b/compiler/rustc_middle/src/ty/predicate.rs @@ -171,7 +171,7 @@ impl<'tcx> Clause<'tcx> { } pub fn kind(self) -> ty::Binder<'tcx, ClauseKind<'tcx>> { - self.0.internee.map_bound(|kind| match kind { + self.0.internee.map_bound_no_validate_bound_vars(|kind| match kind { PredicateKind::Clause(clause) => clause, _ => unreachable!(), }) @@ -520,7 +520,8 @@ impl<'tcx> UpcastFrom, TraitClause<'tcx>> for Predicate<'tcx> { impl<'tcx> UpcastFrom, PolyTraitClause<'tcx>> for Predicate<'tcx> { fn upcast_from(from: PolyTraitClause<'tcx>, tcx: TyCtxt<'tcx>) -> Self { - from.map_bound(|p| PredicateKind::Clause(ClauseKind::Trait(p))).upcast(tcx) + from.map_bound_no_validate_bound_vars(|p| PredicateKind::Clause(ClauseKind::Trait(p))) + .upcast(tcx) } } diff --git a/compiler/rustc_next_trait_solver/src/solve/trait_goals.rs b/compiler/rustc_next_trait_solver/src/solve/trait_goals.rs index 19a09e99c7d64..32eecd4e44b38 100644 --- a/compiler/rustc_next_trait_solver/src/solve/trait_goals.rs +++ b/compiler/rustc_next_trait_solver/src/solve/trait_goals.rs @@ -903,47 +903,50 @@ where if goal.predicate.polarity != ty::ClausePolarity::Positive { return Err(NoSolution.into()); } - if let ty::Adt(def, args) = goal.predicate.self_ty().kind() - && let Some(FieldInfo { base, ty, .. }) = - def.field_representing_type_info(ecx.cx(), args) - && { - let sized_trait = ecx.cx().require_trait_lang_item(SolverTraitLangItem::Sized); - // FIXME: add better support for builtin impls of traits that check for the bounds - // on the trait definition in std. - - // NOTE: these bounds have to be kept in sync with the definition of the `Field` - // trait in `library/core/src/field.rs` as well as the old trait solver `fn - // assemble_candidates_for_field_trait` in - // `compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs`. - ecx.add_goal( - GoalSource::ImplWhereBound, - Goal { - param_env: goal.param_env, - predicate: TraitRef::new(ecx.cx(), sized_trait, [base]).upcast(ecx.cx()), - }, - )?; - ecx.add_goal( - GoalSource::ImplWhereBound, - Goal { - param_env: goal.param_env, - predicate: TraitRef::new(ecx.cx(), sized_trait, [ty]).upcast(ecx.cx()), - }, - )?; - // FIXME(field_projections): This function does some questionable incomplete stuff by - // returning `Err(NoSolution)` on ambiguity. - ecx.try_evaluate_added_goals()? == Certainty::Yes - } - && match base.kind() { - ty::Adt(def, _) => def.is_struct() && !def.is_packed(), - ty::Tuple(..) => true, - _ => false, - } - { - ecx.probe_builtin_trait_candidate(BuiltinImplSource::Misc) - .enter(|ecx| ecx.evaluate_added_goals_and_make_canonical_response(Certainty::Yes)) - } else { - Err(NoSolution.into()) + + let ty::Adt(def, args) = goal.predicate.self_ty().kind() else { + return Err(NoSolution.into()); + }; + + let Some(FieldInfo { base, ty, .. }) = def.field_representing_type_info(ecx.cx(), args) + else { + return Err(NoSolution.into()); + }; + + match base.kind() { + ty::Adt(def, _) if def.is_struct() && !def.is_packed() => {} + ty::Adt(..) => return Err(NoSolution.into()), + ty::Tuple(..) => {} + _ => unreachable!(), } + + ecx.probe_builtin_trait_candidate(BuiltinImplSource::Misc).enter(|ecx| { + let sized_trait = ecx.cx().require_trait_lang_item(SolverTraitLangItem::Sized); + + // FIXME: add better support for builtin impls of traits that check for the bounds + // on the trait definition in std. + // + // NOTE: these bounds have to be kept in sync with the definition of the `Field` + // trait in `library/core/src/field.rs` as well as the old trait solver `fn + // assemble_candidates_for_field_trait` in + // `compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs`. + ecx.add_goal( + GoalSource::ImplWhereBound, + Goal { + param_env: goal.param_env, + predicate: TraitRef::new(ecx.cx(), sized_trait, [base]).upcast(ecx.cx()), + }, + )?; + ecx.add_goal( + GoalSource::ImplWhereBound, + Goal { + param_env: goal.param_env, + predicate: TraitRef::new(ecx.cx(), sized_trait, [ty]).upcast(ecx.cx()), + }, + )?; + + ecx.evaluate_added_goals_and_make_canonical_response(Certainty::Yes) + }) } } diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs index 21e250c140161..21b14a45ccf14 100644 --- a/compiler/rustc_span/src/symbol.rs +++ b/compiler/rustc_span/src/symbol.rs @@ -398,6 +398,7 @@ symbols! { abi_vectorcall, abi_x86_interrupt, abort, + abort_immediate, add, add_assign, add_with_overflow, diff --git a/compiler/rustc_type_ir/src/binder.rs b/compiler/rustc_type_ir/src/binder.rs index 383e394c3a9e7..068d8261659f0 100644 --- a/compiler/rustc_type_ir/src/binder.rs +++ b/compiler/rustc_type_ir/src/binder.rs @@ -149,6 +149,18 @@ impl Binder { Binder { value, bound_vars } } + /// There are some uses of `map_bound` which are incredibly hot and trivially + /// correct. Only use this if this significantly improves the performance of + /// builds with debug assertions. + pub fn map_bound_no_validate_bound_vars>(self, f: F) -> Binder + where + F: FnOnce(T) -> U, + { + let Binder { value, bound_vars } = self; + let value = f(value); + Binder { value, bound_vars } + } + pub fn try_map_bound, E>(self, f: F) -> Result, E> where F: FnOnce(T) -> Result, diff --git a/compiler/rustc_type_ir/src/inherent.rs b/compiler/rustc_type_ir/src/inherent.rs index 28b733a865358..cb68b8032f7e1 100644 --- a/compiler/rustc_type_ir/src/inherent.rs +++ b/compiler/rustc_type_ir/src/inherent.rs @@ -490,25 +490,25 @@ pub trait Clause>: fn as_trait_clause(self) -> Option>> { self.kind() - .map_bound(|clause| if let ty::ClauseKind::Trait(t) = clause { Some(t) } else { None }) + .map_bound_no_validate_bound_vars(|clause| { + if let ty::ClauseKind::Trait(t) = clause { Some(t) } else { None } + }) .transpose() } fn as_host_effect_clause(self) -> Option>> { self.kind() - .map_bound( - |clause| if let ty::ClauseKind::HostEffect(t) = clause { Some(t) } else { None }, - ) + .map_bound_no_validate_bound_vars(|clause| { + if let ty::ClauseKind::HostEffect(t) = clause { Some(t) } else { None } + }) .transpose() } fn as_projection_clause(self) -> Option>> { self.kind() - .map_bound( - |clause| { - if let ty::ClauseKind::Projection(p) = clause { Some(p) } else { None } - }, - ) + .map_bound_no_validate_bound_vars(|clause| { + if let ty::ClauseKind::Projection(p) = clause { Some(p) } else { None } + }) .transpose() } diff --git a/compiler/rustc_type_ir/src/predicate.rs b/compiler/rustc_type_ir/src/predicate.rs index e66ef5fe99b4a..0ce9d68d88b4d 100644 --- a/compiler/rustc_type_ir/src/predicate.rs +++ b/compiler/rustc_type_ir/src/predicate.rs @@ -231,7 +231,7 @@ impl ty::Binder> { } pub fn self_ty(self) -> ty::Binder { - self.map_bound(|trait_ref| trait_ref.self_ty()) + self.map_bound_no_validate_bound_vars(|trait_ref| trait_ref.self_ty()) } #[inline] @@ -248,7 +248,10 @@ impl UpcastFrom> for TraitClause { impl UpcastFrom>> for ty::Binder> { fn upcast_from(from: ty::Binder>, _tcx: I) -> Self { - from.map_bound(|trait_ref| TraitClause { trait_ref, polarity: ClausePolarity::Positive }) + from.map_bound_no_validate_bound_vars(|trait_ref| TraitClause { + trait_ref, + polarity: ClausePolarity::Positive, + }) } } diff --git a/library/alloc/src/collections/btree/mem.rs b/library/alloc/src/collections/btree/mem.rs index ad86e9422d974..c9a1ec8ca63c6 100644 --- a/library/alloc/src/collections/btree/mem.rs +++ b/library/alloc/src/collections/btree/mem.rs @@ -19,7 +19,7 @@ pub(super) fn replace(v: &mut T, change: impl FnOnce(T) -> (T, R)) -> R { struct PanicGuard; impl Drop for PanicGuard { fn drop(&mut self) { - intrinsics::abort() + intrinsics::abort_immediate() } } let guard = PanicGuard; diff --git a/library/alloc/src/collections/btree/split.rs b/library/alloc/src/collections/btree/split.rs index 388f41cc1c646..fde6810ed4143 100644 --- a/library/alloc/src/collections/btree/split.rs +++ b/library/alloc/src/collections/btree/split.rs @@ -61,7 +61,7 @@ impl Root { // A panic from a later `search_node` comparison would unwind out of // that state and double-free the shared values (#158165), so abort // instead of exposing it. - let guard = mem::DropGuard::new((), |()| intrinsics::abort()); + let guard = mem::DropGuard::new((), |()| intrinsics::abort_immediate()); loop { split_edge.move_suffix(&mut right_node); diff --git a/library/alloc/src/rcs/arc.rs b/library/alloc/src/rcs/arc.rs index 5b42173da5a3a..ffa848998e9a2 100644 --- a/library/alloc/src/rcs/arc.rs +++ b/library/alloc/src/rcs/arc.rs @@ -5,7 +5,6 @@ use core::clone::TrivialClone; use core::clone::{CloneToUninit, Share, UseCloned}; use core::cmp::Ordering; use core::hash::{Hash, Hasher}; -use core::intrinsics::abort; #[cfg(not(no_global_oom_handling))] use core::iter; use core::marker::{PhantomData, Unsize}; @@ -21,7 +20,7 @@ use core::ptr::{self, NonNull}; use core::slice::from_raw_parts_mut; use core::sync::atomic::Ordering::{Acquire, Relaxed, Release}; use core::sync::atomic::{self, Atomic}; -use core::{borrow, fmt, hint}; +use core::{borrow, fmt, hint, intrinsics}; #[cfg(not(no_global_oom_handling))] use crate::alloc::handle_alloc_error; @@ -2539,7 +2538,7 @@ impl Clone for Arc { // Otherwise, the counter could be brought to an almost-overflow using a compare-exchange loop, // and then overflow using a few `fetch_add`s. if old_size > MAX_REFCOUNT { - abort(); + intrinsics::abort_immediate(); } // SAFETY: Pointer is valid & allocator corresponds to the one used to allocate it. @@ -3587,7 +3586,7 @@ impl Clone for Weak { // See comments in Arc::clone() for why we do this (for mem::forget). if old_size > MAX_REFCOUNT { - abort(); + intrinsics::abort_immediate(); } } @@ -5065,7 +5064,7 @@ impl UniqueArc { // See comments in Arc::clone() for why we do this (for mem::forget). if old_size > MAX_REFCOUNT { - abort(); + intrinsics::abort_immediate(); } Weak { ptr: this.ptr, alloc: this.alloc.clone() } diff --git a/library/alloc/src/rcs/rc.rs b/library/alloc/src/rcs/rc.rs index d928e42f71e20..0666995ffe94a 100644 --- a/library/alloc/src/rcs/rc.rs +++ b/library/alloc/src/rcs/rc.rs @@ -248,7 +248,6 @@ use core::clone::TrivialClone; use core::clone::{CloneToUninit, Share, UseCloned}; use core::cmp::Ordering; use core::hash::{Hash, Hasher}; -use core::intrinsics::abort; #[cfg(not(no_global_oom_handling))] use core::iter; use core::marker::{PhantomData, Unsize}; @@ -264,7 +263,7 @@ use core::pin::PinSafePointer; use core::ptr::{self, NonNull, drop_in_place}; #[cfg(not(no_global_oom_handling))] use core::slice::from_raw_parts_mut; -use core::{borrow, fmt, hint}; +use core::{borrow, fmt, hint, intrinsics}; #[cfg(not(no_global_oom_handling))] use crate::alloc::handle_alloc_error; @@ -3939,8 +3938,8 @@ trait RcInnerPtr { // We want to abort on overflow instead of dropping the value. // Checking for overflow after the store instead of before // allows for slightly better code generation. - if core::intrinsics::unlikely(strong == 0) { - abort(); + if intrinsics::unlikely(strong == 0) { + intrinsics::abort_immediate(); } } @@ -3972,8 +3971,8 @@ trait RcInnerPtr { // We want to abort on overflow instead of dropping the value. // Checking for overflow after the store instead of before // allows for slightly better code generation. - if core::intrinsics::unlikely(weak == 0) { - abort(); + if intrinsics::unlikely(weak == 0) { + intrinsics::abort_immediate(); } } diff --git a/library/core/src/intrinsics/mod.rs b/library/core/src/intrinsics/mod.rs index 1e8497b0ab439..67e639cc53e0a 100644 --- a/library/core/src/intrinsics/mod.rs +++ b/library/core/src/intrinsics/mod.rs @@ -426,26 +426,23 @@ pub fn breakpoint(); #[rustc_intrinsic] pub fn rustc_peek(_: T) -> T; -/// Aborts the execution of the process. +/// Ungracefully aborts the execution of the process. /// -/// Note that, unlike most intrinsics, this is safe to call; -/// it does not require an `unsafe` block. -/// Therefore, implementations must not require the user to uphold -/// any safety invariants. +/// This is the intrinsic for directly implementing [`core::process::abort_immediate`] which, on +/// most platforms, will invoke an invalid instruction. On Unix, the process will probably +/// terminate with a signal like `SIGABRT`, `SIGILL`, `SIGTRAP`, `SIGSEGV` or `SIGBUS`. The +/// precise behavior is not guaranteed and not stable. /// /// [`std::process::abort`](../../std/process/fn.abort.html) is to be preferred if possible, /// as its behavior is more user-friendly and more stable. /// -/// The current implementation of `intrinsics::abort` is to invoke an invalid instruction, -/// on most platforms. -/// On Unix, the -/// process will probably terminate with a signal like `SIGABRT`, `SIGILL`, `SIGTRAP`, `SIGSEGV` or -/// `SIGBUS`. The precise behavior is not guaranteed and not stable. +/// Note that, unlike most intrinsics, this is safe to call; it does not require an `unsafe` block. +/// Therefore, implementations must not require the user to uphold any safety invariants. /// -/// The stabilization-track version of this intrinsic is [`core::process::abort_immediate`]. +/// The stabilized version of this intrinsic is [`core::process::abort_immediate`]. #[rustc_nounwind] #[rustc_intrinsic] -pub const fn abort() -> !; +pub const fn abort_immediate() -> !; /// Informs the optimizer that this point in the code is not reachable, /// enabling further optimizations. diff --git a/library/core/src/num/saturating.rs b/library/core/src/num/saturating.rs index efe96a9ab7494..88961a1a28de8 100644 --- a/library/core/src/num/saturating.rs +++ b/library/core/src/num/saturating.rs @@ -31,6 +31,10 @@ use crate::ops::{ /// /// assert_eq!(u32::MAX, (max + one).0); /// ``` +/// +/// # Layout +/// +/// `Saturating` is guaranteed to have the same layout and ABI as `T`. #[stable(feature = "saturating_int_impl", since = "1.74.0")] #[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Default, Hash)] #[repr(transparent)] diff --git a/library/core/src/panicking.rs b/library/core/src/panicking.rs index 04722e4e2fc10..bd4fbcf68b256 100644 --- a/library/core/src/panicking.rs +++ b/library/core/src/panicking.rs @@ -59,7 +59,7 @@ compile_error!( #[rustc_const_stable_indirect] // must follow stable const rules since it is exposed to stable pub const fn panic_fmt(fmt: fmt::Arguments<'_>) -> ! { if cfg!(panic = "immediate-abort") { - super::intrinsics::abort() + super::intrinsics::abort_immediate() } // NOTE This function never crosses the FFI boundary; it's a Rust-to-Rust call @@ -100,7 +100,7 @@ pub const fn panic_nounwind_fmt(fmt: fmt::Arguments<'_>, force_no_backtrace: boo panic_fmt(fmt) } else #[track_caller] { if cfg!(panic = "immediate-abort") { - super::intrinsics::abort() + super::intrinsics::abort_immediate() } // NOTE This function never crosses the FFI boundary; it's a Rust-to-Rust call @@ -265,7 +265,7 @@ pub const fn panic_display(x: &T) -> ! { #[lang = "panic_bounds_check"] // needed by codegen for panic on OOB array/slice access fn panic_bounds_check(index: usize, len: usize) -> ! { if cfg!(panic = "immediate-abort") { - super::intrinsics::abort() + super::intrinsics::abort_immediate() } panic!("index out of bounds: the len is {len} but the index is {index}") @@ -278,7 +278,7 @@ fn panic_bounds_check(index: usize, len: usize) -> ! { #[rustc_nounwind] // `CheckAlignment` MIR pass requires this function to never unwind fn panic_misaligned_pointer_dereference(required: usize, found: usize) -> ! { if cfg!(panic = "immediate-abort") { - super::intrinsics::abort() + super::intrinsics::abort_immediate() } panic_nounwind_fmt( @@ -296,7 +296,7 @@ fn panic_misaligned_pointer_dereference(required: usize, found: usize) -> ! { #[rustc_nounwind] // `CheckNull` MIR pass requires this function to never unwind fn panic_null_pointer_dereference() -> ! { if cfg!(panic = "immediate-abort") { - super::intrinsics::abort() + super::intrinsics::abort_immediate() } panic_nounwind_fmt( @@ -312,7 +312,7 @@ fn panic_null_pointer_dereference() -> ! { #[rustc_nounwind] // `CheckNull` MIR pass requires this function to never unwind fn panic_null_reference_constructed() -> ! { if cfg!(panic = "immediate-abort") { - super::intrinsics::abort() + super::intrinsics::abort_immediate() } panic_nounwind_fmt(format_args!("null reference produced"), /* force_no_backtrace */ false) @@ -325,7 +325,7 @@ fn panic_null_reference_constructed() -> ! { #[rustc_nounwind] // `CheckEnums` MIR pass requires this function to never unwind fn panic_invalid_enum_construction(source: u128) -> ! { if cfg!(panic = "immediate-abort") { - super::intrinsics::abort() + super::intrinsics::abort_immediate() } panic_nounwind_fmt( diff --git a/library/core/src/primitive_docs.rs b/library/core/src/primitive_docs.rs index 519c523445d07..1c7bf87c54bbc 100644 --- a/library/core/src/primitive_docs.rs +++ b/library/core/src/primitive_docs.rs @@ -1834,9 +1834,23 @@ const _: () = (); /// call will be valid ABI-wise. The callee receives the result of transmuting the function pointer /// from `fn()` to `fn(i32)`; that transmutation is itself a well-defined operation, it's just /// almost certainly UB to later call that function pointer.) -/// - Any two types with size 0 and alignment 1 are ABI-compatible. -/// - A `repr(transparent)` type `T` is ABI-compatible with its unique non-trivial field, i.e., the -/// unique field that doesn't have size 0 and alignment 1 (if there is such a field). +/// - Any two types with "trivial ABI" are ABI-compatible. +/// A type has trivial ABI if is satisfies all of the following: +/// - It has size 0. +/// - It has alignment 1. +/// - One of the following apply: +/// - It is a `repr(Rust)` `struct`, `enum`, or `union` (regardless of its fields, +/// regardless of whether `repr(Rust)` is specified explicitly or used via the implicit default, +/// and possibly with additional `repr` modifiers such as `packed`). +/// - It is a [prim@tuple] (regardless of its fields, and including [`()`][prim@unit]). +/// - It is a `repr(transparent)` `struct`, `enum`, or `union`, and all fields have trivial ABI. +/// - It is an array, and its element type has trivial ABI. (This requirement applies even to arrays of length 0.) +/// - It is [the never type `!`][never]. +// - It is a pattern type or an unsafe binder type, and the inner type has trivial ABI. +// (These are still unstable so intentionally not included in the user-visible doc comment, as their rules may change.) +/// - It is a function item type or closure type. +/// - A `repr(transparent)` type is ABI-compatible with its unique field that does not have trivial ABI +/// (as defined above), if such a field exists. (Note that if no such field exists, then the `repr(transparent)` type itself has trivial ABI, so the case above applies.) /// - `i32` is ABI-compatible with `NonZero`, and similar for all other integer types. /// - If `T` is guaranteed to be subject to the [null pointer /// optimization](option/index.html#representation), and `E` is an enum satisfying the following diff --git a/library/core/src/process.rs b/library/core/src/process.rs index 2da752b42ee85..1c2769f07895b 100644 --- a/library/core/src/process.rs +++ b/library/core/src/process.rs @@ -40,5 +40,5 @@ #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces #[doc(alias = "halt")] pub const fn abort_immediate() -> ! { - crate::intrinsics::abort() + crate::intrinsics::abort_immediate() } diff --git a/library/core/src/slice/sort/shared/pivot.rs b/library/core/src/slice/sort/shared/pivot.rs index 9eb60f854ce21..878ec27419fc2 100644 --- a/library/core/src/slice/sort/shared/pivot.rs +++ b/library/core/src/slice/sort/shared/pivot.rs @@ -17,7 +17,7 @@ pub fn choose_pivot bool>(v: &[T], is_less: &mut F) -> us let len = v.len(); if len < 8 { - intrinsics::abort(); + intrinsics::abort_immediate(); } // SAFETY: a, b, c point to initialized regions of len_div_8 elements, diff --git a/library/core/src/slice/sort/shared/smallsort.rs b/library/core/src/slice/sort/shared/smallsort.rs index 40939f922bcb6..1510c3d6d8d6c 100644 --- a/library/core/src/slice/sort/shared/smallsort.rs +++ b/library/core/src/slice/sort/shared/smallsort.rs @@ -228,7 +228,7 @@ fn small_sort_general_with_scratch bool>( } if scratch.len() < len + 16 { - intrinsics::abort(); + intrinsics::abort_immediate(); } let v_base = v.as_mut_ptr(); @@ -321,7 +321,7 @@ where } if len > SMALL_SORT_NETWORK_SCRATCH_LEN { - intrinsics::abort(); + intrinsics::abort_immediate(); } let mut stack_array = MaybeUninit::<[T; SMALL_SORT_NETWORK_SCRATCH_LEN]>::uninit(); @@ -422,7 +422,7 @@ where F: FnMut(&T, &T) -> bool, { if v.len() < 9 { - intrinsics::abort(); + intrinsics::abort_immediate(); } let v_base = v.as_mut_ptr(); @@ -471,7 +471,7 @@ where F: FnMut(&T, &T) -> bool, { if v.len() < 13 { - intrinsics::abort(); + intrinsics::abort_immediate(); } let v_base = v.as_mut_ptr(); @@ -578,7 +578,7 @@ pub fn insertion_sort_shift_left bool>( ) { let len = v.len(); if offset == 0 || offset > len { - intrinsics::abort(); + intrinsics::abort_immediate(); } // SAFETY: see individual comments. diff --git a/library/core/src/slice/sort/stable/quicksort.rs b/library/core/src/slice/sort/stable/quicksort.rs index acc8a5e838e12..1696a5e3c0277 100644 --- a/library/core/src/slice/sort/stable/quicksort.rs +++ b/library/core/src/slice/sort/stable/quicksort.rs @@ -96,7 +96,7 @@ fn stable_partition bool>( let len = v.len(); if intrinsics::unlikely(scratch.len() < len || pivot_pos >= len) { - core::intrinsics::abort() + core::intrinsics::abort_immediate() } let v_base = v.as_ptr(); diff --git a/library/core/src/slice/sort/unstable/quicksort.rs b/library/core/src/slice/sort/unstable/quicksort.rs index 5f2991ee722d2..58a9aae7c7afa 100644 --- a/library/core/src/slice/sort/unstable/quicksort.rs +++ b/library/core/src/slice/sort/unstable/quicksort.rs @@ -102,7 +102,7 @@ where } if pivot >= len { - intrinsics::abort(); + intrinsics::abort_immediate(); } // SAFETY: We checked that `pivot` is in-bounds. @@ -124,7 +124,7 @@ where let num_lt = (const { inst_partition::() })(v_without_pivot, pivot, is_less); if num_lt >= len { - intrinsics::abort(); + intrinsics::abort_immediate(); } // SAFETY: We checked that `num_lt` is in-bounds. diff --git a/library/core/src/str/iter.rs b/library/core/src/str/iter.rs index b221b98a7b791..60b9e81aaeff9 100644 --- a/library/core/src/str/iter.rs +++ b/library/core/src/str/iter.rs @@ -1284,7 +1284,7 @@ pub struct SplitAsciiWhitespace<'a> { } /// An iterator over the substrings of a string, -/// terminated by a substring matching to a predicate function +/// terminated by a substring matching to a predicate function. /// Unlike `Split`, it contains the matched part as a terminator /// of the subslice. /// diff --git a/library/coretests/tests/num/floats.rs b/library/coretests/tests/num/floats.rs index 7093687f04b15..84d645ce31f3c 100644 --- a/library/coretests/tests/num/floats.rs +++ b/library/coretests/tests/num/floats.rs @@ -727,15 +727,10 @@ float_test! { assert_biteq!(flt(9.0).min(black_box(Float::NAN)), 9.0); assert_biteq!(black_box(flt(-9.0)).min(Float::NAN), -9.0); assert!(Float::NAN.min(Float::NAN).is_nan()); - // FIXME(llvm21): LLVM miscompiles the fallback impl on aarch64 and likely other targets - // (https://github.com/llvm/llvm-project/issues/176624). When we require LLVM 22, - // remove the ui test `tests/ui/float/minmax.rs` and unconditionally enable the test here. - if cfg!(miri) { - assert_biteq!(Float::SNAN.min(black_box(9.0)), 9.0); - assert_biteq!(black_box(Float::SNAN).min(-9.0), -9.0); - assert_biteq!(flt(9.0).min(black_box(Float::SNAN)), 9.0); - assert_biteq!(black_box(flt(-9.0)).min(Float::SNAN), -9.0); - } + assert_biteq!(Float::SNAN.min(black_box(9.0)), 9.0); + assert_biteq!(black_box(Float::SNAN).min(-9.0), -9.0); + assert_biteq!(flt(9.0).min(black_box(Float::SNAN)), 9.0); + assert_biteq!(black_box(flt(-9.0)).min(Float::SNAN), -9.0); assert!(Float::SNAN.min(Float::SNAN).is_nan()); } } @@ -770,15 +765,10 @@ float_test! { assert_biteq!(flt(9.0).max(black_box(Float::NAN)), 9.0); assert_biteq!(black_box(flt(-9.0)).max(Float::NAN), -9.0); assert!(Float::NAN.max(Float::NAN).is_nan()); - // FIXME(llvm21): LLVM miscompiles the fallback impl on aarch64 and likely other targets - // (https://github.com/llvm/llvm-project/issues/176624). When we require LLVM 22, - // remove the ui test `tests/ui/float/minmax.rs` and unconditionally enable the test here. - if cfg!(miri) { - assert_biteq!(Float::SNAN.max(black_box(9.0)), 9.0); - assert_biteq!(black_box(Float::SNAN).max(-9.0), -9.0); - assert_biteq!(flt(9.0).max(black_box(Float::SNAN)), 9.0); - assert_biteq!(black_box(flt(-9.0)).max(Float::SNAN), -9.0); - } + assert_biteq!(Float::SNAN.max(black_box(9.0)), 9.0); + assert_biteq!(black_box(Float::SNAN).max(-9.0), -9.0); + assert_biteq!(flt(9.0).max(black_box(Float::SNAN)), 9.0); + assert_biteq!(black_box(flt(-9.0)).max(Float::SNAN), -9.0); assert!(Float::SNAN.max(Float::SNAN).is_nan()); } } diff --git a/library/std/src/panicking.rs b/library/std/src/panicking.rs index f69e0a749f579..4a66d2c1d55f5 100644 --- a/library/std/src/panicking.rs +++ b/library/std/src/panicking.rs @@ -706,7 +706,7 @@ pub(crate) fn panic_handler(info: &core::panic::PanicInfo<'_>) -> ! { #[rustc_do_not_const_check] // hooked by const-eval pub const fn begin_panic(msg: M) -> ! { if cfg!(panic = "immediate-abort") { - intrinsics::abort() + intrinsics::abort_immediate() } struct Payload { @@ -887,5 +887,5 @@ fn rust_panic(msg: &mut dyn PanicPayload) -> ! { #[cfg_attr(not(test), rustc_std_internal_symbol)] #[cfg(panic = "immediate-abort")] fn rust_panic(_: &mut dyn PanicPayload) -> ! { - crate::intrinsics::abort(); + crate::intrinsics::abort_immediate(); } diff --git a/library/std/src/sys/exit.rs b/library/std/src/sys/exit.rs index b9ebe2d974fec..1ca2bd8f6b514 100644 --- a/library/std/src/sys/exit.rs +++ b/library/std/src/sys/exit.rs @@ -127,7 +127,7 @@ pub fn exit(code: i32) -> ! { ) }; } - crate::intrinsics::abort() + crate::intrinsics::abort_immediate() } any(target_family = "unix", target_os = "wasi") => unsafe { libc::exit(code as crate::ffi::c_int) @@ -147,7 +147,7 @@ pub fn exit(code: i32) -> ! { target_os = "xous" => crate::os::xous::ffi::exit(code as u32), _ => { let _ = code; - crate::intrinsics::abort() + crate::intrinsics::abort_immediate() } } } diff --git a/library/std/src/sys/pal/uefi/mod.rs b/library/std/src/sys/pal/uefi/mod.rs index 67499d2c6f17c..bb771c232f2de 100644 --- a/library/std/src/sys/pal/uefi/mod.rs +++ b/library/std/src/sys/pal/uefi/mod.rs @@ -103,8 +103,8 @@ pub fn abort_internal() -> ! { }; } - // In case SystemTable and ImageHandle cannot be reached, use `core::intrinsics::abort` - core::intrinsics::abort(); + // In case SystemTable and ImageHandle cannot be reached, use `abort_immediate` + core::intrinsics::abort_immediate(); } /// Disable access to BootServices if `EVT_SIGNAL_EXIT_BOOT_SERVICES` is signaled diff --git a/library/std/src/sys/pal/unix/mod.rs b/library/std/src/sys/pal/unix/mod.rs index e4a18794f7823..292c02f3d1f3e 100644 --- a/library/std/src/sys/pal/unix/mod.rs +++ b/library/std/src/sys/pal/unix/mod.rs @@ -267,8 +267,8 @@ pub fn cvt_nz(error: libc::c_int) -> io::Result<()> { // Current glibc's abort() function unblocks SIGABRT, raises SIGABRT, clears the // SIGABRT handler and raises it again, and then starts to get creative. // -// See the public documentation for `intrinsics::abort()` and `process::abort()` -// for further discussion. +// See the public documentation for `intrinsics::abort_immediate()` and +// `process::abort()` for further discussion. // // There is confusion about whether libc::abort() flushes stdio streams. // libc::abort() is required by ISO C 99 (7.14.1.1p5) to be async-signal-safe, diff --git a/library/std/src/sys/pal/unsupported/common.rs b/library/std/src/sys/pal/unsupported/common.rs index d94b9015d0f5f..8e53c3212b64b 100644 --- a/library/std/src/sys/pal/unsupported/common.rs +++ b/library/std/src/sys/pal/unsupported/common.rs @@ -17,5 +17,5 @@ pub fn unsupported_err() -> std_io::Error { } pub fn abort_internal() -> ! { - core::intrinsics::abort(); + core::intrinsics::abort_immediate(); } diff --git a/library/std/src/sys/pal/windows/mod.rs b/library/std/src/sys/pal/windows/mod.rs index 2a8ffaa0baab8..a9f3cdbdd9d3e 100644 --- a/library/std/src/sys/pal/windows/mod.rs +++ b/library/std/src/sys/pal/windows/mod.rs @@ -275,7 +275,7 @@ pub fn abort_internal() -> ! { core::arch::asm!("brk 0xF003", in("x0") c::FAST_FAIL_FATAL_APP_EXIT, options(noreturn, nostack)); } _ => { - core::intrinsics::abort(); + core::intrinsics::abort_immediate(); } } } @@ -284,7 +284,7 @@ pub fn abort_internal() -> ! { #[cfg(miri)] #[track_caller] // even without panics, this helps for Miri backtraces pub fn abort_internal() -> ! { - crate::intrinsics::abort(); + crate::intrinsics::abort_immediate(); } /// Align the inner value to 8 bytes. diff --git a/library/std/src/sys/pal/zkvm/mod.rs b/library/std/src/sys/pal/zkvm/mod.rs index 1a64d3c93d701..3a21e6f66c4e2 100644 --- a/library/std/src/sys/pal/zkvm/mod.rs +++ b/library/std/src/sys/pal/zkvm/mod.rs @@ -31,5 +31,5 @@ pub fn unsupported_err() -> std_io::Error { } pub fn abort_internal() -> ! { - core::intrinsics::abort(); + core::intrinsics::abort_immediate(); } diff --git a/library/std/src/sys/personality/mod.rs b/library/std/src/sys/personality/mod.rs index 31bd457adbe6b..be79643bdf846 100644 --- a/library/std/src/sys/personality/mod.rs +++ b/library/std/src/sys/personality/mod.rs @@ -22,7 +22,7 @@ cfg_select! { // aborting stub. #[lang = "eh_personality"] fn rust_eh_personality() { - core::intrinsics::abort() + core::intrinsics::abort_immediate() } } any( diff --git a/library/stdarch/crates/core_arch/src/mips/mod.rs b/library/stdarch/crates/core_arch/src/mips/mod.rs index 1de3ffd03d1f0..84bfd1585e89b 100644 --- a/library/stdarch/crates/core_arch/src/mips/mod.rs +++ b/library/stdarch/crates/core_arch/src/mips/mod.rs @@ -16,5 +16,5 @@ use stdarch_test::assert_instr; #[inline] #[unstable(feature = "stdarch_mips", issue = "111198")] pub unsafe fn break_() -> ! { - crate::intrinsics::abort() + crate::intrinsics::abort_immediate() } diff --git a/library/stdarch/crates/core_arch/src/nvptx/mod.rs b/library/stdarch/crates/core_arch/src/nvptx/mod.rs index d382aff41f4bf..ea6fffee3897f 100644 --- a/library/stdarch/crates/core_arch/src/nvptx/mod.rs +++ b/library/stdarch/crates/core_arch/src/nvptx/mod.rs @@ -145,7 +145,7 @@ pub unsafe fn _thread_idx_z() -> u32 { #[inline] #[unstable(feature = "stdarch_nvptx", issue = "111199")] pub unsafe fn trap() -> ! { - crate::intrinsics::abort() + crate::intrinsics::abort_immediate() } // Basic CUDA syscall declarations. diff --git a/library/stdarch/crates/core_arch/src/powerpc/mod.rs b/library/stdarch/crates/core_arch/src/powerpc/mod.rs index 53227215d946c..9bb1bf22434dc 100644 --- a/library/stdarch/crates/core_arch/src/powerpc/mod.rs +++ b/library/stdarch/crates/core_arch/src/powerpc/mod.rs @@ -18,5 +18,5 @@ use stdarch_test::assert_instr; #[inline] #[unstable(feature = "stdarch_powerpc", issue = "111145")] pub unsafe fn trap() -> ! { - crate::intrinsics::abort() + crate::intrinsics::abort_immediate() } diff --git a/library/stdarch/crates/core_arch/src/wasm32/mod.rs b/library/stdarch/crates/core_arch/src/wasm32/mod.rs index 57c9157bede89..03986e7e08ec7 100644 --- a/library/stdarch/crates/core_arch/src/wasm32/mod.rs +++ b/library/stdarch/crates/core_arch/src/wasm32/mod.rs @@ -29,7 +29,7 @@ pub use self::memory::*; #[inline] #[stable(feature = "unreachable_wasm32", since = "1.37.0")] pub fn unreachable() -> ! { - crate::intrinsics::abort() + crate::intrinsics::abort_immediate() } /// Generates the [`f32.ceil`] instruction, returning the smallest integer greater than or equal to `a`. diff --git a/src/bootstrap/src/core/build_steps/llvm.rs b/src/bootstrap/src/core/build_steps/llvm.rs index 625b3959d3326..5dae391cc4bee 100644 --- a/src/bootstrap/src/core/build_steps/llvm.rs +++ b/src/bootstrap/src/core/build_steps/llvm.rs @@ -804,11 +804,11 @@ fn check_llvm_version(builder: &Builder<'_>, llvm_config: &Path) { let version = get_llvm_version(builder, llvm_config); let mut parts = version.split('.').take(2).filter_map(|s| s.parse::().ok()); if let (Some(major), Some(_minor)) = (parts.next(), parts.next()) - && major >= 21 + && major >= 22 { return; } - panic!("\n\nbad LLVM version: {version}, need >=21\n\n") + panic!("\n\nbad LLVM version: {version}, need >=22\n\n") } /// C/C++ debug info remap flags for LLVM build. diff --git a/src/ci/docker/README.md b/src/ci/docker/README.md index 8360c8e9d8b48..167121a5a000c 100644 --- a/src/ci/docker/README.md +++ b/src/ci/docker/README.md @@ -14,9 +14,9 @@ To run a specific CI job locally, you can use the `citool` Rust crate: cargo run --manifest-path src/ci/citool/Cargo.toml run-local ``` -For example, to run the `x86_64-gnu-llvm-21-1` job: +For example, to run the `x86_64-gnu-llvm-22-1` job: ``` -cargo run --manifest-path src/ci/citool/Cargo.toml run-local x86_64-gnu-llvm-21-1 +cargo run --manifest-path src/ci/citool/Cargo.toml run-local x86_64-gnu-llvm-22-1 ``` The job will output artifacts in an `obj/` dir at the root of a repository. Note @@ -27,10 +27,10 @@ Docker image executed in the given CI job. while locally, to the `obj/` directory. This is primarily to prevent strange linker errors when using multiple Docker images. -For some Linux workflows (for example `x86_64-gnu-llvm-21-N`), the process is more involved. You will need to see which script is executed for the given workflow inside the [`jobs.yml`](../github-actions/jobs.yml) file and pass it through the `DOCKER_SCRIPT` environment variable. For example, to reproduce the `x86_64-gnu-llvm-21-3` workflow, you can run the following script: +For some Linux workflows (for example `x86_64-gnu-llvm-22-N`), the process is more involved. You will need to see which script is executed for the given workflow inside the [`jobs.yml`](../github-actions/jobs.yml) file and pass it through the `DOCKER_SCRIPT` environment variable. For example, to reproduce the `x86_64-gnu-llvm-22-3` workflow, you can run the following script: ``` -DOCKER_SCRIPT=x86_64-gnu-llvm3.sh ./src/ci/docker/run.sh x86_64-gnu-llvm-21 +DOCKER_SCRIPT=x86_64-gnu-llvm3.sh ./src/ci/docker/run.sh x86_64-gnu-llvm-22 ``` ## Local Development diff --git a/src/ci/docker/host-aarch64/test-aarch64-gnu-llvm-21/Dockerfile b/src/ci/docker/host-aarch64/test-aarch64-gnu-llvm-22/Dockerfile similarity index 89% rename from src/ci/docker/host-aarch64/test-aarch64-gnu-llvm-21/Dockerfile rename to src/ci/docker/host-aarch64/test-aarch64-gnu-llvm-22/Dockerfile index fe6c2d40f5f5c..53030a098841d 100644 --- a/src/ci/docker/host-aarch64/test-aarch64-gnu-llvm-21/Dockerfile +++ b/src/ci/docker/host-aarch64/test-aarch64-gnu-llvm-22/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:25.10 +FROM ubuntu:26.04 ARG DEBIAN_FRONTEND=noninteractive @@ -15,10 +15,10 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ cmake \ sudo \ gdb \ - llvm-21-tools \ - llvm-21-dev \ - lldb-21 \ - python3-lldb-21 \ + llvm-22-tools \ + llvm-22-dev \ + lldb-22 \ + python3-lldb-22 \ libedit-dev \ libssl-dev \ pkg-config \ @@ -43,11 +43,11 @@ ENV NO_DOWNLOAD_CI_LLVM="1" ENV EXTERNAL_LLVM="1" # Override the default debugger `discover` behavior -ENV LLDB_PATH="lldb-21" +ENV LLDB_PATH="lldb-22" # Using llvm-link-shared due to libffi issues -- see #34486 ENV RUST_CONFIGURE_ARGS="--build=aarch64-unknown-linux-gnu \ - --llvm-root=/usr/lib/llvm-21 \ + --llvm-root=/usr/lib/llvm-22 \ --enable-llvm-link-shared \ --set rust.randomize-layout=true \ --set rust.thin-lto-import-instr-limit=10" diff --git a/src/ci/docker/host-x86_64/test-x86_64-gnu-llvm-21/Dockerfile b/src/ci/docker/host-x86_64/test-x86_64-gnu-llvm-21/Dockerfile deleted file mode 100644 index fc96735521077..0000000000000 --- a/src/ci/docker/host-x86_64/test-x86_64-gnu-llvm-21/Dockerfile +++ /dev/null @@ -1,65 +0,0 @@ -FROM ubuntu:25.10 - -ARG DEBIAN_FRONTEND=noninteractive - -RUN apt-get update && apt-get install -y --no-install-recommends \ - bzip2 \ - g++ \ - gcc-multilib \ - make \ - ninja-build \ - file \ - curl \ - ca-certificates \ - python3 \ - git \ - cmake \ - sudo \ - gdb \ - llvm-21-tools \ - llvm-21-dev \ - libedit-dev \ - libssl-dev \ - pkg-config \ - zlib1g-dev \ - xz-utils \ - nodejs \ - mingw-w64 \ - # libgccjit dependencies - flex \ - libmpfr-dev \ - libgmp-dev \ - libmpc3 \ - libmpc-dev \ - && rm -rf /var/lib/apt/lists/* - -# Install powershell (universal package) so we can test x.ps1 on Linux -# FIXME: need a "universal" version that supports libicu74, but for now it still works to ignore that dep. -RUN curl -sL "https://github.com/PowerShell/PowerShell/releases/download/v7.3.1/powershell_7.3.1-1.deb_amd64.deb" > powershell.deb && \ - dpkg --ignore-depends=libicu72 -i powershell.deb && \ - rm -f powershell.deb - -COPY scripts/sccache.sh /scripts/ -RUN sh /scripts/sccache.sh - -# We are disabling CI LLVM since this builder is intentionally using a host -# LLVM, rather than the typical src/llvm-project LLVM. -ENV NO_DOWNLOAD_CI_LLVM="1" -ENV EXTERNAL_LLVM="1" - -# Using llvm-link-shared due to libffi issues -- see #34486 -ENV RUST_CONFIGURE_ARGS="--build=x86_64-unknown-linux-gnu \ - --llvm-root=/usr/lib/llvm-21 \ - --enable-llvm-link-shared \ - --set rust.randomize-layout=true \ - --set rust.thin-lto-import-instr-limit=10" - -COPY scripts/shared.sh /scripts/ - -COPY scripts/x86_64-gnu-llvm.sh /scripts/ -COPY scripts/x86_64-gnu-llvm2.sh /scripts/ -COPY scripts/x86_64-gnu-llvm3.sh /scripts/ -COPY scripts/stage_2_test_set1.sh /scripts/ -COPY scripts/stage_2_test_set2.sh /scripts/ - -ENV SCRIPT="Must specify DOCKER_SCRIPT for this image" diff --git a/src/ci/docker/host-x86_64/test-x86_64-gnu-llvm-22/Dockerfile b/src/ci/docker/host-x86_64/test-x86_64-gnu-llvm-22/Dockerfile index a22e8de90804f..e7191aa31c47b 100644 --- a/src/ci/docker/host-x86_64/test-x86_64-gnu-llvm-22/Dockerfile +++ b/src/ci/docker/host-x86_64/test-x86_64-gnu-llvm-22/Dockerfile @@ -44,16 +44,15 @@ RUN sh /scripts/sccache.sh # We are disabling CI LLVM since this builder is intentionally using a host # LLVM, rather than the typical src/llvm-project LLVM. -ENV NO_DOWNLOAD_CI_LLVM 1 -ENV EXTERNAL_LLVM 1 +ENV NO_DOWNLOAD_CI_LLVM="1" +ENV EXTERNAL_LLVM="1" # Using llvm-link-shared due to libffi issues -- see #34486 -ENV RUST_CONFIGURE_ARGS \ - --build=x86_64-unknown-linux-gnu \ +ENV RUST_CONFIGURE_ARGS="--build=x86_64-unknown-linux-gnu \ --llvm-root=/usr/lib/llvm-22 \ --enable-llvm-link-shared \ --set rust.randomize-layout=true \ - --set rust.thin-lto-import-instr-limit=10 + --set rust.thin-lto-import-instr-limit=10" COPY scripts/shared.sh /scripts/ @@ -63,4 +62,4 @@ COPY scripts/x86_64-gnu-llvm3.sh /scripts/ COPY scripts/stage_2_test_set1.sh /scripts/ COPY scripts/stage_2_test_set2.sh /scripts/ -ENV SCRIPT "Must specify DOCKER_SCRIPT for this image" +ENV SCRIPT="Must specify DOCKER_SCRIPT for this image" diff --git a/src/ci/docker/scripts/stage_2_test_set1.sh b/src/ci/docker/scripts/stage_2_test_set1.sh index 62b3c2c051a40..15d24533c388d 100755 --- a/src/ci/docker/scripts/stage_2_test_set1.sh +++ b/src/ci/docker/scripts/stage_2_test_set1.sh @@ -14,14 +14,7 @@ if [ "$PR_CI_JOB" == "1" ]; then SKIP_TIDY="--skip tidy" fi -# Skip intrinsic-test on LLVM 21 to avoid CI failures. -if [ "$LLVM_VERSION" = "21" ]; then - echo "LLVM_VERSION is 21; skipping intrinsic-test" - SKIP_INTRINSICS="--skip intrinsic-test" -fi - ../x.py --stage 2 test \ ${SKIP_TIDY:+$SKIP_TIDY} \ - ${SKIP_INTRINSICS:+$SKIP_INTRINSICS} \ --skip compiler \ --skip src diff --git a/src/ci/docker/scripts/stage_2_test_set2.sh b/src/ci/docker/scripts/stage_2_test_set2.sh index c0cdc31011378..5a954f5e9e63f 100755 --- a/src/ci/docker/scripts/stage_2_test_set2.sh +++ b/src/ci/docker/scripts/stage_2_test_set2.sh @@ -14,25 +14,8 @@ if [ "$PR_CI_JOB" == "1" ]; then SKIP_TIDY="--skip tidy" fi -# The combination of rust.randomize-layout and LLVM 21 is causing random -# SIGSEGV in the `hir-def` rust-analyzer tests. Since it seems to be fixed in -# LLVM 22, let's just disable this for now since it has been disruptive for -# CI. See https://github.com/rust-lang/rust/issues/156460. -if [[ "$CI_JOB_NAME" == *"llvm-21"* ]]; then - echo "CI_JOB_NAME contains 'llvm-21'; skipping rust-analyzer" - SKIP_RUST_ANALYZER="--skip src/tools/rust-analyzer" -fi - -# Skip intrinsic-test on LLVM 21 to avoid CI failures. -if [ "$LLVM_VERSION" = "21" ]; then - echo "LLVM_VERSION is 21; skipping intrinsic-test" - SKIP_INTRINSICS="--skip intrinsic-test" -fi - ../x.py --stage 2 test \ ${SKIP_TIDY:+$SKIP_TIDY} \ - ${SKIP_INTRINSICS:+$SKIP_INTRINSICS} \ - ${SKIP_RUST_ANALYZER:+$SKIP_RUST_ANALYZER} \ --skip tests \ --skip library \ --skip tidyselftest diff --git a/src/ci/github-actions/jobs.yml b/src/ci/github-actions/jobs.yml index 0fdf50d20a255..57432451b9798 100644 --- a/src/ci/github-actions/jobs.yml +++ b/src/ci/github-actions/jobs.yml @@ -126,21 +126,21 @@ pr: # tidy. This speeds up the PR CI job by ~1 minute. SKIP_SUBMODULES: src/gcc <<: *job-linux-4c - - name: test-x86_64-gnu-llvm-21 + - name: test-x86_64-gnu-llvm-22 env: ENABLE_GCC_CODEGEN: "1" DOCKER_SCRIPT: x86_64-gnu-llvm.sh <<: *job-linux-4c - - name: test-aarch64-gnu-llvm-21-1 + - name: test-aarch64-gnu-llvm-22-1 env: - IMAGE: test-aarch64-gnu-llvm-21 - LLVM_VERSION: "21" + IMAGE: test-aarch64-gnu-llvm-22 + LLVM_VERSION: "22" DOCKER_SCRIPT: stage_2_test_set1.sh <<: *job-aarch64-linux - - name: test-aarch64-gnu-llvm-21-2 + - name: test-aarch64-gnu-llvm-22-2 env: - IMAGE: test-aarch64-gnu-llvm-21 - LLVM_VERSION: "21" + IMAGE: test-aarch64-gnu-llvm-22 + LLVM_VERSION: "22" DOCKER_SCRIPT: stage_2_test_set2.sh <<: *job-aarch64-linux - name: test-x86_64-gnu-tools @@ -428,40 +428,13 @@ auto: - name: test-x86_64-gnu-distcheck <<: *job-linux-4c - # The x86_64-gnu-llvm-21 job is split into multiple jobs to run tests in parallel. - # x86_64-gnu-llvm-21-1 skips tests that run in x86_64-gnu-llvm-21-{2,3}. - - name: test-x86_64-gnu-llvm-21-1 - env: - RUST_BACKTRACE: 1 - IMAGE: test-x86_64-gnu-llvm-21 - LLVM_VERSION: "21" - DOCKER_SCRIPT: stage_2_test_set2.sh - <<: *job-linux-4c - - # Skip tests that run in x86_64-gnu-llvm-21-{1,3} - - name: test-x86_64-gnu-llvm-21-2 - env: - RUST_BACKTRACE: 1 - IMAGE: test-x86_64-gnu-llvm-21 - LLVM_VERSION: "21" - DOCKER_SCRIPT: x86_64-gnu-llvm2.sh - <<: *job-linux-4c - - # Skip tests that run in x86_64-gnu-llvm-21-{1,2} - - name: test-x86_64-gnu-llvm-21-3 - env: - RUST_BACKTRACE: 1 - IMAGE: test-x86_64-gnu-llvm-21 - LLVM_VERSION: "21" - DOCKER_SCRIPT: x86_64-gnu-llvm3.sh - <<: *job-linux-4c - # The x86_64-gnu-llvm-22 job is split into multiple jobs to run tests in parallel. # x86_64-gnu-llvm-22-1 skips tests that run in x86_64-gnu-llvm-22-{2,3}. - name: test-x86_64-gnu-llvm-22-1 env: RUST_BACKTRACE: 1 IMAGE: test-x86_64-gnu-llvm-22 + LLVM_VERSION: "22" DOCKER_SCRIPT: stage_2_test_set2.sh <<: *job-linux-4c @@ -470,6 +443,7 @@ auto: env: RUST_BACKTRACE: 1 IMAGE: test-x86_64-gnu-llvm-22 + LLVM_VERSION: "22" DOCKER_SCRIPT: x86_64-gnu-llvm2.sh <<: *job-linux-4c @@ -478,6 +452,7 @@ auto: env: RUST_BACKTRACE: 1 IMAGE: test-x86_64-gnu-llvm-22 + LLVM_VERSION: "22" DOCKER_SCRIPT: x86_64-gnu-llvm3.sh <<: *job-linux-4c diff --git a/src/doc/rustc-dev-guide/src/tests/directives.md b/src/doc/rustc-dev-guide/src/tests/directives.md index 22735c124fb43..a12b602d9c2d6 100644 --- a/src/doc/rustc-dev-guide/src/tests/directives.md +++ b/src/doc/rustc-dev-guide/src/tests/directives.md @@ -148,8 +148,7 @@ Some examples of `X` in `ignore-X` or `only-X`: - 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-next-solver`, `compare-mode-next-solver-coherence`, +- Specific [compare modes]: `compare-mode-polonius`, `compare-mode-next-solver`, `compare-mode-split-dwarf`, `compare-mode-split-dwarf-single` - The two different test modes used by coverage tests: `ignore-coverage-map`, `ignore-coverage-run` diff --git a/src/doc/unstable-book/src/language-features/intrinsics.md b/src/doc/unstable-book/src/language-features/intrinsics.md index 9e59dd889985c..c662e5831d3a0 100644 --- a/src/doc/unstable-book/src/language-features/intrinsics.md +++ b/src/doc/unstable-book/src/language-features/intrinsics.md @@ -68,5 +68,5 @@ These are written without a body: #![allow(internal_features)] #[rustc_intrinsic] -pub fn abort() -> !; +pub fn abort_immediate() -> !; ``` diff --git a/src/doc/unstable-book/src/language-features/lang-items.md b/src/doc/unstable-book/src/language-features/lang-items.md index ccc973d013e44..c88f0cb859877 100644 --- a/src/doc/unstable-book/src/language-features/lang-items.md +++ b/src/doc/unstable-book/src/language-features/lang-items.md @@ -85,7 +85,7 @@ unsafe fn allocate(size: usize, _align: usize) -> *mut u8 { // Check if `malloc` failed: if p.is_null() { - intrinsics::abort(); + intrinsics::abort_immediate(); } p @@ -102,7 +102,7 @@ extern "C" fn main(_argc: c_int, _argv: *const *const u8) -> c_int { fn rust_eh_personality() {} #[panic_handler] -fn panic_handler(_info: &PanicInfo) -> ! { intrinsics::abort() } +fn panic_handler(_info: &PanicInfo) -> ! { intrinsics::abort_immediate() } ``` Note the use of `abort`: the `exchange_malloc` lang item is assumed to diff --git a/src/tools/compiletest/src/common.rs b/src/tools/compiletest/src/common.rs index 1968f5eb73d4e..5d0750ddb92b7 100644 --- a/src/tools/compiletest/src/common.rs +++ b/src/tools/compiletest/src/common.rs @@ -173,7 +173,6 @@ string_enum! { pub(crate) enum CompareMode { Polonius => "polonius", NextSolver => "next-solver", - NextSolverCoherence => "next-solver-coherence", SplitDwarf => "split-dwarf", SplitDwarfSingle => "split-dwarf-single", } diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 0bb8a7003589c..263c8d5aded54 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -1943,9 +1943,6 @@ impl<'test> TestCx<'test> { Some(CompareMode::NextSolver) => { compiler.args(&["-Znext-solver"]); } - Some(CompareMode::NextSolverCoherence) => { - compiler.args(&["-Znext-solver=coherence"]); - } Some(CompareMode::SplitDwarf) if self.config.target.contains("windows") => { compiler.args(&["-Csplit-debuginfo=unpacked", "-Zunstable-options"]); } diff --git a/src/tools/miri/src/intrinsics/mod.rs b/src/tools/miri/src/intrinsics/mod.rs index 997339f66a51c..aa93632b78470 100644 --- a/src/tools/miri/src/intrinsics/mod.rs +++ b/src/tools/miri/src/intrinsics/mod.rs @@ -95,8 +95,8 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { match intrinsic_name { // Basic control flow - "abort" => { - // Note that `abort` is also hooked separately in CTFE. + "abort_immediate" => { + // Note that `abort_immediate` is also hooked separately in CTFE. throw_machine_stop!(TerminationInfo::Abort( "the program aborted execution".to_owned() )); diff --git a/src/tools/miri/tests/fail/alloc/alloc_error_handler_custom.rs b/src/tools/miri/tests/fail/alloc/alloc_error_handler_custom.rs index 72f45be61b299..cb11c4ac22776 100644 --- a/src/tools/miri/tests/fail/alloc/alloc_error_handler_custom.rs +++ b/src/tools/miri/tests/fail/alloc/alloc_error_handler_custom.rs @@ -16,7 +16,7 @@ mod utils; #[alloc_error_handler] fn alloc_error_handler(layout: Layout) -> ! { let _ = writeln!(utils::MiriStderr, "custom alloc error handler: {layout:?}"); - core::intrinsics::abort(); //~ERROR: aborted + core::intrinsics::abort_immediate(); //~ERROR: aborted } // rustc requires us to provide some more things that aren't actually used by this test diff --git a/src/tools/miri/tests/fail/alloc/alloc_error_handler_custom.stderr b/src/tools/miri/tests/fail/alloc/alloc_error_handler_custom.stderr index 677fa1b1bb9c0..4e6bdd2d82296 100644 --- a/src/tools/miri/tests/fail/alloc/alloc_error_handler_custom.stderr +++ b/src/tools/miri/tests/fail/alloc/alloc_error_handler_custom.stderr @@ -2,8 +2,8 @@ custom alloc error handler: Layout { size: 4, align: 4 (1 << 2) } error: abnormal termination: the program aborted execution --> tests/fail/alloc/alloc_error_handler_custom.rs:LL:CC | -LL | core::intrinsics::abort(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ abnormal termination occurred here +LL | core::intrinsics::abort_immediate(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ abnormal termination occurred here | = note: stack backtrace: 0: alloc_error_handler diff --git a/src/tools/miri/tests/fail/alloc/alloc_error_handler_no_std.rs b/src/tools/miri/tests/fail/alloc/alloc_error_handler_no_std.rs index c7c51c95e9c26..d88c8b27e3c94 100644 --- a/src/tools/miri/tests/fail/alloc/alloc_error_handler_no_std.rs +++ b/src/tools/miri/tests/fail/alloc/alloc_error_handler_no_std.rs @@ -19,7 +19,7 @@ mod utils; fn panic_handler(panic_info: &core::panic::PanicInfo) -> ! { let _ = writeln!(utils::MiriStderr, "custom panic handler called!"); let _ = writeln!(utils::MiriStderr, "{panic_info}"); - core::intrinsics::abort(); //~ERROR: aborted + core::intrinsics::abort_immediate(); //~ERROR: aborted } // rustc requires us to provide some more things that aren't actually used by this test diff --git a/src/tools/miri/tests/fail/alloc/alloc_error_handler_no_std.stderr b/src/tools/miri/tests/fail/alloc/alloc_error_handler_no_std.stderr index 386e7cdc2bd81..b93848eef5274 100644 --- a/src/tools/miri/tests/fail/alloc/alloc_error_handler_no_std.stderr +++ b/src/tools/miri/tests/fail/alloc/alloc_error_handler_no_std.stderr @@ -4,8 +4,8 @@ memory allocation of 4 bytes failed error: abnormal termination: the program aborted execution --> tests/fail/alloc/alloc_error_handler_no_std.rs:LL:CC | -LL | core::intrinsics::abort(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ abnormal termination occurred here +LL | core::intrinsics::abort_immediate(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ abnormal termination occurred here | = note: stack backtrace: 0: panic_handler diff --git a/src/tools/miri/tests/fail/panic/no_std.rs b/src/tools/miri/tests/fail/panic/no_std.rs index cd8a3251fef20..e4b212104ede2 100644 --- a/src/tools/miri/tests/fail/panic/no_std.rs +++ b/src/tools/miri/tests/fail/panic/no_std.rs @@ -16,5 +16,5 @@ fn miri_start(_argc: isize, _argv: *const *const u8) -> isize { #[panic_handler] fn panic_handler(panic_info: &core::panic::PanicInfo) -> ! { writeln!(utils::MiriStderr, "{panic_info}").ok(); - core::intrinsics::abort(); //~ ERROR: the program aborted execution + core::intrinsics::abort_immediate(); //~ ERROR: the program aborted execution } diff --git a/src/tools/miri/tests/fail/panic/no_std.stderr b/src/tools/miri/tests/fail/panic/no_std.stderr index 87adb18a7ab90..493ed858c3234 100644 --- a/src/tools/miri/tests/fail/panic/no_std.stderr +++ b/src/tools/miri/tests/fail/panic/no_std.stderr @@ -3,8 +3,8 @@ blarg I am dead error: abnormal termination: the program aborted execution --> tests/fail/panic/no_std.rs:LL:CC | -LL | core::intrinsics::abort(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ abnormal termination occurred here +LL | core::intrinsics::abort_immediate(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ abnormal termination occurred here | = note: stack backtrace: 0: panic_handler diff --git a/src/tools/rustfmt/tests/source/match.rs b/src/tools/rustfmt/tests/source/match.rs index d1d8d7f2c3665..c171244271f45 100644 --- a/src/tools/rustfmt/tests/source/match.rs +++ b/src/tools/rustfmt/tests/source/match.rs @@ -240,7 +240,7 @@ fn issue383() { fn issue507() { match 1 { - 1 => unsafe { std::intrinsics::abort() }, + 1 => unsafe { std::intrinsics::abort_immediate() }, _ => (), } } diff --git a/src/tools/rustfmt/tests/target/match.rs b/src/tools/rustfmt/tests/target/match.rs index 0e7815a814da2..f751aea547af6 100644 --- a/src/tools/rustfmt/tests/target/match.rs +++ b/src/tools/rustfmt/tests/target/match.rs @@ -249,7 +249,7 @@ fn issue383() { fn issue507() { match 1 { - 1 => unsafe { std::intrinsics::abort() }, + 1 => unsafe { std::intrinsics::abort_immediate() }, _ => (), } } diff --git a/src/tools/tidy/src/tests_revision_unpaired_stdout_stderr.rs b/src/tools/tidy/src/tests_revision_unpaired_stdout_stderr.rs index 4d9cb55138afa..88dc1ce1ae0a7 100644 --- a/src/tools/tidy/src/tests_revision_unpaired_stdout_stderr.rs +++ b/src/tools/tidy/src/tests_revision_unpaired_stdout_stderr.rs @@ -10,15 +10,8 @@ use crate::walk::*; // Should be kept in sync with `CompareMode` in `src/tools/compiletest/src/common.rs`, // as well as `run`. -const IGNORES: &[&str] = &[ - "polonius", - "chalk", - "split-dwarf", - "split-dwarf-single", - "next-solver-coherence", - "next-solver", - "run", -]; +const IGNORES: &[&str] = + &["polonius", "chalk", "split-dwarf", "split-dwarf-single", "next-solver", "run"]; const EXTENSIONS: &[&str] = &["stdout", "stderr"]; const SPECIAL_TEST: &str = "tests/ui/command/need-crate-arg-ignore-tidy.x.rs"; diff --git a/tests/assembly-llvm/asm/loongarch-type.rs b/tests/assembly-llvm/asm/loongarch-type.rs index 5efad583a39df..124d82c5d5d6c 100644 --- a/tests/assembly-llvm/asm/loongarch-type.rs +++ b/tests/assembly-llvm/asm/loongarch-type.rs @@ -8,7 +8,6 @@ //@[loongarch32r] compile-flags: --target loongarch32-unknown-none //@[loongarch32r] needs-llvm-components: loongarch -//@[loongarch32r] min-llvm-version: 22 //@[loongarch64] compile-flags: --target loongarch64-unknown-none //@[loongarch64] needs-llvm-components: loongarch diff --git a/tests/assembly-llvm/asm/powerpc-types.rs b/tests/assembly-llvm/asm/powerpc-types.rs index 1fbf4be0aa3c5..44e14b53b8c52 100644 --- a/tests/assembly-llvm/asm/powerpc-types.rs +++ b/tests/assembly-llvm/asm/powerpc-types.rs @@ -35,8 +35,6 @@ //@ compile-flags: -Zmerge-functions=disabled -Copt-level=3 //@ compile-flags: --check-cfg=cfg(altivec,vsx,power9,power9be) -// PowerPC `f16` was broken before LLVM 22 -//@ min-llvm-version: 22 #![feature(no_core, f16)] #![cfg_attr(vsx, feature(f128))] diff --git a/tests/assembly-llvm/asm/sparc-types.rs b/tests/assembly-llvm/asm/sparc-types.rs index e7f2d84e470a0..9fabd8dcdd09e 100644 --- a/tests/assembly-llvm/asm/sparc-types.rs +++ b/tests/assembly-llvm/asm/sparc-types.rs @@ -11,7 +11,6 @@ //@[sparc64] filecheck-flags: --check-prefix v9 //@ compile-flags: -Zmerge-functions=disabled -Copt-level=3 //@ compile-flags: --check-cfg=cfg(v9) -//@ min-llvm-version: 22 #![deny(unexpected_cfgs)] #![feature(no_core, asm_experimental_arch, f128)] diff --git a/tests/assembly-llvm/asm/xtensa-types.rs b/tests/assembly-llvm/asm/xtensa-types.rs index 69c22d22b8b9a..9419a78f9e07c 100644 --- a/tests/assembly-llvm/asm/xtensa-types.rs +++ b/tests/assembly-llvm/asm/xtensa-types.rs @@ -1,7 +1,6 @@ //@ add-minicore //@ assembly-output: emit-asm //@ compile-flags: --target xtensa-esp32-none-elf -Zmerge-functions=disabled -//@ min-llvm-version: 22 //@ needs-llvm-components: xtensa #![feature(no_core, lang_items, rustc_attrs, asm_experimental_arch)] diff --git a/tests/assembly-llvm/bpf_unaligned.rs b/tests/assembly-llvm/bpf_unaligned.rs index 466c3e411ec2c..ba221fff5bea9 100644 --- a/tests/assembly-llvm/bpf_unaligned.rs +++ b/tests/assembly-llvm/bpf_unaligned.rs @@ -1,7 +1,6 @@ //@ add-minicore //@ assembly-output: emit-asm //@ compile-flags: --target bpfel-unknown-none -C target_feature=+allows-misaligned-mem-access -//@ min-llvm-version: 22 //@ needs-llvm-components: bpf #![feature(no_core)] #![crate_type = "rlib"] diff --git a/tests/assembly-llvm/c-variadic/xtensa.rs b/tests/assembly-llvm/c-variadic/xtensa.rs index a070980cff3d6..31e3c427d4e05 100644 --- a/tests/assembly-llvm/c-variadic/xtensa.rs +++ b/tests/assembly-llvm/c-variadic/xtensa.rs @@ -1,6 +1,5 @@ //@ add-minicore //@ assembly-output: emit-asm -//@ min-llvm-version: 22 // //@ revisions: XTENSA //@ [XTENSA] compile-flags: -Copt-level=3 --target xtensa-esp32-none-elf diff --git a/tests/assembly-llvm/cmse-clear-padding.rs b/tests/assembly-llvm/cmse-clear-padding.rs index 93b10845ea511..271a844a6e82d 100644 --- a/tests/assembly-llvm/cmse-clear-padding.rs +++ b/tests/assembly-llvm/cmse-clear-padding.rs @@ -1,5 +1,4 @@ //@ add-minicore -//@ min-llvm-version: 22 //@ assembly-output: emit-asm //@ compile-flags: --target thumbv8m.main-none-eabi --crate-type lib -Copt-level=1 //@ needs-llvm-components: arm diff --git a/tests/assembly-llvm/mips-div-no-trap.rs b/tests/assembly-llvm/mips-div-no-trap.rs index d2baff77d3070..1088cce4ef26b 100644 --- a/tests/assembly-llvm/mips-div-no-trap.rs +++ b/tests/assembly-llvm/mips-div-no-trap.rs @@ -107,16 +107,16 @@ extern crate minicore; pub unsafe fn unchecked_div(x: T, y: T) -> T; #[rustc_intrinsic] -pub fn abort() -> !; +pub fn abort_immediate() -> !; // NOTRAP-NOT: teq // TRAP: teq #[no_mangle] pub fn div_i32(a: i32, b: i32) -> i32 { match a { - 0 => abort(), + 0 => abort_immediate(), -1 => match b { - -2147483648 => abort(), + -2147483648 => abort_immediate(), _ => unsafe { unchecked_div(a, b) }, }, _ => unsafe { unchecked_div(a, b) }, diff --git a/tests/assembly-llvm/tail-call-indirect.rs b/tests/assembly-llvm/tail-call-indirect.rs index 918283966b405..bdebb1f3c30e1 100644 --- a/tests/assembly-llvm/tail-call-indirect.rs +++ b/tests/assembly-llvm/tail-call-indirect.rs @@ -1,5 +1,4 @@ //@ add-minicore -//@ min-llvm-version: 22 //@ assembly-output: emit-asm //@ needs-llvm-components: x86 //@ compile-flags: --target=x86_64-unknown-linux-gnu diff --git a/tests/assembly-llvm/targets/targets-elf.rs b/tests/assembly-llvm/targets/targets-elf.rs index 971e9700035e5..f5c6277ff106c 100644 --- a/tests/assembly-llvm/targets/targets-elf.rs +++ b/tests/assembly-llvm/targets/targets-elf.rs @@ -845,9 +845,6 @@ //@ [xtensa_esp32s3_espidf] compile-flags: --target xtensa-esp32s3-espidf //@ [xtensa_esp32s3_espidf] needs-llvm-components: xtensa -// xtensa support requires a more recent LLVM. -//@ min-llvm-version: 22 - // Sanity-check that each target can produce assembly code. #![feature(no_core, lang_items)] diff --git a/tests/codegen-llvm/amdgpu-addrspacecast.rs b/tests/codegen-llvm/amdgpu-addrspacecast.rs index 144565f7e28ca..0b15c86d9d22b 100644 --- a/tests/codegen-llvm/amdgpu-addrspacecast.rs +++ b/tests/codegen-llvm/amdgpu-addrspacecast.rs @@ -3,23 +3,20 @@ //@ compile-flags: --crate-type=rlib --target=amdgcn-amd-amdhsa -Ctarget-cpu=gfx900 -O //@ needs-llvm-components: amdgpu //@ add-minicore -//@ revisions: LLVM21 LLVM22 -//@ [LLVM21] max-llvm-major-version: 21 -//@ [LLVM22] min-llvm-version: 22 #![feature(no_core)] #![no_core] extern crate minicore; -// Make sure that on LLVM 22, the alloca is passed directly to the lifetime intrinsics, +// Make sure that on LLVM 22+, the alloca is passed directly to the lifetime intrinsics, // not the addrspacecast. // CHECK-LABEL: @ref_of_local // CHECK: [[alloca:%[0-9]]] = alloca // CHECK: %i = addrspacecast ptr addrspace(5) [[alloca]] to ptr -// LLVM22: call void @llvm.lifetime.start.p5(ptr addrspace(5) [[alloca]]) +// CHECK: call void @llvm.lifetime.start.p5(ptr addrspace(5) [[alloca]]) // CHECK: call void %f(ptr{{.*}}%i) -// LLVM22: call void @llvm.lifetime.end.p5(ptr addrspace(5) [[alloca]]) +// CHECK: call void @llvm.lifetime.end.p5(ptr addrspace(5) [[alloca]]) #[no_mangle] pub fn ref_of_local(f: fn(&i32)) { let i = 0; diff --git a/tests/codegen-llvm/const-vector.rs b/tests/codegen-llvm/const-vector.rs index e9e6188f804c0..39492b38f63d4 100644 --- a/tests/codegen-llvm/const-vector.rs +++ b/tests/codegen-llvm/const-vector.rs @@ -1,5 +1,4 @@ //@ revisions: OPT0 OPT0_S390X -//@ min-llvm-version: 22 //@ [OPT0] ignore-s390x //@ [OPT0_S390X] only-s390x //@ [OPT0] compile-flags: -C no-prepopulate-passes -Copt-level=0 diff --git a/tests/codegen-llvm/issues/issue-122600-ptr-discriminant-update.rs b/tests/codegen-llvm/issues/issue-122600-ptr-discriminant-update.rs index 5b100d2cdc381..9115824669f27 100644 --- a/tests/codegen-llvm/issues/issue-122600-ptr-discriminant-update.rs +++ b/tests/codegen-llvm/issues/issue-122600-ptr-discriminant-update.rs @@ -1,7 +1,4 @@ //@ compile-flags: -Copt-level=3 -//@ revisions: new old -//@ [old] max-llvm-major-version: 21 -//@ [new] min-llvm-version: 22 #![crate_type = "lib"] @@ -25,9 +22,6 @@ pub unsafe fn update(s: *mut State) { // CHECK-NOT: memcpy // CHECK-NOT: 75{{3|4}} - // old: %[[TAG:.+]] = load i8, ptr %s, align 1 - // old-NEXT: and i8 %[[TAG]], 1 - // CHECK-NOT: load // CHECK-NOT: store // CHECK-NOT: memcpy diff --git a/tests/codegen-llvm/pauth/pauth-extern-c-direct-indirect-call.rs b/tests/codegen-llvm/pauth/pauth-extern-c-direct-indirect-call.rs index d01815954b237..b47637a687bb0 100644 --- a/tests/codegen-llvm/pauth/pauth-extern-c-direct-indirect-call.rs +++ b/tests/codegen-llvm/pauth/pauth-extern-c-direct-indirect-call.rs @@ -4,9 +4,6 @@ //@ [O0_PAUTH] needs-llvm-components: aarch64 //@ [O0_PAUTH] compile-flags: --target=aarch64-unknown-linux-pauthtest -C opt-level=0 -// O3_PAUTH relies on an InstCombine fold that removes the redundant `ptrauth` bundle from calls. -// That fold first shipped in LLVM 22, gate this revision accordingly. -//@ [O3_PAUTH] min-llvm-version: 22 //@ [O3_PAUTH] needs-llvm-components: aarch64 //@ [O3_PAUTH] compile-flags: --target=aarch64-unknown-linux-pauthtest -C opt-level=3 diff --git a/tests/codegen-llvm/scalable-vectors/debuginfo.rs b/tests/codegen-llvm/scalable-vectors/debuginfo.rs index 8b2724f06f3e0..1ed7c37a49915 100644 --- a/tests/codegen-llvm/scalable-vectors/debuginfo.rs +++ b/tests/codegen-llvm/scalable-vectors/debuginfo.rs @@ -2,9 +2,6 @@ //@ only-aarch64 //@ only-linux //@ compile-flags: -Cdebuginfo=2 -Copt-level=0 -//@ revisions: POST-LLVM-22 PRE-LLVM-22 -//@ [PRE-LLVM-22] max-llvm-major-version: 21 -//@ [POST-LLVM-22] min-llvm-version: 22 #![crate_type = "lib"] #![allow(incomplete_features, internal_features)] @@ -59,8 +56,7 @@ struct svfloat64_t(f64); #[target_feature(enable = "sve")] pub fn locals() { // CHECK-DAG: name: "svbool_t",{{.*}}, baseType: ![[CT1:[0-9]+]] - // PRE-LLVM-22-DAG: ![[CT1]] = !DICompositeType(tag: DW_TAG_array_type, baseType: ![[ELTTYU8:[0-9]+]],{{.*}}, flags: DIFlagVector, elements: ![[ELTS8:[0-9]+]]) - // POST-LLVM-22-DAG: ![[CT1]] = !DICompositeType(tag: DW_TAG_array_type, baseType: ![[ELTTYU8:[0-9]+]],{{.*}}, flags: DIFlagVector, elements: ![[ELTS8:[0-9]+]], bitStride: i64 1) + // CHECK-DAG: ![[CT1]] = !DICompositeType(tag: DW_TAG_array_type, baseType: ![[ELTTYU8:[0-9]+]],{{.*}}, flags: DIFlagVector, elements: ![[ELTS8:[0-9]+]], bitStride: i64 1) // CHECK-DAG: ![[ELTTYU8]] = !DIBasicType(name: "u8", size: 8, encoding: DW_ATE_unsigned) // CHECK-DAG: ![[ELTS8]] = !{![[REALELTS8:[0-9]+]]} // CHECK-DAG: ![[REALELTS8]] = !DISubrange(lowerBound: 0, upperBound: !DIExpression(DW_OP_constu, 8, DW_OP_bregx, 46, 0, DW_OP_mul, DW_OP_constu, 1, DW_OP_minus)) @@ -71,9 +67,8 @@ pub fn locals() { // CHECK-DAG: ![[ELTTYS8]] = !DIBasicType(name: "i8", size: 8, encoding: DW_ATE_signed) let s8: svint8_t; - // PRE-LLVM-22-DAG: name: "svuint8_t",{{.*}}, baseType: ![[CT1:[0-9]+]] - // POST-LLVM-22-DAG: name: "svuint8_t",{{.*}}, baseType: ![[CT8:[0-9]+]] - // POST-LLVM-22-DAG: ![[CT8]] = !DICompositeType(tag: DW_TAG_array_type, baseType: ![[ELTTYU8]],{{.*}}, flags: DIFlagVector, elements: ![[ELTS8]]) + // CHECK-DAG: name: "svuint8_t",{{.*}}, baseType: ![[CT8:[0-9]+]] + // CHECK-DAG: ![[CT8]] = !DICompositeType(tag: DW_TAG_array_type, baseType: ![[ELTTYU8]],{{.*}}, flags: DIFlagVector, elements: ![[ELTS8]]) let u8: svuint8_t; // CHECK-DAG: name: "svint16_t",{{.*}}, baseType: ![[CT16:[0-9]+]] diff --git a/tests/codegen-llvm/simd-intrinsic/simd-intrinsic-generic-gather.rs b/tests/codegen-llvm/simd-intrinsic/simd-intrinsic-generic-gather.rs index d79a9cf96ada3..643a3c984332c 100644 --- a/tests/codegen-llvm/simd-intrinsic/simd-intrinsic-generic-gather.rs +++ b/tests/codegen-llvm/simd-intrinsic/simd-intrinsic-generic-gather.rs @@ -1,9 +1,4 @@ -// - //@ compile-flags: -C no-prepopulate-passes -//@ revisions: LLVM21 LLVM22 -//@ [LLVM22] min-llvm-version: 22 -//@ [LLVM21] max-llvm-major-version: 21 // ignore-tidy-linelength #![crate_type = "lib"] @@ -28,8 +23,7 @@ pub unsafe fn gather_f32x2( ) -> Vec2 { // CHECK: [[A:%[0-9]+]] = lshr <2 x i32> {{.*}}, {{|splat \(i32 31\)}} // CHECK: [[B:%[0-9]+]] = trunc <2 x i32> [[A]] to <2 x i1> - // LLVM21: call <2 x float> @llvm.masked.gather.v2f32.v2p0(<2 x ptr> {{.*}}, i32 {{.*}}, <2 x i1> [[B]], <2 x float> {{.*}}) - // LLVM22: call <2 x float> @llvm.masked.gather.v2f32.v2p0(<2 x ptr> align {{.*}} {{.*}}, <2 x i1> [[B]], <2 x float> {{.*}}) + // CHECK: call <2 x float> @llvm.masked.gather.v2f32.v2p0(<2 x ptr> align {{.*}} {{.*}}, <2 x i1> [[B]], <2 x float> {{.*}}) simd_gather(values, pointers, mask) } @@ -42,8 +36,7 @@ pub unsafe fn gather_f32x2_unsigned( ) -> Vec2 { // CHECK: [[A:%[0-9]+]] = lshr <2 x i32> {{.*}}, {{|splat \(i32 31\)}} // CHECK: [[B:%[0-9]+]] = trunc <2 x i32> [[A]] to <2 x i1> - // LLVM21: call <2 x float> @llvm.masked.gather.v2f32.v2p0(<2 x ptr> {{.*}}, i32 {{.*}}, <2 x i1> [[B]], <2 x float> {{.*}}) - // LLVM22: call <2 x float> @llvm.masked.gather.v2f32.v2p0(<2 x ptr> align {{.*}} {{.*}}, <2 x i1> [[B]], <2 x float> {{.*}}) + // CHECK: call <2 x float> @llvm.masked.gather.v2f32.v2p0(<2 x ptr> align {{.*}} {{.*}}, <2 x i1> [[B]], <2 x float> {{.*}}) simd_gather(values, pointers, mask) } @@ -56,7 +49,6 @@ pub unsafe fn gather_pf32x2( ) -> Vec2<*const f32> { // CHECK: [[A:%[0-9]+]] = lshr <2 x i32> {{.*}}, {{|splat \(i32 31\)}} // CHECK: [[B:%[0-9]+]] = trunc <2 x i32> [[A]] to <2 x i1> - // LLVM21: call <2 x ptr> @llvm.masked.gather.v2p0.v2p0(<2 x ptr> {{.*}}, i32 {{.*}}, <2 x i1> [[B]], <2 x ptr> {{.*}}) - // LLVM22: call <2 x ptr> @llvm.masked.gather.v2p0.v2p0(<2 x ptr> align {{.*}} {{.*}}, <2 x i1> [[B]], <2 x ptr> {{.*}}) + // CHECK: call <2 x ptr> @llvm.masked.gather.v2p0.v2p0(<2 x ptr> align {{.*}} {{.*}}, <2 x i1> [[B]], <2 x ptr> {{.*}}) simd_gather(values, pointers, mask) } diff --git a/tests/codegen-llvm/simd-intrinsic/simd-intrinsic-generic-masked-load.rs b/tests/codegen-llvm/simd-intrinsic/simd-intrinsic-generic-masked-load.rs index ffe3851c5ad71..e0050431f5b47 100644 --- a/tests/codegen-llvm/simd-intrinsic/simd-intrinsic-generic-masked-load.rs +++ b/tests/codegen-llvm/simd-intrinsic/simd-intrinsic-generic-masked-load.rs @@ -1,7 +1,4 @@ //@ compile-flags: -C no-prepopulate-passes -//@ revisions: LLVM21 LLVM22 -//@ [LLVM22] min-llvm-version: 22 -//@ [LLVM21] max-llvm-major-version: 21 // ignore-tidy-linelength #![crate_type = "lib"] @@ -22,10 +19,7 @@ pub type Vec4 = Simd; pub unsafe fn load_f32x2(mask: Vec2, pointer: *const f32, values: Vec2) -> Vec2 { // CHECK: [[A:%[0-9]+]] = lshr <2 x i32> {{.*}}, {{|splat \(i32 31\)}} // CHECK: [[B:%[0-9]+]] = trunc <2 x i32> [[A]] to <2 x i1> - // LLVM21: call <2 x float> @llvm.masked.load.v2f32.p0(ptr {{.*}}, i32 4, <2 x i1> [[B]], <2 x float> {{.*}}) - // ^^^^^ - // LLVM22: call <2 x float> @llvm.masked.load.v2f32.p0(ptr align 4 {{.*}}, <2 x i1> [[B]], <2 x float> {{.*}}) - // ^^^^^^^ + // CHECK: call <2 x float> @llvm.masked.load.v2f32.p0(ptr align 4 {{.*}}, <2 x i1> [[B]], <2 x float> {{.*}}) // the align parameter should be equal to the alignment of the element type (assumed to be 4) simd_masked_load::<_, _, _, { SimdAlign::Element }>(mask, pointer, values) } @@ -39,10 +33,7 @@ pub unsafe fn load_f32x2_aligned( ) -> Vec2 { // CHECK: [[A:%[0-9]+]] = lshr <2 x i32> {{.*}}, {{|splat \(i32 31\)}} // CHECK: [[B:%[0-9]+]] = trunc <2 x i32> [[A]] to <2 x i1> - // LLVM21: call <2 x float> @llvm.masked.load.v2f32.p0(ptr {{.*}}, i32 8, <2 x i1> [[B]], <2 x float> {{.*}}) - // ^^^^^ - // LLVM22: call <2 x float> @llvm.masked.load.v2f32.p0(ptr align 8 {{.*}}, <2 x i1> [[B]], <2 x float> {{.*}}) - // ^^^^^^^ + // CHECK: call <2 x float> @llvm.masked.load.v2f32.p0(ptr align 8 {{.*}}, <2 x i1> [[B]], <2 x float> {{.*}}) // the align parameter should be equal to the size of the vector simd_masked_load::<_, _, _, { SimdAlign::Vector }>(mask, pointer, values) } @@ -56,10 +47,7 @@ pub unsafe fn load_f32x2_unaligned( ) -> Vec2 { // CHECK: [[A:%[0-9]+]] = lshr <2 x i32> {{.*}}, {{|splat \(i32 31\)}} // CHECK: [[B:%[0-9]+]] = trunc <2 x i32> [[A]] to <2 x i1> - // LLVM21: call <2 x float> @llvm.masked.load.v2f32.p0(ptr {{.*}}, i32 1, <2 x i1> [[B]], <2 x float> {{.*}}) - // ^^^^^ - // LLVM22: call <2 x float> @llvm.masked.load.v2f32.p0(ptr align 1 {{.*}}, <2 x i1> [[B]], <2 x float> {{.*}}) - // ^^^^^^^ + // CHECK: call <2 x float> @llvm.masked.load.v2f32.p0(ptr align 1 {{.*}}, <2 x i1> [[B]], <2 x float> {{.*}}) // the align parameter should be 1 simd_masked_load::<_, _, _, { SimdAlign::Unaligned }>(mask, pointer, values) } @@ -73,8 +61,7 @@ pub unsafe fn load_f32x2_unsigned( ) -> Vec2 { // CHECK: [[A:%[0-9]+]] = lshr <2 x i32> {{.*}}, {{|splat \(i32 31\)}} // CHECK: [[B:%[0-9]+]] = trunc <2 x i32> [[A]] to <2 x i1> - // LLVM21: call <2 x float> @llvm.masked.load.v2f32.p0(ptr {{.*}}, i32 4, <2 x i1> [[B]], <2 x float> {{.*}}) - // LLVM22: call <2 x float> @llvm.masked.load.v2f32.p0(ptr align 4 {{.*}}, <2 x i1> [[B]], <2 x float> {{.*}}) + // CHECK: call <2 x float> @llvm.masked.load.v2f32.p0(ptr align 4 {{.*}}, <2 x i1> [[B]], <2 x float> {{.*}}) simd_masked_load::<_, _, _, { SimdAlign::Element }>(mask, pointer, values) } @@ -87,7 +74,6 @@ pub unsafe fn load_pf32x4( ) -> Vec4<*const f32> { // CHECK: [[A:%[0-9]+]] = lshr <4 x i32> {{.*}}, {{|splat \(i32 31\)}} // CHECK: [[B:%[0-9]+]] = trunc <4 x i32> [[A]] to <4 x i1> - // LLVM21: call <4 x ptr> @llvm.masked.load.v4p0.p0(ptr {{.*}}, i32 {{.*}}, <4 x i1> [[B]], <4 x ptr> {{.*}}) - // LLVM22: call <4 x ptr> @llvm.masked.load.v4p0.p0(ptr align {{.*}} {{.*}}, <4 x i1> [[B]], <4 x ptr> {{.*}}) + // CHECK: call <4 x ptr> @llvm.masked.load.v4p0.p0(ptr align {{.*}} {{.*}}, <4 x i1> [[B]], <4 x ptr> {{.*}}) simd_masked_load::<_, _, _, { SimdAlign::Element }>(mask, pointer, values) } diff --git a/tests/codegen-llvm/simd-intrinsic/simd-intrinsic-generic-masked-store.rs b/tests/codegen-llvm/simd-intrinsic/simd-intrinsic-generic-masked-store.rs index efeeceec09d12..d9bd214609962 100644 --- a/tests/codegen-llvm/simd-intrinsic/simd-intrinsic-generic-masked-store.rs +++ b/tests/codegen-llvm/simd-intrinsic/simd-intrinsic-generic-masked-store.rs @@ -1,7 +1,4 @@ //@ compile-flags: -C no-prepopulate-passes -//@ revisions: LLVM21 LLVM22 -//@ [LLVM22] min-llvm-version: 22 -//@ [LLVM21] max-llvm-major-version: 21 // ignore-tidy-linelength #![crate_type = "lib"] @@ -22,10 +19,7 @@ pub type Vec4 = Simd; pub unsafe fn store_f32x2(mask: Vec2, pointer: *mut f32, values: Vec2) { // CHECK: [[A:%[0-9]+]] = lshr <2 x i32> {{.*}}, {{|splat \(i32 31\)}} // CHECK: [[B:%[0-9]+]] = trunc <2 x i32> [[A]] to <2 x i1> - // LLVM21: call void @llvm.masked.store.v2f32.p0(<2 x float> {{.*}}, ptr {{.*}}, i32 4, <2 x i1> [[B]]) - // ^^^^^ - // LLVM22: call void @llvm.masked.store.v2f32.p0(<2 x float> {{.*}}, ptr align 4 {{.*}}, <2 x i1> [[B]]) - // ^^^^^^^ + // CHECK: call void @llvm.masked.store.v2f32.p0(<2 x float> {{.*}}, ptr align 4 {{.*}}, <2 x i1> [[B]]) // the align parameter should be equal to the alignment of the element type (assumed to be 4) simd_masked_store::<_, _, _, { SimdAlign::Element }>(mask, pointer, values) } @@ -35,10 +29,7 @@ pub unsafe fn store_f32x2(mask: Vec2, pointer: *mut f32, values: Vec2) pub unsafe fn store_f32x2_aligned(mask: Vec2, pointer: *mut f32, values: Vec2) { // CHECK: [[A:%[0-9]+]] = lshr <2 x i32> {{.*}}, {{|splat \(i32 31\)}} // CHECK: [[B:%[0-9]+]] = trunc <2 x i32> [[A]] to <2 x i1> - // LLVM21: call void @llvm.masked.store.v2f32.p0(<2 x float> {{.*}}, ptr {{.*}}, i32 8, <2 x i1> [[B]]) - // ^^^^^ - // LLVM22: call void @llvm.masked.store.v2f32.p0(<2 x float> {{.*}}, ptr align 8 {{.*}}, <2 x i1> [[B]]) - // ^^^^^^^ + // CHECK: call void @llvm.masked.store.v2f32.p0(<2 x float> {{.*}}, ptr align 8 {{.*}}, <2 x i1> [[B]]) // the align parameter should be equal to the size of the vector simd_masked_store::<_, _, _, { SimdAlign::Vector }>(mask, pointer, values) } @@ -48,10 +39,7 @@ pub unsafe fn store_f32x2_aligned(mask: Vec2, pointer: *mut f32, values: Ve pub unsafe fn store_f32x2_unaligned(mask: Vec2, pointer: *mut f32, values: Vec2) { // CHECK: [[A:%[0-9]+]] = lshr <2 x i32> {{.*}}, {{|splat \(i32 31\)}} // CHECK: [[B:%[0-9]+]] = trunc <2 x i32> [[A]] to <2 x i1> - // LLVM21: call void @llvm.masked.store.v2f32.p0(<2 x float> {{.*}}, ptr {{.*}}, i32 1, <2 x i1> [[B]]) - // ^^^^^ - // LLVM22: call void @llvm.masked.store.v2f32.p0(<2 x float> {{.*}}, ptr align 1 {{.*}}, <2 x i1> [[B]]) - // ^^^^^^^ + // CHECK: call void @llvm.masked.store.v2f32.p0(<2 x float> {{.*}}, ptr align 1 {{.*}}, <2 x i1> [[B]]) // the align parameter should be 1 simd_masked_store::<_, _, _, { SimdAlign::Unaligned }>(mask, pointer, values) } @@ -61,8 +49,7 @@ pub unsafe fn store_f32x2_unaligned(mask: Vec2, pointer: *mut f32, values: pub unsafe fn store_f32x2_unsigned(mask: Vec2, pointer: *mut f32, values: Vec2) { // CHECK: [[A:%[0-9]+]] = lshr <2 x i32> {{.*}}, {{|splat \(i32 31\)}} // CHECK: [[B:%[0-9]+]] = trunc <2 x i32> [[A]] to <2 x i1> - // LLVM21: call void @llvm.masked.store.v2f32.p0(<2 x float> {{.*}}, ptr {{.*}}, i32 4, <2 x i1> [[B]]) - // LLVM22: call void @llvm.masked.store.v2f32.p0(<2 x float> {{.*}}, ptr align 4 {{.*}}, <2 x i1> [[B]]) + // CHECK: call void @llvm.masked.store.v2f32.p0(<2 x float> {{.*}}, ptr align 4 {{.*}}, <2 x i1> [[B]]) simd_masked_store::<_, _, _, { SimdAlign::Element }>(mask, pointer, values) } @@ -71,7 +58,6 @@ pub unsafe fn store_f32x2_unsigned(mask: Vec2, pointer: *mut f32, values: V pub unsafe fn store_pf32x4(mask: Vec4, pointer: *mut *const f32, values: Vec4<*const f32>) { // CHECK: [[A:%[0-9]+]] = lshr <4 x i32> {{.*}}, {{|splat \(i32 31\)}} // CHECK: [[B:%[0-9]+]] = trunc <4 x i32> [[A]] to <4 x i1> - // LLVM21: call void @llvm.masked.store.v4p0.p0(<4 x ptr> {{.*}}, ptr {{.*}}, i32 {{.*}}, <4 x i1> [[B]]) - // LLVM22: call void @llvm.masked.store.v4p0.p0(<4 x ptr> {{.*}}, ptr align {{.*}} {{.*}}, <4 x i1> [[B]]) + // CHECK: call void @llvm.masked.store.v4p0.p0(<4 x ptr> {{.*}}, ptr align {{.*}} {{.*}}, <4 x i1> [[B]]) simd_masked_store::<_, _, _, { SimdAlign::Element }>(mask, pointer, values) } diff --git a/tests/codegen-llvm/simd-intrinsic/simd-intrinsic-generic-scatter.rs b/tests/codegen-llvm/simd-intrinsic/simd-intrinsic-generic-scatter.rs index 533fa429ae700..5c6f82d367cf0 100644 --- a/tests/codegen-llvm/simd-intrinsic/simd-intrinsic-generic-scatter.rs +++ b/tests/codegen-llvm/simd-intrinsic/simd-intrinsic-generic-scatter.rs @@ -1,9 +1,4 @@ -// - //@ compile-flags: -C no-prepopulate-passes -//@ revisions: LLVM21 LLVM22 -//@ [LLVM22] min-llvm-version: 22 -//@ [LLVM21] max-llvm-major-version: 21 // ignore-tidy-linelength #![crate_type = "lib"] @@ -24,8 +19,7 @@ pub type Vec4 = Simd; pub unsafe fn scatter_f32x2(pointers: Vec2<*mut f32>, mask: Vec2, values: Vec2) { // CHECK: [[A:%[0-9]+]] = lshr <2 x i32> {{.*}}, {{|splat \(i32 31\)}} // CHECK: [[B:%[0-9]+]] = trunc <2 x i32> [[A]] to <2 x i1> - // LLVM21: call void @llvm.masked.scatter.v2f32.v2p0(<2 x float> {{.*}}, <2 x ptr> {{.*}}, i32 {{.*}}, <2 x i1> [[B]] - // LLVM22: call void @llvm.masked.scatter.v2f32.v2p0(<2 x float> {{.*}}, <2 x ptr> align {{.*}} {{.*}}, <2 x i1> [[B]] + // CHECK: call void @llvm.masked.scatter.v2f32.v2p0(<2 x float> {{.*}}, <2 x ptr> align {{.*}} {{.*}}, <2 x i1> [[B]] simd_scatter(values, pointers, mask) } @@ -34,8 +28,7 @@ pub unsafe fn scatter_f32x2(pointers: Vec2<*mut f32>, mask: Vec2, values: V pub unsafe fn scatter_f32x2_unsigned(pointers: Vec2<*mut f32>, mask: Vec2, values: Vec2) { // CHECK: [[A:%[0-9]+]] = lshr <2 x i32> {{.*}}, {{|splat \(i32 31\)}} // CHECK: [[B:%[0-9]+]] = trunc <2 x i32> [[A]] to <2 x i1> - // LLVM21: call void @llvm.masked.scatter.v2f32.v2p0(<2 x float> {{.*}}, <2 x ptr> {{.*}}, i32 {{.*}}, <2 x i1> [[B]] - // LLVM22: call void @llvm.masked.scatter.v2f32.v2p0(<2 x float> {{.*}}, <2 x ptr> align {{.*}} {{.*}}, <2 x i1> [[B]] + // CHECK: call void @llvm.masked.scatter.v2f32.v2p0(<2 x float> {{.*}}, <2 x ptr> align {{.*}} {{.*}}, <2 x i1> [[B]] simd_scatter(values, pointers, mask) } @@ -48,7 +41,6 @@ pub unsafe fn scatter_pf32x2( ) { // CHECK: [[A:%[0-9]+]] = lshr <2 x i32> {{.*}}, {{|splat \(i32 31\)}} // CHECK: [[B:%[0-9]+]] = trunc <2 x i32> [[A]] to <2 x i1> - // LLVM21: call void @llvm.masked.scatter.v2p0.v2p0(<2 x ptr> {{.*}}, <2 x ptr> {{.*}}, i32 {{.*}}, <2 x i1> [[B]] - // LLVM22: call void @llvm.masked.scatter.v2p0.v2p0(<2 x ptr> {{.*}}, <2 x ptr> align {{.*}} {{.*}}, <2 x i1> [[B]] + // CHECK: call void @llvm.masked.scatter.v2p0.v2p0(<2 x ptr> {{.*}}, <2 x ptr> align {{.*}} {{.*}}, <2 x i1> [[B]] simd_scatter(values, pointers, mask) } diff --git a/tests/codegen-llvm/slp-vectorization-mul3.rs b/tests/codegen-llvm/slp-vectorization-mul3.rs index 38c0949b82713..1c40c6b28f3ff 100644 --- a/tests/codegen-llvm/slp-vectorization-mul3.rs +++ b/tests/codegen-llvm/slp-vectorization-mul3.rs @@ -1,7 +1,6 @@ //! Regression test for #142519 //@ only-x86_64 //@ compile-flags: -O -//@ min-llvm-version: 22 #![crate_type = "lib"] diff --git a/tests/codegen-llvm/store-captures.rs b/tests/codegen-llvm/store-captures.rs index 33d24032ee450..24cbb91cf29ee 100644 --- a/tests/codegen-llvm/store-captures.rs +++ b/tests/codegen-llvm/store-captures.rs @@ -1,4 +1,3 @@ -//@ min-llvm-version: 22 //@ compile-flags: -O -C no-prepopulate-passes #![crate_type = "lib"] diff --git a/tests/codegen-llvm/tail-call-u128.rs b/tests/codegen-llvm/tail-call-u128.rs index 25dfc47a2bfec..b3aab7d93d46c 100644 --- a/tests/codegen-llvm/tail-call-u128.rs +++ b/tests/codegen-llvm/tail-call-u128.rs @@ -1,6 +1,5 @@ //@ add-minicore //@ revisions: win linux -//@ min-llvm-version: 22 // //@ compile-flags: -Copt-level=3 //@[linux] compile-flags: --target x86_64-unknown-linux-gnu diff --git a/tests/codegen-llvm/vec_pop_push_noop.rs b/tests/codegen-llvm/vec_pop_push_noop.rs index 977c220b3baef..9bfc77eaa6fa3 100644 --- a/tests/codegen-llvm/vec_pop_push_noop.rs +++ b/tests/codegen-llvm/vec_pop_push_noop.rs @@ -1,7 +1,4 @@ //@ compile-flags: -Copt-level=3 -//@ revisions: new old -//@ [old] max-llvm-major-version: 21 -//@ [new] min-llvm-version: 22 #![crate_type = "lib"] @@ -10,7 +7,6 @@ pub fn noop(v: &mut Vec) { // CHECK-NOT: grow_one // CHECK-NOT: call - // old: tail call void @llvm.assume // CHECK-NOT: grow_one // CHECK-NOT: call // CHECK: {{ret|[}]}} diff --git a/tests/codegen-llvm/vecdeque_pop_push.rs b/tests/codegen-llvm/vecdeque_pop_push.rs index 6f9ad6674d6cd..7545a0b2e39c3 100644 --- a/tests/codegen-llvm/vecdeque_pop_push.rs +++ b/tests/codegen-llvm/vecdeque_pop_push.rs @@ -1,7 +1,4 @@ //@ compile-flags: -Copt-level=3 -//@ revisions: new old -//@ [old] max-llvm-major-version: 21 -//@ [new] min-llvm-version: 22 #![crate_type = "lib"] @@ -11,7 +8,6 @@ use std::collections::VecDeque; // CHECK-LABEL: @noop_back( pub fn noop_back(v: &mut VecDeque) { // CHECK-NOT: grow - // old: tail call void @llvm.assume // CHECK-NOT: grow // CHECK: ret if let Some(x) = v.pop_back() { diff --git a/tests/run-make/fno-lto/main.rs b/tests/run-make/fno-lto/main.rs new file mode 100644 index 0000000000000..f328e4d9d04c3 --- /dev/null +++ b/tests/run-make/fno-lto/main.rs @@ -0,0 +1 @@ +fn main() {} diff --git a/tests/run-make/fno-lto/rmake.rs b/tests/run-make/fno-lto/rmake.rs new file mode 100644 index 0000000000000..db6fe7e6797f5 --- /dev/null +++ b/tests/run-make/fno-lto/rmake.rs @@ -0,0 +1,17 @@ +//@ needs-target-std +//@ ignore-msvc +//@ ignore-wasm +//@ needs-backends: gcc + +use run_make_support::rustc; + +fn main() { + rustc().input("main.rs").print("link-args").run_unchecked().assert_stdout_contains("-fno-lto"); + + rustc() + .input("main.rs") + .arg("-Clinker-plugin-lto") + .print("link-args") + .run_unchecked() + .assert_stdout_not_contains("-fno-lto"); +} diff --git a/tests/run-make/linker-warning/rmake.rs b/tests/run-make/linker-warning/rmake.rs index b25d892507907..f1a561e1291a5 100644 --- a/tests/run-make/linker-warning/rmake.rs +++ b/tests/run-make/linker-warning/rmake.rs @@ -83,6 +83,7 @@ fn main() { .normalize("libpanic_abort", "libpanic_unwind") .normalize(r#""[^"]*\/symbols.o""#, "\"/symbols.o\"") .normalize(r#""[^"]*\/raw-dylibs""#, "\"/raw-dylibs\"") + .normalize("\"-fno-lto\" ", "") .run(); } diff --git a/tests/rustdoc-html/safe-intrinsic.rs b/tests/rustdoc-html/safe-intrinsic.rs index a40116894a84a..1a38a4f5f1c15 100644 --- a/tests/rustdoc-html/safe-intrinsic.rs +++ b/tests/rustdoc-html/safe-intrinsic.rs @@ -14,10 +14,10 @@ pub trait MetaSized: PointeeSized {} #[lang = "sized"] pub trait Sized: MetaSized {} -//@ has 'foo/fn.abort.html' -//@ has - '//pre[@class="rust item-decl"]' 'pub fn abort() -> !' +//@ has 'foo/fn.abort_immediate.html' +//@ has - '//pre[@class="rust item-decl"]' 'pub fn abort_immediate() -> !' #[rustc_intrinsic] -pub fn abort() -> !; +pub fn abort_immediate() -> !; //@ has 'foo/fn.unreachable.html' //@ has - '//pre[@class="rust item-decl"]' 'pub unsafe fn unreachable() -> !' #[rustc_intrinsic] diff --git a/tests/ui/borrowck/opaque-types-patterns-subtyping-ice-104779.stderr b/tests/ui/borrowck/opaque-types-patterns-subtyping-ice-104779.current.stderr similarity index 75% rename from tests/ui/borrowck/opaque-types-patterns-subtyping-ice-104779.stderr rename to tests/ui/borrowck/opaque-types-patterns-subtyping-ice-104779.current.stderr index 887cb14a76935..1da79e2dbe7a9 100644 --- a/tests/ui/borrowck/opaque-types-patterns-subtyping-ice-104779.stderr +++ b/tests/ui/borrowck/opaque-types-patterns-subtyping-ice-104779.current.stderr @@ -1,5 +1,5 @@ warning: function cannot return without recursing - --> $DIR/opaque-types-patterns-subtyping-ice-104779.rs:12:1 + --> $DIR/opaque-types-patterns-subtyping-ice-104779.rs:17:1 | LL | fn foo() -> impl Sized { | ^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing @@ -11,13 +11,13 @@ LL | match foo() { = note: `#[warn(unconditional_recursion)]` on by default error: higher-ranked subtype error - --> $DIR/opaque-types-patterns-subtyping-ice-104779.rs:15:15 + --> $DIR/opaque-types-patterns-subtyping-ice-104779.rs:20:15 | LL | match foo() { | ^^^^^ error: higher-ranked subtype error - --> $DIR/opaque-types-patterns-subtyping-ice-104779.rs:15:15 + --> $DIR/opaque-types-patterns-subtyping-ice-104779.rs:20:15 | LL | match foo() { | ^^^^^ @@ -25,13 +25,13 @@ LL | match foo() { = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: higher-ranked subtype error - --> $DIR/opaque-types-patterns-subtyping-ice-104779.rs:18:13 + --> $DIR/opaque-types-patterns-subtyping-ice-104779.rs:23:13 | LL | Subtype::Bar => (), | ^^^^^^^^^^^^ error: higher-ranked subtype error - --> $DIR/opaque-types-patterns-subtyping-ice-104779.rs:18:13 + --> $DIR/opaque-types-patterns-subtyping-ice-104779.rs:23:13 | LL | Subtype::Bar => (), | ^^^^^^^^^^^^ diff --git a/tests/ui/borrowck/opaque-types-patterns-subtyping-ice-104779.next.stderr b/tests/ui/borrowck/opaque-types-patterns-subtyping-ice-104779.next.stderr new file mode 100644 index 0000000000000..9693391617a2e --- /dev/null +++ b/tests/ui/borrowck/opaque-types-patterns-subtyping-ice-104779.next.stderr @@ -0,0 +1,14 @@ +warning: function cannot return without recursing + --> $DIR/opaque-types-patterns-subtyping-ice-104779.rs:17:1 + | +LL | fn foo() -> impl Sized { + | ^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing +... +LL | match foo() { + | ----- recursive call site + | + = help: a `loop` may express intention better if this is on purpose + = note: `#[warn(unconditional_recursion)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/borrowck/opaque-types-patterns-subtyping-ice-104779.rs b/tests/ui/borrowck/opaque-types-patterns-subtyping-ice-104779.rs index b9e729bff62a0..eddd25e3e30e9 100644 --- a/tests/ui/borrowck/opaque-types-patterns-subtyping-ice-104779.rs +++ b/tests/ui/borrowck/opaque-types-patterns-subtyping-ice-104779.rs @@ -1,3 +1,8 @@ +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver +//@[next] check-pass + // issue: rust-lang/rust#104779 // ICE region infer, IndexMap: key not found @@ -13,11 +18,11 @@ fn foo() -> impl Sized { //~^ WARN function cannot return without recursing loop { match foo() { - //~^ ERROR higher-ranked subtype error - //~^^ ERROR higher-ranked subtype error + //[current]~^ ERROR higher-ranked subtype error + //[current]~^^ ERROR higher-ranked subtype error Subtype::Bar => (), - //~^ ERROR higher-ranked subtype error - //~^^ ERROR higher-ranked subtype error + //[current]~^ ERROR higher-ranked subtype error + //[current]~^^ ERROR higher-ranked subtype error Supertype::Var(x) => {} } } diff --git a/tests/ui/codegen/huge-stacks.rs b/tests/ui/codegen/huge-stacks.rs index 790de95eb7416..f661d8728be1f 100644 --- a/tests/ui/codegen/huge-stacks.rs +++ b/tests/ui/codegen/huge-stacks.rs @@ -2,7 +2,6 @@ //@[optimized]compile-flags: -O //@ run-pass //@ only-64bit -//@ min-llvm-version: 22 // Regression test for https://github.com/rust-lang/rust/issues/83060 // Verifies a program is not miscompiled if it includes a 4GB array on the stack diff --git a/tests/ui/const-generics/gca/require-next-solver.stderr b/tests/ui/const-generics/gca/require-next-solver.current.stderr similarity index 85% rename from tests/ui/const-generics/gca/require-next-solver.stderr rename to tests/ui/const-generics/gca/require-next-solver.current.stderr index 717b561993a17..06e32d0713b7e 100644 --- a/tests/ui/const-generics/gca/require-next-solver.stderr +++ b/tests/ui/const-generics/gca/require-next-solver.current.stderr @@ -1,5 +1,5 @@ error: `gca_const_items` requires -Znext-solver=globally to be enabled - --> $DIR/require-next-solver.rs:2:12 + --> $DIR/require-next-solver.rs:6:12 | LL | #![feature(gca_const_items)] | ^^^^^^^^^^^^^^^ diff --git a/tests/ui/const-generics/gca/require-next-solver.rs b/tests/ui/const-generics/gca/require-next-solver.rs index ce2fdea3a6328..2cd16ab13e70c 100644 --- a/tests/ui/const-generics/gca/require-next-solver.rs +++ b/tests/ui/const-generics/gca/require-next-solver.rs @@ -1,4 +1,8 @@ +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver +//@[next] check-pass #![feature(gca_min_const_items)] #![feature(gca_const_items)] -//~^ ERROR next-solver +//[current]~^ ERROR next-solver fn main() {} diff --git a/tests/ui/consts/const-eval/const_panic.stderr b/tests/ui/consts/const-eval/const_panic.stderr index 19d8f3ae1c106..c91151b137fbe 100644 --- a/tests/ui/consts/const-eval/const_panic.stderr +++ b/tests/ui/consts/const-eval/const_panic.stderr @@ -76,7 +76,7 @@ error[E0080]: the program aborted execution LL | const ABORT: () = core::process::abort_immediate(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `ABORT` failed inside this call | -note: inside `abort_immediate` +note: inside `std::process::abort_immediate` --> $SRC_DIR/core/src/process.rs:LL:COL error: aborting due to 13 previous errors diff --git a/tests/ui/error-codes/E0275.current.stderr b/tests/ui/error-codes/E0275.current.stderr new file mode 100644 index 0000000000000..cfefaac27188b --- /dev/null +++ b/tests/ui/error-codes/E0275.current.stderr @@ -0,0 +1,37 @@ +error[E0275]: overflow evaluating the requirement `Bar>>>>>>: Foo` + --> $DIR/E0275.rs:10:33 + | +LL | impl Foo for T where Bar: Foo {} + | ^^^ + | + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`E0275`) +note: required for `Bar>>>>>>>>>>>>` to implement `Foo` + --> $DIR/E0275.rs:10:9 + | +LL | impl Foo for T where Bar: Foo {} + | ^^^ ^ --- unsatisfied trait bound introduced here + = note: 126 redundant requirements hidden + = note: required for `Bar` to implement `Foo` + = note: the full name for the type has been written to '$TEST_BUILD_DIR/E0275.long-type-$LONG_TYPE_HASH.txt' + = note: consider using `--verbose` to print the full type name to the console + +error[E0275]: overflow evaluating the requirement `Bar>>>>>>: Foo` + --> $DIR/E0275.rs:13:14 + | +LL | fn is_foo() {} + | ^^^ + | + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`E0275`) +note: required for `Bar>>>>>>>>>>>>` to implement `Foo` + --> $DIR/E0275.rs:10:9 + | +LL | impl Foo for T where Bar: Foo {} + | ^^^ ^ --- unsatisfied trait bound introduced here + = note: 126 redundant requirements hidden + = note: required for `T` to implement `Foo` + = note: the full name for the type has been written to '$TEST_BUILD_DIR/E0275.long-type-$LONG_TYPE_HASH.txt' + = note: consider using `--verbose` to print the full type name to the console + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/error-codes/E0275.next.stderr b/tests/ui/error-codes/E0275.next.stderr new file mode 100644 index 0000000000000..d883d64dd2970 --- /dev/null +++ b/tests/ui/error-codes/E0275.next.stderr @@ -0,0 +1,16 @@ +error[E0275]: overflow evaluating the requirement `(): Foo` + --> $DIR/E0275.rs:16:14 + | +LL | is_foo::<()>(); + | ^^ + | + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`E0275`) +note: required by a bound in `is_foo` + --> $DIR/E0275.rs:13:14 + | +LL | fn is_foo() {} + | ^^^ required by this bound in `is_foo` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/error-codes/E0275.rs b/tests/ui/error-codes/E0275.rs index 98d4a3c01b9a2..e796b87b18784 100644 --- a/tests/ui/error-codes/E0275.rs +++ b/tests/ui/error-codes/E0275.rs @@ -1,9 +1,18 @@ +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver + //@ compile-flags: -Zwrite-long-types-to-disk=yes trait Foo {} struct Bar(T); -impl Foo for T where Bar: Foo {} //~ ERROR E0275 +impl Foo for T where Bar: Foo {} +//[current]~^ ERROR E0275 +fn is_foo() {} +//[current]~^ ERROR E0275 fn main() { + is_foo::<()>(); + //[next]~^ ERROR E0275 } diff --git a/tests/ui/error-codes/E0275.stderr b/tests/ui/error-codes/E0275.stderr deleted file mode 100644 index 36175f636d6fb..0000000000000 --- a/tests/ui/error-codes/E0275.stderr +++ /dev/null @@ -1,20 +0,0 @@ -error[E0275]: overflow evaluating the requirement `Bar>>>>>>: Foo` - --> $DIR/E0275.rs:6:33 - | -LL | impl Foo for T where Bar: Foo {} - | ^^^ - | - = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`E0275`) -note: required for `Bar>>>>>>>>>>>>` to implement `Foo` - --> $DIR/E0275.rs:6:9 - | -LL | impl Foo for T where Bar: Foo {} - | ^^^ ^ --- unsatisfied trait bound introduced here - = note: 126 redundant requirements hidden - = note: required for `Bar` to implement `Foo` - = note: the full name for the type has been written to '$TEST_BUILD_DIR/E0275.long-type-$LONG_TYPE_HASH.txt' - = note: consider using `--verbose` to print the full type name to the console - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/explicit-tail-calls/no-unsized-arguments.aarch64.stderr b/tests/ui/explicit-tail-calls/no-unsized-arguments.aarch64.stderr index 33e190e1a4a7f..31ceec9afe081 100644 --- a/tests/ui/explicit-tail-calls/no-unsized-arguments.aarch64.stderr +++ b/tests/ui/explicit-tail-calls/no-unsized-arguments.aarch64.stderr @@ -1,5 +1,5 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation time - --> $DIR/no-unsized-arguments.rs:40:42 + --> $DIR/no-unsized-arguments.rs:39:42 | LL | extern "tail" fn unsized_argument(x: [u8]) -> u8 { | ^^^^ doesn't have a size known at compile-time @@ -11,7 +11,7 @@ LL | extern "tail" fn unsized_argument(x: &[u8]) -> u8 { | + error: unsized arguments cannot be used in a tail call - --> $DIR/no-unsized-arguments.rs:33:5 + --> $DIR/no-unsized-arguments.rs:32:5 | LL | become unsized_argument(b); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -19,7 +19,7 @@ LL | become unsized_argument(b); = note: unsized argument of type `[u8]` error: unsized arguments cannot be used in a tail call - --> $DIR/no-unsized-arguments.rs:48:5 + --> $DIR/no-unsized-arguments.rs:47:5 | LL | become unsized_argument(*b); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/explicit-tail-calls/no-unsized-arguments.rs b/tests/ui/explicit-tail-calls/no-unsized-arguments.rs index a0c5b53d8df0c..76a9a59c51a15 100644 --- a/tests/ui/explicit-tail-calls/no-unsized-arguments.rs +++ b/tests/ui/explicit-tail-calls/no-unsized-arguments.rs @@ -1,6 +1,5 @@ //@ add-minicore //@ ignore-backends: gcc -//@ min-llvm-version: 22 // //@ revisions: x86 x86_64 aarch64 // diff --git a/tests/ui/explicit-tail-calls/no-unsized-arguments.x86.stderr b/tests/ui/explicit-tail-calls/no-unsized-arguments.x86.stderr index 33e190e1a4a7f..31ceec9afe081 100644 --- a/tests/ui/explicit-tail-calls/no-unsized-arguments.x86.stderr +++ b/tests/ui/explicit-tail-calls/no-unsized-arguments.x86.stderr @@ -1,5 +1,5 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation time - --> $DIR/no-unsized-arguments.rs:40:42 + --> $DIR/no-unsized-arguments.rs:39:42 | LL | extern "tail" fn unsized_argument(x: [u8]) -> u8 { | ^^^^ doesn't have a size known at compile-time @@ -11,7 +11,7 @@ LL | extern "tail" fn unsized_argument(x: &[u8]) -> u8 { | + error: unsized arguments cannot be used in a tail call - --> $DIR/no-unsized-arguments.rs:33:5 + --> $DIR/no-unsized-arguments.rs:32:5 | LL | become unsized_argument(b); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -19,7 +19,7 @@ LL | become unsized_argument(b); = note: unsized argument of type `[u8]` error: unsized arguments cannot be used in a tail call - --> $DIR/no-unsized-arguments.rs:48:5 + --> $DIR/no-unsized-arguments.rs:47:5 | LL | become unsized_argument(*b); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/explicit-tail-calls/no-unsized-arguments.x86_64.stderr b/tests/ui/explicit-tail-calls/no-unsized-arguments.x86_64.stderr index 33e190e1a4a7f..31ceec9afe081 100644 --- a/tests/ui/explicit-tail-calls/no-unsized-arguments.x86_64.stderr +++ b/tests/ui/explicit-tail-calls/no-unsized-arguments.x86_64.stderr @@ -1,5 +1,5 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation time - --> $DIR/no-unsized-arguments.rs:40:42 + --> $DIR/no-unsized-arguments.rs:39:42 | LL | extern "tail" fn unsized_argument(x: [u8]) -> u8 { | ^^^^ doesn't have a size known at compile-time @@ -11,7 +11,7 @@ LL | extern "tail" fn unsized_argument(x: &[u8]) -> u8 { | + error: unsized arguments cannot be used in a tail call - --> $DIR/no-unsized-arguments.rs:33:5 + --> $DIR/no-unsized-arguments.rs:32:5 | LL | become unsized_argument(b); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -19,7 +19,7 @@ LL | become unsized_argument(b); = note: unsized argument of type `[u8]` error: unsized arguments cannot be used in a tail call - --> $DIR/no-unsized-arguments.rs:48:5 + --> $DIR/no-unsized-arguments.rs:47:5 | LL | become unsized_argument(*b); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/explicit-tail-calls/rpit.stderr b/tests/ui/explicit-tail-calls/rpit.current.stderr similarity index 93% rename from tests/ui/explicit-tail-calls/rpit.stderr rename to tests/ui/explicit-tail-calls/rpit.current.stderr index 9c181db8b8019..ffb82c60ce844 100644 --- a/tests/ui/explicit-tail-calls/rpit.stderr +++ b/tests/ui/explicit-tail-calls/rpit.current.stderr @@ -1,5 +1,5 @@ error: mismatched signatures - --> $DIR/rpit.rs:14:5 + --> $DIR/rpit.rs:19:5 | LL | become foo(x, y); | ^^^^^^^^^^^^^^^^ diff --git a/tests/ui/explicit-tail-calls/rpit.rs b/tests/ui/explicit-tail-calls/rpit.rs index 0d1f2c78fd13d..550a88996072f 100644 --- a/tests/ui/explicit-tail-calls/rpit.rs +++ b/tests/ui/explicit-tail-calls/rpit.rs @@ -1,3 +1,8 @@ +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver +//@[next] check-pass + #![feature(explicit_tail_calls)] #![expect(incomplete_features)] @@ -12,7 +17,7 @@ fn foo(x: u32, y: u32) -> u32 { fn bar(x: u32, y: u32) -> impl ToString { become foo(x, y); - //~^ ERROR mismatched signatures + //[current]~^ ERROR mismatched signatures } fn main() { diff --git a/tests/ui/explicit-tail-calls/support/basic.rs b/tests/ui/explicit-tail-calls/support/basic.rs index d46dd726c0bd1..eb3041f106171 100644 --- a/tests/ui/explicit-tail-calls/support/basic.rs +++ b/tests/ui/explicit-tail-calls/support/basic.rs @@ -1,7 +1,6 @@ //@ build-pass //@ ignore-backends: gcc //@ add-minicore -//@ min-llvm-version: 22 // //@ revisions: i686 //@[i686] compile-flags: --target i686-unknown-linux-gnu diff --git a/tests/ui/explicit-tail-calls/support/bystack.rs b/tests/ui/explicit-tail-calls/support/bystack.rs index c89ad194f8ba1..8a9aa72bb5636 100644 --- a/tests/ui/explicit-tail-calls/support/bystack.rs +++ b/tests/ui/explicit-tail-calls/support/bystack.rs @@ -1,7 +1,6 @@ //@ build-pass //@ ignore-backends: gcc //@ add-minicore -//@ min-llvm-version: 22 // //@ revisions: i686 //@[i686] compile-flags: --target i686-unknown-linux-gnu @@ -33,6 +32,9 @@ //@ revisions: powerpc64 //@[powerpc64] compile-flags: --target powerpc64-unknown-linux-gnu //@[powerpc64] needs-llvm-components: powerpc +// +// loongarch disabled musttail in LLVM 22, didn't come back in LLVM 23 +// //@ revisions: loongarch32 //@[loongarch32] compile-flags: --target loongarch32-unknown-none //@[loongarch32] needs-llvm-components: loongarch @@ -41,6 +43,7 @@ //@[loongarch64] compile-flags: --target loongarch64-unknown-linux-gnu //@[loongarch64] needs-llvm-components: loongarch //@[loongarch64] max-llvm-major-version: 21 +// //@ revisions: bpf //@[bpf] compile-flags: --target bpfeb-unknown-none //@[bpf] needs-llvm-components: bpf @@ -51,11 +54,12 @@ //@[nvptx64] compile-flags: --target nvptx64-nvidia-cuda //@[nvptx64] needs-llvm-components: nvptx // -// Riscv does not support byval in LLVM 22 (but wil in LLVM 23) +// Riscv does not support byval in LLVM 22 (but does in LLVM 23+) // -// //@ revisions: riscv -// //@[riscv] compile-flags: --target riscv64gc-unknown-linux-gnu -// //@[riscv] needs-llvm-components: riscv +//@ revisions: riscv +//@[riscv] compile-flags: --target riscv64gc-unknown-linux-gnu +//@[riscv] needs-llvm-components: riscv +//@[riscv] min-llvm-version: 23 // // Wasm needs a special target feature. // diff --git a/tests/ui/explicit-tail-calls/support/byval.rs b/tests/ui/explicit-tail-calls/support/byval.rs index e6f26b9292eb6..cea5f5a51aa9e 100644 --- a/tests/ui/explicit-tail-calls/support/byval.rs +++ b/tests/ui/explicit-tail-calls/support/byval.rs @@ -1,7 +1,6 @@ //@ build-pass //@ ignore-backends: gcc //@ add-minicore -//@ min-llvm-version: 22 // //@ revisions: i686 //@[i686] compile-flags: --target i686-unknown-linux-gnu @@ -33,6 +32,9 @@ //@ revisions: powerpc64 //@[powerpc64] compile-flags: --target powerpc64-unknown-linux-gnu //@[powerpc64] needs-llvm-components: powerpc +// +// loongarch dropped support for musttail in LLVM 22 and it didn't come back in 23 +// //@ revisions: loongarch32 //@[loongarch32] compile-flags: --target loongarch32-unknown-none //@[loongarch32] needs-llvm-components: loongarch @@ -41,6 +43,7 @@ //@[loongarch64] compile-flags: --target loongarch64-unknown-linux-gnu //@[loongarch64] needs-llvm-components: loongarch //@[loongarch64] max-llvm-major-version: 21 +// //@ revisions: bpf //@[bpf] compile-flags: --target bpfeb-unknown-none //@[bpf] needs-llvm-components: bpf @@ -51,11 +54,12 @@ //@[nvptx64] compile-flags: --target nvptx64-nvidia-cuda //@[nvptx64] needs-llvm-components: nvptx // -// Riscv does not support byval in LLVM 22 (but wil in LLVM 23) +// Riscv does not support byval in LLVM 22 (but does in LLVM 23+) // -// //@ revisions: riscv -// //@[riscv] compile-flags: --target riscv64gc-unknown-linux-gnu -// //@[riscv] needs-llvm-components: riscv +//@ revisions: riscv +//@[riscv] compile-flags: --target riscv64gc-unknown-linux-gnu +//@[riscv] needs-llvm-components: riscv +//@[riscv] min-llvm-version: 23 // // Wasm needs a special target feature. // diff --git a/tests/ui/feature-gates/feature-gate-xtensa-target-feature.rs b/tests/ui/feature-gates/feature-gate-xtensa-target-feature.rs index e9d6a35e0ab30..f08218fdae7f6 100644 --- a/tests/ui/feature-gates/feature-gate-xtensa-target-feature.rs +++ b/tests/ui/feature-gates/feature-gate-xtensa-target-feature.rs @@ -1,6 +1,5 @@ //@ add-minicore //@ needs-llvm-components: xtensa -//@ min-llvm-version: 22 //@ compile-flags: --target=xtensa-esp32-none-elf --crate-type=rlib //@ ignore-backends: gcc #![no_core] diff --git a/tests/ui/feature-gates/feature-gate-xtensa-target-feature.stderr b/tests/ui/feature-gates/feature-gate-xtensa-target-feature.stderr index 1854fbb3de4d2..d8dc56900f8f8 100644 --- a/tests/ui/feature-gates/feature-gate-xtensa-target-feature.stderr +++ b/tests/ui/feature-gates/feature-gate-xtensa-target-feature.stderr @@ -1,5 +1,5 @@ error[E0658]: the target feature `bool` is currently unstable - --> $DIR/feature-gate-xtensa-target-feature.rs:12:18 + --> $DIR/feature-gate-xtensa-target-feature.rs:11:18 | LL | #[target_feature(enable = "bool")] | ^^^^^^^^^^^^^^^ diff --git a/tests/ui/field_representing_types/field-projection-overflow-coherence.rs b/tests/ui/field_representing_types/field-projection-overflow-coherence.rs new file mode 100644 index 0000000000000..ea95e12a6d4bf --- /dev/null +++ b/tests/ui/field_representing_types/field-projection-overflow-coherence.rs @@ -0,0 +1,55 @@ +//@ edition: 2021 +//@ compile-flags: -Znext-solver -Arecursion_depth_exceeding_limit + +#![forbid(unsafe_code)] +#![feature(field_projections)] +#![allow(incomplete_features)] + +use core::field::{Field, field_of}; + +trait Chain { + type A; +} + +impl Chain for () { + type A = u8; +} + +struct Link(T); + +impl Chain for Link { + type A = ::A; +} + +type L4 = Link>>>; +type L16 = L4>>>; +type L64 = L16>>>; +type Deep = L64>>; // 192 links + +struct S { + f: ::A, +} + +trait Tr { + type Out; +} + +impl Tr for S +where + field_of!(S, f): Field, +{ + type Out = u8; +} + +impl Tr for S { //~ ERROR conflicting implementations of trait `Tr` + type Out = [u8; 16]; +} + +fn poly() -> as Tr>::Out { + 0 +} + +fn main() { + let v = poly::(); + println!("{:?}", v); +} diff --git a/tests/ui/field_representing_types/field-projection-overflow-coherence.stderr b/tests/ui/field_representing_types/field-projection-overflow-coherence.stderr new file mode 100644 index 0000000000000..d53819445a083 --- /dev/null +++ b/tests/ui/field_representing_types/field-projection-overflow-coherence.stderr @@ -0,0 +1,18 @@ +error[E0119]: conflicting implementations of trait `Tr` for type `S>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + --> $DIR/field-projection-overflow-coherence.rs:44:1 + | +LL | / impl Tr for S +LL | | where +LL | | field_of!(S, f): Field, + | |______________________________- first implementation here +... +LL | impl Tr for S { + | ^^^^^^^^^^^^^^^^^^^ conflicting implementation for `S>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + | + = note: overflow evaluating the requirement `Link>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>: Chain` + = note: overflow evaluating the requirement `field_of!(S>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>, f): Field` + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`field_projection_overflow_coherence`) + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/tests/ui/field_representing_types/not-field-if-unsized.next.stderr b/tests/ui/field_representing_types/not-field-if-unsized.next.stderr index 967f6115c1ac1..e639d01dc176a 100644 --- a/tests/ui/field_representing_types/not-field-if-unsized.next.stderr +++ b/tests/ui/field_representing_types/not-field-if-unsized.next.stderr @@ -1,21 +1,37 @@ -error[E0277]: the trait bound `field_of!(MyStruct, 0): Field` is not satisfied +error[E0277]: the size for values of type `(dyn Trait + 'static)` cannot be known at compilation time --> $DIR/not-field-if-unsized.rs:17:20 | LL | assert_field::(); - | ^^^^^^^^^^^^^^^^^^^^^^ the nightly-only, unstable trait `Field` is not implemented for `field_of!(MyStruct, 0)` + | ^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | + = help: within `field_of!(MyStruct, 0)`, the trait `Sized` is not implemented for `(dyn Trait + 'static)` +note: required because it appears within the type `MyStruct` + --> $DIR/not-field-if-unsized.rs:10:28 + | +LL | pub struct MyStruct(usize, dyn Trait); + | ^^^^^^^^^ required by this field +note: required because it appears within the type `field_of!(MyStruct, 0)` + --> $SRC_DIR/core/src/field.rs:LL:COL note: required by a bound in `assert_field` --> $DIR/not-field-if-unsized.rs:12:20 | LL | fn assert_field() {} | ^^^^^ required by this bound in `assert_field` -error[E0277]: the trait bound `field_of!(MyStruct, 1): Field` is not satisfied +error[E0277]: the size for values of type `(dyn Trait + 'static)` cannot be known at compilation time --> $DIR/not-field-if-unsized.rs:21:20 | LL | assert_field::(); - | ^^^^^^^^^^^^^^^^^^^^^^ the nightly-only, unstable trait `Field` is not implemented for `field_of!(MyStruct, 1)` + | ^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time + | + = help: within `field_of!(MyStruct, 1)`, the trait `Sized` is not implemented for `(dyn Trait + 'static)` +note: required because it appears within the type `MyStruct` + --> $DIR/not-field-if-unsized.rs:10:28 | +LL | pub struct MyStruct(usize, dyn Trait); + | ^^^^^^^^^ required by this field +note: required because it appears within the type `field_of!(MyStruct, 1)` + --> $SRC_DIR/core/src/field.rs:LL:COL note: required by a bound in `assert_field` --> $DIR/not-field-if-unsized.rs:12:20 | diff --git a/tests/ui/field_representing_types/not-field-if-unsized.old.stderr b/tests/ui/field_representing_types/not-field-if-unsized.old.stderr index 967f6115c1ac1..693f1353253bd 100644 --- a/tests/ui/field_representing_types/not-field-if-unsized.old.stderr +++ b/tests/ui/field_representing_types/not-field-if-unsized.old.stderr @@ -1,8 +1,8 @@ error[E0277]: the trait bound `field_of!(MyStruct, 0): Field` is not satisfied --> $DIR/not-field-if-unsized.rs:17:20 | -LL | assert_field::(); - | ^^^^^^^^^^^^^^^^^^^^^^ the nightly-only, unstable trait `Field` is not implemented for `field_of!(MyStruct, 0)` +LL | ..._field::(); + | ^^^^^^^^^^^^^^^^^^^^^^ the nightly-only, unstable trait `Field` is not implemented for `field_of!(MyStruct, 0)` | note: required by a bound in `assert_field` --> $DIR/not-field-if-unsized.rs:12:20 @@ -13,8 +13,8 @@ LL | fn assert_field() {} error[E0277]: the trait bound `field_of!(MyStruct, 1): Field` is not satisfied --> $DIR/not-field-if-unsized.rs:21:20 | -LL | assert_field::(); - | ^^^^^^^^^^^^^^^^^^^^^^ the nightly-only, unstable trait `Field` is not implemented for `field_of!(MyStruct, 1)` +LL | ..._field::(); + | ^^^^^^^^^^^^^^^^^^^^^^ the nightly-only, unstable trait `Field` is not implemented for `field_of!(MyStruct, 1)` | note: required by a bound in `assert_field` --> $DIR/not-field-if-unsized.rs:12:20 diff --git a/tests/ui/field_representing_types/not-field-if-unsized.rs b/tests/ui/field_representing_types/not-field-if-unsized.rs index 8f28443d7968c..82a3c385cb799 100644 --- a/tests/ui/field_representing_types/not-field-if-unsized.rs +++ b/tests/ui/field_representing_types/not-field-if-unsized.rs @@ -14,10 +14,10 @@ fn assert_field() {} fn main() { // FIXME(FRTs): this requires relaxing the `Base: ?Sized` bound in the // `Field` trait & compiler changes. - assert_field::(); - //~^ ERROR: the trait bound `field_of!(MyStruct, 0): Field` is not satisfied [E0277] + assert_field::(); //[next]~ ERROR: the size for values of type `(dyn Trait + 'static)` cannot be known at compilation time [E0277] + //[old]~^ ERROR: the trait bound `field_of!(MyStruct, 0): Field` is not satisfied [E0277] // FIXME(FRTs): improve this error message, point to the `dyn Trait` span. - assert_field::(); - //~^ ERROR: the trait bound `field_of!(MyStruct, 1): Field` is not satisfied [E0277] + assert_field::(); //[next]~ ERROR: the size for values of type `(dyn Trait + 'static)` cannot be known at compilation time [E0277] + //[old]~^ ERROR: the trait bound `field_of!(MyStruct, 1): Field` is not satisfied [E0277] } diff --git a/tests/ui/field_representing_types/sized.next.stderr b/tests/ui/field_representing_types/sized.next.stderr index ed7e6955c0762..254603f09b960 100644 --- a/tests/ui/field_representing_types/sized.next.stderr +++ b/tests/ui/field_representing_types/sized.next.stderr @@ -1,45 +1,98 @@ -error[E0277]: the trait bound `field_of!(Generic, count): Field` is not satisfied +error[E0277]: the size for values of type `T` cannot be known at compilation time --> $DIR/sized.rs:20:19 | +LL | fn generic() { + | - this type parameter needs to be `Sized` LL | impls_field::, count)>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the nightly-only, unstable trait `Field` is not implemented for `field_of!(Generic, count)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | +note: required because it appears within the type `Generic` + --> $DIR/sized.rs:16:5 + | +LL | pub struct Generic { +LL | count: usize, +LL | last: T, + | ^^^^^^^ required by this field +note: required because it appears within the type `field_of!(Generic, count)` + --> $SRC_DIR/core/src/field.rs:LL:COL note: required by a bound in `impls_field` --> $DIR/sized.rs:38:19 | LL | fn impls_field() {} | ^^^^^ required by this bound in `impls_field` +help: consider removing the `?Sized` bound to make the type parameter `Sized` + | +LL - fn generic() { +LL + fn generic() { + | -error[E0277]: the trait bound `field_of!(Generic, last): Field` is not satisfied +error[E0277]: the size for values of type `T` cannot be known at compilation time --> $DIR/sized.rs:22:19 | +LL | fn generic() { + | - this type parameter needs to be `Sized` +... LL | impls_field::, last)>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the nightly-only, unstable trait `Field` is not implemented for `field_of!(Generic, last)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time + | +note: required because it appears within the type `Generic` + --> $DIR/sized.rs:16:5 | +LL | pub struct Generic { +LL | count: usize, +LL | last: T, + | ^^^^^^^ required by this field +note: required because it appears within the type `field_of!(Generic, last)` + --> $SRC_DIR/core/src/field.rs:LL:COL note: required by a bound in `impls_field` --> $DIR/sized.rs:38:19 | LL | fn impls_field() {} | ^^^^^ required by this bound in `impls_field` +help: consider removing the `?Sized` bound to make the type parameter `Sized` + | +LL - fn generic() { +LL + fn generic() { + | -error[E0277]: the trait bound `field_of!(MyDST, count): Field` is not satisfied +error[E0277]: the size for values of type `(dyn Debug + 'static)` cannot be known at compilation time --> $DIR/sized.rs:32:19 | LL | impls_field::(); - | ^^^^^^^^^^^^^^^^^^^^^^^ the nightly-only, unstable trait `Field` is not implemented for `field_of!(MyDST, count)` + | ^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | + = help: within `field_of!(MyDST, count)`, the trait `Sized` is not implemented for `(dyn Debug + 'static)` +note: required because it appears within the type `MyDST` + --> $DIR/sized.rs:11:5 + | +LL | pub struct MyDST { +LL | count: usize, +LL | last: dyn Debug, + | ^^^^^^^^^^^^^^^ required by this field +note: required because it appears within the type `field_of!(MyDST, count)` + --> $SRC_DIR/core/src/field.rs:LL:COL note: required by a bound in `impls_field` --> $DIR/sized.rs:38:19 | LL | fn impls_field() {} | ^^^^^ required by this bound in `impls_field` -error[E0277]: the trait bound `field_of!(MyDST, last): Field` is not satisfied +error[E0277]: the size for values of type `(dyn Debug + 'static)` cannot be known at compilation time --> $DIR/sized.rs:34:19 | LL | impls_field::(); - | ^^^^^^^^^^^^^^^^^^^^^^ the nightly-only, unstable trait `Field` is not implemented for `field_of!(MyDST, last)` + | ^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time + | + = help: within `field_of!(MyDST, last)`, the trait `Sized` is not implemented for `(dyn Debug + 'static)` +note: required because it appears within the type `MyDST` + --> $DIR/sized.rs:11:5 | +LL | pub struct MyDST { +LL | count: usize, +LL | last: dyn Debug, + | ^^^^^^^^^^^^^^^ required by this field +note: required because it appears within the type `field_of!(MyDST, last)` + --> $SRC_DIR/core/src/field.rs:LL:COL note: required by a bound in `impls_field` --> $DIR/sized.rs:38:19 | diff --git a/tests/ui/field_representing_types/sized.old.stderr b/tests/ui/field_representing_types/sized.old.stderr index ed7e6955c0762..f86bf6ddd53ee 100644 --- a/tests/ui/field_representing_types/sized.old.stderr +++ b/tests/ui/field_representing_types/sized.old.stderr @@ -1,8 +1,8 @@ error[E0277]: the trait bound `field_of!(Generic, count): Field` is not satisfied --> $DIR/sized.rs:20:19 | -LL | impls_field::, count)>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the nightly-only, unstable trait `Field` is not implemented for `field_of!(Generic, count)` +LL | ...::, count)>(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the nightly-only, unstable trait `Field` is not implemented for `field_of!(Generic, count)` | note: required by a bound in `impls_field` --> $DIR/sized.rs:38:19 @@ -13,8 +13,8 @@ LL | fn impls_field() {} error[E0277]: the trait bound `field_of!(Generic, last): Field` is not satisfied --> $DIR/sized.rs:22:19 | -LL | impls_field::, last)>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the nightly-only, unstable trait `Field` is not implemented for `field_of!(Generic, last)` +LL | ...d::, last)>(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the nightly-only, unstable trait `Field` is not implemented for `field_of!(Generic, last)` | note: required by a bound in `impls_field` --> $DIR/sized.rs:38:19 @@ -25,8 +25,8 @@ LL | fn impls_field() {} error[E0277]: the trait bound `field_of!(MyDST, count): Field` is not satisfied --> $DIR/sized.rs:32:19 | -LL | impls_field::(); - | ^^^^^^^^^^^^^^^^^^^^^^^ the nightly-only, unstable trait `Field` is not implemented for `field_of!(MyDST, count)` +LL | ...field::(); + | ^^^^^^^^^^^^^^^^^^^^^^^ the nightly-only, unstable trait `Field` is not implemented for `field_of!(MyDST, count)` | note: required by a bound in `impls_field` --> $DIR/sized.rs:38:19 diff --git a/tests/ui/field_representing_types/sized.rs b/tests/ui/field_representing_types/sized.rs index 22499e32f33b2..658dd5f24a131 100644 --- a/tests/ui/field_representing_types/sized.rs +++ b/tests/ui/field_representing_types/sized.rs @@ -17,10 +17,10 @@ pub struct Generic { } fn generic() { - impls_field::, count)>(); - //~^ ERROR: the trait bound `field_of!(Generic, count): Field` is not satisfied [E0277] - impls_field::, last)>(); - //~^ ERROR: the trait bound `field_of!(Generic, last): Field` is not satisfied [E0277] + impls_field::, count)>(); //[next]~ ERROR: the size for values of type `T` cannot be known at compilation time [E0277] + //[old]~^ ERROR: the trait bound `field_of!(Generic, count): Field` is not satisfied [E0277] + impls_field::, last)>(); //[next]~ ERROR: the size for values of type `T` cannot be known at compilation time [E0277] + //[old]~^ ERROR: the trait bound `field_of!(Generic, last): Field` is not satisfied [E0277] } fn ok() { @@ -29,10 +29,10 @@ fn ok() { } fn main() { - impls_field::(); - //~^ ERROR: the trait bound `field_of!(MyDST, count): Field` is not satisfied [E0277] - impls_field::(); - //~^ ERROR: the trait bound `field_of!(MyDST, last): Field` is not satisfied [E0277] + impls_field::(); //[next]~ ERROR: the size for values of type `(dyn Debug + 'static)` cannot be known at compilation time [E0277] + //[old]~^ ERROR: the trait bound `field_of!(MyDST, count): Field` is not satisfied [E0277] + impls_field::(); //[next]~ ERROR: the size for values of type `(dyn Debug + 'static)` cannot be known at compilation time [E0277] + //[old]~^ ERROR: the trait bound `field_of!(MyDST, last): Field` is not satisfied [E0277] } fn impls_field() {} diff --git a/tests/ui/float/minmax.rs b/tests/ui/float/minmax.rs deleted file mode 100644 index e6bac901d7922..0000000000000 --- a/tests/ui/float/minmax.rs +++ /dev/null @@ -1,22 +0,0 @@ -//FIXME(llvm21) This should be a library test, but old LLVM miscompiles things so we can't just -// test this properly everywhere. Once we require LLVM 22, remove this test and enable the -// commented-out tests in `library/coretests/tests/floats/mod.rs` instead. -//@ min-llvm-version: 22 -//@ run-pass - -use std::hint::black_box; - -const SNAN32: f32 = f32::from_bits(f32::NAN.to_bits() - 1); -const SNAN64: f64 = f64::from_bits(f64::NAN.to_bits() - 1); - -fn main() { - assert_eq!(SNAN32.min(black_box(9.0)), 9.0f32); - assert_eq!(black_box(SNAN32).min(-9.0), -9.0f32); - assert_eq!((9.0f32).min(black_box(SNAN32)), 9.0f32); - assert_eq!(black_box(-9.0f32).min(SNAN32), -9.0f32); - - assert_eq!(SNAN64.min(black_box(9.0)), 9.0f64); - assert_eq!(black_box(SNAN64).min(-9.0), -9.0f64); - assert_eq!((9.0f64).min(black_box(SNAN64)), 9.0f64); - assert_eq!(black_box(-9.0f64).min(SNAN64), -9.0f64); -} diff --git a/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-71955.current.stderr b/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-71955.current.stderr new file mode 100644 index 0000000000000..83a7a9836a1ad --- /dev/null +++ b/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-71955.current.stderr @@ -0,0 +1,78 @@ +error: implementation of `FnOnce` is not general enough + --> $DIR/issue-71955.rs:47:5 + | +LL | fn foo(f1: F1, f2: F2) + | --- due to a where-clause on `foo`... +... +LL | F2: for<'b, 'c> FnOnce(&'b >::Output) -> bool, + | ---------------------------------------------------------- unsatisfied where-clause on `foo` +... +LL | foo(bar, |s| s.len() == 5); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: ...closure with signature `for<'a> fn(&'a &'2 str) -> bool` must implement `FnOnce<(&'b &'1 str,)>`, for any lifetime `'1`... + = note: ...but it actually implements `FnOnce<(&&'2 str,)>`, for some specific lifetime `'2` +help: consider adding an explicit type annotation to the closure's argument + | +LL | foo(bar, |s: &'b &'c str| s.len() == 5); + | +++++++++++++ + +error: implementation of `FnOnce` is not general enough + --> $DIR/issue-71955.rs:47:5 + | +LL | fn foo(f1: F1, f2: F2) + | --- due to a where-clause on `foo`... +... +LL | F2: for<'b, 'c> FnOnce(&'b >::Output) -> bool, + | ---- unsatisfied where-clause on `foo` +... +LL | foo(bar, |s| s.len() == 5); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: ...closure with signature `for<'a> fn(&'a &'2 str) -> bool` must implement `FnOnce<(&'b &'1 str,)>`, for any lifetime `'1`... + = note: ...but it actually implements `FnOnce<(&&'2 str,)>`, for some specific lifetime `'2` +help: consider adding an explicit type annotation to the closure's argument + | +LL | foo(bar, |s: &'b &'c str| s.len() == 5); + | +++++++++++++ + +error: implementation of `FnOnce` is not general enough + --> $DIR/issue-71955.rs:50:5 + | +LL | fn foo(f1: F1, f2: F2) + | --- due to a where-clause on `foo`... +... +LL | F2: for<'b, 'c> FnOnce(&'b >::Output) -> bool, + | ---------------------------------------------------------- unsatisfied where-clause on `foo` +... +LL | foo(baz, |s| s.0.len() == 5); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: ...closure with signature `for<'a> fn(&'a Wrapper<'2>) -> bool` must implement `FnOnce<(&'b Wrapper<'1>,)>`, for any lifetime `'1`... + = note: ...but it actually implements `FnOnce<(&Wrapper<'2>,)>`, for some specific lifetime `'2` +help: consider adding an explicit type annotation to the closure's argument + | +LL | foo(baz, |s: &'b Wrapper<'c>| s.0.len() == 5); + | +++++++++++++++++ + +error: implementation of `FnOnce` is not general enough + --> $DIR/issue-71955.rs:50:5 + | +LL | fn foo(f1: F1, f2: F2) + | --- due to a where-clause on `foo`... +... +LL | F2: for<'b, 'c> FnOnce(&'b >::Output) -> bool, + | ---- unsatisfied where-clause on `foo` +... +LL | foo(baz, |s| s.0.len() == 5); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: ...closure with signature `for<'a> fn(&'a Wrapper<'2>) -> bool` must implement `FnOnce<(&'b Wrapper<'1>,)>`, for any lifetime `'1`... + = note: ...but it actually implements `FnOnce<(&Wrapper<'2>,)>`, for some specific lifetime `'2` +help: consider adding an explicit type annotation to the closure's argument + | +LL | foo(baz, |s: &'b Wrapper<'c>| s.0.len() == 5); + | +++++++++++++++++ + +error: aborting due to 4 previous errors + diff --git a/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-71955.rs b/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-71955.rs index a44ed9e5ef59b..5f7e6cee4ebcf 100644 --- a/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-71955.rs +++ b/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-71955.rs @@ -1,34 +1,36 @@ -//@ check-fail -#![feature(rustc_attrs)] +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver +//@[next] check-pass + +// A regression test which failed with the old solver. The old solver +// ended up normalizing `>::Output` to `?t` because +// it did not eagerly prove the nested `F: Fn(&'s str) -> (&'s str, T)` +// where-clause. +// +// This means we don't map the `'!c` back to a bound var after +// inferring `?t`. We only normalize inside of binders with the new +// solver if the resulting term does not reference any inference +// variables which can later be constrained to mention something from +// the binder we're in. This is necessary as these placeholders would +// then leak from normalization. trait Parser<'s> { type Output; - - fn call(&self, input: &'s str) -> (&'s str, Self::Output); } impl<'s, F, T> Parser<'s> for F -where F: Fn(&'s str) -> (&'s str, T) { +where + F: Fn(&'s str) -> (&'s str, T), +{ type Output = T; - fn call(&self, input: &'s str) -> (&'s str, T) { - self(input) - } } -fn foo( - f1: F1, - base: &'static str, - f2: F2 -) +fn foo(f1: F1, f2: F2) where F1: for<'a> Parser<'a>, - F2: FnOnce(&::Output) -> bool + F2: for<'b, 'c> FnOnce(&'b >::Output) -> bool, { - let s: String = base.to_owned(); - let str_ref = s.as_ref(); - let (remaining, produced) = f1.call(str_ref); - assert!(f2(&produced)); - assert_eq!(remaining.len(), 0); } struct Wrapper<'a>(&'a str); @@ -42,10 +44,10 @@ fn main() { (&s[..1], Wrapper(&s[..])) } - foo(bar, "string", |s| s.len() == 5); - //~^ ERROR implementation of `FnOnce` is not general enough - //~| ERROR implementation of `FnOnce` is not general enough - foo(baz, "string", |s| s.0.len() == 5); - //~^ ERROR implementation of `FnOnce` is not general enough - //~| ERROR implementation of `FnOnce` is not general enough + foo(bar, |s| s.len() == 5); + //[current]~^ ERROR implementation of `FnOnce` is not general enough + //[current]~| ERROR implementation of `FnOnce` is not general enough + foo(baz, |s| s.0.len() == 5); + //[current]~^ ERROR implementation of `FnOnce` is not general enough + //[current]~| ERROR implementation of `FnOnce` is not general enough } diff --git a/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-71955.stderr b/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-71955.stderr deleted file mode 100644 index fa524168e12e7..0000000000000 --- a/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-71955.stderr +++ /dev/null @@ -1,78 +0,0 @@ -error: implementation of `FnOnce` is not general enough - --> $DIR/issue-71955.rs:45:5 - | -LL | fn foo( - | --- due to a where-clause on `foo`... -... -LL | F2: FnOnce(&::Output) -> bool - | --------------------------------------- unsatisfied where-clause on `foo` -... -LL | foo(bar, "string", |s| s.len() == 5); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: ...closure with signature `for<'a> fn(&'a &'2 str) -> bool` must implement `FnOnce<(&&'1 str,)>`, for any lifetime `'1`... - = note: ...but it actually implements `FnOnce<(&&'2 str,)>`, for some specific lifetime `'2` -help: consider adding an explicit type annotation to the closure's argument - | -LL | foo(bar, "string", |s: &&str| s.len() == 5); - | +++++++ - -error: implementation of `FnOnce` is not general enough - --> $DIR/issue-71955.rs:45:5 - | -LL | fn foo( - | --- due to a where-clause on `foo`... -... -LL | F2: FnOnce(&::Output) -> bool - | ---- unsatisfied where-clause on `foo` -... -LL | foo(bar, "string", |s| s.len() == 5); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: ...closure with signature `for<'a> fn(&'a &'2 str) -> bool` must implement `FnOnce<(&&'1 str,)>`, for any lifetime `'1`... - = note: ...but it actually implements `FnOnce<(&&'2 str,)>`, for some specific lifetime `'2` -help: consider adding an explicit type annotation to the closure's argument - | -LL | foo(bar, "string", |s: &&str| s.len() == 5); - | +++++++ - -error: implementation of `FnOnce` is not general enough - --> $DIR/issue-71955.rs:48:5 - | -LL | fn foo( - | --- due to a where-clause on `foo`... -... -LL | F2: FnOnce(&::Output) -> bool - | --------------------------------------- unsatisfied where-clause on `foo` -... -LL | foo(baz, "string", |s| s.0.len() == 5); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: ...closure with signature `for<'a> fn(&'a Wrapper<'2>) -> bool` must implement `FnOnce<(&Wrapper<'1>,)>`, for any lifetime `'1`... - = note: ...but it actually implements `FnOnce<(&Wrapper<'2>,)>`, for some specific lifetime `'2` -help: consider adding an explicit type annotation to the closure's argument - | -LL | foo(baz, "string", |s: &Wrapper<'_>| s.0.len() == 5); - | ++++++++++++++ - -error: implementation of `FnOnce` is not general enough - --> $DIR/issue-71955.rs:48:5 - | -LL | fn foo( - | --- due to a where-clause on `foo`... -... -LL | F2: FnOnce(&::Output) -> bool - | ---- unsatisfied where-clause on `foo` -... -LL | foo(baz, "string", |s| s.0.len() == 5); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: ...closure with signature `for<'a> fn(&'a Wrapper<'2>) -> bool` must implement `FnOnce<(&Wrapper<'1>,)>`, for any lifetime `'1`... - = note: ...but it actually implements `FnOnce<(&Wrapper<'2>,)>`, for some specific lifetime `'2` -help: consider adding an explicit type annotation to the closure's argument - | -LL | foo(baz, "string", |s: &Wrapper<'_>| s.0.len() == 5); - | ++++++++++++++ - -error: aborting due to 4 previous errors - diff --git a/tests/ui/impl-trait/defining-use-captured-non-universal-region.infer.stderr b/tests/ui/impl-trait/defining-use-captured-non-universal-region.infer.stderr index ded9a92d8e8c4..df54bacefa07b 100644 --- a/tests/ui/impl-trait/defining-use-captured-non-universal-region.infer.stderr +++ b/tests/ui/impl-trait/defining-use-captured-non-universal-region.infer.stderr @@ -1,5 +1,5 @@ error[E0792]: expected generic lifetime parameter, found `'_` - --> $DIR/defining-use-captured-non-universal-region.rs:13:18 + --> $DIR/defining-use-captured-non-universal-region.rs:16:18 | LL | fn foo<'a>() -> impl Sized + 'a { | -- this generic parameter must be used with a generic lifetime parameter diff --git a/tests/ui/impl-trait/defining-use-captured-non-universal-region.rs b/tests/ui/impl-trait/defining-use-captured-non-universal-region.rs index e18302dc061a3..a2f127e7935ef 100644 --- a/tests/ui/impl-trait/defining-use-captured-non-universal-region.rs +++ b/tests/ui/impl-trait/defining-use-captured-non-universal-region.rs @@ -1,15 +1,18 @@ // This was an ICE. See #110726. -//@ revisions: statik infer fixed +//@ revisions: statik infer fixed next +//@ ignore-compare-mode-next-solver (explicit revisions) //@ [fixed] check-pass +//@[next] compile-flags: -Znext-solver +//@[next] check-pass #![allow(unconditional_recursion)] fn foo<'a>() -> impl Sized + 'a { - #[cfg(statik)] + #[cfg(any(statik, next))] let i: i32 = foo::<'static>(); //[statik]~^ ERROR expected generic lifetime parameter, found `'static` - #[cfg(infer)] + #[cfg(any(infer, next))] let i: i32 = foo::<'_>(); //[infer]~^ ERROR expected generic lifetime parameter, found `'_` diff --git a/tests/ui/impl-trait/defining-use-captured-non-universal-region.statik.stderr b/tests/ui/impl-trait/defining-use-captured-non-universal-region.statik.stderr index 43beb29f9ec46..0c84035485033 100644 --- a/tests/ui/impl-trait/defining-use-captured-non-universal-region.statik.stderr +++ b/tests/ui/impl-trait/defining-use-captured-non-universal-region.statik.stderr @@ -1,9 +1,9 @@ error[E0792]: expected generic lifetime parameter, found `'static` - --> $DIR/defining-use-captured-non-universal-region.rs:9:18 + --> $DIR/defining-use-captured-non-universal-region.rs:12:18 | LL | fn foo<'a>() -> impl Sized + 'a { | -- cannot use static lifetime; use a bound lifetime instead or remove the lifetime parameter from the opaque type -LL | #[cfg(statik)] +LL | #[cfg(any(statik, next))] LL | let i: i32 = foo::<'static>(); | ^^^^^^^^^^^^^^^^ diff --git a/tests/ui/impl-trait/impl-fn-in-ret-pos-invalid-binder.edition2015.stderr b/tests/ui/impl-trait/impl-fn-in-ret-pos-invalid-binder.edition2015.stderr new file mode 100644 index 0000000000000..d601a597067c0 --- /dev/null +++ b/tests/ui/impl-trait/impl-fn-in-ret-pos-invalid-binder.edition2015.stderr @@ -0,0 +1,17 @@ +error[E0657]: `impl Trait` cannot capture higher-ranked lifetime from outer `impl Trait` + --> $DIR/impl-fn-in-ret-pos-invalid-binder.rs:13:43 + | +LL | fn a<'a>() -> impl for<'b> Fn(&'a u8) -> (impl Sized + 'b) { + | ^^^^^^^^^^^^^-- + | | + | `impl Trait` implicitly captures all lifetimes in scope + | +note: lifetime declared here + --> $DIR/impl-fn-in-ret-pos-invalid-binder.rs:13:24 + | +LL | fn a<'a>() -> impl for<'b> Fn(&'a u8) -> (impl Sized + 'b) { + | ^^ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0657`. diff --git a/tests/ui/impl-trait/impl-fn-in-ret-pos-invalid-binder.edition2024.stderr b/tests/ui/impl-trait/impl-fn-in-ret-pos-invalid-binder.edition2024.stderr new file mode 100644 index 0000000000000..d601a597067c0 --- /dev/null +++ b/tests/ui/impl-trait/impl-fn-in-ret-pos-invalid-binder.edition2024.stderr @@ -0,0 +1,17 @@ +error[E0657]: `impl Trait` cannot capture higher-ranked lifetime from outer `impl Trait` + --> $DIR/impl-fn-in-ret-pos-invalid-binder.rs:13:43 + | +LL | fn a<'a>() -> impl for<'b> Fn(&'a u8) -> (impl Sized + 'b) { + | ^^^^^^^^^^^^^-- + | | + | `impl Trait` implicitly captures all lifetimes in scope + | +note: lifetime declared here + --> $DIR/impl-fn-in-ret-pos-invalid-binder.rs:13:24 + | +LL | fn a<'a>() -> impl for<'b> Fn(&'a u8) -> (impl Sized + 'b) { + | ^^ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0657`. diff --git a/tests/ui/impl-trait/impl-fn-in-ret-pos-invalid-binder.next.stderr b/tests/ui/impl-trait/impl-fn-in-ret-pos-invalid-binder.next.stderr new file mode 100644 index 0000000000000..2ec2c79e2e0de --- /dev/null +++ b/tests/ui/impl-trait/impl-fn-in-ret-pos-invalid-binder.next.stderr @@ -0,0 +1,26 @@ +error[E0657]: `impl Trait` cannot capture higher-ranked lifetime from outer `impl Trait` + --> $DIR/impl-fn-in-ret-pos-invalid-binder.rs:13:43 + | +LL | fn a<'a>() -> impl for<'b> Fn(&'a u8) -> (impl Sized + 'b) { + | ^^^^^^^^^^^^^-- + | | + | `impl Trait` implicitly captures all lifetimes in scope + | +note: lifetime declared here + --> $DIR/impl-fn-in-ret-pos-invalid-binder.rs:13:24 + | +LL | fn a<'a>() -> impl for<'b> Fn(&'a u8) -> (impl Sized + 'b) { + | ^^ + +error[E0275]: overflow evaluating the requirement `a<'a>::{opaque#0}<'a> == {closure@$DIR/impl-fn-in-ret-pos-invalid-binder.rs:14:5: 14:8}` + --> $DIR/impl-fn-in-ret-pos-invalid-binder.rs:13:15 + | +LL | fn a<'a>() -> impl for<'b> Fn(&'a u8) -> (impl Sized + 'b) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`impl_fn_in_ret_pos_invalid_binder`) + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0275, E0657. +For more information about an error, try `rustc --explain E0275`. diff --git a/tests/ui/impl-trait/impl-fn-in-ret-pos-invalid-binder.rs b/tests/ui/impl-trait/impl-fn-in-ret-pos-invalid-binder.rs new file mode 100644 index 0000000000000..261a826b66c0d --- /dev/null +++ b/tests/ui/impl-trait/impl-fn-in-ret-pos-invalid-binder.rs @@ -0,0 +1,16 @@ +#![feature(impl_trait_in_fn_trait_return)] + +// A variant of `impl-fn-predefined-lifetimes.rs` which uses an explicit +// binder for the lifetime in the nested opaque type. This is intentionally +// not supported. + +fn a<'a>() -> impl for<'b> Fn(&'a u8) -> (impl Sized + 'b) { + //~^ ERROR: `impl Trait` cannot capture higher-ranked lifetime from outer `impl Trait` + |x| x +} + +fn _b<'a>() -> impl Fn(&'a u8) -> (impl Sized + 'a) { + a() +} + +fn main() {} diff --git a/tests/ui/impl-trait/impl-fn-in-ret-pos-invalid-binder.stderr b/tests/ui/impl-trait/impl-fn-in-ret-pos-invalid-binder.stderr new file mode 100644 index 0000000000000..3e593a64ee77b --- /dev/null +++ b/tests/ui/impl-trait/impl-fn-in-ret-pos-invalid-binder.stderr @@ -0,0 +1,17 @@ +error[E0657]: `impl Trait` cannot capture higher-ranked lifetime from outer `impl Trait` + --> $DIR/impl-fn-in-ret-pos-invalid-binder.rs:7:43 + | +LL | fn a<'a>() -> impl for<'b> Fn(&'a u8) -> (impl Sized + 'b) { + | ^^^^^^^^^^^^^-- + | | + | `impl Trait` implicitly captures all lifetimes in scope + | +note: lifetime declared here + --> $DIR/impl-fn-in-ret-pos-invalid-binder.rs:7:24 + | +LL | fn a<'a>() -> impl for<'b> Fn(&'a u8) -> (impl Sized + 'b) { + | ^^ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0657`. diff --git a/tests/ui/impl-trait/impl-fn-predefined-lifetimes.edition2015.stderr b/tests/ui/impl-trait/impl-fn-predefined-lifetimes.edition2015.stderr index 94476bcfbe88e..6b32c4ba8795c 100644 --- a/tests/ui/impl-trait/impl-fn-predefined-lifetimes.edition2015.stderr +++ b/tests/ui/impl-trait/impl-fn-predefined-lifetimes.edition2015.stderr @@ -1,11 +1,19 @@ error[E0792]: expected generic lifetime parameter, found `'_` - --> $DIR/impl-fn-predefined-lifetimes.rs:8:9 + --> $DIR/impl-fn-predefined-lifetimes.rs:15:9 | -LL | fn a<'a>() -> impl Fn(&'a u8) -> (impl Debug + '_) { +LL | fn a<'a>() -> impl Fn(&'a u8) -> (impl Sized + 'a) { | -- this generic parameter must be used with a generic lifetime parameter LL | |x| x | ^ -error: aborting due to 1 previous error +error[E0792]: expected generic lifetime parameter, found `'_` + --> $DIR/impl-fn-predefined-lifetimes.rs:25:9 + | +LL | fn c<'a>() -> impl Fn(&'a u8) -> (impl Sized + '_) { + | -- this generic parameter must be used with a generic lifetime parameter +LL | |x| x + | ^ + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0792`. diff --git a/tests/ui/impl-trait/impl-fn-predefined-lifetimes.edition2024.stderr b/tests/ui/impl-trait/impl-fn-predefined-lifetimes.edition2024.stderr index 2f1eacb0c34fa..1bebc53d9ec47 100644 --- a/tests/ui/impl-trait/impl-fn-predefined-lifetimes.edition2024.stderr +++ b/tests/ui/impl-trait/impl-fn-predefined-lifetimes.edition2024.stderr @@ -1,11 +1,19 @@ error[E0792]: expected generic lifetime parameter, found `'_` - --> $DIR/impl-fn-predefined-lifetimes.rs:8:9 + --> $DIR/impl-fn-predefined-lifetimes.rs:15:9 | -LL | fn a<'a>() -> impl Fn(&'a u8) -> (impl Debug + '_) { +LL | fn a<'a>() -> impl Fn(&'a u8) -> (impl Sized + 'a) { | -- this generic parameter must be used with a generic lifetime parameter LL | |x| x | ^ -error: aborting due to 1 previous error +error[E0792]: expected generic lifetime parameter, found `'_` + --> $DIR/impl-fn-predefined-lifetimes.rs:25:9 + | +LL | fn c<'a>() -> impl Fn(&'a u8) -> (impl Sized + '_) { + | -- this generic parameter must be used with a generic lifetime parameter +LL | |x| x + | ^ + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0792`. diff --git a/tests/ui/impl-trait/impl-fn-predefined-lifetimes.rs b/tests/ui/impl-trait/impl-fn-predefined-lifetimes.rs index b2963cc10fa85..a787b70505e7e 100644 --- a/tests/ui/impl-trait/impl-fn-predefined-lifetimes.rs +++ b/tests/ui/impl-trait/impl-fn-predefined-lifetimes.rs @@ -1,15 +1,32 @@ -//@revisions: edition2015 edition2024 +//@ revisions: edition2015 edition2024 next +//@ ignore-compare-mode-next-solver (explicit revisions) //@[edition2015] edition:2015 //@[edition2024] edition:2024 +//@[next] compile-flags: -Znext-solver +//@[next] check-pass #![feature(impl_trait_in_fn_trait_return)] -use std::fmt::Debug; -fn a<'a>() -> impl Fn(&'a u8) -> (impl Debug + '_) { +// In the old solver we only define the nested `impl Sized` +// inside of the closure, at which point `'a` is an external +// region. The edition does not matter except for the diagnostic. +// In both cases the inner opaque type captures `'a`. + +fn a<'a>() -> impl Fn(&'a u8) -> (impl Sized + 'a) { + |x| x + //[edition2015,edition2024]~^ ERROR expected generic lifetime parameter, found `'_` +} + +fn _b<'a>() -> impl Fn(&'a u8) -> (impl Sized + 'a) { + a() +} + +// `'_` gets inferred to `'a` here. +fn c<'a>() -> impl Fn(&'a u8) -> (impl Sized + '_) { |x| x - //~^ ERROR expected generic lifetime parameter, found `'_` + //[edition2015,edition2024]~^ ERROR expected generic lifetime parameter, found `'_` } -fn _b<'a>() -> impl Fn(&'a u8) -> (impl Debug + 'a) { +fn _d<'a>() -> impl Fn(&'a u8) -> (impl Sized + 'a) { a() } diff --git a/tests/ui/impl-trait/recursive-ice-101862.stderr b/tests/ui/impl-trait/recursive-ice-101862.current.stderr similarity index 92% rename from tests/ui/impl-trait/recursive-ice-101862.stderr rename to tests/ui/impl-trait/recursive-ice-101862.current.stderr index 85745c25e2bfa..2b885659e274b 100644 --- a/tests/ui/impl-trait/recursive-ice-101862.stderr +++ b/tests/ui/impl-trait/recursive-ice-101862.current.stderr @@ -1,5 +1,5 @@ error[E0792]: expected generic type parameter, found `&str` - --> $DIR/recursive-ice-101862.rs:6:19 + --> $DIR/recursive-ice-101862.rs:10:19 | LL | pub fn ice(x: impl AsRef) -> impl IntoIterator { | --------------- this generic parameter must be used with a generic type parameter @@ -8,7 +8,7 @@ LL | vec![].append(&mut ice(x.as_ref())); | ^^^^^^^^^^^^^^^^^^^^ warning: function cannot return without recursing - --> $DIR/recursive-ice-101862.rs:4:1 + --> $DIR/recursive-ice-101862.rs:8:1 | LL | pub fn ice(x: impl AsRef) -> impl IntoIterator { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing diff --git a/tests/ui/impl-trait/recursive-ice-101862.next.stderr b/tests/ui/impl-trait/recursive-ice-101862.next.stderr new file mode 100644 index 0000000000000..48b5831acc0c6 --- /dev/null +++ b/tests/ui/impl-trait/recursive-ice-101862.next.stderr @@ -0,0 +1,14 @@ +warning: function cannot return without recursing + --> $DIR/recursive-ice-101862.rs:8:1 + | +LL | pub fn ice(x: impl AsRef) -> impl IntoIterator { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing +LL | +LL | vec![].append(&mut ice(x.as_ref())); + | --------------- recursive call site + | + = help: a `loop` may express intention better if this is on purpose + = note: `#[warn(unconditional_recursion)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/impl-trait/recursive-ice-101862.rs b/tests/ui/impl-trait/recursive-ice-101862.rs index 02f95fe5604b2..117b3f0b8d089 100644 --- a/tests/ui/impl-trait/recursive-ice-101862.rs +++ b/tests/ui/impl-trait/recursive-ice-101862.rs @@ -1,10 +1,14 @@ +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver +//@[next] check-pass // issue: rust-lang/rust#101852 // ICE opaque type with non-universal region substs pub fn ice(x: impl AsRef) -> impl IntoIterator { //~^ WARN function cannot return without recursing vec![].append(&mut ice(x.as_ref())); - //~^ ERROR expected generic type parameter, found `&str` + //[current]~^ ERROR expected generic type parameter, found `&str` Vec::new() } diff --git a/tests/ui/impl-trait/rpit/early_bound.stderr b/tests/ui/impl-trait/rpit/early_bound.current.stderr similarity index 85% rename from tests/ui/impl-trait/rpit/early_bound.stderr rename to tests/ui/impl-trait/rpit/early_bound.current.stderr index d5eb229e3a75a..11b671545ad28 100644 --- a/tests/ui/impl-trait/rpit/early_bound.stderr +++ b/tests/ui/impl-trait/rpit/early_bound.current.stderr @@ -1,11 +1,11 @@ error: concrete type differs from previous defining opaque type use - --> $DIR/early_bound.rs:6:36 + --> $DIR/early_bound.rs:10:36 | LL | let _ = identity::<&'a ()>(test(false)); | ^^^^^^^^^^^ expected `!`, got `&()` | note: previous use here - --> $DIR/early_bound.rs:3:29 + --> $DIR/early_bound.rs:7:29 | LL | fn test<'a: 'a>(n: bool) -> impl Sized + 'a { | ^^^^^^^^^^^^^^^ diff --git a/tests/ui/impl-trait/rpit/early_bound.rs b/tests/ui/impl-trait/rpit/early_bound.rs index 0337f605e487b..30940def29ecb 100644 --- a/tests/ui/impl-trait/rpit/early_bound.rs +++ b/tests/ui/impl-trait/rpit/early_bound.rs @@ -1,10 +1,14 @@ +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver +//@[next] check-pass use std::convert::identity; fn test<'a: 'a>(n: bool) -> impl Sized + 'a { let true = n else { loop {} }; let _ = || { let _ = identity::<&'a ()>(test(false)); - //~^ ERROR concrete type differs from previous defining opaque type use + //[current]~^ ERROR concrete type differs from previous defining opaque type use }; loop {} } diff --git a/tests/ui/impl-trait/rpit/non-defining-use-lifetimes.stderr b/tests/ui/impl-trait/rpit/non-defining-use-lifetimes.current.stderr similarity index 85% rename from tests/ui/impl-trait/rpit/non-defining-use-lifetimes.stderr rename to tests/ui/impl-trait/rpit/non-defining-use-lifetimes.current.stderr index d2a224601fbe6..024d2db71e340 100644 --- a/tests/ui/impl-trait/rpit/non-defining-use-lifetimes.stderr +++ b/tests/ui/impl-trait/rpit/non-defining-use-lifetimes.current.stderr @@ -1,5 +1,5 @@ error[E0792]: expected generic lifetime parameter, found `'static` - --> $DIR/non-defining-use-lifetimes.rs:13:16 + --> $DIR/non-defining-use-lifetimes.rs:17:16 | LL | fn foo<'a>(_: Lt<'a>) -> impl Sized + 'a { | -- cannot use static lifetime; use a bound lifetime instead or remove the lifetime parameter from the opaque type @@ -7,7 +7,7 @@ LL | let _: () = foo(Lt::<'static>::None); | ^^ error[E0792]: expected generic lifetime parameter, found `'_` - --> $DIR/non-defining-use-lifetimes.rs:22:16 + --> $DIR/non-defining-use-lifetimes.rs:26:16 | LL | fn foo<'a>(_: Lt<'a>) -> impl Sized + 'a { | -- this generic parameter must be used with a generic lifetime parameter @@ -15,13 +15,13 @@ LL | let _: () = foo(Lt::<'_>::None); | ^^ error: non-defining opaque type use in defining scope - --> $DIR/non-defining-use-lifetimes.rs:32:16 + --> $DIR/non-defining-use-lifetimes.rs:36:16 | LL | let _: () = foo(Lt::<'a>::None, Lt::<'a>::None); | ^^ | note: lifetime used multiple times - --> $DIR/non-defining-use-lifetimes.rs:31:58 + --> $DIR/non-defining-use-lifetimes.rs:35:58 | LL | fn foo<'a, 'b>(_: Lt<'a>, _: Lt<'b>) -> impl Sized + 'a + 'b { | ^^ ^^ diff --git a/tests/ui/impl-trait/rpit/non-defining-use-lifetimes.rs b/tests/ui/impl-trait/rpit/non-defining-use-lifetimes.rs index 5e04e6b091adc..68a99fb099074 100644 --- a/tests/ui/impl-trait/rpit/non-defining-use-lifetimes.rs +++ b/tests/ui/impl-trait/rpit/non-defining-use-lifetimes.rs @@ -1,3 +1,7 @@ +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver +//@[next] check-pass // issue: #111935 #![allow(unconditional_recursion)] @@ -11,7 +15,7 @@ mod statik { // invalid defining use: Opaque<'static> := () fn foo<'a>(_: Lt<'a>) -> impl Sized + 'a { let _: () = foo(Lt::<'static>::None); - //~^ ERROR expected generic lifetime parameter, found `'static` + //[current]~^ ERROR expected generic lifetime parameter, found `'static` } } @@ -20,7 +24,7 @@ mod infer { // invalid defining use: Opaque<'_> := () fn foo<'a>(_: Lt<'a>) -> impl Sized + 'a { let _: () = foo(Lt::<'_>::None); - //~^ ERROR expected generic lifetime parameter, found `'_` + //[current]~^ ERROR expected generic lifetime parameter, found `'_` } } @@ -30,7 +34,7 @@ mod equal { // because of the use of equal lifetimes in args fn foo<'a, 'b>(_: Lt<'a>, _: Lt<'b>) -> impl Sized + 'a + 'b { let _: () = foo(Lt::<'a>::None, Lt::<'a>::None); - //~^ ERROR non-defining opaque type use in defining scope + //[current]~^ ERROR non-defining opaque type use in defining scope } } diff --git a/tests/ui/impl-trait/rpit/non-defining-use.stderr b/tests/ui/impl-trait/rpit/non-defining-use.current.stderr similarity index 94% rename from tests/ui/impl-trait/rpit/non-defining-use.stderr rename to tests/ui/impl-trait/rpit/non-defining-use.current.stderr index c2b1b0f824976..22909ccfd54b1 100644 --- a/tests/ui/impl-trait/rpit/non-defining-use.stderr +++ b/tests/ui/impl-trait/rpit/non-defining-use.current.stderr @@ -1,5 +1,5 @@ error[E0792]: expected generic type parameter, found `u8` - --> $DIR/non-defining-use.rs:4:17 + --> $DIR/non-defining-use.rs:8:17 | LL | fn foo() -> impl Sized { | - this generic parameter must be used with a generic type parameter @@ -7,7 +7,7 @@ LL | let _: () = foo::(); | ^^^^^^^^^^^ error[E0792]: expected generic type parameter, found `u8` - --> $DIR/non-defining-use.rs:8:17 + --> $DIR/non-defining-use.rs:12:17 | LL | fn bar(val: T) -> impl Sized { | - this generic parameter must be used with a generic type parameter diff --git a/tests/ui/impl-trait/rpit/non-defining-use.rs b/tests/ui/impl-trait/rpit/non-defining-use.rs index 3ab0e0ee4e29f..2c4976004cb31 100644 --- a/tests/ui/impl-trait/rpit/non-defining-use.rs +++ b/tests/ui/impl-trait/rpit/non-defining-use.rs @@ -1,12 +1,16 @@ +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver +//@[next] check-pass // Regression test for #111935 that non-defining uses of RPIT result in errors #![allow(unconditional_recursion)] fn foo() -> impl Sized { - let _: () = foo::(); //~ ERROR expected generic type parameter, found `u8` + let _: () = foo::(); //[current]~ ERROR expected generic type parameter, found `u8` } fn bar(val: T) -> impl Sized { let _: u8 = bar(0u8); - //~^ ERROR expected generic type parameter, found `u8` + //[current]~^ ERROR expected generic type parameter, found `u8` val } diff --git a/tests/ui/iterators/generator_capture_.stderr b/tests/ui/iterators/generator_capture_2.current.stderr similarity index 80% rename from tests/ui/iterators/generator_capture_.stderr rename to tests/ui/iterators/generator_capture_2.current.stderr index 3d9647ae16f32..f4d0e9ff33240 100644 --- a/tests/ui/iterators/generator_capture_.stderr +++ b/tests/ui/iterators/generator_capture_2.current.stderr @@ -1,8 +1,8 @@ error[E0382]: use of moved value: `f` - --> $DIR/generator_capture_.rs:21:17 + --> $DIR/generator_capture_2.rs:27:17 | LL | let f = { - | - move occurs because `f` has type `{gen closure@$DIR/generator_capture_.rs:10:17: 10:24}`, which does not implement the `Copy` trait + | - move occurs because `f` has type `{gen closure@$DIR/generator_capture_2.rs:16:17: 16:24}`, which does not implement the `Copy` trait ... LL | let mut i = f(); | --- `f` moved due to this call @@ -11,7 +11,7 @@ LL | let mut i = f(); | ^ value used here after move | note: this value implements `FnOnce`, which causes it to be moved when called - --> $DIR/generator_capture_.rs:16:17 + --> $DIR/generator_capture_2.rs:22:17 | LL | let mut i = f(); | ^ diff --git a/tests/ui/iterators/generator_capture_.rs b/tests/ui/iterators/generator_capture_2.rs similarity index 70% rename from tests/ui/iterators/generator_capture_.rs rename to tests/ui/iterators/generator_capture_2.rs index f630bc64b974c..5277dbb203732 100644 --- a/tests/ui/iterators/generator_capture_.rs +++ b/tests/ui/iterators/generator_capture_2.rs @@ -1,3 +1,9 @@ +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver +//@[next] known-bug: trait-system-refactor-initiative#302 +//@[next] check-pass + // This test exercises lending behavior for iterator closures which is not yet supported. #![feature(iter_macro, yield_expr)] @@ -18,7 +24,7 @@ fn main() { assert_eq!(i.next(), Some('o')); assert_eq!(i.next(), Some('o')); assert_eq!(i.next(), None); - let mut i = f(); //~ ERROR use of moved value: `f` + let mut i = f(); //[current]~ ERROR use of moved value: `f` assert_eq!(i.next(), Some('f')); assert_eq!(i.next(), Some('o')); assert_eq!(i.next(), Some('o')); diff --git a/tests/ui/iterators/iter-macro-not-async-closure-simplified.narrow.stderr b/tests/ui/iterators/iter-macro-not-async-closure-simplified.narrow.stderr index 4e0dabade2de0..7aaff4c7bf679 100644 --- a/tests/ui/iterators/iter-macro-not-async-closure-simplified.narrow.stderr +++ b/tests/ui/iterators/iter-macro-not-async-closure-simplified.narrow.stderr @@ -1,14 +1,14 @@ -error[E0277]: the trait bound `{gen closure@$DIR/iter-macro-not-async-closure-simplified.rs:21:21: 21:28}: AsyncFnOnce()` is not satisfied - --> $DIR/iter-macro-not-async-closure-simplified.rs:27:21 +error[E0277]: the trait bound `{gen closure@$DIR/iter-macro-not-async-closure-simplified.rs:25:21: 25:28}: AsyncFnOnce()` is not satisfied + --> $DIR/iter-macro-not-async-closure-simplified.rs:31:21 | LL | call_async_once(f); | --------------- ^ unsatisfied trait bound | | | required by a bound introduced by this call | - = help: the trait `AsyncFnOnce()` is not implemented for `{gen closure@$DIR/iter-macro-not-async-closure-simplified.rs:21:21: 21:28}` + = help: the trait `AsyncFnOnce()` is not implemented for `{gen closure@$DIR/iter-macro-not-async-closure-simplified.rs:25:21: 25:28}` note: required by a bound in `call_async_once` - --> $DIR/iter-macro-not-async-closure-simplified.rs:18:28 + --> $DIR/iter-macro-not-async-closure-simplified.rs:22:28 | LL | ...pl AsyncFnOnce()) {} | ^^^^^^^^^^^^^ required by this bound in `call_async_once` diff --git a/tests/ui/iterators/iter-macro-not-async-closure-simplified.rs b/tests/ui/iterators/iter-macro-not-async-closure-simplified.rs index 4fa14fda661cf..e8c31f0eed879 100644 --- a/tests/ui/iterators/iter-macro-not-async-closure-simplified.rs +++ b/tests/ui/iterators/iter-macro-not-async-closure-simplified.rs @@ -7,9 +7,13 @@ // explanation is moved to the `help` instead of the span label. // //@ edition: 2024 -//@ revisions: narrow wide +//@ revisions: narrow wide next +//@ ignore-compare-mode-next-solver (explicit revisions) //@[narrow] compile-flags: --diagnostic-width=20 //@[wide] compile-flags: --diagnostic-width=300 +//@[next] compile-flags: -Znext-solver +//@[next] known-bug: trait-system-refactor-initiative#302 +//@[next] check-pass #![feature(yield_expr, iter_macro)] @@ -25,5 +29,5 @@ fn main() { }}; call_async_once(f); - //~^ ERROR AsyncFnOnce()` is not satisfied + //[narrow,wide]~^ ERROR AsyncFnOnce()` is not satisfied } diff --git a/tests/ui/iterators/iter-macro-not-async-closure-simplified.wide.stderr b/tests/ui/iterators/iter-macro-not-async-closure-simplified.wide.stderr index a6c239c181b5f..60a94e070eaba 100644 --- a/tests/ui/iterators/iter-macro-not-async-closure-simplified.wide.stderr +++ b/tests/ui/iterators/iter-macro-not-async-closure-simplified.wide.stderr @@ -1,13 +1,13 @@ -error[E0277]: the trait bound `{gen closure@$DIR/iter-macro-not-async-closure-simplified.rs:21:21: 21:28}: AsyncFnOnce()` is not satisfied - --> $DIR/iter-macro-not-async-closure-simplified.rs:27:21 +error[E0277]: the trait bound `{gen closure@$DIR/iter-macro-not-async-closure-simplified.rs:25:21: 25:28}: AsyncFnOnce()` is not satisfied + --> $DIR/iter-macro-not-async-closure-simplified.rs:31:21 | LL | call_async_once(f); - | --------------- ^ the trait `AsyncFnOnce()` is not implemented for `{gen closure@$DIR/iter-macro-not-async-closure-simplified.rs:21:21: 21:28}` + | --------------- ^ the trait `AsyncFnOnce()` is not implemented for `{gen closure@$DIR/iter-macro-not-async-closure-simplified.rs:25:21: 25:28}` | | | required by a bound introduced by this call | note: required by a bound in `call_async_once` - --> $DIR/iter-macro-not-async-closure-simplified.rs:18:28 + --> $DIR/iter-macro-not-async-closure-simplified.rs:22:28 | LL | fn call_async_once(_: impl AsyncFnOnce()) {} | ^^^^^^^^^^^^^ required by this bound in `call_async_once` diff --git a/tests/ui/iterators/iter-macro-not-async-closure.stderr b/tests/ui/iterators/iter-macro-not-async-closure.current.stderr similarity index 71% rename from tests/ui/iterators/iter-macro-not-async-closure.stderr rename to tests/ui/iterators/iter-macro-not-async-closure.current.stderr index 0d7bfaca8bab2..c896d226a7715 100644 --- a/tests/ui/iterators/iter-macro-not-async-closure.stderr +++ b/tests/ui/iterators/iter-macro-not-async-closure.current.stderr @@ -1,73 +1,73 @@ -error[E0277]: the trait bound `{gen closure@$DIR/iter-macro-not-async-closure.rs:19:21: 19:28}: AsyncFnOnce()` is not satisfied - --> $DIR/iter-macro-not-async-closure.rs:25:34 +error[E0277]: the trait bound `{gen closure@$DIR/iter-macro-not-async-closure.rs:25:21: 25:28}: AsyncFnOnce()` is not satisfied + --> $DIR/iter-macro-not-async-closure.rs:31:34 | LL | let x = pin!(call_async_once(f)); - | --------------- ^ the trait `AsyncFnOnce()` is not implemented for `{gen closure@$DIR/iter-macro-not-async-closure.rs:19:21: 19:28}` + | --------------- ^ the trait `AsyncFnOnce()` is not implemented for `{gen closure@$DIR/iter-macro-not-async-closure.rs:25:21: 25:28}` | | | required by a bound introduced by this call | note: required by a bound in `call_async_once` - --> $DIR/iter-macro-not-async-closure.rs:14:34 + --> $DIR/iter-macro-not-async-closure.rs:20:34 | LL | async fn call_async_once(f: impl AsyncFnOnce()) { | ^^^^^^^^^^^^^ required by this bound in `call_async_once` -error[E0277]: the trait bound `{gen closure@$DIR/iter-macro-not-async-closure.rs:19:21: 19:28}: AsyncFnOnce()` is not satisfied - --> $DIR/iter-macro-not-async-closure.rs:25:18 +error[E0277]: the trait bound `{gen closure@$DIR/iter-macro-not-async-closure.rs:25:21: 25:28}: AsyncFnOnce()` is not satisfied + --> $DIR/iter-macro-not-async-closure.rs:31:18 | LL | let x = pin!(call_async_once(f)); - | ^^^^^^^^^^^^^^^^^^ the trait `AsyncFnOnce()` is not implemented for `{gen closure@$DIR/iter-macro-not-async-closure.rs:19:21: 19:28}` + | ^^^^^^^^^^^^^^^^^^ the trait `AsyncFnOnce()` is not implemented for `{gen closure@$DIR/iter-macro-not-async-closure.rs:25:21: 25:28}` | note: required by a bound in `call_async_once` - --> $DIR/iter-macro-not-async-closure.rs:14:34 + --> $DIR/iter-macro-not-async-closure.rs:20:34 | LL | async fn call_async_once(f: impl AsyncFnOnce()) { | ^^^^^^^^^^^^^ required by this bound in `call_async_once` -error[E0277]: the trait bound `{gen closure@$DIR/iter-macro-not-async-closure.rs:19:21: 19:28}: AsyncFnOnce()` is not satisfied - --> $DIR/iter-macro-not-async-closure.rs:25:13 +error[E0277]: the trait bound `{gen closure@$DIR/iter-macro-not-async-closure.rs:25:21: 25:28}: AsyncFnOnce()` is not satisfied + --> $DIR/iter-macro-not-async-closure.rs:31:13 | LL | let x = pin!(call_async_once(f)); - | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `AsyncFnOnce()` is not implemented for `{gen closure@$DIR/iter-macro-not-async-closure.rs:19:21: 19:28}` + | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `AsyncFnOnce()` is not implemented for `{gen closure@$DIR/iter-macro-not-async-closure.rs:25:21: 25:28}` | note: required by a bound in `call_async_once` - --> $DIR/iter-macro-not-async-closure.rs:14:34 + --> $DIR/iter-macro-not-async-closure.rs:20:34 | LL | async fn call_async_once(f: impl AsyncFnOnce()) { | ^^^^^^^^^^^^^ required by this bound in `call_async_once` -error[E0277]: the trait bound `{gen closure@$DIR/iter-macro-not-async-closure.rs:19:21: 19:28}: AsyncFnOnce()` is not satisfied - --> $DIR/iter-macro-not-async-closure.rs:25:13 +error[E0277]: the trait bound `{gen closure@$DIR/iter-macro-not-async-closure.rs:25:21: 25:28}: AsyncFnOnce()` is not satisfied + --> $DIR/iter-macro-not-async-closure.rs:31:13 | LL | let x = pin!(call_async_once(f)); - | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `AsyncFnOnce()` is not implemented for `{gen closure@$DIR/iter-macro-not-async-closure.rs:19:21: 19:28}` + | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `AsyncFnOnce()` is not implemented for `{gen closure@$DIR/iter-macro-not-async-closure.rs:25:21: 25:28}` | note: required by a bound in `call_async_once` - --> $DIR/iter-macro-not-async-closure.rs:14:34 + --> $DIR/iter-macro-not-async-closure.rs:20:34 | LL | async fn call_async_once(f: impl AsyncFnOnce()) { | ^^^^^^^^^^^^^ required by this bound in `call_async_once` -error[E0277]: the trait bound `{gen closure@$DIR/iter-macro-not-async-closure.rs:19:21: 19:28}: AsyncFnOnce()` is not satisfied - --> $DIR/iter-macro-not-async-closure.rs:25:13 +error[E0277]: the trait bound `{gen closure@$DIR/iter-macro-not-async-closure.rs:25:21: 25:28}: AsyncFnOnce()` is not satisfied + --> $DIR/iter-macro-not-async-closure.rs:31:13 | LL | let x = pin!(call_async_once(f)); - | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `AsyncFnOnce()` is not implemented for `{gen closure@$DIR/iter-macro-not-async-closure.rs:19:21: 19:28}` + | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `AsyncFnOnce()` is not implemented for `{gen closure@$DIR/iter-macro-not-async-closure.rs:25:21: 25:28}` | note: required by a bound in `call_async_once` - --> $DIR/iter-macro-not-async-closure.rs:14:34 + --> $DIR/iter-macro-not-async-closure.rs:20:34 | LL | async fn call_async_once(f: impl AsyncFnOnce()) { | ^^^^^^^^^^^^^ required by this bound in `call_async_once` -error[E0277]: the trait bound `{gen closure@$DIR/iter-macro-not-async-closure.rs:19:21: 19:28}: AsyncFnOnce()` is not satisfied - --> $DIR/iter-macro-not-async-closure.rs:31:5 +error[E0277]: the trait bound `{gen closure@$DIR/iter-macro-not-async-closure.rs:25:21: 25:28}: AsyncFnOnce()` is not satisfied + --> $DIR/iter-macro-not-async-closure.rs:37:5 | LL | x.poll(&mut Context::from_waker(Waker::noop())); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `AsyncFnOnce()` is not implemented for `{gen closure@$DIR/iter-macro-not-async-closure.rs:19:21: 19:28}` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `AsyncFnOnce()` is not implemented for `{gen closure@$DIR/iter-macro-not-async-closure.rs:25:21: 25:28}` | note: required by a bound in `call_async_once` - --> $DIR/iter-macro-not-async-closure.rs:14:34 + --> $DIR/iter-macro-not-async-closure.rs:20:34 | LL | async fn call_async_once(f: impl AsyncFnOnce()) { | ^^^^^^^^^^^^^ required by this bound in `call_async_once` diff --git a/tests/ui/iterators/iter-macro-not-async-closure.rs b/tests/ui/iterators/iter-macro-not-async-closure.rs index c46be769b3a67..3cf9e2237d2e7 100644 --- a/tests/ui/iterators/iter-macro-not-async-closure.rs +++ b/tests/ui/iterators/iter-macro-not-async-closure.rs @@ -1,3 +1,9 @@ +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver +//@[next] known-bug: trait-system-refactor-initiative#302 +//@[next] check-pass + // This test ensures iterators created with the `iter!` macro are not // accidentally async closures. // @@ -23,11 +29,11 @@ fn main() { }}; let x = pin!(call_async_once(f)); - //~^ ERROR AsyncFnOnce()` is not satisfied - //~^^ ERROR AsyncFnOnce()` is not satisfied - //~^^^ ERROR AsyncFnOnce()` is not satisfied - //~^^^^ ERROR AsyncFnOnce()` is not satisfied - //~^^^^^ ERROR AsyncFnOnce()` is not satisfied + //[current]~^ ERROR AsyncFnOnce()` is not satisfied + //[current]~^^ ERROR AsyncFnOnce()` is not satisfied + //[current]~^^^ ERROR AsyncFnOnce()` is not satisfied + //[current]~^^^^ ERROR AsyncFnOnce()` is not satisfied + //[current]~^^^^^ ERROR AsyncFnOnce()` is not satisfied x.poll(&mut Context::from_waker(Waker::noop())); - //~^ ERROR AsyncFnOnce()` is not satisfied + //[current]~^ ERROR AsyncFnOnce()` is not satisfied } diff --git a/tests/ui/lazy-type-alias-impl-trait/branches.stderr b/tests/ui/lazy-type-alias-impl-trait/branches.current.stderr similarity index 94% rename from tests/ui/lazy-type-alias-impl-trait/branches.stderr rename to tests/ui/lazy-type-alias-impl-trait/branches.current.stderr index 0cc727bc3ded4..793409b9c78e4 100644 --- a/tests/ui/lazy-type-alias-impl-trait/branches.stderr +++ b/tests/ui/lazy-type-alias-impl-trait/branches.current.stderr @@ -1,5 +1,5 @@ error[E0277]: a value of type `Bar` cannot be built from an iterator over elements of type `_` - --> $DIR/branches.rs:17:28 + --> $DIR/branches.rs:21:28 | LL | std::iter::empty().collect() | ^^^^^^^ value of type `Bar` cannot be built from `std::iter::Iterator` diff --git a/tests/ui/lazy-type-alias-impl-trait/branches.rs b/tests/ui/lazy-type-alias-impl-trait/branches.rs index 30f9c08a27fd0..14be136872edb 100644 --- a/tests/ui/lazy-type-alias-impl-trait/branches.rs +++ b/tests/ui/lazy-type-alias-impl-trait/branches.rs @@ -1,3 +1,7 @@ +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver +//@[next] check-pass #![feature(type_alias_impl_trait)] type Foo = impl std::fmt::Debug; @@ -15,7 +19,7 @@ fn bar(b: bool) -> Bar { vec![42_i32] } else { std::iter::empty().collect() - //~^ ERROR a value of type `Bar` cannot be built from an iterator over elements of type `_` + //[current]~^ ERROR a value of type `Bar` cannot be built from an iterator over elements of type `_` }; x } diff --git a/tests/ui/lazy-type-alias-impl-trait/recursion3.stderr b/tests/ui/lazy-type-alias-impl-trait/recursion3.current.stderr similarity index 89% rename from tests/ui/lazy-type-alias-impl-trait/recursion3.stderr rename to tests/ui/lazy-type-alias-impl-trait/recursion3.current.stderr index 0cbedfb69f85a..aa0061f5506be 100644 --- a/tests/ui/lazy-type-alias-impl-trait/recursion3.stderr +++ b/tests/ui/lazy-type-alias-impl-trait/recursion3.current.stderr @@ -1,5 +1,5 @@ error[E0369]: cannot add `{integer}` to `Foo` - --> $DIR/recursion3.rs:10:29 + --> $DIR/recursion3.rs:14:29 | LL | let x: u32 = foo(false) + 42; | ---------- ^ -- {integer} @@ -7,7 +7,7 @@ LL | let x: u32 = foo(false) + 42; | Foo error[E0369]: cannot add `{integer}` to `impl Debug` - --> $DIR/recursion3.rs:18:29 + --> $DIR/recursion3.rs:22:29 | LL | let x: u32 = bar(false) + 42; | ---------- ^ -- {integer} diff --git a/tests/ui/lazy-type-alias-impl-trait/recursion3.rs b/tests/ui/lazy-type-alias-impl-trait/recursion3.rs index 0b15484f7ef53..9119f651965f5 100644 --- a/tests/ui/lazy-type-alias-impl-trait/recursion3.rs +++ b/tests/ui/lazy-type-alias-impl-trait/recursion3.rs @@ -1,3 +1,7 @@ +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver +//@[next] check-pass #![feature(type_alias_impl_trait)] type Foo = impl std::fmt::Debug; @@ -7,7 +11,7 @@ fn foo(b: bool) -> Foo { if b { return 42; } - let x: u32 = foo(false) + 42; //~ ERROR cannot add + let x: u32 = foo(false) + 42; //[current]~ ERROR cannot add 99 } @@ -15,7 +19,7 @@ fn bar(b: bool) -> impl std::fmt::Debug { if b { return 42; } - let x: u32 = bar(false) + 42; //~ ERROR cannot add + let x: u32 = bar(false) + 42; //[current]~ ERROR cannot add 99 } diff --git a/tests/ui/lifetimes/conflicting-bounds.stderr b/tests/ui/lifetimes/conflicting-bounds.current.stderr similarity index 91% rename from tests/ui/lifetimes/conflicting-bounds.stderr rename to tests/ui/lifetimes/conflicting-bounds.current.stderr index cd66eb5e3fea6..887850b1db711 100644 --- a/tests/ui/lifetimes/conflicting-bounds.stderr +++ b/tests/ui/lifetimes/conflicting-bounds.current.stderr @@ -1,7 +1,7 @@ error[E0283]: type annotations needed: cannot satisfy `Self: Gen<'source>` | note: multiple `impl`s or `where` clauses satisfying `Self: Gen<'source>` found - --> $DIR/conflicting-bounds.rs:3:1 + --> $DIR/conflicting-bounds.rs:13:1 | LL | pub trait Gen<'source> { | ^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/lifetimes/conflicting-bounds.rs b/tests/ui/lifetimes/conflicting-bounds.rs index 62240792afd76..7409c5f593e78 100644 --- a/tests/ui/lifetimes/conflicting-bounds.rs +++ b/tests/ui/lifetimes/conflicting-bounds.rs @@ -1,4 +1,14 @@ -//~ ERROR type annotations needed: cannot satisfy `Self: Gen<'source>` +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver +//@[next] check-pass +//[current]~^^^^ ERROR type annotations needed: cannot satisfy `Self: Gen<'source>` + +// This previously failed with ambiguity in the old solver and +// was added as a diagnostics test in #105285. The new solver +// is now able to uniquely chose one of the `ParamEnv` candidates +// as it does not result in any region constraints, causing this +// test to pass. pub trait Gen<'source> { type Output; diff --git a/tests/ui/marker_trait_attr/overlap-marker-trait-with-static-lifetime.stderr b/tests/ui/marker_trait_attr/overlap-marker-trait-with-static-lifetime.current.stderr similarity index 77% rename from tests/ui/marker_trait_attr/overlap-marker-trait-with-static-lifetime.stderr rename to tests/ui/marker_trait_attr/overlap-marker-trait-with-static-lifetime.current.stderr index fe4de540b513a..de37ee0744aec 100644 --- a/tests/ui/marker_trait_attr/overlap-marker-trait-with-static-lifetime.stderr +++ b/tests/ui/marker_trait_attr/overlap-marker-trait-with-static-lifetime.current.stderr @@ -1,11 +1,11 @@ error[E0283]: type annotations needed: cannot satisfy `&'static (): Marker` - --> $DIR/overlap-marker-trait-with-static-lifetime.rs:11:17 + --> $DIR/overlap-marker-trait-with-static-lifetime.rs:16:17 | LL | impl Marker for &'static () {} | ^^^^^^^^^^^ | note: multiple `impl`s satisfying `&'static (): Marker` found - --> $DIR/overlap-marker-trait-with-static-lifetime.rs:11:1 + --> $DIR/overlap-marker-trait-with-static-lifetime.rs:16:1 | LL | impl Marker for &'static () {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -13,13 +13,13 @@ LL | impl Marker for &'static () {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0283]: type annotations needed: cannot satisfy `&'static (): Marker` - --> $DIR/overlap-marker-trait-with-static-lifetime.rs:12:17 + --> $DIR/overlap-marker-trait-with-static-lifetime.rs:17:17 | LL | impl Marker for &'static () {} | ^^^^^^^^^^^ | note: multiple `impl`s satisfying `&'static (): Marker` found - --> $DIR/overlap-marker-trait-with-static-lifetime.rs:11:1 + --> $DIR/overlap-marker-trait-with-static-lifetime.rs:16:1 | LL | impl Marker for &'static () {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/marker_trait_attr/overlap-marker-trait-with-static-lifetime.rs b/tests/ui/marker_trait_attr/overlap-marker-trait-with-static-lifetime.rs index 84297de364bb7..8c82f4e00d535 100644 --- a/tests/ui/marker_trait_attr/overlap-marker-trait-with-static-lifetime.rs +++ b/tests/ui/marker_trait_attr/overlap-marker-trait-with-static-lifetime.rs @@ -1,4 +1,9 @@ -//@ known-bug: #89515 +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver +//@[next] check-pass + +//@[current] known-bug: #89515 // // The trait solver cannot deal with ambiguous marker trait impls // if there are lifetimes involved. As we must not special-case any diff --git a/tests/ui/marker_trait_attr/overlap-marker-trait-with-underscore-lifetime.stderr b/tests/ui/marker_trait_attr/overlap-marker-trait-with-underscore-lifetime.current.stderr similarity index 74% rename from tests/ui/marker_trait_attr/overlap-marker-trait-with-underscore-lifetime.stderr rename to tests/ui/marker_trait_attr/overlap-marker-trait-with-underscore-lifetime.current.stderr index 3cd59d6926eb4..0eee44be3631f 100644 --- a/tests/ui/marker_trait_attr/overlap-marker-trait-with-underscore-lifetime.stderr +++ b/tests/ui/marker_trait_attr/overlap-marker-trait-with-underscore-lifetime.current.stderr @@ -1,11 +1,11 @@ error[E0283]: type annotations needed: cannot satisfy `&(): Marker` - --> $DIR/overlap-marker-trait-with-underscore-lifetime.rs:6:17 + --> $DIR/overlap-marker-trait-with-underscore-lifetime.rs:11:17 | LL | impl Marker for &'_ () {} | ^^^^^^ | note: multiple `impl`s satisfying `&(): Marker` found - --> $DIR/overlap-marker-trait-with-underscore-lifetime.rs:6:1 + --> $DIR/overlap-marker-trait-with-underscore-lifetime.rs:11:1 | LL | impl Marker for &'_ () {} | ^^^^^^^^^^^^^^^^^^^^^^ @@ -13,13 +13,13 @@ LL | impl Marker for &'_ () {} | ^^^^^^^^^^^^^^^^^^^^^^ error[E0283]: type annotations needed: cannot satisfy `&(): Marker` - --> $DIR/overlap-marker-trait-with-underscore-lifetime.rs:7:17 + --> $DIR/overlap-marker-trait-with-underscore-lifetime.rs:12:17 | LL | impl Marker for &'_ () {} | ^^^^^^ | note: multiple `impl`s satisfying `&(): Marker` found - --> $DIR/overlap-marker-trait-with-underscore-lifetime.rs:6:1 + --> $DIR/overlap-marker-trait-with-underscore-lifetime.rs:11:1 | LL | impl Marker for &'_ () {} | ^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/marker_trait_attr/overlap-marker-trait-with-underscore-lifetime.rs b/tests/ui/marker_trait_attr/overlap-marker-trait-with-underscore-lifetime.rs index eabce1aeff140..486c93456fe66 100644 --- a/tests/ui/marker_trait_attr/overlap-marker-trait-with-underscore-lifetime.rs +++ b/tests/ui/marker_trait_attr/overlap-marker-trait-with-underscore-lifetime.rs @@ -1,9 +1,14 @@ +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver +//@[next] check-pass + #![feature(marker_trait_attr)] #[marker] trait Marker {} -impl Marker for &'_ () {} //~ ERROR type annotations needed -impl Marker for &'_ () {} //~ ERROR type annotations needed +impl Marker for &'_ () {} //[current]~ ERROR type annotations needed +impl Marker for &'_ () {} //[current]~ ERROR type annotations needed fn main() {} diff --git a/tests/ui/proc-macro/auxiliary/derive-unstable.rs b/tests/ui/proc-macro/auxiliary/derive-unstable.rs index 8ba3a06e3549e..c7e34db900042 100644 --- a/tests/ui/proc-macro/auxiliary/derive-unstable.rs +++ b/tests/ui/proc-macro/auxiliary/derive-unstable.rs @@ -4,6 +4,5 @@ use proc_macro::TokenStream; #[proc_macro_derive(Unstable)] pub fn derive(_input: TokenStream) -> TokenStream { - - "unsafe fn foo() -> u32 { ::std::intrinsics::abort() }".parse().unwrap() + "unsafe fn foo() -> u32 { ::std::intrinsics::abort_immediate() }".parse().unwrap() } diff --git a/tests/ui/process/signal-exit-status.rs b/tests/ui/process/signal-exit-status.rs index 33aa83abfc377..1a7836b171a81 100644 --- a/tests/ui/process/signal-exit-status.rs +++ b/tests/ui/process/signal-exit-status.rs @@ -12,7 +12,7 @@ pub fn main() { let args: Vec = env::args().collect(); if args.len() >= 2 && args[1] == "signal" { // Raise an aborting signal without UB - core::intrinsics::abort(); + core::intrinsics::abort_immediate(); } else { let status = Command::new(&args[0]).arg("signal").status().unwrap(); assert!(status.code().is_none()); diff --git a/tests/ui/sized-hierarchy/pretty-print-opaque-no-feat.rs b/tests/ui/sized-hierarchy/pretty-print-opaque-no-feat.rs index 955108a20744b..ae6bbacb4da9e 100644 --- a/tests/ui/sized-hierarchy/pretty-print-opaque-no-feat.rs +++ b/tests/ui/sized-hierarchy/pretty-print-opaque-no-feat.rs @@ -1,13 +1,12 @@ -//@ compile-flags: --crate-type=lib - pub trait Tr {} impl Tr for u32 {} pub fn foo() -> Box { - if true { - let x = foo(); - let y: Box = x; -//~^ ERROR: the size for values of type `impl Tr + ?Sized` cannot be known - } Box::new(1u32) } + +fn main() { + let _: Box = foo(); + //~^ ERROR: the size for values of type `impl Tr + ?Sized` cannot be known + +} diff --git a/tests/ui/sized-hierarchy/pretty-print-opaque-no-feat.stderr b/tests/ui/sized-hierarchy/pretty-print-opaque-no-feat.stderr index bbe19870937ee..532d133b78580 100644 --- a/tests/ui/sized-hierarchy/pretty-print-opaque-no-feat.stderr +++ b/tests/ui/sized-hierarchy/pretty-print-opaque-no-feat.stderr @@ -1,8 +1,8 @@ error[E0277]: the size for values of type `impl Tr + ?Sized` cannot be known at compilation time - --> $DIR/pretty-print-opaque-no-feat.rs:9:30 + --> $DIR/pretty-print-opaque-no-feat.rs:9:26 | -LL | let y: Box = x; - | ^ doesn't have a size known at compile-time +LL | let _: Box = foo(); + | ^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `impl Tr + ?Sized` = note: required for the cast from `Box` to `Box` diff --git a/tests/ui/type-alias-impl-trait/defined-in-closure-external-lifetime.stderr b/tests/ui/type-alias-impl-trait/defined-in-closure-external-lifetime.current.stderr similarity index 86% rename from tests/ui/type-alias-impl-trait/defined-in-closure-external-lifetime.stderr rename to tests/ui/type-alias-impl-trait/defined-in-closure-external-lifetime.current.stderr index 2210291d37b5a..f43fe9490644d 100644 --- a/tests/ui/type-alias-impl-trait/defined-in-closure-external-lifetime.stderr +++ b/tests/ui/type-alias-impl-trait/defined-in-closure-external-lifetime.current.stderr @@ -1,5 +1,5 @@ error[E0792]: expected generic lifetime parameter, found `'_` - --> $DIR/defined-in-closure-external-lifetime.rs:7:29 + --> $DIR/defined-in-closure-external-lifetime.rs:10:29 | LL | type Opaque<'x> = impl Sized + 'x; | -- this generic parameter must be used with a generic lifetime parameter @@ -8,7 +8,7 @@ LL | let _ = || { let _: Opaque<'s> = (); }; | ^^^^^^^^^^ error[E0792]: expected generic lifetime parameter, found `'_` - --> $DIR/defined-in-closure-external-lifetime.rs:16:34 + --> $DIR/defined-in-closure-external-lifetime.rs:20:34 | LL | type Opaque<'x> = impl Sized + 'x; | -- this generic parameter must be used with a generic lifetime parameter diff --git a/tests/ui/type-alias-impl-trait/defined-in-closure-external-lifetime.next.stderr b/tests/ui/type-alias-impl-trait/defined-in-closure-external-lifetime.next.stderr new file mode 100644 index 0000000000000..9d9437c6b8c27 --- /dev/null +++ b/tests/ui/type-alias-impl-trait/defined-in-closure-external-lifetime.next.stderr @@ -0,0 +1,14 @@ +error: non-defining use of `case1::Opaque<'_>` in the defining scope + --> $DIR/defined-in-closure-external-lifetime.rs:10:29 + | +LL | let _ = || { let _: Opaque<'s> = (); }; + | ^^^^^^^^^^ + +error: non-defining use of `case2::Opaque<'_>` in the defining scope + --> $DIR/defined-in-closure-external-lifetime.rs:20:23 + | +LL | let _ = || -> Opaque<'s> {}; + | ^^^^^^^^^^ + +error: aborting due to 2 previous errors + diff --git a/tests/ui/type-alias-impl-trait/defined-in-closure-external-lifetime.rs b/tests/ui/type-alias-impl-trait/defined-in-closure-external-lifetime.rs index bc3904eb4e5fe..3b6e62f91d78c 100644 --- a/tests/ui/type-alias-impl-trait/defined-in-closure-external-lifetime.rs +++ b/tests/ui/type-alias-impl-trait/defined-in-closure-external-lifetime.rs @@ -1,20 +1,25 @@ +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver #![feature(type_alias_impl_trait)] mod case1 { type Opaque<'x> = impl Sized + 'x; #[define_opaque(Opaque)] - fn foo<'s>() -> Opaque<'s> { + fn foo<'s>() { let _ = || { let _: Opaque<'s> = (); }; - //~^ ERROR expected generic lifetime parameter, found `'_` + //[current]~^ ERROR expected generic lifetime parameter, found `'_` + //[next]~^^ ERROR non-defining use of `case1::Opaque<'_>` in the defining scope } } mod case2 { type Opaque<'x> = impl Sized + 'x; #[define_opaque(Opaque)] - fn foo<'s>() -> Opaque<'s> { + fn foo<'s>() { let _ = || -> Opaque<'s> {}; - //~^ ERROR expected generic lifetime parameter, found `'_` + //[current]~^ ERROR expected generic lifetime parameter, found `'_` + //[next]~^^ ERROR non-defining use of `case2::Opaque<'_>` in the defining scope } } diff --git a/tests/ui/type-alias-impl-trait/generic-not-strictly-equal.basic.stderr b/tests/ui/type-alias-impl-trait/generic-not-strictly-equal.basic.stderr index 43e887f36c5fe..1f30bb83da9ae 100644 --- a/tests/ui/type-alias-impl-trait/generic-not-strictly-equal.basic.stderr +++ b/tests/ui/type-alias-impl-trait/generic-not-strictly-equal.basic.stderr @@ -1,5 +1,5 @@ error[E0792]: expected generic lifetime parameter, found `'_` - --> $DIR/generic-not-strictly-equal.rs:34:5 + --> $DIR/generic-not-strictly-equal.rs:38:5 | LL | type Opaque<'a> = impl Copy + Captures<'a>; | -- this generic parameter must be used with a generic lifetime parameter diff --git a/tests/ui/type-alias-impl-trait/generic-not-strictly-equal.member_constraints.stderr b/tests/ui/type-alias-impl-trait/generic-not-strictly-equal.member_constraints.stderr index 43e887f36c5fe..1f30bb83da9ae 100644 --- a/tests/ui/type-alias-impl-trait/generic-not-strictly-equal.member_constraints.stderr +++ b/tests/ui/type-alias-impl-trait/generic-not-strictly-equal.member_constraints.stderr @@ -1,5 +1,5 @@ error[E0792]: expected generic lifetime parameter, found `'_` - --> $DIR/generic-not-strictly-equal.rs:34:5 + --> $DIR/generic-not-strictly-equal.rs:38:5 | LL | type Opaque<'a> = impl Copy + Captures<'a>; | -- this generic parameter must be used with a generic lifetime parameter diff --git a/tests/ui/type-alias-impl-trait/generic-not-strictly-equal.next_basic.stderr b/tests/ui/type-alias-impl-trait/generic-not-strictly-equal.next_basic.stderr new file mode 100644 index 0000000000000..686c8a85d0009 --- /dev/null +++ b/tests/ui/type-alias-impl-trait/generic-not-strictly-equal.next_basic.stderr @@ -0,0 +1,8 @@ +error: non-defining use of `Opaque<'_>` in the defining scope + --> $DIR/generic-not-strictly-equal.rs:28:18 + | +LL | let opaque = None::>; // let's call this lifetime '?1 + | ^^^^^^^^^^^^^^^^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/type-alias-impl-trait/generic-not-strictly-equal.next_member_constraints.stderr b/tests/ui/type-alias-impl-trait/generic-not-strictly-equal.next_member_constraints.stderr new file mode 100644 index 0000000000000..686c8a85d0009 --- /dev/null +++ b/tests/ui/type-alias-impl-trait/generic-not-strictly-equal.next_member_constraints.stderr @@ -0,0 +1,8 @@ +error: non-defining use of `Opaque<'_>` in the defining scope + --> $DIR/generic-not-strictly-equal.rs:28:18 + | +LL | let opaque = None::>; // let's call this lifetime '?1 + | ^^^^^^^^^^^^^^^^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/type-alias-impl-trait/generic-not-strictly-equal.rs b/tests/ui/type-alias-impl-trait/generic-not-strictly-equal.rs index 42f363d0e575b..e65eacbdcaa64 100644 --- a/tests/ui/type-alias-impl-trait/generic-not-strictly-equal.rs +++ b/tests/ui/type-alias-impl-trait/generic-not-strictly-equal.rs @@ -9,7 +9,10 @@ // // See #113971 for details. -//@ revisions: basic member_constraints +//@ revisions: basic member_constraints next_basic next_member_constraints +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next_basic] compile-flags: -Znext-solver +//@[next_member_constraints] compile-flags: -Znext-solver #![feature(type_alias_impl_trait)] trait Captures<'a> {} @@ -21,18 +24,19 @@ fn relate(_: X, _: X) {} type Opaque<'a> = impl Copy + Captures<'a>; #[define_opaque(Opaque)] -fn test<'x>(_: Opaque<'x>) { +fn test<'x>() { let opaque = None::>; // let's call this lifetime '?1 + //[next_basic,next_member_constraints]~^ ERROR: non-defining use of `Opaque<'_>` in the defining scope - #[cfg(basic)] + #[cfg(any(basic, next_basic))] let hidden = None::; - #[cfg(member_constraints)] + #[cfg(any(member_constraints, next_member_constraints))] let hidden = None::<&'x u8>; ensure_outlives::<'x>(opaque); // outlives constraint: '?1: 'x relate(opaque, hidden); // defining use: Opaque<'?1> := u8 - //~^ ERROR expected generic lifetime parameter, found `'_` + //[basic,member_constraints]~^ ERROR expected generic lifetime parameter, found `'_` } fn main() {} diff --git a/tests/ui/type-alias-impl-trait/impl_trait_for_tait_bound.stderr b/tests/ui/type-alias-impl-trait/impl_trait_for_tait_bound.current.stderr similarity index 78% rename from tests/ui/type-alias-impl-trait/impl_trait_for_tait_bound.stderr rename to tests/ui/type-alias-impl-trait/impl_trait_for_tait_bound.current.stderr index ee20c5e1c9b6d..31b9f179f8971 100644 --- a/tests/ui/type-alias-impl-trait/impl_trait_for_tait_bound.stderr +++ b/tests/ui/type-alias-impl-trait/impl_trait_for_tait_bound.current.stderr @@ -1,16 +1,16 @@ error[E0277]: the trait bound `u32: Yay` is not satisfied - --> $DIR/impl_trait_for_tait_bound.rs:11:14 + --> $DIR/impl_trait_for_tait_bound.rs:15:14 | LL | is_yay::(); | ^^^ the trait `Yay` is not implemented for `u32` | help: the trait `Yay` is implemented for `Foo` - --> $DIR/impl_trait_for_tait_bound.rs:7:1 + --> $DIR/impl_trait_for_tait_bound.rs:11:1 | LL | impl Yay for Foo {} | ^^^^^^^^^^^^^^^^ note: required by a bound in `is_yay` - --> $DIR/impl_trait_for_tait_bound.rs:17:14 + --> $DIR/impl_trait_for_tait_bound.rs:21:14 | LL | fn is_yay() {} | ^^^ required by this bound in `is_yay` diff --git a/tests/ui/type-alias-impl-trait/impl_trait_for_tait_bound.rs b/tests/ui/type-alias-impl-trait/impl_trait_for_tait_bound.rs index e0045df08ec7c..6860fc4132d89 100644 --- a/tests/ui/type-alias-impl-trait/impl_trait_for_tait_bound.rs +++ b/tests/ui/type-alias-impl-trait/impl_trait_for_tait_bound.rs @@ -1,3 +1,7 @@ +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver +//@[next] check-pass #![feature(type_alias_impl_trait)] use std::fmt::Debug; @@ -8,7 +12,7 @@ impl Yay for Foo {} #[define_opaque(Foo)] fn foo() { - is_yay::(); //~ ERROR: the trait bound `u32: Yay` is not satisfied + is_yay::(); //[current]~ ERROR: the trait bound `u32: Yay` is not satisfied is_debug::(); // OK is_yay::(); // OK is_debug::(); // OK diff --git a/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn-infer.rs b/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn-infer.rs deleted file mode 100644 index 839ac47162382..0000000000000 --- a/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn-infer.rs +++ /dev/null @@ -1,15 +0,0 @@ -// https://github.com/rust-lang/rust/issues/73481 -// This test used to cause unsoundness, since one of the two possible -// resolutions was chosen at random instead of erroring due to conflicts. - -#![feature(type_alias_impl_trait)] - -type Y = impl std::fmt::Debug; - -#[define_opaque(Y)] -fn g() -> (Y, Y) { - //~^ ERROR concrete type differs from previous defining opaque type use - (42_i64, 60) -} - -fn main() {} diff --git a/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn-infer.stderr b/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn-int-infer.current.stderr similarity index 86% rename from tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn-infer.stderr rename to tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn-int-infer.current.stderr index e044cbe819e8c..6901fc9257666 100644 --- a/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn-infer.stderr +++ b/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn-int-infer.current.stderr @@ -1,5 +1,5 @@ error: concrete type differs from previous defining opaque type use - --> $DIR/multiple-def-uses-in-one-fn-infer.rs:10:17 + --> $DIR/multiple-def-uses-in-one-fn-int-infer.rs:17:17 | LL | fn g() -> (Y, Y) { | ^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn-int-infer.rs b/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn-int-infer.rs new file mode 100644 index 0000000000000..48a7d73c3519a --- /dev/null +++ b/tests/ui/type-alias-impl-trait/multiple-def-uses-in-one-fn-int-infer.rs @@ -0,0 +1,22 @@ +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver +//@[next] check-pass +// https://github.com/rust-lang/rust/issues/73481 + +// This test previously compiled due to an unsoundness as `Y` +// was incorrectly inferred to be `i32`. The new solver now treats +// `Y` as a defining use and uses it to constrain `Y` to +// `i64` as well. + +#![feature(type_alias_impl_trait)] + +type Y = impl std::fmt::Debug; + +#[define_opaque(Y)] +fn g() -> (Y, Y) { + //[current]~^ ERROR concrete type differs from previous defining opaque type use + (42_i64, 60) +} + +fn main() {} diff --git a/tests/ui/type-alias-impl-trait/param_mismatch4.stderr b/tests/ui/type-alias-impl-trait/param_mismatch4.current.stderr similarity index 90% rename from tests/ui/type-alias-impl-trait/param_mismatch4.stderr rename to tests/ui/type-alias-impl-trait/param_mismatch4.current.stderr index 647637ae32a7c..d1822fcdeb2f5 100644 --- a/tests/ui/type-alias-impl-trait/param_mismatch4.stderr +++ b/tests/ui/type-alias-impl-trait/param_mismatch4.current.stderr @@ -1,5 +1,5 @@ error[E0792]: expected generic lifetime parameter, found `'_` - --> $DIR/param_mismatch4.rs:13:12 + --> $DIR/param_mismatch4.rs:17:12 | LL | type Opq<'a> = impl Sized; | -- this generic parameter must be used with a generic lifetime parameter diff --git a/tests/ui/type-alias-impl-trait/param_mismatch4.rs b/tests/ui/type-alias-impl-trait/param_mismatch4.rs index bc32143d0eb1d..d671bccb1e13b 100644 --- a/tests/ui/type-alias-impl-trait/param_mismatch4.rs +++ b/tests/ui/type-alias-impl-trait/param_mismatch4.rs @@ -1,3 +1,7 @@ +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver +//@[next] check-pass //! This test checks that when checking for opaque types that //! only differ in lifetimes, we handle the case of non-generic //! regions correctly. @@ -11,7 +15,7 @@ type Opq<'a> = impl Sized; #[define_opaque(Opq)] fn build<'a>() -> Opq<'a> { let _: Opq<'_> = (); - //~^ ERROR expected generic lifetime parameter, found `'_` + //[current]~^ ERROR expected generic lifetime parameter, found `'_` } fn main() {} diff --git a/tests/ui/type-alias-impl-trait/reveal_local.stderr b/tests/ui/type-alias-impl-trait/reveal_local.current.stderr similarity index 86% rename from tests/ui/type-alias-impl-trait/reveal_local.stderr rename to tests/ui/type-alias-impl-trait/reveal_local.current.stderr index bd0828885910b..bc01bcd4cfd17 100644 --- a/tests/ui/type-alias-impl-trait/reveal_local.stderr +++ b/tests/ui/type-alias-impl-trait/reveal_local.current.stderr @@ -1,12 +1,12 @@ error[E0283]: type annotations needed: cannot satisfy `Foo: Send` - --> $DIR/reveal_local.rs:23:15 + --> $DIR/reveal_local.rs:27:15 | LL | is_send::(); | ^^^ | = note: cannot satisfy `Foo: Send` note: required by a bound in `is_send` - --> $DIR/reveal_local.rs:7:15 + --> $DIR/reveal_local.rs:11:15 | LL | fn is_send() {} | ^^^^ required by this bound in `is_send` diff --git a/tests/ui/type-alias-impl-trait/reveal_local.rs b/tests/ui/type-alias-impl-trait/reveal_local.rs index 1e1e118937b2b..30b5412392e6f 100644 --- a/tests/ui/type-alias-impl-trait/reveal_local.rs +++ b/tests/ui/type-alias-impl-trait/reveal_local.rs @@ -1,3 +1,7 @@ +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver +//@[next] check-pass #![feature(type_alias_impl_trait)] use std::fmt::Debug; @@ -21,7 +25,7 @@ fn not_gooder() -> Foo { // while we could know this from the hidden type, it would // need extra roundabout logic to support it. is_send::(); - //~^ ERROR: type annotations needed: cannot satisfy `Foo: Send` + //[current]~^ ERROR: type annotations needed: cannot satisfy `Foo: Send` x } diff --git a/tests/ui/type-alias-impl-trait/taint.stderr b/tests/ui/type-alias-impl-trait/taint-polymorphization-ice.current.stderr similarity index 88% rename from tests/ui/type-alias-impl-trait/taint.stderr rename to tests/ui/type-alias-impl-trait/taint-polymorphization-ice.current.stderr index e2e34a5d1ba4b..22930611649c5 100644 --- a/tests/ui/type-alias-impl-trait/taint.stderr +++ b/tests/ui/type-alias-impl-trait/taint-polymorphization-ice.current.stderr @@ -1,5 +1,5 @@ error[E0792]: expected generic lifetime parameter, found `'_` - --> $DIR/taint.rs:14:17 + --> $DIR/taint-polymorphization-ice.rs:19:17 | LL | type Two<'a, 'b> = impl std::fmt::Debug; | -- this generic parameter must be used with a generic lifetime parameter diff --git a/tests/ui/type-alias-impl-trait/taint-polymorphization-ice.rs b/tests/ui/type-alias-impl-trait/taint-polymorphization-ice.rs new file mode 100644 index 0000000000000..bcdde44ecb724 --- /dev/null +++ b/tests/ui/type-alias-impl-trait/taint-polymorphization-ice.rs @@ -0,0 +1,23 @@ +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver +//@[next] check-pass +//@ compile-flags: -Zvalidate-mir -Zinline-mir=yes + +// reported as rust-lang/rust#126896. This originally ICE'd +// with polymorphization. + +#![feature(type_alias_impl_trait)] +type Two<'a, 'b> = impl std::fmt::Debug; + +fn set(x: &mut isize) -> isize { + *x +} + +#[define_opaque(Two)] +fn d(x: Two) { + let c1 = || set(x); //[current]~ ERROR: expected generic lifetime parameter, found `'_` + c1; +} + +fn main() {} diff --git a/tests/ui/type-alias-impl-trait/taint.rs b/tests/ui/type-alias-impl-trait/taint.rs deleted file mode 100644 index 3d67c9bca4162..0000000000000 --- a/tests/ui/type-alias-impl-trait/taint.rs +++ /dev/null @@ -1,18 +0,0 @@ -//@ compile-flags: -Zvalidate-mir -Zinline-mir=yes - -// reported as rust-lang/rust#126896 - -#![feature(type_alias_impl_trait)] -type Two<'a, 'b> = impl std::fmt::Debug; - -fn set(x: &mut isize) -> isize { - *x -} - -#[define_opaque(Two)] -fn d(x: Two) { - let c1 = || set(x); //~ ERROR: expected generic lifetime parameter, found `'_` - c1; -} - -fn main() {}