diff options
Diffstat (limited to 'tests')
155 files changed, 1587 insertions, 1194 deletions
diff --git a/tests/assembly/x86_64-cmp.rs b/tests/assembly/x86_64-cmp.rs new file mode 100644 index 00000000000..31efdda1bfa --- /dev/null +++ b/tests/assembly/x86_64-cmp.rs @@ -0,0 +1,51 @@ +//@ revisions: DEBUG OPTIM +//@ [DEBUG] compile-flags: -C opt-level=0 +//@ [OPTIM] compile-flags: -C opt-level=3 +//@ assembly-output: emit-asm +//@ compile-flags: --crate-type=lib -C llvm-args=-x86-asm-syntax=intel +//@ only-x86_64 +//@ ignore-sgx + +#![feature(core_intrinsics)] + +use std::intrinsics::three_way_compare; + +#[no_mangle] +// CHECK-LABEL: signed_cmp: +pub fn signed_cmp(a: i16, b: i16) -> std::cmp::Ordering { + // DEBUG: cmp + // DEBUG: setg + // DEBUG: and + // DEBUG: cmp + // DEBUG: setl + // DEBUG: and + // DEBUG: sub + + // OPTIM: xor + // OPTIM: cmp + // OPTIM: setne + // OPTIM: mov + // OPTIM: cmovge + // OPTIM: ret + three_way_compare(a, b) +} + +#[no_mangle] +// CHECK-LABEL: unsigned_cmp: +pub fn unsigned_cmp(a: u16, b: u16) -> std::cmp::Ordering { + // DEBUG: cmp + // DEBUG: seta + // DEBUG: and + // DEBUG: cmp + // DEBUG: setb + // DEBUG: and + // DEBUG: sub + + // OPTIM: xor + // OPTIM: cmp + // OPTIM: setne + // OPTIM: mov + // OPTIM: cmovae + // OPTIM: ret + three_way_compare(a, b) +} diff --git a/tests/codegen/intrinsics/three_way_compare.rs b/tests/codegen/intrinsics/three_way_compare.rs new file mode 100644 index 00000000000..f3b631abc22 --- /dev/null +++ b/tests/codegen/intrinsics/three_way_compare.rs @@ -0,0 +1,47 @@ +//@ revisions: DEBUG OPTIM +//@ [DEBUG] compile-flags: -C opt-level=0 +//@ [OPTIM] compile-flags: -C opt-level=3 +//@ compile-flags: -C no-prepopulate-passes + +#![crate_type = "lib"] +#![feature(core_intrinsics)] + +use std::intrinsics::three_way_compare; + +#[no_mangle] +// CHECK-LABEL: @signed_cmp +// DEBUG-SAME: (i16 %a, i16 %b) +// OPTIM-SAME: (i16 noundef %a, i16 noundef %b) +pub fn signed_cmp(a: i16, b: i16) -> std::cmp::Ordering { + // DEBUG: %[[GT:.+]] = icmp sgt i16 %a, %b + // DEBUG: %[[ZGT:.+]] = zext i1 %[[GT]] to i8 + // DEBUG: %[[LT:.+]] = icmp slt i16 %a, %b + // DEBUG: %[[ZLT:.+]] = zext i1 %[[LT]] to i8 + // DEBUG: %[[R:.+]] = sub nsw i8 %[[ZGT]], %[[ZLT]] + + // OPTIM: %[[LT:.+]] = icmp slt i16 %a, %b + // OPTIM: %[[NE:.+]] = icmp ne i16 %a, %b + // OPTIM: %[[CGE:.+]] = select i1 %[[NE]], i8 1, i8 0 + // OPTIM: %[[CGEL:.+]] = select i1 %[[LT]], i8 -1, i8 %[[CGE]] + // OPTIM: ret i8 %[[CGEL]] + three_way_compare(a, b) +} + +#[no_mangle] +// CHECK-LABEL: @unsigned_cmp +// DEBUG-SAME: (i16 %a, i16 %b) +// OPTIM-SAME: (i16 noundef %a, i16 noundef %b) +pub fn unsigned_cmp(a: u16, b: u16) -> std::cmp::Ordering { + // DEBUG: %[[GT:.+]] = icmp ugt i16 %a, %b + // DEBUG: %[[ZGT:.+]] = zext i1 %[[GT]] to i8 + // DEBUG: %[[LT:.+]] = icmp ult i16 %a, %b + // DEBUG: %[[ZLT:.+]] = zext i1 %[[LT]] to i8 + // DEBUG: %[[R:.+]] = sub nsw i8 %[[ZGT]], %[[ZLT]] + + // OPTIM: %[[LT:.+]] = icmp ult i16 %a, %b + // OPTIM: %[[NE:.+]] = icmp ne i16 %a, %b + // OPTIM: %[[CGE:.+]] = select i1 %[[NE]], i8 1, i8 0 + // OPTIM: %[[CGEL:.+]] = select i1 %[[LT]], i8 -1, i8 %[[CGE]] + // OPTIM: ret i8 %[[CGEL]] + three_way_compare(a, b) +} diff --git a/tests/codegen/unchecked_shifts.rs b/tests/codegen/unchecked_shifts.rs index 9cf2f2b0cb6..7d020fbb4d2 100644 --- a/tests/codegen/unchecked_shifts.rs +++ b/tests/codegen/unchecked_shifts.rs @@ -2,6 +2,7 @@ #![crate_type = "lib"] #![feature(unchecked_shifts)] +#![feature(core_intrinsics)] // CHECK-LABEL: @unchecked_shl_unsigned_same #[no_mangle] @@ -19,7 +20,7 @@ pub unsafe fn unchecked_shl_unsigned_smaller(a: u16, b: u32) -> u16 { // This uses -DAG to avoid failing on irrelevant reorderings, // like emitting the truncation earlier. - // CHECK-DAG: %[[INRANGE:.+]] = icmp ult i32 %b, 65536 + // CHECK-DAG: %[[INRANGE:.+]] = icmp ult i32 %b, 16 // CHECK-DAG: tail call void @llvm.assume(i1 %[[INRANGE]]) // CHECK-DAG: %[[TRUNC:.+]] = trunc i32 %b to i16 // CHECK-DAG: shl i16 %a, %[[TRUNC]] @@ -51,7 +52,7 @@ pub unsafe fn unchecked_shr_signed_smaller(a: i16, b: u32) -> i16 { // This uses -DAG to avoid failing on irrelevant reorderings, // like emitting the truncation earlier. - // CHECK-DAG: %[[INRANGE:.+]] = icmp ult i32 %b, 32768 + // CHECK-DAG: %[[INRANGE:.+]] = icmp ult i32 %b, 16 // CHECK-DAG: tail call void @llvm.assume(i1 %[[INRANGE]]) // CHECK-DAG: %[[TRUNC:.+]] = trunc i32 %b to i16 // CHECK-DAG: ashr i16 %a, %[[TRUNC]] @@ -66,3 +67,47 @@ pub unsafe fn unchecked_shr_signed_bigger(a: i64, b: u32) -> i64 { // CHECK: ashr i64 %a, %[[EXT]] a.unchecked_shr(b) } + +// CHECK-LABEL: @unchecked_shr_u128_i8 +#[no_mangle] +pub unsafe fn unchecked_shr_u128_i8(a: u128, b: i8) -> u128 { + // CHECK-NOT: assume + // CHECK: %[[EXT:.+]] = zext{{( nneg)?}} i8 %b to i128 + // CHECK: lshr i128 %a, %[[EXT]] + std::intrinsics::unchecked_shr(a, b) +} + +// CHECK-LABEL: @unchecked_shl_i128_u8 +#[no_mangle] +pub unsafe fn unchecked_shl_i128_u8(a: i128, b: u8) -> i128 { + // CHECK-NOT: assume + // CHECK: %[[EXT:.+]] = zext{{( nneg)?}} i8 %b to i128 + // CHECK: shl i128 %a, %[[EXT]] + std::intrinsics::unchecked_shl(a, b) +} + +// CHECK-LABEL: @unchecked_shl_u8_i128 +#[no_mangle] +pub unsafe fn unchecked_shl_u8_i128(a: u8, b: i128) -> u8 { + // This uses -DAG to avoid failing on irrelevant reorderings, + // like emitting the truncation earlier. + + // CHECK-DAG: %[[INRANGE:.+]] = icmp ult i128 %b, 8 + // CHECK-DAG: tail call void @llvm.assume(i1 %[[INRANGE]]) + // CHECK-DAG: %[[TRUNC:.+]] = trunc i128 %b to i8 + // CHECK-DAG: shl i8 %a, %[[TRUNC]] + std::intrinsics::unchecked_shl(a, b) +} + +// CHECK-LABEL: @unchecked_shr_i8_u128 +#[no_mangle] +pub unsafe fn unchecked_shr_i8_u128(a: i8, b: u128) -> i8 { + // This uses -DAG to avoid failing on irrelevant reorderings, + // like emitting the truncation earlier. + + // CHECK-DAG: %[[INRANGE:.+]] = icmp ult i128 %b, 8 + // CHECK-DAG: tail call void @llvm.assume(i1 %[[INRANGE]]) + // CHECK-DAG: %[[TRUNC:.+]] = trunc i128 %b to i8 + // CHECK-DAG: ashr i8 %a, %[[TRUNC]] + std::intrinsics::unchecked_shr(a, b) +} diff --git a/tests/incremental/hashes/function_interfaces.rs b/tests/incremental/hashes/function_interfaces.rs index 3be30fab99c..4fa2762099c 100644 --- a/tests/incremental/hashes/function_interfaces.rs +++ b/tests/incremental/hashes/function_interfaces.rs @@ -217,7 +217,7 @@ pub fn second_trait_bound<T: Eq + Clone>() {} pub fn second_builtin_bound<T: Send >() {} #[cfg(not(any(cfail1,cfail4)))] -#[rustc_clean(cfg = "cfail2", except = "opt_hir_owner_nodes, predicates_of")] +#[rustc_clean(cfg = "cfail2", except = "opt_hir_owner_nodes")] #[rustc_clean(cfg = "cfail3")] #[rustc_clean(cfg = "cfail5", except = "opt_hir_owner_nodes, predicates_of")] #[rustc_clean(cfg = "cfail6")] diff --git a/tests/mir-opt/building/custom/as_cast.int_to_ptr.built.after.mir b/tests/mir-opt/building/custom/as_cast.int_to_ptr.built.after.mir index 0dc46d61eff..faff79e8c57 100644 --- a/tests/mir-opt/building/custom/as_cast.int_to_ptr.built.after.mir +++ b/tests/mir-opt/building/custom/as_cast.int_to_ptr.built.after.mir @@ -4,7 +4,7 @@ fn int_to_ptr(_1: usize) -> *const i32 { let mut _0: *const i32; bb0: { - _0 = _1 as *const i32 (PointerFromExposedAddress); + _0 = _1 as *const i32 (PointerWithExposedProvenance); return; } } diff --git a/tests/mir-opt/const_prop/reify_fn_ptr.main.GVN.diff b/tests/mir-opt/const_prop/reify_fn_ptr.main.GVN.diff index cde0cb32f75..2f76e74a3f8 100644 --- a/tests/mir-opt/const_prop/reify_fn_ptr.main.GVN.diff +++ b/tests/mir-opt/const_prop/reify_fn_ptr.main.GVN.diff @@ -16,7 +16,7 @@ _3 = main as fn() (PointerCoercion(ReifyFnPointer)); _2 = move _3 as usize (PointerExposeAddress); StorageDead(_3); - _1 = move _2 as *const fn() (PointerFromExposedAddress); + _1 = move _2 as *const fn() (PointerWithExposedProvenance); StorageDead(_2); StorageDead(_1); _0 = const (); diff --git a/tests/mir-opt/const_prop/reify_fn_ptr.rs b/tests/mir-opt/const_prop/reify_fn_ptr.rs index ad73b084219..4e897d22768 100644 --- a/tests/mir-opt/const_prop/reify_fn_ptr.rs +++ b/tests/mir-opt/const_prop/reify_fn_ptr.rs @@ -5,6 +5,6 @@ fn main() { // CHECK-LABEL: fn main( // CHECK: [[ptr:_.*]] = main as fn() (PointerCoercion(ReifyFnPointer)); // CHECK: [[addr:_.*]] = move [[ptr]] as usize (PointerExposeAddress); - // CHECK: [[back:_.*]] = move [[addr]] as *const fn() (PointerFromExposedAddress); + // CHECK: [[back:_.*]] = move [[addr]] as *const fn() (PointerWithExposedProvenance); let _ = main as usize as *const fn(); } diff --git a/tests/mir-opt/inline/unchecked_shifts.rs b/tests/mir-opt/inline/unchecked_shifts.rs index 12b00e76a11..3c4e73bf7ea 100644 --- a/tests/mir-opt/inline/unchecked_shifts.rs +++ b/tests/mir-opt/inline/unchecked_shifts.rs @@ -4,6 +4,9 @@ //@ compile-flags: -Zmir-opt-level=2 -Zinline-mir +// These used to be more interesting when the library had to fix the RHS type. +// After MCP#693, though, that's the backend's problem, not something in MIR. + // EMIT_MIR unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.diff // EMIT_MIR unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.mir pub unsafe fn unchecked_shl_unsigned_smaller(a: u16, b: u32) -> u16 { @@ -12,22 +15,6 @@ pub unsafe fn unchecked_shl_unsigned_smaller(a: u16, b: u32) -> u16 { a.unchecked_shl(b) } -// EMIT_MIR unchecked_shifts.unchecked_shr_signed_smaller.Inline.diff -// EMIT_MIR unchecked_shifts.unchecked_shr_signed_smaller.PreCodegen.after.mir -pub unsafe fn unchecked_shr_signed_smaller(a: i16, b: u32) -> i16 { - // CHECK-LABEL: fn unchecked_shr_signed_smaller( - // CHECK: (inlined core::num::<impl i16>::unchecked_shr) - a.unchecked_shr(b) -} - -// EMIT_MIR unchecked_shifts.unchecked_shl_unsigned_bigger.Inline.diff -// EMIT_MIR unchecked_shifts.unchecked_shl_unsigned_bigger.PreCodegen.after.mir -pub unsafe fn unchecked_shl_unsigned_bigger(a: u64, b: u32) -> u64 { - // CHECK-LABEL: fn unchecked_shl_unsigned_bigger( - // CHECK: (inlined core::num::<impl u64>::unchecked_shl) - a.unchecked_shl(b) -} - // EMIT_MIR unchecked_shifts.unchecked_shr_signed_bigger.Inline.diff // EMIT_MIR unchecked_shifts.unchecked_shr_signed_bigger.PreCodegen.after.mir pub unsafe fn unchecked_shr_signed_bigger(a: i64, b: u32) -> i64 { diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_bigger.Inline.panic-abort.diff b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_bigger.Inline.panic-abort.diff deleted file mode 100644 index 1ab1d01e5fa..00000000000 --- a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_bigger.Inline.panic-abort.diff +++ /dev/null @@ -1,36 +0,0 @@ -- // MIR for `unchecked_shl_unsigned_bigger` before Inline -+ // MIR for `unchecked_shl_unsigned_bigger` after Inline - - fn unchecked_shl_unsigned_bigger(_1: u64, _2: u32) -> u64 { - debug a => _1; - debug b => _2; - let mut _0: u64; - let mut _3: u64; - let mut _4: u32; -+ scope 1 (inlined core::num::<impl u64>::unchecked_shl) { -+ debug self => _3; -+ debug rhs => _4; -+ let mut _5: u64; -+ scope 2 { -+ } -+ } - - bb0: { - StorageLive(_3); - _3 = _1; - StorageLive(_4); - _4 = _2; -- _0 = core::num::<impl u64>::unchecked_shl(move _3, move _4) -> [return: bb1, unwind unreachable]; -- } -- -- bb1: { -+ StorageLive(_5); -+ _5 = _4 as u64 (IntToInt); -+ _0 = ShlUnchecked(_3, move _5); -+ StorageDead(_5); - StorageDead(_4); - StorageDead(_3); - return; - } - } - diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_bigger.Inline.panic-unwind.diff b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_bigger.Inline.panic-unwind.diff deleted file mode 100644 index d71b5c4a626..00000000000 --- a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_bigger.Inline.panic-unwind.diff +++ /dev/null @@ -1,36 +0,0 @@ -- // MIR for `unchecked_shl_unsigned_bigger` before Inline -+ // MIR for `unchecked_shl_unsigned_bigger` after Inline - - fn unchecked_shl_unsigned_bigger(_1: u64, _2: u32) -> u64 { - debug a => _1; - debug b => _2; - let mut _0: u64; - let mut _3: u64; - let mut _4: u32; -+ scope 1 (inlined core::num::<impl u64>::unchecked_shl) { -+ debug self => _3; -+ debug rhs => _4; -+ let mut _5: u64; -+ scope 2 { -+ } -+ } - - bb0: { - StorageLive(_3); - _3 = _1; - StorageLive(_4); - _4 = _2; -- _0 = core::num::<impl u64>::unchecked_shl(move _3, move _4) -> [return: bb1, unwind continue]; -- } -- -- bb1: { -+ StorageLive(_5); -+ _5 = _4 as u64 (IntToInt); -+ _0 = ShlUnchecked(_3, move _5); -+ StorageDead(_5); - StorageDead(_4); - StorageDead(_3); - return; - } - } - diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_bigger.PreCodegen.after.panic-abort.mir b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_bigger.PreCodegen.after.panic-abort.mir deleted file mode 100644 index 65b832497f9..00000000000 --- a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_bigger.PreCodegen.after.panic-abort.mir +++ /dev/null @@ -1,22 +0,0 @@ -// MIR for `unchecked_shl_unsigned_bigger` after PreCodegen - -fn unchecked_shl_unsigned_bigger(_1: u64, _2: u32) -> u64 { - debug a => _1; - debug b => _2; - let mut _0: u64; - scope 1 (inlined core::num::<impl u64>::unchecked_shl) { - debug self => _1; - debug rhs => _2; - let mut _3: u64; - scope 2 { - } - } - - bb0: { - StorageLive(_3); - _3 = _2 as u64 (IntToInt); - _0 = ShlUnchecked(_1, move _3); - StorageDead(_3); - return; - } -} diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_bigger.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_bigger.PreCodegen.after.panic-unwind.mir deleted file mode 100644 index 65b832497f9..00000000000 --- a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_bigger.PreCodegen.after.panic-unwind.mir +++ /dev/null @@ -1,22 +0,0 @@ -// MIR for `unchecked_shl_unsigned_bigger` after PreCodegen - -fn unchecked_shl_unsigned_bigger(_1: u64, _2: u32) -> u64 { - debug a => _1; - debug b => _2; - let mut _0: u64; - scope 1 (inlined core::num::<impl u64>::unchecked_shl) { - debug self => _1; - debug rhs => _2; - let mut _3: u64; - scope 2 { - } - } - - bb0: { - StorageLive(_3); - _3 = _2 as u64 (IntToInt); - _0 = ShlUnchecked(_1, move _3); - StorageDead(_3); - return; - } -} diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.panic-abort.diff b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.panic-abort.diff index d052219661b..51e506142a9 100644 --- a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.panic-abort.diff +++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.panic-abort.diff @@ -10,8 +10,6 @@ + scope 1 (inlined core::num::<impl u16>::unchecked_shl) { + debug self => _3; + debug rhs => _4; -+ let mut _5: u16; -+ let mut _6: bool; + scope 2 { + } + } @@ -25,14 +23,7 @@ - } - - bb1: { -+ StorageLive(_5); -+ StorageLive(_6); -+ _6 = Le(_4, const 65535_u32); -+ assume(move _6); -+ StorageDead(_6); -+ _5 = _4 as u16 (IntToInt); -+ _0 = ShlUnchecked(_3, move _5); -+ StorageDead(_5); ++ _0 = ShlUnchecked(_3, _4); StorageDead(_4); StorageDead(_3); return; diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.panic-unwind.diff b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.panic-unwind.diff index 67a5ac2483b..053ccc077a4 100644 --- a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.panic-unwind.diff @@ -10,8 +10,6 @@ + scope 1 (inlined core::num::<impl u16>::unchecked_shl) { + debug self => _3; + debug rhs => _4; -+ let mut _5: u16; -+ let mut _6: bool; + scope 2 { + } + } @@ -25,14 +23,7 @@ - } - - bb1: { -+ StorageLive(_5); -+ StorageLive(_6); -+ _6 = Le(_4, const 65535_u32); -+ assume(move _6); -+ StorageDead(_6); -+ _5 = _4 as u16 (IntToInt); -+ _0 = ShlUnchecked(_3, move _5); -+ StorageDead(_5); ++ _0 = ShlUnchecked(_3, _4); StorageDead(_4); StorageDead(_3); return; diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.panic-abort.mir b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.panic-abort.mir index f9dff62e0c8..2be887e9b5a 100644 --- a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.panic-abort.mir @@ -7,21 +7,12 @@ fn unchecked_shl_unsigned_smaller(_1: u16, _2: u32) -> u16 { scope 1 (inlined core::num::<impl u16>::unchecked_shl) { debug self => _1; debug rhs => _2; - let mut _3: bool; - let mut _4: u16; scope 2 { } } bb0: { - StorageLive(_4); - StorageLive(_3); - _3 = Le(_2, const 65535_u32); - assume(move _3); - StorageDead(_3); - _4 = _2 as u16 (IntToInt); - _0 = ShlUnchecked(_1, move _4); - StorageDead(_4); + _0 = ShlUnchecked(_1, _2); return; } } diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.panic-unwind.mir index f9dff62e0c8..2be887e9b5a 100644 --- a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.panic-unwind.mir @@ -7,21 +7,12 @@ fn unchecked_shl_unsigned_smaller(_1: u16, _2: u32) -> u16 { scope 1 (inlined core::num::<impl u16>::unchecked_shl) { debug self => _1; debug rhs => _2; - let mut _3: bool; - let mut _4: u16; scope 2 { } } bb0: { - StorageLive(_4); - StorageLive(_3); - _3 = Le(_2, const 65535_u32); - assume(move _3); - StorageDead(_3); - _4 = _2 as u16 (IntToInt); - _0 = ShlUnchecked(_1, move _4); - StorageDead(_4); + _0 = ShlUnchecked(_1, _2); return; } } diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.Inline.panic-abort.diff b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.Inline.panic-abort.diff index 1e83fec4f3d..816d03b4405 100644 --- a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.Inline.panic-abort.diff +++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.Inline.panic-abort.diff @@ -10,7 +10,6 @@ + scope 1 (inlined core::num::<impl i64>::unchecked_shr) { + debug self => _3; + debug rhs => _4; -+ let mut _5: i64; + scope 2 { + } + } @@ -24,10 +23,7 @@ - } - - bb1: { -+ StorageLive(_5); -+ _5 = _4 as i64 (IntToInt); -+ _0 = ShrUnchecked(_3, move _5); -+ StorageDead(_5); ++ _0 = ShrUnchecked(_3, _4); StorageDead(_4); StorageDead(_3); return; diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.Inline.panic-unwind.diff b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.Inline.panic-unwind.diff index 6aafb61dc55..d4121f89baf 100644 --- a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.Inline.panic-unwind.diff @@ -10,7 +10,6 @@ + scope 1 (inlined core::num::<impl i64>::unchecked_shr) { + debug self => _3; + debug rhs => _4; -+ let mut _5: i64; + scope 2 { + } + } @@ -24,10 +23,7 @@ - } - - bb1: { -+ StorageLive(_5); -+ _5 = _4 as i64 (IntToInt); -+ _0 = ShrUnchecked(_3, move _5); -+ StorageDead(_5); ++ _0 = ShrUnchecked(_3, _4); StorageDead(_4); StorageDead(_3); return; diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.PreCodegen.after.panic-abort.mir b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.PreCodegen.after.panic-abort.mir index 7524ec4970e..4696112175e 100644 --- a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.PreCodegen.after.panic-abort.mir @@ -7,16 +7,12 @@ fn unchecked_shr_signed_bigger(_1: i64, _2: u32) -> i64 { scope 1 (inlined core::num::<impl i64>::unchecked_shr) { debug self => _1; debug rhs => _2; - let mut _3: i64; scope 2 { } } bb0: { - StorageLive(_3); - _3 = _2 as i64 (IntToInt); - _0 = ShrUnchecked(_1, move _3); - StorageDead(_3); + _0 = ShrUnchecked(_1, _2); return; } } diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.PreCodegen.after.panic-unwind.mir index 7524ec4970e..4696112175e 100644 --- a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.PreCodegen.after.panic-unwind.mir @@ -7,16 +7,12 @@ fn unchecked_shr_signed_bigger(_1: i64, _2: u32) -> i64 { scope 1 (inlined core::num::<impl i64>::unchecked_shr) { debug self => _1; debug rhs => _2; - let mut _3: i64; scope 2 { } } bb0: { - StorageLive(_3); - _3 = _2 as i64 (IntToInt); - _0 = ShrUnchecked(_1, move _3); - StorageDead(_3); + _0 = ShrUnchecked(_1, _2); return; } } diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.Inline.panic-abort.diff b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.Inline.panic-abort.diff deleted file mode 100644 index 15b36b284de..00000000000 --- a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.Inline.panic-abort.diff +++ /dev/null @@ -1,41 +0,0 @@ -- // MIR for `unchecked_shr_signed_smaller` before Inline -+ // MIR for `unchecked_shr_signed_smaller` after Inline - - fn unchecked_shr_signed_smaller(_1: i16, _2: u32) -> i16 { - debug a => _1; - debug b => _2; - let mut _0: i16; - let mut _3: i16; - let mut _4: u32; -+ scope 1 (inlined core::num::<impl i16>::unchecked_shr) { -+ debug self => _3; -+ debug rhs => _4; -+ let mut _5: i16; -+ let mut _6: bool; -+ scope 2 { -+ } -+ } - - bb0: { - StorageLive(_3); - _3 = _1; - StorageLive(_4); - _4 = _2; -- _0 = core::num::<impl i16>::unchecked_shr(move _3, move _4) -> [return: bb1, unwind unreachable]; -- } -- -- bb1: { -+ StorageLive(_5); -+ StorageLive(_6); -+ _6 = Le(_4, const 32767_u32); -+ assume(move _6); -+ StorageDead(_6); -+ _5 = _4 as i16 (IntToInt); -+ _0 = ShrUnchecked(_3, move _5); -+ StorageDead(_5); - StorageDead(_4); - StorageDead(_3); - return; - } - } - diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.Inline.panic-unwind.diff b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.Inline.panic-unwind.diff deleted file mode 100644 index 8629f92dbad..00000000000 --- a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.Inline.panic-unwind.diff +++ /dev/null @@ -1,41 +0,0 @@ -- // MIR for `unchecked_shr_signed_smaller` before Inline -+ // MIR for `unchecked_shr_signed_smaller` after Inline - - fn unchecked_shr_signed_smaller(_1: i16, _2: u32) -> i16 { - debug a => _1; - debug b => _2; - let mut _0: i16; - let mut _3: i16; - let mut _4: u32; -+ scope 1 (inlined core::num::<impl i16>::unchecked_shr) { -+ debug self => _3; -+ debug rhs => _4; -+ let mut _5: i16; -+ let mut _6: bool; -+ scope 2 { -+ } -+ } - - bb0: { - StorageLive(_3); - _3 = _1; - StorageLive(_4); - _4 = _2; -- _0 = core::num::<impl i16>::unchecked_shr(move _3, move _4) -> [return: bb1, unwind continue]; -- } -- -- bb1: { -+ StorageLive(_5); -+ StorageLive(_6); -+ _6 = Le(_4, const 32767_u32); -+ assume(move _6); -+ StorageDead(_6); -+ _5 = _4 as i16 (IntToInt); -+ _0 = ShrUnchecked(_3, move _5); -+ StorageDead(_5); - StorageDead(_4); - StorageDead(_3); - return; - } - } - diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.PreCodegen.after.panic-abort.mir b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.PreCodegen.after.panic-abort.mir deleted file mode 100644 index 65fa0d956c0..00000000000 --- a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.PreCodegen.after.panic-abort.mir +++ /dev/null @@ -1,27 +0,0 @@ -// MIR for `unchecked_shr_signed_smaller` after PreCodegen - -fn unchecked_shr_signed_smaller(_1: i16, _2: u32) -> i16 { - debug a => _1; - debug b => _2; - let mut _0: i16; - scope 1 (inlined core::num::<impl i16>::unchecked_shr) { - debug self => _1; - debug rhs => _2; - let mut _3: bool; - let mut _4: i16; - scope 2 { - } - } - - bb0: { - StorageLive(_4); - StorageLive(_3); - _3 = Le(_2, const 32767_u32); - assume(move _3); - StorageDead(_3); - _4 = _2 as i16 (IntToInt); - _0 = ShrUnchecked(_1, move _4); - StorageDead(_4); - return; - } -} diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.PreCodegen.after.panic-unwind.mir deleted file mode 100644 index 65fa0d956c0..00000000000 --- a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.PreCodegen.after.panic-unwind.mir +++ /dev/null @@ -1,27 +0,0 @@ -// MIR for `unchecked_shr_signed_smaller` after PreCodegen - -fn unchecked_shr_signed_smaller(_1: i16, _2: u32) -> i16 { - debug a => _1; - debug b => _2; - let mut _0: i16; - scope 1 (inlined core::num::<impl i16>::unchecked_shr) { - debug self => _1; - debug rhs => _2; - let mut _3: bool; - let mut _4: i16; - scope 2 { - } - } - - bb0: { - StorageLive(_4); - StorageLive(_3); - _3 = Le(_2, const 32767_u32); - assume(move _3); - StorageDead(_3); - _4 = _2 as i16 (IntToInt); - _0 = ShrUnchecked(_1, move _4); - StorageDead(_4); - return; - } -} diff --git a/tests/mir-opt/lower_intrinsics.rs b/tests/mir-opt/lower_intrinsics.rs index 278ddfce1c3..08366417d7c 100644 --- a/tests/mir-opt/lower_intrinsics.rs +++ b/tests/mir-opt/lower_intrinsics.rs @@ -16,7 +16,7 @@ pub fn wrapping(a: i32, b: i32) { } // EMIT_MIR lower_intrinsics.unchecked.LowerIntrinsics.diff -pub unsafe fn unchecked(a: i32, b: i32) { +pub unsafe fn unchecked(a: i32, b: i32, c: u32) { // CHECK-LABEL: fn unchecked( // CHECK: {{_.*}} = AddUnchecked( // CHECK: {{_.*}} = SubUnchecked( @@ -25,6 +25,8 @@ pub unsafe fn unchecked(a: i32, b: i32) { // CHECK: {{_.*}} = Rem( // CHECK: {{_.*}} = ShlUnchecked( // CHECK: {{_.*}} = ShrUnchecked( + // CHECK: {{_.*}} = ShlUnchecked( + // CHECK: {{_.*}} = ShrUnchecked( let _a = core::intrinsics::unchecked_add(a, b); let _b = core::intrinsics::unchecked_sub(a, b); let _c = core::intrinsics::unchecked_mul(a, b); @@ -32,6 +34,8 @@ pub unsafe fn unchecked(a: i32, b: i32) { let _y = core::intrinsics::unchecked_rem(a, b); let _i = core::intrinsics::unchecked_shl(a, b); let _j = core::intrinsics::unchecked_shr(a, b); + let _k = core::intrinsics::unchecked_shl(a, c); + let _l = core::intrinsics::unchecked_shr(a, c); } // EMIT_MIR lower_intrinsics.size_of.LowerIntrinsics.diff @@ -229,3 +233,18 @@ pub unsafe fn ptr_offset(p: *const i32, d: isize) -> *const i32 { core::intrinsics::offset(p, d) } + +// EMIT_MIR lower_intrinsics.three_way_compare_char.LowerIntrinsics.diff +pub fn three_way_compare_char(a: char, b: char) { + let _x = core::intrinsics::three_way_compare(a, b); +} + +// EMIT_MIR lower_intrinsics.three_way_compare_signed.LowerIntrinsics.diff +pub fn three_way_compare_signed(a: i16, b: i16) { + core::intrinsics::three_way_compare(a, b); +} + +// EMIT_MIR lower_intrinsics.three_way_compare_unsigned.LowerIntrinsics.diff +pub fn three_way_compare_unsigned(a: u32, b: u32) { + let _x = core::intrinsics::three_way_compare(a, b); +} diff --git a/tests/mir-opt/lower_intrinsics.three_way_compare_char.LowerIntrinsics.panic-abort.diff b/tests/mir-opt/lower_intrinsics.three_way_compare_char.LowerIntrinsics.panic-abort.diff new file mode 100644 index 00000000000..816d6209715 --- /dev/null +++ b/tests/mir-opt/lower_intrinsics.three_way_compare_char.LowerIntrinsics.panic-abort.diff @@ -0,0 +1,34 @@ +- // MIR for `three_way_compare_char` before LowerIntrinsics ++ // MIR for `three_way_compare_char` after LowerIntrinsics + + fn three_way_compare_char(_1: char, _2: char) -> () { + debug a => _1; + debug b => _2; + let mut _0: (); + let _3: std::cmp::Ordering; + let mut _4: char; + let mut _5: char; + scope 1 { + debug _x => _3; + } + + bb0: { + StorageLive(_3); + StorageLive(_4); + _4 = _1; + StorageLive(_5); + _5 = _2; +- _3 = three_way_compare::<char>(move _4, move _5) -> [return: bb1, unwind unreachable]; ++ _3 = Cmp(move _4, move _5); ++ goto -> bb1; + } + + bb1: { + StorageDead(_5); + StorageDead(_4); + _0 = const (); + StorageDead(_3); + return; + } + } + diff --git a/tests/mir-opt/lower_intrinsics.three_way_compare_char.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.three_way_compare_char.LowerIntrinsics.panic-unwind.diff new file mode 100644 index 00000000000..80b4bd7a2be --- /dev/null +++ b/tests/mir-opt/lower_intrinsics.three_way_compare_char.LowerIntrinsics.panic-unwind.diff @@ -0,0 +1,34 @@ +- // MIR for `three_way_compare_char` before LowerIntrinsics ++ // MIR for `three_way_compare_char` after LowerIntrinsics + + fn three_way_compare_char(_1: char, _2: char) -> () { + debug a => _1; + debug b => _2; + let mut _0: (); + let _3: std::cmp::Ordering; + let mut _4: char; + let mut _5: char; + scope 1 { + debug _x => _3; + } + + bb0: { + StorageLive(_3); + StorageLive(_4); + _4 = _1; + StorageLive(_5); + _5 = _2; +- _3 = three_way_compare::<char>(move _4, move _5) -> [return: bb1, unwind continue]; ++ _3 = Cmp(move _4, move _5); ++ goto -> bb1; + } + + bb1: { + StorageDead(_5); + StorageDead(_4); + _0 = const (); + StorageDead(_3); + return; + } + } + diff --git a/tests/mir-opt/lower_intrinsics.three_way_compare_signed.LowerIntrinsics.panic-abort.diff b/tests/mir-opt/lower_intrinsics.three_way_compare_signed.LowerIntrinsics.panic-abort.diff new file mode 100644 index 00000000000..05c20aaa09a --- /dev/null +++ b/tests/mir-opt/lower_intrinsics.three_way_compare_signed.LowerIntrinsics.panic-abort.diff @@ -0,0 +1,31 @@ +- // MIR for `three_way_compare_signed` before LowerIntrinsics ++ // MIR for `three_way_compare_signed` after LowerIntrinsics + + fn three_way_compare_signed(_1: i16, _2: i16) -> () { + debug a => _1; + debug b => _2; + let mut _0: (); + let _3: std::cmp::Ordering; + let mut _4: i16; + let mut _5: i16; + + bb0: { + StorageLive(_3); + StorageLive(_4); + _4 = _1; + StorageLive(_5); + _5 = _2; +- _3 = three_way_compare::<i16>(move _4, move _5) -> [return: bb1, unwind unreachable]; ++ _3 = Cmp(move _4, move _5); ++ goto -> bb1; + } + + bb1: { + StorageDead(_5); + StorageDead(_4); + StorageDead(_3); + _0 = const (); + return; + } + } + diff --git a/tests/mir-opt/lower_intrinsics.three_way_compare_signed.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.three_way_compare_signed.LowerIntrinsics.panic-unwind.diff new file mode 100644 index 00000000000..8a254d02a47 --- /dev/null +++ b/tests/mir-opt/lower_intrinsics.three_way_compare_signed.LowerIntrinsics.panic-unwind.diff @@ -0,0 +1,31 @@ +- // MIR for `three_way_compare_signed` before LowerIntrinsics ++ // MIR for `three_way_compare_signed` after LowerIntrinsics + + fn three_way_compare_signed(_1: i16, _2: i16) -> () { + debug a => _1; + debug b => _2; + let mut _0: (); + let _3: std::cmp::Ordering; + let mut _4: i16; + let mut _5: i16; + + bb0: { + StorageLive(_3); + StorageLive(_4); + _4 = _1; + StorageLive(_5); + _5 = _2; +- _3 = three_way_compare::<i16>(move _4, move _5) -> [return: bb1, unwind continue]; ++ _3 = Cmp(move _4, move _5); ++ goto -> bb1; + } + + bb1: { + StorageDead(_5); + StorageDead(_4); + StorageDead(_3); + _0 = const (); + return; + } + } + diff --git a/tests/mir-opt/lower_intrinsics.three_way_compare_unsigned.LowerIntrinsics.panic-abort.diff b/tests/mir-opt/lower_intrinsics.three_way_compare_unsigned.LowerIntrinsics.panic-abort.diff new file mode 100644 index 00000000000..437614ec673 --- /dev/null +++ b/tests/mir-opt/lower_intrinsics.three_way_compare_unsigned.LowerIntrinsics.panic-abort.diff @@ -0,0 +1,34 @@ +- // MIR for `three_way_compare_unsigned` before LowerIntrinsics ++ // MIR for `three_way_compare_unsigned` after LowerIntrinsics + + fn three_way_compare_unsigned(_1: u32, _2: u32) -> () { + debug a => _1; + debug b => _2; + let mut _0: (); + let _3: std::cmp::Ordering; + let mut _4: u32; + let mut _5: u32; + scope 1 { + debug _x => _3; + } + + bb0: { + StorageLive(_3); + StorageLive(_4); + _4 = _1; + StorageLive(_5); + _5 = _2; +- _3 = three_way_compare::<u32>(move _4, move _5) -> [return: bb1, unwind unreachable]; ++ _3 = Cmp(move _4, move _5); ++ goto -> bb1; + } + + bb1: { + StorageDead(_5); + StorageDead(_4); + _0 = const (); + StorageDead(_3); + return; + } + } + diff --git a/tests/mir-opt/lower_intrinsics.three_way_compare_unsigned.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.three_way_compare_unsigned.LowerIntrinsics.panic-unwind.diff new file mode 100644 index 00000000000..7d6137979c8 --- /dev/null +++ b/tests/mir-opt/lower_intrinsics.three_way_compare_unsigned.LowerIntrinsics.panic-unwind.diff @@ -0,0 +1,34 @@ +- // MIR for `three_way_compare_unsigned` before LowerIntrinsics ++ // MIR for `three_way_compare_unsigned` after LowerIntrinsics + + fn three_way_compare_unsigned(_1: u32, _2: u32) -> () { + debug a => _1; + debug b => _2; + let mut _0: (); + let _3: std::cmp::Ordering; + let mut _4: u32; + let mut _5: u32; + scope 1 { + debug _x => _3; + } + + bb0: { + StorageLive(_3); + StorageLive(_4); + _4 = _1; + StorageLive(_5); + _5 = _2; +- _3 = three_way_compare::<u32>(move _4, move _5) -> [return: bb1, unwind continue]; ++ _3 = Cmp(move _4, move _5); ++ goto -> bb1; + } + + bb1: { + StorageDead(_5); + StorageDead(_4); + _0 = const (); + StorageDead(_3); + return; + } + } + diff --git a/tests/mir-opt/lower_intrinsics.unchecked.LowerIntrinsics.panic-abort.diff b/tests/mir-opt/lower_intrinsics.unchecked.LowerIntrinsics.panic-abort.diff index dd92b8d6d2c..3c9694d0370 100644 --- a/tests/mir-opt/lower_intrinsics.unchecked.LowerIntrinsics.panic-abort.diff +++ b/tests/mir-opt/lower_intrinsics.unchecked.LowerIntrinsics.panic-abort.diff @@ -1,45 +1,58 @@ - // MIR for `unchecked` before LowerIntrinsics + // MIR for `unchecked` after LowerIntrinsics - fn unchecked(_1: i32, _2: i32) -> () { + fn unchecked(_1: i32, _2: i32, _3: u32) -> () { debug a => _1; debug b => _2; + debug c => _3; let mut _0: (); - let _3: i32; - let mut _4: i32; + let _4: i32; let mut _5: i32; - let mut _7: i32; + let mut _6: i32; let mut _8: i32; - let mut _10: i32; + let mut _9: i32; let mut _11: i32; - let mut _13: i32; + let mut _12: i32; let mut _14: i32; - let mut _16: i32; + let mut _15: i32; let mut _17: i32; - let mut _19: i32; + let mut _18: i32; let mut _20: i32; - let mut _22: i32; + let mut _21: i32; let mut _23: i32; + let mut _24: i32; + let mut _26: i32; + let mut _27: u32; + let mut _29: i32; + let mut _30: u32; scope 1 { - debug _a => _3; - let _6: i32; + debug _a => _4; + let _7: i32; scope 2 { - debug _b => _6; - let _9: i32; + debug _b => _7; + let _10: i32; scope 3 { - debug _c => _9; - let _12: i32; + debug _c => _10; + let _13: i32; scope 4 { - debug _x => _12; - let _15: i32; + debug _x => _13; + let _16: i32; scope 5 { - debug _y => _15; - let _18: i32; + debug _y => _16; + let _19: i32; scope 6 { - debug _i => _18; - let _21: i32; + debug _i => _19; + let _22: i32; scope 7 { - debug _j => _21; + debug _j => _22; + let _25: i32; + scope 8 { + debug _k => _25; + let _28: i32; + scope 9 { + debug _l => _28; + } + } } } } @@ -49,105 +62,133 @@ } bb0: { - StorageLive(_3); StorageLive(_4); - _4 = _1; StorageLive(_5); - _5 = _2; -- _3 = unchecked_add::<i32>(move _4, move _5) -> [return: bb1, unwind unreachable]; -+ _3 = AddUnchecked(move _4, move _5); + _5 = _1; + StorageLive(_6); + _6 = _2; +- _4 = unchecked_add::<i32>(move _5, move _6) -> [return: bb1, unwind unreachable]; ++ _4 = AddUnchecked(move _5, move _6); + goto -> bb1; } bb1: { + StorageDead(_6); StorageDead(_5); - StorageDead(_4); - StorageLive(_6); StorageLive(_7); - _7 = _1; StorageLive(_8); - _8 = _2; -- _6 = unchecked_sub::<i32>(move _7, move _8) -> [return: bb2, unwind unreachable]; -+ _6 = SubUnchecked(move _7, move _8); + _8 = _1; + StorageLive(_9); + _9 = _2; +- _7 = unchecked_sub::<i32>(move _8, move _9) -> [return: bb2, unwind unreachable]; ++ _7 = SubUnchecked(move _8, move _9); + goto -> bb2; } bb2: { + StorageDead(_9); StorageDead(_8); - StorageDead(_7); - StorageLive(_9); StorageLive(_10); - _10 = _1; StorageLive(_11); - _11 = _2; -- _9 = unchecked_mul::<i32>(move _10, move _11) -> [return: bb3, unwind unreachable]; -+ _9 = MulUnchecked(move _10, move _11); + _11 = _1; + StorageLive(_12); + _12 = _2; +- _10 = unchecked_mul::<i32>(move _11, move _12) -> [return: bb3, unwind unreachable]; ++ _10 = MulUnchecked(move _11, move _12); + goto -> bb3; } bb3: { + StorageDead(_12); StorageDead(_11); - StorageDead(_10); - StorageLive(_12); StorageLive(_13); - _13 = _1; StorageLive(_14); - _14 = _2; -- _12 = unchecked_div::<i32>(move _13, move _14) -> [return: bb4, unwind unreachable]; -+ _12 = Div(move _13, move _14); + _14 = _1; + StorageLive(_15); + _15 = _2; +- _13 = unchecked_div::<i32>(move _14, move _15) -> [return: bb4, unwind unreachable]; ++ _13 = Div(move _14, move _15); + goto -> bb4; } bb4: { + StorageDead(_15); StorageDead(_14); - StorageDead(_13); - StorageLive(_15); StorageLive(_16); - _16 = _1; StorageLive(_17); - _17 = _2; -- _15 = unchecked_rem::<i32>(move _16, move _17) -> [return: bb5, unwind unreachable]; -+ _15 = Rem(move _16, move _17); + _17 = _1; + StorageLive(_18); + _18 = _2; +- _16 = unchecked_rem::<i32>(move _17, move _18) -> [return: bb5, unwind unreachable]; ++ _16 = Rem(move _17, move _18); + goto -> bb5; } bb5: { + StorageDead(_18); StorageDead(_17); - StorageDead(_16); - StorageLive(_18); StorageLive(_19); - _19 = _1; StorageLive(_20); - _20 = _2; -- _18 = unchecked_shl::<i32>(move _19, move _20) -> [return: bb6, unwind unreachable]; -+ _18 = ShlUnchecked(move _19, move _20); + _20 = _1; + StorageLive(_21); + _21 = _2; +- _19 = unchecked_shl::<i32, i32>(move _20, move _21) -> [return: bb6, unwind unreachable]; ++ _19 = ShlUnchecked(move _20, move _21); + goto -> bb6; } bb6: { + StorageDead(_21); StorageDead(_20); - StorageDead(_19); - StorageLive(_21); StorageLive(_22); - _22 = _1; StorageLive(_23); - _23 = _2; -- _21 = unchecked_shr::<i32>(move _22, move _23) -> [return: bb7, unwind unreachable]; -+ _21 = ShrUnchecked(move _22, move _23); + _23 = _1; + StorageLive(_24); + _24 = _2; +- _22 = unchecked_shr::<i32, i32>(move _23, move _24) -> [return: bb7, unwind unreachable]; ++ _22 = ShrUnchecked(move _23, move _24); + goto -> bb7; } bb7: { + StorageDead(_24); StorageDead(_23); - StorageDead(_22); + StorageLive(_25); + StorageLive(_26); + _26 = _1; + StorageLive(_27); + _27 = _3; +- _25 = unchecked_shl::<i32, u32>(move _26, move _27) -> [return: bb8, unwind unreachable]; ++ _25 = ShlUnchecked(move _26, move _27); ++ goto -> bb8; + } + + bb8: { + StorageDead(_27); + StorageDead(_26); + StorageLive(_28); + StorageLive(_29); + _29 = _1; + StorageLive(_30); + _30 = _3; +- _28 = unchecked_shr::<i32, u32>(move _29, move _30) -> [return: bb9, unwind unreachable]; ++ _28 = ShrUnchecked(move _29, move _30); ++ goto -> bb9; + } + + bb9: { + StorageDead(_30); + StorageDead(_29); _0 = const (); - StorageDead(_21); - StorageDead(_18); - StorageDead(_15); - StorageDead(_12); - StorageDead(_9); - StorageDead(_6); - StorageDead(_3); + StorageDead(_28); + StorageDead(_25); + StorageDead(_22); + StorageDead(_19); + StorageDead(_16); + StorageDead(_13); + StorageDead(_10); + StorageDead(_7); + StorageDead(_4); return; } } diff --git a/tests/mir-opt/lower_intrinsics.unchecked.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.unchecked.LowerIntrinsics.panic-unwind.diff index dd92b8d6d2c..3c9694d0370 100644 --- a/tests/mir-opt/lower_intrinsics.unchecked.LowerIntrinsics.panic-unwind.diff +++ b/tests/mir-opt/lower_intrinsics.unchecked.LowerIntrinsics.panic-unwind.diff @@ -1,45 +1,58 @@ - // MIR for `unchecked` before LowerIntrinsics + // MIR for `unchecked` after LowerIntrinsics - fn unchecked(_1: i32, _2: i32) -> () { + fn unchecked(_1: i32, _2: i32, _3: u32) -> () { debug a => _1; debug b => _2; + debug c => _3; let mut _0: (); - let _3: i32; - let mut _4: i32; + let _4: i32; let mut _5: i32; - let mut _7: i32; + let mut _6: i32; let mut _8: i32; - let mut _10: i32; + let mut _9: i32; let mut _11: i32; - let mut _13: i32; + let mut _12: i32; let mut _14: i32; - let mut _16: i32; + let mut _15: i32; let mut _17: i32; - let mut _19: i32; + let mut _18: i32; let mut _20: i32; - let mut _22: i32; + let mut _21: i32; let mut _23: i32; + let mut _24: i32; + let mut _26: i32; + let mut _27: u32; + let mut _29: i32; + let mut _30: u32; scope 1 { - debug _a => _3; - let _6: i32; + debug _a => _4; + let _7: i32; scope 2 { - debug _b => _6; - let _9: i32; + debug _b => _7; + let _10: i32; scope 3 { - debug _c => _9; - let _12: i32; + debug _c => _10; + let _13: i32; scope 4 { - debug _x => _12; - let _15: i32; + debug _x => _13; + let _16: i32; scope 5 { - debug _y => _15; - let _18: i32; + debug _y => _16; + let _19: i32; scope 6 { - debug _i => _18; - let _21: i32; + debug _i => _19; + let _22: i32; scope 7 { - debug _j => _21; + debug _j => _22; + let _25: i32; + scope 8 { + debug _k => _25; + let _28: i32; + scope 9 { + debug _l => _28; + } + } } } } @@ -49,105 +62,133 @@ } bb0: { - StorageLive(_3); StorageLive(_4); - _4 = _1; StorageLive(_5); - _5 = _2; -- _3 = unchecked_add::<i32>(move _4, move _5) -> [return: bb1, unwind unreachable]; -+ _3 = AddUnchecked(move _4, move _5); + _5 = _1; + StorageLive(_6); + _6 = _2; +- _4 = unchecked_add::<i32>(move _5, move _6) -> [return: bb1, unwind unreachable]; ++ _4 = AddUnchecked(move _5, move _6); + goto -> bb1; } bb1: { + StorageDead(_6); StorageDead(_5); - StorageDead(_4); - StorageLive(_6); StorageLive(_7); - _7 = _1; StorageLive(_8); - _8 = _2; -- _6 = unchecked_sub::<i32>(move _7, move _8) -> [return: bb2, unwind unreachable]; -+ _6 = SubUnchecked(move _7, move _8); + _8 = _1; + StorageLive(_9); + _9 = _2; +- _7 = unchecked_sub::<i32>(move _8, move _9) -> [return: bb2, unwind unreachable]; ++ _7 = SubUnchecked(move _8, move _9); + goto -> bb2; } bb2: { + StorageDead(_9); StorageDead(_8); - StorageDead(_7); - StorageLive(_9); StorageLive(_10); - _10 = _1; StorageLive(_11); - _11 = _2; -- _9 = unchecked_mul::<i32>(move _10, move _11) -> [return: bb3, unwind unreachable]; -+ _9 = MulUnchecked(move _10, move _11); + _11 = _1; + StorageLive(_12); + _12 = _2; +- _10 = unchecked_mul::<i32>(move _11, move _12) -> [return: bb3, unwind unreachable]; ++ _10 = MulUnchecked(move _11, move _12); + goto -> bb3; } bb3: { + StorageDead(_12); StorageDead(_11); - StorageDead(_10); - StorageLive(_12); StorageLive(_13); - _13 = _1; StorageLive(_14); - _14 = _2; -- _12 = unchecked_div::<i32>(move _13, move _14) -> [return: bb4, unwind unreachable]; -+ _12 = Div(move _13, move _14); + _14 = _1; + StorageLive(_15); + _15 = _2; +- _13 = unchecked_div::<i32>(move _14, move _15) -> [return: bb4, unwind unreachable]; ++ _13 = Div(move _14, move _15); + goto -> bb4; } bb4: { + StorageDead(_15); StorageDead(_14); - StorageDead(_13); - StorageLive(_15); StorageLive(_16); - _16 = _1; StorageLive(_17); - _17 = _2; -- _15 = unchecked_rem::<i32>(move _16, move _17) -> [return: bb5, unwind unreachable]; -+ _15 = Rem(move _16, move _17); + _17 = _1; + StorageLive(_18); + _18 = _2; +- _16 = unchecked_rem::<i32>(move _17, move _18) -> [return: bb5, unwind unreachable]; ++ _16 = Rem(move _17, move _18); + goto -> bb5; } bb5: { + StorageDead(_18); StorageDead(_17); - StorageDead(_16); - StorageLive(_18); StorageLive(_19); - _19 = _1; StorageLive(_20); - _20 = _2; -- _18 = unchecked_shl::<i32>(move _19, move _20) -> [return: bb6, unwind unreachable]; -+ _18 = ShlUnchecked(move _19, move _20); + _20 = _1; + StorageLive(_21); + _21 = _2; +- _19 = unchecked_shl::<i32, i32>(move _20, move _21) -> [return: bb6, unwind unreachable]; ++ _19 = ShlUnchecked(move _20, move _21); + goto -> bb6; } bb6: { + StorageDead(_21); StorageDead(_20); - StorageDead(_19); - StorageLive(_21); StorageLive(_22); - _22 = _1; StorageLive(_23); - _23 = _2; -- _21 = unchecked_shr::<i32>(move _22, move _23) -> [return: bb7, unwind unreachable]; -+ _21 = ShrUnchecked(move _22, move _23); + _23 = _1; + StorageLive(_24); + _24 = _2; +- _22 = unchecked_shr::<i32, i32>(move _23, move _24) -> [return: bb7, unwind unreachable]; ++ _22 = ShrUnchecked(move _23, move _24); + goto -> bb7; } bb7: { + StorageDead(_24); StorageDead(_23); - StorageDead(_22); + StorageLive(_25); + StorageLive(_26); + _26 = _1; + StorageLive(_27); + _27 = _3; +- _25 = unchecked_shl::<i32, u32>(move _26, move _27) -> [return: bb8, unwind unreachable]; ++ _25 = ShlUnchecked(move _26, move _27); ++ goto -> bb8; + } + + bb8: { + StorageDead(_27); + StorageDead(_26); + StorageLive(_28); + StorageLive(_29); + _29 = _1; + StorageLive(_30); + _30 = _3; +- _28 = unchecked_shr::<i32, u32>(move _29, move _30) -> [return: bb9, unwind unreachable]; ++ _28 = ShrUnchecked(move _29, move _30); ++ goto -> bb9; + } + + bb9: { + StorageDead(_30); + StorageDead(_29); _0 = const (); - StorageDead(_21); - StorageDead(_18); - StorageDead(_15); - StorageDead(_12); - StorageDead(_9); - StorageDead(_6); - StorageDead(_3); + StorageDead(_28); + StorageDead(_25); + StorageDead(_22); + StorageDead(_19); + StorageDead(_16); + StorageDead(_13); + StorageDead(_10); + StorageDead(_7); + StorageDead(_4); return; } } diff --git a/tests/mir-opt/pre-codegen/derived_ord.rs b/tests/mir-opt/pre-codegen/derived_ord.rs new file mode 100644 index 00000000000..bad751edf84 --- /dev/null +++ b/tests/mir-opt/pre-codegen/derived_ord.rs @@ -0,0 +1,9 @@ +// skip-filecheck +//@ compile-flags: -O -Zmir-opt-level=2 -Cdebuginfo=0 + +#![crate_type = "lib"] + +#[derive(PartialOrd, PartialEq)] +pub struct MultiField(char, i16); + +// EMIT_MIR derived_ord.{impl#0}-partial_cmp.PreCodegen.after.mir diff --git a/tests/mir-opt/pre-codegen/derived_ord.{impl#0}-partial_cmp.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/derived_ord.{impl#0}-partial_cmp.PreCodegen.after.mir new file mode 100644 index 00000000000..a6c64425912 --- /dev/null +++ b/tests/mir-opt/pre-codegen/derived_ord.{impl#0}-partial_cmp.PreCodegen.after.mir @@ -0,0 +1,78 @@ +// MIR for `<impl at $DIR/derived_ord.rs:6:10: 6:20>::partial_cmp` after PreCodegen + +fn <impl at $DIR/derived_ord.rs:6:10: 6:20>::partial_cmp(_1: &MultiField, _2: &MultiField) -> Option<std::cmp::Ordering> { + debug self => _1; + debug other => _2; + let mut _0: std::option::Option<std::cmp::Ordering>; + let mut _3: &char; + let mut _4: &char; + let mut _8: std::option::Option<std::cmp::Ordering>; + let mut _9: i8; + let mut _10: &i16; + let mut _11: &i16; + scope 1 { + debug cmp => _8; + } + scope 2 (inlined std::cmp::impls::<impl PartialOrd for char>::partial_cmp) { + debug self => _3; + debug other => _4; + let mut _5: char; + let mut _6: char; + let mut _7: std::cmp::Ordering; + } + scope 3 (inlined std::cmp::impls::<impl PartialOrd for i16>::partial_cmp) { + debug self => _10; + debug other => _11; + let mut _12: i16; + let mut _13: i16; + let mut _14: std::cmp::Ordering; + } + + bb0: { + StorageLive(_3); + _3 = &((*_1).0: char); + StorageLive(_4); + _4 = &((*_2).0: char); + StorageLive(_5); + _5 = ((*_1).0: char); + StorageLive(_6); + _6 = ((*_2).0: char); + _7 = Cmp(move _5, move _6); + StorageDead(_6); + StorageDead(_5); + _8 = Option::<std::cmp::Ordering>::Some(_7); + StorageDead(_4); + StorageDead(_3); + _9 = discriminant(_7); + switchInt(move _9) -> [0: bb1, otherwise: bb2]; + } + + bb1: { + StorageLive(_10); + _10 = &((*_1).1: i16); + StorageLive(_11); + _11 = &((*_2).1: i16); + StorageLive(_14); + StorageLive(_12); + _12 = ((*_1).1: i16); + StorageLive(_13); + _13 = ((*_2).1: i16); + _14 = Cmp(move _12, move _13); + StorageDead(_13); + StorageDead(_12); + _0 = Option::<std::cmp::Ordering>::Some(move _14); + StorageDead(_14); + StorageDead(_11); + StorageDead(_10); + goto -> bb3; + } + + bb2: { + _0 = _8; + goto -> bb3; + } + + bb3: { + return; + } +} diff --git a/tests/run-make/core-no-fp-fmt-parse/Makefile b/tests/run-make/core-no-fp-fmt-parse/Makefile deleted file mode 100644 index 837664d92b9..00000000000 --- a/tests/run-make/core-no-fp-fmt-parse/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) --edition=2021 -Dwarnings --crate-type=rlib ../../../library/core/src/lib.rs --cfg no_fp_fmt_parse diff --git a/tests/run-make/core-no-fp-fmt-parse/rmake.rs b/tests/run-make/core-no-fp-fmt-parse/rmake.rs new file mode 100644 index 00000000000..2748d4359c3 --- /dev/null +++ b/tests/run-make/core-no-fp-fmt-parse/rmake.rs @@ -0,0 +1,17 @@ +// This test checks that the core library of Rust can be compiled without enabling +// support for formatting and parsing floating-point numbers. + +extern crate run_make_support; + +use run_make_support::rustc; +use std::path::PathBuf; + +fn main() { + rustc() + .edition("2021") + .arg("-Dwarnings") + .crate_type("rlib") + .input("../../../library/core/src/lib.rs") + .cfg("no_fp_fmt_parse") + .run(); +} diff --git a/tests/run-make/non-unicode-env/non_unicode_env.rs b/tests/run-make/non-unicode-env/non_unicode_env.rs new file mode 100644 index 00000000000..865fc937365 --- /dev/null +++ b/tests/run-make/non-unicode-env/non_unicode_env.rs @@ -0,0 +1,3 @@ +fn main() { + let _ = env!("NON_UNICODE_VAR"); +} diff --git a/tests/run-make/non-unicode-env/non_unicode_env.stderr b/tests/run-make/non-unicode-env/non_unicode_env.stderr new file mode 100644 index 00000000000..c4dcd7b2eb7 --- /dev/null +++ b/tests/run-make/non-unicode-env/non_unicode_env.stderr @@ -0,0 +1,10 @@ +error: environment variable `NON_UNICODE_VAR` is not a valid Unicode string + --> non_unicode_env.rs:2:13 + | +2 | let _ = env!("NON_UNICODE_VAR"); + | ^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: this error originates in the macro `env` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to 1 previous error + diff --git a/tests/run-make/non-unicode-env/rmake.rs b/tests/run-make/non-unicode-env/rmake.rs new file mode 100644 index 00000000000..ba4aa1609b5 --- /dev/null +++ b/tests/run-make/non-unicode-env/rmake.rs @@ -0,0 +1,14 @@ +extern crate run_make_support; + +use run_make_support::rustc; + +fn main() { + #[cfg(unix)] + let non_unicode: &std::ffi::OsStr = std::os::unix::ffi::OsStrExt::from_bytes(&[0xFF]); + #[cfg(windows)] + let non_unicode: std::ffi::OsString = std::os::windows::ffi::OsStringExt::from_wide(&[0xD800]); + let output = rustc().input("non_unicode_env.rs").env("NON_UNICODE_VAR", non_unicode).run_fail(); + let actual = std::str::from_utf8(&output.stderr).unwrap(); + let expected = std::fs::read_to_string("non_unicode_env.stderr").unwrap(); + assert_eq!(actual, expected); +} diff --git a/tests/rustdoc-gui/anchors.goml b/tests/rustdoc-gui/anchors.goml index 72e0bcd77e0..3239e54a866 100644 --- a/tests/rustdoc-gui/anchors.goml +++ b/tests/rustdoc-gui/anchors.goml @@ -2,7 +2,7 @@ define-function: ( "check-colors", - (theme, main_color, title_color, main_heading_color, main_heading_type_color, src_link_color, sidebar_link_color), + [theme, main_color, title_color, main_heading_color, main_heading_type_color, src_link_color, sidebar_link_color], block { go-to: "file://" + |DOC_PATH| + "/staged_api/struct.Foo.html" // This is needed to ensure that the text color is computed. diff --git a/tests/rustdoc-gui/code-color.goml b/tests/rustdoc-gui/code-color.goml index 92bdfb25b00..e17af5e7f1f 100644 --- a/tests/rustdoc-gui/code-color.goml +++ b/tests/rustdoc-gui/code-color.goml @@ -8,7 +8,7 @@ show-text: true define-function: ( "check-colors", - (theme, doc_code_color, doc_inline_code_color), + [theme, doc_code_color, doc_inline_code_color], block { // Set the theme. set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} diff --git a/tests/rustdoc-gui/codeblock-tooltip.goml b/tests/rustdoc-gui/codeblock-tooltip.goml index 7be5e39ba47..19e3927f642 100644 --- a/tests/rustdoc-gui/codeblock-tooltip.goml +++ b/tests/rustdoc-gui/codeblock-tooltip.goml @@ -4,7 +4,7 @@ show-text: true define-function: ( "check-colors", - (theme, background, color, border), + [theme, background, color, border], block { // Setting the theme. set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} diff --git a/tests/rustdoc-gui/cursor.goml b/tests/rustdoc-gui/cursor.goml index 27c955f5a13..9412987fc32 100644 --- a/tests/rustdoc-gui/cursor.goml +++ b/tests/rustdoc-gui/cursor.goml @@ -8,7 +8,7 @@ assert-css: ("#toggle-all-docs", {"cursor": "pointer"}) assert-css: ("#copy-path", {"cursor": "pointer"}) // the search tabs -write: (".search-input", "Foo") +write-into: (".search-input", "Foo") // To be SURE that the search will be run. press-key: 'Enter' // Waiting for the search results to appear... diff --git a/tests/rustdoc-gui/docblock-code-block-line-number.goml b/tests/rustdoc-gui/docblock-code-block-line-number.goml index a50449e1701..cb7bdaab4c8 100644 --- a/tests/rustdoc-gui/docblock-code-block-line-number.goml +++ b/tests/rustdoc-gui/docblock-code-block-line-number.goml @@ -10,7 +10,7 @@ assert-false: "pre.example-line-numbers" // Let's now check some CSS properties... define-function: ( "check-colors", - (theme, color), + [theme, color], block { // We now set the setting to show the line numbers on code examples. set-local-storage: { diff --git a/tests/rustdoc-gui/docblock-table.goml b/tests/rustdoc-gui/docblock-table.goml index 678b302f22e..db6d065a4b3 100644 --- a/tests/rustdoc-gui/docblock-table.goml +++ b/tests/rustdoc-gui/docblock-table.goml @@ -6,7 +6,7 @@ compare-elements-css: (".impl-items .docblock table td", ".top-doc .docblock tab define-function: ( "check-colors", - (theme, border_color, zebra_stripe_color), + [theme, border_color, zebra_stripe_color], block { set-local-storage: {"rustdoc-use-system-theme": "false", "rustdoc-theme": |theme|} reload: diff --git a/tests/rustdoc-gui/escape-key.goml b/tests/rustdoc-gui/escape-key.goml index 3ea20fd118e..ff8557b9b81 100644 --- a/tests/rustdoc-gui/escape-key.goml +++ b/tests/rustdoc-gui/escape-key.goml @@ -2,7 +2,7 @@ // current content displayed. go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" // First, we check that the search results are hidden when the Escape key is pressed. -write: (".search-input", "test") +write-into: (".search-input", "test") // To be SURE that the search will be run. press-key: 'Enter' wait-for: "#search h1" // The search element is empty before the first search diff --git a/tests/rustdoc-gui/globals.goml b/tests/rustdoc-gui/globals.goml index c01c8bb1019..f8c495ec18a 100644 --- a/tests/rustdoc-gui/globals.goml +++ b/tests/rustdoc-gui/globals.goml @@ -10,7 +10,7 @@ assert-window-property: {"srcIndex": null} // Form input go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" -write: (".search-input", "Foo") +write-into: (".search-input", "Foo") press-key: 'Enter' wait-for: "#search-tabs" assert-window-property-false: {"searchIndex": null} diff --git a/tests/rustdoc-gui/go-to-collapsed-elem.goml b/tests/rustdoc-gui/go-to-collapsed-elem.goml index 80e9791775e..e56e7ba08cd 100644 --- a/tests/rustdoc-gui/go-to-collapsed-elem.goml +++ b/tests/rustdoc-gui/go-to-collapsed-elem.goml @@ -9,14 +9,14 @@ set-property: ("#implementations-list .implementors-toggle", {"open": "false"}) click: "//*[@class='sidebar']//a[@href='#method.must_use']" assert-property: ("#implementations-list .implementors-toggle", {"open": "true"}) -define-function: ("collapsed-from-search", (), block { +define-function: ("collapsed-from-search", [], block { // Now we do the same through search result. // First we reload the page without the anchor in the URL. go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html" // Then we collapse the section again... set-property: ("#implementations-list .implementors-toggle", {"open": "false"}) // Then we run the search. - write: (".search-input", "foo::must_use") + write-into: (".search-input", "foo::must_use") wait-for: "//*[@id='search']//a[@href='../test_docs/struct.Foo.html#method.must_use']" click: "//*[@id='search']//a[@href='../test_docs/struct.Foo.html#method.must_use']" assert-property: ("#implementations-list .implementors-toggle", {"open": "true"}) diff --git a/tests/rustdoc-gui/headers-color.goml b/tests/rustdoc-gui/headers-color.goml index 80d11c9c849..2a181c0669f 100644 --- a/tests/rustdoc-gui/headers-color.goml +++ b/tests/rustdoc-gui/headers-color.goml @@ -2,7 +2,7 @@ define-function: ( "check-colors", - (theme, color, code_header_color, focus_background_color, headings_color), + [theme, color, code_header_color, focus_background_color, headings_color], block { go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html" // This is needed so that the text color is computed. diff --git a/tests/rustdoc-gui/headings-anchor.goml b/tests/rustdoc-gui/headings-anchor.goml index f568caa3b07..9d52c2ac4b5 100644 --- a/tests/rustdoc-gui/headings-anchor.goml +++ b/tests/rustdoc-gui/headings-anchor.goml @@ -4,7 +4,7 @@ show-text: true define-function: ( "check-heading-anchor", - (heading_id), + [heading_id], block { // The anchor should not be displayed by default. assert-css: ("#" + |heading_id| + " .doc-anchor", { "display": "none" }) @@ -27,6 +27,6 @@ move-cursor-to: "#top-doc-prose-title" // to prevent it from overlapping with the `[-]` element. assert-css: ("#top-doc-prose-title:hover .doc-anchor", { "display": "none" }) -call-function: ("check-heading-anchor", ("top-doc-prose-sub-heading")) -call-function: ("check-heading-anchor", ("top-doc-prose-sub-sub-heading")) -call-function: ("check-heading-anchor", ("you-know-the-drill")) +call-function: ("check-heading-anchor", {"heading_id": "top-doc-prose-sub-heading"}) +call-function: ("check-heading-anchor", {"heading_id": "top-doc-prose-sub-sub-heading"}) +call-function: ("check-heading-anchor", {"heading_id": "you-know-the-drill"}) diff --git a/tests/rustdoc-gui/headings.goml b/tests/rustdoc-gui/headings.goml index 102b699b1dd..cdc61e36be2 100644 --- a/tests/rustdoc-gui/headings.goml +++ b/tests/rustdoc-gui/headings.goml @@ -156,7 +156,7 @@ go-to: "file://" + |DOC_PATH| + "/test_docs/struct.HeavilyDocumentedStruct.html" define-function: ( "check-colors", - (theme, heading_color, small_heading_color, heading_border_color), + [theme, heading_color, small_heading_color, heading_border_color], block { set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} reload: @@ -220,7 +220,7 @@ call-function: ( define-function: ( "check-since-color", - (theme), + [theme], block { set-local-storage: {"rustdoc-theme": |theme|} reload: @@ -229,6 +229,6 @@ define-function: ( ) go-to: "file://" + |DOC_PATH| + "/staged_api/struct.Foo.html" -call-function: ("check-since-color", ("ayu")) -call-function: ("check-since-color", ("dark")) -call-function: ("check-since-color", ("light")) +call-function: ("check-since-color", {"theme": "ayu"}) +call-function: ("check-since-color", {"theme": "dark"}) +call-function: ("check-since-color", {"theme": "light"}) diff --git a/tests/rustdoc-gui/help-page.goml b/tests/rustdoc-gui/help-page.goml index 84c20355500..9a7247a737b 100644 --- a/tests/rustdoc-gui/help-page.goml +++ b/tests/rustdoc-gui/help-page.goml @@ -7,17 +7,17 @@ assert-css: ("#help dd", {"font-size": "16px"}) click: "#help-button > a" assert-css: ("#help", {"display": "block"}) compare-elements-property: (".sub", "#help", ["offsetWidth"]) -compare-elements-position: (".sub", "#help", ("x")) +compare-elements-position: (".sub", "#help", ["x"]) set-window-size: (500, 1000) // Try mobile next. assert-css: ("#help", {"display": "block"}) compare-elements-property: (".sub", "#help", ["offsetWidth"]) -compare-elements-position: (".sub", "#help", ("x")) +compare-elements-position: (".sub", "#help", ["x"]) // Checking the color of the elements of the help menu. show-text: true define-function: ( "check-colors", - (theme, color, background, box_shadow), + [theme, color, background, box_shadow], block { // Setting the theme. set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} @@ -60,7 +60,7 @@ assert-css: ("#help dd", {"font-size": "16px"}) click: "#help-button > a" assert-css: ("#help", {"display": "none"}) compare-elements-property-false: (".sub", "#help", ["offsetWidth"]) -compare-elements-position-false: (".sub", "#help", ("x")) +compare-elements-position-false: (".sub", "#help", ["x"]) // This test ensures that the "the rustdoc book" anchor link within the help popover works. go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" diff --git a/tests/rustdoc-gui/highlight-colors.goml b/tests/rustdoc-gui/highlight-colors.goml index d162674fa69..48bef319d42 100644 --- a/tests/rustdoc-gui/highlight-colors.goml +++ b/tests/rustdoc-gui/highlight-colors.goml @@ -4,7 +4,7 @@ show-text: true define-function: ( "check-colors", - ( + [ theme, kw, kw2, @@ -20,7 +20,7 @@ define-function: ( question_mark, comment, doc_comment, - ), + ], block { set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} reload: diff --git a/tests/rustdoc-gui/item-decl-colors.goml b/tests/rustdoc-gui/item-decl-colors.goml index 7bbd20c4ee0..e68d206a511 100644 --- a/tests/rustdoc-gui/item-decl-colors.goml +++ b/tests/rustdoc-gui/item-decl-colors.goml @@ -6,7 +6,7 @@ fail-on-request-error: false define-function: ( "check-colors", - ( + [ theme, attr_color, trait_color, @@ -16,7 +16,7 @@ define-function: ( constant_color, fn_color, assoc_type_color, - ), + ], block { go-to: "file://" + |DOC_PATH| + "/test_docs/struct.WithGenerics.html" show-text: true diff --git a/tests/rustdoc-gui/item-decl-comment-highlighting.goml b/tests/rustdoc-gui/item-decl-comment-highlighting.goml index 60772693d6c..056b6a5b1e8 100644 --- a/tests/rustdoc-gui/item-decl-comment-highlighting.goml +++ b/tests/rustdoc-gui/item-decl-comment-highlighting.goml @@ -4,7 +4,7 @@ show-text: true define-function: ( "check-item-decl-comment", - (theme, url, comment_color), + [theme, url, comment_color], block { go-to: |url| set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} @@ -15,7 +15,7 @@ define-function: ( define-function: ( "check-items-for-theme", - (theme, comment_color), + [theme, comment_color], block { call-function: ("check-item-decl-comment", { "theme": |theme|, diff --git a/tests/rustdoc-gui/item-info-alignment.goml b/tests/rustdoc-gui/item-info-alignment.goml index 6fc365d1f19..cd0624056b9 100644 --- a/tests/rustdoc-gui/item-info-alignment.goml +++ b/tests/rustdoc-gui/item-info-alignment.goml @@ -4,7 +4,7 @@ go-to: "file://" + |DOC_PATH| + "/lib2/struct.ItemInfoAlignmentTest.html" // First, we try it in "desktop" mode. set-window-size: (1200, 870) -compare-elements-position: (".impl-items > .item-info", "summary > .item-info", ("x")) +compare-elements-position: (".impl-items > .item-info", "summary > .item-info", ["x"]) // Next, we try it in "mobile" mode (max-width: 700px). set-window-size: (650, 650) -compare-elements-position: (".impl-items > .item-info", "summary > .item-info", ("x")) +compare-elements-position: (".impl-items > .item-info", "summary > .item-info", ["x"]) diff --git a/tests/rustdoc-gui/item-info.goml b/tests/rustdoc-gui/item-info.goml index b46d4255ee5..1eb46e832b7 100644 --- a/tests/rustdoc-gui/item-info.goml +++ b/tests/rustdoc-gui/item-info.goml @@ -31,13 +31,13 @@ assert-count: ("#main-content > .item-info .stab", 2) compare-elements-position-false: ( "#main-content > .item-info .stab:nth-of-type(1)", "#main-content > .item-info .stab:nth-of-type(2)", - ("y"), + ["y"], ) // But they should have the same `x` position. compare-elements-position: ( "#main-content > .item-info .stab:nth-of-type(1)", "#main-content > .item-info .stab:nth-of-type(2)", - ("x"), + ["x"], ) // They are supposed to have the same height too. compare-elements-css: ( diff --git a/tests/rustdoc-gui/jump-to-def-background.goml b/tests/rustdoc-gui/jump-to-def-background.goml index fa7ed3586dd..ae9c0c560cf 100644 --- a/tests/rustdoc-gui/jump-to-def-background.goml +++ b/tests/rustdoc-gui/jump-to-def-background.goml @@ -3,7 +3,7 @@ go-to: "file://" + |DOC_PATH| + "/src/link_to_definition/lib.rs.html" define-function: ( "check-background-color", - (theme, background_color), + [theme, background_color], block { // Set the theme. set-local-storage: { "rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false" } @@ -17,6 +17,15 @@ define-function: ( }, ) -call-function: ("check-background-color", ("ayu", "#333")) -call-function: ("check-background-color", ("dark", "#333")) -call-function: ("check-background-color", ("light", "#eee")) +call-function: ("check-background-color", { + "theme": "ayu", + "background_color": "#333", +}) +call-function: ("check-background-color", { + "theme": "dark", + "background_color": "#333", +}) +call-function: ("check-background-color", { + "theme": "light", + "background_color": "#eee", +}) diff --git a/tests/rustdoc-gui/label-next-to-symbol.goml b/tests/rustdoc-gui/label-next-to-symbol.goml index d23f9114d36..9a7de60bf38 100644 --- a/tests/rustdoc-gui/label-next-to-symbol.goml +++ b/tests/rustdoc-gui/label-next-to-symbol.goml @@ -27,14 +27,14 @@ compare-elements-position-near: ( compare-elements-position: ( ".item-name .stab.deprecated", ".item-name .stab.portability", - ("y"), + ["y"], ) // Ensure no wrap compare-elements-position: ( "//*[@class='item-name']//a[text()='replaced_function']/..", "//*[@class='desc docblock-short'][text()='a thing with a label']", - ("y"), + ["y"], ) // Mobile view @@ -49,19 +49,19 @@ compare-elements-position-near: ( compare-elements-position: ( ".item-name .stab.deprecated", ".item-name .stab.portability", - ("y"), + ["y"], ) // Ensure wrap compare-elements-position-false: ( "//*[@class='item-name']//a[text()='replaced_function']/..", "//*[@class='desc docblock-short'][text()='a thing with a label']", - ("y"), + ["y"], ) compare-elements-position-false: ( ".item-name .stab.deprecated", "//*[@class='desc docblock-short'][text()='a thing with a label']", - ("y"), + ["y"], ) // Ensure it doesn't expand. @@ -72,5 +72,5 @@ go-to: "file://" + |DOC_PATH| + "/test_docs/cfgs/index.html" compare-elements-position-false: ( "//*[@class='stab portability']/code[text()='appservice-api-c']", "//*[@class='stab portability']/code[text()='server']", - ("y"), + ["y"], ) diff --git a/tests/rustdoc-gui/links-color.goml b/tests/rustdoc-gui/links-color.goml index d88ebfb40d7..a1fb619a5d3 100644 --- a/tests/rustdoc-gui/links-color.goml +++ b/tests/rustdoc-gui/links-color.goml @@ -6,8 +6,8 @@ show-text: true define-function: ( "check-colors", - (theme, mod, macro, struct, enum, trait, fn, type, union, keyword, - sidebar, sidebar_current, sidebar_current_background), + [theme, mod, macro, struct, enum, trait, fn, type, union, keyword, + sidebar, sidebar_current, sidebar_current_background], block { set-local-storage: { "rustdoc-theme": |theme|, diff --git a/tests/rustdoc-gui/notable-trait.goml b/tests/rustdoc-gui/notable-trait.goml index e10bb538f07..0b1c6622596 100644 --- a/tests/rustdoc-gui/notable-trait.goml +++ b/tests/rustdoc-gui/notable-trait.goml @@ -7,13 +7,13 @@ set-window-size: (1100, 600) compare-elements-position: ( "//*[@id='method.create_an_iterator_from_read']//a[text()='NotableStructWithLongName']", "//*[@id='method.create_an_iterator_from_read']//*[@class='tooltip']", - ("y"), + ["y"], ) // Checking they don't have the same x position. compare-elements-position-false: ( "//*[@id='method.create_an_iterator_from_read']//a[text()='NotableStructWithLongName']", "//*[@id='method.create_an_iterator_from_read']//*[@class='tooltip']", - ("x"), + ["x"], ) // The `i` should be *after* the type. assert-position: ( @@ -37,7 +37,7 @@ compare-elements-position-near: ( compare-elements-position-false: ( "//*[@id='method.create_an_iterator_from_read']//*[@class='tooltip']", "//*[@class='tooltip popover']", - ("x") + ["x"] ) click: "//*[@id='method.create_an_iterator_from_read']//*[@class='tooltip']" move-cursor-to: "//h1" @@ -48,7 +48,7 @@ set-window-size: (1055, 600) compare-elements-position-false: ( "//*[@id='method.create_an_iterator_from_read']//a[text()='NotableStructWithLongName']", "//*[@id='method.create_an_iterator_from_read']//*[@class='tooltip']", - ("y", "x"), + ["y", "x"], ) // Now both the `i` and the struct name should be on the next line. @@ -57,13 +57,13 @@ set-window-size: (980, 600) compare-elements-position: ( "//*[@id='method.create_an_iterator_from_read']//a[text()='NotableStructWithLongName']", "//*[@id='method.create_an_iterator_from_read']//*[@class='tooltip']", - ("y"), + ["y"], ) // Checking they don't have the same x position. compare-elements-position-false: ( "//*[@id='method.create_an_iterator_from_read']//a[text()='NotableStructWithLongName']", "//*[@id='method.create_an_iterator_from_read']//*[@class='tooltip']", - ("x"), + ["x"], ) // The `i` should be *after* the type. assert-position: ( @@ -81,13 +81,13 @@ set-window-size: (650, 600) compare-elements-position: ( "//*[@id='method.create_an_iterator_from_read']//a[text()='NotableStructWithLongName']", "//*[@id='method.create_an_iterator_from_read']//*[@class='tooltip']", - ("y"), + ["y"], ) // Checking they don't have the same x position. compare-elements-position-false: ( "//*[@id='method.create_an_iterator_from_read']//a[text()='NotableStructWithLongName']", "//*[@id='method.create_an_iterator_from_read']//*[@class='tooltip']", - ("x"), + ["x"], ) // The `i` should be *after* the type. assert-position: ( @@ -109,7 +109,7 @@ compare-elements-position-near: ( compare-elements-position-false: ( "//*[@id='method.create_an_iterator_from_read']//*[@class='tooltip']", "//*[@class='tooltip popover']", - ("x") + ["x"] ) assert-position: ( "//*[@class='tooltip popover']", @@ -122,7 +122,7 @@ assert-count: ("//*[@class='tooltip popover']", 0) // Now check the colors. define-function: ( "check-colors", - (theme, header_color, content_color, type_color, trait_color, link_color), + [theme, header_color, content_color, type_color, trait_color, link_color], block { go-to: "file://" + |DOC_PATH| + "/test_docs/struct.NotableStructWithLongName.html" // This is needed to ensure that the text color is computed. diff --git a/tests/rustdoc-gui/pocket-menu.goml b/tests/rustdoc-gui/pocket-menu.goml index 404e5740305..b16150cd0d3 100644 --- a/tests/rustdoc-gui/pocket-menu.goml +++ b/tests/rustdoc-gui/pocket-menu.goml @@ -31,7 +31,7 @@ assert-css: ("#settings-menu .popover", {"display": "none"}) define-function: ( "check-popover-colors", - (theme, border_color), + [theme, border_color], block { set-local-storage: { "rustdoc-theme": |theme|, diff --git a/tests/rustdoc-gui/run-on-hover.goml b/tests/rustdoc-gui/run-on-hover.goml index 1f87febcec6..19b15afbac3 100644 --- a/tests/rustdoc-gui/run-on-hover.goml +++ b/tests/rustdoc-gui/run-on-hover.goml @@ -7,7 +7,7 @@ show-text: true define-function: ( "check-run-button", - (theme, color, background, hover_color, hover_background), + [theme, color, background, hover_color, hover_background], block { set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} reload: diff --git a/tests/rustdoc-gui/rust-logo.goml b/tests/rustdoc-gui/rust-logo.goml index dcf3d6bab63..a3b420e5eb9 100644 --- a/tests/rustdoc-gui/rust-logo.goml +++ b/tests/rustdoc-gui/rust-logo.goml @@ -3,7 +3,7 @@ go-to: "file://" + |DOC_PATH| + "/staged_api/index.html" define-function: ( "check-logo", - (theme, filter), + [theme, filter], block { // Going to the doc page. go-to: "file://" + |DOC_PATH| + "/staged_api/index.html" diff --git a/tests/rustdoc-gui/scrape-examples-color.goml b/tests/rustdoc-gui/scrape-examples-color.goml index 0052d18dc56..b1675a5f1fd 100644 --- a/tests/rustdoc-gui/scrape-examples-color.goml +++ b/tests/rustdoc-gui/scrape-examples-color.goml @@ -4,8 +4,8 @@ show-text: true define-function: ( "check-colors", - (theme, highlight, highlight_focus, help_border, help_color, help_hover_border, - help_hover_color), + [theme, highlight, highlight_focus, help_border, help_color, help_hover_border, + help_hover_color], block { set-local-storage: { "rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false", } reload: @@ -64,7 +64,7 @@ go-to: "file://" + |DOC_PATH| + "/scrape_examples/fn.test.html" define-function: ( "check-background", - (theme, background_color_start, background_color_end), + [theme, background_color_start, background_color_end], block { set-local-storage: { "rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false", } reload: diff --git a/tests/rustdoc-gui/scrape-examples-toggle.goml b/tests/rustdoc-gui/scrape-examples-toggle.goml index f742b3186e5..ea645d28924 100644 --- a/tests/rustdoc-gui/scrape-examples-toggle.goml +++ b/tests/rustdoc-gui/scrape-examples-toggle.goml @@ -5,7 +5,7 @@ go-to: "file://" + |DOC_PATH| + "/scrape_examples/fn.test_many.html" show-text: true define-function: ( "check-color", - (theme, toggle_line_color, toggle_line_hover_color), + [theme, toggle_line_color, toggle_line_hover_color], block { set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} reload: diff --git a/tests/rustdoc-gui/search-corrections.goml b/tests/rustdoc-gui/search-corrections.goml index aeb3c9b31a3..b81b1f382a9 100644 --- a/tests/rustdoc-gui/search-corrections.goml +++ b/tests/rustdoc-gui/search-corrections.goml @@ -4,7 +4,7 @@ // First, try a search-by-name go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" // Intentionally wrong spelling of "NotableStructWithLongName" -write: (".search-input", "NotableStructWithLongNamr") +write-into: (".search-input", "NotableStructWithLongNamr") // To be SURE that the search will be run. press-key: 'Enter' // Waiting for the search results to appear... @@ -41,7 +41,7 @@ assert-text: ( // Now, explicit return values go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" // Intentionally wrong spelling of "NotableStructWithLongName" -write: (".search-input", "-> NotableStructWithLongNamr") +write-into: (".search-input", "-> NotableStructWithLongNamr") // To be SURE that the search will be run. press-key: 'Enter' // Waiting for the search results to appear... @@ -58,7 +58,7 @@ assert-text: ( // Now, generic correction go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" // Intentionally wrong spelling of "NotableStructWithLongName" -write: (".search-input", "NotableStructWithLongNamr, NotableStructWithLongNamr") +write-into: (".search-input", "NotableStructWithLongNamr, NotableStructWithLongNamr") // To be SURE that the search will be run. press-key: 'Enter' // Waiting for the search results to appear... @@ -75,7 +75,7 @@ assert-text: ( // Now, generic correction plus error go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" // Intentionally wrong spelling of "NotableStructWithLongName" -write: (".search-input", "Foo<NotableStructWithLongNamr>,y") +write-into: (".search-input", "Foo<NotableStructWithLongNamr>,y") // To be SURE that the search will be run. press-key: 'Enter' // Waiting for the search results to appear... @@ -91,7 +91,7 @@ assert-text: ( go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" // Intentionally wrong spelling of "NotableStructWithLongName" -write: (".search-input", "generic:NotableStructWithLongNamr<x>,y") +write-into: (".search-input", "generic:NotableStructWithLongNamr<x>,y") // To be SURE that the search will be run. press-key: 'Enter' // Waiting for the search results to appear... diff --git a/tests/rustdoc-gui/search-error.goml b/tests/rustdoc-gui/search-error.goml index 70aeda1769a..d3de77b5635 100644 --- a/tests/rustdoc-gui/search-error.goml +++ b/tests/rustdoc-gui/search-error.goml @@ -4,7 +4,7 @@ show-text: true define-function: ( "check-colors", - (theme, error_background), + [theme, error_background], block { // Setting the theme. set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} diff --git a/tests/rustdoc-gui/search-filter.goml b/tests/rustdoc-gui/search-filter.goml index 9e2855b5e02..8c50322fcd4 100644 --- a/tests/rustdoc-gui/search-filter.goml +++ b/tests/rustdoc-gui/search-filter.goml @@ -1,7 +1,7 @@ // Checks that the crate search filtering is handled correctly and changes the results. go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" show-text: true -write: (".search-input", "test") +write-into: (".search-input", "test") // To be SURE that the search will be run. press-key: 'Enter' // Waiting for the search results to appear... diff --git a/tests/rustdoc-gui/search-form-elements.goml b/tests/rustdoc-gui/search-form-elements.goml index 0ea61a4f0eb..2fc66259291 100644 --- a/tests/rustdoc-gui/search-form-elements.goml +++ b/tests/rustdoc-gui/search-form-elements.goml @@ -4,10 +4,10 @@ show-text: true define-function: ( "check-search-colors", - ( + [ theme, border, background, search_input_color, search_input_border_focus, menu_button_border, menu_button_a_color, menu_button_a_border_hover, menu_a_color, - ), + ], block { set-local-storage: { "rustdoc-theme": |theme|, diff --git a/tests/rustdoc-gui/search-keyboard.goml b/tests/rustdoc-gui/search-keyboard.goml index f1d8024616b..707bb8f5faa 100644 --- a/tests/rustdoc-gui/search-keyboard.goml +++ b/tests/rustdoc-gui/search-keyboard.goml @@ -1,7 +1,7 @@ // Checks that the search tab results work correctly with function signature syntax // First, try a search-by-name go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" -write: (".search-input", "Foo") +write-into: (".search-input", "Foo") // To be SURE that the search will be run. press-key: 'Enter' // Waiting for the search results to appear... diff --git a/tests/rustdoc-gui/search-no-result.goml b/tests/rustdoc-gui/search-no-result.goml index e7c64791256..dda50ec3fb6 100644 --- a/tests/rustdoc-gui/search-no-result.goml +++ b/tests/rustdoc-gui/search-no-result.goml @@ -4,7 +4,7 @@ show-text: true define-function: ( "check-no-result", - (theme, link, link_hover), + [theme, link, link_hover], block { // Changing theme. set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} diff --git a/tests/rustdoc-gui/search-reexport.goml b/tests/rustdoc-gui/search-reexport.goml index b9d2c8f15ce..2e7c967d5c3 100644 --- a/tests/rustdoc-gui/search-reexport.goml +++ b/tests/rustdoc-gui/search-reexport.goml @@ -6,7 +6,7 @@ reload: // First we check that the reexport has the correct ID and no background color. assert-text: ("//*[@id='reexport.TheStdReexport']", "pub use ::std as TheStdReexport;") assert-css: ("//*[@id='reexport.TheStdReexport']", {"background-color": "rgba(0, 0, 0, 0)"}) -write: (".search-input", "TheStdReexport") +write-into: (".search-input", "TheStdReexport") // To be SURE that the search will be run. press-key: 'Enter' wait-for: "//a[@class='result-import']" @@ -22,7 +22,7 @@ wait-for-css: ("//*[@id='reexport.TheStdReexport']", {"background-color": "#494a // We now check that the alias is working as well on the reexport. // To be SURE that the search will be run. press-key: 'Enter' -write: (".search-input", "AliasForTheStdReexport") +write-into: (".search-input", "AliasForTheStdReexport") wait-for: "//a[@class='result-import']" assert-text: ( "a.result-import .result-name", diff --git a/tests/rustdoc-gui/search-result-color.goml b/tests/rustdoc-gui/search-result-color.goml index 44677dfbfef..1a19ea2d843 100644 --- a/tests/rustdoc-gui/search-result-color.goml +++ b/tests/rustdoc-gui/search-result-color.goml @@ -2,7 +2,7 @@ define-function: ( "check-result-color", - (result_kind, color, hover_color), + [result_kind, color, hover_color], block { assert-css: (".result-" + |result_kind| + " ." + |result_kind|, {"color": |color|}, ALL) assert-css: ( @@ -78,60 +78,60 @@ store-value: (hover_background_color, "#3c3c3c") // hover background color store-value: (grey, "#999") call-function: ( - "check-result-color", ( - "keyword", // item kind - "#39afd7", // color of item kind - "#39afd7", // color of hovered/focused item kind - ), + "check-result-color", { + "result_kind": "keyword", + "color": "#39afd7", + "hover_color": "#39afd7", + }, ) call-function: ( - "check-result-color", ( - "struct", // item kind - "#ffa0a5", // color of item kind - "#ffa0a5", // color of hovered/focused item kind - ), + "check-result-color", { + "result_kind": "struct", + "color": "#ffa0a5", + "hover_color": "#ffa0a5", + }, ) call-function: ( - "check-result-color", ( - "associatedtype", // item kind - "#39afd7", // color of item kind - "#39afd7", // color of hovered/focused item kind - ), + "check-result-color", { + "result_kind": "associatedtype", + "color": "#39afd7", + "hover_color": "#39afd7", + }, ) call-function: ( - "check-result-color", ( - "tymethod", // item kind - "#fdd687", // color of item kind - "#fdd687", // color of hovered/focused item kind - ), + "check-result-color", { + "result_kind": "tymethod", + "color": "#fdd687", + "hover_color": "#fdd687", + }, ) call-function: ( - "check-result-color", ( - "method", // item kind - "#fdd687", // color of item kind - "#fdd687", // color of hovered/focused item kind - ), + "check-result-color", { + "result_kind": "method", + "color": "#fdd687", + "hover_color": "#fdd687", + }, ) call-function: ( - "check-result-color", ( - "structfield", // item kind - "#0096cf", // color of item kind - "#fff", // color of hovered/focused item kind - ), + "check-result-color", { + "result_kind": "structfield", + "color": "#0096cf", + "hover_color": "#fff", + }, ) call-function: ( - "check-result-color", ( - "macro", // item kind - "#a37acc", // color of item kind - "#a37acc", // color of hovered/focused item kind - ), + "check-result-color", { + "result_kind": "macro", + "color": "#a37acc", + "hover_color": "#a37acc", + }, ) call-function: ( - "check-result-color", ( - "fn", // item kind - "#fdd687", // color of item kind - "#fdd687", // color of hovered/focused item kind - ), + "check-result-color", { + "result_kind": "fn", + "color": "#fdd687", + "hover_color": "#fdd687", + }, ) // Checking the `<a>` container. @@ -190,60 +190,60 @@ store-value: (hover_background_color, "#616161") // hover background color store-value: (grey, "#ccc") call-function: ( - "check-result-color", ( - "keyword", // item kind - "#d2991d", // color of item kind - "#d2991d", // color of hovered/focused item kind - ), + "check-result-color", { + "result_kind": "keyword", + "color": "#d2991d", + "hover_color": "#d2991d", + }, ) call-function: ( - "check-result-color", ( - "struct", // item kind - "#2dbfb8", // color of item kind - "#2dbfb8", // color of hovered/focused item kind - ), + "check-result-color", { + "result_kind": "struct", + "color": "#2dbfb8", + "hover_color": "#2dbfb8", + }, ) call-function: ( - "check-result-color", ( - "associatedtype", // item kind - "#d2991d", // color of item kind - "#d2991d", // color of hovered/focused item kind - ), + "check-result-color", { + "result_kind": "associatedtype", + "color": "#d2991d", + "hover_color": "#d2991d", + }, ) call-function: ( - "check-result-color", ( - "tymethod", // item kind - "#2bab63", // color of item kind - "#2bab63", // color of hovered/focused item kind - ), + "check-result-color", { + "result_kind": "tymethod", + "color": "#2bab63", + "hover_color": "#2bab63", + }, ) call-function: ( - "check-result-color", ( - "method", // item kind - "#2bab63", // color of item kind - "#2bab63", // color of hovered/focused item kind - ), + "check-result-color", { + "result_kind": "method", + "color": "#2bab63", + "hover_color": "#2bab63", + }, ) call-function: ( - "check-result-color", ( - "structfield", // item kind - "#ddd", // color of item kind - "#ddd", // color of hovered/focused item kind - ), + "check-result-color", { + "result_kind": "structfield", + "color": "#ddd", + "hover_color": "#ddd", + }, ) call-function: ( - "check-result-color", ( - "macro", // item kind - "#09bd00", // color of item kind - "#09bd00", // color of hovered/focused item kind - ), + "check-result-color", { + "result_kind": "macro", + "color": "#09bd00", + "hover_color": "#09bd00", + }, ) call-function: ( - "check-result-color", ( - "fn", // item kind - "#2bab63", // color of item kind - "#2bab63", // color of hovered/focused item kind - ), + "check-result-color", { + "result_kind": "fn", + "color": "#2bab63", + "hover_color": "#2bab63", + }, ) // Checking the `<a>` container. @@ -287,60 +287,60 @@ store-value: (hover_background_color, "#ccc") // hover background color store-value: (grey, "#999") call-function: ( - "check-result-color", ( - "keyword", // item kind - "#3873ad", // color of item kind - "#3873ad", // color of hovered/focused item kind - ), + "check-result-color", { + "result_kind": "keyword", + "color": "#3873ad", + "hover_color": "#3873ad", + }, ) call-function: ( - "check-result-color", ( - "struct", // item kind - "#ad378a", // color of item kind - "#ad378a", // color of hovered/focused item kind - ), + "check-result-color", { + "result_kind": "struct", + "color": "#ad378a", + "hover_color": "#ad378a", + }, ) call-function: ( - "check-result-color", ( - "associatedtype", // item kind - "#3873ad", // color of item kind - "#3873ad", // color of hovered/focused item kind - ), + "check-result-color", { + "result_kind": "associatedtype", + "color": "#3873ad", + "hover_color": "#3873ad", + }, ) call-function: ( - "check-result-color", ( - "tymethod", // item kind - "#ad7c37", // color of item kind - "#ad7c37", // color of hovered/focused item kind - ), + "check-result-color", { + "result_kind": "tymethod", + "color": "#ad7c37", + "hover_color": "#ad7c37", + }, ) call-function: ( - "check-result-color", ( - "method", // item kind - "#ad7c37", // color of item kind - "#ad7c37", // color of hovered/focused item kind - ), + "check-result-color", { + "result_kind": "method", + "color": "#ad7c37", + "hover_color": "#ad7c37", + }, ) call-function: ( - "check-result-color", ( - "structfield", // item kind - "#000", // color of item kind - "#000", // color of hovered/focused item kind - ), + "check-result-color", { + "result_kind": "structfield", + "color": "#000", + "hover_color": "#000", + }, ) call-function: ( - "check-result-color", ( - "macro", // item kind - "#068000", // color of item kind - "#068000", // color of hovered/focused item kind - ), + "check-result-color", { + "result_kind": "macro", + "color": "#068000", + "hover_color": "#068000", + }, ) call-function: ( - "check-result-color", ( - "fn", // item kind - "#ad7c37", // color of item kind - "#ad7c37", // color of hovered/focused item kind - ), + "check-result-color", { + "result_kind": "fn", + "color": "#ad7c37", + "hover_color": "#ad7c37", + }, ) // Checking the `<a>` container. @@ -358,11 +358,11 @@ show-text: true define-function: ( "check-alias", - (theme, alias, grey), + [theme, alias, grey], block { set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} reload: - write: (".search-input", "thisisanalias") + write-into: (".search-input", "thisisanalias") // To be SURE that the search will be run. press-key: 'Enter' // Waiting for the search results to appear... diff --git a/tests/rustdoc-gui/search-result-display.goml b/tests/rustdoc-gui/search-result-display.goml index 6ce13b8c3d3..b1a5548808e 100644 --- a/tests/rustdoc-gui/search-result-display.goml +++ b/tests/rustdoc-gui/search-result-display.goml @@ -2,7 +2,7 @@ // Checks that the search results have the expected width. go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" set-window-size: (900, 1000) -write: (".search-input", "test") +write-into: (".search-input", "test") // To be SURE that the search will be run. press-key: 'Enter' wait-for: "#crate-search" @@ -69,7 +69,7 @@ assert-css: ("#search", {"width": "640px"}) show-text: true define-function: ( "check-filter", - (theme, border, filter, hover_border, hover_filter), + [theme, border, filter, hover_border, hover_filter], block { set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} reload: diff --git a/tests/rustdoc-gui/search-result-impl-disambiguation.goml b/tests/rustdoc-gui/search-result-impl-disambiguation.goml index 6d12032e891..3e49ac33025 100644 --- a/tests/rustdoc-gui/search-result-impl-disambiguation.goml +++ b/tests/rustdoc-gui/search-result-impl-disambiguation.goml @@ -5,7 +5,7 @@ go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" // This should link to the inherent impl -write: (".search-input", "ZyxwvutMethodDisambiguation -> bool") +write-into: (".search-input", "ZyxwvutMethodDisambiguation -> bool") // To be SURE that the search will be run. press-key: 'Enter' // Waiting for the search results to appear... @@ -25,7 +25,7 @@ assert: "section:target" go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" // This should link to the trait impl -write: (".search-input", "ZyxwvutMethodDisambiguation, usize -> usize") +write-into: (".search-input", "ZyxwvutMethodDisambiguation, usize -> usize") // To be SURE that the search will be run. press-key: 'Enter' // Waiting for the search results to appear... diff --git a/tests/rustdoc-gui/search-result-keyword.goml b/tests/rustdoc-gui/search-result-keyword.goml index 1b2be6d4e3e..370edce2ddd 100644 --- a/tests/rustdoc-gui/search-result-keyword.goml +++ b/tests/rustdoc-gui/search-result-keyword.goml @@ -1,6 +1,6 @@ // Checks that the "keyword" results have the expected text alongside them. go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" -write: (".search-input", "CookieMonster") +write-into: (".search-input", "CookieMonster") // To be SURE that the search will be run. press-key: 'Enter' // Waiting for the search results to appear... diff --git a/tests/rustdoc-gui/search-tab-change-title-fn-sig.goml b/tests/rustdoc-gui/search-tab-change-title-fn-sig.goml index 156d8d03ca2..7e26229ec6e 100644 --- a/tests/rustdoc-gui/search-tab-change-title-fn-sig.goml +++ b/tests/rustdoc-gui/search-tab-change-title-fn-sig.goml @@ -1,7 +1,7 @@ // Checks that the search tab results work correctly with function signature syntax // First, try a search-by-name go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" -write: (".search-input", "Foo") +write-into: (".search-input", "Foo") // To be SURE that the search will be run. press-key: 'Enter' // Waiting for the search results to appear... @@ -23,7 +23,7 @@ wait-for-attribute: ("#search-tabs > button:nth-of-type(3)", {"class": "selected // Now try search-by-return go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" -write: (".search-input", "-> String") +write-into: (".search-input", "-> String") // To be SURE that the search will be run. press-key: 'Enter' // Waiting for the search results to appear... @@ -45,7 +45,7 @@ wait-for-attribute: ("#search-tabs > button:nth-of-type(1)", {"class": "selected // Try with a search-by-return with no results go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" -write: (".search-input", "-> Something") +write-into: (".search-input", "-> Something") // To be SURE that the search will be run. press-key: 'Enter' // Waiting for the search results to appear... @@ -55,7 +55,7 @@ assert-text: ("#search-tabs > button:nth-of-type(1)", "In Function Return Types" // Try with a search-by-parameter go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" -write: (".search-input", "usize,pattern") +write-into: (".search-input", "usize,pattern") // To be SURE that the search will be run. press-key: 'Enter' // Waiting for the search results to appear... @@ -65,7 +65,7 @@ assert-text: ("#search-tabs > button:nth-of-type(1)", "In Function Parameters", // Try with a search-by-parameter-and-return go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" -write: (".search-input", "pattern -> str") +write-into: (".search-input", "pattern -> str") // To be SURE that the search will be run. press-key: 'Enter' // Waiting for the search results to appear... diff --git a/tests/rustdoc-gui/search-tab.goml b/tests/rustdoc-gui/search-tab.goml index b52bb0688c1..c33866593c3 100644 --- a/tests/rustdoc-gui/search-tab.goml +++ b/tests/rustdoc-gui/search-tab.goml @@ -4,9 +4,9 @@ show-text: true define-function: ( "check-colors", - (theme, background, background_selected, background_hover, border_bottom, + [theme, background, background_selected, background_hover, border_bottom, border_bottom_selected, border_bottom_hover, border_top, border_top_selected, - border_top_hover), + border_top_hover], block { // Setting the theme. set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} @@ -93,12 +93,12 @@ assert-property: ("#search-tabs > button:nth-child(3) > .count", {"offsetWidth": compare-elements-position: ( "#search-tabs > button:nth-child(1) > .count", "#search-tabs > button:nth-child(2) > .count", - ("y") + ["y"] ) compare-elements-position: ( "#search-tabs > button:nth-child(2) > .count", "#search-tabs > button:nth-child(3) > .count", - ("y") + ["y"] ) // Check that counts are beside the titles and haven't wrapped compare-elements-position-near: ( @@ -135,12 +135,12 @@ assert-property: ("#search-tabs > button:nth-child(3) > .count", {"offsetWidth": compare-elements-position: ( "#search-tabs > button:nth-child(1) > .count", "#search-tabs > button:nth-child(2) > .count", - ("y") + ["y"] ) compare-elements-position: ( "#search-tabs > button:nth-child(2) > .count", "#search-tabs > button:nth-child(3) > .count", - ("y") + ["y"] ) // Check that counts are NOT beside the titles; now they have wrapped compare-elements-position-near-false: ( diff --git a/tests/rustdoc-gui/setting-auto-hide-content-large-items.goml b/tests/rustdoc-gui/setting-auto-hide-content-large-items.goml index b55a1cfd92b..9afde7c61da 100644 --- a/tests/rustdoc-gui/setting-auto-hide-content-large-items.goml +++ b/tests/rustdoc-gui/setting-auto-hide-content-large-items.goml @@ -6,7 +6,7 @@ fail-on-request-error: false define-function: ( "check-setting", - (storage_value, setting_attribute_value, toggle_attribute_value), + [storage_value, setting_attribute_value, toggle_attribute_value], block { assert-local-storage: {"rustdoc-auto-hide-large-items": |storage_value|} click: "#settings-menu" diff --git a/tests/rustdoc-gui/setting-auto-hide-item-methods-docs.goml b/tests/rustdoc-gui/setting-auto-hide-item-methods-docs.goml index 5210ad8f793..644396ed578 100644 --- a/tests/rustdoc-gui/setting-auto-hide-item-methods-docs.goml +++ b/tests/rustdoc-gui/setting-auto-hide-item-methods-docs.goml @@ -3,7 +3,7 @@ define-function: ( "check-setting", - (storage_value, setting_attribute_value, toggle_attribute_value), + [storage_value, setting_attribute_value, toggle_attribute_value], block { assert-local-storage: {"rustdoc-auto-hide-method-docs": |storage_value|} click: "#settings-menu" diff --git a/tests/rustdoc-gui/setting-auto-hide-trait-implementations.goml b/tests/rustdoc-gui/setting-auto-hide-trait-implementations.goml index ecadd8fa80e..3c09198dae5 100644 --- a/tests/rustdoc-gui/setting-auto-hide-trait-implementations.goml +++ b/tests/rustdoc-gui/setting-auto-hide-trait-implementations.goml @@ -2,7 +2,7 @@ define-function: ( "check-setting", - (storage_value, setting_attribute_value, toggle_attribute_value), + [storage_value, setting_attribute_value, toggle_attribute_value], block { assert-local-storage: {"rustdoc-auto-hide-trait-implementations": |storage_value|} click: "#settings-menu" diff --git a/tests/rustdoc-gui/setting-go-to-only-result.goml b/tests/rustdoc-gui/setting-go-to-only-result.goml index 45e0b349051..f8535477c22 100644 --- a/tests/rustdoc-gui/setting-go-to-only-result.goml +++ b/tests/rustdoc-gui/setting-go-to-only-result.goml @@ -2,7 +2,7 @@ define-function: ( "check-setting", - (storage_value, setting_attribute_value), + [storage_value, setting_attribute_value], block { assert-local-storage: {"rustdoc-go-to-only-result": |storage_value|} click: "#settings-menu" @@ -32,7 +32,7 @@ assert-local-storage: {"rustdoc-go-to-only-result": "true"} go-to: "file://" + |DOC_PATH| + "/lib2/index.html" // We enter it into the search. -write: (".search-input", "HasALongTraitWithParams") +write-into: (".search-input", "HasALongTraitWithParams") wait-for-document-property: {"title": "HasALongTraitWithParams in lib2 - Rust"} assert-window-property: ({"location": "/lib2/struct.HasALongTraitWithParams.html"}, ENDS_WITH) diff --git a/tests/rustdoc-gui/settings.goml b/tests/rustdoc-gui/settings.goml index e40c637dcf7..0bb21c28cb5 100644 --- a/tests/rustdoc-gui/settings.goml +++ b/tests/rustdoc-gui/settings.goml @@ -304,7 +304,7 @@ wait-for: "#settings" assert-css: (".setting-radio", {"cursor": "pointer"}) assert-attribute-false: ("#settings", {"class": "popover"}, CONTAINS) -compare-elements-position: (".sub form", "#settings", ("x")) +compare-elements-position: (".sub form", "#settings", ["x"]) // Check that setting-line has the same margin in this mode as in the popover. assert-css: (".setting-line", {"margin": |setting_line_margin|}) diff --git a/tests/rustdoc-gui/sidebar-links-color.goml b/tests/rustdoc-gui/sidebar-links-color.goml index 774fbcac1e2..0edffc51a81 100644 --- a/tests/rustdoc-gui/sidebar-links-color.goml +++ b/tests/rustdoc-gui/sidebar-links-color.goml @@ -6,12 +6,12 @@ show-text: true define-function: ( "check-colors", - ( + [ theme, struct, struct_hover, struct_hover_background, enum, enum_hover, enum_hover_background, union, union_hover, union_hover_background, trait, trait_hover, trait_hover_background, fn, fn_hover, fn_hover_background, type, type_hover, type_hover_background, keyword, keyword_hover, keyword_hover_background, - ), + ], block { set-local-storage: { "rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false" } reload: diff --git a/tests/rustdoc-gui/sidebar-mobile.goml b/tests/rustdoc-gui/sidebar-mobile.goml index d3a82d9ebe6..8843de8d7e9 100644 --- a/tests/rustdoc-gui/sidebar-mobile.goml +++ b/tests/rustdoc-gui/sidebar-mobile.goml @@ -57,7 +57,7 @@ show-text: true define-function: ( "check-colors", - (theme, color, background), + [theme, color, background], block { set-local-storage: {"rustdoc-use-system-theme": "false", "rustdoc-theme": |theme|} reload: diff --git a/tests/rustdoc-gui/sidebar-source-code-display.goml b/tests/rustdoc-gui/sidebar-source-code-display.goml index 5149d4991f7..41c8e45f4a6 100644 --- a/tests/rustdoc-gui/sidebar-source-code-display.goml +++ b/tests/rustdoc-gui/sidebar-source-code-display.goml @@ -30,9 +30,9 @@ show-text: true define-function: ( "check-colors", - ( + [ theme, color, color_hover, background, background_hover, background_toggle, - ), + ], block { set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} reload: diff --git a/tests/rustdoc-gui/sidebar-source-code.goml b/tests/rustdoc-gui/sidebar-source-code.goml index d7de43a2243..3f7ef643d18 100644 --- a/tests/rustdoc-gui/sidebar-source-code.goml +++ b/tests/rustdoc-gui/sidebar-source-code.goml @@ -6,7 +6,7 @@ show-text: true // First, check the sidebar colors. define-function: ( "check-colors", - (theme, color, background_color), + [theme, color, background_color], block { set-local-storage: { "rustdoc-theme": |theme|, diff --git a/tests/rustdoc-gui/sidebar.goml b/tests/rustdoc-gui/sidebar.goml index 82b4f2e9429..115b1eb323c 100644 --- a/tests/rustdoc-gui/sidebar.goml +++ b/tests/rustdoc-gui/sidebar.goml @@ -6,7 +6,7 @@ show-text: true // First, check the sidebar colors. define-function: ( "check-colors", - (theme, color, background_color), + [theme, color, background_color], block { set-local-storage: { "rustdoc-theme": |theme|, diff --git a/tests/rustdoc-gui/source-code-page.goml b/tests/rustdoc-gui/source-code-page.goml index 8b4d7617e0c..e29d123d227 100644 --- a/tests/rustdoc-gui/source-code-page.goml +++ b/tests/rustdoc-gui/source-code-page.goml @@ -21,7 +21,7 @@ assert-attribute-false: (".src-line-numbers > a:nth-child(7)", {"class": "line-h define-function: ( "check-colors", - (theme, color, background_color, highlight_color, highlight_background_color), + [theme, color, background_color, highlight_color, highlight_background_color], block { set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} reload: @@ -61,7 +61,7 @@ call-function: ("check-colors", { }) // This is to ensure that the content is correctly align with the line numbers. -compare-elements-position: ("//*[@id='1']", ".rust > code > span", ("y")) +compare-elements-position: ("//*[@id='1']", ".rust > code > span", ["y"]) // Check the `href` property so that users can treat anchors as links. assert-property: (".src-line-numbers > a:nth-child(1)", { "href": |DOC_PATH| + "/src/test_docs/lib.rs.html#1" @@ -122,7 +122,7 @@ store-property: ( ) define-function: ( "check-sidebar-dir-entry", - (x, y), + [x, y], block { assert: "details:first-of-type.dir-entry[open] > summary::marker" assert-css: ("#src-sidebar > details:first-of-type.dir-entry", {"padding-left": "4px"}) diff --git a/tests/rustdoc-gui/stab-badge.goml b/tests/rustdoc-gui/stab-badge.goml index bb3d2aaa3dc..46df0946c45 100644 --- a/tests/rustdoc-gui/stab-badge.goml +++ b/tests/rustdoc-gui/stab-badge.goml @@ -3,7 +3,7 @@ go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" show-text: true define-function: ( "check-badge", - (theme, background, color), + [theme, background, color], block { set-local-storage: {"rustdoc-use-system-theme": "false", "rustdoc-theme": |theme|} go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" diff --git a/tests/rustdoc-gui/target.goml b/tests/rustdoc-gui/target.goml index 26071df8d04..0f8f7709363 100644 --- a/tests/rustdoc-gui/target.goml +++ b/tests/rustdoc-gui/target.goml @@ -7,7 +7,7 @@ assert: "#method\.a_method:target" define-function: ( "check-style", - (theme, background, border), + [theme, background, border], block { set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} reload: diff --git a/tests/rustdoc-gui/toggle-docs.goml b/tests/rustdoc-gui/toggle-docs.goml index 9ea6d9b18f4..cfd18bd2e14 100644 --- a/tests/rustdoc-gui/toggle-docs.goml +++ b/tests/rustdoc-gui/toggle-docs.goml @@ -49,7 +49,7 @@ assert-attribute: ("details.toggle", {"open": ""}, ALL) show-text: true define-function: ( "check-color", - (theme, filter), + [theme, filter], block { // Setting the theme. set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} diff --git a/tests/rustdoc-gui/type-declation-overflow.goml b/tests/rustdoc-gui/type-declation-overflow.goml index a97cc98897a..3709aa10266 100644 --- a/tests/rustdoc-gui/type-declation-overflow.goml +++ b/tests/rustdoc-gui/type-declation-overflow.goml @@ -47,18 +47,18 @@ assert-css: (".mobile-topbar h2", {"overflow-x": "hidden"}) // On desktop, they wrap when too big. set-window-size: (1100, 800) go-to: "file://" + |DOC_PATH| + "/lib2/too_long/struct.SuperIncrediblyLongLongLongLongLongLongLongGigaGigaGigaMegaLongLongLongStructName.html" -compare-elements-position-false: (".main-heading h1", ".main-heading .out-of-band", ("y")) +compare-elements-position-false: (".main-heading h1", ".main-heading .out-of-band", ["y"]) go-to: "file://" + |DOC_PATH| + "/lib2/index.html" -compare-elements-position: (".main-heading h1", ".main-heading .out-of-band", ("y")) +compare-elements-position: (".main-heading h1", ".main-heading .out-of-band", ["y"]) // make sure there is a gap between them compare-elements-position-near-false: (".main-heading h1", ".main-heading .out-of-band", {"x": 550}) // On mobile, they always wrap. set-window-size: (600, 600) go-to: "file://" + |DOC_PATH| + "/lib2/too_long/struct.SuperIncrediblyLongLongLongLongLongLongLongGigaGigaGigaMegaLongLongLongStructName.html" -compare-elements-position-false: (".main-heading h1", ".main-heading .out-of-band", ("y")) +compare-elements-position-false: (".main-heading h1", ".main-heading .out-of-band", ["y"]) go-to: "file://" + |DOC_PATH| + "/lib2/index.html" -compare-elements-position-false: (".main-heading h1", ".main-heading .out-of-band", ("y")) +compare-elements-position-false: (".main-heading h1", ".main-heading .out-of-band", ["y"]) // Now we will check that the scrolling is working. // First on an item with "hidden methods". diff --git a/tests/rustdoc-gui/unsafe-fn.goml b/tests/rustdoc-gui/unsafe-fn.goml index 8d26f15f37f..83503121a04 100644 --- a/tests/rustdoc-gui/unsafe-fn.goml +++ b/tests/rustdoc-gui/unsafe-fn.goml @@ -13,7 +13,7 @@ define-function: ( "sup-check", // `theme` is the theme being tested. // `color` is the expected color of the `<sup>` element. - (theme, color), + [theme, color], block { // Set the theme. set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} @@ -23,6 +23,15 @@ define-function: ( }, ) -call-function: ("sup-check", ("ayu", "#c5c5c5")) -call-function: ("sup-check", ("dark", "#ddd")) -call-function: ("sup-check", ("light", "black")) +call-function: ("sup-check", { + "theme": "ayu", + "color": "#c5c5c5", +}) +call-function: ("sup-check", { + "theme": "dark", + "color": "#ddd", +}) +call-function: ("sup-check", { + "theme": "light", + "color": "black", +}) diff --git a/tests/rustdoc-gui/warning-block.goml b/tests/rustdoc-gui/warning-block.goml index 10e206049f5..a5a47f868db 100644 --- a/tests/rustdoc-gui/warning-block.goml +++ b/tests/rustdoc-gui/warning-block.goml @@ -5,7 +5,7 @@ show-text: true store-value: (default_y_pos, 5) define-function: ( "check-warning", - (theme, color, border_color), + [theme, color, border_color], block { set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} reload: diff --git a/tests/rustdoc-gui/where-whitespace.goml b/tests/rustdoc-gui/where-whitespace.goml index da104fa4011..823ce970407 100644 --- a/tests/rustdoc-gui/where-whitespace.goml +++ b/tests/rustdoc-gui/where-whitespace.goml @@ -3,25 +3,25 @@ go-to: "file://" + |DOC_PATH| + "/lib2/trait.Whitespace.html" show-text: true // First, we check in the trait definition if the where clause is "on its own" (not on the same // line than "pub trait Whitespace<Idx>"). -compare-elements-position-false: (".item-decl code", "div.where", ("y")) +compare-elements-position-false: (".item-decl code", "div.where", ["y"]) // And that the code following it isn't on the same line either. -compare-elements-position-false: (".item-decl .fn", "div.where", ("y")) +compare-elements-position-false: (".item-decl .fn", "div.where", ["y"]) go-to: "file://" + |DOC_PATH| + "/lib2/struct.WhereWhitespace.html" // We make the screen a bit wider to ensure that the trait impl is on one line. set-window-size: (915, 915) -compare-elements-position-false: ("#method\.new .fn", "#method\.new div.where", ("y")) +compare-elements-position-false: ("#method\.new .fn", "#method\.new div.where", ["y"]) // We ensure that both the trait name and the struct name are on the same line in // "impl<K, T> Whitespace<&K> for WhereWhitespace<T>". compare-elements-position: ( "#trait-implementations-list .impl h3 .trait", "#trait-implementations-list .impl h3 .struct", - ("y"), + ["y"], ) // And we now check that the where condition isn't on the same line. compare-elements-position-false: ( "#trait-implementations-list .impl h3 .trait", "#trait-implementations-list .impl h3 div.where", - ("y"), + ["y"], ) diff --git a/tests/rustdoc-ui/synthetic-auto-trait-impls/const-in-super-trait-and-item-bound.rs b/tests/rustdoc-ui/synthetic-auto-trait-impls/const-in-super-trait-and-item-bound.rs new file mode 100644 index 00000000000..df6de6769d5 --- /dev/null +++ b/tests/rustdoc-ui/synthetic-auto-trait-impls/const-in-super-trait-and-item-bound.rs @@ -0,0 +1,23 @@ +// We used to ICE here while trying to synthesize auto trait impls. +// issue: 107715 +//@ check-pass + +pub const N: usize = 1; + +pub struct MapType<K: Supertrait<V>, V> { + _array: K::Array, +} + +pub trait Subtrait: Supertrait<[u8; N]> {} + +pub trait Supertrait<V> { + type Array: AnotherTrait<V>; +} + +pub trait AnotherTrait<V> { + const LENGTH: usize; +} + +pub struct Container<S: Subtrait> { + _x: MapType<S, [u8; N]>, +} diff --git a/tests/rustdoc-ui/synthetic-auto-trait-impls/lifetime-generic-user-impl-normalize.rs b/tests/rustdoc-ui/synthetic-auto-trait-impls/lifetime-generic-user-impl-normalize.rs new file mode 100644 index 00000000000..1b67c2bc875 --- /dev/null +++ b/tests/rustdoc-ui/synthetic-auto-trait-impls/lifetime-generic-user-impl-normalize.rs @@ -0,0 +1,17 @@ +// We used to ICE here while trying to synthesize auto trait impls. +// issue: 112242 +//@ check-pass +//@ compile-flags: -Znormalize-docs + +pub trait MyTrait<'a> { + type MyItem; +} +pub struct Inner<Q>(Q); +pub struct Outer<Q>(Inner<Q>); + +impl<'a, Q> std::marker::Unpin for Inner<Q> +where + Q: MyTrait<'a>, + <Q as MyTrait<'a>>::MyItem: Copy, +{ +} diff --git a/tests/rustdoc-ui/synthetic-auto-trait-impls/lifetime-generic-user-impl.rs b/tests/rustdoc-ui/synthetic-auto-trait-impls/lifetime-generic-user-impl.rs new file mode 100644 index 00000000000..31d1b11ff31 --- /dev/null +++ b/tests/rustdoc-ui/synthetic-auto-trait-impls/lifetime-generic-user-impl.rs @@ -0,0 +1,11 @@ +// We used to ICE here while trying to synthesize auto trait impls. +// issue: 123370 +//@ check-pass + +pub struct Inner<'a, Q>(&'a (), Q); + +pub struct Outer<'a, Q>(Inner<'a, Q>); + +impl<'a, Q: Trait<'a>> std::marker::Unpin for Inner<'static, Q> {} + +pub trait Trait<'a> {} diff --git a/tests/rustdoc-ui/synthetic-auto-trait-impls/projections-in-super-trait-bound-unsatisfied.rs b/tests/rustdoc-ui/synthetic-auto-trait-impls/projections-in-super-trait-bound-unsatisfied.rs new file mode 100644 index 00000000000..f62f8396e99 --- /dev/null +++ b/tests/rustdoc-ui/synthetic-auto-trait-impls/projections-in-super-trait-bound-unsatisfied.rs @@ -0,0 +1,18 @@ +// We used to ICE here while trying to synthesize auto trait impls. +// issue: 114657 + +pub trait Foo { + type FooType; +} + +pub trait Bar<const A: usize>: Foo<FooType = <Self as Bar<A>>::BarType> { + type BarType; +} + +pub(crate) const B: usize = 5; + +pub trait Tec: Bar<B> {} + +pub struct Structure<C: Tec> { //~ ERROR the trait bound `C: Bar<5>` is not satisfied + _field: C::BarType, //~ ERROR the trait bound `C: Bar<5>` is not satisfied +} diff --git a/tests/rustdoc-ui/synthetic-auto-trait-impls/projections-in-super-trait-bound-unsatisfied.stderr b/tests/rustdoc-ui/synthetic-auto-trait-impls/projections-in-super-trait-bound-unsatisfied.stderr new file mode 100644 index 00000000000..d87e769b505 --- /dev/null +++ b/tests/rustdoc-ui/synthetic-auto-trait-impls/projections-in-super-trait-bound-unsatisfied.stderr @@ -0,0 +1,25 @@ +error[E0277]: the trait bound `C: Bar<5>` is not satisfied + --> $DIR/projections-in-super-trait-bound-unsatisfied.rs:16:1 + | +LL | pub struct Structure<C: Tec> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bar<5>` is not implemented for `C` + | +help: consider further restricting this bound + | +LL | pub struct Structure<C: Tec + Bar<5>> { + | ++++++++ + +error[E0277]: the trait bound `C: Bar<5>` is not satisfied + --> $DIR/projections-in-super-trait-bound-unsatisfied.rs:17:13 + | +LL | _field: C::BarType, + | ^^^^^^^^^^ the trait `Bar<5>` is not implemented for `C` + | +help: consider further restricting this bound + | +LL | pub struct Structure<C: Tec + Bar<5>> { + | ++++++++ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/rustdoc-ui/synthetic-auto-trait-impls/unconstrained-param-in-impl-ambiguity.rs b/tests/rustdoc-ui/synthetic-auto-trait-impls/unconstrained-param-in-impl-ambiguity.rs new file mode 100644 index 00000000000..6c62415e06d --- /dev/null +++ b/tests/rustdoc-ui/synthetic-auto-trait-impls/unconstrained-param-in-impl-ambiguity.rs @@ -0,0 +1,10 @@ +// We used to ICE here while trying to synthesize auto trait impls. +// issue: 112828 + +struct Outer(Inner); +struct Inner; + +unsafe impl<Q: Trait> Send for Inner {} +//~^ ERROR the type parameter `Q` is not constrained by the impl trait, self type, or predicates + +trait Trait {} diff --git a/tests/rustdoc-ui/synthetic-auto-trait-impls/unconstrained-param-in-impl-ambiguity.stderr b/tests/rustdoc-ui/synthetic-auto-trait-impls/unconstrained-param-in-impl-ambiguity.stderr new file mode 100644 index 00000000000..38d1a537fe4 --- /dev/null +++ b/tests/rustdoc-ui/synthetic-auto-trait-impls/unconstrained-param-in-impl-ambiguity.stderr @@ -0,0 +1,9 @@ +error[E0207]: the type parameter `Q` is not constrained by the impl trait, self type, or predicates + --> $DIR/unconstrained-param-in-impl-ambiguity.rs:7:13 + | +LL | unsafe impl<Q: Trait> Send for Inner {} + | ^ unconstrained type parameter + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0207`. diff --git a/tests/rustdoc/search-index-summaries.rs b/tests/rustdoc/search-index-summaries.rs index efd366405bf..529b42d0ca9 100644 --- a/tests/rustdoc/search-index-summaries.rs +++ b/tests/rustdoc/search-index-summaries.rs @@ -1,6 +1,6 @@ #![crate_name = "foo"] -// @hasraw 'search-index.js' 'Foo short link.' +// @hasraw 'search.desc/foo/foo-desc-0-.js' 'Foo short link.' // @!hasraw - 'www.example.com' // @!hasraw - 'More Foo.' diff --git a/tests/rustdoc/synthetic_auto/bounds.rs b/tests/rustdoc/synthetic_auto/bounds.rs new file mode 100644 index 00000000000..17528d01c8d --- /dev/null +++ b/tests/rustdoc/synthetic_auto/bounds.rs @@ -0,0 +1,21 @@ +pub struct Outer<T>(Inner<T>); +pub struct Inner<T>(T); + +// @has bounds/struct.Outer.html +// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]//h3[@class="code-header"]' \ +// "impl<T> Unpin for Outer<T>where \ +// T: for<'any> Trait<A = (), B<'any> = (), X = ()>," + +impl<T> std::marker::Unpin for Inner<T> +where + T: for<'any> Trait<A = (), B<'any> = (), X = ()>, +{} + +pub trait Trait: SuperTrait { + type A; + type B<'a>; +} + +pub trait SuperTrait { + type X; +} diff --git a/tests/rustdoc/synthetic_auto/complex.rs b/tests/rustdoc/synthetic_auto/complex.rs index 4c39f0bf1e0..2722f6d338f 100644 --- a/tests/rustdoc/synthetic_auto/complex.rs +++ b/tests/rustdoc/synthetic_auto/complex.rs @@ -21,8 +21,8 @@ mod foo { // @has complex/struct.NotOuter.html // @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]//h3[@class="code-header"]' \ -// "impl<'a, T, K: ?Sized> Send for Outer<'a, T, K>where K: for<'b> Fn((&'b bool, &'a u8)) \ -// -> &'b i8, T: MyTrait<'a>, <T as MyTrait<'a>>::MyItem: Copy, 'a: 'static" +// "impl<'a, T, K> Send for Outer<'a, T, K>where 'a: 'static, T: MyTrait<'a>, \ +// K: for<'b> Fn((&'b bool, &'a u8)) -> &'b i8 + ?Sized, <T as MyTrait<'a>>::MyItem: Copy," pub use foo::{Foo, Inner as NotInner, MyTrait as NotMyTrait, Outer as NotOuter}; diff --git a/tests/rustdoc/synthetic_auto/lifetimes.rs b/tests/rustdoc/synthetic_auto/lifetimes.rs index 71265b3078a..23e1efdaeef 100644 --- a/tests/rustdoc/synthetic_auto/lifetimes.rs +++ b/tests/rustdoc/synthetic_auto/lifetimes.rs @@ -10,7 +10,7 @@ where // @has lifetimes/struct.Foo.html // @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]//h3[@class="code-header"]' \ -// "impl<'c, K> Send for Foo<'c, K>where K: for<'b> Fn(&'b bool) -> &'c u8, 'c: 'static" +// "impl<'c, K> Send for Foo<'c, K>where 'c: 'static, K: for<'b> Fn(&'b bool) -> &'c u8," // // @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]//h3[@class="code-header"]' \ // "impl<'c, K> Sync for Foo<'c, K>where K: Sync" diff --git a/tests/rustdoc/synthetic_auto/no-redundancy.rs b/tests/rustdoc/synthetic_auto/no-redundancy.rs index d30b38dd4dc..64dab429647 100644 --- a/tests/rustdoc/synthetic_auto/no-redundancy.rs +++ b/tests/rustdoc/synthetic_auto/no-redundancy.rs @@ -1,6 +1,3 @@ -// FIXME(fmease, #119216): Reenable this test! -//@ ignore-test - pub struct Inner<T> { field: T, } @@ -13,7 +10,7 @@ where // @has no_redundancy/struct.Outer.html // @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]//h3[@class="code-header"]' \ -// "impl<T> Send for Outer<T>where T: Send + Copy" +// "impl<T> Send for Outer<T>where T: Copy + Send" pub struct Outer<T> { inner_field: Inner<T>, } diff --git a/tests/rustdoc/synthetic_auto/project.rs b/tests/rustdoc/synthetic_auto/project.rs index 7c9412ae962..f4ede76e6de 100644 --- a/tests/rustdoc/synthetic_auto/project.rs +++ b/tests/rustdoc/synthetic_auto/project.rs @@ -24,11 +24,11 @@ where // @has project/struct.Foo.html // @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]//h3[@class="code-header"]' \ -// "impl<'c, K> Send for Foo<'c, K>where K: MyTrait<MyItem = bool>, 'c: 'static" +// "impl<'c, K> Send for Foo<'c, K>where 'c: 'static, K: MyTrait<MyItem = bool>," // // @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl"]//h3[@class="code-header"]' \ -// "impl<'c, K> Sync for Foo<'c, K>where K: MyTrait, <K as MyTrait>::MyItem: OtherTrait, \ -// 'c: 'static," +// "impl<'c, K> Sync for Foo<'c, K>where 'c: 'static, K: MyTrait, \ +// <K as MyTrait>::MyItem: OtherTrait," pub struct Foo<'c, K: 'c> { inner_field: Inner<'c, K>, } diff --git a/tests/ui/async-await/async-is-unwindsafe.rs b/tests/ui/async-await/async-is-unwindsafe.rs index 53009b6e741..d0202f72f00 100644 --- a/tests/ui/async-await/async-is-unwindsafe.rs +++ b/tests/ui/async-await/async-is-unwindsafe.rs @@ -11,6 +11,7 @@ fn main() { is_unwindsafe(async { //~^ ERROR the type `&mut Context<'_>` may not be safely transferred across an unwind boundary + //~| ERROR the type `&mut (dyn Any + 'static)` may not be safely transferred across an unwind boundary use std::ptr::null; use std::task::{Context, RawWaker, RawWakerVTable, Waker}; let waker = unsafe { diff --git a/tests/ui/async-await/async-is-unwindsafe.stderr b/tests/ui/async-await/async-is-unwindsafe.stderr index 5d87fc74768..6bb06df9f39 100644 --- a/tests/ui/async-await/async-is-unwindsafe.stderr +++ b/tests/ui/async-await/async-is-unwindsafe.stderr @@ -6,19 +6,18 @@ LL | is_unwindsafe(async { | |_____| | || LL | || +LL | || LL | || use std::ptr::null; -LL | || use std::task::{Context, RawWaker, RawWakerVTable, Waker}; ... || LL | || drop(cx_ref); LL | || }); | ||_____-^ `&mut Context<'_>` may not be safely transferred across an unwind boundary | |_____| - | within this `{async block@$DIR/async-is-unwindsafe.rs:12:19: 29:6}` + | within this `{async block@$DIR/async-is-unwindsafe.rs:12:19: 30:6}` | - = help: within `{async block@$DIR/async-is-unwindsafe.rs:12:19: 29:6}`, the trait `UnwindSafe` is not implemented for `&mut Context<'_>`, which is required by `{async block@$DIR/async-is-unwindsafe.rs:12:19: 29:6}: UnwindSafe` - = note: `UnwindSafe` is implemented for `&Context<'_>`, but not for `&mut Context<'_>` + = help: within `{async block@$DIR/async-is-unwindsafe.rs:12:19: 30:6}`, the trait `UnwindSafe` is not implemented for `&mut Context<'_>`, which is required by `{async block@$DIR/async-is-unwindsafe.rs:12:19: 30:6}: UnwindSafe` note: future does not implement `UnwindSafe` as this value is used across an await - --> $DIR/async-is-unwindsafe.rs:25:18 + --> $DIR/async-is-unwindsafe.rs:26:18 | LL | let cx_ref = &mut cx; | ------ has type `&mut Context<'_>` which does not implement `UnwindSafe` @@ -31,6 +30,38 @@ note: required by a bound in `is_unwindsafe` LL | fn is_unwindsafe(_: impl std::panic::UnwindSafe) {} | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_unwindsafe` -error: aborting due to 1 previous error +error[E0277]: the type `&mut (dyn Any + 'static)` may not be safely transferred across an unwind boundary + --> $DIR/async-is-unwindsafe.rs:12:5 + | +LL | is_unwindsafe(async { + | _____^_____________- + | |_____| + | || +LL | || +LL | || +LL | || use std::ptr::null; +... || +LL | || drop(cx_ref); +LL | || }); + | ||_____-^ `&mut (dyn Any + 'static)` may not be safely transferred across an unwind boundary + | |_____| + | within this `{async block@$DIR/async-is-unwindsafe.rs:12:19: 30:6}` + | + = help: within `{async block@$DIR/async-is-unwindsafe.rs:12:19: 30:6}`, the trait `UnwindSafe` is not implemented for `&mut (dyn Any + 'static)`, which is required by `{async block@$DIR/async-is-unwindsafe.rs:12:19: 30:6}: UnwindSafe` +note: future does not implement `UnwindSafe` as this value is used across an await + --> $DIR/async-is-unwindsafe.rs:26:18 + | +LL | let mut cx = Context::from_waker(&waker); + | ------ has type `Context<'_>` which does not implement `UnwindSafe` +... +LL | async {}.await; // this needs an inner await point + | ^^^^^ await occurs here, with `mut cx` maybe used later +note: required by a bound in `is_unwindsafe` + --> $DIR/async-is-unwindsafe.rs:3:26 + | +LL | fn is_unwindsafe(_: impl std::panic::UnwindSafe) {} + | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_unwindsafe` + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.mir.stderr b/tests/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.mir.stderr deleted file mode 100644 index 34ec8aadbcf..00000000000 --- a/tests/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.mir.stderr +++ /dev/null @@ -1,19 +0,0 @@ -error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/const-extern-fn-requires-unsafe.rs:12:5 - | -LL | foo(); - | ^^^^^ call to unsafe function - | - = note: consult the function's documentation for information on how to avoid undefined behavior - -error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/const-extern-fn-requires-unsafe.rs:9:17 - | -LL | let a: [u8; foo()]; - | ^^^^^ call to unsafe function - | - = note: consult the function's documentation for information on how to avoid undefined behavior - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.thir.stderr b/tests/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.thir.stderr deleted file mode 100644 index e6b8173eb05..00000000000 --- a/tests/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.thir.stderr +++ /dev/null @@ -1,19 +0,0 @@ -error[E0133]: call to unsafe function `foo` is unsafe and requires unsafe function or block - --> $DIR/const-extern-fn-requires-unsafe.rs:12:5 - | -LL | foo(); - | ^^^^^ call to unsafe function - | - = note: consult the function's documentation for information on how to avoid undefined behavior - -error[E0133]: call to unsafe function `foo` is unsafe and requires unsafe function or block - --> $DIR/const-extern-fn-requires-unsafe.rs:9:17 - | -LL | let a: [u8; foo()]; - | ^^^^^ call to unsafe function - | - = note: consult the function's documentation for information on how to avoid undefined behavior - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/consts/const-int-unchecked.rs b/tests/ui/consts/const-int-unchecked.rs index 3fe96c2de23..8de28aa2bb1 100644 --- a/tests/ui/consts/const-int-unchecked.rs +++ b/tests/ui/consts/const-int-unchecked.rs @@ -27,7 +27,7 @@ const SHL_U128: u128 = unsafe { intrinsics::unchecked_shl(5_u128, 128) }; const SHL_I8: i8 = unsafe { intrinsics::unchecked_shl(5_i8, 8) }; //~^ ERROR evaluation of constant value failed -const SHL_I16: i16 = unsafe { intrinsics::unchecked_shl(5_16, 16) }; +const SHL_I16: i16 = unsafe { intrinsics::unchecked_shl(5_i16, 16) }; //~^ ERROR evaluation of constant value failed const SHL_I32: i32 = unsafe { intrinsics::unchecked_shl(5_i32, 32) }; //~^ ERROR evaluation of constant value failed @@ -40,7 +40,7 @@ const SHL_I128: i128 = unsafe { intrinsics::unchecked_shl(5_i128, 128) }; const SHL_I8_NEG: i8 = unsafe { intrinsics::unchecked_shl(5_i8, -1) }; //~^ ERROR evaluation of constant value failed -const SHL_I16_NEG: i16 = unsafe { intrinsics::unchecked_shl(5_16, -1) }; +const SHL_I16_NEG: i16 = unsafe { intrinsics::unchecked_shl(5_i16, -1) }; //~^ ERROR evaluation of constant value failed const SHL_I32_NEG: i32 = unsafe { intrinsics::unchecked_shl(5_i32, -1) }; //~^ ERROR evaluation of constant value failed @@ -54,7 +54,7 @@ const SHL_I128_NEG: i128 = unsafe { intrinsics::unchecked_shl(5_i128, -1) }; const SHL_I8_NEG_RANDOM: i8 = unsafe { intrinsics::unchecked_shl(5_i8, -6) }; //~^ ERROR evaluation of constant value failed -const SHL_I16_NEG_RANDOM: i16 = unsafe { intrinsics::unchecked_shl(5_16, -13) }; +const SHL_I16_NEG_RANDOM: i16 = unsafe { intrinsics::unchecked_shl(5_i16, -13) }; //~^ ERROR evaluation of constant value failed const SHL_I32_NEG_RANDOM: i32 = unsafe { intrinsics::unchecked_shl(5_i32, -25) }; //~^ ERROR evaluation of constant value failed @@ -82,7 +82,7 @@ const SHR_U128: u128 = unsafe { intrinsics::unchecked_shr(5_u128, 128) }; const SHR_I8: i8 = unsafe { intrinsics::unchecked_shr(5_i8, 8) }; //~^ ERROR evaluation of constant value failed -const SHR_I16: i16 = unsafe { intrinsics::unchecked_shr(5_16, 16) }; +const SHR_I16: i16 = unsafe { intrinsics::unchecked_shr(5_i16, 16) }; //~^ ERROR evaluation of constant value failed const SHR_I32: i32 = unsafe { intrinsics::unchecked_shr(5_i32, 32) }; //~^ ERROR evaluation of constant value failed @@ -95,7 +95,7 @@ const SHR_I128: i128 = unsafe { intrinsics::unchecked_shr(5_i128, 128) }; const SHR_I8_NEG: i8 = unsafe { intrinsics::unchecked_shr(5_i8, -1) }; //~^ ERROR evaluation of constant value failed -const SHR_I16_NEG: i16 = unsafe { intrinsics::unchecked_shr(5_16, -1) }; +const SHR_I16_NEG: i16 = unsafe { intrinsics::unchecked_shr(5_i16, -1) }; //~^ ERROR evaluation of constant value failed const SHR_I32_NEG: i32 = unsafe { intrinsics::unchecked_shr(5_i32, -1) }; //~^ ERROR evaluation of constant value failed @@ -109,7 +109,7 @@ const SHR_I128_NEG: i128 = unsafe { intrinsics::unchecked_shr(5_i128, -1) }; const SHR_I8_NEG_RANDOM: i8 = unsafe { intrinsics::unchecked_shr(5_i8, -6) }; //~^ ERROR evaluation of constant value failed -const SHR_I16_NEG_RANDOM: i16 = unsafe { intrinsics::unchecked_shr(5_16, -13) }; +const SHR_I16_NEG_RANDOM: i16 = unsafe { intrinsics::unchecked_shr(5_i16, -13) }; //~^ ERROR evaluation of constant value failed const SHR_I32_NEG_RANDOM: i32 = unsafe { intrinsics::unchecked_shr(5_i32, -25) }; //~^ ERROR evaluation of constant value failed diff --git a/tests/ui/consts/const-int-unchecked.stderr b/tests/ui/consts/const-int-unchecked.stderr index ad14c8f68f8..84b222972a1 100644 --- a/tests/ui/consts/const-int-unchecked.stderr +++ b/tests/ui/consts/const-int-unchecked.stderr @@ -37,8 +37,8 @@ LL | const SHL_I8: i8 = unsafe { intrinsics::unchecked_shl(5_i8, 8) }; error[E0080]: evaluation of constant value failed --> $DIR/const-int-unchecked.rs:30:31 | -LL | const SHL_I16: i16 = unsafe { intrinsics::unchecked_shl(5_16, 16) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 16 in `unchecked_shl` +LL | const SHL_I16: i16 = unsafe { intrinsics::unchecked_shl(5_i16, 16) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 16 in `unchecked_shl` error[E0080]: evaluation of constant value failed --> $DIR/const-int-unchecked.rs:32:31 @@ -67,8 +67,8 @@ LL | const SHL_I8_NEG: i8 = unsafe { intrinsics::unchecked_shl(5_i8, -1) }; error[E0080]: evaluation of constant value failed --> $DIR/const-int-unchecked.rs:43:35 | -LL | const SHL_I16_NEG: i16 = unsafe { intrinsics::unchecked_shl(5_16, -1) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by -1 in `unchecked_shl` +LL | const SHL_I16_NEG: i16 = unsafe { intrinsics::unchecked_shl(5_i16, -1) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by -1 in `unchecked_shl` error[E0080]: evaluation of constant value failed --> $DIR/const-int-unchecked.rs:45:35 @@ -97,8 +97,8 @@ LL | const SHL_I8_NEG_RANDOM: i8 = unsafe { intrinsics::unchecked_shl(5_i8, -6) error[E0080]: evaluation of constant value failed --> $DIR/const-int-unchecked.rs:57:42 | -LL | const SHL_I16_NEG_RANDOM: i16 = unsafe { intrinsics::unchecked_shl(5_16, -13) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by -13 in `unchecked_shl` +LL | const SHL_I16_NEG_RANDOM: i16 = unsafe { intrinsics::unchecked_shl(5_i16, -13) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by -13 in `unchecked_shl` error[E0080]: evaluation of constant value failed --> $DIR/const-int-unchecked.rs:59:42 @@ -157,8 +157,8 @@ LL | const SHR_I8: i8 = unsafe { intrinsics::unchecked_shr(5_i8, 8) }; error[E0080]: evaluation of constant value failed --> $DIR/const-int-unchecked.rs:85:31 | -LL | const SHR_I16: i16 = unsafe { intrinsics::unchecked_shr(5_16, 16) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 16 in `unchecked_shr` +LL | const SHR_I16: i16 = unsafe { intrinsics::unchecked_shr(5_i16, 16) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by 16 in `unchecked_shr` error[E0080]: evaluation of constant value failed --> $DIR/const-int-unchecked.rs:87:31 @@ -187,8 +187,8 @@ LL | const SHR_I8_NEG: i8 = unsafe { intrinsics::unchecked_shr(5_i8, -1) }; error[E0080]: evaluation of constant value failed --> $DIR/const-int-unchecked.rs:98:35 | -LL | const SHR_I16_NEG: i16 = unsafe { intrinsics::unchecked_shr(5_16, -1) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by -1 in `unchecked_shr` +LL | const SHR_I16_NEG: i16 = unsafe { intrinsics::unchecked_shr(5_i16, -1) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by -1 in `unchecked_shr` error[E0080]: evaluation of constant value failed --> $DIR/const-int-unchecked.rs:100:35 @@ -217,8 +217,8 @@ LL | const SHR_I8_NEG_RANDOM: i8 = unsafe { intrinsics::unchecked_shr(5_i8, -6) error[E0080]: evaluation of constant value failed --> $DIR/const-int-unchecked.rs:112:42 | -LL | const SHR_I16_NEG_RANDOM: i16 = unsafe { intrinsics::unchecked_shr(5_16, -13) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by -13 in `unchecked_shr` +LL | const SHR_I16_NEG_RANDOM: i16 = unsafe { intrinsics::unchecked_shr(5_i16, -13) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing shift by -13 in `unchecked_shr` error[E0080]: evaluation of constant value failed --> $DIR/const-int-unchecked.rs:114:42 diff --git a/tests/ui/derives/auxiliary/rustc-serialize.rs b/tests/ui/derives/auxiliary/rustc-serialize.rs new file mode 100644 index 00000000000..24177af931c --- /dev/null +++ b/tests/ui/derives/auxiliary/rustc-serialize.rs @@ -0,0 +1,16 @@ +#![crate_type = "lib"] + +pub trait Decoder { + type Error; + + fn read_enum<T, F>(&mut self, name: &str, f: F) -> Result<T, Self::Error> + where F: FnOnce(&mut Self) -> Result<T, Self::Error>; + fn read_enum_variant<T, F>(&mut self, names: &[&str], f: F) + -> Result<T, Self::Error> + where F: FnMut(&mut Self, usize) -> Result<T, Self::Error>; + +} + +pub trait Decodable: Sized { + fn decode<D: Decoder>(d: &mut D) -> Result<Self, D::Error>; +} diff --git a/tests/ui/derives/rustc-decodable-issue-123156.rs b/tests/ui/derives/rustc-decodable-issue-123156.rs new file mode 100644 index 00000000000..1983837ed8d --- /dev/null +++ b/tests/ui/derives/rustc-decodable-issue-123156.rs @@ -0,0 +1,11 @@ +//@ check-pass +//@ edition:2021 +//@ aux-build:rustc-serialize.rs + +#![crate_type = "lib"] +#![allow(deprecated, soft_unstable)] + +extern crate rustc_serialize; + +#[derive(RustcDecodable)] +pub enum Foo {} diff --git a/tests/ui/derives/rustc-decodable-issue-123156.stderr b/tests/ui/derives/rustc-decodable-issue-123156.stderr new file mode 100644 index 00000000000..ee7b33d59bb --- /dev/null +++ b/tests/ui/derives/rustc-decodable-issue-123156.stderr @@ -0,0 +1,10 @@ +Future incompatibility report: Future breakage diagnostic: +warning: use of unstable library feature 'rustc_encodable_decodable': derive macro for `rustc-serialize`; should not be used in new code + --> $DIR/rustc-decodable-issue-123156.rs:10:10 + | +LL | #[derive(RustcDecodable)] + | ^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #64266 <https://github.com/rust-lang/rust/issues/64266> + diff --git a/tests/ui/higher-ranked/builtin-closure-like-bounds.rs b/tests/ui/higher-ranked/builtin-closure-like-bounds.rs new file mode 100644 index 00000000000..dee290cc439 --- /dev/null +++ b/tests/ui/higher-ranked/builtin-closure-like-bounds.rs @@ -0,0 +1,58 @@ +//@ edition:2024 +//@ compile-flags: -Zunstable-options +//@ revisions: current next +//@[next] compile-flags: -Znext-solver +//@ check-pass + +// Makes sure that we support closure/coroutine goals where the signature of +// the item references higher-ranked lifetimes from the *predicate* binder, +// not its own internal signature binder. +// +// This was fixed in <https://github.com/rust-lang/rust/pull/122267>. + +#![feature(unboxed_closures, gen_blocks)] + +trait Dispatch { + fn dispatch(self); +} + +struct Fut<T>(T); +impl<T: for<'a> Fn<(&'a (),)>> Dispatch for Fut<T> +where + for<'a> <T as FnOnce<(&'a (),)>>::Output: Future, +{ + fn dispatch(self) { + (self.0)(&()); + } +} + +struct Gen<T>(T); +impl<T: for<'a> Fn<(&'a (),)>> Dispatch for Gen<T> +where + for<'a> <T as FnOnce<(&'a (),)>>::Output: Iterator, +{ + fn dispatch(self) { + (self.0)(&()); + } +} + +struct Closure<T>(T); +impl<T: for<'a> Fn<(&'a (),)>> Dispatch for Closure<T> +where + for<'a> <T as FnOnce<(&'a (),)>>::Output: Fn<(&'a (),)>, +{ + fn dispatch(self) { + (self.0)(&())(&()); + } +} + +fn main() { + async fn foo(_: &()) {} + Fut(foo).dispatch(); + + gen fn bar(_: &()) {} + Gen(bar).dispatch(); + + fn uwu<'a>(x: &'a ()) -> impl Fn(&'a ()) { |_| {} } + Closure(uwu).dispatch(); +} diff --git a/tests/ui/higher-ranked/closure-bound-codegen-ice.rs b/tests/ui/higher-ranked/closure-bound-codegen-ice.rs new file mode 100644 index 00000000000..4d7ae12d7a7 --- /dev/null +++ b/tests/ui/higher-ranked/closure-bound-codegen-ice.rs @@ -0,0 +1,33 @@ +//@ revisions: current next +//@[next] compile-flags: -Znext-solver +//@ build-pass + +// Regression test for incomplete handling of Fn-trait goals, +// fixed in #122267. + +trait Trait { + type Assoc<'a>: FnOnce(&'a ()); +} + +impl Trait for () { + type Assoc<'a> = fn(&'a ()); +} + +trait Indir { + fn break_me() {} +} + +impl<F: Trait> Indir for F +where + for<'a> F::Assoc<'a>: FnOnce(&'a ()), +{ + fn break_me() {} +} + +fn foo<F: Trait>() { + F::break_me() +} + +fn main() { + foo::<()>(); +} diff --git a/tests/ui/higher-ranked/trait-bounds/fn-ptr.classic.stderr b/tests/ui/higher-ranked/trait-bounds/fn-ptr.classic.stderr deleted file mode 100644 index b322ea41c43..00000000000 --- a/tests/ui/higher-ranked/trait-bounds/fn-ptr.classic.stderr +++ /dev/null @@ -1,19 +0,0 @@ -error[E0277]: expected a `Fn(&'w ())` closure, found `fn(&'w ())` - --> $DIR/fn-ptr.rs:12:5 - | -LL | ice(); - | ^^^^^ expected an `Fn(&'w ())` closure, found `fn(&'w ())` - | - = help: the trait `for<'w> Fn<(&'w (),)>` is not implemented for `fn(&'w ())` -note: required by a bound in `ice` - --> $DIR/fn-ptr.rs:7:25 - | -LL | fn ice() - | --- required by a bound in this function -LL | where -LL | for<'w> fn(&'w ()): Fn(&'w ()), - | ^^^^^^^^^^ required by this bound in `ice` - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/higher-ranked/trait-bounds/fn-ptr.current.stderr b/tests/ui/higher-ranked/trait-bounds/fn-ptr.current.stderr deleted file mode 100644 index f3583cd218b..00000000000 --- a/tests/ui/higher-ranked/trait-bounds/fn-ptr.current.stderr +++ /dev/null @@ -1,19 +0,0 @@ -error[E0277]: expected a `Fn(&'w ())` closure, found `fn(&'w ())` - --> $DIR/fn-ptr.rs:13:5 - | -LL | ice(); - | ^^^^^ expected an `Fn(&'w ())` closure, found `fn(&'w ())` - | - = help: the trait `for<'w> Fn<(&'w (),)>` is not implemented for `fn(&'w ())` -note: required by a bound in `ice` - --> $DIR/fn-ptr.rs:8:25 - | -LL | fn ice() - | --- required by a bound in this function -LL | where -LL | for<'w> fn(&'w ()): Fn(&'w ()), - | ^^^^^^^^^^ required by this bound in `ice` - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/higher-ranked/trait-bounds/fn-ptr.rs b/tests/ui/higher-ranked/trait-bounds/fn-ptr.rs index 9298c10c341..7a4c15f4d4b 100644 --- a/tests/ui/higher-ranked/trait-bounds/fn-ptr.rs +++ b/tests/ui/higher-ranked/trait-bounds/fn-ptr.rs @@ -1,7 +1,7 @@ //@ revisions: current next //@ ignore-compare-mode-next-solver (explicit revisions) //@[next] compile-flags: -Znext-solver -//@[next] check-pass +//@ check-pass fn ice() where @@ -11,5 +11,4 @@ where fn main() { ice(); - //[current]~^ ERROR expected a `Fn(&'w ())` closure, found `fn(&'w ())` } diff --git a/tests/ui/higher-ranked/trait-bounds/future.classic.stderr b/tests/ui/higher-ranked/trait-bounds/future.classic.stderr deleted file mode 100644 index ef31b7266c7..00000000000 --- a/tests/ui/higher-ranked/trait-bounds/future.classic.stderr +++ /dev/null @@ -1,6 +0,0 @@ -error: the compiler unexpectedly panicked. this is a bug. - -query stack during panic: -#0 [evaluate_obligation] evaluating trait selection obligation `for<'a> {async fn body@$DIR/future.rs:32:35: 34:2}: core::future::future::Future` -#1 [codegen_select_candidate] computing candidate for `<strlen as Trait>` -end of query stack diff --git a/tests/ui/higher-ranked/trait-bounds/future.current.stderr b/tests/ui/higher-ranked/trait-bounds/future.current.stderr deleted file mode 100644 index 673bc48a424..00000000000 --- a/tests/ui/higher-ranked/trait-bounds/future.current.stderr +++ /dev/null @@ -1,6 +0,0 @@ -error: the compiler unexpectedly panicked. this is a bug. - -query stack during panic: -#0 [evaluate_obligation] evaluating trait selection obligation `for<'a> {async fn body of strlen()}: core::future::future::Future` -#1 [codegen_select_candidate] computing candidate for `<strlen as Trait>` -end of query stack diff --git a/tests/ui/higher-ranked/trait-bounds/future.rs b/tests/ui/higher-ranked/trait-bounds/future.rs index 4b52f04dbe0..7105015b690 100644 --- a/tests/ui/higher-ranked/trait-bounds/future.rs +++ b/tests/ui/higher-ranked/trait-bounds/future.rs @@ -3,14 +3,7 @@ //@ revisions: current next //@ ignore-compare-mode-next-solver (explicit revisions) //@[next] compile-flags: -Znext-solver -//@[next] check-pass -//@[current] known-bug: #112347 -//@[current] build-fail -//@[current] failure-status: 101 -//@[current] normalize-stderr-test "note: .*\n\n" -> "" -//@[current] normalize-stderr-test "thread 'rustc' panicked.*\n.*\n" -> "" -//@[current] normalize-stderr-test "(error: internal compiler error: [^:]+):\d+:\d+: " -> "$1:LL:CC: " -//@[current] rustc-env:RUST_BACKTRACE=0 +//@ check-pass #![feature(unboxed_closures)] diff --git a/tests/ui/lifetimes/issue-105675.rs b/tests/ui/lifetimes/issue-105675.rs index 2e2eaca0d33..0472537e7f3 100644 --- a/tests/ui/lifetimes/issue-105675.rs +++ b/tests/ui/lifetimes/issue-105675.rs @@ -4,7 +4,7 @@ fn main() { let f = | _ , y: &u32 , z | (); thing(f); //~^ ERROR implementation of `FnOnce` is not general enough - //~^^ ERROR implementation of `FnOnce` is not general enough + //~| ERROR implementation of `FnOnce` is not general enough let f = | x, y: _ , z: u32 | (); thing(f); //~^ ERROR implementation of `FnOnce` is not general enough diff --git a/tests/ui/lifetimes/lifetime-errors/issue_74400.rs b/tests/ui/lifetimes/lifetime-errors/issue_74400.rs index b02e38bec3b..72345fa294a 100644 --- a/tests/ui/lifetimes/lifetime-errors/issue_74400.rs +++ b/tests/ui/lifetimes/lifetime-errors/issue_74400.rs @@ -1,5 +1,5 @@ //! Regression test for #74400: Type mismatch in function arguments E0631, E0271 are falsely -//! recognized as E0308 mismatched types. +//! recognized as "implementation of `FnOnce` is not general enough". use std::convert::identity; @@ -13,6 +13,6 @@ fn g<T>(data: &[T]) { //~^ ERROR the parameter type //~| ERROR the parameter type //~| ERROR the parameter type - //~| ERROR implementation of `FnOnce` is not general + //~| ERROR implementation of `FnOnce` is not general enough //~| ERROR implementation of `Fn` is not general enough } diff --git a/tests/ui/lint/lint-strict-provenance-fuzzy-casts.stderr b/tests/ui/lint/lint-strict-provenance-fuzzy-casts.stderr index 0b128974275..24f2500abf8 100644 --- a/tests/ui/lint/lint-strict-provenance-fuzzy-casts.stderr +++ b/tests/ui/lint/lint-strict-provenance-fuzzy-casts.stderr @@ -4,7 +4,7 @@ error: strict provenance disallows casting integer `usize` to pointer `*const u8 LL | let dangling = 16_usize as *const u8; | ^^^^^^^^^^^^^^^^^^^^^ | - = help: if you can't comply with strict provenance and don't have a pointer with the correct provenance you can use `std::ptr::from_exposed_addr()` instead + = help: if you can't comply with strict provenance and don't have a pointer with the correct provenance you can use `std::ptr::with_exposed_provenance()` instead note: the lint level is defined here --> $DIR/lint-strict-provenance-fuzzy-casts.rs:2:9 | diff --git a/tests/ui/marker_trait_attr/unsound-overlap.rs b/tests/ui/marker_trait_attr/unsound-overlap.rs index 2e5101b822c..2ce26b610f6 100644 --- a/tests/ui/marker_trait_attr/unsound-overlap.rs +++ b/tests/ui/marker_trait_attr/unsound-overlap.rs @@ -8,6 +8,7 @@ trait B {} impl<T: A> B for T {} impl<T: B> A for T {} impl A for &str {} +//~^ ERROR type annotations needed: cannot satisfy `&str: A` impl<T: A + B> A for (T,) {} trait TraitWithAssoc { type Assoc; diff --git a/tests/ui/marker_trait_attr/unsound-overlap.stderr b/tests/ui/marker_trait_attr/unsound-overlap.stderr index 5e58f5227ed..13498fa4b22 100644 --- a/tests/ui/marker_trait_attr/unsound-overlap.stderr +++ b/tests/ui/marker_trait_attr/unsound-overlap.stderr @@ -1,5 +1,19 @@ +error[E0283]: type annotations needed: cannot satisfy `&str: A` + --> $DIR/unsound-overlap.rs:10:12 + | +LL | impl A for &str {} + | ^^^^ + | +note: multiple `impl`s satisfying `&str: A` found + --> $DIR/unsound-overlap.rs:9:1 + | +LL | impl<T: B> A for T {} + | ^^^^^^^^^^^^^^^^^^ +LL | impl A for &str {} + | ^^^^^^^^^^^^^^^ + error[E0119]: conflicting implementations of trait `TraitWithAssoc` for type `((&str,),)` - --> $DIR/unsound-overlap.rs:20:1 + --> $DIR/unsound-overlap.rs:21:1 | LL | impl<T: A> TraitWithAssoc for T { | ------------------------------- first implementation here @@ -7,6 +21,7 @@ LL | impl<T: A> TraitWithAssoc for T { LL | impl TraitWithAssoc for ((&str,),) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `((&str,),)` -error: aborting due to 1 previous error +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0119`. +Some errors have detailed explanations: E0119, E0283. +For more information about an error, try `rustc --explain E0119`. diff --git a/tests/ui/methods/probe-overflow-due-to-sized-predicate-ordering.rs b/tests/ui/methods/probe-overflow-due-to-sized-predicate-ordering.rs new file mode 100644 index 00000000000..08e15117c4b --- /dev/null +++ b/tests/ui/methods/probe-overflow-due-to-sized-predicate-ordering.rs @@ -0,0 +1,30 @@ +//@ check-pass +// Regression test due to #123279 + +pub trait Job: AsJob { + fn run_once(&self); +} + +impl<F: Fn()> Job for F { + fn run_once(&self) { + todo!() + } +} + +pub trait AsJob {} + +// Ensure that `T: Sized + Job` by reordering the explicit `Sized` to where +// the implicit sized pred would go. +impl<T: Job + Sized> AsJob for T {} + +pub struct LoopingJobService { + job: Box<dyn Job>, +} + +impl Job for LoopingJobService { + fn run_once(&self) { + self.job.run_once() + } +} + +fn main() {} diff --git a/tests/ui/repr/repr-align.rs b/tests/ui/repr/repr-align.rs index 58ecf9a5183..33aa727d4bd 100644 --- a/tests/ui/repr/repr-align.rs +++ b/tests/ui/repr/repr-align.rs @@ -15,6 +15,10 @@ struct S2(i32); #[repr(align(536870912))] // ok: this is the largest accepted alignment struct S3(i32); +#[repr(align(0))] //~ ERROR: invalid `repr(align)` attribute: not a power of two + //~| ERROR: invalid `repr(align)` attribute: not a power of two +struct S4(i32); + #[repr(align(16.0))] //~ ERROR: invalid `repr(align)` attribute: not an unsuffixed integer //~| ERROR: invalid `repr(align)` attribute: not an unsuffixed integer enum E0 { A, B } @@ -30,4 +34,8 @@ enum E2 { A, B } #[repr(align(536870912))] // ok: this is the largest accepted alignment enum E3 { A, B } +#[repr(align(0))] //~ ERROR: invalid `repr(align)` attribute: not a power of two + //~| ERROR: invalid `repr(align)` attribute: not a power of two +enum E4 { A, B } + fn main() {} diff --git a/tests/ui/repr/repr-align.stderr b/tests/ui/repr/repr-align.stderr index bb0e17ba395..660247840c4 100644 --- a/tests/ui/repr/repr-align.stderr +++ b/tests/ui/repr/repr-align.stderr @@ -16,24 +16,36 @@ error[E0589]: invalid `repr(align)` attribute: larger than 2^29 LL | #[repr(align(4294967296))] | ^^^^^^^^^^ -error[E0589]: invalid `repr(align)` attribute: not an unsuffixed integer +error[E0589]: invalid `repr(align)` attribute: not a power of two --> $DIR/repr-align.rs:18:14 | +LL | #[repr(align(0))] + | ^ + +error[E0589]: invalid `repr(align)` attribute: not an unsuffixed integer + --> $DIR/repr-align.rs:22:14 + | LL | #[repr(align(16.0))] | ^^^^ error[E0589]: invalid `repr(align)` attribute: not a power of two - --> $DIR/repr-align.rs:22:14 + --> $DIR/repr-align.rs:26:14 | LL | #[repr(align(15))] | ^^ error[E0589]: invalid `repr(align)` attribute: larger than 2^29 - --> $DIR/repr-align.rs:26:14 + --> $DIR/repr-align.rs:30:14 | LL | #[repr(align(4294967296))] | ^^^^^^^^^^ +error[E0589]: invalid `repr(align)` attribute: not a power of two + --> $DIR/repr-align.rs:37:14 + | +LL | #[repr(align(0))] + | ^ + error[E0589]: invalid `repr(align)` attribute: not an unsuffixed integer --> $DIR/repr-align.rs:3:14 | @@ -58,16 +70,24 @@ LL | #[repr(align(4294967296))] | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -error[E0589]: invalid `repr(align)` attribute: not an unsuffixed integer +error[E0589]: invalid `repr(align)` attribute: not a power of two --> $DIR/repr-align.rs:18:14 | +LL | #[repr(align(0))] + | ^ + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error[E0589]: invalid `repr(align)` attribute: not an unsuffixed integer + --> $DIR/repr-align.rs:22:14 + | LL | #[repr(align(16.0))] | ^^^^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error[E0589]: invalid `repr(align)` attribute: not a power of two - --> $DIR/repr-align.rs:22:14 + --> $DIR/repr-align.rs:26:14 | LL | #[repr(align(15))] | ^^ @@ -75,13 +95,21 @@ LL | #[repr(align(15))] = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error[E0589]: invalid `repr(align)` attribute: larger than 2^29 - --> $DIR/repr-align.rs:26:14 + --> $DIR/repr-align.rs:30:14 | LL | #[repr(align(4294967296))] | ^^^^^^^^^^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -error: aborting due to 12 previous errors +error[E0589]: invalid `repr(align)` attribute: not a power of two + --> $DIR/repr-align.rs:37:14 + | +LL | #[repr(align(0))] + | ^ + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: aborting due to 16 previous errors For more information about this error, try `rustc --explain E0589`. diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/fn-ptr.mir.stderr b/tests/ui/rfcs/rfc-2396-target_feature-11/fn-ptr.mir.stderr deleted file mode 100644 index 7bbd4e15898..00000000000 --- a/tests/ui/rfcs/rfc-2396-target_feature-11/fn-ptr.mir.stderr +++ /dev/null @@ -1,23 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/fn-ptr.rs:11:21 - | -LL | #[target_feature(enable = "sse2")] - | ---------------------------------- `#[target_feature]` added here -... -LL | let foo: fn() = foo; - | ---- ^^^ cannot coerce functions with `#[target_feature]` to safe function pointers - | | - | expected due to this - | - = note: expected fn pointer `fn()` - found fn item `fn() {foo}` - = note: fn items are distinct from fn pointers - = note: functions with `#[target_feature]` can only be coerced to `unsafe` function pointers -help: consider casting to a fn pointer - | -LL | let foo: fn() = foo as fn(); - | ~~~~~~~~~~~ - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/fn-ptr.thir.stderr b/tests/ui/rfcs/rfc-2396-target_feature-11/fn-ptr.thir.stderr deleted file mode 100644 index 7bbd4e15898..00000000000 --- a/tests/ui/rfcs/rfc-2396-target_feature-11/fn-ptr.thir.stderr +++ /dev/null @@ -1,23 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/fn-ptr.rs:11:21 - | -LL | #[target_feature(enable = "sse2")] - | ---------------------------------- `#[target_feature]` added here -... -LL | let foo: fn() = foo; - | ---- ^^^ cannot coerce functions with `#[target_feature]` to safe function pointers - | | - | expected due to this - | - = note: expected fn pointer `fn()` - found fn item `fn() {foo}` - = note: fn items are distinct from fn pointers - = note: functions with `#[target_feature]` can only be coerced to `unsafe` function pointers -help: consider casting to a fn pointer - | -LL | let foo: fn() = foo as fn(); - | ~~~~~~~~~~~ - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.mir.stderr b/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.mir.stderr deleted file mode 100644 index cabc475fa61..00000000000 --- a/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.mir.stderr +++ /dev/null @@ -1,115 +0,0 @@ -error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block - --> $DIR/safe-calls.rs:28:5 - | -LL | sse2(); - | ^^^^^^ call to function with `#[target_feature]` - | - = help: in order for the call to be safe, the context requires the following additional target feature: sse2 - = note: the sse2 target feature being enabled in the build configuration does not remove the requirement to list it in `#[target_feature]` - -error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block - --> $DIR/safe-calls.rs:31:5 - | -LL | avx_bmi2(); - | ^^^^^^^^^^ call to function with `#[target_feature]` - | - = help: in order for the call to be safe, the context requires the following additional target features: avx and bmi2 - -error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block - --> $DIR/safe-calls.rs:34:5 - | -LL | Quux.avx_bmi2(); - | ^^^^^^^^^^^^^^^ call to function with `#[target_feature]` - | - = help: in order for the call to be safe, the context requires the following additional target features: avx and bmi2 - -error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block - --> $DIR/safe-calls.rs:41:5 - | -LL | avx_bmi2(); - | ^^^^^^^^^^ call to function with `#[target_feature]` - | - = help: in order for the call to be safe, the context requires the following additional target features: avx and bmi2 - -error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block - --> $DIR/safe-calls.rs:44:5 - | -LL | Quux.avx_bmi2(); - | ^^^^^^^^^^^^^^^ call to function with `#[target_feature]` - | - = help: in order for the call to be safe, the context requires the following additional target features: avx and bmi2 - -error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block - --> $DIR/safe-calls.rs:51:5 - | -LL | sse2(); - | ^^^^^^ call to function with `#[target_feature]` - | - = help: in order for the call to be safe, the context requires the following additional target feature: sse2 - = note: the sse2 target feature being enabled in the build configuration does not remove the requirement to list it in `#[target_feature]` - -error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block - --> $DIR/safe-calls.rs:54:5 - | -LL | avx_bmi2(); - | ^^^^^^^^^^ call to function with `#[target_feature]` - | - = help: in order for the call to be safe, the context requires the following additional target feature: bmi2 - -error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block - --> $DIR/safe-calls.rs:57:5 - | -LL | Quux.avx_bmi2(); - | ^^^^^^^^^^^^^^^ call to function with `#[target_feature]` - | - = help: in order for the call to be safe, the context requires the following additional target feature: bmi2 - -error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block - --> $DIR/safe-calls.rs:65:5 - | -LL | sse2(); - | ^^^^^^ call to function with `#[target_feature]` - | - = help: in order for the call to be safe, the context requires the following additional target feature: sse2 - = note: the sse2 target feature being enabled in the build configuration does not remove the requirement to list it in `#[target_feature]` - -error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block - --> $DIR/safe-calls.rs:70:15 - | -LL | const _: () = sse2(); - | ^^^^^^ call to function with `#[target_feature]` - | - = help: in order for the call to be safe, the context requires the following additional target feature: sse2 - = note: the sse2 target feature being enabled in the build configuration does not remove the requirement to list it in `#[target_feature]` - -error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block - --> $DIR/safe-calls.rs:74:15 - | -LL | const _: () = sse2_and_fxsr(); - | ^^^^^^^^^^^^^^^ call to function with `#[target_feature]` - | - = help: in order for the call to be safe, the context requires the following additional target features: sse2 and fxsr - = note: the fxsr and sse2 target features being enabled in the build configuration does not remove the requirement to list them in `#[target_feature]` - -error: call to function with `#[target_feature]` is unsafe and requires unsafe block (error E0133) - --> $DIR/safe-calls.rs:82:5 - | -LL | sse2(); - | ^^^^^^ call to function with `#[target_feature]` - | - = help: in order for the call to be safe, the context requires the following additional target feature: sse2 - = note: the sse2 target feature being enabled in the build configuration does not remove the requirement to list it in `#[target_feature]` -note: an unsafe function restricts its caller, but its body is safe by default - --> $DIR/safe-calls.rs:81:1 - | -LL | unsafe fn needs_unsafe_block() { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: the lint level is defined here - --> $DIR/safe-calls.rs:78:8 - | -LL | #[deny(unsafe_op_in_unsafe_fn)] - | ^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 12 previous errors - -For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.thir.stderr b/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.thir.stderr deleted file mode 100644 index 13b58fde862..00000000000 --- a/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.thir.stderr +++ /dev/null @@ -1,115 +0,0 @@ -error[E0133]: call to function `sse2` with `#[target_feature]` is unsafe and requires unsafe function or block - --> $DIR/safe-calls.rs:28:5 - | -LL | sse2(); - | ^^^^^^ call to function with `#[target_feature]` - | - = help: in order for the call to be safe, the context requires the following additional target feature: sse2 - = note: the sse2 target feature being enabled in the build configuration does not remove the requirement to list it in `#[target_feature]` - -error[E0133]: call to function `avx_bmi2` with `#[target_feature]` is unsafe and requires unsafe function or block - --> $DIR/safe-calls.rs:31:5 - | -LL | avx_bmi2(); - | ^^^^^^^^^^ call to function with `#[target_feature]` - | - = help: in order for the call to be safe, the context requires the following additional target features: avx and bmi2 - -error[E0133]: call to function `Quux::avx_bmi2` with `#[target_feature]` is unsafe and requires unsafe function or block - --> $DIR/safe-calls.rs:34:5 - | -LL | Quux.avx_bmi2(); - | ^^^^^^^^^^^^^^^ call to function with `#[target_feature]` - | - = help: in order for the call to be safe, the context requires the following additional target features: avx and bmi2 - -error[E0133]: call to function `avx_bmi2` with `#[target_feature]` is unsafe and requires unsafe function or block - --> $DIR/safe-calls.rs:41:5 - | -LL | avx_bmi2(); - | ^^^^^^^^^^ call to function with `#[target_feature]` - | - = help: in order for the call to be safe, the context requires the following additional target features: avx and bmi2 - -error[E0133]: call to function `Quux::avx_bmi2` with `#[target_feature]` is unsafe and requires unsafe function or block - --> $DIR/safe-calls.rs:44:5 - | -LL | Quux.avx_bmi2(); - | ^^^^^^^^^^^^^^^ call to function with `#[target_feature]` - | - = help: in order for the call to be safe, the context requires the following additional target features: avx and bmi2 - -error[E0133]: call to function `sse2` with `#[target_feature]` is unsafe and requires unsafe function or block - --> $DIR/safe-calls.rs:51:5 - | -LL | sse2(); - | ^^^^^^ call to function with `#[target_feature]` - | - = help: in order for the call to be safe, the context requires the following additional target feature: sse2 - = note: the sse2 target feature being enabled in the build configuration does not remove the requirement to list it in `#[target_feature]` - -error[E0133]: call to function `avx_bmi2` with `#[target_feature]` is unsafe and requires unsafe function or block - --> $DIR/safe-calls.rs:54:5 - | -LL | avx_bmi2(); - | ^^^^^^^^^^ call to function with `#[target_feature]` - | - = help: in order for the call to be safe, the context requires the following additional target feature: bmi2 - -error[E0133]: call to function `Quux::avx_bmi2` with `#[target_feature]` is unsafe and requires unsafe function or block - --> $DIR/safe-calls.rs:57:5 - | -LL | Quux.avx_bmi2(); - | ^^^^^^^^^^^^^^^ call to function with `#[target_feature]` - | - = help: in order for the call to be safe, the context requires the following additional target feature: bmi2 - -error[E0133]: call to function `sse2` with `#[target_feature]` is unsafe and requires unsafe function or block - --> $DIR/safe-calls.rs:65:5 - | -LL | sse2(); - | ^^^^^^ call to function with `#[target_feature]` - | - = help: in order for the call to be safe, the context requires the following additional target feature: sse2 - = note: the sse2 target feature being enabled in the build configuration does not remove the requirement to list it in `#[target_feature]` - -error[E0133]: call to function `sse2` with `#[target_feature]` is unsafe and requires unsafe function or block - --> $DIR/safe-calls.rs:70:15 - | -LL | const _: () = sse2(); - | ^^^^^^ call to function with `#[target_feature]` - | - = help: in order for the call to be safe, the context requires the following additional target feature: sse2 - = note: the sse2 target feature being enabled in the build configuration does not remove the requirement to list it in `#[target_feature]` - -error[E0133]: call to function `sse2_and_fxsr` with `#[target_feature]` is unsafe and requires unsafe function or block - --> $DIR/safe-calls.rs:74:15 - | -LL | const _: () = sse2_and_fxsr(); - | ^^^^^^^^^^^^^^^ call to function with `#[target_feature]` - | - = help: in order for the call to be safe, the context requires the following additional target features: sse2 and fxsr - = note: the fxsr and sse2 target features being enabled in the build configuration does not remove the requirement to list them in `#[target_feature]` - -error: call to function `sse2` with `#[target_feature]` is unsafe and requires unsafe block (error E0133) - --> $DIR/safe-calls.rs:82:5 - | -LL | sse2(); - | ^^^^^^ call to function with `#[target_feature]` - | - = help: in order for the call to be safe, the context requires the following additional target feature: sse2 - = note: the sse2 target feature being enabled in the build configuration does not remove the requirement to list it in `#[target_feature]` -note: an unsafe function restricts its caller, but its body is safe by default - --> $DIR/safe-calls.rs:81:1 - | -LL | unsafe fn needs_unsafe_block() { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: the lint level is defined here - --> $DIR/safe-calls.rs:78:8 - | -LL | #[deny(unsafe_op_in_unsafe_fn)] - | ^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 12 previous errors - -For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/sanitizer/cfi-coroutine.rs b/tests/ui/sanitizer/cfi-coroutine.rs index 24e59cf5b4d..5c6a489a7e8 100644 --- a/tests/ui/sanitizer/cfi-coroutine.rs +++ b/tests/ui/sanitizer/cfi-coroutine.rs @@ -3,6 +3,7 @@ //@ revisions: cfi kcfi // FIXME(#122848) Remove only-linux once OSX CFI binaries work //@ only-linux +//@ edition: 2024 //@ [cfi] needs-sanitizer-cfi //@ [kcfi] needs-sanitizer-kcfi //@ compile-flags: -C target-feature=-crt-static @@ -10,16 +11,22 @@ //@ [cfi] compile-flags: -Z sanitizer=cfi //@ [kcfi] compile-flags: -Z sanitizer=kcfi //@ [kcfi] compile-flags: -C panic=abort -Z panic-abort-tests -C prefer-dynamic=off -//@ compile-flags: --test +//@ compile-flags: --test -Z unstable-options //@ run-pass #![feature(coroutines)] #![feature(coroutine_trait)] +#![feature(noop_waker)] +#![feature(gen_blocks)] +#![feature(async_iterator)] use std::ops::{Coroutine, CoroutineState}; use std::pin::{pin, Pin}; +use std::task::{Context, Poll, Waker}; +use std::async_iter::AsyncIterator; -fn main() { +#[test] +fn general_coroutine() { let mut coro = |x: i32| { yield x; "done" @@ -28,3 +35,33 @@ fn main() { assert_eq!(abstract_coro.as_mut().resume(2), CoroutineState::Yielded(2)); assert_eq!(abstract_coro.as_mut().resume(0), CoroutineState::Complete("done")); } + +async fn async_fn() {} + +#[test] +fn async_coroutine() { + let f: fn() -> Pin<Box<dyn Future<Output = ()>>> = || Box::pin(async_fn()); + let _ = async { f().await; }; + assert_eq!(f().as_mut().poll(&mut Context::from_waker(Waker::noop())), Poll::Ready(())); +} + +async gen fn async_gen_fn() -> u8 { + yield 5; +} + +#[test] +fn async_gen_coroutine() { + let f: fn() -> Pin<Box<dyn AsyncIterator<Item = u8>>> = || Box::pin(async_gen_fn()); + assert_eq!(f().as_mut().poll_next(&mut Context::from_waker(Waker::noop())), + Poll::Ready(Some(5))); +} + +gen fn gen_fn() -> u8 { + yield 6; +} + +#[test] +fn gen_coroutine() { + let f: fn() -> Box<dyn Iterator<Item = u8>> = || Box::new(gen_fn()); + assert_eq!(f().next(), Some(6)); +} diff --git a/tests/ui/simd/intrinsic/ptr-cast.rs b/tests/ui/simd/intrinsic/ptr-cast.rs index 83d86baf334..62820346241 100644 --- a/tests/ui/simd/intrinsic/ptr-cast.rs +++ b/tests/ui/simd/intrinsic/ptr-cast.rs @@ -5,7 +5,7 @@ extern "rust-intrinsic" { fn simd_cast_ptr<T, U>(x: T) -> U; fn simd_expose_addr<T, U>(x: T) -> U; - fn simd_from_exposed_addr<T, U>(x: T) -> U; + fn simd_with_exposed_provenance<T, U>(x: T) -> U; } #[derive(Copy, Clone)] @@ -24,10 +24,10 @@ fn main() { let exposed_addr: V<usize> = simd_expose_addr(const_ptrs); - let from_exposed_addr: V<*mut i8> = simd_from_exposed_addr(exposed_addr); + let with_exposed_provenance: V<*mut i8> = simd_with_exposed_provenance(exposed_addr); assert!(const_ptrs.0 == [ptr as *const u8, core::ptr::null()]); assert!(exposed_addr.0 == [ptr as usize, 0]); - assert!(from_exposed_addr.0 == ptrs.0); + assert!(with_exposed_provenance.0 == ptrs.0); } } diff --git a/tests/ui/sized/ensure-overriding-bindings-in-pattern-with-ty-err-doesnt-ice.rs b/tests/ui/sized/ensure-overriding-bindings-in-pattern-with-ty-err-doesnt-ice.rs index d08ca644a1c..5c96c653df5 100644 --- a/tests/ui/sized/ensure-overriding-bindings-in-pattern-with-ty-err-doesnt-ice.rs +++ b/tests/ui/sized/ensure-overriding-bindings-in-pattern-with-ty-err-doesnt-ice.rs @@ -2,6 +2,6 @@ fn main() { let str::<{fn str() { let str::T>>::as_bytes; }}, T>::as_bytes; //~^ ERROR expected a pattern, found an expression //~| ERROR cannot find type `T` in this scope -//~| ERROR type and const arguments are not allowed on builtin type `str` +//~| ERROR const and type arguments are not allowed on builtin type `str` //~| ERROR expected unit struct, unit variant or constant, found associated function `str<, T>::as_bytes` } diff --git a/tests/ui/sized/ensure-overriding-bindings-in-pattern-with-ty-err-doesnt-ice.stderr b/tests/ui/sized/ensure-overriding-bindings-in-pattern-with-ty-err-doesnt-ice.stderr index 19d4ac713ce..d62c019a1e1 100644 --- a/tests/ui/sized/ensure-overriding-bindings-in-pattern-with-ty-err-doesnt-ice.stderr +++ b/tests/ui/sized/ensure-overriding-bindings-in-pattern-with-ty-err-doesnt-ice.stderr @@ -10,11 +10,11 @@ error[E0412]: cannot find type `T` in this scope LL | let str::<{fn str() { let str::T>>::as_bytes; }}, T>::as_bytes; | ^ not found in this scope -error[E0109]: type and const arguments are not allowed on builtin type `str` +error[E0109]: const and type arguments are not allowed on builtin type `str` --> $DIR/ensure-overriding-bindings-in-pattern-with-ty-err-doesnt-ice.rs:2:15 | LL | let str::<{fn str() { let str::T>>::as_bytes; }}, T>::as_bytes; - | --- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^ type and const arguments not allowed + | --- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^ const and type arguments not allowed | | | not allowed on builtin type `str` | diff --git a/tests/ui/specialization/issue-39448.rs b/tests/ui/specialization/issue-39448.rs index a15c4bd6b7f..1c8843d983a 100644 --- a/tests/ui/specialization/issue-39448.rs +++ b/tests/ui/specialization/issue-39448.rs @@ -22,6 +22,7 @@ trait FromA<T> { } impl<T: A, U: A + FromA<T>> FromA<T> for U { + //~^ ERROR cycle detected when computing whether impls specialize one another default fn from(x: T) -> Self { ToA::to(x) } @@ -42,7 +43,7 @@ where #[allow(dead_code)] fn foo<T: A, U: A>(x: T, y: U) -> U { - x.foo(y.to()).to() //~ ERROR overflow evaluating the requirement + x.foo(y.to()).to() } fn main() { diff --git a/tests/ui/specialization/issue-39448.stderr b/tests/ui/specialization/issue-39448.stderr index dc5db4f4285..e2c5f8c4846 100644 --- a/tests/ui/specialization/issue-39448.stderr +++ b/tests/ui/specialization/issue-39448.stderr @@ -8,28 +8,21 @@ LL | #![feature(specialization)] = help: consider using `min_specialization` instead, which is more stable and complete = note: `#[warn(incomplete_features)]` on by default -error[E0275]: overflow evaluating the requirement `T: FromA<U>` - --> $DIR/issue-39448.rs:45:13 - | -LL | x.foo(y.to()).to() - | ^^ - | -note: required for `T` to implement `FromA<U>` - --> $DIR/issue-39448.rs:24:29 +error[E0391]: cycle detected when computing whether impls specialize one another + --> $DIR/issue-39448.rs:24:1 | LL | impl<T: A, U: A + FromA<T>> FromA<T> for U { - | -------- ^^^^^^^^ ^ - | | - | unsatisfied trait bound introduced here -note: required for `U` to implement `ToA<T>` - --> $DIR/issue-39448.rs:34:12 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: ...which requires evaluating trait selection obligation `u16: FromA<u8>`... + = note: ...which again requires computing whether impls specialize one another, completing the cycle +note: cycle used when building specialization graph of trait `FromA` + --> $DIR/issue-39448.rs:20:1 | -LL | impl<T, U> ToA<U> for T - | ^^^^^^ ^ -LL | where -LL | U: FromA<T>, - | -------- unsatisfied trait bound introduced here +LL | trait FromA<T> { + | ^^^^^^^^^^^^^^ + = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information error: aborting due to 1 previous error; 1 warning emitted -For more information about this error, try `rustc --explain E0275`. +For more information about this error, try `rustc --explain E0391`. diff --git a/tests/ui/specialization/issue-39618.rs b/tests/ui/specialization/issue-39618.rs index 5b9b012e665..14a6fcf572e 100644 --- a/tests/ui/specialization/issue-39618.rs +++ b/tests/ui/specialization/issue-39618.rs @@ -2,8 +2,6 @@ // FIXME(JohnTitor): Centril pointed out this looks suspicions, we should revisit here. // More context: https://github.com/rust-lang/rust/pull/69192#discussion_r379846796 -//@ check-pass - #![feature(specialization)] //~ WARN the feature `specialization` is incomplete trait Foo { @@ -19,6 +17,7 @@ impl<T> Bar for T where T: Foo { } impl<T> Foo for T where T: Bar { + //~^ ERROR cycle detected when computing whether impls specialize one another fn foo(&self) {} } diff --git a/tests/ui/specialization/issue-39618.stderr b/tests/ui/specialization/issue-39618.stderr index 19de60c7c17..756162ce92c 100644 --- a/tests/ui/specialization/issue-39618.stderr +++ b/tests/ui/specialization/issue-39618.stderr @@ -1,5 +1,5 @@ warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/issue-39618.rs:7:12 + --> $DIR/issue-39618.rs:5:12 | LL | #![feature(specialization)] | ^^^^^^^^^^^^^^ @@ -8,5 +8,21 @@ LL | #![feature(specialization)] = help: consider using `min_specialization` instead, which is more stable and complete = note: `#[warn(incomplete_features)]` on by default -warning: 1 warning emitted +error[E0391]: cycle detected when computing whether impls specialize one another + --> $DIR/issue-39618.rs:19:1 + | +LL | impl<T> Foo for T where T: Bar { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: ...which requires evaluating trait selection obligation `u64: Bar`... + = note: ...which again requires computing whether impls specialize one another, completing the cycle +note: cycle used when building specialization graph of trait `Foo` + --> $DIR/issue-39618.rs:7:1 + | +LL | trait Foo { + | ^^^^^^^^^ + = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information + +error: aborting due to 1 previous error; 1 warning emitted +For more information about this error, try `rustc --explain E0391`. diff --git a/tests/ui/stability-attribute/stability-in-private-module.rs b/tests/ui/stability-attribute/stability-in-private-module.rs index f12e9198b0d..df94931690b 100644 --- a/tests/ui/stability-attribute/stability-in-private-module.rs +++ b/tests/ui/stability-attribute/stability-in-private-module.rs @@ -1,4 +1,4 @@ fn main() { - let _ = std::thread::thread_info::current_thread(); - //~^ERROR module `thread_info` is private + let _ = std::sys::os::errno(); + //~^ERROR module `sys` is private } diff --git a/tests/ui/stability-attribute/stability-in-private-module.stderr b/tests/ui/stability-attribute/stability-in-private-module.stderr index 9eb4d3efc8b..e65f8aa9b1f 100644 --- a/tests/ui/stability-attribute/stability-in-private-module.stderr +++ b/tests/ui/stability-attribute/stability-in-private-module.stderr @@ -1,13 +1,13 @@ -error[E0603]: module `thread_info` is private - --> $DIR/stability-in-private-module.rs:2:26 +error[E0603]: module `sys` is private + --> $DIR/stability-in-private-module.rs:2:18 | -LL | let _ = std::thread::thread_info::current_thread(); - | ^^^^^^^^^^^ -------------- function `current_thread` is not publicly re-exported - | | - | private module +LL | let _ = std::sys::os::errno(); + | ^^^ ----- function `errno` is not publicly re-exported + | | + | private module | -note: the module `thread_info` is defined here - --> $SRC_DIR/std/src/thread/mod.rs:LL:COL +note: the module `sys` is defined here + --> $SRC_DIR/std/src/lib.rs:LL:COL error: aborting due to 1 previous error diff --git a/tests/ui/statics/nested-allocations-dont-inherit-codegen-attrs.rs b/tests/ui/statics/nested-allocations-dont-inherit-codegen-attrs.rs new file mode 100644 index 00000000000..0b7e659c7b7 --- /dev/null +++ b/tests/ui/statics/nested-allocations-dont-inherit-codegen-attrs.rs @@ -0,0 +1,11 @@ +//@ build-pass + +// Make sure that the nested static allocation for `FOO` doesn't inherit `no_mangle`. +#[no_mangle] +pub static mut FOO: &mut [i32] = &mut [42]; + +// Make sure that the nested static allocation for `BAR` doesn't inherit `export_name`. +#[export_name = "BAR_"] +pub static mut BAR: &mut [i32] = &mut [42]; + +fn main() {} diff --git a/tests/ui/statics/nested_thread_local.rs b/tests/ui/statics/nested_thread_local.rs new file mode 100644 index 00000000000..a512016335a --- /dev/null +++ b/tests/ui/statics/nested_thread_local.rs @@ -0,0 +1,14 @@ +// Check that we forbid nested statics in `thread_local` statics. + +#![feature(const_refs_to_cell)] +#![feature(thread_local)] + +#[thread_local] +static mut FOO: &u32 = { + //~^ ERROR: does not support implicit nested statics + // Prevent promotion (that would trigger on `&42` as an expression) + let x = 42; + &{ x } +}; + +fn main() {} diff --git a/tests/ui/statics/nested_thread_local.stderr b/tests/ui/statics/nested_thread_local.stderr new file mode 100644 index 00000000000..30c742626fa --- /dev/null +++ b/tests/ui/statics/nested_thread_local.stderr @@ -0,0 +1,8 @@ +error: #[thread_local] does not support implicit nested statics, please create explicit static items and refer to them instead + --> $DIR/nested_thread_local.rs:7:1 + | +LL | static mut FOO: &u32 = { + | ^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/traits/stack-error-order-dependence-2.rs b/tests/ui/traits/stack-error-order-dependence-2.rs new file mode 100644 index 00000000000..323685aa15b --- /dev/null +++ b/tests/ui/traits/stack-error-order-dependence-2.rs @@ -0,0 +1,24 @@ +//@ check-pass +// Regression test for <https://github.com/rust-lang/rust/issues/123303>. +// This time EXCEPT without `dyn` builtin bounds :^) + +pub trait Trait: Supertrait {} + +trait Impossible {} +impl<F: ?Sized + Impossible> Trait for F {} + +pub trait Supertrait {} + +impl<T: ?Sized + Trait + Impossible> Supertrait for T {} + +fn needs_supertrait<T: ?Sized + Supertrait>() {} +fn needs_trait<T: ?Sized + Trait>() {} + +struct A; +impl Trait for A where A: Supertrait {} +impl Supertrait for A {} + +fn main() { + needs_supertrait::<A>(); + needs_trait::<A>(); +} diff --git a/tests/ui/traits/stack-error-order-dependence.rs b/tests/ui/traits/stack-error-order-dependence.rs new file mode 100644 index 00000000000..037c292a542 --- /dev/null +++ b/tests/ui/traits/stack-error-order-dependence.rs @@ -0,0 +1,19 @@ +//@ check-pass +// Regression test for <https://github.com/rust-lang/rust/issues/123303>. + +pub trait Trait: Supertrait {} + +trait Impossible {} +impl<F: ?Sized + Impossible> Trait for F {} + +pub trait Supertrait {} + +impl<T: ?Sized + Trait + Impossible> Supertrait for T {} + +fn needs_supertrait<T: ?Sized + Supertrait>() {} +fn needs_trait<T: ?Sized + Trait>() {} + +fn main() { + needs_supertrait::<dyn Trait>(); + needs_trait::<dyn Trait>(); +} |
