diff options
Diffstat (limited to 'tests')
685 files changed, 4886 insertions, 2630 deletions
diff --git a/tests/mir-opt/array_index_is_temporary.main.SimplifyCfg-elaborate-drops.after.panic-unwind.mir b/tests/mir-opt/array_index_is_temporary.main.SimplifyCfg-elaborate-drops.after.panic-unwind.mir index 2f6c92d9e85..4b05610f731 100644 --- a/tests/mir-opt/array_index_is_temporary.main.SimplifyCfg-elaborate-drops.after.panic-unwind.mir +++ b/tests/mir-opt/array_index_is_temporary.main.SimplifyCfg-elaborate-drops.after.panic-unwind.mir @@ -36,7 +36,7 @@ fn main() -> () { StorageLive(_5); StorageLive(_6); _6 = _3; - _5 = foo(move _6) -> bb1; + _5 = foo(move _6) -> [return: bb1, unwind continue]; } bb1: { @@ -45,7 +45,7 @@ fn main() -> () { _7 = _2; _8 = Len(_1); _9 = Lt(_7, _8); - assert(move _9, "index out of bounds: the length is {} but the index is {}", move _8, _7) -> bb2; + assert(move _9, "index out of bounds: the length is {} but the index is {}", move _8, _7) -> [success: bb2, unwind continue]; } bb2: { diff --git a/tests/mir-opt/basic_assignment.main.ElaborateDrops.diff b/tests/mir-opt/basic_assignment.main.ElaborateDrops.diff index 41732211628..9c7b3c5197b 100644 --- a/tests/mir-opt/basic_assignment.main.ElaborateDrops.diff +++ b/tests/mir-opt/basic_assignment.main.ElaborateDrops.diff @@ -58,7 +58,7 @@ bb4: { StorageDead(_5); -- drop(_4) -> bb5; +- drop(_4) -> [return: bb5, unwind continue]; + goto -> bb5; } diff --git a/tests/mir-opt/box_expr.main.ElaborateDrops.before.panic-unwind.mir b/tests/mir-opt/box_expr.main.ElaborateDrops.before.panic-unwind.mir index cf63c4f19da..a72d22a9c9f 100644 --- a/tests/mir-opt/box_expr.main.ElaborateDrops.before.panic-unwind.mir +++ b/tests/mir-opt/box_expr.main.ElaborateDrops.before.panic-unwind.mir @@ -19,7 +19,7 @@ fn main() -> () { StorageLive(_1); _2 = SizeOf(S); _3 = AlignOf(S); - _4 = alloc::alloc::exchange_malloc(move _2, move _3) -> bb1; + _4 = alloc::alloc::exchange_malloc(move _2, move _3) -> [return: bb1, unwind continue]; } bb1: { @@ -30,7 +30,7 @@ fn main() -> () { bb2: { _1 = move _5; - drop(_5) -> bb3; + drop(_5) -> [return: bb3, unwind continue]; } bb3: { @@ -45,7 +45,7 @@ fn main() -> () { StorageDead(_7); StorageDead(_6); _0 = const (); - drop(_1) -> bb5; + drop(_1) -> [return: bb5, unwind continue]; } bb5: { diff --git a/tests/mir-opt/building/async_await.a-{closure#0}.generator_resume.0.mir b/tests/mir-opt/building/async_await.a-{closure#0}.generator_resume.0.mir index 7e8206b02fc..074ebddf78b 100644 --- a/tests/mir-opt/building/async_await.a-{closure#0}.generator_resume.0.mir +++ b/tests/mir-opt/building/async_await.a-{closure#0}.generator_resume.0.mir @@ -30,7 +30,7 @@ fn a::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:11:14: 11:16]> } bb2: { - assert(const false, "`async fn` resumed after completion") -> bb2; + assert(const false, "`async fn` resumed after completion") -> [success: bb2, unwind continue]; } bb3: { diff --git a/tests/mir-opt/building/async_await.b-{closure#0}.generator_resume.0.mir b/tests/mir-opt/building/async_await.b-{closure#0}.generator_resume.0.mir index ed138871851..f774f32eb23 100644 --- a/tests/mir-opt/building/async_await.b-{closure#0}.generator_resume.0.mir +++ b/tests/mir-opt/building/async_await.b-{closure#0}.generator_resume.0.mir @@ -310,7 +310,7 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>, } bb28: { - assert(const false, "`async fn` resumed after completion") -> bb28; + assert(const false, "`async fn` resumed after completion") -> [success: bb28, unwind continue]; } bb29: { diff --git a/tests/mir-opt/building/custom/terminators.direct_call.built.after.mir b/tests/mir-opt/building/custom/terminators.direct_call.built.after.mir index 534d7615180..07044ceaef4 100644 --- a/tests/mir-opt/building/custom/terminators.direct_call.built.after.mir +++ b/tests/mir-opt/building/custom/terminators.direct_call.built.after.mir @@ -4,7 +4,7 @@ fn direct_call(_1: i32) -> i32 { let mut _0: i32; bb0: { - _0 = ident::<i32>(_1) -> bb1; + _0 = ident::<i32>(_1) -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/building/custom/terminators.drop_first.built.after.mir b/tests/mir-opt/building/custom/terminators.drop_first.built.after.mir index aba724a4b0d..6524f754d9c 100644 --- a/tests/mir-opt/building/custom/terminators.drop_first.built.after.mir +++ b/tests/mir-opt/building/custom/terminators.drop_first.built.after.mir @@ -4,7 +4,7 @@ fn drop_first(_1: WriteOnDrop<'_>, _2: WriteOnDrop<'_>) -> () { let mut _0: (); bb0: { - drop(_1) -> bb1; + drop(_1) -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/building/custom/terminators.drop_second.built.after.mir b/tests/mir-opt/building/custom/terminators.drop_second.built.after.mir index 32d770bb0c1..ed3728121bd 100644 --- a/tests/mir-opt/building/custom/terminators.drop_second.built.after.mir +++ b/tests/mir-opt/building/custom/terminators.drop_second.built.after.mir @@ -4,7 +4,7 @@ fn drop_second(_1: WriteOnDrop<'_>, _2: WriteOnDrop<'_>) -> () { let mut _0: (); bb0: { - drop(_2) -> bb1; + drop(_2) -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/building/custom/terminators.indirect_call.built.after.mir b/tests/mir-opt/building/custom/terminators.indirect_call.built.after.mir index 56371c78666..3b849354dcd 100644 --- a/tests/mir-opt/building/custom/terminators.indirect_call.built.after.mir +++ b/tests/mir-opt/building/custom/terminators.indirect_call.built.after.mir @@ -4,7 +4,7 @@ fn indirect_call(_1: i32, _2: fn(i32) -> i32) -> i32 { let mut _0: i32; bb0: { - _0 = _2(_1) -> bb1; + _0 = _2(_1) -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/combine_array_len.norm2.InstSimplify.panic-unwind.diff b/tests/mir-opt/combine_array_len.norm2.InstSimplify.panic-unwind.diff index ab7a34f840d..4833c1089e3 100644 --- a/tests/mir-opt/combine_array_len.norm2.InstSimplify.panic-unwind.diff +++ b/tests/mir-opt/combine_array_len.norm2.InstSimplify.panic-unwind.diff @@ -32,7 +32,7 @@ - _4 = Len(_1); + _4 = const 2_usize; _5 = Lt(_3, _4); - assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> bb1; + assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind continue]; } bb1: { @@ -44,7 +44,7 @@ - _8 = Len(_1); + _8 = const 2_usize; _9 = Lt(_7, _8); - assert(move _9, "index out of bounds: the length is {} but the index is {}", move _8, _7) -> bb2; + assert(move _9, "index out of bounds: the length is {} but the index is {}", move _8, _7) -> [success: bb2, unwind continue]; } bb2: { diff --git a/tests/mir-opt/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-unwind.diff b/tests/mir-opt/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-unwind.diff index ee0f9fbf828..1a4372afe69 100644 --- a/tests/mir-opt/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-unwind.diff +++ b/tests/mir-opt/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-unwind.diff @@ -21,7 +21,7 @@ _4 = &((*_1).0: T); - _3 = &(*_4); + _3 = _4; - _2 = <T as Clone>::clone(move _3) -> bb1; + _2 = <T as Clone>::clone(move _3) -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/const_prop/aggregate.main.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/aggregate.main.ConstProp.panic-unwind.diff index 73b5baafb33..e4650046bdf 100644 --- a/tests/mir-opt/const_prop/aggregate.main.ConstProp.panic-unwind.diff +++ b/tests/mir-opt/const_prop/aggregate.main.ConstProp.panic-unwind.diff @@ -27,7 +27,7 @@ StorageLive(_5); - _5 = _1; + _5 = const 1_u8; - _4 = foo(move _5) -> bb1; + _4 = foo(move _5) -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/const_prop/aggregate.main.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/const_prop/aggregate.main.PreCodegen.after.panic-unwind.mir index 93d461a38c4..9590c7f90aa 100644 --- a/tests/mir-opt/const_prop/aggregate.main.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/const_prop/aggregate.main.PreCodegen.after.panic-unwind.mir @@ -23,7 +23,7 @@ fn main() -> () { StorageLive(_4); StorageLive(_5); _5 = const 1_u8; - _4 = foo(move _5) -> bb1; + _4 = foo(move _5) -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/const_prop/array_index.main.ConstProp.32bit.panic-unwind.diff b/tests/mir-opt/const_prop/array_index.main.ConstProp.32bit.panic-unwind.diff index 9ac2fac6c00..ec11395c376 100644 --- a/tests/mir-opt/const_prop/array_index.main.ConstProp.32bit.panic-unwind.diff +++ b/tests/mir-opt/const_prop/array_index.main.ConstProp.32bit.panic-unwind.diff @@ -20,10 +20,10 @@ _3 = const 2_usize; - _4 = Len(_2); - _5 = Lt(_3, _4); -- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> bb1; +- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind continue]; + _4 = const 4_usize; + _5 = const true; -+ assert(const true, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> bb1; ++ assert(const true, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/const_prop/array_index.main.ConstProp.64bit.panic-unwind.diff b/tests/mir-opt/const_prop/array_index.main.ConstProp.64bit.panic-unwind.diff index 9ac2fac6c00..ec11395c376 100644 --- a/tests/mir-opt/const_prop/array_index.main.ConstProp.64bit.panic-unwind.diff +++ b/tests/mir-opt/const_prop/array_index.main.ConstProp.64bit.panic-unwind.diff @@ -20,10 +20,10 @@ _3 = const 2_usize; - _4 = Len(_2); - _5 = Lt(_3, _4); -- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> bb1; +- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind continue]; + _4 = const 4_usize; + _5 = const true; -+ assert(const true, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> bb1; ++ assert(const true, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/const_prop/bad_op_div_by_zero.main.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/bad_op_div_by_zero.main.ConstProp.panic-unwind.diff index 2aff357cc3e..a5b51681ec9 100644 --- a/tests/mir-opt/const_prop/bad_op_div_by_zero.main.ConstProp.panic-unwind.diff +++ b/tests/mir-opt/const_prop/bad_op_div_by_zero.main.ConstProp.panic-unwind.diff @@ -24,21 +24,21 @@ StorageLive(_3); - _3 = _1; - _4 = Eq(_3, const 0_i32); -- assert(!move _4, "attempt to divide `{}` by zero", const 1_i32) -> bb1; +- assert(!move _4, "attempt to divide `{}` by zero", const 1_i32) -> [success: bb1, unwind continue]; + _3 = const 0_i32; + _4 = const true; -+ assert(!const true, "attempt to divide `{}` by zero", const 1_i32) -> bb1; ++ assert(!const true, "attempt to divide `{}` by zero", const 1_i32) -> [success: bb1, unwind continue]; } bb1: { - _5 = Eq(_3, const -1_i32); - _6 = Eq(const 1_i32, const i32::MIN); - _7 = BitAnd(move _5, move _6); -- assert(!move _7, "attempt to compute `{} / {}`, which would overflow", const 1_i32, _3) -> bb2; +- assert(!move _7, "attempt to compute `{} / {}`, which would overflow", const 1_i32, _3) -> [success: bb2, unwind continue]; + _5 = const false; + _6 = const false; + _7 = const false; -+ assert(!const false, "attempt to compute `{} / {}`, which would overflow", const 1_i32, _3) -> bb2; ++ assert(!const false, "attempt to compute `{} / {}`, which would overflow", const 1_i32, _3) -> [success: bb2, unwind continue]; } bb2: { diff --git a/tests/mir-opt/const_prop/bad_op_mod_by_zero.main.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/bad_op_mod_by_zero.main.ConstProp.panic-unwind.diff index db93de9630b..4afddf3c92d 100644 --- a/tests/mir-opt/const_prop/bad_op_mod_by_zero.main.ConstProp.panic-unwind.diff +++ b/tests/mir-opt/const_prop/bad_op_mod_by_zero.main.ConstProp.panic-unwind.diff @@ -24,21 +24,21 @@ StorageLive(_3); - _3 = _1; - _4 = Eq(_3, const 0_i32); -- assert(!move _4, "attempt to calculate the remainder of `{}` with a divisor of zero", const 1_i32) -> bb1; +- assert(!move _4, "attempt to calculate the remainder of `{}` with a divisor of zero", const 1_i32) -> [success: bb1, unwind continue]; + _3 = const 0_i32; + _4 = const true; -+ assert(!const true, "attempt to calculate the remainder of `{}` with a divisor of zero", const 1_i32) -> bb1; ++ assert(!const true, "attempt to calculate the remainder of `{}` with a divisor of zero", const 1_i32) -> [success: bb1, unwind continue]; } bb1: { - _5 = Eq(_3, const -1_i32); - _6 = Eq(const 1_i32, const i32::MIN); - _7 = BitAnd(move _5, move _6); -- assert(!move _7, "attempt to compute the remainder of `{} % {}`, which would overflow", const 1_i32, _3) -> bb2; +- assert(!move _7, "attempt to compute the remainder of `{} % {}`, which would overflow", const 1_i32, _3) -> [success: bb2, unwind continue]; + _5 = const false; + _6 = const false; + _7 = const false; -+ assert(!const false, "attempt to compute the remainder of `{} % {}`, which would overflow", const 1_i32, _3) -> bb2; ++ assert(!const false, "attempt to compute the remainder of `{} % {}`, which would overflow", const 1_i32, _3) -> [success: bb2, unwind continue]; } bb2: { diff --git a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.panic-unwind.diff b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.panic-unwind.diff index f39468d9684..2c0e4844ecc 100644 --- a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.panic-unwind.diff +++ b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.panic-unwind.diff @@ -36,9 +36,9 @@ _6 = const 3_usize; _7 = const 3_usize; - _8 = Lt(_6, _7); -- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> bb1; +- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind continue]; + _8 = const false; -+ assert(const false, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> bb1; ++ assert(const false, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.panic-unwind.diff b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.panic-unwind.diff index f39468d9684..2c0e4844ecc 100644 --- a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.panic-unwind.diff +++ b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.panic-unwind.diff @@ -36,9 +36,9 @@ _6 = const 3_usize; _7 = const 3_usize; - _8 = Lt(_6, _7); -- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> bb1; +- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind continue]; + _8 = const false; -+ assert(const false, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> bb1; ++ assert(const false, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/const_prop/boxes.main.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/boxes.main.ConstProp.panic-unwind.diff index 8e3c2f6c844..6214766c7ee 100644 --- a/tests/mir-opt/const_prop/boxes.main.ConstProp.panic-unwind.diff +++ b/tests/mir-opt/const_prop/boxes.main.ConstProp.panic-unwind.diff @@ -26,7 +26,7 @@ - _5 = AlignOf(i32); + _4 = const 4_usize; + _5 = const 4_usize; - _6 = alloc::alloc::exchange_malloc(move _4, move _5) -> bb1; + _6 = alloc::alloc::exchange_malloc(move _4, move _5) -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/const_prop/checked_add.main.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/checked_add.main.ConstProp.panic-unwind.diff index 175e2b51a37..125407bf285 100644 --- a/tests/mir-opt/const_prop/checked_add.main.ConstProp.panic-unwind.diff +++ b/tests/mir-opt/const_prop/checked_add.main.ConstProp.panic-unwind.diff @@ -12,9 +12,9 @@ bb0: { StorageLive(_1); - _2 = CheckedAdd(const 1_u32, const 1_u32); -- assert(!move (_2.1: bool), "attempt to compute `{} + {}`, which would overflow", const 1_u32, const 1_u32) -> bb1; +- assert(!move (_2.1: bool), "attempt to compute `{} + {}`, which would overflow", const 1_u32, const 1_u32) -> [success: bb1, unwind continue]; + _2 = const (2_u32, false); -+ assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 1_u32, const 1_u32) -> bb1; ++ assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 1_u32, const 1_u32) -> [success: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/const_prop/const_prop_fails_gracefully.main.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/const_prop_fails_gracefully.main.ConstProp.panic-unwind.diff index 01ec24916c8..850b743feb1 100644 --- a/tests/mir-opt/const_prop/const_prop_fails_gracefully.main.ConstProp.panic-unwind.diff +++ b/tests/mir-opt/const_prop/const_prop_fails_gracefully.main.ConstProp.panic-unwind.diff @@ -24,7 +24,7 @@ StorageLive(_4); StorageLive(_5); _5 = _1; - _4 = read(move _5) -> bb1; + _4 = read(move _5) -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/const_prop/control_flow_simplification.hello.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/control_flow_simplification.hello.ConstProp.panic-unwind.diff index 4593ffaac2b..7496d254309 100644 --- a/tests/mir-opt/const_prop/control_flow_simplification.hello.ConstProp.panic-unwind.diff +++ b/tests/mir-opt/const_prop/control_flow_simplification.hello.ConstProp.panic-unwind.diff @@ -14,7 +14,7 @@ } bb1: { - _2 = begin_panic::<&str>(const "explicit panic"); + _2 = begin_panic::<&str>(const "explicit panic") -> unwind continue; } bb2: { diff --git a/tests/mir-opt/const_prop/indirect.main.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/indirect.main.ConstProp.panic-unwind.diff index affef00bb73..ccfa35f001b 100644 --- a/tests/mir-opt/const_prop/indirect.main.ConstProp.panic-unwind.diff +++ b/tests/mir-opt/const_prop/indirect.main.ConstProp.panic-unwind.diff @@ -15,10 +15,10 @@ StorageLive(_2); - _2 = const 2_u32 as u8 (IntToInt); - _3 = CheckedAdd(_2, const 1_u8); -- assert(!move (_3.1: bool), "attempt to compute `{} + {}`, which would overflow", move _2, const 1_u8) -> bb1; +- assert(!move (_3.1: bool), "attempt to compute `{} + {}`, which would overflow", move _2, const 1_u8) -> [success: bb1, unwind continue]; + _2 = const 2_u8; + _3 = const (3_u8, false); -+ assert(!const false, "attempt to compute `{} + {}`, which would overflow", move _2, const 1_u8) -> bb1; ++ assert(!const false, "attempt to compute `{} + {}`, which would overflow", move _2, const 1_u8) -> [success: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-unwind.diff index 9dae4b404aa..4f8e0f0f599 100644 --- a/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-unwind.diff +++ b/tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-unwind.diff @@ -21,9 +21,9 @@ StorageLive(_3); _3 = const 1_u8; - _4 = CheckedAdd(_2, _3); -- assert(!move (_4.1: bool), "attempt to compute `{} + {}`, which would overflow", _2, _3) -> bb1; +- assert(!move (_4.1: bool), "attempt to compute `{} + {}`, which would overflow", _2, _3) -> [success: bb1, unwind continue]; + _4 = const (0_u8, true); -+ assert(!const true, "attempt to compute `{} + {}`, which would overflow", _2, _3) -> bb1; ++ assert(!const true, "attempt to compute `{} + {}`, which would overflow", _2, _3) -> [success: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/const_prop/issue_66971.main.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/issue_66971.main.ConstProp.panic-unwind.diff index e83c18735b6..5e3443228cd 100644 --- a/tests/mir-opt/const_prop/issue_66971.main.ConstProp.panic-unwind.diff +++ b/tests/mir-opt/const_prop/issue_66971.main.ConstProp.panic-unwind.diff @@ -9,7 +9,7 @@ bb0: { StorageLive(_2); _2 = (const (), const 0_u8, const 0_u8); - _1 = encode(move _2) -> bb1; + _1 = encode(move _2) -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/const_prop/issue_67019.main.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/issue_67019.main.ConstProp.panic-unwind.diff index cbbc2582973..95776030162 100644 --- a/tests/mir-opt/const_prop/issue_67019.main.ConstProp.panic-unwind.diff +++ b/tests/mir-opt/const_prop/issue_67019.main.ConstProp.panic-unwind.diff @@ -14,7 +14,7 @@ + _3 = const (1_u8, 2_u8); _2 = (move _3,); StorageDead(_3); - _1 = test(move _2) -> bb1; + _1 = test(move _2) -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/const_prop/large_array_index.main.ConstProp.32bit.panic-unwind.diff b/tests/mir-opt/const_prop/large_array_index.main.ConstProp.32bit.panic-unwind.diff index be245b424c1..658607116c8 100644 --- a/tests/mir-opt/const_prop/large_array_index.main.ConstProp.32bit.panic-unwind.diff +++ b/tests/mir-opt/const_prop/large_array_index.main.ConstProp.32bit.panic-unwind.diff @@ -20,10 +20,10 @@ _3 = const 2_usize; - _4 = Len(_2); - _5 = Lt(_3, _4); -- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> bb1; +- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind continue]; + _4 = const 5000_usize; + _5 = const true; -+ assert(const true, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> bb1; ++ assert(const true, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/const_prop/large_array_index.main.ConstProp.64bit.panic-unwind.diff b/tests/mir-opt/const_prop/large_array_index.main.ConstProp.64bit.panic-unwind.diff index be245b424c1..658607116c8 100644 --- a/tests/mir-opt/const_prop/large_array_index.main.ConstProp.64bit.panic-unwind.diff +++ b/tests/mir-opt/const_prop/large_array_index.main.ConstProp.64bit.panic-unwind.diff @@ -20,10 +20,10 @@ _3 = const 2_usize; - _4 = Len(_2); - _5 = Lt(_3, _4); -- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> bb1; +- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind continue]; + _4 = const 5000_usize; + _5 = const true; -+ assert(const true, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> bb1; ++ assert(const true, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.main.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.main.ConstProp.panic-unwind.diff index 50006f5f5b5..7ba2b483dc3 100644 --- a/tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.main.ConstProp.panic-unwind.diff +++ b/tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.main.ConstProp.panic-unwind.diff @@ -14,7 +14,7 @@ bb0: { StorageLive(_1); - _1 = foo() -> bb1; + _1 = foo() -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.ConstProp.panic-unwind.diff index 69a0c3e2429..15ef0fa4dff 100644 --- a/tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.ConstProp.panic-unwind.diff +++ b/tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.ConstProp.panic-unwind.diff @@ -23,7 +23,7 @@ bb0: { StorageLive(_1); - _1 = foo() -> bb1; + _1 = foo() -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/const_prop/offset_of.concrete.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/offset_of.concrete.ConstProp.panic-unwind.diff index 29cad611b54..bbb807d8fcd 100644 --- a/tests/mir-opt/const_prop/offset_of.concrete.ConstProp.panic-unwind.diff +++ b/tests/mir-opt/const_prop/offset_of.concrete.ConstProp.panic-unwind.diff @@ -29,7 +29,7 @@ StorageLive(_2); - _2 = OffsetOf(Alpha, [0]); + _2 = const 4_usize; - _1 = must_use::<usize>(move _2) -> bb1; + _1 = must_use::<usize>(move _2) -> [return: bb1, unwind continue]; } bb1: { @@ -38,7 +38,7 @@ StorageLive(_4); - _4 = OffsetOf(Alpha, [1]); + _4 = const 0_usize; - _3 = must_use::<usize>(move _4) -> bb2; + _3 = must_use::<usize>(move _4) -> [return: bb2, unwind continue]; } bb2: { @@ -47,7 +47,7 @@ StorageLive(_6); - _6 = OffsetOf(Alpha, [2, 0]); + _6 = const 2_usize; - _5 = must_use::<usize>(move _6) -> bb3; + _5 = must_use::<usize>(move _6) -> [return: bb3, unwind continue]; } bb3: { @@ -56,7 +56,7 @@ StorageLive(_8); - _8 = OffsetOf(Alpha, [2, 1]); + _8 = const 3_usize; - _7 = must_use::<usize>(move _8) -> bb4; + _7 = must_use::<usize>(move _8) -> [return: bb4, unwind continue]; } bb4: { diff --git a/tests/mir-opt/const_prop/offset_of.generic.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/offset_of.generic.ConstProp.panic-unwind.diff index 2a58a1a5ceb..fd5206e460c 100644 --- a/tests/mir-opt/const_prop/offset_of.generic.ConstProp.panic-unwind.diff +++ b/tests/mir-opt/const_prop/offset_of.generic.ConstProp.panic-unwind.diff @@ -28,7 +28,7 @@ StorageLive(_1); StorageLive(_2); _2 = OffsetOf(Gamma<T>, [0]); - _1 = must_use::<usize>(move _2) -> bb1; + _1 = must_use::<usize>(move _2) -> [return: bb1, unwind continue]; } bb1: { @@ -36,7 +36,7 @@ StorageLive(_3); StorageLive(_4); _4 = OffsetOf(Gamma<T>, [1]); - _3 = must_use::<usize>(move _4) -> bb2; + _3 = must_use::<usize>(move _4) -> [return: bb2, unwind continue]; } bb2: { @@ -44,7 +44,7 @@ StorageLive(_5); StorageLive(_6); _6 = OffsetOf(Delta<T>, [1]); - _5 = must_use::<usize>(move _6) -> bb3; + _5 = must_use::<usize>(move _6) -> [return: bb3, unwind continue]; } bb3: { @@ -52,7 +52,7 @@ StorageLive(_7); StorageLive(_8); _8 = OffsetOf(Delta<T>, [2]); - _7 = must_use::<usize>(move _8) -> bb4; + _7 = must_use::<usize>(move _8) -> [return: bb4, unwind continue]; } bb4: { diff --git a/tests/mir-opt/const_prop/repeat.main.ConstProp.32bit.panic-unwind.diff b/tests/mir-opt/const_prop/repeat.main.ConstProp.32bit.panic-unwind.diff index f94708605ee..571f279a8c1 100644 --- a/tests/mir-opt/const_prop/repeat.main.ConstProp.32bit.panic-unwind.diff +++ b/tests/mir-opt/const_prop/repeat.main.ConstProp.32bit.panic-unwind.diff @@ -22,10 +22,10 @@ _4 = const 2_usize; - _5 = Len(_3); - _6 = Lt(_4, _5); -- assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, _4) -> bb1; +- assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, _4) -> [success: bb1, unwind continue]; + _5 = const 8_usize; + _6 = const true; -+ assert(const true, "index out of bounds: the length is {} but the index is {}", move _5, _4) -> bb1; ++ assert(const true, "index out of bounds: the length is {} but the index is {}", move _5, _4) -> [success: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/const_prop/repeat.main.ConstProp.64bit.panic-unwind.diff b/tests/mir-opt/const_prop/repeat.main.ConstProp.64bit.panic-unwind.diff index f94708605ee..571f279a8c1 100644 --- a/tests/mir-opt/const_prop/repeat.main.ConstProp.64bit.panic-unwind.diff +++ b/tests/mir-opt/const_prop/repeat.main.ConstProp.64bit.panic-unwind.diff @@ -22,10 +22,10 @@ _4 = const 2_usize; - _5 = Len(_3); - _6 = Lt(_4, _5); -- assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, _4) -> bb1; +- assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, _4) -> [success: bb1, unwind continue]; + _5 = const 8_usize; + _6 = const true; -+ assert(const true, "index out of bounds: the length is {} but the index is {}", move _5, _4) -> bb1; ++ assert(const true, "index out of bounds: the length is {} but the index is {}", move _5, _4) -> [success: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/const_prop/return_place.add.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/return_place.add.ConstProp.panic-unwind.diff index f89e9dd5b63..79f85fcef11 100644 --- a/tests/mir-opt/const_prop/return_place.add.ConstProp.panic-unwind.diff +++ b/tests/mir-opt/const_prop/return_place.add.ConstProp.panic-unwind.diff @@ -7,9 +7,9 @@ bb0: { - _1 = CheckedAdd(const 2_u32, const 2_u32); -- assert(!move (_1.1: bool), "attempt to compute `{} + {}`, which would overflow", const 2_u32, const 2_u32) -> bb1; +- assert(!move (_1.1: bool), "attempt to compute `{} + {}`, which would overflow", const 2_u32, const 2_u32) -> [success: bb1, unwind continue]; + _1 = const (4_u32, false); -+ assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 2_u32, const 2_u32) -> bb1; ++ assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 2_u32, const 2_u32) -> [success: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/const_prop/return_place.add.PreCodegen.before.panic-unwind.mir b/tests/mir-opt/const_prop/return_place.add.PreCodegen.before.panic-unwind.mir index 148f16c7ee2..9a064697463 100644 --- a/tests/mir-opt/const_prop/return_place.add.PreCodegen.before.panic-unwind.mir +++ b/tests/mir-opt/const_prop/return_place.add.PreCodegen.before.panic-unwind.mir @@ -6,7 +6,7 @@ fn add() -> u32 { bb0: { _1 = const (4_u32, false); - assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 2_u32, const 2_u32) -> bb1; + assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 2_u32, const 2_u32) -> [success: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/const_prop/scalar_literal_propagation.main.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/scalar_literal_propagation.main.ConstProp.panic-unwind.diff index d7d6e8e435e..a7d7a7224ce 100644 --- a/tests/mir-opt/const_prop/scalar_literal_propagation.main.ConstProp.panic-unwind.diff +++ b/tests/mir-opt/const_prop/scalar_literal_propagation.main.ConstProp.panic-unwind.diff @@ -17,7 +17,7 @@ StorageLive(_3); - _3 = _1; + _3 = const 1_u32; - _2 = consume(move _3) -> bb1; + _2 = consume(move _3) -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/const_prop/slice_len.main.ConstProp.32bit.panic-unwind.diff b/tests/mir-opt/const_prop/slice_len.main.ConstProp.32bit.panic-unwind.diff index b07ec0ad502..c0f290a9ab4 100644 --- a/tests/mir-opt/const_prop/slice_len.main.ConstProp.32bit.panic-unwind.diff +++ b/tests/mir-opt/const_prop/slice_len.main.ConstProp.32bit.panic-unwind.diff @@ -27,10 +27,10 @@ _6 = const 1_usize; - _7 = Len((*_2)); - _8 = Lt(_6, _7); -- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> bb1; +- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind continue]; + _7 = const 3_usize; + _8 = const true; -+ assert(const true, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> bb1; ++ assert(const true, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/const_prop/slice_len.main.ConstProp.64bit.panic-unwind.diff b/tests/mir-opt/const_prop/slice_len.main.ConstProp.64bit.panic-unwind.diff index b07ec0ad502..c0f290a9ab4 100644 --- a/tests/mir-opt/const_prop/slice_len.main.ConstProp.64bit.panic-unwind.diff +++ b/tests/mir-opt/const_prop/slice_len.main.ConstProp.64bit.panic-unwind.diff @@ -27,10 +27,10 @@ _6 = const 1_usize; - _7 = Len((*_2)); - _8 = Lt(_6, _7); -- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> bb1; +- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind continue]; + _7 = const 3_usize; + _8 = const true; -+ assert(const true, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> bb1; ++ assert(const true, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/const_prop/switch_int.main.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/switch_int.main.ConstProp.panic-unwind.diff index 02dca4d3dea..1ce28e979a5 100644 --- a/tests/mir-opt/const_prop/switch_int.main.ConstProp.panic-unwind.diff +++ b/tests/mir-opt/const_prop/switch_int.main.ConstProp.panic-unwind.diff @@ -13,11 +13,11 @@ } bb1: { - _0 = foo(const -1_i32) -> bb3; + _0 = foo(const -1_i32) -> [return: bb3, unwind continue]; } bb2: { - _0 = foo(const 0_i32) -> bb3; + _0 = foo(const 0_i32) -> [return: bb3, unwind continue]; } bb3: { diff --git a/tests/mir-opt/const_prop/switch_int.main.SimplifyConstCondition-after-const-prop.panic-unwind.diff b/tests/mir-opt/const_prop/switch_int.main.SimplifyConstCondition-after-const-prop.panic-unwind.diff index 72ce94e1429..e598a0d3df0 100644 --- a/tests/mir-opt/const_prop/switch_int.main.SimplifyConstCondition-after-const-prop.panic-unwind.diff +++ b/tests/mir-opt/const_prop/switch_int.main.SimplifyConstCondition-after-const-prop.panic-unwind.diff @@ -13,11 +13,11 @@ } bb1: { - _0 = foo(const -1_i32) -> bb3; + _0 = foo(const -1_i32) -> [return: bb3, unwind continue]; } bb2: { - _0 = foo(const 0_i32) -> bb3; + _0 = foo(const 0_i32) -> [return: bb3, unwind continue]; } bb3: { diff --git a/tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.panic-unwind.diff b/tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.panic-unwind.diff index d44c69ca440..6255f9ec596 100644 --- a/tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.panic-unwind.diff +++ b/tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.panic-unwind.diff @@ -18,7 +18,7 @@ StorageLive(_3); - _3 = _1; + _3 = const (1_u32, 2_u32); - _2 = consume(move _3) -> bb1; + _2 = consume(move _3) -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/copy-prop/borrowed_local.f.CopyProp.panic-unwind.diff b/tests/mir-opt/copy-prop/borrowed_local.f.CopyProp.panic-unwind.diff index 074f8270241..b702e3b7d1e 100644 --- a/tests/mir-opt/copy-prop/borrowed_local.f.CopyProp.panic-unwind.diff +++ b/tests/mir-opt/copy-prop/borrowed_local.f.CopyProp.panic-unwind.diff @@ -13,11 +13,11 @@ _2 = &_1; _3 = _1; _4 = &_3; - _0 = cmp_ref(_2, _4) -> bb1; + _0 = cmp_ref(_2, _4) -> [return: bb1, unwind continue]; } bb1: { - _0 = opaque::<u8>(_3) -> bb2; + _0 = opaque::<u8>(_3) -> [return: bb2, unwind continue]; } bb2: { diff --git a/tests/mir-opt/copy-prop/branch.foo.CopyProp.panic-unwind.diff b/tests/mir-opt/copy-prop/branch.foo.CopyProp.panic-unwind.diff index 0dcc5cef734..2f92d8818cf 100644 --- a/tests/mir-opt/copy-prop/branch.foo.CopyProp.panic-unwind.diff +++ b/tests/mir-opt/copy-prop/branch.foo.CopyProp.panic-unwind.diff @@ -16,13 +16,13 @@ bb0: { StorageLive(_1); - _1 = val() -> bb1; + _1 = val() -> [return: bb1, unwind continue]; } bb1: { StorageLive(_2); StorageLive(_3); - _3 = cond() -> bb2; + _3 = cond() -> [return: bb2, unwind continue]; } bb2: { @@ -36,7 +36,7 @@ bb4: { StorageLive(_4); - _4 = val() -> bb5; + _4 = val() -> [return: bb5, unwind continue]; } bb5: { diff --git a/tests/mir-opt/copy-prop/copy_propagation_arg.bar.CopyProp.panic-unwind.diff b/tests/mir-opt/copy-prop/copy_propagation_arg.bar.CopyProp.panic-unwind.diff index 95c1c12ee69..ef9c343a264 100644 --- a/tests/mir-opt/copy-prop/copy_propagation_arg.bar.CopyProp.panic-unwind.diff +++ b/tests/mir-opt/copy-prop/copy_propagation_arg.bar.CopyProp.panic-unwind.diff @@ -11,7 +11,7 @@ StorageLive(_2); StorageLive(_3); _3 = _1; - _2 = dummy(move _3) -> bb1; + _2 = dummy(move _3) -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/copy-prop/copy_propagation_arg.foo.CopyProp.panic-unwind.diff b/tests/mir-opt/copy-prop/copy_propagation_arg.foo.CopyProp.panic-unwind.diff index e16d6220ef2..769089e16f3 100644 --- a/tests/mir-opt/copy-prop/copy_propagation_arg.foo.CopyProp.panic-unwind.diff +++ b/tests/mir-opt/copy-prop/copy_propagation_arg.foo.CopyProp.panic-unwind.diff @@ -11,7 +11,7 @@ StorageLive(_2); StorageLive(_3); _3 = _1; - _2 = dummy(move _3) -> bb1; + _2 = dummy(move _3) -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/copy-prop/custom_move_arg.f.CopyProp.panic-unwind.diff b/tests/mir-opt/copy-prop/custom_move_arg.f.CopyProp.panic-unwind.diff index 2d7e34f2d6e..eb40183c1c9 100644 --- a/tests/mir-opt/copy-prop/custom_move_arg.f.CopyProp.panic-unwind.diff +++ b/tests/mir-opt/copy-prop/custom_move_arg.f.CopyProp.panic-unwind.diff @@ -8,14 +8,14 @@ bb0: { - _2 = _1; -- _0 = opaque::<NotCopy>(move _1) -> bb1; -+ _0 = opaque::<NotCopy>(_1) -> bb1; +- _0 = opaque::<NotCopy>(move _1) -> [return: bb1, unwind continue]; ++ _0 = opaque::<NotCopy>(_1) -> [return: bb1, unwind continue]; } bb1: { - _3 = move _2; -- _0 = opaque::<NotCopy>(_3) -> bb2; -+ _0 = opaque::<NotCopy>(_1) -> bb2; +- _0 = opaque::<NotCopy>(_3) -> [return: bb2, unwind continue]; ++ _0 = opaque::<NotCopy>(_1) -> [return: bb2, unwind continue]; } bb2: { diff --git a/tests/mir-opt/copy-prop/cycle.main.CopyProp.panic-unwind.diff b/tests/mir-opt/copy-prop/cycle.main.CopyProp.panic-unwind.diff index bf9e941c7b6..e343b78924a 100644 --- a/tests/mir-opt/copy-prop/cycle.main.CopyProp.panic-unwind.diff +++ b/tests/mir-opt/copy-prop/cycle.main.CopyProp.panic-unwind.diff @@ -22,7 +22,7 @@ bb0: { StorageLive(_1); - _1 = val() -> bb1; + _1 = val() -> [return: bb1, unwind continue]; } bb1: { @@ -38,7 +38,7 @@ StorageLive(_5); StorageLive(_6); _6 = _1; - _5 = std::mem::drop::<i32>(move _6) -> bb2; + _5 = std::mem::drop::<i32>(move _6) -> [return: bb2, unwind continue]; } bb2: { diff --git a/tests/mir-opt/copy-prop/dead_stores_79191.f.CopyProp.after.panic-unwind.mir b/tests/mir-opt/copy-prop/dead_stores_79191.f.CopyProp.after.panic-unwind.mir index 617e57d884b..f8c285ff384 100644 --- a/tests/mir-opt/copy-prop/dead_stores_79191.f.CopyProp.after.panic-unwind.mir +++ b/tests/mir-opt/copy-prop/dead_stores_79191.f.CopyProp.after.panic-unwind.mir @@ -16,7 +16,7 @@ fn f(_1: usize) -> usize { _1 = _2; StorageLive(_4); _4 = _1; - _0 = id::<usize>(move _4) -> bb1; + _0 = id::<usize>(move _4) -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/copy-prop/dead_stores_better.f.CopyProp.after.panic-unwind.mir b/tests/mir-opt/copy-prop/dead_stores_better.f.CopyProp.after.panic-unwind.mir index 617e57d884b..f8c285ff384 100644 --- a/tests/mir-opt/copy-prop/dead_stores_better.f.CopyProp.after.panic-unwind.mir +++ b/tests/mir-opt/copy-prop/dead_stores_better.f.CopyProp.after.panic-unwind.mir @@ -16,7 +16,7 @@ fn f(_1: usize) -> usize { _1 = _2; StorageLive(_4); _4 = _1; - _0 = id::<usize>(move _4) -> bb1; + _0 = id::<usize>(move _4) -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/copy-prop/issue_107511.main.CopyProp.panic-unwind.diff b/tests/mir-opt/copy-prop/issue_107511.main.CopyProp.panic-unwind.diff index 69f399bf1fa..c2d892be35d 100644 --- a/tests/mir-opt/copy-prop/issue_107511.main.CopyProp.panic-unwind.diff +++ b/tests/mir-opt/copy-prop/issue_107511.main.CopyProp.panic-unwind.diff @@ -49,14 +49,14 @@ _7 = &_2; _6 = move _7 as &[i32] (Pointer(Unsize)); StorageDead(_7); - _5 = core::slice::<impl [i32]>::len(move _6) -> bb1; + _5 = core::slice::<impl [i32]>::len(move _6) -> [return: bb1, unwind continue]; } bb1: { StorageDead(_6); _4 = std::ops::Range::<usize> { start: const 0_usize, end: move _5 }; StorageDead(_5); - _3 = <std::ops::Range<usize> as IntoIterator>::into_iter(move _4) -> bb2; + _3 = <std::ops::Range<usize> as IntoIterator>::into_iter(move _4) -> [return: bb2, unwind continue]; } bb2: { @@ -73,7 +73,7 @@ StorageLive(_13); _13 = &mut _8; _12 = &mut (*_13); - _11 = <std::ops::Range<usize> as Iterator>::next(move _12) -> bb4; + _11 = <std::ops::Range<usize> as Iterator>::next(move _12) -> [return: bb4, unwind continue]; } bb4: { @@ -90,9 +90,9 @@ - _18 = _16; _19 = Len(_2); - _20 = Lt(_18, _19); -- assert(move _20, "index out of bounds: the length is {} but the index is {}", move _19, _18) -> bb8; +- assert(move _20, "index out of bounds: the length is {} but the index is {}", move _19, _18) -> [success: bb8, unwind continue]; + _20 = Lt(_16, _19); -+ assert(move _20, "index out of bounds: the length is {} but the index is {}", move _19, _16) -> bb8; ++ assert(move _20, "index out of bounds: the length is {} but the index is {}", move _19, _16) -> [success: bb8, unwind continue]; } bb6: { diff --git a/tests/mir-opt/copy-prop/move_arg.f.CopyProp.panic-unwind.diff b/tests/mir-opt/copy-prop/move_arg.f.CopyProp.panic-unwind.diff index cbbf6686b04..0c6a3c6d5c9 100644 --- a/tests/mir-opt/copy-prop/move_arg.f.CopyProp.panic-unwind.diff +++ b/tests/mir-opt/copy-prop/move_arg.f.CopyProp.panic-unwind.diff @@ -21,8 +21,8 @@ - _4 = _1; - StorageLive(_5); - _5 = _2; -- _3 = g::<T>(move _4, move _5) -> bb1; -+ _3 = g::<T>(_1, _1) -> bb1; +- _3 = g::<T>(move _4, move _5) -> [return: bb1, unwind continue]; ++ _3 = g::<T>(_1, _1) -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/copy-prop/move_projection.f.CopyProp.panic-unwind.diff b/tests/mir-opt/copy-prop/move_projection.f.CopyProp.panic-unwind.diff index 3ebee0ed80d..ad3889639e0 100644 --- a/tests/mir-opt/copy-prop/move_projection.f.CopyProp.panic-unwind.diff +++ b/tests/mir-opt/copy-prop/move_projection.f.CopyProp.panic-unwind.diff @@ -9,13 +9,13 @@ bb0: { - _2 = _1; - _3 = move (_2.0: u8); -- _0 = opaque::<Foo>(move _1) -> bb1; +- _0 = opaque::<Foo>(move _1) -> [return: bb1, unwind continue]; + _3 = (_1.0: u8); -+ _0 = opaque::<Foo>(_1) -> bb1; ++ _0 = opaque::<Foo>(_1) -> [return: bb1, unwind continue]; } bb1: { - _0 = opaque::<u8>(move _3) -> bb2; + _0 = opaque::<u8>(move _3) -> [return: bb2, unwind continue]; } bb2: { diff --git a/tests/mir-opt/copy-prop/reborrow.demiraw.CopyProp.panic-unwind.diff b/tests/mir-opt/copy-prop/reborrow.demiraw.CopyProp.panic-unwind.diff index 0f14b53e9ad..66a0f49cfb9 100644 --- a/tests/mir-opt/copy-prop/reborrow.demiraw.CopyProp.panic-unwind.diff +++ b/tests/mir-opt/copy-prop/reborrow.demiraw.CopyProp.panic-unwind.diff @@ -36,8 +36,8 @@ StorageLive(_6); - StorageLive(_7); - _7 = _5; -- _6 = opaque::<*mut u8>(move _7) -> bb1; -+ _6 = opaque::<*mut u8>(_2) -> bb1; +- _6 = opaque::<*mut u8>(move _7) -> [return: bb1, unwind continue]; ++ _6 = opaque::<*mut u8>(_2) -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/copy-prop/reborrow.miraw.CopyProp.panic-unwind.diff b/tests/mir-opt/copy-prop/reborrow.miraw.CopyProp.panic-unwind.diff index ba6e09fa95c..f5a512b8995 100644 --- a/tests/mir-opt/copy-prop/reborrow.miraw.CopyProp.panic-unwind.diff +++ b/tests/mir-opt/copy-prop/reborrow.miraw.CopyProp.panic-unwind.diff @@ -32,8 +32,8 @@ StorageLive(_5); - StorageLive(_6); - _6 = _4; -- _5 = opaque::<*mut u8>(move _6) -> bb1; -+ _5 = opaque::<*mut u8>(_2) -> bb1; +- _5 = opaque::<*mut u8>(move _6) -> [return: bb1, unwind continue]; ++ _5 = opaque::<*mut u8>(_2) -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/copy-prop/reborrow.remut.CopyProp.panic-unwind.diff b/tests/mir-opt/copy-prop/reborrow.remut.CopyProp.panic-unwind.diff index 4379aa06385..67763fdce66 100644 --- a/tests/mir-opt/copy-prop/reborrow.remut.CopyProp.panic-unwind.diff +++ b/tests/mir-opt/copy-prop/reborrow.remut.CopyProp.panic-unwind.diff @@ -30,8 +30,8 @@ StorageLive(_5); - StorageLive(_6); - _6 = move _4; -- _5 = opaque::<&mut u8>(move _6) -> bb1; -+ _5 = opaque::<&mut u8>(move _2) -> bb1; +- _5 = opaque::<&mut u8>(move _6) -> [return: bb1, unwind continue]; ++ _5 = opaque::<&mut u8>(move _2) -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/copy-prop/reborrow.reraw.CopyProp.panic-unwind.diff b/tests/mir-opt/copy-prop/reborrow.reraw.CopyProp.panic-unwind.diff index 53332f8161e..becc4256321 100644 --- a/tests/mir-opt/copy-prop/reborrow.reraw.CopyProp.panic-unwind.diff +++ b/tests/mir-opt/copy-prop/reborrow.reraw.CopyProp.panic-unwind.diff @@ -30,8 +30,8 @@ StorageLive(_5); - StorageLive(_6); - _6 = move _4; -- _5 = opaque::<&mut u8>(move _6) -> bb1; -+ _5 = opaque::<&mut u8>(move _2) -> bb1; +- _5 = opaque::<&mut u8>(move _6) -> [return: bb1, unwind continue]; ++ _5 = opaque::<&mut u8>(move _2) -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/dataflow-const-prop/checked.main.DataflowConstProp.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/checked.main.DataflowConstProp.panic-unwind.diff index 784841eacbf..0d8a9aca3d8 100644 --- a/tests/mir-opt/dataflow-const-prop/checked.main.DataflowConstProp.panic-unwind.diff +++ b/tests/mir-opt/dataflow-const-prop/checked.main.DataflowConstProp.panic-unwind.diff @@ -41,10 +41,10 @@ StorageLive(_5); - _5 = _2; - _6 = CheckedAdd(_4, _5); -- assert(!move (_6.1: bool), "attempt to compute `{} + {}`, which would overflow", move _4, move _5) -> bb1; +- assert(!move (_6.1: bool), "attempt to compute `{} + {}`, which would overflow", move _4, move _5) -> [success: bb1, unwind continue]; + _5 = const 2_i32; + _6 = CheckedAdd(const 1_i32, const 2_i32); -+ assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 1_i32, const 2_i32) -> bb1; ++ assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 1_i32, const 2_i32) -> [success: bb1, unwind continue]; } bb1: { @@ -58,10 +58,10 @@ StorageLive(_9); - _9 = _7; - _10 = CheckedAdd(_9, const 1_i32); -- assert(!move (_10.1: bool), "attempt to compute `{} + {}`, which would overflow", move _9, const 1_i32) -> bb2; +- assert(!move (_10.1: bool), "attempt to compute `{} + {}`, which would overflow", move _9, const 1_i32) -> [success: bb2, unwind continue]; + _9 = const i32::MAX; + _10 = CheckedAdd(const i32::MAX, const 1_i32); -+ assert(!const true, "attempt to compute `{} + {}`, which would overflow", const i32::MAX, const 1_i32) -> bb2; ++ assert(!const true, "attempt to compute `{} + {}`, which would overflow", const i32::MAX, const 1_i32) -> [success: bb2, unwind continue]; } bb2: { diff --git a/tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.panic-unwind.diff index d79a2da1ddb..c1d281ab788 100644 --- a/tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.panic-unwind.diff +++ b/tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.panic-unwind.diff @@ -21,9 +21,9 @@ StorageLive(_3); _3 = const 1_u8; - _4 = CheckedAdd(_2, _3); -- assert(!move (_4.1: bool), "attempt to compute `{} + {}`, which would overflow", _2, _3) -> bb1; +- assert(!move (_4.1: bool), "attempt to compute `{} + {}`, which would overflow", _2, _3) -> [success: bb1, unwind continue]; + _4 = CheckedAdd(const u8::MAX, const 1_u8); -+ assert(!const true, "attempt to compute `{} + {}`, which would overflow", const u8::MAX, const 1_u8) -> bb1; ++ assert(!const true, "attempt to compute `{} + {}`, which would overflow", const u8::MAX, const 1_u8) -> [success: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/dataflow-const-prop/ref_without_sb.main.DataflowConstProp.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/ref_without_sb.main.DataflowConstProp.panic-unwind.diff index 83d2f78323e..4e1d26acfa3 100644 --- a/tests/mir-opt/dataflow-const-prop/ref_without_sb.main.DataflowConstProp.panic-unwind.diff +++ b/tests/mir-opt/dataflow-const-prop/ref_without_sb.main.DataflowConstProp.panic-unwind.diff @@ -24,7 +24,7 @@ StorageLive(_4); _4 = &_1; _3 = &(*_4); - _2 = escape::<i32>(move _3) -> bb1; + _2 = escape::<i32>(move _3) -> [return: bb1, unwind continue]; } bb1: { @@ -33,7 +33,7 @@ StorageDead(_2); _1 = const 1_i32; StorageLive(_5); - _5 = some_function() -> bb2; + _5 = some_function() -> [return: bb2, unwind continue]; } bb2: { diff --git a/tests/mir-opt/dataflow-const-prop/sibling_ptr.main.DataflowConstProp.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/sibling_ptr.main.DataflowConstProp.panic-unwind.diff index 927ca0124bb..ebeb8619d73 100644 --- a/tests/mir-opt/dataflow-const-prop/sibling_ptr.main.DataflowConstProp.panic-unwind.diff +++ b/tests/mir-opt/dataflow-const-prop/sibling_ptr.main.DataflowConstProp.panic-unwind.diff @@ -30,7 +30,7 @@ StorageLive(_4); StorageLive(_5); _5 = _3; - _4 = ptr::mut_ptr::<impl *mut u8>::add(move _5, const 1_usize) -> bb1; + _4 = ptr::mut_ptr::<impl *mut u8>::add(move _5, const 1_usize) -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/dataflow-const-prop/terminator.main.DataflowConstProp.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/terminator.main.DataflowConstProp.panic-unwind.diff index f9723a04983..395620fec52 100644 --- a/tests/mir-opt/dataflow-const-prop/terminator.main.DataflowConstProp.panic-unwind.diff +++ b/tests/mir-opt/dataflow-const-prop/terminator.main.DataflowConstProp.panic-unwind.diff @@ -22,8 +22,8 @@ + _4 = const 1_i32; + _3 = const 2_i32; StorageDead(_4); -- _2 = foo(move _3) -> bb1; -+ _2 = foo(const 2_i32) -> bb1; +- _2 = foo(move _3) -> [return: bb1, unwind continue]; ++ _2 = foo(const 2_i32) -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination.panic-unwind.diff b/tests/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination.panic-unwind.diff index 80a4dd37183..4b922e05e10 100644 --- a/tests/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination.panic-unwind.diff +++ b/tests/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination.panic-unwind.diff @@ -28,9 +28,9 @@ bb1: { - StorageLive(_5); -- _5 = cond() -> bb2; +- _5 = cond() -> [return: bb2, unwind continue]; + StorageLive(_4); -+ _4 = cond() -> bb2; ++ _4 = cond() -> [return: bb2, unwind continue]; } bb2: { diff --git a/tests/mir-opt/deduplicate_blocks.is_line_doc_comment_2.DeduplicateBlocks.panic-unwind.diff b/tests/mir-opt/deduplicate_blocks.is_line_doc_comment_2.DeduplicateBlocks.panic-unwind.diff index 66396d28e70..3d9aa829052 100644 --- a/tests/mir-opt/deduplicate_blocks.is_line_doc_comment_2.DeduplicateBlocks.panic-unwind.diff +++ b/tests/mir-opt/deduplicate_blocks.is_line_doc_comment_2.DeduplicateBlocks.panic-unwind.diff @@ -17,7 +17,7 @@ StorageLive(_2); StorageLive(_3); _3 = &(*_1); - _2 = core::str::<impl str>::as_bytes(move _3) -> bb1; + _2 = core::str::<impl str>::as_bytes(move _3) -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/derefer_complex_case.main.Derefer.panic-unwind.diff b/tests/mir-opt/derefer_complex_case.main.Derefer.panic-unwind.diff index 62085341d37..da4cc188cfa 100644 --- a/tests/mir-opt/derefer_complex_case.main.Derefer.panic-unwind.diff +++ b/tests/mir-opt/derefer_complex_case.main.Derefer.panic-unwind.diff @@ -30,7 +30,7 @@ StorageLive(_2); _14 = const _; _2 = &(*_14); - _1 = <&[i32; 2] as IntoIterator>::into_iter(move _2) -> bb1; + _1 = <&[i32; 2] as IntoIterator>::into_iter(move _2) -> [return: bb1, unwind continue]; } bb1: { @@ -47,7 +47,7 @@ StorageLive(_9); _9 = &mut _4; _8 = &mut (*_9); - _7 = <std::slice::Iter<'_, i32> as Iterator>::next(move _8) -> bb3; + _7 = <std::slice::Iter<'_, i32> as Iterator>::next(move _8) -> [return: bb3, unwind continue]; } bb3: { @@ -63,7 +63,7 @@ + _12 = (*_15); StorageLive(_13); _13 = _12; - _6 = std::mem::drop::<i32>(move _13) -> bb7; + _6 = std::mem::drop::<i32>(move _13) -> [return: bb7, unwind continue]; } bb5: { diff --git a/tests/mir-opt/derefer_inline_test.main.Derefer.panic-unwind.diff b/tests/mir-opt/derefer_inline_test.main.Derefer.panic-unwind.diff index 50683837097..2ada087b4bd 100644 --- a/tests/mir-opt/derefer_inline_test.main.Derefer.panic-unwind.diff +++ b/tests/mir-opt/derefer_inline_test.main.Derefer.panic-unwind.diff @@ -9,7 +9,7 @@ bb0: { StorageLive(_1); StorageLive(_2); - _2 = f() -> bb1; + _2 = f() -> [return: bb1, unwind continue]; } bb1: { @@ -18,7 +18,7 @@ bb2: { StorageDead(_2); - drop(_1) -> bb3; + drop(_1) -> [return: bb3, unwind continue]; } bb3: { diff --git a/tests/mir-opt/derefer_terminator_test.main.Derefer.panic-unwind.diff b/tests/mir-opt/derefer_terminator_test.main.Derefer.panic-unwind.diff index 59168eda2f3..19b26c901cb 100644 --- a/tests/mir-opt/derefer_terminator_test.main.Derefer.panic-unwind.diff +++ b/tests/mir-opt/derefer_terminator_test.main.Derefer.panic-unwind.diff @@ -30,12 +30,12 @@ bb0: { StorageLive(_1); - _1 = foo() -> bb1; + _1 = foo() -> [return: bb1, unwind continue]; } bb1: { StorageLive(_2); - _2 = foo() -> bb2; + _2 = foo() -> [return: bb2, unwind continue]; } bb2: { diff --git a/tests/mir-opt/dest-prop/branch.foo.DestinationPropagation.panic-unwind.diff b/tests/mir-opt/dest-prop/branch.foo.DestinationPropagation.panic-unwind.diff index e0734f47de2..759c1cabf45 100644 --- a/tests/mir-opt/dest-prop/branch.foo.DestinationPropagation.panic-unwind.diff +++ b/tests/mir-opt/dest-prop/branch.foo.DestinationPropagation.panic-unwind.diff @@ -18,16 +18,16 @@ bb0: { - StorageLive(_1); -- _1 = val() -> bb1; +- _1 = val() -> [return: bb1, unwind continue]; + nop; -+ _0 = val() -> bb1; ++ _0 = val() -> [return: bb1, unwind continue]; } bb1: { - StorageLive(_2); + nop; StorageLive(_3); - _3 = cond() -> bb2; + _3 = cond() -> [return: bb2, unwind continue]; } bb2: { @@ -42,7 +42,7 @@ bb4: { StorageLive(_4); - _4 = val() -> bb5; + _4 = val() -> [return: bb5, unwind continue]; } bb5: { diff --git a/tests/mir-opt/dest-prop/copy_propagation_arg.bar.DestinationPropagation.panic-unwind.diff b/tests/mir-opt/dest-prop/copy_propagation_arg.bar.DestinationPropagation.panic-unwind.diff index b181066df04..8b2835c8ced 100644 --- a/tests/mir-opt/dest-prop/copy_propagation_arg.bar.DestinationPropagation.panic-unwind.diff +++ b/tests/mir-opt/dest-prop/copy_propagation_arg.bar.DestinationPropagation.panic-unwind.diff @@ -11,10 +11,10 @@ StorageLive(_2); - StorageLive(_3); - _3 = _1; -- _2 = dummy(move _3) -> bb1; +- _2 = dummy(move _3) -> [return: bb1, unwind continue]; + nop; + nop; -+ _2 = dummy(move _1) -> bb1; ++ _2 = dummy(move _1) -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/dest-prop/copy_propagation_arg.foo.DestinationPropagation.panic-unwind.diff b/tests/mir-opt/dest-prop/copy_propagation_arg.foo.DestinationPropagation.panic-unwind.diff index f1972866936..b4c8a89278b 100644 --- a/tests/mir-opt/dest-prop/copy_propagation_arg.foo.DestinationPropagation.panic-unwind.diff +++ b/tests/mir-opt/dest-prop/copy_propagation_arg.foo.DestinationPropagation.panic-unwind.diff @@ -12,8 +12,8 @@ + nop; StorageLive(_3); _3 = _1; -- _2 = dummy(move _3) -> bb1; -+ _1 = dummy(move _3) -> bb1; +- _2 = dummy(move _3) -> [return: bb1, unwind continue]; ++ _1 = dummy(move _3) -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/dest-prop/cycle.main.DestinationPropagation.panic-unwind.diff b/tests/mir-opt/dest-prop/cycle.main.DestinationPropagation.panic-unwind.diff index 0dc7de31cc4..6f6e01d37b1 100644 --- a/tests/mir-opt/dest-prop/cycle.main.DestinationPropagation.panic-unwind.diff +++ b/tests/mir-opt/dest-prop/cycle.main.DestinationPropagation.panic-unwind.diff @@ -24,9 +24,9 @@ bb0: { - StorageLive(_1); -- _1 = val() -> bb1; +- _1 = val() -> [return: bb1, unwind continue]; + nop; -+ _6 = val() -> bb1; ++ _6 = val() -> [return: bb1, unwind continue]; } bb1: { @@ -51,7 +51,7 @@ - _6 = _1; + nop; + nop; - _5 = std::mem::drop::<i32>(move _6) -> bb2; + _5 = std::mem::drop::<i32>(move _6) -> [return: bb2, unwind continue]; } bb2: { diff --git a/tests/mir-opt/dest-prop/dead_stores_79191.f.DestinationPropagation.after.panic-unwind.mir b/tests/mir-opt/dest-prop/dead_stores_79191.f.DestinationPropagation.after.panic-unwind.mir index bf515d328ae..9147de2ec47 100644 --- a/tests/mir-opt/dest-prop/dead_stores_79191.f.DestinationPropagation.after.panic-unwind.mir +++ b/tests/mir-opt/dest-prop/dead_stores_79191.f.DestinationPropagation.after.panic-unwind.mir @@ -20,7 +20,7 @@ fn f(_1: usize) -> usize { nop; nop; nop; - _0 = id::<usize>(move _1) -> bb1; + _0 = id::<usize>(move _1) -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/dest-prop/dead_stores_better.f.DestinationPropagation.after.panic-unwind.mir b/tests/mir-opt/dest-prop/dead_stores_better.f.DestinationPropagation.after.panic-unwind.mir index 038bd4b6da9..185feb4b418 100644 --- a/tests/mir-opt/dest-prop/dead_stores_better.f.DestinationPropagation.after.panic-unwind.mir +++ b/tests/mir-opt/dest-prop/dead_stores_better.f.DestinationPropagation.after.panic-unwind.mir @@ -19,7 +19,7 @@ fn f(_1: usize) -> usize { nop; nop; nop; - _0 = id::<usize>(move _1) -> bb1; + _0 = id::<usize>(move _1) -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/dest-prop/simple.nrvo.DestinationPropagation.panic-unwind.diff b/tests/mir-opt/dest-prop/simple.nrvo.DestinationPropagation.panic-unwind.diff index 4e32823c1ee..9c3cbef38d6 100644 --- a/tests/mir-opt/dest-prop/simple.nrvo.DestinationPropagation.panic-unwind.diff +++ b/tests/mir-opt/dest-prop/simple.nrvo.DestinationPropagation.panic-unwind.diff @@ -25,8 +25,8 @@ StorageLive(_6); _6 = &mut _2; _5 = &mut (*_6); -- _3 = move _4(move _5) -> bb1; -+ _3 = move _1(move _5) -> bb1; +- _3 = move _4(move _5) -> [return: bb1, unwind continue]; ++ _3 = move _1(move _5) -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/dest-prop/union.main.DestinationPropagation.panic-unwind.diff b/tests/mir-opt/dest-prop/union.main.DestinationPropagation.panic-unwind.diff index 8d1297d0299..d2eef90582d 100644 --- a/tests/mir-opt/dest-prop/union.main.DestinationPropagation.panic-unwind.diff +++ b/tests/mir-opt/dest-prop/union.main.DestinationPropagation.panic-unwind.diff @@ -18,7 +18,7 @@ bb0: { StorageLive(_1); StorageLive(_2); - _2 = val() -> bb1; + _2 = val() -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/dest-prop/unreachable.f.DestinationPropagation.panic-unwind.diff b/tests/mir-opt/dest-prop/unreachable.f.DestinationPropagation.panic-unwind.diff index e46a318f51a..7f730a77b06 100644 --- a/tests/mir-opt/dest-prop/unreachable.f.DestinationPropagation.panic-unwind.diff +++ b/tests/mir-opt/dest-prop/unreachable.f.DestinationPropagation.panic-unwind.diff @@ -34,7 +34,7 @@ - _5 = _1; - StorageLive(_6); - _6 = _2; -- _4 = g::<T>(move _5, move _6) -> bb2; +- _4 = g::<T>(move _5, move _6) -> [return: bb2, unwind continue]; - } - - bb2: { @@ -53,9 +53,9 @@ + nop; StorageLive(_9); - _9 = _2; -- _7 = g::<T>(move _8, move _9) -> bb4; +- _7 = g::<T>(move _8, move _9) -> [return: bb4, unwind continue]; + _9 = _1; -+ _7 = g::<T>(move _1, move _9) -> bb2; ++ _7 = g::<T>(move _1, move _9) -> [return: bb2, unwind continue]; } - bb4: { diff --git a/tests/mir-opt/fn_ptr_shim.core.ops-function-Fn-call.AddMovesForPackedDrops.before.mir b/tests/mir-opt/fn_ptr_shim.core.ops-function-Fn-call.AddMovesForPackedDrops.before.mir index 4fe11435fab..5fddfd494ea 100644 --- a/tests/mir-opt/fn_ptr_shim.core.ops-function-Fn-call.AddMovesForPackedDrops.before.mir +++ b/tests/mir-opt/fn_ptr_shim.core.ops-function-Fn-call.AddMovesForPackedDrops.before.mir @@ -1,10 +1,10 @@ // MIR for `std::ops::Fn::call` before AddMovesForPackedDrops -fn std::ops::Fn::call(_1: *const fn(), _2: ()) -> <fn() as FnOnce<()>>::Output { +fn std::ops::Fn::call(_1: &fn(), _2: ()) -> <fn() as FnOnce<()>>::Output { let mut _0: <fn() as std::ops::FnOnce<()>>::Output; bb0: { - _0 = move (*_1)() -> bb1; + _0 = move (*_1)() -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/funky_arms.float_to_exponential_common.ConstProp.panic-unwind.diff b/tests/mir-opt/funky_arms.float_to_exponential_common.ConstProp.panic-unwind.diff index 513ff03c426..8a3dcfab44b 100644 --- a/tests/mir-opt/funky_arms.float_to_exponential_common.ConstProp.panic-unwind.diff +++ b/tests/mir-opt/funky_arms.float_to_exponential_common.ConstProp.panic-unwind.diff @@ -38,7 +38,7 @@ StorageLive(_4); StorageLive(_5); _5 = &(*_1); - _4 = Formatter::<'_>::sign_plus(move _5) -> bb1; + _4 = Formatter::<'_>::sign_plus(move _5) -> [return: bb1, unwind continue]; } bb1: { @@ -63,7 +63,7 @@ StorageLive(_7); StorageLive(_8); _8 = &(*_1); - _7 = Formatter::<'_>::precision(move _8) -> bb5; + _7 = Formatter::<'_>::precision(move _8) -> [return: bb5, unwind continue]; } bb5: { @@ -81,7 +81,7 @@ _15 = _10 as u32 (IntToInt); _14 = Add(move _15, const 1_u32); StorageDead(_15); - _0 = float_to_exponential_common_exact::<T>(_1, _2, move _13, move _14, _3) -> bb7; + _0 = float_to_exponential_common_exact::<T>(_1, _2, move _13, move _14, _3) -> [return: bb7, unwind continue]; } bb7: { @@ -93,7 +93,7 @@ bb8: { StorageLive(_20); _20 = _6; - _0 = float_to_exponential_common_shortest::<T>(_1, _2, move _20, _3) -> bb9; + _0 = float_to_exponential_common_shortest::<T>(_1, _2, move _20, _3) -> [return: bb9, unwind continue]; } bb9: { diff --git a/tests/mir-opt/inline/asm_unwind.main.Inline.panic-unwind.diff b/tests/mir-opt/inline/asm_unwind.main.Inline.panic-unwind.diff index af67723d937..684211b53b3 100644 --- a/tests/mir-opt/inline/asm_unwind.main.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/asm_unwind.main.Inline.panic-unwind.diff @@ -15,7 +15,7 @@ bb0: { StorageLive(_1); -- _1 = foo() -> bb1; +- _1 = foo() -> [return: bb1, unwind continue]; + StorageLive(_2); + asm!("", options(MAY_UNWIND)) -> [return: bb2, unwind: bb3]; } @@ -28,7 +28,7 @@ + } + + bb2: { -+ drop(_2) -> bb1; ++ drop(_2) -> [return: bb1, unwind continue]; + } + + bb3 (cleanup): { diff --git a/tests/mir-opt/inline/caller_with_trivial_bound.foo.Inline.panic-unwind.diff b/tests/mir-opt/inline/caller_with_trivial_bound.foo.Inline.panic-unwind.diff index 67f16833435..d4427b2a807 100644 --- a/tests/mir-opt/inline/caller_with_trivial_bound.foo.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/caller_with_trivial_bound.foo.Inline.panic-unwind.diff @@ -10,7 +10,7 @@ bb0: { StorageLive(_1); - _1 = bar::<T>() -> bb1; + _1 = bar::<T>() -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/inline/cycle.g.Inline.panic-unwind.diff b/tests/mir-opt/inline/cycle.g.Inline.panic-unwind.diff index 2bdb942379c..3ce8d9acf36 100644 --- a/tests/mir-opt/inline/cycle.g.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/cycle.g.Inline.panic-unwind.diff @@ -16,7 +16,7 @@ bb0: { StorageLive(_1); -- _1 = f::<fn() {main}>(main) -> bb1; +- _1 = f::<fn() {main}>(main) -> [return: bb1, unwind continue]; + StorageLive(_2); + _2 = main; + StorageLive(_4); @@ -46,7 +46,7 @@ + bb4: { + StorageDead(_5); + StorageDead(_3); -+ drop(_2) -> bb1; ++ drop(_2) -> [return: bb1, unwind continue]; } } diff --git a/tests/mir-opt/inline/cycle.main.Inline.panic-unwind.diff b/tests/mir-opt/inline/cycle.main.Inline.panic-unwind.diff index c4f97d75308..198a2322618 100644 --- a/tests/mir-opt/inline/cycle.main.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/cycle.main.Inline.panic-unwind.diff @@ -24,7 +24,7 @@ bb0: { StorageLive(_1); -- _1 = f::<fn() {g}>(g) -> bb1; +- _1 = f::<fn() {g}>(g) -> [return: bb1, unwind continue]; + StorageLive(_2); + _2 = g; + StorageLive(_4); @@ -56,7 +56,7 @@ + StorageDead(_6); + StorageDead(_5); + StorageDead(_3); -+ drop(_2) -> bb1; ++ drop(_2) -> [return: bb1, unwind continue]; } } diff --git a/tests/mir-opt/inline/dyn_trait.get_query.Inline.panic-unwind.diff b/tests/mir-opt/inline/dyn_trait.get_query.Inline.panic-unwind.diff index ca772cf4383..941ba24605c 100644 --- a/tests/mir-opt/inline/dyn_trait.get_query.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/dyn_trait.get_query.Inline.panic-unwind.diff @@ -22,17 +22,17 @@ StorageLive(_2); StorageLive(_3); _3 = &(*_1); - _2 = <Q as Query>::cache::<T>(move _3) -> bb1; + _2 = <Q as Query>::cache::<T>(move _3) -> [return: bb1, unwind continue]; } bb1: { StorageDead(_3); StorageLive(_4); _4 = &(*_2); -- _0 = try_execute_query::<<Q as Query>::C>(move _4) -> bb2; +- _0 = try_execute_query::<<Q as Query>::C>(move _4) -> [return: bb2, unwind continue]; + StorageLive(_5); + _5 = _4 as &dyn Cache<V = <Q as Query>::V> (Pointer(Unsize)); -+ _0 = <dyn Cache<V = <Q as Query>::V> as Cache>::store_nocache(_5) -> bb2; ++ _0 = <dyn Cache<V = <Q as Query>::V> as Cache>::store_nocache(_5) -> [return: bb2, unwind continue]; } bb2: { diff --git a/tests/mir-opt/inline/dyn_trait.mk_cycle.Inline.panic-unwind.diff b/tests/mir-opt/inline/dyn_trait.mk_cycle.Inline.panic-unwind.diff index 12b539fc250..7b1cf895a87 100644 --- a/tests/mir-opt/inline/dyn_trait.mk_cycle.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/dyn_trait.mk_cycle.Inline.panic-unwind.diff @@ -9,7 +9,7 @@ bb0: { StorageLive(_2); _2 = &(*_1); - _0 = <dyn Cache<V = V> as Cache>::store_nocache(move _2) -> bb1; + _0 = <dyn Cache<V = V> as Cache>::store_nocache(move _2) -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/inline/dyn_trait.try_execute_query.Inline.panic-unwind.diff b/tests/mir-opt/inline/dyn_trait.try_execute_query.Inline.panic-unwind.diff index 9bcd73e1c8b..5e30da400d2 100644 --- a/tests/mir-opt/inline/dyn_trait.try_execute_query.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/dyn_trait.try_execute_query.Inline.panic-unwind.diff @@ -16,8 +16,8 @@ _3 = &(*_1); _2 = move _3 as &dyn Cache<V = <C as Cache>::V> (Pointer(Unsize)); StorageDead(_3); -- _0 = mk_cycle::<<C as Cache>::V>(move _2) -> bb1; -+ _0 = <dyn Cache<V = <C as Cache>::V> as Cache>::store_nocache(_2) -> bb1; +- _0 = mk_cycle::<<C as Cache>::V>(move _2) -> [return: bb1, unwind continue]; ++ _0 = <dyn Cache<V = <C as Cache>::V> as Cache>::store_nocache(_2) -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/inline/exponential_runtime.main.Inline.panic-unwind.diff b/tests/mir-opt/inline/exponential_runtime.main.Inline.panic-unwind.diff index b87e164e471..0a4ce40c529 100644 --- a/tests/mir-opt/inline/exponential_runtime.main.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/exponential_runtime.main.Inline.panic-unwind.diff @@ -37,7 +37,7 @@ bb0: { StorageLive(_1); -- _1 = <() as G>::call() -> bb1; +- _1 = <() as G>::call() -> [return: bb1, unwind continue]; + StorageLive(_2); + StorageLive(_3); + StorageLive(_4); @@ -56,7 +56,7 @@ + StorageLive(_17); + StorageLive(_18); + StorageLive(_19); -+ _17 = <() as A>::call() -> bb12; ++ _17 = <() as A>::call() -> [return: bb12, unwind continue]; } bb1: { @@ -72,63 +72,63 @@ + StorageDead(_7); + StorageDead(_6); + StorageDead(_5); -+ _3 = <() as F>::call() -> bb3; ++ _3 = <() as F>::call() -> [return: bb3, unwind continue]; + } + + bb3: { -+ _4 = <() as F>::call() -> bb1; ++ _4 = <() as F>::call() -> [return: bb1, unwind continue]; + } + + bb4: { + StorageDead(_10); + StorageDead(_9); + StorageDead(_8); -+ _6 = <() as E>::call() -> bb5; ++ _6 = <() as E>::call() -> [return: bb5, unwind continue]; + } + + bb5: { -+ _7 = <() as E>::call() -> bb2; ++ _7 = <() as E>::call() -> [return: bb2, unwind continue]; + } + + bb6: { + StorageDead(_13); + StorageDead(_12); + StorageDead(_11); -+ _9 = <() as D>::call() -> bb7; ++ _9 = <() as D>::call() -> [return: bb7, unwind continue]; + } + + bb7: { -+ _10 = <() as D>::call() -> bb4; ++ _10 = <() as D>::call() -> [return: bb4, unwind continue]; + } + + bb8: { + StorageDead(_16); + StorageDead(_15); + StorageDead(_14); -+ _12 = <() as C>::call() -> bb9; ++ _12 = <() as C>::call() -> [return: bb9, unwind continue]; + } + + bb9: { -+ _13 = <() as C>::call() -> bb6; ++ _13 = <() as C>::call() -> [return: bb6, unwind continue]; + } + + bb10: { + StorageDead(_19); + StorageDead(_18); + StorageDead(_17); -+ _15 = <() as B>::call() -> bb11; ++ _15 = <() as B>::call() -> [return: bb11, unwind continue]; + } + + bb11: { -+ _16 = <() as B>::call() -> bb8; ++ _16 = <() as B>::call() -> [return: bb8, unwind continue]; + } + + bb12: { -+ _18 = <() as A>::call() -> bb13; ++ _18 = <() as A>::call() -> [return: bb13, unwind continue]; + } + + bb13: { -+ _19 = <() as A>::call() -> bb10; ++ _19 = <() as A>::call() -> [return: bb10, unwind continue]; } } diff --git a/tests/mir-opt/inline/inline_compatibility.inlined_no_sanitize.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_compatibility.inlined_no_sanitize.Inline.panic-unwind.diff index 10e0f0efcbc..eba5ad9cf26 100644 --- a/tests/mir-opt/inline/inline_compatibility.inlined_no_sanitize.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/inline_compatibility.inlined_no_sanitize.Inline.panic-unwind.diff @@ -9,7 +9,7 @@ bb0: { StorageLive(_1); -- _1 = no_sanitize() -> bb1; +- _1 = no_sanitize() -> [return: bb1, unwind continue]; - } - - bb1: { diff --git a/tests/mir-opt/inline/inline_compatibility.inlined_target_feature.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_compatibility.inlined_target_feature.Inline.panic-unwind.diff index b854e93d9b7..24457819b2c 100644 --- a/tests/mir-opt/inline/inline_compatibility.inlined_target_feature.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/inline_compatibility.inlined_target_feature.Inline.panic-unwind.diff @@ -9,7 +9,7 @@ bb0: { StorageLive(_1); -- _1 = target_feature() -> bb1; +- _1 = target_feature() -> [return: bb1, unwind continue]; - } - - bb1: { diff --git a/tests/mir-opt/inline/inline_compatibility.not_inlined_c_variadic.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_compatibility.not_inlined_c_variadic.Inline.panic-unwind.diff index d9e7177e627..364acab6d93 100644 --- a/tests/mir-opt/inline/inline_compatibility.not_inlined_c_variadic.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/inline_compatibility.not_inlined_c_variadic.Inline.panic-unwind.diff @@ -10,7 +10,7 @@ bb0: { StorageLive(_1); - _1 = sum(const 4_u32, const 4_u32, const 30_u32, const 200_u32, const 1000_u32) -> bb1; + _1 = sum(const 4_u32, const 4_u32, const 30_u32, const 200_u32, const 1000_u32) -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/inline/inline_compatibility.not_inlined_no_sanitize.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_compatibility.not_inlined_no_sanitize.Inline.panic-unwind.diff index 7d9b1d847b0..965b7ddca32 100644 --- a/tests/mir-opt/inline/inline_compatibility.not_inlined_no_sanitize.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/inline_compatibility.not_inlined_no_sanitize.Inline.panic-unwind.diff @@ -7,7 +7,7 @@ bb0: { StorageLive(_1); - _1 = no_sanitize() -> bb1; + _1 = no_sanitize() -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/inline/inline_compatibility.not_inlined_target_feature.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_compatibility.not_inlined_target_feature.Inline.panic-unwind.diff index 5bee5865283..bcdbd6e3314 100644 --- a/tests/mir-opt/inline/inline_compatibility.not_inlined_target_feature.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/inline_compatibility.not_inlined_target_feature.Inline.panic-unwind.diff @@ -7,7 +7,7 @@ bb0: { StorageLive(_1); - _1 = target_feature() -> bb1; + _1 = target_feature() -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/inline/inline_cycle.one.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_cycle.one.Inline.panic-unwind.diff index 66d25162cb1..75ac40bea61 100644 --- a/tests/mir-opt/inline/inline_cycle.one.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/inline_cycle.one.Inline.panic-unwind.diff @@ -13,7 +13,7 @@ bb0: { StorageLive(_1); - _1 = <C as Call>::call() -> bb1; + _1 = <C as Call>::call() -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/inline/inline_cycle.two.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_cycle.two.Inline.panic-unwind.diff index d3bd412d953..a08662959dd 100644 --- a/tests/mir-opt/inline/inline_cycle.two.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/inline_cycle.two.Inline.panic-unwind.diff @@ -23,14 +23,14 @@ bb0: { StorageLive(_1); -- _1 = call::<fn() {f}>(f) -> bb1; +- _1 = call::<fn() {f}>(f) -> [return: bb1, unwind continue]; + StorageLive(_2); + _2 = f; + StorageLive(_3); + StorageLive(_4); + _4 = const (); + StorageLive(_5); -+ _5 = f() -> bb1; ++ _5 = f() -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/inline/inline_cycle_generic.main.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_cycle_generic.main.Inline.panic-unwind.diff index 2a4002f0499..8314526ee04 100644 --- a/tests/mir-opt/inline/inline_cycle_generic.main.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/inline_cycle_generic.main.Inline.panic-unwind.diff @@ -13,8 +13,8 @@ bb0: { StorageLive(_1); -- _1 = <C as Call>::call() -> bb1; -+ _1 = <B<C> as Call>::call() -> bb1; +- _1 = <C as Call>::call() -> [return: bb1, unwind continue]; ++ _1 = <B<C> as Call>::call() -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/inline/inline_diverging.f.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_diverging.f.Inline.panic-unwind.diff index 76bb3356f50..b7991899253 100644 --- a/tests/mir-opt/inline/inline_diverging.f.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/inline_diverging.f.Inline.panic-unwind.diff @@ -10,7 +10,7 @@ bb0: { StorageLive(_2); -- _2 = sleep(); +- _2 = sleep() -> unwind continue; + goto -> bb1; + } + diff --git a/tests/mir-opt/inline/inline_diverging.g.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_diverging.g.Inline.panic-unwind.diff index d65efa43a7b..5663b462400 100644 --- a/tests/mir-opt/inline/inline_diverging.g.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/inline_diverging.g.Inline.panic-unwind.diff @@ -33,9 +33,9 @@ bb2: { StorageLive(_6); -- _6 = panic(); +- _6 = panic() -> unwind continue; + StorageLive(_7); -+ _7 = begin_panic::<&str>(const "explicit panic"); ++ _7 = begin_panic::<&str>(const "explicit panic") -> unwind continue; } } diff --git a/tests/mir-opt/inline/inline_diverging.h.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_diverging.h.Inline.panic-unwind.diff index f7e0e1c55f8..dfc12db12a8 100644 --- a/tests/mir-opt/inline/inline_diverging.h.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/inline_diverging.h.Inline.panic-unwind.diff @@ -27,7 +27,7 @@ bb0: { StorageLive(_1); -- _1 = call_twice::<!, fn() -> ! {sleep}>(sleep); +- _1 = call_twice::<!, fn() -> ! {sleep}>(sleep) -> unwind continue; + StorageLive(_2); + _2 = sleep; + StorageLive(_6); diff --git a/tests/mir-opt/inline/inline_generator.main.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_generator.main.Inline.panic-unwind.diff index 588f04048d6..fedcf04231d 100644 --- a/tests/mir-opt/inline/inline_generator.main.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/inline_generator.main.Inline.panic-unwind.diff @@ -35,7 +35,7 @@ StorageLive(_2); StorageLive(_3); StorageLive(_4); -- _4 = g() -> bb1; +- _4 = g() -> [return: bb1, unwind continue]; - } - - bb1: { diff --git a/tests/mir-opt/inline/inline_into_box_place.main.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_into_box_place.main.Inline.panic-unwind.diff index 4615a3f9826..0b643b3c7a9 100644 --- a/tests/mir-opt/inline/inline_into_box_place.main.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/inline_into_box_place.main.Inline.panic-unwind.diff @@ -117,7 +117,7 @@ bb0: { StorageLive(_1); StorageLive(_2); -- _2 = Vec::<u32>::new() -> bb1; +- _2 = Vec::<u32>::new() -> [return: bb1, unwind continue]; + StorageLive(_3); + _3 = const _; + _2 = Vec::<u32> { buf: move _3, len: const 0_usize }; diff --git a/tests/mir-opt/inline/inline_options.main.Inline.after.panic-unwind.mir b/tests/mir-opt/inline/inline_options.main.Inline.after.panic-unwind.mir index d006c73f954..df0cab513ec 100644 --- a/tests/mir-opt/inline/inline_options.main.Inline.after.panic-unwind.mir +++ b/tests/mir-opt/inline/inline_options.main.Inline.after.panic-unwind.mir @@ -12,7 +12,7 @@ fn main() -> () { bb0: { StorageLive(_1); - _1 = not_inlined() -> bb1; + _1 = not_inlined() -> [return: bb1, unwind continue]; } bb1: { @@ -21,7 +21,7 @@ fn main() -> () { StorageLive(_3); StorageLive(_4); StorageLive(_5); - _3 = g() -> bb3; + _3 = g() -> [return: bb3, unwind continue]; } bb2: { @@ -34,10 +34,10 @@ fn main() -> () { } bb3: { - _4 = g() -> bb4; + _4 = g() -> [return: bb4, unwind continue]; } bb4: { - _5 = g() -> bb2; + _5 = g() -> [return: bb2, unwind continue]; } } diff --git a/tests/mir-opt/inline/inline_shims.clone.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_shims.clone.Inline.panic-unwind.diff index 9897ed78edf..00e92a0f5e5 100644 --- a/tests/mir-opt/inline/inline_shims.clone.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/inline_shims.clone.Inline.panic-unwind.diff @@ -11,7 +11,7 @@ bb0: { StorageLive(_2); _2 = &_1; -- _0 = <fn(A, B) as Clone>::clone(move _2) -> bb1; +- _0 = <fn(A, B) as Clone>::clone(move _2) -> [return: bb1, unwind continue]; - } - - bb1: { diff --git a/tests/mir-opt/inline/inline_shims.drop.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_shims.drop.Inline.panic-unwind.diff index 1d24756e1d2..4270ae00b66 100644 --- a/tests/mir-opt/inline/inline_shims.drop.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/inline_shims.drop.Inline.panic-unwind.diff @@ -21,7 +21,7 @@ StorageLive(_3); StorageLive(_4); _4 = _1; - _3 = std::ptr::drop_in_place::<Vec<A>>(move _4) -> bb1; + _3 = std::ptr::drop_in_place::<Vec<A>>(move _4) -> [return: bb1, unwind continue]; } bb1: { @@ -29,7 +29,7 @@ StorageDead(_3); StorageLive(_5); _5 = _2; -- _0 = std::ptr::drop_in_place::<Option<B>>(move _5) -> bb2; +- _0 = std::ptr::drop_in_place::<Option<B>>(move _5) -> [return: bb2, unwind continue]; + StorageLive(_6); + StorageLive(_7); + _6 = discriminant((*_5)); @@ -44,7 +44,7 @@ + } + + bb3: { -+ drop((((*_5) as Some).0: B)) -> bb2; ++ drop((((*_5) as Some).0: B)) -> [return: bb2, unwind continue]; } } diff --git a/tests/mir-opt/inline/inline_specialization.main.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_specialization.main.Inline.panic-unwind.diff index 0f7b1909f8d..bc841101df7 100644 --- a/tests/mir-opt/inline/inline_specialization.main.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/inline_specialization.main.Inline.panic-unwind.diff @@ -12,7 +12,7 @@ bb0: { StorageLive(_1); -- _1 = <Vec<()> as Foo>::bar() -> bb1; +- _1 = <Vec<()> as Foo>::bar() -> [return: bb1, unwind continue]; - } - - bb1: { diff --git a/tests/mir-opt/inline/inline_trait_method.test.Inline.after.panic-unwind.mir b/tests/mir-opt/inline/inline_trait_method.test.Inline.after.panic-unwind.mir index 9550fdea192..da18a5adc37 100644 --- a/tests/mir-opt/inline/inline_trait_method.test.Inline.after.panic-unwind.mir +++ b/tests/mir-opt/inline/inline_trait_method.test.Inline.after.panic-unwind.mir @@ -8,7 +8,7 @@ fn test(_1: &dyn X) -> u32 { bb0: { StorageLive(_2); _2 = &(*_1); - _0 = <dyn X as X>::y(move _2) -> bb1; + _0 = <dyn X as X>::y(move _2) -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/inline/inline_trait_method_2.test2.Inline.after.panic-unwind.mir b/tests/mir-opt/inline/inline_trait_method_2.test2.Inline.after.panic-unwind.mir index ffc16bfe670..5d4979680a4 100644 --- a/tests/mir-opt/inline/inline_trait_method_2.test2.Inline.after.panic-unwind.mir +++ b/tests/mir-opt/inline/inline_trait_method_2.test2.Inline.after.panic-unwind.mir @@ -15,7 +15,7 @@ fn test2(_1: &dyn X) -> bool { _3 = &(*_1); _2 = move _3 as &dyn X (Pointer(Unsize)); StorageDead(_3); - _0 = <dyn X as X>::y(_2) -> bb1; + _0 = <dyn X as X>::y(_2) -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/inline/issue_106141.outer.Inline.panic-unwind.diff b/tests/mir-opt/inline/issue_106141.outer.Inline.panic-unwind.diff index 1e407f07d09..16a19f4a356 100644 --- a/tests/mir-opt/inline/issue_106141.outer.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/issue_106141.outer.Inline.panic-unwind.diff @@ -16,16 +16,16 @@ + } bb0: { -- _0 = inner() -> bb1; +- _0 = inner() -> [return: bb1, unwind continue]; + StorageLive(_1); + _1 = const _; -+ _0 = index() -> bb1; ++ _0 = index() -> [return: bb1, unwind continue]; } bb1: { + StorageLive(_3); + _2 = Lt(_0, const 1_usize); -+ assert(move _2, "index out of bounds: the length is {} but the index is {}", const 1_usize, _0) -> bb2; ++ assert(move _2, "index out of bounds: the length is {} but the index is {}", const 1_usize, _0) -> [success: bb2, unwind continue]; + } + + bb2: { 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 577fc8bee66..d71b5c4a626 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 @@ -20,7 +20,7 @@ _3 = _1; StorageLive(_4); _4 = _2; -- _0 = core::num::<impl u64>::unchecked_shl(move _3, move _4) -> bb1; +- _0 = core::num::<impl u64>::unchecked_shl(move _3, move _4) -> [return: bb1, unwind continue]; - } - - bb1: { 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 ba159c063b3..cae25759cd8 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 @@ -22,7 +22,7 @@ _3 = _1; StorageLive(_4); _4 = _2; -- _0 = core::num::<impl u16>::unchecked_shl(move _3, move _4) -> bb1; +- _0 = core::num::<impl u16>::unchecked_shl(move _3, move _4) -> [return: bb1, unwind continue]; - } - - bb1: { 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 d7ff104b92e..6aafb61dc55 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 @@ -20,7 +20,7 @@ _3 = _1; StorageLive(_4); _4 = _2; -- _0 = core::num::<impl i64>::unchecked_shr(move _3, move _4) -> bb1; +- _0 = core::num::<impl i64>::unchecked_shr(move _3, move _4) -> [return: bb1, unwind continue]; - } - - bb1: { 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 3d398e00fc8..fe533121486 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 @@ -22,7 +22,7 @@ _3 = _1; StorageLive(_4); _4 = _2; -- _0 = core::num::<impl i16>::unchecked_shr(move _3, move _4) -> bb1; +- _0 = core::num::<impl i16>::unchecked_shr(move _3, move _4) -> [return: bb1, unwind continue]; - } - - bb1: { diff --git a/tests/mir-opt/issue_101973.inner.ConstProp.panic-unwind.diff b/tests/mir-opt/issue_101973.inner.ConstProp.panic-unwind.diff index fbfb8f1fd4e..a6bd29e1c9d 100644 --- a/tests/mir-opt/issue_101973.inner.ConstProp.panic-unwind.diff +++ b/tests/mir-opt/issue_101973.inner.ConstProp.panic-unwind.diff @@ -45,10 +45,10 @@ StorageLive(_8); - _10 = const 8_i32 as u32 (IntToInt); - _11 = Lt(move _10, const 32_u32); -- assert(move _11, "attempt to shift right by `{}`, which would overflow", const 8_i32) -> bb1; +- assert(move _11, "attempt to shift right by `{}`, which would overflow", const 8_i32) -> [success: bb1, unwind continue]; + _10 = const 8_u32; + _11 = const true; -+ assert(const true, "attempt to shift right by `{}`, which would overflow", const 8_i32) -> bb1; ++ assert(const true, "attempt to shift right by `{}`, which would overflow", const 8_i32) -> [success: bb1, unwind continue]; } bb1: { @@ -57,10 +57,10 @@ StorageDead(_8); - _12 = const 1_i32 as u32 (IntToInt); - _13 = Lt(move _12, const 32_u32); -- assert(move _13, "attempt to shift left by `{}`, which would overflow", const 1_i32) -> bb2; +- assert(move _13, "attempt to shift left by `{}`, which would overflow", const 1_i32) -> [success: bb2, unwind continue]; + _12 = const 1_u32; + _13 = const true; -+ assert(const true, "attempt to shift left by `{}`, which would overflow", const 1_i32) -> bb2; ++ assert(const true, "attempt to shift left by `{}`, which would overflow", const 1_i32) -> [success: bb2, unwind continue]; } bb2: { diff --git a/tests/mir-opt/issue_104451_unwindable_intrinsics.main.AbortUnwindingCalls.after.panic-unwind.mir b/tests/mir-opt/issue_104451_unwindable_intrinsics.main.AbortUnwindingCalls.after.panic-unwind.mir index 8ffd46311dc..1851747f0a6 100644 --- a/tests/mir-opt/issue_104451_unwindable_intrinsics.main.AbortUnwindingCalls.after.panic-unwind.mir +++ b/tests/mir-opt/issue_104451_unwindable_intrinsics.main.AbortUnwindingCalls.after.panic-unwind.mir @@ -11,6 +11,6 @@ fn main() -> () { StorageLive(_1); StorageLive(_2); _2 = (); - _1 = const_eval_select::<(), fn() -> ! {ow_ct}, fn() -> ! {ow_ct}, !>(move _2, ow_ct, ow_ct); + _1 = const_eval_select::<(), fn() -> ! {ow_ct}, fn() -> ! {ow_ct}, !>(move _2, ow_ct, ow_ct) -> unwind continue; } } diff --git a/tests/mir-opt/issue_41110.test.ElaborateDrops.panic-unwind.diff b/tests/mir-opt/issue_41110.test.ElaborateDrops.panic-unwind.diff index b33d8fc52b4..254658c810d 100644 --- a/tests/mir-opt/issue_41110.test.ElaborateDrops.panic-unwind.diff +++ b/tests/mir-opt/issue_41110.test.ElaborateDrops.panic-unwind.diff @@ -58,7 +58,7 @@ bb5: { StorageDead(_2); -- drop(_1) -> bb6; +- drop(_1) -> [return: bb6, unwind continue]; + goto -> bb6; } diff --git a/tests/mir-opt/issue_41888.main.ElaborateDrops.panic-unwind.diff b/tests/mir-opt/issue_41888.main.ElaborateDrops.panic-unwind.diff index 04071c72555..4ef3650cdea 100644 --- a/tests/mir-opt/issue_41888.main.ElaborateDrops.panic-unwind.diff +++ b/tests/mir-opt/issue_41888.main.ElaborateDrops.panic-unwind.diff @@ -85,7 +85,7 @@ bb9: { StorageDead(_2); -- drop(_1) -> bb10; +- drop(_1) -> [return: bb10, unwind continue]; + goto -> bb19; } diff --git a/tests/mir-opt/issue_62289.test.ElaborateDrops.before.panic-unwind.mir b/tests/mir-opt/issue_62289.test.ElaborateDrops.before.panic-unwind.mir index 4bbfe47299c..7ecdc428e59 100644 --- a/tests/mir-opt/issue_62289.test.ElaborateDrops.before.panic-unwind.mir +++ b/tests/mir-opt/issue_62289.test.ElaborateDrops.before.panic-unwind.mir @@ -31,7 +31,7 @@ fn test() -> Option<Box<u32>> { StorageLive(_1); _2 = SizeOf(u32); _3 = AlignOf(u32); - _4 = alloc::alloc::exchange_malloc(move _2, move _3) -> bb1; + _4 = alloc::alloc::exchange_malloc(move _2, move _3) -> [return: bb1, unwind continue]; } bb1: { @@ -73,13 +73,13 @@ fn test() -> Option<Box<u32>> { bb6: { StorageDead(_11); StorageDead(_9); - drop(_5) -> bb9; + drop(_5) -> [return: bb9, unwind continue]; } bb7: { StorageDead(_5); _0 = Option::<Box<u32>>::Some(move _1); - drop(_1) -> bb8; + drop(_1) -> [return: bb8, unwind continue]; } bb8: { diff --git a/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-unwind.diff b/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-unwind.diff index 761673ca546..25df839c2db 100644 --- a/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-unwind.diff +++ b/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-unwind.diff @@ -42,7 +42,7 @@ } bb1: { - _15 = core::panicking::panic(const "internal error: entered unreachable code"); + _15 = core::panicking::panic(const "internal error: entered unreachable code") -> unwind continue; } bb2: { diff --git a/tests/mir-opt/issue_99325.main.built.after.mir b/tests/mir-opt/issue_99325.main.built.after.mir index d8a88a0635c..0fe66d3fb70 100644 --- a/tests/mir-opt/issue_99325.main.built.after.mir +++ b/tests/mir-opt/issue_99325.main.built.after.mir @@ -2,7 +2,7 @@ | User Type Annotations | 0: user_ty: Canonical { value: TypeOf(DefId(0:3 ~ issue_99325[22bb]::function_with_bytes), UserSubsts { substs: [Const { ty: &'static [u8; 4], kind: Branch([Leaf(0x41), Leaf(0x41), Leaf(0x41), Leaf(0x41)]) }], user_self_ty: None }), max_universe: U0, variables: [] }, span: $DIR/issue_99325.rs:10:16: 10:46, inferred_ty: fn() -> &'static [u8] {function_with_bytes::<&*b"AAAA">} -| 1: user_ty: Canonical { value: TypeOf(DefId(0:3 ~ issue_99325[22bb]::function_with_bytes), UserSubsts { substs: [Const { ty: &'static [u8; 4], kind: Unevaluated([], DefId(0:8 ~ issue_99325[22bb]::main::{constant#1})) }], user_self_ty: None }), max_universe: U0, variables: [] }, span: $DIR/issue_99325.rs:11:16: 11:68, inferred_ty: fn() -> &'static [u8] {function_with_bytes::<&*b"AAAA">} +| 1: user_ty: Canonical { value: TypeOf(DefId(0:3 ~ issue_99325[22bb]::function_with_bytes), UserSubsts { substs: [Const { ty: &'static [u8; 4], kind: UnevaluatedConst { def: DefId(0:8 ~ issue_99325[22bb]::main::{constant#1}), substs: [] } }], user_self_ty: None }), max_universe: U0, variables: [] }, span: $DIR/issue_99325.rs:11:16: 11:68, inferred_ty: fn() -> &'static [u8] {function_with_bytes::<&*b"AAAA">} | fn main() -> () { let mut _0: (); diff --git a/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.panic-unwind.mir index e7c1be7e6e6..43a1a1eed20 100644 --- a/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.panic-unwind.mir @@ -26,7 +26,7 @@ fn num_to_digit(_1: char) -> u32 { bb0: { StorageLive(_3); StorageLive(_2); - _2 = char::methods::<impl char>::to_digit(_1, const 8_u32) -> bb1; + _2 = char::methods::<impl char>::to_digit(_1, const 8_u32) -> [return: bb1, unwind continue]; } bb1: { @@ -39,7 +39,7 @@ fn num_to_digit(_1: char) -> u32 { bb2: { StorageLive(_5); - _5 = char::methods::<impl char>::to_digit(_1, const 8_u32) -> bb3; + _5 = char::methods::<impl char>::to_digit(_1, const 8_u32) -> [return: bb3, unwind continue]; } bb3: { @@ -48,7 +48,7 @@ fn num_to_digit(_1: char) -> u32 { } bb4: { - _7 = core::panicking::panic(const "called `Option::unwrap()` on a `None` value"); + _7 = core::panicking::panic(const "called `Option::unwrap()` on a `None` value") -> unwind continue; } bb5: { diff --git a/tests/mir-opt/lower_array_len.array_bound.NormalizeArrayLen.panic-unwind.diff b/tests/mir-opt/lower_array_len.array_bound.NormalizeArrayLen.panic-unwind.diff index 35a1e51a3ac..1cba0f27afa 100644 --- a/tests/mir-opt/lower_array_len.array_bound.NormalizeArrayLen.panic-unwind.diff +++ b/tests/mir-opt/lower_array_len.array_bound.NormalizeArrayLen.panic-unwind.diff @@ -42,7 +42,7 @@ _8 = _1; _9 = Len((*_2)); _10 = Lt(_8, _9); - assert(move _10, "index out of bounds: the length is {} but the index is {}", move _9, _8) -> bb3; + assert(move _10, "index out of bounds: the length is {} but the index is {}", move _9, _8) -> [success: bb3, unwind continue]; } bb3: { diff --git a/tests/mir-opt/lower_array_len.array_bound_mut.NormalizeArrayLen.panic-unwind.diff b/tests/mir-opt/lower_array_len.array_bound_mut.NormalizeArrayLen.panic-unwind.diff index 3c6f3734624..6c450067cc4 100644 --- a/tests/mir-opt/lower_array_len.array_bound_mut.NormalizeArrayLen.panic-unwind.diff +++ b/tests/mir-opt/lower_array_len.array_bound_mut.NormalizeArrayLen.panic-unwind.diff @@ -45,7 +45,7 @@ _8 = _1; _9 = Len((*_2)); _10 = Lt(_8, _9); - assert(move _10, "index out of bounds: the length is {} but the index is {}", move _9, _8) -> bb3; + assert(move _10, "index out of bounds: the length is {} but the index is {}", move _9, _8) -> [success: bb3, unwind continue]; } bb3: { @@ -59,7 +59,7 @@ _11 = const 0_usize; _12 = Len((*_2)); _13 = Lt(_11, _12); - assert(move _13, "index out of bounds: the length is {} but the index is {}", move _12, _11) -> bb5; + assert(move _13, "index out of bounds: the length is {} but the index is {}", move _12, _11) -> [success: bb5, unwind continue]; } bb5: { diff --git a/tests/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.panic-unwind.diff b/tests/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.panic-unwind.diff index d90f3dddf58..310b3b26ac5 100644 --- a/tests/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.panic-unwind.diff +++ b/tests/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.panic-unwind.diff @@ -20,7 +20,7 @@ StorageLive(_5); StorageLive(_6); _6 = &(*_2); -- _5 = core::slice::<impl [u8]>::len(move _6) -> bb1; +- _5 = core::slice::<impl [u8]>::len(move _6) -> [return: bb1, unwind continue]; + _5 = Len((*_6)); + goto -> bb1; } @@ -38,7 +38,7 @@ _7 = _1; _8 = Len((*_2)); _9 = Lt(_7, _8); - assert(move _9, "index out of bounds: the length is {} but the index is {}", move _8, _7) -> bb3; + assert(move _9, "index out of bounds: the length is {} but the index is {}", move _8, _7) -> [success: bb3, unwind continue]; } bb3: { diff --git a/tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.panic-unwind.mir b/tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.panic-unwind.mir index 568ad441cbc..6fb107929e6 100644 --- a/tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.panic-unwind.mir +++ b/tests/mir-opt/no_spurious_drop_after_call.main.ElaborateDrops.before.panic-unwind.mir @@ -14,7 +14,7 @@ fn main() -> () { StorageLive(_4); _4 = const ""; _3 = &(*_4); - _2 = <str as ToString>::to_string(move _3) -> bb1; + _2 = <str as ToString>::to_string(move _3) -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/nrvo_simple.nrvo.RenameReturnPlace.panic-unwind.diff b/tests/mir-opt/nrvo_simple.nrvo.RenameReturnPlace.panic-unwind.diff index b17675ec1ed..3df8e567f1f 100644 --- a/tests/mir-opt/nrvo_simple.nrvo.RenameReturnPlace.panic-unwind.diff +++ b/tests/mir-opt/nrvo_simple.nrvo.RenameReturnPlace.panic-unwind.diff @@ -26,7 +26,7 @@ - _6 = &mut _2; + _6 = &mut _0; _5 = &mut (*_6); - _3 = move _4(move _5) -> bb1; + _3 = move _4(move _5) -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.mir index 46c078cea0d..98c267e8e71 100644 --- a/tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.mir @@ -31,7 +31,7 @@ fn step_forward(_1: u32, _2: usize) -> u32 { StorageLive(_7); StorageLive(_4); StorageLive(_3); - _3 = <u32 as Step>::forward_checked(_1, _2) -> bb1; + _3 = <u32 as Step>::forward_checked(_1, _2) -> [return: bb1, unwind continue]; } bb1: { @@ -47,7 +47,7 @@ fn step_forward(_1: u32, _2: usize) -> u32 { } bb2: { - assert(!const true, "attempt to compute `{} + {}`, which would overflow", const _, const 1_u32) -> bb3; + assert(!const true, "attempt to compute `{} + {}`, which would overflow", const _, const 1_u32) -> [success: bb3, unwind continue]; } bb3: { diff --git a/tests/mir-opt/pre-codegen/loops.filter_mapped.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/loops.filter_mapped.PreCodegen.after.mir index b8b2d91adb6..3b49cb711b7 100644 --- a/tests/mir-opt/pre-codegen/loops.filter_mapped.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/loops.filter_mapped.PreCodegen.after.mir @@ -30,7 +30,7 @@ fn filter_mapped(_1: impl Iterator<Item = T>, _2: impl Fn(T) -> Option<U>) -> () bb0: { StorageLive(_4); StorageLive(_3); - _3 = <impl Iterator<Item = T> as Iterator>::filter_map::<U, impl Fn(T) -> Option<U>>(move _1, move _2) -> bb1; + _3 = <impl Iterator<Item = T> as Iterator>::filter_map::<U, impl Fn(T) -> Option<U>>(move _1, move _2) -> [return: bb1, unwind continue]; } bb1: { @@ -60,7 +60,7 @@ fn filter_mapped(_1: impl Iterator<Item = T>, _2: impl Fn(T) -> Option<U>) -> () bb4: { StorageDead(_9); - drop(_5) -> bb5; + drop(_5) -> [return: bb5, unwind continue]; } bb5: { diff --git a/tests/mir-opt/pre-codegen/loops.int_range.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/loops.int_range.PreCodegen.after.mir index 609555c8c43..40bb3a37c58 100644 --- a/tests/mir-opt/pre-codegen/loops.int_range.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/loops.int_range.PreCodegen.after.mir @@ -79,7 +79,7 @@ fn int_range(_1: usize, _2: usize) -> () { bb3: { _12 = ((*_5).0: usize); StorageLive(_13); - _13 = <usize as Step>::forward_unchecked(_12, const 1_usize) -> bb4; + _13 = <usize as Step>::forward_unchecked(_12, const 1_usize) -> [return: bb4, unwind continue]; } bb4: { @@ -104,7 +104,7 @@ fn int_range(_1: usize, _2: usize) -> () { bb7: { _15 = ((_11 as Some).0: usize); - _16 = opaque::<usize>(_15) -> bb8; + _16 = opaque::<usize>(_15) -> [return: bb8, unwind continue]; } bb8: { diff --git a/tests/mir-opt/pre-codegen/loops.mapped.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/loops.mapped.PreCodegen.after.mir index f756f34b7d6..e4e1d052e73 100644 --- a/tests/mir-opt/pre-codegen/loops.mapped.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/loops.mapped.PreCodegen.after.mir @@ -25,7 +25,7 @@ fn mapped(_1: impl Iterator<Item = T>, _2: impl Fn(T) -> U) -> () { bb0: { StorageLive(_4); StorageLive(_3); - _3 = <impl Iterator<Item = T> as Iterator>::map::<U, impl Fn(T) -> U>(move _1, move _2) -> bb1; + _3 = <impl Iterator<Item = T> as Iterator>::map::<U, impl Fn(T) -> U>(move _1, move _2) -> [return: bb1, unwind continue]; } bb1: { @@ -49,7 +49,7 @@ fn mapped(_1: impl Iterator<Item = T>, _2: impl Fn(T) -> U) -> () { bb4: { StorageDead(_7); - drop(_5) -> bb5; + drop(_5) -> [return: bb5, unwind continue]; } bb5: { diff --git a/tests/mir-opt/pre-codegen/loops.vec_move.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/loops.vec_move.PreCodegen.after.mir index 604cb773da5..1b5f2a0884b 100644 --- a/tests/mir-opt/pre-codegen/loops.vec_move.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/loops.vec_move.PreCodegen.after.mir @@ -19,7 +19,7 @@ fn vec_move(_1: Vec<impl Sized>) -> () { bb0: { StorageLive(_2); - _2 = <Vec<impl Sized> as IntoIterator>::into_iter(move _1) -> bb1; + _2 = <Vec<impl Sized> as IntoIterator>::into_iter(move _1) -> [return: bb1, unwind continue]; } bb1: { @@ -41,7 +41,7 @@ fn vec_move(_1: Vec<impl Sized>) -> () { bb4: { StorageDead(_5); - drop(_3) -> bb5; + drop(_3) -> [return: bb5, unwind continue]; } bb5: { diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.panic-unwind.diff b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.panic-unwind.diff index a57ce86bc25..b6929f3f93c 100644 --- a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.panic-unwind.diff +++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.panic-unwind.diff @@ -25,9 +25,9 @@ bb0: { StorageLive(_1); - _2 = CheckedAdd(const 2_i32, const 2_i32); -- assert(!move (_2.1: bool), "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> bb1; +- assert(!move (_2.1: bool), "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> [success: bb1, unwind continue]; + _2 = const (4_i32, false); -+ assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> bb1; ++ assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> [success: bb1, unwind continue]; } bb1: { @@ -40,9 +40,9 @@ _5 = const 3_usize; _6 = const 6_usize; - _7 = Lt(_5, _6); -- assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, _5) -> bb2; +- assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, _5) -> [success: bb2, unwind continue]; + _7 = const true; -+ assert(const true, "index out of bounds: the length is {} but the index is {}", const 6_usize, const 3_usize) -> bb2; ++ assert(const true, "index out of bounds: the length is {} but the index is {}", const 6_usize, const 3_usize) -> [success: bb2, unwind continue]; } bb2: { diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.panic-unwind.diff b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.panic-unwind.diff index a57ce86bc25..b6929f3f93c 100644 --- a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.panic-unwind.diff +++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.panic-unwind.diff @@ -25,9 +25,9 @@ bb0: { StorageLive(_1); - _2 = CheckedAdd(const 2_i32, const 2_i32); -- assert(!move (_2.1: bool), "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> bb1; +- assert(!move (_2.1: bool), "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> [success: bb1, unwind continue]; + _2 = const (4_i32, false); -+ assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> bb1; ++ assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> [success: bb1, unwind continue]; } bb1: { @@ -40,9 +40,9 @@ _5 = const 3_usize; _6 = const 6_usize; - _7 = Lt(_5, _6); -- assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, _5) -> bb2; +- assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, _5) -> [success: bb2, unwind continue]; + _7 = const true; -+ assert(const true, "index out of bounds: the length is {} but the index is {}", const 6_usize, const 3_usize) -> bb2; ++ assert(const true, "index out of bounds: the length is {} but the index is {}", const 6_usize, const 3_usize) -> [success: bb2, unwind continue]; } bb2: { diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.32bit.panic-unwind.diff b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.32bit.panic-unwind.diff index 1a5617c7639..e987969d313 100644 --- a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.32bit.panic-unwind.diff +++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.32bit.panic-unwind.diff @@ -27,7 +27,7 @@ bb0: { StorageLive(_1); _2 = CheckedAdd(const 2_i32, const 2_i32); - assert(!move (_2.1: bool), "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> bb1; + assert(!move (_2.1: bool), "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> [success: bb1, unwind continue]; } bb1: { @@ -39,7 +39,7 @@ _5 = const 3_usize; _6 = Len(_4); _7 = Lt(_5, _6); - assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, _5) -> bb2; + assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, _5) -> [success: bb2, unwind continue]; } bb2: { diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.64bit.panic-unwind.diff b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.64bit.panic-unwind.diff index 1a5617c7639..e987969d313 100644 --- a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.64bit.panic-unwind.diff +++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.64bit.panic-unwind.diff @@ -27,7 +27,7 @@ bb0: { StorageLive(_1); _2 = CheckedAdd(const 2_i32, const 2_i32); - assert(!move (_2.1: bool), "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> bb1; + assert(!move (_2.1: bool), "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> [success: bb1, unwind continue]; } bb1: { @@ -39,7 +39,7 @@ _5 = const 3_usize; _6 = Len(_4); _7 = Lt(_5, _6); - assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, _5) -> bb2; + assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, _5) -> [success: bb2, unwind continue]; } bb2: { diff --git a/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-unwind.mir index cf98f2022c5..fbe16dc3cd4 100644 --- a/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-unwind.mir @@ -102,7 +102,7 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () { bb6: { StorageDead(_12); StorageDead(_5); - drop(_3) -> bb7; + drop(_3) -> [return: bb7, unwind continue]; } bb7: { diff --git a/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.panic-unwind.mir index a7525b8b9a8..04d6da1d9bd 100644 --- a/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.panic-unwind.mir @@ -52,7 +52,7 @@ fn inclusive_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () { bb3: { StorageDead(_7); StorageDead(_5); - drop(_3) -> bb4; + drop(_3) -> [return: bb4, unwind continue]; } bb4: { diff --git a/tests/mir-opt/pre-codegen/range_iter.range_inclusive_iter_next.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/range_iter.range_inclusive_iter_next.PreCodegen.after.panic-unwind.mir index af775b454a7..fd565fe75ec 100644 --- a/tests/mir-opt/pre-codegen/range_iter.range_inclusive_iter_next.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/range_iter.range_inclusive_iter_next.PreCodegen.after.panic-unwind.mir @@ -8,7 +8,7 @@ fn range_inclusive_iter_next(_1: &mut RangeInclusive<u32>) -> Option<u32> { } bb0: { - _0 = <RangeInclusive<u32> as iter::range::RangeInclusiveIteratorImpl>::spec_next(_1) -> bb1; + _0 = <RangeInclusive<u32> as iter::range::RangeInclusiveIteratorImpl>::spec_next(_1) -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-unwind.mir index 33752e970d1..65870f693c0 100644 --- a/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-unwind.mir @@ -53,7 +53,7 @@ fn range_iter_next(_1: &mut std::ops::Range<u32>) -> Option<u32> { bb2: { _7 = ((*_1).0: u32); StorageLive(_8); - _8 = <u32 as Step>::forward_unchecked(_7, const 1_usize) -> bb3; + _8 = <u32 as Step>::forward_unchecked(_7, const 1_usize) -> [return: bb3, unwind continue]; } bb3: { diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.panic-unwind.mir index 9f7fca639f7..a6b931d2c24 100644 --- a/tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.panic-unwind.mir @@ -12,7 +12,7 @@ fn slice_index_range(_1: &[u32], _2: std::ops::Range<usize>) -> &[u32] { bb0: { StorageLive(_3); - _3 = <std::ops::Range<usize> as SliceIndex<[u32]>>::index(move _2, _1) -> bb1; + _3 = <std::ops::Range<usize> as SliceIndex<[u32]>>::index(move _2, _1) -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_index_usize.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_index.slice_index_usize.PreCodegen.after.panic-unwind.mir index 13bd84f9596..d576520a8d5 100644 --- a/tests/mir-opt/pre-codegen/slice_index.slice_index_usize.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/slice_index.slice_index_usize.PreCodegen.after.panic-unwind.mir @@ -10,7 +10,7 @@ fn slice_index_usize(_1: &[u32], _2: usize) -> u32 { bb0: { _3 = Len((*_1)); _4 = Lt(_2, _3); - assert(move _4, "index out of bounds: the length is {} but the index is {}", move _3, _2) -> bb1; + assert(move _4, "index out of bounds: the length is {} but the index is {}", move _3, _2) -> [success: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-unwind.mir index 71162df4bd0..8294a5cb6dc 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-unwind.mir @@ -164,7 +164,7 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { bb6: { StorageDead(_17); StorageDead(_15); - drop(_2) -> bb7; + drop(_2) -> [return: bb7, unwind continue]; } bb7: { diff --git a/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-unwind.mir index 08d829d52cc..ff40e450968 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-unwind.mir @@ -152,7 +152,7 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () { bb6: { StorageDead(_16); StorageDead(_14); - drop(_2) -> bb7; + drop(_2) -> [return: bb7, unwind continue]; } bb7: { diff --git a/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-unwind.mir index 5ce8143d98b..3423c5d865d 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-unwind.mir @@ -111,7 +111,7 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { bb6: { StorageDead(_12); StorageDead(_5); - drop(_2) -> bb7; + drop(_2) -> [return: bb7, unwind continue]; } bb7: { diff --git a/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-unwind.mir index 14ca6004dfe..b40d9209d25 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-unwind.mir @@ -169,7 +169,7 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { bb6: { StorageDead(_18); StorageDead(_15); - drop(_2) -> bb7; + drop(_2) -> [return: bb7, unwind continue]; } bb7: { diff --git a/tests/mir-opt/pre-codegen/slice_iter.slice_iter_mut_next_back.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_mut_next_back.PreCodegen.after.panic-unwind.mir index f9253a321f9..386f3a9edcd 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.slice_iter_mut_next_back.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_mut_next_back.PreCodegen.after.panic-unwind.mir @@ -5,7 +5,7 @@ fn slice_iter_mut_next_back(_1: &mut std::slice::IterMut<'_, T>) -> Option<&mut let mut _0: std::option::Option<&mut T>; bb0: { - _0 = <std::slice::IterMut<'_, T> as DoubleEndedIterator>::next_back(_1) -> bb1; + _0 = <std::slice::IterMut<'_, T> as DoubleEndedIterator>::next_back(_1) -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/pre-codegen/slice_iter.slice_iter_next.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_next.PreCodegen.after.panic-unwind.mir index 207fc8c752f..e76ec00391c 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.slice_iter_next.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_next.PreCodegen.after.panic-unwind.mir @@ -5,7 +5,7 @@ fn slice_iter_next(_1: &mut std::slice::Iter<'_, T>) -> Option<&T> { let mut _0: std::option::Option<&T>; bb0: { - _0 = <std::slice::Iter<'_, T> as Iterator>::next(_1) -> bb1; + _0 = <std::slice::Iter<'_, T> as Iterator>::next(_1) -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-unwind.mir index 52e85809735..1e20b1be56b 100644 --- a/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-unwind.mir @@ -7,7 +7,7 @@ fn outer(_1: u8) -> u8 { bb0: { _2 = &_1; // scope 0 at $DIR/spans.rs:11:11: 11:13 - _0 = inner(_2) -> bb1; // scope 0 at $DIR/spans.rs:11:5: 11:14 + _0 = inner(_2) -> [return: bb1, unwind continue]; // scope 0 at $DIR/spans.rs:11:5: 11:14 // mir::Constant // + span: $DIR/spans.rs:11:5: 11:10 // + literal: Const { ty: for<'a> fn(&'a u8) -> u8 {inner}, val: Value(<ZST>) } diff --git a/tests/mir-opt/reference_prop.debuginfo.ReferencePropagation.diff b/tests/mir-opt/reference_prop.debuginfo.ReferencePropagation.diff index 6732f8b4bb3..132f66a1ad3 100644 --- a/tests/mir-opt/reference_prop.debuginfo.ReferencePropagation.diff +++ b/tests/mir-opt/reference_prop.debuginfo.ReferencePropagation.diff @@ -104,7 +104,7 @@ _13 = &(*_26); StorageLive(_15); _15 = RangeFull; - _12 = <[i32; 10] as Index<RangeFull>>::index(move _13, move _15) -> bb5; + _12 = <[i32; 10] as Index<RangeFull>>::index(move _13, move _15) -> [return: bb5, unwind continue]; } bb5: { diff --git a/tests/mir-opt/reference_prop.dominate_storage.ReferencePropagation.diff b/tests/mir-opt/reference_prop.dominate_storage.ReferencePropagation.diff index 3baa565f03e..012efa9693e 100644 --- a/tests/mir-opt/reference_prop.dominate_storage.ReferencePropagation.diff +++ b/tests/mir-opt/reference_prop.dominate_storage.ReferencePropagation.diff @@ -22,7 +22,7 @@ bb2: { _5 = (*_2); - _0 = opaque::<i32>(_5) -> bb3; + _0 = opaque::<i32>(_5) -> [return: bb3, unwind continue]; } bb3: { diff --git a/tests/mir-opt/reference_prop.maybe_dead.ReferencePropagation.diff b/tests/mir-opt/reference_prop.maybe_dead.ReferencePropagation.diff index 9ceb5a7634d..c6bd6c21210 100644 --- a/tests/mir-opt/reference_prop.maybe_dead.ReferencePropagation.diff +++ b/tests/mir-opt/reference_prop.maybe_dead.ReferencePropagation.diff @@ -27,17 +27,17 @@ bb1: { StorageDead(_2); StorageDead(_3); - _0 = opaque::<i32>(_6) -> bb2; + _0 = opaque::<i32>(_6) -> [return: bb2, unwind continue]; } bb2: { _7 = (*_4); - _0 = opaque::<i32>(_7) -> bb3; + _0 = opaque::<i32>(_7) -> [return: bb3, unwind continue]; } bb3: { _8 = (*_5); - _0 = opaque::<i32>(_8) -> bb4; + _0 = opaque::<i32>(_8) -> [return: bb4, unwind continue]; } bb4: { diff --git a/tests/mir-opt/reference_prop.multiple_storage.ReferencePropagation.diff b/tests/mir-opt/reference_prop.multiple_storage.ReferencePropagation.diff index 03add126545..0fd74155aa3 100644 --- a/tests/mir-opt/reference_prop.multiple_storage.ReferencePropagation.diff +++ b/tests/mir-opt/reference_prop.multiple_storage.ReferencePropagation.diff @@ -14,7 +14,7 @@ StorageDead(_1); StorageLive(_1); _3 = (*_2); - _0 = opaque::<i32>(_3) -> bb1; + _0 = opaque::<i32>(_3) -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/reference_prop.reference_propagation.ReferencePropagation.diff b/tests/mir-opt/reference_prop.reference_propagation.ReferencePropagation.diff index 43292dd7249..f1f77cffd20 100644 --- a/tests/mir-opt/reference_prop.reference_propagation.ReferencePropagation.diff +++ b/tests/mir-opt/reference_prop.reference_propagation.ReferencePropagation.diff @@ -201,7 +201,7 @@ StorageLive(_7); StorageLive(_8); _8 = (); - _7 = opaque::<()>(move _8) -> bb1; + _7 = opaque::<()>(move _8) -> [return: bb1, unwind continue]; } bb1: { @@ -232,7 +232,7 @@ StorageLive(_16); StorageLive(_17); _17 = (); - _16 = opaque::<()>(move _17) -> bb2; + _16 = opaque::<()>(move _17) -> [return: bb2, unwind continue]; } bb2: { @@ -256,7 +256,7 @@ StorageLive(_23); StorageLive(_24); _24 = _21; - _23 = opaque::<&&usize>(move _24) -> bb3; + _23 = opaque::<&&usize>(move _24) -> [return: bb3, unwind continue]; } bb3: { @@ -280,7 +280,7 @@ StorageLive(_30); StorageLive(_31); _31 = _28; - _30 = opaque::<*mut &usize>(move _31) -> bb4; + _30 = opaque::<*mut &usize>(move _31) -> [return: bb4, unwind continue]; } bb4: { @@ -303,7 +303,7 @@ StorageLive(_36); StorageLive(_37); _37 = _34; - _36 = opaque::<&usize>(move _37) -> bb5; + _36 = opaque::<&usize>(move _37) -> [return: bb5, unwind continue]; } bb5: { @@ -332,7 +332,7 @@ StorageLive(_45); StorageLive(_46); _46 = _44; - _45 = opaque::<&usize>(move _46) -> bb6; + _45 = opaque::<&usize>(move _46) -> [return: bb6, unwind continue]; } bb6: { @@ -355,7 +355,7 @@ StorageLive(_50); StorageLive(_51); _51 = (); - _50 = opaque::<()>(move _51) -> bb7; + _50 = opaque::<()>(move _51) -> [return: bb7, unwind continue]; } bb7: { @@ -381,7 +381,7 @@ StorageLive(_57); StorageLive(_58); _58 = (); - _57 = opaque::<()>(move _58) -> bb8; + _57 = opaque::<()>(move _58) -> [return: bb8, unwind continue]; } bb8: { @@ -404,7 +404,7 @@ StorageLive(_64); StorageLive(_65); _65 = (); - _64 = opaque::<()>(move _65) -> bb9; + _64 = opaque::<()>(move _65) -> [return: bb9, unwind continue]; } bb9: { @@ -428,7 +428,7 @@ StorageLive(_70); StorageLive(_71); _71 = (); - _70 = opaque::<()>(move _71) -> bb10; + _70 = opaque::<()>(move _71) -> [return: bb10, unwind continue]; } bb10: { diff --git a/tests/mir-opt/reference_prop.reference_propagation_const_ptr.ReferencePropagation.diff b/tests/mir-opt/reference_prop.reference_propagation_const_ptr.ReferencePropagation.diff index 3a317853bdb..05eab7989df 100644 --- a/tests/mir-opt/reference_prop.reference_propagation_const_ptr.ReferencePropagation.diff +++ b/tests/mir-opt/reference_prop.reference_propagation_const_ptr.ReferencePropagation.diff @@ -242,7 +242,7 @@ StorageLive(_7); StorageLive(_8); _8 = (); - _7 = opaque::<()>(move _8) -> bb1; + _7 = opaque::<()>(move _8) -> [return: bb1, unwind continue]; } bb1: { @@ -269,7 +269,7 @@ StorageLive(_15); StorageLive(_16); _16 = (); - _15 = opaque::<()>(move _16) -> bb2; + _15 = opaque::<()>(move _16) -> [return: bb2, unwind continue]; } bb2: { @@ -293,7 +293,7 @@ StorageLive(_22); StorageLive(_23); _23 = _20; - _22 = opaque::<&*const usize>(move _23) -> bb3; + _22 = opaque::<&*const usize>(move _23) -> [return: bb3, unwind continue]; } bb3: { @@ -317,7 +317,7 @@ StorageLive(_29); StorageLive(_30); _30 = _27; - _29 = opaque::<*mut *const usize>(move _30) -> bb4; + _29 = opaque::<*mut *const usize>(move _30) -> [return: bb4, unwind continue]; } bb4: { @@ -340,7 +340,7 @@ StorageLive(_35); StorageLive(_36); _36 = _33; - _35 = opaque::<*const usize>(move _36) -> bb5; + _35 = opaque::<*const usize>(move _36) -> [return: bb5, unwind continue]; } bb5: { @@ -369,7 +369,7 @@ StorageLive(_44); StorageLive(_45); _45 = _43; - _44 = opaque::<*const usize>(move _45) -> bb6; + _44 = opaque::<*const usize>(move _45) -> [return: bb6, unwind continue]; } bb6: { @@ -392,7 +392,7 @@ StorageLive(_49); StorageLive(_50); _50 = (); - _49 = opaque::<()>(move _50) -> bb7; + _49 = opaque::<()>(move _50) -> [return: bb7, unwind continue]; } bb7: { @@ -414,7 +414,7 @@ StorageLive(_55); StorageLive(_56); _56 = (); - _55 = opaque::<()>(move _56) -> bb8; + _55 = opaque::<()>(move _56) -> [return: bb8, unwind continue]; } bb8: { @@ -437,7 +437,7 @@ StorageLive(_62); StorageLive(_63); _63 = (); - _62 = opaque::<()>(move _63) -> bb9; + _62 = opaque::<()>(move _63) -> [return: bb9, unwind continue]; } bb9: { @@ -462,7 +462,7 @@ StorageLive(_69); StorageLive(_70); _70 = (); - _69 = opaque::<()>(move _70) -> bb10; + _69 = opaque::<()>(move _70) -> [return: bb10, unwind continue]; } bb10: { @@ -486,7 +486,7 @@ StorageLive(_75); StorageLive(_76); _76 = (); - _75 = opaque::<()>(move _76) -> bb11; + _75 = opaque::<()>(move _76) -> [return: bb11, unwind continue]; } bb11: { diff --git a/tests/mir-opt/reference_prop.reference_propagation_mut.ReferencePropagation.diff b/tests/mir-opt/reference_prop.reference_propagation_mut.ReferencePropagation.diff index 91c6b2b6322..ee680fdb3f2 100644 --- a/tests/mir-opt/reference_prop.reference_propagation_mut.ReferencePropagation.diff +++ b/tests/mir-opt/reference_prop.reference_propagation_mut.ReferencePropagation.diff @@ -201,7 +201,7 @@ StorageLive(_7); StorageLive(_8); _8 = (); - _7 = opaque::<()>(move _8) -> bb1; + _7 = opaque::<()>(move _8) -> [return: bb1, unwind continue]; } bb1: { @@ -232,7 +232,7 @@ StorageLive(_16); StorageLive(_17); _17 = (); - _16 = opaque::<()>(move _17) -> bb2; + _16 = opaque::<()>(move _17) -> [return: bb2, unwind continue]; } bb2: { @@ -256,7 +256,7 @@ StorageLive(_23); StorageLive(_24); _24 = _21; - _23 = opaque::<&&mut usize>(move _24) -> bb3; + _23 = opaque::<&&mut usize>(move _24) -> [return: bb3, unwind continue]; } bb3: { @@ -280,7 +280,7 @@ StorageLive(_30); StorageLive(_31); _31 = _28; - _30 = opaque::<*mut &mut usize>(move _31) -> bb4; + _30 = opaque::<*mut &mut usize>(move _31) -> [return: bb4, unwind continue]; } bb4: { @@ -302,7 +302,7 @@ StorageLive(_36); StorageLive(_37); _37 = move _34; - _36 = opaque::<&mut usize>(move _37) -> bb5; + _36 = opaque::<&mut usize>(move _37) -> [return: bb5, unwind continue]; } bb5: { @@ -329,7 +329,7 @@ StorageLive(_45); StorageLive(_46); _46 = move _44; - _45 = opaque::<&mut usize>(move _46) -> bb6; + _45 = opaque::<&mut usize>(move _46) -> [return: bb6, unwind continue]; } bb6: { @@ -352,7 +352,7 @@ StorageLive(_50); StorageLive(_51); _51 = (); - _50 = opaque::<()>(move _51) -> bb7; + _50 = opaque::<()>(move _51) -> [return: bb7, unwind continue]; } bb7: { @@ -378,7 +378,7 @@ StorageLive(_57); StorageLive(_58); _58 = (); - _57 = opaque::<()>(move _58) -> bb8; + _57 = opaque::<()>(move _58) -> [return: bb8, unwind continue]; } bb8: { @@ -401,7 +401,7 @@ StorageLive(_64); StorageLive(_65); _65 = (); - _64 = opaque::<()>(move _65) -> bb9; + _64 = opaque::<()>(move _65) -> [return: bb9, unwind continue]; } bb9: { @@ -425,7 +425,7 @@ StorageLive(_70); StorageLive(_71); _71 = (); - _70 = opaque::<()>(move _71) -> bb10; + _70 = opaque::<()>(move _71) -> [return: bb10, unwind continue]; } bb10: { diff --git a/tests/mir-opt/reference_prop.reference_propagation_mut_ptr.ReferencePropagation.diff b/tests/mir-opt/reference_prop.reference_propagation_mut_ptr.ReferencePropagation.diff index 8c669644c48..fb0ef3184f0 100644 --- a/tests/mir-opt/reference_prop.reference_propagation_mut_ptr.ReferencePropagation.diff +++ b/tests/mir-opt/reference_prop.reference_propagation_mut_ptr.ReferencePropagation.diff @@ -219,7 +219,7 @@ StorageLive(_7); StorageLive(_8); _8 = (); - _7 = opaque::<()>(move _8) -> bb1; + _7 = opaque::<()>(move _8) -> [return: bb1, unwind continue]; } bb1: { @@ -246,7 +246,7 @@ StorageLive(_15); StorageLive(_16); _16 = (); - _15 = opaque::<()>(move _16) -> bb2; + _15 = opaque::<()>(move _16) -> [return: bb2, unwind continue]; } bb2: { @@ -270,7 +270,7 @@ StorageLive(_22); StorageLive(_23); _23 = _20; - _22 = opaque::<&*mut usize>(move _23) -> bb3; + _22 = opaque::<&*mut usize>(move _23) -> [return: bb3, unwind continue]; } bb3: { @@ -294,7 +294,7 @@ StorageLive(_29); StorageLive(_30); _30 = _27; - _29 = opaque::<*mut *mut usize>(move _30) -> bb4; + _29 = opaque::<*mut *mut usize>(move _30) -> [return: bb4, unwind continue]; } bb4: { @@ -316,7 +316,7 @@ StorageLive(_35); StorageLive(_36); _36 = _33; - _35 = opaque::<*mut usize>(move _36) -> bb5; + _35 = opaque::<*mut usize>(move _36) -> [return: bb5, unwind continue]; } bb5: { @@ -343,7 +343,7 @@ StorageLive(_44); StorageLive(_45); _45 = _43; - _44 = opaque::<*mut usize>(move _45) -> bb6; + _44 = opaque::<*mut usize>(move _45) -> [return: bb6, unwind continue]; } bb6: { @@ -366,7 +366,7 @@ StorageLive(_49); StorageLive(_50); _50 = (); - _49 = opaque::<()>(move _50) -> bb7; + _49 = opaque::<()>(move _50) -> [return: bb7, unwind continue]; } bb7: { @@ -388,7 +388,7 @@ StorageLive(_55); StorageLive(_56); _56 = (); - _55 = opaque::<()>(move _56) -> bb8; + _55 = opaque::<()>(move _56) -> [return: bb8, unwind continue]; } bb8: { @@ -411,7 +411,7 @@ StorageLive(_62); StorageLive(_63); _63 = (); - _62 = opaque::<()>(move _63) -> bb9; + _62 = opaque::<()>(move _63) -> [return: bb9, unwind continue]; } bb9: { @@ -435,7 +435,7 @@ StorageLive(_68); StorageLive(_69); _69 = (); - _68 = opaque::<()>(move _69) -> bb10; + _68 = opaque::<()>(move _69) -> [return: bb10, unwind continue]; } bb10: { diff --git a/tests/mir-opt/reference_prop.unique_with_copies.ReferencePropagation.diff b/tests/mir-opt/reference_prop.unique_with_copies.ReferencePropagation.diff index b4c34c07022..b4912a918ba 100644 --- a/tests/mir-opt/reference_prop.unique_with_copies.ReferencePropagation.diff +++ b/tests/mir-opt/reference_prop.unique_with_copies.ReferencePropagation.diff @@ -34,7 +34,7 @@ StorageLive(_4); StorageLive(_5); _5 = (*_3); - _4 = opaque::<i32>(move _5) -> bb1; + _4 = opaque::<i32>(move _5) -> [return: bb1, unwind continue]; } bb1: { @@ -47,7 +47,7 @@ StorageLive(_7); - _7 = (*_1); + _7 = (*_3); - _6 = opaque::<i32>(move _7) -> bb2; + _6 = opaque::<i32>(move _7) -> [return: bb2, unwind continue]; } bb2: { diff --git a/tests/mir-opt/remove_storage_markers.main.RemoveStorageMarkers.panic-unwind.diff b/tests/mir-opt/remove_storage_markers.main.RemoveStorageMarkers.panic-unwind.diff index d7f867e31dd..faaebc300ef 100644 --- a/tests/mir-opt/remove_storage_markers.main.RemoveStorageMarkers.panic-unwind.diff +++ b/tests/mir-opt/remove_storage_markers.main.RemoveStorageMarkers.panic-unwind.diff @@ -32,7 +32,7 @@ - StorageLive(_2); - StorageLive(_3); _3 = std::ops::Range::<i32> { start: const 0_i32, end: const 10_i32 }; - _2 = <std::ops::Range<i32> as IntoIterator>::into_iter(move _3) -> bb1; + _2 = <std::ops::Range<i32> as IntoIterator>::into_iter(move _3) -> [return: bb1, unwind continue]; } bb1: { @@ -49,7 +49,7 @@ - StorageLive(_9); _9 = &mut _4; _8 = &mut (*_9); - _7 = <std::ops::Range<i32> as Iterator>::next(move _8) -> bb3; + _7 = <std::ops::Range<i32> as Iterator>::next(move _8) -> [return: bb3, unwind continue]; } bb3: { diff --git a/tests/mir-opt/remove_unneeded_drops.opt.RemoveUnneededDrops.panic-unwind.diff b/tests/mir-opt/remove_unneeded_drops.opt.RemoveUnneededDrops.panic-unwind.diff index 8cb773e4807..a335e8853f3 100644 --- a/tests/mir-opt/remove_unneeded_drops.opt.RemoveUnneededDrops.panic-unwind.diff +++ b/tests/mir-opt/remove_unneeded_drops.opt.RemoveUnneededDrops.panic-unwind.diff @@ -14,7 +14,7 @@ - nop; StorageLive(_3); _3 = _1; -- drop(_3) -> bb1; +- drop(_3) -> [return: bb1, unwind continue]; - } - - bb1: { diff --git a/tests/mir-opt/remove_unneeded_drops.opt_generic_copy.RemoveUnneededDrops.panic-unwind.diff b/tests/mir-opt/remove_unneeded_drops.opt_generic_copy.RemoveUnneededDrops.panic-unwind.diff index d189e587982..1f7a6f9ad59 100644 --- a/tests/mir-opt/remove_unneeded_drops.opt_generic_copy.RemoveUnneededDrops.panic-unwind.diff +++ b/tests/mir-opt/remove_unneeded_drops.opt_generic_copy.RemoveUnneededDrops.panic-unwind.diff @@ -14,7 +14,7 @@ - nop; StorageLive(_3); _3 = _1; -- drop(_3) -> bb1; +- drop(_3) -> [return: bb1, unwind continue]; - } - - bb1: { diff --git a/tests/mir-opt/retag.array_casts.SimplifyCfg-elaborate-drops.after.panic-unwind.mir b/tests/mir-opt/retag.array_casts.SimplifyCfg-elaborate-drops.after.panic-unwind.mir index 18eb21d6542..93f14af29b4 100644 --- a/tests/mir-opt/retag.array_casts.SimplifyCfg-elaborate-drops.after.panic-unwind.mir +++ b/tests/mir-opt/retag.array_casts.SimplifyCfg-elaborate-drops.after.panic-unwind.mir @@ -76,7 +76,7 @@ fn array_casts() -> () { StorageLive(_6); StorageLive(_7); _7 = _2; - _6 = ptr::mut_ptr::<impl *mut usize>::add(move _7, const 1_usize) -> bb1; + _6 = ptr::mut_ptr::<impl *mut usize>::add(move _7, const 1_usize) -> [return: bb1, unwind continue]; } bb1: { @@ -102,7 +102,7 @@ fn array_casts() -> () { StorageLive(_16); StorageLive(_17); _17 = _9; - _16 = ptr::const_ptr::<impl *const usize>::add(move _17, const 1_usize) -> bb2; + _16 = ptr::const_ptr::<impl *const usize>::add(move _17, const 1_usize) -> [return: bb2, unwind continue]; } bb2: { @@ -154,7 +154,7 @@ fn array_casts() -> () { StorageLive(_34); _34 = Option::<Arguments<'_>>::None; Retag(_34); - _28 = core::panicking::assert_failed::<usize, usize>(move _29, move _30, move _32, move _34); + _28 = core::panicking::assert_failed::<usize, usize>(move _29, move _30, move _32, move _34) -> unwind continue; } bb4: { diff --git a/tests/mir-opt/retag.core.ptr-drop_in_place.Test.SimplifyCfg-make_shim.after.panic-unwind.mir b/tests/mir-opt/retag.core.ptr-drop_in_place.Test.SimplifyCfg-make_shim.after.panic-unwind.mir index 96d2abf98b4..70c53bafa37 100644 --- a/tests/mir-opt/retag.core.ptr-drop_in_place.Test.SimplifyCfg-make_shim.after.panic-unwind.mir +++ b/tests/mir-opt/retag.core.ptr-drop_in_place.Test.SimplifyCfg-make_shim.after.panic-unwind.mir @@ -10,7 +10,7 @@ fn std::ptr::drop_in_place(_1: *mut Test) -> () { _2 = &mut (*_1); Retag([fn entry] _2); _3 = &mut (*_2); - _4 = <Test as Drop>::drop(move _3) -> bb1; + _4 = <Test as Drop>::drop(move _3) -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/retag.main.SimplifyCfg-elaborate-drops.after.panic-unwind.mir b/tests/mir-opt/retag.main.SimplifyCfg-elaborate-drops.after.panic-unwind.mir index 483485f2942..45034946328 100644 --- a/tests/mir-opt/retag.main.SimplifyCfg-elaborate-drops.after.panic-unwind.mir +++ b/tests/mir-opt/retag.main.SimplifyCfg-elaborate-drops.after.panic-unwind.mir @@ -114,7 +114,7 @@ fn main() -> () { StorageLive(_18); _18 = &_1; _17 = &(*_18); - _15 = move _16(move _17) -> bb3; + _15 = move _16(move _17) -> [return: bb3, unwind continue]; } bb3: { @@ -153,7 +153,7 @@ fn main() -> () { _25 = _26; StorageDead(_26); StorageLive(_27); - _27 = array_casts() -> bb6; + _27 = array_casts() -> [return: bb6, unwind continue]; } bb6: { diff --git a/tests/mir-opt/simplify_if.main.SimplifyConstCondition-after-const-prop.panic-unwind.diff b/tests/mir-opt/simplify_if.main.SimplifyConstCondition-after-const-prop.panic-unwind.diff index 2a841f72ba3..81903c64dbd 100644 --- a/tests/mir-opt/simplify_if.main.SimplifyConstCondition-after-const-prop.panic-unwind.diff +++ b/tests/mir-opt/simplify_if.main.SimplifyConstCondition-after-const-prop.panic-unwind.diff @@ -14,7 +14,7 @@ } bb1: { - _2 = noop() -> bb2; + _2 = noop() -> [return: bb2, unwind continue]; } bb2: { diff --git a/tests/mir-opt/simplify_locals_fixedpoint.foo.SimplifyLocals-final.panic-unwind.diff b/tests/mir-opt/simplify_locals_fixedpoint.foo.SimplifyLocals-final.panic-unwind.diff index ef3a923fd69..ba5262b0ee1 100644 --- a/tests/mir-opt/simplify_locals_fixedpoint.foo.SimplifyLocals-final.panic-unwind.diff +++ b/tests/mir-opt/simplify_locals_fixedpoint.foo.SimplifyLocals-final.panic-unwind.diff @@ -39,7 +39,7 @@ } bb3: { - drop(_1) -> bb4; + drop(_1) -> [return: bb4, unwind continue]; } bb4: { diff --git a/tests/mir-opt/simplify_locals_removes_unused_consts.main.SimplifyLocals-before-const-prop.panic-unwind.diff b/tests/mir-opt/simplify_locals_removes_unused_consts.main.SimplifyLocals-before-const-prop.panic-unwind.diff index dca51602021..a5d9bbc49af 100644 --- a/tests/mir-opt/simplify_locals_removes_unused_consts.main.SimplifyLocals-before-const-prop.panic-unwind.diff +++ b/tests/mir-opt/simplify_locals_removes_unused_consts.main.SimplifyLocals-before-const-prop.panic-unwind.diff @@ -36,7 +36,7 @@ + _2 = (move _3, move _4); + StorageDead(_4); StorageDead(_3); -+ _1 = use_zst(move _2) -> bb1; ++ _1 = use_zst(move _2) -> [return: bb1, unwind continue]; + } + + bb1: { @@ -55,8 +55,8 @@ + _6 = Add(move _7, const 2_u8); StorageDead(_7); - StorageDead(_6); -- _4 = use_zst(move _5) -> bb1; -+ _5 = use_u8(move _6) -> bb2; +- _4 = use_zst(move _5) -> [return: bb1, unwind continue]; ++ _5 = use_u8(move _6) -> [return: bb2, unwind continue]; } - bb1: { @@ -70,7 +70,7 @@ - _10 = (_11.0: u8); - _9 = Add(move _10, const 2_u8); - StorageDead(_10); -- _8 = use_u8(move _9) -> bb2; +- _8 = use_u8(move _9) -> [return: bb2, unwind continue]; - } - bb2: { diff --git a/tests/mir-opt/simplify_match.main.ConstProp.panic-unwind.diff b/tests/mir-opt/simplify_match.main.ConstProp.panic-unwind.diff index dc2f75ec9b2..c881dec28c7 100644 --- a/tests/mir-opt/simplify_match.main.ConstProp.panic-unwind.diff +++ b/tests/mir-opt/simplify_match.main.ConstProp.panic-unwind.diff @@ -20,7 +20,7 @@ } bb2: { - _0 = noop() -> bb3; + _0 = noop() -> [return: bb3, unwind continue]; } bb3: { diff --git a/tests/mir-opt/unreachable.main.UnreachablePropagation.panic-unwind.diff b/tests/mir-opt/unreachable.main.UnreachablePropagation.panic-unwind.diff index 19ea846bf2c..906dce9819f 100644 --- a/tests/mir-opt/unreachable.main.UnreachablePropagation.panic-unwind.diff +++ b/tests/mir-opt/unreachable.main.UnreachablePropagation.panic-unwind.diff @@ -19,7 +19,7 @@ bb0: { StorageLive(_1); - _1 = empty() -> bb1; + _1 = empty() -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/unreachable_diverging.main.UnreachablePropagation.panic-unwind.diff b/tests/mir-opt/unreachable_diverging.main.UnreachablePropagation.panic-unwind.diff index 9d54a2f234b..a0479fb9130 100644 --- a/tests/mir-opt/unreachable_diverging.main.UnreachablePropagation.panic-unwind.diff +++ b/tests/mir-opt/unreachable_diverging.main.UnreachablePropagation.panic-unwind.diff @@ -21,7 +21,7 @@ StorageLive(_1); _1 = const true; StorageLive(_2); - _2 = empty() -> bb1; + _2 = empty() -> [return: bb1, unwind continue]; } bb1: { @@ -39,7 +39,7 @@ } bb3: { - _5 = loop_forever() -> bb5; + _5 = loop_forever() -> [return: bb5, unwind continue]; } bb4: { diff --git a/tests/mir-opt/while_storage.while_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/while_storage.while_loop.PreCodegen.after.panic-unwind.mir index ec4782e5f3c..7dc4f7ab1a8 100644 --- a/tests/mir-opt/while_storage.while_loop.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/while_storage.while_loop.PreCodegen.after.panic-unwind.mir @@ -12,7 +12,7 @@ fn while_loop(_1: bool) -> () { bb1: { StorageLive(_2); - _2 = get_bool(_1) -> bb2; + _2 = get_bool(_1) -> [return: bb2, unwind continue]; } bb2: { @@ -21,7 +21,7 @@ fn while_loop(_1: bool) -> () { bb3: { StorageLive(_3); - _3 = get_bool(_1) -> bb4; + _3 = get_bool(_1) -> [return: bb4, unwind continue]; } bb4: { diff --git a/tests/run-make/coverage/lib/doctest_crate.rs b/tests/run-coverage-rustdoc/auxiliary/doctest_crate.rs index c3210146d69..c3210146d69 100644 --- a/tests/run-make/coverage/lib/doctest_crate.rs +++ b/tests/run-coverage-rustdoc/auxiliary/doctest_crate.rs diff --git a/tests/run-make/coverage-reports/expected_show_coverage.doctest.txt b/tests/run-coverage-rustdoc/doctest.coverage index 732de652627..0fce73a6048 100644 --- a/tests/run-make/coverage-reports/expected_show_coverage.doctest.txt +++ b/tests/run-coverage-rustdoc/doctest.coverage @@ -1,4 +1,15 @@ -../coverage/doctest.rs: +$DIR/auxiliary/doctest_crate.rs: + 1| |/// A function run only from within doctests + 2| 3|pub fn fn_run_in_doctests(conditional: usize) { + 3| 3| match conditional { + 4| 1| 1 => assert_eq!(1, 1), // this is run, + 5| 1| 2 => assert_eq!(1, 1), // this, + 6| 1| 3 => assert_eq!(1, 1), // and this too + 7| 0| _ => assert_eq!(1, 2), // however this is not + 8| | } + 9| 3|} + +$DIR/doctest.rs: 1| |//! This test ensures that code from doctests is properly re-mapped. 2| |//! See <https://github.com/rust-lang/rust/issues/79417> for more info. 3| |//! @@ -67,7 +78,7 @@ 63| |//! doctest_main() 64| |//! } 65| |//! ``` - 66| | + 66| |// aux-build:doctest_crate.rs 67| |/// doctest attached to fn testing external code: 68| |/// ``` 69| 1|/// extern crate doctest_crate; @@ -102,14 +113,3 @@ 98| |// what affect it might have on diagnostic messages from the compiler, and whether anyone would care 99| |// if the indentation changed. I don't know if there is a more viable solution. -../coverage/lib/doctest_crate.rs: - 1| |/// A function run only from within doctests - 2| 3|pub fn fn_run_in_doctests(conditional: usize) { - 3| 3| match conditional { - 4| 1| 1 => assert_eq!(1, 1), // this is run, - 5| 1| 2 => assert_eq!(1, 1), // this, - 6| 1| 3 => assert_eq!(1, 1), // and this too - 7| 0| _ => assert_eq!(1, 2), // however this is not - 8| | } - 9| 3|} - diff --git a/tests/run-make/coverage/doctest.rs b/tests/run-coverage-rustdoc/doctest.rs index ec04ea57063..251b0c291e9 100644 --- a/tests/run-make/coverage/doctest.rs +++ b/tests/run-coverage-rustdoc/doctest.rs @@ -63,7 +63,7 @@ //! doctest_main() //! } //! ``` - +// aux-build:doctest_crate.rs /// doctest attached to fn testing external code: /// ``` /// extern crate doctest_crate; diff --git a/tests/run-make/coverage-reports/expected_show_coverage.abort.txt b/tests/run-coverage/abort.coverage index a71c58d618d..a71c58d618d 100644 --- a/tests/run-make/coverage-reports/expected_show_coverage.abort.txt +++ b/tests/run-coverage/abort.coverage diff --git a/tests/run-make/coverage/abort.rs b/tests/run-coverage/abort.rs index 98264bdc1af..98264bdc1af 100644 --- a/tests/run-make/coverage/abort.rs +++ b/tests/run-coverage/abort.rs diff --git a/tests/run-make/coverage-reports/expected_show_coverage.assert.txt b/tests/run-coverage/assert.coverage index 405688806ea..a7134a149e2 100644 --- a/tests/run-make/coverage-reports/expected_show_coverage.assert.txt +++ b/tests/run-coverage/assert.coverage @@ -1,5 +1,5 @@ 1| |#![allow(unused_assignments)] - 2| |// expect-exit-status-101 + 2| |// failure-status: 101 3| | 4| 4|fn might_fail_assert(one_plus_one: u32) { 5| 4| println!("does 1 + 1 = {}?", one_plus_one); diff --git a/tests/run-make/coverage/assert.rs b/tests/run-coverage/assert.rs index c85f2748eb9..d32a37e078e 100644 --- a/tests/run-make/coverage/assert.rs +++ b/tests/run-coverage/assert.rs @@ -1,5 +1,5 @@ #![allow(unused_assignments)] -// expect-exit-status-101 +// failure-status: 101 fn might_fail_assert(one_plus_one: u32) { println!("does 1 + 1 = {}?", one_plus_one); diff --git a/tests/run-make/coverage-reports/expected_show_coverage.async.txt b/tests/run-coverage/async.coverage index 93c1535b06b..93c1535b06b 100644 --- a/tests/run-make/coverage-reports/expected_show_coverage.async.txt +++ b/tests/run-coverage/async.coverage diff --git a/tests/run-make/coverage/async.rs b/tests/run-coverage/async.rs index efd9e62d64e..efd9e62d64e 100644 --- a/tests/run-make/coverage/async.rs +++ b/tests/run-coverage/async.rs diff --git a/tests/run-make/coverage-reports/expected_show_coverage.async2.txt b/tests/run-coverage/async2.coverage index 500dde1f269..500dde1f269 100644 --- a/tests/run-make/coverage-reports/expected_show_coverage.async2.txt +++ b/tests/run-coverage/async2.coverage diff --git a/tests/run-make/coverage/async2.rs b/tests/run-coverage/async2.rs index 959d48ce9db..959d48ce9db 100644 --- a/tests/run-make/coverage/async2.rs +++ b/tests/run-coverage/async2.rs diff --git a/tests/run-make/coverage/lib/inline_always_with_dead_code.rs b/tests/run-coverage/auxiliary/inline_always_with_dead_code.rs index 2b21dee6ccf..2b21dee6ccf 100644 --- a/tests/run-make/coverage/lib/inline_always_with_dead_code.rs +++ b/tests/run-coverage/auxiliary/inline_always_with_dead_code.rs diff --git a/tests/run-make/coverage/lib/unused_mod_helper.rs b/tests/run-coverage/auxiliary/unused_mod_helper.rs index ae1cc1531ed..ae1cc1531ed 100644 --- a/tests/run-make/coverage/lib/unused_mod_helper.rs +++ b/tests/run-coverage/auxiliary/unused_mod_helper.rs diff --git a/tests/run-make/coverage/lib/used_crate.rs b/tests/run-coverage/auxiliary/used_crate.rs index 8b8b1f7f351..16592d48dda 100644 --- a/tests/run-make/coverage/lib/used_crate.rs +++ b/tests/run-coverage/auxiliary/used_crate.rs @@ -1,6 +1,6 @@ #![allow(unused_assignments, unused_variables)] -// compile-flags: -C opt-level=3 # validates coverage now works with optimizations -use std::fmt::Debug; +// compile-flags: -C opt-level=3 +use std::fmt::Debug; // ^^ validates coverage now works with optimizations pub fn used_function() { // Initialize test constants in a way that cannot be determined at compile time, to ensure diff --git a/tests/run-make/coverage/lib/used_inline_crate.rs b/tests/run-coverage/auxiliary/used_inline_crate.rs index 4a052756d4e..8b8e9d5483f 100644 --- a/tests/run-make/coverage/lib/used_inline_crate.rs +++ b/tests/run-coverage/auxiliary/used_inline_crate.rs @@ -1,7 +1,7 @@ #![allow(unused_assignments, unused_variables)] -// compile-flags: -C opt-level=3 # validates coverage now works with optimizations - +// compile-flags: -C opt-level=3 +// ^^ validates coverage now works with optimizations use std::fmt::Debug; pub fn used_function() { diff --git a/tests/run-make/coverage-reports/expected_show_coverage.closure.txt b/tests/run-coverage/closure.coverage index 002ecec3b91..45d36b72e3a 100644 --- a/tests/run-make/coverage-reports/expected_show_coverage.closure.txt +++ b/tests/run-coverage/closure.coverage @@ -1,6 +1,6 @@ 1| |#![allow(unused_assignments, unused_variables)] - 2| |// compile-flags: -C opt-level=2 # fix described in rustc_middle/mir/mono.rs - 3| 1|fn main() { + 2| |// compile-flags: -C opt-level=2 + 3| 1|fn main() { // ^^ fix described in rustc_middle/mir/mono.rs 4| 1| // Initialize test constants in a way that cannot be determined at compile time, to ensure 5| 1| // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from 6| 1| // dependent conditions. diff --git a/tests/run-make/coverage/closure.rs b/tests/run-coverage/closure.rs index 32ec0bcdf8c..eb3a1ebff88 100644 --- a/tests/run-make/coverage/closure.rs +++ b/tests/run-coverage/closure.rs @@ -1,6 +1,6 @@ #![allow(unused_assignments, unused_variables)] -// compile-flags: -C opt-level=2 # fix described in rustc_middle/mir/mono.rs -fn main() { +// compile-flags: -C opt-level=2 +fn main() { // ^^ fix described in rustc_middle/mir/mono.rs // Initialize test constants in a way that cannot be determined at compile time, to ensure // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from // dependent conditions. diff --git a/tests/run-make/coverage-reports/expected_show_coverage.closure_macro.txt b/tests/run-coverage/closure_macro.coverage index 87f7014760e..87f7014760e 100644 --- a/tests/run-make/coverage-reports/expected_show_coverage.closure_macro.txt +++ b/tests/run-coverage/closure_macro.coverage diff --git a/tests/run-make/coverage/closure_macro.rs b/tests/run-coverage/closure_macro.rs index 5e3b00d1ef5..5e3b00d1ef5 100644 --- a/tests/run-make/coverage/closure_macro.rs +++ b/tests/run-coverage/closure_macro.rs diff --git a/tests/run-make/coverage-reports/expected_show_coverage.closure_macro_async.txt b/tests/run-coverage/closure_macro_async.coverage index 2b5418132c3..2b5418132c3 100644 --- a/tests/run-make/coverage-reports/expected_show_coverage.closure_macro_async.txt +++ b/tests/run-coverage/closure_macro_async.coverage diff --git a/tests/run-make/coverage/closure_macro_async.rs b/tests/run-coverage/closure_macro_async.rs index e3e89e9c8b3..e3e89e9c8b3 100644 --- a/tests/run-make/coverage/closure_macro_async.rs +++ b/tests/run-coverage/closure_macro_async.rs diff --git a/tests/run-make/coverage-reports/expected_show_coverage.conditions.txt b/tests/run-coverage/conditions.coverage index 2d8a98a5d0c..2d8a98a5d0c 100644 --- a/tests/run-make/coverage-reports/expected_show_coverage.conditions.txt +++ b/tests/run-coverage/conditions.coverage diff --git a/tests/run-make/coverage/conditions.rs b/tests/run-coverage/conditions.rs index 057599d1b47..057599d1b47 100644 --- a/tests/run-make/coverage/conditions.rs +++ b/tests/run-coverage/conditions.rs diff --git a/tests/run-make/coverage-reports/expected_show_coverage.continue.txt b/tests/run-coverage/continue.coverage index bf42924b191..bf42924b191 100644 --- a/tests/run-make/coverage-reports/expected_show_coverage.continue.txt +++ b/tests/run-coverage/continue.coverage diff --git a/tests/run-make/coverage/continue.rs b/tests/run-coverage/continue.rs index 624aa98341b..624aa98341b 100644 --- a/tests/run-make/coverage/continue.rs +++ b/tests/run-coverage/continue.rs diff --git a/tests/run-make/coverage-reports/expected_show_coverage.dead_code.txt b/tests/run-coverage/dead_code.coverage index 09ff14c6f27..09ff14c6f27 100644 --- a/tests/run-make/coverage-reports/expected_show_coverage.dead_code.txt +++ b/tests/run-coverage/dead_code.coverage diff --git a/tests/run-make/coverage/dead_code.rs b/tests/run-coverage/dead_code.rs index a1285df0ec6..a1285df0ec6 100644 --- a/tests/run-make/coverage/dead_code.rs +++ b/tests/run-coverage/dead_code.rs diff --git a/tests/run-make/coverage-reports/expected_show_coverage.drop_trait.txt b/tests/run-coverage/drop_trait.coverage index fe6a9e93cbf..293001e9590 100644 --- a/tests/run-make/coverage-reports/expected_show_coverage.drop_trait.txt +++ b/tests/run-coverage/drop_trait.coverage @@ -1,5 +1,5 @@ 1| |#![allow(unused_assignments)] - 2| |// expect-exit-status-1 + 2| |// failure-status: 1 3| | 4| |struct Firework { 5| | strength: i32, diff --git a/tests/run-make/coverage/drop_trait.rs b/tests/run-coverage/drop_trait.rs index d15bfc0f877..a9b5d1d1e7f 100644 --- a/tests/run-make/coverage/drop_trait.rs +++ b/tests/run-coverage/drop_trait.rs @@ -1,5 +1,5 @@ #![allow(unused_assignments)] -// expect-exit-status-1 +// failure-status: 1 struct Firework { strength: i32, diff --git a/tests/run-make/coverage-reports/expected_show_coverage.generator.txt b/tests/run-coverage/generator.coverage index 0fb3808ff2e..0fb3808ff2e 100644 --- a/tests/run-make/coverage-reports/expected_show_coverage.generator.txt +++ b/tests/run-coverage/generator.coverage diff --git a/tests/run-make/coverage/generator.rs b/tests/run-coverage/generator.rs index 4319991021e..4319991021e 100644 --- a/tests/run-make/coverage/generator.rs +++ b/tests/run-coverage/generator.rs diff --git a/tests/run-make/coverage-reports/expected_show_coverage.generics.txt b/tests/run-coverage/generics.coverage index 7eb33a29a92..7a7649674ca 100644 --- a/tests/run-make/coverage-reports/expected_show_coverage.generics.txt +++ b/tests/run-coverage/generics.coverage @@ -1,5 +1,5 @@ 1| |#![allow(unused_assignments)] - 2| |// expect-exit-status-1 + 2| |// failure-status: 1 3| | 4| |struct Firework<T> where T: Copy + std::fmt::Display { 5| | strength: T, diff --git a/tests/run-make/coverage/generics.rs b/tests/run-coverage/generics.rs index 18b38868496..150ffb9db39 100644 --- a/tests/run-make/coverage/generics.rs +++ b/tests/run-coverage/generics.rs @@ -1,5 +1,5 @@ #![allow(unused_assignments)] -// expect-exit-status-1 +// failure-status: 1 struct Firework<T> where T: Copy + std::fmt::Display { strength: T, diff --git a/tests/run-make/coverage-reports/expected_show_coverage.if.txt b/tests/run-coverage/if.coverage index 0c9eff227ed..0c9eff227ed 100644 --- a/tests/run-make/coverage-reports/expected_show_coverage.if.txt +++ b/tests/run-coverage/if.coverage diff --git a/tests/run-make/coverage/if.rs b/tests/run-coverage/if.rs index 8ad5042ff7b..8ad5042ff7b 100644 --- a/tests/run-make/coverage/if.rs +++ b/tests/run-coverage/if.rs diff --git a/tests/run-make/coverage-reports/expected_show_coverage.if_else.txt b/tests/run-coverage/if_else.coverage index 4285d318686..4285d318686 100644 --- a/tests/run-make/coverage-reports/expected_show_coverage.if_else.txt +++ b/tests/run-coverage/if_else.coverage diff --git a/tests/run-make/coverage/if_else.rs b/tests/run-coverage/if_else.rs index 3244e1e3afd..3244e1e3afd 100644 --- a/tests/run-make/coverage/if_else.rs +++ b/tests/run-coverage/if_else.rs diff --git a/tests/run-make/coverage-reports/expected_show_coverage.inline-dead.txt b/tests/run-coverage/inline-dead.coverage index a59fe1146f4..a59fe1146f4 100644 --- a/tests/run-make/coverage-reports/expected_show_coverage.inline-dead.txt +++ b/tests/run-coverage/inline-dead.coverage diff --git a/tests/run-make/coverage/inline-dead.rs b/tests/run-coverage/inline-dead.rs index 854fa062967..854fa062967 100644 --- a/tests/run-make/coverage/inline-dead.rs +++ b/tests/run-coverage/inline-dead.rs diff --git a/tests/run-make/coverage-reports/expected_show_coverage.inline.txt b/tests/run-coverage/inline.coverage index 6f5d1544fa0..6f5d1544fa0 100644 --- a/tests/run-make/coverage-reports/expected_show_coverage.inline.txt +++ b/tests/run-coverage/inline.coverage diff --git a/tests/run-make/coverage/inline.rs b/tests/run-coverage/inline.rs index 9cfab9ddbad..9cfab9ddbad 100644 --- a/tests/run-make/coverage/inline.rs +++ b/tests/run-coverage/inline.rs diff --git a/tests/run-make/coverage-reports/expected_show_coverage.inner_items.txt b/tests/run-coverage/inner_items.coverage index 883254a09ba..883254a09ba 100644 --- a/tests/run-make/coverage-reports/expected_show_coverage.inner_items.txt +++ b/tests/run-coverage/inner_items.coverage diff --git a/tests/run-make/coverage/inner_items.rs b/tests/run-coverage/inner_items.rs index bcb62b3031c..bcb62b3031c 100644 --- a/tests/run-make/coverage/inner_items.rs +++ b/tests/run-coverage/inner_items.rs diff --git a/tests/run-make/coverage-reports/expected_show_coverage.issue-83601.txt b/tests/run-coverage/issue-83601.coverage index 25c74ab2e70..25c74ab2e70 100644 --- a/tests/run-make/coverage-reports/expected_show_coverage.issue-83601.txt +++ b/tests/run-coverage/issue-83601.coverage diff --git a/tests/run-make/coverage/issue-83601.rs b/tests/run-coverage/issue-83601.rs index 0b72a81947c..0b72a81947c 100644 --- a/tests/run-make/coverage/issue-83601.rs +++ b/tests/run-coverage/issue-83601.rs diff --git a/tests/run-make/coverage-reports/expected_show_coverage.issue-84561.txt b/tests/run-coverage/issue-84561.coverage index 4a60432c14c..7a97e353245 100644 --- a/tests/run-make/coverage-reports/expected_show_coverage.issue-84561.txt +++ b/tests/run-coverage/issue-84561.coverage @@ -1,6 +1,6 @@ 1| |// This demonstrated Issue #84561: function-like macros produce unintuitive coverage results. 2| | - 3| |// expect-exit-status-101 + 3| |// failure-status: 101 4| 21|#[derive(PartialEq, Eq)] 5| |struct Foo(u32); 6| 1|fn test3() { diff --git a/tests/run-make/coverage/issue-84561.rs b/tests/run-coverage/issue-84561.rs index b39a289c45e..facf5b5b4cf 100644 --- a/tests/run-make/coverage/issue-84561.rs +++ b/tests/run-coverage/issue-84561.rs @@ -1,6 +1,6 @@ // This demonstrated Issue #84561: function-like macros produce unintuitive coverage results. -// expect-exit-status-101 +// failure-status: 101 #[derive(PartialEq, Eq)] struct Foo(u32); fn test3() { diff --git a/tests/run-make/coverage-reports/expected_show_coverage.issue-85461.txt b/tests/run-coverage/issue-85461.coverage index 1aa4a22c33e..d78a4a1129c 100644 --- a/tests/run-make/coverage-reports/expected_show_coverage.issue-85461.txt +++ b/tests/run-coverage/issue-85461.coverage @@ -1,16 +1,4 @@ -../coverage/issue-85461.rs: - 1| |// Regression test for #85461: MSVC sometimes fail to link with dead code and #[inline(always)] - 2| | - 3| |extern crate inline_always_with_dead_code; - 4| | - 5| |use inline_always_with_dead_code::{bar, baz}; - 6| | - 7| 1|fn main() { - 8| 1| bar::call_me(); - 9| 1| baz::call_me(); - 10| 1|} - -../coverage/lib/inline_always_with_dead_code.rs: +$DIR/auxiliary/inline_always_with_dead_code.rs: 1| |// compile-flags: -Cinstrument-coverage -Ccodegen-units=4 -Copt-level=0 2| | 3| |#![allow(dead_code)] @@ -34,3 +22,15 @@ 21| 1| } 22| |} +$DIR/issue-85461.rs: + 1| |// Regression test for #85461: MSVC sometimes fail to link with dead code and #[inline(always)] + 2| |// aux-build:inline_always_with_dead_code.rs + 3| |extern crate inline_always_with_dead_code; + 4| | + 5| |use inline_always_with_dead_code::{bar, baz}; + 6| | + 7| 1|fn main() { + 8| 1| bar::call_me(); + 9| 1| baz::call_me(); + 10| 1|} + diff --git a/tests/run-make/coverage/issue-85461.rs b/tests/run-coverage/issue-85461.rs index a1b9ebb1ed3..6f626b4a65b 100644 --- a/tests/run-make/coverage/issue-85461.rs +++ b/tests/run-coverage/issue-85461.rs @@ -1,5 +1,5 @@ // Regression test for #85461: MSVC sometimes fail to link with dead code and #[inline(always)] - +// aux-build:inline_always_with_dead_code.rs extern crate inline_always_with_dead_code; use inline_always_with_dead_code::{bar, baz}; diff --git a/tests/run-make/coverage-reports/expected_show_coverage.issue-93054.txt b/tests/run-coverage/issue-93054.coverage index a1655adedd4..a1655adedd4 100644 --- a/tests/run-make/coverage-reports/expected_show_coverage.issue-93054.txt +++ b/tests/run-coverage/issue-93054.coverage diff --git a/tests/run-make/coverage/issue-93054.rs b/tests/run-coverage/issue-93054.rs index c160b3db03f..c160b3db03f 100644 --- a/tests/run-make/coverage/issue-93054.rs +++ b/tests/run-coverage/issue-93054.rs diff --git a/tests/run-make/coverage-reports/expected_show_coverage.lazy_boolean.txt b/tests/run-coverage/lazy_boolean.coverage index bd349df2fbc..bd349df2fbc 100644 --- a/tests/run-make/coverage-reports/expected_show_coverage.lazy_boolean.txt +++ b/tests/run-coverage/lazy_boolean.coverage diff --git a/tests/run-make/coverage/lazy_boolean.rs b/tests/run-coverage/lazy_boolean.rs index bb6219e851c..bb6219e851c 100644 --- a/tests/run-make/coverage/lazy_boolean.rs +++ b/tests/run-coverage/lazy_boolean.rs diff --git a/tests/run-make/coverage-reports/expected_show_coverage.loop_break_value.txt b/tests/run-coverage/loop_break_value.coverage index 022fe4c5962..022fe4c5962 100644 --- a/tests/run-make/coverage-reports/expected_show_coverage.loop_break_value.txt +++ b/tests/run-coverage/loop_break_value.coverage diff --git a/tests/run-make/coverage/loop_break_value.rs b/tests/run-coverage/loop_break_value.rs index dbc4fad7a23..dbc4fad7a23 100644 --- a/tests/run-make/coverage/loop_break_value.rs +++ b/tests/run-coverage/loop_break_value.rs diff --git a/tests/run-make/coverage-reports/expected_show_coverage.loops_branches.txt b/tests/run-coverage/loops_branches.coverage index b7ad79a2484..b7ad79a2484 100644 --- a/tests/run-make/coverage-reports/expected_show_coverage.loops_branches.txt +++ b/tests/run-coverage/loops_branches.coverage diff --git a/tests/run-make/coverage/loops_branches.rs b/tests/run-coverage/loops_branches.rs index 7116ce47f4b..7116ce47f4b 100644 --- a/tests/run-make/coverage/loops_branches.rs +++ b/tests/run-coverage/loops_branches.rs diff --git a/tests/run-make/coverage-reports/expected_show_coverage.match_or_pattern.txt b/tests/run-coverage/match_or_pattern.coverage index a0fccb24f99..a0fccb24f99 100644 --- a/tests/run-make/coverage-reports/expected_show_coverage.match_or_pattern.txt +++ b/tests/run-coverage/match_or_pattern.coverage diff --git a/tests/run-make/coverage/match_or_pattern.rs b/tests/run-coverage/match_or_pattern.rs index 4c6a8a9b703..4c6a8a9b703 100644 --- a/tests/run-make/coverage/match_or_pattern.rs +++ b/tests/run-coverage/match_or_pattern.rs diff --git a/tests/run-make/coverage-reports/expected_show_coverage.nested_loops.txt b/tests/run-coverage/nested_loops.coverage index 0dbd6bcf313..0dbd6bcf313 100644 --- a/tests/run-make/coverage-reports/expected_show_coverage.nested_loops.txt +++ b/tests/run-coverage/nested_loops.coverage diff --git a/tests/run-make/coverage/nested_loops.rs b/tests/run-coverage/nested_loops.rs index 4c7c7842796..4c7c7842796 100644 --- a/tests/run-make/coverage/nested_loops.rs +++ b/tests/run-coverage/nested_loops.rs diff --git a/tests/run-make/coverage-reports/expected_show_coverage.no_cov_crate.txt b/tests/run-coverage/no_cov_crate.coverage index 83a9204136f..83a9204136f 100644 --- a/tests/run-make/coverage-reports/expected_show_coverage.no_cov_crate.txt +++ b/tests/run-coverage/no_cov_crate.coverage diff --git a/tests/run-make/coverage/no_cov_crate.rs b/tests/run-coverage/no_cov_crate.rs index 0bfbdda2cab..0bfbdda2cab 100644 --- a/tests/run-make/coverage/no_cov_crate.rs +++ b/tests/run-coverage/no_cov_crate.rs diff --git a/tests/run-make/coverage-reports/expected_show_coverage.overflow.txt b/tests/run-coverage/overflow.coverage index 25e822bffd1..95043759166 100644 --- a/tests/run-make/coverage-reports/expected_show_coverage.overflow.txt +++ b/tests/run-coverage/overflow.coverage @@ -1,5 +1,5 @@ 1| |#![allow(unused_assignments)] - 2| |// expect-exit-status-101 + 2| |// failure-status: 101 3| | 4| 4|fn might_overflow(to_add: u32) -> u32 { 5| 4| if to_add > 5 { diff --git a/tests/run-make/coverage/overflow.rs b/tests/run-coverage/overflow.rs index e537b0e95c3..7df8de6f3cd 100644 --- a/tests/run-make/coverage/overflow.rs +++ b/tests/run-coverage/overflow.rs @@ -1,5 +1,5 @@ #![allow(unused_assignments)] -// expect-exit-status-101 +// failure-status: 101 fn might_overflow(to_add: u32) -> u32 { if to_add > 5 { diff --git a/tests/run-make/coverage-reports/expected_show_coverage.panic_unwind.txt b/tests/run-coverage/panic_unwind.coverage index 114507dc9fd..58b9ba448ee 100644 --- a/tests/run-make/coverage-reports/expected_show_coverage.panic_unwind.txt +++ b/tests/run-coverage/panic_unwind.coverage @@ -1,5 +1,5 @@ 1| |#![allow(unused_assignments)] - 2| |// expect-exit-status-101 + 2| |// failure-status: 101 3| | 4| 4|fn might_panic(should_panic: bool) { 5| 4| if should_panic { diff --git a/tests/run-make/coverage/panic_unwind.rs b/tests/run-coverage/panic_unwind.rs index 03128c2cce6..638d2eb6aaa 100644 --- a/tests/run-make/coverage/panic_unwind.rs +++ b/tests/run-coverage/panic_unwind.rs @@ -1,5 +1,5 @@ #![allow(unused_assignments)] -// expect-exit-status-101 +// failure-status: 101 fn might_panic(should_panic: bool) { if should_panic { diff --git a/tests/run-make/coverage-reports/expected_show_coverage.partial_eq.txt b/tests/run-coverage/partial_eq.coverage index a77175af663..a77175af663 100644 --- a/tests/run-make/coverage-reports/expected_show_coverage.partial_eq.txt +++ b/tests/run-coverage/partial_eq.coverage diff --git a/tests/run-make/coverage/partial_eq.rs b/tests/run-coverage/partial_eq.rs index 4ceaba9b111..4ceaba9b111 100644 --- a/tests/run-make/coverage/partial_eq.rs +++ b/tests/run-coverage/partial_eq.rs diff --git a/tests/run-make/coverage-reports/expected_show_coverage.simple_loop.txt b/tests/run-coverage/simple_loop.coverage index feb83bad674..feb83bad674 100644 --- a/tests/run-make/coverage-reports/expected_show_coverage.simple_loop.txt +++ b/tests/run-coverage/simple_loop.coverage diff --git a/tests/run-make/coverage/simple_loop.rs b/tests/run-coverage/simple_loop.rs index 6f7f23475b8..6f7f23475b8 100644 --- a/tests/run-make/coverage/simple_loop.rs +++ b/tests/run-coverage/simple_loop.rs diff --git a/tests/run-make/coverage-reports/expected_show_coverage.simple_match.txt b/tests/run-coverage/simple_match.coverage index b9298213111..b9298213111 100644 --- a/tests/run-make/coverage-reports/expected_show_coverage.simple_match.txt +++ b/tests/run-coverage/simple_match.coverage diff --git a/tests/run-make/coverage/simple_match.rs b/tests/run-coverage/simple_match.rs index be99e59a826..be99e59a826 100644 --- a/tests/run-make/coverage/simple_match.rs +++ b/tests/run-coverage/simple_match.rs diff --git a/tests/run-make/coverage-reports/expected_show_coverage.sort_groups.txt b/tests/run-coverage/sort_groups.coverage index 81468cb35da..81468cb35da 100644 --- a/tests/run-make/coverage-reports/expected_show_coverage.sort_groups.txt +++ b/tests/run-coverage/sort_groups.coverage diff --git a/tests/run-make/coverage/sort_groups.rs b/tests/run-coverage/sort_groups.rs index f89f9f3ec61..f89f9f3ec61 100644 --- a/tests/run-make/coverage/sort_groups.rs +++ b/tests/run-coverage/sort_groups.rs diff --git a/tests/run-make/coverage-reports/expected_show_coverage.test_harness.txt b/tests/run-coverage/test_harness.coverage index 93bd1cfcb48..93bd1cfcb48 100644 --- a/tests/run-make/coverage-reports/expected_show_coverage.test_harness.txt +++ b/tests/run-coverage/test_harness.coverage diff --git a/tests/run-make/coverage/test_harness.rs b/tests/run-coverage/test_harness.rs index 12a755734c1..12a755734c1 100644 --- a/tests/run-make/coverage/test_harness.rs +++ b/tests/run-coverage/test_harness.rs diff --git a/tests/run-make/coverage-reports/expected_show_coverage.tight_inf_loop.txt b/tests/run-coverage/tight_inf_loop.coverage index 2d4c57f451a..2d4c57f451a 100644 --- a/tests/run-make/coverage-reports/expected_show_coverage.tight_inf_loop.txt +++ b/tests/run-coverage/tight_inf_loop.coverage diff --git a/tests/run-make/coverage/tight_inf_loop.rs b/tests/run-coverage/tight_inf_loop.rs index cef99027aaa..cef99027aaa 100644 --- a/tests/run-make/coverage/tight_inf_loop.rs +++ b/tests/run-coverage/tight_inf_loop.rs diff --git a/tests/run-make/coverage-reports/expected_show_coverage.try_error_result.txt b/tests/run-coverage/try_error_result.coverage index 0ad0180b761..efe573a5607 100644 --- a/tests/run-make/coverage-reports/expected_show_coverage.try_error_result.txt +++ b/tests/run-coverage/try_error_result.coverage @@ -1,5 +1,5 @@ 1| |#![allow(unused_assignments)] - 2| |// expect-exit-status-1 + 2| |// failure-status: 1 3| | 4| 6|fn call(return_error: bool) -> Result<(),()> { 5| 6| if return_error { diff --git a/tests/run-make/coverage/try_error_result.rs b/tests/run-coverage/try_error_result.rs index cd0acf72302..9eb1d2db218 100644 --- a/tests/run-make/coverage/try_error_result.rs +++ b/tests/run-coverage/try_error_result.rs @@ -1,5 +1,5 @@ #![allow(unused_assignments)] -// expect-exit-status-1 +// failure-status: 1 fn call(return_error: bool) -> Result<(),()> { if return_error { diff --git a/tests/run-make/coverage-reports/expected_show_coverage.unused.txt b/tests/run-coverage/unused.coverage index 15fcf21c0ef..15fcf21c0ef 100644 --- a/tests/run-make/coverage-reports/expected_show_coverage.unused.txt +++ b/tests/run-coverage/unused.coverage diff --git a/tests/run-make/coverage/unused.rs b/tests/run-coverage/unused.rs index fb6113eb01c..fb6113eb01c 100644 --- a/tests/run-make/coverage/unused.rs +++ b/tests/run-coverage/unused.rs diff --git a/tests/run-coverage/unused_mod.coverage b/tests/run-coverage/unused_mod.coverage new file mode 100644 index 00000000000..e1d82f66f75 --- /dev/null +++ b/tests/run-coverage/unused_mod.coverage @@ -0,0 +1,13 @@ +$DIR/auxiliary/unused_mod_helper.rs: + 1| 0|pub fn never_called_function() { + 2| 0| println!("I am never called"); + 3| 0|} + +$DIR/unused_mod.rs: + 1| |#[path = "auxiliary/unused_mod_helper.rs"] + 2| |mod unused_module; + 3| | + 4| 1|fn main() { + 5| 1| println!("hello world!"); + 6| 1|} + diff --git a/tests/run-make/coverage/unused_mod.rs b/tests/run-coverage/unused_mod.rs index 679b4e53188..6e62839c998 100644 --- a/tests/run-make/coverage/unused_mod.rs +++ b/tests/run-coverage/unused_mod.rs @@ -1,4 +1,4 @@ -#[path = "lib/unused_mod_helper.rs"] +#[path = "auxiliary/unused_mod_helper.rs"] mod unused_module; fn main() { diff --git a/tests/run-make/coverage-reports/expected_show_coverage.uses_crate.txt b/tests/run-coverage/uses_crate.coverage index 412f4a93b9c..a3b78e21405 100644 --- a/tests/run-make/coverage-reports/expected_show_coverage.uses_crate.txt +++ b/tests/run-coverage/uses_crate.coverage @@ -1,6 +1,7 @@ +$DIR/auxiliary/used_crate.rs: 1| |#![allow(unused_assignments, unused_variables)] - 2| |// compile-flags: -C opt-level=3 # validates coverage now works with optimizations - 3| |use std::fmt::Debug; + 2| |// compile-flags: -C opt-level=3 + 3| |use std::fmt::Debug; // ^^ validates coverage now works with optimizations 4| | 5| 1|pub fn used_function() { 6| 1| // Initialize test constants in a way that cannot be determined at compile time, to ensure @@ -146,3 +147,24 @@ 99| |// functions" list, which would then omit coverage results for 100| |// `unused_generic_function<T>()`, below. +$DIR/uses_crate.rs: + 1| |// FIXME #110395 + 2| |// ignore-linux + 3| | + 4| |// Validates coverage now works with optimizations + 5| |// compile-flags: -C opt-level=3 + 6| | + 7| |#![allow(unused_assignments, unused_variables)] + 8| | + 9| |// aux-build:used_crate.rs + 10| |extern crate used_crate; + 11| | + 12| 1|fn main() { + 13| 1| used_crate::used_function(); + 14| 1| let some_vec = vec![1, 2, 3, 4]; + 15| 1| used_crate::used_only_from_bin_crate_generic_function(&some_vec); + 16| 1| used_crate::used_only_from_bin_crate_generic_function("used from bin uses_crate.rs"); + 17| 1| used_crate::used_from_bin_crate_and_lib_crate_generic_function(some_vec); + 18| 1| used_crate::used_with_same_type_from_bin_crate_and_lib_crate_generic_function("interesting?"); + 19| 1|} + diff --git a/tests/run-make/coverage/uses_crate.rs b/tests/run-coverage/uses_crate.rs index 1ee8037a1e7..ab466970f8e 100644 --- a/tests/run-make/coverage/uses_crate.rs +++ b/tests/run-coverage/uses_crate.rs @@ -1,8 +1,12 @@ // FIXME #110395 -// ignore-llvm-cov-show-diffs +// ignore-linux + +// Validates coverage now works with optimizations +// compile-flags: -C opt-level=3 #![allow(unused_assignments, unused_variables)] -// compile-flags: -C opt-level=3 # validates coverage now works with optimizations + +// aux-build:used_crate.rs extern crate used_crate; fn main() { diff --git a/tests/run-make/coverage-reports/expected_show_coverage.uses_inline_crate.txt b/tests/run-coverage/uses_inline_crate.coverage index 66ca9e80a32..f878d8107c5 100644 --- a/tests/run-make/coverage-reports/expected_show_coverage.uses_inline_crate.txt +++ b/tests/run-coverage/uses_inline_crate.coverage @@ -1,7 +1,8 @@ +$DIR/auxiliary/used_inline_crate.rs: 1| |#![allow(unused_assignments, unused_variables)] 2| | - 3| |// compile-flags: -C opt-level=3 # validates coverage now works with optimizations - 4| | + 3| |// compile-flags: -C opt-level=3 + 4| |// ^^ validates coverage now works with optimizations 5| |use std::fmt::Debug; 6| | 7| 1|pub fn used_function() { @@ -137,3 +138,27 @@ 89| 2| used_only_from_this_lib_crate_generic_function("used ONLY from library used_crate.rs"); 90| 2|} +$DIR/uses_inline_crate.rs: + 1| |// FIXME #110395 + 2| |// ignore-linux + 3| | + 4| |// Validates coverage now works with optimizations + 5| |// compile-flags: -C opt-level=3 + 6| | + 7| |#![allow(unused_assignments, unused_variables)] + 8| | + 9| |// aux-build:used_inline_crate.rs + 10| |extern crate used_inline_crate; + 11| | + 12| 1|fn main() { + 13| 1| used_inline_crate::used_function(); + 14| 1| used_inline_crate::used_inline_function(); + 15| 1| let some_vec = vec![1, 2, 3, 4]; + 16| 1| used_inline_crate::used_only_from_bin_crate_generic_function(&some_vec); + 17| 1| used_inline_crate::used_only_from_bin_crate_generic_function("used from bin uses_crate.rs"); + 18| 1| used_inline_crate::used_from_bin_crate_and_lib_crate_generic_function(some_vec); + 19| 1| used_inline_crate::used_with_same_type_from_bin_crate_and_lib_crate_generic_function( + 20| 1| "interesting?", + 21| 1| ); + 22| 1|} + diff --git a/tests/run-make/coverage/uses_inline_crate.rs b/tests/run-coverage/uses_inline_crate.rs index f7aff3c3f8a..4bd66d2f89c 100644 --- a/tests/run-make/coverage/uses_inline_crate.rs +++ b/tests/run-coverage/uses_inline_crate.rs @@ -1,10 +1,12 @@ // FIXME #110395 -// ignore-llvm-cov-show-diffs +// ignore-linux -#![allow(unused_assignments, unused_variables)] +// Validates coverage now works with optimizations +// compile-flags: -C opt-level=3 -// compile-flags: -C opt-level=3 # validates coverage now works with optimizations +#![allow(unused_assignments, unused_variables)] +// aux-build:used_inline_crate.rs extern crate used_inline_crate; fn main() { diff --git a/tests/run-make/coverage-reports/expected_show_coverage.while.txt b/tests/run-coverage/while.coverage index efa7d083f0c..efa7d083f0c 100644 --- a/tests/run-make/coverage-reports/expected_show_coverage.while.txt +++ b/tests/run-coverage/while.coverage diff --git a/tests/run-make/coverage/while.rs b/tests/run-coverage/while.rs index 781b90b3566..781b90b3566 100644 --- a/tests/run-make/coverage/while.rs +++ b/tests/run-coverage/while.rs diff --git a/tests/run-make/coverage-reports/expected_show_coverage.while_early_ret.txt b/tests/run-coverage/while_early_ret.coverage index d19afc0de61..2ce94e0131d 100644 --- a/tests/run-make/coverage-reports/expected_show_coverage.while_early_ret.txt +++ b/tests/run-coverage/while_early_ret.coverage @@ -1,5 +1,5 @@ 1| |#![allow(unused_assignments)] - 2| |// expect-exit-status-1 + 2| |// failure-status: 1 3| | 4| 1|fn main() -> Result<(),u8> { 5| 1| let mut countdown = 10; diff --git a/tests/run-make/coverage/while_early_ret.rs b/tests/run-coverage/while_early_ret.rs index 1fcea9c85c4..1c83c8fc7a8 100644 --- a/tests/run-make/coverage/while_early_ret.rs +++ b/tests/run-coverage/while_early_ret.rs @@ -1,5 +1,5 @@ #![allow(unused_assignments)] -// expect-exit-status-1 +// failure-status: 1 fn main() -> Result<(),u8> { let mut countdown = 10; diff --git a/tests/run-make/coverage-reports/expected_show_coverage.yield.txt b/tests/run-coverage/yield.coverage index 6e2f23ee77b..6e2f23ee77b 100644 --- a/tests/run-make/coverage-reports/expected_show_coverage.yield.txt +++ b/tests/run-coverage/yield.coverage diff --git a/tests/run-make/coverage/yield.rs b/tests/run-coverage/yield.rs index ff7616656ff..ff7616656ff 100644 --- a/tests/run-make/coverage/yield.rs +++ b/tests/run-coverage/yield.rs diff --git a/tests/run-make-fulldeps/obtain-borrowck/driver.rs b/tests/run-make-fulldeps/obtain-borrowck/driver.rs index b59a65a713f..04c551cf4bb 100644 --- a/tests/run-make-fulldeps/obtain-borrowck/driver.rs +++ b/tests/run-make-fulldeps/obtain-borrowck/driver.rs @@ -27,7 +27,7 @@ use rustc_interface::{Config, Queries}; use rustc_middle::query::queries::mir_borrowck::ProvidedValue; use rustc_middle::query::{ExternProviders, Providers}; use rustc_middle::ty::TyCtxt; -use rustc_session::Session; +use rustc_session::{Session, EarlyErrorHandler}; use std::cell::RefCell; use std::collections::HashMap; use std::thread_local; @@ -58,6 +58,7 @@ impl rustc_driver::Callbacks for CompilerCalls { // the result. fn after_analysis<'tcx>( &mut self, + _handler: &EarlyErrorHandler, compiler: &Compiler, queries: &'tcx Queries<'tcx>, ) -> Compilation { diff --git a/tests/run-make/const_fn_mir/dump.mir b/tests/run-make/const_fn_mir/dump.mir index 25ac0c7e852..ced170bbeee 100644 --- a/tests/run-make/const_fn_mir/dump.mir +++ b/tests/run-make/const_fn_mir/dump.mir @@ -6,7 +6,7 @@ fn foo() -> i32 { bb0: { _1 = CheckedAdd(const 5_i32, const 6_i32); - assert(!move (_1.1: bool), "attempt to compute `{} + {}`, which would overflow", const 5_i32, const 6_i32) -> bb1; + assert(!move (_1.1: bool), "attempt to compute `{} + {}`, which would overflow", const 5_i32, const 6_i32) -> [success: bb1, unwind continue]; } bb1: { @@ -22,7 +22,7 @@ fn foo() -> i32 { bb0: { _1 = CheckedAdd(const 5_i32, const 6_i32); - assert(!move (_1.1: bool), "attempt to compute `{} + {}`, which would overflow", const 5_i32, const 6_i32) -> bb1; + assert(!move (_1.1: bool), "attempt to compute `{} + {}`, which would overflow", const 5_i32, const 6_i32) -> [success: bb1, unwind continue]; } bb1: { @@ -36,7 +36,7 @@ fn main() -> () { let _1: i32; bb0: { - _1 = foo() -> bb1; + _1 = foo() -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/run-make/coverage-llvmir/Makefile b/tests/run-make/coverage-llvmir/Makefile index 7be65505332..be92f8ac8fc 100644 --- a/tests/run-make/coverage-llvmir/Makefile +++ b/tests/run-make/coverage-llvmir/Makefile @@ -6,7 +6,7 @@ # version during testing, with an additional directive at the top of this file # that sets, for example: `min-llvm-version: 12.0` -include ../coverage/coverage_tools.mk +include ../tools.mk BASEDIR=../coverage-llvmir diff --git a/tests/run-make/coverage-reports/Makefile b/tests/run-make/coverage-reports/Makefile deleted file mode 100644 index 0ae409c4119..00000000000 --- a/tests/run-make/coverage-reports/Makefile +++ /dev/null @@ -1,178 +0,0 @@ -# needs-profiler-support -# ignore-windows-gnu - -# FIXME(pietroalbini): this test currently does not work on cross-compiled -# targets because remote-test is not capable of sending back the *.profraw -# files generated by the LLVM instrumentation. -# ignore-cross-compile - -# Rust coverage maps support LLVM Coverage Mapping Format versions 5 and 6, -# corresponding with LLVM versions 12 and 13, respectively. -# When upgrading LLVM versions, consider whether to enforce a minimum LLVM -# version during testing, with an additional directive at the top of this file -# that sets, for example: `min-llvm-version: 12.0` - -# FIXME(mati865): MinGW GCC miscompiles compiler-rt profiling library but with Clang it works -# properly. Since we only have GCC on the CI ignore the test for now. - -include ../coverage/coverage_tools.mk - -BASEDIR=../coverage-reports -SOURCEDIR=../coverage - -# The `llvm-cov show` flag `--debug`, used to generate the `counters` output files, is only -# enabled if LLVM assertions are enabled. This requires Rust config `llvm/optimize` and not -# `llvm/release_debuginfo`. Note that some CI builds disable debug assertions (by setting -# `NO_LLVM_ASSERTIONS=1`), so the tests must still pass even if the `--debug` flag is -# not supported. (Note that `counters` files are only produced in the `$(TMPDIR)` -# directory, for inspection and debugging support. They are *not* copied to `expected_*` -# files when `--bless`ed.) -LLVM_COV_DEBUG := $(shell \ - "$(LLVM_BIN_DIR)"/llvm-cov show --debug 2>&1 | \ - grep -q "Unknown command line argument '--debug'"; \ - echo $$?) -ifeq ($(LLVM_COV_DEBUG), 1) -DEBUG_FLAG=--debug -endif - -# FIXME(richkadel): I'm adding `--ignore-filename-regex=` line(s) for specific test(s) that produce -# `llvm-cov` results for multiple files (for example `uses_crate.rs` and `used_crate/mod.rs`) as a -# workaround for two problems causing tests to fail on Windows: -# -# 1. When multiple files appear in the `llvm-cov show` results, each file's coverage results can -# appear in different a different order. Whether this is random or, somehow, platform-specific, -# the Windows output flips the order of the files, compared to Linux. In the `uses_crate.rs` -# test, the only test-unique (interesting) results we care about are the results for only one -# of the two files, `mod/uses_crate.rs`, so the workaround is to ignore all but this one file. -# In the future, we may want a more sophisticated solution that splits apart `llvm-cov show` -# results into separate results files for each result (taking care not to create new file -# paths that might be too long for Windows MAX_PATH limits when creating these new sub-results, -# as well). -# 2. When multiple files appear in the `llvm-cov show` results, the results for each file are -# prefixed with their filename, including platform-specific path separators (`\` for Windows, -# and `/` everywhere else). This could be filtered or normalized of course, but by ignoring -# coverage results for all but one of the file, the filenames are no longer included anyway. -# If this changes (if/when we decide to support `llvm-cov show` results for multiple files), -# the file path separator differences may need to be addressed. -# -# Since this is only a workaround, I decided to implement the override by adding an option for -# each file to be ignored, using a `--ignore-filename-regex=` entry for each one, rather than -# implement some more sophisticated solution with a new custom test directive in the test file -# itself (similar to `expect-exit-status`) because that would add a lot of complexity and still -# be a workaround, with the same result, with no benefit. -# -# Yes these `--ignore-filename-regex=` options are included in all invocations of `llvm-cov show` -# for now, but it is effectively ignored for all tests that don't include this file anyway. -# -# (Note that it's also possible the `_counters.<test>.txt` and `<test>.json` files (if generated) -# may order results from multiple files inconsistently, which might also have to be accommodated -# if and when we allow `llvm-cov` to produce results for multiple files. Note, the path separators -# appear to be normalized to `/` in those files, thankfully.) -LLVM_COV_IGNORE_FILES=\ - --ignore-filename-regex='(uses_crate.rs|uses_inline_crate.rs|unused_mod.rs)' - -all: $(patsubst $(SOURCEDIR)/lib/%.rs,%,$(wildcard $(SOURCEDIR)/lib/*.rs)) $(patsubst $(SOURCEDIR)/%.rs,%,$(wildcard $(SOURCEDIR)/*.rs)) - -# Ensure there are no `expected` results for tests that may have been removed or renamed -.PHONY: clear_expected_if_blessed -clear_expected_if_blessed: -ifdef RUSTC_BLESS_TEST - rm -f expected_* -endif - --include clear_expected_if_blessed - -%: $(SOURCEDIR)/lib/%.rs - # Compile the test library with coverage instrumentation - $(RUSTC) $(SOURCEDIR)/lib/$@.rs \ - $$( sed -n 's/^\/\/ compile-flags: \([^#]*\).*/\1/p' $(SOURCEDIR)/lib/$@.rs ) \ - --crate-type rlib -Cinstrument-coverage --target $(TARGET) - -%: $(SOURCEDIR)/%.rs - # Compile the test program with coverage instrumentation - $(RUSTC) $(SOURCEDIR)/$@.rs \ - $$( sed -n 's/^\/\/ compile-flags: \([^#]*\).*/\1/p' $(SOURCEDIR)/$@.rs ) \ - -L "$(TMPDIR)" -Cinstrument-coverage --target $(TARGET) - - # Run it in order to generate some profiling data, - # with `LLVM_PROFILE_FILE=<profdata_file>` environment variable set to - # output the coverage stats for this run. - LLVM_PROFILE_FILE="$(TMPDIR)"/$@.profraw \ - $(call RUN,$@) || \ - ( \ - status=$$?; \ - grep -q "^\/\/ expect-exit-status-$$status" $(SOURCEDIR)/$@.rs || \ - ( >&2 echo "program exited with an unexpected exit status: $$status"; \ - false \ - ) \ - ) - - # Run it through rustdoc as well to cover doctests. - # `%p` is the pid, and `%m` the binary signature. We suspect that the pid alone - # might result in overwritten files and failed tests, as rustdoc spawns each - # doctest as its own process, so make sure the filename is as unique as possible. - LLVM_PROFILE_FILE="$(TMPDIR)"/$@-%p-%m.profraw \ - $(RUSTDOC) --crate-name workaround_for_79771 --test $(SOURCEDIR)/$@.rs \ - $$( sed -n 's/^\/\/ compile-flags: \([^#]*\).*/\1/p' $(SOURCEDIR)/$@.rs ) \ - -L "$(TMPDIR)" -Cinstrument-coverage \ - -Z unstable-options --persist-doctests=$(TMPDIR)/rustdoc-$@ - - # Postprocess the profiling data so it can be used by the llvm-cov tool - "$(LLVM_BIN_DIR)"/llvm-profdata merge --sparse \ - "$(TMPDIR)"/$@*.profraw \ - -o "$(TMPDIR)"/$@.profdata - - # Generate a coverage report using `llvm-cov show`. - "$(LLVM_BIN_DIR)"/llvm-cov show \ - $(DEBUG_FLAG) \ - $(LLVM_COV_IGNORE_FILES) \ - --compilation-dir=. \ - --Xdemangler="$(RUST_DEMANGLER)" \ - --show-line-counts-or-regions \ - --instr-profile="$(TMPDIR)"/$@.profdata \ - $(call BIN,"$(TMPDIR)"/$@) \ - $$( \ - for file in $(TMPDIR)/rustdoc-$@/*/rust_out*; do \ - [ -x "$$file" ] && printf "%s %s " -object $$file; \ - done \ - ) \ - 2> "$(TMPDIR)"/show_coverage_stderr.$@.txt \ - | "$(PYTHON)" $(BASEDIR)/normalize_paths.py \ - | "$(PYTHON)" $(BASEDIR)/sort_subviews.py \ - > "$(TMPDIR)"/actual_show_coverage.$@.txt || \ - ( status=$$? ; \ - >&2 cat "$(TMPDIR)"/show_coverage_stderr.$@.txt ; \ - exit $$status \ - ) - -ifdef DEBUG_FLAG - # The first line (beginning with "Args:" contains hard-coded, build-specific - # file paths. Strip that line and keep the remaining lines with counter debug - # data. - tail -n +2 "$(TMPDIR)"/show_coverage_stderr.$@.txt \ - > "$(TMPDIR)"/actual_show_coverage_counters.$@.txt -endif - -ifdef RUSTC_BLESS_TEST - cp "$(TMPDIR)"/actual_show_coverage.$@.txt \ - expected_show_coverage.$@.txt -else - # Compare the show coverage output (`--bless` refreshes `typical` files). - # - # `llvm-cov show` normally prints instantiation groups in an unpredictable - # order, but we have used `sort_subviews.py` to sort them, so we can still - # check the output directly with `diff`. - # - # Some of the test cases are currently not working (since #110393) and have - # been marked with `// ignore-llvm-cov-show-diffs` so that they don't fail - # the build. - - $(DIFF) \ - expected_show_coverage.$@.txt "$(TMPDIR)"/actual_show_coverage.$@.txt || \ - ( grep -q '^\/\/ ignore-llvm-cov-show-diffs' $(SOURCEDIR)/$@.rs && \ - >&2 echo 'diff failed, but suppressed with `// ignore-llvm-cov-show-diffs` in $(SOURCEDIR)/$@.rs' \ - ) || \ - ( >&2 echo 'diff failed, and not suppressed without `// ignore-llvm-cov-show-diffs` in $(SOURCEDIR)/$@.rs'; \ - false \ - ) -endif diff --git a/tests/run-make/coverage-reports/expected_show_coverage.unused_mod.txt b/tests/run-make/coverage-reports/expected_show_coverage.unused_mod.txt deleted file mode 100644 index 82d6fccc271..00000000000 --- a/tests/run-make/coverage-reports/expected_show_coverage.unused_mod.txt +++ /dev/null @@ -1,4 +0,0 @@ - 1| 0|pub fn never_called_function() { - 2| 0| println!("I am never called"); - 3| 0|} - diff --git a/tests/run-make/coverage-reports/normalize_paths.py b/tests/run-make/coverage-reports/normalize_paths.py deleted file mode 100755 index e5777ad2512..00000000000 --- a/tests/run-make/coverage-reports/normalize_paths.py +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env python - -from __future__ import print_function - -import sys - -# Normalize file paths in output -for line in sys.stdin: - if line.startswith("..") and line.rstrip().endswith(".rs:"): - print(line.replace("\\", "/"), end='') - else: - print(line, end='') diff --git a/tests/run-make/coverage-reports/sort_subviews.py b/tests/run-make/coverage-reports/sort_subviews.py deleted file mode 100755 index 10cfc51d447..00000000000 --- a/tests/run-make/coverage-reports/sort_subviews.py +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/env python3 - -# `llvm-cov show` prints grouped subviews (e.g. for generic functions) in an -# unstable order, which is inconvenient when checking output snapshots with -# `diff`. To work around that, this script detects consecutive subviews in its -# piped input, and sorts them while preserving their contents. - -from __future__ import print_function - -import sys - - -def main(): - subviews = [] - - def flush_subviews(): - if not subviews: - return - - # The last "subview" should be just a boundary line on its own, so - # temporarily remove it before sorting the accumulated subviews. - terminator = subviews.pop() - subviews.sort() - subviews.append(terminator) - - for view in subviews: - for line in view: - print(line, end="") - - subviews.clear() - - for line in sys.stdin: - if line.startswith(" ------------------"): - # This is a subview boundary line, so start a new subview. - subviews.append([line]) - elif line.startswith(" |"): - # Add this line to the current subview. - subviews[-1].append(line) - else: - # This line is not part of a subview, so sort and print any - # accumulated subviews, and then print the line as-is. - flush_subviews() - print(line, end="") - - flush_subviews() - assert not subviews - - -if __name__ == "__main__": - main() diff --git a/tests/run-make/coverage/WARNING_KEEP_NAMES_SHORT.txt b/tests/run-make/coverage/WARNING_KEEP_NAMES_SHORT.txt deleted file mode 100644 index 6a1403b8a00..00000000000 --- a/tests/run-make/coverage/WARNING_KEEP_NAMES_SHORT.txt +++ /dev/null @@ -1,10 +0,0 @@ -IMPORTANT: The Rust test programs in this directory generate various output -files in the `../coverage*` directories (`expected` and `actual` files). - -Microsoft Windows has a relatively short limit on file paths (not individual -path components, but the entire path). The files generated by these -`../coverage*` tests typically have file paths that include the program -source file name plus function and type names (depending on the program). - -Keep the test file names short, and keep function names and other symbols -short as well, to avoid hitting the Windows limits. diff --git a/tests/run-make/coverage/compiletest-ignore-dir b/tests/run-make/coverage/compiletest-ignore-dir deleted file mode 100644 index 470ff996098..00000000000 --- a/tests/run-make/coverage/compiletest-ignore-dir +++ /dev/null @@ -1,3 +0,0 @@ -# Directory "coverage" supports the tests at prefix ../coverage-* - -# Use ./x.py [options] test tests/run-make/coverage to run all related tests. diff --git a/tests/run-make/coverage/coverage_tools.mk b/tests/run-make/coverage/coverage_tools.mk deleted file mode 100644 index 028c020a461..00000000000 --- a/tests/run-make/coverage/coverage_tools.mk +++ /dev/null @@ -1,6 +0,0 @@ -# Common Makefile include for Rust `run-make/coverage-* tests. Include this -# file with the line: -# -# include ../coverage/coverage_tools.mk - -include ../tools.mk diff --git a/tests/run-make/optimization-remarks-dir/Makefile b/tests/run-make/optimization-remarks-dir/Makefile new file mode 100644 index 00000000000..a8342c8ad14 --- /dev/null +++ b/tests/run-make/optimization-remarks-dir/Makefile @@ -0,0 +1,12 @@ +include ../tools.mk + +PROFILE_DIR=$(TMPDIR)/profiles + +all: check_inline check_filter + +check_inline: + $(RUSTC) -O foo.rs --crate-type=lib -Cremark=all -Zremark-dir=$(PROFILE_DIR) + cat $(PROFILE_DIR)/*.opt.yaml | $(CGREP) -e "inline" +check_filter: + $(RUSTC) -O foo.rs --crate-type=lib -Cremark=foo -Zremark-dir=$(PROFILE_DIR) + cat $(PROFILE_DIR)/*.opt.yaml | $(CGREP) -e -v "inline" diff --git a/tests/run-make/optimization-remarks-dir/foo.rs b/tests/run-make/optimization-remarks-dir/foo.rs new file mode 100644 index 00000000000..6ac3af0dcad --- /dev/null +++ b/tests/run-make/optimization-remarks-dir/foo.rs @@ -0,0 +1,6 @@ +#[inline(never)] +pub fn bar() {} + +pub fn foo() { + bar(); +} diff --git a/tests/run-make/rust-lld/Makefile b/tests/run-make/rust-lld/Makefile new file mode 100644 index 00000000000..f8526530d4d --- /dev/null +++ b/tests/run-make/rust-lld/Makefile @@ -0,0 +1,8 @@ +include ../tools.mk + +# ignore-msvc +# needs-rust-lld +# ignore-s390x lld does not yet support s390x as target +all: + RUSTC_LOG=rustc_codegen_ssa::back::link=info $(RUSTC) -Clink-self-contained=+linker -Clinker-flavor=gnu-lld-cc -Zunstable-options -Clink-args=-Wl,-v main.rs 2> $(TMPDIR)/output.txt + $(CGREP) -e "^LLD [0-9]+\.[0-9]+\.[0-9]+" < $(TMPDIR)/output.txt diff --git a/tests/run-make/rust-lld/main.rs b/tests/run-make/rust-lld/main.rs new file mode 100644 index 00000000000..bf159cd941c --- /dev/null +++ b/tests/run-make/rust-lld/main.rs @@ -0,0 +1,4 @@ +// Test linking using `cc` with `rust-lld`, using the unstable CLI described in MCP 510 +// see https://github.com/rust-lang/compiler-team/issues/510 for more info + +fn main() {} diff --git a/tests/run-make/rustdoc-themes/foo.rs b/tests/run-make/rustdoc-themes/foo.rs index 995544aeff9..8b1e75b0ae1 100644 --- a/tests/run-make/rustdoc-themes/foo.rs +++ b/tests/run-make/rustdoc-themes/foo.rs @@ -1,4 +1,4 @@ // @has test.css // @has foo/struct.Foo.html -// @has - '//*[@id="rustdoc-vars"]/@data-themes' 'test' +// @has - '//*[@name="rustdoc-vars"]/@data-themes' 'test' pub struct Foo; diff --git a/tests/rustdoc-gui/label-next-to-symbol.goml b/tests/rustdoc-gui/label-next-to-symbol.goml index 6c6380256bd..eb603d6c6b6 100644 --- a/tests/rustdoc-gui/label-next-to-symbol.goml +++ b/tests/rustdoc-gui/label-next-to-symbol.goml @@ -37,7 +37,6 @@ compare-elements-position: ( ("y"), ) - // Mobile view set-window-size: (600, 600) // staggered layout with 2em spacing @@ -64,3 +63,14 @@ compare-elements-position-false: ( "//*[@class='desc docblock-short'][text()='a thing with a label']", ("y"), ) + +// Ensure it doesn't expand. +set-window-size: (800, 800) +go-to: "file://" + |DOC_PATH| + "/test_docs/cfgs/index.html" +// This part of the tags should not be on the same line as the beginning since the width +// is too small for that. +compare-elements-position-false: ( + "//*[@class='stab portability']/code[text()='appservice-api-c']", + "//*[@class='stab portability']/code[text()='server']", + ("y"), +) diff --git a/tests/rustdoc-gui/notable-trait.goml b/tests/rustdoc-gui/notable-trait.goml index 371931d51fc..e10bb538f07 100644 --- a/tests/rustdoc-gui/notable-trait.goml +++ b/tests/rustdoc-gui/notable-trait.goml @@ -175,11 +175,11 @@ call-function: ( "check-colors", { "theme": "ayu", - "link_color": "rgb(57, 175, 215)", - "content_color": "rgb(230, 225, 207)", - "header_color": "rgb(255, 255, 255)", - "type_color": "rgb(255, 160, 165)", - "trait_color": "rgb(57, 175, 215)", + "link_color": "#39afd7", + "content_color": "#e6e1cf", + "header_color": "#fff", + "type_color": "#ffa0a5", + "trait_color": "#39afd7", }, ) @@ -187,11 +187,11 @@ call-function: ( "check-colors", { "theme": "dark", - "link_color": "rgb(210, 153, 29)", - "content_color": "rgb(221, 221, 221)", - "header_color": "rgb(221, 221, 221)", - "type_color": "rgb(45, 191, 184)", - "trait_color": "rgb(183, 140, 242)", + "link_color": "#d2991d", + "content_color": "#ddd", + "header_color": "#ddd", + "type_color": "#2dbfb8", + "trait_color": "#b78cf2", }, ) @@ -199,11 +199,11 @@ call-function: ( "check-colors", { "theme": "light", - "link_color": "rgb(56, 115, 173)", - "content_color": "rgb(0, 0, 0)", - "header_color": "rgb(0, 0, 0)", - "type_color": "rgb(173, 55, 138)", - "trait_color": "rgb(110, 79, 201)", + "link_color": "#3873ad", + "content_color": "black", + "header_color": "black", + "type_color": "#ad378a", + "trait_color": "#6e4fc9", }, ) diff --git a/tests/rustdoc-gui/search-filter.goml b/tests/rustdoc-gui/search-filter.goml index d739471a625..9e2855b5e02 100644 --- a/tests/rustdoc-gui/search-filter.goml +++ b/tests/rustdoc-gui/search-filter.goml @@ -65,9 +65,9 @@ reload: set-timeout: 2000 wait-for: "#crate-search" assert-css: ("#crate-search", { - "border": "1px solid rgb(224, 224, 224)", - "color": "rgb(0, 0, 0)", - "background-color": "rgb(255, 255, 255)", + "border": "1px solid #e0e0e0", + "color": "black", + "background-color": "white", }) // We now check the dark theme. @@ -75,15 +75,15 @@ click: "#settings-menu" wait-for: "#settings" click: "#theme-dark" wait-for-css: ("#crate-search", { - "border": "1px solid rgb(224, 224, 224)", - "color": "rgb(221, 221, 221)", - "background-color": "rgb(53, 53, 53)", + "border": "1px solid #e0e0e0", + "color": "#ddd", + "background-color": "#353535", }) // And finally we check the ayu theme. click: "#theme-ayu" wait-for-css: ("#crate-search", { - "border": "1px solid rgb(92, 103, 115)", - "color": "rgb(255, 255, 255)", - "background-color": "rgb(15, 20, 25)", + "border": "1px solid #5c6773", + "color": "#fff", + "background-color": "#0f1419", }) diff --git a/tests/rustdoc-gui/search-result-color.goml b/tests/rustdoc-gui/search-result-color.goml index e3c628b366f..7a7785fd9ac 100644 --- a/tests/rustdoc-gui/search-result-color.goml +++ b/tests/rustdoc-gui/search-result-color.goml @@ -61,7 +61,7 @@ assert-css: ( {"color": "#c5c5c5"}, ) assert-css: ( - "//*[@class='result-name']/*[text()='test_docs::']", + "//*[@class='result-name']//*[text()='test_docs::']", {"color": "#0096cf"}, ) @@ -138,7 +138,7 @@ call-function: ( move-cursor-to: ".search-input" focus: ".search-input" // To ensure the `<a>` container isnt focus or hover. assert-css: ( - "//*[@class='result-name']/*[text()='test_docs::']/ancestor::a", + "//*[@class='result-name']//*[text()='test_docs::']/ancestor::a", {"color": "#0096cf", "background-color": "transparent"}, ALL, ) @@ -146,11 +146,11 @@ assert-css: ( // Checking color and background on hover. move-cursor-to: "//*[@class='desc'][text()='Just a normal struct.']" assert-css: ( - "//*[@class='result-name']/*[text()='test_docs::']", + "//*[@class='result-name']//*[text()='test_docs::']", {"color": "#fff"}, ) assert-css: ( - "//*[@class='result-name']/*[text()='test_docs::']/ancestor::a", + "//*[@class='result-name']//*[text()='test_docs::']/ancestor::a", {"color": "#fff", "background-color": "rgb(60, 60, 60)"}, ) @@ -173,7 +173,7 @@ assert-css: ( {"color": "#ddd"}, ) assert-css: ( - "//*[@class='result-name']/*[text()='test_docs::']", + "//*[@class='result-name']//*[text()='test_docs::']", {"color": "#ddd"}, ) @@ -250,7 +250,7 @@ call-function: ( move-cursor-to: ".search-input" focus: ".search-input" // To ensure the `<a>` container isnt focus or hover. assert-css: ( - "//*[@class='result-name']/*[text()='test_docs::']/ancestor::a", + "//*[@class='result-name']//*[text()='test_docs::']/ancestor::a", {"color": "#ddd", "background-color": "transparent"}, ) @@ -270,7 +270,7 @@ assert-css: ( {"color": "#000"}, ) assert-css: ( - "//*[@class='result-name']/*[text()='test_docs::']", + "//*[@class='result-name']//*[text()='test_docs::']", {"color": "#000"}, ) @@ -347,7 +347,7 @@ call-function: ( move-cursor-to: ".search-input" focus: ".search-input" // To ensure the `<a>` container isnt focus or hover. assert-css: ( - "//*[@class='result-name']/*[text()='test_docs::']/ancestor::a", + "//*[@class='result-name']//*[text()='test_docs::']/ancestor::a", {"color": "#000", "background-color": "transparent"}, ) diff --git a/tests/rustdoc-gui/search-result-display.goml b/tests/rustdoc-gui/search-result-display.goml index 6593c1a9c45..6ce13b8c3d3 100644 --- a/tests/rustdoc-gui/search-result-display.goml +++ b/tests/rustdoc-gui/search-result-display.goml @@ -1,3 +1,4 @@ +// ignore-tidy-linelength // Checks that the search results have the expected width. go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" set-window-size: (900, 1000) @@ -7,15 +8,41 @@ press-key: 'Enter' wait-for: "#crate-search" // The width is returned by "getComputedStyle" which returns the exact number instead of the // CSS rule which is "50%"... -assert-size: (".search-results div.desc", {"width": 310}) +assert-size: (".search-results div.desc", {"width": 248}) +store-size: (".search-results .result-name .typename", {"width": width}) set-window-size: (600, 100) // As counter-intuitive as it may seem, in this width, the width is "100%", which is why // when computed it's larger. assert-size: (".search-results div.desc", {"width": 566}) // The result set is all on one line. -assert-css: (".search-results .result-name > span:not(.typename)", {"display": "inline"}) -assert-css: (".search-results .result-name > span.typename", {"display": "inline-block"}) +compare-elements-position-near: ( + ".search-results .result-name .typename", + ".search-results .result-name .path", + {"y": 2}, +) +compare-elements-position-near-false: ( + ".search-results .result-name .typename", + ".search-results .result-name .path", + {"x": 5}, +) +// The width of the "typename" isn't fixed anymore in this display mode. +store-size: (".search-results .result-name .typename", {"width": new_width}) +assert: |new_width| < |width| - 10 + +// Check that if the search is too long on mobile, it'll go under the "typename". +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html?search=SuperIncrediblyLongLongLongLongLongLongLongGigaGigaGigaMegaLongLongLongStructName" +wait-for: "#crate-search" +compare-elements-position-near: ( + ".search-results .result-name .typename", + ".search-results .result-name .path", + {"y": 2, "x": 0}, +) +compare-elements-size-near: ( + ".search-results .result-name", + ".search-results .result-name .path", + {"width": 8, "height": 8}, +) // Check that the crate filter `<select>` is correctly handled when it goes to next line. // To do so we need to update the length of one of its `<option>`. 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 b3f9ae9283f..156d8d03ca2 100644 --- a/tests/rustdoc-gui/search-tab-change-title-fn-sig.goml +++ b/tests/rustdoc-gui/search-tab-change-title-fn-sig.goml @@ -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: (".search-input", "usize,pattern") // 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/src/test_docs/lib.rs b/tests/rustdoc-gui/src/test_docs/lib.rs index c040fa02dff..ecf3a7cc147 100644 --- a/tests/rustdoc-gui/src/test_docs/lib.rs +++ b/tests/rustdoc-gui/src/test_docs/lib.rs @@ -507,3 +507,12 @@ pub mod fields { }, } } + +pub mod cfgs { + #[doc(cfg(all( + any(not(feature = "appservice-api-c"), not(feature = "appservice-api-s")), + any(not(feature = "client"), not(feature = "server")), + )))] + /// Some docs. + pub mod cfgs {} +} diff --git a/tests/rustdoc-js-std/parser-errors.js b/tests/rustdoc-js-std/parser-errors.js index af7f63f99cb..b32bfea5439 100644 --- a/tests/rustdoc-js-std/parser-errors.js +++ b/tests/rustdoc-js-std/parser-errors.js @@ -33,15 +33,24 @@ const PARSED = [ original: "\"P\" \"P\"", returned: [], userQuery: "\"p\" \"p\"", + error: "Cannot have more than one element if you use quotes", + }, + { + query: '"P","P"', + elems: [], + foundElems: 0, + original: "\"P\",\"P\"", + returned: [], + userQuery: "\"p\",\"p\"", error: "Cannot have more than one literal search element", }, { - query: 'P "P"', + query: "P,\"P\"", elems: [], foundElems: 0, - original: "P \"P\"", + original: "P,\"P\"", returned: [], - userQuery: "p \"p\"", + userQuery: "p,\"p\"", error: "Cannot use literal search when there is more than one element", }, { @@ -51,7 +60,16 @@ const PARSED = [ original: "\"p\" p", returned: [], userQuery: "\"p\" p", - error: "You cannot have more than one element if you use quotes", + error: "Cannot have more than one element if you use quotes", + }, + { + query: '"p",p', + elems: [], + foundElems: 0, + original: "\"p\",p", + returned: [], + userQuery: "\"p\",p", + error: "Cannot have more than one element if you use quotes", }, { query: '"const": p', @@ -60,7 +78,7 @@ const PARSED = [ original: "\"const\": p", returned: [], userQuery: "\"const\": p", - error: "You cannot use quotes on type filter", + error: "Cannot use quotes on type filter", }, { query: "a<:a>", @@ -108,6 +126,15 @@ const PARSED = [ error: "Paths cannot start with `::`", }, { + query: " ::a::b", + elems: [], + foundElems: 0, + original: "::a::b", + returned: [], + userQuery: "::a::b", + error: "Paths cannot start with `::`", + }, + { query: "a::::b", elems: [], foundElems: 0, @@ -135,13 +162,13 @@ const PARSED = [ error: "Expected type filter before `:`", }, { - query: "a b:", + query: "a,b:", elems: [], foundElems: 0, - original: "a b:", + original: "a,b:", returned: [], - userQuery: "a b:", - error: "Unexpected `:` (expected path after type filter)", + userQuery: "a,b:", + error: "Unexpected `:` (expected path after type filter `b:`)", }, { query: "a (b:", @@ -159,7 +186,7 @@ const PARSED = [ original: "_:", returned: [], userQuery: "_:", - error: "Unexpected `:` (expected path after type filter)", + error: "Unexpected `:` (expected path after type filter `_:`)", }, { query: "_:a", @@ -213,6 +240,15 @@ const PARSED = [ original: '"p" <a>', returned: [], userQuery: '"p" <a>', + error: "Cannot have more than one element if you use quotes", + }, + { + query: '"p",<a>', + elems: [], + foundElems: 0, + original: '"p",<a>', + returned: [], + userQuery: '"p",<a>', error: "Found generics without a path", }, { @@ -222,7 +258,16 @@ const PARSED = [ original: '"p" a<a>', returned: [], userQuery: '"p" a<a>', - error: "You cannot have more than one element if you use quotes", + error: "Cannot have more than one element if you use quotes", + }, + { + query: '"p",a<a>', + elems: [], + foundElems: 0, + original: '"p",a<a>', + returned: [], + userQuery: '"p",a<a>', + error: "Cannot have more than one element if you use quotes", }, { query: "a,<", @@ -240,7 +285,7 @@ const PARSED = [ original: 'aaaaa<>b', returned: [], userQuery: 'aaaaa<>b', - error: 'Expected `,`, ` `, `:` or `->`, found `b`', + error: 'Expected `,`, `:` or `->` after `>`, found `b`', }, { query: "fn:aaaaa<>b", @@ -249,7 +294,7 @@ const PARSED = [ original: 'fn:aaaaa<>b', returned: [], userQuery: 'fn:aaaaa<>b', - error: 'Expected `,`, ` `, `:` or `->`, found `b`', + error: 'Expected `,`, `:` or `->` after `>`, found `b`', }, { query: "->a<>b", @@ -258,7 +303,7 @@ const PARSED = [ original: '->a<>b', returned: [], userQuery: '->a<>b', - error: 'Expected `,` or ` `, found `b`', + error: 'Expected `,` after `>`, found `b`', }, { query: "a<->", @@ -276,7 +321,7 @@ const PARSED = [ original: 'a:: a', returned: [], userQuery: 'a:: a', - error: 'Paths cannot end with `::`', + error: 'Unexpected `:: `', }, { query: "a ::a", @@ -285,7 +330,7 @@ const PARSED = [ original: 'a ::a', returned: [], userQuery: 'a ::a', - error: 'Paths cannot start with `::`', + error: 'Unexpected ` ::`', }, { query: "a<a>:", @@ -294,7 +339,7 @@ const PARSED = [ original: "a<a>:", returned: [], userQuery: "a<a>:", - error: 'Unexpected `<` in type filter', + error: 'Unexpected `<` in type filter (before `:`)', }, { query: "a<>:", @@ -303,7 +348,7 @@ const PARSED = [ original: "a<>:", returned: [], userQuery: "a<>:", - error: 'Unexpected `<` in type filter', + error: 'Unexpected `<` in type filter (before `:`)', }, { query: "a,:", @@ -312,7 +357,7 @@ const PARSED = [ original: "a,:", returned: [], userQuery: "a,:", - error: 'Unexpected `,` in type filter', + error: 'Unexpected `,` in type filter (before `:`)', }, { query: " a<> :", @@ -321,7 +366,7 @@ const PARSED = [ original: "a<> :", returned: [], userQuery: "a<> :", - error: 'Unexpected `<` in type filter', + error: 'Unexpected `<` in type filter (before `:`)', }, { query: "mod : :", @@ -330,7 +375,16 @@ const PARSED = [ original: "mod : :", returned: [], userQuery: "mod : :", - error: 'Unexpected `:`', + error: 'Unexpected `:` (expected path after type filter `mod:`)', + }, + { + query: "mod: :", + elems: [], + foundElems: 0, + original: "mod: :", + returned: [], + userQuery: "mod: :", + error: 'Unexpected `:` (expected path after type filter `mod:`)', }, { query: "a!a", @@ -386,4 +440,108 @@ const PARSED = [ userQuery: "a<", error: "Unclosed `<`", }, + { + query: "p<x> , y", + elems: [ + { + name: "p", + fullPath: ["p"], + pathWithoutLast: [], + pathLast: "p", + generics: [ + { + name: "x", + fullPath: ["x"], + pathWithoutLast: [], + pathLast: "x", + generics: [], + typeFilter: -1, + }, + ], + typeFilter: -1, + }, + { + name: "y", + fullPath: ["y"], + pathWithoutLast: [], + pathLast: "y", + generics: [], + typeFilter: -1, + }, + ], + foundElems: 2, + original: "p<x> , y", + returned: [], + userQuery: "p<x> , y", + error: null, + }, + { + query: "p<x , y>", + elems: [ + { + name: "p", + fullPath: ["p"], + pathWithoutLast: [], + pathLast: "p", + generics: [ + { + name: "x", + fullPath: ["x"], + pathWithoutLast: [], + pathLast: "x", + generics: [], + typeFilter: -1, + }, + { + name: "y", + fullPath: ["y"], + pathWithoutLast: [], + pathLast: "y", + generics: [], + typeFilter: -1, + }, + ], + typeFilter: -1, + }, + ], + foundElems: 1, + original: "p<x , y>", + returned: [], + userQuery: "p<x , y>", + error: null, + }, + { + query: "p ,x , y", + elems: [ + { + name: "p", + fullPath: ["p"], + pathWithoutLast: [], + pathLast: "p", + generics: [], + typeFilter: -1, + }, + { + name: "x", + fullPath: ["x"], + pathWithoutLast: [], + pathLast: "x", + generics: [], + typeFilter: -1, + }, + { + name: "y", + fullPath: ["y"], + pathWithoutLast: [], + pathLast: "y", + generics: [], + typeFilter: -1, + }, + ], + foundElems: 3, + original: "p ,x , y", + returned: [], + userQuery: "p ,x , y", + error: null, + }, ]; diff --git a/tests/rustdoc-js-std/parser-filter.js b/tests/rustdoc-js-std/parser-filter.js index 6f5d66e57ba..3b9cc5b1bf0 100644 --- a/tests/rustdoc-js-std/parser-filter.js +++ b/tests/rustdoc-js-std/parser-filter.js @@ -38,7 +38,7 @@ const PARSED = [ original: "macro<f>:foo", returned: [], userQuery: "macro<f>:foo", - error: "Unexpected `<` in type filter", + error: "Unexpected `<` in type filter (before `:`)", }, { query: 'macro!', diff --git a/tests/rustdoc-js-std/parser-generics.js b/tests/rustdoc-js-std/parser-generics.js index eb3cf455155..726ee56c2c1 100644 --- a/tests/rustdoc-js-std/parser-generics.js +++ b/tests/rustdoc-js-std/parser-generics.js @@ -9,7 +9,7 @@ const PARSED = [ error: 'Unclosed `<`', }, { - query: 'p<> u8', + query: 'p<>,u8', elems: [ { name: "p", @@ -29,9 +29,9 @@ const PARSED = [ }, ], foundElems: 2, - original: "p<> u8", + original: "p<>,u8", returned: [], - userQuery: "p<> u8", + userQuery: "p<>,u8", error: null, }, { diff --git a/tests/rustdoc-js-std/parser-quote.js b/tests/rustdoc-js-std/parser-quote.js index 9d2a3620ed7..731673cf463 100644 --- a/tests/rustdoc-js-std/parser-quote.js +++ b/tests/rustdoc-js-std/parser-quote.js @@ -38,7 +38,7 @@ const PARSED = [ original: '"p" -> a', returned: [], userQuery: '"p" -> a', - error: "You cannot have more than one element if you use quotes", + error: "Cannot have more than one element if you use quotes", }, { query: '"a" -> "p"', diff --git a/tests/rustdoc-js-std/parser-separators.js b/tests/rustdoc-js-std/parser-separators.js index 69f9ac29ad3..00c489b51a6 100644 --- a/tests/rustdoc-js-std/parser-separators.js +++ b/tests/rustdoc-js-std/parser-separators.js @@ -5,6 +5,24 @@ const PARSED = [ query: 'aaaaaa b', elems: [ { + name: 'aaaaaa\tb', + fullPath: ['aaaaaa', 'b'], + pathWithoutLast: ['aaaaaa'], + pathLast: 'b', + generics: [], + typeFilter: -1, + }, + ], + foundElems: 1, + original: "aaaaaa b", + returned: [], + userQuery: "aaaaaa b", + error: null, + }, + { + query: "aaaaaa, b", + elems: [ + { name: 'aaaaaa', fullPath: ['aaaaaa'], pathWithoutLast: [], @@ -22,32 +40,24 @@ const PARSED = [ }, ], foundElems: 2, - original: "aaaaaa b", + original: "aaaaaa, b", returned: [], - userQuery: "aaaaaa b", + userQuery: "aaaaaa, b", error: null, }, { query: 'a b', elems: [ { - name: 'a', - fullPath: ['a'], - pathWithoutLast: [], - pathLast: 'a', - generics: [], - typeFilter: -1, - }, - { - name: 'b', - fullPath: ['b'], - pathWithoutLast: [], + name: 'a b', + fullPath: ['a', 'b'], + pathWithoutLast: ['a'], pathLast: 'b', generics: [], typeFilter: -1, }, ], - foundElems: 2, + foundElems: 1, original: "a b", returned: [], userQuery: "a b", @@ -83,23 +93,15 @@ const PARSED = [ query: 'a\tb', elems: [ { - name: 'a', - fullPath: ['a'], - pathWithoutLast: [], - pathLast: 'a', - generics: [], - typeFilter: -1, - }, - { - name: 'b', - fullPath: ['b'], - pathWithoutLast: [], + name: 'a\tb', + fullPath: ['a', 'b'], + pathWithoutLast: ['a'], pathLast: 'b', generics: [], typeFilter: -1, }, ], - foundElems: 2, + foundElems: 1, original: "a\tb", returned: [], userQuery: "a\tb", @@ -115,16 +117,9 @@ const PARSED = [ pathLast: 'a', generics: [ { - name: 'b', - fullPath: ['b'], - pathWithoutLast: [], - pathLast: 'b', - generics: [], - }, - { - name: 'c', - fullPath: ['c'], - pathWithoutLast: [], + name: 'b c', + fullPath: ['b', 'c'], + pathWithoutLast: ['b'], pathLast: 'c', generics: [], }, @@ -181,16 +176,9 @@ const PARSED = [ pathLast: 'a', generics: [ { - name: 'b', - fullPath: ['b'], - pathWithoutLast: [], - pathLast: 'b', - generics: [], - }, - { - name: 'c', - fullPath: ['c'], - pathWithoutLast: [], + name: 'b\tc', + fullPath: ['b', 'c'], + pathWithoutLast: ['b'], pathLast: 'c', generics: [], }, diff --git a/tests/rustdoc-js-std/parser-slice-array.js b/tests/rustdoc-js-std/parser-slice-array.js index f85dd199741..c22b7870dbf 100644 --- a/tests/rustdoc-js-std/parser-slice-array.js +++ b/tests/rustdoc-js-std/parser-slice-array.js @@ -62,7 +62,7 @@ const PARSED = [ error: null, }, { - query: '[] u8', + query: '[],u8', elems: [ { name: "[]", @@ -82,9 +82,9 @@ const PARSED = [ }, ], foundElems: 2, - original: "[] u8", + original: "[],u8", returned: [], - userQuery: "[] u8", + userQuery: "[],u8", error: null, }, { diff --git a/tests/rustdoc-js-std/parser-weird-queries.js b/tests/rustdoc-js-std/parser-weird-queries.js index 0e08eaf73c8..720ef66c165 100644 --- a/tests/rustdoc-js-std/parser-weird-queries.js +++ b/tests/rustdoc-js-std/parser-weird-queries.js @@ -7,23 +7,14 @@ const PARSED = [ query: 'a b', elems: [ { - name: "a", - fullPath: ["a"], - pathWithoutLast: [], - pathLast: "a", - generics: [], - typeFilter: -1, - }, - { - name: "b", - fullPath: ["b"], - pathWithoutLast: [], + name: "a b", + fullPath: ["a", "b"], + pathWithoutLast: ["a"], pathLast: "b", generics: [], - typeFilter: -1, }, ], - foundElems: 2, + foundElems: 1, original: "a b", returned: [], userQuery: "a b", @@ -33,23 +24,14 @@ const PARSED = [ query: 'a b', elems: [ { - name: "a", - fullPath: ["a"], - pathWithoutLast: [], - pathLast: "a", - generics: [], - typeFilter: -1, - }, - { - name: "b", - fullPath: ["b"], - pathWithoutLast: [], + name: "a b", + fullPath: ["a", "b"], + pathWithoutLast: ["a"], pathLast: "b", generics: [], - typeFilter: -1, }, ], - foundElems: 2, + foundElems: 1, original: "a b", returned: [], userQuery: "a b", @@ -73,7 +55,6 @@ const PARSED = [ pathWithoutLast: [], pathLast: "aaa", generics: [], - typeFilter: -1, }, { name: "a", @@ -81,7 +62,6 @@ const PARSED = [ pathWithoutLast: [], pathLast: "a", generics: [], - typeFilter: -1, }, ], foundElems: 2, @@ -106,7 +86,7 @@ const PARSED = [ original: 'mod :', returned: [], userQuery: 'mod :', - error: "Unexpected `:` (expected path after type filter)", + error: "Unexpected `:` (expected path after type filter `mod:`)", }, { query: 'mod\t:', @@ -115,6 +95,6 @@ const PARSED = [ original: 'mod\t:', returned: [], userQuery: 'mod\t:', - error: "Unexpected `:` (expected path after type filter)", + error: "Unexpected `:` (expected path after type filter `mod:`)", }, ]; diff --git a/tests/rustdoc-js-std/vec-new.js b/tests/rustdoc-js-std/vec-new.js index 309f3543faf..9823a417a5d 100644 --- a/tests/rustdoc-js-std/vec-new.js +++ b/tests/rustdoc-js-std/vec-new.js @@ -1,9 +1,20 @@ -const EXPECTED = { - 'query': 'Vec::new', - 'others': [ - { 'path': 'std::vec::Vec', 'name': 'new' }, - { 'path': 'alloc::vec::Vec', 'name': 'new' }, - { 'path': 'std::vec::Vec', 'name': 'new_in' }, - { 'path': 'alloc::vec::Vec', 'name': 'new_in' }, - ], -}; +const EXPECTED = [ + { + 'query': 'Vec::new', + 'others': [ + { 'path': 'std::vec::Vec', 'name': 'new' }, + { 'path': 'alloc::vec::Vec', 'name': 'new' }, + { 'path': 'std::vec::Vec', 'name': 'new_in' }, + { 'path': 'alloc::vec::Vec', 'name': 'new_in' }, + ], + }, + { + 'query': 'Vec new', + 'others': [ + { 'path': 'std::vec::Vec', 'name': 'new' }, + { 'path': 'alloc::vec::Vec', 'name': 'new' }, + { 'path': 'std::vec::Vec', 'name': 'new_in' }, + { 'path': 'alloc::vec::Vec', 'name': 'new_in' }, + ], + }, +]; diff --git a/tests/ui-fulldeps/missing-rustc-driver-error.stderr b/tests/ui-fulldeps/missing-rustc-driver-error.stderr index ad03ba0103c..939e888e5cb 100644 --- a/tests/ui-fulldeps/missing-rustc-driver-error.stderr +++ b/tests/ui-fulldeps/missing-rustc-driver-error.stderr @@ -10,15 +10,7 @@ error: crate `indexmap` required to be available in rlib format, but was not fou error: crate `hashbrown` required to be available in rlib format, but was not found in this form -error: crate `ahash` required to be available in rlib format, but was not found in this form +error: crate `equivalent` required to be available in rlib format, but was not found in this form -error: crate `once_cell` required to be available in rlib format, but was not found in this form - -error: crate `getrandom` required to be available in rlib format, but was not found in this form - -error: crate `cfg_if` required to be available in rlib format, but was not found in this form - -error: crate `libc` required to be available in rlib format, but was not found in this form - -error: aborting due to 10 previous errors +error: aborting due to 6 previous errors diff --git a/tests/ui-fulldeps/session-diagnostic/example.ftl b/tests/ui-fulldeps/session-diagnostic/example.ftl index cb2d476d815..1d1ba8e1bd5 100644 --- a/tests/ui-fulldeps/session-diagnostic/example.ftl +++ b/tests/ui-fulldeps/session-diagnostic/example.ftl @@ -3,3 +3,5 @@ no_crate_example = this is an example message used in testing .help = with a help .suggestion = with a suggestion .label = with a label + +no_crate_bad_reference = {$r} does not exist diff --git a/tests/ui-fulldeps/session-diagnostic/invalid-variable.rs b/tests/ui-fulldeps/session-diagnostic/invalid-variable.rs new file mode 100644 index 00000000000..57798dda3eb --- /dev/null +++ b/tests/ui-fulldeps/session-diagnostic/invalid-variable.rs @@ -0,0 +1,21 @@ +// run-fail +// compile-flags: --test +// test that messages referencing non-existent fields cause test failures + +#![feature(rustc_private)] +#![crate_type = "lib"] + +extern crate rustc_driver; +extern crate rustc_fluent_macro; +extern crate rustc_macros; +extern crate rustc_errors; +use rustc_fluent_macro::fluent_messages; +use rustc_macros::Diagnostic; +use rustc_errors::{SubdiagnosticMessage, DiagnosticMessage}; +extern crate rustc_session; + +fluent_messages! { "./example.ftl" } + +#[derive(Diagnostic)] +#[diag(no_crate_bad_reference)] +struct BadRef; diff --git a/tests/ui-fulldeps/stable-mir/crate-info.rs b/tests/ui-fulldeps/stable-mir/crate-info.rs index 3c0d684a4d7..f55d7d599f1 100644 --- a/tests/ui-fulldeps/stable-mir/crate-info.rs +++ b/tests/ui-fulldeps/stable-mir/crate-info.rs @@ -13,12 +13,14 @@ extern crate rustc_driver; extern crate rustc_hir; extern crate rustc_interface; extern crate rustc_middle; +extern crate rustc_session; extern crate rustc_smir; use rustc_driver::{Callbacks, Compilation, RunCompiler}; use rustc_hir::def::DefKind; use rustc_interface::{interface, Queries}; use rustc_middle::ty::TyCtxt; +use rustc_session::EarlyErrorHandler; use rustc_smir::{rustc_internal, stable_mir}; use std::assert_matches::assert_matches; use std::io::Write; @@ -153,6 +155,7 @@ impl Callbacks for SMirCalls { /// continue the compilation afterwards (defaults to `Compilation::Continue`) fn after_analysis<'tcx>( &mut self, + _handler: &EarlyErrorHandler, _compiler: &interface::Compiler, queries: &'tcx Queries<'tcx>, ) -> Compilation { diff --git a/tests/ui/abi/foreign/foreign-fn-with-byval.rs b/tests/ui/abi/foreign/foreign-fn-with-byval.rs index f366b6ee1bd..e20ee0da45d 100644 --- a/tests/ui/abi/foreign/foreign-fn-with-byval.rs +++ b/tests/ui/abi/foreign/foreign-fn-with-byval.rs @@ -1,5 +1,5 @@ // run-pass -#![allow(improper_ctypes)] +#![allow(improper_ctypes, improper_ctypes_definitions)] // ignore-wasm32-bare no libc to test ffi with diff --git a/tests/ui/abi/issue-94223.rs b/tests/ui/abi/issue-94223.rs new file mode 100644 index 00000000000..79d6b94031b --- /dev/null +++ b/tests/ui/abi/issue-94223.rs @@ -0,0 +1,8 @@ +// check-pass +#![allow(improper_ctypes_definitions)] +#![crate_type = "lib"] + +// Check that computing the fn abi for `bad`, with a external ABI fn ptr that is not FFI-safe, does +// not ICE. + +pub fn bad(f: extern "C" fn([u8])) {} diff --git a/tests/ui/associated-inherent-types/assoc-inherent-unstable.rs b/tests/ui/associated-inherent-types/assoc-inherent-unstable.rs index 34b4e47bf46..152bb7a60a7 100644 --- a/tests/ui/associated-inherent-types/assoc-inherent-unstable.rs +++ b/tests/ui/associated-inherent-types/assoc-inherent-unstable.rs @@ -1,6 +1,9 @@ // aux-crate:aux=assoc-inherent-unstable.rs // edition: 2021 +#![feature(inherent_associated_types)] +#![allow(incomplete_features)] + type Data = aux::Owner::Data; //~ ERROR use of unstable library feature 'data' fn main() {} diff --git a/tests/ui/associated-inherent-types/assoc-inherent-unstable.stderr b/tests/ui/associated-inherent-types/assoc-inherent-unstable.stderr index c0be8bfd79b..415ee0193c9 100644 --- a/tests/ui/associated-inherent-types/assoc-inherent-unstable.stderr +++ b/tests/ui/associated-inherent-types/assoc-inherent-unstable.stderr @@ -1,5 +1,5 @@ error[E0658]: use of unstable library feature 'data' - --> $DIR/assoc-inherent-unstable.rs:4:13 + --> $DIR/assoc-inherent-unstable.rs:7:13 | LL | type Data = aux::Owner::Data; | ^^^^^^^^^^^^^^^^ diff --git a/tests/ui/associated-inherent-types/bugs/cycle-iat-inside-of-adt.rs b/tests/ui/associated-inherent-types/bugs/cycle-iat-inside-of-adt.rs index f41574403d8..33c73c3db89 100644 --- a/tests/ui/associated-inherent-types/bugs/cycle-iat-inside-of-adt.rs +++ b/tests/ui/associated-inherent-types/bugs/cycle-iat-inside-of-adt.rs @@ -1,5 +1,7 @@ // known-bug: #108491 +#![feature(inherent_associated_types)] +#![allow(incomplete_features)] // FIXME(inherent_associated_types): This should pass. struct Foo { @@ -8,3 +10,5 @@ struct Foo { impl Foo { pub type Bar = usize; } + +fn main() {} diff --git a/tests/ui/associated-inherent-types/bugs/cycle-iat-inside-of-adt.stderr b/tests/ui/associated-inherent-types/bugs/cycle-iat-inside-of-adt.stderr index f313c494671..23269e1afab 100644 --- a/tests/ui/associated-inherent-types/bugs/cycle-iat-inside-of-adt.stderr +++ b/tests/ui/associated-inherent-types/bugs/cycle-iat-inside-of-adt.stderr @@ -1,49 +1,43 @@ -error[E0601]: `main` function not found in crate `cycle_iat_inside_of_adt` - --> $DIR/cycle-iat-inside-of-adt.rs:10:2 - | -LL | } - | ^ consider adding a `main` function to `$DIR/cycle-iat-inside-of-adt.rs` - error[E0391]: cycle detected when computing predicates of `Foo` - --> $DIR/cycle-iat-inside-of-adt.rs:5:1 + --> $DIR/cycle-iat-inside-of-adt.rs:7:1 | LL | struct Foo { | ^^^^^^^^^^ | note: ...which requires computing predicates of `Foo`... - --> $DIR/cycle-iat-inside-of-adt.rs:5:1 + --> $DIR/cycle-iat-inside-of-adt.rs:7:1 | LL | struct Foo { | ^^^^^^^^^^ note: ...which requires computing inferred outlives predicates of `Foo`... - --> $DIR/cycle-iat-inside-of-adt.rs:5:1 + --> $DIR/cycle-iat-inside-of-adt.rs:7:1 | LL | struct Foo { | ^^^^^^^^^^ = note: ...which requires computing the inferred outlives predicates for items in this crate... note: ...which requires computing type of `Foo::bar`... - --> $DIR/cycle-iat-inside-of-adt.rs:6:5 + --> $DIR/cycle-iat-inside-of-adt.rs:8:5 | LL | bar: Self::Bar, | ^^^^^^^^^^^^^^ note: ...which requires computing normalized predicates of `Foo`... - --> $DIR/cycle-iat-inside-of-adt.rs:5:1 + --> $DIR/cycle-iat-inside-of-adt.rs:7:1 | LL | struct Foo { | ^^^^^^^^^^ = note: ...which again requires computing predicates of `Foo`, completing the cycle note: cycle used when collecting item types in top-level module - --> $DIR/cycle-iat-inside-of-adt.rs:5:1 - | -LL | / struct Foo { -LL | | bar: Self::Bar, -LL | | } -LL | | impl Foo { -LL | | pub type Bar = usize; -LL | | } - | |_^ + --> $DIR/cycle-iat-inside-of-adt.rs:3:1 + | +LL | / #![feature(inherent_associated_types)] +LL | | #![allow(incomplete_features)] +LL | | // FIXME(inherent_associated_types): This should pass. +LL | | +... | +LL | | +LL | | fn main() {} + | |____________^ -error: aborting due to 2 previous errors +error: aborting due to previous error -Some errors have detailed explanations: E0391, E0601. -For more information about an error, try `rustc --explain E0391`. +For more information about this error, try `rustc --explain E0391`. diff --git a/tests/ui/associated-inherent-types/dont-select-if-disabled.rs b/tests/ui/associated-inherent-types/dont-select-if-disabled.rs new file mode 100644 index 00000000000..472be4fbfbc --- /dev/null +++ b/tests/ui/associated-inherent-types/dont-select-if-disabled.rs @@ -0,0 +1,17 @@ +// Regression test for #113265. + +// Don't perform selection if the feature is not enabled to prevent cycle errors +// that exist due to current limitations of the implementation from masking the +// feature-gate error. See the aforementioned issue. +// This does lead to rustc not mentioning inherent associated types at usage-sites of +// IATs that were defined in an external crate but that's acceptable for now. + +// FIXME(inherent_associated_types): Revisit this decision once the implementation is smarter. + +// The following program would currently lead to a cycle if IATs were enabled. + +struct S(S::P); //~ ERROR ambiguous associated type + +impl S { type P = (); } //~ ERROR inherent associated types are unstable + +fn main() {} diff --git a/tests/ui/associated-inherent-types/dont-select-if-disabled.stderr b/tests/ui/associated-inherent-types/dont-select-if-disabled.stderr new file mode 100644 index 00000000000..87a3f35c968 --- /dev/null +++ b/tests/ui/associated-inherent-types/dont-select-if-disabled.stderr @@ -0,0 +1,24 @@ +error[E0223]: ambiguous associated type + --> $DIR/dont-select-if-disabled.rs:13:10 + | +LL | struct S(S::P); + | ^^^^ + | +help: if there were a trait named `Example` with associated type `P` implemented for `S`, you could use the fully-qualified path + | +LL | struct S(<S as Example>::P); + | ~~~~~~~~~~~~~~~~~ + +error[E0658]: inherent associated types are unstable + --> $DIR/dont-select-if-disabled.rs:15:10 + | +LL | impl S { type P = (); } + | ^^^^^^^^^^^^ + | + = note: see issue #8995 <https://github.com/rust-lang/rust/issues/8995> for more information + = help: add `#![feature(inherent_associated_types)]` to the crate attributes to enable + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0223, E0658. +For more information about an error, try `rustc --explain E0223`. diff --git a/tests/ui/associated-inherent-types/issue-109071.no_gate.stderr b/tests/ui/associated-inherent-types/issue-109071.no_gate.stderr index 8b6a8206569..6f206f2b89c 100644 --- a/tests/ui/associated-inherent-types/issue-109071.no_gate.stderr +++ b/tests/ui/associated-inherent-types/issue-109071.no_gate.stderr @@ -29,7 +29,13 @@ LL | type Item = &[T]; = note: see issue #8995 <https://github.com/rust-lang/rust/issues/8995> for more information = help: add `#![feature(inherent_associated_types)]` to the crate attributes to enable -error: aborting due to 3 previous errors +error[E0223]: ambiguous associated type + --> $DIR/issue-109071.rs:15:22 + | +LL | fn T() -> Option<Self::Item> {} + | ^^^^^^^^^^ help: use the fully-qualified path: `<Windows<T> as IntoIterator>::Item` + +error: aborting due to 4 previous errors -Some errors have detailed explanations: E0107, E0637, E0658. +Some errors have detailed explanations: E0107, E0223, E0637, E0658. For more information about an error, try `rustc --explain E0107`. diff --git a/tests/ui/associated-inherent-types/issue-109071.rs b/tests/ui/associated-inherent-types/issue-109071.rs index 73b969d5940..951c708e3f9 100644 --- a/tests/ui/associated-inherent-types/issue-109071.rs +++ b/tests/ui/associated-inherent-types/issue-109071.rs @@ -13,6 +13,7 @@ impl<T> Windows { //~ ERROR: missing generics for struct `Windows` impl<T> Windows<T> { fn T() -> Option<Self::Item> {} + //[no_gate]~^ ERROR: ambiguous associated type } fn main() {} diff --git a/tests/ui/associated-inherent-types/issue-109789.stderr b/tests/ui/associated-inherent-types/issue-109789.stderr index 7af338274a1..84fc85cd09e 100644 --- a/tests/ui/associated-inherent-types/issue-109789.stderr +++ b/tests/ui/associated-inherent-types/issue-109789.stderr @@ -1,8 +1,8 @@ error[E0308]: mismatched types - --> $DIR/issue-109789.rs:18:1 + --> $DIR/issue-109789.rs:18:11 | LL | fn bar(_: Foo<for<'a> fn(&'a ())>::Assoc) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other | = note: expected struct `Foo<fn(&'static ())>` found struct `Foo<for<'a> fn(&'a ())>` diff --git a/tests/ui/associated-inherent-types/private-in-public.rs b/tests/ui/associated-inherent-types/private-in-public.rs index 44a20a79ad6..e9e189f95c9 100644 --- a/tests/ui/associated-inherent-types/private-in-public.rs +++ b/tests/ui/associated-inherent-types/private-in-public.rs @@ -1,7 +1,7 @@ #![feature(inherent_associated_types)] +#![feature(type_privacy_lints)] #![allow(incomplete_features)] #![crate_type = "lib"] - #![deny(private_in_public)] #![warn(private_interfaces)] @@ -12,12 +12,15 @@ pub type PubAlias0 = PubTy::PrivAssocTy; //~^ ERROR private associated type `PubTy::PrivAssocTy` in public interface (error E0446) //~| WARNING this was previously accepted +//~| WARNING associated type `PubTy::PrivAssocTy` is more private than the item `PubAlias0` pub type PubAlias1 = PrivTy::PubAssocTy; //~^ ERROR private type `PrivTy` in public interface (error E0446) //~| WARNING this was previously accepted +//~| WARNING type `PrivTy` is more private than the item `PubAlias1` pub type PubAlias2 = PubTy::PubAssocTy<PrivTy>; //~^ ERROR private type `PrivTy` in public interface (error E0446) //~| WARNING this was previously accepted +//~| WARNING type `PrivTy` is more private than the item `PubAlias2` pub struct PubTy; impl PubTy { diff --git a/tests/ui/associated-inherent-types/private-in-public.stderr b/tests/ui/associated-inherent-types/private-in-public.stderr index d40db83707b..65d187c1bcd 100644 --- a/tests/ui/associated-inherent-types/private-in-public.stderr +++ b/tests/ui/associated-inherent-types/private-in-public.stderr @@ -13,14 +13,13 @@ LL | #![deny(private_in_public)] | ^^^^^^^^^^^^^^^^^ warning: associated type `PubTy::PrivAssocTy` is more private than the item `PubAlias0` - | -note: type alias `PubAlias0` is reachable at visibility `pub` --> $DIR/private-in-public.rs:12:1 | LL | pub type PubAlias0 = PubTy::PrivAssocTy; - | ^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^ type alias `PubAlias0` is reachable at visibility `pub` + | note: but associated type `PubTy::PrivAssocTy` is only usable at visibility `pub(crate)` - --> $DIR/private-in-public.rs:24:5 + --> $DIR/private-in-public.rs:27:5 | LL | type PrivAssocTy = (); | ^^^^^^^^^^^^^^^^ @@ -31,7 +30,7 @@ LL | #![warn(private_interfaces)] | ^^^^^^^^^^^^^^^^^^ error: private type `PrivTy` in public interface (error E0446) - --> $DIR/private-in-public.rs:15:1 + --> $DIR/private-in-public.rs:16:1 | LL | pub type PubAlias1 = PrivTy::PubAssocTy; | ^^^^^^^^^^^^^^^^^^ @@ -40,20 +39,19 @@ LL | pub type PubAlias1 = PrivTy::PubAssocTy; = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537> warning: type `PrivTy` is more private than the item `PubAlias1` - | -note: type alias `PubAlias1` is reachable at visibility `pub` - --> $DIR/private-in-public.rs:15:1 + --> $DIR/private-in-public.rs:16:1 | LL | pub type PubAlias1 = PrivTy::PubAssocTy; - | ^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^ type alias `PubAlias1` is reachable at visibility `pub` + | note: but type `PrivTy` is only usable at visibility `pub(crate)` - --> $DIR/private-in-public.rs:28:1 + --> $DIR/private-in-public.rs:31:1 | LL | struct PrivTy; | ^^^^^^^^^^^^^ error: private type `PrivTy` in public interface (error E0446) - --> $DIR/private-in-public.rs:18:1 + --> $DIR/private-in-public.rs:20:1 | LL | pub type PubAlias2 = PubTy::PubAssocTy<PrivTy>; | ^^^^^^^^^^^^^^^^^^ @@ -62,14 +60,13 @@ LL | pub type PubAlias2 = PubTy::PubAssocTy<PrivTy>; = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537> warning: type `PrivTy` is more private than the item `PubAlias2` - | -note: type alias `PubAlias2` is reachable at visibility `pub` - --> $DIR/private-in-public.rs:18:1 + --> $DIR/private-in-public.rs:20:1 | LL | pub type PubAlias2 = PubTy::PubAssocTy<PrivTy>; - | ^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^ type alias `PubAlias2` is reachable at visibility `pub` + | note: but type `PrivTy` is only usable at visibility `pub(crate)` - --> $DIR/private-in-public.rs:28:1 + --> $DIR/private-in-public.rs:31:1 | LL | struct PrivTy; | ^^^^^^^^^^^^^ diff --git a/tests/ui/associated-type-bounds/implied-in-supertrait.rs b/tests/ui/associated-type-bounds/implied-in-supertrait.rs new file mode 100644 index 00000000000..ea7e7c984da --- /dev/null +++ b/tests/ui/associated-type-bounds/implied-in-supertrait.rs @@ -0,0 +1,19 @@ +// check-pass + +#![feature(associated_type_bounds)] + +trait Trait: Super<Assoc: Bound> {} + +trait Super { + type Assoc; +} + +trait Bound {} + +fn foo<T>(x: T) +where + T: Trait, +{ +} + +fn main() {} diff --git a/tests/ui/async-await/in-trait/async-associated-types2.rs b/tests/ui/async-await/in-trait/async-associated-types2.rs deleted file mode 100644 index b889f616a03..00000000000 --- a/tests/ui/async-await/in-trait/async-associated-types2.rs +++ /dev/null @@ -1,30 +0,0 @@ -// check-pass -// edition: 2021 -// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty -// revisions: current next - -#![feature(async_fn_in_trait)] -#![feature(impl_trait_in_assoc_type)] -#![allow(incomplete_features)] - -use std::future::Future; - -trait MyTrait { - type Fut<'a>: Future<Output = i32> - where - Self: 'a; - - fn foo<'a>(&'a self) -> Self::Fut<'a>; -} - -impl MyTrait for i32 { - type Fut<'a> = impl Future<Output = i32> + 'a - where - Self: 'a; - - fn foo<'a>(&'a self) -> Self::Fut<'a> { - async { *self } - } -} - -fn main() {} diff --git a/tests/ui/async-await/in-trait/async-lifetimes-and-bounds.rs b/tests/ui/async-await/in-trait/async-lifetimes-and-bounds.rs index d5481d277e4..9869a8d71c2 100644 --- a/tests/ui/async-await/in-trait/async-lifetimes-and-bounds.rs +++ b/tests/ui/async-await/in-trait/async-lifetimes-and-bounds.rs @@ -1,5 +1,7 @@ // check-pass // edition: 2021 +// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty +// revisions: current next #![feature(async_fn_in_trait)] #![allow(incomplete_features)] diff --git a/tests/ui/async-await/in-trait/async-lifetimes.rs b/tests/ui/async-await/in-trait/async-lifetimes.rs index f298e45d239..ecbd1910ac4 100644 --- a/tests/ui/async-await/in-trait/async-lifetimes.rs +++ b/tests/ui/async-await/in-trait/async-lifetimes.rs @@ -1,5 +1,7 @@ // check-pass // edition: 2021 +// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty +// revisions: current next #![feature(async_fn_in_trait)] #![allow(incomplete_features)] diff --git a/tests/ui/async-await/in-trait/missing-feature-flag.current.stderr b/tests/ui/async-await/in-trait/missing-feature-flag.current.stderr new file mode 100644 index 00000000000..e6ac9bc2277 --- /dev/null +++ b/tests/ui/async-await/in-trait/missing-feature-flag.current.stderr @@ -0,0 +1,30 @@ +error[E0046]: not all trait items implemented, missing: `foo` + --> $DIR/missing-feature-flag.rs:14:1 + | +LL | async fn foo(_: T) -> &'static str; + | ----------------------------------- `foo` from trait +... +LL | impl<T> MyTrait<T> for MyStruct {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `foo` in implementation + +error[E0520]: `foo` specializes an item from a parent `impl`, but that item is not marked `default` + --> $DIR/missing-feature-flag.rs:18:5 + | +LL | impl<T> MyTrait<T> for MyStruct {} + | ------------------------------- parent `impl` is here +... +LL | async fn foo(_: i32) -> &'static str {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot specialize default item `foo` + | + = note: to specialize, `foo` in the parent `impl` must be marked `default` + +error[E0308]: mismatched types + --> $DIR/missing-feature-flag.rs:18:42 + | +LL | async fn foo(_: i32) -> &'static str {} + | ^^ expected `&str`, found `()` + +error: aborting due to 3 previous errors + +Some errors have detailed explanations: E0046, E0308, E0520. +For more information about an error, try `rustc --explain E0046`. diff --git a/tests/ui/async-await/in-trait/missing-feature-flag.next.stderr b/tests/ui/async-await/in-trait/missing-feature-flag.next.stderr new file mode 100644 index 00000000000..e6ac9bc2277 --- /dev/null +++ b/tests/ui/async-await/in-trait/missing-feature-flag.next.stderr @@ -0,0 +1,30 @@ +error[E0046]: not all trait items implemented, missing: `foo` + --> $DIR/missing-feature-flag.rs:14:1 + | +LL | async fn foo(_: T) -> &'static str; + | ----------------------------------- `foo` from trait +... +LL | impl<T> MyTrait<T> for MyStruct {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `foo` in implementation + +error[E0520]: `foo` specializes an item from a parent `impl`, but that item is not marked `default` + --> $DIR/missing-feature-flag.rs:18:5 + | +LL | impl<T> MyTrait<T> for MyStruct {} + | ------------------------------- parent `impl` is here +... +LL | async fn foo(_: i32) -> &'static str {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot specialize default item `foo` + | + = note: to specialize, `foo` in the parent `impl` must be marked `default` + +error[E0308]: mismatched types + --> $DIR/missing-feature-flag.rs:18:42 + | +LL | async fn foo(_: i32) -> &'static str {} + | ^^ expected `&str`, found `()` + +error: aborting due to 3 previous errors + +Some errors have detailed explanations: E0046, E0308, E0520. +For more information about an error, try `rustc --explain E0046`. diff --git a/tests/ui/async-await/in-trait/missing-feature-flag.rs b/tests/ui/async-await/in-trait/missing-feature-flag.rs new file mode 100644 index 00000000000..6481f4a7059 --- /dev/null +++ b/tests/ui/async-await/in-trait/missing-feature-flag.rs @@ -0,0 +1,23 @@ +// edition:2018 +// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty +// revisions: current next + +#![feature(async_fn_in_trait)] +#![feature(min_specialization)] + +struct MyStruct; + +trait MyTrait<T> { + async fn foo(_: T) -> &'static str; +} + +impl<T> MyTrait<T> for MyStruct {} +//~^ ERROR: not all trait items implemented, missing: `foo` [E0046] + +impl MyTrait<i32> for MyStruct { + async fn foo(_: i32) -> &'static str {} + //~^ ERROR: `foo` specializes an item from a parent `impl`, but that item is not marked `default` [E0520] + //~| ERROR: mismatched types [E0308] +} + +fn main() {} diff --git a/tests/ui/async-await/in-trait/normalize-opaque-with-bound-vars.rs b/tests/ui/async-await/in-trait/normalize-opaque-with-bound-vars.rs new file mode 100644 index 00000000000..c4008f2b7e7 --- /dev/null +++ b/tests/ui/async-await/in-trait/normalize-opaque-with-bound-vars.rs @@ -0,0 +1,64 @@ +// build-pass +// edition:2021 +// compile-flags: -Cdebuginfo=2 + +// We were not normalizing opaques with escaping bound vars during codegen, +// leading to later errors during debuginfo computation. + +#![feature(async_fn_in_trait)] + +#[derive(Clone, Copy)] +pub struct SharedState {} + +pub trait State { + async fn execute(self, shared_state: &SharedState); +} + +pub trait StateComposer { + fn and_then<T, F>(self, map_fn: F) -> AndThen<Self, F> + where + Self: State + Sized, + T: State, + F: FnOnce() -> T, + { + AndThen { previous: self, map_fn } + } +} + +impl<T> StateComposer for T where T: State {} +pub struct AndThen<T, F> { + previous: T, + map_fn: F, +} + +impl<T, U, F> State for AndThen<T, F> +where + T: State, + U: State, + F: FnOnce() -> U, +{ + async fn execute(self, shared_state: &SharedState) + where + Self: Sized, + { + self.previous.execute(shared_state).await; + (self.map_fn)().execute(shared_state).await + } +} + +pub struct SomeState {} + +impl State for SomeState { + async fn execute(self, shared_state: &SharedState) {} +} + +pub fn main() { + let shared_state = SharedState {}; + async { + SomeState {} + .and_then(|| SomeState {}) + .and_then(|| SomeState {}) + .execute(&shared_state) + .await; + }; +} diff --git a/tests/ui/async-await/in-trait/return-not-existing-pair.current.stderr b/tests/ui/async-await/in-trait/return-not-existing-pair.current.stderr new file mode 100644 index 00000000000..56973a1d11a --- /dev/null +++ b/tests/ui/async-await/in-trait/return-not-existing-pair.current.stderr @@ -0,0 +1,39 @@ +error[E0726]: implicit elided lifetime not allowed here + --> $DIR/return-not-existing-pair.rs:12:20 + | +LL | impl<'a, 'b, T, U> MyTrait<T> for U { + | ^^^^^^^^^^ expected lifetime parameters + | +help: indicate the anonymous lifetimes + | +LL | impl<'a, 'b, T, U> MyTrait<'_, '_, T> for U { + | +++++++ + +error[E0412]: cannot find type `ConnImpl` in this scope + --> $DIR/return-not-existing-pair.rs:8:48 + | +LL | async fn foo(&'a self, key: &'b T) -> (&'a ConnImpl, &'b T); + | ^^^^^^^^ not found in this scope + +error[E0186]: method `foo` has a `&self` declaration in the trait, but not in the impl + --> $DIR/return-not-existing-pair.rs:14:5 + | +LL | async fn foo(&'a self, key: &'b T) -> (&'a ConnImpl, &'b T); + | ------------------------------------------------------------ `&self` used in trait +... +LL | async fn foo(_: T) -> (&'a U, &'b T) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&self` in impl + +error[E0308]: mismatched types + --> $DIR/return-not-existing-pair.rs:14:42 + | +LL | async fn foo(_: T) -> (&'a U, &'b T) {} + | ^^ expected `(&U, &T)`, found `()` + | + = note: expected tuple `(&'a U, &'b T)` + found unit type `()` + +error: aborting due to 4 previous errors + +Some errors have detailed explanations: E0186, E0308, E0412, E0726. +For more information about an error, try `rustc --explain E0186`. diff --git a/tests/ui/async-await/in-trait/return-not-existing-pair.next.stderr b/tests/ui/async-await/in-trait/return-not-existing-pair.next.stderr new file mode 100644 index 00000000000..56973a1d11a --- /dev/null +++ b/tests/ui/async-await/in-trait/return-not-existing-pair.next.stderr @@ -0,0 +1,39 @@ +error[E0726]: implicit elided lifetime not allowed here + --> $DIR/return-not-existing-pair.rs:12:20 + | +LL | impl<'a, 'b, T, U> MyTrait<T> for U { + | ^^^^^^^^^^ expected lifetime parameters + | +help: indicate the anonymous lifetimes + | +LL | impl<'a, 'b, T, U> MyTrait<'_, '_, T> for U { + | +++++++ + +error[E0412]: cannot find type `ConnImpl` in this scope + --> $DIR/return-not-existing-pair.rs:8:48 + | +LL | async fn foo(&'a self, key: &'b T) -> (&'a ConnImpl, &'b T); + | ^^^^^^^^ not found in this scope + +error[E0186]: method `foo` has a `&self` declaration in the trait, but not in the impl + --> $DIR/return-not-existing-pair.rs:14:5 + | +LL | async fn foo(&'a self, key: &'b T) -> (&'a ConnImpl, &'b T); + | ------------------------------------------------------------ `&self` used in trait +... +LL | async fn foo(_: T) -> (&'a U, &'b T) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&self` in impl + +error[E0308]: mismatched types + --> $DIR/return-not-existing-pair.rs:14:42 + | +LL | async fn foo(_: T) -> (&'a U, &'b T) {} + | ^^ expected `(&U, &T)`, found `()` + | + = note: expected tuple `(&'a U, &'b T)` + found unit type `()` + +error: aborting due to 4 previous errors + +Some errors have detailed explanations: E0186, E0308, E0412, E0726. +For more information about an error, try `rustc --explain E0186`. diff --git a/tests/ui/async-await/in-trait/return-not-existing-pair.rs b/tests/ui/async-await/in-trait/return-not-existing-pair.rs new file mode 100644 index 00000000000..d1b3832d12b --- /dev/null +++ b/tests/ui/async-await/in-trait/return-not-existing-pair.rs @@ -0,0 +1,19 @@ +// edition:2021 +// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty +// revisions: current next + +#![feature(async_fn_in_trait)] + +trait MyTrait<'a, 'b, T> { + async fn foo(&'a self, key: &'b T) -> (&'a ConnImpl, &'b T); + //~^ ERROR: cannot find type `ConnImpl` in this scope [E0412] +} + +impl<'a, 'b, T, U> MyTrait<T> for U { + //~^ ERROR: implicit elided lifetime not allowed here [E0726] + async fn foo(_: T) -> (&'a U, &'b T) {} + //~^ ERROR: method `foo` has a `&self` declaration in the trait, but not in the impl [E0186] + //~| ERROR: mismatched types [E0308] +} + +fn main() {} diff --git a/tests/ui/async-await/in-trait/return-not-existing-type-wrapping-rpitit.current.stderr b/tests/ui/async-await/in-trait/return-not-existing-type-wrapping-rpitit.current.stderr new file mode 100644 index 00000000000..2564d68d591 --- /dev/null +++ b/tests/ui/async-await/in-trait/return-not-existing-type-wrapping-rpitit.current.stderr @@ -0,0 +1,9 @@ +error[E0412]: cannot find type `Missing` in this scope + --> $DIR/return-not-existing-type-wrapping-rpitit.rs:10:25 + | +LL | fn bar() -> Wrapper<Missing<impl Sized>>; + | ^^^^^^^ not found in this scope + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0412`. diff --git a/tests/ui/async-await/in-trait/return-not-existing-type-wrapping-rpitit.next.stderr b/tests/ui/async-await/in-trait/return-not-existing-type-wrapping-rpitit.next.stderr new file mode 100644 index 00000000000..2564d68d591 --- /dev/null +++ b/tests/ui/async-await/in-trait/return-not-existing-type-wrapping-rpitit.next.stderr @@ -0,0 +1,9 @@ +error[E0412]: cannot find type `Missing` in this scope + --> $DIR/return-not-existing-type-wrapping-rpitit.rs:10:25 + | +LL | fn bar() -> Wrapper<Missing<impl Sized>>; + | ^^^^^^^ not found in this scope + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0412`. diff --git a/tests/ui/async-await/in-trait/return-not-existing-type-wrapping-rpitit.rs b/tests/ui/async-await/in-trait/return-not-existing-type-wrapping-rpitit.rs new file mode 100644 index 00000000000..37c02827e8d --- /dev/null +++ b/tests/ui/async-await/in-trait/return-not-existing-type-wrapping-rpitit.rs @@ -0,0 +1,20 @@ +// edition:2021 +// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty +// revisions: current next + +#![feature(return_position_impl_trait_in_trait)] + +struct Wrapper<T>(T); + +trait Foo { + fn bar() -> Wrapper<Missing<impl Sized>>; + //~^ ERROR: cannot find type `Missing` in this scope [E0412] +} + +impl Foo for () { + fn bar() -> Wrapper<i32> { + Wrapper(0) + } +} + +fn main() {} diff --git a/tests/ui/async-await/return-type-notation/rtn-implied-in-supertrait.rs b/tests/ui/async-await/return-type-notation/rtn-implied-in-supertrait.rs new file mode 100644 index 00000000000..e55104ee968 --- /dev/null +++ b/tests/ui/async-await/return-type-notation/rtn-implied-in-supertrait.rs @@ -0,0 +1,28 @@ +// edition:2021 +// check-pass + +#![feature(async_fn_in_trait, return_position_impl_trait_in_trait, return_type_notation)] +//~^ WARN the feature `return_type_notation` is incomplete + +use std::future::Future; + +struct JoinHandle<T>(fn() -> T); + +fn spawn<T>(_: impl Future<Output = T>) -> JoinHandle<T> { + todo!() +} + +trait Foo { + async fn bar(&self) -> i32; +} + +trait SendFoo: Foo<bar(): Send> + Send {} + +fn foobar(foo: impl SendFoo) -> JoinHandle<i32> { + spawn(async move { + let future = foo.bar(); + future.await + }) +} + +fn main() {} diff --git a/tests/ui/async-await/return-type-notation/rtn-implied-in-supertrait.stderr b/tests/ui/async-await/return-type-notation/rtn-implied-in-supertrait.stderr new file mode 100644 index 00000000000..8626648b523 --- /dev/null +++ b/tests/ui/async-await/return-type-notation/rtn-implied-in-supertrait.stderr @@ -0,0 +1,11 @@ +warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/rtn-implied-in-supertrait.rs:4:68 + | +LL | #![feature(async_fn_in_trait, return_position_impl_trait_in_trait, return_type_notation)] + | ^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/async-await/return-type-notation/rtn-in-impl-signature.rs b/tests/ui/async-await/return-type-notation/rtn-in-impl-signature.rs new file mode 100644 index 00000000000..1b16a492a7a --- /dev/null +++ b/tests/ui/async-await/return-type-notation/rtn-in-impl-signature.rs @@ -0,0 +1,13 @@ +#![feature(return_type_notation)] +//~^ WARN the feature `return_type_notation` is incomplete + +// Shouldn't ICE when we have a (bad) RTN in an impl header + +trait Super1<'a> { + fn bar<'b>() -> bool; +} + +impl Super1<'_, bar(): Send> for () {} +//~^ ERROR associated type bindings are not allowed here + +fn main() {} diff --git a/tests/ui/async-await/return-type-notation/rtn-in-impl-signature.stderr b/tests/ui/async-await/return-type-notation/rtn-in-impl-signature.stderr new file mode 100644 index 00000000000..52d8168c9d8 --- /dev/null +++ b/tests/ui/async-await/return-type-notation/rtn-in-impl-signature.stderr @@ -0,0 +1,18 @@ +warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/rtn-in-impl-signature.rs:1:12 + | +LL | #![feature(return_type_notation)] + | ^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information + = note: `#[warn(incomplete_features)]` on by default + +error[E0229]: associated type bindings are not allowed here + --> $DIR/rtn-in-impl-signature.rs:10:17 + | +LL | impl Super1<'_, bar(): Send> for () {} + | ^^^^^^^^^^^ associated type not allowed here + +error: aborting due to previous error; 1 warning emitted + +For more information about this error, try `rustc --explain E0229`. diff --git a/tests/ui/chalkify/arithmetic.rs b/tests/ui/chalkify/arithmetic.rs deleted file mode 100644 index 6c78a71b0fc..00000000000 --- a/tests/ui/chalkify/arithmetic.rs +++ /dev/null @@ -1,20 +0,0 @@ -// check-pass -// compile-flags: -Z trait-solver=chalk - -fn main() { - 1 + 2; - 3 * 6; - 2 - 5; - 17 / 6; - 23 % 11; - 4 & 6; - 7 | 15; - 4 << 7; - 123 >> 3; - 1 == 2; - 5 != 5; - 6 < 2; - 7 > 11; - 3 <= 1; - 9 >= 14; -} diff --git a/tests/ui/chalkify/assert.rs b/tests/ui/chalkify/assert.rs deleted file mode 100644 index 834c8935e76..00000000000 --- a/tests/ui/chalkify/assert.rs +++ /dev/null @@ -1,6 +0,0 @@ -// run-pass -// compile-flags: -Z trait-solver=chalk - -fn main() { - assert_eq!(1, 1); -} diff --git a/tests/ui/chalkify/basic.rs b/tests/ui/chalkify/basic.rs deleted file mode 100644 index 4a7cd939669..00000000000 --- a/tests/ui/chalkify/basic.rs +++ /dev/null @@ -1,12 +0,0 @@ -// check-pass -// compile-flags: -Z trait-solver=chalk - -trait Foo {} - -struct Bar {} - -impl Foo for Bar {} - -fn main() -> () { - let _ = Bar {}; -} diff --git a/tests/ui/chalkify/bugs/async.stderr b/tests/ui/chalkify/bugs/async.stderr deleted file mode 100644 index 9ebaac31dcb..00000000000 --- a/tests/ui/chalkify/bugs/async.stderr +++ /dev/null @@ -1,22 +0,0 @@ -error[E0277]: `[async fn body@$DIR/async.rs:23:29: 25:2]` is not a future - --> $DIR/async.rs:23:25 - | -LL | async fn foo(x: u32) -> u32 { - | ^^^ `[async fn body@$DIR/async.rs:23:29: 25:2]` is not a future - | - = 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 { 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 { - | ^^^query stack during panic: -#0 [typeck] type-checking `foo` -#1 [type_of] computing type of `foo::{opaque#0}` -#2 [check_mod_item_types] checking item types in top-level module -#3 [analysis] running analysis passes on this crate -end of query stack -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/chalkify/builtin-copy-clone.rs b/tests/ui/chalkify/builtin-copy-clone.rs deleted file mode 100644 index a478c006ef1..00000000000 --- a/tests/ui/chalkify/builtin-copy-clone.rs +++ /dev/null @@ -1,45 +0,0 @@ -// run-pass -// compile-flags: -Z trait-solver=chalk - -// Test that `Clone` is correctly implemented for builtin types. - -#[derive(Copy, Clone)] -struct S(#[allow(unused_tuple_struct_fields)] i32); - -fn test_clone<T: Clone>(arg: T) { - let _ = arg.clone(); -} - -fn test_copy<T: Copy>(arg: T) { - let _ = arg; - let _ = arg; -} - -fn test_copy_clone<T: Copy + Clone>(arg: T) { - test_copy(arg); - test_clone(arg); -} - -fn foo() { } - -fn main() { - // FIXME: add closures when they're considered WF - test_copy_clone(foo); - let f: fn() = foo; - test_copy_clone(f); - // FIXME(#86252): reinstate array test after chalk upgrade - //test_copy_clone([1; 56]); - test_copy_clone((1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)); - test_copy_clone((1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, true, 'a', 1.1)); - test_copy_clone(()); - test_copy_clone(((1, 1), (1, 1, 1), (1.1, 1, 1, 'a'), ())); - - let a = ( - (S(1), S(0)), - ( - (S(0), S(0), S(1)), - S(0) - ) - ); - test_copy_clone(a); -} diff --git a/tests/ui/chalkify/chalk_initial_program.rs b/tests/ui/chalkify/chalk_initial_program.rs deleted file mode 100644 index 21de72b6fcc..00000000000 --- a/tests/ui/chalkify/chalk_initial_program.rs +++ /dev/null @@ -1,16 +0,0 @@ -// compile-flags: -Z trait-solver=chalk - -trait Foo { } - -impl Foo for i32 { } - -impl Foo for u32 { } - -fn gimme<F: Foo>() { } - -// Note: this also tests that `std::process::Termination` is implemented for `()`. -fn main() { - gimme::<i32>(); - gimme::<u32>(); - gimme::<f32>(); //~ERROR the trait bound `f32: Foo` is not satisfied -} diff --git a/tests/ui/chalkify/chalk_initial_program.stderr b/tests/ui/chalkify/chalk_initial_program.stderr deleted file mode 100644 index 343c0a31862..00000000000 --- a/tests/ui/chalkify/chalk_initial_program.stderr +++ /dev/null @@ -1,18 +0,0 @@ -error[E0277]: the trait bound `f32: Foo` is not satisfied - --> $DIR/chalk_initial_program.rs:15:13 - | -LL | gimme::<f32>(); - | ^^^ the trait `Foo` is not implemented for `f32` - | - = help: the following other types implement trait `Foo`: - i32 - u32 -note: required by a bound in `gimme` - --> $DIR/chalk_initial_program.rs:9:13 - | -LL | fn gimme<F: Foo>() { } - | ^^^ required by this bound in `gimme` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/chalkify/closure.rs b/tests/ui/chalkify/closure.rs deleted file mode 100644 index a908a1e97ec..00000000000 --- a/tests/ui/chalkify/closure.rs +++ /dev/null @@ -1,38 +0,0 @@ -// compile-flags: -Z trait-solver=chalk - -fn main() -> () { - let t = || {}; - t(); - - let mut a = 0; - let mut b = move || { - a = 1; - }; - b(); - - let mut c = b; - - c(); - b(); - - let mut a = 0; - let mut b = || { - a = 1; - }; - b(); - - let mut c = b; - - c(); - b(); //~ ERROR - - // FIXME(chalk): this doesn't quite work - /* - let b = |c| { - c - }; - - let a = &32; - b(a); - */ -} diff --git a/tests/ui/chalkify/closure.stderr b/tests/ui/chalkify/closure.stderr deleted file mode 100644 index a33c0ba0d37..00000000000 --- a/tests/ui/chalkify/closure.stderr +++ /dev/null @@ -1,22 +0,0 @@ -error[E0382]: borrow of moved value: `b` - --> $DIR/closure.rs:27:5 - | -LL | let mut c = b; - | - value moved here -... -LL | b(); - | ^ value borrowed here after move - | -note: closure cannot be moved more than once as it is not `Copy` due to moving the variable `a` out of its environment - --> $DIR/closure.rs:20:9 - | -LL | a = 1; - | ^ -help: consider mutably borrowing `b` - | -LL | let mut c = &mut b; - | ++++ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0382`. diff --git a/tests/ui/chalkify/generic_impls.rs b/tests/ui/chalkify/generic_impls.rs deleted file mode 100644 index 7d33e12d8be..00000000000 --- a/tests/ui/chalkify/generic_impls.rs +++ /dev/null @@ -1,18 +0,0 @@ -// compile-flags: -Z trait-solver=chalk - -trait Foo { } - -impl<T> Foo for (T, u32) { } - -fn gimme<F: Foo>() { } - -fn foo<T>() { - gimme::<(T, u32)>(); - gimme::<(Option<T>, u32)>(); - gimme::<(Option<T>, f32)>(); //~ ERROR -} - -fn main() { - gimme::<(i32, u32)>(); - gimme::<(i32, f32)>(); //~ ERROR -} diff --git a/tests/ui/chalkify/generic_impls.stderr b/tests/ui/chalkify/generic_impls.stderr deleted file mode 100644 index d4a8354d3fc..00000000000 --- a/tests/ui/chalkify/generic_impls.stderr +++ /dev/null @@ -1,29 +0,0 @@ -error[E0277]: the trait bound `(Option<T>, f32): Foo` is not satisfied - --> $DIR/generic_impls.rs:12:13 - | -LL | gimme::<(Option<T>, f32)>(); - | ^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `(Option<T>, f32)` - | - = help: the trait `Foo` is implemented for `(T, u32)` -note: required by a bound in `gimme` - --> $DIR/generic_impls.rs:7:13 - | -LL | fn gimme<F: Foo>() { } - | ^^^ required by this bound in `gimme` - -error[E0277]: the trait bound `(i32, f32): Foo` is not satisfied - --> $DIR/generic_impls.rs:17:13 - | -LL | gimme::<(i32, f32)>(); - | ^^^^^^^^^^ the trait `Foo` is not implemented for `(i32, f32)` - | - = help: the trait `Foo` is implemented for `(T, u32)` -note: required by a bound in `gimme` - --> $DIR/generic_impls.rs:7:13 - | -LL | fn gimme<F: Foo>() { } - | ^^^ required by this bound in `gimme` - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/chalkify/impl_wf.rs b/tests/ui/chalkify/impl_wf.rs deleted file mode 100644 index c8dfd4c3a5b..00000000000 --- a/tests/ui/chalkify/impl_wf.rs +++ /dev/null @@ -1,26 +0,0 @@ -// compile-flags: -Z trait-solver=chalk - -trait Foo: Sized { } - -trait Bar { - type Item: Foo; -} - -impl Foo for i32 { } - -impl Foo for str { } -//~^ ERROR the size for values of type `str` cannot be known at compilation time - - -// Implicit `T: Sized` bound. -impl<T> Foo for Option<T> { } - -trait Baz<U: ?Sized> where U: Foo { } - -impl Baz<i32> for i32 { } - -impl Baz<f32> for f32 { } -//~^ ERROR the trait bound `f32: Foo` is not satisfied - -fn main() { -} diff --git a/tests/ui/chalkify/impl_wf.stderr b/tests/ui/chalkify/impl_wf.stderr deleted file mode 100644 index 84c32fa3771..00000000000 --- a/tests/ui/chalkify/impl_wf.stderr +++ /dev/null @@ -1,29 +0,0 @@ -error[E0277]: the size for values of type `str` cannot be known at compilation time - --> $DIR/impl_wf.rs:11:14 - | -LL | impl Foo for str { } - | ^^^ doesn't have a size known at compile-time - | - = help: the trait `Sized` is not implemented for `str` -note: required by a bound in `Foo` - --> $DIR/impl_wf.rs:3:12 - | -LL | trait Foo: Sized { } - | ^^^^^ required by this bound in `Foo` - -error[E0277]: the trait bound `f32: Foo` is not satisfied - --> $DIR/impl_wf.rs:22:19 - | -LL | impl Baz<f32> for f32 { } - | ^^^ the trait `Foo` is not implemented for `f32` - | - = help: the trait `Foo` is implemented for `i32` -note: required by a bound in `Baz` - --> $DIR/impl_wf.rs:18:31 - | -LL | trait Baz<U: ?Sized> where U: Foo { } - | ^^^ required by this bound in `Baz` - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/chalkify/impl_wf_2.rs b/tests/ui/chalkify/impl_wf_2.rs deleted file mode 100644 index 325044ad634..00000000000 --- a/tests/ui/chalkify/impl_wf_2.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Split out of impl_wf.rs to work around rust aborting compilation early - -// compile-flags: -Z trait-solver=chalk - -trait Foo: Sized { } - -trait Bar { - type Item: Foo; -} - -impl Foo for i32 { } - -// Implicit `T: Sized` bound. -impl<T> Foo for Option<T> { } - -impl Bar for () { - type Item = i32; -} - -impl<T> Bar for Option<T> { - type Item = Option<T>; -} - -impl Bar for f32 { - type Item = f32; - //~^ ERROR the trait bound `f32: Foo` is not satisfied -} - -trait Baz<U: ?Sized> where U: Foo { } - -impl Baz<i32> for i32 { } - -fn main() {} diff --git a/tests/ui/chalkify/impl_wf_2.stderr b/tests/ui/chalkify/impl_wf_2.stderr deleted file mode 100644 index 1c1df644b06..00000000000 --- a/tests/ui/chalkify/impl_wf_2.stderr +++ /dev/null @@ -1,16 +0,0 @@ -error[E0277]: the trait bound `f32: Foo` is not satisfied - --> $DIR/impl_wf_2.rs:25:17 - | -LL | type Item = f32; - | ^^^ the trait `Foo` is not implemented for `f32` - | - = help: the trait `Foo` is implemented for `i32` -note: required by a bound in `Bar::Item` - --> $DIR/impl_wf_2.rs:8:16 - | -LL | type Item: Foo; - | ^^^ required by this bound in `Bar::Item` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/chalkify/inherent_impl.rs b/tests/ui/chalkify/inherent_impl.rs deleted file mode 100644 index f0f24d485cd..00000000000 --- a/tests/ui/chalkify/inherent_impl.rs +++ /dev/null @@ -1,42 +0,0 @@ -// run-pass -// compile-flags: -Z trait-solver=chalk - -trait Foo { } - -impl Foo for i32 { } - -struct S<T: Foo> { - x: T, -} - -fn only_foo<T: Foo>(_x: &T) { } - -impl<T> S<T> { - // Test that we have the correct environment inside an inherent method. - fn dummy_foo(&self) { - only_foo(&self.x) - } -} - -trait Bar { } -impl Bar for u32 { } - -fn only_bar<T: Bar>() { } - -impl<T> S<T> { - // Test that the environment of `dummy_bar` adds up with the environment - // of the inherent impl. - fn dummy_bar<U: Bar>(&self) { - only_foo(&self.x); - only_bar::<U>(); - } -} - -fn main() { - let s = S { - x: 5, - }; - - s.dummy_bar::<u32>(); - s.dummy_foo(); -} diff --git a/tests/ui/chalkify/inherent_impl_min.rs b/tests/ui/chalkify/inherent_impl_min.rs deleted file mode 100644 index 3eda7102dec..00000000000 --- a/tests/ui/chalkify/inherent_impl_min.rs +++ /dev/null @@ -1,27 +0,0 @@ -// run-pass -// compile-flags: -Z trait-solver=chalk - -trait Foo { } - -impl Foo for i32 { } - -struct S<T: Foo> { - x: T, -} - -fn only_foo<T: Foo>(_x: &T) { } - -impl<T> S<T> { - // Test that we have the correct environment inside an inherent method. - fn dummy_foo(&self) { - only_foo(&self.x) - } -} - -fn main() { - let s = S { - x: 5, - }; - - s.dummy_foo(); -} diff --git a/tests/ui/chalkify/lower_env1.rs b/tests/ui/chalkify/lower_env1.rs deleted file mode 100644 index c8762001e6a..00000000000 --- a/tests/ui/chalkify/lower_env1.rs +++ /dev/null @@ -1,14 +0,0 @@ -// check-pass -// compile-flags: -Z trait-solver=chalk - -#![allow(dead_code)] - -trait Foo { } - -trait Bar where Self: Foo { } - -fn bar<T: Bar + ?Sized>() { -} - -fn main() { -} diff --git a/tests/ui/chalkify/lower_env2.rs b/tests/ui/chalkify/lower_env2.rs deleted file mode 100644 index 7d4f81f12ea..00000000000 --- a/tests/ui/chalkify/lower_env2.rs +++ /dev/null @@ -1,16 +0,0 @@ -// check-pass -// compile-flags: -Z trait-solver=chalk - -#![allow(dead_code)] - -trait Foo { } - -struct S<'a, T: ?Sized> where T: Foo { - data: &'a T, -} - -fn bar<T: Foo>(_x: S<'_, T>) { // note that we have an implicit `T: Sized` bound -} - -fn main() { -} diff --git a/tests/ui/chalkify/lower_env3.rs b/tests/ui/chalkify/lower_env3.rs deleted file mode 100644 index 5b70c4abbb5..00000000000 --- a/tests/ui/chalkify/lower_env3.rs +++ /dev/null @@ -1,16 +0,0 @@ -// check-pass -// compile-flags: -Z trait-solver=chalk - -#![allow(dead_code)] - -trait Foo { - fn foo(&self); -} - -impl<T> Foo for T where T: Clone { - fn foo(&self) { - } -} - -fn main() { -} diff --git a/tests/ui/chalkify/lower_impl.rs b/tests/ui/chalkify/lower_impl.rs deleted file mode 100644 index 6f79b3ba386..00000000000 --- a/tests/ui/chalkify/lower_impl.rs +++ /dev/null @@ -1,17 +0,0 @@ -// check-pass -// compile-flags: -Z trait-solver=chalk - -trait Foo { } - -impl<T: 'static> Foo for T where T: Iterator<Item = i32> { } - -trait Bar { - type Assoc; -} - -impl<T> Bar for T where T: Iterator<Item = i32> { - type Assoc = Vec<T>; -} - -fn main() { -} diff --git a/tests/ui/chalkify/lower_struct.rs b/tests/ui/chalkify/lower_struct.rs deleted file mode 100644 index 6be0d4dd5bd..00000000000 --- a/tests/ui/chalkify/lower_struct.rs +++ /dev/null @@ -1,8 +0,0 @@ -// check-pass -// compile-flags: -Z trait-solver=chalk - -struct Foo<'a, T> where Box<T>: Clone { - _x: std::marker::PhantomData<&'a T>, -} - -fn main() { } diff --git a/tests/ui/chalkify/lower_trait.rs b/tests/ui/chalkify/lower_trait.rs deleted file mode 100644 index 8f5b358220b..00000000000 --- a/tests/ui/chalkify/lower_trait.rs +++ /dev/null @@ -1,11 +0,0 @@ -// check-pass -// compile-flags: -Z trait-solver=chalk - -trait Bar { } - -trait Foo<S, T: ?Sized> { - type Assoc: Bar + ?Sized; -} - -fn main() { -} diff --git a/tests/ui/chalkify/lower_trait_higher_rank.rs b/tests/ui/chalkify/lower_trait_higher_rank.rs deleted file mode 100644 index f04a1deea87..00000000000 --- a/tests/ui/chalkify/lower_trait_higher_rank.rs +++ /dev/null @@ -1,9 +0,0 @@ -// check-pass -// compile-flags: -Z trait-solver=chalk - -trait Foo<F: ?Sized> where for<'a> F: Fn(&'a (u8, u16)) -> &'a u8 -{ -} - -fn main() { -} diff --git a/tests/ui/chalkify/lower_trait_where_clause.rs b/tests/ui/chalkify/lower_trait_where_clause.rs deleted file mode 100644 index a21d2f31963..00000000000 --- a/tests/ui/chalkify/lower_trait_where_clause.rs +++ /dev/null @@ -1,16 +0,0 @@ -// check-pass -// compile-flags: -Z trait-solver=chalk - -use std::borrow::Borrow; - -trait Foo<'a, 'b, T, U> -where - T: Borrow<U> + ?Sized, - U: ?Sized + 'b, - 'a: 'b, - Box<T>:, // NOTE(#53696) this checks an empty list of bounds. -{ -} - -fn main() { -} diff --git a/tests/ui/chalkify/println.rs b/tests/ui/chalkify/println.rs deleted file mode 100644 index edddc382152..00000000000 --- a/tests/ui/chalkify/println.rs +++ /dev/null @@ -1,6 +0,0 @@ -// check-pass -// compile-flags: -Z trait-solver=chalk - -fn main() { - println!("hello"); -} diff --git a/tests/ui/chalkify/projection.rs b/tests/ui/chalkify/projection.rs deleted file mode 100644 index 19bb2ae1497..00000000000 --- a/tests/ui/chalkify/projection.rs +++ /dev/null @@ -1,25 +0,0 @@ -// run-pass -// compile-flags: -Z trait-solver=chalk - -trait Foo { } - -trait Bar { - type Item: Foo; -} - -impl Foo for i32 { } -impl Bar for i32 { - type Item = i32; -} - -fn only_foo<T: Foo>() { } - -fn only_bar<T: Bar>() { - // `T` implements `Bar` hence `<T as Bar>::Item` must also implement `Bar` - only_foo::<T::Item>() -} - -fn main() { - only_bar::<i32>(); - only_foo::<<i32 as Bar>::Item>(); -} diff --git a/tests/ui/chalkify/recursive_where_clause_on_type.rs b/tests/ui/chalkify/recursive_where_clause_on_type.rs deleted file mode 100644 index c2c8aa6aabe..00000000000 --- a/tests/ui/chalkify/recursive_where_clause_on_type.rs +++ /dev/null @@ -1,30 +0,0 @@ -// FIXME(chalk): should fail, see comments -// check-fail -// compile-flags: -Z trait-solver=chalk - -#![feature(trivial_bounds)] - -trait Bar { - fn foo(); -} -trait Foo: Bar { } - -struct S where S: Foo; - -impl Foo for S { -} - -fn bar<T: Bar>() { - T::foo(); -} - -fn foo<T: Foo>() { - bar::<T>() -} - -fn main() { - // For some reason, the error is duplicated... - - foo::<S>() //~ ERROR the type `S` is not well-formed - //~^ ERROR the type `S` is not well-formed -} diff --git a/tests/ui/chalkify/recursive_where_clause_on_type.stderr b/tests/ui/chalkify/recursive_where_clause_on_type.stderr deleted file mode 100644 index cead5adeaaa..00000000000 --- a/tests/ui/chalkify/recursive_where_clause_on_type.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error: the type `S` is not well-formed - --> $DIR/recursive_where_clause_on_type.rs:28:11 - | -LL | foo::<S>() - | ^ - -error: the type `S` is not well-formed - --> $DIR/recursive_where_clause_on_type.rs:28:5 - | -LL | foo::<S>() - | ^^^^^^^^ - -error: aborting due to 2 previous errors - diff --git a/tests/ui/chalkify/super_trait.rs b/tests/ui/chalkify/super_trait.rs deleted file mode 100644 index 540ae51e57f..00000000000 --- a/tests/ui/chalkify/super_trait.rs +++ /dev/null @@ -1,19 +0,0 @@ -// run-pass -// compile-flags: -Z trait-solver=chalk - -trait Foo { } -trait Bar: Foo { } - -impl Foo for i32 { } -impl Bar for i32 { } - -fn only_foo<T: Foo>() { } - -fn only_bar<T: Bar>() { - // `T` implements `Bar` hence `T` must also implement `Foo` - only_foo::<T>() -} - -fn main() { - only_bar::<i32>() -} diff --git a/tests/ui/chalkify/trait-objects.rs b/tests/ui/chalkify/trait-objects.rs deleted file mode 100644 index 144d9788b82..00000000000 --- a/tests/ui/chalkify/trait-objects.rs +++ /dev/null @@ -1,12 +0,0 @@ -// check-pass -// compile-flags: -Z trait-solver=chalk - -use std::fmt::Display; - -fn main() { - let d: &dyn Display = &mut 3; - d.to_string(); - (&d).to_string(); - let f: &dyn Fn(i32) -> _ = &|x| x + x; - f(2); -} diff --git a/tests/ui/chalkify/trait_implied_bound.rs b/tests/ui/chalkify/trait_implied_bound.rs deleted file mode 100644 index f97dbf6b7e7..00000000000 --- a/tests/ui/chalkify/trait_implied_bound.rs +++ /dev/null @@ -1,18 +0,0 @@ -// run-pass -// compile-flags: -Z trait-solver=chalk - -trait Foo { } -trait Bar<U> where U: Foo { } - -impl Foo for i32 { } -impl Bar<i32> for i32 { } - -fn only_foo<T: Foo>() { } - -fn only_bar<U, T: Bar<U>>() { - only_foo::<U>() -} - -fn main() { - only_bar::<i32, i32>() -} diff --git a/tests/ui/chalkify/type_implied_bound.rs b/tests/ui/chalkify/type_implied_bound.rs deleted file mode 100644 index 70f1b4265e4..00000000000 --- a/tests/ui/chalkify/type_implied_bound.rs +++ /dev/null @@ -1,29 +0,0 @@ -// run-pass -// compile-flags: -Z trait-solver=chalk - -trait Eq { } -trait Hash: Eq { } - -impl Eq for i32 { } -impl Hash for i32 { } - -struct Set<T: Hash> { - _x: T, -} - -fn only_eq<T: Eq>() { } - -fn take_a_set<T>(_: &Set<T>) { - // `Set<T>` is an input type of `take_a_set`, hence we know that - // `T` must implement `Hash`, and we know in turn that `T` must - // implement `Eq`. - only_eq::<T>() -} - -fn main() { - let set = Set { - _x: 5, - }; - - take_a_set(&set); -} diff --git a/tests/ui/chalkify/type_inference.rs b/tests/ui/chalkify/type_inference.rs deleted file mode 100644 index d7167d0dc57..00000000000 --- a/tests/ui/chalkify/type_inference.rs +++ /dev/null @@ -1,28 +0,0 @@ -// compile-flags: -Z trait-solver=chalk - -trait Foo { } -impl Foo for i32 { } - -trait Bar { } -impl Bar for i32 { } -impl Bar for u32 { } - -fn only_foo<T: Foo>(_x: T) { } - -fn only_bar<T: Bar>(_x: T) { } - -fn main() { - let x = 5.0; - - // The only type which implements `Foo` is `i32`, so the chalk trait solver - // is expecting a variable of type `i32`. This behavior differs from the - // old-style trait solver. I guess this will change, that's why I'm - // adding that test. - // FIXME(chalk): order of these two errors is non-deterministic, - // so let's just hide one for now - //only_foo(x); // ERROR the trait bound `f64: Foo` is not satisfied - - // Here we have two solutions so we get back the behavior of the old-style - // trait solver. - only_bar(x); //~ ERROR the trait bound `{float}: Bar` is not satisfied -} diff --git a/tests/ui/chalkify/type_inference.stderr b/tests/ui/chalkify/type_inference.stderr deleted file mode 100644 index 508a6dd1388..00000000000 --- a/tests/ui/chalkify/type_inference.stderr +++ /dev/null @@ -1,20 +0,0 @@ -error[E0277]: the trait bound `{float}: Bar` is not satisfied - --> $DIR/type_inference.rs:27:14 - | -LL | only_bar(x); - | -------- ^ the trait `Bar` is not implemented for `{float}` - | | - | required by a bound introduced by this call - | - = help: the following other types implement trait `Bar`: - i32 - u32 -note: required by a bound in `only_bar` - --> $DIR/type_inference.rs:12:16 - | -LL | fn only_bar<T: Bar>(_x: T) { } - | ^^^ required by this bound in `only_bar` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/chalkify/type_wf.rs b/tests/ui/chalkify/type_wf.rs deleted file mode 100644 index 37d2f5ca832..00000000000 --- a/tests/ui/chalkify/type_wf.rs +++ /dev/null @@ -1,25 +0,0 @@ -// check-fail -// compile-flags: -Z trait-solver=chalk - -trait Foo { } - -struct S<T: Foo> { - x: T, -} - -impl Foo for i32 { } -impl<T> Foo for Option<T> { } - -fn main() { - let s = S { - x: 5, - }; - - let s = S { - x: 5.0, //~ ERROR the trait bound `{float}: Foo` is not satisfied - }; - - let s = S { - x: Some(5.0), - }; -} diff --git a/tests/ui/chalkify/type_wf.stderr b/tests/ui/chalkify/type_wf.stderr deleted file mode 100644 index 6e8daf63517..00000000000 --- a/tests/ui/chalkify/type_wf.stderr +++ /dev/null @@ -1,16 +0,0 @@ -error[E0277]: the trait bound `{float}: Foo` is not satisfied - --> $DIR/type_wf.rs:19:12 - | -LL | x: 5.0, - | ^^^ the trait `Foo` is not implemented for `{float}` - | - = help: the trait `Foo` is implemented for `i32` -note: required by a bound in `S` - --> $DIR/type_wf.rs:6:13 - | -LL | struct S<T: Foo> { - | ^^^ required by this bound in `S` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/closures/issue-113087.rs b/tests/ui/closures/issue-113087.rs new file mode 100644 index 00000000000..a4edc2f2f0b --- /dev/null +++ b/tests/ui/closures/issue-113087.rs @@ -0,0 +1,11 @@ +fn some_fn<'a>(_: &'a i32, _: impl FnOnce(&'a i32)) {} + +fn main() { + let some_closure = |_| {}; + + for a in [1] { + some_fn(&a, |c| { //~ ERROR does not live long enough + some_closure(c); + }); + } +} diff --git a/tests/ui/closures/issue-113087.stderr b/tests/ui/closures/issue-113087.stderr new file mode 100644 index 00000000000..8ccef4a54f5 --- /dev/null +++ b/tests/ui/closures/issue-113087.stderr @@ -0,0 +1,16 @@ +error[E0597]: `a` does not live long enough + --> $DIR/issue-113087.rs:7:17 + | +LL | for a in [1] { + | - binding `a` declared here +LL | some_fn(&a, |c| { + | ^^ borrowed value does not live long enough +LL | some_closure(c); + | ------------ borrow later captured here by closure +LL | }); +LL | } + | - `a` dropped here while still borrowed + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0597`. diff --git a/tests/ui/codegen/subtyping-impacts-selection-1.rs b/tests/ui/codegen/subtyping-impacts-selection-1.rs new file mode 100644 index 00000000000..09e06f6d684 --- /dev/null +++ b/tests/ui/codegen/subtyping-impacts-selection-1.rs @@ -0,0 +1,44 @@ +// run-pass +// revisions: mir codegen +//[mir] compile-flags: -Zmir-opt-level=3 +//[codegen] compile-flags: -Zmir-opt-level=0 + +// A regression test for #107205 +#![allow(coherence_leak_check)] +struct Foo<T: 'static>(T); + +fn useful<'a>(_: &'a u8) {} + +trait GetInner { + type Assoc; + fn muahaha(&mut self) -> Self::Assoc; +} + +impl GetInner for Foo<fn(&'static u8)> { + type Assoc = String; + fn muahaha(&mut self) -> String { + String::from("I am a string") + } +} + +impl GetInner for Foo<for<'a> fn(&'a u8)> { + type Assoc = [usize; 3]; + fn muahaha(&mut self) -> [usize; 3] { + [100; 3] + } +} + +fn break_me(hr_fnptr: Box<Foo::<for<'a> fn(&'a u8)>>) -> Box<dyn GetInner<Assoc = String>> { + let lr_fnptr = hr_fnptr as Box<Foo<fn(&'static u8)>>; + lr_fnptr as Box<dyn GetInner<Assoc = String>> +} + +fn main() { + drop(Box::new(Foo(useful as fn(&'static u8))) as Box<dyn GetInner<Assoc = String>>); + drop(Box::new(Foo(useful as fn(&u8))) as Box<dyn GetInner<Assoc = [usize; 3]>>); + + let mut any = break_me(Box::new(Foo(useful))); + + let evil_string = any.muahaha(); + assert_eq!(evil_string, "I am a string"); +} diff --git a/tests/ui/codegen/subtyping-impacts-selection-2.rs b/tests/ui/codegen/subtyping-impacts-selection-2.rs new file mode 100644 index 00000000000..921136775b7 --- /dev/null +++ b/tests/ui/codegen/subtyping-impacts-selection-2.rs @@ -0,0 +1,12 @@ +// run-pass +// revisions: mir codegen +//[mir] compile-flags: -Zmir-opt-level=3 +//[codegen] compile-flags: -Zmir-opt-level=0 + +// A regression test for #107205 + +const X: for<'b> fn(&'b ()) = |&()| (); +fn main() { + let dyn_debug = Box::new(X) as Box<fn(&'static ())> as Box<dyn Send>; + drop(dyn_debug) +} diff --git a/tests/ui/const-generics/defaults/default-param-wf-concrete.stderr b/tests/ui/const-generics/defaults/default-param-wf-concrete.next.stderr index e8ebddade5c..4259ce2b626 100644 --- a/tests/ui/const-generics/defaults/default-param-wf-concrete.stderr +++ b/tests/ui/const-generics/defaults/default-param-wf-concrete.next.stderr @@ -1,5 +1,5 @@ error[E0080]: evaluation of constant value failed - --> $DIR/default-param-wf-concrete.rs:1:28 + --> $DIR/default-param-wf-concrete.rs:4:28 | LL | struct Foo<const N: u8 = { 255 + 1 }>; | ^^^^^^^ attempt to compute `u8::MAX + 1_u8`, which would overflow diff --git a/tests/ui/const-generics/defaults/default-param-wf-concrete.old.stderr b/tests/ui/const-generics/defaults/default-param-wf-concrete.old.stderr new file mode 100644 index 00000000000..4259ce2b626 --- /dev/null +++ b/tests/ui/const-generics/defaults/default-param-wf-concrete.old.stderr @@ -0,0 +1,9 @@ +error[E0080]: evaluation of constant value failed + --> $DIR/default-param-wf-concrete.rs:4:28 + | +LL | struct Foo<const N: u8 = { 255 + 1 }>; + | ^^^^^^^ attempt to compute `u8::MAX + 1_u8`, which would overflow + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0080`. diff --git a/tests/ui/const-generics/defaults/default-param-wf-concrete.rs b/tests/ui/const-generics/defaults/default-param-wf-concrete.rs index 41a52c7eb0d..09a00dd8e70 100644 --- a/tests/ui/const-generics/defaults/default-param-wf-concrete.rs +++ b/tests/ui/const-generics/defaults/default-param-wf-concrete.rs @@ -1,3 +1,6 @@ +// revisions: old next +//[next] compile-flags: -Ztrait-solver=next + struct Foo<const N: u8 = { 255 + 1 }>; //~^ ERROR evaluation of constant value failed fn main() {} diff --git a/tests/ui/const-generics/generic_const_exprs/eval-privacy.rs b/tests/ui/const-generics/generic_const_exprs/eval-privacy.rs index 96b769699cc..e5464a4253f 100644 --- a/tests/ui/const-generics/generic_const_exprs/eval-privacy.rs +++ b/tests/ui/const-generics/generic_const_exprs/eval-privacy.rs @@ -1,7 +1,7 @@ #![crate_type = "lib"] #![feature(generic_const_exprs)] +#![feature(type_privacy_lints)] #![allow(incomplete_features)] - #![warn(private_interfaces)] // In this test both old and new private-in-public diagnostic were emitted. @@ -21,6 +21,7 @@ where { type AssocTy = Const<{ my_const_fn(U) }>; //~^ ERROR private type + //~| WARNING type `fn(u8) -> u8 {my_const_fn}` is more private than the item `<Const<U> as Trait>::AssocTy` fn assoc_fn() -> Self::AssocTy { Const } diff --git a/tests/ui/const-generics/generic_const_exprs/eval-privacy.stderr b/tests/ui/const-generics/generic_const_exprs/eval-privacy.stderr index 465621619b4..16fae6b5c63 100644 --- a/tests/ui/const-generics/generic_const_exprs/eval-privacy.stderr +++ b/tests/ui/const-generics/generic_const_exprs/eval-privacy.stderr @@ -8,14 +8,13 @@ LL | const fn my_const_fn(val: u8) -> u8 { | ----------------------------------- `fn(u8) -> u8 {my_const_fn}` declared as private warning: type `fn(u8) -> u8 {my_const_fn}` is more private than the item `<Const<U> as Trait>::AssocTy` - | -note: associated type `<Const<U> as Trait>::AssocTy` is reachable at visibility `pub` --> $DIR/eval-privacy.rs:22:5 | LL | type AssocTy = Const<{ my_const_fn(U) }>; - | ^^^^^^^^^^^^ + | ^^^^^^^^^^^^ associated type `<Const<U> as Trait>::AssocTy` is reachable at visibility `pub` + | note: but type `fn(u8) -> u8 {my_const_fn}` is only usable at visibility `pub(crate)` - --> $DIR/eval-privacy.rs:29:1 + --> $DIR/eval-privacy.rs:30:1 | LL | const fn my_const_fn(val: u8) -> u8 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/consts/const-len-underflow-separate-spans.stderr b/tests/ui/consts/const-len-underflow-separate-spans.next.stderr index 269553631cc..d9208d0706a 100644 --- a/tests/ui/consts/const-len-underflow-separate-spans.stderr +++ b/tests/ui/consts/const-len-underflow-separate-spans.next.stderr @@ -1,11 +1,11 @@ error[E0080]: evaluation of constant value failed - --> $DIR/const-len-underflow-separate-spans.rs:7:20 + --> $DIR/const-len-underflow-separate-spans.rs:10:20 | LL | const LEN: usize = ONE - TWO; | ^^^^^^^^^ attempt to compute `1_usize - 2_usize`, which would overflow note: erroneous constant used - --> $DIR/const-len-underflow-separate-spans.rs:11:17 + --> $DIR/const-len-underflow-separate-spans.rs:14:17 | LL | let a: [i8; LEN] = unimplemented!(); | ^^^ diff --git a/tests/ui/consts/const-len-underflow-separate-spans.old.stderr b/tests/ui/consts/const-len-underflow-separate-spans.old.stderr new file mode 100644 index 00000000000..d9208d0706a --- /dev/null +++ b/tests/ui/consts/const-len-underflow-separate-spans.old.stderr @@ -0,0 +1,15 @@ +error[E0080]: evaluation of constant value failed + --> $DIR/const-len-underflow-separate-spans.rs:10:20 + | +LL | const LEN: usize = ONE - TWO; + | ^^^^^^^^^ attempt to compute `1_usize - 2_usize`, which would overflow + +note: erroneous constant used + --> $DIR/const-len-underflow-separate-spans.rs:14:17 + | +LL | let a: [i8; LEN] = unimplemented!(); + | ^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0080`. diff --git a/tests/ui/consts/const-len-underflow-separate-spans.rs b/tests/ui/consts/const-len-underflow-separate-spans.rs index 4544c8876ae..55704b64154 100644 --- a/tests/ui/consts/const-len-underflow-separate-spans.rs +++ b/tests/ui/consts/const-len-underflow-separate-spans.rs @@ -2,6 +2,9 @@ // spot (where the underflow occurred), while also providing the // overall context for what caused the evaluation. +// revisions: old next +//[next] compile-flags: -Ztrait-solver=next + const ONE: usize = 1; const TWO: usize = 2; const LEN: usize = ONE - TWO; diff --git a/tests/ui/consts/const_in_pattern/issue-73431.rs b/tests/ui/consts/const_in_pattern/issue-73431.rs index fa18a3af1b0..835f502b407 100644 --- a/tests/ui/consts/const_in_pattern/issue-73431.rs +++ b/tests/ui/consts/const_in_pattern/issue-73431.rs @@ -1,4 +1,5 @@ // run-pass +// unset-rustc-env:RUSTC_LOG_COLOR // Regression test for https://github.com/rust-lang/rust/issues/73431. diff --git a/tests/ui/duplicate/dupe-symbols-7.rs b/tests/ui/duplicate/dupe-symbols-7.rs index 633ca4c3189..4983874729c 100644 --- a/tests/ui/duplicate/dupe-symbols-7.rs +++ b/tests/ui/duplicate/dupe-symbols-7.rs @@ -3,9 +3,6 @@ // // error-pattern: entry symbol `main` declared multiple times -// FIXME https://github.com/rust-lang/rust/issues/59774 -// normalize-stderr-test "thread.*panicked.*Metadata module not compiled.*\n" -> "" -// normalize-stderr-test "note:.*RUST_BACKTRACE=1.*\n" -> "" #![allow(warnings)] #[no_mangle] diff --git a/tests/ui/duplicate/dupe-symbols-7.stderr b/tests/ui/duplicate/dupe-symbols-7.stderr index 1455f0e75ab..cd5147c0e15 100644 --- a/tests/ui/duplicate/dupe-symbols-7.stderr +++ b/tests/ui/duplicate/dupe-symbols-7.stderr @@ -1,5 +1,5 @@ error: entry symbol `main` declared multiple times - --> $DIR/dupe-symbols-7.rs:12:1 + --> $DIR/dupe-symbols-7.rs:9:1 | LL | fn main(){} | ^^^^^^^^^ diff --git a/tests/ui/dyn-star/box.rs b/tests/ui/dyn-star/box.rs index d1f1819d9f3..87c8356a174 100644 --- a/tests/ui/dyn-star/box.rs +++ b/tests/ui/dyn-star/box.rs @@ -1,5 +1,7 @@ // run-pass -// compile-flags: -C opt-level=0 +// revisions: current next +//[current] compile-flags: -C opt-level=0 +//[next] compile-flags: -Ztrait-solver=next -C opt-level=0 #![feature(dyn_star)] #![allow(incomplete_features)] diff --git a/tests/ui/dyn-star/param-env-infer.current.stderr b/tests/ui/dyn-star/param-env-infer.current.stderr deleted file mode 100644 index b3af7be7950..00000000000 --- a/tests/ui/dyn-star/param-env-infer.current.stderr +++ /dev/null @@ -1,18 +0,0 @@ -warning: the feature `dyn_star` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/param-env-infer.rs:5:12 - | -LL | #![feature(dyn_star, pointer_like_trait)] - | ^^^^^^^^ - | - = note: see issue #102425 <https://github.com/rust-lang/rust/issues/102425> for more information - = note: `#[warn(incomplete_features)]` on by default - -error[E0282]: type annotations needed - --> $DIR/param-env-infer.rs:13:10 - | -LL | t as _ - | ^ cannot infer type - -error: aborting due to previous error; 1 warning emitted - -For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/dyn-star/param-env-infer.rs b/tests/ui/dyn-star/param-env-infer.rs deleted file mode 100644 index 1fb16d76853..00000000000 --- a/tests/ui/dyn-star/param-env-infer.rs +++ /dev/null @@ -1,17 +0,0 @@ -// revisions: current next -//[next] compile-flags: -Ztrait-solver=next -// incremental - -#![feature(dyn_star, pointer_like_trait)] -//~^ WARN the feature `dyn_star` is incomplete and may not be safe to use and/or cause compiler crashes - -use std::fmt::Debug; -use std::marker::PointerLike; - -fn make_dyn_star<'a, T: PointerLike + Debug + 'a>(t: T) -> impl PointerLike + Debug + 'a { - //[next]~^ ERROR cycle detected when computing type of `make_dyn_star::{opaque#0}` - t as _ - //[current]~^ ERROR type annotations needed -} - -fn main() {} diff --git a/tests/ui/dyn-star/param-env-region-infer.current.stderr b/tests/ui/dyn-star/param-env-region-infer.current.stderr new file mode 100644 index 00000000000..902053ecfef --- /dev/null +++ b/tests/ui/dyn-star/param-env-region-infer.current.stderr @@ -0,0 +1,9 @@ +error[E0282]: type annotations needed + --> $DIR/param-env-region-infer.rs:18:10 + | +LL | t as _ + | ^ cannot infer type + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/dyn-star/param-env-infer.next.stderr b/tests/ui/dyn-star/param-env-region-infer.next.stderr index 408abecc30d..dd724a65908 100644 --- a/tests/ui/dyn-star/param-env-infer.next.stderr +++ b/tests/ui/dyn-star/param-env-region-infer.next.stderr @@ -1,20 +1,11 @@ -warning: the feature `dyn_star` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/param-env-infer.rs:5:12 - | -LL | #![feature(dyn_star, pointer_like_trait)] - | ^^^^^^^^ - | - = note: see issue #102425 <https://github.com/rust-lang/rust/issues/102425> for more information - = note: `#[warn(incomplete_features)]` on by default - error[E0391]: cycle detected when computing type of `make_dyn_star::{opaque#0}` - --> $DIR/param-env-infer.rs:11:60 + --> $DIR/param-env-region-infer.rs:16:60 | LL | fn make_dyn_star<'a, T: PointerLike + Debug + 'a>(t: T) -> impl PointerLike + Debug + 'a { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: ...which requires type-checking `make_dyn_star`... - --> $DIR/param-env-infer.rs:11:1 + --> $DIR/param-env-region-infer.rs:16:1 | LL | fn make_dyn_star<'a, T: PointerLike + Debug + 'a>(t: T) -> impl PointerLike + Debug + 'a { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -22,10 +13,10 @@ LL | fn make_dyn_star<'a, T: PointerLike + Debug + 'a>(t: T) -> impl PointerLike = note: ...which requires normalizing `make_dyn_star::{opaque#0}`... = note: ...which again requires computing type of `make_dyn_star::{opaque#0}`, completing the cycle note: cycle used when checking item types in top-level module - --> $DIR/param-env-infer.rs:5:1 + --> $DIR/param-env-region-infer.rs:10:1 | LL | / #![feature(dyn_star, pointer_like_trait)] -LL | | +LL | | #![allow(incomplete_features)] LL | | LL | | use std::fmt::Debug; ... | @@ -33,6 +24,6 @@ LL | | LL | | fn main() {} | |____________^ -error: aborting due to previous error; 1 warning emitted +error: aborting due to previous error For more information about this error, try `rustc --explain E0391`. diff --git a/tests/ui/dyn-star/param-env-region-infer.rs b/tests/ui/dyn-star/param-env-region-infer.rs new file mode 100644 index 00000000000..537473abc3a --- /dev/null +++ b/tests/ui/dyn-star/param-env-region-infer.rs @@ -0,0 +1,22 @@ +// revisions: current next +// Need `-Zdeduplicate-diagnostics=yes` because the number of cycle errors +// emitted is for some horrible reason platform-specific. +//[next] compile-flags: -Ztrait-solver=next -Zdeduplicate-diagnostics=yes +// incremental + +// checks that we don't ICE if there are region inference variables in the environment +// when computing `PointerLike` builtin candidates. + +#![feature(dyn_star, pointer_like_trait)] +#![allow(incomplete_features)] + +use std::fmt::Debug; +use std::marker::PointerLike; + +fn make_dyn_star<'a, T: PointerLike + Debug + 'a>(t: T) -> impl PointerLike + Debug + 'a { + //[next]~^ ERROR cycle detected when computing + t as _ + //[current]~^ ERROR type annotations needed +} + +fn main() {} diff --git a/tests/ui/error-codes/E0445.rs b/tests/ui/error-codes/E0445.rs index f5f35fb8a4d..9f29c81673e 100644 --- a/tests/ui/error-codes/E0445.rs +++ b/tests/ui/error-codes/E0445.rs @@ -1,3 +1,4 @@ +#![feature(type_privacy_lints)] #[warn(private_bounds)] #[warn(private_interfaces)] @@ -11,9 +12,12 @@ trait Foo { pub trait Bar : Foo {} //~^ ERROR private trait `Foo` in public interface [E0445] +//~| WARNING trait `Foo` is more private than the item `Bar` pub struct Bar2<T: Foo>(pub T); //~^ ERROR private trait `Foo` in public interface [E0445] +//~| WARNING trait `Foo` is more private than the item `Bar2` pub fn foo<T: Foo> (t: T) {} //~^ ERROR private trait `Foo` in public interface [E0445] +//~| WARNING trait `Foo` is more private than the item `foo` fn main() {} diff --git a/tests/ui/error-codes/E0445.stderr b/tests/ui/error-codes/E0445.stderr index ac3637a8218..4f940868ff9 100644 --- a/tests/ui/error-codes/E0445.stderr +++ b/tests/ui/error-codes/E0445.stderr @@ -1,5 +1,5 @@ error[E0445]: private trait `Foo` in public interface - --> $DIR/E0445.rs:12:1 + --> $DIR/E0445.rs:13:1 | LL | trait Foo { | --------- `Foo` declared as private @@ -8,25 +8,24 @@ LL | pub trait Bar : Foo {} | ^^^^^^^^^^^^^^^^^^^ can't leak private trait warning: trait `Foo` is more private than the item `Bar` - | -note: trait `Bar` is reachable at visibility `pub` - --> $DIR/E0445.rs:12:1 + --> $DIR/E0445.rs:13:1 | LL | pub trait Bar : Foo {} - | ^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^ trait `Bar` is reachable at visibility `pub` + | note: but trait `Foo` is only usable at visibility `pub(crate)` - --> $DIR/E0445.rs:8:1 + --> $DIR/E0445.rs:9:1 | LL | trait Foo { | ^^^^^^^^^ note: the lint level is defined here - --> $DIR/E0445.rs:1:8 + --> $DIR/E0445.rs:2:8 | LL | #[warn(private_bounds)] | ^^^^^^^^^^^^^^ error[E0445]: private trait `Foo` in public interface - --> $DIR/E0445.rs:14:1 + --> $DIR/E0445.rs:16:1 | LL | trait Foo { | --------- `Foo` declared as private @@ -35,20 +34,19 @@ LL | pub struct Bar2<T: Foo>(pub T); | ^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait warning: trait `Foo` is more private than the item `Bar2` - | -note: struct `Bar2` is reachable at visibility `pub` - --> $DIR/E0445.rs:14:1 + --> $DIR/E0445.rs:16:1 | LL | pub struct Bar2<T: Foo>(pub T); - | ^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^ struct `Bar2` is reachable at visibility `pub` + | note: but trait `Foo` is only usable at visibility `pub(crate)` - --> $DIR/E0445.rs:8:1 + --> $DIR/E0445.rs:9:1 | LL | trait Foo { | ^^^^^^^^^ error[E0445]: private trait `Foo` in public interface - --> $DIR/E0445.rs:16:1 + --> $DIR/E0445.rs:19:1 | LL | trait Foo { | --------- `Foo` declared as private @@ -57,14 +55,13 @@ LL | pub fn foo<T: Foo> (t: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait warning: trait `Foo` is more private than the item `foo` - | -note: function `foo` is reachable at visibility `pub` - --> $DIR/E0445.rs:16:1 + --> $DIR/E0445.rs:19:1 | LL | pub fn foo<T: Foo> (t: T) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^ function `foo` is reachable at visibility `pub` + | note: but trait `Foo` is only usable at visibility `pub(crate)` - --> $DIR/E0445.rs:8:1 + --> $DIR/E0445.rs:9:1 | LL | trait Foo { | ^^^^^^^^^ diff --git a/tests/ui/error-codes/E0637.stderr b/tests/ui/error-codes/E0637.stderr index 78341735e19..d9db89ddb0c 100644 --- a/tests/ui/error-codes/E0637.stderr +++ b/tests/ui/error-codes/E0637.stderr @@ -22,11 +22,10 @@ error[E0637]: `&` without an explicit lifetime name cannot be used here LL | T: Into<&u32>, | ^ explicit lifetime name needed here | -help: consider introducing a higher-ranked lifetime here with `for<'a>` - --> $DIR/E0637.rs:13:8 +help: consider introducing a higher-ranked lifetime here | -LL | T: Into<&u32>, - | ^ +LL | T: for<'a> Into<&'a u32>, + | +++++++ ++ error: aborting due to 3 previous errors diff --git a/tests/ui/feature-gates/feature-gate-type_alias_impl_trait.rs b/tests/ui/feature-gates/feature-gate-type_alias_impl_trait.rs index 6dfd7f6840f..3f49020bbea 100644 --- a/tests/ui/feature-gates/feature-gate-type_alias_impl_trait.rs +++ b/tests/ui/feature-gates/feature-gate-type_alias_impl_trait.rs @@ -1,4 +1,3 @@ -// ignore-compare-mode-chalk // check-pass #![feature(type_alias_impl_trait)] use std::fmt::Debug; @@ -12,7 +11,7 @@ fn define() -> Bar { type Foo2 = impl Debug; -fn define2() { +fn define2(_: Foo2) { let x = || -> Foo2 { 42 }; } @@ -21,13 +20,13 @@ type Foo3 = impl Debug; fn define3(x: Foo3) { let y: i32 = x; } -fn define3_1() { +fn define3_1(_: Foo3) { define3(42) } type Foo4 = impl Debug; -fn define4() { +fn define4(_: Foo4) { let y: Foo4 = 42; } diff --git a/tests/ui/feature-gates/feature-gate-type_privacy_lints.rs b/tests/ui/feature-gates/feature-gate-type_privacy_lints.rs new file mode 100644 index 00000000000..aad64c9d073 --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-type_privacy_lints.rs @@ -0,0 +1,12 @@ +// check-pass + +#![warn(private_interfaces)] //~ WARN unknown lint + //~| WARN unknown lint + //~| WARN unknown lint +#![warn(private_bounds)] //~ WARN unknown lint + //~| WARN unknown lint + //~| WARN unknown lint +#![warn(unnameable_types)] //~ WARN unknown lint + //~| WARN unknown lint + //~| WARN unknown lint +fn main() {} diff --git a/tests/ui/feature-gates/feature-gate-type_privacy_lints.stderr b/tests/ui/feature-gates/feature-gate-type_privacy_lints.stderr new file mode 100644 index 00000000000..79cc974cca1 --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-type_privacy_lints.stderr @@ -0,0 +1,93 @@ +warning: unknown lint: `private_interfaces` + --> $DIR/feature-gate-type_privacy_lints.rs:3:1 + | +LL | #![warn(private_interfaces)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: the `private_interfaces` lint is unstable + = note: see issue #48054 <https://github.com/rust-lang/rust/issues/48054> for more information + = help: add `#![feature(type_privacy_lints)]` to the crate attributes to enable + = note: `#[warn(unknown_lints)]` on by default + +warning: unknown lint: `private_bounds` + --> $DIR/feature-gate-type_privacy_lints.rs:6:1 + | +LL | #![warn(private_bounds)] + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: the `private_bounds` lint is unstable + = note: see issue #48054 <https://github.com/rust-lang/rust/issues/48054> for more information + = help: add `#![feature(type_privacy_lints)]` to the crate attributes to enable + +warning: unknown lint: `unnameable_types` + --> $DIR/feature-gate-type_privacy_lints.rs:9:1 + | +LL | #![warn(unnameable_types)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: the `unnameable_types` lint is unstable + = note: see issue #48054 <https://github.com/rust-lang/rust/issues/48054> for more information + = help: add `#![feature(type_privacy_lints)]` to the crate attributes to enable + +warning: unknown lint: `private_interfaces` + --> $DIR/feature-gate-type_privacy_lints.rs:3:1 + | +LL | #![warn(private_interfaces)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: the `private_interfaces` lint is unstable + = note: see issue #48054 <https://github.com/rust-lang/rust/issues/48054> for more information + = help: add `#![feature(type_privacy_lints)]` to the crate attributes to enable + +warning: unknown lint: `private_bounds` + --> $DIR/feature-gate-type_privacy_lints.rs:6:1 + | +LL | #![warn(private_bounds)] + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: the `private_bounds` lint is unstable + = note: see issue #48054 <https://github.com/rust-lang/rust/issues/48054> for more information + = help: add `#![feature(type_privacy_lints)]` to the crate attributes to enable + +warning: unknown lint: `unnameable_types` + --> $DIR/feature-gate-type_privacy_lints.rs:9:1 + | +LL | #![warn(unnameable_types)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: the `unnameable_types` lint is unstable + = note: see issue #48054 <https://github.com/rust-lang/rust/issues/48054> for more information + = help: add `#![feature(type_privacy_lints)]` to the crate attributes to enable + +warning: unknown lint: `private_interfaces` + --> $DIR/feature-gate-type_privacy_lints.rs:3:1 + | +LL | #![warn(private_interfaces)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: the `private_interfaces` lint is unstable + = note: see issue #48054 <https://github.com/rust-lang/rust/issues/48054> for more information + = help: add `#![feature(type_privacy_lints)]` to the crate attributes to enable + +warning: unknown lint: `private_bounds` + --> $DIR/feature-gate-type_privacy_lints.rs:6:1 + | +LL | #![warn(private_bounds)] + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: the `private_bounds` lint is unstable + = note: see issue #48054 <https://github.com/rust-lang/rust/issues/48054> for more information + = help: add `#![feature(type_privacy_lints)]` to the crate attributes to enable + +warning: unknown lint: `unnameable_types` + --> $DIR/feature-gate-type_privacy_lints.rs:9:1 + | +LL | #![warn(unnameable_types)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: the `unnameable_types` lint is unstable + = note: see issue #48054 <https://github.com/rust-lang/rust/issues/48054> for more information + = help: add `#![feature(type_privacy_lints)]` to the crate attributes to enable + +warning: 9 warnings emitted + diff --git a/tests/ui/for/issue-20605.next.stderr b/tests/ui/for/issue-20605.next.stderr index a96a53ca93e..d55efedfcbe 100644 --- a/tests/ui/for/issue-20605.next.stderr +++ b/tests/ui/for/issue-20605.next.stderr @@ -20,6 +20,53 @@ error: the type `<dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter` is LL | for item in *things { *item = 0 } | ^^^^^^^ -error: aborting due to 3 previous errors +error[E0277]: `<dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter` is not an iterator + --> $DIR/issue-20605.rs:5:17 + | +LL | for item in *things { *item = 0 } + | ^^^^^^^ `<dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter` is not an iterator + | + = help: the trait `Iterator` is not implemented for `<dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter` + +error: the type `&mut <dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter` is not well-formed + --> $DIR/issue-20605.rs:5:17 + | +LL | for item in *things { *item = 0 } + | ^^^^^^^ + +error[E0614]: type `<<dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter as Iterator>::Item` cannot be dereferenced + --> $DIR/issue-20605.rs:5:27 + | +LL | for item in *things { *item = 0 } + | ^^^^^ + +error[E0277]: the size for values of type `<<dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter as Iterator>::Item` cannot be known at compilation time + --> $DIR/issue-20605.rs:5:9 + | +LL | for item in *things { *item = 0 } + | ^^^^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `<<dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter as Iterator>::Item` + = note: all local variables must have a statically known size + = help: unsized locals are gated as an unstable feature + +error: the type `Option<<<dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter as Iterator>::Item>` is not well-formed + --> $DIR/issue-20605.rs:5:17 + | +LL | for item in *things { *item = 0 } + | ^^^^^^^ + +error[E0277]: the size for values of type `<<dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter as Iterator>::Item` cannot be known at compilation time + --> $DIR/issue-20605.rs:5:5 + | +LL | for item in *things { *item = 0 } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `<<dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter as Iterator>::Item` +note: required by a bound in `None` + --> $SRC_DIR/core/src/option.rs:LL:COL + +error: aborting due to 9 previous errors -For more information about this error, try `rustc --explain E0277`. +Some errors have detailed explanations: E0277, E0614. +For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/for/issue-20605.rs b/tests/ui/for/issue-20605.rs index 64156b35705..50d4c3fddb5 100644 --- a/tests/ui/for/issue-20605.rs +++ b/tests/ui/for/issue-20605.rs @@ -3,9 +3,18 @@ fn changer<'a>(mut things: Box<dyn Iterator<Item=&'a mut u8>>) { for item in *things { *item = 0 } - //~^ ERROR the size for values of type - //[next]~^^ ERROR the type `<dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter` is not well-formed - //[next]~| ERROR the trait bound `dyn Iterator<Item = &'a mut u8>: IntoIterator` is not satisfied + //[current]~^ ERROR the size for values of type + //[next]~^^ ERROR the trait bound `dyn Iterator<Item = &'a mut u8>: IntoIterator` is not satisfied + //[next]~| ERROR the size for values of type `<dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter` cannot be known at compilation time + //[next]~| ERROR the type `<dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter` is not well-formed + //[next]~| ERROR `<dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter` is not an iterator + //[next]~| ERROR the type `&mut <dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter` is not well-formed + //[next]~| ERROR the size for values of type `<<dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter as Iterator>::Item` cannot be known at compilation time + //[next]~| ERROR the type `Option<<<dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter as Iterator>::Item>` is not well-formed + //[next]~| ERROR the size for values of type `<<dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter as Iterator>::Item` cannot be known at compilation time + //[next]~| ERROR type `<<dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter as Iterator>::Item` cannot be dereferenced + // FIXME(-Ztrait-solver=next): these error messages are horrible and have to be + // improved before we stabilize the new solver. } fn main() {} diff --git a/tests/ui/generator/layout-error.rs b/tests/ui/generator/layout-error.rs index 7c3d187409a..44cfc1d70dd 100644 --- a/tests/ui/generator/layout-error.rs +++ b/tests/ui/generator/layout-error.rs @@ -24,5 +24,6 @@ fn main() { type F = impl Future; // Check that statics are inhabited computes they layout. static POOL: Task<F> = Task::new(); + //~^ ERROR: cannot check whether the hidden type of `layout_error[b009]::main::F::{opaque#0}` satisfies auto traits Task::spawn(&POOL, || cb()); } diff --git a/tests/ui/generator/layout-error.stderr b/tests/ui/generator/layout-error.stderr index b1a258f4f2c..ea3b25551c4 100644 --- a/tests/ui/generator/layout-error.stderr +++ b/tests/ui/generator/layout-error.stderr @@ -4,6 +4,24 @@ error[E0425]: cannot find value `Foo` in this scope LL | let a = Foo; | ^^^ not found in this scope -error: aborting due to previous error +error: cannot check whether the hidden type of `layout_error[b009]::main::F::{opaque#0}` satisfies auto traits + --> $DIR/layout-error.rs:26:18 + | +LL | static POOL: Task<F> = Task::new(); + | ^^^^^^^ + | +note: opaque type is declared here + --> $DIR/layout-error.rs:24:14 + | +LL | type F = impl Future; + | ^^^^^^^^^^^ +note: required because it appears within the type `Task<F>` + --> $DIR/layout-error.rs:9:12 + | +LL | pub struct Task<F: Future>(F); + | ^^^^ + = note: shared static variables must have a type that implements `Sync` + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0425`. diff --git a/tests/ui/generic-associated-types/gat-bounds-not-checked-with-right-substitutions.rs b/tests/ui/generic-associated-types/gat-bounds-not-checked-with-right-substitutions.rs new file mode 100644 index 00000000000..05d205266b4 --- /dev/null +++ b/tests/ui/generic-associated-types/gat-bounds-not-checked-with-right-substitutions.rs @@ -0,0 +1,29 @@ +// This test checks that we correctly reject the following unsound code. + +trait Lengthen<T> { + fn lengthen(self) -> T; +} + +impl<'a> Lengthen<&'a str> for &'a str { + fn lengthen(self) -> &'a str { self } +} + +trait Gat { + type Gat<'a>: for<'b> Lengthen<Self::Gat<'b>>; + + fn lengthen(s: Self::Gat<'_>) -> Self::Gat<'static> { + s.lengthen() + } +} + +impl Gat for () { + type Gat<'a> = &'a str; //~ ERROR: implementation of `Lengthen` is not general enough +} + +fn main() { + let s = "hello, garbage".to_string(); + let borrow: &'static str = <() as Gat>::lengthen(&s); + drop(s); + + println!("{borrow}"); +} diff --git a/tests/ui/generic-associated-types/gat-bounds-not-checked-with-right-substitutions.stderr b/tests/ui/generic-associated-types/gat-bounds-not-checked-with-right-substitutions.stderr new file mode 100644 index 00000000000..7ea7a7b2de7 --- /dev/null +++ b/tests/ui/generic-associated-types/gat-bounds-not-checked-with-right-substitutions.stderr @@ -0,0 +1,11 @@ +error: implementation of `Lengthen` is not general enough + --> $DIR/gat-bounds-not-checked-with-right-substitutions.rs:20:20 + | +LL | type Gat<'a> = &'a str; + | ^^^^^^^ implementation of `Lengthen` is not general enough + | + = note: `Lengthen<&'0 str>` would have to be implemented for the type `&'a str`, for any lifetime `'0`... + = note: ...but `Lengthen<&'1 str>` is actually implemented for the type `&'1 str`, for some specific lifetime `'1` + +error: aborting due to previous error + diff --git a/tests/ui/generic-associated-types/issue-90014-tait.rs b/tests/ui/generic-associated-types/issue-90014-tait.rs new file mode 100644 index 00000000000..bc3a4e12965 --- /dev/null +++ b/tests/ui/generic-associated-types/issue-90014-tait.rs @@ -0,0 +1,23 @@ +//! This test is reporting the wrong error. We need +//! more inherent associated type tests that use opaque types +//! in general. Some variant of this test should compile successfully. +// known-bug: unknown +// edition:2018 + +#![feature(impl_trait_in_assoc_type, inherent_associated_types)] +#![allow(incomplete_features)] + +use std::future::Future; + +struct Foo<'a>(&'a mut ()); + +impl Foo<'_> { + type Fut<'a> = impl Future<Output = ()>; + //^ ERROR: the type `&mut ()` does not fulfill the required lifetime + + fn make_fut<'a>(&'a self) -> Self::Fut<'a> { + async { () } + } +} + +fn main() {} diff --git a/tests/ui/generic-associated-types/issue-90014-tait.stderr b/tests/ui/generic-associated-types/issue-90014-tait.stderr new file mode 100644 index 00000000000..8330a387ecd --- /dev/null +++ b/tests/ui/generic-associated-types/issue-90014-tait.stderr @@ -0,0 +1,22 @@ +error[E0308]: mismatched types + --> $DIR/issue-90014-tait.rs:19:9 + | +LL | type Fut<'a> = impl Future<Output = ()>; + | ------------------------ the expected future +... +LL | fn make_fut<'a>(&'a self) -> Self::Fut<'a> { + | ------------- expected `Foo<'_>::Fut<'a>` because of return type +LL | async { () } + | ^^^^^^^^^^^^ expected future, found `async` block + | + = note: expected opaque type `Foo<'_>::Fut<'a>` + found `async` block `[async block@$DIR/issue-90014-tait.rs:19:9: 19:21]` +note: this item must have the opaque type in its signature in order to be able to register hidden types + --> $DIR/issue-90014-tait.rs:18:8 + | +LL | fn make_fut<'a>(&'a self) -> Self::Fut<'a> { + | ^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/chalkify/bugs/async.rs b/tests/ui/generic-associated-types/issue-90014-tait2.rs index a1ef4732b63..dacbc93dec8 100644 --- a/tests/ui/chalkify/bugs/async.rs +++ b/tests/ui/generic-associated-types/issue-90014-tait2.rs @@ -1,9 +1,10 @@ -// edition:2021 -// known-bug: unknown -// unset-rustc-env:RUST_BACKTRACE -// compile-flags:-Z trait-solver=chalk +//! This test checks that opaque type collection doesn't try to normalize the projection +//! without respecting its binders (which would ICE). +//! Unfortunately we don't even reach opaque type collection, as we ICE in typeck before that. +// known-bug: #109281 +// failure-status: 101 // error-pattern:internal compiler error -// failure-status:101 +// normalize-stderr-test "internal compiler error.*" -> "" // normalize-stderr-test "DefId\([^)]*\)" -> "..." // normalize-stderr-test "\nerror: internal compiler error.*\n\n" -> "" // normalize-stderr-test "note:.*unexpectedly panicked.*\n\n" -> "" @@ -17,9 +18,29 @@ // normalize-stderr-test ".*note: Some details.*\n" -> "" // normalize-stderr-test "\n\n[ ]*\n" -> "" // normalize-stderr-test "compiler/.*: projection" -> "projection" +// edition:2018 -fn main() -> () {} +#![feature(type_alias_impl_trait)] +#![allow(incomplete_features)] -async fn foo(x: u32) -> u32 { - x +use std::future::Future; + +struct Foo<'a>(&'a mut ()); + +type Fut<'a> = impl Future<Output = ()>; + +trait Trait<'x> { + type Thing; +} + +impl<'x, T: 'x> Trait<'x> for (T,) { + type Thing = T; +} + +impl Foo<'_> { + fn make_fut(&self) -> Box<dyn for<'a> Trait<'a, Thing = Fut<'a>>> { + Box::new((async { () },)) + } } + +fn main() {} diff --git a/tests/ui/generic-associated-types/issue-90014-tait2.stderr b/tests/ui/generic-associated-types/issue-90014-tait2.stderr new file mode 100644 index 00000000000..3187be3334c --- /dev/null +++ b/tests/ui/generic-associated-types/issue-90014-tait2.stderr @@ -0,0 +1,12 @@ +error: + --> $DIR/issue-90014-tait2.rs:41:27 + | +LL | fn make_fut(&self) -> Box<dyn for<'a> Trait<'a, Thing = Fut<'a>>> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^query stack during panic: +#0 [typeck] type-checking `<impl at $DIR/issue-90014-tait2.rs:40:1: 40:13>::make_fut` +#1 [type_of] computing type of `Fut::{opaque#0}` +#2 [check_mod_item_types] checking item types in top-level module +#3 [analysis] running analysis passes on this crate +end of query stack +error: aborting due to previous error + diff --git a/tests/ui/generics/issue-65285-incorrect-explicit-lifetime-name-needed.stderr b/tests/ui/generics/issue-65285-incorrect-explicit-lifetime-name-needed.stderr index faf4c9eb872..bcd1fbc55ed 100644 --- a/tests/ui/generics/issue-65285-incorrect-explicit-lifetime-name-needed.stderr +++ b/tests/ui/generics/issue-65285-incorrect-explicit-lifetime-name-needed.stderr @@ -4,11 +4,10 @@ error[E0637]: `&` without an explicit lifetime name cannot be used here LL | fn should_error<T>() where T : Into<&u32> {} | ^ explicit lifetime name needed here | -help: consider introducing a higher-ranked lifetime here with `for<'a>` - --> $DIR/issue-65285-incorrect-explicit-lifetime-name-needed.rs:5:32 +help: consider introducing a higher-ranked lifetime here | -LL | fn should_error<T>() where T : Into<&u32> {} - | ^ +LL | fn should_error<T>() where T : for<'a> Into<&'a u32> {} + | +++++++ ++ error[E0106]: missing lifetime specifier --> $DIR/issue-65285-incorrect-explicit-lifetime-name-needed.rs:9:20 diff --git a/tests/ui/hashmap/hashmap-memory.rs b/tests/ui/hashmap/hashmap-memory.rs index 87f8b6ad573..bd364b349e2 100644 --- a/tests/ui/hashmap/hashmap-memory.rs +++ b/tests/ui/hashmap/hashmap-memory.rs @@ -1,5 +1,6 @@ // run-pass +#![allow(improper_ctypes_definitions)] #![allow(non_camel_case_types)] #![allow(dead_code)] #![allow(unused_mut)] diff --git a/tests/ui/impl-trait/auto-trait-leak.rs b/tests/ui/impl-trait/auto-trait-leak.rs index c2fbbf94fd6..d71c0987935 100644 --- a/tests/ui/impl-trait/auto-trait-leak.rs +++ b/tests/ui/impl-trait/auto-trait-leak.rs @@ -3,21 +3,23 @@ use std::rc::Rc; fn send<T: Send>(_: T) {} -fn main() { -} +fn main() {} // Cycles should work as the deferred obligations are // independently resolved and only require the concrete // return type, which can't depend on the obligation. fn cycle1() -> impl Clone { //~^ ERROR cycle detected + //~| ERROR cycle detected send(cycle2().clone()); + //~^ ERROR: cannot check whether the hidden type of opaque type satisfies auto traits Rc::new(Cell::new(5)) } fn cycle2() -> impl Clone { send(cycle1().clone()); + //~^ ERROR: cannot check whether the hidden type of opaque type satisfies auto traits Rc::new(String::from("foo")) } diff --git a/tests/ui/impl-trait/auto-trait-leak.stderr b/tests/ui/impl-trait/auto-trait-leak.stderr index c0c4cd5013e..92a9763bc9b 100644 --- a/tests/ui/impl-trait/auto-trait-leak.stderr +++ b/tests/ui/impl-trait/auto-trait-leak.stderr @@ -1,5 +1,5 @@ error[E0391]: cycle detected when computing type of `cycle1::{opaque#0}` - --> $DIR/auto-trait-leak.rs:12:16 + --> $DIR/auto-trait-leak.rs:11:16 | LL | fn cycle1() -> impl Clone { | ^^^^^^^^^^ @@ -11,12 +11,12 @@ LL | send(cycle2().clone()); | ^^^^ = note: ...which requires evaluating trait selection obligation `cycle2::{opaque#0}: core::marker::Send`... note: ...which requires computing type of `cycle2::{opaque#0}`... - --> $DIR/auto-trait-leak.rs:19:16 + --> $DIR/auto-trait-leak.rs:20:16 | LL | fn cycle2() -> impl Clone { | ^^^^^^^^^^ note: ...which requires type-checking `cycle2`... - --> $DIR/auto-trait-leak.rs:20:5 + --> $DIR/auto-trait-leak.rs:21:5 | LL | send(cycle1().clone()); | ^^^^ @@ -34,6 +34,89 @@ LL | | Rc::new(String::from("foo")) LL | | } | |_^ -error: aborting due to previous error +error[E0391]: cycle detected when computing type of `cycle1::{opaque#0}` + --> $DIR/auto-trait-leak.rs:11:16 + | +LL | fn cycle1() -> impl Clone { + | ^^^^^^^^^^ + | +note: ...which requires type-checking `cycle1`... + --> $DIR/auto-trait-leak.rs:14:5 + | +LL | send(cycle2().clone()); + | ^^^^ + = note: ...which requires evaluating trait selection obligation `cycle2::{opaque#0}: core::marker::Send`... +note: ...which requires computing type of `cycle2::{opaque#0}`... + --> $DIR/auto-trait-leak.rs:20:16 + | +LL | fn cycle2() -> impl Clone { + | ^^^^^^^^^^ +note: ...which requires type-checking `cycle2`... + --> $DIR/auto-trait-leak.rs:20:1 + | +LL | fn cycle2() -> impl Clone { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: ...which again requires computing type of `cycle1::{opaque#0}`, completing the cycle +note: cycle used when checking item types in top-level module + --> $DIR/auto-trait-leak.rs:1:1 + | +LL | / use std::cell::Cell; +LL | | use std::rc::Rc; +LL | | +LL | | fn send<T: Send>(_: T) {} +... | +LL | | Rc::new(String::from("foo")) +LL | | } + | |_^ + +error: cannot check whether the hidden type of opaque type satisfies auto traits + --> $DIR/auto-trait-leak.rs:21:10 + | +LL | send(cycle1().clone()); + | ---- ^^^^^^^^^^^^^^^^ + | | + | required by a bound introduced by this call + | +note: opaque type is declared here + --> $DIR/auto-trait-leak.rs:11:16 + | +LL | fn cycle1() -> impl Clone { + | ^^^^^^^^^^ +note: this item depends on auto traits of the hidden type, but may also be registering the hidden type. This is not supported right now. You can try moving the opaque type and the item that actually registers a hidden type into a new submodule + --> $DIR/auto-trait-leak.rs:20:4 + | +LL | fn cycle2() -> impl Clone { + | ^^^^^^ +note: required by a bound in `send` + --> $DIR/auto-trait-leak.rs:4:12 + | +LL | fn send<T: Send>(_: T) {} + | ^^^^ required by this bound in `send` + +error: cannot check whether the hidden type of opaque type satisfies auto traits + --> $DIR/auto-trait-leak.rs:14:10 + | +LL | send(cycle2().clone()); + | ---- ^^^^^^^^^^^^^^^^ + | | + | required by a bound introduced by this call + | +note: opaque type is declared here + --> $DIR/auto-trait-leak.rs:20:16 + | +LL | fn cycle2() -> impl Clone { + | ^^^^^^^^^^ +note: this item depends on auto traits of the hidden type, but may also be registering the hidden type. This is not supported right now. You can try moving the opaque type and the item that actually registers a hidden type into a new submodule + --> $DIR/auto-trait-leak.rs:11:4 + | +LL | fn cycle1() -> impl Clone { + | ^^^^^^ +note: required by a bound in `send` + --> $DIR/auto-trait-leak.rs:4:12 + | +LL | fn send<T: Send>(_: T) {} + | ^^^^ required by this bound in `send` + +error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0391`. diff --git a/tests/ui/impl-trait/deduce-signature-from-supertrait.rs b/tests/ui/impl-trait/deduce-signature-from-supertrait.rs index d2c34792035..7a51aac44e2 100644 --- a/tests/ui/impl-trait/deduce-signature-from-supertrait.rs +++ b/tests/ui/impl-trait/deduce-signature-from-supertrait.rs @@ -8,8 +8,10 @@ impl<T: Fn(i32)> SuperExpectation for T {} type Foo = impl SuperExpectation; -fn main() { +fn bop(_: Foo) { let _: Foo = |x| { let _ = x.to_string(); }; } + +fn main() {} diff --git a/tests/ui/impl-trait/in-assoc-type.rs b/tests/ui/impl-trait/in-assoc-type.rs index 36c54bdd6de..38ad2fa6f02 100644 --- a/tests/ui/impl-trait/in-assoc-type.rs +++ b/tests/ui/impl-trait/in-assoc-type.rs @@ -1,3 +1,6 @@ +//! This test checks that we don't allow registering hidden types for +//! opaque types from other impls. + #![feature(impl_trait_in_assoc_type)] trait Foo<T> { diff --git a/tests/ui/impl-trait/in-assoc-type.stderr b/tests/ui/impl-trait/in-assoc-type.stderr index ab3f3a14410..af60da07cac 100644 --- a/tests/ui/impl-trait/in-assoc-type.stderr +++ b/tests/ui/impl-trait/in-assoc-type.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/in-assoc-type.rs:17:22 + --> $DIR/in-assoc-type.rs:20:22 | LL | type Bar = impl std::fmt::Debug; | -------------------- the expected opaque type @@ -12,7 +12,7 @@ LL | fn foo(&self) -> <Self as Foo<()>>::Bar {} = note: expected opaque type `<() as Foo<()>>::Bar` found unit type `()` note: this item must have the opaque type in its signature in order to be able to register hidden types - --> $DIR/in-assoc-type.rs:17:8 + --> $DIR/in-assoc-type.rs:20:8 | LL | fn foo(&self) -> <Self as Foo<()>>::Bar {} | ^^^ diff --git a/tests/ui/impl-trait/in-trait/foreign.rs b/tests/ui/impl-trait/in-trait/foreign.rs index 98417b343a1..b0fbe3a3d4a 100644 --- a/tests/ui/impl-trait/in-trait/foreign.rs +++ b/tests/ui/impl-trait/in-trait/foreign.rs @@ -14,6 +14,10 @@ impl Foo for Local { fn bar(self) -> Arc<String> { Arc::new(String::new()) } } +fn generic(f: impl Foo) { + let x = &*f.bar(); +} + fn main() { // Witness an RPITIT from another crate. let &() = Foreign.bar(); diff --git a/tests/ui/impl-trait/in-trait/issue-102140.next.stderr b/tests/ui/impl-trait/in-trait/issue-102140.next.stderr index 7aa7880e258..94893c9e7b4 100644 --- a/tests/ui/impl-trait/in-trait/issue-102140.next.stderr +++ b/tests/ui/impl-trait/in-trait/issue-102140.next.stderr @@ -6,11 +6,7 @@ LL | MyTrait::foo(&self) | | | required by a bound introduced by this call | -help: consider removing the leading `&`-reference - | -LL - MyTrait::foo(&self) -LL + MyTrait::foo(self) - | + = help: the trait `MyTrait` is implemented for `Outer` error[E0277]: the trait bound `&dyn MyTrait: MyTrait` is not satisfied --> $DIR/issue-102140.rs:26:9 diff --git a/tests/ui/impl-trait/in-trait/method-signature-matches.lt.stderr b/tests/ui/impl-trait/in-trait/method-signature-matches.lt.stderr index f604ada6ac7..239c4b35c72 100644 --- a/tests/ui/impl-trait/in-trait/method-signature-matches.lt.stderr +++ b/tests/ui/impl-trait/in-trait/method-signature-matches.lt.stderr @@ -5,7 +5,7 @@ LL | fn early<'late, T>(_: &'late ()) {} | - ^^^^^^^^^ | | | | | expected type parameter `T`, found `()` - | | help: change the parameter type to match the trait: `&'early T` + | | help: change the parameter type to match the trait: `&T` | this type parameter | note: type in trait @@ -13,8 +13,8 @@ note: type in trait | LL | fn early<'early, T>(x: &'early T) -> impl Sized; | ^^^^^^^^^ - = note: expected signature `fn(&'early T)` - found signature `fn(&())` + = note: expected signature `fn(&T)` + found signature `fn(&'late ())` error: aborting due to previous error diff --git a/tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.current.stderr b/tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.current.stderr new file mode 100644 index 00000000000..ff30103b771 --- /dev/null +++ b/tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.current.stderr @@ -0,0 +1,16 @@ +error[E0277]: the trait bound `impl Foo<u8>: Foo<char>` is not satisfied + --> $DIR/return-dont-satisfy-bounds.rs:13:34 + | +LL | fn foo<F2: Foo<u8>>(self) -> impl Foo<u8> { + | ^^^^^^^^^^^^ the trait `Foo<char>` is not implemented for `impl Foo<u8>` + | + = help: the trait `Foo<char>` is implemented for `Bar` +note: required by a bound in `Foo::foo::{opaque#0}` + --> $DIR/return-dont-satisfy-bounds.rs:7:30 + | +LL | fn foo<F2>(self) -> impl Foo<T>; + | ^^^^^^ required by this bound in `Foo::foo::{opaque#0}` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.next.stderr b/tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.next.stderr new file mode 100644 index 00000000000..7c7f7feaa55 --- /dev/null +++ b/tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.next.stderr @@ -0,0 +1,16 @@ +error[E0277]: the trait bound `impl Foo<u8>: Foo<char>` is not satisfied + --> $DIR/return-dont-satisfy-bounds.rs:13:34 + | +LL | fn foo<F2: Foo<u8>>(self) -> impl Foo<u8> { + | ^^^^^^^^^^^^ the trait `Foo<char>` is not implemented for `impl Foo<u8>` + | + = help: the trait `Foo<char>` is implemented for `Bar` +note: required by a bound in `Foo::{opaque#0}` + --> $DIR/return-dont-satisfy-bounds.rs:7:30 + | +LL | fn foo<F2>(self) -> impl Foo<T>; + | ^^^^^^ required by this bound in `Foo::{opaque#0}` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.rs b/tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.rs new file mode 100644 index 00000000000..65528f212e2 --- /dev/null +++ b/tests/ui/impl-trait/in-trait/return-dont-satisfy-bounds.rs @@ -0,0 +1,19 @@ +// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty +// revisions: current next + +#![feature(return_position_impl_trait_in_trait)] + +trait Foo<T> { + fn foo<F2>(self) -> impl Foo<T>; +} + +struct Bar; + +impl Foo<char> for Bar { + fn foo<F2: Foo<u8>>(self) -> impl Foo<u8> { + //~^ ERROR: the trait bound `impl Foo<u8>: Foo<char>` is not satisfied [E0277] + self + } +} + +fn main() {} diff --git a/tests/ui/impl-trait/in-trait/signature-mismatch.current.stderr b/tests/ui/impl-trait/in-trait/signature-mismatch.current.stderr index eba270af7f0..8c9dd403174 100644 --- a/tests/ui/impl-trait/in-trait/signature-mismatch.current.stderr +++ b/tests/ui/impl-trait/in-trait/signature-mismatch.current.stderr @@ -1,16 +1,61 @@ -error: `impl` item signature doesn't match `trait` item signature - --> $DIR/signature-mismatch.rs:17:5 +error: return type captures more lifetimes than trait definition + --> $DIR/signature-mismatch.rs:36:47 + | +LL | fn async_fn<'a>(&self, buff: &'a [u8]) -> impl Future<Output = Vec<u8>> + 'a { + | -- this lifetime was captured ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: hidden type must only reference lifetimes captured by this impl trait + --> $DIR/signature-mismatch.rs:17:40 | LL | fn async_fn(&self, buff: &[u8]) -> impl Future<Output = Vec<u8>>; - | ----------------------------------------------------------------- expected `fn(&'1 Struct, &'2 [u8]) -> impl Future<Output = Vec<u8>> + '3` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: hidden type inferred to be `impl Future<Output = Vec<u8>> + 'a` + +error: return type captures more lifetimes than trait definition + --> $DIR/signature-mismatch.rs:41:57 + | +LL | fn async_fn_early<'a: 'a>(&self, buff: &'a [u8]) -> impl Future<Output = Vec<u8>> + 'a { + | -- this lifetime was captured ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: hidden type must only reference lifetimes captured by this impl trait + --> $DIR/signature-mismatch.rs:18:57 + | +LL | fn async_fn_early<'a: 'a>(&self, buff: &'a [u8]) -> impl Future<Output = Vec<u8>>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: hidden type inferred to be `impl Future<Output = Vec<u8>> + 'a` + +error: return type captures more lifetimes than trait definition + --> $DIR/signature-mismatch.rs:49:10 + | +LL | fn async_fn_multiple<'a, 'b>( + | -- this lifetime was captured ... -LL | fn async_fn<'a>(&self, buff: &'a [u8]) -> impl Future<Output = Vec<u8>> + 'a { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(&'1 Struct, &'2 [u8]) -> impl Future<Output = Vec<u8>> + '2` +LL | ) -> impl Future<Output = Vec<u8>> + Captures2<'a, 'b> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: hidden type must only reference lifetimes captured by this impl trait + --> $DIR/signature-mismatch.rs:20:12 + | +LL | -> impl Future<Output = Vec<u8>> + Captures<'a>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: hidden type inferred to be `impl Future<Output = Vec<u8>> + Captures2<'a, 'b>` + +error[E0309]: the parameter type `T` may not live long enough + --> $DIR/signature-mismatch.rs:58:10 + | +LL | ) -> impl Future<Output = Vec<u8>> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `impl Future<Output = Vec<u8>>` will meet its required lifetime bounds... + | +note: ...that is required by this bound + --> $DIR/signature-mismatch.rs:25:42 + | +LL | ) -> impl Future<Output = Vec<u8>> + 'a; + | ^^ +help: consider adding an explicit lifetime bound... | - = note: expected signature `fn(&'1 Struct, &'2 [u8]) -> impl Future<Output = Vec<u8>> + '3` - found signature `fn(&'1 Struct, &'2 [u8]) -> impl Future<Output = Vec<u8>> + '2` - = help: the lifetime requirements from the `impl` do not correspond to the requirements in the `trait` - = help: verify the lifetime relationships in the `trait` and `impl` between the `self` argument, the other inputs and its output +LL | fn async_fn_reduce_outlive<'a, 'b, T: 'a>( + | ++++ -error: aborting due to previous error +error: aborting due to 4 previous errors +For more information about this error, try `rustc --explain E0309`. diff --git a/tests/ui/impl-trait/in-trait/signature-mismatch.next.stderr b/tests/ui/impl-trait/in-trait/signature-mismatch.next.stderr index eba270af7f0..8c9dd403174 100644 --- a/tests/ui/impl-trait/in-trait/signature-mismatch.next.stderr +++ b/tests/ui/impl-trait/in-trait/signature-mismatch.next.stderr @@ -1,16 +1,61 @@ -error: `impl` item signature doesn't match `trait` item signature - --> $DIR/signature-mismatch.rs:17:5 +error: return type captures more lifetimes than trait definition + --> $DIR/signature-mismatch.rs:36:47 + | +LL | fn async_fn<'a>(&self, buff: &'a [u8]) -> impl Future<Output = Vec<u8>> + 'a { + | -- this lifetime was captured ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: hidden type must only reference lifetimes captured by this impl trait + --> $DIR/signature-mismatch.rs:17:40 | LL | fn async_fn(&self, buff: &[u8]) -> impl Future<Output = Vec<u8>>; - | ----------------------------------------------------------------- expected `fn(&'1 Struct, &'2 [u8]) -> impl Future<Output = Vec<u8>> + '3` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: hidden type inferred to be `impl Future<Output = Vec<u8>> + 'a` + +error: return type captures more lifetimes than trait definition + --> $DIR/signature-mismatch.rs:41:57 + | +LL | fn async_fn_early<'a: 'a>(&self, buff: &'a [u8]) -> impl Future<Output = Vec<u8>> + 'a { + | -- this lifetime was captured ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: hidden type must only reference lifetimes captured by this impl trait + --> $DIR/signature-mismatch.rs:18:57 + | +LL | fn async_fn_early<'a: 'a>(&self, buff: &'a [u8]) -> impl Future<Output = Vec<u8>>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: hidden type inferred to be `impl Future<Output = Vec<u8>> + 'a` + +error: return type captures more lifetimes than trait definition + --> $DIR/signature-mismatch.rs:49:10 + | +LL | fn async_fn_multiple<'a, 'b>( + | -- this lifetime was captured ... -LL | fn async_fn<'a>(&self, buff: &'a [u8]) -> impl Future<Output = Vec<u8>> + 'a { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(&'1 Struct, &'2 [u8]) -> impl Future<Output = Vec<u8>> + '2` +LL | ) -> impl Future<Output = Vec<u8>> + Captures2<'a, 'b> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: hidden type must only reference lifetimes captured by this impl trait + --> $DIR/signature-mismatch.rs:20:12 + | +LL | -> impl Future<Output = Vec<u8>> + Captures<'a>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: hidden type inferred to be `impl Future<Output = Vec<u8>> + Captures2<'a, 'b>` + +error[E0309]: the parameter type `T` may not live long enough + --> $DIR/signature-mismatch.rs:58:10 + | +LL | ) -> impl Future<Output = Vec<u8>> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `impl Future<Output = Vec<u8>>` will meet its required lifetime bounds... + | +note: ...that is required by this bound + --> $DIR/signature-mismatch.rs:25:42 + | +LL | ) -> impl Future<Output = Vec<u8>> + 'a; + | ^^ +help: consider adding an explicit lifetime bound... | - = note: expected signature `fn(&'1 Struct, &'2 [u8]) -> impl Future<Output = Vec<u8>> + '3` - found signature `fn(&'1 Struct, &'2 [u8]) -> impl Future<Output = Vec<u8>> + '2` - = help: the lifetime requirements from the `impl` do not correspond to the requirements in the `trait` - = help: verify the lifetime relationships in the `trait` and `impl` between the `self` argument, the other inputs and its output +LL | fn async_fn_reduce_outlive<'a, 'b, T: 'a>( + | ++++ -error: aborting due to previous error +error: aborting due to 4 previous errors +For more information about this error, try `rustc --explain E0309`. diff --git a/tests/ui/impl-trait/in-trait/signature-mismatch.rs b/tests/ui/impl-trait/in-trait/signature-mismatch.rs index 38c902a97a9..23dd71acecb 100644 --- a/tests/ui/impl-trait/in-trait/signature-mismatch.rs +++ b/tests/ui/impl-trait/in-trait/signature-mismatch.rs @@ -7,17 +7,70 @@ use std::future::Future; +trait Captures<'a> {} +impl<T> Captures<'_> for T {} + +trait Captures2<'a, 'b> {} +impl<T> Captures2<'_, '_> for T {} + pub trait AsyncTrait { fn async_fn(&self, buff: &[u8]) -> impl Future<Output = Vec<u8>>; + fn async_fn_early<'a: 'a>(&self, buff: &'a [u8]) -> impl Future<Output = Vec<u8>>; + fn async_fn_multiple<'a>(&'a self, buff: &[u8]) + -> impl Future<Output = Vec<u8>> + Captures<'a>; + fn async_fn_reduce_outlive<'a, T>( + &'a self, + buff: &[u8], + t: T, + ) -> impl Future<Output = Vec<u8>> + 'a; + fn async_fn_reduce<'a, T>( + &'a self, + buff: &[u8], + t: T, + ) -> impl Future<Output = Vec<u8>> + Captures<'a>; } pub struct Struct; impl AsyncTrait for Struct { fn async_fn<'a>(&self, buff: &'a [u8]) -> impl Future<Output = Vec<u8>> + 'a { - //~^ ERROR `impl` item signature doesn't match `trait` item signature + //~^ ERROR return type captures more lifetimes than trait definition + async move { buff.to_vec() } + } + + fn async_fn_early<'a: 'a>(&self, buff: &'a [u8]) -> impl Future<Output = Vec<u8>> + 'a { + //~^ ERROR return type captures more lifetimes than trait definition + async move { buff.to_vec() } + } + + fn async_fn_multiple<'a, 'b>( + &'a self, + buff: &'b [u8], + ) -> impl Future<Output = Vec<u8>> + Captures2<'a, 'b> { + //~^ ERROR return type captures more lifetimes than trait definition async move { buff.to_vec() } } + + fn async_fn_reduce_outlive<'a, 'b, T>( + &'a self, + buff: &'b [u8], + t: T, + ) -> impl Future<Output = Vec<u8>> { + //~^ ERROR the parameter type `T` may not live long enough + async move { + let _t = t; + vec![] + } + } + + // OK: We remove the `Captures<'a>`, providing a guarantee that we don't capture `'a`, + // but we still fulfill the `Captures<'a>` trait bound. + fn async_fn_reduce<'a, 'b, T>(&'a self, buff: &'b [u8], t: T) -> impl Future<Output = Vec<u8>> { + async move { + let _t = t; + vec![] + } + } } fn main() {} diff --git a/tests/ui/impl-trait/in-trait/variances-of-gat.rs b/tests/ui/impl-trait/in-trait/variances-of-gat.rs new file mode 100644 index 00000000000..4008ece94da --- /dev/null +++ b/tests/ui/impl-trait/in-trait/variances-of-gat.rs @@ -0,0 +1,19 @@ +// check-pass +// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty +// revisions: current next + +#![feature(return_position_impl_trait_in_trait)] + +trait Foo {} + +impl Foo for () {} + +trait ThreeCellFragment { + fn ext_cells<'a>(&'a self) -> impl Foo + 'a { + self.ext_adjacent_cells() + } + + fn ext_adjacent_cells<'a>(&'a self) -> impl Foo + 'a; +} + +fn main() {} diff --git a/tests/ui/impl-trait/in-trait/wf-bounds.current.stderr b/tests/ui/impl-trait/in-trait/wf-bounds.current.stderr index 1a70716123c..74c84c012b1 100644 --- a/tests/ui/impl-trait/in-trait/wf-bounds.current.stderr +++ b/tests/ui/impl-trait/in-trait/wf-bounds.current.stderr @@ -1,5 +1,5 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation time - --> $DIR/wf-bounds.rs:13:22 + --> $DIR/wf-bounds.rs:17:22 | LL | fn nya() -> impl Wf<Vec<[u8]>>; | ^^^^^^^^^^^^^ doesn't have a size known at compile-time @@ -9,14 +9,14 @@ note: required by a bound in `Vec` --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL error[E0277]: the size for values of type `[u8]` cannot be known at compilation time - --> $DIR/wf-bounds.rs:16:23 + --> $DIR/wf-bounds.rs:20:23 | LL | fn nya2() -> impl Wf<[u8]>; | ^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[u8]` note: required by a bound in `Wf` - --> $DIR/wf-bounds.rs:8:10 + --> $DIR/wf-bounds.rs:10:10 | LL | trait Wf<T> { | ^ required by this bound in `Wf` @@ -26,7 +26,7 @@ LL | trait Wf<T: ?Sized> { | ++++++++ error[E0277]: the size for values of type `[u8]` cannot be known at compilation time - --> $DIR/wf-bounds.rs:19:44 + --> $DIR/wf-bounds.rs:23:44 | LL | fn nya3() -> impl Wf<(), Output = impl Wf<Vec<[u8]>>>; | ^^^^^^^^^^^^^ doesn't have a size known at compile-time @@ -35,6 +35,23 @@ LL | fn nya3() -> impl Wf<(), Output = impl Wf<Vec<[u8]>>>; note: required by a bound in `Vec` --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL -error: aborting due to 3 previous errors +error[E0277]: `T` doesn't implement `std::fmt::Display` + --> $DIR/wf-bounds.rs:26:26 + | +LL | fn nya4<T>() -> impl Wf<NeedsDisplay<T>>; + | ^^^^^^^^^^^^^^^^^^^ `T` cannot be formatted with the default formatter + | + = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead +note: required by a bound in `NeedsDisplay` + --> $DIR/wf-bounds.rs:14:24 + | +LL | struct NeedsDisplay<T: Display>(T); + | ^^^^^^^ required by this bound in `NeedsDisplay` +help: consider restricting type parameter `T` + | +LL | fn nya4<T: std::fmt::Display>() -> impl Wf<NeedsDisplay<T>>; + | +++++++++++++++++++ + +error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/impl-trait/in-trait/wf-bounds.next.stderr b/tests/ui/impl-trait/in-trait/wf-bounds.next.stderr index 1a70716123c..74c84c012b1 100644 --- a/tests/ui/impl-trait/in-trait/wf-bounds.next.stderr +++ b/tests/ui/impl-trait/in-trait/wf-bounds.next.stderr @@ -1,5 +1,5 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation time - --> $DIR/wf-bounds.rs:13:22 + --> $DIR/wf-bounds.rs:17:22 | LL | fn nya() -> impl Wf<Vec<[u8]>>; | ^^^^^^^^^^^^^ doesn't have a size known at compile-time @@ -9,14 +9,14 @@ note: required by a bound in `Vec` --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL error[E0277]: the size for values of type `[u8]` cannot be known at compilation time - --> $DIR/wf-bounds.rs:16:23 + --> $DIR/wf-bounds.rs:20:23 | LL | fn nya2() -> impl Wf<[u8]>; | ^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[u8]` note: required by a bound in `Wf` - --> $DIR/wf-bounds.rs:8:10 + --> $DIR/wf-bounds.rs:10:10 | LL | trait Wf<T> { | ^ required by this bound in `Wf` @@ -26,7 +26,7 @@ LL | trait Wf<T: ?Sized> { | ++++++++ error[E0277]: the size for values of type `[u8]` cannot be known at compilation time - --> $DIR/wf-bounds.rs:19:44 + --> $DIR/wf-bounds.rs:23:44 | LL | fn nya3() -> impl Wf<(), Output = impl Wf<Vec<[u8]>>>; | ^^^^^^^^^^^^^ doesn't have a size known at compile-time @@ -35,6 +35,23 @@ LL | fn nya3() -> impl Wf<(), Output = impl Wf<Vec<[u8]>>>; note: required by a bound in `Vec` --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL -error: aborting due to 3 previous errors +error[E0277]: `T` doesn't implement `std::fmt::Display` + --> $DIR/wf-bounds.rs:26:26 + | +LL | fn nya4<T>() -> impl Wf<NeedsDisplay<T>>; + | ^^^^^^^^^^^^^^^^^^^ `T` cannot be formatted with the default formatter + | + = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead +note: required by a bound in `NeedsDisplay` + --> $DIR/wf-bounds.rs:14:24 + | +LL | struct NeedsDisplay<T: Display>(T); + | ^^^^^^^ required by this bound in `NeedsDisplay` +help: consider restricting type parameter `T` + | +LL | fn nya4<T: std::fmt::Display>() -> impl Wf<NeedsDisplay<T>>; + | +++++++++++++++++++ + +error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/impl-trait/in-trait/wf-bounds.rs b/tests/ui/impl-trait/in-trait/wf-bounds.rs index 1c9590bd853..f8c1e561d5c 100644 --- a/tests/ui/impl-trait/in-trait/wf-bounds.rs +++ b/tests/ui/impl-trait/in-trait/wf-bounds.rs @@ -5,10 +5,14 @@ #![feature(return_position_impl_trait_in_trait)] #![allow(incomplete_features)] +use std::fmt::Display; + trait Wf<T> { type Output; } +struct NeedsDisplay<T: Display>(T); + trait Uwu { fn nya() -> impl Wf<Vec<[u8]>>; //~^ ERROR the size for values of type `[u8]` cannot be known at compilation time @@ -18,6 +22,9 @@ trait Uwu { fn nya3() -> impl Wf<(), Output = impl Wf<Vec<[u8]>>>; //~^ ERROR the size for values of type `[u8]` cannot be known at compilation time + + fn nya4<T>() -> impl Wf<NeedsDisplay<T>>; + //~^ ERROR `T` doesn't implement `std::fmt::Display` } fn main() {} diff --git a/tests/ui/impl-trait/issue-103181-2.rs b/tests/ui/impl-trait/issue-103181-2.rs index b43ac45075e..34deb98beef 100644 --- a/tests/ui/impl-trait/issue-103181-2.rs +++ b/tests/ui/impl-trait/issue-103181-2.rs @@ -24,6 +24,8 @@ where B: Send, // <- a second bound { normalize(broken_fut(), ()); + //~^ ERROR: cannot check whether the hidden type of opaque type satisfies auto traits + //~| ERROR: cannot check whether the hidden type of opaque type satisfies auto traits } fn main() {} diff --git a/tests/ui/impl-trait/issue-103181-2.stderr b/tests/ui/impl-trait/issue-103181-2.stderr index 5eb2dd9184b..cb5253ea6cd 100644 --- a/tests/ui/impl-trait/issue-103181-2.stderr +++ b/tests/ui/impl-trait/issue-103181-2.stderr @@ -4,6 +4,61 @@ error[E0425]: cannot find value `ident_error` in this scope LL | ident_error; | ^^^^^^^^^^^ not found in this scope -error: aborting due to previous error +error: cannot check whether the hidden type of opaque type satisfies auto traits + --> $DIR/issue-103181-2.rs:26:15 + | +LL | normalize(broken_fut(), ()); + | --------- ^^^^^^^^^^^^ + | | + | required by a bound introduced by this call + | +note: opaque type is declared here + --> $DIR/issue-103181-2.rs:11:23 + | +LL | async fn broken_fut() { + | ^ +note: this item depends on auto traits of the hidden type, but may also be registering the hidden type. This is not supported right now. You can try moving the opaque type and the item that actually registers a hidden type into a new submodule + --> $DIR/issue-103181-2.rs:20:10 + | +LL | async fn iceice<A, B>() + | ^^^^^^ +note: required for `impl Future<Output = ()>` to implement `SendFuture` + --> $DIR/issue-103181-2.rs:7:17 + | +LL | impl<Fut: Send> SendFuture for Fut { + | ---- ^^^^^^^^^^ ^^^ + | | + | unsatisfied trait bound introduced here +note: required by a bound in `normalize` + --> $DIR/issue-103181-2.rs:18:19 + | +LL | fn normalize<Fut: SendFuture>(_: Fut, _: Fut::Output) {} + | ^^^^^^^^^^ required by this bound in `normalize` + +error: cannot check whether the hidden type of opaque type satisfies auto traits + --> $DIR/issue-103181-2.rs:26:5 + | +LL | normalize(broken_fut(), ()); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: opaque type is declared here + --> $DIR/issue-103181-2.rs:11:23 + | +LL | async fn broken_fut() { + | ^ +note: this item depends on auto traits of the hidden type, but may also be registering the hidden type. This is not supported right now. You can try moving the opaque type and the item that actually registers a hidden type into a new submodule + --> $DIR/issue-103181-2.rs:20:10 + | +LL | async fn iceice<A, B>() + | ^^^^^^ +note: required for `impl Future<Output = ()>` to implement `SendFuture` + --> $DIR/issue-103181-2.rs:7:17 + | +LL | impl<Fut: Send> SendFuture for Fut { + | ---- ^^^^^^^^^^ ^^^ + | | + | unsatisfied trait bound introduced here + +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0425`. diff --git a/tests/ui/impl-trait/issue-55872-3.rs b/tests/ui/impl-trait/issue-55872-3.rs index d031271ac08..7490a130800 100644 --- a/tests/ui/impl-trait/issue-55872-3.rs +++ b/tests/ui/impl-trait/issue-55872-3.rs @@ -1,5 +1,4 @@ // edition:2018 -// ignore-compare-mode-chalk #![feature(impl_trait_in_assoc_type)] diff --git a/tests/ui/impl-trait/issue-55872-3.stderr b/tests/ui/impl-trait/issue-55872-3.stderr index c6e10f0f350..82798897433 100644 --- a/tests/ui/impl-trait/issue-55872-3.stderr +++ b/tests/ui/impl-trait/issue-55872-3.stderr @@ -1,8 +1,8 @@ -error[E0277]: the trait bound `[async block@$DIR/issue-55872-3.rs:16:9: 16:17]: Copy` is not satisfied - --> $DIR/issue-55872-3.rs:14:20 +error[E0277]: the trait bound `[async block@$DIR/issue-55872-3.rs:15:9: 15:17]: Copy` is not satisfied + --> $DIR/issue-55872-3.rs:13:20 | LL | fn foo<T>() -> Self::E { - | ^^^^^^^ the trait `Copy` is not implemented for `[async block@$DIR/issue-55872-3.rs:16:9: 16:17]` + | ^^^^^^^ the trait `Copy` is not implemented for `[async block@$DIR/issue-55872-3.rs:15:9: 15:17]` error: aborting due to previous error diff --git a/tests/ui/impl-trait/issues/issue-65581.rs b/tests/ui/impl-trait/issues/issue-65581.rs index b947fc1d239..af65b79d3e8 100644 --- a/tests/ui/impl-trait/issues/issue-65581.rs +++ b/tests/ui/impl-trait/issues/issue-65581.rs @@ -1,5 +1,4 @@ // check-pass -// ignore-compare-mode-chalk #![allow(dead_code)] diff --git a/tests/ui/impl-trait/issues/issue-70877.rs b/tests/ui/impl-trait/issues/issue-70877.rs index 8169cfafac7..df772298674 100644 --- a/tests/ui/impl-trait/issues/issue-70877.rs +++ b/tests/ui/impl-trait/issues/issue-70877.rs @@ -25,12 +25,12 @@ fn ham() -> Foo { Bar(1) } -fn oof() -> impl std::fmt::Debug { +fn oof(_: Foo) -> impl std::fmt::Debug { let mut bar = ham(); let func = bar.next().unwrap(); return func(&"oof"); //~ ERROR opaque type's hidden type cannot be another opaque type } fn main() { - let _ = oof(); + let _ = oof(ham()); } diff --git a/tests/ui/impl-trait/issues/issue-70877.stderr b/tests/ui/impl-trait/issues/issue-70877.stderr index 8813bff3c35..ee140e6f6c4 100644 --- a/tests/ui/impl-trait/issues/issue-70877.stderr +++ b/tests/ui/impl-trait/issues/issue-70877.stderr @@ -5,10 +5,10 @@ LL | return func(&"oof"); | ^^^^^^^^^^^^ one of the two opaque types used here has to be outside its defining scope | note: opaque type whose hidden type is being assigned - --> $DIR/issue-70877.rs:28:13 + --> $DIR/issue-70877.rs:28:19 | -LL | fn oof() -> impl std::fmt::Debug { - | ^^^^^^^^^^^^^^^^^^^^ +LL | fn oof(_: Foo) -> impl std::fmt::Debug { + | ^^^^^^^^^^^^^^^^^^^^ note: opaque type being used as hidden type --> $DIR/issue-70877.rs:4:15 | diff --git a/tests/ui/impl-trait/issues/issue-74282.rs b/tests/ui/impl-trait/issues/issue-74282.rs index 654de0cd025..51bd5f67ed5 100644 --- a/tests/ui/impl-trait/issues/issue-74282.rs +++ b/tests/ui/impl-trait/issues/issue-74282.rs @@ -3,9 +3,12 @@ type Closure = impl Fn() -> u64; struct Anonymous(Closure); -fn main() { +fn bop(_: Closure) { let y = || -> Closure { || 3 }; - Anonymous(|| { //~ ERROR mismatched types - 3 //~^ ERROR mismatched types + Anonymous(|| { + //~^ ERROR mismatched types + 3 //~^^ ERROR mismatched types }) } + +fn main() {} diff --git a/tests/ui/impl-trait/issues/issue-74282.stderr b/tests/ui/impl-trait/issues/issue-74282.stderr index 724f3c5d674..d43e9fee0b3 100644 --- a/tests/ui/impl-trait/issues/issue-74282.stderr +++ b/tests/ui/impl-trait/issues/issue-74282.stderr @@ -8,6 +8,7 @@ LL | Anonymous(|| { | _____---------_^ | | | | | arguments to this struct are incorrect +LL | | LL | | 3 LL | | }) | |_____^ expected opaque type, found closure @@ -25,15 +26,20 @@ LL | struct Anonymous(Closure); error[E0308]: mismatched types --> $DIR/issue-74282.rs:8:5 | -LL | fn main() { - | - expected `()` because of default return type -LL | let y = || -> Closure { || 3 }; LL | / Anonymous(|| { +LL | | LL | | 3 LL | | }) - | | ^- help: consider using a semicolon here: `;` - | |______| - | expected `()`, found `Anonymous` + | |______^ expected `()`, found `Anonymous` + | +help: consider using a semicolon here + | +LL | }); + | + +help: try adding a return type + | +LL | fn bop(_: Closure) -> Anonymous { + | ++++++++++++ error: aborting due to 2 previous errors diff --git a/tests/ui/impl-trait/issues/issue-78722-2.rs b/tests/ui/impl-trait/issues/issue-78722-2.rs new file mode 100644 index 00000000000..cf5361e1e60 --- /dev/null +++ b/tests/ui/impl-trait/issues/issue-78722-2.rs @@ -0,0 +1,22 @@ +//! test that we cannot register hidden types for opaque types +//! declared outside an anonymous constant. +// edition:2018 + +#![feature(type_alias_impl_trait)] + +type F = impl core::future::Future<Output = u8>; + +struct Bug { + V1: [(); { + fn concrete_use() -> F { + //~^ ERROR future that resolves to `u8`, but it resolves to `()` + async {} + } + let f: F = async { 1 }; + //~^ ERROR item constrains opaque type that is not in its signature + //~| ERROR `async` blocks are not allowed in constants + 1 + }], +} + +fn main() {} diff --git a/tests/ui/impl-trait/issues/issue-78722-2.stderr b/tests/ui/impl-trait/issues/issue-78722-2.stderr new file mode 100644 index 00000000000..6db603e7751 --- /dev/null +++ b/tests/ui/impl-trait/issues/issue-78722-2.stderr @@ -0,0 +1,32 @@ +error[E0658]: `async` blocks are not allowed in constants + --> $DIR/issue-78722-2.rs:15:20 + | +LL | let f: F = async { 1 }; + | ^^^^^^^^^^^ + | + = note: see issue #85368 <https://github.com/rust-lang/rust/issues/85368> for more information + = help: add `#![feature(const_async_blocks)]` to the crate attributes to enable + +error[E0271]: expected `[async block@$DIR/issue-78722-2.rs:13:13: 13:21]` to be a future that resolves to `u8`, but it resolves to `()` + --> $DIR/issue-78722-2.rs:11:30 + | +LL | fn concrete_use() -> F { + | ^ expected `()`, found `u8` + +error: item constrains opaque type that is not in its signature + --> $DIR/issue-78722-2.rs:15:20 + | +LL | let f: F = async { 1 }; + | ^^^^^^^^^^^ + | + = note: this item must mention the opaque type in its signature in order to be able to register hidden types +note: this item must mention the opaque type in its signature in order to be able to register hidden types + --> $DIR/issue-78722-2.rs:15:20 + | +LL | let f: F = async { 1 }; + | ^^^^^^^^^^^ + +error: aborting due to 3 previous errors + +Some errors have detailed explanations: E0271, E0658. +For more information about an error, try `rustc --explain E0271`. diff --git a/tests/ui/impl-trait/issues/issue-78722.rs b/tests/ui/impl-trait/issues/issue-78722.rs index 7b5ab5f2298..75ccc8d8e8a 100644 --- a/tests/ui/impl-trait/issues/issue-78722.rs +++ b/tests/ui/impl-trait/issues/issue-78722.rs @@ -2,10 +2,9 @@ #![feature(type_alias_impl_trait)] -type F = impl core::future::Future<Output = u8>; - struct Bug { V1: [(); { + type F = impl core::future::Future<Output = u8>; fn concrete_use() -> F { //~^ ERROR to be a future that resolves to `u8`, but it resolves to `()` async {} diff --git a/tests/ui/impl-trait/issues/issue-78722.stderr b/tests/ui/impl-trait/issues/issue-78722.stderr index 05a2c135cf7..36340a0bab4 100644 --- a/tests/ui/impl-trait/issues/issue-78722.stderr +++ b/tests/ui/impl-trait/issues/issue-78722.stderr @@ -1,5 +1,5 @@ error[E0658]: `async` blocks are not allowed in constants - --> $DIR/issue-78722.rs:13:20 + --> $DIR/issue-78722.rs:12:20 | LL | let f: F = async { 1 }; | ^^^^^^^^^^^ @@ -7,8 +7,8 @@ LL | let f: F = async { 1 }; = note: see issue #85368 <https://github.com/rust-lang/rust/issues/85368> for more information = help: add `#![feature(const_async_blocks)]` to the crate attributes to enable -error[E0271]: expected `[async block@$DIR/issue-78722.rs:11:13: 11:21]` to be a future that resolves to `u8`, but it resolves to `()` - --> $DIR/issue-78722.rs:9:30 +error[E0271]: expected `[async block@$DIR/issue-78722.rs:10:13: 10:21]` to be a future that resolves to `u8`, but it resolves to `()` + --> $DIR/issue-78722.rs:8:30 | LL | fn concrete_use() -> F { | ^ expected `()`, found `u8` diff --git a/tests/ui/impl-trait/normalize-opaque-with-bound-vars.rs b/tests/ui/impl-trait/normalize-opaque-with-bound-vars.rs new file mode 100644 index 00000000000..1025c2c7e8a --- /dev/null +++ b/tests/ui/impl-trait/normalize-opaque-with-bound-vars.rs @@ -0,0 +1,27 @@ +// build-pass +// edition:2021 +// compile-flags: -Cdebuginfo=2 + +// We were not normalizing opaques with escaping bound vars during codegen, +// leading to later linker errors because of differences in mangled symbol name. + +fn func<T>() -> impl Sized {} + +trait Trait<'a> { + type Assoc; + + fn call() { + let _ = async { + let _value = func::<Self::Assoc>(); + std::future::ready(()).await + }; + } +} + +impl Trait<'static> for () { + type Assoc = (); +} + +fn main() { + <()>::call(); +} diff --git a/tests/ui/impl-trait/reveal-during-codegen.rs b/tests/ui/impl-trait/reveal-during-codegen.rs new file mode 100644 index 00000000000..11463772eb3 --- /dev/null +++ b/tests/ui/impl-trait/reveal-during-codegen.rs @@ -0,0 +1,11 @@ +// build-pass +// revisions: current next +//[next] compile-flags: -Ztrait-solver=next + +fn test() -> Option<impl Sized> { + Some("") +} + +fn main() { + test(); +} diff --git a/tests/ui/impl-trait/universal_wrong_hrtb.rs b/tests/ui/impl-trait/universal_wrong_hrtb.rs index b9551c2ceb0..48561710143 100644 --- a/tests/ui/impl-trait/universal_wrong_hrtb.rs +++ b/tests/ui/impl-trait/universal_wrong_hrtb.rs @@ -3,6 +3,6 @@ trait Trait<'a> { } fn test_argument_position(x: impl for<'a> Trait<'a, Assoc = impl Copy + 'a>) {} -//~^ ERROR `impl Trait` can only mention lifetimes bound at the fn or impl level +//~^ ERROR `impl Trait` can only mention lifetimes from an fn or impl fn main() {} diff --git a/tests/ui/impl-trait/universal_wrong_hrtb.stderr b/tests/ui/impl-trait/universal_wrong_hrtb.stderr index 37eb8dfa1a1..b5a091b61fa 100644 --- a/tests/ui/impl-trait/universal_wrong_hrtb.stderr +++ b/tests/ui/impl-trait/universal_wrong_hrtb.stderr @@ -1,14 +1,8 @@ -error: `impl Trait` can only mention lifetimes bound at the fn or impl level +error: `impl Trait` can only mention lifetimes from an fn or impl --> $DIR/universal_wrong_hrtb.rs:5:73 | LL | fn test_argument_position(x: impl for<'a> Trait<'a, Assoc = impl Copy + 'a>) {} - | ^^ - | -note: lifetime declared here - --> $DIR/universal_wrong_hrtb.rs:5:39 - | -LL | fn test_argument_position(x: impl for<'a> Trait<'a, Assoc = impl Copy + 'a>) {} - | ^^ + | -- lifetime declared here ^^ error: aborting due to previous error diff --git a/tests/ui/imports/auxiliary/issue-85992-extern-1.rs b/tests/ui/imports/auxiliary/issue-85992-extern-1.rs new file mode 100644 index 00000000000..a2d0e206065 --- /dev/null +++ b/tests/ui/imports/auxiliary/issue-85992-extern-1.rs @@ -0,0 +1,6 @@ +#[macro_export] +macro_rules! m { + () => { + use issue_85992_extern_2::Outcome; + } +} diff --git a/tests/ui/imports/auxiliary/issue-85992-extern-2.rs b/tests/ui/imports/auxiliary/issue-85992-extern-2.rs new file mode 100644 index 00000000000..e9b6a44cfe2 --- /dev/null +++ b/tests/ui/imports/auxiliary/issue-85992-extern-2.rs @@ -0,0 +1 @@ +// nothing diff --git a/tests/ui/imports/issue-56125.stderr b/tests/ui/imports/issue-56125.stderr index 3448f311977..15477fb6f10 100644 --- a/tests/ui/imports/issue-56125.stderr +++ b/tests/ui/imports/issue-56125.stderr @@ -22,7 +22,7 @@ error[E0659]: `issue_56125` is ambiguous LL | use issue_56125::last_segment::*; | ^^^^^^^^^^^ ambiguous name | - = note: ambiguous because of multiple potential import sources + = note: ambiguous because of a conflict between a name from a glob import and an outer scope during import or macro resolution = note: `issue_56125` could refer to a crate passed with `--extern` = help: use `::issue_56125` to refer to this crate unambiguously note: `issue_56125` could also refer to the module imported here @@ -30,7 +30,8 @@ note: `issue_56125` could also refer to the module imported here | LL | use issue_56125::last_segment::*; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = help: use `self::issue_56125` to refer to this module unambiguously + = help: consider adding an explicit import of `issue_56125` to disambiguate + = help: or use `self::issue_56125` to refer to this module unambiguously error[E0659]: `issue_56125` is ambiguous --> $DIR/issue-56125.rs:11:9 @@ -38,7 +39,7 @@ error[E0659]: `issue_56125` is ambiguous LL | use issue_56125::non_last_segment::non_last_segment::*; | ^^^^^^^^^^^ ambiguous name | - = note: ambiguous because of multiple potential import sources + = note: ambiguous because of a conflict between a name from a glob import and an outer scope during import or macro resolution = note: `issue_56125` could refer to a crate passed with `--extern` = help: use `::issue_56125` to refer to this crate unambiguously note: `issue_56125` could also refer to the module imported here @@ -46,7 +47,8 @@ note: `issue_56125` could also refer to the module imported here | LL | use issue_56125::non_last_segment::non_last_segment::*; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = help: use `self::issue_56125` to refer to this module unambiguously + = help: consider adding an explicit import of `issue_56125` to disambiguate + = help: or use `self::issue_56125` to refer to this module unambiguously error[E0659]: `issue_56125` is ambiguous --> $DIR/issue-56125.rs:18:9 @@ -54,7 +56,7 @@ error[E0659]: `issue_56125` is ambiguous LL | use issue_56125::*; | ^^^^^^^^^^^ ambiguous name | - = note: ambiguous because of multiple potential import sources + = note: ambiguous because of a conflict between a name from a glob import and an outer scope during import or macro resolution = note: `issue_56125` could refer to a crate passed with `--extern` = help: use `::issue_56125` to refer to this crate unambiguously note: `issue_56125` could also refer to the module imported here @@ -62,7 +64,8 @@ note: `issue_56125` could also refer to the module imported here | LL | use issue_56125::*; | ^^^^^^^^^^^^^^ - = help: use `self::issue_56125` to refer to this module unambiguously + = help: consider adding an explicit import of `issue_56125` to disambiguate + = help: or use `self::issue_56125` to refer to this module unambiguously error: aborting due to 4 previous errors diff --git a/tests/ui/imports/issue-57539.stderr b/tests/ui/imports/issue-57539.stderr index 1a3ca4edaca..88cc42ccf66 100644 --- a/tests/ui/imports/issue-57539.stderr +++ b/tests/ui/imports/issue-57539.stderr @@ -4,7 +4,7 @@ error[E0659]: `core` is ambiguous LL | use core; | ^^^^ ambiguous name | - = note: ambiguous because of multiple potential import sources + = note: ambiguous because of a conflict between a name from a glob import and an outer scope during import or macro resolution = note: `core` could refer to a built-in crate = help: use `::core` to refer to this crate unambiguously note: `core` could also refer to the module imported here @@ -12,7 +12,8 @@ note: `core` could also refer to the module imported here | LL | use crate::*; | ^^^^^^^^ - = help: use `self::core` to refer to this module unambiguously + = help: consider adding an explicit import of `core` to disambiguate + = help: or use `self::core` to refer to this module unambiguously error: aborting due to previous error diff --git a/tests/ui/imports/issue-85992.rs b/tests/ui/imports/issue-85992.rs new file mode 100644 index 00000000000..d5524109144 --- /dev/null +++ b/tests/ui/imports/issue-85992.rs @@ -0,0 +1,11 @@ +// edition: 2021 +// compile-flags: --extern issue_85992_extern_1 --extern issue_85992_extern_2 +// aux-build: issue-85992-extern-1.rs +// aux-build: issue-85992-extern-2.rs + +issue_85992_extern_1::m!(); + +use crate::issue_85992_extern_2; +//~^ ERROR unresolved import `crate::issue_85992_extern_2` + +fn main() {} diff --git a/tests/ui/imports/issue-85992.stderr b/tests/ui/imports/issue-85992.stderr new file mode 100644 index 00000000000..810d41009c5 --- /dev/null +++ b/tests/ui/imports/issue-85992.stderr @@ -0,0 +1,9 @@ +error[E0432]: unresolved import `crate::issue_85992_extern_2` + --> $DIR/issue-85992.rs:8:5 + | +LL | use crate::issue_85992_extern_2; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `issue_85992_extern_2` in the root + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0432`. diff --git a/tests/ui/issues/issue-12133-3.rs b/tests/ui/issues/issue-12133-3.rs index e6b16e2da1d..988b61e3baf 100644 --- a/tests/ui/issues/issue-12133-3.rs +++ b/tests/ui/issues/issue-12133-3.rs @@ -4,7 +4,7 @@ // aux-build:issue-12133-dylib2.rs // ignore-emscripten no dylib support // ignore-musl -// ignore-sgx no dylib support +// needs-dynamic-linking // pretty-expanded FIXME #23616 diff --git a/tests/ui/issues/issue-18389.rs b/tests/ui/issues/issue-18389.rs index 3686afc48af..05a5decf462 100644 --- a/tests/ui/issues/issue-18389.rs +++ b/tests/ui/issues/issue-18389.rs @@ -1,3 +1,4 @@ +#![feature(type_privacy_lints)] #![warn(private_bounds)] // In this test both old and new private-in-public diagnostic were emitted. @@ -12,6 +13,7 @@ trait Private<P, R> { } pub trait Public: Private< //~^ ERROR private trait `Private<<Self as Public>::P, <Self as Public>::R>` in public interface +//~| WARNING trait `Private<<Self as Public>::P, <Self as Public>::R>` is more private than the item `Public` <Self as Public>::P, <Self as Public>::R > { diff --git a/tests/ui/issues/issue-18389.stderr b/tests/ui/issues/issue-18389.stderr index f9ebde48a45..18ffc4177d7 100644 --- a/tests/ui/issues/issue-18389.stderr +++ b/tests/ui/issues/issue-18389.stderr @@ -1,34 +1,35 @@ error[E0445]: private trait `Private<<Self as Public>::P, <Self as Public>::R>` in public interface - --> $DIR/issue-18389.rs:13:1 + --> $DIR/issue-18389.rs:14:1 | LL | trait Private<P, R> { | ------------------- `Private<<Self as Public>::P, <Self as Public>::R>` declared as private ... LL | / pub trait Public: Private< LL | | +LL | | LL | | <Self as Public>::P, LL | | <Self as Public>::R LL | | > { | |_^ can't leak private trait warning: trait `Private<<Self as Public>::P, <Self as Public>::R>` is more private than the item `Public` - | -note: trait `Public` is reachable at visibility `pub` - --> $DIR/issue-18389.rs:13:1 + --> $DIR/issue-18389.rs:14:1 | LL | / pub trait Public: Private< LL | | +LL | | LL | | <Self as Public>::P, LL | | <Self as Public>::R LL | | > { - | |_^ + | |_^ trait `Public` is reachable at visibility `pub` + | note: but trait `Private<<Self as Public>::P, <Self as Public>::R>` is only usable at visibility `pub(crate)` - --> $DIR/issue-18389.rs:10:1 + --> $DIR/issue-18389.rs:11:1 | LL | trait Private<P, R> { | ^^^^^^^^^^^^^^^^^^^ note: the lint level is defined here - --> $DIR/issue-18389.rs:1:9 + --> $DIR/issue-18389.rs:2:9 | LL | #![warn(private_bounds)] | ^^^^^^^^^^^^^^ diff --git a/tests/ui/issues/issue-35570.rs b/tests/ui/issues/issue-35570.rs index a2b0222d4f3..42bdb423f8f 100644 --- a/tests/ui/issues/issue-35570.rs +++ b/tests/ui/issues/issue-35570.rs @@ -7,7 +7,6 @@ trait Trait2<'a> { fn _ice(param: Box<dyn for <'a> Trait1<<() as Trait2<'a>>::Ty>>) { //~^ ERROR the trait bound `for<'a> (): Trait2<'a>` is not satisfied - //~| ERROR the trait bound `for<'a> (): Trait2<'a>` is not satisfied let _e: (usize, usize) = unsafe{mem::transmute(param)}; } diff --git a/tests/ui/issues/issue-35570.stderr b/tests/ui/issues/issue-35570.stderr index 3dc33729d8f..2697d46bdb2 100644 --- a/tests/ui/issues/issue-35570.stderr +++ b/tests/ui/issues/issue-35570.stderr @@ -4,16 +4,6 @@ error[E0277]: the trait bound `for<'a> (): Trait2<'a>` is not satisfied LL | fn _ice(param: Box<dyn for <'a> Trait1<<() as Trait2<'a>>::Ty>>) { | ^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'a> Trait2<'a>` is not implemented for `()` -error[E0277]: the trait bound `for<'a> (): Trait2<'a>` is not satisfied - --> $DIR/issue-35570.rs:8:1 - | -LL | / fn _ice(param: Box<dyn for <'a> Trait1<<() as Trait2<'a>>::Ty>>) { -LL | | -LL | | -LL | | let _e: (usize, usize) = unsafe{mem::transmute(param)}; -LL | | } - | |_^ the trait `for<'a> Trait2<'a>` is not implemented for `()` - -error: aborting due to 2 previous errors +error: aborting due to previous error For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/issues/issue-67552.rs b/tests/ui/issues/issue-67552.rs index ec1997ccd5d..7336b873dd6 100644 --- a/tests/ui/issues/issue-67552.rs +++ b/tests/ui/issues/issue-67552.rs @@ -1,6 +1,7 @@ // build-fail // compile-flags: -Copt-level=0 // normalize-stderr-test: ".nll/" -> "/" +// ignore-compare-mode-next-solver (hangs) fn main() { rec(Empty); diff --git a/tests/ui/issues/issue-67552.stderr b/tests/ui/issues/issue-67552.stderr index 4746f918bf8..f93ed67dab2 100644 --- a/tests/ui/issues/issue-67552.stderr +++ b/tests/ui/issues/issue-67552.stderr @@ -1,11 +1,11 @@ error: reached the recursion limit while instantiating `rec::<&mut &mut &mut &mut &mut ...>` - --> $DIR/issue-67552.rs:29:9 + --> $DIR/issue-67552.rs:30:9 | LL | rec(identity(&mut it)) | ^^^^^^^^^^^^^^^^^^^^^^ | note: `rec` defined here - --> $DIR/issue-67552.rs:22:1 + --> $DIR/issue-67552.rs:23:1 | LL | / fn rec<T>(mut it: T) LL | | where diff --git a/tests/ui/issues/issue-85461.rs b/tests/ui/issues/issue-85461.rs index 9655108876f..092105df24e 100644 --- a/tests/ui/issues/issue-85461.rs +++ b/tests/ui/issues/issue-85461.rs @@ -1,6 +1,7 @@ // compile-flags: -Cinstrument-coverage -Ccodegen-units=4 --crate-type dylib -Copt-level=0 // build-pass // needs-profiler-support +// needs-dynamic-linking // Regression test for #85461 where MSVC sometimes fails to link instrument-coverage binaries // with dead code and #[inline(always)]. diff --git a/tests/ui/limits/huge-array-simple-32.rs b/tests/ui/limits/huge-array-simple-32.rs index 2290e3d5e76..f25b8887402 100644 --- a/tests/ui/limits/huge-array-simple-32.rs +++ b/tests/ui/limits/huge-array-simple-32.rs @@ -1,9 +1,6 @@ // ignore-64bit // build-fail -// FIXME https://github.com/rust-lang/rust/issues/59774 -// normalize-stderr-test "thread.*panicked.*Metadata module not compiled.*\n" -> "" -// normalize-stderr-test "note:.*RUST_BACKTRACE=1.*\n" -> "" #![allow(arithmetic_overflow)] fn main() { diff --git a/tests/ui/limits/huge-array-simple-32.stderr b/tests/ui/limits/huge-array-simple-32.stderr index 31e120df626..d1e4e6295a9 100644 --- a/tests/ui/limits/huge-array-simple-32.stderr +++ b/tests/ui/limits/huge-array-simple-32.stderr @@ -1,5 +1,5 @@ error: values of the type `[u8; 2147516416]` are too big for the current architecture - --> $DIR/huge-array-simple-32.rs:10:9 + --> $DIR/huge-array-simple-32.rs:7:9 | LL | let _fat: [u8; (1<<31)+(1<<15)] = | ^^^^ diff --git a/tests/ui/limits/huge-array-simple-64.rs b/tests/ui/limits/huge-array-simple-64.rs index 02c961fc5fa..c5778c428ae 100644 --- a/tests/ui/limits/huge-array-simple-64.rs +++ b/tests/ui/limits/huge-array-simple-64.rs @@ -1,9 +1,6 @@ // build-fail // ignore-32bit -// FIXME https://github.com/rust-lang/rust/issues/59774 -// normalize-stderr-test "thread.*panicked.*Metadata module not compiled.*\n" -> "" -// normalize-stderr-test "note:.*RUST_BACKTRACE=1.*\n" -> "" #![allow(arithmetic_overflow)] fn main() { diff --git a/tests/ui/limits/huge-array-simple-64.stderr b/tests/ui/limits/huge-array-simple-64.stderr index c5d3fe85d0d..5791b6439c9 100644 --- a/tests/ui/limits/huge-array-simple-64.stderr +++ b/tests/ui/limits/huge-array-simple-64.stderr @@ -1,5 +1,5 @@ error: values of the type `[u8; 2305843011361177600]` are too big for the current architecture - --> $DIR/huge-array-simple-64.rs:10:9 + --> $DIR/huge-array-simple-64.rs:7:9 | LL | let _fat: [u8; (1<<61)+(1<<31)] = | ^^^^ diff --git a/tests/ui/limits/huge-array.rs b/tests/ui/limits/huge-array.rs index 3070801f865..811cf25dd76 100644 --- a/tests/ui/limits/huge-array.rs +++ b/tests/ui/limits/huge-array.rs @@ -1,8 +1,4 @@ -// FIXME https://github.com/rust-lang/rust/issues/59774 - // build-fail -// normalize-stderr-test "thread.*panicked.*Metadata module not compiled.*\n" -> "" -// normalize-stderr-test "note:.*RUST_BACKTRACE=1.*\n" -> "" fn generic<T: Copy>(t: T) { let s: [T; 1518600000] = [t; 1518600000]; diff --git a/tests/ui/limits/huge-array.stderr b/tests/ui/limits/huge-array.stderr index 817458b73e4..24adb33b088 100644 --- a/tests/ui/limits/huge-array.stderr +++ b/tests/ui/limits/huge-array.stderr @@ -1,5 +1,5 @@ error: values of the type `[[u8; 1518599999]; 1518600000]` are too big for the current architecture - --> $DIR/huge-array.rs:8:9 + --> $DIR/huge-array.rs:4:9 | LL | let s: [T; 1518600000] = [t; 1518600000]; | ^ diff --git a/tests/ui/limits/huge-enum.rs b/tests/ui/limits/huge-enum.rs index 39ea6e11b1f..dd4bae60d3e 100644 --- a/tests/ui/limits/huge-enum.rs +++ b/tests/ui/limits/huge-enum.rs @@ -2,10 +2,6 @@ // normalize-stderr-test "std::option::Option<\[u32; \d+\]>" -> "TYPE" // normalize-stderr-test "\[u32; \d+\]" -> "TYPE" -// FIXME https://github.com/rust-lang/rust/issues/59774 -// normalize-stderr-test "thread.*panicked.*Metadata module not compiled.*\n" -> "" -// normalize-stderr-test "note:.*RUST_BACKTRACE=1.*\n" -> "" - #[cfg(target_pointer_width = "32")] type BIG = Option<[u32; (1<<29)-1]>; diff --git a/tests/ui/limits/huge-enum.stderr b/tests/ui/limits/huge-enum.stderr index a1456e1a8ab..5e2bda9be50 100644 --- a/tests/ui/limits/huge-enum.stderr +++ b/tests/ui/limits/huge-enum.stderr @@ -1,5 +1,5 @@ error: values of the type `Option<TYPE>` are too big for the current architecture - --> $DIR/huge-enum.rs:16:9 + --> $DIR/huge-enum.rs:12:9 | LL | let big: BIG = None; | ^^^ diff --git a/tests/ui/limits/huge-struct.rs b/tests/ui/limits/huge-struct.rs index 02f38d860b4..904e2774b19 100644 --- a/tests/ui/limits/huge-struct.rs +++ b/tests/ui/limits/huge-struct.rs @@ -3,10 +3,6 @@ // normalize-stderr-test "S1M" -> "SXX" // error-pattern: too big for the current -// FIXME https://github.com/rust-lang/rust/issues/59774 -// normalize-stderr-test "thread.*panicked.*Metadata module not compiled.*\n" -> "" -// normalize-stderr-test "note:.*RUST_BACKTRACE=1.*\n" -> "" - struct S32<T> { v0: T, v1: T, diff --git a/tests/ui/limits/huge-struct.stderr b/tests/ui/limits/huge-struct.stderr index f0ee88e5955..ce14bc5b888 100644 --- a/tests/ui/limits/huge-struct.stderr +++ b/tests/ui/limits/huge-struct.stderr @@ -1,5 +1,5 @@ error: values of the type `SXX<SXX<SXX<u32>>>` are too big for the current architecture - --> $DIR/huge-struct.rs:50:9 + --> $DIR/huge-struct.rs:46:9 | LL | let fat: Option<SXX<SXX<SXX<u32>>>> = None; | ^^^ diff --git a/tests/ui/limits/issue-15919-32.rs b/tests/ui/limits/issue-15919-32.rs index 3c93f14ccc7..3254cb2c5bb 100644 --- a/tests/ui/limits/issue-15919-32.rs +++ b/tests/ui/limits/issue-15919-32.rs @@ -1,10 +1,6 @@ // ignore-64bit // build-fail -// FIXME https://github.com/rust-lang/rust/issues/59774 -// normalize-stderr-test "thread.*panicked.*Metadata module not compiled.*\n" -> "" -// normalize-stderr-test "note:.*RUST_BACKTRACE=1.*\n" -> "" - fn main() { let x = [0usize; 0xffff_ffff]; //~ ERROR too big } diff --git a/tests/ui/limits/issue-15919-32.stderr b/tests/ui/limits/issue-15919-32.stderr index 0d79fc0c770..f9e48a52cb9 100644 --- a/tests/ui/limits/issue-15919-32.stderr +++ b/tests/ui/limits/issue-15919-32.stderr @@ -1,5 +1,5 @@ error: values of the type `[usize; usize::MAX]` are too big for the current architecture - --> $DIR/issue-15919-32.rs:9:9 + --> $DIR/issue-15919-32.rs:5:9 | LL | let x = [0usize; 0xffff_ffff]; | ^ diff --git a/tests/ui/limits/issue-15919-64.rs b/tests/ui/limits/issue-15919-64.rs index 3ecbd34eaaa..272e8800d68 100644 --- a/tests/ui/limits/issue-15919-64.rs +++ b/tests/ui/limits/issue-15919-64.rs @@ -1,10 +1,6 @@ // build-fail // ignore-32bit -// FIXME https://github.com/rust-lang/rust/issues/59774 -// normalize-stderr-test "thread.*panicked.*Metadata module not compiled.*\n" -> "" -// normalize-stderr-test "note:.*RUST_BACKTRACE=1.*\n" -> "" - fn main() { let x = [0usize; 0xffff_ffff_ffff_ffff]; //~ ERROR too big } diff --git a/tests/ui/limits/issue-15919-64.stderr b/tests/ui/limits/issue-15919-64.stderr index 3399d644ede..167272890aa 100644 --- a/tests/ui/limits/issue-15919-64.stderr +++ b/tests/ui/limits/issue-15919-64.stderr @@ -1,5 +1,5 @@ error: values of the type `[usize; usize::MAX]` are too big for the current architecture - --> $DIR/issue-15919-64.rs:9:9 + --> $DIR/issue-15919-64.rs:5:9 | LL | let x = [0usize; 0xffff_ffff_ffff_ffff]; | ^ diff --git a/tests/ui/limits/issue-17913.rs b/tests/ui/limits/issue-17913.rs index 56cf5d831bd..6b37d6f0551 100644 --- a/tests/ui/limits/issue-17913.rs +++ b/tests/ui/limits/issue-17913.rs @@ -2,10 +2,6 @@ // normalize-stderr-test "\[&usize; \d+\]" -> "[&usize; usize::MAX]" // error-pattern: too big for the current architecture -// FIXME https://github.com/rust-lang/rust/issues/59774 -// normalize-stderr-test "thread.*panicked.*Metadata module not compiled.*\n" -> "" -// normalize-stderr-test "note:.*RUST_BACKTRACE=1.*\n" -> "" - #[cfg(target_pointer_width = "64")] fn main() { let n = 0_usize; diff --git a/tests/ui/limits/issue-56762.rs b/tests/ui/limits/issue-56762.rs index fb0a270f18b..ed7ee4da85d 100644 --- a/tests/ui/limits/issue-56762.rs +++ b/tests/ui/limits/issue-56762.rs @@ -1,8 +1,5 @@ // only-x86_64 -// FIXME https://github.com/rust-lang/rust/issues/59774 -// normalize-stderr-test "thread.*panicked.*Metadata module not compiled.*\n" -> "" -// normalize-stderr-test "note:.*RUST_BACKTRACE=1.*\n" -> "" const HUGE_SIZE: usize = !0usize / 8; diff --git a/tests/ui/limits/issue-56762.stderr b/tests/ui/limits/issue-56762.stderr index e6b9c676278..29f2a8859ee 100644 --- a/tests/ui/limits/issue-56762.stderr +++ b/tests/ui/limits/issue-56762.stderr @@ -1,11 +1,11 @@ error[E0080]: values of the type `[u8; 2305843009213693951]` are too big for the current architecture - --> $DIR/issue-56762.rs:19:1 + --> $DIR/issue-56762.rs:16:1 | LL | static MY_TOO_BIG_ARRAY_1: TooBigArray = TooBigArray::new(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0080]: values of the type `[u8; 2305843009213693951]` are too big for the current architecture - --> $DIR/issue-56762.rs:21:1 + --> $DIR/issue-56762.rs:18:1 | LL | static MY_TOO_BIG_ARRAY_2: [u8; HUGE_SIZE] = [0x00; HUGE_SIZE]; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/linkage-attr/incompatible-flavor.stderr b/tests/ui/linkage-attr/incompatible-flavor.stderr index e07e778521c..aabdd14b69b 100644 --- a/tests/ui/linkage-attr/incompatible-flavor.stderr +++ b/tests/ui/linkage-attr/incompatible-flavor.stderr @@ -1,6 +1,6 @@ error: linker flavor `msvc` is incompatible with the current target | - = note: compatible flavors are: gcc, ld, ld.lld + = note: compatible flavors are: gnu, gnu-lld, gnu-cc, gnu-lld-cc, gcc, ld, ld.lld error: aborting due to previous error diff --git a/tests/ui/linkage-attr/linkage3.rs b/tests/ui/linkage-attr/linkage3.rs index 112eb1d3bd9..cac10af6338 100644 --- a/tests/ui/linkage-attr/linkage3.rs +++ b/tests/ui/linkage-attr/linkage3.rs @@ -1,8 +1,4 @@ -// FIXME https://github.com/rust-lang/rust/issues/59774 - // check-fail -// normalize-stderr-test "thread.*panicked.*Metadata module not compiled.*\n" -> "" -// normalize-stderr-test "note:.*RUST_BACKTRACE=1.*\n" -> "" #![feature(linkage)] diff --git a/tests/ui/linkage-attr/linkage3.stderr b/tests/ui/linkage-attr/linkage3.stderr index f2579c6e850..dbb5880ab92 100644 --- a/tests/ui/linkage-attr/linkage3.stderr +++ b/tests/ui/linkage-attr/linkage3.stderr @@ -1,5 +1,5 @@ error: invalid linkage specified - --> $DIR/linkage3.rs:11:5 + --> $DIR/linkage3.rs:7:5 | LL | static foo: *const i32; | ^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/linkage-attr/unstable-flavor.bpf.stderr b/tests/ui/linkage-attr/unstable-flavor.bpf.stderr index 3346d12c20e..594a461769b 100644 --- a/tests/ui/linkage-attr/unstable-flavor.bpf.stderr +++ b/tests/ui/linkage-attr/unstable-flavor.bpf.stderr @@ -1,2 +1,2 @@ -error: linker flavor `bpf-linker` is unstable, `-Z unstable-options` flag must also be passed to explicitly use it +error: the linker flavor `bpf-linker` is unstable, the `-Z unstable-options` flag must also be passed to use the unstable values diff --git a/tests/ui/linkage-attr/unstable-flavor.ptx.stderr b/tests/ui/linkage-attr/unstable-flavor.ptx.stderr index 03ca2a01246..714c09df53f 100644 --- a/tests/ui/linkage-attr/unstable-flavor.ptx.stderr +++ b/tests/ui/linkage-attr/unstable-flavor.ptx.stderr @@ -1,2 +1,2 @@ -error: linker flavor `ptx-linker` is unstable, `-Z unstable-options` flag must also be passed to explicitly use it +error: the linker flavor `ptx-linker` is unstable, the `-Z unstable-options` flag must also be passed to use the unstable values diff --git a/tests/ui/linkage-attr/unstable-flavor.rs b/tests/ui/linkage-attr/unstable-flavor.rs index 5487882dc24..b58fd055fdc 100644 --- a/tests/ui/linkage-attr/unstable-flavor.rs +++ b/tests/ui/linkage-attr/unstable-flavor.rs @@ -1,9 +1,13 @@ +// Even though this test only checks 2 of the 10 or so unstable linker flavors, it exercizes the +// unique codepath checking all unstable options (see `LinkerFlavorCli::is_unstable` and its +// caller). If it passes, all the other unstable options are rejected as well. +// // revisions: bpf ptx // [bpf] compile-flags: --target=bpfel-unknown-none -C linker-flavor=bpf-linker --crate-type=rlib -// [bpf] error-pattern: linker flavor `bpf-linker` is unstable, `-Z unstable-options` flag +// [bpf] error-pattern: linker flavor `bpf-linker` is unstable, the `-Z unstable-options` flag // [bpf] needs-llvm-components: // [ptx] compile-flags: --target=nvptx64-nvidia-cuda -C linker-flavor=ptx-linker --crate-type=rlib -// [ptx] error-pattern: linker flavor `ptx-linker` is unstable, `-Z unstable-options` flag +// [ptx] error-pattern: linker flavor `ptx-linker` is unstable, the `-Z unstable-options` flag // [ptx] needs-llvm-components: #![feature(no_core)] diff --git a/tests/ui/lint/dropping_copy_types.rs b/tests/ui/lint/dropping_copy_types.rs index 2937320e5d8..2412222d6d1 100644 --- a/tests/ui/lint/dropping_copy_types.rs +++ b/tests/ui/lint/dropping_copy_types.rs @@ -77,3 +77,22 @@ fn issue9482(x: u8) { _ => (), } } + +fn issue112653() { + fn foo() -> Result<u8, ()> { + println!("doing foo"); + Ok(0) // result is not always useful, the side-effect matters + } + fn bar() { + println!("doing bar"); + } + + fn stuff() -> Result<(), ()> { + match 42 { + 0 => drop(foo()?), // drop is needed because we only care about side-effects + 1 => bar(), + _ => (), // doing nothing (no side-effects needed here) + } + Ok(()) + } +} diff --git a/tests/ui/lint/dropping_references.rs b/tests/ui/lint/dropping_references.rs index 0d5d484f451..bb02cb75a90 100644 --- a/tests/ui/lint/dropping_references.rs +++ b/tests/ui/lint/dropping_references.rs @@ -97,3 +97,22 @@ fn issue10122(x: u8) { _ => (), } } + +fn issue112653() { + fn foo() -> Result<&'static u8, ()> { + println!("doing foo"); + Ok(&0) // result is not always useful, the side-effect matters + } + fn bar() { + println!("doing bar"); + } + + fn stuff() -> Result<(), ()> { + match 42 { + 0 => drop(foo()?), // drop is needed because we only care about side-effects + 1 => bar(), + _ => (), // doing nothing (no side-effects needed here) + } + Ok(()) + } +} diff --git a/tests/ui/lint/issue-99387.rs b/tests/ui/lint/issue-99387.rs index 616eb935e93..ba5031167e3 100644 --- a/tests/ui/lint/issue-99387.rs +++ b/tests/ui/lint/issue-99387.rs @@ -1,4 +1,5 @@ -// check-pass +//! Test that we don't follow through projections to find +//! opaque types. #![feature(type_alias_impl_trait)] #![allow(private_in_public)] @@ -18,6 +19,7 @@ impl<'a> Tr for &'a () { } pub fn ohno<'a>() -> <&'a () as Tr>::Item { + //~^ ERROR item constrains opaque type that is not in its signature None.into_iter() } diff --git a/tests/ui/lint/issue-99387.stderr b/tests/ui/lint/issue-99387.stderr new file mode 100644 index 00000000000..3a46ce7e195 --- /dev/null +++ b/tests/ui/lint/issue-99387.stderr @@ -0,0 +1,15 @@ +error: item constrains opaque type that is not in its signature + --> $DIR/issue-99387.rs:21:22 + | +LL | pub fn ohno<'a>() -> <&'a () as Tr>::Item { + | ^^^^^^^^^^^^^^^^^^^^ + | + = note: this item must mention the opaque type in its signature in order to be able to register hidden types +note: this item must mention the opaque type in its signature in order to be able to register hidden types + --> $DIR/issue-99387.rs:21:8 + | +LL | pub fn ohno<'a>() -> <&'a () as Tr>::Item { + | ^^^^ + +error: aborting due to previous error + diff --git a/tests/ui/lint/lint-ctypes-94223.rs b/tests/ui/lint/lint-ctypes-94223.rs new file mode 100644 index 00000000000..70dd2a71f26 --- /dev/null +++ b/tests/ui/lint/lint-ctypes-94223.rs @@ -0,0 +1,42 @@ +#![crate_type = "lib"] +#![deny(improper_ctypes_definitions)] + +pub fn bad(f: extern "C" fn([u8])) {} +//~^ ERROR `extern` fn uses type `[u8]`, which is not FFI-safe + +pub fn bad_twice(f: Result<extern "C" fn([u8]), extern "C" fn([u8])>) {} +//~^ ERROR `extern` fn uses type `[u8]`, which is not FFI-safe +//~^^ ERROR `extern` fn uses type `[u8]`, which is not FFI-safe + +struct BadStruct(extern "C" fn([u8])); +//~^ ERROR `extern` fn uses type `[u8]`, which is not FFI-safe + +enum BadEnum { + A(extern "C" fn([u8])), + //~^ ERROR `extern` fn uses type `[u8]`, which is not FFI-safe +} + +enum BadUnion { + A(extern "C" fn([u8])), + //~^ ERROR `extern` fn uses type `[u8]`, which is not FFI-safe +} + +type Foo = extern "C" fn([u8]); +//~^ ERROR `extern` fn uses type `[u8]`, which is not FFI-safe + +pub struct FfiUnsafe; + +#[allow(improper_ctypes_definitions)] +extern "C" fn f(_: FfiUnsafe) { + unimplemented!() +} + +pub static BAD: extern "C" fn(FfiUnsafe) = f; +//~^ ERROR `extern` fn uses type `FfiUnsafe`, which is not FFI-safe + +pub static BAD_TWICE: Result<extern "C" fn(FfiUnsafe), extern "C" fn(FfiUnsafe)> = Ok(f); +//~^ ERROR `extern` fn uses type `FfiUnsafe`, which is not FFI-safe +//~^^ ERROR `extern` fn uses type `FfiUnsafe`, which is not FFI-safe + +pub const BAD_CONST: extern "C" fn(FfiUnsafe) = f; +//~^ ERROR `extern` fn uses type `FfiUnsafe`, which is not FFI-safe diff --git a/tests/ui/lint/lint-ctypes-94223.stderr b/tests/ui/lint/lint-ctypes-94223.stderr new file mode 100644 index 00000000000..49e64ed5140 --- /dev/null +++ b/tests/ui/lint/lint-ctypes-94223.stderr @@ -0,0 +1,126 @@ +error: `extern` fn uses type `[u8]`, which is not FFI-safe + --> $DIR/lint-ctypes-94223.rs:4:15 + | +LL | pub fn bad(f: extern "C" fn([u8])) {} + | ^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider using a raw pointer instead + = note: slices have no C equivalent +note: the lint level is defined here + --> $DIR/lint-ctypes-94223.rs:2:9 + | +LL | #![deny(improper_ctypes_definitions)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: `extern` fn uses type `[u8]`, which is not FFI-safe + --> $DIR/lint-ctypes-94223.rs:7:28 + | +LL | pub fn bad_twice(f: Result<extern "C" fn([u8]), extern "C" fn([u8])>) {} + | ^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider using a raw pointer instead + = note: slices have no C equivalent + +error: `extern` fn uses type `[u8]`, which is not FFI-safe + --> $DIR/lint-ctypes-94223.rs:7:49 + | +LL | pub fn bad_twice(f: Result<extern "C" fn([u8]), extern "C" fn([u8])>) {} + | ^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider using a raw pointer instead + = note: slices have no C equivalent + +error: `extern` fn uses type `[u8]`, which is not FFI-safe + --> $DIR/lint-ctypes-94223.rs:11:18 + | +LL | struct BadStruct(extern "C" fn([u8])); + | ^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider using a raw pointer instead + = note: slices have no C equivalent + +error: `extern` fn uses type `[u8]`, which is not FFI-safe + --> $DIR/lint-ctypes-94223.rs:15:7 + | +LL | A(extern "C" fn([u8])), + | ^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider using a raw pointer instead + = note: slices have no C equivalent + +error: `extern` fn uses type `[u8]`, which is not FFI-safe + --> $DIR/lint-ctypes-94223.rs:20:7 + | +LL | A(extern "C" fn([u8])), + | ^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider using a raw pointer instead + = note: slices have no C equivalent + +error: `extern` fn uses type `[u8]`, which is not FFI-safe + --> $DIR/lint-ctypes-94223.rs:24:12 + | +LL | type Foo = extern "C" fn([u8]); + | ^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider using a raw pointer instead + = note: slices have no C equivalent + +error: `extern` fn uses type `FfiUnsafe`, which is not FFI-safe + --> $DIR/lint-ctypes-94223.rs:34:17 + | +LL | pub static BAD: extern "C" fn(FfiUnsafe) = f; + | ^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct + = note: this struct has unspecified layout +note: the type is defined here + --> $DIR/lint-ctypes-94223.rs:27:1 + | +LL | pub struct FfiUnsafe; + | ^^^^^^^^^^^^^^^^^^^^ + +error: `extern` fn uses type `FfiUnsafe`, which is not FFI-safe + --> $DIR/lint-ctypes-94223.rs:37:30 + | +LL | pub static BAD_TWICE: Result<extern "C" fn(FfiUnsafe), extern "C" fn(FfiUnsafe)> = Ok(f); + | ^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct + = note: this struct has unspecified layout +note: the type is defined here + --> $DIR/lint-ctypes-94223.rs:27:1 + | +LL | pub struct FfiUnsafe; + | ^^^^^^^^^^^^^^^^^^^^ + +error: `extern` fn uses type `FfiUnsafe`, which is not FFI-safe + --> $DIR/lint-ctypes-94223.rs:37:56 + | +LL | pub static BAD_TWICE: Result<extern "C" fn(FfiUnsafe), extern "C" fn(FfiUnsafe)> = Ok(f); + | ^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct + = note: this struct has unspecified layout +note: the type is defined here + --> $DIR/lint-ctypes-94223.rs:27:1 + | +LL | pub struct FfiUnsafe; + | ^^^^^^^^^^^^^^^^^^^^ + +error: `extern` fn uses type `FfiUnsafe`, which is not FFI-safe + --> $DIR/lint-ctypes-94223.rs:41:22 + | +LL | pub const BAD_CONST: extern "C" fn(FfiUnsafe) = f; + | ^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct + = note: this struct has unspecified layout +note: the type is defined here + --> $DIR/lint-ctypes-94223.rs:27:1 + | +LL | pub struct FfiUnsafe; + | ^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 11 previous errors + diff --git a/tests/ui/macros/auxiliary/proc_macro_sequence.rs b/tests/ui/macros/auxiliary/proc_macro_sequence.rs index 1331480d835..2f69cbc9450 100644 --- a/tests/ui/macros/auxiliary/proc_macro_sequence.rs +++ b/tests/ui/macros/auxiliary/proc_macro_sequence.rs @@ -8,11 +8,6 @@ extern crate proc_macro; use proc_macro::{quote, Span, TokenStream, TokenTree}; -fn assert_same_span(a: Span, b: Span) { - assert_eq!(a.start(), b.start()); - assert_eq!(a.end(), b.end()); -} - // This macro generates a macro with the same macro definition as `manual_foo` in // `same-sequence-span.rs` but with the same span for all sequences. #[proc_macro] diff --git a/tests/ui/macros/builtin-prelude-no-accidents.stderr b/tests/ui/macros/builtin-prelude-no-accidents.stderr index 8cd9a63b808..b726e186241 100644 --- a/tests/ui/macros/builtin-prelude-no-accidents.stderr +++ b/tests/ui/macros/builtin-prelude-no-accidents.stderr @@ -3,21 +3,37 @@ error[E0433]: failed to resolve: use of undeclared crate or module `env` | LL | env::current_dir; | ^^^ use of undeclared crate or module `env` - -error[E0433]: failed to resolve: use of undeclared crate or module `vec` - --> $DIR/builtin-prelude-no-accidents.rs:7:14 | -LL | type B = vec::Vec<u8>; - | ^^^ - | | - | use of undeclared crate or module `vec` - | help: a struct with a similar name exists (notice the capitalization): `Vec` +help: consider importing this module + | +LL + use std::env; + | error[E0433]: failed to resolve: use of undeclared crate or module `panic` --> $DIR/builtin-prelude-no-accidents.rs:6:14 | LL | type A = panic::PanicInfo; | ^^^^^ use of undeclared crate or module `panic` + | +help: consider importing this module + | +LL + use std::panic; + | + +error[E0433]: failed to resolve: use of undeclared crate or module `vec` + --> $DIR/builtin-prelude-no-accidents.rs:7:14 + | +LL | type B = vec::Vec<u8>; + | ^^^ use of undeclared crate or module `vec` + | +help: a struct with a similar name exists + | +LL | type B = Vec::Vec<u8>; + | ~~~ +help: consider importing this module + | +LL + use std::vec; + | error: aborting due to 3 previous errors diff --git a/tests/ui/macros/same-sequence-span.stderr b/tests/ui/macros/same-sequence-span.stderr index bdd191e8ed6..3242a32e2f4 100644 --- a/tests/ui/macros/same-sequence-span.stderr +++ b/tests/ui/macros/same-sequence-span.stderr @@ -17,15 +17,14 @@ LL | $(= $z:tt)* error: `$x:expr` may be followed by `$y:tt`, which is not allowed for `expr` fragments --> $DIR/same-sequence-span.rs:19:1 | +LL | | } + | |_________________________________^ not allowed after `expr` fragments +LL | LL | proc_macro_sequence::make_foo!(); | ^------------------------------- | | | _in this macro invocation | | -LL | | -LL | | -LL | | fn main() {} - | |_________________________________^ not allowed after `expr` fragments | = note: allowed there are: `=>`, `,` or `;` = note: this error originates in the macro `proc_macro_sequence::make_foo` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/match/issue-113012.rs b/tests/ui/match/issue-113012.rs new file mode 100644 index 00000000000..da7a8b65b97 --- /dev/null +++ b/tests/ui/match/issue-113012.rs @@ -0,0 +1,12 @@ +// run-pass + +#![allow(dead_code)] +struct Foo(()); + +const FOO: Foo = Foo(match 0 { + 0.. => (), + _ => (), +}); + +fn main() { +} diff --git a/tests/ui/object-safety/assoc_type_bounds_sized.rs b/tests/ui/object-safety/assoc_type_bounds_sized.rs index 61ad3cf9dc6..6d10ceeb1b4 100644 --- a/tests/ui/object-safety/assoc_type_bounds_sized.rs +++ b/tests/ui/object-safety/assoc_type_bounds_sized.rs @@ -1,9 +1,24 @@ +//! This test checks that associated types only need to be +//! mentioned in trait objects, if they don't require `Self: Sized`. + +// check-pass + trait Foo { type Bar where Self: Sized; } -fn foo(_: &dyn Foo) {} //~ ERROR: the value of the associated type `Bar` (from trait `Foo`) must be specified +fn foo(_: &dyn Foo) {} + +trait Other: Sized {} + +trait Boo { + type Assoc + where + Self: Other; +} + +fn boo(_: &dyn Boo) {} fn main() {} diff --git a/tests/ui/object-safety/assoc_type_bounds_sized.stderr b/tests/ui/object-safety/assoc_type_bounds_sized.stderr deleted file mode 100644 index 49d624f9b1d..00000000000 --- a/tests/ui/object-safety/assoc_type_bounds_sized.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0191]: the value of the associated type `Bar` (from trait `Foo`) must be specified - --> $DIR/assoc_type_bounds_sized.rs:7:16 - | -LL | type Bar - | -------- `Bar` defined here -... -LL | fn foo(_: &dyn Foo) {} - | ^^^ help: specify the associated type: `Foo<Bar = Type>` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0191`. diff --git a/tests/ui/object-safety/assoc_type_bounds_sized_others.rs b/tests/ui/object-safety/assoc_type_bounds_sized_others.rs new file mode 100644 index 00000000000..647b72a759f --- /dev/null +++ b/tests/ui/object-safety/assoc_type_bounds_sized_others.rs @@ -0,0 +1,25 @@ +//! This test checks that even if some associated types have +//! `where Self: Sized` bounds, those without still need to be +//! mentioned in trait objects. + +trait Foo { + type Bar + where + Self: Sized; + type Bop; +} + +fn foo(_: &dyn Foo) {} +//~^ ERROR the value of the associated type `Bop` (from trait `Foo`) must be specified + +trait Bar { + type Bop; + type Bar + where + Self: Sized; +} + +fn bar(_: &dyn Bar) {} +//~^ ERROR the value of the associated type `Bop` (from trait `Bar`) must be specified + +fn main() {} diff --git a/tests/ui/object-safety/assoc_type_bounds_sized_others.stderr b/tests/ui/object-safety/assoc_type_bounds_sized_others.stderr new file mode 100644 index 00000000000..e4c44334b34 --- /dev/null +++ b/tests/ui/object-safety/assoc_type_bounds_sized_others.stderr @@ -0,0 +1,21 @@ +error[E0191]: the value of the associated type `Bop` (from trait `Foo`) must be specified + --> $DIR/assoc_type_bounds_sized_others.rs:12:16 + | +LL | type Bop; + | -------- `Bop` defined here +... +LL | fn foo(_: &dyn Foo) {} + | ^^^ help: specify the associated type: `Foo<Bop = Type>` + +error[E0191]: the value of the associated type `Bop` (from trait `Bar`) must be specified + --> $DIR/assoc_type_bounds_sized_others.rs:22:16 + | +LL | type Bop; + | -------- `Bop` defined here +... +LL | fn bar(_: &dyn Bar) {} + | ^^^ help: specify the associated type: `Bar<Bop = Type>` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0191`. diff --git a/tests/ui/object-safety/assoc_type_bounds_sized_unnecessary.rs b/tests/ui/object-safety/assoc_type_bounds_sized_unnecessary.rs new file mode 100644 index 00000000000..800624e3124 --- /dev/null +++ b/tests/ui/object-safety/assoc_type_bounds_sized_unnecessary.rs @@ -0,0 +1,17 @@ +// check-pass + +trait Foo { + type Bar + where + Self: Sized; +} + +fn foo(_: &dyn Foo<Bar = ()>) {} +//~^ WARN: unnecessary associated type bound for not object safe associated type +//~| WARN: unnecessary associated type bound for not object safe associated type +//~| WARN: unnecessary associated type bound for not object safe associated type + +#[allow(unused_associated_type_bounds)] +fn bar(_: &dyn Foo<Bar = ()>) {} + +fn main() {} diff --git a/tests/ui/object-safety/assoc_type_bounds_sized_unnecessary.stderr b/tests/ui/object-safety/assoc_type_bounds_sized_unnecessary.stderr new file mode 100644 index 00000000000..d0a4179fe3e --- /dev/null +++ b/tests/ui/object-safety/assoc_type_bounds_sized_unnecessary.stderr @@ -0,0 +1,27 @@ +warning: unnecessary associated type bound for not object safe associated type + --> $DIR/assoc_type_bounds_sized_unnecessary.rs:9:20 + | +LL | fn foo(_: &dyn Foo<Bar = ()>) {} + | ^^^^^^^^ help: remove this bound + | + = note: this associated type has a `where Self: Sized` bound. Thus, while the associated type can be specified, it cannot be used in any way, because trait objects are not `Sized`. + = note: `#[warn(unused_associated_type_bounds)]` on by default + +warning: unnecessary associated type bound for not object safe associated type + --> $DIR/assoc_type_bounds_sized_unnecessary.rs:9:20 + | +LL | fn foo(_: &dyn Foo<Bar = ()>) {} + | ^^^^^^^^ help: remove this bound + | + = note: this associated type has a `where Self: Sized` bound. Thus, while the associated type can be specified, it cannot be used in any way, because trait objects are not `Sized`. + +warning: unnecessary associated type bound for not object safe associated type + --> $DIR/assoc_type_bounds_sized_unnecessary.rs:9:20 + | +LL | fn foo(_: &dyn Foo<Bar = ()>) {} + | ^^^^^^^^ help: remove this bound + | + = note: this associated type has a `where Self: Sized` bound. Thus, while the associated type can be specified, it cannot be used in any way, because trait objects are not `Sized`. + +warning: 3 warnings emitted + diff --git a/tests/ui/object-safety/assoc_type_bounds_sized_used.rs b/tests/ui/object-safety/assoc_type_bounds_sized_used.rs new file mode 100644 index 00000000000..cf5345b1c1d --- /dev/null +++ b/tests/ui/object-safety/assoc_type_bounds_sized_used.rs @@ -0,0 +1,20 @@ +//! This test checks that even if some associated types have +//! `where Self: Sized` bounds, those without still need to be +//! mentioned in trait objects. + +trait Bop { + type Bar: Default + where + Self: Sized; +} + +fn bop<T: Bop + ?Sized>() { + let _ = <T as Bop>::Bar::default(); + //~^ ERROR: trait bounds were not satisfied + //~| ERROR: the size for values of type `T` cannot be known at compilation time +} + +fn main() { + bop::<dyn Bop>(); + //~^ ERROR: the size for values of type `dyn Bop` cannot be known at compilation time +} diff --git a/tests/ui/object-safety/assoc_type_bounds_sized_used.stderr b/tests/ui/object-safety/assoc_type_bounds_sized_used.stderr new file mode 100644 index 00000000000..f8488d842e2 --- /dev/null +++ b/tests/ui/object-safety/assoc_type_bounds_sized_used.stderr @@ -0,0 +1,53 @@ +error[E0599]: the function or associated item `default` exists for associated type `<T as Bop>::Bar`, but its trait bounds were not satisfied + --> $DIR/assoc_type_bounds_sized_used.rs:12:30 + | +LL | let _ = <T as Bop>::Bar::default(); + | ^^^^^^^ function or associated item cannot be called on `<T as Bop>::Bar` due to unsatisfied trait bounds + | + = note: the following trait bounds were not satisfied: + `T: Sized` + which is required by `<T as Bop>::Bar: Default` +help: consider restricting the type parameter to satisfy the trait bound + | +LL | fn bop<T: Bop + ?Sized>() where T: Sized { + | ++++++++++++++ + +error[E0277]: the size for values of type `T` cannot be known at compilation time + --> $DIR/assoc_type_bounds_sized_used.rs:12:13 + | +LL | fn bop<T: Bop + ?Sized>() { + | - this type parameter needs to be `Sized` +LL | let _ = <T as Bop>::Bar::default(); + | ^^^^^^^^^^^^^^^ doesn't have a size known at compile-time + | +note: required by a bound in `Bop::Bar` + --> $DIR/assoc_type_bounds_sized_used.rs:8:15 + | +LL | type Bar: Default + | --- required by a bound in this associated type +LL | where +LL | Self: Sized; + | ^^^^^ required by this bound in `Bop::Bar` +help: consider removing the `?Sized` bound to make the type parameter `Sized` + | +LL - fn bop<T: Bop + ?Sized>() { +LL + fn bop<T: Bop>() { + | + +error[E0277]: the size for values of type `dyn Bop` cannot be known at compilation time + --> $DIR/assoc_type_bounds_sized_used.rs:18:11 + | +LL | bop::<dyn Bop>(); + | ^^^^^^^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `dyn Bop` +note: required by a bound in `bop` + --> $DIR/assoc_type_bounds_sized_used.rs:11:11 + | +LL | fn bop<T: Bop + ?Sized>() { + | ^^^ required by this bound in `bop` + +error: aborting due to 3 previous errors + +Some errors have detailed explanations: E0277, E0599. +For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/parser/issue-113342.rs b/tests/ui/parser/issue-113342.rs new file mode 100644 index 00000000000..18b502736f7 --- /dev/null +++ b/tests/ui/parser/issue-113342.rs @@ -0,0 +1,9 @@ +#[link(name = "my_c_library")] +extern "C" { + fn my_c_function(x: i32) -> bool; +} + +#[no_mangle] +extern "C" pub fn id(x: i32) -> i32 { x } //~ ERROR expected `fn`, found keyword `pub` + +fn main() {} diff --git a/tests/ui/parser/issue-113342.stderr b/tests/ui/parser/issue-113342.stderr new file mode 100644 index 00000000000..a0c5e665ff8 --- /dev/null +++ b/tests/ui/parser/issue-113342.stderr @@ -0,0 +1,11 @@ +error: expected `fn`, found keyword `pub` + --> $DIR/issue-113342.rs:7:12 + | +LL | extern "C" pub fn id(x: i32) -> i32 { x } + | -----------^^^ + | | | + | | expected `fn` + | help: visibility `pub` must come before `extern "C"`: `pub extern "C"` + +error: aborting due to previous error + diff --git a/tests/ui/parser/utf16-be-without-bom.stderr b/tests/ui/parser/utf16-be-without-bom.stderr index 768d2c53164..c041f3ecf53 100644 --- a/tests/ui/parser/utf16-be-without-bom.stderr +++ b/tests/ui/parser/utf16-be-without-bom.stderr Binary files differdiff --git a/tests/ui/parser/utf16-le-without-bom.stderr b/tests/ui/parser/utf16-le-without-bom.stderr index 4f4b91e39ed..cc2220441ac 100644 --- a/tests/ui/parser/utf16-le-without-bom.stderr +++ b/tests/ui/parser/utf16-le-without-bom.stderr Binary files differdiff --git a/tests/ui/pattern/usefulness/empty-match.exhaustive_patterns.stderr b/tests/ui/pattern/usefulness/empty-match.exhaustive_patterns.stderr index 49b6dfca62e..5b81a8c3d3c 100644 --- a/tests/ui/pattern/usefulness/empty-match.exhaustive_patterns.stderr +++ b/tests/ui/pattern/usefulness/empty-match.exhaustive_patterns.stderr @@ -176,6 +176,7 @@ LL | match_guarded_arm!(0u8); | ^^^ pattern `_` not covered | = note: the matched value is of type `u8` + = note: match arms with guards don't count towards exhaustivity help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ _ if false => {}, @@ -183,7 +184,7 @@ LL + _ => todo!() | error[E0004]: non-exhaustive patterns: `NonEmptyStruct1` not covered - --> $DIR/empty-match.rs:133:24 + --> $DIR/empty-match.rs:134:24 | LL | match_guarded_arm!(NonEmptyStruct1); | ^^^^^^^^^^^^^^^ pattern `NonEmptyStruct1` not covered @@ -194,6 +195,7 @@ note: `NonEmptyStruct1` defined here LL | struct NonEmptyStruct1; | ^^^^^^^^^^^^^^^ = note: the matched value is of type `NonEmptyStruct1` + = note: match arms with guards don't count towards exhaustivity help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ _ if false => {}, @@ -201,7 +203,7 @@ LL + NonEmptyStruct1 => todo!() | error[E0004]: non-exhaustive patterns: `NonEmptyStruct2(_)` not covered - --> $DIR/empty-match.rs:137:24 + --> $DIR/empty-match.rs:139:24 | LL | match_guarded_arm!(NonEmptyStruct2(true)); | ^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyStruct2(_)` not covered @@ -212,6 +214,7 @@ note: `NonEmptyStruct2` defined here LL | struct NonEmptyStruct2(bool); | ^^^^^^^^^^^^^^^ = note: the matched value is of type `NonEmptyStruct2` + = note: match arms with guards don't count towards exhaustivity help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ _ if false => {}, @@ -219,7 +222,7 @@ LL + NonEmptyStruct2(_) => todo!() | error[E0004]: non-exhaustive patterns: `NonEmptyUnion1 { .. }` not covered - --> $DIR/empty-match.rs:141:24 + --> $DIR/empty-match.rs:144:24 | LL | match_guarded_arm!((NonEmptyUnion1 { foo: () })); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyUnion1 { .. }` not covered @@ -230,6 +233,7 @@ note: `NonEmptyUnion1` defined here LL | union NonEmptyUnion1 { | ^^^^^^^^^^^^^^ = note: the matched value is of type `NonEmptyUnion1` + = note: match arms with guards don't count towards exhaustivity help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ _ if false => {}, @@ -237,7 +241,7 @@ LL + NonEmptyUnion1 { .. } => todo!() | error[E0004]: non-exhaustive patterns: `NonEmptyUnion2 { .. }` not covered - --> $DIR/empty-match.rs:145:24 + --> $DIR/empty-match.rs:149:24 | LL | match_guarded_arm!((NonEmptyUnion2 { foo: () })); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyUnion2 { .. }` not covered @@ -248,6 +252,7 @@ note: `NonEmptyUnion2` defined here LL | union NonEmptyUnion2 { | ^^^^^^^^^^^^^^ = note: the matched value is of type `NonEmptyUnion2` + = note: match arms with guards don't count towards exhaustivity help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ _ if false => {}, @@ -255,7 +260,7 @@ LL + NonEmptyUnion2 { .. } => todo!() | error[E0004]: non-exhaustive patterns: `NonEmptyEnum1::Foo(_)` not covered - --> $DIR/empty-match.rs:149:24 + --> $DIR/empty-match.rs:154:24 | LL | match_guarded_arm!(NonEmptyEnum1::Foo(true)); | ^^^^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyEnum1::Foo(_)` not covered @@ -268,6 +273,7 @@ LL | enum NonEmptyEnum1 { LL | Foo(bool), | ^^^ not covered = note: the matched value is of type `NonEmptyEnum1` + = note: match arms with guards don't count towards exhaustivity help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ _ if false => {}, @@ -275,7 +281,7 @@ LL + NonEmptyEnum1::Foo(_) => todo!() | error[E0004]: non-exhaustive patterns: `NonEmptyEnum2::Foo(_)` and `NonEmptyEnum2::Bar` not covered - --> $DIR/empty-match.rs:153:24 + --> $DIR/empty-match.rs:159:24 | LL | match_guarded_arm!(NonEmptyEnum2::Foo(true)); | ^^^^^^^^^^^^^^^^^^^^^^^^ patterns `NonEmptyEnum2::Foo(_)` and `NonEmptyEnum2::Bar` not covered @@ -291,6 +297,7 @@ LL | Foo(bool), LL | Bar, | ^^^ not covered = note: the matched value is of type `NonEmptyEnum2` + = note: match arms with guards don't count towards exhaustivity help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | LL ~ _ if false => {}, @@ -298,7 +305,7 @@ LL + NonEmptyEnum2::Foo(_) | NonEmptyEnum2::Bar => todo!() | error[E0004]: non-exhaustive patterns: `NonEmptyEnum5::V1`, `NonEmptyEnum5::V2`, `NonEmptyEnum5::V3` and 2 more not covered - --> $DIR/empty-match.rs:157:24 + --> $DIR/empty-match.rs:164:24 | LL | match_guarded_arm!(NonEmptyEnum5::V1); | ^^^^^^^^^^^^^^^^^ patterns `NonEmptyEnum5::V1`, `NonEmptyEnum5::V2`, `NonEmptyEnum5::V3` and 2 more not covered @@ -309,6 +316,7 @@ note: `NonEmptyEnum5` defined here LL | enum NonEmptyEnum5 { | ^^^^^^^^^^^^^ = note: the matched value is of type `NonEmptyEnum5` + = note: match arms with guards don't count towards exhaustivity help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms | LL ~ _ if false => {}, diff --git a/tests/ui/pattern/usefulness/empty-match.normal.stderr b/tests/ui/pattern/usefulness/empty-match.normal.stderr index f54a3f3364f..6d17455086b 100644 --- a/tests/ui/pattern/usefulness/empty-match.normal.stderr +++ b/tests/ui/pattern/usefulness/empty-match.normal.stderr @@ -175,6 +175,7 @@ LL | match_guarded_arm!(0u8); | ^^^ pattern `_` not covered | = note: the matched value is of type `u8` + = note: match arms with guards don't count towards exhaustivity help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ _ if false => {}, @@ -182,7 +183,7 @@ LL + _ => todo!() | error[E0004]: non-exhaustive patterns: `NonEmptyStruct1` not covered - --> $DIR/empty-match.rs:133:24 + --> $DIR/empty-match.rs:134:24 | LL | match_guarded_arm!(NonEmptyStruct1); | ^^^^^^^^^^^^^^^ pattern `NonEmptyStruct1` not covered @@ -193,6 +194,7 @@ note: `NonEmptyStruct1` defined here LL | struct NonEmptyStruct1; | ^^^^^^^^^^^^^^^ = note: the matched value is of type `NonEmptyStruct1` + = note: match arms with guards don't count towards exhaustivity help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ _ if false => {}, @@ -200,7 +202,7 @@ LL + NonEmptyStruct1 => todo!() | error[E0004]: non-exhaustive patterns: `NonEmptyStruct2(_)` not covered - --> $DIR/empty-match.rs:137:24 + --> $DIR/empty-match.rs:139:24 | LL | match_guarded_arm!(NonEmptyStruct2(true)); | ^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyStruct2(_)` not covered @@ -211,6 +213,7 @@ note: `NonEmptyStruct2` defined here LL | struct NonEmptyStruct2(bool); | ^^^^^^^^^^^^^^^ = note: the matched value is of type `NonEmptyStruct2` + = note: match arms with guards don't count towards exhaustivity help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ _ if false => {}, @@ -218,7 +221,7 @@ LL + NonEmptyStruct2(_) => todo!() | error[E0004]: non-exhaustive patterns: `NonEmptyUnion1 { .. }` not covered - --> $DIR/empty-match.rs:141:24 + --> $DIR/empty-match.rs:144:24 | LL | match_guarded_arm!((NonEmptyUnion1 { foo: () })); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyUnion1 { .. }` not covered @@ -229,6 +232,7 @@ note: `NonEmptyUnion1` defined here LL | union NonEmptyUnion1 { | ^^^^^^^^^^^^^^ = note: the matched value is of type `NonEmptyUnion1` + = note: match arms with guards don't count towards exhaustivity help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ _ if false => {}, @@ -236,7 +240,7 @@ LL + NonEmptyUnion1 { .. } => todo!() | error[E0004]: non-exhaustive patterns: `NonEmptyUnion2 { .. }` not covered - --> $DIR/empty-match.rs:145:24 + --> $DIR/empty-match.rs:149:24 | LL | match_guarded_arm!((NonEmptyUnion2 { foo: () })); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyUnion2 { .. }` not covered @@ -247,6 +251,7 @@ note: `NonEmptyUnion2` defined here LL | union NonEmptyUnion2 { | ^^^^^^^^^^^^^^ = note: the matched value is of type `NonEmptyUnion2` + = note: match arms with guards don't count towards exhaustivity help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ _ if false => {}, @@ -254,7 +259,7 @@ LL + NonEmptyUnion2 { .. } => todo!() | error[E0004]: non-exhaustive patterns: `NonEmptyEnum1::Foo(_)` not covered - --> $DIR/empty-match.rs:149:24 + --> $DIR/empty-match.rs:154:24 | LL | match_guarded_arm!(NonEmptyEnum1::Foo(true)); | ^^^^^^^^^^^^^^^^^^^^^^^^ pattern `NonEmptyEnum1::Foo(_)` not covered @@ -267,6 +272,7 @@ LL | enum NonEmptyEnum1 { LL | Foo(bool), | ^^^ not covered = note: the matched value is of type `NonEmptyEnum1` + = note: match arms with guards don't count towards exhaustivity help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL ~ _ if false => {}, @@ -274,7 +280,7 @@ LL + NonEmptyEnum1::Foo(_) => todo!() | error[E0004]: non-exhaustive patterns: `NonEmptyEnum2::Foo(_)` and `NonEmptyEnum2::Bar` not covered - --> $DIR/empty-match.rs:153:24 + --> $DIR/empty-match.rs:159:24 | LL | match_guarded_arm!(NonEmptyEnum2::Foo(true)); | ^^^^^^^^^^^^^^^^^^^^^^^^ patterns `NonEmptyEnum2::Foo(_)` and `NonEmptyEnum2::Bar` not covered @@ -290,6 +296,7 @@ LL | Foo(bool), LL | Bar, | ^^^ not covered = note: the matched value is of type `NonEmptyEnum2` + = note: match arms with guards don't count towards exhaustivity help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | LL ~ _ if false => {}, @@ -297,7 +304,7 @@ LL + NonEmptyEnum2::Foo(_) | NonEmptyEnum2::Bar => todo!() | error[E0004]: non-exhaustive patterns: `NonEmptyEnum5::V1`, `NonEmptyEnum5::V2`, `NonEmptyEnum5::V3` and 2 more not covered - --> $DIR/empty-match.rs:157:24 + --> $DIR/empty-match.rs:164:24 | LL | match_guarded_arm!(NonEmptyEnum5::V1); | ^^^^^^^^^^^^^^^^^ patterns `NonEmptyEnum5::V1`, `NonEmptyEnum5::V2`, `NonEmptyEnum5::V3` and 2 more not covered @@ -308,6 +315,7 @@ note: `NonEmptyEnum5` defined here LL | enum NonEmptyEnum5 { | ^^^^^^^^^^^^^ = note: the matched value is of type `NonEmptyEnum5` + = note: match arms with guards don't count towards exhaustivity help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms | LL ~ _ if false => {}, diff --git a/tests/ui/pattern/usefulness/empty-match.rs b/tests/ui/pattern/usefulness/empty-match.rs index 062241faa4c..d56d2e3c817 100644 --- a/tests/ui/pattern/usefulness/empty-match.rs +++ b/tests/ui/pattern/usefulness/empty-match.rs @@ -128,34 +128,42 @@ fn main() { match_guarded_arm!(0u8); //~ ERROR `_` not covered //~| NOTE the matched value is of type + //~| NOTE match arms with guards don't count towards exhaustivity //~| NOTE pattern `_` not covered //~| NOTE in this expansion of match_guarded_arm! match_guarded_arm!(NonEmptyStruct1); //~ ERROR `NonEmptyStruct1` not covered //~| NOTE pattern `NonEmptyStruct1` not covered //~| NOTE the matched value is of type + //~| NOTE match arms with guards don't count towards exhaustivity //~| NOTE in this expansion of match_guarded_arm! match_guarded_arm!(NonEmptyStruct2(true)); //~ ERROR `NonEmptyStruct2(_)` not covered //~| NOTE the matched value is of type //~| NOTE pattern `NonEmptyStruct2(_)` not covered + //~| NOTE match arms with guards don't count towards exhaustivity //~| NOTE in this expansion of match_guarded_arm! match_guarded_arm!((NonEmptyUnion1 { foo: () })); //~ ERROR `NonEmptyUnion1 { .. }` not covered //~| NOTE the matched value is of type //~| NOTE pattern `NonEmptyUnion1 { .. }` not covered + //~| NOTE match arms with guards don't count towards exhaustivity //~| NOTE in this expansion of match_guarded_arm! match_guarded_arm!((NonEmptyUnion2 { foo: () })); //~ ERROR `NonEmptyUnion2 { .. }` not covered //~| NOTE the matched value is of type //~| NOTE pattern `NonEmptyUnion2 { .. }` not covered + //~| NOTE match arms with guards don't count towards exhaustivity //~| NOTE in this expansion of match_guarded_arm! match_guarded_arm!(NonEmptyEnum1::Foo(true)); //~ ERROR `NonEmptyEnum1::Foo(_)` not covered //~| NOTE the matched value is of type //~| NOTE pattern `NonEmptyEnum1::Foo(_)` not covered + //~| NOTE match arms with guards don't count towards exhaustivity //~| NOTE in this expansion of match_guarded_arm! match_guarded_arm!(NonEmptyEnum2::Foo(true)); //~ ERROR `NonEmptyEnum2::Foo(_)` and `NonEmptyEnum2::Bar` not covered //~| NOTE the matched value is of type //~| NOTE patterns `NonEmptyEnum2::Foo(_)` and + //~| NOTE match arms with guards don't count towards exhaustivity //~| NOTE in this expansion of match_guarded_arm! match_guarded_arm!(NonEmptyEnum5::V1); //~ ERROR `NonEmptyEnum5::V1`, `NonEmptyEnum5::V2`, `NonEmptyEnum5::V3` and 2 more not covered //~| NOTE the matched value is of type //~| NOTE patterns `NonEmptyEnum5::V1`, + //~| NOTE match arms with guards don't count towards exhaustivity //~| NOTE in this expansion of match_guarded_arm! } diff --git a/tests/ui/pattern/usefulness/issue-3601.rs b/tests/ui/pattern/usefulness/issue-3601.rs index 6215a23980d..a6d2b11f4ee 100644 --- a/tests/ui/pattern/usefulness/issue-3601.rs +++ b/tests/ui/pattern/usefulness/issue-3601.rs @@ -1,19 +1,19 @@ #![feature(box_patterns)] struct HTMLImageData { - image: Option<String> + image: Option<String>, } struct ElementData { - kind: Box<ElementKind> + kind: Box<ElementKind>, } enum ElementKind { - HTMLImageElement(HTMLImageData) + HTMLImageElement(HTMLImageData), } enum NodeKind { - Element(ElementData) + Element(ElementData), } struct NodeData { @@ -27,8 +27,13 @@ fn main() { // n.b. span could be better match n.kind { - box NodeKind::Element(ed) => match ed.kind { //~ ERROR non-exhaustive patterns - box ElementKind::HTMLImageElement(ref d) if d.image.is_some() => { true } + box NodeKind::Element(ed) => match ed.kind { + //~^ ERROR non-exhaustive patterns + //~| NOTE the matched value is of type + //~| NOTE match arms with guards don't count towards exhaustivity + //~| NOTE pattern `box _` not covered + //~| NOTE `Box<ElementKind>` defined here + box ElementKind::HTMLImageElement(ref d) if d.image.is_some() => true, }, }; } diff --git a/tests/ui/pattern/usefulness/issue-3601.stderr b/tests/ui/pattern/usefulness/issue-3601.stderr index 2f6b167d4f8..b8c98743101 100644 --- a/tests/ui/pattern/usefulness/issue-3601.stderr +++ b/tests/ui/pattern/usefulness/issue-3601.stderr @@ -7,10 +7,11 @@ LL | box NodeKind::Element(ed) => match ed.kind { note: `Box<ElementKind>` defined here --> $SRC_DIR/alloc/src/boxed.rs:LL:COL = note: the matched value is of type `Box<ElementKind>` + = note: match arms with guards don't count towards exhaustivity help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ box ElementKind::HTMLImageElement(ref d) if d.image.is_some() => { true }, -LL + box _ => todo!() +LL ~ box ElementKind::HTMLImageElement(ref d) if d.image.is_some() => true, +LL ~ box _ => todo!(), | error: aborting due to previous error diff --git a/tests/ui/pattern/usefulness/match-non-exhaustive.rs b/tests/ui/pattern/usefulness/match-non-exhaustive.rs index 3b210a115d2..62c185d04b3 100644 --- a/tests/ui/pattern/usefulness/match-non-exhaustive.rs +++ b/tests/ui/pattern/usefulness/match-non-exhaustive.rs @@ -1,4 +1,5 @@ fn main() { match 0 { 1 => () } //~ ERROR non-exhaustive patterns match 0 { 0 if false => () } //~ ERROR non-exhaustive patterns + //-| NOTE match arms with guards don't count towards exhaustivity } diff --git a/tests/ui/pattern/usefulness/match-non-exhaustive.stderr b/tests/ui/pattern/usefulness/match-non-exhaustive.stderr index 08dde523a15..4fa3a729212 100644 --- a/tests/ui/pattern/usefulness/match-non-exhaustive.stderr +++ b/tests/ui/pattern/usefulness/match-non-exhaustive.stderr @@ -17,6 +17,7 @@ LL | match 0 { 0 if false => () } | ^ pattern `_` not covered | = note: the matched value is of type `i32` + = note: match arms with guards don't count towards exhaustivity help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | LL | match 0 { 0 if false => (), _ => todo!() } diff --git a/tests/ui/privacy/effective_visibilities_full_priv.rs b/tests/ui/privacy/effective_visibilities_full_priv.rs index cc708917586..a26ae3bd122 100644 --- a/tests/ui/privacy/effective_visibilities_full_priv.rs +++ b/tests/ui/privacy/effective_visibilities_full_priv.rs @@ -6,7 +6,7 @@ struct SemiPriv; mod m { #[rustc_effective_visibility] struct Priv; - //~^ ERROR Direct: pub(self), Reexported: pub(self), Reachable: pub(crate), ReachableThroughImplTrait: pub(crate) + //~^ ERROR not in the table //~| ERROR not in the table #[rustc_effective_visibility] diff --git a/tests/ui/privacy/effective_visibilities_full_priv.stderr b/tests/ui/privacy/effective_visibilities_full_priv.stderr index a856aa20d92..29d82e2ee01 100644 --- a/tests/ui/privacy/effective_visibilities_full_priv.stderr +++ b/tests/ui/privacy/effective_visibilities_full_priv.stderr @@ -1,4 +1,4 @@ -error: Direct: pub(self), Reexported: pub(self), Reachable: pub(crate), ReachableThroughImplTrait: pub(crate) +error: not in the table --> $DIR/effective_visibilities_full_priv.rs:8:5 | LL | struct Priv; diff --git a/tests/ui/privacy/private-in-public-non-principal.rs b/tests/ui/privacy/private-in-public-non-principal.rs index a80c1541463..a2284c93027 100644 --- a/tests/ui/privacy/private-in-public-non-principal.rs +++ b/tests/ui/privacy/private-in-public-non-principal.rs @@ -1,6 +1,6 @@ #![feature(auto_traits)] #![feature(negative_impls)] - +#![feature(type_privacy_lints)] #![deny(private_interfaces)] // In this test both old and new private-in-public diagnostic were emitted. @@ -13,6 +13,7 @@ auto trait PrivNonPrincipal {} pub fn leak_dyn_nonprincipal() -> Box<dyn PubPrincipal + PrivNonPrincipal> { loop {} } //~^ WARN private trait `PrivNonPrincipal` in public interface //~| WARN this was previously accepted +//~| ERROR trait `PrivNonPrincipal` is more private than the item `leak_dyn_nonprincipal` #[deny(missing_docs)] fn container() { diff --git a/tests/ui/privacy/private-in-public-non-principal.stderr b/tests/ui/privacy/private-in-public-non-principal.stderr index 9fc12affe4b..1387f59cbde 100644 --- a/tests/ui/privacy/private-in-public-non-principal.stderr +++ b/tests/ui/privacy/private-in-public-non-principal.stderr @@ -9,12 +9,11 @@ LL | pub fn leak_dyn_nonprincipal() -> Box<dyn PubPrincipal + PrivNonPrincipal> = note: `#[warn(private_in_public)]` on by default error: trait `PrivNonPrincipal` is more private than the item `leak_dyn_nonprincipal` - | -note: function `leak_dyn_nonprincipal` is reachable at visibility `pub` --> $DIR/private-in-public-non-principal.rs:13:1 | LL | pub fn leak_dyn_nonprincipal() -> Box<dyn PubPrincipal + PrivNonPrincipal> { loop {} } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function `leak_dyn_nonprincipal` is reachable at visibility `pub` + | note: but trait `PrivNonPrincipal` is only usable at visibility `pub(crate)` --> $DIR/private-in-public-non-principal.rs:11:1 | @@ -27,13 +26,13 @@ LL | #![deny(private_interfaces)] | ^^^^^^^^^^^^^^^^^^ error: missing documentation for an associated function - --> $DIR/private-in-public-non-principal.rs:20:9 + --> $DIR/private-in-public-non-principal.rs:21:9 | LL | pub fn check_doc_lint() {} | ^^^^^^^^^^^^^^^^^^^^^^^ | note: the lint level is defined here - --> $DIR/private-in-public-non-principal.rs:17:8 + --> $DIR/private-in-public-non-principal.rs:18:8 | LL | #[deny(missing_docs)] | ^^^^^^^^^^^^ diff --git a/tests/ui/privacy/unnameable_types.rs b/tests/ui/privacy/unnameable_types.rs index 8b53f372fc9..eae20dd9df3 100644 --- a/tests/ui/privacy/unnameable_types.rs +++ b/tests/ui/privacy/unnameable_types.rs @@ -1,4 +1,4 @@ -#![allow(unused)] +#![feature(type_privacy_lints)] #![allow(private_in_public)] #![deny(unnameable_types)] diff --git a/tests/ui/privacy/where-priv-type.rs b/tests/ui/privacy/where-priv-type.rs index 9899902dd88..2e0a6b3e72c 100644 --- a/tests/ui/privacy/where-priv-type.rs +++ b/tests/ui/privacy/where-priv-type.rs @@ -3,8 +3,8 @@ #![crate_type = "lib"] #![feature(generic_const_exprs)] +#![feature(type_privacy_lints)] #![allow(incomplete_features)] - #![warn(private_bounds)] #![warn(private_interfaces)] @@ -25,6 +25,7 @@ impl PubTrWithAssocTy for PrivTy { type AssocTy = PrivTy; } pub struct S //~^ WARNING private type `PrivTy` in public interface //~| WARNING hard error +//~| WARNING type `PrivTy` is more private than the item `S` where PrivTy: {} @@ -33,6 +34,7 @@ where pub enum E //~^ WARNING private type `PrivTy` in public interface //~| WARNING hard error +//~| WARNING type `PrivTy` is more private than the item `E` where PrivTy: {} @@ -41,6 +43,7 @@ where pub fn f() //~^ WARNING private type `PrivTy` in public interface //~| WARNING hard error +//~| WARNING type `PrivTy` is more private than the item `f` where PrivTy: {} @@ -48,12 +51,14 @@ where impl S //~^ ERROR private type `PrivTy` in public interface +//~| WARNING type `PrivTy` is more private than the item `S` where PrivTy: { pub fn f() //~^ WARNING private type `PrivTy` in public interface //~| WARNING hard error + //~| WARNING type `PrivTy` is more private than the item `S::f` where PrivTy: {} @@ -85,6 +90,7 @@ where { type AssocTy = Const<{ my_const_fn(U) }>; //~^ ERROR private type + //~| WARNING type `fn(u8) -> u8 {my_const_fn}` is more private than the item `<Const<U> as Trait>::AssocTy` fn assoc_fn() -> Self::AssocTy { Const } diff --git a/tests/ui/privacy/where-priv-type.stderr b/tests/ui/privacy/where-priv-type.stderr index 2830fa6cd44..d6baf22b3fb 100644 --- a/tests/ui/privacy/where-priv-type.stderr +++ b/tests/ui/privacy/where-priv-type.stderr @@ -9,12 +9,11 @@ LL | pub struct S = note: `#[warn(private_in_public)]` on by default warning: type `PrivTy` is more private than the item `S` - | -note: struct `S` is reachable at visibility `pub` --> $DIR/where-priv-type.rs:25:1 | LL | pub struct S - | ^^^^^^^^^^^^ + | ^^^^^^^^^^^^ struct `S` is reachable at visibility `pub` + | note: but type `PrivTy` is only usable at visibility `pub(crate)` --> $DIR/where-priv-type.rs:15:1 | @@ -27,7 +26,7 @@ LL | #![warn(private_bounds)] | ^^^^^^^^^^^^^^ warning: private type `PrivTy` in public interface (error E0446) - --> $DIR/where-priv-type.rs:33:1 + --> $DIR/where-priv-type.rs:34:1 | LL | pub enum E | ^^^^^^^^^^ @@ -36,12 +35,11 @@ LL | pub enum E = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537> warning: type `PrivTy` is more private than the item `E` - | -note: enum `E` is reachable at visibility `pub` - --> $DIR/where-priv-type.rs:33:1 + --> $DIR/where-priv-type.rs:34:1 | LL | pub enum E - | ^^^^^^^^^^ + | ^^^^^^^^^^ enum `E` is reachable at visibility `pub` + | note: but type `PrivTy` is only usable at visibility `pub(crate)` --> $DIR/where-priv-type.rs:15:1 | @@ -49,11 +47,12 @@ LL | struct PrivTy; | ^^^^^^^^^^^^^ warning: private type `PrivTy` in public interface (error E0446) - --> $DIR/where-priv-type.rs:41:1 + --> $DIR/where-priv-type.rs:43:1 | LL | / pub fn f() LL | | LL | | +LL | | LL | | where LL | | PrivTy: | |___________^ @@ -62,16 +61,16 @@ LL | | PrivTy: = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537> warning: type `PrivTy` is more private than the item `f` - | -note: function `f` is reachable at visibility `pub` - --> $DIR/where-priv-type.rs:41:1 + --> $DIR/where-priv-type.rs:43:1 | LL | / pub fn f() LL | | LL | | +LL | | LL | | where LL | | PrivTy: - | |___________^ + | |___________^ function `f` is reachable at visibility `pub` + | note: but type `PrivTy` is only usable at visibility `pub(crate)` --> $DIR/where-priv-type.rs:15:1 | @@ -79,7 +78,7 @@ LL | struct PrivTy; | ^^^^^^^^^^^^^ error[E0446]: private type `PrivTy` in public interface - --> $DIR/where-priv-type.rs:49:1 + --> $DIR/where-priv-type.rs:52:1 | LL | struct PrivTy; | ------------- `PrivTy` declared as private @@ -88,12 +87,11 @@ LL | impl S | ^^^^^^ can't leak private type warning: type `PrivTy` is more private than the item `S` - | -note: implementation `S` is reachable at visibility `pub` - --> $DIR/where-priv-type.rs:49:1 + --> $DIR/where-priv-type.rs:52:1 | LL | impl S - | ^^^^^^ + | ^^^^^^ implementation `S` is reachable at visibility `pub` + | note: but type `PrivTy` is only usable at visibility `pub(crate)` --> $DIR/where-priv-type.rs:15:1 | @@ -101,11 +99,12 @@ LL | struct PrivTy; | ^^^^^^^^^^^^^ warning: private type `PrivTy` in public interface (error E0446) - --> $DIR/where-priv-type.rs:54:5 + --> $DIR/where-priv-type.rs:58:5 | LL | / pub fn f() LL | | LL | | +LL | | LL | | where LL | | PrivTy: | |_______________^ @@ -114,16 +113,16 @@ LL | | PrivTy: = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537> warning: type `PrivTy` is more private than the item `S::f` - | -note: associated function `S::f` is reachable at visibility `pub` - --> $DIR/where-priv-type.rs:54:5 + --> $DIR/where-priv-type.rs:58:5 | LL | / pub fn f() LL | | LL | | +LL | | LL | | where LL | | PrivTy: - | |_______________^ + | |_______________^ associated function `S::f` is reachable at visibility `pub` + | note: but type `PrivTy` is only usable at visibility `pub(crate)` --> $DIR/where-priv-type.rs:15:1 | @@ -131,7 +130,7 @@ LL | struct PrivTy; | ^^^^^^^^^^^^^ error[E0446]: private type `fn(u8) -> u8 {my_const_fn}` in public interface - --> $DIR/where-priv-type.rs:86:5 + --> $DIR/where-priv-type.rs:91:5 | LL | type AssocTy = Const<{ my_const_fn(U) }>; | ^^^^^^^^^^^^ can't leak private type @@ -140,14 +139,13 @@ LL | const fn my_const_fn(val: u8) -> u8 { | ----------------------------------- `fn(u8) -> u8 {my_const_fn}` declared as private warning: type `fn(u8) -> u8 {my_const_fn}` is more private than the item `<Const<U> as Trait>::AssocTy` - | -note: associated type `<Const<U> as Trait>::AssocTy` is reachable at visibility `pub` - --> $DIR/where-priv-type.rs:86:5 + --> $DIR/where-priv-type.rs:91:5 | LL | type AssocTy = Const<{ my_const_fn(U) }>; - | ^^^^^^^^^^^^ + | ^^^^^^^^^^^^ associated type `<Const<U> as Trait>::AssocTy` is reachable at visibility `pub` + | note: but type `fn(u8) -> u8 {my_const_fn}` is only usable at visibility `pub(crate)` - --> $DIR/where-priv-type.rs:93:1 + --> $DIR/where-priv-type.rs:99:1 | LL | const fn my_const_fn(val: u8) -> u8 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/privacy/where-pub-type-impls-priv-trait.rs b/tests/ui/privacy/where-pub-type-impls-priv-trait.rs index 3aad893eae2..c59fdb7c7a9 100644 --- a/tests/ui/privacy/where-pub-type-impls-priv-trait.rs +++ b/tests/ui/privacy/where-pub-type-impls-priv-trait.rs @@ -2,8 +2,8 @@ #![crate_type = "lib"] #![feature(generic_const_exprs)] +#![feature(type_privacy_lints)] #![allow(incomplete_features)] - #![warn(private_bounds)] // In this test both old and new private-in-public diagnostic were emitted. @@ -23,6 +23,7 @@ impl PubTrWithAssocTy for PrivTy { type AssocTy = PrivTy; } pub struct S //~^ ERROR private trait `PrivTr` in public interface +//~| WARNING trait `PrivTr` is more private than the item `S` where PubTy: PrivTr {} @@ -30,6 +31,7 @@ where pub enum E //~^ ERROR private trait `PrivTr` in public interface +//~| WARNING trait `PrivTr` is more private than the item `E` where PubTy: PrivTr {} @@ -37,6 +39,7 @@ where pub fn f() //~^ ERROR private trait `PrivTr` in public interface +//~| WARNING trait `PrivTr` is more private than the item `f` where PubTy: PrivTr {} @@ -44,11 +47,13 @@ where impl S //~^ ERROR private trait `PrivTr` in public interface +//~| WARNING trait `PrivTr` is more private than the item `S` where PubTy: PrivTr { pub fn f() //~^ ERROR private trait `PrivTr` in public interface + //~| WARNING trait `PrivTr` is more private than the item `S::f` where PubTy: PrivTr {} diff --git a/tests/ui/privacy/where-pub-type-impls-priv-trait.stderr b/tests/ui/privacy/where-pub-type-impls-priv-trait.stderr index 413f7f781cd..e2d7ce44692 100644 --- a/tests/ui/privacy/where-pub-type-impls-priv-trait.stderr +++ b/tests/ui/privacy/where-pub-type-impls-priv-trait.stderr @@ -8,12 +8,11 @@ LL | pub struct S | ^^^^^^^^^^^^ can't leak private trait warning: trait `PrivTr` is more private than the item `S` - | -note: struct `S` is reachable at visibility `pub` --> $DIR/where-pub-type-impls-priv-trait.rs:24:1 | LL | pub struct S - | ^^^^^^^^^^^^ + | ^^^^^^^^^^^^ struct `S` is reachable at visibility `pub` + | note: but trait `PrivTr` is only usable at visibility `pub(crate)` --> $DIR/where-pub-type-impls-priv-trait.rs:14:1 | @@ -26,7 +25,7 @@ LL | #![warn(private_bounds)] | ^^^^^^^^^^^^^^ error[E0445]: private trait `PrivTr` in public interface - --> $DIR/where-pub-type-impls-priv-trait.rs:31:1 + --> $DIR/where-pub-type-impls-priv-trait.rs:32:1 | LL | trait PrivTr {} | ------------ `PrivTr` declared as private @@ -35,12 +34,11 @@ LL | pub enum E | ^^^^^^^^^^ can't leak private trait warning: trait `PrivTr` is more private than the item `E` - | -note: enum `E` is reachable at visibility `pub` - --> $DIR/where-pub-type-impls-priv-trait.rs:31:1 + --> $DIR/where-pub-type-impls-priv-trait.rs:32:1 | LL | pub enum E - | ^^^^^^^^^^ + | ^^^^^^^^^^ enum `E` is reachable at visibility `pub` + | note: but trait `PrivTr` is only usable at visibility `pub(crate)` --> $DIR/where-pub-type-impls-priv-trait.rs:14:1 | @@ -48,27 +46,28 @@ LL | trait PrivTr {} | ^^^^^^^^^^^^ error[E0445]: private trait `PrivTr` in public interface - --> $DIR/where-pub-type-impls-priv-trait.rs:38:1 + --> $DIR/where-pub-type-impls-priv-trait.rs:40:1 | LL | trait PrivTr {} | ------------ `PrivTr` declared as private ... LL | / pub fn f() LL | | +LL | | LL | | where LL | | PubTy: PrivTr | |_________________^ can't leak private trait warning: trait `PrivTr` is more private than the item `f` - | -note: function `f` is reachable at visibility `pub` - --> $DIR/where-pub-type-impls-priv-trait.rs:38:1 + --> $DIR/where-pub-type-impls-priv-trait.rs:40:1 | LL | / pub fn f() LL | | +LL | | LL | | where LL | | PubTy: PrivTr - | |_________________^ + | |_________________^ function `f` is reachable at visibility `pub` + | note: but trait `PrivTr` is only usable at visibility `pub(crate)` --> $DIR/where-pub-type-impls-priv-trait.rs:14:1 | @@ -76,7 +75,7 @@ LL | trait PrivTr {} | ^^^^^^^^^^^^ error[E0445]: private trait `PrivTr` in public interface - --> $DIR/where-pub-type-impls-priv-trait.rs:45:1 + --> $DIR/where-pub-type-impls-priv-trait.rs:48:1 | LL | trait PrivTr {} | ------------ `PrivTr` declared as private @@ -85,12 +84,11 @@ LL | impl S | ^^^^^^ can't leak private trait warning: trait `PrivTr` is more private than the item `S` - | -note: implementation `S` is reachable at visibility `pub` - --> $DIR/where-pub-type-impls-priv-trait.rs:45:1 + --> $DIR/where-pub-type-impls-priv-trait.rs:48:1 | LL | impl S - | ^^^^^^ + | ^^^^^^ implementation `S` is reachable at visibility `pub` + | note: but trait `PrivTr` is only usable at visibility `pub(crate)` --> $DIR/where-pub-type-impls-priv-trait.rs:14:1 | @@ -98,27 +96,28 @@ LL | trait PrivTr {} | ^^^^^^^^^^^^ error[E0445]: private trait `PrivTr` in public interface - --> $DIR/where-pub-type-impls-priv-trait.rs:50:5 + --> $DIR/where-pub-type-impls-priv-trait.rs:54:5 | LL | trait PrivTr {} | ------------ `PrivTr` declared as private ... LL | / pub fn f() LL | | +LL | | LL | | where LL | | PubTy: PrivTr | |_____________________^ can't leak private trait warning: trait `PrivTr` is more private than the item `S::f` - | -note: associated function `S::f` is reachable at visibility `pub` - --> $DIR/where-pub-type-impls-priv-trait.rs:50:5 + --> $DIR/where-pub-type-impls-priv-trait.rs:54:5 | LL | / pub fn f() LL | | +LL | | LL | | where LL | | PubTy: PrivTr - | |_____________________^ + | |_____________________^ associated function `S::f` is reachable at visibility `pub` + | note: but trait `PrivTr` is only usable at visibility `pub(crate)` --> $DIR/where-pub-type-impls-priv-trait.rs:14:1 | diff --git a/tests/ui/proc-macro/auxiliary/api/cmp.rs b/tests/ui/proc-macro/auxiliary/api/cmp.rs index 5784a6e5d94..ec3e637acab 100644 --- a/tests/ui/proc-macro/auxiliary/api/cmp.rs +++ b/tests/ui/proc-macro/auxiliary/api/cmp.rs @@ -1,18 +1,9 @@ -use proc_macro::{LineColumn, Punct, Spacing}; +use proc_macro::{Punct, Spacing}; pub fn test() { - test_line_column_ord(); test_punct_eq(); } -fn test_line_column_ord() { - let line0_column0 = LineColumn { line: 0, column: 0 }; - let line0_column1 = LineColumn { line: 0, column: 1 }; - let line1_column0 = LineColumn { line: 1, column: 0 }; - assert!(line0_column0 < line0_column1); - assert!(line0_column1 < line1_column0); -} - fn test_punct_eq() { let colon_alone = Punct::new(':', Spacing::Alone); assert_eq!(colon_alone, ':'); diff --git a/tests/ui/proc-macro/auxiliary/assert-span-pos.rs b/tests/ui/proc-macro/auxiliary/assert-span-pos.rs index 455c5c7c380..8126470ece9 100644 --- a/tests/ui/proc-macro/auxiliary/assert-span-pos.rs +++ b/tests/ui/proc-macro/auxiliary/assert-span-pos.rs @@ -26,10 +26,9 @@ pub fn assert_span_pos(input: TokenStream) -> TokenStream { let line: usize = str1.parse().unwrap(); let col: usize = str2.parse().unwrap(); - let sp1s = sp1.start(); - if (line, col) != (sp1s.line, sp1s.column) { + if (line, col) != (sp1.line(), sp1.column()) { let msg = format!("line/column mismatch: ({}, {}) != ({}, {})", line, col, - sp1s.line, sp1s.column); + sp1.line(), sp1.column()); sp1.error(msg).emit(); } diff --git a/tests/ui/proc-macro/auxiliary/macro-only-syntax.rs b/tests/ui/proc-macro/auxiliary/macro-only-syntax.rs index c72306c3d50..4ca3a0faa27 100644 --- a/tests/ui/proc-macro/auxiliary/macro-only-syntax.rs +++ b/tests/ui/proc-macro/auxiliary/macro-only-syntax.rs @@ -81,7 +81,7 @@ fn expect_brace(tokens: &mut token_stream::IntoIter) -> token_stream::IntoIter { fn check_useful_span(token: TokenTree, expected_filename: &str) { let span = token.span(); - assert!(span.start().column < span.end().column); + assert!(span.column() < span.end().column()); let source_path = span.source_file().path(); let filename = source_path.components().last().unwrap(); diff --git a/tests/ui/proc-macro/crt-static.rs b/tests/ui/proc-macro/crt-static.rs index 020128fa214..78592f82709 100644 --- a/tests/ui/proc-macro/crt-static.rs +++ b/tests/ui/proc-macro/crt-static.rs @@ -7,6 +7,7 @@ // build-pass // force-host // no-prefer-dynamic +// needs-dynamic-linking #![crate_type = "proc-macro"] diff --git a/tests/ui/proc-macro/derive-helper-shadowing.rs b/tests/ui/proc-macro/derive-helper-shadowing.rs index 80d982d2504..4f25b4b0dca 100644 --- a/tests/ui/proc-macro/derive-helper-shadowing.rs +++ b/tests/ui/proc-macro/derive-helper-shadowing.rs @@ -23,7 +23,7 @@ macro_rules! gen_helper_use { struct S { #[empty_helper] // OK, no ambiguity, derive helpers have highest priority field: [u8; { - use empty_helper; //~ ERROR `empty_helper` is ambiguous + use empty_helper; // OK, no ambiguity, derive helpers have highest priority #[empty_helper] // OK, no ambiguity, derive helpers have highest priority struct U; diff --git a/tests/ui/proc-macro/derive-helper-shadowing.stderr b/tests/ui/proc-macro/derive-helper-shadowing.stderr index 566c4130846..f284b1c54dd 100644 --- a/tests/ui/proc-macro/derive-helper-shadowing.stderr +++ b/tests/ui/proc-macro/derive-helper-shadowing.stderr @@ -38,25 +38,6 @@ LL + use crate::empty_helper; | error[E0659]: `empty_helper` is ambiguous - --> $DIR/derive-helper-shadowing.rs:26:13 - | -LL | use empty_helper; - | ^^^^^^^^^^^^ ambiguous name - | - = note: ambiguous because of multiple potential import sources -note: `empty_helper` could refer to the derive helper attribute defined here - --> $DIR/derive-helper-shadowing.rs:22:10 - | -LL | #[derive(Empty)] - | ^^^^^ -note: `empty_helper` could also refer to the attribute macro imported here - --> $DIR/derive-helper-shadowing.rs:10:5 - | -LL | use test_macros::empty_attr as empty_helper; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = help: use `crate::empty_helper` to refer to this attribute macro unambiguously - -error[E0659]: `empty_helper` is ambiguous --> $DIR/derive-helper-shadowing.rs:19:3 | LL | #[empty_helper] @@ -88,6 +69,6 @@ LL | #[derive(Empty)] = note: for more information, see issue #79202 <https://github.com/rust-lang/rust/issues/79202> = note: `#[warn(legacy_derive_helpers)]` on by default -error: aborting due to 5 previous errors; 1 warning emitted +error: aborting due to 4 previous errors; 1 warning emitted For more information about this error, try `rustc --explain E0659`. diff --git a/tests/ui/pub/issue-33174-restricted-type-in-public-interface.rs b/tests/ui/pub/issue-33174-restricted-type-in-public-interface.rs index 9e4ba80a784..cdeea6224b2 100644 --- a/tests/ui/pub/issue-33174-restricted-type-in-public-interface.rs +++ b/tests/ui/pub/issue-33174-restricted-type-in-public-interface.rs @@ -1,3 +1,4 @@ +#![feature(type_privacy_lints)] #![allow(non_camel_case_types)] // genus is always capitalized #![warn(private_interfaces)] //~^ NOTE the lint level is defined here @@ -26,14 +27,17 @@ pub struct Shell<T> { pub type Helix_pomatia = Shell<Snail>; //~^ ERROR private type `Snail` in public interface +//~| WARNING type `Snail` is more private than the item `Helix_pomatia` //~| NOTE can't leak private type //~| NOTE type alias `Helix_pomatia` is reachable at visibility `pub` pub type Dermochelys_coriacea = Shell<sea::Turtle>; //~^ ERROR crate-private type `Turtle` in public interface +//~| WARNING type `Turtle` is more private than the item `Dermochelys_coriacea` //~| NOTE can't leak crate-private type //~| NOTE type alias `Dermochelys_coriacea` is reachable at visibility `pub` pub type Testudo_graeca = Shell<Tortoise>; //~^ ERROR private type `Tortoise` in public interface +//~| WARNING type `Tortoise` is more private than the item `Testudo_graeca` //~| NOTE can't leak private type //~| NOTE type alias `Testudo_graeca` is reachable at visibility `pub` diff --git a/tests/ui/pub/issue-33174-restricted-type-in-public-interface.stderr b/tests/ui/pub/issue-33174-restricted-type-in-public-interface.stderr index 52f67d4cdd5..20e51e1901f 100644 --- a/tests/ui/pub/issue-33174-restricted-type-in-public-interface.stderr +++ b/tests/ui/pub/issue-33174-restricted-type-in-public-interface.stderr @@ -1,5 +1,5 @@ error[E0446]: private type `Snail` in public interface - --> $DIR/issue-33174-restricted-type-in-public-interface.rs:27:1 + --> $DIR/issue-33174-restricted-type-in-public-interface.rs:28:1 | LL | pub(crate) struct Snail; | ----------------------- `Snail` declared as private @@ -8,25 +8,24 @@ LL | pub type Helix_pomatia = Shell<Snail>; | ^^^^^^^^^^^^^^^^^^^^^^ can't leak private type warning: type `Snail` is more private than the item `Helix_pomatia` - | -note: type alias `Helix_pomatia` is reachable at visibility `pub` - --> $DIR/issue-33174-restricted-type-in-public-interface.rs:27:1 + --> $DIR/issue-33174-restricted-type-in-public-interface.rs:28:1 | LL | pub type Helix_pomatia = Shell<Snail>; - | ^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^ type alias `Helix_pomatia` is reachable at visibility `pub` + | note: but type `Snail` is only usable at visibility `pub(crate)` - --> $DIR/issue-33174-restricted-type-in-public-interface.rs:9:1 + --> $DIR/issue-33174-restricted-type-in-public-interface.rs:10:1 | LL | pub(crate) struct Snail; | ^^^^^^^^^^^^^^^^^^^^^^^ note: the lint level is defined here - --> $DIR/issue-33174-restricted-type-in-public-interface.rs:2:9 + --> $DIR/issue-33174-restricted-type-in-public-interface.rs:3:9 | LL | #![warn(private_interfaces)] | ^^^^^^^^^^^^^^^^^^ error[E0446]: crate-private type `Turtle` in public interface - --> $DIR/issue-33174-restricted-type-in-public-interface.rs:31:1 + --> $DIR/issue-33174-restricted-type-in-public-interface.rs:33:1 | LL | pub(super) struct Turtle; | ------------------------ `Turtle` declared as crate-private @@ -35,20 +34,19 @@ LL | pub type Dermochelys_coriacea = Shell<sea::Turtle>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak crate-private type warning: type `Turtle` is more private than the item `Dermochelys_coriacea` - | -note: type alias `Dermochelys_coriacea` is reachable at visibility `pub` - --> $DIR/issue-33174-restricted-type-in-public-interface.rs:31:1 + --> $DIR/issue-33174-restricted-type-in-public-interface.rs:33:1 | LL | pub type Dermochelys_coriacea = Shell<sea::Turtle>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type alias `Dermochelys_coriacea` is reachable at visibility `pub` + | note: but type `Turtle` is only usable at visibility `pub(crate)` - --> $DIR/issue-33174-restricted-type-in-public-interface.rs:14:5 + --> $DIR/issue-33174-restricted-type-in-public-interface.rs:15:5 | LL | pub(super) struct Turtle; | ^^^^^^^^^^^^^^^^^^^^^^^^ error[E0446]: private type `Tortoise` in public interface - --> $DIR/issue-33174-restricted-type-in-public-interface.rs:35:1 + --> $DIR/issue-33174-restricted-type-in-public-interface.rs:38:1 | LL | struct Tortoise; | --------------- `Tortoise` declared as private @@ -57,14 +55,13 @@ LL | pub type Testudo_graeca = Shell<Tortoise>; | ^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type warning: type `Tortoise` is more private than the item `Testudo_graeca` - | -note: type alias `Testudo_graeca` is reachable at visibility `pub` - --> $DIR/issue-33174-restricted-type-in-public-interface.rs:35:1 + --> $DIR/issue-33174-restricted-type-in-public-interface.rs:38:1 | LL | pub type Testudo_graeca = Shell<Tortoise>; - | ^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^ type alias `Testudo_graeca` is reachable at visibility `pub` + | note: but type `Tortoise` is only usable at visibility `pub(crate)` - --> $DIR/issue-33174-restricted-type-in-public-interface.rs:19:1 + --> $DIR/issue-33174-restricted-type-in-public-interface.rs:20:1 | LL | struct Tortoise; | ^^^^^^^^^^^^^^^ diff --git a/tests/ui/recursion/issue-95134.rs b/tests/ui/recursion/issue-95134.rs index 2f1cffa2fa9..7ee31d85c2b 100644 --- a/tests/ui/recursion/issue-95134.rs +++ b/tests/ui/recursion/issue-95134.rs @@ -3,6 +3,7 @@ // compile-flags: -Copt-level=0 // dont-check-failure-status // dont-check-compiler-stderr +// ignore-compare-mode-next-solver (hangs) pub fn encode_num<Writer: ExampleWriter>(n: u32, mut writer: Writer) -> Result<(), Writer::Error> { if n > 15 { diff --git a/tests/ui/regions/regions-implied-bounds-projection-gap-hr-1.rs b/tests/ui/regions/regions-implied-bounds-projection-gap-hr-1.rs index 1106352037a..429548f119b 100644 --- a/tests/ui/regions/regions-implied-bounds-projection-gap-hr-1.rs +++ b/tests/ui/regions/regions-implied-bounds-projection-gap-hr-1.rs @@ -20,7 +20,6 @@ trait Trait2<'a, 'b> { // do not infer that. fn callee<'x, 'y, T>(t: &'x dyn for<'z> Trait1< <T as Trait2<'y, 'z>>::Foo >) //~^ ERROR the trait bound `for<'z> T: Trait2<'y, 'z>` is not satisfied - //~| ERROR the trait bound `for<'z> T: Trait2<'y, 'z>` is not satisfied { } diff --git a/tests/ui/regions/regions-implied-bounds-projection-gap-hr-1.stderr b/tests/ui/regions/regions-implied-bounds-projection-gap-hr-1.stderr index 3fd39810d44..6844e866532 100644 --- a/tests/ui/regions/regions-implied-bounds-projection-gap-hr-1.stderr +++ b/tests/ui/regions/regions-implied-bounds-projection-gap-hr-1.stderr @@ -9,21 +9,6 @@ help: consider restricting type parameter `T` LL | fn callee<'x, 'y, T: for<'z> Trait2<'y, 'z>>(t: &'x dyn for<'z> Trait1< <T as Trait2<'y, 'z>>::Foo >) | ++++++++++++++++++++++++ -error[E0277]: the trait bound `for<'z> T: Trait2<'y, 'z>` is not satisfied - --> $DIR/regions-implied-bounds-projection-gap-hr-1.rs:21:1 - | -LL | / fn callee<'x, 'y, T>(t: &'x dyn for<'z> Trait1< <T as Trait2<'y, 'z>>::Foo >) -LL | | -LL | | -LL | | { -LL | | } - | |_^ the trait `for<'z> Trait2<'y, 'z>` is not implemented for `T` - | -help: consider restricting type parameter `T` - | -LL | fn callee<'x, 'y, T: for<'z> Trait2<'y, 'z>>(t: &'x dyn for<'z> Trait1< <T as Trait2<'y, 'z>>::Foo >) - | ++++++++++++++++++++++++ - -error: aborting due to 2 previous errors +error: aborting due to previous error For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/resolve/export-fully-qualified-2018.rs b/tests/ui/resolve/export-fully-qualified-2018.rs new file mode 100644 index 00000000000..afd48acb6bb --- /dev/null +++ b/tests/ui/resolve/export-fully-qualified-2018.rs @@ -0,0 +1,13 @@ +// edition:2018 + +// In this test baz isn't resolved when called as foo.baz even though +// it's called from inside foo. This is somewhat surprising and may +// want to change eventually. + +mod foo { + pub fn bar() { foo::baz(); } //~ ERROR failed to resolve: use of undeclared crate or module `foo` + + fn baz() { } +} + +fn main() { } diff --git a/tests/ui/resolve/export-fully-qualified-2018.stderr b/tests/ui/resolve/export-fully-qualified-2018.stderr new file mode 100644 index 00000000000..366ffd9bb2b --- /dev/null +++ b/tests/ui/resolve/export-fully-qualified-2018.stderr @@ -0,0 +1,14 @@ +error[E0433]: failed to resolve: use of undeclared crate or module `foo` + --> $DIR/export-fully-qualified-2018.rs:8:20 + | +LL | pub fn bar() { foo::baz(); } + | ^^^ use of undeclared crate or module `foo` + | +help: consider importing this module + | +LL + use crate::foo; + | + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0433`. diff --git a/tests/ui/resolve/export-fully-qualified.rs b/tests/ui/resolve/export-fully-qualified.rs index 4e73a2c5488..9d4daf4cd79 100644 --- a/tests/ui/resolve/export-fully-qualified.rs +++ b/tests/ui/resolve/export-fully-qualified.rs @@ -1,3 +1,5 @@ +// edition:2015 + // In this test baz isn't resolved when called as foo.baz even though // it's called from inside foo. This is somewhat surprising and may // want to change eventually. diff --git a/tests/ui/resolve/export-fully-qualified.stderr b/tests/ui/resolve/export-fully-qualified.stderr index 7ee352e1232..0cd516ee1b1 100644 --- a/tests/ui/resolve/export-fully-qualified.stderr +++ b/tests/ui/resolve/export-fully-qualified.stderr @@ -1,8 +1,13 @@ error[E0433]: failed to resolve: use of undeclared crate or module `foo` - --> $DIR/export-fully-qualified.rs:6:20 + --> $DIR/export-fully-qualified.rs:8:20 | LL | pub fn bar() { foo::baz(); } | ^^^ use of undeclared crate or module `foo` + | +help: consider importing this module + | +LL + use foo; + | error: aborting due to previous error diff --git a/tests/ui/resolve/resolve-self-in-impl.stderr b/tests/ui/resolve/resolve-self-in-impl.stderr index b3042d41346..9f9ed68898f 100644 --- a/tests/ui/resolve/resolve-self-in-impl.stderr +++ b/tests/ui/resolve/resolve-self-in-impl.stderr @@ -1,40 +1,40 @@ error: `Self` is not valid in the self type of an impl block - --> $DIR/resolve-self-in-impl.rs:16:6 + --> $DIR/resolve-self-in-impl.rs:14:13 | -LL | impl Self {} - | ^^^^ +LL | impl Tr for Self {} + | ^^^^ | = note: replace `Self` with a different type error: `Self` is not valid in the self type of an impl block - --> $DIR/resolve-self-in-impl.rs:17:8 + --> $DIR/resolve-self-in-impl.rs:15:15 | -LL | impl S<Self> {} - | ^^^^ +LL | impl Tr for S<Self> {} + | ^^^^ | = note: replace `Self` with a different type error: `Self` is not valid in the self type of an impl block - --> $DIR/resolve-self-in-impl.rs:18:7 + --> $DIR/resolve-self-in-impl.rs:16:6 | -LL | impl (Self, Self) {} - | ^^^^ ^^^^ +LL | impl Self {} + | ^^^^ | = note: replace `Self` with a different type error: `Self` is not valid in the self type of an impl block - --> $DIR/resolve-self-in-impl.rs:14:13 + --> $DIR/resolve-self-in-impl.rs:17:8 | -LL | impl Tr for Self {} - | ^^^^ +LL | impl S<Self> {} + | ^^^^ | = note: replace `Self` with a different type error: `Self` is not valid in the self type of an impl block - --> $DIR/resolve-self-in-impl.rs:15:15 + --> $DIR/resolve-self-in-impl.rs:18:7 | -LL | impl Tr for S<Self> {} - | ^^^^ +LL | impl (Self, Self) {} + | ^^^^ ^^^^ | = note: replace `Self` with a different type diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/helloworld.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/helloworld.rs new file mode 100644 index 00000000000..49457354cc9 --- /dev/null +++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/helloworld.rs @@ -0,0 +1,29 @@ +// check-pass + +// gate-test-effects +// ^ effects doesn't have a gate so we will trick tidy into thinking this is a gate test + +#![feature(const_trait_impl, effects, rustc_attrs)] + +// ensure we are passing in the correct host effect in always const contexts. + +pub const fn hmm</* T, */ #[rustc_host] const host: bool = true>() -> usize { + if host { + 1 + } else { + 0 + } +} + +const _: () = { + let x = hmm(); + assert!(0 == x); +}; + +/* FIXME(effects) +pub const fn uwu(x: [u8; hmm::<()>()]) { + let [] = x; +} +*/ + +fn main() {} diff --git a/tests/ui/rfcs/rfc-3348-c-string-literals/basic.rs b/tests/ui/rfcs/rfc-3348-c-string-literals/basic.rs index e4b07ab8108..3fc5fd481ea 100644 --- a/tests/ui/rfcs/rfc-3348-c-string-literals/basic.rs +++ b/tests/ui/rfcs/rfc-3348-c-string-literals/basic.rs @@ -1,4 +1,6 @@ -// run-pass +// FIXME(c_str_literals): This should be `run-pass` +// known-bug: #113333 +// edition: 2021 #![feature(c_str_literals)] diff --git a/tests/ui/rfcs/rfc-3348-c-string-literals/basic.stderr b/tests/ui/rfcs/rfc-3348-c-string-literals/basic.stderr new file mode 100644 index 00000000000..571c319d8c5 --- /dev/null +++ b/tests/ui/rfcs/rfc-3348-c-string-literals/basic.stderr @@ -0,0 +1,25 @@ +error: prefix `c` is unknown + --> $DIR/basic.rs:8:27 + | +LL | assert_eq!(b"test\0", c"test".to_bytes_with_nul()); + | ^ unknown prefix + | + = note: prefixed identifiers and literals are reserved since Rust 2021 +help: consider inserting whitespace here + | +LL | assert_eq!(b"test\0", c "test".to_bytes_with_nul()); + | + + +error: no rules expected the token `"test"` + --> $DIR/basic.rs:8:28 + | +LL | assert_eq!(b"test\0", c"test".to_bytes_with_nul()); + | -^^^^^ + | | + | no rules expected this token in macro call + | help: missing comma here + | + = note: while trying to match sequence start + +error: aborting due to 2 previous errors + diff --git a/tests/ui/rfcs/rfc-3348-c-string-literals/edition-2015-2018-lexing.rs b/tests/ui/rfcs/rfc-3348-c-string-literals/edition-2015-2018-lexing.rs new file mode 100644 index 00000000000..2a4cd600426 --- /dev/null +++ b/tests/ui/rfcs/rfc-3348-c-string-literals/edition-2015-2018-lexing.rs @@ -0,0 +1,24 @@ +// Regression test for issue #113235. + +// check-pass +// revisions: edition2015 edition2018 +//[edition2015] edition: 2015 +//[edition2018] edition: 2018 + +// Make sure that in pre-2021 editions we continue to parse the snippet +// `c"hello"` as an identifier followed by a (normal) string literal and +// allow the code below to compile. +// Prefixes including `c` as used by C string literals are only reserved +// in edition 2021 and onward. +// +// Consider checking out rust-2021/reserved-prefixes-migration.rs as well. + +macro_rules! parse { + (c $e:expr) => { + $e + }; +} + +fn main() { + let _: &'static str = parse!(c"hello"); +} diff --git a/tests/ui/rfcs/rfc-3348-c-string-literals/gate.rs b/tests/ui/rfcs/rfc-3348-c-string-literals/gate.rs index b27da26ed23..ddd6d9a25da 100644 --- a/tests/ui/rfcs/rfc-3348-c-string-literals/gate.rs +++ b/tests/ui/rfcs/rfc-3348-c-string-literals/gate.rs @@ -1,4 +1,6 @@ // gate-test-c_str_literals +// known-bug: #113333 +// edition: 2021 macro_rules! m { ($t:tt) => {} @@ -6,8 +8,8 @@ macro_rules! m { fn main() { c"foo"; - //~^ ERROR: `c".."` literals are experimental + // FIXME(c_str_literals): This should be ``c".."` literals are experimental` m!(c"test"); - //~^ ERROR: `c".."` literals are experimental + // FIXME(c_str_literals): This should be ``c".."` literals are experimental` } diff --git a/tests/ui/rfcs/rfc-3348-c-string-literals/gate.stderr b/tests/ui/rfcs/rfc-3348-c-string-literals/gate.stderr index bc0c537aada..8de36ca4a6e 100644 --- a/tests/ui/rfcs/rfc-3348-c-string-literals/gate.stderr +++ b/tests/ui/rfcs/rfc-3348-c-string-literals/gate.stderr @@ -1,21 +1,32 @@ -error[E0658]: `c".."` literals are experimental - --> $DIR/gate.rs:8:5 +error: prefix `c` is unknown + --> $DIR/gate.rs:10:5 | LL | c"foo"; - | ^^^^^^ + | ^ unknown prefix | - = note: see issue #105723 <https://github.com/rust-lang/rust/issues/105723> for more information - = help: add `#![feature(c_str_literals)]` to the crate attributes to enable + = note: prefixed identifiers and literals are reserved since Rust 2021 +help: consider inserting whitespace here + | +LL | c "foo"; + | + -error[E0658]: `c".."` literals are experimental - --> $DIR/gate.rs:11:8 +error: prefix `c` is unknown + --> $DIR/gate.rs:13:8 | LL | m!(c"test"); - | ^^^^^^^ + | ^ unknown prefix + | + = note: prefixed identifiers and literals are reserved since Rust 2021 +help: consider inserting whitespace here | - = note: see issue #105723 <https://github.com/rust-lang/rust/issues/105723> for more information - = help: add `#![feature(c_str_literals)]` to the crate attributes to enable +LL | m!(c "test"); + | + + +error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `"foo"` + --> $DIR/gate.rs:10:6 + | +LL | c"foo"; + | ^^^^^ expected one of 8 possible tokens -error: aborting due to 2 previous errors +error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/rfcs/rfc-3348-c-string-literals/no-nuls.rs b/tests/ui/rfcs/rfc-3348-c-string-literals/no-nuls.rs index 7bc6097f124..96945f125da 100644 --- a/tests/ui/rfcs/rfc-3348-c-string-literals/no-nuls.rs +++ b/tests/ui/rfcs/rfc-3348-c-string-literals/no-nuls.rs Binary files differdiff --git a/tests/ui/rfcs/rfc-3348-c-string-literals/no-nuls.stderr b/tests/ui/rfcs/rfc-3348-c-string-literals/no-nuls.stderr index ff9006f6f97..2226c7aa6a9 100644 --- a/tests/ui/rfcs/rfc-3348-c-string-literals/no-nuls.stderr +++ b/tests/ui/rfcs/rfc-3348-c-string-literals/no-nuls.stderr Binary files differdiff --git a/tests/ui/rfcs/rfc-3348-c-string-literals/non-ascii.rs b/tests/ui/rfcs/rfc-3348-c-string-literals/non-ascii.rs index 82e8e2090d7..066505c23df 100644 --- a/tests/ui/rfcs/rfc-3348-c-string-literals/non-ascii.rs +++ b/tests/ui/rfcs/rfc-3348-c-string-literals/non-ascii.rs @@ -1,4 +1,6 @@ -// run-pass +// FIXME(c_str_literals): This should be `run-pass` +// known-bug: #113333 +// edition: 2021 #![feature(c_str_literals)] diff --git a/tests/ui/rfcs/rfc-3348-c-string-literals/non-ascii.stderr b/tests/ui/rfcs/rfc-3348-c-string-literals/non-ascii.stderr new file mode 100644 index 00000000000..47361fb61d2 --- /dev/null +++ b/tests/ui/rfcs/rfc-3348-c-string-literals/non-ascii.stderr @@ -0,0 +1,38 @@ +error: prefix `c` is unknown + --> $DIR/non-ascii.rs:9:9 + | +LL | c"\xEF\x80🦀\u{1F980}".to_bytes_with_nul(), + | ^ unknown prefix + | + = note: prefixed identifiers and literals are reserved since Rust 2021 +help: consider inserting whitespace here + | +LL | c "\xEF\x80🦀\u{1F980}".to_bytes_with_nul(), + | + + +error: out of range hex escape + --> $DIR/non-ascii.rs:9:11 + | +LL | c"\xEF\x80🦀\u{1F980}".to_bytes_with_nul(), + | ^^^^ must be a character in the range [\x00-\x7f] + +error: out of range hex escape + --> $DIR/non-ascii.rs:9:15 + | +LL | c"\xEF\x80🦀\u{1F980}".to_bytes_with_nul(), + | ^^^^ must be a character in the range [\x00-\x7f] + +error: no rules expected the token `"\xEF\x80🦀\u{1F980}"` + --> $DIR/non-ascii.rs:9:10 + | +LL | c"\xEF\x80🦀\u{1F980}".to_bytes_with_nul(), + | -^^^^^^^^^^^^^^^^^^^^ + | | + | no rules expected this token in macro call + | help: missing comma here + | +note: while trying to match `,` + --> $SRC_DIR/core/src/macros/mod.rs:LL:COL + +error: aborting due to 4 previous errors + diff --git a/tests/ui/rust-2018/uniform-paths/ambiguity-macros-nested.stderr b/tests/ui/rust-2018/uniform-paths/ambiguity-macros-nested.stderr index 7e008d46574..a5c79366bf0 100644 --- a/tests/ui/rust-2018/uniform-paths/ambiguity-macros-nested.stderr +++ b/tests/ui/rust-2018/uniform-paths/ambiguity-macros-nested.stderr @@ -4,7 +4,7 @@ error[E0659]: `std` is ambiguous LL | pub use std::io; | ^^^ ambiguous name | - = note: ambiguous because of multiple potential import sources + = note: ambiguous because of a conflict between a macro-expanded name and a less macro-expanded name from outer scope during import or macro resolution = note: `std` could refer to a built-in crate = help: use `::std` to refer to this crate unambiguously note: `std` could also refer to the module defined here diff --git a/tests/ui/rust-2018/uniform-paths/ambiguity-macros.stderr b/tests/ui/rust-2018/uniform-paths/ambiguity-macros.stderr index 771d2c10c1d..8045f3a45b6 100644 --- a/tests/ui/rust-2018/uniform-paths/ambiguity-macros.stderr +++ b/tests/ui/rust-2018/uniform-paths/ambiguity-macros.stderr @@ -4,7 +4,7 @@ error[E0659]: `std` is ambiguous LL | use std::io; | ^^^ ambiguous name | - = note: ambiguous because of multiple potential import sources + = note: ambiguous because of a conflict between a macro-expanded name and a less macro-expanded name from outer scope during import or macro resolution = note: `std` could refer to a built-in crate = help: use `::std` to refer to this crate unambiguously note: `std` could also refer to the module defined here diff --git a/tests/ui/rust-2018/uniform-paths/ambiguity-nested.rs b/tests/ui/rust-2018/uniform-paths/ambiguity-nested.rs index 50c8fc8229c..0ef580d7aa5 100644 --- a/tests/ui/rust-2018/uniform-paths/ambiguity-nested.rs +++ b/tests/ui/rust-2018/uniform-paths/ambiguity-nested.rs @@ -1,3 +1,4 @@ +// check-pass // edition:2018 // This test is similar to `ambiguity.rs`, but nested in a module. @@ -5,8 +6,7 @@ #![allow(non_camel_case_types)] mod foo { - pub use std::io; - //~^ ERROR `std` is ambiguous + pub use std::io; // OK mod std { pub struct io; diff --git a/tests/ui/rust-2018/uniform-paths/ambiguity-nested.stderr b/tests/ui/rust-2018/uniform-paths/ambiguity-nested.stderr deleted file mode 100644 index defb16f7970..00000000000 --- a/tests/ui/rust-2018/uniform-paths/ambiguity-nested.stderr +++ /dev/null @@ -1,21 +0,0 @@ -error[E0659]: `std` is ambiguous - --> $DIR/ambiguity-nested.rs:8:13 - | -LL | pub use std::io; - | ^^^ ambiguous name - | - = note: ambiguous because of multiple potential import sources - = note: `std` could refer to a built-in crate - = help: use `::std` to refer to this crate unambiguously -note: `std` could also refer to the module defined here - --> $DIR/ambiguity-nested.rs:11:5 - | -LL | / mod std { -LL | | pub struct io; -LL | | } - | |_____^ - = help: use `self::std` to refer to this module unambiguously - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0659`. diff --git a/tests/ui/rust-2018/uniform-paths/ambiguity.rs b/tests/ui/rust-2018/uniform-paths/ambiguity.rs index 60f77a1c663..890e8b7b3c0 100644 --- a/tests/ui/rust-2018/uniform-paths/ambiguity.rs +++ b/tests/ui/rust-2018/uniform-paths/ambiguity.rs @@ -1,9 +1,9 @@ +// check-pass // edition:2018 #![allow(non_camel_case_types)] -use std::io; -//~^ ERROR `std` is ambiguous +use std::io; // OK mod std { pub struct io; diff --git a/tests/ui/rust-2018/uniform-paths/ambiguity.stderr b/tests/ui/rust-2018/uniform-paths/ambiguity.stderr deleted file mode 100644 index 2d735c7e3fd..00000000000 --- a/tests/ui/rust-2018/uniform-paths/ambiguity.stderr +++ /dev/null @@ -1,21 +0,0 @@ -error[E0659]: `std` is ambiguous - --> $DIR/ambiguity.rs:5:5 - | -LL | use std::io; - | ^^^ ambiguous name - | - = note: ambiguous because of multiple potential import sources - = note: `std` could refer to a built-in crate - = help: use `::std` to refer to this crate unambiguously -note: `std` could also refer to the module defined here - --> $DIR/ambiguity.rs:8:1 - | -LL | / mod std { -LL | | pub struct io; -LL | | } - | |_^ - = help: use `crate::std` to refer to this module unambiguously - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0659`. diff --git a/tests/ui/rust-2018/uniform-paths/block-scoped-shadow-nested.rs b/tests/ui/rust-2018/uniform-paths/block-scoped-shadow-nested.rs index 3f5897901a0..4cba0949802 100644 --- a/tests/ui/rust-2018/uniform-paths/block-scoped-shadow-nested.rs +++ b/tests/ui/rust-2018/uniform-paths/block-scoped-shadow-nested.rs @@ -1,3 +1,4 @@ +// check-pass // edition:2018 mod my { @@ -13,7 +14,7 @@ mod sub { fn foo() { use my::sub; { - use sub::bar; //~ ERROR `sub` is ambiguous + use sub::bar; // OK } } diff --git a/tests/ui/rust-2018/uniform-paths/block-scoped-shadow-nested.stderr b/tests/ui/rust-2018/uniform-paths/block-scoped-shadow-nested.stderr deleted file mode 100644 index 3d45a814029..00000000000 --- a/tests/ui/rust-2018/uniform-paths/block-scoped-shadow-nested.stderr +++ /dev/null @@ -1,24 +0,0 @@ -error[E0659]: `sub` is ambiguous - --> $DIR/block-scoped-shadow-nested.rs:16:13 - | -LL | use sub::bar; - | ^^^ ambiguous name - | - = note: ambiguous because of multiple potential import sources -note: `sub` could refer to the module imported here - --> $DIR/block-scoped-shadow-nested.rs:14:9 - | -LL | use my::sub; - | ^^^^^^^ -note: `sub` could also refer to the module defined here - --> $DIR/block-scoped-shadow-nested.rs:9:1 - | -LL | / mod sub { -LL | | pub fn bar() {} -LL | | } - | |_^ - = help: use `crate::sub` to refer to this module unambiguously - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0659`. diff --git a/tests/ui/rust-2018/uniform-paths/block-scoped-shadow.rs b/tests/ui/rust-2018/uniform-paths/block-scoped-shadow.rs index 828ee4fe474..c902d133e7c 100644 --- a/tests/ui/rust-2018/uniform-paths/block-scoped-shadow.rs +++ b/tests/ui/rust-2018/uniform-paths/block-scoped-shadow.rs @@ -1,3 +1,4 @@ +// check-pass // edition:2018 #![allow(non_camel_case_types)] @@ -8,14 +9,11 @@ struct std; fn main() { enum Foo { A, B } - use Foo::*; - //~^ ERROR `Foo` is ambiguous + use Foo::*; // OK let _ = (A, B); fn std() {} enum std {} - use std as foo; - //~^ ERROR `std` is ambiguous - //~| ERROR `std` is ambiguous + use std as foo; // OK } diff --git a/tests/ui/rust-2018/uniform-paths/block-scoped-shadow.stderr b/tests/ui/rust-2018/uniform-paths/block-scoped-shadow.stderr deleted file mode 100644 index b068312cedd..00000000000 --- a/tests/ui/rust-2018/uniform-paths/block-scoped-shadow.stderr +++ /dev/null @@ -1,60 +0,0 @@ -error[E0659]: `Foo` is ambiguous - --> $DIR/block-scoped-shadow.rs:11:9 - | -LL | use Foo::*; - | ^^^ ambiguous name - | - = note: ambiguous because of multiple potential import sources -note: `Foo` could refer to the enum defined here - --> $DIR/block-scoped-shadow.rs:10:5 - | -LL | enum Foo { A, B } - | ^^^^^^^^^^^^^^^^^ -note: `Foo` could also refer to the enum defined here - --> $DIR/block-scoped-shadow.rs:5:1 - | -LL | enum Foo {} - | ^^^^^^^^^^^ - = help: use `crate::Foo` to refer to this enum unambiguously - -error[E0659]: `std` is ambiguous - --> $DIR/block-scoped-shadow.rs:18:9 - | -LL | use std as foo; - | ^^^ ambiguous name - | - = note: ambiguous because of multiple potential import sources -note: `std` could refer to the enum defined here - --> $DIR/block-scoped-shadow.rs:17:5 - | -LL | enum std {} - | ^^^^^^^^^^^ -note: `std` could also refer to the struct defined here - --> $DIR/block-scoped-shadow.rs:7:1 - | -LL | struct std; - | ^^^^^^^^^^^ - = help: use `crate::std` to refer to this struct unambiguously - -error[E0659]: `std` is ambiguous - --> $DIR/block-scoped-shadow.rs:18:9 - | -LL | use std as foo; - | ^^^ ambiguous name - | - = note: ambiguous because of multiple potential import sources -note: `std` could refer to the function defined here - --> $DIR/block-scoped-shadow.rs:16:5 - | -LL | fn std() {} - | ^^^^^^^^^^^ -note: `std` could also refer to the unit struct defined here - --> $DIR/block-scoped-shadow.rs:7:1 - | -LL | struct std; - | ^^^^^^^^^^^ - = help: use `crate::std` to refer to this unit struct unambiguously - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0659`. diff --git a/tests/ui/rust-2018/uniform-paths/issue-56596.stderr b/tests/ui/rust-2018/uniform-paths/issue-56596.stderr index 8b8ab26dce2..849d6275eb8 100644 --- a/tests/ui/rust-2018/uniform-paths/issue-56596.stderr +++ b/tests/ui/rust-2018/uniform-paths/issue-56596.stderr @@ -4,7 +4,7 @@ error[E0659]: `issue_56596` is ambiguous LL | use issue_56596; | ^^^^^^^^^^^ ambiguous name | - = note: ambiguous because of multiple potential import sources + = note: ambiguous because of a conflict between a name from a glob import and an outer scope during import or macro resolution = note: `issue_56596` could refer to a crate passed with `--extern` = help: use `::issue_56596` to refer to this crate unambiguously note: `issue_56596` could also refer to the module imported here @@ -12,7 +12,8 @@ note: `issue_56596` could also refer to the module imported here | LL | use m::*; | ^^^^ - = help: use `crate::issue_56596` to refer to this module unambiguously + = help: consider adding an explicit import of `issue_56596` to disambiguate + = help: or use `crate::issue_56596` to refer to this module unambiguously error: aborting due to previous error diff --git a/tests/ui/rust-2018/uniform-paths/macro-rules.rs b/tests/ui/rust-2018/uniform-paths/macro-rules.rs index 2d9a6a9a924..1084f5e8b34 100644 --- a/tests/ui/rust-2018/uniform-paths/macro-rules.rs +++ b/tests/ui/rust-2018/uniform-paths/macro-rules.rs @@ -27,8 +27,7 @@ mod m3 { fn f() { macro_rules! legacy_macro { () => () } - // Legacy macro imports create ambiguities with other names in the same namespace. - use legacy_macro as _; //~ ERROR `legacy_macro` is ambiguous + use legacy_macro as _; // OK } } diff --git a/tests/ui/rust-2018/uniform-paths/macro-rules.stderr b/tests/ui/rust-2018/uniform-paths/macro-rules.stderr index 9f8c928c32c..8a978c98a44 100644 --- a/tests/ui/rust-2018/uniform-paths/macro-rules.stderr +++ b/tests/ui/rust-2018/uniform-paths/macro-rules.stderr @@ -10,26 +10,6 @@ help: consider adding a `#[macro_export]` to the macro in the imported module LL | macro_rules! legacy_macro { () => () } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0659]: `legacy_macro` is ambiguous - --> $DIR/macro-rules.rs:31:13 - | -LL | use legacy_macro as _; - | ^^^^^^^^^^^^ ambiguous name - | - = note: ambiguous because of multiple potential import sources -note: `legacy_macro` could refer to the macro defined here - --> $DIR/macro-rules.rs:28:9 - | -LL | macro_rules! legacy_macro { () => () } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: `legacy_macro` could also refer to the macro defined here - --> $DIR/macro-rules.rs:25:5 - | -LL | macro legacy_macro() {} - | ^^^^^^^^^^^^^^^^^^^^^^^ - = help: use `self::legacy_macro` to refer to this macro unambiguously - -error: aborting due to 2 previous errors +error: aborting due to previous error -Some errors have detailed explanations: E0364, E0659. -For more information about an error, try `rustc --explain E0364`. +For more information about this error, try `rustc --explain E0364`. diff --git a/tests/ui/stability-attribute/auxiliary/default_body.rs b/tests/ui/stability-attribute/auxiliary/default_body.rs index 3a177419d66..2f315eb1bc8 100644 --- a/tests/ui/stability-attribute/auxiliary/default_body.rs +++ b/tests/ui/stability-attribute/auxiliary/default_body.rs @@ -11,6 +11,10 @@ pub trait JustTrait { #[rustc_default_body_unstable(feature = "fun_default_body", issue = "none")] #[stable(feature = "stable_feature", since = "1.0.0")] fn fun() {} + + #[rustc_default_body_unstable(feature = "fun_default_body", issue = "none", reason = "reason")] + #[stable(feature = "stable_feature", since = "1.0.0")] + fn fun2() {} } #[rustc_must_implement_one_of(eq, neq)] diff --git a/tests/ui/stability-attribute/default-body-stability-err.rs b/tests/ui/stability-attribute/default-body-stability-err.rs index ecb281bccf6..d1a3597687d 100644 --- a/tests/ui/stability-attribute/default-body-stability-err.rs +++ b/tests/ui/stability-attribute/default-body-stability-err.rs @@ -10,6 +10,7 @@ struct Type; impl JustTrait for Type {} //~^ ERROR not all trait items implemented, missing: `CONSTANT` [E0046] //~| ERROR not all trait items implemented, missing: `fun` [E0046] +//~| ERROR not all trait items implemented, missing: `fun2` [E0046] impl Equal for Type { //~^ ERROR not all trait items implemented, missing: `eq` [E0046] diff --git a/tests/ui/stability-attribute/default-body-stability-err.stderr b/tests/ui/stability-attribute/default-body-stability-err.stderr index ef666f30fc2..12ec9ea3adb 100644 --- a/tests/ui/stability-attribute/default-body-stability-err.stderr +++ b/tests/ui/stability-attribute/default-body-stability-err.stderr @@ -18,8 +18,18 @@ LL | impl JustTrait for Type {} = note: use of unstable library feature 'fun_default_body' = help: add `#![feature(fun_default_body)]` to the crate attributes to enable +error[E0046]: not all trait items implemented, missing: `fun2` + --> $DIR/default-body-stability-err.rs:10:1 + | +LL | impl JustTrait for Type {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: default implementation of `fun2` is unstable + = note: use of unstable library feature 'fun_default_body': reason + = help: add `#![feature(fun_default_body)]` to the crate attributes to enable + error[E0046]: not all trait items implemented, missing: `eq` - --> $DIR/default-body-stability-err.rs:14:1 + --> $DIR/default-body-stability-err.rs:15:1 | LL | / impl Equal for Type { LL | | @@ -33,6 +43,6 @@ LL | | } = note: use of unstable library feature 'eq_default_body' = help: add `#![feature(eq_default_body)]` to the crate attributes to enable -error: aborting due to 3 previous errors +error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0046`. diff --git a/tests/ui/stability-attribute/default-body-stability-ok-impls.rs b/tests/ui/stability-attribute/default-body-stability-ok-impls.rs index e1f5c017096..b29d45256bf 100644 --- a/tests/ui/stability-attribute/default-body-stability-ok-impls.rs +++ b/tests/ui/stability-attribute/default-body-stability-ok-impls.rs @@ -12,6 +12,8 @@ impl JustTrait for Type { const CONSTANT: usize = 1; fn fun() {} + + fn fun2() {} } impl Equal for Type { diff --git a/tests/ui/suggestions/crate-or-module-typo.stderr b/tests/ui/suggestions/crate-or-module-typo.stderr index 98b88b4fb92..5e7a7685ab0 100644 --- a/tests/ui/suggestions/crate-or-module-typo.stderr +++ b/tests/ui/suggestions/crate-or-module-typo.stderr @@ -36,6 +36,11 @@ error[E0433]: failed to resolve: use of undeclared crate or module `bar` | LL | pub fn bar() { bar::baz(); } | ^^^ use of undeclared crate or module `bar` + | +help: consider importing this module + | +LL + use crate::bar; + | error: aborting due to 4 previous errors diff --git a/tests/ui/suggestions/issue-102972.rs b/tests/ui/suggestions/issue-102972.rs new file mode 100644 index 00000000000..106288b054d --- /dev/null +++ b/tests/ui/suggestions/issue-102972.rs @@ -0,0 +1,16 @@ +fn test1() { + let mut chars = "Hello".chars(); + for _c in chars.by_ref() { + chars.next(); //~ ERROR cannot borrow `chars` as mutable more than once at a time + } +} + +fn test2() { + let v = vec![1, 2, 3]; + let mut iter = v.iter(); + for _i in iter { + iter.next(); //~ ERROR borrow of moved value: `iter` + } +} + +fn main() { } diff --git a/tests/ui/suggestions/issue-102972.stderr b/tests/ui/suggestions/issue-102972.stderr new file mode 100644 index 00000000000..03f9dbb6c89 --- /dev/null +++ b/tests/ui/suggestions/issue-102972.stderr @@ -0,0 +1,33 @@ +error[E0499]: cannot borrow `chars` as mutable more than once at a time + --> $DIR/issue-102972.rs:4:9 + | +LL | for _c in chars.by_ref() { + | -------------- + | | + | first mutable borrow occurs here + | first borrow later used here +LL | chars.next(); + | ^^^^^^^^^^^^ second mutable borrow occurs here + | + = note: a for loop advances the iterator for you, the result is stored in `_c`. + = help: if you want to call `next` on a iterator within the loop, consider using `while let`. + +error[E0382]: borrow of moved value: `iter` + --> $DIR/issue-102972.rs:12:9 + | +LL | let mut iter = v.iter(); + | -------- move occurs because `iter` has type `std::slice::Iter<'_, i32>`, which does not implement the `Copy` trait +LL | for _i in iter { + | ---- `iter` moved due to this implicit call to `.into_iter()` +LL | iter.next(); + | ^^^^^^^^^^^ value borrowed here after move + | + = note: a for loop advances the iterator for you, the result is stored in `_i`. + = help: if you want to call `next` on a iterator within the loop, consider using `while let`. +note: `into_iter` takes ownership of the receiver `self`, which moves `iter` + --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0382, E0499. +For more information about an error, try `rustc --explain E0382`. diff --git a/tests/ui/suggestions/issue-112590-suggest-import.rs b/tests/ui/suggestions/issue-112590-suggest-import.rs new file mode 100644 index 00000000000..0938814c559 --- /dev/null +++ b/tests/ui/suggestions/issue-112590-suggest-import.rs @@ -0,0 +1,10 @@ +pub struct S; + +impl fmt::Debug for S { //~ ERROR failed to resolve: use of undeclared crate or module `fmt` + fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result { //~ ERROR failed to resolve: use of undeclared crate or module `fmt` + //~^ ERROR failed to resolve: use of undeclared crate or module `fmt` + Ok(()) + } +} + +fn main() { } diff --git a/tests/ui/suggestions/issue-112590-suggest-import.stderr b/tests/ui/suggestions/issue-112590-suggest-import.stderr new file mode 100644 index 00000000000..aeac18c16f0 --- /dev/null +++ b/tests/ui/suggestions/issue-112590-suggest-import.stderr @@ -0,0 +1,36 @@ +error[E0433]: failed to resolve: use of undeclared crate or module `fmt` + --> $DIR/issue-112590-suggest-import.rs:3:6 + | +LL | impl fmt::Debug for S { + | ^^^ use of undeclared crate or module `fmt` + | +help: consider importing this module + | +LL + use std::fmt; + | + +error[E0433]: failed to resolve: use of undeclared crate or module `fmt` + --> $DIR/issue-112590-suggest-import.rs:4:28 + | +LL | fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result { + | ^^^ use of undeclared crate or module `fmt` + | +help: consider importing this module + | +LL + use std::fmt; + | + +error[E0433]: failed to resolve: use of undeclared crate or module `fmt` + --> $DIR/issue-112590-suggest-import.rs:4:51 + | +LL | fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result { + | ^^^ use of undeclared crate or module `fmt` + | +help: consider importing this module + | +LL + use std::fmt; + | + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0433`. diff --git a/tests/ui/suggestions/issue-89640.rs b/tests/ui/suggestions/issue-89640.rs new file mode 100644 index 00000000000..6bb33ad8f30 --- /dev/null +++ b/tests/ui/suggestions/issue-89640.rs @@ -0,0 +1,3 @@ +fn main() { + le t x: i32 = 3; //~ ERROR expected one of +} diff --git a/tests/ui/suggestions/issue-89640.stderr b/tests/ui/suggestions/issue-89640.stderr new file mode 100644 index 00000000000..8ff4ef4f0ec --- /dev/null +++ b/tests/ui/suggestions/issue-89640.stderr @@ -0,0 +1,13 @@ +error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `t` + --> $DIR/issue-89640.rs:2:8 + | +LL | le t x: i32 = 3; + | ^ expected one of 8 possible tokens + | +help: consider removing the space to spell keyword `let` + | +LL | let x: i32 = 3; + | ~~~ + +error: aborting due to previous error + diff --git a/tests/ui/suggestions/suggest-split-at-mut.stderr b/tests/ui/suggestions/suggest-split-at-mut.stderr index 330f012b2a9..bb185138383 100644 --- a/tests/ui/suggestions/suggest-split-at-mut.stderr +++ b/tests/ui/suggestions/suggest-split-at-mut.stderr @@ -9,6 +9,7 @@ LL | *a = 5; | ------ first borrow later used here | = help: consider using `.split_at_mut(position)` or similar method to obtain two mutable non-overlapping sub-slices + = help: consider using `.swap(index_1, index_2)` to swap elements at the specified indices error: aborting due to previous error diff --git a/tests/ui/test-attrs/test-fn-signature-verification-for-explicit-return-type.rs b/tests/ui/test-attrs/test-fn-signature-verification-for-explicit-return-type.rs index 585874e273d..02fee1a00da 100644 --- a/tests/ui/test-attrs/test-fn-signature-verification-for-explicit-return-type.rs +++ b/tests/ui/test-attrs/test-fn-signature-verification-for-explicit-return-type.rs @@ -1,5 +1,5 @@ // run-pass -// needs-unwind (#73509) +// ignore-fuchsia Test must be run out-of-process #![feature(test)] diff --git a/tests/ui/test-attrs/test-panic-abort.rs b/tests/ui/test-attrs/test-panic-abort.rs index 931b7993c81..08e5242af66 100644 --- a/tests/ui/test-attrs/test-panic-abort.rs +++ b/tests/ui/test-attrs/test-panic-abort.rs @@ -11,9 +11,13 @@ // ignore-sgx no subprocess support #![cfg(test)] +#![feature(test)] + +extern crate test; use std::io::Write; use std::env; +use test::Bencher; #[test] fn it_works() { @@ -48,3 +52,8 @@ fn no_residual_environment() { } } } + +#[bench] +fn benchmark(b: &mut Bencher) { + b.iter(|| assert_eq!(1 + 1, 2)); +} diff --git a/tests/ui/test-attrs/test-panic-abort.run.stdout b/tests/ui/test-attrs/test-panic-abort.run.stdout index f608a8cdc55..b6b9c2560fe 100644 --- a/tests/ui/test-attrs/test-panic-abort.run.stdout +++ b/tests/ui/test-attrs/test-panic-abort.run.stdout @@ -1,5 +1,6 @@ -running 5 tests +running 6 tests +test benchmark ... ok test it_exits ... FAILED test it_fails ... FAILED test it_panics - should panic ... ok @@ -18,7 +19,7 @@ testing123 testing321 thread 'main' panicked at 'assertion failed: `(left == right)` left: `2`, - right: `5`', $DIR/test-panic-abort.rs:34:5 + right: `5`', $DIR/test-panic-abort.rs:38:5 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace @@ -26,5 +27,5 @@ failures: it_exits it_fails -test result: FAILED. 3 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME +test result: FAILED. 4 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME diff --git a/tests/ui/traits/auxiliary/trivial3.rs b/tests/ui/traits/auxiliary/trivial3.rs new file mode 100644 index 00000000000..0a47fdc74d7 --- /dev/null +++ b/tests/ui/traits/auxiliary/trivial3.rs @@ -0,0 +1 @@ +pub trait Trait {} diff --git a/tests/ui/traits/auxiliary/trivial4.rs b/tests/ui/traits/auxiliary/trivial4.rs new file mode 100644 index 00000000000..a527d1a9526 --- /dev/null +++ b/tests/ui/traits/auxiliary/trivial4.rs @@ -0,0 +1,3 @@ +pub trait Trait {} + +impl Trait for () {} diff --git a/tests/ui/traits/ice-with-dyn-pointee-errors.rs b/tests/ui/traits/ice-with-dyn-pointee-errors.rs new file mode 100644 index 00000000000..46cef2c8bc0 --- /dev/null +++ b/tests/ui/traits/ice-with-dyn-pointee-errors.rs @@ -0,0 +1,15 @@ +#![feature(ptr_metadata)] +// Address issue #112737 -- ICE with dyn Pointee +extern crate core; +use core::ptr::Pointee; + +fn unknown_sized_object_ptr_in(_: &(impl Pointee<Metadata = ()> + ?Sized)) {} + +fn raw_pointer_in(x: &dyn Pointee<Metadata = ()>) { + unknown_sized_object_ptr_in(x) + //~^ ERROR type mismatch resolving `<dyn Pointee<Metadata = ()> as Pointee>::Metadata == ()` +} + +fn main() { + raw_pointer_in(&42) +} diff --git a/tests/ui/traits/ice-with-dyn-pointee-errors.stderr b/tests/ui/traits/ice-with-dyn-pointee-errors.stderr new file mode 100644 index 00000000000..8ad11c3344a --- /dev/null +++ b/tests/ui/traits/ice-with-dyn-pointee-errors.stderr @@ -0,0 +1,19 @@ +error[E0271]: type mismatch resolving `<dyn Pointee<Metadata = ()> as Pointee>::Metadata == ()` + --> $DIR/ice-with-dyn-pointee-errors.rs:9:33 + | +LL | unknown_sized_object_ptr_in(x) + | --------------------------- ^ expected `()`, found `DynMetadata<dyn Pointee<Metadata = ...>>` + | | + | required by a bound introduced by this call + | + = note: expected unit type `()` + found struct `DynMetadata<dyn Pointee<Metadata = ()>>` +note: required by a bound in `unknown_sized_object_ptr_in` + --> $DIR/ice-with-dyn-pointee-errors.rs:6:50 + | +LL | fn unknown_sized_object_ptr_in(_: &(impl Pointee<Metadata = ()> + ?Sized)) {} + | ^^^^^^^^^^^^^ required by this bound in `unknown_sized_object_ptr_in` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0271`. diff --git a/tests/ui/traits/ice-with-dyn-pointee.rs b/tests/ui/traits/ice-with-dyn-pointee.rs new file mode 100644 index 00000000000..9b3b9c8cddf --- /dev/null +++ b/tests/ui/traits/ice-with-dyn-pointee.rs @@ -0,0 +1,11 @@ +// run-pass +#![feature(ptr_metadata)] +// Address issue #112737 -- ICE with dyn Pointee +extern crate core; +use core::ptr::Pointee; + +fn raw_pointer_in(_: &dyn Pointee<Metadata = ()>) {} + +fn main() { + raw_pointer_in(&42) +} diff --git a/tests/ui/traits/new-solver/alias-bound-unsound.rs b/tests/ui/traits/new-solver/alias-bound-unsound.rs index 6b6a77e2c7e..959f1afa04e 100644 --- a/tests/ui/traits/new-solver/alias-bound-unsound.rs +++ b/tests/ui/traits/new-solver/alias-bound-unsound.rs @@ -21,9 +21,7 @@ impl Foo for () { fn main() { let x = String::from("hello, world"); drop(<() as Foo>::copy_me(&x)); - //~^ ERROR `<() as Foo>::Item: Copy` is not satisfied - //~| ERROR `<() as Foo>::Item` is not well-formed - //~| ERROR `<() as Foo>::Item` is not well-formed + //~^ ERROR the type `&<() as Foo>::Item` is not well-formed //~| ERROR `<() as Foo>::Item` is not well-formed println!("{x}"); } diff --git a/tests/ui/traits/new-solver/alias-bound-unsound.stderr b/tests/ui/traits/new-solver/alias-bound-unsound.stderr index 89abc608213..5800e2c4340 100644 --- a/tests/ui/traits/new-solver/alias-bound-unsound.stderr +++ b/tests/ui/traits/new-solver/alias-bound-unsound.stderr @@ -1,29 +1,8 @@ -error[E0277]: the trait bound `<() as Foo>::Item: Copy` is not satisfied - --> $DIR/alias-bound-unsound.rs:23:10 - | -LL | drop(<() as Foo>::copy_me(&x)); - | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `<() as Foo>::Item` - | -note: required by a bound in `Foo::Item` - --> $DIR/alias-bound-unsound.rs:10:30 - | -LL | type Item: Copy - | ---- required by a bound in this associated type -LL | where -LL | <Self as Foo>::Item: Copy; - | ^^^^ required by this bound in `Foo::Item` - -error: the type `<() as Foo>::Item` is not well-formed - --> $DIR/alias-bound-unsound.rs:23:10 - | -LL | drop(<() as Foo>::copy_me(&x)); - | ^^^^^^^^^^^^^^^^^^^^^^^^ - -error: the type `<() as Foo>::Item` is not well-formed - --> $DIR/alias-bound-unsound.rs:23:5 +error: the type `&<() as Foo>::Item` is not well-formed + --> $DIR/alias-bound-unsound.rs:23:31 | LL | drop(<() as Foo>::copy_me(&x)); - | ^^^^ + | ^^ error: the type `<() as Foo>::Item` is not well-formed --> $DIR/alias-bound-unsound.rs:23:10 @@ -31,6 +10,5 @@ error: the type `<() as Foo>::Item` is not well-formed LL | drop(<() as Foo>::copy_me(&x)); | ^^^^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 4 previous errors +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/new-solver/alias_eq_substs_eq_not_intercrate.rs b/tests/ui/traits/new-solver/alias_eq_substs_eq_not_intercrate.rs index b036411be83..204f6e8b071 100644 --- a/tests/ui/traits/new-solver/alias_eq_substs_eq_not_intercrate.rs +++ b/tests/ui/traits/new-solver/alias_eq_substs_eq_not_intercrate.rs @@ -1,22 +1,17 @@ // compile-flags: -Ztrait-solver=next -// check-pass -// (should not pass, should be turned into a coherence-only test) - -// check that a `alias-eq(<?0 as TraitB>::Assoc, <T as TraitB>::Assoc)` goal fails. - -// FIXME(deferred_projection_equality): add a test that this is true during coherence +// check that a `alias-eq(<?a as TraitB>::Assoc, <?b as TraitB>::Assoc)` goal fails +// during coherence. We must not incorrectly constrain `?a` and `?b` to be +// equal. trait TraitB { type Assoc; } -fn needs_a<T: TraitB>() -> T::Assoc { - unimplemented!() -} +trait Overlaps<T> {} -fn bar<T: TraitB>() { - let _: <_ as TraitB>::Assoc = needs_a::<T>(); -} +impl<T: TraitB> Overlaps<Box<T>> for <T as TraitB>::Assoc {} +impl<U: TraitB> Overlaps<U> for <U as TraitB>::Assoc {} +//~^ ERROR conflicting implementations of trait fn main() {} diff --git a/tests/ui/traits/new-solver/alias_eq_substs_eq_not_intercrate.stderr b/tests/ui/traits/new-solver/alias_eq_substs_eq_not_intercrate.stderr new file mode 100644 index 00000000000..8eda64e4490 --- /dev/null +++ b/tests/ui/traits/new-solver/alias_eq_substs_eq_not_intercrate.stderr @@ -0,0 +1,11 @@ +error[E0119]: conflicting implementations of trait `Overlaps<Box<_>>` for type `<_ as TraitB>::Assoc` + --> $DIR/alias_eq_substs_eq_not_intercrate.rs:14:1 + | +LL | impl<T: TraitB> Overlaps<Box<T>> for <T as TraitB>::Assoc {} + | --------------------------------------------------------- first implementation here +LL | impl<U: TraitB> Overlaps<U> for <U as TraitB>::Assoc {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `<_ as TraitB>::Assoc` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/tests/ui/traits/new-solver/async.fail.stderr b/tests/ui/traits/new-solver/async.fail.stderr index b395c23ae00..72fa2eb3161 100644 --- a/tests/ui/traits/new-solver/async.fail.stderr +++ b/tests/ui/traits/new-solver/async.fail.stderr @@ -1,8 +1,8 @@ -error[E0271]: expected `[async block@$DIR/async.rs:12:17: 12:25]` to be a future that resolves to `i32`, but it resolves to `()` +error[E0271]: type mismatch resolving `<[async block@$DIR/async.rs:12:17: 12:25] as Future>::Output == i32` --> $DIR/async.rs:12:17 | LL | needs_async(async {}); - | ----------- ^^^^^^^^ expected `i32`, found `()` + | ----------- ^^^^^^^^ types differ | | | required by a bound introduced by this call | diff --git a/tests/ui/traits/new-solver/async.rs b/tests/ui/traits/new-solver/async.rs index 195cc35cad2..155b71eb749 100644 --- a/tests/ui/traits/new-solver/async.rs +++ b/tests/ui/traits/new-solver/async.rs @@ -10,7 +10,7 @@ fn needs_async(_: impl Future<Output = i32>) {} #[cfg(fail)] fn main() { needs_async(async {}); - //[fail]~^ ERROR to be a future that resolves to `i32`, but it resolves to `()` + //[fail]~^ ERROR type mismatch } #[cfg(pass)] diff --git a/tests/ui/traits/new-solver/dont-remap-tait-substs.rs b/tests/ui/traits/new-solver/dont-remap-tait-substs.rs index 028222f4e6d..309bee8aa8c 100644 --- a/tests/ui/traits/new-solver/dont-remap-tait-substs.rs +++ b/tests/ui/traits/new-solver/dont-remap-tait-substs.rs @@ -12,7 +12,7 @@ type Foo<T: Send, U> = impl NeedsSend<T>; trait NeedsSend<T> {} impl<T: Send> NeedsSend<T> for T {} -fn define<A, B: Send>(a: A, b: B) { +fn define<A, B: Send>(a: A, b: B, _: Foo<B, A>) { let y: Option<Foo<B, A>> = Some(b); } diff --git a/tests/ui/traits/new-solver/dont-type_of-tait-in-defining-scope.not_send.stderr b/tests/ui/traits/new-solver/dont-type_of-tait-in-defining-scope.not_send.stderr new file mode 100644 index 00000000000..ec1c3231abc --- /dev/null +++ b/tests/ui/traits/new-solver/dont-type_of-tait-in-defining-scope.not_send.stderr @@ -0,0 +1,16 @@ +error[E0283]: type annotations needed: cannot satisfy `Foo: Send` + --> $DIR/dont-type_of-tait-in-defining-scope.rs:16:5 + | +LL | needs_send::<Foo>(); + | ^^^^^^^^^^^^^^^^^ + | + = note: cannot satisfy `Foo: Send` +note: required by a bound in `needs_send` + --> $DIR/dont-type_of-tait-in-defining-scope.rs:13:18 + | +LL | fn needs_send<T: Send>() {} + | ^^^^ required by this bound in `needs_send` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0283`. diff --git a/tests/ui/traits/new-solver/dont-type_of-tait-in-defining-scope.rs b/tests/ui/traits/new-solver/dont-type_of-tait-in-defining-scope.rs new file mode 100644 index 00000000000..08f14d7494d --- /dev/null +++ b/tests/ui/traits/new-solver/dont-type_of-tait-in-defining-scope.rs @@ -0,0 +1,24 @@ +// revisions: is_send not_send +// compile-flags: -Ztrait-solver=next +//[is_send] check-pass + +#![feature(type_alias_impl_trait)] + +#[cfg(is_send)] +type Foo = impl Send; + +#[cfg(not_send)] +type Foo = impl Sized; + +fn needs_send<T: Send>() {} + +fn test(_: Foo) { + needs_send::<Foo>(); + //[not_send]~^ ERROR type annotations needed: cannot satisfy `Foo: Send` +} + +fn defines(_: Foo) { + let _: Foo = (); +} + +fn main() {} diff --git a/tests/ui/traits/new-solver/dyn-any-dont-prefer-impl.rs b/tests/ui/traits/new-solver/dyn-any-dont-prefer-impl.rs new file mode 100644 index 00000000000..7d15b8c6392 --- /dev/null +++ b/tests/ui/traits/new-solver/dyn-any-dont-prefer-impl.rs @@ -0,0 +1,13 @@ +// compile-flags: -Ztrait-solver=next +// check-pass + +use std::any::Any; + +fn needs_usize(_: &usize) {} + +fn main() { + let x: &dyn Any = &1usize; + if let Some(x) = x.downcast_ref::<usize>() { + needs_usize(x); + } +} diff --git a/tests/ui/traits/new-solver/equating-projection-cyclically.rs b/tests/ui/traits/new-solver/equating-projection-cyclically.rs index 019c6e81c50..2668da1b745 100644 --- a/tests/ui/traits/new-solver/equating-projection-cyclically.rs +++ b/tests/ui/traits/new-solver/equating-projection-cyclically.rs @@ -1,11 +1,10 @@ // compile-flags: -Ztrait-solver=next -// known-bug: unknown trait Test { type Assoc; } -fn transform<T: Test>(x: T) -> T::Assoc { +fn transform<T: Test>(x: Inv<T>) -> Inv<T::Assoc> { todo!() } @@ -17,8 +16,13 @@ impl Test for String { type Assoc = String; } +struct Inv<T>(Option<*mut T>); + fn main() { - let mut x = Default::default(); + let mut x: Inv<_> = Inv(None); + // This ends up equating `Inv<?x>` with `Inv<<?x as Test>::Assoc>` + // which fails the occurs check when generalizing `?x`. x = transform(x); - x = 1i32; + //~^ ERROR mismatched types + x = Inv::<i32>(None); } diff --git a/tests/ui/traits/new-solver/equating-projection-cyclically.stderr b/tests/ui/traits/new-solver/equating-projection-cyclically.stderr index 57cbc65a17a..6031d4f08ee 100644 --- a/tests/ui/traits/new-solver/equating-projection-cyclically.stderr +++ b/tests/ui/traits/new-solver/equating-projection-cyclically.stderr @@ -1,13 +1,8 @@ error[E0308]: mismatched types - --> $DIR/equating-projection-cyclically.rs:22:19 + --> $DIR/equating-projection-cyclically.rs:25:9 | LL | x = transform(x); - | ^ expected inferred type, found associated type - | - = note: expected type `_` - found associated type `<_ as Test>::Assoc` - = help: consider constraining the associated type `<_ as Test>::Assoc` to `_` - = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html + | ^^^^^^^^^^^^ cyclic type of infinite size error: aborting due to previous error diff --git a/tests/ui/traits/new-solver/lazy-nested-obligations-2.rs b/tests/ui/traits/new-solver/lazy-nested-obligations-2.rs index 32addd829dc..fd91d81cdf0 100644 --- a/tests/ui/traits/new-solver/lazy-nested-obligations-2.rs +++ b/tests/ui/traits/new-solver/lazy-nested-obligations-2.rs @@ -1,6 +1,5 @@ -// check-pass // compile-flags: -Ztrait-solver=next -// Issue 95863 +// known-bug: #95863 pub trait With { type F; diff --git a/tests/ui/traits/new-solver/lazy-nested-obligations-2.stderr b/tests/ui/traits/new-solver/lazy-nested-obligations-2.stderr new file mode 100644 index 00000000000..d0a4cd661b3 --- /dev/null +++ b/tests/ui/traits/new-solver/lazy-nested-obligations-2.stderr @@ -0,0 +1,39 @@ +error[E0308]: mismatched types + --> $DIR/lazy-nested-obligations-2.rs:15:23 + | +LL | let _: V<i32> = V(f); + | - ^ types differ + | | + | arguments to this struct are incorrect + | + = note: expected associated type `<i32 as With>::F` + found fn item `for<'a> fn(&'a str) {f}` + = help: consider constraining the associated type `<i32 as With>::F` to `for<'a> fn(&'a str) {f}` or calling a method that returns `<i32 as With>::F` + = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html +note: tuple struct defined here + --> $DIR/lazy-nested-obligations-2.rs:16:16 + | +LL | pub struct V<T: With>(<T as With>::F); + | ^ + +error[E0308]: mismatched types + --> $DIR/lazy-nested-obligations-2.rs:21:30 + | +LL | let _: E3<i32> = E3::Var(f); + | ------- ^ types differ + | | + | arguments to this enum variant are incorrect + | + = note: expected associated type `<i32 as With>::F` + found fn item `for<'a> fn(&'a str) {f}` + = help: consider constraining the associated type `<i32 as With>::F` to `for<'a> fn(&'a str) {f}` or calling a method that returns `<i32 as With>::F` + = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html +note: tuple variant defined here + --> $DIR/lazy-nested-obligations-2.rs:19:9 + | +LL | Var(<T as With>::F), + | ^^^ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/traits/new-solver/object-unsafety.rs b/tests/ui/traits/new-solver/object-unsafety.rs index 7bdd863a762..da843c91478 100644 --- a/tests/ui/traits/new-solver/object-unsafety.rs +++ b/tests/ui/traits/new-solver/object-unsafety.rs @@ -10,7 +10,15 @@ fn copy<U: Setup + ?Sized>(from: &U::From) -> U::From { pub fn copy_any<T>(t: &T) -> T { copy::<dyn Setup<From=T>>(t) - //~^ ERROR the trait bound `dyn Setup<From = T>: Setup` is not satisfied + //~^ ERROR the type `&<dyn Setup<From = T> as Setup>::From` is not well-formed + //~| ERROR the trait bound `dyn Setup<From = T>: Setup` is not satisfied + //~| ERROR mismatched types + //~| ERROR mismatched types + //~| ERROR the type `<dyn Setup<From = T> as Setup>::From` is not well-formed + //~| ERROR the size for values of type `<dyn Setup<From = T> as Setup>::From` cannot be known at compilation time + + // FIXME(-Ztrait-solver=next): These error messages are horrible and some of them + // are even simple fallout from previous error. } fn main() { diff --git a/tests/ui/traits/new-solver/object-unsafety.stderr b/tests/ui/traits/new-solver/object-unsafety.stderr index 198ac623df8..bb7c68b8941 100644 --- a/tests/ui/traits/new-solver/object-unsafety.stderr +++ b/tests/ui/traits/new-solver/object-unsafety.stderr @@ -14,6 +14,65 @@ help: consider introducing a `where` clause, but there might be an alternative b LL | pub fn copy_any<T>(t: &T) -> T where dyn Setup<From = T>: Setup { | ++++++++++++++++++++++++++++++++ -error: aborting due to previous error +error: the type `&<dyn Setup<From = T> as Setup>::From` is not well-formed + --> $DIR/object-unsafety.rs:12:31 + | +LL | copy::<dyn Setup<From=T>>(t) + | ^ + +error[E0308]: mismatched types + --> $DIR/object-unsafety.rs:12:31 + | +LL | copy::<dyn Setup<From=T>>(t) + | ------------------------- ^ types differ + | | + | arguments to this function are incorrect + | + = note: expected reference `&<dyn Setup<From = T> as Setup>::From` + found reference `&T` +note: function defined here + --> $DIR/object-unsafety.rs:7:4 + | +LL | fn copy<U: Setup + ?Sized>(from: &U::From) -> U::From { + | ^^^^ -------------- + +error[E0308]: mismatched types + --> $DIR/object-unsafety.rs:12:5 + | +LL | pub fn copy_any<T>(t: &T) -> T { + | - - expected `T` because of return type + | | + | this type parameter +LL | copy::<dyn Setup<From=T>>(t) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ types differ + | + = note: expected type parameter `T` + found associated type `<dyn Setup<From = T> as Setup>::From` + = note: you might be missing a type parameter or trait bound + +error: the type `<dyn Setup<From = T> as Setup>::From` is not well-formed + --> $DIR/object-unsafety.rs:12:5 + | +LL | copy::<dyn Setup<From=T>>(t) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0277]: the size for values of type `<dyn Setup<From = T> as Setup>::From` cannot be known at compilation time + --> $DIR/object-unsafety.rs:12:5 + | +LL | copy::<dyn Setup<From=T>>(t) + | ^^^^^^^^^^^^^^^^^^^^^^^^^--- + | | + | doesn't have a size known at compile-time + | this returned value is of type `<dyn Setup<From = T> as Setup>::From` + | + = help: the trait `Sized` is not implemented for `<dyn Setup<From = T> as Setup>::From` + = note: the return type of a function must have a statically known size +help: consider further restricting the associated type + | +LL | pub fn copy_any<T>(t: &T) -> T where <dyn Setup<From = T> as Setup>::From: Sized { + | +++++++++++++++++++++++++++++++++++++++++++++++++ + +error: aborting due to 6 previous errors -For more information about this error, try `rustc --explain E0277`. +Some errors have detailed explanations: E0277, E0308. +For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/new-solver/recursive-self-normalization-2.rs b/tests/ui/traits/new-solver/recursive-self-normalization-2.rs index 8c029f5179d..d086db475ac 100644 --- a/tests/ui/traits/new-solver/recursive-self-normalization-2.rs +++ b/tests/ui/traits/new-solver/recursive-self-normalization-2.rs @@ -1,3 +1,4 @@ +//~ ERROR overflow // compile-flags: -Ztrait-solver=next trait Foo1 { diff --git a/tests/ui/traits/new-solver/recursive-self-normalization-2.stderr b/tests/ui/traits/new-solver/recursive-self-normalization-2.stderr index 139b0a45680..eebaf21d7df 100644 --- a/tests/ui/traits/new-solver/recursive-self-normalization-2.stderr +++ b/tests/ui/traits/new-solver/recursive-self-normalization-2.stderr @@ -1,16 +1,20 @@ error[E0275]: overflow evaluating the requirement `<T as Foo1>::Assoc1: Bar` - --> $DIR/recursive-self-normalization-2.rs:15:5 + --> $DIR/recursive-self-normalization-2.rs:16:5 | LL | needs_bar::<T::Assoc1>(); | ^^^^^^^^^^^^^^^^^^^^^^ | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`recursive_self_normalization_2`) note: required by a bound in `needs_bar` - --> $DIR/recursive-self-normalization-2.rs:12:17 + --> $DIR/recursive-self-normalization-2.rs:13:17 | LL | fn needs_bar<S: Bar>() {} | ^^^ required by this bound in `needs_bar` -error: aborting due to previous error +error[E0275]: overflow evaluating the requirement `<T as Foo2>::Assoc2` + | + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`recursive_self_normalization_2`) + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/traits/new-solver/recursive-self-normalization.rs b/tests/ui/traits/new-solver/recursive-self-normalization.rs index 06d187b5fdf..d15df7dea73 100644 --- a/tests/ui/traits/new-solver/recursive-self-normalization.rs +++ b/tests/ui/traits/new-solver/recursive-self-normalization.rs @@ -1,3 +1,4 @@ +//~ ERROR overflow evaluating the requirement `<T as Foo>::Assoc` [E0275] // compile-flags: -Ztrait-solver=next trait Foo { diff --git a/tests/ui/traits/new-solver/recursive-self-normalization.stderr b/tests/ui/traits/new-solver/recursive-self-normalization.stderr index 8e9b9b4b4ce..6a87fe2f121 100644 --- a/tests/ui/traits/new-solver/recursive-self-normalization.stderr +++ b/tests/ui/traits/new-solver/recursive-self-normalization.stderr @@ -1,16 +1,20 @@ error[E0275]: overflow evaluating the requirement `<T as Foo>::Assoc: Bar` - --> $DIR/recursive-self-normalization.rs:11:5 + --> $DIR/recursive-self-normalization.rs:12:5 | LL | needs_bar::<T::Assoc>(); | ^^^^^^^^^^^^^^^^^^^^^ | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`recursive_self_normalization`) note: required by a bound in `needs_bar` - --> $DIR/recursive-self-normalization.rs:8:17 + --> $DIR/recursive-self-normalization.rs:9:17 | LL | fn needs_bar<S: Bar>() {} | ^^^ required by this bound in `needs_bar` -error: aborting due to previous error +error[E0275]: overflow evaluating the requirement `<T as Foo>::Assoc` + | + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`recursive_self_normalization`) + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/traits/new-solver/slice-match-byte-lit.rs b/tests/ui/traits/new-solver/slice-match-byte-lit.rs index 5f9c0df6450..4f848062595 100644 --- a/tests/ui/traits/new-solver/slice-match-byte-lit.rs +++ b/tests/ui/traits/new-solver/slice-match-byte-lit.rs @@ -1,5 +1,5 @@ // compile-flags: -Ztrait-solver=next -// known-bug: rust-lang/trait-system-refactor-initiative#38 +// check-pass fn test(s: &[u8]) { match &s[0..3] { diff --git a/tests/ui/traits/new-solver/slice-match-byte-lit.stderr b/tests/ui/traits/new-solver/slice-match-byte-lit.stderr deleted file mode 100644 index 294e8bc94be..00000000000 --- a/tests/ui/traits/new-solver/slice-match-byte-lit.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0271]: type mismatch resolving `[u8; 3] <: <Range<usize> as SliceIndex<[u8]>>::Output` - --> $DIR/slice-match-byte-lit.rs:6:9 - | -LL | match &s[0..3] { - | -------- this expression has type `&<std::ops::Range<usize> as SliceIndex<[u8]>>::Output` -LL | b"uwu" => {} - | ^^^^^^ types differ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0271`. diff --git a/tests/ui/traits/new-solver/specialization-transmute.rs b/tests/ui/traits/new-solver/specialization-transmute.rs index a54701df4ef..f6b19e7adf5 100644 --- a/tests/ui/traits/new-solver/specialization-transmute.rs +++ b/tests/ui/traits/new-solver/specialization-transmute.rs @@ -10,12 +10,11 @@ trait Default { } impl<T> Default for T { - default type Id = T; - - fn intu(&self) -> &Self::Id { + default type Id = T; + // This will be fixed by #111994 + fn intu(&self) -> &Self::Id { //~ ERROR type annotations needed self - //~^ ERROR cannot satisfy `T <: <T as Default>::Id` - } + } } fn transmute<T: Default<Id = U>, U: Copy>(t: T) -> U { @@ -24,7 +23,6 @@ fn transmute<T: Default<Id = U>, U: Copy>(t: T) -> U { use std::num::NonZeroU8; fn main() { - let s = transmute::<u8, Option<NonZeroU8>>(0); - //~^ ERROR cannot satisfy `<u8 as Default>::Id == Option<NonZeroU8> + let s = transmute::<u8, Option<NonZeroU8>>(0); // this call should then error assert_eq!(s, None); } diff --git a/tests/ui/traits/new-solver/specialization-transmute.stderr b/tests/ui/traits/new-solver/specialization-transmute.stderr index e67c56afc0d..09b1405fefb 100644 --- a/tests/ui/traits/new-solver/specialization-transmute.stderr +++ b/tests/ui/traits/new-solver/specialization-transmute.stderr @@ -8,24 +8,14 @@ LL | #![feature(specialization)] = help: consider using `min_specialization` instead, which is more stable and complete = note: `#[warn(incomplete_features)]` on by default -error[E0284]: type annotations needed: cannot satisfy `T <: <T as Default>::Id` - --> $DIR/specialization-transmute.rs:16:9 +error[E0284]: type annotations needed + --> $DIR/specialization-transmute.rs:15:23 | -LL | self - | ^^^^ cannot satisfy `T <: <T as Default>::Id` - -error[E0284]: type annotations needed: cannot satisfy `<u8 as Default>::Id == Option<NonZeroU8>` - --> $DIR/specialization-transmute.rs:27:13 - | -LL | let s = transmute::<u8, Option<NonZeroU8>>(0); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot satisfy `<u8 as Default>::Id == Option<NonZeroU8>` - | -note: required by a bound in `transmute` - --> $DIR/specialization-transmute.rs:21:25 +LL | fn intu(&self) -> &Self::Id { + | ^^^^^^^^^ cannot infer type | -LL | fn transmute<T: Default<Id = U>, U: Copy>(t: T) -> U { - | ^^^^^^ required by this bound in `transmute` + = note: cannot satisfy `<T as Default>::Id == _` -error: aborting due to 2 previous errors; 1 warning emitted +error: aborting due to previous error; 1 warning emitted For more information about this error, try `rustc --explain E0284`. diff --git a/tests/ui/traits/new-solver/specialization-unconstrained.rs b/tests/ui/traits/new-solver/specialization-unconstrained.rs index 02150689ee5..7fd753109be 100644 --- a/tests/ui/traits/new-solver/specialization-unconstrained.rs +++ b/tests/ui/traits/new-solver/specialization-unconstrained.rs @@ -11,7 +11,7 @@ trait Default { } impl<T> Default for T { - default type Id = T; + default type Id = T; //~ ERROR type annotations needed } fn test<T: Default<Id = U>, U>() {} diff --git a/tests/ui/traits/new-solver/specialization-unconstrained.stderr b/tests/ui/traits/new-solver/specialization-unconstrained.stderr index 910925cbaeb..9915da1a27a 100644 --- a/tests/ui/traits/new-solver/specialization-unconstrained.stderr +++ b/tests/ui/traits/new-solver/specialization-unconstrained.stderr @@ -8,6 +8,12 @@ LL | #![feature(specialization)] = help: consider using `min_specialization` instead, which is more stable and complete = note: `#[warn(incomplete_features)]` on by default +error[E0282]: type annotations needed + --> $DIR/specialization-unconstrained.rs:14:22 + | +LL | default type Id = T; + | ^ cannot infer type for associated type `<T as Default>::Id` + error[E0284]: type annotations needed: cannot satisfy `<u32 as Default>::Id == ()` --> $DIR/specialization-unconstrained.rs:20:5 | @@ -20,6 +26,7 @@ note: required by a bound in `test` LL | fn test<T: Default<Id = U>, U>() {} | ^^^^^^ required by this bound in `test` -error: aborting due to previous error; 1 warning emitted +error: aborting due to 2 previous errors; 1 warning emitted -For more information about this error, try `rustc --explain E0284`. +Some errors have detailed explanations: E0282, E0284. +For more information about an error, try `rustc --explain E0282`. diff --git a/tests/ui/traits/new-solver/tait-eq-proj-2.rs b/tests/ui/traits/new-solver/tait-eq-proj-2.rs index 99a3d02bd1a..77ea8bc246e 100644 --- a/tests/ui/traits/new-solver/tait-eq-proj-2.rs +++ b/tests/ui/traits/new-solver/tait-eq-proj-2.rs @@ -8,9 +8,11 @@ type Tait = impl Iterator<Item = impl Sized>; -fn mk<T>() -> T { todo!() } +fn mk<T>() -> T { + todo!() +} -fn a() { +fn a(_: Tait) { let x: Tait = mk(); let mut array = mk(); let mut z = IntoIterator::into_iter(array); diff --git a/tests/ui/traits/new-solver/tait-eq-proj.rs b/tests/ui/traits/new-solver/tait-eq-proj.rs index 01141b2819a..01ef2ec953a 100644 --- a/tests/ui/traits/new-solver/tait-eq-proj.rs +++ b/tests/ui/traits/new-solver/tait-eq-proj.rs @@ -28,7 +28,7 @@ goals together. Essentially: */ -fn a() { +fn a(_: Tait) { let _: Tait = IntoIterator::into_iter([0i32; 32]); } diff --git a/tests/ui/traits/new-solver/tait-eq-tait.rs b/tests/ui/traits/new-solver/tait-eq-tait.rs index 532c4c39bd4..70d9dc0eaa8 100644 --- a/tests/ui/traits/new-solver/tait-eq-tait.rs +++ b/tests/ui/traits/new-solver/tait-eq-tait.rs @@ -6,12 +6,13 @@ #![feature(type_alias_impl_trait)] -type Tait = impl Sized; -type Tait2 = impl Sized; - -fn mk<T>() -> T { todo!() } +fn mk<T>() -> T { + todo!() +} fn main() { + type Tait = impl Sized; + type Tait2 = impl Sized; let x: Tait = 1u32; let y: Tait2 = x; } diff --git a/tests/ui/traits/new-solver/two-projection-param-candidates-are-ambiguous.stderr b/tests/ui/traits/new-solver/two-projection-param-candidates-are-ambiguous.stderr index fa5e780ee5e..83a0452b088 100644 --- a/tests/ui/traits/new-solver/two-projection-param-candidates-are-ambiguous.stderr +++ b/tests/ui/traits/new-solver/two-projection-param-candidates-are-ambiguous.stderr @@ -5,6 +5,7 @@ LL | needs_bar::<T>(); | ^^^^^^^^^^^^^^ | = note: cannot satisfy `T: Bar` + = help: the trait `Bar` is implemented for `T` note: required by a bound in `needs_bar` --> $DIR/two-projection-param-candidates-are-ambiguous.rs:23:17 | diff --git a/tests/ui/traits/new-solver/winnow-specializing-impls.rs b/tests/ui/traits/new-solver/winnow-specializing-impls.rs new file mode 100644 index 00000000000..06f64de7403 --- /dev/null +++ b/tests/ui/traits/new-solver/winnow-specializing-impls.rs @@ -0,0 +1,22 @@ +// build-pass +// compile-flags: -Ztrait-solver=next + +// Tests that the specializing impl `<() as Foo>` holds during codegen. + +#![feature(min_specialization)] + +trait Foo { + fn bar(); +} + +impl<T> Foo for T { + default fn bar() {} +} + +impl Foo for () { + fn bar() {} +} + +fn main() { + <() as Foo>::bar(); +} diff --git a/tests/ui/traits/non_lifetime_binders/nested-apit-mentioning-outer-bound-var.rs b/tests/ui/traits/non_lifetime_binders/nested-apit-mentioning-outer-bound-var.rs new file mode 100644 index 00000000000..e9ae00df7a0 --- /dev/null +++ b/tests/ui/traits/non_lifetime_binders/nested-apit-mentioning-outer-bound-var.rs @@ -0,0 +1,11 @@ +#![feature(non_lifetime_binders)] +//~^ WARN the feature `non_lifetime_binders` is incomplete + +trait Trait<Input> { + type Assoc; +} + +fn uwu(_: impl for<T> Trait<(), Assoc = impl Trait<T>>) {} +//~^ ERROR `impl Trait` can only mention type parameters from an fn or impl + +fn main() {} diff --git a/tests/ui/traits/non_lifetime_binders/nested-apit-mentioning-outer-bound-var.stderr b/tests/ui/traits/non_lifetime_binders/nested-apit-mentioning-outer-bound-var.stderr new file mode 100644 index 00000000000..1124076c23c --- /dev/null +++ b/tests/ui/traits/non_lifetime_binders/nested-apit-mentioning-outer-bound-var.stderr @@ -0,0 +1,17 @@ +warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/nested-apit-mentioning-outer-bound-var.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: `impl Trait` can only mention type parameters from an fn or impl + --> $DIR/nested-apit-mentioning-outer-bound-var.rs:8:52 + | +LL | fn uwu(_: impl for<T> Trait<(), Assoc = impl Trait<T>>) {} + | - type parameter declared here ^ + +error: aborting due to previous error; 1 warning emitted + diff --git a/tests/ui/traits/trivial_impl.rs b/tests/ui/traits/trivial_impl.rs new file mode 100644 index 00000000000..6ac8c744bc4 --- /dev/null +++ b/tests/ui/traits/trivial_impl.rs @@ -0,0 +1,18 @@ +//! This test checks that we do need to implement +//! all members, even if their where bounds only hold +//! due to other impls. + +trait Foo<T> { + fn foo() + where + Self: Foo<()>; +} + +impl Foo<()> for () { + fn foo() {} +} + +impl Foo<u32> for () {} +//~^ ERROR: not all trait items implemented, missing: `foo` + +fn main() {} diff --git a/tests/ui/traits/trivial_impl.stderr b/tests/ui/traits/trivial_impl.stderr new file mode 100644 index 00000000000..4b29b55bea1 --- /dev/null +++ b/tests/ui/traits/trivial_impl.stderr @@ -0,0 +1,14 @@ +error[E0046]: not all trait items implemented, missing: `foo` + --> $DIR/trivial_impl.rs:15:1 + | +LL | / fn foo() +LL | | where +LL | | Self: Foo<()>; + | |______________________- `foo` from trait +... +LL | impl Foo<u32> for () {} + | ^^^^^^^^^^^^^^^^^^^^ missing `foo` in implementation + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0046`. diff --git a/tests/ui/traits/trivial_impl2.rs b/tests/ui/traits/trivial_impl2.rs new file mode 100644 index 00000000000..be58096007f --- /dev/null +++ b/tests/ui/traits/trivial_impl2.rs @@ -0,0 +1,13 @@ +//! This test checks that we currently need to implement +//! members, even if their where bounds don't hold for the impl type. + +trait Foo<T> { + fn foo() + where + Self: Foo<()>; +} + +impl Foo<u32> for () {} +//~^ ERROR: not all trait items implemented, missing: `foo` + +fn main() {} diff --git a/tests/ui/traits/trivial_impl2.stderr b/tests/ui/traits/trivial_impl2.stderr new file mode 100644 index 00000000000..04c05df0616 --- /dev/null +++ b/tests/ui/traits/trivial_impl2.stderr @@ -0,0 +1,14 @@ +error[E0046]: not all trait items implemented, missing: `foo` + --> $DIR/trivial_impl2.rs:10:1 + | +LL | / fn foo() +LL | | where +LL | | Self: Foo<()>; + | |______________________- `foo` from trait +... +LL | impl Foo<u32> for () {} + | ^^^^^^^^^^^^^^^^^^^^ missing `foo` in implementation + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0046`. diff --git a/tests/ui/traits/trivial_impl3.rs b/tests/ui/traits/trivial_impl3.rs new file mode 100644 index 00000000000..714f643bc99 --- /dev/null +++ b/tests/ui/traits/trivial_impl3.rs @@ -0,0 +1,19 @@ +//! Check that we don't break orphan rules. +//! The dependency may add an impl for `u8` later, +//! which would break this crate. We want to avoid adding +//! more ways in which adding an impl can be a breaking change. + +// aux-build:trivial3.rs + +extern crate trivial3; + +pub trait Foo { + fn foo() + where + Self: trivial3::Trait; +} + +impl Foo for u8 {} +//~^ ERROR not all trait items implemented, missing: `foo` + +fn main() {} diff --git a/tests/ui/traits/trivial_impl3.stderr b/tests/ui/traits/trivial_impl3.stderr new file mode 100644 index 00000000000..dfb39d6ce15 --- /dev/null +++ b/tests/ui/traits/trivial_impl3.stderr @@ -0,0 +1,14 @@ +error[E0046]: not all trait items implemented, missing: `foo` + --> $DIR/trivial_impl3.rs:16:1 + | +LL | / fn foo() +LL | | where +LL | | Self: trivial3::Trait; + | |______________________________- `foo` from trait +... +LL | impl Foo for u8 {} + | ^^^^^^^^^^^^^^^ missing `foo` in implementation + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0046`. diff --git a/tests/ui/traits/trivial_impl4.rs b/tests/ui/traits/trivial_impl4.rs new file mode 100644 index 00000000000..518f159c1fb --- /dev/null +++ b/tests/ui/traits/trivial_impl4.rs @@ -0,0 +1,21 @@ +//! Check that we don't break orphan rules. +//! The dependency may add an impl for `u8` later, +//! which would break this crate. We want to avoid adding +//! more ways in which adding an impl can be a breaking change. +//! This test differs from `trivial_impl3` because there actually +//! exists any impl for `Trait`, which has an effect on coherence. + +// aux-build:trivial4.rs + +extern crate trivial4; + +pub trait Foo { + fn foo() + where + Self: trivial4::Trait; +} + +impl Foo for u8 {} +//~^ ERROR not all trait items implemented, missing: `foo` + +fn main() {} diff --git a/tests/ui/traits/trivial_impl4.stderr b/tests/ui/traits/trivial_impl4.stderr new file mode 100644 index 00000000000..04b29ed7734 --- /dev/null +++ b/tests/ui/traits/trivial_impl4.stderr @@ -0,0 +1,14 @@ +error[E0046]: not all trait items implemented, missing: `foo` + --> $DIR/trivial_impl4.rs:18:1 + | +LL | / fn foo() +LL | | where +LL | | Self: trivial4::Trait; + | |______________________________- `foo` from trait +... +LL | impl Foo for u8 {} + | ^^^^^^^^^^^^^^^ missing `foo` in implementation + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0046`. diff --git a/tests/ui/traits/trivial_impl_sized.rs b/tests/ui/traits/trivial_impl_sized.rs new file mode 100644 index 00000000000..501a3405090 --- /dev/null +++ b/tests/ui/traits/trivial_impl_sized.rs @@ -0,0 +1,26 @@ +//! This test checks that we currently need to implement +//! members, even if their where bounds don't hold for the impl type. + +trait Foo { + fn foo() + where + Self: Sized; +} + +impl Foo for () { + fn foo() {} +} + +// Must not be allowed +impl Foo for i32 {} +//~^ ERROR: not all trait items implemented, missing: `foo` + +// Should be allowed +impl Foo for dyn std::fmt::Debug {} +//~^ ERROR: not all trait items implemented, missing: `foo` + +impl Foo for dyn std::fmt::Display { + fn foo() {} +} + +fn main() {} diff --git a/tests/ui/traits/trivial_impl_sized.stderr b/tests/ui/traits/trivial_impl_sized.stderr new file mode 100644 index 00000000000..ebf6dfc9dd2 --- /dev/null +++ b/tests/ui/traits/trivial_impl_sized.stderr @@ -0,0 +1,25 @@ +error[E0046]: not all trait items implemented, missing: `foo` + --> $DIR/trivial_impl_sized.rs:15:1 + | +LL | / fn foo() +LL | | where +LL | | Self: Sized; + | |____________________- `foo` from trait +... +LL | impl Foo for i32 {} + | ^^^^^^^^^^^^^^^^ missing `foo` in implementation + +error[E0046]: not all trait items implemented, missing: `foo` + --> $DIR/trivial_impl_sized.rs:19:1 + | +LL | / fn foo() +LL | | where +LL | | Self: Sized; + | |____________________- `foo` from trait +... +LL | impl Foo for dyn std::fmt::Debug {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `foo` in implementation + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0046`. diff --git a/tests/ui/treat-err-as-bug/panic-causes-oom-112708.rs b/tests/ui/treat-err-as-bug/panic-causes-oom-112708.rs new file mode 100644 index 00000000000..c7d480a773d --- /dev/null +++ b/tests/ui/treat-err-as-bug/panic-causes-oom-112708.rs @@ -0,0 +1,10 @@ +// compile-flags: -Ztreat-err-as-bug +// dont-check-failure-status +// error-pattern: aborting due to `-Z treat-err-as-bug=1` +// dont-check-compiler-stderr +// rustc-env:RUST_BACKTRACE=0 + +fn main() { + #[deny(while_true)] + while true {} +} diff --git a/tests/ui/treat-err-as-bug/panic-causes-oom-112708.stderr b/tests/ui/treat-err-as-bug/panic-causes-oom-112708.stderr new file mode 100644 index 00000000000..2d49071ac49 --- /dev/null +++ b/tests/ui/treat-err-as-bug/panic-causes-oom-112708.stderr @@ -0,0 +1,32 @@ +error: denote infinite loops with `loop { ... }` + --> $DIR/panic-causes-oom-112708.rs:13:5 + | +LL | while true {} + | ^^^^^^^^^^ help: use `loop` + | +note: the lint level is defined here + --> $DIR/panic-causes-oom-112708.rs:12:12 + | +LL | #[deny(while_true)] + | ^^^^^^^^^^ + + +query stack during panic: +#0 [early_lint_checks] perform lints prior to macro expansion +#1 [hir_crate] getting the crate HIR +end of query stack + +error: the compiler unexpectedly panicked. this is a bug. + +query stack during panic: +#0 [early_lint_checks] perform lints prior to macro expansion +#1 [hir_crate] getting the crate HIR +end of query stack + +error: the compiler unexpectedly panicked. this is a bug. + +query stack during panic: +#0 [early_lint_checks] perform lints prior to macro expansion +#1 [hir_crate] getting the crate HIR +end of query stack +thread caused non-unwinding panic. aborting. diff --git a/tests/ui/type-alias-impl-trait/auto-trait-leakage3.rs b/tests/ui/type-alias-impl-trait/auto-trait-leakage3.rs index 5fb7a9473d3..fd3f9c61420 100644 --- a/tests/ui/type-alias-impl-trait/auto-trait-leakage3.rs +++ b/tests/ui/type-alias-impl-trait/auto-trait-leakage3.rs @@ -4,8 +4,9 @@ // FIXME This should compile, but it currently doesn't mod m { - type Foo = impl std::fmt::Debug; + pub type Foo = impl std::fmt::Debug; //~^ ERROR: cycle detected when computing type of `m::Foo::{opaque#0}` [E0391] + //~| ERROR: cycle detected when computing type of `m::Foo::{opaque#0}` [E0391] pub fn foo() -> Foo { 22_u32 @@ -13,6 +14,7 @@ mod m { pub fn bar() { is_send(foo()); + //~^ ERROR: cannot check whether the hidden type of `auto_trait_leakage3[211d]::m::Foo::{opaque#0} } fn is_send<T: Send>(_: T) {} diff --git a/tests/ui/type-alias-impl-trait/auto-trait-leakage3.stderr b/tests/ui/type-alias-impl-trait/auto-trait-leakage3.stderr index 1e9a45aac79..dd56c59bf5f 100644 --- a/tests/ui/type-alias-impl-trait/auto-trait-leakage3.stderr +++ b/tests/ui/type-alias-impl-trait/auto-trait-leakage3.stderr @@ -1,11 +1,11 @@ error[E0391]: cycle detected when computing type of `m::Foo::{opaque#0}` - --> $DIR/auto-trait-leakage3.rs:7:16 + --> $DIR/auto-trait-leakage3.rs:7:20 | -LL | type Foo = impl std::fmt::Debug; - | ^^^^^^^^^^^^^^^^^^^^ +LL | pub type Foo = impl std::fmt::Debug; + | ^^^^^^^^^^^^^^^^^^^^ | note: ...which requires type-checking `m::bar`... - --> $DIR/auto-trait-leakage3.rs:15:9 + --> $DIR/auto-trait-leakage3.rs:16:9 | LL | is_send(foo()); | ^^^^^^^ @@ -17,6 +17,48 @@ note: cycle used when checking item types in module `m` LL | mod m { | ^^^^^ -error: aborting due to previous error +error[E0391]: cycle detected when computing type of `m::Foo::{opaque#0}` + --> $DIR/auto-trait-leakage3.rs:7:20 + | +LL | pub type Foo = impl std::fmt::Debug; + | ^^^^^^^^^^^^^^^^^^^^ + | +note: ...which requires type-checking `m::bar`... + --> $DIR/auto-trait-leakage3.rs:15:5 + | +LL | pub fn bar() { + | ^^^^^^^^^^^^ + = note: ...which again requires computing type of `m::Foo::{opaque#0}`, completing the cycle +note: cycle used when checking item types in module `m` + --> $DIR/auto-trait-leakage3.rs:6:1 + | +LL | mod m { + | ^^^^^ + +error: cannot check whether the hidden type of `auto_trait_leakage3[211d]::m::Foo::{opaque#0}` satisfies auto traits + --> $DIR/auto-trait-leakage3.rs:16:17 + | +LL | is_send(foo()); + | ------- ^^^^^ + | | + | required by a bound introduced by this call + | +note: opaque type is declared here + --> $DIR/auto-trait-leakage3.rs:7:20 + | +LL | pub type Foo = impl std::fmt::Debug; + | ^^^^^^^^^^^^^^^^^^^^ +note: this item depends on auto traits of the hidden type, but may also be registering the hidden type. This is not supported right now. You can try moving the opaque type and the item that actually registers a hidden type into a new submodule + --> $DIR/auto-trait-leakage3.rs:15:12 + | +LL | pub fn bar() { + | ^^^ +note: required by a bound in `is_send` + --> $DIR/auto-trait-leakage3.rs:20:19 + | +LL | fn is_send<T: Send>(_: T) {} + | ^^^^ required by this bound in `is_send` + +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0391`. diff --git a/tests/ui/type-alias-impl-trait/bound_reduction2.rs b/tests/ui/type-alias-impl-trait/bound_reduction2.rs index 0bcc9e002ca..4e9f65d88a1 100644 --- a/tests/ui/type-alias-impl-trait/bound_reduction2.rs +++ b/tests/ui/type-alias-impl-trait/bound_reduction2.rs @@ -13,6 +13,7 @@ trait Trait<U> {} impl<W> Trait<W> for () {} fn foo_desugared<T: TraitWithAssoc>(_: T) -> Foo<T::Assoc> { + //~^ ERROR non-defining opaque type use () //~^ ERROR expected generic type parameter, found `<T as TraitWithAssoc>::Assoc` } diff --git a/tests/ui/type-alias-impl-trait/bound_reduction2.stderr b/tests/ui/type-alias-impl-trait/bound_reduction2.stderr index 3c259bd9e97..14f9dbbdb4e 100644 --- a/tests/ui/type-alias-impl-trait/bound_reduction2.stderr +++ b/tests/ui/type-alias-impl-trait/bound_reduction2.stderr @@ -1,5 +1,17 @@ +error[E0792]: non-defining opaque type use in defining scope + --> $DIR/bound_reduction2.rs:15:46 + | +LL | fn foo_desugared<T: TraitWithAssoc>(_: T) -> Foo<T::Assoc> { + | ^^^^^^^^^^^^^ argument `<T as TraitWithAssoc>::Assoc` is not a generic parameter + | +note: for this opaque type + --> $DIR/bound_reduction2.rs:9:15 + | +LL | type Foo<V> = impl Trait<V>; + | ^^^^^^^^^^^^^ + error[E0792]: expected generic type parameter, found `<T as TraitWithAssoc>::Assoc` - --> $DIR/bound_reduction2.rs:16:5 + --> $DIR/bound_reduction2.rs:17:5 | LL | type Foo<V> = impl Trait<V>; | - this generic parameter must be used with a generic type parameter @@ -7,6 +19,6 @@ LL | type Foo<V> = impl Trait<V>; LL | () | ^^ -error: aborting due to previous error +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0792`. diff --git a/tests/ui/type-alias-impl-trait/closure_args.rs b/tests/ui/type-alias-impl-trait/closure_args.rs index c5e7af81d3d..243f9cd6d4f 100644 --- a/tests/ui/type-alias-impl-trait/closure_args.rs +++ b/tests/ui/type-alias-impl-trait/closure_args.rs @@ -11,6 +11,13 @@ fn run<F: FnOnce(Input) -> ()>(f: F, i: Input) { f(i); } -fn main() { - run(|x: u32| {println!("{x}");}, 0); +fn bop(_: Input) { + run( + |x: u32| { + println!("{x}"); + }, + 0, + ); } + +fn main() {} diff --git a/tests/ui/type-alias-impl-trait/closure_args2.rs b/tests/ui/type-alias-impl-trait/closure_args2.rs index 82386c280a8..1dd5c3e40cd 100644 --- a/tests/ui/type-alias-impl-trait/closure_args2.rs +++ b/tests/ui/type-alias-impl-trait/closure_args2.rs @@ -1,10 +1,12 @@ -// run-pass +// check-pass #![feature(type_alias_impl_trait)] trait Foo { // This was reachable in https://github.com/rust-lang/rust/issues/100800 - fn foo(&self) { unreachable!() } + fn foo(&self) { + unreachable!() + } } impl<T> Foo for T {} @@ -14,10 +16,17 @@ impl B { } type Input = impl Foo; -fn run1<F: FnOnce(Input)>(f: F, i: Input) {f(i)} -fn run2<F: FnOnce(B)>(f: F, i: B) {f(i)} +fn run1<F: FnOnce(Input)>(f: F, i: Input) { + f(i) +} +fn run2<F: FnOnce(B)>(f: F, i: B) { + f(i) +} -fn main() { - run1(|x: B| {x.foo()}, B); - run2(|x: B| {x.foo()}, B); +fn bop() -> Input { + run1(|x: B| x.foo(), B); + run2(|x: B| x.foo(), B); + panic!() } + +fn main() {} diff --git a/tests/ui/type-alias-impl-trait/cross_inference.rs b/tests/ui/type-alias-impl-trait/cross_inference.rs index 07f3dd1997b..5eaf0ddda99 100644 --- a/tests/ui/type-alias-impl-trait/cross_inference.rs +++ b/tests/ui/type-alias-impl-trait/cross_inference.rs @@ -5,8 +5,8 @@ #![feature(type_alias_impl_trait)] fn main() { - type T = impl Copy; - let foo: T = (1u32, 2u32); + type Tait = impl Copy; + let foo: Tait = (1u32, 2u32); let x: (_, _) = foo; println!("{:?}", x); } diff --git a/tests/ui/type-alias-impl-trait/declared_but_not_defined_in_scope.stderr b/tests/ui/type-alias-impl-trait/declared_but_not_defined_in_scope.stderr index fbfa0ccf1e8..d60f1ffbccc 100644 --- a/tests/ui/type-alias-impl-trait/declared_but_not_defined_in_scope.stderr +++ b/tests/ui/type-alias-impl-trait/declared_but_not_defined_in_scope.stderr @@ -19,6 +19,11 @@ LL | "" | = note: expected opaque type `Boo` found reference `&'static str` +note: this item must have the opaque type in its signature in order to be able to register hidden types + --> $DIR/declared_but_not_defined_in_scope.rs:10:4 + | +LL | fn bomp() -> boo::Boo { + | ^^^^ error: aborting due to 2 previous errors diff --git a/tests/ui/type-alias-impl-trait/different_defining_uses_never_type-2.rs b/tests/ui/type-alias-impl-trait/different_defining_uses_never_type-2.rs index e5bfbfdae91..b2842df150a 100644 --- a/tests/ui/type-alias-impl-trait/different_defining_uses_never_type-2.rs +++ b/tests/ui/type-alias-impl-trait/different_defining_uses_never_type-2.rs @@ -2,7 +2,7 @@ type Tait<'a> = impl Sized + 'a; -fn foo<'a, 'b>() { +fn foo<'a, 'b>() -> Tait<'a> { if false { if { return } { let y: Tait<'b> = 1i32; @@ -10,6 +10,7 @@ fn foo<'a, 'b>() { } } let x: Tait<'a> = (); + x } fn main() {} diff --git a/tests/ui/type-alias-impl-trait/different_defining_uses_never_type-2.stderr b/tests/ui/type-alias-impl-trait/different_defining_uses_never_type-2.stderr index f2eb7bc4dc7..b138f9d5c45 100644 --- a/tests/ui/type-alias-impl-trait/different_defining_uses_never_type-2.stderr +++ b/tests/ui/type-alias-impl-trait/different_defining_uses_never_type-2.stderr @@ -5,10 +5,10 @@ LL | let y: Tait<'b> = 1i32; | ^^^^ expected `()`, got `i32` | note: previous use here - --> $DIR/different_defining_uses_never_type-2.rs:12:23 + --> $DIR/different_defining_uses_never_type-2.rs:7:14 | -LL | let x: Tait<'a> = (); - | ^^ +LL | if { return } { + | ^^^^^^ error: aborting due to previous error diff --git a/tests/ui/type-alias-impl-trait/different_defining_uses_never_type-3.rs b/tests/ui/type-alias-impl-trait/different_defining_uses_never_type-3.rs index 2b30a9cd57c..a4ac27378e1 100644 --- a/tests/ui/type-alias-impl-trait/different_defining_uses_never_type-3.rs +++ b/tests/ui/type-alias-impl-trait/different_defining_uses_never_type-3.rs @@ -2,7 +2,7 @@ type Tait<T> = impl Sized; -fn foo<T, U>() { +fn foo<T, U>() -> Tait<T> { if false { if { return } { let y: Tait<U> = 1i32; @@ -10,6 +10,7 @@ fn foo<T, U>() { } } let x: Tait<T> = (); + x } fn main() {} diff --git a/tests/ui/type-alias-impl-trait/generic_duplicate_lifetime_param.rs b/tests/ui/type-alias-impl-trait/generic_duplicate_lifetime_param.rs index 9d938a61600..14ced341854 100644 --- a/tests/ui/type-alias-impl-trait/generic_duplicate_lifetime_param.rs +++ b/tests/ui/type-alias-impl-trait/generic_duplicate_lifetime_param.rs @@ -9,6 +9,7 @@ impl<'a, T: ?Sized> Captures<'a> for T {} type Two<'a, 'b> = impl std::fmt::Debug + Captures<'a> + Captures<'b>; fn one<'a>(t: &'a ()) -> Two<'a, 'a> { + //~^ ERROR non-defining opaque type use t //~^ ERROR non-defining opaque type use } diff --git a/tests/ui/type-alias-impl-trait/generic_duplicate_lifetime_param.stderr b/tests/ui/type-alias-impl-trait/generic_duplicate_lifetime_param.stderr index 72e1ef4b492..4da69a705c0 100644 --- a/tests/ui/type-alias-impl-trait/generic_duplicate_lifetime_param.stderr +++ b/tests/ui/type-alias-impl-trait/generic_duplicate_lifetime_param.stderr @@ -1,5 +1,17 @@ error: non-defining opaque type use in defining scope - --> $DIR/generic_duplicate_lifetime_param.rs:12:5 + --> $DIR/generic_duplicate_lifetime_param.rs:11:26 + | +LL | fn one<'a>(t: &'a ()) -> Two<'a, 'a> { + | ^^^^^^^^^^^ generic argument `'a` used twice + | +note: for this opaque type + --> $DIR/generic_duplicate_lifetime_param.rs:9:20 + | +LL | type Two<'a, 'b> = impl std::fmt::Debug + Captures<'a> + Captures<'b>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: non-defining opaque type use in defining scope + --> $DIR/generic_duplicate_lifetime_param.rs:13:5 | LL | t | ^ @@ -10,5 +22,5 @@ note: lifetime used multiple times LL | type Two<'a, 'b> = impl std::fmt::Debug + Captures<'a> + Captures<'b>; | ^^ ^^ -error: aborting due to previous error +error: aborting due to 2 previous errors diff --git a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use.rs b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use.rs index 80462f8ac04..1e391b55a4f 100644 --- a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use.rs +++ b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use.rs @@ -1,5 +1,12 @@ #![feature(type_alias_impl_trait)] +//! This test checks various cases where we are using the same +//! generic parameter twice in the parameter list of a TAIT. +//! Within defining scopes that is not legal, because the hidden type +//! is not fully defined then. This could cause us to have a TAIT +//! that doesn't have a hidden type for all possible combinations of generic +//! parameters passed to it. + use std::fmt::Debug; fn main() {} @@ -7,7 +14,6 @@ fn main() {} // test that unused generic parameters are ok type TwoTys<T, U> = impl Debug; - pub trait Captures<'a> {} impl<'a, T: ?Sized> Captures<'a> for T {} @@ -16,18 +22,20 @@ type TwoLifetimes<'a, 'b> = impl Debug + Captures<'a> + Captures<'b>; type TwoConsts<const X: usize, const Y: usize> = impl Debug; - fn one_ty<T: Debug>(t: T) -> TwoTys<T, T> { + //~^ ERROR non-defining opaque type use in defining scope t //~^ ERROR non-defining opaque type use in defining scope } fn one_lifetime<'a>(t: &'a u32) -> TwoLifetimes<'a, 'a> { + //~^ ERROR non-defining opaque type use in defining scope t //~^ ERROR non-defining opaque type use in defining scope } fn one_const<const N: usize>(t: *mut [u8; N]) -> TwoConsts<N, N> { + //~^ ERROR non-defining opaque type use in defining scope t //~^ ERROR non-defining opaque type use in defining scope } diff --git a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use.stderr b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use.stderr index 98e4bfea10d..d8330771d30 100644 --- a/tests/ui/type-alias-impl-trait/generic_duplicate_param_use.stderr +++ b/tests/ui/type-alias-impl-trait/generic_duplicate_param_use.stderr @@ -1,38 +1,74 @@ error: non-defining opaque type use in defining scope - --> $DIR/generic_duplicate_param_use.rs:21:5 + --> $DIR/generic_duplicate_param_use.rs:25:30 + | +LL | fn one_ty<T: Debug>(t: T) -> TwoTys<T, T> { + | ^^^^^^^^^^^^ generic argument `T` used twice + | +note: for this opaque type + --> $DIR/generic_duplicate_param_use.rs:15:21 + | +LL | type TwoTys<T, U> = impl Debug; + | ^^^^^^^^^^ + +error: non-defining opaque type use in defining scope + --> $DIR/generic_duplicate_param_use.rs:27:5 | LL | t | ^ | note: type used multiple times - --> $DIR/generic_duplicate_param_use.rs:8:13 + --> $DIR/generic_duplicate_param_use.rs:15:13 | LL | type TwoTys<T, U> = impl Debug; | ^ ^ error: non-defining opaque type use in defining scope - --> $DIR/generic_duplicate_param_use.rs:26:5 + --> $DIR/generic_duplicate_param_use.rs:31:36 + | +LL | fn one_lifetime<'a>(t: &'a u32) -> TwoLifetimes<'a, 'a> { + | ^^^^^^^^^^^^^^^^^^^^ generic argument `'a` used twice + | +note: for this opaque type + --> $DIR/generic_duplicate_param_use.rs:21:29 + | +LL | type TwoLifetimes<'a, 'b> = impl Debug + Captures<'a> + Captures<'b>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: non-defining opaque type use in defining scope + --> $DIR/generic_duplicate_param_use.rs:33:5 | LL | t | ^ | note: lifetime used multiple times - --> $DIR/generic_duplicate_param_use.rs:15:19 + --> $DIR/generic_duplicate_param_use.rs:21:19 | LL | type TwoLifetimes<'a, 'b> = impl Debug + Captures<'a> + Captures<'b>; | ^^ ^^ error: non-defining opaque type use in defining scope - --> $DIR/generic_duplicate_param_use.rs:31:5 + --> $DIR/generic_duplicate_param_use.rs:37:50 + | +LL | fn one_const<const N: usize>(t: *mut [u8; N]) -> TwoConsts<N, N> { + | ^^^^^^^^^^^^^^^ generic argument `N` used twice + | +note: for this opaque type + --> $DIR/generic_duplicate_param_use.rs:23:50 + | +LL | type TwoConsts<const X: usize, const Y: usize> = impl Debug; + | ^^^^^^^^^^ + +error: non-defining opaque type use in defining scope + --> $DIR/generic_duplicate_param_use.rs:39:5 | LL | t | ^ | note: constant used multiple times - --> $DIR/generic_duplicate_param_use.rs:17:16 + --> $DIR/generic_duplicate_param_use.rs:23:16 | LL | type TwoConsts<const X: usize, const Y: usize> = impl Debug; | ^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^ -error: aborting due to 3 previous errors +error: aborting due to 6 previous errors diff --git a/tests/ui/type-alias-impl-trait/generic_nondefining_use.rs b/tests/ui/type-alias-impl-trait/generic_nondefining_use.rs index e7b8567b9a2..68f4c6923ae 100644 --- a/tests/ui/type-alias-impl-trait/generic_nondefining_use.rs +++ b/tests/ui/type-alias-impl-trait/generic_nondefining_use.rs @@ -13,16 +13,19 @@ type OneConst<const X: usize> = impl Debug; // Not defining uses, because they doesn't define *all* possible generics. fn concrete_ty() -> OneTy<u32> { + //~^ ERROR: non-defining opaque type use in defining scope 5u32 - //~^ ERROR expected generic type parameter, found `u32` + //~^ ERROR: expected generic type parameter, found `u32` } fn concrete_lifetime() -> OneLifetime<'static> { + //~^ ERROR: non-defining opaque type use in defining scope 6u32 - //~^ ERROR expected generic lifetime parameter, found `'static` + //~^ ERROR: expected generic lifetime parameter, found `'static` } fn concrete_const() -> OneConst<{ 123 }> { + //~^ ERROR: non-defining opaque type use in defining scope 7u32 - //~^ ERROR expected generic constant parameter, found `123` + //~^ ERROR: expected generic constant parameter, found `123` } diff --git a/tests/ui/type-alias-impl-trait/generic_nondefining_use.stderr b/tests/ui/type-alias-impl-trait/generic_nondefining_use.stderr index 966fe823f02..e3b7b1a76b0 100644 --- a/tests/ui/type-alias-impl-trait/generic_nondefining_use.stderr +++ b/tests/ui/type-alias-impl-trait/generic_nondefining_use.stderr @@ -1,5 +1,17 @@ +error[E0792]: non-defining opaque type use in defining scope + --> $DIR/generic_nondefining_use.rs:15:21 + | +LL | fn concrete_ty() -> OneTy<u32> { + | ^^^^^^^^^^ argument `u32` is not a generic parameter + | +note: for this opaque type + --> $DIR/generic_nondefining_use.rs:7:17 + | +LL | type OneTy<T> = impl Debug; + | ^^^^^^^^^^ + error[E0792]: expected generic type parameter, found `u32` - --> $DIR/generic_nondefining_use.rs:16:5 + --> $DIR/generic_nondefining_use.rs:17:5 | LL | type OneTy<T> = impl Debug; | - this generic parameter must be used with a generic type parameter @@ -7,8 +19,20 @@ LL | type OneTy<T> = impl Debug; LL | 5u32 | ^^^^ +error[E0792]: non-defining opaque type use in defining scope + --> $DIR/generic_nondefining_use.rs:21:27 + | +LL | fn concrete_lifetime() -> OneLifetime<'static> { + | ^^^^^^^^^^^^^^^^^^^^ argument `'static` is not a generic parameter + | +note: for this opaque type + --> $DIR/generic_nondefining_use.rs:9:24 + | +LL | type OneLifetime<'a> = impl Debug; + | ^^^^^^^^^^ + error[E0792]: expected generic lifetime parameter, found `'static` - --> $DIR/generic_nondefining_use.rs:21:5 + --> $DIR/generic_nondefining_use.rs:23:5 | LL | type OneLifetime<'a> = impl Debug; | -- cannot use static lifetime; use a bound lifetime instead or remove the lifetime parameter from the opaque type @@ -16,8 +40,20 @@ LL | type OneLifetime<'a> = impl Debug; LL | 6u32 | ^^^^ +error[E0792]: non-defining opaque type use in defining scope + --> $DIR/generic_nondefining_use.rs:27:24 + | +LL | fn concrete_const() -> OneConst<{ 123 }> { + | ^^^^^^^^^^^^^^^^^ argument `123` is not a generic parameter + | +note: for this opaque type + --> $DIR/generic_nondefining_use.rs:11:33 + | +LL | type OneConst<const X: usize> = impl Debug; + | ^^^^^^^^^^ + error[E0792]: expected generic constant parameter, found `123` - --> $DIR/generic_nondefining_use.rs:26:5 + --> $DIR/generic_nondefining_use.rs:29:5 | LL | type OneConst<const X: usize> = impl Debug; | -------------- this generic parameter must be used with a generic constant parameter @@ -25,6 +61,6 @@ LL | type OneConst<const X: usize> = impl Debug; LL | 7u32 | ^^^^ -error: aborting due to 3 previous errors +error: aborting due to 6 previous errors For more information about this error, try `rustc --explain E0792`. diff --git a/tests/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.rs b/tests/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.rs index cdd8f6f1976..c60f5c11cd1 100644 --- a/tests/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.rs +++ b/tests/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.rs @@ -5,12 +5,12 @@ fn main() { let x = wrong_generic(&y); let z: i32 = x; //~^ ERROR expected generic type parameter, found `&i32` -} -type WrongGeneric<T> = impl 'static; -//~^ ERROR: at least one trait must be specified + type WrongGeneric<T> = impl 'static; + //~^ ERROR: at least one trait must be specified -fn wrong_generic<T>(t: T) -> WrongGeneric<T> { - t - //~^ ERROR the parameter type `T` may not live long enough + fn wrong_generic<T>(t: T) -> WrongGeneric<T> { + t + //~^ ERROR the parameter type `T` may not live long enough + } } diff --git a/tests/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.stderr b/tests/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.stderr index fa79e51e9f7..8c3a25dbfe7 100644 --- a/tests/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.stderr +++ b/tests/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.stderr @@ -1,8 +1,8 @@ error: at least one trait must be specified - --> $DIR/generic_type_does_not_live_long_enough.rs:10:24 + --> $DIR/generic_type_does_not_live_long_enough.rs:9:28 | -LL | type WrongGeneric<T> = impl 'static; - | ^^^^^^^^^^^^ +LL | type WrongGeneric<T> = impl 'static; + | ^^^^^^^^^^^^ error[E0792]: expected generic type parameter, found `&i32` --> $DIR/generic_type_does_not_live_long_enough.rs:6:18 @@ -10,19 +10,19 @@ error[E0792]: expected generic type parameter, found `&i32` LL | let z: i32 = x; | ^ ... -LL | type WrongGeneric<T> = impl 'static; - | - this generic parameter must be used with a generic type parameter +LL | type WrongGeneric<T> = impl 'static; + | - this generic parameter must be used with a generic type parameter error[E0310]: the parameter type `T` may not live long enough - --> $DIR/generic_type_does_not_live_long_enough.rs:14:5 + --> $DIR/generic_type_does_not_live_long_enough.rs:13:9 | -LL | t - | ^ ...so that the type `T` will meet its required lifetime bounds +LL | t + | ^ ...so that the type `T` will meet its required lifetime bounds | help: consider adding an explicit lifetime bound... | -LL | fn wrong_generic<T: 'static>(t: T) -> WrongGeneric<T> { - | +++++++++ +LL | fn wrong_generic<T: 'static>(t: T) -> WrongGeneric<T> { + | +++++++++ error: aborting due to 3 previous errors diff --git a/tests/ui/type-alias-impl-trait/higher_kinded_params.rs b/tests/ui/type-alias-impl-trait/higher_kinded_params.rs new file mode 100644 index 00000000000..db1a3a1c7a9 --- /dev/null +++ b/tests/ui/type-alias-impl-trait/higher_kinded_params.rs @@ -0,0 +1,28 @@ +//! This test checks that walking into binders +//! during opaque type collection does not ICE or raise errors. + +// edition: 2021 + +// check-pass + +#![feature(type_alias_impl_trait)] + +trait B { + type C; +} + +struct A; + +impl<'a> B for &'a A { + type C = (); +} + +struct Terminator; + +type Successors<'a> = impl std::fmt::Debug + 'a; + +impl Terminator { + fn successors(&self, _: for<'x> fn(&'x ()) -> <&'x A as B>::C) -> Successors<'_> {} +} + +fn main() {} diff --git a/tests/ui/type-alias-impl-trait/higher_kinded_params2.rs b/tests/ui/type-alias-impl-trait/higher_kinded_params2.rs new file mode 100644 index 00000000000..f011e5b2148 --- /dev/null +++ b/tests/ui/type-alias-impl-trait/higher_kinded_params2.rs @@ -0,0 +1,35 @@ +//! This test checks the behaviour of walking into binders +//! and normalizing something behind them actually works. + +// edition: 2021 + +#![feature(type_alias_impl_trait)] + +trait B { + type C; +} + +struct A; + +impl<'a> B for &'a A { + type C = Tait; +} + +type Tait = impl std::fmt::Debug; + +struct Terminator; + +type Successors<'a> = impl std::fmt::Debug + 'a; + +impl Terminator { + fn successors(&self, mut f: for<'x> fn(&'x ()) -> <&'x A as B>::C) -> Successors<'_> { + f = g; + //~^ ERROR item constrains opaque type that is not in its signature + } +} + +fn g(_: &()) -> String { + String::new() +} + +fn main() {} diff --git a/tests/ui/type-alias-impl-trait/higher_kinded_params2.stderr b/tests/ui/type-alias-impl-trait/higher_kinded_params2.stderr new file mode 100644 index 00000000000..39f584dd49c --- /dev/null +++ b/tests/ui/type-alias-impl-trait/higher_kinded_params2.stderr @@ -0,0 +1,15 @@ +error: item constrains opaque type that is not in its signature + --> $DIR/higher_kinded_params2.rs:26:13 + | +LL | f = g; + | ^ + | + = note: this item must mention the opaque type in its signature in order to be able to register hidden types +note: this item must mention the opaque type in its signature in order to be able to register hidden types + --> $DIR/higher_kinded_params2.rs:25:8 + | +LL | fn successors(&self, mut f: for<'x> fn(&'x ()) -> <&'x A as B>::C) -> Successors<'_> { + | ^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/tests/ui/type-alias-impl-trait/higher_kinded_params3.rs b/tests/ui/type-alias-impl-trait/higher_kinded_params3.rs index 839a611cb71..6edfccaf7d1 100644 --- a/tests/ui/type-alias-impl-trait/higher_kinded_params3.rs +++ b/tests/ui/type-alias-impl-trait/higher_kinded_params3.rs @@ -24,7 +24,8 @@ type Successors<'a> = impl std::fmt::Debug + 'a; impl Terminator { fn successors(&self, mut f: for<'x> fn(&'x ()) -> <&'x A as B>::C) -> Successors<'_> { f = g; - //~^ ERROR: mismatched types + //~^ ERROR mismatched types + //~| ERROR item constrains opaque type that is not in its signature } } diff --git a/tests/ui/type-alias-impl-trait/higher_kinded_params3.stderr b/tests/ui/type-alias-impl-trait/higher_kinded_params3.stderr index aaba9ad5ca7..14372d8f3e6 100644 --- a/tests/ui/type-alias-impl-trait/higher_kinded_params3.stderr +++ b/tests/ui/type-alias-impl-trait/higher_kinded_params3.stderr @@ -1,3 +1,16 @@ +error: item constrains opaque type that is not in its signature + --> $DIR/higher_kinded_params3.rs:26:13 + | +LL | f = g; + | ^ + | + = note: this item must mention the opaque type in its signature in order to be able to register hidden types +note: this item must mention the opaque type in its signature in order to be able to register hidden types + --> $DIR/higher_kinded_params3.rs:25:8 + | +LL | fn successors(&self, mut f: for<'x> fn(&'x ()) -> <&'x A as B>::C) -> Successors<'_> { + | ^^^^^^^^^^ + error[E0308]: mismatched types --> $DIR/higher_kinded_params3.rs:26:9 | @@ -10,6 +23,6 @@ LL | f = g; = note: expected fn pointer `for<'x> fn(&'x ()) -> Tait<'x>` found fn pointer `for<'a> fn(&'a ()) -> &'a ()` -error: aborting due to previous error +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/type-alias-impl-trait/inference-cycle.rs b/tests/ui/type-alias-impl-trait/inference-cycle.rs index 79caddf7913..20175a4feca 100644 --- a/tests/ui/type-alias-impl-trait/inference-cycle.rs +++ b/tests/ui/type-alias-impl-trait/inference-cycle.rs @@ -2,8 +2,9 @@ #![allow(dead_code)] mod m { - type Foo = impl std::fmt::Debug; + pub type Foo = impl std::fmt::Debug; //~^ ERROR cycle detected + //~| ERROR cycle detected // Cycle: error today, but it'd be nice if it eventually worked @@ -13,10 +14,11 @@ mod m { pub fn bar() { is_send(foo()); // Today: error + //~^ ERROR: cannot check whether the hidden type of `inference_cycle[4ecc]::m::Foo::{opaque#0}` satisfies auto traits } - fn baz() { - let f: Foo = 22_u32; + fn baz() -> Foo { + () } fn is_send<T: Send>(_: T) {} diff --git a/tests/ui/type-alias-impl-trait/inference-cycle.stderr b/tests/ui/type-alias-impl-trait/inference-cycle.stderr index b9d646b927a..4d5f367476b 100644 --- a/tests/ui/type-alias-impl-trait/inference-cycle.stderr +++ b/tests/ui/type-alias-impl-trait/inference-cycle.stderr @@ -1,11 +1,11 @@ error[E0391]: cycle detected when computing type of `m::Foo::{opaque#0}` - --> $DIR/inference-cycle.rs:5:16 + --> $DIR/inference-cycle.rs:5:20 | -LL | type Foo = impl std::fmt::Debug; - | ^^^^^^^^^^^^^^^^^^^^ +LL | pub type Foo = impl std::fmt::Debug; + | ^^^^^^^^^^^^^^^^^^^^ | note: ...which requires type-checking `m::bar`... - --> $DIR/inference-cycle.rs:15:9 + --> $DIR/inference-cycle.rs:16:9 | LL | is_send(foo()); // Today: error | ^^^^^^^ @@ -17,6 +17,48 @@ note: cycle used when checking item types in module `m` LL | mod m { | ^^^^^ -error: aborting due to previous error +error[E0391]: cycle detected when computing type of `m::Foo::{opaque#0}` + --> $DIR/inference-cycle.rs:5:20 + | +LL | pub type Foo = impl std::fmt::Debug; + | ^^^^^^^^^^^^^^^^^^^^ + | +note: ...which requires type-checking `m::bar`... + --> $DIR/inference-cycle.rs:15:5 + | +LL | pub fn bar() { + | ^^^^^^^^^^^^ + = note: ...which again requires computing type of `m::Foo::{opaque#0}`, completing the cycle +note: cycle used when checking item types in module `m` + --> $DIR/inference-cycle.rs:4:1 + | +LL | mod m { + | ^^^^^ + +error: cannot check whether the hidden type of `inference_cycle[4ecc]::m::Foo::{opaque#0}` satisfies auto traits + --> $DIR/inference-cycle.rs:16:17 + | +LL | is_send(foo()); // Today: error + | ------- ^^^^^ + | | + | required by a bound introduced by this call + | +note: opaque type is declared here + --> $DIR/inference-cycle.rs:5:20 + | +LL | pub type Foo = impl std::fmt::Debug; + | ^^^^^^^^^^^^^^^^^^^^ +note: this item depends on auto traits of the hidden type, but may also be registering the hidden type. This is not supported right now. You can try moving the opaque type and the item that actually registers a hidden type into a new submodule + --> $DIR/inference-cycle.rs:15:12 + | +LL | pub fn bar() { + | ^^^ +note: required by a bound in `is_send` + --> $DIR/inference-cycle.rs:24:19 + | +LL | fn is_send<T: Send>(_: T) {} + | ^^^^ required by this bound in `is_send` + +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0391`. diff --git a/tests/ui/type-alias-impl-trait/issue-109054.rs b/tests/ui/type-alias-impl-trait/issue-109054.rs new file mode 100644 index 00000000000..1fbec47b14b --- /dev/null +++ b/tests/ui/type-alias-impl-trait/issue-109054.rs @@ -0,0 +1,22 @@ +// edition:2021 + +#![feature(type_alias_impl_trait)] + +struct CallMe; + +type ReturnType<'a> = impl std::future::Future<Output = u32> + 'a; +type FnType = impl Fn(&u32) -> ReturnType; + +impl std::ops::Deref for CallMe { + type Target = FnType; + + fn deref(&self) -> &Self::Target { + fn inner(val: &u32) -> ReturnType { + async move { *val * 2 } + } + + &inner //~ ERROR: expected generic lifetime parameter, found `'_` + } +} + +fn main() {} diff --git a/tests/ui/type-alias-impl-trait/issue-109054.stderr b/tests/ui/type-alias-impl-trait/issue-109054.stderr new file mode 100644 index 00000000000..a611b9fe448 --- /dev/null +++ b/tests/ui/type-alias-impl-trait/issue-109054.stderr @@ -0,0 +1,12 @@ +error[E0792]: expected generic lifetime parameter, found `'_` + --> $DIR/issue-109054.rs:18:9 + | +LL | type ReturnType<'a> = impl std::future::Future<Output = u32> + 'a; + | -- this generic parameter must be used with a generic lifetime parameter +... +LL | &inner + | ^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0792`. diff --git a/tests/ui/type-alias-impl-trait/issue-53678-generator-and-const-fn.rs b/tests/ui/type-alias-impl-trait/issue-53678-generator-and-const-fn.rs index a3f126d56cf..a213dbba4ea 100644 --- a/tests/ui/type-alias-impl-trait/issue-53678-generator-and-const-fn.rs +++ b/tests/ui/type-alias-impl-trait/issue-53678-generator-and-const-fn.rs @@ -1,19 +1,22 @@ #![feature(generators, generator_trait, rustc_attrs)] #![feature(type_alias_impl_trait)] -use std::ops::Generator; +// check-pass -type GenOnce<Y, R> = impl Generator<Yield = Y, Return = R>; +mod gen { + use std::ops::Generator; -const fn const_generator<Y, R>(yielding: Y, returning: R) -> GenOnce<Y, R> { - move || { - yield yielding; + pub type GenOnce<Y, R> = impl Generator<Yield = Y, Return = R>; - return returning; + pub const fn const_generator<Y, R>(yielding: Y, returning: R) -> GenOnce<Y, R> { + move || { + yield yielding; + + return returning; + } } } -const FOO: GenOnce<usize, usize> = const_generator(10, 100); +const FOO: gen::GenOnce<usize, usize> = gen::const_generator(10, 100); -#[rustc_error] -fn main() {} //~ ERROR +fn main() {} diff --git a/tests/ui/type-alias-impl-trait/issue-53678-generator-and-const-fn.stderr b/tests/ui/type-alias-impl-trait/issue-53678-generator-and-const-fn.stderr deleted file mode 100644 index eb1c9603a60..00000000000 --- a/tests/ui/type-alias-impl-trait/issue-53678-generator-and-const-fn.stderr +++ /dev/null @@ -1,8 +0,0 @@ -error: fatal error triggered by #[rustc_error] - --> $DIR/issue-53678-generator-and-const-fn.rs:19:1 - | -LL | fn main() {} - | ^^^^^^^^^ - -error: aborting due to previous error - diff --git a/tests/ui/type-alias-impl-trait/issue-57961.rs b/tests/ui/type-alias-impl-trait/issue-57961.rs index 4aa5966ff25..61af7a0f625 100644 --- a/tests/ui/type-alias-impl-trait/issue-57961.rs +++ b/tests/ui/type-alias-impl-trait/issue-57961.rs @@ -11,8 +11,8 @@ impl Foo for () { //~^ ERROR expected `IntoIter<u32>` to be an iterator that yields `X`, but it yields `u32` } -fn incoherent() { - let f: X = 22_i32; +fn incoherent() -> X { + 22_i32 } fn main() {} diff --git a/tests/ui/type-alias-impl-trait/issue-60564.rs b/tests/ui/type-alias-impl-trait/issue-60564.rs index c2f4c370807..48bd70bcca9 100644 --- a/tests/ui/type-alias-impl-trait/issue-60564.rs +++ b/tests/ui/type-alias-impl-trait/issue-60564.rs @@ -17,6 +17,7 @@ where { type BitsIter = IterBitsIter<T, E, u8>; fn iter_bits(self, n: u8) -> Self::BitsIter { + //~^ ERROR non-defining opaque type use (0u8..n).rev().map(move |shift| ((self >> T::from(shift)) & T::from(1)).try_into().unwrap()) //~^ ERROR expected generic type parameter, found `u8` } diff --git a/tests/ui/type-alias-impl-trait/issue-60564.stderr b/tests/ui/type-alias-impl-trait/issue-60564.stderr index f8fdb004d09..d42495e934d 100644 --- a/tests/ui/type-alias-impl-trait/issue-60564.stderr +++ b/tests/ui/type-alias-impl-trait/issue-60564.stderr @@ -1,5 +1,17 @@ +error[E0792]: non-defining opaque type use in defining scope + --> $DIR/issue-60564.rs:19:34 + | +LL | fn iter_bits(self, n: u8) -> Self::BitsIter { + | ^^^^^^^^^^^^^^ argument `u8` is not a generic parameter + | +note: for this opaque type + --> $DIR/issue-60564.rs:8:30 + | +LL | type IterBitsIter<T, E, I> = impl std::iter::Iterator<Item = I>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + error[E0792]: expected generic type parameter, found `u8` - --> $DIR/issue-60564.rs:20:9 + --> $DIR/issue-60564.rs:21:9 | LL | type IterBitsIter<T, E, I> = impl std::iter::Iterator<Item = I>; | - this generic parameter must be used with a generic type parameter @@ -7,6 +19,6 @@ LL | type IterBitsIter<T, E, I> = impl std::iter::Iterator<Item = I>; LL | (0u8..n).rev().map(move |shift| ((self >> T::from(shift)) & T::from(1)).try_into().unwrap()) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to previous error +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0792`. diff --git a/tests/ui/type-alias-impl-trait/issue-63263-closure-return.rs b/tests/ui/type-alias-impl-trait/issue-63263-closure-return.rs index 7414611a748..ddea7aeb6cd 100644 --- a/tests/ui/type-alias-impl-trait/issue-63263-closure-return.rs +++ b/tests/ui/type-alias-impl-trait/issue-63263-closure-return.rs @@ -8,6 +8,9 @@ pub type Closure = impl FnOnce(); -fn main() { +fn bop() -> Closure { || -> Closure { || () }; + panic!() } + +fn main() {} diff --git a/tests/ui/type-alias-impl-trait/issue-65679-inst-opaque-ty-from-val-twice.rs b/tests/ui/type-alias-impl-trait/issue-65679-inst-opaque-ty-from-val-twice.rs index b91cbce3727..7b3e9e12405 100644 --- a/tests/ui/type-alias-impl-trait/issue-65679-inst-opaque-ty-from-val-twice.rs +++ b/tests/ui/type-alias-impl-trait/issue-65679-inst-opaque-ty-from-val-twice.rs @@ -11,7 +11,9 @@ type T = impl Sized; fn take(_: fn() -> T) {} -fn main() { +fn bop(_: T) { take(|| {}); take(|| {}); } + +fn main() {} diff --git a/tests/ui/type-alias-impl-trait/issue-68368-non-defining-use-2.rs b/tests/ui/type-alias-impl-trait/issue-68368-non-defining-use-2.rs index 5e0a82a7286..9dcdb578568 100644 --- a/tests/ui/type-alias-impl-trait/issue-68368-non-defining-use-2.rs +++ b/tests/ui/type-alias-impl-trait/issue-68368-non-defining-use-2.rs @@ -7,7 +7,8 @@ trait Trait<T> {} type Alias<'a, U> = impl Trait<U>; fn f<'a>() -> Alias<'a, ()> {} -//~^ ERROR expected generic type parameter, found `()` +//~^ ERROR non-defining opaque type use +//~| ERROR expected generic type parameter, found `()` fn main() {} diff --git a/tests/ui/type-alias-impl-trait/issue-68368-non-defining-use-2.stderr b/tests/ui/type-alias-impl-trait/issue-68368-non-defining-use-2.stderr index 271743a4010..085bffe907b 100644 --- a/tests/ui/type-alias-impl-trait/issue-68368-non-defining-use-2.stderr +++ b/tests/ui/type-alias-impl-trait/issue-68368-non-defining-use-2.stderr @@ -1,3 +1,15 @@ +error[E0792]: non-defining opaque type use in defining scope + --> $DIR/issue-68368-non-defining-use-2.rs:9:15 + | +LL | fn f<'a>() -> Alias<'a, ()> {} + | ^^^^^^^^^^^^^ argument `()` is not a generic parameter + | +note: for this opaque type + --> $DIR/issue-68368-non-defining-use-2.rs:7:21 + | +LL | type Alias<'a, U> = impl Trait<U>; + | ^^^^^^^^^^^^^ + error[E0792]: expected generic type parameter, found `()` --> $DIR/issue-68368-non-defining-use-2.rs:9:29 | @@ -7,6 +19,6 @@ LL | LL | fn f<'a>() -> Alias<'a, ()> {} | ^^ -error: aborting due to previous error +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0792`. diff --git a/tests/ui/type-alias-impl-trait/issue-68368-non-defining-use.rs b/tests/ui/type-alias-impl-trait/issue-68368-non-defining-use.rs index 3b32260c96f..dfe2ee8204c 100644 --- a/tests/ui/type-alias-impl-trait/issue-68368-non-defining-use.rs +++ b/tests/ui/type-alias-impl-trait/issue-68368-non-defining-use.rs @@ -8,6 +8,7 @@ type Alias<'a, U> = impl Trait<U>; fn f<'a>() -> Alias<'a, ()> {} //~^ ERROR expected generic type parameter, found `()` +//~| ERROR non-defining opaque type use fn main() {} diff --git a/tests/ui/type-alias-impl-trait/issue-68368-non-defining-use.stderr b/tests/ui/type-alias-impl-trait/issue-68368-non-defining-use.stderr index 4d9a8d6eef9..ea704ffff97 100644 --- a/tests/ui/type-alias-impl-trait/issue-68368-non-defining-use.stderr +++ b/tests/ui/type-alias-impl-trait/issue-68368-non-defining-use.stderr @@ -1,3 +1,15 @@ +error[E0792]: non-defining opaque type use in defining scope + --> $DIR/issue-68368-non-defining-use.rs:9:15 + | +LL | fn f<'a>() -> Alias<'a, ()> {} + | ^^^^^^^^^^^^^ argument `()` is not a generic parameter + | +note: for this opaque type + --> $DIR/issue-68368-non-defining-use.rs:7:21 + | +LL | type Alias<'a, U> = impl Trait<U>; + | ^^^^^^^^^^^^^ + error[E0792]: expected generic type parameter, found `()` --> $DIR/issue-68368-non-defining-use.rs:9:29 | @@ -7,6 +19,6 @@ LL | LL | fn f<'a>() -> Alias<'a, ()> {} | ^^ -error: aborting due to previous error +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0792`. diff --git a/tests/ui/type-alias-impl-trait/issue-69136-inner-lifetime-resolve-error.rs b/tests/ui/type-alias-impl-trait/issue-69136-inner-lifetime-resolve-error.rs index 7657fe2fb1a..a0f8e48e268 100644 --- a/tests/ui/type-alias-impl-trait/issue-69136-inner-lifetime-resolve-error.rs +++ b/tests/ui/type-alias-impl-trait/issue-69136-inner-lifetime-resolve-error.rs @@ -1,4 +1,6 @@ -// Regression test for #69136 +//! Regression test for #69136 +//! This test checks that the unknown lifetime `'a` doesn't cause +//! ICEs after emitting the error. #![feature(type_alias_impl_trait)] @@ -17,7 +19,6 @@ impl<T> WithAssoc<T> for () { type Return<A> = impl WithAssoc<A, AssocType = impl SomeTrait + 'a>; //~^ ERROR use of undeclared lifetime name `'a` -fn my_fun() -> Return<()> {} -//~^ ERROR expected generic type parameter, found `()` +fn my_fun<T>() -> Return<T> {} fn main() {} diff --git a/tests/ui/type-alias-impl-trait/issue-69136-inner-lifetime-resolve-error.stderr b/tests/ui/type-alias-impl-trait/issue-69136-inner-lifetime-resolve-error.stderr index d1250786d93..b7af3f06d0d 100644 --- a/tests/ui/type-alias-impl-trait/issue-69136-inner-lifetime-resolve-error.stderr +++ b/tests/ui/type-alias-impl-trait/issue-69136-inner-lifetime-resolve-error.stderr @@ -1,5 +1,5 @@ error[E0261]: use of undeclared lifetime name `'a` - --> $DIR/issue-69136-inner-lifetime-resolve-error.rs:17:65 + --> $DIR/issue-69136-inner-lifetime-resolve-error.rs:19:65 | LL | type Return<A> = impl WithAssoc<A, AssocType = impl SomeTrait + 'a>; | ^^ undeclared lifetime @@ -14,16 +14,6 @@ help: consider introducing lifetime `'a` here LL | type Return<'a, A> = impl WithAssoc<A, AssocType = impl SomeTrait + 'a>; | +++ -error[E0792]: expected generic type parameter, found `()` - --> $DIR/issue-69136-inner-lifetime-resolve-error.rs:20:27 - | -LL | type Return<A> = impl WithAssoc<A, AssocType = impl SomeTrait + 'a>; - | - this generic parameter must be used with a generic type parameter -... -LL | fn my_fun() -> Return<()> {} - | ^^ - -error: aborting due to 2 previous errors +error: aborting due to previous error -Some errors have detailed explanations: E0261, E0792. -For more information about an error, try `rustc --explain E0261`. +For more information about this error, try `rustc --explain E0261`. diff --git a/tests/ui/type-alias-impl-trait/issue-70121.rs b/tests/ui/type-alias-impl-trait/issue-70121.rs index dff0d89d465..bfd8d8872e3 100644 --- a/tests/ui/type-alias-impl-trait/issue-70121.rs +++ b/tests/ui/type-alias-impl-trait/issue-70121.rs @@ -1,5 +1,3 @@ -// check-pass - #![feature(type_alias_impl_trait)] pub type Successors<'a> = impl Iterator<Item = &'a ()>; @@ -17,6 +15,7 @@ impl<'a> Tr for &'a () { } pub fn kazusa<'a>() -> <&'a () as Tr>::Item { + //~^ ERROR item constrains opaque type that is not in its signature None.into_iter() } diff --git a/tests/ui/type-alias-impl-trait/issue-70121.stderr b/tests/ui/type-alias-impl-trait/issue-70121.stderr new file mode 100644 index 00000000000..30c3ddd8659 --- /dev/null +++ b/tests/ui/type-alias-impl-trait/issue-70121.stderr @@ -0,0 +1,15 @@ +error: item constrains opaque type that is not in its signature + --> $DIR/issue-70121.rs:17:24 + | +LL | pub fn kazusa<'a>() -> <&'a () as Tr>::Item { + | ^^^^^^^^^^^^^^^^^^^^ + | + = note: this item must mention the opaque type in its signature in order to be able to register hidden types +note: this item must mention the opaque type in its signature in order to be able to register hidden types + --> $DIR/issue-70121.rs:17:8 + | +LL | pub fn kazusa<'a>() -> <&'a () as Tr>::Item { + | ^^^^^^ + +error: aborting due to previous error + diff --git a/tests/ui/type-alias-impl-trait/issue-77179.rs b/tests/ui/type-alias-impl-trait/issue-77179.rs index 8d818d4a387..e7b04a48975 100644 --- a/tests/ui/type-alias-impl-trait/issue-77179.rs +++ b/tests/ui/type-alias-impl-trait/issue-77179.rs @@ -2,7 +2,7 @@ #![feature(type_alias_impl_trait)] -type Pointer<T> = impl std::ops::Deref<Target=T>; +type Pointer<T> = impl std::ops::Deref<Target = T>; fn test() -> Pointer<_> { //~^ ERROR: the placeholder `_` is not allowed within types diff --git a/tests/ui/type-alias-impl-trait/nested_in_closure.rs b/tests/ui/type-alias-impl-trait/nested_in_closure.rs new file mode 100644 index 00000000000..362f3d53e88 --- /dev/null +++ b/tests/ui/type-alias-impl-trait/nested_in_closure.rs @@ -0,0 +1,17 @@ +#![feature(type_alias_impl_trait)] +// check-pass + +fn main() { + let x = || { + type Tait = impl Sized; + let y: Tait = (); + }; + + let y = || { + type Tait = impl std::fmt::Debug; + let y: Tait = (); + y + }; + let mut z = y(); + z = (); +} diff --git a/tests/ui/type-alias-impl-trait/nested_type_alias_impl_trait.rs b/tests/ui/type-alias-impl-trait/nested_type_alias_impl_trait.rs index 60b6e1aac62..07607516cc4 100644 --- a/tests/ui/type-alias-impl-trait/nested_type_alias_impl_trait.rs +++ b/tests/ui/type-alias-impl-trait/nested_type_alias_impl_trait.rs @@ -10,11 +10,11 @@ mod my_mod { 5i32 } - pub fn get_foot() -> Foot { + pub fn get_foot(_: Foo) -> Foot { get_foo() //~ ERROR opaque type's hidden type cannot be another opaque type } } fn main() { - let _: my_mod::Foot = my_mod::get_foot(); + let _: my_mod::Foot = my_mod::get_foot(my_mod::get_foo()); } diff --git a/tests/ui/type-alias-impl-trait/no_revealing_outside_defining_module.stderr b/tests/ui/type-alias-impl-trait/no_revealing_outside_defining_module.stderr index ae03a5b3e37..863282a0ff9 100644 --- a/tests/ui/type-alias-impl-trait/no_revealing_outside_defining_module.stderr +++ b/tests/ui/type-alias-impl-trait/no_revealing_outside_defining_module.stderr @@ -11,6 +11,11 @@ LL | let _: &str = bomp(); | = note: expected reference `&str` found opaque type `Boo` +note: this item must have the opaque type in its signature in order to be able to register hidden types + --> $DIR/no_revealing_outside_defining_module.rs:14:4 + | +LL | fn bomp2() { + | ^^^^^ error[E0308]: mismatched types --> $DIR/no_revealing_outside_defining_module.rs:19:5 @@ -25,6 +30,11 @@ LL | "" | = note: expected opaque type `Boo` found reference `&'static str` +note: this item must have the opaque type in its signature in order to be able to register hidden types + --> $DIR/no_revealing_outside_defining_module.rs:18:4 + | +LL | fn bomp() -> boo::Boo { + | ^^^^ error: aborting due to 2 previous errors diff --git a/tests/ui/type-alias-impl-trait/reveal_local.rs b/tests/ui/type-alias-impl-trait/reveal_local.rs index 7ecb5535301..7943bb240f1 100644 --- a/tests/ui/type-alias-impl-trait/reveal_local.rs +++ b/tests/ui/type-alias-impl-trait/reveal_local.rs @@ -4,22 +4,28 @@ use std::fmt::Debug; type Foo = impl Debug; //~^ ERROR cycle detected +//~| ERROR cycle detected +//~| ERROR cycle detected -fn is_send<T: Send>() { } +fn is_send<T: Send>() {} fn not_good() { // Error: this function does not constrain `Foo` to any particular // hidden type, so it cannot rely on `Send` being true. is_send::<Foo>(); + //~^ ERROR: cannot check whether the hidden type of `reveal_local[9507]::Foo::{opaque#0}` satisfies auto traits } -fn not_gooder() { +fn not_gooder() -> Foo { // Constrain `Foo = u32` let x: Foo = 22_u32; // while we could know this from the hidden type, it would // need extra roundabout logic to support it. is_send::<Foo>(); + //~^ ERROR: cannot check whether the hidden type of `reveal_local[9507]::Foo::{opaque#0}` satisfies auto traits + + x } fn main() {} diff --git a/tests/ui/type-alias-impl-trait/reveal_local.stderr b/tests/ui/type-alias-impl-trait/reveal_local.stderr index 27fded33329..0c5ef4a6fb4 100644 --- a/tests/ui/type-alias-impl-trait/reveal_local.stderr +++ b/tests/ui/type-alias-impl-trait/reveal_local.stderr @@ -5,7 +5,7 @@ LL | type Foo = impl Debug; | ^^^^^^^^^^ | note: ...which requires type-checking `not_good`... - --> $DIR/reveal_local.rs:13:5 + --> $DIR/reveal_local.rs:15:5 | LL | is_send::<Foo>(); | ^^^^^^^^^^^^^^ @@ -23,6 +23,98 @@ LL | | LL | | fn main() {} | |____________^ -error: aborting due to previous error +error[E0391]: cycle detected when computing type of `Foo::{opaque#0}` + --> $DIR/reveal_local.rs:5:12 + | +LL | type Foo = impl Debug; + | ^^^^^^^^^^ + | +note: ...which requires type-checking `not_good`... + --> $DIR/reveal_local.rs:12:1 + | +LL | fn not_good() { + | ^^^^^^^^^^^^^ + = note: ...which again requires computing type of `Foo::{opaque#0}`, completing the cycle +note: cycle used when checking item types in top-level module + --> $DIR/reveal_local.rs:1:1 + | +LL | / #![feature(type_alias_impl_trait)] +LL | | +LL | | use std::fmt::Debug; +LL | | +... | +LL | | +LL | | fn main() {} + | |____________^ + +error: cannot check whether the hidden type of `reveal_local[9507]::Foo::{opaque#0}` satisfies auto traits + --> $DIR/reveal_local.rs:15:15 + | +LL | is_send::<Foo>(); + | ^^^ + | +note: opaque type is declared here + --> $DIR/reveal_local.rs:5:12 + | +LL | type Foo = impl Debug; + | ^^^^^^^^^^ +note: this item depends on auto traits of the hidden type, but may also be registering the hidden type. This is not supported right now. You can try moving the opaque type and the item that actually registers a hidden type into a new submodule + --> $DIR/reveal_local.rs:12:4 + | +LL | fn not_good() { + | ^^^^^^^^ +note: required by a bound in `is_send` + --> $DIR/reveal_local.rs:10:15 + | +LL | fn is_send<T: Send>() {} + | ^^^^ required by this bound in `is_send` + +error[E0391]: cycle detected when computing type of `Foo::{opaque#0}` + --> $DIR/reveal_local.rs:5:12 + | +LL | type Foo = impl Debug; + | ^^^^^^^^^^ + | +note: ...which requires type-checking `not_gooder`... + --> $DIR/reveal_local.rs:19:1 + | +LL | fn not_gooder() -> Foo { + | ^^^^^^^^^^^^^^^^^^^^^^ + = note: ...which again requires computing type of `Foo::{opaque#0}`, completing the cycle +note: cycle used when checking item types in top-level module + --> $DIR/reveal_local.rs:1:1 + | +LL | / #![feature(type_alias_impl_trait)] +LL | | +LL | | use std::fmt::Debug; +LL | | +... | +LL | | +LL | | fn main() {} + | |____________^ + +error: cannot check whether the hidden type of `reveal_local[9507]::Foo::{opaque#0}` satisfies auto traits + --> $DIR/reveal_local.rs:25:15 + | +LL | is_send::<Foo>(); + | ^^^ + | +note: opaque type is declared here + --> $DIR/reveal_local.rs:5:12 + | +LL | type Foo = impl Debug; + | ^^^^^^^^^^ +note: this item depends on auto traits of the hidden type, but may also be registering the hidden type. This is not supported right now. You can try moving the opaque type and the item that actually registers a hidden type into a new submodule + --> $DIR/reveal_local.rs:19:4 + | +LL | fn not_gooder() -> Foo { + | ^^^^^^^^^^ +note: required by a bound in `is_send` + --> $DIR/reveal_local.rs:10:15 + | +LL | fn is_send<T: Send>() {} + | ^^^^ required by this bound in `is_send` + +error: aborting due to 5 previous errors For more information about this error, try `rustc --explain E0391`. diff --git a/tests/ui/type-alias-impl-trait/type_of_a_let.rs b/tests/ui/type-alias-impl-trait/type_of_a_let.rs index 4e9d1788b94..36161171555 100644 --- a/tests/ui/type-alias-impl-trait/type_of_a_let.rs +++ b/tests/ui/type-alias-impl-trait/type_of_a_let.rs @@ -5,16 +5,16 @@ use std::fmt::Debug; type Foo = impl Debug; -fn foo1() -> u32 { +fn foo1() -> (u32, Foo) { let x: Foo = 22_u32; - x + (x, todo!()) } -fn foo2() -> u32 { +fn foo2() -> (u32, Foo) { let x: Foo = 22_u32; let y: Foo = x; same_type((x, y)); //~ ERROR use of moved value - y //~ ERROR use of moved value + (y, todo!()) //~ ERROR use of moved value } fn same_type<T>(x: (T, T)) {} diff --git a/tests/ui/type-alias-impl-trait/type_of_a_let.stderr b/tests/ui/type-alias-impl-trait/type_of_a_let.stderr index 1dabe4586c5..7d7cad874fa 100644 --- a/tests/ui/type-alias-impl-trait/type_of_a_let.stderr +++ b/tests/ui/type-alias-impl-trait/type_of_a_let.stderr @@ -9,14 +9,14 @@ LL | same_type((x, y)); | ^ value used here after move error[E0382]: use of moved value: `y` - --> $DIR/type_of_a_let.rs:17:5 + --> $DIR/type_of_a_let.rs:17:6 | LL | let y: Foo = x; | - move occurs because `y` has type `Foo`, which does not implement the `Copy` trait LL | same_type((x, y)); | - value moved here -LL | y - | ^ value used here after move +LL | (y, todo!()) + | ^ value used here after move error: aborting due to 2 previous errors diff --git a/tests/ui/type-inference/issue-113283-alllocator-trait-eq.rs b/tests/ui/type-inference/issue-113283-alllocator-trait-eq.rs new file mode 100644 index 00000000000..5d0e456d9dd --- /dev/null +++ b/tests/ui/type-inference/issue-113283-alllocator-trait-eq.rs @@ -0,0 +1,18 @@ +// run-pass +// Verify that PartialEq implementations do not break type inference when +// accepting types with different allocators + +use std::rc::Rc; +use std::sync::Arc; + + +fn main() { + let boxed: Vec<Box<i32>> = vec![]; + assert_eq!(boxed, vec![]); + + let rc: Vec<Rc<i32>> = vec![]; + assert_eq!(rc, vec![]); + + let arc: Vec<Arc<i32>> = vec![]; + assert_eq!(arc, vec![]); +} diff --git a/tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand-rust2015.fixed b/tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand-rust2015.fixed new file mode 100644 index 00000000000..5be6ff8e7e1 --- /dev/null +++ b/tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand-rust2015.fixed @@ -0,0 +1,17 @@ +// run-rustfix + +trait WithType<T> {} +trait WithRegion<'a> { } + +#[allow(dead_code)] +struct Foo<T> { + t: T +} + +impl<T> Foo<T> +where + T: for<'a> WithType<&'a u32> +//~^ ERROR `&` without an explicit lifetime name cannot be used here +{ } + +fn main() {} diff --git a/tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand-rust2015.rs b/tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand-rust2015.rs new file mode 100644 index 00000000000..d7072aa1181 --- /dev/null +++ b/tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand-rust2015.rs @@ -0,0 +1,17 @@ +// run-rustfix + +trait WithType<T> {} +trait WithRegion<'a> { } + +#[allow(dead_code)] +struct Foo<T> { + t: T +} + +impl<T> Foo<T> +where + T: WithType<&u32> +//~^ ERROR `&` without an explicit lifetime name cannot be used here +{ } + +fn main() {} diff --git a/tests/ui/underscore-lifetime/where-clause-trait-impl-region.rust2015.stderr b/tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand-rust2015.stderr index 63fc1a19b93..3e197dc9a9d 100644 --- a/tests/ui/underscore-lifetime/where-clause-trait-impl-region.rust2015.stderr +++ b/tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand-rust2015.stderr @@ -1,14 +1,13 @@ error[E0637]: `&` without an explicit lifetime name cannot be used here - --> $DIR/where-clause-trait-impl-region.rs:11:17 + --> $DIR/where-clause-inherent-impl-ampersand-rust2015.rs:13:17 | LL | T: WithType<&u32> | ^ explicit lifetime name needed here | -help: consider introducing a higher-ranked lifetime here with `for<'a>` - --> $DIR/where-clause-trait-impl-region.rs:11:8 +help: consider introducing a higher-ranked lifetime here | -LL | T: WithType<&u32> - | ^ +LL | T: for<'a> WithType<&'a u32> + | +++++++ ++ error: aborting due to previous error diff --git a/tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand-rust2018.fixed b/tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand-rust2018.fixed new file mode 100644 index 00000000000..0f1be586589 --- /dev/null +++ b/tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand-rust2018.fixed @@ -0,0 +1,18 @@ +// edition:2018 +// run-rustfix + +trait WithType<T> {} +trait WithRegion<'a> { } + +#[allow(dead_code)] +struct Foo<T> { + t: T +} + +impl<T> Foo<T> +where + T: for<'a> WithType<&'a u32> +//~^ ERROR `&` without an explicit lifetime name cannot be used here +{ } + +fn main() {} diff --git a/tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand-rust2018.rs b/tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand-rust2018.rs new file mode 100644 index 00000000000..59f7e472e2d --- /dev/null +++ b/tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand-rust2018.rs @@ -0,0 +1,18 @@ +// edition:2018 +// run-rustfix + +trait WithType<T> {} +trait WithRegion<'a> { } + +#[allow(dead_code)] +struct Foo<T> { + t: T +} + +impl<T> Foo<T> +where + T: WithType<&u32> +//~^ ERROR `&` without an explicit lifetime name cannot be used here +{ } + +fn main() {} diff --git a/tests/ui/underscore-lifetime/where-clause-trait-impl-region.rust2018.stderr b/tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand-rust2018.stderr index 63fc1a19b93..08b4268e5d2 100644 --- a/tests/ui/underscore-lifetime/where-clause-trait-impl-region.rust2018.stderr +++ b/tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand-rust2018.stderr @@ -1,14 +1,13 @@ error[E0637]: `&` without an explicit lifetime name cannot be used here - --> $DIR/where-clause-trait-impl-region.rs:11:17 + --> $DIR/where-clause-inherent-impl-ampersand-rust2018.rs:14:17 | LL | T: WithType<&u32> | ^ explicit lifetime name needed here | -help: consider introducing a higher-ranked lifetime here with `for<'a>` - --> $DIR/where-clause-trait-impl-region.rs:11:8 +help: consider introducing a higher-ranked lifetime here | -LL | T: WithType<&u32> - | ^ +LL | T: for<'a> WithType<&'a u32> + | +++++++ ++ error: aborting due to previous error diff --git a/tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand.rs b/tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand.rs deleted file mode 100644 index 43de30944ca..00000000000 --- a/tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand.rs +++ /dev/null @@ -1,18 +0,0 @@ -// revisions: rust2015 rust2018 -//[rust2018] edition:2018 - -trait WithType<T> {} -trait WithRegion<'a> { } - -struct Foo<T> { - t: T -} - -impl<T> Foo<T> -where - T: WithType<&u32> -//[rust2015]~^ ERROR `&` without an explicit lifetime name cannot be used here -//[rust2018]~^^ ERROR `&` without an explicit lifetime name cannot be used here -{ } - -fn main() {} diff --git a/tests/ui/underscore-lifetime/where-clause-trait-impl-region-2015.fixed b/tests/ui/underscore-lifetime/where-clause-trait-impl-region-2015.fixed new file mode 100644 index 00000000000..55c7470960e --- /dev/null +++ b/tests/ui/underscore-lifetime/where-clause-trait-impl-region-2015.fixed @@ -0,0 +1,14 @@ +// run-rustfix + +trait WithType<T> {} +trait WithRegion<'a> { } + +trait Foo { } + +impl<T> Foo for Vec<T> +where + T: for<'a> WithType<&'a u32> +//~^ ERROR `&` without an explicit lifetime name cannot be used here +{ } + +fn main() {} diff --git a/tests/ui/underscore-lifetime/where-clause-trait-impl-region-2015.rs b/tests/ui/underscore-lifetime/where-clause-trait-impl-region-2015.rs new file mode 100644 index 00000000000..42a35b02161 --- /dev/null +++ b/tests/ui/underscore-lifetime/where-clause-trait-impl-region-2015.rs @@ -0,0 +1,14 @@ +// run-rustfix + +trait WithType<T> {} +trait WithRegion<'a> { } + +trait Foo { } + +impl<T> Foo for Vec<T> +where + T: WithType<&u32> +//~^ ERROR `&` without an explicit lifetime name cannot be used here +{ } + +fn main() {} diff --git a/tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand.rust2015.stderr b/tests/ui/underscore-lifetime/where-clause-trait-impl-region-2015.stderr index f4d14b5f87b..8c5bbb631b4 100644 --- a/tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand.rust2015.stderr +++ b/tests/ui/underscore-lifetime/where-clause-trait-impl-region-2015.stderr @@ -1,14 +1,13 @@ error[E0637]: `&` without an explicit lifetime name cannot be used here - --> $DIR/where-clause-inherent-impl-ampersand.rs:13:17 + --> $DIR/where-clause-trait-impl-region-2015.rs:10:17 | LL | T: WithType<&u32> | ^ explicit lifetime name needed here | -help: consider introducing a higher-ranked lifetime here with `for<'a>` - --> $DIR/where-clause-inherent-impl-ampersand.rs:13:8 +help: consider introducing a higher-ranked lifetime here | -LL | T: WithType<&u32> - | ^ +LL | T: for<'a> WithType<&'a u32> + | +++++++ ++ error: aborting due to previous error diff --git a/tests/ui/underscore-lifetime/where-clause-trait-impl-region-2018.fixed b/tests/ui/underscore-lifetime/where-clause-trait-impl-region-2018.fixed new file mode 100644 index 00000000000..09b96fe5ea4 --- /dev/null +++ b/tests/ui/underscore-lifetime/where-clause-trait-impl-region-2018.fixed @@ -0,0 +1,15 @@ +// run-rustfix +// edition:2018 + +trait WithType<T> {} +trait WithRegion<'a> { } + +trait Foo { } + +impl<T> Foo for Vec<T> +where + T: for<'a> WithType<&'a u32> +//~^ ERROR `&` without an explicit lifetime name cannot be used here +{ } + +fn main() {} diff --git a/tests/ui/underscore-lifetime/where-clause-trait-impl-region-2018.rs b/tests/ui/underscore-lifetime/where-clause-trait-impl-region-2018.rs new file mode 100644 index 00000000000..445f38cbee1 --- /dev/null +++ b/tests/ui/underscore-lifetime/where-clause-trait-impl-region-2018.rs @@ -0,0 +1,15 @@ +// run-rustfix +// edition:2018 + +trait WithType<T> {} +trait WithRegion<'a> { } + +trait Foo { } + +impl<T> Foo for Vec<T> +where + T: WithType<&u32> +//~^ ERROR `&` without an explicit lifetime name cannot be used here +{ } + +fn main() {} diff --git a/tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand.rust2018.stderr b/tests/ui/underscore-lifetime/where-clause-trait-impl-region-2018.stderr index f4d14b5f87b..0268c59fa4a 100644 --- a/tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand.rust2018.stderr +++ b/tests/ui/underscore-lifetime/where-clause-trait-impl-region-2018.stderr @@ -1,14 +1,13 @@ error[E0637]: `&` without an explicit lifetime name cannot be used here - --> $DIR/where-clause-inherent-impl-ampersand.rs:13:17 + --> $DIR/where-clause-trait-impl-region-2018.rs:11:17 | LL | T: WithType<&u32> | ^ explicit lifetime name needed here | -help: consider introducing a higher-ranked lifetime here with `for<'a>` - --> $DIR/where-clause-inherent-impl-ampersand.rs:13:8 +help: consider introducing a higher-ranked lifetime here | -LL | T: WithType<&u32> - | ^ +LL | T: for<'a> WithType<&'a u32> + | +++++++ ++ error: aborting due to previous error diff --git a/tests/ui/underscore-lifetime/where-clause-trait-impl-region.rs b/tests/ui/underscore-lifetime/where-clause-trait-impl-region.rs deleted file mode 100644 index 09e5bbd846d..00000000000 --- a/tests/ui/underscore-lifetime/where-clause-trait-impl-region.rs +++ /dev/null @@ -1,15 +0,0 @@ -// revisions: rust2015 rust2018 -//[rust2018] edition:2018 - -trait WithType<T> {} -trait WithRegion<'a> { } - -trait Foo { } - -impl<T> Foo for Vec<T> -where - T: WithType<&u32> -//[rust2015,rust2018]~^ ERROR `&` without an explicit lifetime name cannot be used here -{ } - -fn main() {} diff --git a/tests/ui/uninhabited/projection.rs b/tests/ui/uninhabited/projection.rs new file mode 100644 index 00000000000..be0d3ff7da7 --- /dev/null +++ b/tests/ui/uninhabited/projection.rs @@ -0,0 +1,32 @@ +// check-pass + +#![feature(never_type, exhaustive_patterns)] + +trait Tag { + type TagType; +} + +enum Keep {} +enum Erase {} + +impl Tag for Keep { + type TagType = (); +} + +impl Tag for Erase { + type TagType = !; +} + +enum TagInt<T: Tag> { + Untagged(i32), + Tagged(T::TagType, i32) +} + +fn test(keep: TagInt<Keep>, erase: TagInt<Erase>) { + match erase { + TagInt::Untagged(_) => (), + TagInt::Tagged(_, _) => () + }; +} + +fn main() {} |
