diff options
Diffstat (limited to 'tests')
80 files changed, 979 insertions, 210 deletions
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 index 1ed65b310ac..1ab1d01e5fa 100644 --- 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 @@ -21,12 +21,12 @@ 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 = unchecked_shl::<u64>(_3, move _5) -> [return: bb1, unwind unreachable]; - } - - bb1: { ++ _0 = ShlUnchecked(_3, move _5); + StorageDead(_5); StorageDead(_4); StorageDead(_3); 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 index 7a27675638b..577fc8bee66 100644 --- 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 @@ -21,12 +21,12 @@ StorageLive(_4); _4 = _2; - _0 = core::num::<impl u64>::unchecked_shl(move _3, move _4) -> bb1; +- } +- +- bb1: { + StorageLive(_5); + _5 = _4 as u64 (IntToInt); -+ _0 = unchecked_shl::<u64>(_3, move _5) -> [return: bb1, unwind unreachable]; - } - - bb1: { ++ _0 = ShlUnchecked(_3, move _5); + StorageDead(_5); StorageDead(_4); StorageDead(_3); 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 index eee56b9560d..65b832497f9 100644 --- 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 @@ -15,10 +15,7 @@ fn unchecked_shl_unsigned_bigger(_1: u64, _2: u32) -> u64 { bb0: { StorageLive(_3); _3 = _2 as u64 (IntToInt); - _0 = unchecked_shl::<u64>(_1, move _3) -> [return: bb1, unwind unreachable]; - } - - bb1: { + _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 index eee56b9560d..65b832497f9 100644 --- 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 @@ -15,10 +15,7 @@ fn unchecked_shl_unsigned_bigger(_1: u64, _2: u32) -> u64 { bb0: { StorageLive(_3); _3 = _2 as u64 (IntToInt); - _0 = unchecked_shl::<u64>(_1, move _3) -> [return: bb1, unwind unreachable]; - } - - bb1: { + _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 6c809f0b533..90b32247c95 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 @@ -23,6 +23,9 @@ StorageLive(_4); _4 = _2; - _0 = core::num::<impl u16>::unchecked_shl(move _3, move _4) -> [return: bb1, unwind unreachable]; +- } +- +- bb1: { + StorageLive(_5); + StorageLive(_6); + StorageLive(_7); @@ -32,10 +35,7 @@ + assume(move _6); + StorageDead(_6); + _5 = _4 as u16 (IntToInt); -+ _0 = unchecked_shl::<u16>(_3, move _5) -> [return: bb1, unwind unreachable]; - } - - bb1: { ++ _0 = ShlUnchecked(_3, move _5); + StorageDead(_5); StorageDead(_4); StorageDead(_3); 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 0753c1b05df..ba159c063b3 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 @@ -23,6 +23,9 @@ StorageLive(_4); _4 = _2; - _0 = core::num::<impl u16>::unchecked_shl(move _3, move _4) -> bb1; +- } +- +- bb1: { + StorageLive(_5); + StorageLive(_6); + StorageLive(_7); @@ -32,10 +35,7 @@ + assume(move _6); + StorageDead(_6); + _5 = _4 as u16 (IntToInt); -+ _0 = unchecked_shl::<u16>(_3, move _5) -> [return: bb1, unwind unreachable]; - } - - bb1: { ++ _0 = ShlUnchecked(_3, move _5); + StorageDead(_5); StorageDead(_4); StorageDead(_3); 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 7bf10b365a6..3f388a69d7e 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 @@ -24,10 +24,7 @@ fn unchecked_shl_unsigned_smaller(_1: u16, _2: u32) -> u16 { assume(move _4); StorageDead(_4); _5 = _2 as u16 (IntToInt); - _0 = unchecked_shl::<u16>(_1, move _5) -> [return: bb1, unwind unreachable]; - } - - bb1: { + _0 = ShlUnchecked(_1, move _5); StorageDead(_5); 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 7bf10b365a6..3f388a69d7e 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 @@ -24,10 +24,7 @@ fn unchecked_shl_unsigned_smaller(_1: u16, _2: u32) -> u16 { assume(move _4); StorageDead(_4); _5 = _2 as u16 (IntToInt); - _0 = unchecked_shl::<u16>(_1, move _5) -> [return: bb1, unwind unreachable]; - } - - bb1: { + _0 = ShlUnchecked(_1, move _5); StorageDead(_5); 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 04ddb4e80ff..1e83fec4f3d 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 @@ -21,12 +21,12 @@ StorageLive(_4); _4 = _2; - _0 = core::num::<impl i64>::unchecked_shr(move _3, move _4) -> [return: bb1, unwind unreachable]; +- } +- +- bb1: { + StorageLive(_5); + _5 = _4 as i64 (IntToInt); -+ _0 = unchecked_shr::<i64>(_3, move _5) -> [return: bb1, unwind unreachable]; - } - - bb1: { ++ _0 = ShrUnchecked(_3, move _5); + StorageDead(_5); StorageDead(_4); StorageDead(_3); 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 762aa1564b5..d7ff104b92e 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 @@ -21,12 +21,12 @@ StorageLive(_4); _4 = _2; - _0 = core::num::<impl i64>::unchecked_shr(move _3, move _4) -> bb1; +- } +- +- bb1: { + StorageLive(_5); + _5 = _4 as i64 (IntToInt); -+ _0 = unchecked_shr::<i64>(_3, move _5) -> [return: bb1, unwind unreachable]; - } - - bb1: { ++ _0 = ShrUnchecked(_3, move _5); + StorageDead(_5); StorageDead(_4); StorageDead(_3); 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 858760d065c..7524ec4970e 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 @@ -15,10 +15,7 @@ fn unchecked_shr_signed_bigger(_1: i64, _2: u32) -> i64 { bb0: { StorageLive(_3); _3 = _2 as i64 (IntToInt); - _0 = unchecked_shr::<i64>(_1, move _3) -> [return: bb1, unwind unreachable]; - } - - bb1: { + _0 = ShrUnchecked(_1, move _3); StorageDead(_3); 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 858760d065c..7524ec4970e 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 @@ -15,10 +15,7 @@ fn unchecked_shr_signed_bigger(_1: i64, _2: u32) -> i64 { bb0: { StorageLive(_3); _3 = _2 as i64 (IntToInt); - _0 = unchecked_shr::<i64>(_1, move _3) -> [return: bb1, unwind unreachable]; - } - - bb1: { + _0 = ShrUnchecked(_1, move _3); StorageDead(_3); 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 index 5739336cb4f..fa7e5d16e39 100644 --- 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 @@ -23,6 +23,9 @@ StorageLive(_4); _4 = _2; - _0 = core::num::<impl i16>::unchecked_shr(move _3, move _4) -> [return: bb1, unwind unreachable]; +- } +- +- bb1: { + StorageLive(_5); + StorageLive(_6); + StorageLive(_7); @@ -32,10 +35,7 @@ + assume(move _6); + StorageDead(_6); + _5 = _4 as i16 (IntToInt); -+ _0 = unchecked_shr::<i16>(_3, move _5) -> [return: bb1, unwind unreachable]; - } - - bb1: { ++ _0 = ShrUnchecked(_3, move _5); + StorageDead(_5); StorageDead(_4); StorageDead(_3); 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 index e04912e1d1c..3d398e00fc8 100644 --- 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 @@ -23,6 +23,9 @@ StorageLive(_4); _4 = _2; - _0 = core::num::<impl i16>::unchecked_shr(move _3, move _4) -> bb1; +- } +- +- bb1: { + StorageLive(_5); + StorageLive(_6); + StorageLive(_7); @@ -32,10 +35,7 @@ + assume(move _6); + StorageDead(_6); + _5 = _4 as i16 (IntToInt); -+ _0 = unchecked_shr::<i16>(_3, move _5) -> [return: bb1, unwind unreachable]; - } - - bb1: { ++ _0 = ShrUnchecked(_3, move _5); + StorageDead(_5); StorageDead(_4); StorageDead(_3); 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 index 08b044f4f9e..64ea25349ac 100644 --- 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 @@ -24,10 +24,7 @@ fn unchecked_shr_signed_smaller(_1: i16, _2: u32) -> i16 { assume(move _4); StorageDead(_4); _5 = _2 as i16 (IntToInt); - _0 = unchecked_shr::<i16>(_1, move _5) -> [return: bb1, unwind unreachable]; - } - - bb1: { + _0 = ShrUnchecked(_1, move _5); StorageDead(_5); 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 index 08b044f4f9e..64ea25349ac 100644 --- 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 @@ -24,10 +24,7 @@ fn unchecked_shr_signed_smaller(_1: i16, _2: u32) -> i16 { assume(move _4); StorageDead(_4); _5 = _2 as i16 (IntToInt); - _0 = unchecked_shr::<i16>(_1, move _5) -> [return: bb1, unwind unreachable]; - } - - bb1: { + _0 = ShrUnchecked(_1, move _5); StorageDead(_5); return; } diff --git a/tests/mir-opt/lower_intrinsics.rs b/tests/mir-opt/lower_intrinsics.rs index 876b4497034..0758e9b775b 100644 --- a/tests/mir-opt/lower_intrinsics.rs +++ b/tests/mir-opt/lower_intrinsics.rs @@ -13,8 +13,13 @@ pub fn wrapping(a: i32, b: i32) { // EMIT_MIR lower_intrinsics.unchecked.LowerIntrinsics.diff pub unsafe fn unchecked(a: i32, b: i32) { + let _a = core::intrinsics::unchecked_add(a, b); + let _b = core::intrinsics::unchecked_sub(a, b); + let _c = core::intrinsics::unchecked_mul(a, b); let _x = core::intrinsics::unchecked_div(a, b); let _y = core::intrinsics::unchecked_rem(a, b); + let _i = core::intrinsics::unchecked_shl(a, b); + let _j = core::intrinsics::unchecked_shr(a, b); } // EMIT_MIR lower_intrinsics.size_of.LowerIntrinsics.diff 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 c532d74ced0..dd92b8d6d2c 100644 --- a/tests/mir-opt/lower_intrinsics.unchecked.LowerIntrinsics.panic-abort.diff +++ b/tests/mir-opt/lower_intrinsics.unchecked.LowerIntrinsics.panic-abort.diff @@ -10,11 +10,41 @@ let mut _5: i32; let mut _7: i32; let mut _8: i32; + let mut _10: i32; + let mut _11: i32; + let mut _13: i32; + let mut _14: i32; + let mut _16: i32; + let mut _17: i32; + let mut _19: i32; + let mut _20: i32; + let mut _22: i32; + let mut _23: i32; scope 1 { - debug _x => _3; + debug _a => _3; let _6: i32; scope 2 { - debug _y => _6; + debug _b => _6; + let _9: i32; + scope 3 { + debug _c => _9; + let _12: i32; + scope 4 { + debug _x => _12; + let _15: i32; + scope 5 { + debug _y => _15; + let _18: i32; + scope 6 { + debug _i => _18; + let _21: i32; + scope 7 { + debug _j => _21; + } + } + } + } + } } } @@ -24,8 +54,8 @@ _4 = _1; StorageLive(_5); _5 = _2; -- _3 = unchecked_div::<i32>(move _4, move _5) -> [return: bb1, unwind unreachable]; -+ _3 = Div(move _4, move _5); +- _3 = unchecked_add::<i32>(move _4, move _5) -> [return: bb1, unwind unreachable]; ++ _3 = AddUnchecked(move _4, move _5); + goto -> bb1; } @@ -37,15 +67,85 @@ _7 = _1; StorageLive(_8); _8 = _2; -- _6 = unchecked_rem::<i32>(move _7, move _8) -> [return: bb2, unwind unreachable]; -+ _6 = Rem(move _7, move _8); +- _6 = unchecked_sub::<i32>(move _7, move _8) -> [return: bb2, unwind unreachable]; ++ _6 = SubUnchecked(move _7, move _8); + goto -> bb2; } bb2: { 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); ++ goto -> bb3; + } + + bb3: { + 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); ++ goto -> bb4; + } + + bb4: { + 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); ++ goto -> bb5; + } + + bb5: { + 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); ++ goto -> bb6; + } + + bb6: { + 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); ++ goto -> bb7; + } + + bb7: { + StorageDead(_23); + StorageDead(_22); _0 = const (); + StorageDead(_21); + StorageDead(_18); + StorageDead(_15); + StorageDead(_12); + StorageDead(_9); StorageDead(_6); StorageDead(_3); 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 c532d74ced0..dd92b8d6d2c 100644 --- a/tests/mir-opt/lower_intrinsics.unchecked.LowerIntrinsics.panic-unwind.diff +++ b/tests/mir-opt/lower_intrinsics.unchecked.LowerIntrinsics.panic-unwind.diff @@ -10,11 +10,41 @@ let mut _5: i32; let mut _7: i32; let mut _8: i32; + let mut _10: i32; + let mut _11: i32; + let mut _13: i32; + let mut _14: i32; + let mut _16: i32; + let mut _17: i32; + let mut _19: i32; + let mut _20: i32; + let mut _22: i32; + let mut _23: i32; scope 1 { - debug _x => _3; + debug _a => _3; let _6: i32; scope 2 { - debug _y => _6; + debug _b => _6; + let _9: i32; + scope 3 { + debug _c => _9; + let _12: i32; + scope 4 { + debug _x => _12; + let _15: i32; + scope 5 { + debug _y => _15; + let _18: i32; + scope 6 { + debug _i => _18; + let _21: i32; + scope 7 { + debug _j => _21; + } + } + } + } + } } } @@ -24,8 +54,8 @@ _4 = _1; StorageLive(_5); _5 = _2; -- _3 = unchecked_div::<i32>(move _4, move _5) -> [return: bb1, unwind unreachable]; -+ _3 = Div(move _4, move _5); +- _3 = unchecked_add::<i32>(move _4, move _5) -> [return: bb1, unwind unreachable]; ++ _3 = AddUnchecked(move _4, move _5); + goto -> bb1; } @@ -37,15 +67,85 @@ _7 = _1; StorageLive(_8); _8 = _2; -- _6 = unchecked_rem::<i32>(move _7, move _8) -> [return: bb2, unwind unreachable]; -+ _6 = Rem(move _7, move _8); +- _6 = unchecked_sub::<i32>(move _7, move _8) -> [return: bb2, unwind unreachable]; ++ _6 = SubUnchecked(move _7, move _8); + goto -> bb2; } bb2: { 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); ++ goto -> bb3; + } + + bb3: { + 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); ++ goto -> bb4; + } + + bb4: { + 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); ++ goto -> bb5; + } + + bb5: { + 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); ++ goto -> bb6; + } + + bb6: { + 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); ++ goto -> bb7; + } + + bb7: { + StorageDead(_23); + StorageDead(_22); _0 = const (); + StorageDead(_21); + StorageDead(_18); + StorageDead(_15); + StorageDead(_12); + StorageDead(_9); StorageDead(_6); StorageDead(_3); return; diff --git a/tests/mir-opt/pre-codegen/checked_ops.checked_shl.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/checked_ops.checked_shl.PreCodegen.after.mir index 1a7d5433e35..800308c2e0b 100644 --- a/tests/mir-opt/pre-codegen/checked_ops.checked_shl.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/checked_ops.checked_shl.PreCodegen.after.mir @@ -7,10 +7,9 @@ fn checked_shl(_1: u32, _2: u32) -> Option<u32> { scope 1 (inlined core::num::<impl u32>::checked_shl) { debug self => _1; debug rhs => _2; - let mut _7: u32; - let mut _8: bool; + let mut _7: bool; scope 2 { - debug a => _7; + debug a => _5; debug b => _6; } scope 3 (inlined core::num::<impl u32>::overflowing_shl) { @@ -36,44 +35,38 @@ fn checked_shl(_1: u32, _2: u32) -> Option<u32> { } bb0: { - StorageLive(_6); - StorageLive(_7); StorageLive(_5); + StorageLive(_6); StorageLive(_4); StorageLive(_3); _3 = const 31_u32; _4 = BitAnd(_2, move _3); StorageDead(_3); - _5 = unchecked_shl::<u32>(_1, _4) -> [return: bb1, unwind unreachable]; + _5 = ShlUnchecked(_1, _4); + StorageDead(_4); + _6 = Ge(_2, const _); + StorageLive(_7); + _7 = unlikely(_6) -> [return: bb1, unwind unreachable]; } bb1: { - StorageDead(_4); - _6 = Ge(_2, const _); - _7 = move _5; - StorageDead(_5); - StorageLive(_8); - _8 = unlikely(_6) -> [return: bb2, unwind unreachable]; + switchInt(move _7) -> [0: bb2, otherwise: bb3]; } bb2: { - switchInt(move _8) -> [0: bb3, otherwise: bb4]; + _0 = Option::<u32>::Some(_5); + goto -> bb4; } bb3: { - _0 = Option::<u32>::Some(_7); - goto -> bb5; - } - - bb4: { _0 = Option::<u32>::None; - goto -> bb5; + goto -> bb4; } - bb5: { - StorageDead(_8); + bb4: { StorageDead(_7); StorageDead(_6); + StorageDead(_5); return; } } diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-abort.mir index 79282d88905..9d914e95344 100644 --- a/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-abort.mir @@ -10,18 +10,17 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range<usize>) -> debug self => _1; debug index => std::ops::Range<usize>{ .0 => _3, .1 => _4, }; let mut _5: *mut [u32]; - let mut _14: *mut [u32]; + let mut _13: *mut [u32]; scope 2 { scope 3 (inlined <std::ops::Range<usize> as SliceIndex<[u32]>>::get_unchecked_mut) { debug self => std::ops::Range<usize>{ .0 => _3, .1 => _4, }; debug slice => _5; let mut _7: *mut u32; let mut _8: *mut u32; - let mut _9: usize; + let _15: usize; let _16: usize; - let _17: usize; scope 4 { - debug this => std::ops::Range<usize>{ .0 => _16, .1 => _17, }; + debug this => std::ops::Range<usize>{ .0 => _15, .1 => _16, }; scope 5 { let _6: usize; scope 6 { @@ -37,30 +36,30 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range<usize>) -> } scope 14 (inlined slice_from_raw_parts_mut::<u32>) { debug data => _8; - debug len => _9; - let mut _10: *mut (); + debug len => _6; + let mut _9: *mut (); scope 15 (inlined ptr::mut_ptr::<impl *mut u32>::cast::<()>) { debug self => _8; } scope 16 (inlined std::ptr::from_raw_parts_mut::<[u32]>) { - debug data_address => _10; - debug metadata => _9; - let mut _11: *const (); - let mut _12: std::ptr::metadata::PtrComponents<[u32]>; - let mut _13: std::ptr::metadata::PtrRepr<[u32]>; + debug data_address => _9; + debug metadata => _6; + let mut _10: *const (); + let mut _11: std::ptr::metadata::PtrComponents<[u32]>; + let mut _12: std::ptr::metadata::PtrRepr<[u32]>; scope 17 { } } } } scope 7 (inlined <std::ops::Range<usize> as SliceIndex<[T]>>::get_unchecked_mut::runtime::<u32>) { - debug this => std::ops::Range<usize>{ .0 => _16, .1 => _17, }; + debug this => std::ops::Range<usize>{ .0 => _15, .1 => _16, }; debug slice => _5; scope 8 (inlined ptr::mut_ptr::<impl *mut [u32]>::len) { debug self => _5; - let mut _15: *const [u32]; + let mut _14: *const [u32]; scope 9 (inlined std::ptr::metadata::<[u32]>) { - debug ptr => _15; + debug ptr => _14; scope 10 { } } @@ -75,46 +74,40 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range<usize>) -> bb0: { _3 = move (_2.0: usize); _4 = move (_2.1: usize); - StorageLive(_14); + StorageLive(_13); StorageLive(_5); _5 = &raw mut (*_1); + StorageLive(_6); + StorageLive(_14); StorageLive(_15); StorageLive(_16); - StorageLive(_17); - StorageLive(_6); - _6 = unchecked_sub::<usize>(_4, _3) -> [return: bb1, unwind unreachable]; - } - - bb1: { + _6 = SubUnchecked(_4, _3); StorageLive(_8); StorageLive(_7); _7 = _5 as *mut u32 (PtrToPtr); _8 = Offset(_7, _3); StorageDead(_7); StorageLive(_9); - _9 = _6; - StorageLive(_10); - _10 = _8 as *mut () (PtrToPtr); - StorageLive(_13); + _9 = _8 as *mut () (PtrToPtr); StorageLive(_12); StorageLive(_11); - _11 = _10 as *const () (Pointer(MutToConstPointer)); - _12 = ptr::metadata::PtrComponents::<[u32]> { data_address: move _11, metadata: _9 }; + StorageLive(_10); + _10 = _9 as *const () (Pointer(MutToConstPointer)); + _11 = ptr::metadata::PtrComponents::<[u32]> { data_address: move _10, metadata: _6 }; + StorageDead(_10); + _12 = ptr::metadata::PtrRepr::<[u32]> { const_ptr: move _11 }; StorageDead(_11); - _13 = ptr::metadata::PtrRepr::<[u32]> { const_ptr: move _12 }; + _13 = (_12.1: *mut [u32]); StorageDead(_12); - _14 = (_13.1: *mut [u32]); - StorageDead(_13); - StorageDead(_10); StorageDead(_9); StorageDead(_8); - StorageDead(_6); - StorageDead(_17); StorageDead(_16); StorageDead(_15); - StorageDead(_5); - _0 = &mut (*_14); StorageDead(_14); + StorageDead(_6); + StorageDead(_5); + _0 = &mut (*_13); + StorageDead(_13); return; } } diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-unwind.mir index 79282d88905..9d914e95344 100644 --- a/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-unwind.mir @@ -10,18 +10,17 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range<usize>) -> debug self => _1; debug index => std::ops::Range<usize>{ .0 => _3, .1 => _4, }; let mut _5: *mut [u32]; - let mut _14: *mut [u32]; + let mut _13: *mut [u32]; scope 2 { scope 3 (inlined <std::ops::Range<usize> as SliceIndex<[u32]>>::get_unchecked_mut) { debug self => std::ops::Range<usize>{ .0 => _3, .1 => _4, }; debug slice => _5; let mut _7: *mut u32; let mut _8: *mut u32; - let mut _9: usize; + let _15: usize; let _16: usize; - let _17: usize; scope 4 { - debug this => std::ops::Range<usize>{ .0 => _16, .1 => _17, }; + debug this => std::ops::Range<usize>{ .0 => _15, .1 => _16, }; scope 5 { let _6: usize; scope 6 { @@ -37,30 +36,30 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range<usize>) -> } scope 14 (inlined slice_from_raw_parts_mut::<u32>) { debug data => _8; - debug len => _9; - let mut _10: *mut (); + debug len => _6; + let mut _9: *mut (); scope 15 (inlined ptr::mut_ptr::<impl *mut u32>::cast::<()>) { debug self => _8; } scope 16 (inlined std::ptr::from_raw_parts_mut::<[u32]>) { - debug data_address => _10; - debug metadata => _9; - let mut _11: *const (); - let mut _12: std::ptr::metadata::PtrComponents<[u32]>; - let mut _13: std::ptr::metadata::PtrRepr<[u32]>; + debug data_address => _9; + debug metadata => _6; + let mut _10: *const (); + let mut _11: std::ptr::metadata::PtrComponents<[u32]>; + let mut _12: std::ptr::metadata::PtrRepr<[u32]>; scope 17 { } } } } scope 7 (inlined <std::ops::Range<usize> as SliceIndex<[T]>>::get_unchecked_mut::runtime::<u32>) { - debug this => std::ops::Range<usize>{ .0 => _16, .1 => _17, }; + debug this => std::ops::Range<usize>{ .0 => _15, .1 => _16, }; debug slice => _5; scope 8 (inlined ptr::mut_ptr::<impl *mut [u32]>::len) { debug self => _5; - let mut _15: *const [u32]; + let mut _14: *const [u32]; scope 9 (inlined std::ptr::metadata::<[u32]>) { - debug ptr => _15; + debug ptr => _14; scope 10 { } } @@ -75,46 +74,40 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range<usize>) -> bb0: { _3 = move (_2.0: usize); _4 = move (_2.1: usize); - StorageLive(_14); + StorageLive(_13); StorageLive(_5); _5 = &raw mut (*_1); + StorageLive(_6); + StorageLive(_14); StorageLive(_15); StorageLive(_16); - StorageLive(_17); - StorageLive(_6); - _6 = unchecked_sub::<usize>(_4, _3) -> [return: bb1, unwind unreachable]; - } - - bb1: { + _6 = SubUnchecked(_4, _3); StorageLive(_8); StorageLive(_7); _7 = _5 as *mut u32 (PtrToPtr); _8 = Offset(_7, _3); StorageDead(_7); StorageLive(_9); - _9 = _6; - StorageLive(_10); - _10 = _8 as *mut () (PtrToPtr); - StorageLive(_13); + _9 = _8 as *mut () (PtrToPtr); StorageLive(_12); StorageLive(_11); - _11 = _10 as *const () (Pointer(MutToConstPointer)); - _12 = ptr::metadata::PtrComponents::<[u32]> { data_address: move _11, metadata: _9 }; + StorageLive(_10); + _10 = _9 as *const () (Pointer(MutToConstPointer)); + _11 = ptr::metadata::PtrComponents::<[u32]> { data_address: move _10, metadata: _6 }; + StorageDead(_10); + _12 = ptr::metadata::PtrRepr::<[u32]> { const_ptr: move _11 }; StorageDead(_11); - _13 = ptr::metadata::PtrRepr::<[u32]> { const_ptr: move _12 }; + _13 = (_12.1: *mut [u32]); StorageDead(_12); - _14 = (_13.1: *mut [u32]); - StorageDead(_13); - StorageDead(_10); StorageDead(_9); StorageDead(_8); - StorageDead(_6); - StorageDead(_17); StorageDead(_16); StorageDead(_15); - StorageDead(_5); - _0 = &mut (*_14); StorageDead(_14); + StorageDead(_6); + StorageDead(_5); + _0 = &mut (*_13); + StorageDead(_13); return; } } diff --git a/tests/run-make-fulldeps/issue-19371/foo.rs b/tests/run-make-fulldeps/issue-19371/foo.rs index 6d08cfd07f8..9cca6200050 100644 --- a/tests/run-make-fulldeps/issue-19371/foo.rs +++ b/tests/run-make-fulldeps/issue-19371/foo.rs @@ -63,10 +63,11 @@ fn compile(code: String, output: PathBuf, sysroot: PathBuf) { }; interface::run_compiler(config, |compiler| { - // This runs all the passes prior to linking, too. - let linker = compiler.enter(|queries| queries.linker()); - if let Ok(linker) = linker { - linker.link(); - } + let linker = compiler.enter(|queries| { + queries.global_ctxt()?.enter(|tcx| tcx.analysis(()))?; + let ongoing_codegen = queries.ongoing_codegen()?; + queries.linker(ongoing_codegen) + }); + linker.unwrap().link(); }); } diff --git a/tests/run-make/allocator-shim-circular-deps/Makefile b/tests/run-make/allocator-shim-circular-deps/Makefile new file mode 100644 index 00000000000..4624b846803 --- /dev/null +++ b/tests/run-make/allocator-shim-circular-deps/Makefile @@ -0,0 +1,7 @@ +# ignore-cross-compile +include ../tools.mk + +all: + rm -rf $(TMPDIR) && mkdir $(TMPDIR) + $(RUSTC) my_lib.rs + $(RUSTC) main.rs --test --extern my_lib=$(TMPDIR)/libmy_lib.rlib diff --git a/tests/run-make/allocator-shim-circular-deps/main.rs b/tests/run-make/allocator-shim-circular-deps/main.rs new file mode 100644 index 00000000000..e317c657150 --- /dev/null +++ b/tests/run-make/allocator-shim-circular-deps/main.rs @@ -0,0 +1,5 @@ +#![crate_type = "bin"] + +fn main() { + my_lib::do_something(); +} diff --git a/tests/run-make/allocator-shim-circular-deps/my_lib.rs b/tests/run-make/allocator-shim-circular-deps/my_lib.rs new file mode 100644 index 00000000000..095b1036116 --- /dev/null +++ b/tests/run-make/allocator-shim-circular-deps/my_lib.rs @@ -0,0 +1,10 @@ +#![crate_type = "lib"] + +use std::alloc::System; + +#[global_allocator] +static ALLOCATOR: System = System; + +pub fn do_something() { + format!("allocating a string!"); +} diff --git a/tests/run-make/coverage-reports/sort_subviews.py b/tests/run-make/coverage-reports/sort_subviews.py index 10cfc51d447..10cfc51d447 100644..100755 --- a/tests/run-make/coverage-reports/sort_subviews.py +++ b/tests/run-make/coverage-reports/sort_subviews.py diff --git a/tests/run-make/libtest-junit/validate_junit.py b/tests/run-make/libtest-junit/validate_junit.py index 47a8e70ccc3..0d9b34a3cf7 100755 --- a/tests/run-make/libtest-junit/validate_junit.py +++ b/tests/run-make/libtest-junit/validate_junit.py @@ -7,6 +7,6 @@ import xml.etree.ElementTree as ET for line in sys.stdin: try: ET.fromstring(line) - except ET.ParseError as pe: + except ET.ParseError: print("Invalid xml: %r" % line) raise diff --git a/tests/run-make/rustdoc-map-file/validate_json.py b/tests/run-make/rustdoc-map-file/validate_json.py index 5c14c90b70d..912dea3791b 100755 --- a/tests/run-make/rustdoc-map-file/validate_json.py +++ b/tests/run-make/rustdoc-map-file/validate_json.py @@ -6,7 +6,7 @@ import json def find_redirect_map_file(folder, errors): - for root, dirs, files in os.walk(folder): + for root, _dirs, files in os.walk(folder): for name in files: if not name.endswith("redirect-map.json"): continue diff --git a/tests/run-make/sysroot-crates-are-unstable/test.py b/tests/run-make/sysroot-crates-are-unstable/test.py index cab4faa4e64..45cfdd195b4 100644 --- a/tests/run-make/sysroot-crates-are-unstable/test.py +++ b/tests/run-make/sysroot-crates-are-unstable/test.py @@ -46,7 +46,7 @@ def check_lib(lib): '--target', os.environ['TARGET'], '--extern', '{}={}'.format(lib['name'], lib['path'])], to_input=('extern crate {};'.format(lib['name'])).encode('utf-8')) - if not 'use of unstable library feature' in '{}{}'.format(stdout, stderr): + if 'use of unstable library feature' not in '{}{}'.format(stdout, stderr): print('crate {} "{}" is not unstable'.format(lib['name'], lib['path'])) print('{}{}'.format(stdout, stderr)) print('') diff --git a/tests/rustdoc-gui/search-result-color.goml b/tests/rustdoc-gui/search-result-color.goml index c75e4141434..193a3eb3fd1 100644 --- a/tests/rustdoc-gui/search-result-color.goml +++ b/tests/rustdoc-gui/search-result-color.goml @@ -28,6 +28,12 @@ define-function: ( ".result-" + |result_kind| + ":focus ." + |result_kind|, {"color": |hover_color|}, ) + // color of the typename (struct, module, method, ...) before search results + assert-css: ( + ".result-name .typename", + {"color": "#888"}, + ALL, + ) }, ) diff --git a/tests/rustdoc/alias-reexport.rs b/tests/rustdoc/alias-reexport.rs new file mode 100644 index 00000000000..a2a8e651caf --- /dev/null +++ b/tests/rustdoc/alias-reexport.rs @@ -0,0 +1,16 @@ +// aux-build:alias-reexport.rs +// aux-build:alias-reexport2.rs + +#![crate_name = "foo"] +#![feature(lazy_type_alias)] + +extern crate alias_reexport2; + +// @has 'foo/reexport/fn.foo.html' +// @has - '//*[@class="rust item-decl"]' 'pub fn foo() -> Reexported' +// @has 'foo/reexport/fn.foo2.html' +// @has - '//*[@class="rust item-decl"]' 'pub fn foo2() -> Result<Reexported, ()>' +// @has 'foo/reexport/type.Reexported.html' +// @has - '//*[@class="rust item-decl"]' 'pub type Reexported = u8;' +#[doc(inline)] +pub use alias_reexport2 as reexport; diff --git a/tests/rustdoc/alias-reexport2.rs b/tests/rustdoc/alias-reexport2.rs new file mode 100644 index 00000000000..85d3cdad962 --- /dev/null +++ b/tests/rustdoc/alias-reexport2.rs @@ -0,0 +1,16 @@ +// gate-test-lazy_type_alias +// aux-build:alias-reexport.rs + +#![crate_name = "foo"] +#![feature(lazy_type_alias)] + +extern crate alias_reexport; + +use alias_reexport::Reexported; + +// @has 'foo/fn.foo.html' +// @has - '//*[@class="rust item-decl"]' 'pub fn foo() -> Reexported' +pub fn foo() -> Reexported { 0 } +// @has 'foo/fn.foo2.html' +// @has - '//*[@class="rust item-decl"]' 'pub fn foo2() -> Result<Reexported, ()>' +pub fn foo2() -> Result<Reexported, ()> { Ok(0) } diff --git a/tests/rustdoc/auxiliary/alias-reexport.rs b/tests/rustdoc/auxiliary/alias-reexport.rs new file mode 100644 index 00000000000..14fafc02d36 --- /dev/null +++ b/tests/rustdoc/auxiliary/alias-reexport.rs @@ -0,0 +1,3 @@ +#![feature(lazy_type_alias)] + +pub type Reexported = u8; diff --git a/tests/rustdoc/auxiliary/alias-reexport2.rs b/tests/rustdoc/auxiliary/alias-reexport2.rs new file mode 100644 index 00000000000..9f6910572ad --- /dev/null +++ b/tests/rustdoc/auxiliary/alias-reexport2.rs @@ -0,0 +1,12 @@ +#![feature(lazy_type_alias)] + +extern crate alias_reexport; + +pub use alias_reexport::Reexported; + +// @has 'foo/fn.foo.html' +// @has - '//*[@class="docblock item-decl"]' 'pub fn foo() -> Reexported' +pub fn foo() -> Reexported { 0 } +// @has 'foo/fn.foo2.html' +// @has - '//*[@class="docblock item-decl"]' 'pub fn foo2() -> Result<Reexported, ()>' +pub fn foo2() -> Result<Reexported, ()> { Ok(0) } diff --git a/tests/rustdoc/files-creation-hidden.rs b/tests/rustdoc/files-creation-hidden.rs new file mode 100644 index 00000000000..bcabbfc91e8 --- /dev/null +++ b/tests/rustdoc/files-creation-hidden.rs @@ -0,0 +1,23 @@ +#![crate_name="foo"] + +// @!has "foo/struct.Foo.html" +#[doc(hidden)] +pub struct Foo; + +// @!has "foo/struct.Bar.html" +pub use crate::Foo as Bar; + +// @!has "foo/struct.Baz.html" +#[doc(hidden)] +pub use crate::Foo as Baz; + +// @!has "foo/foo/index.html" +#[doc(hidden)] +pub mod foo {} + +// @!has "foo/bar/index.html" +pub use crate::foo as bar; + +// @!has "foo/baz/index.html" +#[doc(hidden)] +pub use crate::foo as baz; diff --git a/tests/rustdoc/files-creation-private.rs b/tests/rustdoc/files-creation-private.rs new file mode 100644 index 00000000000..ca2327e0f91 --- /dev/null +++ b/tests/rustdoc/files-creation-private.rs @@ -0,0 +1,18 @@ +#![crate_name="foo"] + +// @!has "foo/priv/index.html" +// @!has "foo/priv/struct.Foo.html" +mod private { + pub struct Foo; +} + +// @has "foo/struct.Bar.html" +pub use crate::private::Foo as Bar; + +// @!has "foo/foo/index.html" +mod foo { + pub mod subfoo {} +} + +// @has "foo/bar/index.html" +pub use crate::foo::subfoo as bar; diff --git a/tests/rustdoc/issue-111064-reexport-trait-from-hidden-2.rs b/tests/rustdoc/issue-111064-reexport-trait-from-hidden-2.rs index 8e1029a1ca3..d6832bb7a09 100644 --- a/tests/rustdoc/issue-111064-reexport-trait-from-hidden-2.rs +++ b/tests/rustdoc/issue-111064-reexport-trait-from-hidden-2.rs @@ -3,10 +3,10 @@ #![crate_name = "foo"] // @!has 'foo/hidden/index.html' -// FIXME: add missing `@` for the two next tests once issue is fixed! -// To be done in <https://github.com/rust-lang/rust/issues/111249>. -// !has 'foo/hidden/inner/index.html' -// !has 'foo/hidden/inner/trait.Foo.html' +// @!has 'foo/hidden/inner/index.html' +// FIXME: Should be `@!has`: https://github.com/rust-lang/rust/issues/111249 +// @has 'foo/hidden/inner/trait.Foo.html' +// @matchesraw - '<meta http-equiv="refresh" content="0;URL=../../../foo/visible/trait.Foo.html">' #[doc(hidden)] pub mod hidden { pub mod inner { diff --git a/tests/rustdoc/issue-111249-file-creation.rs b/tests/rustdoc/issue-111249-file-creation.rs new file mode 100644 index 00000000000..d2042b231e4 --- /dev/null +++ b/tests/rustdoc/issue-111249-file-creation.rs @@ -0,0 +1,34 @@ +#![crate_name = "foo"] +#![feature(no_core)] +#![no_core] + +// The following five should not fail! +// @!has 'foo/hidden/index.html' +// @!has 'foo/hidden/inner/index.html' +// FIXME: Should be `@!has`: https://github.com/rust-lang/rust/issues/111249 +// @has 'foo/hidden/inner/trait.Foo.html' +// @matchesraw - '<meta http-equiv="refresh" content="0;URL=../../../foo/visible/trait.Foo.html">' +// @!has 'foo/hidden/inner/inner_hidden/index.html' +// @!has 'foo/hidden/inner/inner_hidden/trait.HiddenFoo.html' +#[doc(hidden)] +pub mod hidden { + pub mod inner { + pub trait Foo {} + + #[doc(hidden)] + pub mod inner_hidden { + pub trait HiddenFoo {} + } + } +} + +// @has 'foo/visible/index.html' +// @has 'foo/visible/trait.Foo.html' +#[doc(inline)] +pub use hidden::inner as visible; + +// @has 'foo/struct.Bar.html' +// @count - '//*[@id="impl-Foo-for-Bar"]' 1 +pub struct Bar; + +impl visible::Foo for Bar {} diff --git a/tests/rustdoc/redirect.rs b/tests/rustdoc/redirect.rs index 5b7a76e1a77..4fb81c23d39 100644 --- a/tests/rustdoc/redirect.rs +++ b/tests/rustdoc/redirect.rs @@ -10,7 +10,9 @@ pub trait Foo {} // @has - '//code' 'pub use reexp_stripped::Bar' // @has - '//code/a' 'Bar' // @has - '//a[@href="../reexp_stripped/hidden/struct.Bar.html"]' 'Bar' +// FIXME: Should be `@!has`: https://github.com/rust-lang/rust/issues/111249 // @has reexp_stripped/hidden/struct.Bar.html +// @matchesraw - '<meta http-equiv="refresh" content="0;URL=../../reexp_stripped/struct.Bar.html">' // @has 'reexp_stripped/struct.Bar.html' // @has - '//a[@href="struct.Bar.html"]' 'Bar' #[doc(no_inline)] diff --git a/tests/ui/argument-suggestions/issue-112507.rs b/tests/ui/argument-suggestions/issue-112507.rs new file mode 100644 index 00000000000..61743c59a4a --- /dev/null +++ b/tests/ui/argument-suggestions/issue-112507.rs @@ -0,0 +1,12 @@ +pub enum Value { + Float(Option<f64>), +} + +fn main() { + let _a = Value::Float( //~ ERROR this enum variant takes 1 argument but 4 arguments were supplied + 0, + None, + None, + 0, + ); +} diff --git a/tests/ui/argument-suggestions/issue-112507.stderr b/tests/ui/argument-suggestions/issue-112507.stderr new file mode 100644 index 00000000000..dfb47e010e4 --- /dev/null +++ b/tests/ui/argument-suggestions/issue-112507.stderr @@ -0,0 +1,27 @@ +error[E0061]: this enum variant takes 1 argument but 4 arguments were supplied + --> $DIR/issue-112507.rs:6:14 + | +LL | let _a = Value::Float( + | ^^^^^^^^^^^^ +LL | 0, + | - unexpected argument of type `{integer}` +LL | None, +LL | None, + | ---- unexpected argument of type `Option<_>` +LL | 0, + | - unexpected argument of type `{integer}` + | +note: tuple variant defined here + --> $DIR/issue-112507.rs:2:5 + | +LL | Float(Option<f64>), + | ^^^^^ +help: remove the extra arguments + | +LL ~ , +LL ~ None); + | + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0061`. diff --git a/tests/ui/chalkify/bugs/async.stderr b/tests/ui/chalkify/bugs/async.stderr index e6d46b02706..9ebaac31dcb 100644 --- a/tests/ui/chalkify/bugs/async.stderr +++ b/tests/ui/chalkify/bugs/async.stderr @@ -7,7 +7,7 @@ LL | async fn foo(x: u32) -> u32 { = help: the trait `Future` is not implemented for `[async fn body@$DIR/async.rs:23:29: 25:2]` = note: [async fn body@$DIR/async.rs:23:29: 25:2] must be a future or must implement `IntoFuture` to be awaited -error: internal compiler error: projection clauses should be implied from elsewhere. obligation: `Obligation(predicate=Binder(ProjectionPredicate(AliasTy { substs: [[async fn body@$DIR/async.rs:23:29: 25:2]], def_id: ... }, Term::Ty(u32)), []), depth=0)` +error: internal compiler error: projection clauses should be implied from elsewhere. obligation: `Obligation(predicate=Binder { value: ProjectionPredicate(AliasTy { substs: [[async fn body@$DIR/async.rs:23:29: 25:2]], def_id: ... }, Term::Ty(u32)), bound_vars: [] }, depth=0)` --> $DIR/async.rs:23:25 | LL | async fn foo(x: u32) -> u32 { diff --git a/tests/ui/enum/suggest-default-attribute.stderr b/tests/ui/enum/suggest-default-attribute.stderr index fb830d3f78b..b56d599a786 100644 --- a/tests/ui/enum/suggest-default-attribute.stderr +++ b/tests/ui/enum/suggest-default-attribute.stderr @@ -7,7 +7,7 @@ LL | #[default] help: consider adding a derive | LL + #[derive(Default)] -LL ~ pub enum Test { +LL | pub enum Test { | error: aborting due to previous error diff --git a/tests/ui/feature-gates/feature-gate-explicit_tail_calls.rs b/tests/ui/feature-gates/feature-gate-explicit_tail_calls.rs new file mode 100644 index 00000000000..856a7f39328 --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-explicit_tail_calls.rs @@ -0,0 +1,9 @@ +pub fn you<T>() -> T { + become bottom(); //~ error: `become` expression is experimental +} + +pub fn bottom<T>() -> T { + become you(); //~ error: `become` expression is experimental +} + +fn main() {} diff --git a/tests/ui/feature-gates/feature-gate-explicit_tail_calls.stderr b/tests/ui/feature-gates/feature-gate-explicit_tail_calls.stderr new file mode 100644 index 00000000000..b58da19c174 --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-explicit_tail_calls.stderr @@ -0,0 +1,21 @@ +error[E0658]: `become` expression is experimental + --> $DIR/feature-gate-explicit_tail_calls.rs:2:5 + | +LL | become bottom(); + | ^^^^^^^^^^^^^^^ + | + = note: see issue #112788 <https://github.com/rust-lang/rust/issues/112788> for more information + = help: add `#![feature(explicit_tail_calls)]` to the crate attributes to enable + +error[E0658]: `become` expression is experimental + --> $DIR/feature-gate-explicit_tail_calls.rs:6:5 + | +LL | become you(); + | ^^^^^^^^^^^^ + | + = note: see issue #112788 <https://github.com/rust-lang/rust/issues/112788> for more information + = help: add `#![feature(explicit_tail_calls)]` to the crate attributes to enable + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/impl-trait/coherence-treats-tait-ambig.current.stderr b/tests/ui/impl-trait/coherence-treats-tait-ambig.current.stderr new file mode 100644 index 00000000000..61fed16294b --- /dev/null +++ b/tests/ui/impl-trait/coherence-treats-tait-ambig.current.stderr @@ -0,0 +1,13 @@ +error[E0119]: conflicting implementations of trait `Into<T>` for type `Foo` + --> $DIR/coherence-treats-tait-ambig.rs:10:1 + | +LL | impl Into<T> for Foo { + | ^^^^^^^^^^^^^^^^^^^^ + | + = note: conflicting implementation in crate `core`: + - impl<T, U> Into<U> for T + where U: From<T>; + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/tests/ui/impl-trait/coherence-treats-tait-ambig.next.stderr b/tests/ui/impl-trait/coherence-treats-tait-ambig.next.stderr new file mode 100644 index 00000000000..61fed16294b --- /dev/null +++ b/tests/ui/impl-trait/coherence-treats-tait-ambig.next.stderr @@ -0,0 +1,13 @@ +error[E0119]: conflicting implementations of trait `Into<T>` for type `Foo` + --> $DIR/coherence-treats-tait-ambig.rs:10:1 + | +LL | impl Into<T> for Foo { + | ^^^^^^^^^^^^^^^^^^^^ + | + = note: conflicting implementation in crate `core`: + - impl<T, U> Into<U> for T + where U: From<T>; + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/tests/ui/impl-trait/coherence-treats-tait-ambig.rs b/tests/ui/impl-trait/coherence-treats-tait-ambig.rs new file mode 100644 index 00000000000..156a7eb0e23 --- /dev/null +++ b/tests/ui/impl-trait/coherence-treats-tait-ambig.rs @@ -0,0 +1,19 @@ +// revisions: current next +//[next] compile-flags: -Ztrait-solver=next + +#![feature(type_alias_impl_trait)] + +type T = impl Sized; + +struct Foo; + +impl Into<T> for Foo { +//~^ ERROR conflicting implementations of trait `Into<T>` for type `Foo` + fn into(self) -> T { + Foo + } +} + +fn main() { + let _: T = Foo.into(); +} diff --git a/tests/ui/impl-trait/in-trait/suggest-missing-item.fixed b/tests/ui/impl-trait/in-trait/suggest-missing-item.fixed new file mode 100644 index 00000000000..16c4d15ddcd --- /dev/null +++ b/tests/ui/impl-trait/in-trait/suggest-missing-item.fixed @@ -0,0 +1,22 @@ +// edition:2021 +// run-rustfix + +#![feature(async_fn_in_trait, return_position_impl_trait_in_trait)] + +trait Trait { + async fn foo(); + + async fn bar() -> i32; + + fn test(&self) -> impl Sized + '_; +} + +struct S; + +impl Trait for S {fn test(&self) -> impl Sized + '_ { todo!() } +async fn bar() -> i32 { todo!() } +async fn foo() { todo!() } +} +//~^ ERROR not all trait items implemented + +fn main() {} diff --git a/tests/ui/impl-trait/in-trait/suggest-missing-item.rs b/tests/ui/impl-trait/in-trait/suggest-missing-item.rs new file mode 100644 index 00000000000..f218e6cb581 --- /dev/null +++ b/tests/ui/impl-trait/in-trait/suggest-missing-item.rs @@ -0,0 +1,19 @@ +// edition:2021 +// run-rustfix + +#![feature(async_fn_in_trait, return_position_impl_trait_in_trait)] + +trait Trait { + async fn foo(); + + async fn bar() -> i32; + + fn test(&self) -> impl Sized + '_; +} + +struct S; + +impl Trait for S {} +//~^ ERROR not all trait items implemented + +fn main() {} diff --git a/tests/ui/impl-trait/in-trait/suggest-missing-item.stderr b/tests/ui/impl-trait/in-trait/suggest-missing-item.stderr new file mode 100644 index 00000000000..d96641fe163 --- /dev/null +++ b/tests/ui/impl-trait/in-trait/suggest-missing-item.stderr @@ -0,0 +1,18 @@ +error[E0046]: not all trait items implemented, missing: `foo`, `bar`, `test` + --> $DIR/suggest-missing-item.rs:16:1 + | +LL | async fn foo(); + | --------------- `foo` from trait +LL | +LL | async fn bar() -> i32; + | ---------------------- `bar` from trait +LL | +LL | fn test(&self) -> impl Sized + '_; + | ---------------------------------- `test` from trait +... +LL | impl Trait for S {} + | ^^^^^^^^^^^^^^^^ missing `foo`, `bar`, `test` in implementation + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0046`. diff --git a/tests/ui/resolve/auxiliary/issue-112831-aux.rs b/tests/ui/resolve/auxiliary/issue-112831-aux.rs new file mode 100644 index 00000000000..df436fb9929 --- /dev/null +++ b/tests/ui/resolve/auxiliary/issue-112831-aux.rs @@ -0,0 +1,13 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; + +struct Zeroable; + +#[proc_macro_derive(Zeroable)] +pub fn derive_zeroable(_: proc_macro::TokenStream) -> proc_macro::TokenStream { + proc_macro::TokenStream::default() +} diff --git a/tests/ui/resolve/issue-112831.rs b/tests/ui/resolve/issue-112831.rs new file mode 100644 index 00000000000..ffd83ea8bc1 --- /dev/null +++ b/tests/ui/resolve/issue-112831.rs @@ -0,0 +1,20 @@ +// check-pass +// aux-build:issue-112831-aux.rs + +mod zeroable { + pub trait Zeroable {} +} + +use zeroable::*; + +mod pod { + use super::*; + pub trait Pod: Zeroable {} +} + +use pod::*; + +extern crate issue_112831_aux; +use issue_112831_aux::Zeroable; + +fn main() {} diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/attr-misuse.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/attr-misuse.stderr index b18f33218c2..998958cedf7 100644 --- a/tests/ui/rfcs/rfc-2632-const-trait-impl/attr-misuse.stderr +++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/attr-misuse.stderr @@ -3,12 +3,16 @@ error: attribute should be applied to a trait | LL | #[const_trait] | ^^^^^^^^^^^^^^ +LL | fn main() {} + | ------------ not a trait error: attribute should be applied to a trait --> $DIR/attr-misuse.rs:5:5 | LL | #[const_trait] | ^^^^^^^^^^^^^^ +LL | fn foo(self); + | ------------- not a trait error: aborting due to 2 previous errors diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/match-non-const-eq.gated.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/match-non-const-eq.gated.stderr new file mode 100644 index 00000000000..bd0dd126c5e --- /dev/null +++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/match-non-const-eq.gated.stderr @@ -0,0 +1,26 @@ +error[E0277]: can't compare `str` with `str` in const contexts + --> $DIR/match-non-const-eq.rs:6:9 + | +LL | "a" => (), + | ^^^ no implementation for `str == str` + | + = help: the trait `~const PartialEq` is not implemented for `str` +note: the trait `PartialEq` is implemented for `str`, but that implementation is not `const` + --> $DIR/match-non-const-eq.rs:6:9 + | +LL | "a" => (), + | ^^^ + +error[E0015]: cannot match on `str` in constant functions + --> $DIR/match-non-const-eq.rs:6:9 + | +LL | "a" => (), + | ^^^ + | + = note: `str` cannot be compared in compile-time, and therefore cannot be used in `match`es + = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0015, E0277. +For more information about an error, try `rustc --explain E0015`. diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/match-non-const-eq.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/match-non-const-eq.rs new file mode 100644 index 00000000000..0d04101a383 --- /dev/null +++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/match-non-const-eq.rs @@ -0,0 +1,12 @@ +// revisions: stock gated +#![cfg_attr(gated, feature(const_trait_impl))] + +const fn foo(input: &'static str) { + match input { + "a" => (), //[gated]~ ERROR can't compare `str` with `str` in const contexts + //~^ ERROR cannot match on `str` in constant functions + _ => (), + } +} + +fn main() {} diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/match-non-const-eq.stock.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/match-non-const-eq.stock.stderr new file mode 100644 index 00000000000..dcb9b49ea04 --- /dev/null +++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/match-non-const-eq.stock.stderr @@ -0,0 +1,13 @@ +error[E0015]: cannot match on `str` in constant functions + --> $DIR/match-non-const-eq.rs:6:9 + | +LL | "a" => (), + | ^^^ + | + = note: `str` cannot be compared in compile-time, and therefore cannot be used in `match`es + = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants + = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0015`. diff --git a/tests/ui/test-attrs/test-function-signature.rs b/tests/ui/test-attrs/test-function-signature.rs new file mode 100644 index 00000000000..9e86e9209e3 --- /dev/null +++ b/tests/ui/test-attrs/test-function-signature.rs @@ -0,0 +1,31 @@ +// compile-flags: --test + +#[test] +fn foo() -> Result<(), ()> { + Ok(()) +} + +#[test] +fn bar() -> i32 { //~ ERROR the trait bound `i32: Termination` is not satisfied + 0 +} + +#[test] +fn baz(val: i32) {} //~ ERROR functions used as tests can not have any arguments + +#[test] +fn lifetime_generic<'a>() -> Result<(), &'a str> { + Err("coerce me to any lifetime") +} + +#[test] +fn type_generic<T>() {} //~ ERROR functions used as tests can not have any non-lifetime generic parameters + +#[test] +fn const_generic<const N: usize>() {} //~ ERROR functions used as tests can not have any non-lifetime generic parameters + +// Regression test for <https://github.com/rust-lang/rust/issues/112360>. This used to ICE. +fn nested() { + #[test] + fn foo(arg: ()) {} //~ ERROR functions used as tests can not have any arguments +} diff --git a/tests/ui/test-attrs/test-function-signature.stderr b/tests/ui/test-attrs/test-function-signature.stderr new file mode 100644 index 00000000000..abdb30dc931 --- /dev/null +++ b/tests/ui/test-attrs/test-function-signature.stderr @@ -0,0 +1,39 @@ +error: functions used as tests can not have any arguments + --> $DIR/test-function-signature.rs:14:1 + | +LL | fn baz(val: i32) {} + | ^^^^^^^^^^^^^^^^^^^ + +error: functions used as tests can not have any non-lifetime generic parameters + --> $DIR/test-function-signature.rs:22:1 + | +LL | fn type_generic<T>() {} + | ^^^^^^^^^^^^^^^^^^^^^^^ + +error: functions used as tests can not have any non-lifetime generic parameters + --> $DIR/test-function-signature.rs:25:1 + | +LL | fn const_generic<const N: usize>() {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: functions used as tests can not have any arguments + --> $DIR/test-function-signature.rs:30:5 + | +LL | fn foo(arg: ()) {} + | ^^^^^^^^^^^^^^^^^^ + +error[E0277]: the trait bound `i32: Termination` is not satisfied + --> $DIR/test-function-signature.rs:9:13 + | +LL | #[test] + | ------- in this procedural macro expansion +LL | fn bar() -> i32 { + | ^^^ the trait `Termination` is not implemented for `i32` + | +note: required by a bound in `assert_test_result` + --> $SRC_DIR/test/src/lib.rs:LL:COL + = note: this error originates in the attribute macro `test` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to 5 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/cache-reached-depth-ice.rs b/tests/ui/traits/cache-reached-depth-ice.rs index c36ac08579b..8c2391113d7 100644 --- a/tests/ui/traits/cache-reached-depth-ice.rs +++ b/tests/ui/traits/cache-reached-depth-ice.rs @@ -41,5 +41,5 @@ fn test<X: ?Sized + Send>() {} fn main() { test::<A>(); - //~^ ERROR evaluate(Binder(TraitPredicate(<A as std::marker::Send>, polarity:Positive), [])) = Ok(EvaluatedToOk) + //~^ ERROR evaluate(Binder { value: TraitPredicate(<A as std::marker::Send>, polarity:Positive), bound_vars: [] }) = Ok(EvaluatedToOk) } diff --git a/tests/ui/traits/cache-reached-depth-ice.stderr b/tests/ui/traits/cache-reached-depth-ice.stderr index 082aa0f5cd9..7cd75819277 100644 --- a/tests/ui/traits/cache-reached-depth-ice.stderr +++ b/tests/ui/traits/cache-reached-depth-ice.stderr @@ -1,4 +1,4 @@ -error: evaluate(Binder(TraitPredicate(<A as std::marker::Send>, polarity:Positive), [])) = Ok(EvaluatedToOk) +error: evaluate(Binder { value: TraitPredicate(<A as std::marker::Send>, polarity:Positive), bound_vars: [] }) = Ok(EvaluatedToOk) --> $DIR/cache-reached-depth-ice.rs:43:5 | LL | fn test<X: ?Sized + Send>() {} diff --git a/tests/ui/traits/deny-builtin-object-impl.current.stderr b/tests/ui/traits/deny-builtin-object-impl.current.stderr new file mode 100644 index 00000000000..5c1987426f7 --- /dev/null +++ b/tests/ui/traits/deny-builtin-object-impl.current.stderr @@ -0,0 +1,15 @@ +error[E0277]: the trait bound `dyn NotObject: NotObject` is not satisfied + --> $DIR/deny-builtin-object-impl.rs:18:23 + | +LL | test_not_object::<dyn NotObject>(); + | ^^^^^^^^^^^^^ the trait `NotObject` is not implemented for `dyn NotObject` + | +note: required by a bound in `test_not_object` + --> $DIR/deny-builtin-object-impl.rs:14:23 + | +LL | fn test_not_object<T: NotObject + ?Sized>() {} + | ^^^^^^^^^ required by this bound in `test_not_object` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/deny-builtin-object-impl.next.stderr b/tests/ui/traits/deny-builtin-object-impl.next.stderr new file mode 100644 index 00000000000..5c1987426f7 --- /dev/null +++ b/tests/ui/traits/deny-builtin-object-impl.next.stderr @@ -0,0 +1,15 @@ +error[E0277]: the trait bound `dyn NotObject: NotObject` is not satisfied + --> $DIR/deny-builtin-object-impl.rs:18:23 + | +LL | test_not_object::<dyn NotObject>(); + | ^^^^^^^^^^^^^ the trait `NotObject` is not implemented for `dyn NotObject` + | +note: required by a bound in `test_not_object` + --> $DIR/deny-builtin-object-impl.rs:14:23 + | +LL | fn test_not_object<T: NotObject + ?Sized>() {} + | ^^^^^^^^^ required by this bound in `test_not_object` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/deny-builtin-object-impl.rs b/tests/ui/traits/deny-builtin-object-impl.rs new file mode 100644 index 00000000000..dce03a43b68 --- /dev/null +++ b/tests/ui/traits/deny-builtin-object-impl.rs @@ -0,0 +1,20 @@ +// revisions: current next +//[next] compile-flags: -Ztrait-solver=next + +#![feature(rustc_attrs)] + +#[rustc_deny_explicit_impl(implement_via_object = true)] +trait YesObject {} + +#[rustc_deny_explicit_impl(implement_via_object = false)] +trait NotObject {} + +fn test_yes_object<T: YesObject + ?Sized>() {} + +fn test_not_object<T: NotObject + ?Sized>() {} + +fn main() { + test_yes_object::<dyn YesObject>(); + test_not_object::<dyn NotObject>(); + //~^ ERROR the trait bound `dyn NotObject: NotObject` is not satisfied +} diff --git a/tests/ui/traits/issue-83538-tainted-cache-after-cycle.rs b/tests/ui/traits/issue-83538-tainted-cache-after-cycle.rs index 3cd68ff6f06..5136aef4f7a 100644 --- a/tests/ui/traits/issue-83538-tainted-cache-after-cycle.rs +++ b/tests/ui/traits/issue-83538-tainted-cache-after-cycle.rs @@ -57,10 +57,10 @@ fn main() { // Key is that Vec<First> is "ok" and Third<'_, Ty> is "ok modulo regions": forward(); - //~^ ERROR evaluate(Binder(TraitPredicate(<std::vec::Vec<First> as std::marker::Unpin>, polarity:Positive), [])) = Ok(EvaluatedToOk) - //~| ERROR evaluate(Binder(TraitPredicate(<Third<'_, Ty> as std::marker::Unpin>, polarity:Positive), [])) = Ok(EvaluatedToOkModuloRegions) + //~^ ERROR evaluate(Binder { value: TraitPredicate(<std::vec::Vec<First> as std::marker::Unpin>, polarity:Positive), bound_vars: [] }) = Ok(EvaluatedToOk) + //~| ERROR evaluate(Binder { value: TraitPredicate(<Third<'_, Ty> as std::marker::Unpin>, polarity:Positive), bound_vars: [] }) = Ok(EvaluatedToOkModuloRegions) reverse(); - //~^ ERROR evaluate(Binder(TraitPredicate(<std::vec::Vec<First> as std::marker::Unpin>, polarity:Positive), [])) = Ok(EvaluatedToOk) - //~| ERROR evaluate(Binder(TraitPredicate(<Third<'_, Ty> as std::marker::Unpin>, polarity:Positive), [])) = Ok(EvaluatedToOkModuloRegions) + //~^ ERROR evaluate(Binder { value: TraitPredicate(<std::vec::Vec<First> as std::marker::Unpin>, polarity:Positive), bound_vars: [] }) = Ok(EvaluatedToOk) + //~| ERROR evaluate(Binder { value: TraitPredicate(<Third<'_, Ty> as std::marker::Unpin>, polarity:Positive), bound_vars: [] }) = Ok(EvaluatedToOkModuloRegions) } diff --git a/tests/ui/traits/issue-83538-tainted-cache-after-cycle.stderr b/tests/ui/traits/issue-83538-tainted-cache-after-cycle.stderr index 7c4041144a4..96baec76a17 100644 --- a/tests/ui/traits/issue-83538-tainted-cache-after-cycle.stderr +++ b/tests/ui/traits/issue-83538-tainted-cache-after-cycle.stderr @@ -1,4 +1,4 @@ -error: evaluate(Binder(TraitPredicate(<std::vec::Vec<First> as std::marker::Unpin>, polarity:Positive), [])) = Ok(EvaluatedToOk) +error: evaluate(Binder { value: TraitPredicate(<std::vec::Vec<First> as std::marker::Unpin>, polarity:Positive), bound_vars: [] }) = Ok(EvaluatedToOk) --> $DIR/issue-83538-tainted-cache-after-cycle.rs:59:5 | LL | Vec<First>: Unpin, @@ -7,7 +7,7 @@ LL | Vec<First>: Unpin, LL | forward(); | ^^^^^^^ -error: evaluate(Binder(TraitPredicate(<Third<'_, Ty> as std::marker::Unpin>, polarity:Positive), [])) = Ok(EvaluatedToOkModuloRegions) +error: evaluate(Binder { value: TraitPredicate(<Third<'_, Ty> as std::marker::Unpin>, polarity:Positive), bound_vars: [] }) = Ok(EvaluatedToOkModuloRegions) --> $DIR/issue-83538-tainted-cache-after-cycle.rs:59:5 | LL | Third<'a, Ty>: Unpin, @@ -16,7 +16,7 @@ LL | Third<'a, Ty>: Unpin, LL | forward(); | ^^^^^^^ -error: evaluate(Binder(TraitPredicate(<Third<'_, Ty> as std::marker::Unpin>, polarity:Positive), [])) = Ok(EvaluatedToOkModuloRegions) +error: evaluate(Binder { value: TraitPredicate(<Third<'_, Ty> as std::marker::Unpin>, polarity:Positive), bound_vars: [] }) = Ok(EvaluatedToOkModuloRegions) --> $DIR/issue-83538-tainted-cache-after-cycle.rs:63:5 | LL | Third<'a, Ty>: Unpin, @@ -25,7 +25,7 @@ LL | Third<'a, Ty>: Unpin, LL | reverse(); | ^^^^^^^ -error: evaluate(Binder(TraitPredicate(<std::vec::Vec<First> as std::marker::Unpin>, polarity:Positive), [])) = Ok(EvaluatedToOk) +error: evaluate(Binder { value: TraitPredicate(<std::vec::Vec<First> as std::marker::Unpin>, polarity:Positive), bound_vars: [] }) = Ok(EvaluatedToOk) --> $DIR/issue-83538-tainted-cache-after-cycle.rs:63:5 | LL | Vec<First>: Unpin, diff --git a/tests/ui/traits/issue-85360-eval-obligation-ice.rs b/tests/ui/traits/issue-85360-eval-obligation-ice.rs index 19131684a48..ac8bda9c010 100644 --- a/tests/ui/traits/issue-85360-eval-obligation-ice.rs +++ b/tests/ui/traits/issue-85360-eval-obligation-ice.rs @@ -7,12 +7,12 @@ use core::marker::PhantomData; fn main() { test::<MaskedStorage<GenericComp<Pos>>>(make()); - //~^ ERROR evaluate(Binder(TraitPredicate(<MaskedStorage<GenericComp<Pos>> as std::marker::Sized>, polarity:Positive), [])) = Ok(EvaluatedToOk) - //~| ERROR evaluate(Binder(TraitPredicate(<MaskedStorage<GenericComp<Pos>> as std::marker::Sized>, polarity:Positive), [])) = Ok(EvaluatedToOk) + //~^ ERROR evaluate(Binder { value: TraitPredicate(<MaskedStorage<GenericComp<Pos>> as std::marker::Sized>, polarity:Positive), bound_vars: [] }) = Ok(EvaluatedToOk) + //~| ERROR evaluate(Binder { value: TraitPredicate(<MaskedStorage<GenericComp<Pos>> as std::marker::Sized>, polarity:Positive), bound_vars: [] }) = Ok(EvaluatedToOk) test::<MaskedStorage<GenericComp2<Pos>>>(make()); - //~^ ERROR evaluate(Binder(TraitPredicate(<MaskedStorage<GenericComp2<Pos>> as std::marker::Sized>, polarity:Positive), [])) = Ok(EvaluatedToOkModuloRegions) - //~| ERROR evaluate(Binder(TraitPredicate(<MaskedStorage<GenericComp2<Pos>> as std::marker::Sized>, polarity:Positive), [])) = Ok(EvaluatedToOkModuloRegions) + //~^ ERROR evaluate(Binder { value: TraitPredicate(<MaskedStorage<GenericComp2<Pos>> as std::marker::Sized>, polarity:Positive), bound_vars: [] }) = Ok(EvaluatedToOkModuloRegions) + //~| ERROR evaluate(Binder { value: TraitPredicate(<MaskedStorage<GenericComp2<Pos>> as std::marker::Sized>, polarity:Positive), bound_vars: [] }) = Ok(EvaluatedToOkModuloRegions) } #[rustc_evaluate_where_clauses] diff --git a/tests/ui/traits/issue-85360-eval-obligation-ice.stderr b/tests/ui/traits/issue-85360-eval-obligation-ice.stderr index ebf977dd680..9590ea12c05 100644 --- a/tests/ui/traits/issue-85360-eval-obligation-ice.stderr +++ b/tests/ui/traits/issue-85360-eval-obligation-ice.stderr @@ -1,4 +1,4 @@ -error: evaluate(Binder(TraitPredicate(<MaskedStorage<GenericComp<Pos>> as std::marker::Sized>, polarity:Positive), [])) = Ok(EvaluatedToOk) +error: evaluate(Binder { value: TraitPredicate(<MaskedStorage<GenericComp<Pos>> as std::marker::Sized>, polarity:Positive), bound_vars: [] }) = Ok(EvaluatedToOk) --> $DIR/issue-85360-eval-obligation-ice.rs:9:5 | LL | test::<MaskedStorage<GenericComp<Pos>>>(make()); @@ -7,7 +7,7 @@ LL | test::<MaskedStorage<GenericComp<Pos>>>(make()); LL | fn test<T: Sized>(_: T) {} | - predicate -error: evaluate(Binder(TraitPredicate(<MaskedStorage<GenericComp<Pos>> as std::marker::Sized>, polarity:Positive), [])) = Ok(EvaluatedToOk) +error: evaluate(Binder { value: TraitPredicate(<MaskedStorage<GenericComp<Pos>> as std::marker::Sized>, polarity:Positive), bound_vars: [] }) = Ok(EvaluatedToOk) --> $DIR/issue-85360-eval-obligation-ice.rs:9:5 | LL | test::<MaskedStorage<GenericComp<Pos>>>(make()); @@ -16,7 +16,7 @@ LL | test::<MaskedStorage<GenericComp<Pos>>>(make()); LL | fn test<T: Sized>(_: T) {} | ----- predicate -error: evaluate(Binder(TraitPredicate(<MaskedStorage<GenericComp2<Pos>> as std::marker::Sized>, polarity:Positive), [])) = Ok(EvaluatedToOkModuloRegions) +error: evaluate(Binder { value: TraitPredicate(<MaskedStorage<GenericComp2<Pos>> as std::marker::Sized>, polarity:Positive), bound_vars: [] }) = Ok(EvaluatedToOkModuloRegions) --> $DIR/issue-85360-eval-obligation-ice.rs:13:5 | LL | test::<MaskedStorage<GenericComp2<Pos>>>(make()); @@ -25,7 +25,7 @@ LL | test::<MaskedStorage<GenericComp2<Pos>>>(make()); LL | fn test<T: Sized>(_: T) {} | - predicate -error: evaluate(Binder(TraitPredicate(<MaskedStorage<GenericComp2<Pos>> as std::marker::Sized>, polarity:Positive), [])) = Ok(EvaluatedToOkModuloRegions) +error: evaluate(Binder { value: TraitPredicate(<MaskedStorage<GenericComp2<Pos>> as std::marker::Sized>, polarity:Positive), bound_vars: [] }) = Ok(EvaluatedToOkModuloRegions) --> $DIR/issue-85360-eval-obligation-ice.rs:13:5 | LL | test::<MaskedStorage<GenericComp2<Pos>>>(make()); diff --git a/tests/ui/traits/non_lifetime_binders/foreach-partial-eq.rs b/tests/ui/traits/non_lifetime_binders/foreach-partial-eq.rs new file mode 100644 index 00000000000..96a7424f0dc --- /dev/null +++ b/tests/ui/traits/non_lifetime_binders/foreach-partial-eq.rs @@ -0,0 +1,12 @@ +#![feature(non_lifetime_binders)] +//~^ WARN the feature `non_lifetime_binders` is incomplete + +fn auto_trait() +where + for<T> T: PartialEq + PartialOrd, +{} + +fn main() { + auto_trait(); + //~^ ERROR can't compare `T` with `T` +} diff --git a/tests/ui/traits/non_lifetime_binders/foreach-partial-eq.stderr b/tests/ui/traits/non_lifetime_binders/foreach-partial-eq.stderr new file mode 100644 index 00000000000..da09343fb27 --- /dev/null +++ b/tests/ui/traits/non_lifetime_binders/foreach-partial-eq.stderr @@ -0,0 +1,28 @@ +warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/foreach-partial-eq.rs:1:12 + | +LL | #![feature(non_lifetime_binders)] + | ^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #108185 <https://github.com/rust-lang/rust/issues/108185> for more information + = note: `#[warn(incomplete_features)]` on by default + +error[E0277]: can't compare `T` with `T` + --> $DIR/foreach-partial-eq.rs:10:5 + | +LL | auto_trait(); + | ^^^^^^^^^^ no implementation for `T < T` and `T > T` + | + = help: the trait `PartialOrd` is not implemented for `T` +note: required by a bound in `auto_trait` + --> $DIR/foreach-partial-eq.rs:6:27 + | +LL | fn auto_trait() + | ---------- required by a bound in this function +LL | where +LL | for<T> T: PartialEq + PartialOrd, + | ^^^^^^^^^^ required by this bound in `auto_trait` + +error: aborting due to previous error; 1 warning emitted + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/project-modulo-regions.rs b/tests/ui/traits/project-modulo-regions.rs index f0c0dd3ed95..e88f21ecfe8 100644 --- a/tests/ui/traits/project-modulo-regions.rs +++ b/tests/ui/traits/project-modulo-regions.rs @@ -48,8 +48,8 @@ fn test(val: MyStruct) where Helper: HelperTrait { fn foo(val: MyStruct) { test(val); - //[with_clause]~^ ERROR evaluate(Binder(TraitPredicate(<Helper as HelperTrait>, polarity:Positive), [])) = Ok(EvaluatedToOkModuloRegions) - //[without_clause]~^^ ERROR evaluate(Binder(TraitPredicate(<Helper as HelperTrait>, polarity:Positive), [])) = Ok(EvaluatedToOk) + //[with_clause]~^ ERROR evaluate(Binder { value: TraitPredicate(<Helper as HelperTrait>, polarity:Positive), bound_vars: [] }) = Ok(EvaluatedToOkModuloRegions) + //[without_clause]~^^ ERROR evaluate(Binder { value: TraitPredicate(<Helper as HelperTrait>, polarity:Positive), bound_vars: [] }) = Ok(EvaluatedToOk) } fn main() {} diff --git a/tests/ui/traits/project-modulo-regions.with_clause.stderr b/tests/ui/traits/project-modulo-regions.with_clause.stderr index 2434c32c818..dcc98e855d1 100644 --- a/tests/ui/traits/project-modulo-regions.with_clause.stderr +++ b/tests/ui/traits/project-modulo-regions.with_clause.stderr @@ -1,4 +1,4 @@ -error: evaluate(Binder(TraitPredicate(<Helper as HelperTrait>, polarity:Positive), [])) = Ok(EvaluatedToOkModuloRegions) +error: evaluate(Binder { value: TraitPredicate(<Helper as HelperTrait>, polarity:Positive), bound_vars: [] }) = Ok(EvaluatedToOkModuloRegions) --> $DIR/project-modulo-regions.rs:50:5 | LL | fn test(val: MyStruct) where Helper: HelperTrait { diff --git a/tests/ui/traits/project-modulo-regions.without_clause.stderr b/tests/ui/traits/project-modulo-regions.without_clause.stderr index 9d35690d5f0..e9959567e06 100644 --- a/tests/ui/traits/project-modulo-regions.without_clause.stderr +++ b/tests/ui/traits/project-modulo-regions.without_clause.stderr @@ -1,4 +1,4 @@ -error: evaluate(Binder(TraitPredicate(<Helper as HelperTrait>, polarity:Positive), [])) = Ok(EvaluatedToOk) +error: evaluate(Binder { value: TraitPredicate(<Helper as HelperTrait>, polarity:Positive), bound_vars: [] }) = Ok(EvaluatedToOk) --> $DIR/project-modulo-regions.rs:50:5 | LL | fn test(val: MyStruct) where Helper: HelperTrait { diff --git a/tests/ui/type-alias-impl-trait/debug-ty-with-weak.rs b/tests/ui/type-alias-impl-trait/debug-ty-with-weak.rs new file mode 100644 index 00000000000..44158349fdd --- /dev/null +++ b/tests/ui/type-alias-impl-trait/debug-ty-with-weak.rs @@ -0,0 +1,12 @@ +// compile-flags: --crate-type=lib -Cdebuginfo=2 +// build-pass + +#![feature(type_alias_impl_trait)] + +type Debuggable = impl core::fmt::Debug; + +static mut TEST: Option<Debuggable> = None; + +fn foo() -> Debuggable { + 0u32 +} diff --git a/tests/ui/type-alias-impl-trait/issue-76202-trait-impl-for-tait.rs b/tests/ui/type-alias-impl-trait/issue-76202-trait-impl-for-tait.rs index b97e444c6d0..386b77d4d16 100644 --- a/tests/ui/type-alias-impl-trait/issue-76202-trait-impl-for-tait.rs +++ b/tests/ui/type-alias-impl-trait/issue-76202-trait-impl-for-tait.rs @@ -1,6 +1,8 @@ // Regression test for issue #76202 // Tests that we don't ICE when we have a trait impl on a TAIT. +// revisions: current next +//[next] compile-flags: -Ztrait-solver=next // check-pass #![feature(type_alias_impl_trait)] diff --git a/tests/ui/unsized/issue-71659.stderr b/tests/ui/unsized/issue-71659.current.stderr index b57b3015e47..6b982a73952 100644 --- a/tests/ui/unsized/issue-71659.stderr +++ b/tests/ui/unsized/issue-71659.current.stderr @@ -1,11 +1,11 @@ error[E0277]: the trait bound `dyn Foo: CastTo<[i32]>` is not satisfied - --> $DIR/issue-71659.rs:30:15 + --> $DIR/issue-71659.rs:33:15 | LL | let x = x.cast::<[i32]>(); | ^^^^ the trait `CastTo<[i32]>` is not implemented for `dyn Foo` | note: required by a bound in `Cast::cast` - --> $DIR/issue-71659.rs:19:15 + --> $DIR/issue-71659.rs:22:15 | LL | fn cast<T: ?Sized>(&self) -> &T | ---- required by a bound in this associated function diff --git a/tests/ui/unsized/issue-71659.next.stderr b/tests/ui/unsized/issue-71659.next.stderr new file mode 100644 index 00000000000..6b982a73952 --- /dev/null +++ b/tests/ui/unsized/issue-71659.next.stderr @@ -0,0 +1,18 @@ +error[E0277]: the trait bound `dyn Foo: CastTo<[i32]>` is not satisfied + --> $DIR/issue-71659.rs:33:15 + | +LL | let x = x.cast::<[i32]>(); + | ^^^^ the trait `CastTo<[i32]>` is not implemented for `dyn Foo` + | +note: required by a bound in `Cast::cast` + --> $DIR/issue-71659.rs:22:15 + | +LL | fn cast<T: ?Sized>(&self) -> &T + | ---- required by a bound in this associated function +LL | where +LL | Self: CastTo<T>, + | ^^^^^^^^^ required by this bound in `Cast::cast` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/unsized/issue-71659.rs b/tests/ui/unsized/issue-71659.rs index 3524ca02bbf..db5c2e205aa 100644 --- a/tests/ui/unsized/issue-71659.rs +++ b/tests/ui/unsized/issue-71659.rs @@ -1,3 +1,6 @@ +// revisions: current next +//[next] compile-flags: -Ztrait-solver=next + #![feature(unsize)] use std::marker::Unsize; diff --git a/tests/ui/weird-exprs.rs b/tests/ui/weird-exprs.rs index 59b4bb8ef85..892b281357f 100644 --- a/tests/ui/weird-exprs.rs +++ b/tests/ui/weird-exprs.rs @@ -1,7 +1,6 @@ // run-pass #![feature(generators)] -#![feature(unboxed_closures, fn_traits)] #![allow(non_camel_case_types)] #![allow(dead_code)] @@ -17,6 +16,7 @@ extern crate core; use std::cell::Cell; use std::mem::swap; +use std::ops::Deref; // Just a grab bag of stuff that you wouldn't want to actually write. @@ -183,10 +183,10 @@ fn 𝚌𝚘𝚗𝚝𝚒𝚗𝚞𝚎() { fn function() { struct foo; - impl FnOnce<()> for foo { - type Output = foo; - extern "rust-call" fn call_once(self, _args: ()) -> Self::Output { - foo + impl Deref for foo { + type Target = fn() -> Self; + fn deref(&self) -> &Self::Target { + &((|| foo) as _) } } let foo = foo () ()() ()()() ()()()() ()()()()(); |
