diff options
Diffstat (limited to 'tests')
379 files changed, 4243 insertions, 1475 deletions
diff --git a/tests/codegen/iter-repeat-n-trivial-drop.rs b/tests/codegen/iter-repeat-n-trivial-drop.rs index 0b08e578151..b052d339917 100644 --- a/tests/codegen/iter-repeat-n-trivial-drop.rs +++ b/tests/codegen/iter-repeat-n-trivial-drop.rs @@ -47,7 +47,7 @@ pub fn iter_repeat_n_next(it: &mut std::iter::RepeatN<NotCopy>) -> Option<NotCop #[no_mangle] // CHECK-LABEL: @vec_extend_via_iter_repeat_n pub fn vec_extend_via_iter_repeat_n() -> Vec<u8> { - // CHECK: %[[ADDR:.+]] = tail call noundef dereferenceable_or_null(1234) ptr @__rust_alloc(i64 noundef 1234, i64 noundef 1) + // CHECK: %[[ADDR:.+]] = tail call {{(noalias )?}}noundef dereferenceable_or_null(1234) ptr @__rust_alloc(i64 noundef 1234, i64 noundef 1) // CHECK: tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(1234) %[[ADDR]], i8 42, i64 1234, let n = 1234_usize; diff --git a/tests/mir-opt/building/async_await.b-{closure#0}.coroutine_resume.0.mir b/tests/mir-opt/building/async_await.b-{closure#0}.coroutine_resume.0.mir index 9c8cf8763fd..2f7c4f7d402 100644 --- a/tests/mir-opt/building/async_await.b-{closure#0}.coroutine_resume.0.mir +++ b/tests/mir-opt/building/async_await.b-{closure#0}.coroutine_resume.0.mir @@ -110,7 +110,7 @@ fn b::{closure#0}(_1: Pin<&mut {async fn body@$DIR/async_await.rs:15:18: 18:2}>, bb0: { _39 = discriminant((*(_1.0: &mut {async fn body@$DIR/async_await.rs:15:18: 18:2}))); - switchInt(move _39) -> [0: bb1, 1: bb29, 3: bb27, 4: bb28, otherwise: bb9]; + switchInt(move _39) -> [0: bb1, 1: bb29, 3: bb27, 4: bb28, otherwise: bb8]; } bb1: { @@ -165,10 +165,14 @@ fn b::{closure#0}(_1: Pin<&mut {async fn body@$DIR/async_await.rs:15:18: 18:2}>, StorageDead(_10); PlaceMention(_9); _16 = discriminant(_9); - switchInt(move _16) -> [0: bb10, 1: bb8, otherwise: bb9]; + switchInt(move _16) -> [0: bb10, 1: bb9, otherwise: bb8]; } bb8: { + unreachable; + } + + bb9: { _8 = const (); StorageDead(_14); StorageDead(_12); @@ -186,10 +190,6 @@ fn b::{closure#0}(_1: Pin<&mut {async fn body@$DIR/async_await.rs:15:18: 18:2}>, return; } - bb9: { - unreachable; - } - bb10: { StorageLive(_17); _17 = ((_9 as Ready).0: ()); @@ -267,7 +267,7 @@ fn b::{closure#0}(_1: Pin<&mut {async fn body@$DIR/async_await.rs:15:18: 18:2}>, StorageDead(_26); PlaceMention(_25); _32 = discriminant(_25); - switchInt(move _32) -> [0: bb21, 1: bb20, otherwise: bb9]; + switchInt(move _32) -> [0: bb21, 1: bb20, otherwise: bb8]; } bb20: { diff --git a/tests/mir-opt/building/issue_101867.main.built.after.mir b/tests/mir-opt/building/issue_101867.main.built.after.mir index 57f8cca9abc..028d7ee7cd8 100644 --- a/tests/mir-opt/building/issue_101867.main.built.after.mir +++ b/tests/mir-opt/building/issue_101867.main.built.after.mir @@ -27,13 +27,13 @@ fn main() -> () { StorageLive(_5); PlaceMention(_1); _6 = discriminant(_1); - switchInt(move _6) -> [1: bb4, otherwise: bb3]; + switchInt(move _6) -> [1: bb5, otherwise: bb4]; } bb1: { StorageLive(_3); StorageLive(_4); - _4 = begin_panic::<&str>(const "explicit panic") -> bb7; + _4 = begin_panic::<&str>(const "explicit panic") -> bb8; } bb2: { @@ -43,14 +43,19 @@ fn main() -> () { } bb3: { - goto -> bb6; + FakeRead(ForMatchedPlace(None), _1); + unreachable; } bb4: { - falseEdge -> [real: bb5, imaginary: bb3]; + goto -> bb7; } bb5: { + falseEdge -> [real: bb6, imaginary: bb4]; + } + + bb6: { _5 = ((_1 as Some).0: u8); _0 = const (); StorageDead(_5); @@ -58,12 +63,12 @@ fn main() -> () { return; } - bb6: { + bb7: { StorageDead(_5); goto -> bb1; } - bb7 (cleanup): { + bb8 (cleanup): { resume; } } diff --git a/tests/mir-opt/building/issue_49232.main.built.after.mir b/tests/mir-opt/building/issue_49232.main.built.after.mir index ac50b388910..7c1f5a6ec72 100644 --- a/tests/mir-opt/building/issue_49232.main.built.after.mir +++ b/tests/mir-opt/building/issue_49232.main.built.after.mir @@ -17,7 +17,7 @@ fn main() -> () { } bb1: { - falseUnwind -> [real: bb2, unwind: bb11]; + falseUnwind -> [real: bb2, unwind: bb12]; } bb2: { @@ -25,41 +25,46 @@ fn main() -> () { StorageLive(_3); _3 = const true; PlaceMention(_3); - switchInt(_3) -> [0: bb3, otherwise: bb4]; + switchInt(_3) -> [0: bb4, otherwise: bb5]; } bb3: { - falseEdge -> [real: bb5, imaginary: bb4]; + FakeRead(ForMatchedPlace(None), _3); + unreachable; } bb4: { - _0 = const (); - goto -> bb10; + falseEdge -> [real: bb6, imaginary: bb5]; } bb5: { - _2 = const 4_i32; - goto -> bb8; + _0 = const (); + goto -> bb11; } bb6: { - unreachable; + _2 = const 4_i32; + goto -> bb9; } bb7: { - goto -> bb8; + unreachable; } bb8: { + goto -> bb9; + } + + bb9: { FakeRead(ForLet(None), _2); StorageDead(_3); StorageLive(_5); StorageLive(_6); _6 = &_2; - _5 = std::mem::drop::<&i32>(move _6) -> [return: bb9, unwind: bb11]; + _5 = std::mem::drop::<&i32>(move _6) -> [return: bb10, unwind: bb12]; } - bb9: { + bb10: { StorageDead(_6); StorageDead(_5); _1 = const (); @@ -67,13 +72,13 @@ fn main() -> () { goto -> bb1; } - bb10: { + bb11: { StorageDead(_3); StorageDead(_2); return; } - bb11 (cleanup): { + bb12 (cleanup): { resume; } } diff --git a/tests/mir-opt/building/logical_or_in_conditional.test_complex.built.after.mir b/tests/mir-opt/building/logical_or_in_conditional.test_complex.built.after.mir index 7407e7a8b2a..d7c758d8876 100644 --- a/tests/mir-opt/building/logical_or_in_conditional.test_complex.built.after.mir +++ b/tests/mir-opt/building/logical_or_in_conditional.test_complex.built.after.mir @@ -19,168 +19,178 @@ fn test_complex() -> () { bb0: { StorageLive(_1); StorageLive(_2); - _2 = E::f() -> [return: bb1, unwind: bb31]; + _2 = E::f() -> [return: bb1, unwind: bb33]; } bb1: { PlaceMention(_2); _3 = discriminant(_2); - switchInt(move _3) -> [0: bb2, otherwise: bb3]; + switchInt(move _3) -> [0: bb4, otherwise: bb3]; } bb2: { - falseEdge -> [real: bb4, imaginary: bb3]; + FakeRead(ForMatchedPlace(None), _2); + unreachable; } bb3: { - goto -> bb19; + goto -> bb20; } bb4: { - StorageLive(_4); - _4 = always_true() -> [return: bb5, unwind: bb31]; + falseEdge -> [real: bb5, imaginary: bb3]; } bb5: { - switchInt(move _4) -> [0: bb7, otherwise: bb6]; + StorageLive(_4); + _4 = always_true() -> [return: bb6, unwind: bb33]; } bb6: { + switchInt(move _4) -> [0: bb8, otherwise: bb7]; + } + + bb7: { StorageLive(_5); StorageLive(_6); StorageLive(_7); _7 = Droppy(const 0_u8); _6 = (_7.0: u8); _5 = Gt(move _6, const 0_u8); - switchInt(move _5) -> [0: bb9, otherwise: bb8]; - } - - bb7: { - goto -> bb13; + switchInt(move _5) -> [0: bb10, otherwise: bb9]; } bb8: { - drop(_7) -> [return: bb10, unwind: bb31]; + goto -> bb14; } bb9: { - goto -> bb11; + drop(_7) -> [return: bb11, unwind: bb33]; } bb10: { - StorageDead(_7); - StorageDead(_6); - goto -> bb16; + goto -> bb12; } bb11: { - drop(_7) -> [return: bb12, unwind: bb31]; + StorageDead(_7); + StorageDead(_6); + goto -> bb17; } bb12: { + drop(_7) -> [return: bb13, unwind: bb33]; + } + + bb13: { StorageDead(_7); StorageDead(_6); - goto -> bb13; + goto -> bb14; } - bb13: { + bb14: { StorageLive(_8); StorageLive(_9); StorageLive(_10); _10 = Droppy(const 1_u8); _9 = (_10.0: u8); _8 = Gt(move _9, const 1_u8); - switchInt(move _8) -> [0: bb15, otherwise: bb14]; - } - - bb14: { - drop(_10) -> [return: bb16, unwind: bb31]; + switchInt(move _8) -> [0: bb16, otherwise: bb15]; } bb15: { - goto -> bb17; + drop(_10) -> [return: bb17, unwind: bb33]; } bb16: { + goto -> bb18; + } + + bb17: { StorageDead(_10); StorageDead(_9); _1 = const (); - goto -> bb20; + goto -> bb21; } - bb17: { - drop(_10) -> [return: bb18, unwind: bb31]; + bb18: { + drop(_10) -> [return: bb19, unwind: bb33]; } - bb18: { + bb19: { StorageDead(_10); StorageDead(_9); - goto -> bb19; + goto -> bb20; } - bb19: { + bb20: { _1 = const (); - goto -> bb20; + goto -> bb21; } - bb20: { + bb21: { StorageDead(_8); StorageDead(_5); StorageDead(_4); StorageDead(_2); StorageDead(_1); StorageLive(_11); - _11 = always_true() -> [return: bb21, unwind: bb31]; - } - - bb21: { - switchInt(move _11) -> [0: bb23, otherwise: bb22]; + _11 = always_true() -> [return: bb22, unwind: bb33]; } bb22: { - goto -> bb29; + switchInt(move _11) -> [0: bb24, otherwise: bb23]; } bb23: { - goto -> bb24; + goto -> bb31; } bb24: { - StorageLive(_12); - _12 = E::f() -> [return: bb25, unwind: bb31]; + goto -> bb25; } bb25: { - PlaceMention(_12); - _13 = discriminant(_12); - switchInt(move _13) -> [1: bb27, otherwise: bb26]; + StorageLive(_12); + _12 = E::f() -> [return: bb26, unwind: bb33]; } bb26: { - goto -> bb29; + PlaceMention(_12); + _13 = discriminant(_12); + switchInt(move _13) -> [1: bb29, otherwise: bb28]; } bb27: { - falseEdge -> [real: bb28, imaginary: bb26]; + FakeRead(ForMatchedPlace(None), _12); + unreachable; } bb28: { - _0 = const (); - goto -> bb30; + goto -> bb31; } bb29: { - _0 = const (); - goto -> bb30; + falseEdge -> [real: bb30, imaginary: bb28]; } bb30: { + _0 = const (); + goto -> bb32; + } + + bb31: { + _0 = const (); + goto -> bb32; + } + + bb32: { StorageDead(_11); StorageDead(_12); return; } - bb31 (cleanup): { + bb33 (cleanup): { resume; } } diff --git a/tests/mir-opt/building/match_false_edges.full_tested_match.built.after.mir b/tests/mir-opt/building/match_false_edges.full_tested_match.built.after.mir index b99b0b99559..88292dd0597 100644 --- a/tests/mir-opt/building/match_false_edges.full_tested_match.built.after.mir +++ b/tests/mir-opt/building/match_false_edges.full_tested_match.built.after.mir @@ -28,25 +28,25 @@ fn full_tested_match() -> () { _2 = Option::<i32>::Some(const 42_i32); PlaceMention(_2); _3 = discriminant(_2); - switchInt(move _3) -> [0: bb1, 1: bb2, otherwise: bb4]; + switchInt(move _3) -> [0: bb2, 1: bb3, otherwise: bb1]; } bb1: { - _1 = (const 3_i32, const 3_i32); - goto -> bb11; + FakeRead(ForMatchedPlace(None), _2); + unreachable; } bb2: { - falseEdge -> [real: bb5, imaginary: bb3]; + _1 = (const 3_i32, const 3_i32); + goto -> bb11; } bb3: { - falseEdge -> [real: bb10, imaginary: bb1]; + falseEdge -> [real: bb5, imaginary: bb4]; } bb4: { - FakeRead(ForMatchedPlace(None), _2); - unreachable; + falseEdge -> [real: bb10, imaginary: bb2]; } bb5: { @@ -54,7 +54,7 @@ fn full_tested_match() -> () { _6 = &((_2 as Some).0: i32); _4 = &fake _2; StorageLive(_7); - _7 = guard() -> [return: bb6, unwind: bb12]; + _7 = guard() -> [return: bb6, unwind: bb13]; } bb6: { @@ -83,7 +83,7 @@ fn full_tested_match() -> () { bb9: { StorageDead(_7); StorageDead(_6); - goto -> bb3; + goto -> bb4; } bb10: { @@ -105,7 +105,12 @@ fn full_tested_match() -> () { return; } - bb12 (cleanup): { + bb12: { + FakeRead(ForMatchedPlace(None), _1); + unreachable; + } + + bb13 (cleanup): { resume; } } diff --git a/tests/mir-opt/building/match_false_edges.full_tested_match2.built.after.mir b/tests/mir-opt/building/match_false_edges.full_tested_match2.built.after.mir index d1d86b55d68..205bb4980d9 100644 --- a/tests/mir-opt/building/match_false_edges.full_tested_match2.built.after.mir +++ b/tests/mir-opt/building/match_false_edges.full_tested_match2.built.after.mir @@ -28,18 +28,23 @@ fn full_tested_match2() -> () { _2 = Option::<i32>::Some(const 42_i32); PlaceMention(_2); _3 = discriminant(_2); - switchInt(move _3) -> [0: bb1, 1: bb2, otherwise: bb4]; + switchInt(move _3) -> [0: bb2, 1: bb3, otherwise: bb1]; } bb1: { - falseEdge -> [real: bb10, imaginary: bb3]; + FakeRead(ForMatchedPlace(None), _2); + unreachable; } bb2: { - falseEdge -> [real: bb5, imaginary: bb1]; + falseEdge -> [real: bb10, imaginary: bb4]; } bb3: { + falseEdge -> [real: bb5, imaginary: bb2]; + } + + bb4: { StorageLive(_9); _9 = ((_2 as Some).0: i32); StorageLive(_10); @@ -50,17 +55,12 @@ fn full_tested_match2() -> () { goto -> bb11; } - bb4: { - FakeRead(ForMatchedPlace(None), _2); - unreachable; - } - bb5: { StorageLive(_6); _6 = &((_2 as Some).0: i32); _4 = &fake _2; StorageLive(_7); - _7 = guard() -> [return: bb6, unwind: bb12]; + _7 = guard() -> [return: bb6, unwind: bb13]; } bb6: { @@ -89,7 +89,7 @@ fn full_tested_match2() -> () { bb9: { StorageDead(_7); StorageDead(_6); - falseEdge -> [real: bb3, imaginary: bb1]; + falseEdge -> [real: bb4, imaginary: bb2]; } bb10: { @@ -105,7 +105,12 @@ fn full_tested_match2() -> () { return; } - bb12 (cleanup): { + bb12: { + FakeRead(ForMatchedPlace(None), _1); + unreachable; + } + + bb13 (cleanup): { resume; } } diff --git a/tests/mir-opt/building/match_false_edges.main.built.after.mir b/tests/mir-opt/building/match_false_edges.main.built.after.mir index 1d4fe67f350..21f377a6404 100644 --- a/tests/mir-opt/building/match_false_edges.main.built.after.mir +++ b/tests/mir-opt/building/match_false_edges.main.built.after.mir @@ -39,55 +39,60 @@ fn main() -> () { _2 = Option::<i32>::Some(const 1_i32); PlaceMention(_2); _4 = discriminant(_2); - switchInt(move _4) -> [1: bb2, otherwise: bb1]; + switchInt(move _4) -> [1: bb7, otherwise: bb2]; } bb1: { - falseEdge -> [real: bb13, imaginary: bb6]; + FakeRead(ForMatchedPlace(None), _2); + unreachable; } bb2: { - falseEdge -> [real: bb8, imaginary: bb1]; + falseEdge -> [real: bb14, imaginary: bb5]; } bb3: { - goto -> bb1; - } - - bb4: { _3 = discriminant(_2); - switchInt(move _3) -> [1: bb6, otherwise: bb5]; + switchInt(move _3) -> [1: bb5, otherwise: bb4]; } - bb5: { + bb4: { StorageLive(_14); _14 = _2; _1 = const 4_i32; StorageDead(_14); - goto -> bb19; + goto -> bb20; + } + + bb5: { + falseEdge -> [real: bb15, imaginary: bb4]; } bb6: { - falseEdge -> [real: bb14, imaginary: bb5]; + goto -> bb4; } bb7: { - goto -> bb5; + falseEdge -> [real: bb9, imaginary: bb2]; } bb8: { + goto -> bb2; + } + + bb9: { StorageLive(_7); _7 = &((_2 as Some).0: i32); _5 = &fake _2; StorageLive(_8); - _8 = guard() -> [return: bb9, unwind: bb20]; + _8 = guard() -> [return: bb10, unwind: bb22]; } - bb9: { - switchInt(move _8) -> [0: bb11, otherwise: bb10]; + bb10: { + switchInt(move _8) -> [0: bb12, otherwise: bb11]; } - bb10: { + bb11: { StorageDead(_8); FakeRead(ForMatchGuard, _5); FakeRead(ForGuardBinding, _7); @@ -96,42 +101,42 @@ fn main() -> () { _1 = const 1_i32; StorageDead(_6); StorageDead(_7); - goto -> bb19; + goto -> bb20; } - bb11: { - goto -> bb12; + bb12: { + goto -> bb13; } - bb12: { + bb13: { StorageDead(_8); StorageDead(_7); - falseEdge -> [real: bb3, imaginary: bb1]; + falseEdge -> [real: bb8, imaginary: bb2]; } - bb13: { + bb14: { StorageLive(_9); _9 = _2; _1 = const 2_i32; StorageDead(_9); - goto -> bb19; + goto -> bb20; } - bb14: { + bb15: { StorageLive(_11); _11 = &((_2 as Some).0: i32); _5 = &fake _2; StorageLive(_12); StorageLive(_13); _13 = (*_11); - _12 = guard2(move _13) -> [return: bb15, unwind: bb20]; + _12 = guard2(move _13) -> [return: bb16, unwind: bb22]; } - bb15: { - switchInt(move _12) -> [0: bb17, otherwise: bb16]; + bb16: { + switchInt(move _12) -> [0: bb18, otherwise: bb17]; } - bb16: { + bb17: { StorageDead(_13); StorageDead(_12); FakeRead(ForMatchGuard, _5); @@ -141,21 +146,21 @@ fn main() -> () { _1 = const 3_i32; StorageDead(_10); StorageDead(_11); - goto -> bb19; + goto -> bb20; } - bb17: { - goto -> bb18; + bb18: { + goto -> bb19; } - bb18: { + bb19: { StorageDead(_13); StorageDead(_12); StorageDead(_11); - falseEdge -> [real: bb7, imaginary: bb5]; + falseEdge -> [real: bb6, imaginary: bb4]; } - bb19: { + bb20: { PlaceMention(_1); StorageDead(_2); StorageDead(_1); @@ -163,7 +168,12 @@ fn main() -> () { return; } - bb20 (cleanup): { + bb21: { + FakeRead(ForMatchedPlace(None), _1); + unreachable; + } + + bb22 (cleanup): { resume; } } diff --git a/tests/mir-opt/building/simple_match.match_bool.built.after.mir b/tests/mir-opt/building/simple_match.match_bool.built.after.mir index 06de4c51051..cd51c942bee 100644 --- a/tests/mir-opt/building/simple_match.match_bool.built.after.mir +++ b/tests/mir-opt/building/simple_match.match_bool.built.after.mir @@ -6,24 +6,29 @@ fn match_bool(_1: bool) -> usize { bb0: { PlaceMention(_1); - switchInt(_1) -> [0: bb2, otherwise: bb1]; + switchInt(_1) -> [0: bb2, otherwise: bb3]; } bb1: { - falseEdge -> [real: bb3, imaginary: bb2]; + FakeRead(ForMatchedPlace(None), _1); + unreachable; } bb2: { _0 = const 20_usize; - goto -> bb4; + goto -> bb5; } bb3: { - _0 = const 10_usize; - goto -> bb4; + falseEdge -> [real: bb4, imaginary: bb2]; } bb4: { + _0 = const 10_usize; + goto -> bb5; + } + + bb5: { return; } } diff --git a/tests/mir-opt/building/uniform_array_move_out.move_out_by_subslice.built.after.mir b/tests/mir-opt/building/uniform_array_move_out.move_out_by_subslice.built.after.mir index 82424de0392..282c9704ffc 100644 --- a/tests/mir-opt/building/uniform_array_move_out.move_out_by_subslice.built.after.mir +++ b/tests/mir-opt/building/uniform_array_move_out.move_out_by_subslice.built.after.mir @@ -30,7 +30,7 @@ fn move_out_by_subslice() -> () { StorageLive(_2); _3 = SizeOf(i32); _4 = AlignOf(i32); - _5 = alloc::alloc::exchange_malloc(move _3, move _4) -> [return: bb1, unwind: bb12]; + _5 = alloc::alloc::exchange_malloc(move _3, move _4) -> [return: bb1, unwind: bb13]; } bb1: { @@ -38,7 +38,7 @@ fn move_out_by_subslice() -> () { _6 = ShallowInitBox(move _5, i32); (*_6) = const 1_i32; _2 = move _6; - drop(_6) -> [return: bb2, unwind: bb11]; + drop(_6) -> [return: bb2, unwind: bb12]; } bb2: { @@ -46,7 +46,7 @@ fn move_out_by_subslice() -> () { StorageLive(_7); _8 = SizeOf(i32); _9 = AlignOf(i32); - _10 = alloc::alloc::exchange_malloc(move _8, move _9) -> [return: bb3, unwind: bb11]; + _10 = alloc::alloc::exchange_malloc(move _8, move _9) -> [return: bb3, unwind: bb12]; } bb3: { @@ -54,18 +54,18 @@ fn move_out_by_subslice() -> () { _11 = ShallowInitBox(move _10, i32); (*_11) = const 2_i32; _7 = move _11; - drop(_11) -> [return: bb4, unwind: bb10]; + drop(_11) -> [return: bb4, unwind: bb11]; } bb4: { StorageDead(_11); _1 = [move _2, move _7]; - drop(_7) -> [return: bb5, unwind: bb11]; + drop(_7) -> [return: bb5, unwind: bb12]; } bb5: { StorageDead(_7); - drop(_2) -> [return: bb6, unwind: bb12]; + drop(_2) -> [return: bb6, unwind: bb13]; } bb6: { @@ -75,32 +75,37 @@ fn move_out_by_subslice() -> () { StorageLive(_12); _12 = move _1[0..2]; _0 = const (); - drop(_12) -> [return: bb7, unwind: bb9]; + drop(_12) -> [return: bb8, unwind: bb10]; } bb7: { - StorageDead(_12); - drop(_1) -> [return: bb8, unwind: bb12]; + FakeRead(ForMatchedPlace(None), _1); + unreachable; } bb8: { - StorageDead(_1); - return; + StorageDead(_12); + drop(_1) -> [return: bb9, unwind: bb13]; } - bb9 (cleanup): { - drop(_1) -> [return: bb12, unwind terminate(cleanup)]; + bb9: { + StorageDead(_1); + return; } bb10 (cleanup): { - drop(_7) -> [return: bb11, unwind terminate(cleanup)]; + drop(_1) -> [return: bb13, unwind terminate(cleanup)]; } bb11 (cleanup): { - drop(_2) -> [return: bb12, unwind terminate(cleanup)]; + drop(_7) -> [return: bb12, unwind terminate(cleanup)]; } bb12 (cleanup): { + drop(_2) -> [return: bb13, unwind terminate(cleanup)]; + } + + bb13 (cleanup): { resume; } } diff --git a/tests/mir-opt/building/uniform_array_move_out.move_out_from_end.built.after.mir b/tests/mir-opt/building/uniform_array_move_out.move_out_from_end.built.after.mir index 0872d1b6ac0..d1956c91b88 100644 --- a/tests/mir-opt/building/uniform_array_move_out.move_out_from_end.built.after.mir +++ b/tests/mir-opt/building/uniform_array_move_out.move_out_from_end.built.after.mir @@ -30,7 +30,7 @@ fn move_out_from_end() -> () { StorageLive(_2); _3 = SizeOf(i32); _4 = AlignOf(i32); - _5 = alloc::alloc::exchange_malloc(move _3, move _4) -> [return: bb1, unwind: bb12]; + _5 = alloc::alloc::exchange_malloc(move _3, move _4) -> [return: bb1, unwind: bb13]; } bb1: { @@ -38,7 +38,7 @@ fn move_out_from_end() -> () { _6 = ShallowInitBox(move _5, i32); (*_6) = const 1_i32; _2 = move _6; - drop(_6) -> [return: bb2, unwind: bb11]; + drop(_6) -> [return: bb2, unwind: bb12]; } bb2: { @@ -46,7 +46,7 @@ fn move_out_from_end() -> () { StorageLive(_7); _8 = SizeOf(i32); _9 = AlignOf(i32); - _10 = alloc::alloc::exchange_malloc(move _8, move _9) -> [return: bb3, unwind: bb11]; + _10 = alloc::alloc::exchange_malloc(move _8, move _9) -> [return: bb3, unwind: bb12]; } bb3: { @@ -54,18 +54,18 @@ fn move_out_from_end() -> () { _11 = ShallowInitBox(move _10, i32); (*_11) = const 2_i32; _7 = move _11; - drop(_11) -> [return: bb4, unwind: bb10]; + drop(_11) -> [return: bb4, unwind: bb11]; } bb4: { StorageDead(_11); _1 = [move _2, move _7]; - drop(_7) -> [return: bb5, unwind: bb11]; + drop(_7) -> [return: bb5, unwind: bb12]; } bb5: { StorageDead(_7); - drop(_2) -> [return: bb6, unwind: bb12]; + drop(_2) -> [return: bb6, unwind: bb13]; } bb6: { @@ -75,32 +75,37 @@ fn move_out_from_end() -> () { StorageLive(_12); _12 = move _1[1 of 2]; _0 = const (); - drop(_12) -> [return: bb7, unwind: bb9]; + drop(_12) -> [return: bb8, unwind: bb10]; } bb7: { - StorageDead(_12); - drop(_1) -> [return: bb8, unwind: bb12]; + FakeRead(ForMatchedPlace(None), _1); + unreachable; } bb8: { - StorageDead(_1); - return; + StorageDead(_12); + drop(_1) -> [return: bb9, unwind: bb13]; } - bb9 (cleanup): { - drop(_1) -> [return: bb12, unwind terminate(cleanup)]; + bb9: { + StorageDead(_1); + return; } bb10 (cleanup): { - drop(_7) -> [return: bb11, unwind terminate(cleanup)]; + drop(_1) -> [return: bb13, unwind terminate(cleanup)]; } bb11 (cleanup): { - drop(_2) -> [return: bb12, unwind terminate(cleanup)]; + drop(_7) -> [return: bb12, unwind terminate(cleanup)]; } bb12 (cleanup): { + drop(_2) -> [return: bb13, unwind terminate(cleanup)]; + } + + bb13 (cleanup): { resume; } } diff --git a/tests/mir-opt/copy-prop/issue_107511.main.CopyProp.panic-abort.diff b/tests/mir-opt/copy-prop/issue_107511.main.CopyProp.panic-abort.diff index a802d0256d4..51390e2abbe 100644 --- a/tests/mir-opt/copy-prop/issue_107511.main.CopyProp.panic-abort.diff +++ b/tests/mir-opt/copy-prop/issue_107511.main.CopyProp.panic-abort.diff @@ -79,10 +79,14 @@ bb4: { StorageDead(_12); _14 = discriminant(_11); - switchInt(move _14) -> [0: bb7, 1: bb5, otherwise: bb6]; + switchInt(move _14) -> [0: bb7, 1: bb6, otherwise: bb5]; } bb5: { + unreachable; + } + + bb6: { - StorageLive(_16); _16 = ((_11 as Some).0: usize); StorageLive(_17); @@ -95,10 +99,6 @@ + assert(move _20, "index out of bounds: the length is {} but the index is {}", move _19, _16) -> [success: bb8, unwind unreachable]; } - bb6: { - unreachable; - } - bb7: { _0 = const (); StorageDead(_13); 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 35f852098c3..8a2cbb68824 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 @@ -79,10 +79,14 @@ bb4: { StorageDead(_12); _14 = discriminant(_11); - switchInt(move _14) -> [0: bb7, 1: bb5, otherwise: bb6]; + switchInt(move _14) -> [0: bb7, 1: bb6, otherwise: bb5]; } bb5: { + unreachable; + } + + bb6: { - StorageLive(_16); _16 = ((_11 as Some).0: usize); StorageLive(_17); @@ -95,10 +99,6 @@ + assert(move _20, "index out of bounds: the length is {} but the index is {}", move _19, _16) -> [success: bb8, unwind continue]; } - bb6: { - unreachable; - } - bb7: { _0 = const (); StorageDead(_13); diff --git a/tests/mir-opt/dataflow-const-prop/enum.constant.DataflowConstProp.32bit.diff b/tests/mir-opt/dataflow-const-prop/enum.constant.DataflowConstProp.32bit.diff index f50a763ef9a..fc814f7e7a9 100644 --- a/tests/mir-opt/dataflow-const-prop/enum.constant.DataflowConstProp.32bit.diff +++ b/tests/mir-opt/dataflow-const-prop/enum.constant.DataflowConstProp.32bit.diff @@ -26,12 +26,16 @@ _1 = const _; StorageLive(_2); - _3 = discriminant(_1); -- switchInt(move _3) -> [0: bb3, 1: bb1, otherwise: bb2]; +- switchInt(move _3) -> [0: bb3, 1: bb2, otherwise: bb1]; + _3 = const 0_isize; -+ switchInt(const 0_isize) -> [0: bb3, 1: bb1, otherwise: bb2]; ++ switchInt(const 0_isize) -> [0: bb3, 1: bb2, otherwise: bb1]; } bb1: { + unreachable; + } + + bb2: { StorageLive(_5); _5 = ((_1 as V2).0: i32); _2 = _5; @@ -39,10 +43,6 @@ goto -> bb4; } - bb2: { - unreachable; - } - bb3: { StorageLive(_4); - _4 = ((_1 as V1).0: i32); diff --git a/tests/mir-opt/dataflow-const-prop/enum.constant.DataflowConstProp.64bit.diff b/tests/mir-opt/dataflow-const-prop/enum.constant.DataflowConstProp.64bit.diff index f50a763ef9a..fc814f7e7a9 100644 --- a/tests/mir-opt/dataflow-const-prop/enum.constant.DataflowConstProp.64bit.diff +++ b/tests/mir-opt/dataflow-const-prop/enum.constant.DataflowConstProp.64bit.diff @@ -26,12 +26,16 @@ _1 = const _; StorageLive(_2); - _3 = discriminant(_1); -- switchInt(move _3) -> [0: bb3, 1: bb1, otherwise: bb2]; +- switchInt(move _3) -> [0: bb3, 1: bb2, otherwise: bb1]; + _3 = const 0_isize; -+ switchInt(const 0_isize) -> [0: bb3, 1: bb1, otherwise: bb2]; ++ switchInt(const 0_isize) -> [0: bb3, 1: bb2, otherwise: bb1]; } bb1: { + unreachable; + } + + bb2: { StorageLive(_5); _5 = ((_1 as V2).0: i32); _2 = _5; @@ -39,10 +43,6 @@ goto -> bb4; } - bb2: { - unreachable; - } - bb3: { StorageLive(_4); - _4 = ((_1 as V1).0: i32); diff --git a/tests/mir-opt/dataflow-const-prop/enum.multiple.DataflowConstProp.32bit.diff b/tests/mir-opt/dataflow-const-prop/enum.multiple.DataflowConstProp.32bit.diff index 6bf702b8568..10d33767c90 100644 --- a/tests/mir-opt/dataflow-const-prop/enum.multiple.DataflowConstProp.32bit.diff +++ b/tests/mir-opt/dataflow-const-prop/enum.multiple.DataflowConstProp.32bit.diff @@ -49,16 +49,16 @@ StorageDead(_4); StorageLive(_6); _7 = discriminant(_3); - switchInt(move _7) -> [0: bb4, 1: bb6, otherwise: bb5]; + switchInt(move _7) -> [0: bb5, 1: bb6, otherwise: bb4]; } bb4: { - _6 = const 0_u8; - goto -> bb7; + unreachable; } bb5: { - unreachable; + _6 = const 0_u8; + goto -> bb7; } bb6: { diff --git a/tests/mir-opt/dataflow-const-prop/enum.multiple.DataflowConstProp.64bit.diff b/tests/mir-opt/dataflow-const-prop/enum.multiple.DataflowConstProp.64bit.diff index 6bf702b8568..10d33767c90 100644 --- a/tests/mir-opt/dataflow-const-prop/enum.multiple.DataflowConstProp.64bit.diff +++ b/tests/mir-opt/dataflow-const-prop/enum.multiple.DataflowConstProp.64bit.diff @@ -49,16 +49,16 @@ StorageDead(_4); StorageLive(_6); _7 = discriminant(_3); - switchInt(move _7) -> [0: bb4, 1: bb6, otherwise: bb5]; + switchInt(move _7) -> [0: bb5, 1: bb6, otherwise: bb4]; } bb4: { - _6 = const 0_u8; - goto -> bb7; + unreachable; } bb5: { - unreachable; + _6 = const 0_u8; + goto -> bb7; } bb6: { diff --git a/tests/mir-opt/dataflow-const-prop/enum.rs b/tests/mir-opt/dataflow-const-prop/enum.rs index 7ad64d05be4..78410e49d2a 100644 --- a/tests/mir-opt/dataflow-const-prop/enum.rs +++ b/tests/mir-opt/dataflow-const-prop/enum.rs @@ -20,7 +20,7 @@ fn simple() { // CHECK: [[e]] = const E::V1(0_i32); let e = E::V1(0); - // CHECK: switchInt(const 0_isize) -> [0: [[target_bb:bb.*]], 1: bb1, otherwise: bb2]; + // CHECK: switchInt(const 0_isize) -> [0: [[target_bb:bb.*]], 1: bb2, otherwise: bb1]; // CHECK: [[target_bb]]: { // CHECK: [[x]] = const 0_i32; let x = match e { E::V1(x1) => x1, E::V2(x2) => x2 }; @@ -36,7 +36,7 @@ fn constant() { // CHECK: [[e]] = const _; let e = C; - // CHECK: switchInt(const 0_isize) -> [0: [[target_bb:bb.*]], 1: bb1, otherwise: bb2]; + // CHECK: switchInt(const 0_isize) -> [0: [[target_bb:bb.*]], 1: bb2, otherwise: bb1]; // CHECK: [[target_bb]]: { // CHECK: [[x]] = const 0_i32; let x = match e { E::V1(x1) => x1, E::V2(x2) => x2 }; @@ -55,7 +55,7 @@ fn statics() { // CHECK: [[e1]] = const E::V1(0_i32); let e1 = C; - // CHECK: switchInt(const 0_isize) -> [0: [[target_bb:bb.*]], 1: bb1, otherwise: bb2]; + // CHECK: switchInt(const 0_isize) -> [0: [[target_bb:bb.*]], 1: bb2, otherwise: bb1]; // CHECK: [[target_bb]]: { // CHECK: [[x1]] = const 0_i32; let x1 = match e1 { E::V1(x11) => x11, E::V2(x12) => x12 }; diff --git a/tests/mir-opt/dataflow-const-prop/enum.simple.DataflowConstProp.32bit.diff b/tests/mir-opt/dataflow-const-prop/enum.simple.DataflowConstProp.32bit.diff index b31f98460e4..89ed26f065b 100644 --- a/tests/mir-opt/dataflow-const-prop/enum.simple.DataflowConstProp.32bit.diff +++ b/tests/mir-opt/dataflow-const-prop/enum.simple.DataflowConstProp.32bit.diff @@ -27,12 +27,16 @@ + _1 = const E::V1(0_i32); StorageLive(_2); - _3 = discriminant(_1); -- switchInt(move _3) -> [0: bb3, 1: bb1, otherwise: bb2]; +- switchInt(move _3) -> [0: bb3, 1: bb2, otherwise: bb1]; + _3 = const 0_isize; -+ switchInt(const 0_isize) -> [0: bb3, 1: bb1, otherwise: bb2]; ++ switchInt(const 0_isize) -> [0: bb3, 1: bb2, otherwise: bb1]; } bb1: { + unreachable; + } + + bb2: { StorageLive(_5); _5 = ((_1 as V2).0: i32); _2 = _5; @@ -40,10 +44,6 @@ goto -> bb4; } - bb2: { - unreachable; - } - bb3: { StorageLive(_4); - _4 = ((_1 as V1).0: i32); diff --git a/tests/mir-opt/dataflow-const-prop/enum.simple.DataflowConstProp.64bit.diff b/tests/mir-opt/dataflow-const-prop/enum.simple.DataflowConstProp.64bit.diff index b31f98460e4..89ed26f065b 100644 --- a/tests/mir-opt/dataflow-const-prop/enum.simple.DataflowConstProp.64bit.diff +++ b/tests/mir-opt/dataflow-const-prop/enum.simple.DataflowConstProp.64bit.diff @@ -27,12 +27,16 @@ + _1 = const E::V1(0_i32); StorageLive(_2); - _3 = discriminant(_1); -- switchInt(move _3) -> [0: bb3, 1: bb1, otherwise: bb2]; +- switchInt(move _3) -> [0: bb3, 1: bb2, otherwise: bb1]; + _3 = const 0_isize; -+ switchInt(const 0_isize) -> [0: bb3, 1: bb1, otherwise: bb2]; ++ switchInt(const 0_isize) -> [0: bb3, 1: bb2, otherwise: bb1]; } bb1: { + unreachable; + } + + bb2: { StorageLive(_5); _5 = ((_1 as V2).0: i32); _2 = _5; @@ -40,10 +44,6 @@ goto -> bb4; } - bb2: { - unreachable; - } - bb3: { StorageLive(_4); - _4 = ((_1 as V1).0: i32); diff --git a/tests/mir-opt/dataflow-const-prop/enum.statics.DataflowConstProp.32bit.diff b/tests/mir-opt/dataflow-const-prop/enum.statics.DataflowConstProp.32bit.diff index 44e8d39cca3..fe8ed011489 100644 --- a/tests/mir-opt/dataflow-const-prop/enum.statics.DataflowConstProp.32bit.diff +++ b/tests/mir-opt/dataflow-const-prop/enum.statics.DataflowConstProp.32bit.diff @@ -49,12 +49,16 @@ StorageDead(_2); StorageLive(_3); - _4 = discriminant(_1); -- switchInt(move _4) -> [0: bb3, 1: bb1, otherwise: bb2]; +- switchInt(move _4) -> [0: bb3, 1: bb2, otherwise: bb1]; + _4 = const 0_isize; -+ switchInt(const 0_isize) -> [0: bb3, 1: bb1, otherwise: bb2]; ++ switchInt(const 0_isize) -> [0: bb3, 1: bb2, otherwise: bb1]; } bb1: { + unreachable; + } + + bb2: { StorageLive(_6); _6 = ((_1 as V2).0: i32); _3 = _6; @@ -62,10 +66,6 @@ goto -> bb4; } - bb2: { - unreachable; - } - bb3: { StorageLive(_5); - _5 = ((_1 as V1).0: i32); @@ -84,7 +84,7 @@ StorageDead(_8); StorageLive(_9); _10 = discriminant((*_7)); - switchInt(move _10) -> [0: bb6, 1: bb5, otherwise: bb2]; + switchInt(move _10) -> [0: bb6, 1: bb5, otherwise: bb1]; } bb5: { diff --git a/tests/mir-opt/dataflow-const-prop/enum.statics.DataflowConstProp.64bit.diff b/tests/mir-opt/dataflow-const-prop/enum.statics.DataflowConstProp.64bit.diff index ac4ca086d0f..df3a989d09e 100644 --- a/tests/mir-opt/dataflow-const-prop/enum.statics.DataflowConstProp.64bit.diff +++ b/tests/mir-opt/dataflow-const-prop/enum.statics.DataflowConstProp.64bit.diff @@ -49,12 +49,16 @@ StorageDead(_2); StorageLive(_3); - _4 = discriminant(_1); -- switchInt(move _4) -> [0: bb3, 1: bb1, otherwise: bb2]; +- switchInt(move _4) -> [0: bb3, 1: bb2, otherwise: bb1]; + _4 = const 0_isize; -+ switchInt(const 0_isize) -> [0: bb3, 1: bb1, otherwise: bb2]; ++ switchInt(const 0_isize) -> [0: bb3, 1: bb2, otherwise: bb1]; } bb1: { + unreachable; + } + + bb2: { StorageLive(_6); _6 = ((_1 as V2).0: i32); _3 = _6; @@ -62,10 +66,6 @@ goto -> bb4; } - bb2: { - unreachable; - } - bb3: { StorageLive(_5); - _5 = ((_1 as V1).0: i32); @@ -84,7 +84,7 @@ StorageDead(_8); StorageLive(_9); _10 = discriminant((*_7)); - switchInt(move _10) -> [0: bb6, 1: bb5, otherwise: bb2]; + switchInt(move _10) -> [0: bb6, 1: bb5, otherwise: bb1]; } bb5: { diff --git a/tests/mir-opt/deduplicate_blocks.is_line_doc_comment_2.DeduplicateBlocks.panic-abort.diff b/tests/mir-opt/deduplicate_blocks.is_line_doc_comment_2.DeduplicateBlocks.panic-abort.diff index 5c4fc06a2ba..938b9bb14ad 100644 --- a/tests/mir-opt/deduplicate_blocks.is_line_doc_comment_2.DeduplicateBlocks.panic-abort.diff +++ b/tests/mir-opt/deduplicate_blocks.is_line_doc_comment_2.DeduplicateBlocks.panic-abort.diff @@ -25,58 +25,66 @@ _7 = Len((*_2)); _8 = const 4_usize; _9 = Ge(move _7, move _8); - switchInt(move _9) -> [0: bb6, otherwise: bb2]; +- switchInt(move _9) -> [0: bb2, otherwise: bb7]; ++ switchInt(move _9) -> [0: bb2, otherwise: bb6]; } bb2: { - switchInt((*_2)[0 of 4]) -> [47: bb3, otherwise: bb6]; + _4 = Len((*_2)); + _5 = const 3_usize; + _6 = Ge(move _4, move _5); +- switchInt(move _6) -> [0: bb3, otherwise: bb4]; ++ switchInt(move _6) -> [0: bb10, otherwise: bb3]; } bb3: { - switchInt((*_2)[1 of 4]) -> [47: bb4, otherwise: bb6]; +- _0 = const false; +- goto -> bb14; ++ switchInt((*_2)[0 of 3]) -> [47: bb4, otherwise: bb10]; } bb4: { - switchInt((*_2)[2 of 4]) -> [47: bb5, otherwise: bb6]; +- switchInt((*_2)[0 of 3]) -> [47: bb5, otherwise: bb3]; ++ switchInt((*_2)[1 of 3]) -> [47: bb5, otherwise: bb10]; } bb5: { -- switchInt((*_2)[3 of 4]) -> [47: bb11, otherwise: bb6]; -+ switchInt((*_2)[3 of 4]) -> [47: bb10, otherwise: bb6]; +- switchInt((*_2)[1 of 3]) -> [47: bb6, otherwise: bb3]; ++ switchInt((*_2)[2 of 3]) -> [47: bb11, 33: bb11, otherwise: bb10]; } bb6: { - _4 = Len((*_2)); - _5 = const 3_usize; - _6 = Ge(move _4, move _5); - switchInt(move _6) -> [0: bb10, otherwise: bb7]; +- switchInt((*_2)[2 of 3]) -> [47: bb12, 33: bb13, otherwise: bb3]; ++ switchInt((*_2)[0 of 4]) -> [47: bb7, otherwise: bb2]; } bb7: { - switchInt((*_2)[0 of 3]) -> [47: bb8, otherwise: bb10]; +- switchInt((*_2)[0 of 4]) -> [47: bb8, otherwise: bb2]; ++ switchInt((*_2)[1 of 4]) -> [47: bb8, otherwise: bb2]; } bb8: { - switchInt((*_2)[1 of 3]) -> [47: bb9, otherwise: bb10]; +- switchInt((*_2)[1 of 4]) -> [47: bb9, otherwise: bb2]; ++ switchInt((*_2)[2 of 4]) -> [47: bb9, otherwise: bb2]; } bb9: { -- switchInt((*_2)[2 of 3]) -> [47: bb12, 33: bb13, otherwise: bb10]; -+ switchInt((*_2)[2 of 3]) -> [47: bb11, 33: bb11, otherwise: bb10]; +- switchInt((*_2)[2 of 4]) -> [47: bb10, otherwise: bb2]; ++ switchInt((*_2)[3 of 4]) -> [47: bb10, otherwise: bb2]; } bb10: { +- switchInt((*_2)[3 of 4]) -> [47: bb11, otherwise: bb2]; +- } +- +- bb11: { _0 = const false; - goto -> bb14; + goto -> bb12; } - bb11: { -- _0 = const false; -- goto -> bb14; -- } -- - bb12: { ++ bb11: { _0 = const true; - goto -> bb14; + goto -> bb12; 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 3d9aa829052..ce89694076b 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 @@ -25,58 +25,66 @@ _7 = Len((*_2)); _8 = const 4_usize; _9 = Ge(move _7, move _8); - switchInt(move _9) -> [0: bb6, otherwise: bb2]; +- switchInt(move _9) -> [0: bb2, otherwise: bb7]; ++ switchInt(move _9) -> [0: bb2, otherwise: bb6]; } bb2: { - switchInt((*_2)[0 of 4]) -> [47: bb3, otherwise: bb6]; + _4 = Len((*_2)); + _5 = const 3_usize; + _6 = Ge(move _4, move _5); +- switchInt(move _6) -> [0: bb3, otherwise: bb4]; ++ switchInt(move _6) -> [0: bb10, otherwise: bb3]; } bb3: { - switchInt((*_2)[1 of 4]) -> [47: bb4, otherwise: bb6]; +- _0 = const false; +- goto -> bb14; ++ switchInt((*_2)[0 of 3]) -> [47: bb4, otherwise: bb10]; } bb4: { - switchInt((*_2)[2 of 4]) -> [47: bb5, otherwise: bb6]; +- switchInt((*_2)[0 of 3]) -> [47: bb5, otherwise: bb3]; ++ switchInt((*_2)[1 of 3]) -> [47: bb5, otherwise: bb10]; } bb5: { -- switchInt((*_2)[3 of 4]) -> [47: bb11, otherwise: bb6]; -+ switchInt((*_2)[3 of 4]) -> [47: bb10, otherwise: bb6]; +- switchInt((*_2)[1 of 3]) -> [47: bb6, otherwise: bb3]; ++ switchInt((*_2)[2 of 3]) -> [47: bb11, 33: bb11, otherwise: bb10]; } bb6: { - _4 = Len((*_2)); - _5 = const 3_usize; - _6 = Ge(move _4, move _5); - switchInt(move _6) -> [0: bb10, otherwise: bb7]; +- switchInt((*_2)[2 of 3]) -> [47: bb12, 33: bb13, otherwise: bb3]; ++ switchInt((*_2)[0 of 4]) -> [47: bb7, otherwise: bb2]; } bb7: { - switchInt((*_2)[0 of 3]) -> [47: bb8, otherwise: bb10]; +- switchInt((*_2)[0 of 4]) -> [47: bb8, otherwise: bb2]; ++ switchInt((*_2)[1 of 4]) -> [47: bb8, otherwise: bb2]; } bb8: { - switchInt((*_2)[1 of 3]) -> [47: bb9, otherwise: bb10]; +- switchInt((*_2)[1 of 4]) -> [47: bb9, otherwise: bb2]; ++ switchInt((*_2)[2 of 4]) -> [47: bb9, otherwise: bb2]; } bb9: { -- switchInt((*_2)[2 of 3]) -> [47: bb12, 33: bb13, otherwise: bb10]; -+ switchInt((*_2)[2 of 3]) -> [47: bb11, 33: bb11, otherwise: bb10]; +- switchInt((*_2)[2 of 4]) -> [47: bb10, otherwise: bb2]; ++ switchInt((*_2)[3 of 4]) -> [47: bb10, otherwise: bb2]; } bb10: { +- switchInt((*_2)[3 of 4]) -> [47: bb11, otherwise: bb2]; +- } +- +- bb11: { _0 = const false; - goto -> bb14; + goto -> bb12; } - bb11: { -- _0 = const false; -- goto -> bb14; -- } -- - bb12: { ++ bb11: { _0 = const true; - goto -> bb14; + goto -> bb12; diff --git a/tests/mir-opt/derefer_complex_case.main.Derefer.panic-abort.diff b/tests/mir-opt/derefer_complex_case.main.Derefer.panic-abort.diff index 0fad716a2cb..6654e710625 100644 --- a/tests/mir-opt/derefer_complex_case.main.Derefer.panic-abort.diff +++ b/tests/mir-opt/derefer_complex_case.main.Derefer.panic-abort.diff @@ -55,10 +55,14 @@ StorageDead(_8); PlaceMention(_7); _10 = discriminant(_7); - switchInt(move _10) -> [0: bb6, 1: bb4, otherwise: bb5]; + switchInt(move _10) -> [0: bb6, 1: bb5, otherwise: bb4]; } bb4: { + unreachable; + } + + bb5: { StorageLive(_12); - _12 = (*((_7 as Some).0: &i32)); + _15 = deref_copy ((_7 as Some).0: &i32); @@ -68,10 +72,6 @@ _6 = std::mem::drop::<i32>(move _13) -> [return: bb7, unwind: bb8]; } - bb5: { - unreachable; - } - bb6: { _0 = const (); StorageDead(_9); 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 ae5656f02a5..18fc27e7cf7 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 @@ -55,10 +55,14 @@ StorageDead(_8); PlaceMention(_7); _10 = discriminant(_7); - switchInt(move _10) -> [0: bb6, 1: bb4, otherwise: bb5]; + switchInt(move _10) -> [0: bb6, 1: bb5, otherwise: bb4]; } bb4: { + unreachable; + } + + bb5: { StorageLive(_12); - _12 = (*((_7 as Some).0: &i32)); + _15 = deref_copy ((_7 as Some).0: &i32); @@ -68,10 +72,6 @@ _6 = std::mem::drop::<i32>(move _13) -> [return: bb7, unwind continue]; } - bb5: { - unreachable; - } - bb6: { _0 = const (); StorageDead(_9); diff --git a/tests/mir-opt/early_otherwise_branch.opt2.EarlyOtherwiseBranch.diff b/tests/mir-opt/early_otherwise_branch.opt2.EarlyOtherwiseBranch.diff index b91a469225c..32a8dd8b8b4 100644 --- a/tests/mir-opt/early_otherwise_branch.opt2.EarlyOtherwiseBranch.diff +++ b/tests/mir-opt/early_otherwise_branch.opt2.EarlyOtherwiseBranch.diff @@ -30,7 +30,7 @@ StorageDead(_5); StorageDead(_4); _8 = discriminant((_3.0: std::option::Option<u32>)); -- switchInt(move _8) -> [0: bb1, 1: bb3, otherwise: bb2]; +- switchInt(move _8) -> [0: bb2, 1: bb3, otherwise: bb1]; + StorageLive(_11); + _11 = discriminant((_3.1: std::option::Option<u32>)); + StorageLive(_12); @@ -40,24 +40,23 @@ } bb1: { -- _6 = discriminant((_3.1: std::option::Option<u32>)); -- switchInt(move _6) -> [0: bb5, otherwise: bb2]; -- } -- -- bb2: { + StorageDead(_12); _0 = const 1_u32; - goto -> bb6; + goto -> bb4; } + bb2: { +- _6 = discriminant((_3.1: std::option::Option<u32>)); +- switchInt(move _6) -> [0: bb5, otherwise: bb1]; +- } +- - bb3: { - _7 = discriminant((_3.1: std::option::Option<u32>)); -- switchInt(move _7) -> [1: bb4, otherwise: bb2]; +- switchInt(move _7) -> [1: bb4, otherwise: bb1]; - } - - bb4: { -+ bb2: { StorageLive(_10); _10 = (((_3.1: std::option::Option<u32>) as Some).0: u32); StorageLive(_9); diff --git a/tests/mir-opt/early_otherwise_branch_68867.try_sum.EarlyOtherwiseBranch.diff b/tests/mir-opt/early_otherwise_branch_68867.try_sum.EarlyOtherwiseBranch.diff index 79cf1c0e34a..6179bab11fe 100644 --- a/tests/mir-opt/early_otherwise_branch_68867.try_sum.EarlyOtherwiseBranch.diff +++ b/tests/mir-opt/early_otherwise_branch_68867.try_sum.EarlyOtherwiseBranch.diff @@ -78,16 +78,10 @@ StorageDead(_5); _34 = deref_copy (_4.0: &ViewportPercentageLength); _11 = discriminant((*_34)); - switchInt(move _11) -> [0: bb1, 1: bb3, 2: bb4, 3: bb5, otherwise: bb2]; + switchInt(move _11) -> [0: bb2, 1: bb3, 2: bb4, 3: bb5, otherwise: bb1]; } bb1: { - _35 = deref_copy (_4.1: &ViewportPercentageLength); - _7 = discriminant((*_35)); - switchInt(move _7) -> [0: bb6, otherwise: bb2]; - } - - bb2: { StorageLive(_33); _33 = (); _0 = Result::<ViewportPercentageLength, ()>::Err(move _33); @@ -97,22 +91,28 @@ goto -> bb11; } + bb2: { + _35 = deref_copy (_4.1: &ViewportPercentageLength); + _7 = discriminant((*_35)); + switchInt(move _7) -> [0: bb6, otherwise: bb1]; + } + bb3: { _36 = deref_copy (_4.1: &ViewportPercentageLength); _8 = discriminant((*_36)); - switchInt(move _8) -> [1: bb7, otherwise: bb2]; + switchInt(move _8) -> [1: bb7, otherwise: bb1]; } bb4: { _37 = deref_copy (_4.1: &ViewportPercentageLength); _9 = discriminant((*_37)); - switchInt(move _9) -> [2: bb8, otherwise: bb2]; + switchInt(move _9) -> [2: bb8, otherwise: bb1]; } bb5: { _38 = deref_copy (_4.1: &ViewportPercentageLength); _10 = discriminant((*_38)); - switchInt(move _10) -> [3: bb9, otherwise: bb2]; + switchInt(move _10) -> [3: bb9, otherwise: bb1]; } bb6: { diff --git a/tests/mir-opt/early_otherwise_branch_noopt.noopt1.EarlyOtherwiseBranch.diff b/tests/mir-opt/early_otherwise_branch_noopt.noopt1.EarlyOtherwiseBranch.diff index af0337d0a7e..d7908ab3cd2 100644 --- a/tests/mir-opt/early_otherwise_branch_noopt.noopt1.EarlyOtherwiseBranch.diff +++ b/tests/mir-opt/early_otherwise_branch_noopt.noopt1.EarlyOtherwiseBranch.diff @@ -36,26 +36,26 @@ StorageDead(_5); StorageDead(_4); _8 = discriminant((_3.0: std::option::Option<u32>)); - switchInt(move _8) -> [0: bb1, 1: bb4, otherwise: bb3]; + switchInt(move _8) -> [0: bb2, 1: bb4, otherwise: bb1]; } bb1: { - _6 = discriminant((_3.1: std::option::Option<u32>)); - switchInt(move _6) -> [0: bb2, 1: bb7, otherwise: bb3]; + unreachable; } bb2: { - _0 = const 3_u32; - goto -> bb8; + _6 = discriminant((_3.1: std::option::Option<u32>)); + switchInt(move _6) -> [0: bb3, 1: bb7, otherwise: bb1]; } bb3: { - unreachable; + _0 = const 3_u32; + goto -> bb8; } bb4: { _7 = discriminant((_3.1: std::option::Option<u32>)); - switchInt(move _7) -> [0: bb6, 1: bb5, otherwise: bb3]; + switchInt(move _7) -> [0: bb6, 1: bb5, otherwise: bb1]; } bb5: { diff --git a/tests/mir-opt/gvn.wrap_unwrap.GVN.panic-abort.diff b/tests/mir-opt/gvn.wrap_unwrap.GVN.panic-abort.diff index 62710ba8fbf..a5c29c191ad 100644 --- a/tests/mir-opt/gvn.wrap_unwrap.GVN.panic-abort.diff +++ b/tests/mir-opt/gvn.wrap_unwrap.GVN.panic-abort.diff @@ -21,18 +21,18 @@ + _2 = Option::<T>::Some(_1); StorageDead(_3); - _4 = discriminant(_2); -- switchInt(move _4) -> [0: bb1, 1: bb3, otherwise: bb2]; +- switchInt(move _4) -> [0: bb2, 1: bb3, otherwise: bb1]; + _4 = const 1_isize; -+ switchInt(const 1_isize) -> [0: bb1, 1: bb3, otherwise: bb2]; ++ switchInt(const 1_isize) -> [0: bb2, 1: bb3, otherwise: bb1]; } bb1: { - StorageLive(_6); - _6 = begin_panic::<&str>(const "explicit panic") -> unwind unreachable; + unreachable; } bb2: { - unreachable; + StorageLive(_6); + _6 = begin_panic::<&str>(const "explicit panic") -> unwind unreachable; } bb3: { diff --git a/tests/mir-opt/gvn.wrap_unwrap.GVN.panic-unwind.diff b/tests/mir-opt/gvn.wrap_unwrap.GVN.panic-unwind.diff index ad46a065b1e..6f2e5248271 100644 --- a/tests/mir-opt/gvn.wrap_unwrap.GVN.panic-unwind.diff +++ b/tests/mir-opt/gvn.wrap_unwrap.GVN.panic-unwind.diff @@ -21,18 +21,18 @@ + _2 = Option::<T>::Some(_1); StorageDead(_3); - _4 = discriminant(_2); -- switchInt(move _4) -> [0: bb1, 1: bb3, otherwise: bb2]; +- switchInt(move _4) -> [0: bb2, 1: bb3, otherwise: bb1]; + _4 = const 1_isize; -+ switchInt(const 1_isize) -> [0: bb1, 1: bb3, otherwise: bb2]; ++ switchInt(const 1_isize) -> [0: bb2, 1: bb3, otherwise: bb1]; } bb1: { - StorageLive(_6); - _6 = begin_panic::<&str>(const "explicit panic") -> unwind continue; + unreachable; } bb2: { - unreachable; + StorageLive(_6); + _6 = begin_panic::<&str>(const "explicit panic") -> unwind continue; } bb3: { diff --git a/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-abort.diff b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-abort.diff index 9358a64b4fa..52688c2e867 100644 --- a/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-abort.diff +++ b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-abort.diff @@ -28,18 +28,18 @@ + StorageLive(_3); + StorageLive(_5); + _3 = discriminant(_2); -+ switchInt(move _3) -> [0: bb1, 1: bb3, otherwise: bb2]; ++ switchInt(move _3) -> [0: bb2, 1: bb3, otherwise: bb1]; } bb1: { -+ StorageLive(_4); -+ _4 = cfg!(debug_assertions); -+ assume(_4); -+ _5 = unreachable_unchecked::precondition_check() -> [return: bb2, unwind unreachable]; ++ unreachable; + } + + bb2: { -+ unreachable; ++ StorageLive(_4); ++ _4 = cfg!(debug_assertions); ++ assume(_4); ++ _5 = unreachable_unchecked::precondition_check() -> [return: bb1, unwind unreachable]; + } + + bb3: { diff --git a/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-unwind.diff b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-unwind.diff index ac33c126155..fd83f1cb331 100644 --- a/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-unwind.diff @@ -28,22 +28,22 @@ + StorageLive(_3); + StorageLive(_5); + _3 = discriminant(_2); -+ switchInt(move _3) -> [0: bb1, 1: bb3, otherwise: bb2]; ++ switchInt(move _3) -> [0: bb2, 1: bb3, otherwise: bb1]; } bb1: { - StorageDead(_2); - return; -+ StorageLive(_4); -+ _4 = cfg!(debug_assertions); -+ assume(_4); -+ _5 = unreachable_unchecked::precondition_check() -> [return: bb2, unwind unreachable]; ++ unreachable; } - bb2 (cleanup): { - resume; + bb2: { -+ unreachable; ++ StorageLive(_4); ++ _4 = cfg!(debug_assertions); ++ assume(_4); ++ _5 = unreachable_unchecked::precondition_check() -> [return: bb1, unwind unreachable]; + } + + bb3: { diff --git a/tests/mir-opt/issue_120925_unsafefncast.rs b/tests/mir-opt/issue_120925_unsafefncast.rs new file mode 100644 index 00000000000..f80ae66efda --- /dev/null +++ b/tests/mir-opt/issue_120925_unsafefncast.rs @@ -0,0 +1,25 @@ +// Verify that we do not ICE when attempting to interpret casts between fn types. +// skip-filecheck + +static FOO: fn() = || assert_ne!(42, 43); +static BAR: fn(i32, i32) = |a, b| assert_ne!(a, b); + +fn main() { + FOO(); + + let bar: unsafe fn(i32, i32) = BAR; + + let f: fn() = || {}; + f(); + + f(); + + f(); + + let g: fn(i32) = |i| assert_eq!(i, 2); + g(2); + + g(2); + + g(2); +} diff --git a/tests/mir-opt/issue_62289.test.ElaborateDrops.before.panic-abort.mir b/tests/mir-opt/issue_62289.test.ElaborateDrops.before.panic-abort.mir index fadfdfc87be..91dee82fde0 100644 --- a/tests/mir-opt/issue_62289.test.ElaborateDrops.before.panic-abort.mir +++ b/tests/mir-opt/issue_62289.test.ElaborateDrops.before.panic-abort.mir @@ -47,10 +47,14 @@ fn test() -> Option<Box<u32>> { StorageDead(_7); PlaceMention(_6); _8 = discriminant(_6); - switchInt(move _8) -> [0: bb3, 1: bb5, otherwise: bb4]; + switchInt(move _8) -> [0: bb4, 1: bb5, otherwise: bb3]; } bb3: { + unreachable; + } + + bb4: { StorageLive(_12); _12 = ((_6 as Continue).0: u32); (*_5) = _12; @@ -59,10 +63,6 @@ fn test() -> Option<Box<u32>> { drop(_5) -> [return: bb7, unwind: bb11]; } - bb4: { - unreachable; - } - bb5: { StorageLive(_9); _9 = ((_6 as Break).0: std::option::Option<std::convert::Infallible>); 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 8f94165a108..ff7fc74ff61 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 @@ -47,10 +47,14 @@ fn test() -> Option<Box<u32>> { StorageDead(_7); PlaceMention(_6); _8 = discriminant(_6); - switchInt(move _8) -> [0: bb3, 1: bb5, otherwise: bb4]; + switchInt(move _8) -> [0: bb4, 1: bb5, otherwise: bb3]; } bb3: { + unreachable; + } + + bb4: { StorageLive(_12); _12 = ((_6 as Continue).0: u32); (*_5) = _12; @@ -59,10 +63,6 @@ fn test() -> Option<Box<u32>> { drop(_5) -> [return: bb7, unwind: bb11]; } - bb4: { - unreachable; - } - bb5: { StorageLive(_9); _9 = ((_6 as Break).0: std::option::Option<std::convert::Infallible>); diff --git a/tests/mir-opt/issue_72181.bar.built.after.mir b/tests/mir-opt/issue_72181.bar.built.after.mir index c2e4e2072de..b6cc7d22195 100644 --- a/tests/mir-opt/issue_72181.bar.built.after.mir +++ b/tests/mir-opt/issue_72181.bar.built.after.mir @@ -14,4 +14,9 @@ fn bar(_1: [(Never, u32); 1]) -> u32 { StorageDead(_2); return; } + + bb1: { + FakeRead(ForMatchedPlace(None), _1); + unreachable; + } } diff --git a/tests/mir-opt/issue_72181.main.built.after.mir b/tests/mir-opt/issue_72181.main.built.after.mir index 4e4071536b1..12c4a2b6325 100644 --- a/tests/mir-opt/issue_72181.main.built.after.mir +++ b/tests/mir-opt/issue_72181.main.built.after.mir @@ -22,7 +22,7 @@ fn main() -> () { bb0: { StorageLive(_1); - _1 = std::mem::size_of::<Foo>() -> [return: bb1, unwind: bb3]; + _1 = std::mem::size_of::<Foo>() -> [return: bb1, unwind: bb5]; } bb1: { @@ -42,10 +42,15 @@ fn main() -> () { _6 = const 0_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) -> [success: bb2, unwind: bb3]; + assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb3, unwind: bb5]; } bb2: { + FakeRead(ForMatchedPlace(None), _1); + unreachable; + } + + bb3: { _5 = (_2[_6].0: u64); PlaceMention(_5); StorageDead(_6); @@ -55,7 +60,12 @@ fn main() -> () { return; } - bb3 (cleanup): { + bb4: { + FakeRead(ForMatchedPlace(None), _5); + unreachable; + } + + bb5 (cleanup): { resume; } } diff --git a/tests/mir-opt/issue_72181_1.f.built.after.mir b/tests/mir-opt/issue_72181_1.f.built.after.mir index 89da9a80113..674a4013fe7 100644 --- a/tests/mir-opt/issue_72181_1.f.built.after.mir +++ b/tests/mir-opt/issue_72181_1.f.built.after.mir @@ -6,11 +6,15 @@ fn f(_1: Void) -> ! { bb0: { PlaceMention(_1); + goto -> bb1; + } + + bb1: { FakeRead(ForMatchedPlace(None), _1); unreachable; } - bb1: { + bb2: { return; } } diff --git a/tests/mir-opt/issue_91633.bar.built.after.mir b/tests/mir-opt/issue_91633.bar.built.after.mir index cce1a1fd2ef..53829588a1b 100644 --- a/tests/mir-opt/issue_91633.bar.built.after.mir +++ b/tests/mir-opt/issue_91633.bar.built.after.mir @@ -12,7 +12,7 @@ fn bar(_1: Box<[T]>) -> () { StorageLive(_2); StorageLive(_3); _3 = &(*_1); - _2 = <[T] as Index<usize>>::index(move _3, const 0_usize) -> [return: bb1, unwind: bb3]; + _2 = <[T] as Index<usize>>::index(move _3, const 0_usize) -> [return: bb1, unwind: bb4]; } bb1: { @@ -20,18 +20,23 @@ fn bar(_1: Box<[T]>) -> () { PlaceMention((*_2)); StorageDead(_2); _0 = const (); - drop(_1) -> [return: bb2, unwind: bb4]; + drop(_1) -> [return: bb3, unwind: bb5]; } bb2: { - return; + FakeRead(ForMatchedPlace(None), (*_2)); + unreachable; } - bb3 (cleanup): { - drop(_1) -> [return: bb4, unwind terminate(cleanup)]; + bb3: { + return; } bb4 (cleanup): { + drop(_1) -> [return: bb5, unwind terminate(cleanup)]; + } + + bb5 (cleanup): { resume; } } diff --git a/tests/mir-opt/issue_91633.hey.built.after.mir b/tests/mir-opt/issue_91633.hey.built.after.mir index aa8f31f8156..a537e509996 100644 --- a/tests/mir-opt/issue_91633.hey.built.after.mir +++ b/tests/mir-opt/issue_91633.hey.built.after.mir @@ -14,7 +14,7 @@ fn hey(_1: &[T]) -> () { StorageLive(_3); StorageLive(_4); _4 = &(*_1); - _3 = <[T] as Index<usize>>::index(move _4, const 0_usize) -> [return: bb1, unwind: bb2]; + _3 = <[T] as Index<usize>>::index(move _4, const 0_usize) -> [return: bb1, unwind: bb3]; } bb1: { @@ -27,7 +27,12 @@ fn hey(_1: &[T]) -> () { return; } - bb2 (cleanup): { + bb2: { + FakeRead(ForMatchedPlace(None), _2); + unreachable; + } + + bb3 (cleanup): { resume; } } diff --git a/tests/mir-opt/issue_99325.main.built.after.32bit.mir b/tests/mir-opt/issue_99325.main.built.after.32bit.mir index a10061ed941..53254f76dbc 100644 --- a/tests/mir-opt/issue_99325.main.built.after.32bit.mir +++ b/tests/mir-opt/issue_99325.main.built.after.32bit.mir @@ -67,7 +67,7 @@ fn main() -> () { StorageLive(_2); StorageLive(_3); StorageLive(_4); - _4 = function_with_bytes::<&*b"AAAA">() -> [return: bb1, unwind: bb21]; + _4 = function_with_bytes::<&*b"AAAA">() -> [return: bb1, unwind: bb23]; } bb1: { @@ -91,24 +91,29 @@ fn main() -> () { _11 = &(*_8); StorageLive(_12); _12 = &(*_9); - _10 = <&[u8] as PartialEq<&[u8; 4]>>::eq(move _11, move _12) -> [return: bb2, unwind: bb21]; + _10 = <&[u8] as PartialEq<&[u8; 4]>>::eq(move _11, move _12) -> [return: bb3, unwind: bb23]; } bb2: { - switchInt(move _10) -> [0: bb4, otherwise: bb3]; + FakeRead(ForMatchedPlace(None), _2); + unreachable; } bb3: { - StorageDead(_12); - StorageDead(_11); - goto -> bb8; + switchInt(move _10) -> [0: bb5, otherwise: bb4]; } bb4: { - goto -> bb5; + StorageDead(_12); + StorageDead(_11); + goto -> bb9; } bb5: { + goto -> bb6; + } + + bb6: { StorageDead(_12); StorageDead(_11); StorageLive(_14); @@ -127,10 +132,10 @@ fn main() -> () { _19 = &(*_20); StorageLive(_21); _21 = Option::<Arguments<'_>>::None; - _15 = core::panicking::assert_failed::<&[u8], &[u8; 4]>(move _16, move _17, move _19, move _21) -> bb21; + _15 = core::panicking::assert_failed::<&[u8], &[u8; 4]>(move _16, move _17, move _19, move _21) -> bb23; } - bb6: { + bb7: { StorageDead(_21); StorageDead(_19); StorageDead(_17); @@ -142,23 +147,23 @@ fn main() -> () { unreachable; } - bb7: { - goto -> bb9; + bb8: { + goto -> bb10; } - bb8: { + bb9: { _1 = const (); - goto -> bb9; + goto -> bb10; } - bb9: { + bb10: { StorageDead(_10); StorageDead(_9); StorageDead(_8); - goto -> bb10; + goto -> bb11; } - bb10: { + bb11: { StorageDead(_7); StorageDead(_6); StorageDead(_4); @@ -168,10 +173,10 @@ fn main() -> () { StorageLive(_23); StorageLive(_24); StorageLive(_25); - _25 = function_with_bytes::<&*b"AAAA">() -> [return: bb11, unwind: bb21]; + _25 = function_with_bytes::<&*b"AAAA">() -> [return: bb12, unwind: bb23]; } - bb11: { + bb12: { _24 = &_25; StorageLive(_26); StorageLive(_27); @@ -190,24 +195,29 @@ fn main() -> () { _31 = &(*_28); StorageLive(_32); _32 = &(*_29); - _30 = <&[u8] as PartialEq<&[u8; 4]>>::eq(move _31, move _32) -> [return: bb12, unwind: bb21]; + _30 = <&[u8] as PartialEq<&[u8; 4]>>::eq(move _31, move _32) -> [return: bb14, unwind: bb23]; } - bb12: { - switchInt(move _30) -> [0: bb14, otherwise: bb13]; + bb13: { + FakeRead(ForMatchedPlace(None), _23); + unreachable; } - bb13: { + bb14: { + switchInt(move _30) -> [0: bb16, otherwise: bb15]; + } + + bb15: { StorageDead(_32); StorageDead(_31); - goto -> bb18; + goto -> bb20; } - bb14: { - goto -> bb15; + bb16: { + goto -> bb17; } - bb15: { + bb17: { StorageDead(_32); StorageDead(_31); StorageLive(_34); @@ -226,10 +236,10 @@ fn main() -> () { _39 = &(*_40); StorageLive(_41); _41 = Option::<Arguments<'_>>::None; - _35 = core::panicking::assert_failed::<&[u8], &[u8; 4]>(move _36, move _37, move _39, move _41) -> bb21; + _35 = core::panicking::assert_failed::<&[u8], &[u8; 4]>(move _36, move _37, move _39, move _41) -> bb23; } - bb16: { + bb18: { StorageDead(_41); StorageDead(_39); StorageDead(_37); @@ -241,23 +251,23 @@ fn main() -> () { unreachable; } - bb17: { - goto -> bb19; + bb19: { + goto -> bb21; } - bb18: { + bb20: { _22 = const (); - goto -> bb19; + goto -> bb21; } - bb19: { + bb21: { StorageDead(_30); StorageDead(_29); StorageDead(_28); - goto -> bb20; + goto -> bb22; } - bb20: { + bb22: { StorageDead(_27); StorageDead(_25); StorageDead(_23); @@ -266,7 +276,7 @@ fn main() -> () { return; } - bb21 (cleanup): { + bb23 (cleanup): { resume; } } diff --git a/tests/mir-opt/issue_99325.main.built.after.64bit.mir b/tests/mir-opt/issue_99325.main.built.after.64bit.mir index a10061ed941..53254f76dbc 100644 --- a/tests/mir-opt/issue_99325.main.built.after.64bit.mir +++ b/tests/mir-opt/issue_99325.main.built.after.64bit.mir @@ -67,7 +67,7 @@ fn main() -> () { StorageLive(_2); StorageLive(_3); StorageLive(_4); - _4 = function_with_bytes::<&*b"AAAA">() -> [return: bb1, unwind: bb21]; + _4 = function_with_bytes::<&*b"AAAA">() -> [return: bb1, unwind: bb23]; } bb1: { @@ -91,24 +91,29 @@ fn main() -> () { _11 = &(*_8); StorageLive(_12); _12 = &(*_9); - _10 = <&[u8] as PartialEq<&[u8; 4]>>::eq(move _11, move _12) -> [return: bb2, unwind: bb21]; + _10 = <&[u8] as PartialEq<&[u8; 4]>>::eq(move _11, move _12) -> [return: bb3, unwind: bb23]; } bb2: { - switchInt(move _10) -> [0: bb4, otherwise: bb3]; + FakeRead(ForMatchedPlace(None), _2); + unreachable; } bb3: { - StorageDead(_12); - StorageDead(_11); - goto -> bb8; + switchInt(move _10) -> [0: bb5, otherwise: bb4]; } bb4: { - goto -> bb5; + StorageDead(_12); + StorageDead(_11); + goto -> bb9; } bb5: { + goto -> bb6; + } + + bb6: { StorageDead(_12); StorageDead(_11); StorageLive(_14); @@ -127,10 +132,10 @@ fn main() -> () { _19 = &(*_20); StorageLive(_21); _21 = Option::<Arguments<'_>>::None; - _15 = core::panicking::assert_failed::<&[u8], &[u8; 4]>(move _16, move _17, move _19, move _21) -> bb21; + _15 = core::panicking::assert_failed::<&[u8], &[u8; 4]>(move _16, move _17, move _19, move _21) -> bb23; } - bb6: { + bb7: { StorageDead(_21); StorageDead(_19); StorageDead(_17); @@ -142,23 +147,23 @@ fn main() -> () { unreachable; } - bb7: { - goto -> bb9; + bb8: { + goto -> bb10; } - bb8: { + bb9: { _1 = const (); - goto -> bb9; + goto -> bb10; } - bb9: { + bb10: { StorageDead(_10); StorageDead(_9); StorageDead(_8); - goto -> bb10; + goto -> bb11; } - bb10: { + bb11: { StorageDead(_7); StorageDead(_6); StorageDead(_4); @@ -168,10 +173,10 @@ fn main() -> () { StorageLive(_23); StorageLive(_24); StorageLive(_25); - _25 = function_with_bytes::<&*b"AAAA">() -> [return: bb11, unwind: bb21]; + _25 = function_with_bytes::<&*b"AAAA">() -> [return: bb12, unwind: bb23]; } - bb11: { + bb12: { _24 = &_25; StorageLive(_26); StorageLive(_27); @@ -190,24 +195,29 @@ fn main() -> () { _31 = &(*_28); StorageLive(_32); _32 = &(*_29); - _30 = <&[u8] as PartialEq<&[u8; 4]>>::eq(move _31, move _32) -> [return: bb12, unwind: bb21]; + _30 = <&[u8] as PartialEq<&[u8; 4]>>::eq(move _31, move _32) -> [return: bb14, unwind: bb23]; } - bb12: { - switchInt(move _30) -> [0: bb14, otherwise: bb13]; + bb13: { + FakeRead(ForMatchedPlace(None), _23); + unreachable; } - bb13: { + bb14: { + switchInt(move _30) -> [0: bb16, otherwise: bb15]; + } + + bb15: { StorageDead(_32); StorageDead(_31); - goto -> bb18; + goto -> bb20; } - bb14: { - goto -> bb15; + bb16: { + goto -> bb17; } - bb15: { + bb17: { StorageDead(_32); StorageDead(_31); StorageLive(_34); @@ -226,10 +236,10 @@ fn main() -> () { _39 = &(*_40); StorageLive(_41); _41 = Option::<Arguments<'_>>::None; - _35 = core::panicking::assert_failed::<&[u8], &[u8; 4]>(move _36, move _37, move _39, move _41) -> bb21; + _35 = core::panicking::assert_failed::<&[u8], &[u8; 4]>(move _36, move _37, move _39, move _41) -> bb23; } - bb16: { + bb18: { StorageDead(_41); StorageDead(_39); StorageDead(_37); @@ -241,23 +251,23 @@ fn main() -> () { unreachable; } - bb17: { - goto -> bb19; + bb19: { + goto -> bb21; } - bb18: { + bb20: { _22 = const (); - goto -> bb19; + goto -> bb21; } - bb19: { + bb21: { StorageDead(_30); StorageDead(_29); StorageDead(_28); - goto -> bb20; + goto -> bb22; } - bb20: { + bb22: { StorageDead(_27); StorageDead(_25); StorageDead(_23); @@ -266,7 +276,7 @@ fn main() -> () { return; } - bb21 (cleanup): { + bb23 (cleanup): { resume; } } diff --git a/tests/mir-opt/jump_threading.dfa.JumpThreading.panic-abort.diff b/tests/mir-opt/jump_threading.dfa.JumpThreading.panic-abort.diff index ad5846c97de..bbbfe90691f 100644 --- a/tests/mir-opt/jump_threading.dfa.JumpThreading.panic-abort.diff +++ b/tests/mir-opt/jump_threading.dfa.JumpThreading.panic-abort.diff @@ -24,20 +24,20 @@ bb1: { _4 = discriminant(_1); - switchInt(move _4) -> [0: bb4, 1: bb5, 2: bb6, 3: bb2, otherwise: bb3]; + switchInt(move _4) -> [0: bb4, 1: bb5, 2: bb6, 3: bb3, otherwise: bb2]; } bb2: { + unreachable; + } + + bb3: { _0 = const (); StorageDead(_2); StorageDead(_1); return; } - bb3: { - unreachable; - } - bb4: { StorageLive(_5); _5 = DFA::B; diff --git a/tests/mir-opt/jump_threading.dfa.JumpThreading.panic-unwind.diff b/tests/mir-opt/jump_threading.dfa.JumpThreading.panic-unwind.diff index ad5846c97de..bbbfe90691f 100644 --- a/tests/mir-opt/jump_threading.dfa.JumpThreading.panic-unwind.diff +++ b/tests/mir-opt/jump_threading.dfa.JumpThreading.panic-unwind.diff @@ -24,20 +24,20 @@ bb1: { _4 = discriminant(_1); - switchInt(move _4) -> [0: bb4, 1: bb5, 2: bb6, 3: bb2, otherwise: bb3]; + switchInt(move _4) -> [0: bb4, 1: bb5, 2: bb6, 3: bb3, otherwise: bb2]; } bb2: { + unreachable; + } + + bb3: { _0 = const (); StorageDead(_2); StorageDead(_1); return; } - bb3: { - unreachable; - } - bb4: { StorageLive(_5); _5 = DFA::B; diff --git a/tests/mir-opt/jump_threading.identity.JumpThreading.panic-abort.diff b/tests/mir-opt/jump_threading.identity.JumpThreading.panic-abort.diff index 9cc4385f60b..d67477ab1b9 100644 --- a/tests/mir-opt/jump_threading.identity.JumpThreading.panic-abort.diff +++ b/tests/mir-opt/jump_threading.identity.JumpThreading.panic-abort.diff @@ -56,10 +56,14 @@ StorageLive(_11); StorageLive(_12); _10 = discriminant(_4); - switchInt(move _10) -> [0: bb7, 1: bb6, otherwise: bb2]; + switchInt(move _10) -> [0: bb7, 1: bb6, otherwise: bb1]; } bb1: { + unreachable; + } + + bb2: { StorageLive(_9); _9 = ((_3 as Continue).0: i32); _2 = _9; @@ -70,10 +74,6 @@ goto -> bb4; } - bb2: { - unreachable; - } - bb3: { StorageLive(_6); _6 = ((_3 as Break).0: std::result::Result<std::convert::Infallible, i32>); @@ -103,8 +103,8 @@ StorageDead(_10); StorageDead(_4); _5 = discriminant(_3); -- switchInt(move _5) -> [0: bb1, 1: bb3, otherwise: bb2]; -+ goto -> bb1; +- switchInt(move _5) -> [0: bb2, 1: bb3, otherwise: bb1]; ++ goto -> bb2; } bb6: { diff --git a/tests/mir-opt/jump_threading.identity.JumpThreading.panic-unwind.diff b/tests/mir-opt/jump_threading.identity.JumpThreading.panic-unwind.diff index 9cc4385f60b..d67477ab1b9 100644 --- a/tests/mir-opt/jump_threading.identity.JumpThreading.panic-unwind.diff +++ b/tests/mir-opt/jump_threading.identity.JumpThreading.panic-unwind.diff @@ -56,10 +56,14 @@ StorageLive(_11); StorageLive(_12); _10 = discriminant(_4); - switchInt(move _10) -> [0: bb7, 1: bb6, otherwise: bb2]; + switchInt(move _10) -> [0: bb7, 1: bb6, otherwise: bb1]; } bb1: { + unreachable; + } + + bb2: { StorageLive(_9); _9 = ((_3 as Continue).0: i32); _2 = _9; @@ -70,10 +74,6 @@ goto -> bb4; } - bb2: { - unreachable; - } - bb3: { StorageLive(_6); _6 = ((_3 as Break).0: std::result::Result<std::convert::Infallible, i32>); @@ -103,8 +103,8 @@ StorageDead(_10); StorageDead(_4); _5 = discriminant(_3); -- switchInt(move _5) -> [0: bb1, 1: bb3, otherwise: bb2]; -+ goto -> bb1; +- switchInt(move _5) -> [0: bb2, 1: bb3, otherwise: bb1]; ++ goto -> bb2; } bb6: { diff --git a/tests/mir-opt/jump_threading.rs b/tests/mir-opt/jump_threading.rs index a66fe8b57e7..512aebd857a 100644 --- a/tests/mir-opt/jump_threading.rs +++ b/tests/mir-opt/jump_threading.rs @@ -12,12 +12,12 @@ use std::ops::ControlFlow; fn too_complex(x: Result<i32, usize>) -> Option<i32> { // CHECK-LABEL: fn too_complex( // CHECK: bb0: { - // CHECK: switchInt(move {{_.*}}) -> [0: bb3, 1: bb1, otherwise: bb2]; + // CHECK: switchInt(move {{_.*}}) -> [0: bb3, 1: bb2, otherwise: bb1]; // CHECK: bb1: { + // CHECK: unreachable; + // CHECK: bb2: { // CHECK: [[controlflow:_.*]] = ControlFlow::<usize, i32>::Break( // CHECK: goto -> bb8; - // CHECK: bb2: { - // CHECK: unreachable; // CHECK: bb3: { // CHECK: [[controlflow]] = ControlFlow::<usize, i32>::Continue( // CHECK: goto -> bb4; @@ -50,13 +50,13 @@ fn identity(x: Result<i32, i32>) -> Result<i32, i32> { // CHECK-LABEL: fn identity( // CHECK: bb0: { // CHECK: [[x:_.*]] = _1; - // CHECK: switchInt(move {{_.*}}) -> [0: bb7, 1: bb6, otherwise: bb2]; + // CHECK: switchInt(move {{_.*}}) -> [0: bb7, 1: bb6, otherwise: bb1]; // CHECK: bb1: { + // CHECK: unreachable; + // CHECK: bb2: { // CHECK: {{_.*}} = (([[controlflow:_.*]] as Continue).0: i32); // CHECK: _0 = Result::<i32, i32>::Ok( // CHECK: goto -> bb4; - // CHECK: bb2: { - // CHECK: unreachable; // CHECK: bb3: { // CHECK: {{_.*}} = (([[controlflow]] as Break).0: std::result::Result<std::convert::Infallible, i32>); // CHECK: _0 = Result::<i32, i32>::Err( @@ -64,7 +64,7 @@ fn identity(x: Result<i32, i32>) -> Result<i32, i32> { // CHECK: bb4: { // CHECK: return; // CHECK: bb5: { - // CHECK: goto -> bb1; + // CHECK: goto -> bb2; // CHECK: bb6: { // CHECK: {{_.*}} = move (([[x]] as Err).0: i32); // CHECK: [[controlflow]] = ControlFlow::<Result<Infallible, i32>, i32>::Break( @@ -93,11 +93,11 @@ fn dfa() { // CHECK: {{_.*}} = DFA::A; // CHECK: goto -> bb1; // CHECK: bb1: { - // CHECK: switchInt({{.*}}) -> [0: bb4, 1: bb5, 2: bb6, 3: bb2, otherwise: bb3]; + // CHECK: switchInt({{.*}}) -> [0: bb4, 1: bb5, 2: bb6, 3: bb3, otherwise: bb2]; // CHECK: bb2: { - // CHECK: return; - // CHECK: bb3: { // CHECK: unreachable; + // CHECK: bb3: { + // CHECK: return; // CHECK: bb4: { // CHECK: {{_.*}} = DFA::B; // CHECK: goto -> bb1; diff --git a/tests/mir-opt/jump_threading.too_complex.JumpThreading.panic-abort.diff b/tests/mir-opt/jump_threading.too_complex.JumpThreading.panic-abort.diff index f5eade4a914..365d9d6b32b 100644 --- a/tests/mir-opt/jump_threading.too_complex.JumpThreading.panic-abort.diff +++ b/tests/mir-opt/jump_threading.too_complex.JumpThreading.panic-abort.diff @@ -30,10 +30,14 @@ bb0: { StorageLive(_2); _3 = discriminant(_1); - switchInt(move _3) -> [0: bb3, 1: bb1, otherwise: bb2]; + switchInt(move _3) -> [0: bb3, 1: bb2, otherwise: bb1]; } bb1: { + unreachable; + } + + bb2: { StorageLive(_6); _6 = ((_1 as Err).0: usize); StorageLive(_7); @@ -45,10 +49,6 @@ + goto -> bb8; } - bb2: { - unreachable; - } - bb3: { StorageLive(_4); _4 = ((_1 as Ok).0: i32); @@ -62,7 +62,7 @@ bb4: { _8 = discriminant(_2); -- switchInt(move _8) -> [0: bb6, 1: bb5, otherwise: bb2]; +- switchInt(move _8) -> [0: bb6, 1: bb5, otherwise: bb1]; + goto -> bb6; } diff --git a/tests/mir-opt/jump_threading.too_complex.JumpThreading.panic-unwind.diff b/tests/mir-opt/jump_threading.too_complex.JumpThreading.panic-unwind.diff index f5eade4a914..365d9d6b32b 100644 --- a/tests/mir-opt/jump_threading.too_complex.JumpThreading.panic-unwind.diff +++ b/tests/mir-opt/jump_threading.too_complex.JumpThreading.panic-unwind.diff @@ -30,10 +30,14 @@ bb0: { StorageLive(_2); _3 = discriminant(_1); - switchInt(move _3) -> [0: bb3, 1: bb1, otherwise: bb2]; + switchInt(move _3) -> [0: bb3, 1: bb2, otherwise: bb1]; } bb1: { + unreachable; + } + + bb2: { StorageLive(_6); _6 = ((_1 as Err).0: usize); StorageLive(_7); @@ -45,10 +49,6 @@ + goto -> bb8; } - bb2: { - unreachable; - } - bb3: { StorageLive(_4); _4 = ((_1 as Ok).0: i32); @@ -62,7 +62,7 @@ bb4: { _8 = discriminant(_2); -- switchInt(move _8) -> [0: bb6, 1: bb5, otherwise: bb2]; +- switchInt(move _8) -> [0: bb6, 1: bb5, otherwise: bb1]; + goto -> bb6; } diff --git a/tests/mir-opt/match_arm_scopes.complicated_match.panic-abort.SimplifyCfg-initial.after-ElaborateDrops.after.diff b/tests/mir-opt/match_arm_scopes.complicated_match.panic-abort.SimplifyCfg-initial.after-ElaborateDrops.after.diff index b4bd45ba597..307f7105dd2 100644 --- a/tests/mir-opt/match_arm_scopes.complicated_match.panic-abort.SimplifyCfg-initial.after-ElaborateDrops.after.diff +++ b/tests/mir-opt/match_arm_scopes.complicated_match.panic-abort.SimplifyCfg-initial.after-ElaborateDrops.after.diff @@ -32,33 +32,25 @@ bb0: { PlaceMention(_2); -- switchInt((_2.0: bool)) -> [0: bb1, otherwise: bb2]; +- switchInt((_2.0: bool)) -> [0: bb6, otherwise: bb1]; + switchInt((_2.0: bool)) -> [0: bb5, otherwise: bb1]; } bb1: { -- falseEdge -> [real: bb8, imaginary: bb3]; +- switchInt((_2.1: bool)) -> [0: bb5, otherwise: bb2]; + switchInt((_2.1: bool)) -> [0: bb10, otherwise: bb2]; } bb2: { -- switchInt((_2.1: bool)) -> [0: bb3, otherwise: bb4]; +- switchInt((_2.0: bool)) -> [0: bb4, otherwise: bb3]; + switchInt((_2.0: bool)) -> [0: bb3, otherwise: bb17]; } bb3: { -- falseEdge -> [real: bb13, imaginary: bb5]; +- falseEdge -> [real: bb20, imaginary: bb4]; - } - - bb4: { -- switchInt((_2.0: bool)) -> [0: bb6, otherwise: bb5]; -- } -- -- bb5: { -- falseEdge -> [real: bb20, imaginary: bb6]; -- } -- -- bb6: { StorageLive(_15); _15 = (_2.1: bool); StorageLive(_16); @@ -67,6 +59,14 @@ + goto -> bb16; } +- bb5: { +- falseEdge -> [real: bb13, imaginary: bb3]; +- } +- +- bb6: { +- falseEdge -> [real: bb8, imaginary: bb5]; +- } +- - bb7: { + bb4: { _0 = const 1_i32; @@ -127,7 +127,7 @@ StorageDead(_9); StorageDead(_8); StorageDead(_6); -- falseEdge -> [real: bb2, imaginary: bb3]; +- falseEdge -> [real: bb1, imaginary: bb5]; + goto -> bb1; } @@ -184,7 +184,7 @@ StorageDead(_12); StorageDead(_8); StorageDead(_6); -- falseEdge -> [real: bb4, imaginary: bb5]; +- falseEdge -> [real: bb2, imaginary: bb3]; + goto -> bb2; } diff --git a/tests/mir-opt/match_arm_scopes.complicated_match.panic-unwind.SimplifyCfg-initial.after-ElaborateDrops.after.diff b/tests/mir-opt/match_arm_scopes.complicated_match.panic-unwind.SimplifyCfg-initial.after-ElaborateDrops.after.diff index b4bd45ba597..307f7105dd2 100644 --- a/tests/mir-opt/match_arm_scopes.complicated_match.panic-unwind.SimplifyCfg-initial.after-ElaborateDrops.after.diff +++ b/tests/mir-opt/match_arm_scopes.complicated_match.panic-unwind.SimplifyCfg-initial.after-ElaborateDrops.after.diff @@ -32,33 +32,25 @@ bb0: { PlaceMention(_2); -- switchInt((_2.0: bool)) -> [0: bb1, otherwise: bb2]; +- switchInt((_2.0: bool)) -> [0: bb6, otherwise: bb1]; + switchInt((_2.0: bool)) -> [0: bb5, otherwise: bb1]; } bb1: { -- falseEdge -> [real: bb8, imaginary: bb3]; +- switchInt((_2.1: bool)) -> [0: bb5, otherwise: bb2]; + switchInt((_2.1: bool)) -> [0: bb10, otherwise: bb2]; } bb2: { -- switchInt((_2.1: bool)) -> [0: bb3, otherwise: bb4]; +- switchInt((_2.0: bool)) -> [0: bb4, otherwise: bb3]; + switchInt((_2.0: bool)) -> [0: bb3, otherwise: bb17]; } bb3: { -- falseEdge -> [real: bb13, imaginary: bb5]; +- falseEdge -> [real: bb20, imaginary: bb4]; - } - - bb4: { -- switchInt((_2.0: bool)) -> [0: bb6, otherwise: bb5]; -- } -- -- bb5: { -- falseEdge -> [real: bb20, imaginary: bb6]; -- } -- -- bb6: { StorageLive(_15); _15 = (_2.1: bool); StorageLive(_16); @@ -67,6 +59,14 @@ + goto -> bb16; } +- bb5: { +- falseEdge -> [real: bb13, imaginary: bb3]; +- } +- +- bb6: { +- falseEdge -> [real: bb8, imaginary: bb5]; +- } +- - bb7: { + bb4: { _0 = const 1_i32; @@ -127,7 +127,7 @@ StorageDead(_9); StorageDead(_8); StorageDead(_6); -- falseEdge -> [real: bb2, imaginary: bb3]; +- falseEdge -> [real: bb1, imaginary: bb5]; + goto -> bb1; } @@ -184,7 +184,7 @@ StorageDead(_12); StorageDead(_8); StorageDead(_6); -- falseEdge -> [real: bb4, imaginary: bb5]; +- falseEdge -> [real: bb2, imaginary: bb3]; + goto -> bb2; } diff --git a/tests/mir-opt/match_test.main.SimplifyCfg-initial.after.mir b/tests/mir-opt/match_test.main.SimplifyCfg-initial.after.mir index 5bf78b6150f..107f56f7f69 100644 --- a/tests/mir-opt/match_test.main.SimplifyCfg-initial.after.mir +++ b/tests/mir-opt/match_test.main.SimplifyCfg-initial.after.mir @@ -32,12 +32,12 @@ fn main() -> () { } bb1: { - falseEdge -> [real: bb9, imaginary: bb4]; + _3 = const 3_i32; + goto -> bb14; } bb2: { - _3 = const 3_i32; - goto -> bb14; + falseEdge -> [real: bb9, imaginary: bb4]; } bb3: { @@ -50,11 +50,11 @@ fn main() -> () { } bb5: { - switchInt(_1) -> [4294967295: bb6, otherwise: bb2]; + switchInt(_1) -> [4294967295: bb6, otherwise: bb1]; } bb6: { - falseEdge -> [real: bb13, imaginary: bb2]; + falseEdge -> [real: bb13, imaginary: bb1]; } bb7: { @@ -64,7 +64,7 @@ fn main() -> () { bb8: { _7 = Lt(_1, const 10_i32); - switchInt(move _7) -> [0: bb3, otherwise: bb1]; + switchInt(move _7) -> [0: bb3, otherwise: bb2]; } bb9: { @@ -83,7 +83,7 @@ fn main() -> () { bb11: { StorageDead(_9); - falseEdge -> [real: bb2, imaginary: bb4]; + falseEdge -> [real: bb1, imaginary: bb4]; } bb12: { diff --git a/tests/mir-opt/matches_u8.exhaustive_match.MatchBranchSimplification.diff b/tests/mir-opt/matches_u8.exhaustive_match.MatchBranchSimplification.diff index fec58556366..157f9c98353 100644 --- a/tests/mir-opt/matches_u8.exhaustive_match.MatchBranchSimplification.diff +++ b/tests/mir-opt/matches_u8.exhaustive_match.MatchBranchSimplification.diff @@ -8,16 +8,16 @@ bb0: { _2 = discriminant(_1); - switchInt(move _2) -> [0: bb3, 1: bb1, otherwise: bb2]; + switchInt(move _2) -> [0: bb3, 1: bb2, otherwise: bb1]; } bb1: { - _0 = const 1_u8; - goto -> bb4; + unreachable; } bb2: { - unreachable; + _0 = const 1_u8; + goto -> bb4; } bb3: { diff --git a/tests/mir-opt/matches_u8.exhaustive_match_i8.MatchBranchSimplification.diff b/tests/mir-opt/matches_u8.exhaustive_match_i8.MatchBranchSimplification.diff index 94d3ce6c971..19083771fd9 100644 --- a/tests/mir-opt/matches_u8.exhaustive_match_i8.MatchBranchSimplification.diff +++ b/tests/mir-opt/matches_u8.exhaustive_match_i8.MatchBranchSimplification.diff @@ -8,16 +8,16 @@ bb0: { _2 = discriminant(_1); - switchInt(move _2) -> [0: bb3, 1: bb1, otherwise: bb2]; + switchInt(move _2) -> [0: bb3, 1: bb2, otherwise: bb1]; } bb1: { - _0 = const 1_i8; - goto -> bb4; + unreachable; } bb2: { - unreachable; + _0 = const 1_i8; + goto -> bb4; } bb3: { diff --git a/tests/mir-opt/no_drop_for_inactive_variant.unwrap.SimplifyCfg-elaborate-drops.after.panic-abort.mir b/tests/mir-opt/no_drop_for_inactive_variant.unwrap.SimplifyCfg-elaborate-drops.after.panic-abort.mir index 08695523646..31a6a1d8b3d 100644 --- a/tests/mir-opt/no_drop_for_inactive_variant.unwrap.SimplifyCfg-elaborate-drops.after.panic-abort.mir +++ b/tests/mir-opt/no_drop_for_inactive_variant.unwrap.SimplifyCfg-elaborate-drops.after.panic-abort.mir @@ -15,16 +15,16 @@ fn unwrap(_1: Option<T>) -> T { bb0: { _2 = discriminant(_1); - switchInt(move _2) -> [0: bb1, 1: bb3, otherwise: bb2]; + switchInt(move _2) -> [0: bb2, 1: bb3, otherwise: bb1]; } bb1: { - StorageLive(_4); - _4 = begin_panic::<&str>(const "explicit panic") -> unwind unreachable; + unreachable; } bb2: { - unreachable; + StorageLive(_4); + _4 = begin_panic::<&str>(const "explicit panic") -> unwind unreachable; } bb3: { diff --git a/tests/mir-opt/no_drop_for_inactive_variant.unwrap.SimplifyCfg-elaborate-drops.after.panic-unwind.mir b/tests/mir-opt/no_drop_for_inactive_variant.unwrap.SimplifyCfg-elaborate-drops.after.panic-unwind.mir index 6276d854846..53352fbb19f 100644 --- a/tests/mir-opt/no_drop_for_inactive_variant.unwrap.SimplifyCfg-elaborate-drops.after.panic-unwind.mir +++ b/tests/mir-opt/no_drop_for_inactive_variant.unwrap.SimplifyCfg-elaborate-drops.after.panic-unwind.mir @@ -15,16 +15,16 @@ fn unwrap(_1: Option<T>) -> T { bb0: { _2 = discriminant(_1); - switchInt(move _2) -> [0: bb1, 1: bb3, otherwise: bb2]; + switchInt(move _2) -> [0: bb2, 1: bb3, otherwise: bb1]; } bb1: { - StorageLive(_4); - _4 = begin_panic::<&str>(const "explicit panic") -> bb4; + unreachable; } bb2: { - unreachable; + StorageLive(_4); + _4 = begin_panic::<&str>(const "explicit panic") -> bb4; } bb3: { diff --git a/tests/mir-opt/reference_prop.debuginfo.ReferencePropagation.diff b/tests/mir-opt/reference_prop.debuginfo.ReferencePropagation.diff index 1648f5dd8ca..84350b0dc51 100644 --- a/tests/mir-opt/reference_prop.debuginfo.ReferencePropagation.diff +++ b/tests/mir-opt/reference_prop.debuginfo.ReferencePropagation.diff @@ -67,10 +67,14 @@ StorageLive(_7); _7 = Option::<i32>::Some(const 0_i32); _8 = discriminant(_7); - switchInt(move _8) -> [0: bb3, 1: bb1, otherwise: bb2]; + switchInt(move _8) -> [0: bb3, 1: bb2, otherwise: bb1]; } bb1: { + unreachable; + } + + bb2: { StorageLive(_9); _27 = const _; _9 = &(((*_27) as Some).0: i32); @@ -79,10 +83,6 @@ goto -> bb4; } - bb2: { - unreachable; - } - bb3: { - _6 = const (); goto -> bb4; diff --git a/tests/mir-opt/remove_storage_markers.main.RemoveStorageMarkers.panic-abort.diff b/tests/mir-opt/remove_storage_markers.main.RemoveStorageMarkers.panic-abort.diff index 8804e671527..14762b9c40f 100644 --- a/tests/mir-opt/remove_storage_markers.main.RemoveStorageMarkers.panic-abort.diff +++ b/tests/mir-opt/remove_storage_markers.main.RemoveStorageMarkers.panic-abort.diff @@ -55,10 +55,14 @@ bb3: { - StorageDead(_8); _10 = discriminant(_7); - switchInt(move _10) -> [0: bb6, 1: bb4, otherwise: bb5]; + switchInt(move _10) -> [0: bb6, 1: bb5, otherwise: bb4]; } bb4: { + unreachable; + } + + bb5: { - StorageLive(_12); _12 = ((_7 as Some).0: i32); - StorageLive(_13); @@ -74,10 +78,6 @@ goto -> bb2; } - bb5: { - unreachable; - } - bb6: { _0 = const (); - StorageDead(_9); 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 faaebc300ef..24797424b5c 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 @@ -55,10 +55,14 @@ bb3: { - StorageDead(_8); _10 = discriminant(_7); - switchInt(move _10) -> [0: bb6, 1: bb4, otherwise: bb5]; + switchInt(move _10) -> [0: bb6, 1: bb5, otherwise: bb4]; } bb4: { + unreachable; + } + + bb5: { - StorageLive(_12); _12 = ((_7 as Some).0: i32); - StorageLive(_13); @@ -74,10 +78,6 @@ goto -> bb2; } - bb5: { - unreachable; - } - bb6: { _0 = const (); - StorageDead(_9); diff --git a/tests/mir-opt/simplify_locals_removes_unused_discriminant_reads.map.SimplifyLocals-before-const-prop.diff b/tests/mir-opt/simplify_locals_removes_unused_discriminant_reads.map.SimplifyLocals-before-const-prop.diff index 9ff32b26b77..5611d679b78 100644 --- a/tests/mir-opt/simplify_locals_removes_unused_discriminant_reads.map.SimplifyLocals-before-const-prop.diff +++ b/tests/mir-opt/simplify_locals_removes_unused_discriminant_reads.map.SimplifyLocals-before-const-prop.diff @@ -18,10 +18,14 @@ - _5 = const false; - _5 = const true; _2 = discriminant(_1); - switchInt(move _2) -> [0: bb3, 1: bb1, otherwise: bb2]; + switchInt(move _2) -> [0: bb3, 1: bb2, otherwise: bb1]; } bb1: { + unreachable; + } + + bb2: { StorageLive(_3); _3 = move ((_1 as Some).0: std::boxed::Box<()>); StorageLive(_4); @@ -32,10 +36,6 @@ goto -> bb4; } - bb2: { - unreachable; - } - bb3: { _0 = Option::<Box<()>>::None; goto -> bb4; diff --git a/tests/mir-opt/uninhabited_enum_branching.byref.UninhabitedEnumBranching.diff b/tests/mir-opt/uninhabited_enum_branching.byref.UninhabitedEnumBranching.diff index 7919450cdc5..5a3544f8538 100644 --- a/tests/mir-opt/uninhabited_enum_branching.byref.UninhabitedEnumBranching.diff +++ b/tests/mir-opt/uninhabited_enum_branching.byref.UninhabitedEnumBranching.diff @@ -30,11 +30,15 @@ StorageLive(_4); _4 = &(_1.1: Test3); _5 = discriminant((*_4)); -- switchInt(move _5) -> [0: bb3, 1: bb4, 2: bb5, 3: bb1, otherwise: bb2]; -+ switchInt(move _5) -> [0: bb12, 1: bb12, 2: bb5, 3: bb1, otherwise: bb12]; +- switchInt(move _5) -> [0: bb3, 1: bb4, 2: bb5, 3: bb2, otherwise: bb1]; ++ switchInt(move _5) -> [0: bb12, 1: bb12, 2: bb5, 3: bb2, otherwise: bb12]; } bb1: { + unreachable; + } + + bb2: { StorageLive(_8); _8 = const "D"; _3 = &(*_8); @@ -42,10 +46,6 @@ goto -> bb6; } - bb2: { - unreachable; - } - bb3: { _3 = const "A(Empty)"; goto -> bb6; @@ -72,7 +72,7 @@ StorageDead(_3); StorageLive(_9); _10 = discriminant((_1.1: Test3)); -- switchInt(move _10) -> [0: bb8, 1: bb9, 2: bb10, 3: bb7, otherwise: bb2]; +- switchInt(move _10) -> [0: bb8, 1: bb9, 2: bb10, 3: bb7, otherwise: bb1]; + switchInt(move _10) -> [0: bb12, 1: bb12, 2: bb10, 3: bb7, otherwise: bb12]; } diff --git a/tests/mir-opt/uninhabited_enum_branching.custom_discriminant.UninhabitedEnumBranching.diff b/tests/mir-opt/uninhabited_enum_branching.custom_discriminant.UninhabitedEnumBranching.diff index 5e15298a78c..121374553ed 100644 --- a/tests/mir-opt/uninhabited_enum_branching.custom_discriminant.UninhabitedEnumBranching.diff +++ b/tests/mir-opt/uninhabited_enum_branching.custom_discriminant.UninhabitedEnumBranching.diff @@ -13,11 +13,15 @@ StorageLive(_2); _2 = Test2::D; _3 = discriminant(_2); -- switchInt(move _3) -> [4: bb3, 5: bb1, otherwise: bb2]; -+ switchInt(move _3) -> [4: bb3, 5: bb1, otherwise: bb5]; +- switchInt(move _3) -> [4: bb3, 5: bb2, otherwise: bb1]; ++ switchInt(move _3) -> [4: bb3, 5: bb2, otherwise: bb5]; } bb1: { + unreachable; + } + + bb2: { StorageLive(_4); _4 = const "E"; _1 = &(*_4); @@ -25,10 +29,6 @@ goto -> bb4; } - bb2: { - unreachable; - } - bb3: { _1 = const "D"; goto -> bb4; diff --git a/tests/mir-opt/uninhabited_enum_branching.rs b/tests/mir-opt/uninhabited_enum_branching.rs index 60389117b16..65552fb058a 100644 --- a/tests/mir-opt/uninhabited_enum_branching.rs +++ b/tests/mir-opt/uninhabited_enum_branching.rs @@ -32,7 +32,7 @@ struct Plop { fn simple() { // CHECK-LABEL: fn simple( // CHECK: [[discr:_.*]] = discriminant( - // CHECK: switchInt(move [[discr]]) -> [0: [[unreachable:bb.*]], 1: [[unreachable]], 2: bb1, otherwise: [[unreachable]]]; + // CHECK: switchInt(move [[discr]]) -> [0: [[unreachable:bb.*]], 1: [[unreachable]], 2: bb2, otherwise: [[unreachable]]]; // CHECK: [[unreachable]]: { // CHECK-NEXT: unreachable; match Test1::C { @@ -46,7 +46,7 @@ fn simple() { fn custom_discriminant() { // CHECK-LABEL: fn custom_discriminant( // CHECK: [[discr:_.*]] = discriminant( - // CHECK: switchInt(move [[discr]]) -> [4: bb3, 5: bb1, otherwise: bb5]; + // CHECK: switchInt(move [[discr]]) -> [4: bb3, 5: bb2, otherwise: bb5]; // CHECK: bb5: { // CHECK-NEXT: unreachable; match Test2::D { @@ -61,7 +61,7 @@ fn byref() { let plop = Plop { xx: 51, test3: Test3::C }; // CHECK: [[ref_discr:_.*]] = discriminant((* - // CHECK: switchInt(move [[ref_discr]]) -> [0: [[unreachable:bb.*]], 1: [[unreachable]], 2: bb5, 3: bb1, otherwise: [[unreachable]]]; + // CHECK: switchInt(move [[ref_discr]]) -> [0: [[unreachable:bb.*]], 1: [[unreachable]], 2: bb5, 3: bb2, otherwise: [[unreachable]]]; match &plop.test3 { Test3::A(_) => "A(Empty)", Test3::B(_) => "B(Empty)", diff --git a/tests/mir-opt/uninhabited_enum_branching.simple.UninhabitedEnumBranching.diff b/tests/mir-opt/uninhabited_enum_branching.simple.UninhabitedEnumBranching.diff index 410db79802e..6ce61e15287 100644 --- a/tests/mir-opt/uninhabited_enum_branching.simple.UninhabitedEnumBranching.diff +++ b/tests/mir-opt/uninhabited_enum_branching.simple.UninhabitedEnumBranching.diff @@ -14,11 +14,15 @@ StorageLive(_2); _2 = Test1::C; _3 = discriminant(_2); -- switchInt(move _3) -> [0: bb3, 1: bb4, 2: bb1, otherwise: bb2]; -+ switchInt(move _3) -> [0: bb6, 1: bb6, 2: bb1, otherwise: bb6]; +- switchInt(move _3) -> [0: bb3, 1: bb4, 2: bb2, otherwise: bb1]; ++ switchInt(move _3) -> [0: bb6, 1: bb6, 2: bb2, otherwise: bb6]; } bb1: { + unreachable; + } + + bb2: { StorageLive(_5); _5 = const "C"; _1 = &(*_5); @@ -26,10 +30,6 @@ goto -> bb5; } - bb2: { - unreachable; - } - bb3: { _1 = const "A(Empty)"; goto -> bb5; diff --git a/tests/mir-opt/unreachable.as_match.UnreachablePropagation.panic-abort.diff b/tests/mir-opt/unreachable.as_match.UnreachablePropagation.panic-abort.diff index f6e594ffac7..da7a2bd10e0 100644 --- a/tests/mir-opt/unreachable.as_match.UnreachablePropagation.panic-abort.diff +++ b/tests/mir-opt/unreachable.as_match.UnreachablePropagation.panic-abort.diff @@ -19,20 +19,20 @@ bb1: { _2 = discriminant(_1); -- switchInt(move _2) -> [0: bb4, 1: bb2, otherwise: bb3]; +- switchInt(move _2) -> [0: bb4, 1: bb3, otherwise: bb2]; + _5 = Eq(_2, const 0_isize); + assume(move _5); + goto -> bb4; } bb2: { -- StorageLive(_3); -- _3 = move ((_1 as Some).0: Empty); -- StorageLive(_4); unreachable; } bb3: { +- StorageLive(_3); +- _3 = move ((_1 as Some).0: Empty); +- StorageLive(_4); unreachable; } diff --git a/tests/mir-opt/unreachable.as_match.UnreachablePropagation.panic-unwind.diff b/tests/mir-opt/unreachable.as_match.UnreachablePropagation.panic-unwind.diff index 2813d64672e..a2121fc684f 100644 --- a/tests/mir-opt/unreachable.as_match.UnreachablePropagation.panic-unwind.diff +++ b/tests/mir-opt/unreachable.as_match.UnreachablePropagation.panic-unwind.diff @@ -19,20 +19,20 @@ bb1: { _2 = discriminant(_1); -- switchInt(move _2) -> [0: bb4, 1: bb2, otherwise: bb3]; +- switchInt(move _2) -> [0: bb4, 1: bb3, otherwise: bb2]; + _5 = Eq(_2, const 0_isize); + assume(move _5); + goto -> bb4; } bb2: { -- StorageLive(_3); -- _3 = move ((_1 as Some).0: Empty); -- StorageLive(_4); unreachable; } bb3: { +- StorageLive(_3); +- _3 = move ((_1 as Some).0: Empty); +- StorageLive(_4); unreachable; } diff --git a/tests/rustdoc/glob-reexport-attribute-merge-doc-auto-cfg.rs b/tests/rustdoc/glob-reexport-attribute-merge-doc-auto-cfg.rs new file mode 100644 index 00000000000..3e3e602eb1b --- /dev/null +++ b/tests/rustdoc/glob-reexport-attribute-merge-doc-auto-cfg.rs @@ -0,0 +1,29 @@ +// This test ensures that non-glob reexports don't get their attributes merge with +// the reexported item whereas glob reexports do with the `doc_auto_cfg` feature. + +#![crate_name = "foo"] +#![feature(doc_auto_cfg)] + +// @has 'foo/index.html' +// There are two items. +// @count - '//*[@class="item-table"]//div[@class="item-name"]' 2 +// Only one of them should have an attribute. +// @count - '//*[@class="item-table"]//div[@class="item-name"]/*[@class="stab portability"]' 1 + +mod a { + #[cfg(not(feature = "a"))] + pub struct Test1; +} + +mod b { + #[cfg(not(feature = "a"))] + pub struct Test2; +} + +// @has 'foo/struct.Test1.html' +// @count - '//*[@id="main-content"]/*[@class="item-info"]' 1 +// @has - '//*[@id="main-content"]/*[@class="item-info"]' 'Available on non-crate feature a only.' +pub use a::*; +// @has 'foo/struct.Test2.html' +// @count - '//*[@id="main-content"]/*[@class="item-info"]' 0 +pub use b::Test2; diff --git a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr index 67257c28b6e..2032b8a972a 100644 --- a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr +++ b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr @@ -2,7 +2,7 @@ error: unsupported type attribute for diagnostic derive enum --> $DIR/diagnostic-derive.rs:47:1 | LL | #[diag(no_crate_example, code = E0123)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^ error: diagnostic slug not specified --> $DIR/diagnostic-derive.rs:50:5 @@ -24,27 +24,21 @@ error: `#[nonsense(...)]` is not a valid attribute --> $DIR/diagnostic-derive.rs:63:1 | LL | #[nonsense(no_crate_example, code = E0123)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^ error: diagnostic slug not specified --> $DIR/diagnostic-derive.rs:63:1 | -LL | / #[nonsense(no_crate_example, code = E0123)] -LL | | -LL | | -LL | | -LL | | struct InvalidStructAttr {} - | |___________________________^ +LL | #[nonsense(no_crate_example, code = E0123)] + | ^ | = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]` error: diagnostic slug not specified --> $DIR/diagnostic-derive.rs:70:1 | -LL | / #[diag(code = E0123)] -LL | | -LL | | struct InvalidLitNestedAttr {} - | |______________________________^ +LL | #[diag(code = E0123)] + | ^ | = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]` @@ -57,11 +51,8 @@ LL | #[diag(nonsense("foo"), code = E0123, slug = "foo")] error: diagnostic slug not specified --> $DIR/diagnostic-derive.rs:80:1 | -LL | / #[diag(nonsense("foo"), code = E0123, slug = "foo")] -LL | | -LL | | -LL | | struct InvalidNestedStructAttr1 {} - | |__________________________________^ +LL | #[diag(nonsense("foo"), code = E0123, slug = "foo")] + | ^ | = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]` @@ -76,11 +67,8 @@ LL | #[diag(nonsense = "...", code = E0123, slug = "foo")] error: diagnostic slug not specified --> $DIR/diagnostic-derive.rs:86:1 | -LL | / #[diag(nonsense = "...", code = E0123, slug = "foo")] -LL | | -LL | | -LL | | struct InvalidNestedStructAttr2 {} - | |__________________________________^ +LL | #[diag(nonsense = "...", code = E0123, slug = "foo")] + | ^ | = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]` @@ -95,11 +83,8 @@ LL | #[diag(nonsense = 4, code = E0123, slug = "foo")] error: diagnostic slug not specified --> $DIR/diagnostic-derive.rs:92:1 | -LL | / #[diag(nonsense = 4, code = E0123, slug = "foo")] -LL | | -LL | | -LL | | struct InvalidNestedStructAttr3 {} - | |__________________________________^ +LL | #[diag(nonsense = 4, code = E0123, slug = "foo")] + | ^ | = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]` @@ -115,7 +100,7 @@ error: `#[suggestion = ...]` is not a valid attribute --> $DIR/diagnostic-derive.rs:105:5 | LL | #[suggestion = "bar"] - | ^^^^^^^^^^^^^^^^^^^^^ + | ^ error: specified multiple times --> $DIR/diagnostic-derive.rs:112:8 @@ -163,17 +148,15 @@ error: diagnostic slug not specified --> $DIR/diagnostic-derive.rs:128:1 | LL | struct KindNotProvided {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^ | = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]` error: diagnostic slug not specified --> $DIR/diagnostic-derive.rs:131:1 | -LL | / #[diag(code = E0123)] -LL | | -LL | | struct SlugNotProvided {} - | |_________________________^ +LL | #[diag(code = E0123)] + | ^ | = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]` @@ -181,19 +164,19 @@ error: the `#[primary_span]` attribute can only be applied to fields of type `Sp --> $DIR/diagnostic-derive.rs:142:5 | LL | #[primary_span] - | ^^^^^^^^^^^^^^^ + | ^ error: `#[nonsense]` is not a valid attribute --> $DIR/diagnostic-derive.rs:150:5 | LL | #[nonsense] - | ^^^^^^^^^^^ + | ^ error: the `#[label(...)]` attribute can only be applied to fields of type `Span` or `MultiSpan` --> $DIR/diagnostic-derive.rs:167:5 | LL | #[label(no_crate_label)] - | ^^^^^^^^^^^^^^^^^^^^^^^^ + | ^ error: `name` doesn't refer to a field on this type --> $DIR/diagnostic-derive.rs:175:46 @@ -223,13 +206,13 @@ error: the `#[label(...)]` attribute can only be applied to fields of type `Span --> $DIR/diagnostic-derive.rs:210:5 | LL | #[label(no_crate_label)] - | ^^^^^^^^^^^^^^^^^^^^^^^^ + | ^ error: suggestion without `code = "..."` --> $DIR/diagnostic-derive.rs:229:5 | LL | #[suggestion(no_crate_suggestion)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^ error: invalid nested attribute --> $DIR/diagnostic-derive.rs:237:18 @@ -243,7 +226,7 @@ error: suggestion without `code = "..."` --> $DIR/diagnostic-derive.rs:237:5 | LL | #[suggestion(nonsense = "bar")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^ error: invalid nested attribute --> $DIR/diagnostic-derive.rs:246:18 @@ -257,15 +240,13 @@ error: suggestion without `code = "..."` --> $DIR/diagnostic-derive.rs:246:5 | LL | #[suggestion(msg = "bar")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^ error: wrong field type for suggestion --> $DIR/diagnostic-derive.rs:269:5 | -LL | / #[suggestion(no_crate_suggestion, code = "This is suggested code")] -LL | | -LL | | suggestion: Applicability, - | |_____________________________^ +LL | #[suggestion(no_crate_suggestion, code = "This is suggested code")] + | ^ | = help: `#[suggestion(...)]` should be applied to fields of type `Span` or `(Span, Applicability)` @@ -297,13 +278,13 @@ error: `#[label = ...]` is not a valid attribute --> $DIR/diagnostic-derive.rs:300:5 | LL | #[label = "bar"] - | ^^^^^^^^^^^^^^^^ + | ^ error: specified multiple times --> $DIR/diagnostic-derive.rs:451:5 | LL | #[suggestion(no_crate_suggestion, code = "...", applicability = "maybe-incorrect")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^ | note: previously specified here --> $DIR/diagnostic-derive.rs:453:24 @@ -321,7 +302,7 @@ error: the `#[help(...)]` attribute can only be applied to fields of type `Span` --> $DIR/diagnostic-derive.rs:526:5 | LL | #[help(no_crate_help)] - | ^^^^^^^^^^^^^^^^^^^^^^ + | ^ error: a diagnostic slug must be the first argument to the attribute --> $DIR/diagnostic-derive.rs:535:32 @@ -345,7 +326,7 @@ error: `#[primary_span]` is not a valid attribute --> $DIR/diagnostic-derive.rs:563:5 | LL | #[primary_span] - | ^^^^^^^^^^^^^^^ + | ^ | = help: the `primary_span` field attribute is not valid for lint diagnostics @@ -353,17 +334,13 @@ error: `#[error(...)]` is not a valid attribute --> $DIR/diagnostic-derive.rs:583:1 | LL | #[error(no_crate_example, code = E0123)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^ error: diagnostic slug not specified --> $DIR/diagnostic-derive.rs:583:1 | -LL | / #[error(no_crate_example, code = E0123)] -LL | | -LL | | -LL | | -LL | | struct ErrorAttribute {} - | |________________________^ +LL | #[error(no_crate_example, code = E0123)] + | ^ | = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]` @@ -371,17 +348,13 @@ error: `#[warn_(...)]` is not a valid attribute --> $DIR/diagnostic-derive.rs:590:1 | LL | #[warn_(no_crate_example, code = E0123)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^ error: diagnostic slug not specified --> $DIR/diagnostic-derive.rs:590:1 | -LL | / #[warn_(no_crate_example, code = E0123)] -LL | | -LL | | -LL | | -LL | | struct WarnAttribute {} - | |_______________________^ +LL | #[warn_(no_crate_example, code = E0123)] + | ^ | = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]` @@ -389,17 +362,13 @@ error: `#[lint(...)]` is not a valid attribute --> $DIR/diagnostic-derive.rs:597:1 | LL | #[lint(no_crate_example, code = E0123)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^ error: diagnostic slug not specified --> $DIR/diagnostic-derive.rs:597:1 | -LL | / #[lint(no_crate_example, code = E0123)] -LL | | -LL | | -LL | | -LL | | struct LintAttributeOnSessionDiag {} - | |____________________________________^ +LL | #[lint(no_crate_example, code = E0123)] + | ^ | = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]` @@ -407,26 +376,21 @@ error: `#[lint(...)]` is not a valid attribute --> $DIR/diagnostic-derive.rs:604:1 | LL | #[lint(no_crate_example, code = E0123)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^ error: `#[lint(...)]` is not a valid attribute --> $DIR/diagnostic-derive.rs:604:1 | LL | #[lint(no_crate_example, code = E0123)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: diagnostic slug not specified --> $DIR/diagnostic-derive.rs:604:1 | -LL | / #[lint(no_crate_example, code = E0123)] -LL | | -LL | | -LL | | -LL | | -LL | | struct LintAttributeOnLintDiag {} - | |_________________________________^ +LL | #[lint(no_crate_example, code = E0123)] + | ^ | = help: specify the slug as the first argument to the attribute, such as `#[diag(compiletest_example)]` @@ -462,13 +426,13 @@ error: suggestion without `code = "..."` --> $DIR/diagnostic-derive.rs:638:5 | LL | #[suggestion(no_crate_suggestion)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^ error: `#[multipart_suggestion(...)]` is not a valid attribute --> $DIR/diagnostic-derive.rs:645:1 | LL | #[multipart_suggestion(no_crate_suggestion)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^ | = help: consider creating a `Subdiagnostic` instead @@ -476,7 +440,7 @@ error: `#[multipart_suggestion(...)]` is not a valid attribute --> $DIR/diagnostic-derive.rs:648:1 | LL | #[multipart_suggestion()] - | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^ | = help: consider creating a `Subdiagnostic` instead @@ -484,7 +448,7 @@ error: `#[multipart_suggestion(...)]` is not a valid attribute --> $DIR/diagnostic-derive.rs:652:5 | LL | #[multipart_suggestion(no_crate_suggestion)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^ | = help: consider creating a `Subdiagnostic` instead @@ -492,7 +456,7 @@ error: `#[suggestion(...)]` is not a valid attribute --> $DIR/diagnostic-derive.rs:660:1 | LL | #[suggestion(no_crate_suggestion, code = "...")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^ | = help: `#[label]` and `#[suggestion]` can only be applied to fields @@ -500,7 +464,7 @@ error: `#[label]` is not a valid attribute --> $DIR/diagnostic-derive.rs:669:1 | LL | #[label] - | ^^^^^^^^ + | ^ | = help: `#[label]` and `#[suggestion]` can only be applied to fields @@ -508,31 +472,31 @@ error: `eager` is the only supported nested attribute for `subdiagnostic` --> $DIR/diagnostic-derive.rs:703:7 | LL | #[subdiagnostic(bad)] - | ^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^ error: `#[subdiagnostic = ...]` is not a valid attribute --> $DIR/diagnostic-derive.rs:711:5 | LL | #[subdiagnostic = "bad"] - | ^^^^^^^^^^^^^^^^^^^^^^^^ + | ^ error: `eager` is the only supported nested attribute for `subdiagnostic` --> $DIR/diagnostic-derive.rs:719:7 | LL | #[subdiagnostic(bad, bad)] - | ^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^ error: `eager` is the only supported nested attribute for `subdiagnostic` --> $DIR/diagnostic-derive.rs:727:7 | LL | #[subdiagnostic("bad")] - | ^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^ error: `#[subdiagnostic(...)]` is not a valid attribute --> $DIR/diagnostic-derive.rs:735:5 | LL | #[subdiagnostic(eager)] - | ^^^^^^^^^^^^^^^^^^^^^^^ + | ^ | = help: eager subdiagnostics are not supported on lints @@ -552,7 +516,7 @@ error: `#[suggestion(...)]` is not a valid attribute --> $DIR/diagnostic-derive.rs:825:5 | LL | #[suggestion(no_crate_suggestion, code = "")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^ | = note: `#[suggestion(...)]` applied to `Vec` field is ambiguous = help: to show a suggestion consisting of multiple parts, use a `Subdiagnostic` annotated with `#[multipart_suggestion(...)]` diff --git a/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.stderr b/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.stderr index 80bee3bd6e6..fccf3757dbe 100644 --- a/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.stderr +++ b/tests/ui-fulldeps/session-diagnostic/subdiagnostic-derive.stderr @@ -1,30 +1,26 @@ error: label without `#[primary_span]` field --> $DIR/subdiagnostic-derive.rs:51:1 | -LL | / #[label(no_crate_example)] -LL | | -LL | | struct C { -LL | | var: String, -LL | | } - | |_^ +LL | #[label(no_crate_example)] + | ^ error: diagnostic slug must be first argument of a `#[label(...)]` attribute --> $DIR/subdiagnostic-derive.rs:58:1 | LL | #[label] - | ^^^^^^^^ + | ^ error: `#[foo]` is not a valid attribute --> $DIR/subdiagnostic-derive.rs:67:1 | LL | #[foo] - | ^^^^^^ + | ^ error: `#[label = ...]` is not a valid attribute --> $DIR/subdiagnostic-derive.rs:77:1 | LL | #[label = "..."] - | ^^^^^^^^^^^^^^^^ + | ^ error: only `no_span` is a valid nested attribute --> $DIR/subdiagnostic-derive.rs:86:9 @@ -36,7 +32,7 @@ error: diagnostic slug must be first argument of a `#[label(...)]` attribute --> $DIR/subdiagnostic-derive.rs:86:1 | LL | #[label(bug = "...")] - | ^^^^^^^^^^^^^^^^^^^^^ + | ^ error: only `no_span` is a valid nested attribute --> $DIR/subdiagnostic-derive.rs:106:9 @@ -48,7 +44,7 @@ error: diagnostic slug must be first argument of a `#[label(...)]` attribute --> $DIR/subdiagnostic-derive.rs:106:1 | LL | #[label(slug = 4)] - | ^^^^^^^^^^^^^^^^^^ + | ^ error: only `no_span` is a valid nested attribute --> $DIR/subdiagnostic-derive.rs:116:9 @@ -60,13 +56,13 @@ error: diagnostic slug must be first argument of a `#[label(...)]` attribute --> $DIR/subdiagnostic-derive.rs:116:1 | LL | #[label(slug("..."))] - | ^^^^^^^^^^^^^^^^^^^^^ + | ^ error: diagnostic slug must be first argument of a `#[label(...)]` attribute --> $DIR/subdiagnostic-derive.rs:136:1 | LL | #[label()] - | ^^^^^^^^^^ + | ^ error: only `no_span` is a valid nested attribute --> $DIR/subdiagnostic-derive.rs:145:27 @@ -84,31 +80,31 @@ error: unsupported type attribute for subdiagnostic enum --> $DIR/subdiagnostic-derive.rs:163:1 | LL | #[foo] - | ^^^^^^ + | ^ error: `#[bar]` is not a valid attribute --> $DIR/subdiagnostic-derive.rs:177:5 | LL | #[bar] - | ^^^^^^ + | ^ error: `#[bar = ...]` is not a valid attribute --> $DIR/subdiagnostic-derive.rs:189:5 | LL | #[bar = "..."] - | ^^^^^^^^^^^^^^ + | ^ error: `#[bar = ...]` is not a valid attribute --> $DIR/subdiagnostic-derive.rs:201:5 | LL | #[bar = 4] - | ^^^^^^^^^^ + | ^ error: `#[bar(...)]` is not a valid attribute --> $DIR/subdiagnostic-derive.rs:213:5 | LL | #[bar("...")] - | ^^^^^^^^^^^^^ + | ^ error: only `no_span` is a valid nested attribute --> $DIR/subdiagnostic-derive.rs:225:13 @@ -120,37 +116,31 @@ error: diagnostic slug must be first argument of a `#[label(...)]` attribute --> $DIR/subdiagnostic-derive.rs:225:5 | LL | #[label(code = "...")] - | ^^^^^^^^^^^^^^^^^^^^^^ + | ^ error: the `#[primary_span]` attribute can only be applied to fields of type `Span` or `MultiSpan` --> $DIR/subdiagnostic-derive.rs:254:5 | LL | #[primary_span] - | ^^^^^^^^^^^^^^^ + | ^ error: label without `#[primary_span]` field --> $DIR/subdiagnostic-derive.rs:251:1 | -LL | / #[label(no_crate_example)] -LL | | -LL | | struct W { -LL | | #[primary_span] -LL | | -LL | | span: String, -LL | | } - | |_^ +LL | #[label(no_crate_example)] + | ^ error: `#[applicability]` is only valid on suggestions --> $DIR/subdiagnostic-derive.rs:264:5 | LL | #[applicability] - | ^^^^^^^^^^^^^^^^ + | ^ error: `#[bar]` is not a valid attribute --> $DIR/subdiagnostic-derive.rs:274:5 | LL | #[bar] - | ^^^^^^ + | ^ | = help: only `primary_span`, `applicability` and `skip_arg` are valid field attributes @@ -158,13 +148,13 @@ error: `#[bar = ...]` is not a valid attribute --> $DIR/subdiagnostic-derive.rs:285:5 | LL | #[bar = "..."] - | ^^^^^^^^^^^^^^ + | ^ error: `#[bar(...)]` is not a valid attribute --> $DIR/subdiagnostic-derive.rs:296:5 | LL | #[bar("...")] - | ^^^^^^^^^^^^^ + | ^ | = help: only `primary_span`, `applicability` and `skip_arg` are valid field attributes @@ -178,13 +168,13 @@ error: specified multiple times --> $DIR/subdiagnostic-derive.rs:341:5 | LL | #[primary_span] - | ^^^^^^^^^^^^^^^ + | ^ | note: previously specified here --> $DIR/subdiagnostic-derive.rs:338:5 | LL | #[primary_span] - | ^^^^^^^^^^^^^^^ + | ^ error: subdiagnostic kind not specified --> $DIR/subdiagnostic-derive.rs:347:8 @@ -208,25 +198,25 @@ error: specified multiple times --> $DIR/subdiagnostic-derive.rs:402:5 | LL | #[applicability] - | ^^^^^^^^^^^^^^^^ + | ^ | note: previously specified here --> $DIR/subdiagnostic-derive.rs:399:5 | LL | #[applicability] - | ^^^^^^^^^^^^^^^^ + | ^ error: the `#[applicability]` attribute can only be applied to fields of type `Applicability` --> $DIR/subdiagnostic-derive.rs:412:5 | LL | #[applicability] - | ^^^^^^^^^^^^^^^^ + | ^ error: suggestion without `code = "..."` --> $DIR/subdiagnostic-derive.rs:425:1 | LL | #[suggestion(no_crate_example)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^ error: invalid applicability --> $DIR/subdiagnostic-derive.rs:435:62 @@ -237,18 +227,14 @@ LL | #[suggestion(no_crate_example, code = "...", applicability = "foo")] error: suggestion without `#[primary_span]` field --> $DIR/subdiagnostic-derive.rs:453:1 | -LL | / #[suggestion(no_crate_example, code = "...")] -LL | | -LL | | struct AR { -LL | | var: String, -LL | | } - | |_^ +LL | #[suggestion(no_crate_example, code = "...")] + | ^ error: unsupported type attribute for subdiagnostic enum --> $DIR/subdiagnostic-derive.rs:467:1 | LL | #[label] - | ^^^^^^^^ + | ^ error: `var` doesn't refer to a field on this type --> $DIR/subdiagnostic-derive.rs:487:39 @@ -266,7 +252,7 @@ error: `#[suggestion_part]` is not a valid attribute --> $DIR/subdiagnostic-derive.rs:529:5 | LL | #[suggestion_part] - | ^^^^^^^^^^^^^^^^^^ + | ^ | = help: `#[suggestion_part(...)]` is only valid in multipart suggestions, use `#[primary_span]` instead @@ -274,21 +260,15 @@ error: `#[suggestion_part(...)]` is not a valid attribute --> $DIR/subdiagnostic-derive.rs:532:5 | LL | #[suggestion_part(code = "...")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^ | = help: `#[suggestion_part(...)]` is only valid in multipart suggestions error: suggestion without `#[primary_span]` field --> $DIR/subdiagnostic-derive.rs:526:1 | -LL | / #[suggestion(no_crate_example, code = "...")] -LL | | -LL | | struct BA { -LL | | #[suggestion_part] -... | -LL | | var: String, -LL | | } - | |_^ +LL | #[suggestion(no_crate_example, code = "...")] + | ^ error: invalid nested attribute --> $DIR/subdiagnostic-derive.rs:541:42 @@ -301,57 +281,46 @@ LL | #[multipart_suggestion(no_crate_example, code = "...", applicability = "mac error: multipart suggestion without any `#[suggestion_part(...)]` fields --> $DIR/subdiagnostic-derive.rs:541:1 | -LL | / #[multipart_suggestion(no_crate_example, code = "...", applicability = "machine-applicable")] -LL | | -LL | | -LL | | struct BBa { -LL | | var: String, -LL | | } - | |_^ +LL | #[multipart_suggestion(no_crate_example, code = "...", applicability = "machine-applicable")] + | ^ error: `#[suggestion_part(...)]` attribute without `code = "..."` --> $DIR/subdiagnostic-derive.rs:551:5 | LL | #[suggestion_part] - | ^^^^^^^^^^^^^^^^^^ + | ^ error: `#[suggestion_part(...)]` attribute without `code = "..."` --> $DIR/subdiagnostic-derive.rs:559:5 | LL | #[suggestion_part()] - | ^^^^^^^^^^^^^^^^^^^^ + | ^ error: `#[primary_span]` is not a valid attribute --> $DIR/subdiagnostic-derive.rs:568:5 | LL | #[primary_span] - | ^^^^^^^^^^^^^^^ + | ^ | = help: multipart suggestions use one or more `#[suggestion_part]`s rather than one `#[primary_span]` error: multipart suggestion without any `#[suggestion_part(...)]` fields --> $DIR/subdiagnostic-derive.rs:565:1 | -LL | / #[multipart_suggestion(no_crate_example)] -LL | | -LL | | struct BC { -LL | | #[primary_span] -LL | | -LL | | span: Span, -LL | | } - | |_^ +LL | #[multipart_suggestion(no_crate_example)] + | ^ error: `#[suggestion_part(...)]` attribute without `code = "..."` --> $DIR/subdiagnostic-derive.rs:576:5 | LL | #[suggestion_part] - | ^^^^^^^^^^^^^^^^^^ + | ^ error: `#[suggestion_part(...)]` attribute without `code = "..."` --> $DIR/subdiagnostic-derive.rs:579:5 | LL | #[suggestion_part()] - | ^^^^^^^^^^^^^^^^^^^^ + | ^ error: `code` is the only valid nested attribute --> $DIR/subdiagnostic-derive.rs:582:23 @@ -363,13 +332,13 @@ error: the `#[suggestion_part(...)]` attribute can only be applied to fields of --> $DIR/subdiagnostic-derive.rs:587:5 | LL | #[suggestion_part(code = "...")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^ error: the `#[suggestion_part(...)]` attribute can only be applied to fields of type `Span` or `MultiSpan` --> $DIR/subdiagnostic-derive.rs:590:5 | LL | #[suggestion_part()] - | ^^^^^^^^^^^^^^^^^^^^ + | ^ error: specified multiple times --> $DIR/subdiagnostic-derive.rs:598:37 @@ -387,7 +356,7 @@ error: `#[applicability]` has no effect if all `#[suggestion]`/`#[multipart_sugg --> $DIR/subdiagnostic-derive.rs:627:5 | LL | #[applicability] - | ^^^^^^^^^^^^^^^^ + | ^ error: expected exactly one string literal for `code = ...` --> $DIR/subdiagnostic-derive.rs:675:34 @@ -417,19 +386,19 @@ error: specified multiple times --> $DIR/subdiagnostic-derive.rs:763:1 | LL | #[suggestion(no_crate_example, code = "", style = "hidden", style = "normal")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^ | note: previously specified here --> $DIR/subdiagnostic-derive.rs:763:1 | LL | #[suggestion(no_crate_example, code = "", style = "hidden", style = "normal")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^ error: `#[suggestion_hidden(...)]` is not a valid attribute --> $DIR/subdiagnostic-derive.rs:772:1 | LL | #[suggestion_hidden(no_crate_example, code = "")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^ | = help: Use `#[suggestion(..., style = "hidden")]` instead @@ -437,7 +406,7 @@ error: `#[suggestion_hidden(...)]` is not a valid attribute --> $DIR/subdiagnostic-derive.rs:780:1 | LL | #[suggestion_hidden(no_crate_example, code = "", style = "normal")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^ | = help: Use `#[suggestion(..., style = "hidden")]` instead @@ -471,7 +440,7 @@ error: `#[primary_span]` is not a valid attribute --> $DIR/subdiagnostic-derive.rs:825:5 | LL | #[primary_span] - | ^^^^^^^^^^^^^^^ + | ^ | = note: there must be exactly one primary span = help: to create a suggestion with multiple spans, use `#[multipart_suggestion]` instead @@ -479,14 +448,8 @@ LL | #[primary_span] error: suggestion without `#[primary_span]` field --> $DIR/subdiagnostic-derive.rs:822:1 | -LL | / #[suggestion(no_crate_example, code = "")] -LL | | -LL | | struct PrimarySpanOnVec { -LL | | #[primary_span] -... | -LL | | sub: Vec<Span>, -LL | | } - | |_^ +LL | #[suggestion(no_crate_example, code = "")] + | ^ error[E0433]: failed to resolve: maybe a missing crate `core`? --> $DIR/subdiagnostic-derive.rs:96:9 diff --git a/tests/ui/abi/issues/issue-22565-rust-call.rs b/tests/ui/abi/issues/issue-22565-rust-call.rs index a572666c888..72f45cba0c0 100644 --- a/tests/ui/abi/issues/issue-22565-rust-call.rs +++ b/tests/ui/abi/issues/issue-22565-rust-call.rs @@ -25,7 +25,11 @@ impl Tr for Foo { fn main() { b(10); + //~^ ERROR functions with the "rust-call" ABI must take a single non-self tuple argument Foo::bar(); + //~^ ERROR functions with the "rust-call" ABI must take a single non-self tuple argument <Foo as Tr>::a(); + //~^ ERROR functions with the "rust-call" ABI must take a single non-self tuple argument <Foo as Tr>::b(); + //~^ ERROR functions with the "rust-call" ABI must take a single non-self tuple argument } diff --git a/tests/ui/abi/issues/issue-22565-rust-call.stderr b/tests/ui/abi/issues/issue-22565-rust-call.stderr index 9d205b444fa..0fd3285cd3a 100644 --- a/tests/ui/abi/issues/issue-22565-rust-call.stderr +++ b/tests/ui/abi/issues/issue-22565-rust-call.stderr @@ -28,6 +28,30 @@ error: functions with the "rust-call" ABI must take a single non-self tuple argu LL | extern "rust-call" fn b() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 5 previous errors +error[E0277]: functions with the "rust-call" ABI must take a single non-self tuple argument + --> $DIR/issue-22565-rust-call.rs:27:7 + | +LL | b(10); + | ^^ the trait `Tuple` is not implemented for `i32` + +error: functions with the "rust-call" ABI must take a single non-self tuple argument + --> $DIR/issue-22565-rust-call.rs:29:5 + | +LL | Foo::bar(); + | ^^^^^^^^^^ + +error: functions with the "rust-call" ABI must take a single non-self tuple argument + --> $DIR/issue-22565-rust-call.rs:31:5 + | +LL | <Foo as Tr>::a(); + | ^^^^^^^^^^^^^^^^ + +error: functions with the "rust-call" ABI must take a single non-self tuple argument + --> $DIR/issue-22565-rust-call.rs:33:5 + | +LL | <Foo as Tr>::b(); + | ^^^^^^^^^^^^^^^^ + +error: aborting due to 9 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/asm/inline-syntax.arm.stderr b/tests/ui/asm/inline-syntax.arm.stderr index 6bc38811f1b..4a50ec8d0d5 100644 --- a/tests/ui/asm/inline-syntax.arm.stderr +++ b/tests/ui/asm/inline-syntax.arm.stderr @@ -13,7 +13,7 @@ LL | .intel_syntax noprefix | ^ error: unknown directive - --> $DIR/inline-syntax.rs:38:15 + --> $DIR/inline-syntax.rs:35:15 | LL | asm!(".intel_syntax noprefix", "nop"); | ^ @@ -25,7 +25,7 @@ LL | .intel_syntax noprefix | ^ error: unknown directive - --> $DIR/inline-syntax.rs:42:15 + --> $DIR/inline-syntax.rs:39:15 | LL | asm!(".intel_syntax aaa noprefix", "nop"); | ^ @@ -37,7 +37,7 @@ LL | .intel_syntax aaa noprefix | ^ error: unknown directive - --> $DIR/inline-syntax.rs:46:15 + --> $DIR/inline-syntax.rs:43:15 | LL | asm!(".att_syntax noprefix", "nop"); | ^ @@ -49,7 +49,7 @@ LL | .att_syntax noprefix | ^ error: unknown directive - --> $DIR/inline-syntax.rs:50:15 + --> $DIR/inline-syntax.rs:47:15 | LL | asm!(".att_syntax bbb noprefix", "nop"); | ^ @@ -61,7 +61,7 @@ LL | .att_syntax bbb noprefix | ^ error: unknown directive - --> $DIR/inline-syntax.rs:54:15 + --> $DIR/inline-syntax.rs:51:15 | LL | asm!(".intel_syntax noprefix; nop"); | ^ @@ -73,7 +73,7 @@ LL | .intel_syntax noprefix; nop | ^ error: unknown directive - --> $DIR/inline-syntax.rs:61:13 + --> $DIR/inline-syntax.rs:58:13 | LL | .intel_syntax noprefix | ^ diff --git a/tests/ui/asm/inline-syntax.arm_llvm_18.stderr b/tests/ui/asm/inline-syntax.arm_llvm_18.stderr index 4926293bb88..ada3f4891d3 100644 --- a/tests/ui/asm/inline-syntax.arm_llvm_18.stderr +++ b/tests/ui/asm/inline-syntax.arm_llvm_18.stderr @@ -15,7 +15,7 @@ LL | .intel_syntax noprefix | ^ error: unknown directive - --> $DIR/inline-syntax.rs:38:15 + --> $DIR/inline-syntax.rs:35:15 | LL | asm!(".intel_syntax noprefix", "nop"); | ^ @@ -27,7 +27,7 @@ LL | .intel_syntax noprefix | ^ error: unknown directive - --> $DIR/inline-syntax.rs:42:15 + --> $DIR/inline-syntax.rs:39:15 | LL | asm!(".intel_syntax aaa noprefix", "nop"); | ^ @@ -39,7 +39,7 @@ LL | .intel_syntax aaa noprefix | ^ error: unknown directive - --> $DIR/inline-syntax.rs:46:15 + --> $DIR/inline-syntax.rs:43:15 | LL | asm!(".att_syntax noprefix", "nop"); | ^ @@ -51,7 +51,7 @@ LL | .att_syntax noprefix | ^ error: unknown directive - --> $DIR/inline-syntax.rs:50:15 + --> $DIR/inline-syntax.rs:47:15 | LL | asm!(".att_syntax bbb noprefix", "nop"); | ^ @@ -63,7 +63,7 @@ LL | .att_syntax bbb noprefix | ^ error: unknown directive - --> $DIR/inline-syntax.rs:54:15 + --> $DIR/inline-syntax.rs:51:15 | LL | asm!(".intel_syntax noprefix; nop"); | ^ @@ -75,7 +75,7 @@ LL | .intel_syntax noprefix; nop | ^ error: unknown directive - --> $DIR/inline-syntax.rs:61:13 + --> $DIR/inline-syntax.rs:58:13 | LL | .intel_syntax noprefix | ^ diff --git a/tests/ui/asm/inline-syntax.rs b/tests/ui/asm/inline-syntax.rs index 9398a87df62..a8c6c71b805 100644 --- a/tests/ui/asm/inline-syntax.rs +++ b/tests/ui/asm/inline-syntax.rs @@ -2,14 +2,11 @@ //[x86_64] compile-flags: --target x86_64-unknown-linux-gnu //[x86_64] check-pass //[x86_64] needs-llvm-components: x86 -//[x86_64_allowed] compile-flags: --target x86_64-unknown-linux-gnu -//[x86_64_allowed] check-pass -//[x86_64_allowed] needs-llvm-components: x86 //[arm] compile-flags: --target armv7-unknown-linux-gnueabihf //[arm] build-fail //[arm] needs-llvm-components: arm //[arm] ignore-llvm-version: 18 - 99 -// Newer LLVM produces extra error notes. +//Newer LLVM produces extra error notes. //[arm_llvm_18] compile-flags: --target armv7-unknown-linux-gnueabihf //[arm_llvm_18] build-fail //[arm_llvm_18] needs-llvm-components: arm diff --git a/tests/ui/asm/inline-syntax.x86_64.stderr b/tests/ui/asm/inline-syntax.x86_64.stderr index b54b3560447..66dc37f3089 100644 --- a/tests/ui/asm/inline-syntax.x86_64.stderr +++ b/tests/ui/asm/inline-syntax.x86_64.stderr @@ -1,5 +1,5 @@ warning: avoid using `.intel_syntax`, Intel syntax is the default - --> $DIR/inline-syntax.rs:70:14 + --> $DIR/inline-syntax.rs:67:14 | LL | global_asm!(".intel_syntax noprefix", "nop"); | ^^^^^^^^^^^^^^^^^^^^^^ @@ -7,37 +7,37 @@ LL | global_asm!(".intel_syntax noprefix", "nop"); = note: `#[warn(bad_asm_style)]` on by default warning: avoid using `.intel_syntax`, Intel syntax is the default - --> $DIR/inline-syntax.rs:38:15 + --> $DIR/inline-syntax.rs:35:15 | LL | asm!(".intel_syntax noprefix", "nop"); | ^^^^^^^^^^^^^^^^^^^^^^ warning: avoid using `.intel_syntax`, Intel syntax is the default - --> $DIR/inline-syntax.rs:42:15 + --> $DIR/inline-syntax.rs:39:15 | LL | asm!(".intel_syntax aaa noprefix", "nop"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: avoid using `.att_syntax`, prefer using `options(att_syntax)` instead - --> $DIR/inline-syntax.rs:46:15 + --> $DIR/inline-syntax.rs:43:15 | LL | asm!(".att_syntax noprefix", "nop"); | ^^^^^^^^^^^^^^^^^^^^ warning: avoid using `.att_syntax`, prefer using `options(att_syntax)` instead - --> $DIR/inline-syntax.rs:50:15 + --> $DIR/inline-syntax.rs:47:15 | LL | asm!(".att_syntax bbb noprefix", "nop"); | ^^^^^^^^^^^^^^^^^^^^^^^^ warning: avoid using `.intel_syntax`, Intel syntax is the default - --> $DIR/inline-syntax.rs:54:15 + --> $DIR/inline-syntax.rs:51:15 | LL | asm!(".intel_syntax noprefix; nop"); | ^^^^^^^^^^^^^^^^^^^^^^ warning: avoid using `.intel_syntax`, Intel syntax is the default - --> $DIR/inline-syntax.rs:61:13 + --> $DIR/inline-syntax.rs:58:13 | LL | .intel_syntax noprefix | ^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/associated-consts/associated-const-in-trait.rs b/tests/ui/associated-consts/associated-const-in-trait.rs index cf5d5d859b6..4e8143d5795 100644 --- a/tests/ui/associated-consts/associated-const-in-trait.rs +++ b/tests/ui/associated-consts/associated-const-in-trait.rs @@ -7,6 +7,7 @@ trait Trait { impl dyn Trait { //~^ ERROR the trait `Trait` cannot be made into an object [E0038] const fn n() -> usize { Self::N } + //~^ ERROR the trait `Trait` cannot be made into an object [E0038] } fn main() {} diff --git a/tests/ui/associated-consts/associated-const-in-trait.stderr b/tests/ui/associated-consts/associated-const-in-trait.stderr index 59acd4820ae..88360cd2dd5 100644 --- a/tests/ui/associated-consts/associated-const-in-trait.stderr +++ b/tests/ui/associated-consts/associated-const-in-trait.stderr @@ -13,6 +13,21 @@ LL | const N: usize; | ^ ...because it contains this associated `const` = help: consider moving `N` to another trait -error: aborting due to 1 previous error +error[E0038]: the trait `Trait` cannot be made into an object + --> $DIR/associated-const-in-trait.rs:9:29 + | +LL | const fn n() -> usize { Self::N } + | ^^^^ `Trait` cannot be made into an object + | +note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + --> $DIR/associated-const-in-trait.rs:4:11 + | +LL | trait Trait { + | ----- this trait cannot be made into an object... +LL | const N: usize; + | ^ ...because it contains this associated `const` + = help: consider moving `N` to another trait + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0038`. diff --git a/tests/ui/associated-consts/issue-105330.rs b/tests/ui/associated-consts/issue-105330.rs index 6c6dae864f3..fb2169ab43f 100644 --- a/tests/ui/associated-consts/issue-105330.rs +++ b/tests/ui/associated-consts/issue-105330.rs @@ -10,10 +10,15 @@ impl TraitWAssocConst for impl Demo { //~ ERROR E0404 fn foo<A: TraitWAssocConst<A=32>>() { //~ ERROR E0658 foo::<Demo>()(); + //~^ ERROR is not satisfied + //~| ERROR type mismatch + //~| ERROR expected function, found `()` } fn main<A: TraitWAssocConst<A=32>>() { //~^ ERROR E0658 //~| ERROR E0131 foo::<Demo>(); + //~^ ERROR type mismatch + //~| ERROR is not satisfied } diff --git a/tests/ui/associated-consts/issue-105330.stderr b/tests/ui/associated-consts/issue-105330.stderr index b4c021d0f4f..50ce69b3381 100644 --- a/tests/ui/associated-consts/issue-105330.stderr +++ b/tests/ui/associated-consts/issue-105330.stderr @@ -26,7 +26,7 @@ LL | fn foo<A: TraitWAssocConst<A=32>>() { = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: associated const equality is incomplete - --> $DIR/issue-105330.rs:15:29 + --> $DIR/issue-105330.rs:18:29 | LL | fn main<A: TraitWAssocConst<A=32>>() { | ^^^^ @@ -44,12 +44,76 @@ LL | impl TraitWAssocConst for impl Demo { = note: `impl Trait` is only allowed in arguments and return types of functions and methods error[E0131]: `main` function is not allowed to have generic parameters - --> $DIR/issue-105330.rs:15:8 + --> $DIR/issue-105330.rs:18:8 | LL | fn main<A: TraitWAssocConst<A=32>>() { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `main` cannot have generic parameters -error: aborting due to 6 previous errors +error[E0277]: the trait bound `Demo: TraitWAssocConst` is not satisfied + --> $DIR/issue-105330.rs:12:11 + | +LL | foo::<Demo>()(); + | ^^^^ the trait `TraitWAssocConst` is not implemented for `Demo` + | + = help: the trait `TraitWAssocConst` is implemented for `{type error}` +note: required by a bound in `foo` + --> $DIR/issue-105330.rs:11:11 + | +LL | fn foo<A: TraitWAssocConst<A=32>>() { + | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `foo` + +error[E0271]: type mismatch resolving `<Demo as TraitWAssocConst>::A == 32` + --> $DIR/issue-105330.rs:12:11 + | +LL | foo::<Demo>()(); + | ^^^^ expected `32`, found `<Demo as TraitWAssocConst>::A` + | + = note: expected constant `32` + found constant `<Demo as TraitWAssocConst>::A` +note: required by a bound in `foo` + --> $DIR/issue-105330.rs:11:28 + | +LL | fn foo<A: TraitWAssocConst<A=32>>() { + | ^^^^ required by this bound in `foo` + +error[E0618]: expected function, found `()` + --> $DIR/issue-105330.rs:12:5 + | +LL | fn foo<A: TraitWAssocConst<A=32>>() { + | ----------------------------------- `foo::<Demo>` defined here returns `()` +LL | foo::<Demo>()(); + | ^^^^^^^^^^^^^-- + | | + | call expression requires function + +error[E0277]: the trait bound `Demo: TraitWAssocConst` is not satisfied + --> $DIR/issue-105330.rs:21:11 + | +LL | foo::<Demo>(); + | ^^^^ the trait `TraitWAssocConst` is not implemented for `Demo` + | + = help: the trait `TraitWAssocConst` is implemented for `{type error}` +note: required by a bound in `foo` + --> $DIR/issue-105330.rs:11:11 + | +LL | fn foo<A: TraitWAssocConst<A=32>>() { + | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `foo` + +error[E0271]: type mismatch resolving `<Demo as TraitWAssocConst>::A == 32` + --> $DIR/issue-105330.rs:21:11 + | +LL | foo::<Demo>(); + | ^^^^ expected `32`, found `<Demo as TraitWAssocConst>::A` + | + = note: expected constant `32` + found constant `<Demo as TraitWAssocConst>::A` +note: required by a bound in `foo` + --> $DIR/issue-105330.rs:11:28 + | +LL | fn foo<A: TraitWAssocConst<A=32>>() { + | ^^^^ required by this bound in `foo` + +error: aborting due to 11 previous errors -Some errors have detailed explanations: E0131, E0404, E0562, E0658. +Some errors have detailed explanations: E0131, E0271, E0277, E0404, E0562, E0618, E0658. For more information about an error, try `rustc --explain E0131`. diff --git a/tests/ui/associated-inherent-types/issue-109299.rs b/tests/ui/associated-inherent-types/issue-109299.rs index 84e4f9e7252..b6c010c34e4 100644 --- a/tests/ui/associated-inherent-types/issue-109299.rs +++ b/tests/ui/associated-inherent-types/issue-109299.rs @@ -8,5 +8,6 @@ impl Lexer<'d> { //~ ERROR use of undeclared lifetime name `'d` } fn test(_: Lexer::Cursor) {} +//~^ ERROR: lifetime may not live long enough fn main() {} diff --git a/tests/ui/associated-inherent-types/issue-109299.stderr b/tests/ui/associated-inherent-types/issue-109299.stderr index 1e11c0e8c2a..f108a52b92c 100644 --- a/tests/ui/associated-inherent-types/issue-109299.stderr +++ b/tests/ui/associated-inherent-types/issue-109299.stderr @@ -6,6 +6,15 @@ LL | impl Lexer<'d> { | | | help: consider introducing lifetime `'d` here: `<'d>` -error: aborting due to 1 previous error +error: lifetime may not live long enough + --> $DIR/issue-109299.rs:10:1 + | +LL | fn test(_: Lexer::Cursor) {} + | ^^^^^^^^-^^^^^^^^^^^^^^^^ + | | | + | | has type `Lexer<'1>::Cursor` + | requires that `'1` must outlive `'static` + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0261`. diff --git a/tests/ui/associated-inherent-types/issue-109789.rs b/tests/ui/associated-inherent-types/issue-109789.rs index 0b5ba7d1fb5..46dd4590141 100644 --- a/tests/ui/associated-inherent-types/issue-109789.rs +++ b/tests/ui/associated-inherent-types/issue-109789.rs @@ -18,5 +18,7 @@ impl Other for u32 {} fn bar(_: Foo<for<'a> fn(&'a ())>::Assoc) {} //~^ ERROR mismatched types //~| ERROR mismatched types +//~| ERROR higher-ranked subtype error +//~| ERROR higher-ranked subtype error fn main() {} diff --git a/tests/ui/associated-inherent-types/issue-109789.stderr b/tests/ui/associated-inherent-types/issue-109789.stderr index e844f6795e6..c6ea6c5541d 100644 --- a/tests/ui/associated-inherent-types/issue-109789.stderr +++ b/tests/ui/associated-inherent-types/issue-109789.stderr @@ -17,6 +17,20 @@ LL | fn bar(_: Foo<for<'a> fn(&'a ())>::Assoc) {} found struct `Foo<for<'a> fn(&'a ())>` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -error: aborting due to 2 previous errors +error: higher-ranked subtype error + --> $DIR/issue-109789.rs:18:1 + | +LL | fn bar(_: Foo<for<'a> fn(&'a ())>::Assoc) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: higher-ranked subtype error + --> $DIR/issue-109789.rs:18:1 + | +LL | fn bar(_: Foo<for<'a> fn(&'a ())>::Assoc) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/associated-inherent-types/regionck-2.rs b/tests/ui/associated-inherent-types/regionck-2.rs index 7a0b8b08300..573dd359bf2 100644 --- a/tests/ui/associated-inherent-types/regionck-2.rs +++ b/tests/ui/associated-inherent-types/regionck-2.rs @@ -10,5 +10,6 @@ impl Lexer<'static> { } fn test(_: Lexer::Cursor) {} //~ ERROR mismatched types +//~^ ERROR: lifetime may not live long enough fn main() {} diff --git a/tests/ui/associated-inherent-types/regionck-2.stderr b/tests/ui/associated-inherent-types/regionck-2.stderr index 4c68a591240..82f5c6a72c0 100644 --- a/tests/ui/associated-inherent-types/regionck-2.stderr +++ b/tests/ui/associated-inherent-types/regionck-2.stderr @@ -13,6 +13,15 @@ LL | fn test(_: Lexer::Cursor) {} | ^^^^^ = note: ...does not necessarily outlive the static lifetime -error: aborting due to 1 previous error +error: lifetime may not live long enough + --> $DIR/regionck-2.rs:12:1 + | +LL | fn test(_: Lexer::Cursor) {} + | ^^^^^^^^-^^^^^^^^^^^^^^^^ + | | | + | | has type `Lexer<'1>::Cursor` + | requires that `'1` must outlive `'static` + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/associated-types/associated-types-for-unimpl-trait.fixed b/tests/ui/associated-types/associated-types-for-unimpl-trait.fixed index adfba994f32..e713db025e8 100644 --- a/tests/ui/associated-types/associated-types-for-unimpl-trait.fixed +++ b/tests/ui/associated-types/associated-types-for-unimpl-trait.fixed @@ -8,9 +8,9 @@ trait Get { } trait Other { - fn uhoh<U:Get>(&self, foo: U, bar: <Self as Get>::Value) where Self: Get {} + fn uhoh<U: Get>(&self, foo: U, bar: <Self as Get>::Value) where Self: Sized, Self: Get, Self: Get {} //~^ ERROR the trait bound `Self: Get` is not satisfied + //~| ERROR the trait bound `Self: Get` is not satisfied } -fn main() { -} +fn main() {} diff --git a/tests/ui/associated-types/associated-types-for-unimpl-trait.rs b/tests/ui/associated-types/associated-types-for-unimpl-trait.rs index 50478171d86..c5d7ba3a755 100644 --- a/tests/ui/associated-types/associated-types-for-unimpl-trait.rs +++ b/tests/ui/associated-types/associated-types-for-unimpl-trait.rs @@ -8,9 +8,9 @@ trait Get { } trait Other { - fn uhoh<U:Get>(&self, foo: U, bar: <Self as Get>::Value) {} + fn uhoh<U: Get>(&self, foo: U, bar: <Self as Get>::Value) where Self: Sized {} //~^ ERROR the trait bound `Self: Get` is not satisfied + //~| ERROR the trait bound `Self: Get` is not satisfied } -fn main() { -} +fn main() {} diff --git a/tests/ui/associated-types/associated-types-for-unimpl-trait.stderr b/tests/ui/associated-types/associated-types-for-unimpl-trait.stderr index 27014fa53d8..4cba3990049 100644 --- a/tests/ui/associated-types/associated-types-for-unimpl-trait.stderr +++ b/tests/ui/associated-types/associated-types-for-unimpl-trait.stderr @@ -1,14 +1,25 @@ error[E0277]: the trait bound `Self: Get` is not satisfied - --> $DIR/associated-types-for-unimpl-trait.rs:11:40 + --> $DIR/associated-types-for-unimpl-trait.rs:11:41 | -LL | fn uhoh<U:Get>(&self, foo: U, bar: <Self as Get>::Value) {} - | ^^^^^^^^^^^^^^^^^^^^ the trait `Get` is not implemented for `Self` +LL | fn uhoh<U: Get>(&self, foo: U, bar: <Self as Get>::Value) where Self: Sized {} + | ^^^^^^^^^^^^^^^^^^^^ the trait `Get` is not implemented for `Self` | help: consider further restricting `Self` | -LL | fn uhoh<U:Get>(&self, foo: U, bar: <Self as Get>::Value) where Self: Get {} - | +++++++++++++++ +LL | fn uhoh<U: Get>(&self, foo: U, bar: <Self as Get>::Value) where Self: Sized, Self: Get {} + | +++++++++++ -error: aborting due to 1 previous error +error[E0277]: the trait bound `Self: Get` is not satisfied + --> $DIR/associated-types-for-unimpl-trait.rs:11:81 + | +LL | fn uhoh<U: Get>(&self, foo: U, bar: <Self as Get>::Value) where Self: Sized {} + | ^^ the trait `Get` is not implemented for `Self` + | +help: consider further restricting `Self` + | +LL | fn uhoh<U: Get>(&self, foo: U, bar: <Self as Get>::Value) where Self: Sized, Self: Get {} + | +++++++++++ + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/associated-types/associated-types-no-suitable-bound.rs b/tests/ui/associated-types/associated-types-no-suitable-bound.rs index d42460a4c07..7019c476237 100644 --- a/tests/ui/associated-types/associated-types-no-suitable-bound.rs +++ b/tests/ui/associated-types/associated-types-no-suitable-bound.rs @@ -10,7 +10,7 @@ struct Struct { impl Struct { fn uhoh<T>(foo: <T as Get>::Value) {} //~^ ERROR the trait bound `T: Get` is not satisfied + //~| ERROR the trait bound `T: Get` is not satisfied } -fn main() { -} +fn main() {} diff --git a/tests/ui/associated-types/associated-types-no-suitable-bound.stderr b/tests/ui/associated-types/associated-types-no-suitable-bound.stderr index fe1be6be015..9713051d973 100644 --- a/tests/ui/associated-types/associated-types-no-suitable-bound.stderr +++ b/tests/ui/associated-types/associated-types-no-suitable-bound.stderr @@ -9,6 +9,17 @@ help: consider restricting type parameter `T` LL | fn uhoh<T: Get>(foo: <T as Get>::Value) {} | +++++ -error: aborting due to 1 previous error +error[E0277]: the trait bound `T: Get` is not satisfied + --> $DIR/associated-types-no-suitable-bound.rs:11:40 + | +LL | fn uhoh<T>(foo: <T as Get>::Value) {} + | ^^ the trait `Get` is not implemented for `T` + | +help: consider restricting type parameter `T` + | +LL | fn uhoh<T: Get>(foo: <T as Get>::Value) {} + | +++++ + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/associated-types/associated-types-no-suitable-supertrait-2.rs b/tests/ui/associated-types/associated-types-no-suitable-supertrait-2.rs index 17dfa1773dd..5dc1ac88c8a 100644 --- a/tests/ui/associated-types/associated-types-no-suitable-supertrait-2.rs +++ b/tests/ui/associated-types/associated-types-no-suitable-supertrait-2.rs @@ -16,6 +16,7 @@ trait Get { trait Other { fn uhoh<U:Get>(&self, foo: U, bar: <Self as Get>::Value) {} //~^ ERROR the trait bound `Self: Get` is not satisfied + //~| ERROR the trait bound `Self: Get` is not satisfied } fn main() { } diff --git a/tests/ui/associated-types/associated-types-no-suitable-supertrait-2.stderr b/tests/ui/associated-types/associated-types-no-suitable-supertrait-2.stderr index b586053a5bc..c5dcfc00925 100644 --- a/tests/ui/associated-types/associated-types-no-suitable-supertrait-2.stderr +++ b/tests/ui/associated-types/associated-types-no-suitable-supertrait-2.stderr @@ -9,6 +9,17 @@ help: consider further restricting `Self` LL | fn uhoh<U:Get>(&self, foo: U, bar: <Self as Get>::Value) where Self: Get {} | +++++++++++++++ -error: aborting due to 1 previous error +error[E0277]: the trait bound `Self: Get` is not satisfied + --> $DIR/associated-types-no-suitable-supertrait-2.rs:17:62 + | +LL | fn uhoh<U:Get>(&self, foo: U, bar: <Self as Get>::Value) {} + | ^^ the trait `Get` is not implemented for `Self` + | +help: consider further restricting `Self` + | +LL | fn uhoh<U:Get>(&self, foo: U, bar: <Self as Get>::Value) where Self: Get {} + | +++++++++++++++ + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/associated-types/associated-types-no-suitable-supertrait.rs b/tests/ui/associated-types/associated-types-no-suitable-supertrait.rs index cc0101d63cf..144812fa4d1 100644 --- a/tests/ui/associated-types/associated-types-no-suitable-supertrait.rs +++ b/tests/ui/associated-types/associated-types-no-suitable-supertrait.rs @@ -16,12 +16,14 @@ trait Get { trait Other { fn uhoh<U:Get>(&self, foo: U, bar: <Self as Get>::Value) {} //~^ ERROR the trait bound `Self: Get` is not satisfied + //~| ERROR the trait bound `Self: Get` is not satisfied } impl<T:Get> Other for T { fn uhoh<U:Get>(&self, foo: U, bar: <(T, U) as Get>::Value) {} //~^ ERROR the trait bound `(T, U): Get` is not satisfied //~| ERROR the trait bound `(T, U): Get` is not satisfied + //~| ERROR the trait bound `(T, U): Get` is not satisfied } fn main() { } diff --git a/tests/ui/associated-types/associated-types-no-suitable-supertrait.stderr b/tests/ui/associated-types/associated-types-no-suitable-supertrait.stderr index 5443699eb01..46cebda078e 100644 --- a/tests/ui/associated-types/associated-types-no-suitable-supertrait.stderr +++ b/tests/ui/associated-types/associated-types-no-suitable-supertrait.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `(T, U): Get` is not satisfied - --> $DIR/associated-types-no-suitable-supertrait.rs:22:5 + --> $DIR/associated-types-no-suitable-supertrait.rs:23:5 | LL | fn uhoh<U:Get>(&self, foo: U, bar: <(T, U) as Get>::Value) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Get` is not implemented for `(T, U)` @@ -11,7 +11,7 @@ LL | trait Get { | ^^^^^^^^^ error[E0277]: the trait bound `(T, U): Get` is not satisfied - --> $DIR/associated-types-no-suitable-supertrait.rs:22:40 + --> $DIR/associated-types-no-suitable-supertrait.rs:23:40 | LL | fn uhoh<U:Get>(&self, foo: U, bar: <(T, U) as Get>::Value) {} | ^^^^^^^^^^^^^^^^^^^^^^ the trait `Get` is not implemented for `(T, U)` @@ -33,6 +33,29 @@ help: consider further restricting `Self` LL | fn uhoh<U:Get>(&self, foo: U, bar: <Self as Get>::Value) where Self: Get {} | +++++++++++++++ -error: aborting due to 3 previous errors +error[E0277]: the trait bound `Self: Get` is not satisfied + --> $DIR/associated-types-no-suitable-supertrait.rs:17:62 + | +LL | fn uhoh<U:Get>(&self, foo: U, bar: <Self as Get>::Value) {} + | ^^ the trait `Get` is not implemented for `Self` + | +help: consider further restricting `Self` + | +LL | fn uhoh<U:Get>(&self, foo: U, bar: <Self as Get>::Value) where Self: Get {} + | +++++++++++++++ + +error[E0277]: the trait bound `(T, U): Get` is not satisfied + --> $DIR/associated-types-no-suitable-supertrait.rs:23:64 + | +LL | fn uhoh<U:Get>(&self, foo: U, bar: <(T, U) as Get>::Value) {} + | ^^ the trait `Get` is not implemented for `(T, U)` + | +help: this trait has no implementations, consider adding one + --> $DIR/associated-types-no-suitable-supertrait.rs:12:1 + | +LL | trait Get { + | ^^^^^^^^^ + +error: aborting due to 5 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/associated-types/hr-associated-type-bound-1.rs b/tests/ui/associated-types/hr-associated-type-bound-1.rs index db414164e16..37c1a47fcd2 100644 --- a/tests/ui/associated-types/hr-associated-type-bound-1.rs +++ b/tests/ui/associated-types/hr-associated-type-bound-1.rs @@ -15,4 +15,5 @@ impl X<'_> for i32 { fn main() { 1i32.f("abc"); + //~^ ERROR the trait bound `str: Clone` } diff --git a/tests/ui/associated-types/hr-associated-type-bound-1.stderr b/tests/ui/associated-types/hr-associated-type-bound-1.stderr index 01005b6b22d..8830048ed4e 100644 --- a/tests/ui/associated-types/hr-associated-type-bound-1.stderr +++ b/tests/ui/associated-types/hr-associated-type-bound-1.stderr @@ -14,6 +14,22 @@ LL | where LL | for<'b> <Self as X<'b>>::U: Clone, | ^^^^^ required by this bound in `X` -error: aborting due to 1 previous error +error[E0277]: the trait bound `str: Clone` is not satisfied + --> $DIR/hr-associated-type-bound-1.rs:17:10 + | +LL | 1i32.f("abc"); + | ^ the trait `Clone` is not implemented for `str` + | + = help: the trait `Clone` is implemented for `String` +note: required by a bound in `X::f` + --> $DIR/hr-associated-type-bound-1.rs:3:33 + | +LL | for<'b> <Self as X<'b>>::U: Clone, + | ^^^^^ required by this bound in `X::f` +... +LL | fn f(&self, x: &Self::U) { + | - required by a bound in this associated function + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/associated-types/hr-associated-type-bound-object.rs b/tests/ui/associated-types/hr-associated-type-bound-object.rs index e19c918c3df..fec253f9289 100644 --- a/tests/ui/associated-types/hr-associated-type-bound-object.rs +++ b/tests/ui/associated-types/hr-associated-type-bound-object.rs @@ -7,6 +7,9 @@ where fn f<'a, T: X<'a> + ?Sized>(x: &<T as X<'a>>::U) { //~^ ERROR the trait bound `for<'b> <T as X<'b>>::U: Clone` is not satisfied <<T as X<'_>>::U>::clone(x); + //~^ ERROR the trait bound `for<'b> <T as X<'b>>::U: Clone` is not satisfied + //~| ERROR the trait bound `for<'b> <T as X<'b>>::U: Clone` is not satisfied + //~| ERROR the trait bound `<T as X<'_>>::U: Clone` is not satisfied } pub fn main() { diff --git a/tests/ui/associated-types/hr-associated-type-bound-object.stderr b/tests/ui/associated-types/hr-associated-type-bound-object.stderr index 87a048d0a13..322d6e7b947 100644 --- a/tests/ui/associated-types/hr-associated-type-bound-object.stderr +++ b/tests/ui/associated-types/hr-associated-type-bound-object.stderr @@ -17,6 +17,55 @@ help: consider further restricting the associated type LL | fn f<'a, T: X<'a> + ?Sized>(x: &<T as X<'a>>::U) where for<'b> <T as X<'b>>::U: Clone { | ++++++++++++++++++++++++++++++++++++ -error: aborting due to 1 previous error +error[E0277]: the trait bound `for<'b> <T as X<'b>>::U: Clone` is not satisfied + --> $DIR/hr-associated-type-bound-object.rs:9:7 + | +LL | <<T as X<'_>>::U>::clone(x); + | ^ the trait `for<'b> Clone` is not implemented for `<T as X<'b>>::U` + | +note: required by a bound in `X::U` + --> $DIR/hr-associated-type-bound-object.rs:3:33 + | +LL | for<'b> <Self as X<'b>>::U: Clone, + | ^^^^^ required by this bound in `X::U` +LL | { +LL | type U: ?Sized; + | - required by a bound in this associated type +help: consider further restricting the associated type + | +LL | fn f<'a, T: X<'a> + ?Sized>(x: &<T as X<'a>>::U) where for<'b> <T as X<'b>>::U: Clone { + | ++++++++++++++++++++++++++++++++++++ + +error[E0277]: the trait bound `<T as X<'_>>::U: Clone` is not satisfied + --> $DIR/hr-associated-type-bound-object.rs:9:6 + | +LL | <<T as X<'_>>::U>::clone(x); + | ^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `<T as X<'_>>::U` + | +help: consider further restricting the associated type + | +LL | fn f<'a, T: X<'a> + ?Sized>(x: &<T as X<'a>>::U) where <T as X<'_>>::U: Clone { + | ++++++++++++++++++++++++++++ + +error[E0277]: the trait bound `for<'b> <T as X<'b>>::U: Clone` is not satisfied + --> $DIR/hr-associated-type-bound-object.rs:9:5 + | +LL | <<T as X<'_>>::U>::clone(x); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'b> Clone` is not implemented for `<T as X<'b>>::U` + | +note: required by a bound in `X` + --> $DIR/hr-associated-type-bound-object.rs:3:33 + | +LL | trait X<'a> + | - required by a bound in this trait +LL | where +LL | for<'b> <Self as X<'b>>::U: Clone, + | ^^^^^ required by this bound in `X` +help: consider further restricting the associated type + | +LL | fn f<'a, T: X<'a> + ?Sized>(x: &<T as X<'a>>::U) where for<'b> <T as X<'b>>::U: Clone { + | ++++++++++++++++++++++++++++++++++++ + +error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/associated-types/hr-associated-type-bound-param-1.rs b/tests/ui/associated-types/hr-associated-type-bound-param-1.rs index bbeeb145d1f..763d48252f7 100644 --- a/tests/ui/associated-types/hr-associated-type-bound-param-1.rs +++ b/tests/ui/associated-types/hr-associated-type-bound-param-1.rs @@ -17,4 +17,5 @@ impl<'a> Y<'a, u8> for u8 { fn main() { 1u8.g("abc"); + //~^ ERROR the trait bound `str: Clone` is not satisfied } diff --git a/tests/ui/associated-types/hr-associated-type-bound-param-1.stderr b/tests/ui/associated-types/hr-associated-type-bound-param-1.stderr index 0031d205b84..ad6d3e17684 100644 --- a/tests/ui/associated-types/hr-associated-type-bound-param-1.stderr +++ b/tests/ui/associated-types/hr-associated-type-bound-param-1.stderr @@ -14,6 +14,22 @@ LL | trait Y<'a, T: ?Sized> LL | for<'b> <Self as Y<'b, T>>::V: Clone, | ^^^^^ required by this bound in `Y` -error: aborting due to 1 previous error +error[E0277]: the trait bound `str: Clone` is not satisfied + --> $DIR/hr-associated-type-bound-param-1.rs:19:9 + | +LL | 1u8.g("abc"); + | ^ the trait `Clone` is not implemented for `str` + | + = help: the trait `Clone` is implemented for `String` +note: required by a bound in `Y::g` + --> $DIR/hr-associated-type-bound-param-1.rs:4:36 + | +LL | for<'b> <Self as Y<'b, T>>::V: Clone, + | ^^^^^ required by this bound in `Y::g` +... +LL | fn g(&self, x: &Self::V) { + | - required by a bound in this associated function + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/associated-types/hr-associated-type-bound-param-2.rs b/tests/ui/associated-types/hr-associated-type-bound-param-2.rs index f74c5a8590d..b1a6fe87159 100644 --- a/tests/ui/associated-types/hr-associated-type-bound-param-2.rs +++ b/tests/ui/associated-types/hr-associated-type-bound-param-2.rs @@ -8,6 +8,8 @@ where type W: ?Sized; fn h(&self, x: &T::W) { <T::W>::clone(x); + //~^ the trait bound `str: Clone` is not satisfied + //~| the trait bound `str: Clone` is not satisfied } } @@ -18,4 +20,5 @@ impl<'a> Z<'a, u16> for u16 { fn main() { 1u16.h("abc"); + //~^ ERROR Clone` is not satisfied } diff --git a/tests/ui/associated-types/hr-associated-type-bound-param-2.stderr b/tests/ui/associated-types/hr-associated-type-bound-param-2.stderr index bb484da6a77..6a5729e7784 100644 --- a/tests/ui/associated-types/hr-associated-type-bound-param-2.stderr +++ b/tests/ui/associated-types/hr-associated-type-bound-param-2.stderr @@ -15,7 +15,7 @@ LL | for<'b> <T as Z<'b, u16>>::W: Clone, | ^^^^^ required by this bound in `Z` error[E0277]: the trait bound `str: Clone` is not satisfied - --> $DIR/hr-associated-type-bound-param-2.rs:15:14 + --> $DIR/hr-associated-type-bound-param-2.rs:17:14 | LL | type W = str; | ^^^ the trait `Clone` is not implemented for `str`, which is required by `for<'b> <u16 as Z<'b, u16>>::W: Clone` @@ -47,6 +47,54 @@ LL | for<'b> <T as Z<'b, u16>>::W: Clone, | ^^^^^ required by this bound in `Z` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -error: aborting due to 3 previous errors +error[E0277]: the trait bound `str: Clone` is not satisfied + --> $DIR/hr-associated-type-bound-param-2.rs:10:10 + | +LL | <T::W>::clone(x); + | ^^^^ the trait `Clone` is not implemented for `str` + | + = help: the trait `Clone` is implemented for `String` +note: required by a bound in `Z::W` + --> $DIR/hr-associated-type-bound-param-2.rs:6:35 + | +LL | for<'b> <T as Z<'b, u16>>::W: Clone, + | ^^^^^ required by this bound in `Z::W` +LL | { +LL | type W: ?Sized; + | - required by a bound in this associated type + +error[E0277]: the trait bound `str: Clone` is not satisfied + --> $DIR/hr-associated-type-bound-param-2.rs:10:9 + | +LL | <T::W>::clone(x); + | ^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `str` + | + = help: the trait `Clone` is implemented for `String` +note: required by a bound in `Z` + --> $DIR/hr-associated-type-bound-param-2.rs:6:35 + | +LL | trait Z<'a, T: ?Sized> + | - required by a bound in this trait +... +LL | for<'b> <T as Z<'b, u16>>::W: Clone, + | ^^^^^ required by this bound in `Z` + +error[E0277]: the trait bound `str: Clone` is not satisfied + --> $DIR/hr-associated-type-bound-param-2.rs:22:10 + | +LL | 1u16.h("abc"); + | ^ the trait `Clone` is not implemented for `str` + | + = help: the trait `Clone` is implemented for `String` +note: required by a bound in `Z::h` + --> $DIR/hr-associated-type-bound-param-2.rs:6:35 + | +LL | for<'b> <T as Z<'b, u16>>::W: Clone, + | ^^^^^ required by this bound in `Z::h` +... +LL | fn h(&self, x: &T::W) { + | - required by a bound in this associated function + +error: aborting due to 6 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/associated-types/hr-associated-type-bound-param-3.rs b/tests/ui/associated-types/hr-associated-type-bound-param-3.rs index fda7d811185..8b4c84aa349 100644 --- a/tests/ui/associated-types/hr-associated-type-bound-param-3.rs +++ b/tests/ui/associated-types/hr-associated-type-bound-param-3.rs @@ -16,4 +16,5 @@ impl<S, T> X<'_, (T,)> for (S,) { pub fn main() { <(i32,) as X<(i32,)>>::f("abc"); + //~^ ERROR the trait bound `str: Clone` is not satisfied } diff --git a/tests/ui/associated-types/hr-associated-type-bound-param-3.stderr b/tests/ui/associated-types/hr-associated-type-bound-param-3.stderr index f4d2f43a9b4..70e030f2d1c 100644 --- a/tests/ui/associated-types/hr-associated-type-bound-param-3.stderr +++ b/tests/ui/associated-types/hr-associated-type-bound-param-3.stderr @@ -14,6 +14,22 @@ LL | trait X<'a, T> LL | for<'b> <T as X<'b, T>>::U: Clone, | ^^^^^ required by this bound in `X` -error: aborting due to 1 previous error +error[E0277]: the trait bound `str: Clone` is not satisfied + --> $DIR/hr-associated-type-bound-param-3.rs:18:5 + | +LL | <(i32,) as X<(i32,)>>::f("abc"); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `str` + | + = help: the trait `Clone` is implemented for `String` +note: required by a bound in `X::f` + --> $DIR/hr-associated-type-bound-param-3.rs:4:33 + | +LL | for<'b> <T as X<'b, T>>::U: Clone, + | ^^^^^ required by this bound in `X::f` +... +LL | fn f(x: &<T as X<'_, T>>::U) { + | - required by a bound in this associated function + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/associated-types/hr-associated-type-bound-param-4.rs b/tests/ui/associated-types/hr-associated-type-bound-param-4.rs index 20c8157ed97..b75bd896cc8 100644 --- a/tests/ui/associated-types/hr-associated-type-bound-param-4.rs +++ b/tests/ui/associated-types/hr-associated-type-bound-param-4.rs @@ -16,4 +16,5 @@ impl<S, T> X<'_, T> for (S,) { pub fn main() { <(i32,) as X<i32>>::f("abc"); + //~^ ERROR the trait bound `str: Clone` is not satisfied } diff --git a/tests/ui/associated-types/hr-associated-type-bound-param-4.stderr b/tests/ui/associated-types/hr-associated-type-bound-param-4.stderr index 7f03d155391..cba12afd674 100644 --- a/tests/ui/associated-types/hr-associated-type-bound-param-4.stderr +++ b/tests/ui/associated-types/hr-associated-type-bound-param-4.stderr @@ -14,6 +14,22 @@ LL | trait X<'a, T> LL | for<'b> <(T,) as X<'b, T>>::U: Clone, | ^^^^^ required by this bound in `X` -error: aborting due to 1 previous error +error[E0277]: the trait bound `str: Clone` is not satisfied + --> $DIR/hr-associated-type-bound-param-4.rs:18:5 + | +LL | <(i32,) as X<i32>>::f("abc"); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `str` + | + = help: the trait `Clone` is implemented for `String` +note: required by a bound in `X::f` + --> $DIR/hr-associated-type-bound-param-4.rs:4:36 + | +LL | for<'b> <(T,) as X<'b, T>>::U: Clone, + | ^^^^^ required by this bound in `X::f` +... +LL | fn f(x: &<(T,) as X<'_, T>>::U) { + | - required by a bound in this associated function + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/associated-types/hr-associated-type-bound-param-5.rs b/tests/ui/associated-types/hr-associated-type-bound-param-5.rs index d7f3151a502..672ade9aa5e 100644 --- a/tests/ui/associated-types/hr-associated-type-bound-param-5.rs +++ b/tests/ui/associated-types/hr-associated-type-bound-param-5.rs @@ -34,4 +34,5 @@ impl<S, T> X<'_, Box<T>> for S { pub fn main() { <i32 as X<Box<i32>>>::f("abc"); + //~^ ERROR the trait bound `str: Clone` is not satisfied } diff --git a/tests/ui/associated-types/hr-associated-type-bound-param-5.stderr b/tests/ui/associated-types/hr-associated-type-bound-param-5.stderr index fbbc2f45772..ac96187749a 100644 --- a/tests/ui/associated-types/hr-associated-type-bound-param-5.stderr +++ b/tests/ui/associated-types/hr-associated-type-bound-param-5.stderr @@ -30,6 +30,22 @@ LL | trait X<'a, T: Cycle + for<'b> X<'b, T>> LL | for<'b> <T::Next as X<'b, T::Next>>::U: Clone, | ^^^^^ required by this bound in `X` -error: aborting due to 2 previous errors +error[E0277]: the trait bound `str: Clone` is not satisfied + --> $DIR/hr-associated-type-bound-param-5.rs:36:5 + | +LL | <i32 as X<Box<i32>>>::f("abc"); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `str` + | + = help: the trait `Clone` is implemented for `String` +note: required by a bound in `X::f` + --> $DIR/hr-associated-type-bound-param-5.rs:15:33 + | +LL | for<'b> <T as X<'b, T>>::U: Clone, + | ^^^^^ required by this bound in `X::f` +... +LL | fn f(x: &<T as X<'_, T>>::U) { + | - required by a bound in this associated function + +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/associated-types/hr-associated-type-bound-param-6.rs b/tests/ui/associated-types/hr-associated-type-bound-param-6.rs index 482047b0959..f6639904ab3 100644 --- a/tests/ui/associated-types/hr-associated-type-bound-param-6.rs +++ b/tests/ui/associated-types/hr-associated-type-bound-param-6.rs @@ -16,4 +16,6 @@ impl<S, T> X<'_, T> for (S,) { pub fn main() { <(i32,) as X<i32>>::f("abc"); + //~^ ERROR the trait bound `for<'b> i32: X<'b, i32>` is not satisfied + //~| ERROR the trait bound `i32: X<'_, i32>` is not satisfied } diff --git a/tests/ui/associated-types/hr-associated-type-bound-param-6.stderr b/tests/ui/associated-types/hr-associated-type-bound-param-6.stderr index da988f4cfc1..cba83120fdc 100644 --- a/tests/ui/associated-types/hr-associated-type-bound-param-6.stderr +++ b/tests/ui/associated-types/hr-associated-type-bound-param-6.stderr @@ -9,6 +9,22 @@ help: consider restricting type parameter `T` LL | impl<S, T: for<'b> X<'b, T>> X<'_, T> for (S,) { | ++++++++++++++++++ -error: aborting due to 1 previous error +error[E0277]: the trait bound `for<'b> i32: X<'b, i32>` is not satisfied + --> $DIR/hr-associated-type-bound-param-6.rs:18:5 + | +LL | <(i32,) as X<i32>>::f("abc"); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'b> X<'b, i32>` is not implemented for `i32` + | + = help: the trait `X<'_, T>` is implemented for `(S,)` + +error[E0277]: the trait bound `i32: X<'_, i32>` is not satisfied + --> $DIR/hr-associated-type-bound-param-6.rs:18:27 + | +LL | <(i32,) as X<i32>>::f("abc"); + | ^^^^^ the trait `X<'_, i32>` is not implemented for `i32` + | + = help: the trait `X<'_, T>` is implemented for `(S,)` + +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/associated-types/hr-associated-type-projection-1.rs b/tests/ui/associated-types/hr-associated-type-projection-1.rs index 951dd9e97d2..3df3f68ab1e 100644 --- a/tests/ui/associated-types/hr-associated-type-projection-1.rs +++ b/tests/ui/associated-types/hr-associated-type-projection-1.rs @@ -17,4 +17,5 @@ impl<T: Copy + std::ops::Deref> UnsafeCopy<'_, T> for T { pub fn main() { <&'static str>::bug(&""); + //~^ type mismatch resolving `<&str as Deref>::Target == &str` } diff --git a/tests/ui/associated-types/hr-associated-type-projection-1.stderr b/tests/ui/associated-types/hr-associated-type-projection-1.stderr index 59b52521ef8..65221718ee6 100644 --- a/tests/ui/associated-types/hr-associated-type-projection-1.stderr +++ b/tests/ui/associated-types/hr-associated-type-projection-1.stderr @@ -21,6 +21,21 @@ help: consider further restricting this bound LL | impl<T: Copy + std::ops::Deref<Target = T>> UnsafeCopy<'_, T> for T { | ++++++++++++ -error: aborting due to 1 previous error +error[E0271]: type mismatch resolving `<&str as Deref>::Target == &str` + --> $DIR/hr-associated-type-projection-1.rs:19:6 + | +LL | <&'static str>::bug(&""); + | ^^^^^^^^^^^^ expected `&str`, found `str` + | +note: required by a bound in `UnsafeCopy::bug` + --> $DIR/hr-associated-type-projection-1.rs:3:64 + | +LL | for<'b> <Self as UnsafeCopy<'b, T>>::Item: std::ops::Deref<Target = T>, + | ^^^^^^^^^^ required by this bound in `UnsafeCopy::bug` +... +LL | fn bug(item: &Self::Item) -> () { + | --- required by a bound in this associated function + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0271`. diff --git a/tests/ui/associated-types/issue-20005.rs b/tests/ui/associated-types/issue-20005.rs index 36350bff100..e6e83d92061 100644 --- a/tests/ui/associated-types/issue-20005.rs +++ b/tests/ui/associated-types/issue-20005.rs @@ -6,9 +6,9 @@ trait From<Src> { trait To { fn to<Dst>( - self + self //~ ERROR the size for values of type ) -> <Dst as From<Self>>::Result where Dst: From<Self> { //~ ERROR the size for values of type - From::from(self) + From::from(self) //~ ERROR the size for values of type } } diff --git a/tests/ui/associated-types/issue-20005.stderr b/tests/ui/associated-types/issue-20005.stderr index f2983383fa6..1600227c82d 100644 --- a/tests/ui/associated-types/issue-20005.stderr +++ b/tests/ui/associated-types/issue-20005.stderr @@ -18,6 +18,42 @@ help: consider relaxing the implicit `Sized` restriction LL | trait From<Src: ?Sized> { | ++++++++ -error: aborting due to 1 previous error +error[E0277]: the size for values of type `Self` cannot be known at compilation time + --> $DIR/issue-20005.rs:9:9 + | +LL | self + | ^^^^ doesn't have a size known at compile-time + | + = help: unsized fn params are gated as an unstable feature +help: consider further restricting `Self` + | +LL | ) -> <Dst as From<Self>>::Result where Dst: From<Self>, Self: Sized { + | +++++++++++++ +help: function arguments must have a statically known size, borrowed types always have a known size + | +LL | &self + | + + +error[E0277]: the size for values of type `Self` cannot be known at compilation time + --> $DIR/issue-20005.rs:11:9 + | +LL | From::from(self) + | ^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time + | +note: required by an implicit `Sized` bound in `From` + --> $DIR/issue-20005.rs:1:12 + | +LL | trait From<Src> { + | ^^^ required by the implicit `Sized` requirement on this type parameter in `From` +help: consider further restricting `Self` + | +LL | ) -> <Dst as From<Self>>::Result where Dst: From<Self>, Self: Sized { + | +++++++++++++ +help: consider relaxing the implicit `Sized` restriction + | +LL | trait From<Src: ?Sized> { + | ++++++++ + +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/associated-types/issue-38821.rs b/tests/ui/associated-types/issue-38821.rs index 34c35d7acf1..c9be1369f16 100644 --- a/tests/ui/associated-types/issue-38821.rs +++ b/tests/ui/associated-types/issue-38821.rs @@ -35,6 +35,8 @@ pub trait Column: Expression {} //~| ERROR the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied //~| ERROR the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied //~| ERROR the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied +//~| ERROR the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied +//~| ERROR the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied pub enum ColumnInsertValue<Col, Expr> where //~^ ERROR the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied //~| ERROR the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied diff --git a/tests/ui/associated-types/issue-38821.stderr b/tests/ui/associated-types/issue-38821.stderr index 50d622c89bb..acf6bb2810c 100644 --- a/tests/ui/associated-types/issue-38821.stderr +++ b/tests/ui/associated-types/issue-38821.stderr @@ -18,7 +18,7 @@ LL | Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>, <Co | +++++++++++++++++++++++++++++++++++++++ error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied - --> $DIR/issue-38821.rs:38:1 + --> $DIR/issue-38821.rs:40:1 | LL | pub enum ColumnInsertValue<Col, Expr> where | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`, which is required by `<Col as Expression>::SqlType: IntoNullable` @@ -36,7 +36,7 @@ LL | Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>, <Co | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied - --> $DIR/issue-38821.rs:38:1 + --> $DIR/issue-38821.rs:40:1 | LL | / pub enum ColumnInsertValue<Col, Expr> where LL | | @@ -283,6 +283,38 @@ LL | impl<T: NotNull> IntoNullable for T { = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) -error: aborting due to 16 previous errors +error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied + --> $DIR/issue-38821.rs:23:10 + | +LL | #[derive(Debug, Copy, Clone)] + | ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`, which is required by `<Col as Expression>::SqlType: IntoNullable` + | +note: required for `<Col as Expression>::SqlType` to implement `IntoNullable` + --> $DIR/issue-38821.rs:9:18 + | +LL | impl<T: NotNull> IntoNullable for T { + | ------- ^^^^^^^^^^^^ ^ + | | + | unsatisfied trait bound introduced here + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied + --> $DIR/issue-38821.rs:23:23 + | +LL | #[derive(Debug, Copy, Clone)] + | ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`, which is required by `<Col as Expression>::SqlType: IntoNullable` + | +note: required for `<Col as Expression>::SqlType` to implement `IntoNullable` + --> $DIR/issue-38821.rs:9:18 + | +LL | impl<T: NotNull> IntoNullable for T { + | ------- ^^^^^^^^^^^^ ^ + | | + | unsatisfied trait bound introduced here + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to 18 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/associated-types/issue-59324.rs b/tests/ui/associated-types/issue-59324.rs index 551f13ee178..7421e08c898 100644 --- a/tests/ui/associated-types/issue-59324.rs +++ b/tests/ui/associated-types/issue-59324.rs @@ -22,5 +22,7 @@ pub trait ThriftService<Bug: NotFoo>: fn with_factory<H>(factory: dyn ThriftService<()>) {} //~^ ERROR the trait bound `(): Foo` is not satisfied +//~| ERROR the trait bound `(): Foo` is not satisfied +//~| ERROR cannot be known at compilation time fn main() {} diff --git a/tests/ui/associated-types/issue-59324.stderr b/tests/ui/associated-types/issue-59324.stderr index 266e22d4726..f50d86580f8 100644 --- a/tests/ui/associated-types/issue-59324.stderr +++ b/tests/ui/associated-types/issue-59324.stderr @@ -66,6 +66,35 @@ help: consider further restricting this bound LL | pub trait ThriftService<Bug: NotFoo + Foo>: | +++++ -error: aborting due to 5 previous errors +error[E0277]: the trait bound `(): Foo` is not satisfied + --> $DIR/issue-59324.rs:23:52 + | +LL | fn with_factory<H>(factory: dyn ThriftService<()>) {} + | ^^ the trait `Foo` is not implemented for `()` + | +help: this trait has no implementations, consider adding one + --> $DIR/issue-59324.rs:3:1 + | +LL | pub trait Foo: NotFoo { + | ^^^^^^^^^^^^^^^^^^^^^ + +error[E0277]: the size for values of type `(dyn ThriftService<(), AssocType = _> + 'static)` cannot be known at compilation time + --> $DIR/issue-59324.rs:23:20 + | +LL | fn with_factory<H>(factory: dyn ThriftService<()>) {} + | ^^^^^^^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `(dyn ThriftService<(), AssocType = _> + 'static)` + = help: unsized fn params are gated as an unstable feature +help: you can use `impl Trait` as the argument type + | +LL | fn with_factory<H>(factory: impl ThriftService<()>) {} + | ~~~~ +help: function arguments must have a statically known size, borrowed types always have a known size + | +LL | fn with_factory<H>(factory: &dyn ThriftService<()>) {} + | + + +error: aborting due to 7 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/async-await/missing-return-in-async-block.fixed b/tests/ui/async-await/missing-return-in-async-block.fixed new file mode 100644 index 00000000000..3dbac7945b6 --- /dev/null +++ b/tests/ui/async-await/missing-return-in-async-block.fixed @@ -0,0 +1,22 @@ +// run-rustfix +// edition:2021 +use std::future::Future; +use std::pin::Pin; +pub struct S; +pub fn foo() { + let _ = Box::pin(async move { + if true { + return Ok(S); //~ ERROR mismatched types + } + Err(()) + }); +} +pub fn bar() -> Pin<Box<dyn Future<Output = Result<S, ()>> + 'static>> { + Box::pin(async move { + if true { + return Ok(S); //~ ERROR mismatched types + } + Err(()) + }) +} +fn main() {} diff --git a/tests/ui/async-await/missing-return-in-async-block.rs b/tests/ui/async-await/missing-return-in-async-block.rs new file mode 100644 index 00000000000..7d04e0e0fad --- /dev/null +++ b/tests/ui/async-await/missing-return-in-async-block.rs @@ -0,0 +1,22 @@ +// run-rustfix +// edition:2021 +use std::future::Future; +use std::pin::Pin; +pub struct S; +pub fn foo() { + let _ = Box::pin(async move { + if true { + Ok(S) //~ ERROR mismatched types + } + Err(()) + }); +} +pub fn bar() -> Pin<Box<dyn Future<Output = Result<S, ()>> + 'static>> { + Box::pin(async move { + if true { + Ok(S) //~ ERROR mismatched types + } + Err(()) + }) +} +fn main() {} diff --git a/tests/ui/async-await/missing-return-in-async-block.stderr b/tests/ui/async-await/missing-return-in-async-block.stderr new file mode 100644 index 00000000000..5ea76e5f7bf --- /dev/null +++ b/tests/ui/async-await/missing-return-in-async-block.stderr @@ -0,0 +1,35 @@ +error[E0308]: mismatched types + --> $DIR/missing-return-in-async-block.rs:9:13 + | +LL | / if true { +LL | | Ok(S) + | | ^^^^^ expected `()`, found `Result<S, _>` +LL | | } + | |_________- expected this to be `()` + | + = note: expected unit type `()` + found enum `Result<S, _>` +help: you might have meant to return this value + | +LL | return Ok(S); + | ++++++ + + +error[E0308]: mismatched types + --> $DIR/missing-return-in-async-block.rs:17:13 + | +LL | / if true { +LL | | Ok(S) + | | ^^^^^ expected `()`, found `Result<S, _>` +LL | | } + | |_________- expected this to be `()` + | + = note: expected unit type `()` + found enum `Result<S, _>` +help: you might have meant to return this value + | +LL | return Ok(S); + | ++++++ + + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/auto-traits/issue-83857-ub.rs b/tests/ui/auto-traits/issue-83857-ub.rs index 626e60c37f6..f9b47d2b0c6 100644 --- a/tests/ui/auto-traits/issue-83857-ub.rs +++ b/tests/ui/auto-traits/issue-83857-ub.rs @@ -21,7 +21,9 @@ impl WithAssoc for Foo<u32, ()> { fn generic<T, U>(v: Foo<T, U>, f: fn(<Foo<T, U> as WithAssoc>::Output) -> i32) { //~^ ERROR `Foo<T, U>` cannot be sent between threads safely + //~| ERROR `Foo<T, U>` cannot be sent between threads safely f(foo(v)); + //~^ ERROR `Foo<T, U>` cannot be sent between threads safely } fn foo<T: Send>(x: T) -> <T as WithAssoc>::Output { diff --git a/tests/ui/auto-traits/issue-83857-ub.stderr b/tests/ui/auto-traits/issue-83857-ub.stderr index 97f1a603208..6372bdfe762 100644 --- a/tests/ui/auto-traits/issue-83857-ub.stderr +++ b/tests/ui/auto-traits/issue-83857-ub.stderr @@ -17,6 +17,50 @@ help: consider introducing a `where` clause, but there might be an alternative b LL | fn generic<T, U>(v: Foo<T, U>, f: fn(<Foo<T, U> as WithAssoc>::Output) -> i32) where Foo<T, U>: Send { | +++++++++++++++++++++ -error: aborting due to 1 previous error +error[E0277]: `Foo<T, U>` cannot be sent between threads safely + --> $DIR/issue-83857-ub.rs:22:80 + | +LL | fn generic<T, U>(v: Foo<T, U>, f: fn(<Foo<T, U> as WithAssoc>::Output) -> i32) { + | ________________________________________________________________________________^ +LL | | +LL | | +LL | | f(foo(v)); +LL | | +LL | | } + | |_^ `Foo<T, U>` cannot be sent between threads safely + | + = help: the trait `Send` is not implemented for `Foo<T, U>`, which is required by `Foo<T, U>: WithAssoc` +note: required for `Foo<T, U>` to implement `WithAssoc` + --> $DIR/issue-83857-ub.rs:15:15 + | +LL | impl<T: Send> WithAssoc for T { + | ---- ^^^^^^^^^ ^ + | | + | unsatisfied trait bound introduced here +help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement + | +LL | fn generic<T, U>(v: Foo<T, U>, f: fn(<Foo<T, U> as WithAssoc>::Output) -> i32) where Foo<T, U>: Send { + | +++++++++++++++++++++ + +error[E0277]: `Foo<T, U>` cannot be sent between threads safely + --> $DIR/issue-83857-ub.rs:25:11 + | +LL | f(foo(v)); + | --- ^ `Foo<T, U>` cannot be sent between threads safely + | | + | required by a bound introduced by this call + | + = help: the trait `Send` is not implemented for `Foo<T, U>` +note: required by a bound in `foo` + --> $DIR/issue-83857-ub.rs:29:11 + | +LL | fn foo<T: Send>(x: T) -> <T as WithAssoc>::Output { + | ^^^^ required by this bound in `foo` +help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement + | +LL | fn generic<T, U>(v: Foo<T, U>, f: fn(<Foo<T, U> as WithAssoc>::Output) -> i32) where Foo<T, U>: Send { + | +++++++++++++++++++++ + +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/borrowck/copy-suggestion-region-vid.fixed b/tests/ui/borrowck/copy-suggestion-region-vid.fixed new file mode 100644 index 00000000000..ec16469757a --- /dev/null +++ b/tests/ui/borrowck/copy-suggestion-region-vid.fixed @@ -0,0 +1,18 @@ +// run-rustfix +pub struct DataStruct(); + +pub struct HelperStruct<'n> { + pub helpers: [Vec<&'n i64>; 2], + pub is_empty: bool, +} + +impl DataStruct { + pub fn f(&self) -> HelperStruct { + let helpers = [vec![], vec![]]; + + HelperStruct { helpers: helpers.clone(), is_empty: helpers[0].is_empty() } + //~^ ERROR borrow of moved value + } +} + +fn main() {} diff --git a/tests/ui/borrowck/copy-suggestion-region-vid.rs b/tests/ui/borrowck/copy-suggestion-region-vid.rs index 3c5b887ce17..f95c6b03e01 100644 --- a/tests/ui/borrowck/copy-suggestion-region-vid.rs +++ b/tests/ui/borrowck/copy-suggestion-region-vid.rs @@ -1,4 +1,4 @@ -//@run-rustfix +// run-rustfix pub struct DataStruct(); pub struct HelperStruct<'n> { diff --git a/tests/ui/builtin-superkinds/builtin-superkinds-self-type.rs b/tests/ui/builtin-superkinds/builtin-superkinds-self-type.rs index 6fba87b3197..05b51e969a0 100644 --- a/tests/ui/builtin-superkinds/builtin-superkinds-self-type.rs +++ b/tests/ui/builtin-superkinds/builtin-superkinds-self-type.rs @@ -14,4 +14,5 @@ fn main() { let (tx, rx) = channel(); 1193182.foo(tx); assert_eq!(rx.recv(), 1193182); + //~^ ERROR: mismatched types } diff --git a/tests/ui/builtin-superkinds/builtin-superkinds-self-type.stderr b/tests/ui/builtin-superkinds/builtin-superkinds-self-type.stderr index d0102635315..22e72b6245c 100644 --- a/tests/ui/builtin-superkinds/builtin-superkinds-self-type.stderr +++ b/tests/ui/builtin-superkinds/builtin-superkinds-self-type.stderr @@ -17,6 +17,20 @@ help: consider adding an explicit lifetime bound LL | impl <T: Sync + 'static> Foo for T { } | +++++++++ -error: aborting due to 1 previous error +error[E0308]: mismatched types + --> $DIR/builtin-superkinds-self-type.rs:16:27 + | +LL | assert_eq!(rx.recv(), 1193182); + | ^^^^^^^ expected `Result<{integer}, RecvError>`, found integer + | + = note: expected enum `Result<{integer}, RecvError>` + found type `{integer}` +help: try wrapping the expression in `Ok` + | +LL | assert_eq!(rx.recv(), Ok(1193182)); + | +++ + + +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0310`. +Some errors have detailed explanations: E0308, E0310. +For more information about an error, try `rustc --explain E0308`. diff --git a/tests/ui/check-cfg/allow-same-level.stderr b/tests/ui/check-cfg/allow-same-level.stderr index 7f0faa0700d..011ef6e101d 100644 --- a/tests/ui/check-cfg/allow-same-level.stderr +++ b/tests/ui/check-cfg/allow-same-level.stderr @@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `FALSE` LL | #[cfg(FALSE)] | ^^^^^ | - = help: expected names are: `debug_assertions`, `doc`, `doctest`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `unix`, `windows` + = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `unix`, `windows` = help: to expect this configuration use `--check-cfg=cfg(FALSE)` = note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default diff --git a/tests/ui/check-cfg/cargo-feature.none.stderr b/tests/ui/check-cfg/cargo-feature.none.stderr index aed4fd2a8c0..d6c377e21ad 100644 --- a/tests/ui/check-cfg/cargo-feature.none.stderr +++ b/tests/ui/check-cfg/cargo-feature.none.stderr @@ -25,7 +25,7 @@ warning: unexpected `cfg` condition name: `tokio_unstable` LL | #[cfg(tokio_unstable)] | ^^^^^^^^^^^^^^ | - = help: expected names are: `debug_assertions`, `doc`, `doctest`, `feature`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `unix`, `windows` + = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `feature`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `unix`, `windows` = help: consider using a Cargo feature instead or adding `println!("cargo:rustc-check-cfg=cfg(tokio_unstable)");` to the top of a `build.rs` = note: see <https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#check-cfg> for more information about checking conditional configuration diff --git a/tests/ui/check-cfg/cargo-feature.some.stderr b/tests/ui/check-cfg/cargo-feature.some.stderr index 74d65e550bb..11dfd4fa4b6 100644 --- a/tests/ui/check-cfg/cargo-feature.some.stderr +++ b/tests/ui/check-cfg/cargo-feature.some.stderr @@ -25,7 +25,7 @@ warning: unexpected `cfg` condition name: `tokio_unstable` LL | #[cfg(tokio_unstable)] | ^^^^^^^^^^^^^^ | - = help: expected names are: `CONFIG_NVME`, `debug_assertions`, `doc`, `doctest`, `feature`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `unix`, `windows` + = help: expected names are: `CONFIG_NVME`, `clippy`, `debug_assertions`, `doc`, `doctest`, `feature`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `unix`, `windows` = help: consider using a Cargo feature instead or adding `println!("cargo:rustc-check-cfg=cfg(tokio_unstable)");` to the top of a `build.rs` = note: see <https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#check-cfg> for more information about checking conditional configuration diff --git a/tests/ui/check-cfg/cfg-value-for-cfg-name-duplicate.stderr b/tests/ui/check-cfg/cfg-value-for-cfg-name-duplicate.stderr index 82d471d715b..7d374fc81d3 100644 --- a/tests/ui/check-cfg/cfg-value-for-cfg-name-duplicate.stderr +++ b/tests/ui/check-cfg/cfg-value-for-cfg-name-duplicate.stderr @@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `value` LL | #[cfg(value)] | ^^^^^ | - = help: expected names are: `bar`, `bee`, `cow`, `debug_assertions`, `doc`, `doctest`, `foo`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `unix`, `windows` + = help: expected names are: `bar`, `bee`, `clippy`, `cow`, `debug_assertions`, `doc`, `doctest`, `foo`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `unix`, `windows` = help: to expect this configuration use `--check-cfg=cfg(value)` = note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default diff --git a/tests/ui/check-cfg/cfg-value-for-cfg-name-multiple.stderr b/tests/ui/check-cfg/cfg-value-for-cfg-name-multiple.stderr index b88ee71a156..13e6891c353 100644 --- a/tests/ui/check-cfg/cfg-value-for-cfg-name-multiple.stderr +++ b/tests/ui/check-cfg/cfg-value-for-cfg-name-multiple.stderr @@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `my_value` LL | #[cfg(my_value)] | ^^^^^^^^ | - = help: expected names are: `bar`, `debug_assertions`, `doc`, `doctest`, `foo`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `unix`, `windows` + = help: expected names are: `bar`, `clippy`, `debug_assertions`, `doc`, `doctest`, `foo`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `unix`, `windows` = help: to expect this configuration use `--check-cfg=cfg(my_value)` = note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default diff --git a/tests/ui/check-cfg/cfg-value-for-cfg-name.stderr b/tests/ui/check-cfg/cfg-value-for-cfg-name.stderr index c0447551424..a2f9ccfec05 100644 --- a/tests/ui/check-cfg/cfg-value-for-cfg-name.stderr +++ b/tests/ui/check-cfg/cfg-value-for-cfg-name.stderr @@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `linux` LL | #[cfg(linux)] | ^^^^^ help: found config with similar value: `target_os = "linux"` | - = help: expected names are: `debug_assertions`, `doc`, `doctest`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `unix`, `windows` + = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `unix`, `windows` = help: to expect this configuration use `--check-cfg=cfg(linux)` = note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default diff --git a/tests/ui/check-cfg/compact-names.stderr b/tests/ui/check-cfg/compact-names.stderr index dfa26f5dde0..37637e3b153 100644 --- a/tests/ui/check-cfg/compact-names.stderr +++ b/tests/ui/check-cfg/compact-names.stderr @@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `target_architecture` LL | #[cfg(target(os = "linux", architecture = "arm"))] | ^^^^^^^^^^^^^^^^^^^^ | - = help: expected names are: `debug_assertions`, `doc`, `doctest`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `unix`, `windows` + = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `unix`, `windows` = help: to expect this configuration use `--check-cfg=cfg(target_architecture, values("arm"))` = note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default diff --git a/tests/ui/check-cfg/exhaustive-names-values.empty_cfg.stderr b/tests/ui/check-cfg/exhaustive-names-values.empty_cfg.stderr index 040f727a840..4f770e91c58 100644 --- a/tests/ui/check-cfg/exhaustive-names-values.empty_cfg.stderr +++ b/tests/ui/check-cfg/exhaustive-names-values.empty_cfg.stderr @@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `unknown_key` LL | #[cfg(unknown_key = "value")] | ^^^^^^^^^^^^^^^^^^^^^ | - = help: expected names are: `debug_assertions`, `doc`, `doctest`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `unix`, `windows` + = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `unix`, `windows` = help: to expect this configuration use `--check-cfg=cfg(unknown_key, values("value"))` = note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default diff --git a/tests/ui/check-cfg/exhaustive-names-values.feature.stderr b/tests/ui/check-cfg/exhaustive-names-values.feature.stderr index 3cde11cf0f8..c7eaf435f75 100644 --- a/tests/ui/check-cfg/exhaustive-names-values.feature.stderr +++ b/tests/ui/check-cfg/exhaustive-names-values.feature.stderr @@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `unknown_key` LL | #[cfg(unknown_key = "value")] | ^^^^^^^^^^^^^^^^^^^^^ | - = help: expected names are: `debug_assertions`, `doc`, `doctest`, `feature`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `unix`, `windows` + = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `feature`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `unix`, `windows` = help: to expect this configuration use `--check-cfg=cfg(unknown_key, values("value"))` = note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default diff --git a/tests/ui/check-cfg/exhaustive-names-values.full.stderr b/tests/ui/check-cfg/exhaustive-names-values.full.stderr index 3cde11cf0f8..c7eaf435f75 100644 --- a/tests/ui/check-cfg/exhaustive-names-values.full.stderr +++ b/tests/ui/check-cfg/exhaustive-names-values.full.stderr @@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `unknown_key` LL | #[cfg(unknown_key = "value")] | ^^^^^^^^^^^^^^^^^^^^^ | - = help: expected names are: `debug_assertions`, `doc`, `doctest`, `feature`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `unix`, `windows` + = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `feature`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `unix`, `windows` = help: to expect this configuration use `--check-cfg=cfg(unknown_key, values("value"))` = note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default diff --git a/tests/ui/check-cfg/exhaustive-names.stderr b/tests/ui/check-cfg/exhaustive-names.stderr index cfac28cd9b9..3ed5c77e2a4 100644 --- a/tests/ui/check-cfg/exhaustive-names.stderr +++ b/tests/ui/check-cfg/exhaustive-names.stderr @@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `unknown_key` LL | #[cfg(unknown_key = "value")] | ^^^^^^^^^^^^^^^^^^^^^ | - = help: expected names are: `debug_assertions`, `doc`, `doctest`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `unix`, `windows` + = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `unix`, `windows` = help: to expect this configuration use `--check-cfg=cfg(unknown_key, values("value"))` = note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default diff --git a/tests/ui/check-cfg/mix.stderr b/tests/ui/check-cfg/mix.stderr index 39660a2fd6e..77643f227d9 100644 --- a/tests/ui/check-cfg/mix.stderr +++ b/tests/ui/check-cfg/mix.stderr @@ -44,7 +44,7 @@ warning: unexpected `cfg` condition name: `uu` LL | #[cfg_attr(uu, test)] | ^^ | - = help: expected names are: `debug_assertions`, `doc`, `doctest`, `feature`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `unix`, `windows` + = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `feature`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `unix`, `windows` = help: to expect this configuration use `--check-cfg=cfg(uu)` = note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration diff --git a/tests/ui/check-cfg/stmt-no-ice.stderr b/tests/ui/check-cfg/stmt-no-ice.stderr index 112367606dc..f2660e4775b 100644 --- a/tests/ui/check-cfg/stmt-no-ice.stderr +++ b/tests/ui/check-cfg/stmt-no-ice.stderr @@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `crossbeam_loom` LL | #[cfg(crossbeam_loom)] | ^^^^^^^^^^^^^^ | - = help: expected names are: `debug_assertions`, `doc`, `doctest`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `unix`, `windows` + = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `unix`, `windows` = help: to expect this configuration use `--check-cfg=cfg(crossbeam_loom)` = note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default diff --git a/tests/ui/check-cfg/well-known-names.stderr b/tests/ui/check-cfg/well-known-names.stderr index 763ba4646c3..a0386403e25 100644 --- a/tests/ui/check-cfg/well-known-names.stderr +++ b/tests/ui/check-cfg/well-known-names.stderr @@ -18,7 +18,7 @@ warning: unexpected `cfg` condition name: `features` LL | #[cfg(features = "foo")] | ^^^^^^^^^^^^^^^^ | - = help: expected names are: `debug_assertions`, `doc`, `doctest`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `unix`, `windows` + = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `unix`, `windows` = help: to expect this configuration use `--check-cfg=cfg(features, values("foo"))` = note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration diff --git a/tests/ui/check-cfg/well-known-values.rs b/tests/ui/check-cfg/well-known-values.rs index 21268bf10d5..34af54ccf4a 100644 --- a/tests/ui/check-cfg/well-known-values.rs +++ b/tests/ui/check-cfg/well-known-values.rs @@ -23,6 +23,8 @@ // diagnostic prints the list of expected values. #[cfg(any( // tidy-alphabetical-start + clippy = "_UNEXPECTED_VALUE", + //~^ WARN unexpected `cfg` condition value debug_assertions = "_UNEXPECTED_VALUE", //~^ WARN unexpected `cfg` condition value doc = "_UNEXPECTED_VALUE", @@ -106,4 +108,7 @@ fn unix() {} #[cfg(doc)] fn doc() {} +#[cfg(clippy)] +fn clippy() {} + fn main() {} diff --git a/tests/ui/check-cfg/well-known-values.stderr b/tests/ui/check-cfg/well-known-values.stderr index 7eeaa31cbb6..6535cd9a1a1 100644 --- a/tests/ui/check-cfg/well-known-values.stderr +++ b/tests/ui/check-cfg/well-known-values.stderr @@ -1,6 +1,18 @@ warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` --> $DIR/well-known-values.rs:26:5 | +LL | clippy = "_UNEXPECTED_VALUE", + | ^^^^^^---------------------- + | | + | help: remove the value + | + = note: no expected value for `clippy` + = note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration + = note: `#[warn(unexpected_cfgs)]` on by default + +warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` + --> $DIR/well-known-values.rs:28:5 + | LL | debug_assertions = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^---------------------- | | @@ -8,10 +20,9 @@ LL | debug_assertions = "_UNEXPECTED_VALUE", | = note: no expected value for `debug_assertions` = note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration - = note: `#[warn(unexpected_cfgs)]` on by default warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:28:5 + --> $DIR/well-known-values.rs:30:5 | LL | doc = "_UNEXPECTED_VALUE", | ^^^---------------------- @@ -22,7 +33,7 @@ LL | doc = "_UNEXPECTED_VALUE", = note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:30:5 + --> $DIR/well-known-values.rs:32:5 | LL | doctest = "_UNEXPECTED_VALUE", | ^^^^^^^---------------------- @@ -33,7 +44,7 @@ LL | doctest = "_UNEXPECTED_VALUE", = note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:32:5 + --> $DIR/well-known-values.rs:34:5 | LL | miri = "_UNEXPECTED_VALUE", | ^^^^---------------------- @@ -44,7 +55,7 @@ LL | miri = "_UNEXPECTED_VALUE", = note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:34:5 + --> $DIR/well-known-values.rs:36:5 | LL | overflow_checks = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^---------------------- @@ -55,7 +66,7 @@ LL | overflow_checks = "_UNEXPECTED_VALUE", = note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:36:5 + --> $DIR/well-known-values.rs:38:5 | LL | panic = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -64,7 +75,7 @@ LL | panic = "_UNEXPECTED_VALUE", = note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:38:5 + --> $DIR/well-known-values.rs:40:5 | LL | proc_macro = "_UNEXPECTED_VALUE", | ^^^^^^^^^^---------------------- @@ -75,7 +86,7 @@ LL | proc_macro = "_UNEXPECTED_VALUE", = note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:40:5 + --> $DIR/well-known-values.rs:42:5 | LL | relocation_model = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -84,7 +95,7 @@ LL | relocation_model = "_UNEXPECTED_VALUE", = note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:42:5 + --> $DIR/well-known-values.rs:44:5 | LL | sanitize = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -93,7 +104,7 @@ LL | sanitize = "_UNEXPECTED_VALUE", = note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:44:5 + --> $DIR/well-known-values.rs:46:5 | LL | target_abi = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -102,7 +113,7 @@ LL | target_abi = "_UNEXPECTED_VALUE", = note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:46:5 + --> $DIR/well-known-values.rs:48:5 | LL | target_arch = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -111,7 +122,7 @@ LL | target_arch = "_UNEXPECTED_VALUE", = note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:48:5 + --> $DIR/well-known-values.rs:50:5 | LL | target_endian = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -120,7 +131,7 @@ LL | target_endian = "_UNEXPECTED_VALUE", = note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:50:5 + --> $DIR/well-known-values.rs:52:5 | LL | target_env = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -129,7 +140,7 @@ LL | target_env = "_UNEXPECTED_VALUE", = note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:52:5 + --> $DIR/well-known-values.rs:54:5 | LL | target_family = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -138,7 +149,7 @@ LL | target_family = "_UNEXPECTED_VALUE", = note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:54:5 + --> $DIR/well-known-values.rs:56:5 | LL | target_feature = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -147,7 +158,7 @@ LL | target_feature = "_UNEXPECTED_VALUE", = note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:56:5 + --> $DIR/well-known-values.rs:58:5 | LL | target_has_atomic = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -156,7 +167,7 @@ LL | target_has_atomic = "_UNEXPECTED_VALUE", = note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:58:5 + --> $DIR/well-known-values.rs:60:5 | LL | target_has_atomic_equal_alignment = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -165,7 +176,7 @@ LL | target_has_atomic_equal_alignment = "_UNEXPECTED_VALUE", = note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:60:5 + --> $DIR/well-known-values.rs:62:5 | LL | target_has_atomic_load_store = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -174,7 +185,7 @@ LL | target_has_atomic_load_store = "_UNEXPECTED_VALUE", = note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:62:5 + --> $DIR/well-known-values.rs:64:5 | LL | target_os = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -183,7 +194,7 @@ LL | target_os = "_UNEXPECTED_VALUE", = note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:64:5 + --> $DIR/well-known-values.rs:66:5 | LL | target_pointer_width = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -192,7 +203,7 @@ LL | target_pointer_width = "_UNEXPECTED_VALUE", = note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:66:5 + --> $DIR/well-known-values.rs:68:5 | LL | target_thread_local = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^---------------------- @@ -203,7 +214,7 @@ LL | target_thread_local = "_UNEXPECTED_VALUE", = note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:68:5 + --> $DIR/well-known-values.rs:70:5 | LL | target_vendor = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -212,7 +223,7 @@ LL | target_vendor = "_UNEXPECTED_VALUE", = note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:70:5 + --> $DIR/well-known-values.rs:72:5 | LL | test = "_UNEXPECTED_VALUE", | ^^^^---------------------- @@ -223,7 +234,7 @@ LL | test = "_UNEXPECTED_VALUE", = note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:72:5 + --> $DIR/well-known-values.rs:74:5 | LL | unix = "_UNEXPECTED_VALUE", | ^^^^---------------------- @@ -234,7 +245,7 @@ LL | unix = "_UNEXPECTED_VALUE", = note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:74:5 + --> $DIR/well-known-values.rs:76:5 | LL | windows = "_UNEXPECTED_VALUE", | ^^^^^^^---------------------- @@ -245,7 +256,7 @@ LL | windows = "_UNEXPECTED_VALUE", = note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition value: `linuz` - --> $DIR/well-known-values.rs:80:7 + --> $DIR/well-known-values.rs:82:7 | LL | #[cfg(target_os = "linuz")] // testing that we suggest `linux` | ^^^^^^^^^^^^------- @@ -255,5 +266,5 @@ LL | #[cfg(target_os = "linuz")] // testing that we suggest `linux` = note: expected values for `target_os` are: `aix`, `android`, `cuda`, `dragonfly`, `emscripten`, `espidf`, `freebsd`, `fuchsia`, `haiku`, `hermit`, `horizon`, `hurd`, `illumos`, `ios`, `l4re`, `linux`, `macos`, `netbsd`, `none`, `nto`, `openbsd`, `psp`, `redox`, `solaris`, `solid_asp3`, `teeos`, `tvos`, `uefi`, `unknown`, `vita`, `vxworks`, `wasi`, `watchos`, `windows`, `xous`, `zkvm` = note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration -warning: 26 warnings emitted +warning: 27 warnings emitted diff --git a/tests/ui/closure-expected-type/expect-infer-var-appearing-twice.stderr b/tests/ui/closure-expected-type/expect-infer-var-appearing-twice.stderr index e2a2db7c3f0..c0f222b016d 100644 --- a/tests/ui/closure-expected-type/expect-infer-var-appearing-twice.stderr +++ b/tests/ui/closure-expected-type/expect-infer-var-appearing-twice.stderr @@ -9,8 +9,8 @@ LL | | LL | | }); | |______^ expected due to this | - = note: expected closure signature `fn(_, _) -> _` - found closure signature `fn(u32, i32) -> _` + = note: expected closure signature `fn(_, u32) -> _` + found closure signature `fn(_, i32) -> _` note: required by a bound in `with_closure` --> $DIR/expect-infer-var-appearing-twice.rs:2:14 | diff --git a/tests/ui/closures/closure-bounds-cant-promote-superkind-in-struct.rs b/tests/ui/closures/closure-bounds-cant-promote-superkind-in-struct.rs index 039cf3e0464..84aaa5f85e4 100644 --- a/tests/ui/closures/closure-bounds-cant-promote-superkind-in-struct.rs +++ b/tests/ui/closures/closure-bounds-cant-promote-superkind-in-struct.rs @@ -5,6 +5,7 @@ struct X<F> where F: FnOnce() + 'static + Send { fn foo<F>(blk: F) -> X<F> where F: FnOnce() + 'static { //~^ ERROR `F` cannot be sent between threads safely return X { field: blk }; + //~^ ERROR `F` cannot be sent between threads safely } fn main() { diff --git a/tests/ui/closures/closure-bounds-cant-promote-superkind-in-struct.stderr b/tests/ui/closures/closure-bounds-cant-promote-superkind-in-struct.stderr index e98f05b470e..8157590bd9e 100644 --- a/tests/ui/closures/closure-bounds-cant-promote-superkind-in-struct.stderr +++ b/tests/ui/closures/closure-bounds-cant-promote-superkind-in-struct.stderr @@ -14,6 +14,22 @@ help: consider further restricting this bound LL | fn foo<F>(blk: F) -> X<F> where F: FnOnce() + 'static + std::marker::Send { | +++++++++++++++++++ -error: aborting due to 1 previous error +error[E0277]: `F` cannot be sent between threads safely + --> $DIR/closure-bounds-cant-promote-superkind-in-struct.rs:7:23 + | +LL | return X { field: blk }; + | ^^^ `F` cannot be sent between threads safely + | +note: required by a bound in `X` + --> $DIR/closure-bounds-cant-promote-superkind-in-struct.rs:1:43 + | +LL | struct X<F> where F: FnOnce() + 'static + Send { + | ^^^^ required by this bound in `X` +help: consider further restricting this bound + | +LL | fn foo<F>(blk: F) -> X<F> where F: FnOnce() + 'static + std::marker::Send { + | +++++++++++++++++++ + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/issues/issue-10682.rs b/tests/ui/closures/issue-10682.rs index 72e4559d31a..72e4559d31a 100644 --- a/tests/ui/issues/issue-10682.rs +++ b/tests/ui/closures/issue-10682.rs diff --git a/tests/ui/coherence/coherence-blanket-conflicts-with-specific-multidispatch.rs b/tests/ui/coherence/coherence-blanket-conflicts-with-specific-multidispatch.rs index cdec81271d0..8426748fd52 100644 --- a/tests/ui/coherence/coherence-blanket-conflicts-with-specific-multidispatch.rs +++ b/tests/ui/coherence/coherence-blanket-conflicts-with-specific-multidispatch.rs @@ -23,6 +23,7 @@ impl MyTrait<MyType> for MyType { //~^ ERROR E0119 fn get(&self) -> usize { (*self).clone() } //~^ ERROR incompatible type + //~| ERROR mismatched types } fn main() { } diff --git a/tests/ui/coherence/coherence-blanket-conflicts-with-specific-multidispatch.stderr b/tests/ui/coherence/coherence-blanket-conflicts-with-specific-multidispatch.stderr index 471dfe1cae7..0653009409c 100644 --- a/tests/ui/coherence/coherence-blanket-conflicts-with-specific-multidispatch.stderr +++ b/tests/ui/coherence/coherence-blanket-conflicts-with-specific-multidispatch.stderr @@ -24,7 +24,15 @@ LL | fn get(&self) -> T; = note: expected signature `fn(&MyType) -> MyType` found signature `fn(&MyType) -> usize` -error: aborting due to 2 previous errors +error[E0308]: mismatched types + --> $DIR/coherence-blanket-conflicts-with-specific-multidispatch.rs:24:30 + | +LL | fn get(&self) -> usize { (*self).clone() } + | ----- ^^^^^^^^^^^^^^^ expected `usize`, found `MyType` + | | + | expected `usize` because of return type + +error: aborting due to 3 previous errors -Some errors have detailed explanations: E0053, E0119. +Some errors have detailed explanations: E0053, E0119, E0308. For more information about an error, try `rustc --explain E0053`. diff --git a/tests/ui/coherence/coherence-tuple-conflict.rs b/tests/ui/coherence/coherence-tuple-conflict.rs index 8cc82972668..8dd09598c30 100644 --- a/tests/ui/coherence/coherence-tuple-conflict.rs +++ b/tests/ui/coherence/coherence-tuple-conflict.rs @@ -15,6 +15,7 @@ impl<T> MyTrait for (T,T) { impl<A,B> MyTrait for (A,B) { //~^ ERROR E0119 fn get(&self) -> usize { self.dummy } + //~^ ERROR: no field `dummy` } fn main() { } diff --git a/tests/ui/coherence/coherence-tuple-conflict.stderr b/tests/ui/coherence/coherence-tuple-conflict.stderr index 4e02c0eb43c..95f9a1a8841 100644 --- a/tests/ui/coherence/coherence-tuple-conflict.stderr +++ b/tests/ui/coherence/coherence-tuple-conflict.stderr @@ -7,6 +7,13 @@ LL | impl<T> MyTrait for (T,T) { LL | impl<A,B> MyTrait for (A,B) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(_, _)` -error: aborting due to 1 previous error +error[E0609]: no field `dummy` on type `&(A, B)` + --> $DIR/coherence-tuple-conflict.rs:17:35 + | +LL | fn get(&self) -> usize { self.dummy } + | ^^^^^ unknown field + +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0119`. +Some errors have detailed explanations: E0119, E0609. +For more information about an error, try `rustc --explain E0119`. diff --git a/tests/ui/coherence/occurs-check/associated-type.next.stderr b/tests/ui/coherence/occurs-check/associated-type.next.stderr index f64e8b39798..65be4a9c884 100644 --- a/tests/ui/coherence/occurs-check/associated-type.next.stderr +++ b/tests/ui/coherence/occurs-check/associated-type.next.stderr @@ -20,6 +20,13 @@ LL | | for<'a> *const T: ToUnit<'a>, | = note: this behavior recently changed as a result of a bug fix; see rust-lang/rust#56105 for details -error: aborting due to 1 previous error +error[E0284]: type annotations needed: cannot satisfy `<for<'a> fn(&'a (), ()) as Overlap<for<'a> fn(&'a (), ())>>::Assoc == usize` + --> $DIR/associated-type.rs:44:59 + | +LL | foo::<for<'a> fn(&'a (), ()), for<'a> fn(&'a (), ())>(3usize); + | ^^^^^^ cannot satisfy `<for<'a> fn(&'a (), ()) as Overlap<for<'a> fn(&'a (), ())>>::Assoc == usize` + +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0119`. +Some errors have detailed explanations: E0119, E0284. +For more information about an error, try `rustc --explain E0119`. diff --git a/tests/ui/coherence/occurs-check/associated-type.rs b/tests/ui/coherence/occurs-check/associated-type.rs index 227b6684785..3df8fe10a83 100644 --- a/tests/ui/coherence/occurs-check/associated-type.rs +++ b/tests/ui/coherence/occurs-check/associated-type.rs @@ -42,4 +42,5 @@ fn foo<T: Overlap<U>, U>(x: T::Assoc) -> T::Assoc { fn main() { foo::<for<'a> fn(&'a (), ()), for<'a> fn(&'a (), ())>(3usize); + //[next]~^ ERROR: cannot satisfy } diff --git a/tests/ui/const-generics/const-argument-if-length.full.stderr b/tests/ui/const-generics/const-argument-if-length.full.stderr index 315b0f0a064..db3d88392bd 100644 --- a/tests/ui/const-generics/const-argument-if-length.full.stderr +++ b/tests/ui/const-generics/const-argument-if-length.full.stderr @@ -1,5 +1,5 @@ error: unconstrained generic constant - --> $DIR/const-argument-if-length.rs:17:10 + --> $DIR/const-argument-if-length.rs:18:10 | LL | pad: [u8; is_zst::<T>()], | ^^^^^^^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ LL | pad: [u8; is_zst::<T>()], = help: try adding a `where` bound using this expression: `where [(); is_zst::<T>()]:` error[E0277]: the size for values of type `T` cannot be known at compilation time - --> $DIR/const-argument-if-length.rs:15:12 + --> $DIR/const-argument-if-length.rs:16:12 | LL | pub struct AtLeastByte<T: ?Sized> { | - this type parameter needs to be `Sized` @@ -30,6 +30,22 @@ help: the `Box` type always has a statically known size and allocates its conten LL | value: Box<T>, | ++++ + -error: aborting due to 2 previous errors +error[E0277]: the size for values of type `T` cannot be known at compilation time + --> $DIR/const-argument-if-length.rs:7:28 + | +LL | pub const fn is_zst<T: ?Sized>() -> usize { + | - this type parameter needs to be `Sized` +LL | if std::mem::size_of::<T>() == 0 { + | ^ doesn't have a size known at compile-time + | +note: required by an implicit `Sized` bound in `std::mem::size_of` + --> $SRC_DIR/core/src/mem/mod.rs:LL:COL +help: consider removing the `?Sized` bound to make the type parameter `Sized` + | +LL - pub const fn is_zst<T: ?Sized>() -> usize { +LL + pub const fn is_zst<T>() -> usize { + | + +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/const-generics/const-argument-if-length.min.stderr b/tests/ui/const-generics/const-argument-if-length.min.stderr index b9d9bcc9270..fdc3f584476 100644 --- a/tests/ui/const-generics/const-argument-if-length.min.stderr +++ b/tests/ui/const-generics/const-argument-if-length.min.stderr @@ -1,5 +1,5 @@ error: generic parameters may not be used in const operations - --> $DIR/const-argument-if-length.rs:17:24 + --> $DIR/const-argument-if-length.rs:18:24 | LL | pad: [u8; is_zst::<T>()], | ^ cannot perform const operation using `T` @@ -8,7 +8,7 @@ LL | pad: [u8; is_zst::<T>()], = help: add `#![feature(generic_const_exprs)]` to allow generic const expressions error[E0277]: the size for values of type `T` cannot be known at compilation time - --> $DIR/const-argument-if-length.rs:15:12 + --> $DIR/const-argument-if-length.rs:16:12 | LL | pub struct AtLeastByte<T: ?Sized> { | - this type parameter needs to be `Sized` @@ -31,6 +31,22 @@ help: the `Box` type always has a statically known size and allocates its conten LL | value: Box<T>, | ++++ + -error: aborting due to 2 previous errors +error[E0277]: the size for values of type `T` cannot be known at compilation time + --> $DIR/const-argument-if-length.rs:7:28 + | +LL | pub const fn is_zst<T: ?Sized>() -> usize { + | - this type parameter needs to be `Sized` +LL | if std::mem::size_of::<T>() == 0 { + | ^ doesn't have a size known at compile-time + | +note: required by an implicit `Sized` bound in `std::mem::size_of` + --> $SRC_DIR/core/src/mem/mod.rs:LL:COL +help: consider removing the `?Sized` bound to make the type parameter `Sized` + | +LL - pub const fn is_zst<T: ?Sized>() -> usize { +LL + pub const fn is_zst<T>() -> usize { + | + +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/const-generics/const-argument-if-length.rs b/tests/ui/const-generics/const-argument-if-length.rs index db1eafca2c7..c5ff86fbfb7 100644 --- a/tests/ui/const-generics/const-argument-if-length.rs +++ b/tests/ui/const-generics/const-argument-if-length.rs @@ -5,6 +5,7 @@ pub const fn is_zst<T: ?Sized>() -> usize { if std::mem::size_of::<T>() == 0 { + //~^ ERROR the size for values of type `T` cannot be known at compilation time 1 } else { 0 diff --git a/tests/ui/const-generics/fn-const-param-infer.full.stderr b/tests/ui/const-generics/fn-const-param-infer.full.stderr index 48d4a45345a..753558636e1 100644 --- a/tests/ui/const-generics/fn-const-param-infer.full.stderr +++ b/tests/ui/const-generics/fn-const-param-infer.full.stderr @@ -4,6 +4,27 @@ error[E0741]: using function pointers as const generic parameters is forbidden LL | struct Checked<const F: fn(usize) -> bool>; | ^^^^^^^^^^^^^^^^^ -error: aborting due to 1 previous error +error[E0308]: mismatched types + --> $DIR/fn-const-param-infer.rs:23:24 + | +LL | let _ = Checked::<{generic_arg::<u32>}>; + | ^^^^^^^^^^^^^^^^^^ expected fn pointer, found fn item + | + = note: expected fn pointer `fn(usize) -> _` + found fn item `fn(u32) -> _ {generic_arg::<u32>}` + +error[E0282]: type annotations needed + --> $DIR/fn-const-param-infer.rs:25:23 + | +LL | let _ = Checked::<generic>; + | ^^^^^^^ cannot infer type of the type parameter `T` declared on the function `generic` + | +help: consider specifying the generic argument + | +LL | let _ = Checked::<generic::<T>>; + | +++++ + +error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0741`. +Some errors have detailed explanations: E0282, E0308, E0741. +For more information about an error, try `rustc --explain E0282`. diff --git a/tests/ui/const-generics/fn-const-param-infer.min.stderr b/tests/ui/const-generics/fn-const-param-infer.min.stderr index f6d41809d67..01e224f8d9c 100644 --- a/tests/ui/const-generics/fn-const-param-infer.min.stderr +++ b/tests/ui/const-generics/fn-const-param-infer.min.stderr @@ -6,5 +6,27 @@ LL | struct Checked<const F: fn(usize) -> bool>; | = note: the only supported types are integers, `bool` and `char` -error: aborting due to 1 previous error +error[E0308]: mismatched types + --> $DIR/fn-const-param-infer.rs:23:24 + | +LL | let _ = Checked::<{generic_arg::<u32>}>; + | ^^^^^^^^^^^^^^^^^^ expected fn pointer, found fn item + | + = note: expected fn pointer `fn(usize) -> _` + found fn item `fn(u32) -> _ {generic_arg::<u32>}` + +error[E0282]: type annotations needed + --> $DIR/fn-const-param-infer.rs:25:23 + | +LL | let _ = Checked::<generic>; + | ^^^^^^^ cannot infer type of the type parameter `T` declared on the function `generic` + | +help: consider specifying the generic argument + | +LL | let _ = Checked::<generic::<T>>; + | +++++ + +error: aborting due to 3 previous errors +Some errors have detailed explanations: E0282, E0308. +For more information about an error, try `rustc --explain E0282`. diff --git a/tests/ui/const-generics/fn-const-param-infer.rs b/tests/ui/const-generics/fn-const-param-infer.rs index 22f5f529c76..d80e18067e2 100644 --- a/tests/ui/const-generics/fn-const-param-infer.rs +++ b/tests/ui/const-generics/fn-const-param-infer.rs @@ -20,9 +20,9 @@ fn main() { let _ = Checked::<generic_arg>; let _ = Checked::<{generic_arg::<usize>}>; - let _ = Checked::<{generic_arg::<u32>}>; + let _ = Checked::<{generic_arg::<u32>}>; //~ ERROR: mismatched types - let _ = Checked::<generic>; + let _ = Checked::<generic>; //~ ERROR: type annotations needed let _ = Checked::<{generic::<u16>}>; let _: Checked<{generic::<u16>}> = Checked::<{generic::<u16>}>; let _: Checked<{generic::<u32>}> = Checked::<{generic::<u16>}>; diff --git a/tests/ui/const-generics/generic_const_exprs/no_where_clause.rs b/tests/ui/const-generics/generic_const_exprs/no_where_clause.rs index 9c5de03170b..77cce66e4ec 100644 --- a/tests/ui/const-generics/generic_const_exprs/no_where_clause.rs +++ b/tests/ui/const-generics/generic_const_exprs/no_where_clause.rs @@ -16,6 +16,7 @@ impl<const N: usize> Example<N> { Self { a: [0.; N], b: [0.; complex_maths(N)], + //~^ ERROR: unconstrained generic constant } } } diff --git a/tests/ui/const-generics/generic_const_exprs/no_where_clause.stderr b/tests/ui/const-generics/generic_const_exprs/no_where_clause.stderr index 100cf3f8b62..4a87649f43d 100644 --- a/tests/ui/const-generics/generic_const_exprs/no_where_clause.stderr +++ b/tests/ui/const-generics/generic_const_exprs/no_where_clause.stderr @@ -6,5 +6,13 @@ LL | b: [f32; complex_maths(N)], | = help: try adding a `where` bound using this expression: `where [(); complex_maths(N)]:` -error: aborting due to 1 previous error +error: unconstrained generic constant + --> $DIR/no_where_clause.rs:18:15 + | +LL | b: [0.; complex_maths(N)], + | ^^^^^^^^^^^^^^^^ + | + = help: try adding a `where` bound using this expression: `where [(); complex_maths(N)]:` + +error: aborting due to 2 previous errors diff --git a/tests/ui/const-generics/generic_const_exprs/object-safety-err-ret.rs b/tests/ui/const-generics/generic_const_exprs/object-safety-err-ret.rs index 24d333aba0f..1620e257667 100644 --- a/tests/ui/const-generics/generic_const_exprs/object-safety-err-ret.rs +++ b/tests/ui/const-generics/generic_const_exprs/object-safety-err-ret.rs @@ -15,7 +15,7 @@ impl Foo for () { } fn use_dyn(v: &dyn Foo) { //~ERROR the trait `Foo` cannot be made into an object - v.test(); + v.test(); //~ERROR the trait `Foo` cannot be made into an object } fn main() {} diff --git a/tests/ui/const-generics/generic_const_exprs/object-safety-err-ret.stderr b/tests/ui/const-generics/generic_const_exprs/object-safety-err-ret.stderr index 6f0a6b04333..31f271cc7ba 100644 --- a/tests/ui/const-generics/generic_const_exprs/object-safety-err-ret.stderr +++ b/tests/ui/const-generics/generic_const_exprs/object-safety-err-ret.stderr @@ -16,6 +16,24 @@ LL | fn test(&self) -> [u8; bar::<Self>()]; = help: consider moving `test` to another trait = help: only type `()` implements the trait, consider using it directly instead -error: aborting due to 1 previous error +error[E0038]: the trait `Foo` cannot be made into an object + --> $DIR/object-safety-err-ret.rs:18:5 + | +LL | v.test(); + | ^^^^^^^^ `Foo` cannot be made into an object + | +note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + --> $DIR/object-safety-err-ret.rs:8:8 + | +LL | trait Foo { + | --- this trait cannot be made into an object... +LL | fn test(&self) -> [u8; bar::<Self>()]; + | ^^^^ ^^^^^^^^^^^^^^^^^^^ ...because method `test` references the `Self` type in its return type + | | + | ...because method `test` references the `Self` type in its `where` clause + = help: consider moving `test` to another trait + = help: only type `()` implements the trait, consider using it directly instead + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0038`. diff --git a/tests/ui/const-generics/generic_const_exprs/unify-op-with-fn-call.stderr b/tests/ui/const-generics/generic_const_exprs/unify-op-with-fn-call.stderr index eb71ebb62eb..77a7da17c13 100644 --- a/tests/ui/const-generics/generic_const_exprs/unify-op-with-fn-call.stderr +++ b/tests/ui/const-generics/generic_const_exprs/unify-op-with-fn-call.stderr @@ -34,6 +34,47 @@ LL + #[derive(ConstParamTy)] LL | struct Foo(u8); | -error: aborting due to 3 previous errors +error: unconstrained generic constant + --> $DIR/unify-op-with-fn-call.rs:30:12 + | +LL | bar2::<{ std::ops::Add::add(N, N) }>(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: try adding a `where` bound using this expression: `where [(); { std::ops::Add::add(N, N) }]:` + +error[E0015]: cannot call non-const operator in constants + --> $DIR/unify-op-with-fn-call.rs:20:39 + | +LL | fn foo<const N: Foo>(a: Evaluatable<{ N + N }>) { + | ^^^^^ + | +note: impl defined here, but it is not `const` + --> $DIR/unify-op-with-fn-call.rs:10:1 + | +LL | impl const std::ops::Add for Foo { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: calls in constants are limited to constant functions, tuple structs and tuple variants + = help: add `#![feature(effects)]` to the crate attributes to enable + +error[E0015]: cannot call non-const fn `<Foo as Add>::add` in constants + --> $DIR/unify-op-with-fn-call.rs:21:13 + | +LL | bar::<{ std::ops::Add::add(N, N) }>(); + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: calls in constants are limited to constant functions, tuple structs and tuple variants + = help: add `#![feature(effects)]` to the crate attributes to enable + +error[E0015]: cannot call non-const fn `<usize as Add>::add` in constants + --> $DIR/unify-op-with-fn-call.rs:30:14 + | +LL | bar2::<{ std::ops::Add::add(N, N) }>(); + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: calls in constants are limited to constant functions, tuple structs and tuple variants + = help: add `#![feature(effects)]` to the crate attributes to enable + +error: aborting due to 7 previous errors -For more information about this error, try `rustc --explain E0741`. +Some errors have detailed explanations: E0015, E0741. +For more information about an error, try `rustc --explain E0015`. diff --git a/tests/ui/const-generics/issues/issue-62878.min.stderr b/tests/ui/const-generics/issues/issue-62878.min.stderr index eb8b9732f58..984381d1669 100644 --- a/tests/ui/const-generics/issues/issue-62878.min.stderr +++ b/tests/ui/const-generics/issues/issue-62878.min.stderr @@ -15,6 +15,16 @@ LL | fn foo<const N: usize, const A: [u8; N]>() {} = note: the only supported types are integers, `bool` and `char` = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types -error: aborting due to 2 previous errors +error[E0747]: type provided when a constant was expected + --> $DIR/issue-62878.rs:10:11 + | +LL | foo::<_, { [1] }>(); + | ^ + | + = help: const arguments cannot yet be inferred with `_` + = help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable + +error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0770`. +Some errors have detailed explanations: E0747, E0770. +For more information about an error, try `rustc --explain E0747`. diff --git a/tests/ui/const-generics/issues/issue-62878.rs b/tests/ui/const-generics/issues/issue-62878.rs index 4c08a484ef4..d226551ef8a 100644 --- a/tests/ui/const-generics/issues/issue-62878.rs +++ b/tests/ui/const-generics/issues/issue-62878.rs @@ -8,4 +8,5 @@ fn foo<const N: usize, const A: [u8; N]>() {} fn main() { foo::<_, { [1] }>(); + //[min]~^ ERROR: type provided when a constant was expected } diff --git a/tests/ui/const-generics/issues/issue-72352.full.stderr b/tests/ui/const-generics/issues/issue-72352.full.stderr index cc46e7951f0..16a14d7f480 100644 --- a/tests/ui/const-generics/issues/issue-72352.full.stderr +++ b/tests/ui/const-generics/issues/issue-72352.full.stderr @@ -1,7 +1,7 @@ error[E0741]: using function pointers as const generic parameters is forbidden - --> $DIR/issue-72352.rs:7:42 + --> $DIR/issue-72352.rs:8:42 | -LL | unsafe fn unsafely_do_the_thing<const F: fn(&CStr) -> usize>(ptr: *const i8) -> usize { +LL | unsafe fn unsafely_do_the_thing<const F: fn(&CStr) -> usize>(ptr: *const c_char) -> usize { | ^^^^^^^^^^^^^^^^^^ error: aborting due to 1 previous error diff --git a/tests/ui/const-generics/issues/issue-72352.min.stderr b/tests/ui/const-generics/issues/issue-72352.min.stderr index cd009c973ae..ede0faec7c6 100644 --- a/tests/ui/const-generics/issues/issue-72352.min.stderr +++ b/tests/ui/const-generics/issues/issue-72352.min.stderr @@ -1,7 +1,7 @@ error: using function pointers as const generic parameters is forbidden - --> $DIR/issue-72352.rs:7:42 + --> $DIR/issue-72352.rs:8:42 | -LL | unsafe fn unsafely_do_the_thing<const F: fn(&CStr) -> usize>(ptr: *const i8) -> usize { +LL | unsafe fn unsafely_do_the_thing<const F: fn(&CStr) -> usize>(ptr: *const c_char) -> usize { | ^^^^^^^^^^^^^^^^^^ | = note: the only supported types are integers, `bool` and `char` diff --git a/tests/ui/const-generics/issues/issue-72352.rs b/tests/ui/const-generics/issues/issue-72352.rs index 2fa1d7a5337..0cab6e8ebfa 100644 --- a/tests/ui/const-generics/issues/issue-72352.rs +++ b/tests/ui/const-generics/issues/issue-72352.rs @@ -1,10 +1,11 @@ // revisions: full min + #![cfg_attr(full, feature(adt_const_params))] #![cfg_attr(full, allow(incomplete_features))] -use std::ffi::{CStr, CString}; +use std::ffi::{c_char, CStr, CString}; -unsafe fn unsafely_do_the_thing<const F: fn(&CStr) -> usize>(ptr: *const i8) -> usize { +unsafe fn unsafely_do_the_thing<const F: fn(&CStr) -> usize>(ptr: *const c_char) -> usize { //~^ ERROR: using function pointers as const generic parameters is forbidden F(CStr::from_ptr(ptr)) } @@ -16,7 +17,5 @@ fn safely_do_the_thing(s: &CStr) -> usize { fn main() { let baguette = CString::new("baguette").unwrap(); let ptr = baguette.as_ptr(); - println!("{}", unsafe { - unsafely_do_the_thing::<safely_do_the_thing>(ptr) - }); + println!("{}", unsafe { unsafely_do_the_thing::<safely_do_the_thing>(ptr) }); } diff --git a/tests/ui/const-generics/raw-ptr-const-param.full.stderr b/tests/ui/const-generics/raw-ptr-const-param.full.stderr index aef95bdaa88..7ba9ac15bf3 100644 --- a/tests/ui/const-generics/raw-ptr-const-param.full.stderr +++ b/tests/ui/const-generics/raw-ptr-const-param.full.stderr @@ -4,6 +4,18 @@ error[E0741]: using raw pointers as const generic parameters is forbidden LL | struct Const<const P: *const u32>; | ^^^^^^^^^^ -error: aborting due to 1 previous error +error[E0308]: mismatched types + --> $DIR/raw-ptr-const-param.rs:9:40 + | +LL | let _: Const<{ 15 as *const _ }> = Const::<{ 10 as *const _ }>; + | ------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `{0xf as *const u32}`, found `{0xa as *const u32}` + | | + | expected due to this + | + = note: expected struct `Const<{0xf as *const u32}>` + found struct `Const<{0xa as *const u32}>` + +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0741`. +Some errors have detailed explanations: E0308, E0741. +For more information about an error, try `rustc --explain E0308`. diff --git a/tests/ui/const-generics/raw-ptr-const-param.min.stderr b/tests/ui/const-generics/raw-ptr-const-param.min.stderr index 4de98191d5b..18bbcc33c4d 100644 --- a/tests/ui/const-generics/raw-ptr-const-param.min.stderr +++ b/tests/ui/const-generics/raw-ptr-const-param.min.stderr @@ -6,5 +6,17 @@ LL | struct Const<const P: *const u32>; | = note: the only supported types are integers, `bool` and `char` -error: aborting due to 1 previous error +error[E0308]: mismatched types + --> $DIR/raw-ptr-const-param.rs:9:40 + | +LL | let _: Const<{ 15 as *const _ }> = Const::<{ 10 as *const _ }>; + | ------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `{0xf as *const u32}`, found `{0xa as *const u32}` + | | + | expected due to this + | + = note: expected struct `Const<{0xf as *const u32}>` + found struct `Const<{0xa as *const u32}>` + +error: aborting due to 2 previous errors +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/const-generics/raw-ptr-const-param.rs b/tests/ui/const-generics/raw-ptr-const-param.rs index 27ef9e7d96c..9cc46c769e7 100644 --- a/tests/ui/const-generics/raw-ptr-const-param.rs +++ b/tests/ui/const-generics/raw-ptr-const-param.rs @@ -7,5 +7,6 @@ struct Const<const P: *const u32>; //~ ERROR: using raw pointers as const generi fn main() { let _: Const<{ 15 as *const _ }> = Const::<{ 10 as *const _ }>; + //~^ ERROR: mismatched types let _: Const<{ 10 as *const _ }> = Const::<{ 10 as *const _ }>; } diff --git a/tests/ui/const-generics/slice-const-param-mismatch.min.stderr b/tests/ui/const-generics/slice-const-param-mismatch.min.stderr index 3c086f59b27..26f5af6c831 100644 --- a/tests/ui/const-generics/slice-const-param-mismatch.min.stderr +++ b/tests/ui/const-generics/slice-const-param-mismatch.min.stderr @@ -16,5 +16,39 @@ LL | struct ConstBytes<const T: &'static [u8]>; = note: the only supported types are integers, `bool` and `char` = help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types -error: aborting due to 2 previous errors +error[E0308]: mismatched types + --> $DIR/slice-const-param-mismatch.rs:14:35 + | +LL | let _: ConstString<"Hello"> = ConstString::<"World">; + | -------------------- ^^^^^^^^^^^^^^^^^^^^^^ expected `"Hello"`, found `"World"` + | | + | expected due to this + | + = note: expected struct `ConstString<"Hello">` + found struct `ConstString<"World">` + +error[E0308]: mismatched types + --> $DIR/slice-const-param-mismatch.rs:16:33 + | +LL | let _: ConstString<"ℇ㇈↦"> = ConstString::<"ℇ㇈↥">; + | ------------------- ^^^^^^^^^^^^^^^^^^^^^ expected `"ℇ㇈↦"`, found `"ℇ㇈↥"` + | | + | expected due to this + | + = note: expected struct `ConstString<"ℇ㇈↦">` + found struct `ConstString<"ℇ㇈↥">` + +error[E0308]: mismatched types + --> $DIR/slice-const-param-mismatch.rs:18:33 + | +LL | let _: ConstBytes<b"AAA"> = ConstBytes::<b"BBB">; + | ------------------ ^^^^^^^^^^^^^^^^^^^^ expected `b"AAA"`, found `b"BBB"` + | | + | expected due to this + | + = note: expected struct `ConstBytes<b"AAA">` + found struct `ConstBytes<b"BBB">` + +error: aborting due to 5 previous errors +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/const-generics/slice-const-param-mismatch.rs b/tests/ui/const-generics/slice-const-param-mismatch.rs index 7127323e5ba..24c05d7bea5 100644 --- a/tests/ui/const-generics/slice-const-param-mismatch.rs +++ b/tests/ui/const-generics/slice-const-param-mismatch.rs @@ -11,9 +11,9 @@ struct ConstBytes<const T: &'static [u8]>; pub fn main() { let _: ConstString<"Hello"> = ConstString::<"Hello">; - let _: ConstString<"Hello"> = ConstString::<"World">; //[full]~ ERROR mismatched types + let _: ConstString<"Hello"> = ConstString::<"World">; //~ ERROR mismatched types let _: ConstString<"ℇ㇈↦"> = ConstString::<"ℇ㇈↦">; - let _: ConstString<"ℇ㇈↦"> = ConstString::<"ℇ㇈↥">; //[full]~ ERROR mismatched types + let _: ConstString<"ℇ㇈↦"> = ConstString::<"ℇ㇈↥">; //~ ERROR mismatched types let _: ConstBytes<b"AAA"> = ConstBytes::<{&[0x41, 0x41, 0x41]}>; - let _: ConstBytes<b"AAA"> = ConstBytes::<b"BBB">; //[full]~ ERROR mismatched types + let _: ConstBytes<b"AAA"> = ConstBytes::<b"BBB">; //~ ERROR mismatched types } diff --git a/tests/ui/consts/const-unsized.rs b/tests/ui/consts/const-unsized.rs index e0b06a27109..18682aa6eb6 100644 --- a/tests/ui/consts/const-unsized.rs +++ b/tests/ui/consts/const-unsized.rs @@ -18,4 +18,6 @@ static STATIC_BAR: str = *"bar"; fn main() { println!("{:?} {:?} {:?} {:?}", &CONST_0, &CONST_FOO, &STATIC_1, &STATIC_BAR); + //~^ ERROR: cannot move a value of type `str` + //~| ERROR: cannot move a value of type `dyn Debug + Sync` } diff --git a/tests/ui/consts/const-unsized.stderr b/tests/ui/consts/const-unsized.stderr index f70c9b2e077..0b69cad9651 100644 --- a/tests/ui/consts/const-unsized.stderr +++ b/tests/ui/consts/const-unsized.stderr @@ -66,6 +66,19 @@ LL | static STATIC_BAR: str = *"bar"; = help: the trait `Sized` is not implemented for `str` = note: constant expressions must have a statically known size -error: aborting due to 8 previous errors +error[E0161]: cannot move a value of type `str` + --> $DIR/const-unsized.rs:20:48 + | +LL | println!("{:?} {:?} {:?} {:?}", &CONST_0, &CONST_FOO, &STATIC_1, &STATIC_BAR); + | ^^^^^^^^^ the size of `str` cannot be statically determined + +error[E0161]: cannot move a value of type `dyn Debug + Sync` + --> $DIR/const-unsized.rs:20:38 + | +LL | println!("{:?} {:?} {:?} {:?}", &CONST_0, &CONST_FOO, &STATIC_1, &STATIC_BAR); + | ^^^^^^^ the size of `dyn Debug + Sync` cannot be statically determined + +error: aborting due to 10 previous errors -For more information about this error, try `rustc --explain E0277`. +Some errors have detailed explanations: E0161, E0277. +For more information about an error, try `rustc --explain E0161`. diff --git a/tests/ui/consts/const_refs_to_static_fail_invalid.rs b/tests/ui/consts/const_refs_to_static_fail_invalid.rs index bf52f884209..665b876c43e 100644 --- a/tests/ui/consts/const_refs_to_static_fail_invalid.rs +++ b/tests/ui/consts/const_refs_to_static_fail_invalid.rs @@ -1,6 +1,7 @@ // normalize-stderr-test "(the raw bytes of the constant) \(size: [0-9]*, align: [0-9]*\)" -> "$1 (size: $$SIZE, align: $$ALIGN)" // normalize-stderr-test "([0-9a-f][0-9a-f] |╾─*ALLOC[0-9]+(\+[a-z0-9]+)?(<imm>)?─*╼ )+ *│.*" -> "HEX_DUMP" #![feature(const_refs_to_static)] +#![allow(static_mut_ref)] fn invalid() { static S: i8 = 10; @@ -38,7 +39,6 @@ fn mutable() { const C: &i32 = unsafe { &S_MUT }; //~^ERROR: undefined behavior //~| encountered reference to mutable memory - //~| WARN shared reference of mutable static is discouraged // This *must not build*, the constant we are matching against // could change its value! diff --git a/tests/ui/consts/const_refs_to_static_fail_invalid.stderr b/tests/ui/consts/const_refs_to_static_fail_invalid.stderr index 35051557b61..082f8532444 100644 --- a/tests/ui/consts/const_refs_to_static_fail_invalid.stderr +++ b/tests/ui/consts/const_refs_to_static_fail_invalid.stderr @@ -1,20 +1,5 @@ -warning: shared reference of mutable static is discouraged - --> $DIR/const_refs_to_static_fail_invalid.rs:38:30 - | -LL | const C: &i32 = unsafe { &S_MUT }; - | ^^^^^^ shared reference of mutable static - | - = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447> - = note: reference of mutable static is a hard error from 2024 edition - = note: mutable statics can be written to by multiple threads: aliasing violations or data races will cause undefined behavior - = note: `#[warn(static_mut_ref)]` on by default -help: shared references are dangerous since if there's any kind of mutation of that static while the reference lives, that's UB; use `addr_of!` instead to create a raw pointer - | -LL | const C: &i32 = unsafe { addr_of!(S_MUT) }; - | ~~~~~~~~~~~~~~~ - error[E0080]: it is undefined behavior to use this value - --> $DIR/const_refs_to_static_fail_invalid.rs:8:5 + --> $DIR/const_refs_to_static_fail_invalid.rs:9:5 | LL | const C: &bool = unsafe { std::mem::transmute(&S) }; | ^^^^^^^^^^^^^^ constructing invalid value at .<deref>: encountered 0x0a, but expected a boolean @@ -25,13 +10,13 @@ LL | const C: &bool = unsafe { std::mem::transmute(&S) }; } error: could not evaluate constant pattern - --> $DIR/const_refs_to_static_fail_invalid.rs:14:9 + --> $DIR/const_refs_to_static_fail_invalid.rs:15:9 | LL | C => {} | ^ error[E0080]: it is undefined behavior to use this value - --> $DIR/const_refs_to_static_fail_invalid.rs:24:5 + --> $DIR/const_refs_to_static_fail_invalid.rs:25:5 | LL | const C: &i8 = unsafe { &S }; | ^^^^^^^^^^^^ constructing invalid value: encountered reference to `extern` static in `const` @@ -42,13 +27,13 @@ LL | const C: &i8 = unsafe { &S }; } error: could not evaluate constant pattern - --> $DIR/const_refs_to_static_fail_invalid.rs:30:9 + --> $DIR/const_refs_to_static_fail_invalid.rs:31:9 | LL | C => {} | ^ error[E0080]: it is undefined behavior to use this value - --> $DIR/const_refs_to_static_fail_invalid.rs:38:5 + --> $DIR/const_refs_to_static_fail_invalid.rs:39:5 | LL | const C: &i32 = unsafe { &S_MUT }; | ^^^^^^^^^^^^^ constructing invalid value: encountered reference to mutable memory in `const` @@ -64,6 +49,6 @@ error: could not evaluate constant pattern LL | C => {}, | ^ -error: aborting due to 6 previous errors; 1 warning emitted +error: aborting due to 6 previous errors For more information about this error, try `rustc --explain E0080`. diff --git a/tests/ui/consts/issue-17718-const-bad-values.rs b/tests/ui/consts/issue-17718-const-bad-values.rs index 2b593a192ee..0299bfef1b4 100644 --- a/tests/ui/consts/issue-17718-const-bad-values.rs +++ b/tests/ui/consts/issue-17718-const-bad-values.rs @@ -1,9 +1,10 @@ +#![allow(static_mut_ref)] + const C1: &'static mut [usize] = &mut []; //~^ ERROR: mutable references are not allowed static mut S: usize = 3; const C2: &'static mut usize = unsafe { &mut S }; //~^ ERROR: referencing statics in constants -//~| WARN mutable reference of mutable static is discouraged [static_mut_ref] fn main() {} diff --git a/tests/ui/consts/issue-17718-const-bad-values.stderr b/tests/ui/consts/issue-17718-const-bad-values.stderr index 92bab1ab53e..57fcb1c7e9a 100644 --- a/tests/ui/consts/issue-17718-const-bad-values.stderr +++ b/tests/ui/consts/issue-17718-const-bad-values.stderr @@ -1,26 +1,11 @@ -warning: mutable reference of mutable static is discouraged - --> $DIR/issue-17718-const-bad-values.rs:5:41 - | -LL | const C2: &'static mut usize = unsafe { &mut S }; - | ^^^^^^ mutable reference of mutable static - | - = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447> - = note: reference of mutable static is a hard error from 2024 edition - = note: mutable statics can be written to by multiple threads: aliasing violations or data races will cause undefined behavior - = note: `#[warn(static_mut_ref)]` on by default -help: mutable references are dangerous since if there's any other pointer or reference used for that static while the reference lives, that's UB; use `addr_of_mut!` instead to create a raw pointer - | -LL | const C2: &'static mut usize = unsafe { addr_of_mut!(S) }; - | ~~~~~~~~~~~~~~~ - error[E0764]: mutable references are not allowed in the final value of constants - --> $DIR/issue-17718-const-bad-values.rs:1:34 + --> $DIR/issue-17718-const-bad-values.rs:3:34 | LL | const C1: &'static mut [usize] = &mut []; | ^^^^^^^ error[E0658]: referencing statics in constants is unstable - --> $DIR/issue-17718-const-bad-values.rs:5:46 + --> $DIR/issue-17718-const-bad-values.rs:7:46 | LL | const C2: &'static mut usize = unsafe { &mut S }; | ^ @@ -31,7 +16,7 @@ LL | const C2: &'static mut usize = unsafe { &mut S }; = note: `static` and `const` variables can refer to other `const` variables. A `const` variable, however, cannot refer to a `static` variable. = help: to fix this, the value can be extracted to a `const` and then used. -error: aborting due to 2 previous errors; 1 warning emitted +error: aborting due to 2 previous errors Some errors have detailed explanations: E0658, E0764. For more information about an error, try `rustc --explain E0658`. diff --git a/tests/ui/issues/issue-44255.rs b/tests/ui/consts/issue-44255.rs index 22450320432..22450320432 100644 --- a/tests/ui/issues/issue-44255.rs +++ b/tests/ui/consts/issue-44255.rs diff --git a/tests/ui/consts/issue-89088.stderr b/tests/ui/consts/issue-89088.stderr index d5c5f76b90a..7cb85d5279d 100644 --- a/tests/ui/consts/issue-89088.stderr +++ b/tests/ui/consts/issue-89088.stderr @@ -9,9 +9,4 @@ LL | FOO => todo!(), = note: for more information, see issue #120362 <https://github.com/rust-lang/rust/issues/120362> = note: the traits must be derived, manual `impl`s are not sufficient = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details -note: the lint level is defined here - --> $DIR/issue-89088.rs:5:10 - | -LL | #![allow(indirect_structural_match)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.32bit.stderr b/tests/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.32bit.stderr index e280fe622ec..db7e8b6847a 100644 --- a/tests/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.32bit.stderr +++ b/tests/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.32bit.stderr @@ -1,20 +1,5 @@ -warning: shared reference of mutable static is discouraged - --> $DIR/const_refers_to_static_cross_crate.rs:12:14 - | -LL | unsafe { &static_cross_crate::ZERO } - | ^^^^^^^^^^^^^^^^^^^^^^^^^ shared reference of mutable static - | - = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447> - = note: reference of mutable static is a hard error from 2024 edition - = note: mutable statics can be written to by multiple threads: aliasing violations or data races will cause undefined behavior - = note: `#[warn(static_mut_ref)]` on by default -help: shared references are dangerous since if there's any kind of mutation of that static while the reference lives, that's UB; use `addr_of!` instead to create a raw pointer - | -LL | unsafe { addr_of!(static_cross_crate::ZERO) } - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - error[E0080]: it is undefined behavior to use this value - --> $DIR/const_refers_to_static_cross_crate.rs:10:1 + --> $DIR/const_refers_to_static_cross_crate.rs:11:1 | LL | const SLICE_MUT: &[u8; 1] = { | ^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered reference to mutable memory in `const` @@ -79,7 +64,7 @@ LL | U8_MUT3 => true, warning: skipping const checks | help: skipping check for `const_refs_to_static` feature - --> $DIR/const_refers_to_static_cross_crate.rs:12:15 + --> $DIR/const_refers_to_static_cross_crate.rs:13:15 | LL | unsafe { &static_cross_crate::ZERO } | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -99,6 +84,6 @@ help: skipping check for `const_refs_to_static` feature LL | match static_cross_crate::OPT_ZERO { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 8 previous errors; 2 warnings emitted +error: aborting due to 8 previous errors; 1 warning emitted For more information about this error, try `rustc --explain E0080`. diff --git a/tests/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.64bit.stderr b/tests/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.64bit.stderr index 9bca60485c0..200faf35587 100644 --- a/tests/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.64bit.stderr +++ b/tests/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.64bit.stderr @@ -1,20 +1,5 @@ -warning: shared reference of mutable static is discouraged - --> $DIR/const_refers_to_static_cross_crate.rs:12:14 - | -LL | unsafe { &static_cross_crate::ZERO } - | ^^^^^^^^^^^^^^^^^^^^^^^^^ shared reference of mutable static - | - = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447> - = note: reference of mutable static is a hard error from 2024 edition - = note: mutable statics can be written to by multiple threads: aliasing violations or data races will cause undefined behavior - = note: `#[warn(static_mut_ref)]` on by default -help: shared references are dangerous since if there's any kind of mutation of that static while the reference lives, that's UB; use `addr_of!` instead to create a raw pointer - | -LL | unsafe { addr_of!(static_cross_crate::ZERO) } - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - error[E0080]: it is undefined behavior to use this value - --> $DIR/const_refers_to_static_cross_crate.rs:10:1 + --> $DIR/const_refers_to_static_cross_crate.rs:11:1 | LL | const SLICE_MUT: &[u8; 1] = { | ^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered reference to mutable memory in `const` @@ -79,7 +64,7 @@ LL | U8_MUT3 => true, warning: skipping const checks | help: skipping check for `const_refs_to_static` feature - --> $DIR/const_refers_to_static_cross_crate.rs:12:15 + --> $DIR/const_refers_to_static_cross_crate.rs:13:15 | LL | unsafe { &static_cross_crate::ZERO } | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -99,6 +84,6 @@ help: skipping check for `const_refs_to_static` feature LL | match static_cross_crate::OPT_ZERO { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 8 previous errors; 2 warnings emitted +error: aborting due to 8 previous errors; 1 warning emitted For more information about this error, try `rustc --explain E0080`. diff --git a/tests/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.rs b/tests/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.rs index cdbfb37c7c7..bcd29f8b034 100644 --- a/tests/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.rs +++ b/tests/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.rs @@ -2,6 +2,7 @@ // aux-build:static_cross_crate.rs // stderr-per-bitwidth #![feature(exclusive_range_pattern, half_open_range_patterns_in_slices)] +#![allow(static_mut_ref)] extern crate static_cross_crate; @@ -10,7 +11,6 @@ extern crate static_cross_crate; const SLICE_MUT: &[u8; 1] = { //~ ERROR undefined behavior //~| encountered reference to mutable memory unsafe { &static_cross_crate::ZERO } - //~^ WARN shared reference of mutable static is discouraged [static_mut_ref] }; const U8_MUT: &u8 = { //~ ERROR undefined behavior diff --git a/tests/ui/consts/static_mut_containing_mut_ref.rs b/tests/ui/consts/static_mut_containing_mut_ref.rs index 874aa59df0b..495804649b1 100644 --- a/tests/ui/consts/static_mut_containing_mut_ref.rs +++ b/tests/ui/consts/static_mut_containing_mut_ref.rs @@ -1,8 +1,8 @@ // build-pass (FIXME(62277): could be check-pass?) +#![allow(static_mut_ref)] static mut STDERR_BUFFER_SPACE: [u8; 42] = [0u8; 42]; pub static mut STDERR_BUFFER: *mut [u8] = unsafe { &mut STDERR_BUFFER_SPACE }; -//~^ WARN mutable reference of mutable static is discouraged [static_mut_ref] fn main() {} diff --git a/tests/ui/consts/static_mut_containing_mut_ref.stderr b/tests/ui/consts/static_mut_containing_mut_ref.stderr deleted file mode 100644 index 56ceba41cf8..00000000000 --- a/tests/ui/consts/static_mut_containing_mut_ref.stderr +++ /dev/null @@ -1,17 +0,0 @@ -warning: mutable reference of mutable static is discouraged - --> $DIR/static_mut_containing_mut_ref.rs:5:52 - | -LL | pub static mut STDERR_BUFFER: *mut [u8] = unsafe { &mut STDERR_BUFFER_SPACE }; - | ^^^^^^^^^^^^^^^^^^^^^^^^ mutable reference of mutable static - | - = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447> - = note: reference of mutable static is a hard error from 2024 edition - = note: mutable statics can be written to by multiple threads: aliasing violations or data races will cause undefined behavior - = note: `#[warn(static_mut_ref)]` on by default -help: mutable references are dangerous since if there's any other pointer or reference used for that static while the reference lives, that's UB; use `addr_of_mut!` instead to create a raw pointer - | -LL | pub static mut STDERR_BUFFER: *mut [u8] = unsafe { addr_of_mut!(STDERR_BUFFER_SPACE) }; - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -warning: 1 warning emitted - diff --git a/tests/ui/consts/static_mut_containing_mut_ref2.mut_refs.stderr b/tests/ui/consts/static_mut_containing_mut_ref2.mut_refs.stderr index bc32ecc2c35..42cb119d2ae 100644 --- a/tests/ui/consts/static_mut_containing_mut_ref2.mut_refs.stderr +++ b/tests/ui/consts/static_mut_containing_mut_ref2.mut_refs.stderr @@ -1,24 +1,9 @@ -warning: mutable reference of mutable static is discouraged - --> $DIR/static_mut_containing_mut_ref2.rs:8:6 - | -LL | *(&mut STDERR_BUFFER_SPACE) = 42; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ mutable reference of mutable static - | - = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447> - = note: reference of mutable static is a hard error from 2024 edition - = note: mutable statics can be written to by multiple threads: aliasing violations or data races will cause undefined behavior - = note: `#[warn(static_mut_ref)]` on by default -help: mutable references are dangerous since if there's any other pointer or reference used for that static while the reference lives, that's UB; use `addr_of_mut!` instead to create a raw pointer - | -LL | *addr_of_mut!(STDERR_BUFFER_SPACE) = 42; - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - error[E0080]: could not evaluate static initializer --> $DIR/static_mut_containing_mut_ref2.rs:8:5 | LL | *(&mut STDERR_BUFFER_SPACE) = 42; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ modifying a static's initial value from another static's initializer -error: aborting due to 1 previous error; 1 warning emitted +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0080`. diff --git a/tests/ui/consts/static_mut_containing_mut_ref2.rs b/tests/ui/consts/static_mut_containing_mut_ref2.rs index b71f1122cd0..e60a17922fd 100644 --- a/tests/ui/consts/static_mut_containing_mut_ref2.rs +++ b/tests/ui/consts/static_mut_containing_mut_ref2.rs @@ -1,5 +1,5 @@ // revisions: stock mut_refs - +#![allow(static_mut_ref)] #![cfg_attr(mut_refs, feature(const_mut_refs))] static mut STDERR_BUFFER_SPACE: u8 = 0; @@ -8,8 +8,6 @@ pub static mut STDERR_BUFFER: () = unsafe { *(&mut STDERR_BUFFER_SPACE) = 42; //[mut_refs]~^ ERROR could not evaluate static initializer //[stock]~^^ ERROR mutation through a reference is not allowed in statics - //[mut_refs]~^^^ WARN mutable reference of mutable static is discouraged [static_mut_ref] - //[stock]~^^^^ WARN mutable reference of mutable static is discouraged [static_mut_ref] }; fn main() {} diff --git a/tests/ui/consts/static_mut_containing_mut_ref2.stock.stderr b/tests/ui/consts/static_mut_containing_mut_ref2.stock.stderr index aea5b8a33b5..5ff9c0b6e2b 100644 --- a/tests/ui/consts/static_mut_containing_mut_ref2.stock.stderr +++ b/tests/ui/consts/static_mut_containing_mut_ref2.stock.stderr @@ -1,18 +1,3 @@ -warning: mutable reference of mutable static is discouraged - --> $DIR/static_mut_containing_mut_ref2.rs:8:6 - | -LL | *(&mut STDERR_BUFFER_SPACE) = 42; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ mutable reference of mutable static - | - = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447> - = note: reference of mutable static is a hard error from 2024 edition - = note: mutable statics can be written to by multiple threads: aliasing violations or data races will cause undefined behavior - = note: `#[warn(static_mut_ref)]` on by default -help: mutable references are dangerous since if there's any other pointer or reference used for that static while the reference lives, that's UB; use `addr_of_mut!` instead to create a raw pointer - | -LL | *addr_of_mut!(STDERR_BUFFER_SPACE) = 42; - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - error[E0658]: mutation through a reference is not allowed in statics --> $DIR/static_mut_containing_mut_ref2.rs:8:5 | @@ -23,6 +8,6 @@ LL | *(&mut STDERR_BUFFER_SPACE) = 42; = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error: aborting due to 1 previous error; 1 warning emitted +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/cross/cross-fn-cache-hole.rs b/tests/ui/cross/cross-fn-cache-hole.rs index c38a5001ac8..4aa08ea2e17 100644 --- a/tests/ui/cross/cross-fn-cache-hole.rs +++ b/tests/ui/cross/cross-fn-cache-hole.rs @@ -28,4 +28,5 @@ fn require<A,B>() fn main() { require::<i32, u32>(); + //~^ ERROR `i32: Bar<u32>` is not satisfied } diff --git a/tests/ui/cross/cross-fn-cache-hole.stderr b/tests/ui/cross/cross-fn-cache-hole.stderr index ae944387f57..dec2f2553c2 100644 --- a/tests/ui/cross/cross-fn-cache-hole.stderr +++ b/tests/ui/cross/cross-fn-cache-hole.stderr @@ -12,6 +12,25 @@ LL | trait Bar<X> { } = help: see issue #48214 = help: add `#![feature(trivial_bounds)]` to the crate attributes to enable -error: aborting due to 1 previous error +error[E0277]: the trait bound `i32: Bar<u32>` is not satisfied + --> $DIR/cross-fn-cache-hole.rs:30:15 + | +LL | require::<i32, u32>(); + | ^^^ the trait `Bar<u32>` is not implemented for `i32` + | +help: this trait has no implementations, consider adding one + --> $DIR/cross-fn-cache-hole.rs:11:1 + | +LL | trait Bar<X> { } + | ^^^^^^^^^^^^ +note: required by a bound in `require` + --> $DIR/cross-fn-cache-hole.rs:25:14 + | +LL | fn require<A,B>() + | ------- required by a bound in this function +LL | where A: Bar<B> + | ^^^^^^ required by this bound in `require` + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/drop/drop_elaboration_with_errors.rs b/tests/ui/drop/drop_elaboration_with_errors.rs new file mode 100644 index 00000000000..77862762e87 --- /dev/null +++ b/tests/ui/drop/drop_elaboration_with_errors.rs @@ -0,0 +1,20 @@ +// can't use build-fail, because this also fails check-fail, but +// the ICE from #120787 only reproduces on build-fail. +// compile-flags: --emit=mir + +#![feature(type_alias_impl_trait)] + +struct Foo { + field: String, +} + +type Tait = impl Sized; + +fn ice_cold(beverage: Tait) { + let Foo { field } = beverage; + _ = field; +} + +fn main() { + Ok(()) //~ ERROR mismatched types +} diff --git a/tests/ui/drop/drop_elaboration_with_errors.stderr b/tests/ui/drop/drop_elaboration_with_errors.stderr new file mode 100644 index 00000000000..bec229631e1 --- /dev/null +++ b/tests/ui/drop/drop_elaboration_with_errors.stderr @@ -0,0 +1,14 @@ +error[E0308]: mismatched types + --> $DIR/drop_elaboration_with_errors.rs:19:5 + | +LL | fn main() { + | - expected `()` because of default return type +LL | Ok(()) + | ^^^^^^ expected `()`, found `Result<(), _>` + | + = note: expected unit type `()` + found enum `Result<(), _>` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/error-codes/E0038.rs b/tests/ui/error-codes/E0038.rs index 9757e2ab10c..a467767c3fa 100644 --- a/tests/ui/error-codes/E0038.rs +++ b/tests/ui/error-codes/E0038.rs @@ -5,6 +5,8 @@ trait Trait { fn call_foo(x: Box<dyn Trait>) { //~^ ERROR E0038 let y = x.foo(); + //~^ ERROR E0038 + //~| ERROR E0277 } fn main() { diff --git a/tests/ui/error-codes/E0038.stderr b/tests/ui/error-codes/E0038.stderr index 99130396e02..6e8eaab8ddf 100644 --- a/tests/ui/error-codes/E0038.stderr +++ b/tests/ui/error-codes/E0038.stderr @@ -13,6 +13,32 @@ LL | fn foo(&self) -> Self; | ^^^^ ...because method `foo` references the `Self` type in its return type = help: consider moving `foo` to another trait -error: aborting due to 1 previous error +error[E0038]: the trait `Trait` cannot be made into an object + --> $DIR/E0038.rs:7:13 + | +LL | let y = x.foo(); + | ^^^^^^^ `Trait` cannot be made into an object + | +note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + --> $DIR/E0038.rs:2:22 + | +LL | trait Trait { + | ----- this trait cannot be made into an object... +LL | fn foo(&self) -> Self; + | ^^^^ ...because method `foo` references the `Self` type in its return type + = help: consider moving `foo` to another trait + +error[E0277]: the size for values of type `dyn Trait` cannot be known at compilation time + --> $DIR/E0038.rs:7:9 + | +LL | let y = x.foo(); + | ^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `dyn Trait` + = note: all local variables must have a statically known size + = help: unsized locals are gated as an unstable feature + +error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0038`. +Some errors have detailed explanations: E0038, E0277. +For more information about an error, try `rustc --explain E0038`. diff --git a/tests/ui/error-codes/E0059.rs b/tests/ui/error-codes/E0059.rs index f775089bfb9..a04cc0cb2b9 100644 --- a/tests/ui/error-codes/E0059.rs +++ b/tests/ui/error-codes/E0059.rs @@ -1,6 +1,8 @@ #![feature(unboxed_closures)] fn foo<F: Fn<i32>>(f: F) -> F::Output { f(3) } //~ ERROR E0059 +//~^ ERROR `i32` is not a tuple +//~| ERROR cannot use call notation fn main() { } diff --git a/tests/ui/error-codes/E0059.stderr b/tests/ui/error-codes/E0059.stderr index a7591d2b04b..d26fadcdbfa 100644 --- a/tests/ui/error-codes/E0059.stderr +++ b/tests/ui/error-codes/E0059.stderr @@ -7,6 +7,19 @@ LL | fn foo<F: Fn<i32>>(f: F) -> F::Output { f(3) } note: required by a bound in `Fn` --> $SRC_DIR/core/src/ops/function.rs:LL:COL -error: aborting due to 1 previous error +error[E0277]: `i32` is not a tuple + --> $DIR/E0059.rs:3:41 + | +LL | fn foo<F: Fn<i32>>(f: F) -> F::Output { f(3) } + | ^^^^ the trait `Tuple` is not implemented for `i32` + +error[E0059]: cannot use call notation; the first type parameter for the function trait is neither a tuple nor unit + --> $DIR/E0059.rs:3:41 + | +LL | fn foo<F: Fn<i32>>(f: F) -> F::Output { f(3) } + | ^^^^ + +error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0059`. +Some errors have detailed explanations: E0059, E0277. +For more information about an error, try `rustc --explain E0059`. diff --git a/tests/ui/error-codes/E0229.rs b/tests/ui/error-codes/E0229.rs index b7cdb1737b0..558baae37f7 100644 --- a/tests/ui/error-codes/E0229.rs +++ b/tests/ui/error-codes/E0229.rs @@ -15,6 +15,7 @@ fn baz<I>(x: &<I as Foo<A=Bar>>::A) {} //~| ERROR associated type bindings are not allowed here [E0229] //~| ERROR associated type bindings are not allowed here [E0229] //~| ERROR the trait bound `I: Foo` is not satisfied +//~| ERROR the trait bound `I: Foo` is not satisfied fn main() { } diff --git a/tests/ui/error-codes/E0229.stderr b/tests/ui/error-codes/E0229.stderr index a7a2904bb89..bd8e1955ac6 100644 --- a/tests/ui/error-codes/E0229.stderr +++ b/tests/ui/error-codes/E0229.stderr @@ -31,7 +31,18 @@ help: consider restricting type parameter `I` LL | fn baz<I: Foo>(x: &<I as Foo<A=Bar>>::A) {} | +++++ -error: aborting due to 4 previous errors +error[E0277]: the trait bound `I: Foo` is not satisfied + --> $DIR/E0229.rs:13:37 + | +LL | fn baz<I>(x: &<I as Foo<A=Bar>>::A) {} + | ^^ the trait `Foo` is not implemented for `I` + | +help: consider restricting type parameter `I` + | +LL | fn baz<I: Foo>(x: &<I as Foo<A=Bar>>::A) {} + | +++++ + +error: aborting due to 5 previous errors Some errors have detailed explanations: E0229, E0277. For more information about an error, try `rustc --explain E0229`. diff --git a/tests/ui/issues/issue-18576.rs b/tests/ui/extern/issue-18576.rs index 389cf108b05..389cf108b05 100644 --- a/tests/ui/issues/issue-18576.rs +++ b/tests/ui/extern/issue-18576.rs diff --git a/tests/ui/issues/issue-18819.rs b/tests/ui/extern/issue-18819.rs index e634c55f824..e634c55f824 100644 --- a/tests/ui/issues/issue-18819.rs +++ b/tests/ui/extern/issue-18819.rs diff --git a/tests/ui/issues/issue-18819.stderr b/tests/ui/extern/issue-18819.stderr index b2cf0bad1df..b2cf0bad1df 100644 --- a/tests/ui/issues/issue-18819.stderr +++ b/tests/ui/extern/issue-18819.stderr diff --git a/tests/ui/extern/issue-36122-accessing-externed-dst.rs b/tests/ui/extern/issue-36122-accessing-externed-dst.rs index 5f886ff5737..9fb7780e3d7 100644 --- a/tests/ui/extern/issue-36122-accessing-externed-dst.rs +++ b/tests/ui/extern/issue-36122-accessing-externed-dst.rs @@ -3,4 +3,5 @@ fn main() { static symbol: [usize]; //~ ERROR: the size for values of type } println!("{}", symbol[0]); + //~^ ERROR: extern static is unsafe } diff --git a/tests/ui/extern/issue-36122-accessing-externed-dst.stderr b/tests/ui/extern/issue-36122-accessing-externed-dst.stderr index 25348b64002..64178e6f843 100644 --- a/tests/ui/extern/issue-36122-accessing-externed-dst.stderr +++ b/tests/ui/extern/issue-36122-accessing-externed-dst.stderr @@ -6,6 +6,15 @@ LL | static symbol: [usize]; | = help: the trait `Sized` is not implemented for `[usize]` -error: aborting due to 1 previous error +error[E0133]: use of extern static is unsafe and requires unsafe function or block + --> $DIR/issue-36122-accessing-externed-dst.rs:5:20 + | +LL | println!("{}", symbol[0]); + | ^^^^^^ use of extern static + | + = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior + +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0277`. +Some errors have detailed explanations: E0133, E0277. +For more information about an error, try `rustc --explain E0133`. diff --git a/tests/ui/issues/issue-23781.rs b/tests/ui/fmt/issue-23781.rs index 220ebdb1872..220ebdb1872 100644 --- a/tests/ui/issues/issue-23781.rs +++ b/tests/ui/fmt/issue-23781.rs diff --git a/tests/ui/fn/implied-bounds-unnorm-associated-type-5.rs b/tests/ui/fn/implied-bounds-unnorm-associated-type-5.rs index 2a9a6a8cc6c..a7489f6fbaf 100644 --- a/tests/ui/fn/implied-bounds-unnorm-associated-type-5.rs +++ b/tests/ui/fn/implied-bounds-unnorm-associated-type-5.rs @@ -18,6 +18,6 @@ where fn main() { let x = String::from("Hello World!"); let y = f(&x, ()); - drop(x); + drop(x); //~ ERROR cannot move out of `x` println!("{}", y); } diff --git a/tests/ui/fn/implied-bounds-unnorm-associated-type-5.stderr b/tests/ui/fn/implied-bounds-unnorm-associated-type-5.stderr index 4662eb32abb..bf6d77b6269 100644 --- a/tests/ui/fn/implied-bounds-unnorm-associated-type-5.stderr +++ b/tests/ui/fn/implied-bounds-unnorm-associated-type-5.stderr @@ -16,6 +16,19 @@ help: consider adding an explicit lifetime bound LL | impl<'a, T: 'a> Trait<'a> for T { | ++++ -error: aborting due to 1 previous error +error[E0505]: cannot move out of `x` because it is borrowed + --> $DIR/implied-bounds-unnorm-associated-type-5.rs:21:10 + | +LL | let x = String::from("Hello World!"); + | - binding `x` declared here +LL | let y = f(&x, ()); + | -- borrow of `x` occurs here +LL | drop(x); + | ^ move out of `x` occurs here +LL | println!("{}", y); + | - borrow later used here + +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0309`. +Some errors have detailed explanations: E0309, E0505. +For more information about an error, try `rustc --explain E0309`. diff --git a/tests/ui/generic-associated-types/equality-bound.rs b/tests/ui/generic-associated-types/equality-bound.rs index fcc2da8014f..be05181f5d0 100644 --- a/tests/ui/generic-associated-types/equality-bound.rs +++ b/tests/ui/generic-associated-types/equality-bound.rs @@ -12,4 +12,71 @@ fn sum3<J: Iterator>(i: J) -> i32 where I::Item = i32 { panic!() } +use std::iter::FromIterator; + +struct X {} + +impl FromIterator<bool> for X { + fn from_iter<T>(_: T) -> Self where T: IntoIterator, IntoIterator::Item = A, + //~^ ERROR equality constraints are not yet supported in `where` clauses + //~| ERROR cannot find type `A` in this scope + { + todo!() + } +} + +struct Y {} + +impl FromIterator<bool> for Y { + fn from_iter<T>(_: T) -> Self where T: IntoIterator, T::Item = A, + //~^ ERROR equality constraints are not yet supported in `where` clauses + //~| ERROR cannot find type `A` in this scope + { + todo!() + } +} + +struct Z {} + +impl FromIterator<bool> for Z { + fn from_iter<T: IntoIterator>(_: T) -> Self where IntoIterator::Item = A, + //~^ ERROR equality constraints are not yet supported in `where` clauses + //~| ERROR cannot find type `A` in this scope + { + todo!() + } +} + +struct K {} + +impl FromIterator<bool> for K { + fn from_iter<T: IntoIterator>(_: T) -> Self where T::Item = A, + //~^ ERROR equality constraints are not yet supported in `where` clauses + //~| ERROR cannot find type `A` in this scope + { + todo!() + } +} + +struct L {} + +impl FromIterator<bool> for L { + fn from_iter<T>(_: T) -> Self where IntoIterator::Item = A, T: IntoIterator, + //~^ ERROR equality constraints are not yet supported in `where` clauses + //~| ERROR cannot find type `A` in this scope + { + todo!() + } +} + +struct M {} + +impl FromIterator<bool> for M { + fn from_iter<T>(_: T) -> Self where T::Item = A, T: IntoIterator, + //~^ ERROR equality constraints are not yet supported in `where` clauses + //~| ERROR cannot find type `A` in this scope + { + todo!() + } +} fn main() {} diff --git a/tests/ui/generic-associated-types/equality-bound.stderr b/tests/ui/generic-associated-types/equality-bound.stderr index b21ff30a27d..a054c06caeb 100644 --- a/tests/ui/generic-associated-types/equality-bound.stderr +++ b/tests/ui/generic-associated-types/equality-bound.stderr @@ -8,7 +8,7 @@ LL | fn sum<I: Iterator<Item = ()>>(i: I) -> i32 where I::Item = i32 { help: if `Iterator::Item` is an associated type you're trying to set, use the associated type binding syntax | LL - fn sum<I: Iterator<Item = ()>>(i: I) -> i32 where I::Item = i32 { -LL + fn sum<I: Iterator<Item = (), Item = i32>>(i: I) -> i32 where { +LL + fn sum<I: Iterator<Item = (), Item = i32>>(i: I) -> i32 { | error: equality constraints are not yet supported in `where` clauses @@ -21,7 +21,7 @@ LL | fn sum2<I: Iterator>(i: I) -> i32 where I::Item = i32 { help: if `Iterator::Item` is an associated type you're trying to set, use the associated type binding syntax | LL - fn sum2<I: Iterator>(i: I) -> i32 where I::Item = i32 { -LL + fn sum2<I: Iterator<Item = i32>>(i: I) -> i32 where { +LL + fn sum2<I: Iterator<Item = i32>>(i: I) -> i32 { | error: equality constraints are not yet supported in `where` clauses @@ -32,6 +32,138 @@ LL | fn sum3<J: Iterator>(i: J) -> i32 where I::Item = i32 { | = note: see issue #20041 <https://github.com/rust-lang/rust/issues/20041> for more information +error: equality constraints are not yet supported in `where` clauses + --> $DIR/equality-bound.rs:20:58 + | +LL | fn from_iter<T>(_: T) -> Self where T: IntoIterator, IntoIterator::Item = A, + | ^^^^^^^^^^^^^^^^^^^^^^ not supported + | + = note: see issue #20041 <https://github.com/rust-lang/rust/issues/20041> for more information +help: if `IntoIterator::Item` is an associated type you're trying to set, use the associated type binding syntax + | +LL - fn from_iter<T>(_: T) -> Self where T: IntoIterator, IntoIterator::Item = A, +LL + fn from_iter<T>(_: T) -> Self where T: IntoIterator<Item = A>, + | + +error: equality constraints are not yet supported in `where` clauses + --> $DIR/equality-bound.rs:31:58 + | +LL | fn from_iter<T>(_: T) -> Self where T: IntoIterator, T::Item = A, + | ^^^^^^^^^^^ not supported + | + = note: see issue #20041 <https://github.com/rust-lang/rust/issues/20041> for more information +help: if `IntoIterator::Item` is an associated type you're trying to set, use the associated type binding syntax + | +LL - fn from_iter<T>(_: T) -> Self where T: IntoIterator, T::Item = A, +LL + fn from_iter<T>(_: T) -> Self where T: IntoIterator<Item = A>, + | + +error: equality constraints are not yet supported in `where` clauses + --> $DIR/equality-bound.rs:42:55 + | +LL | fn from_iter<T: IntoIterator>(_: T) -> Self where IntoIterator::Item = A, + | ^^^^^^^^^^^^^^^^^^^^^^ not supported + | + = note: see issue #20041 <https://github.com/rust-lang/rust/issues/20041> for more information +help: if `IntoIterator::Item` is an associated type you're trying to set, use the associated type binding syntax + | +LL - fn from_iter<T: IntoIterator>(_: T) -> Self where IntoIterator::Item = A, +LL + fn from_iter<T: IntoIterator<Item = A>>(_: T) -> Self + | + +error: equality constraints are not yet supported in `where` clauses + --> $DIR/equality-bound.rs:53:55 + | +LL | fn from_iter<T: IntoIterator>(_: T) -> Self where T::Item = A, + | ^^^^^^^^^^^ not supported + | + = note: see issue #20041 <https://github.com/rust-lang/rust/issues/20041> for more information +help: if `IntoIterator::Item` is an associated type you're trying to set, use the associated type binding syntax + | +LL - fn from_iter<T: IntoIterator>(_: T) -> Self where T::Item = A, +LL + fn from_iter<T: IntoIterator<Item = A>>(_: T) -> Self + | + +error: equality constraints are not yet supported in `where` clauses + --> $DIR/equality-bound.rs:64:41 + | +LL | fn from_iter<T>(_: T) -> Self where IntoIterator::Item = A, T: IntoIterator, + | ^^^^^^^^^^^^^^^^^^^^^^ not supported + | + = note: see issue #20041 <https://github.com/rust-lang/rust/issues/20041> for more information +help: if `IntoIterator::Item` is an associated type you're trying to set, use the associated type binding syntax + | +LL - fn from_iter<T>(_: T) -> Self where IntoIterator::Item = A, T: IntoIterator, +LL + fn from_iter<T>(_: T) -> Self where T: IntoIterator<Item = A>, + | + +error: equality constraints are not yet supported in `where` clauses + --> $DIR/equality-bound.rs:75:41 + | +LL | fn from_iter<T>(_: T) -> Self where T::Item = A, T: IntoIterator, + | ^^^^^^^^^^^ not supported + | + = note: see issue #20041 <https://github.com/rust-lang/rust/issues/20041> for more information +help: if `IntoIterator::Item` is an associated type you're trying to set, use the associated type binding syntax + | +LL - fn from_iter<T>(_: T) -> Self where T::Item = A, T: IntoIterator, +LL + fn from_iter<T>(_: T) -> Self where T: IntoIterator<Item = A>, + | + +error[E0412]: cannot find type `A` in this scope + --> $DIR/equality-bound.rs:20:79 + | +LL | fn from_iter<T>(_: T) -> Self where T: IntoIterator, IntoIterator::Item = A, + | ^ help: a struct with a similar name exists: `K` +... +LL | struct K {} + | -------- similarly named struct `K` defined here + +error[E0412]: cannot find type `A` in this scope + --> $DIR/equality-bound.rs:31:68 + | +LL | fn from_iter<T>(_: T) -> Self where T: IntoIterator, T::Item = A, + | ^ help: a struct with a similar name exists: `K` +... +LL | struct K {} + | -------- similarly named struct `K` defined here + +error[E0412]: cannot find type `A` in this scope + --> $DIR/equality-bound.rs:42:76 + | +LL | fn from_iter<T: IntoIterator>(_: T) -> Self where IntoIterator::Item = A, + | ^ help: a struct with a similar name exists: `K` +... +LL | struct K {} + | -------- similarly named struct `K` defined here + +error[E0412]: cannot find type `A` in this scope + --> $DIR/equality-bound.rs:53:65 + | +LL | struct K {} + | -------- similarly named struct `K` defined here +... +LL | fn from_iter<T: IntoIterator>(_: T) -> Self where T::Item = A, + | ^ help: a struct with a similar name exists: `K` + +error[E0412]: cannot find type `A` in this scope + --> $DIR/equality-bound.rs:64:62 + | +LL | struct K {} + | -------- similarly named struct `K` defined here +... +LL | fn from_iter<T>(_: T) -> Self where IntoIterator::Item = A, T: IntoIterator, + | ^ help: a struct with a similar name exists: `K` + +error[E0412]: cannot find type `A` in this scope + --> $DIR/equality-bound.rs:75:51 + | +LL | struct K {} + | -------- similarly named struct `K` defined here +... +LL | fn from_iter<T>(_: T) -> Self where T::Item = A, T: IntoIterator, + | ^ help: a struct with a similar name exists: `K` + error[E0433]: failed to resolve: use of undeclared type `I` --> $DIR/equality-bound.rs:9:41 | @@ -41,6 +173,7 @@ LL | fn sum3<J: Iterator>(i: J) -> i32 where I::Item = i32 { | use of undeclared type `I` | help: a type parameter with a similar name exists: `J` -error: aborting due to 4 previous errors +error: aborting due to 16 previous errors -For more information about this error, try `rustc --explain E0433`. +Some errors have detailed explanations: E0412, E0433. +For more information about an error, try `rustc --explain E0412`. diff --git a/tests/ui/generic-associated-types/gat-in-trait-path.base.stderr b/tests/ui/generic-associated-types/gat-in-trait-path.base.stderr index e05c83ebc76..4205c5c5ef7 100644 --- a/tests/ui/generic-associated-types/gat-in-trait-path.base.stderr +++ b/tests/ui/generic-associated-types/gat-in-trait-path.base.stderr @@ -16,6 +16,43 @@ LL | type A<'a> where Self: 'a; Fooer<T> Fooy -error: aborting due to 1 previous error +error[E0038]: the trait `Foo` cannot be made into an object + --> $DIR/gat-in-trait-path.rs:32:5 + | +LL | f(Box::new(foo)); + | ^^^^^^^^^^^^^ `Foo` cannot be made into an object + | +note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + --> $DIR/gat-in-trait-path.rs:10:10 + | +LL | trait Foo { + | --- this trait cannot be made into an object... +LL | type A<'a> where Self: 'a; + | ^ ...because it contains the generic associated type `A` + = help: consider moving `A` to another trait + = help: the following types implement the trait, consider defining an enum where each variant holds one of these types, implementing `Foo` for this new enum and using it instead: + Fooer<T> + Fooy + +error[E0038]: the trait `Foo` cannot be made into an object + --> $DIR/gat-in-trait-path.rs:32:5 + | +LL | f(Box::new(foo)); + | ^^^^^^^^^^^^^ `Foo` cannot be made into an object + | +note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + --> $DIR/gat-in-trait-path.rs:10:10 + | +LL | trait Foo { + | --- this trait cannot be made into an object... +LL | type A<'a> where Self: 'a; + | ^ ...because it contains the generic associated type `A` + = help: consider moving `A` to another trait + = help: the following types implement the trait, consider defining an enum where each variant holds one of these types, implementing `Foo` for this new enum and using it instead: + Fooer<T> + Fooy + = note: required for the cast from `Box<Fooer<{integer}>>` to `Box<(dyn Foo<A = &'a ()> + 'static)>` + +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0038`. diff --git a/tests/ui/generic-associated-types/gat-in-trait-path.rs b/tests/ui/generic-associated-types/gat-in-trait-path.rs index c55f5a726bd..c1ce7d69f10 100644 --- a/tests/ui/generic-associated-types/gat-in-trait-path.rs +++ b/tests/ui/generic-associated-types/gat-in-trait-path.rs @@ -30,4 +30,6 @@ fn f(_arg : Box<dyn for<'a> Foo<A<'a> = &'a ()>>) {} fn main() { let foo = Fooer(5); f(Box::new(foo)); + //[base]~^ the trait `Foo` cannot be made into an object + //[base]~| the trait `Foo` cannot be made into an object } diff --git a/tests/ui/generic-associated-types/gat-trait-path-missing-lifetime.rs b/tests/ui/generic-associated-types/gat-trait-path-missing-lifetime.rs index 285493132b6..671d17f36f1 100644 --- a/tests/ui/generic-associated-types/gat-trait-path-missing-lifetime.rs +++ b/tests/ui/generic-associated-types/gat-trait-path-missing-lifetime.rs @@ -9,6 +9,7 @@ impl<T> X for T { //~ ERROR: not all trait items implemented //~^ ERROR missing generics for associated type //~^^ ERROR missing generics for associated type //~| ERROR method `foo` has 1 type parameter but its trait declaration has 0 type parameters + //~| ERROR may not live long enough t } } diff --git a/tests/ui/generic-associated-types/gat-trait-path-missing-lifetime.stderr b/tests/ui/generic-associated-types/gat-trait-path-missing-lifetime.stderr index 74ce93a613c..8589d008a6b 100644 --- a/tests/ui/generic-associated-types/gat-trait-path-missing-lifetime.stderr +++ b/tests/ui/generic-associated-types/gat-trait-path-missing-lifetime.stderr @@ -51,7 +51,16 @@ LL | type Y<'a>; LL | impl<T> X for T { | ^^^^^^^^^^^^^^^ missing `Y` in implementation -error: aborting due to 4 previous errors +error: lifetime may not live long enough + --> $DIR/gat-trait-path-missing-lifetime.rs:8:3 + | +LL | fn foo<'a, T1: X<Y = T1>>(t : T1) -> T1::Y<'a> { + | ^^^^^^^--^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | | | + | | lifetime `'a` defined here + | requires that `'a` must outlive `'static` + +error: aborting due to 5 previous errors Some errors have detailed explanations: E0046, E0049, E0107. For more information about an error, try `rustc --explain E0046`. diff --git a/tests/ui/generic-associated-types/trait-objects.base.stderr b/tests/ui/generic-associated-types/trait-objects.base.stderr index e3cfd46524e..2b5060289ab 100644 --- a/tests/ui/generic-associated-types/trait-objects.base.stderr +++ b/tests/ui/generic-associated-types/trait-objects.base.stderr @@ -13,6 +13,36 @@ LL | type Item<'a> where Self: 'a; | ^^^^ ...because it contains the generic associated type `Item` = help: consider moving `Item` to another trait -error: aborting due to 1 previous error +error[E0038]: the trait `StreamingIterator` cannot be made into an object + --> $DIR/trait-objects.rs:15:7 + | +LL | x.size_hint().0 + | ^^^^^^^^^ `StreamingIterator` cannot be made into an object + | +note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + --> $DIR/trait-objects.rs:7:10 + | +LL | trait StreamingIterator { + | ----------------- this trait cannot be made into an object... +LL | type Item<'a> where Self: 'a; + | ^^^^ ...because it contains the generic associated type `Item` + = help: consider moving `Item` to another trait + +error[E0038]: the trait `StreamingIterator` cannot be made into an object + --> $DIR/trait-objects.rs:15:5 + | +LL | x.size_hint().0 + | ^^^^^^^^^^^^^ `StreamingIterator` cannot be made into an object + | +note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + --> $DIR/trait-objects.rs:7:10 + | +LL | trait StreamingIterator { + | ----------------- this trait cannot be made into an object... +LL | type Item<'a> where Self: 'a; + | ^^^^ ...because it contains the generic associated type `Item` + = help: consider moving `Item` to another trait + +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0038`. diff --git a/tests/ui/generic-associated-types/trait-objects.rs b/tests/ui/generic-associated-types/trait-objects.rs index 17fed11bac3..674bee919bf 100644 --- a/tests/ui/generic-associated-types/trait-objects.rs +++ b/tests/ui/generic-associated-types/trait-objects.rs @@ -14,6 +14,8 @@ fn min_size(x: &mut dyn for<'a> StreamingIterator<Item<'a> = &'a i32>) -> usize //[base]~^ the trait `StreamingIterator` cannot be made into an object x.size_hint().0 //[extended]~^ borrowed data escapes + //[base]~^^ the trait `StreamingIterator` cannot be made into an object + //[base]~| the trait `StreamingIterator` cannot be made into an object } fn main() {} diff --git a/tests/ui/issues/issue-29746.rs b/tests/ui/hygiene/issue-29746.rs index 3470a7e09ad..3470a7e09ad 100644 --- a/tests/ui/issues/issue-29746.rs +++ b/tests/ui/hygiene/issue-29746.rs diff --git a/tests/ui/impl-trait/in-trait/default-body-type-err-2.stderr b/tests/ui/impl-trait/in-trait/default-body-type-err-2.stderr index 77f6945f064..9fa73d817ca 100644 --- a/tests/ui/impl-trait/in-trait/default-body-type-err-2.stderr +++ b/tests/ui/impl-trait/in-trait/default-body-type-err-2.stderr @@ -1,6 +1,8 @@ error[E0308]: mismatched types --> $DIR/default-body-type-err-2.rs:7:9 | +LL | async fn woopsie_async(&self) -> String { + | ------ expected `String` because of return type LL | 42 | ^^- help: try using a conversion method: `.to_string()` | | diff --git a/tests/ui/impl-trait/object-unsafe-trait-in-return-position-dyn-trait.rs b/tests/ui/impl-trait/object-unsafe-trait-in-return-position-dyn-trait.rs index ab3086c78b3..068f7d3eea6 100644 --- a/tests/ui/impl-trait/object-unsafe-trait-in-return-position-dyn-trait.rs +++ b/tests/ui/impl-trait/object-unsafe-trait-in-return-position-dyn-trait.rs @@ -19,6 +19,7 @@ impl NotObjectSafe for B { } fn car() -> dyn NotObjectSafe { //~ ERROR the trait `NotObjectSafe` cannot be made into an object +//~^ ERROR return type cannot have an unboxed trait object if true { return A; } @@ -27,9 +28,9 @@ fn car() -> dyn NotObjectSafe { //~ ERROR the trait `NotObjectSafe` cannot be ma fn cat() -> Box<dyn NotObjectSafe> { //~ ERROR the trait `NotObjectSafe` cannot be made into an if true { - return Box::new(A); + return Box::new(A); //~ ERROR cannot be made into an object } - Box::new(B) + Box::new(B) //~ ERROR cannot be made into an object } fn main() {} diff --git a/tests/ui/impl-trait/object-unsafe-trait-in-return-position-dyn-trait.stderr b/tests/ui/impl-trait/object-unsafe-trait-in-return-position-dyn-trait.stderr index 37c96d9bc4e..fc9c30abf13 100644 --- a/tests/ui/impl-trait/object-unsafe-trait-in-return-position-dyn-trait.stderr +++ b/tests/ui/impl-trait/object-unsafe-trait-in-return-position-dyn-trait.stderr @@ -24,7 +24,7 @@ LL | fn foo() -> Self where Self: Sized; | +++++++++++++++++ error[E0038]: the trait `NotObjectSafe` cannot be made into an object - --> $DIR/object-unsafe-trait-in-return-position-dyn-trait.rs:28:17 + --> $DIR/object-unsafe-trait-in-return-position-dyn-trait.rs:29:17 | LL | fn cat() -> Box<dyn NotObjectSafe> { | ^^^^^^^^^^^^^^^^^ `NotObjectSafe` cannot be made into an object @@ -48,6 +48,79 @@ help: alternatively, consider constraining `foo` so it does not apply to trait o LL | fn foo() -> Self where Self: Sized; | +++++++++++++++++ -error: aborting due to 2 previous errors +error[E0746]: return type cannot have an unboxed trait object + --> $DIR/object-unsafe-trait-in-return-position-dyn-trait.rs:21:13 + | +LL | fn car() -> dyn NotObjectSafe { + | ^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time + | +help: return an `impl Trait` instead of a `dyn Trait`, if all returned values are the same type + | +LL | fn car() -> impl NotObjectSafe { + | ~~~~ +help: box the return type, and wrap all of the returned values in `Box::new` + | +LL ~ fn car() -> Box<dyn NotObjectSafe> { +LL | +LL | if true { +LL ~ return Box::new(A); +LL | } +LL ~ Box::new(B) + | + +error[E0038]: the trait `NotObjectSafe` cannot be made into an object + --> $DIR/object-unsafe-trait-in-return-position-dyn-trait.rs:31:16 + | +LL | return Box::new(A); + | ^^^^^^^^^^^ `NotObjectSafe` cannot be made into an object + | +note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + --> $DIR/object-unsafe-trait-in-return-position-dyn-trait.rs:3:8 + | +LL | trait NotObjectSafe { + | ------------- this trait cannot be made into an object... +LL | fn foo() -> Self; + | ^^^ ...because associated function `foo` has no `self` parameter + = help: the following types implement the trait, consider defining an enum where each variant holds one of these types, implementing `NotObjectSafe` for this new enum and using it instead: + A + B + = note: required for the cast from `Box<A>` to `Box<(dyn NotObjectSafe + 'static)>` +help: consider turning `foo` into a method by giving it a `&self` argument + | +LL | fn foo(&self) -> Self; + | +++++ +help: alternatively, consider constraining `foo` so it does not apply to trait objects + | +LL | fn foo() -> Self where Self: Sized; + | +++++++++++++++++ + +error[E0038]: the trait `NotObjectSafe` cannot be made into an object + --> $DIR/object-unsafe-trait-in-return-position-dyn-trait.rs:33:5 + | +LL | Box::new(B) + | ^^^^^^^^^^^ `NotObjectSafe` cannot be made into an object + | +note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + --> $DIR/object-unsafe-trait-in-return-position-dyn-trait.rs:3:8 + | +LL | trait NotObjectSafe { + | ------------- this trait cannot be made into an object... +LL | fn foo() -> Self; + | ^^^ ...because associated function `foo` has no `self` parameter + = help: the following types implement the trait, consider defining an enum where each variant holds one of these types, implementing `NotObjectSafe` for this new enum and using it instead: + A + B + = note: required for the cast from `Box<B>` to `Box<(dyn NotObjectSafe + 'static)>` +help: consider turning `foo` into a method by giving it a `&self` argument + | +LL | fn foo(&self) -> Self; + | +++++ +help: alternatively, consider constraining `foo` so it does not apply to trait objects + | +LL | fn foo() -> Self where Self: Sized; + | +++++++++++++++++ + +error: aborting due to 5 previous errors -For more information about this error, try `rustc --explain E0038`. +Some errors have detailed explanations: E0038, E0746. +For more information about an error, try `rustc --explain E0038`. diff --git a/tests/ui/impl-trait/recursive-coroutine-boxed.next.stderr b/tests/ui/impl-trait/recursive-coroutine-boxed.next.stderr new file mode 100644 index 00000000000..fee3b86034a --- /dev/null +++ b/tests/ui/impl-trait/recursive-coroutine-boxed.next.stderr @@ -0,0 +1,23 @@ +error[E0282]: type annotations needed + --> $DIR/recursive-coroutine-boxed.rs:10:23 + | +LL | let mut gen = Box::pin(foo()); + | ^^^^^^^^ cannot infer type of the type parameter `T` declared on the struct `Box` +... +LL | let mut r = gen.as_mut().resume(()); + | ------ type must be known at this point + | +help: consider specifying the generic argument + | +LL | let mut gen = Box::<T>::pin(foo()); + | +++++ + +error[E0282]: type annotations needed + --> $DIR/recursive-coroutine-boxed.rs:10:32 + | +LL | let mut gen = Box::pin(foo()); + | ^^^^^ cannot infer type for opaque type `impl Coroutine<Yield = (), Return = ()>` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/impl-trait/recursive-coroutine-boxed.rs b/tests/ui/impl-trait/recursive-coroutine-boxed.rs index b9291f07e21..3f677986c13 100644 --- a/tests/ui/impl-trait/recursive-coroutine-boxed.rs +++ b/tests/ui/impl-trait/recursive-coroutine-boxed.rs @@ -1,5 +1,5 @@ -// check-pass // revisions: current next +//[current] check-pass //[next] compile-flags: -Znext-solver #![feature(coroutines, coroutine_trait)] @@ -8,6 +8,8 @@ use std::ops::{Coroutine, CoroutineState}; fn foo() -> impl Coroutine<Yield = (), Return = ()> { || { let mut gen = Box::pin(foo()); + //[next]~^ ERROR type annotations needed + //[next]~| ERROR type annotations needed let mut r = gen.as_mut().resume(()); while let CoroutineState::Yielded(v) = r { yield v; diff --git a/tests/ui/impl-trait/two_tait_defining_each_other2.next.stderr b/tests/ui/impl-trait/two_tait_defining_each_other2.next.stderr index e49d1d18b0c..69328e20583 100644 --- a/tests/ui/impl-trait/two_tait_defining_each_other2.next.stderr +++ b/tests/ui/impl-trait/two_tait_defining_each_other2.next.stderr @@ -1,8 +1,8 @@ -error[E0284]: type annotations needed: cannot satisfy `A <: B` +error[E0284]: type annotations needed: cannot satisfy `A == B` --> $DIR/two_tait_defining_each_other2.rs:11:5 | LL | x // B's hidden type is A (opaquely) - | ^ cannot satisfy `A <: B` + | ^ cannot satisfy `A == B` error: aborting due to 1 previous error diff --git a/tests/ui/impl-trait/two_tait_defining_each_other2.rs b/tests/ui/impl-trait/two_tait_defining_each_other2.rs index 8a79af19776..b2f768f4dcd 100644 --- a/tests/ui/impl-trait/two_tait_defining_each_other2.rs +++ b/tests/ui/impl-trait/two_tait_defining_each_other2.rs @@ -10,7 +10,7 @@ trait Foo {} fn muh(x: A) -> B { x // B's hidden type is A (opaquely) //[current]~^ ERROR opaque type's hidden type cannot be another opaque type - //[next]~^^ ERROR type annotations needed: cannot satisfy `A <: B` + //[next]~^^ ERROR type annotations needed: cannot satisfy `A == B` } struct Bar; diff --git a/tests/ui/implied-bounds/hrlt-implied-trait-bounds-guard.rs b/tests/ui/implied-bounds/hrlt-implied-trait-bounds-guard.rs index 27c8f30ec32..eba4ecd3a28 100644 --- a/tests/ui/implied-bounds/hrlt-implied-trait-bounds-guard.rs +++ b/tests/ui/implied-bounds/hrlt-implied-trait-bounds-guard.rs @@ -29,16 +29,19 @@ impl<'long: 'short, 'short, T> Convert<'long, 'short> for T { fn badboi<'in_, 'out, T>(x: Foo<'in_, 'out, T>, sadness: &'in_ T) -> &'out T { //~^ ERROR lifetime mismatch sadness.cast() + //~^ ERROR may not live long enough } fn badboi2<'in_, 'out, T>(x: Foo<'in_, 'out, T>, sadness: &'in_ T) { //~^ ERROR lifetime mismatch let _: &'out T = sadness.cast(); + //~^ ERROR may not live long enough } fn badboi3<'in_, 'out, T>(a: Foo<'in_, 'out, (&'in_ T, &'out T)>, sadness: &'in_ T) { //~^ ERROR lifetime mismatch let _: &'out T = sadness.cast(); + //~^ ERROR may not live long enough } fn bad<'short, T>(value: &'short T) -> &'static T { diff --git a/tests/ui/implied-bounds/hrlt-implied-trait-bounds-guard.stderr b/tests/ui/implied-bounds/hrlt-implied-trait-bounds-guard.stderr index 0c00bbc380e..c9dc820fd60 100644 --- a/tests/ui/implied-bounds/hrlt-implied-trait-bounds-guard.stderr +++ b/tests/ui/implied-bounds/hrlt-implied-trait-bounds-guard.stderr @@ -8,7 +8,7 @@ LL | fn badboi<'in_, 'out, T>(x: Foo<'in_, 'out, T>, sadness: &'in_ T) -> &'out | ...but data from `x` is returned here error[E0623]: lifetime mismatch - --> $DIR/hrlt-implied-trait-bounds-guard.rs:34:30 + --> $DIR/hrlt-implied-trait-bounds-guard.rs:35:30 | LL | fn badboi2<'in_, 'out, T>(x: Foo<'in_, 'out, T>, sadness: &'in_ T) { | ^^^^^^^^^^^^^^^^^^ @@ -17,7 +17,7 @@ LL | fn badboi2<'in_, 'out, T>(x: Foo<'in_, 'out, T>, sadness: &'in_ T) { | ...but data with one lifetime flows into the other here error[E0623]: lifetime mismatch - --> $DIR/hrlt-implied-trait-bounds-guard.rs:39:30 + --> $DIR/hrlt-implied-trait-bounds-guard.rs:41:30 | LL | fn badboi3<'in_, 'out, T>(a: Foo<'in_, 'out, (&'in_ T, &'out T)>, sadness: &'in_ T) { | ^^^^^^^^^^^^^^^^^-------^^-------^^ @@ -25,6 +25,45 @@ LL | fn badboi3<'in_, 'out, T>(a: Foo<'in_, 'out, (&'in_ T, &'out T)>, sadness: | | these two types are declared with different lifetimes... | ...but data from `a` flows into `a` here -error: aborting due to 3 previous errors +error: lifetime may not live long enough + --> $DIR/hrlt-implied-trait-bounds-guard.rs:31:5 + | +LL | fn badboi<'in_, 'out, T>(x: Foo<'in_, 'out, T>, sadness: &'in_ T) -> &'out T { + | ---- ---- lifetime `'out` defined here + | | + | lifetime `'in_` defined here +LL | +LL | sadness.cast() + | ^^^^^^^^^^^^^^ function was supposed to return data with lifetime `'out` but it is returning data with lifetime `'in_` + | + = help: consider adding the following bound: `'in_: 'out` + +error: lifetime may not live long enough + --> $DIR/hrlt-implied-trait-bounds-guard.rs:37:12 + | +LL | fn badboi2<'in_, 'out, T>(x: Foo<'in_, 'out, T>, sadness: &'in_ T) { + | ---- ---- lifetime `'out` defined here + | | + | lifetime `'in_` defined here +LL | +LL | let _: &'out T = sadness.cast(); + | ^^^^^^^ type annotation requires that `'in_` must outlive `'out` + | + = help: consider adding the following bound: `'in_: 'out` + +error: lifetime may not live long enough + --> $DIR/hrlt-implied-trait-bounds-guard.rs:43:12 + | +LL | fn badboi3<'in_, 'out, T>(a: Foo<'in_, 'out, (&'in_ T, &'out T)>, sadness: &'in_ T) { + | ---- ---- lifetime `'out` defined here + | | + | lifetime `'in_` defined here +LL | +LL | let _: &'out T = sadness.cast(); + | ^^^^^^^ type annotation requires that `'in_` must outlive `'out` + | + = help: consider adding the following bound: `'in_: 'out` + +error: aborting due to 6 previous errors For more information about this error, try `rustc --explain E0623`. diff --git a/tests/ui/inference/issue-107090.rs b/tests/ui/inference/issue-107090.rs index 799c3641833..d1c86fb03d7 100644 --- a/tests/ui/inference/issue-107090.rs +++ b/tests/ui/inference/issue-107090.rs @@ -19,7 +19,7 @@ impl<'long: 'short, 'short, T> Convert<'long, 'b> for Foo<'short, 'out, T> { fn badboi<'in_, 'out, T>(x: Foo<'in_, 'out, T>, sadness: &'in_ Foo<'short, 'out, T>) -> &'out T { //~^ ERROR use of undeclared lifetime name - sadness.cast() + sadness.cast() //~ ERROR: mismatched types } fn main() {} diff --git a/tests/ui/inference/issue-107090.stderr b/tests/ui/inference/issue-107090.stderr index e509e262fb1..55825f7765b 100644 --- a/tests/ui/inference/issue-107090.stderr +++ b/tests/ui/inference/issue-107090.stderr @@ -66,6 +66,19 @@ LL | fn badboi<'in_, 'out, T>(x: Foo<'in_, 'out, T>, sadness: &'in_ Foo<'short, | | | help: consider introducing lifetime `'short` here: `'short,` -error: aborting due to 6 previous errors +error[E0308]: mismatched types + --> $DIR/issue-107090.rs:22:5 + | +LL | fn badboi<'in_, 'out, T>(x: Foo<'in_, 'out, T>, sadness: &'in_ Foo<'short, 'out, T>) -> &'out T { + | - expected this type parameter ------- expected `&'out T` because of return type +LL | +LL | sadness.cast() + | ^^^^^^^^^^^^^^ expected `&T`, found `&Foo<'_, '_, T>` + | + = note: expected reference `&'out T` + found reference `&Foo<'_, '_, T>` + +error: aborting due to 7 previous errors -For more information about this error, try `rustc --explain E0261`. +Some errors have detailed explanations: E0261, E0308. +For more information about an error, try `rustc --explain E0261`. diff --git a/tests/ui/issues/issue-12028.rs b/tests/ui/inference/issue-12028.rs index 7503766ff20..7503766ff20 100644 --- a/tests/ui/issues/issue-12028.rs +++ b/tests/ui/inference/issue-12028.rs diff --git a/tests/ui/issues/issue-12028.stderr b/tests/ui/inference/issue-12028.stderr index 3d7fb13d447..3d7fb13d447 100644 --- a/tests/ui/issues/issue-12028.stderr +++ b/tests/ui/inference/issue-12028.stderr diff --git a/tests/ui/issues/issue-18611.rs b/tests/ui/issues/issue-18611.rs index 91a765f34ef..57da57d8353 100644 --- a/tests/ui/issues/issue-18611.rs +++ b/tests/ui/issues/issue-18611.rs @@ -1,5 +1,6 @@ fn add_state(op: <isize as HasState>::State) { //~^ ERROR `isize: HasState` is not satisfied +//~| ERROR `isize: HasState` is not satisfied } trait HasState { diff --git a/tests/ui/issues/issue-18611.stderr b/tests/ui/issues/issue-18611.stderr index ab2374586e4..76848201f73 100644 --- a/tests/ui/issues/issue-18611.stderr +++ b/tests/ui/issues/issue-18611.stderr @@ -5,11 +5,27 @@ LL | fn add_state(op: <isize as HasState>::State) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `HasState` is not implemented for `isize` | help: this trait has no implementations, consider adding one - --> $DIR/issue-18611.rs:5:1 + --> $DIR/issue-18611.rs:6:1 | LL | trait HasState { | ^^^^^^^^^^^^^^ -error: aborting due to 1 previous error +error[E0277]: the trait bound `isize: HasState` is not satisfied + --> $DIR/issue-18611.rs:1:46 + | +LL | fn add_state(op: <isize as HasState>::State) { + | ______________________________________________^ +LL | | +LL | | +LL | | } + | |_^ the trait `HasState` is not implemented for `isize` + | +help: this trait has no implementations, consider adding one + --> $DIR/issue-18611.rs:6:1 + | +LL | trait HasState { + | ^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/issues/issue-18959.rs b/tests/ui/issues/issue-18959.rs index 4b6f04e251b..f4cab630f2e 100644 --- a/tests/ui/issues/issue-18959.rs +++ b/tests/ui/issues/issue-18959.rs @@ -11,10 +11,14 @@ impl Foo for Thing { fn foo(b: &dyn Bar) { //~^ ERROR E0038 b.foo(&0) + //~^ ERROR E0038 } fn main() { let mut thing = Thing; let test: &dyn Bar = &mut thing; + //~^ ERROR E0038 + //~| ERROR E0038 foo(test); + //~^ ERROR E0038 } diff --git a/tests/ui/issues/issue-18959.stderr b/tests/ui/issues/issue-18959.stderr index 76082dadd37..83d46f0331c 100644 --- a/tests/ui/issues/issue-18959.stderr +++ b/tests/ui/issues/issue-18959.stderr @@ -13,6 +13,67 @@ LL | pub trait Bar: Foo { } | --- this trait cannot be made into an object... = help: consider moving `foo` to another trait -error: aborting due to 1 previous error +error[E0038]: the trait `Bar` cannot be made into an object + --> $DIR/issue-18959.rs:13:5 + | +LL | b.foo(&0) + | ^^^^^^^^^ `Bar` cannot be made into an object + | +note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + --> $DIR/issue-18959.rs:1:20 + | +LL | pub trait Foo { fn foo<T>(&self, ext_thing: &T); } + | ^^^ ...because method `foo` has generic type parameters +LL | pub trait Bar: Foo { } + | --- this trait cannot be made into an object... + = help: consider moving `foo` to another trait + +error[E0038]: the trait `Bar` cannot be made into an object + --> $DIR/issue-18959.rs:19:15 + | +LL | let test: &dyn Bar = &mut thing; + | ^^^^^^^^ `Bar` cannot be made into an object + | +note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + --> $DIR/issue-18959.rs:1:20 + | +LL | pub trait Foo { fn foo<T>(&self, ext_thing: &T); } + | ^^^ ...because method `foo` has generic type parameters +LL | pub trait Bar: Foo { } + | --- this trait cannot be made into an object... + = help: consider moving `foo` to another trait + +error[E0038]: the trait `Bar` cannot be made into an object + --> $DIR/issue-18959.rs:19:26 + | +LL | let test: &dyn Bar = &mut thing; + | ^^^^^^^^^^ `Bar` cannot be made into an object + | +note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + --> $DIR/issue-18959.rs:1:20 + | +LL | pub trait Foo { fn foo<T>(&self, ext_thing: &T); } + | ^^^ ...because method `foo` has generic type parameters +LL | pub trait Bar: Foo { } + | --- this trait cannot be made into an object... + = help: consider moving `foo` to another trait + = note: required for the cast from `&mut Thing` to `&dyn Bar` + +error[E0038]: the trait `Bar` cannot be made into an object + --> $DIR/issue-18959.rs:22:9 + | +LL | foo(test); + | ^^^^ `Bar` cannot be made into an object + | +note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + --> $DIR/issue-18959.rs:1:20 + | +LL | pub trait Foo { fn foo<T>(&self, ext_thing: &T); } + | ^^^ ...because method `foo` has generic type parameters +LL | pub trait Bar: Foo { } + | --- this trait cannot be made into an object... + = help: consider moving `foo` to another trait + +error: aborting due to 5 previous errors For more information about this error, try `rustc --explain E0038`. diff --git a/tests/ui/issues/issue-20831-debruijn.rs b/tests/ui/issues/issue-20831-debruijn.rs index 20d980763ea..f3286af0ae5 100644 --- a/tests/ui/issues/issue-20831-debruijn.rs +++ b/tests/ui/issues/issue-20831-debruijn.rs @@ -28,6 +28,8 @@ impl<'a> Publisher<'a> for MyStruct<'a> { fn subscribe(&mut self, t : Box<dyn Subscriber<Input=<Self as Publisher>::Output> + 'a>) { // Not obvious, but there is an implicit lifetime here -------^ //~^^ ERROR cannot infer + //~| ERROR may not live long enough + //~| ERROR may not live long enough // // The fact that `Publisher` is using an implicit lifetime is // what was causing the debruijn accounting to be off, so diff --git a/tests/ui/issues/issue-20831-debruijn.stderr b/tests/ui/issues/issue-20831-debruijn.stderr index bd3ff5d59c6..7d1e19b7e47 100644 --- a/tests/ui/issues/issue-20831-debruijn.stderr +++ b/tests/ui/issues/issue-20831-debruijn.stderr @@ -22,6 +22,30 @@ LL | fn subscribe(&mut self, t : Box<dyn Subscriber<Input=<Self as Publisher = note: expected `<MyStruct<'a> as Publisher<'_>>` found `<MyStruct<'_> as Publisher<'_>>` -error: aborting due to 1 previous error +error: lifetime may not live long enough + --> $DIR/issue-20831-debruijn.rs:28:5 + | +LL | impl<'a> Publisher<'a> for MyStruct<'a> { + | -- lifetime `'a` defined here +LL | type Output = u64; +LL | fn subscribe(&mut self, t : Box<dyn Subscriber<Input=<Self as Publisher>::Output> + 'a>) { + | ^^^^^^^^^^^^^^^^^^^^^^^^-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | | | + | | has type `Box<dyn Subscriber<Input = <MyStruct<'_> as Publisher<'1>>::Output>>` + | requires that `'a` must outlive `'1` + +error: lifetime may not live long enough + --> $DIR/issue-20831-debruijn.rs:28:5 + | +LL | impl<'a> Publisher<'a> for MyStruct<'a> { + | -- lifetime `'a` defined here +LL | type Output = u64; +LL | fn subscribe(&mut self, t : Box<dyn Subscriber<Input=<Self as Publisher>::Output> + 'a>) { + | ^^^^^^^^^^^^^^^^^^^^^^^^-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | | | + | | has type `Box<dyn Subscriber<Input = <MyStruct<'_> as Publisher<'1>>::Output>>` + | requires that `'1` must outlive `'a` + +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0495`. diff --git a/tests/ui/issues/issue-21974.rs b/tests/ui/issues/issue-21974.rs index f7c659be148..24e92ce7b91 100644 --- a/tests/ui/issues/issue-21974.rs +++ b/tests/ui/issues/issue-21974.rs @@ -11,7 +11,7 @@ fn foo<'a,'b,T>(x: &'a T, y: &'b T) where &'a T : Foo, //~ ERROR type annotations needed &'b T : Foo { - x.foo(); + x.foo(); //~ ERROR type annotations needed y.foo(); } diff --git a/tests/ui/issues/issue-21974.stderr b/tests/ui/issues/issue-21974.stderr index 3934846ea02..cc9164e5621 100644 --- a/tests/ui/issues/issue-21974.stderr +++ b/tests/ui/issues/issue-21974.stderr @@ -12,6 +12,20 @@ LL | where &'a T : Foo, LL | &'b T : Foo | ^^^ -error: aborting due to 1 previous error +error[E0283]: type annotations needed: cannot satisfy `&T: Foo` + --> $DIR/issue-21974.rs:14:7 + | +LL | x.foo(); + | ^^^ + | +note: multiple `impl`s or `where` clauses satisfying `&T: Foo` found + --> $DIR/issue-21974.rs:11:19 + | +LL | where &'a T : Foo, + | ^^^ +LL | &'b T : Foo + | ^^^ + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0283`. diff --git a/tests/ui/issues/issue-22874.rs b/tests/ui/issues/issue-22874.rs index 37c6c814352..c4500aacb61 100644 --- a/tests/ui/issues/issue-22874.rs +++ b/tests/ui/issues/issue-22874.rs @@ -5,6 +5,7 @@ struct Table { fn f(table: &Table) -> &[String] { &table.rows[0] + //~^ ERROR the size for values of type } fn main() {} diff --git a/tests/ui/issues/issue-22874.stderr b/tests/ui/issues/issue-22874.stderr index 717ce72b9c1..29ddf9756ff 100644 --- a/tests/ui/issues/issue-22874.stderr +++ b/tests/ui/issues/issue-22874.stderr @@ -7,6 +7,15 @@ LL | rows: [[String]], = help: the trait `Sized` is not implemented for `[String]` = note: slice and array elements must have `Sized` type -error: aborting due to 1 previous error +error[E0277]: the size for values of type `[String]` cannot be known at compilation time + --> $DIR/issue-22874.rs:7:6 + | +LL | &table.rows[0] + | ^^^^^^^^^^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `[String]`, which is required by `[_]: Index<_>` + = note: required for `[[String]]` to implement `Index<_>` + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/issues/issue-27340.rs b/tests/ui/issues/issue-27340.rs index aff37d95a3f..53ca2bc973f 100644 --- a/tests/ui/issues/issue-27340.rs +++ b/tests/ui/issues/issue-27340.rs @@ -2,5 +2,6 @@ struct Foo; #[derive(Copy, Clone)] //~^ ERROR the trait `Copy` cannot be implemented for this type struct Bar(Foo); +//~^ ERROR `Foo: Clone` is not satisfied fn main() {} diff --git a/tests/ui/issues/issue-27340.stderr b/tests/ui/issues/issue-27340.stderr index 3353b83f4e5..61ae660f4cf 100644 --- a/tests/ui/issues/issue-27340.stderr +++ b/tests/ui/issues/issue-27340.stderr @@ -9,6 +9,25 @@ LL | struct Bar(Foo); | = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info) -error: aborting due to 1 previous error +error[E0277]: the trait bound `Foo: Clone` is not satisfied + --> $DIR/issue-27340.rs:4:12 + | +LL | #[derive(Copy, Clone)] + | ----- in this derive macro expansion +LL | +LL | struct Bar(Foo); + | ^^^ the trait `Clone` is not implemented for `Foo` + | +note: required by a bound in `AssertParamIsClone` + --> $SRC_DIR/core/src/clone.rs:LL:COL + = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) +help: consider annotating `Foo` with `#[derive(Clone)]` + | +LL + #[derive(Clone)] +LL | struct Foo; + | + +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0204`. +Some errors have detailed explanations: E0204, E0277. +For more information about an error, try `rustc --explain E0204`. diff --git a/tests/ui/issues/issue-35570.rs b/tests/ui/issues/issue-35570.rs index 42bdb423f8f..a2b0222d4f3 100644 --- a/tests/ui/issues/issue-35570.rs +++ b/tests/ui/issues/issue-35570.rs @@ -7,6 +7,7 @@ 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 f23b55689e3..0aa6b5e402e 100644 --- a/tests/ui/issues/issue-35570.stderr +++ b/tests/ui/issues/issue-35570.stderr @@ -10,6 +10,23 @@ help: this trait has no implementations, consider adding one LL | trait Trait2<'a> { | ^^^^^^^^^^^^^^^^ -error: aborting due to 1 previous error +error[E0277]: the trait bound `for<'a> (): Trait2<'a>` is not satisfied + --> $DIR/issue-35570.rs:8:66 + | +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 `()` + | +help: this trait has no implementations, consider adding one + --> $DIR/issue-35570.rs:4:1 + | +LL | trait Trait2<'a> { + | ^^^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/issues/issue-54410.rs b/tests/ui/issues/issue-54410.rs index e3e8ca985b9..51eea3ad9ac 100644 --- a/tests/ui/issues/issue-54410.rs +++ b/tests/ui/issues/issue-54410.rs @@ -5,4 +5,5 @@ extern "C" { fn main() { println!("{:p}", unsafe { &symbol }); + //~^ WARN: shared reference of mutable static is discouraged } diff --git a/tests/ui/issues/issue-54410.stderr b/tests/ui/issues/issue-54410.stderr index 97e5990750e..941c1be3eab 100644 --- a/tests/ui/issues/issue-54410.stderr +++ b/tests/ui/issues/issue-54410.stderr @@ -6,6 +6,21 @@ LL | pub static mut symbol: [i8]; | = help: the trait `Sized` is not implemented for `[i8]` -error: aborting due to 1 previous error +warning: shared reference of mutable static is discouraged + --> $DIR/issue-54410.rs:7:31 + | +LL | println!("{:p}", unsafe { &symbol }); + | ^^^^^^^ shared reference of mutable static + | + = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447> + = note: reference of mutable static is a hard error from 2024 edition + = note: mutable statics can be written to by multiple threads: aliasing violations or data races will cause undefined behavior + = note: `#[warn(static_mut_ref)]` on by default +help: shared references are dangerous since if there's any kind of mutation of that static while the reference lives, that's UB; use `addr_of!` instead to create a raw pointer + | +LL | println!("{:p}", unsafe { addr_of!(symbol) }); + | ~~~~~~~~~~~~~~~~ + +error: aborting due to 1 previous error; 1 warning emitted For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/issues/issue-7364.rs b/tests/ui/issues/issue-7364.rs index 79642bd411b..0608f902fde 100644 --- a/tests/ui/issues/issue-7364.rs +++ b/tests/ui/issues/issue-7364.rs @@ -3,5 +3,6 @@ use std::cell::RefCell; // Regression test for issue 7364 static boxed: Box<RefCell<isize>> = Box::new(RefCell::new(0)); //~^ ERROR `RefCell<isize>` cannot be shared between threads safely [E0277] +//~| ERROR cannot call non-const fn fn main() { } diff --git a/tests/ui/issues/issue-7364.stderr b/tests/ui/issues/issue-7364.stderr index 15cb2d875c1..3bf59a6d711 100644 --- a/tests/ui/issues/issue-7364.stderr +++ b/tests/ui/issues/issue-7364.stderr @@ -11,6 +11,16 @@ note: required because it appears within the type `Box<RefCell<isize>>` --> $SRC_DIR/alloc/src/boxed.rs:LL:COL = note: shared static variables must have a type that implements `Sync` -error: aborting due to 1 previous error +error[E0015]: cannot call non-const fn `Box::<RefCell<isize>>::new` in statics + --> $DIR/issue-7364.rs:4:37 + | +LL | static boxed: Box<RefCell<isize>> = Box::new(RefCell::new(0)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: calls in statics are limited to constant functions, tuple structs and tuple variants + = note: consider wrapping this expression in `Lazy::new(|| ...)` from the `once_cell` crate: https://crates.io/crates/once_cell + +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0277`. +Some errors have detailed explanations: E0015, E0277. +For more information about an error, try `rustc --explain E0015`. diff --git a/tests/ui/layout/cannot-transmute-unnormalizable-type.rs b/tests/ui/layout/cannot-transmute-unnormalizable-type.rs index 1a2ff8c4705..d2b6e1d8eba 100644 --- a/tests/ui/layout/cannot-transmute-unnormalizable-type.rs +++ b/tests/ui/layout/cannot-transmute-unnormalizable-type.rs @@ -16,8 +16,7 @@ struct Other { fn main() { unsafe { - // FIXME(oli-obk): make this report a transmute error again. std::mem::transmute::<Option<()>, Option<&Other>>(None); - //^ ERROR cannot transmute between types of different sizes, or dependently-sized types + //~^ ERROR cannot transmute between types of different sizes, or dependently-sized types } } diff --git a/tests/ui/layout/cannot-transmute-unnormalizable-type.stderr b/tests/ui/layout/cannot-transmute-unnormalizable-type.stderr index d17564a1eca..dd5119318ff 100644 --- a/tests/ui/layout/cannot-transmute-unnormalizable-type.stderr +++ b/tests/ui/layout/cannot-transmute-unnormalizable-type.stderr @@ -4,6 +4,16 @@ error[E0412]: cannot find type `Missing` in this scope LL | Missing: Trait, | ^^^^^^^ not found in this scope -error: aborting due to 1 previous error +error[E0512]: cannot transmute between types of different sizes, or dependently-sized types + --> $DIR/cannot-transmute-unnormalizable-type.rs:19:9 + | +LL | std::mem::transmute::<Option<()>, Option<&Other>>(None); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: source type: `Option<()>` (8 bits) + = note: target type: `Option<&Other>` (unable to determine layout for `Other` because `<() as Trait>::RefTarget` cannot be normalized) + +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0412`. +Some errors have detailed explanations: E0412, E0512. +For more information about an error, try `rustc --explain E0412`. diff --git a/tests/ui/issues/issue-19707.rs b/tests/ui/lifetimes/issue-19707.rs index 6bc7132af3c..6bc7132af3c 100644 --- a/tests/ui/issues/issue-19707.rs +++ b/tests/ui/lifetimes/issue-19707.rs diff --git a/tests/ui/issues/issue-19707.stderr b/tests/ui/lifetimes/issue-19707.stderr index 3e1bb32c19b..3e1bb32c19b 100644 --- a/tests/ui/issues/issue-19707.stderr +++ b/tests/ui/lifetimes/issue-19707.stderr diff --git a/tests/ui/lifetimes/issue-95023.rs b/tests/ui/lifetimes/issue-95023.rs index e35f1a36e2a..ee39a8c49c0 100644 --- a/tests/ui/lifetimes/issue-95023.rs +++ b/tests/ui/lifetimes/issue-95023.rs @@ -9,5 +9,6 @@ impl Fn(&isize) for Error { //~^ ERROR associated function in `impl` without body //~^^ ERROR method `foo` is not a member of trait `Fn` [E0407] //~^^^ ERROR associated type `B` not found for `Self` [E0220] + //~| ERROR associated type `B` not found for `Self` [E0220] } fn main() {} diff --git a/tests/ui/lifetimes/issue-95023.stderr b/tests/ui/lifetimes/issue-95023.stderr index b9c95d3e49a..0c67d7328f2 100644 --- a/tests/ui/lifetimes/issue-95023.stderr +++ b/tests/ui/lifetimes/issue-95023.stderr @@ -56,7 +56,15 @@ LL | impl Fn(&isize) for Error { | = help: implement the missing item: `fn call(&self, _: (&isize,)) -> <Self as FnOnce<(&isize,)>>::Output { todo!() }` -error: aborting due to 7 previous errors +error[E0220]: associated type `B` not found for `Self` + --> $DIR/issue-95023.rs:8:44 + | +LL | fn foo<const N: usize>(&self) -> Self::B<{ N }>; + | ^ help: `Self` has the following associated type: `Output` + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: aborting due to 8 previous errors Some errors have detailed explanations: E0046, E0183, E0220, E0229, E0277, E0407. For more information about an error, try `rustc --explain E0046`. diff --git a/tests/ui/lint/future-incompat-json-test.stderr b/tests/ui/lint/future-incompat-json-test.stderr index 18fc3f17f00..f33a5cab6ba 100644 --- a/tests/ui/lint/future-incompat-json-test.stderr +++ b/tests/ui/lint/future-incompat-json-test.stderr @@ -1,10 +1,7 @@ -{"$message_type":"future_incompat","future_incompat_report":[{"diagnostic":{"$message_type":"diagnostic","message":"unused variable: `x`","code":{"code":"unused_variables","explanation":null},"level":"warning","spans":[{"file_name":"$DIR/future-incompat-json-test.rs","byte_start":338,"byte_end":339,"line_start":9,"line_end":9,"column_start":9,"column_end":10,"is_primary":true,"text":[{"text":" let x = 1;","highlight_start":9,"highlight_end":10}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"`-A unused-variables` implied by `-A unused`","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"to override `-A unused` add `#[allow(unused_variables)]`","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"if this is intentional, prefix it with an underscore","code":null,"level":"help","spans":[{"file_name":"$DIR/future-incompat-json-test.rs","byte_start":338,"byte_end":339,"line_start":9,"line_end":9,"column_start":9,"column_end":10,"is_primary":true,"text":[{"text":" let x = 1;","highlight_start":9,"highlight_end":10}],"label":null,"suggested_replacement":"_x","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"warning: unused variable: `x` +{"$message_type":"future_incompat","future_incompat_report":[{"diagnostic":{"$message_type":"diagnostic","message":"unused variable: `x`","code":{"code":"unused_variables","explanation":null},"level":"warning","spans":[{"file_name":"$DIR/future-incompat-json-test.rs","byte_start":338,"byte_end":339,"line_start":9,"line_end":9,"column_start":9,"column_end":10,"is_primary":true,"text":[{"text":" let x = 1;","highlight_start":9,"highlight_end":10}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"if this is intentional, prefix it with an underscore","code":null,"level":"help","spans":[{"file_name":"$DIR/future-incompat-json-test.rs","byte_start":338,"byte_end":339,"line_start":9,"line_end":9,"column_start":9,"column_end":10,"is_primary":true,"text":[{"text":" let x = 1;","highlight_start":9,"highlight_end":10}],"label":null,"suggested_replacement":"_x","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"warning: unused variable: `x` --> $DIR/future-incompat-json-test.rs:9:9 | LL | let x = 1; | ^ help: if this is intentional, prefix it with an underscore: `_x` - | - = note: `-A unused-variables` implied by `-A unused` - = help: to override `-A unused` add `#[allow(unused_variables)]` "}}]} diff --git a/tests/ui/lint/future-incompat-test.stderr b/tests/ui/lint/future-incompat-test.stderr index 2951f904fb5..f24e1c7aba4 100644 --- a/tests/ui/lint/future-incompat-test.stderr +++ b/tests/ui/lint/future-incompat-test.stderr @@ -4,7 +4,4 @@ warning: unused variable: `x` | LL | let x = 1; | ^ help: if this is intentional, prefix it with an underscore: `_x` - | - = note: `-A unused-variables` implied by `-A unused` - = help: to override `-A unused` add `#[allow(unused_variables)]` diff --git a/tests/ui/lint/issue-121070-let-range.rs b/tests/ui/lint/issue-121070-let-range.rs new file mode 100644 index 00000000000..84598dcd258 --- /dev/null +++ b/tests/ui/lint/issue-121070-let-range.rs @@ -0,0 +1,16 @@ +// check-pass + +#![feature(let_chains)] +#![allow(irrefutable_let_patterns)] +fn main() { + let _a = 0..1; + + if let x = (0..1) { + eprintln!("x: {:?}", x); + } + if let x = (0..1) && + let _y = (0..2) + { + eprintln!("x: {:?}", x); + } +} diff --git a/tests/ui/issues/issue-19102.rs b/tests/ui/lint/issue-19102.rs index 1f32d10b644..1f32d10b644 100644 --- a/tests/ui/issues/issue-19102.rs +++ b/tests/ui/lint/issue-19102.rs diff --git a/tests/ui/lint/semicolon-in-expressions-from-macros/semicolon-in-expressions-from-macros.stderr b/tests/ui/lint/semicolon-in-expressions-from-macros/semicolon-in-expressions-from-macros.stderr index c6012006164..ea72ef84b9d 100644 --- a/tests/ui/lint/semicolon-in-expressions-from-macros/semicolon-in-expressions-from-macros.stderr +++ b/tests/ui/lint/semicolon-in-expressions-from-macros/semicolon-in-expressions-from-macros.stderr @@ -60,11 +60,6 @@ LL | foo!(first) = note: for more information, see issue #79813 <https://github.com/rust-lang/rust/issues/79813> = note: macro invocations at the end of a block are treated as expressions = note: to ignore the value produced by the macro, add a semicolon after the invocation of `foo` -note: the lint level is defined here - --> $DIR/semicolon-in-expressions-from-macros.rs:24:13 - | -LL | #[allow(semicolon_in_expressions_from_macros)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: this warning originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) Future breakage diagnostic: @@ -79,11 +74,6 @@ LL | let _ = foo!(second); | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #79813 <https://github.com/rust-lang/rust/issues/79813> -note: the lint level is defined here - --> $DIR/semicolon-in-expressions-from-macros.rs:29:13 - | -LL | #[allow(semicolon_in_expressions_from_macros)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: this warning originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) Future breakage diagnostic: @@ -98,11 +88,6 @@ LL | let _ = foo!(third); | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #79813 <https://github.com/rust-lang/rust/issues/79813> -note: the lint level is defined here - --> $DIR/semicolon-in-expressions-from-macros.rs:32:13 - | -LL | #[allow(semicolon_in_expressions_from_macros)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: this warning originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) Future breakage diagnostic: @@ -117,11 +102,6 @@ LL | let _ = foo!(fourth); | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #79813 <https://github.com/rust-lang/rust/issues/79813> -note: the lint level is defined here - --> $DIR/semicolon-in-expressions-from-macros.rs:37:13 - | -LL | #[allow(semicolon_in_expressions_from_macros)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: this warning originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) Future breakage diagnostic: diff --git a/tests/ui/loops/dont-suggest-break-thru-item.rs b/tests/ui/loops/dont-suggest-break-thru-item.rs index b46ba89e81d..308101115e5 100644 --- a/tests/ui/loops/dont-suggest-break-thru-item.rs +++ b/tests/ui/loops/dont-suggest-break-thru-item.rs @@ -8,6 +8,7 @@ fn closure() { if true { Err(1) //~^ ERROR mismatched types + //~| HELP you might have meant to return this value } Ok(()) @@ -21,6 +22,7 @@ fn async_block() { if true { Err(1) //~^ ERROR mismatched types + //~| HELP you might have meant to return this value } Ok(()) diff --git a/tests/ui/loops/dont-suggest-break-thru-item.stderr b/tests/ui/loops/dont-suggest-break-thru-item.stderr index 4fce4715119..c84a98198f5 100644 --- a/tests/ui/loops/dont-suggest-break-thru-item.stderr +++ b/tests/ui/loops/dont-suggest-break-thru-item.stderr @@ -5,27 +5,37 @@ LL | / if true { LL | | Err(1) | | ^^^^^^ expected `()`, found `Result<_, {integer}>` LL | | +LL | | LL | | } | |_____________- expected this to be `()` | = note: expected unit type `()` found enum `Result<_, {integer}>` +help: you might have meant to return this value + | +LL | return Err(1); + | ++++++ + error[E0308]: mismatched types - --> $DIR/dont-suggest-break-thru-item.rs:22:17 + --> $DIR/dont-suggest-break-thru-item.rs:23:17 | LL | / if true { LL | | Err(1) | | ^^^^^^ expected `()`, found `Result<_, {integer}>` LL | | +LL | | LL | | } | |_____________- expected this to be `()` | = note: expected unit type `()` found enum `Result<_, {integer}>` +help: you might have meant to return this value + | +LL | return Err(1); + | ++++++ + error[E0308]: mismatched types - --> $DIR/dont-suggest-break-thru-item.rs:35:17 + --> $DIR/dont-suggest-break-thru-item.rs:37:17 | LL | / if true { LL | | Err(1) @@ -38,7 +48,7 @@ LL | | } found enum `Result<_, {integer}>` error[E0308]: mismatched types - --> $DIR/dont-suggest-break-thru-item.rs:47:17 + --> $DIR/dont-suggest-break-thru-item.rs:49:17 | LL | / if true { LL | | Err(1) diff --git a/tests/ui/nll/check-normalized-sig-for-wf.rs b/tests/ui/nll/check-normalized-sig-for-wf.rs new file mode 100644 index 00000000000..cb0f34ce02f --- /dev/null +++ b/tests/ui/nll/check-normalized-sig-for-wf.rs @@ -0,0 +1,27 @@ +// <https://github.com/rust-lang/rust/issues/114936> +fn whoops( + s: String, + f: impl for<'s> FnOnce(&'s str) -> (&'static str, [&'static &'s (); 0]), +) -> &'static str +{ + f(&s).0 + //~^ ERROR `s` does not live long enough +} + +// <https://github.com/rust-lang/rust/issues/118876> +fn extend<T>(input: &T) -> &'static T { + struct Bounded<'a, 'b: 'static, T>(&'a T, [&'b (); 0]); + let n: Box<dyn FnOnce(&T) -> Bounded<'static, '_, T>> = Box::new(|x| Bounded(x, [])); + n(input).0 + //~^ ERROR borrowed data escapes outside of function +} + +// <https://github.com/rust-lang/rust/issues/118876> +fn extend_mut<'a, T>(input: &'a mut T) -> &'static mut T { + struct Bounded<'a, 'b: 'static, T>(&'a mut T, [&'b (); 0]); + let mut n: Box<dyn FnMut(&mut T) -> Bounded<'static, '_, T>> = Box::new(|x| Bounded(x, [])); + n(input).0 + //~^ ERROR borrowed data escapes outside of function +} + +fn main() {} diff --git a/tests/ui/nll/check-normalized-sig-for-wf.stderr b/tests/ui/nll/check-normalized-sig-for-wf.stderr new file mode 100644 index 00000000000..5c96b0c6561 --- /dev/null +++ b/tests/ui/nll/check-normalized-sig-for-wf.stderr @@ -0,0 +1,47 @@ +error[E0597]: `s` does not live long enough + --> $DIR/check-normalized-sig-for-wf.rs:7:7 + | +LL | s: String, + | - binding `s` declared here +... +LL | f(&s).0 + | --^^- + | | | + | | borrowed value does not live long enough + | argument requires that `s` is borrowed for `'static` +LL | +LL | } + | - `s` dropped here while still borrowed + +error[E0521]: borrowed data escapes outside of function + --> $DIR/check-normalized-sig-for-wf.rs:15:5 + | +LL | fn extend<T>(input: &T) -> &'static T { + | ----- - let's call the lifetime of this reference `'1` + | | + | `input` is a reference that is only valid in the function body +... +LL | n(input).0 + | ^^^^^^^^ + | | + | `input` escapes the function body here + | argument requires that `'1` must outlive `'static` + +error[E0521]: borrowed data escapes outside of function + --> $DIR/check-normalized-sig-for-wf.rs:23:5 + | +LL | fn extend_mut<'a, T>(input: &'a mut T) -> &'static mut T { + | -- ----- `input` is a reference that is only valid in the function body + | | + | lifetime `'a` defined here +... +LL | n(input).0 + | ^^^^^^^^ + | | + | `input` escapes the function body here + | argument requires that `'a` must outlive `'static` + +error: aborting due to 3 previous errors + +Some errors have detailed explanations: E0521, E0597. +For more information about an error, try `rustc --explain E0521`. diff --git a/tests/ui/nll/normalization-bounds-error.rs b/tests/ui/nll/normalization-bounds-error.rs index b6cfcd98732..e7744b53f75 100644 --- a/tests/ui/nll/normalization-bounds-error.rs +++ b/tests/ui/nll/normalization-bounds-error.rs @@ -10,6 +10,7 @@ impl<'a, 'd: 'a> Visitor<'d> for &'a () { } fn visit_seq<'d, 'a: 'd>() -> <&'a () as Visitor<'d>>::Value {} -//~^ ERROR +//~^ ERROR lifetime may not live long enough +//~| ERROR cannot infer fn main() {} diff --git a/tests/ui/nll/normalization-bounds-error.stderr b/tests/ui/nll/normalization-bounds-error.stderr index c6f3f2fd018..d4254881863 100644 --- a/tests/ui/nll/normalization-bounds-error.stderr +++ b/tests/ui/nll/normalization-bounds-error.stderr @@ -22,6 +22,18 @@ LL | fn visit_seq<'d, 'a: 'd>() -> <&'a () as Visitor<'d>>::Value {} = note: expected `Visitor<'d>` found `Visitor<'_>` -error: aborting due to 1 previous error +error: lifetime may not live long enough + --> $DIR/normalization-bounds-error.rs:12:1 + | +LL | fn visit_seq<'d, 'a: 'd>() -> <&'a () as Visitor<'d>>::Value {} + | ^^^^^^^^^^^^^--^^--^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | | | | + | | | lifetime `'a` defined here + | | lifetime `'d` defined here + | requires that `'d` must outlive `'a` + | + = help: consider adding the following bound: `'d: 'a` + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0495`. diff --git a/tests/ui/object-safety/avoid-ice-on-warning-2.new.stderr b/tests/ui/object-safety/avoid-ice-on-warning-2.new.stderr index 7aec3a73fe9..0bc396390d7 100644 --- a/tests/ui/object-safety/avoid-ice-on-warning-2.new.stderr +++ b/tests/ui/object-safety/avoid-ice-on-warning-2.new.stderr @@ -7,6 +7,35 @@ LL | fn id<F>(f: Copy) -> usize { = note: the trait cannot be made into an object because it requires `Self: Sized` = note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> -error: aborting due to 1 previous error +error[E0618]: expected function, found `(dyn Copy + 'static)` + --> $DIR/avoid-ice-on-warning-2.rs:11:5 + | +LL | fn id<F>(f: Copy) -> usize { + | - `f` has type `(dyn Copy + 'static)` +... +LL | f() + | ^-- + | | + | call expression requires function + +error[E0277]: the size for values of type `(dyn Copy + 'static)` cannot be known at compilation time + --> $DIR/avoid-ice-on-warning-2.rs:4:10 + | +LL | fn id<F>(f: Copy) -> usize { + | ^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `(dyn Copy + 'static)` + = help: unsized fn params are gated as an unstable feature +help: you can use `impl Trait` as the argument type + | +LL | fn id<F>(f: impl Copy) -> usize { + | ++++ +help: function arguments must have a statically known size, borrowed types always have a known size + | +LL | fn id<F>(f: &dyn Copy) -> usize { + | ++++ + +error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0038`. +Some errors have detailed explanations: E0038, E0277, E0618. +For more information about an error, try `rustc --explain E0038`. diff --git a/tests/ui/object-safety/avoid-ice-on-warning-2.old.stderr b/tests/ui/object-safety/avoid-ice-on-warning-2.old.stderr index 70e7ea53528..f1f33a6c6d6 100644 --- a/tests/ui/object-safety/avoid-ice-on-warning-2.old.stderr +++ b/tests/ui/object-safety/avoid-ice-on-warning-2.old.stderr @@ -35,6 +35,35 @@ LL | fn id<F>(f: Copy) -> usize { = note: the trait cannot be made into an object because it requires `Self: Sized` = note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> -error: aborting due to 1 previous error; 2 warnings emitted +error[E0618]: expected function, found `(dyn Copy + 'static)` + --> $DIR/avoid-ice-on-warning-2.rs:11:5 + | +LL | fn id<F>(f: Copy) -> usize { + | - `f` has type `(dyn Copy + 'static)` +... +LL | f() + | ^-- + | | + | call expression requires function + +error[E0277]: the size for values of type `(dyn Copy + 'static)` cannot be known at compilation time + --> $DIR/avoid-ice-on-warning-2.rs:4:10 + | +LL | fn id<F>(f: Copy) -> usize { + | ^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `(dyn Copy + 'static)` + = help: unsized fn params are gated as an unstable feature +help: you can use `impl Trait` as the argument type + | +LL | fn id<F>(f: impl Copy) -> usize { + | ++++ +help: function arguments must have a statically known size, borrowed types always have a known size + | +LL | fn id<F>(f: &dyn Copy) -> usize { + | ++++ + +error: aborting due to 3 previous errors; 2 warnings emitted -For more information about this error, try `rustc --explain E0038`. +Some errors have detailed explanations: E0038, E0277, E0618. +For more information about an error, try `rustc --explain E0038`. diff --git a/tests/ui/object-safety/avoid-ice-on-warning-2.rs b/tests/ui/object-safety/avoid-ice-on-warning-2.rs index 9a6a4378fa3..eabfd31dda6 100644 --- a/tests/ui/object-safety/avoid-ice-on-warning-2.rs +++ b/tests/ui/object-safety/avoid-ice-on-warning-2.rs @@ -3,10 +3,12 @@ //[new] edition:2021 fn id<F>(f: Copy) -> usize { //~^ ERROR the trait `Copy` cannot be made into an object +//~| ERROR: the size for values of type `(dyn Copy + 'static)` //[old]~| WARN trait objects without an explicit `dyn` are deprecated //[old]~| WARN this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! //[old]~| WARN trait objects without an explicit `dyn` are deprecated //[old]~| WARN this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! f() + //~^ ERROR: expected function, found `(dyn Copy + 'static)` } fn main() {} diff --git a/tests/ui/object-safety/issue-102762.rs b/tests/ui/object-safety/issue-102762.rs index 4f4c3634528..ed0bee5d37e 100644 --- a/tests/ui/object-safety/issue-102762.rs +++ b/tests/ui/object-safety/issue-102762.rs @@ -22,5 +22,7 @@ fn fetcher() -> Box<dyn Fetcher> { pub fn foo() { let fetcher = fetcher(); + //~^ ERROR the trait `Fetcher` cannot be made into an object let _ = fetcher.get(); + //~^ ERROR the trait `Fetcher` cannot be made into an object } diff --git a/tests/ui/object-safety/issue-102762.stderr b/tests/ui/object-safety/issue-102762.stderr index 2215ec677c5..e746628aa37 100644 --- a/tests/ui/object-safety/issue-102762.stderr +++ b/tests/ui/object-safety/issue-102762.stderr @@ -15,6 +15,40 @@ LL | pub trait Fetcher: Send + Sync { LL | fn get<'a>(self: &'a Box<Self>) -> Pin<Box<dyn Future<Output = Vec<u8>> + 'a>> | ^^^^^^^^^^^^^ ...because method `get`'s `self` parameter cannot be dispatched on -error: aborting due to 1 previous error +error[E0038]: the trait `Fetcher` cannot be made into an object + --> $DIR/issue-102762.rs:24:19 + | +LL | fn get<'a>(self: &'a Box<Self>) -> Pin<Box<dyn Future<Output = Vec<u8>> + 'a>> + | ------------- help: consider changing method `get`'s `self` parameter to be `&self`: `&Self` +... +LL | let fetcher = fetcher(); + | ^^^^^^^^^ `Fetcher` cannot be made into an object + | +note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + --> $DIR/issue-102762.rs:10:22 + | +LL | pub trait Fetcher: Send + Sync { + | ------- this trait cannot be made into an object... +LL | fn get<'a>(self: &'a Box<Self>) -> Pin<Box<dyn Future<Output = Vec<u8>> + 'a>> + | ^^^^^^^^^^^^^ ...because method `get`'s `self` parameter cannot be dispatched on + +error[E0038]: the trait `Fetcher` cannot be made into an object + --> $DIR/issue-102762.rs:26:13 + | +LL | fn get<'a>(self: &'a Box<Self>) -> Pin<Box<dyn Future<Output = Vec<u8>> + 'a>> + | ------------- help: consider changing method `get`'s `self` parameter to be `&self`: `&Self` +... +LL | let _ = fetcher.get(); + | ^^^^^^^^^^^^^ `Fetcher` cannot be made into an object + | +note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + --> $DIR/issue-102762.rs:10:22 + | +LL | pub trait Fetcher: Send + Sync { + | ------- this trait cannot be made into an object... +LL | fn get<'a>(self: &'a Box<Self>) -> Pin<Box<dyn Future<Output = Vec<u8>> + 'a>> + | ^^^^^^^^^^^^^ ...because method `get`'s `self` parameter cannot be dispatched on + +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0038`. diff --git a/tests/ui/object-safety/object-safety-associated-consts.curr.stderr b/tests/ui/object-safety/object-safety-associated-consts.curr.stderr index 462d3d95f13..bd558d36f73 100644 --- a/tests/ui/object-safety/object-safety-associated-consts.curr.stderr +++ b/tests/ui/object-safety/object-safety-associated-consts.curr.stderr @@ -13,6 +13,22 @@ LL | const X: usize; | ^ ...because it contains this associated `const` = help: consider moving `X` to another trait -error: aborting due to 1 previous error +error[E0038]: the trait `Bar` cannot be made into an object + --> $DIR/object-safety-associated-consts.rs:14:5 + | +LL | t + | ^ `Bar` cannot be made into an object + | +note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + --> $DIR/object-safety-associated-consts.rs:9:11 + | +LL | trait Bar { + | --- this trait cannot be made into an object... +LL | const X: usize; + | ^ ...because it contains this associated `const` + = help: consider moving `X` to another trait + = note: required for the cast from `&T` to `&dyn Bar` + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0038`. diff --git a/tests/ui/object-safety/object-safety-associated-consts.rs b/tests/ui/object-safety/object-safety-associated-consts.rs index e1a772e5ab2..622f3a0f92e 100644 --- a/tests/ui/object-safety/object-safety-associated-consts.rs +++ b/tests/ui/object-safety/object-safety-associated-consts.rs @@ -12,7 +12,7 @@ trait Bar { fn make_bar<T:Bar>(t: &T) -> &dyn Bar { //[curr]~^ ERROR E0038 t - //[object_safe_for_dispatch]~^ ERROR E0038 + //~^ ERROR E0038 } fn main() { diff --git a/tests/ui/object-safety/object-safety-generics.curr.stderr b/tests/ui/object-safety/object-safety-generics.curr.stderr index 45810375263..85adeace3c7 100644 --- a/tests/ui/object-safety/object-safety-generics.curr.stderr +++ b/tests/ui/object-safety/object-safety-generics.curr.stderr @@ -14,7 +14,7 @@ LL | fn bar<T>(&self, t: T); = help: consider moving `bar` to another trait error[E0038]: the trait `Bar` cannot be made into an object - --> $DIR/object-safety-generics.rs:24:40 + --> $DIR/object-safety-generics.rs:25:40 | LL | fn make_bar_explicit<T:Bar>(t: &T) -> &dyn Bar { | ^^^^^^^ `Bar` cannot be made into an object @@ -28,6 +28,53 @@ LL | fn bar<T>(&self, t: T); | ^^^ ...because method `bar` has generic type parameters = help: consider moving `bar` to another trait -error: aborting due to 2 previous errors +error[E0038]: the trait `Bar` cannot be made into an object + --> $DIR/object-safety-generics.rs:20:5 + | +LL | t + | ^ `Bar` cannot be made into an object + | +note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + --> $DIR/object-safety-generics.rs:10:8 + | +LL | trait Bar { + | --- this trait cannot be made into an object... +LL | fn bar<T>(&self, t: T); + | ^^^ ...because method `bar` has generic type parameters + = help: consider moving `bar` to another trait + = note: required for the cast from `&T` to `&dyn Bar` + +error[E0038]: the trait `Bar` cannot be made into an object + --> $DIR/object-safety-generics.rs:27:10 + | +LL | t as &dyn Bar + | ^^^^^^^^ `Bar` cannot be made into an object + | +note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + --> $DIR/object-safety-generics.rs:10:8 + | +LL | trait Bar { + | --- this trait cannot be made into an object... +LL | fn bar<T>(&self, t: T); + | ^^^ ...because method `bar` has generic type parameters + = help: consider moving `bar` to another trait + +error[E0038]: the trait `Bar` cannot be made into an object + --> $DIR/object-safety-generics.rs:27:5 + | +LL | t as &dyn Bar + | ^ `Bar` cannot be made into an object + | +note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + --> $DIR/object-safety-generics.rs:10:8 + | +LL | trait Bar { + | --- this trait cannot be made into an object... +LL | fn bar<T>(&self, t: T); + | ^^^ ...because method `bar` has generic type parameters + = help: consider moving `bar` to another trait + = note: required for the cast from `&T` to `&dyn Bar` + +error: aborting due to 5 previous errors For more information about this error, try `rustc --explain E0038`. diff --git a/tests/ui/object-safety/object-safety-generics.object_safe_for_dispatch.stderr b/tests/ui/object-safety/object-safety-generics.object_safe_for_dispatch.stderr index b200b64a1f0..498ad0d8a5e 100644 --- a/tests/ui/object-safety/object-safety-generics.object_safe_for_dispatch.stderr +++ b/tests/ui/object-safety/object-safety-generics.object_safe_for_dispatch.stderr @@ -15,7 +15,7 @@ LL | fn bar<T>(&self, t: T); = note: required for the cast from `&T` to `&dyn Bar` error[E0038]: the trait `Bar` cannot be made into an object - --> $DIR/object-safety-generics.rs:26:5 + --> $DIR/object-safety-generics.rs:27:5 | LL | t as &dyn Bar | ^ `Bar` cannot be made into an object diff --git a/tests/ui/object-safety/object-safety-generics.rs b/tests/ui/object-safety/object-safety-generics.rs index 63dcd169925..4528b4ea6e0 100644 --- a/tests/ui/object-safety/object-safety-generics.rs +++ b/tests/ui/object-safety/object-safety-generics.rs @@ -19,12 +19,15 @@ fn make_bar<T:Bar>(t: &T) -> &dyn Bar { //[curr]~^ ERROR E0038 t //[object_safe_for_dispatch]~^ ERROR E0038 + //[curr]~^^ ERROR E0038 } fn make_bar_explicit<T:Bar>(t: &T) -> &dyn Bar { //[curr]~^ ERROR E0038 t as &dyn Bar //[object_safe_for_dispatch]~^ ERROR E0038 + //[curr]~^^ ERROR E0038 + //[curr]~| ERROR E0038 } fn make_quux<T:Quux>(t: &T) -> &dyn Quux { diff --git a/tests/ui/object-safety/object-safety-issue-22040.rs b/tests/ui/object-safety/object-safety-issue-22040.rs index 1fc5c5442c2..c9ec44cc0b8 100644 --- a/tests/ui/object-safety/object-safety-issue-22040.rs +++ b/tests/ui/object-safety/object-safety-issue-22040.rs @@ -36,7 +36,9 @@ impl <'x> Expr for SExpr<'x> { fn main() { let a: Box<dyn Expr> = Box::new(SExpr::new()); + //~^ ERROR: `Expr` cannot be made into an object let b: Box<dyn Expr> = Box::new(SExpr::new()); + //~^ ERROR: `Expr` cannot be made into an object // assert_eq!(a , b); } diff --git a/tests/ui/object-safety/object-safety-issue-22040.stderr b/tests/ui/object-safety/object-safety-issue-22040.stderr index c9c1437a261..767c232c6ce 100644 --- a/tests/ui/object-safety/object-safety-issue-22040.stderr +++ b/tests/ui/object-safety/object-safety-issue-22040.stderr @@ -13,6 +13,36 @@ LL | trait Expr: Debug + PartialEq { | this trait cannot be made into an object... = help: only type `SExpr<'x>` implements the trait, consider using it directly instead -error: aborting due to 1 previous error +error[E0038]: the trait `Expr` cannot be made into an object + --> $DIR/object-safety-issue-22040.rs:38:16 + | +LL | let a: Box<dyn Expr> = Box::new(SExpr::new()); + | ^^^^^^^^ `Expr` cannot be made into an object + | +note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + --> $DIR/object-safety-issue-22040.rs:5:21 + | +LL | trait Expr: Debug + PartialEq { + | ---- ^^^^^^^^^ ...because it uses `Self` as a type parameter + | | + | this trait cannot be made into an object... + = help: only type `SExpr<'x>` implements the trait, consider using it directly instead + +error[E0038]: the trait `Expr` cannot be made into an object + --> $DIR/object-safety-issue-22040.rs:40:16 + | +LL | let b: Box<dyn Expr> = Box::new(SExpr::new()); + | ^^^^^^^^ `Expr` cannot be made into an object + | +note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + --> $DIR/object-safety-issue-22040.rs:5:21 + | +LL | trait Expr: Debug + PartialEq { + | ---- ^^^^^^^^^ ...because it uses `Self` as a type parameter + | | + | this trait cannot be made into an object... + = help: only type `SExpr<'x>` implements the trait, consider using it directly instead + +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0038`. diff --git a/tests/ui/object-safety/object-safety-mentions-Self.curr.stderr b/tests/ui/object-safety/object-safety-mentions-Self.curr.stderr index de430a89bf8..28c9c9d64a0 100644 --- a/tests/ui/object-safety/object-safety-mentions-Self.curr.stderr +++ b/tests/ui/object-safety/object-safety-mentions-Self.curr.stderr @@ -28,6 +28,38 @@ LL | fn baz(&self) -> Self; | ^^^^ ...because method `baz` references the `Self` type in its return type = help: consider moving `baz` to another trait -error: aborting due to 2 previous errors +error[E0038]: the trait `Bar` cannot be made into an object + --> $DIR/object-safety-mentions-Self.rs:24:5 + | +LL | t + | ^ `Bar` cannot be made into an object + | +note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + --> $DIR/object-safety-mentions-Self.rs:11:22 + | +LL | trait Bar { + | --- this trait cannot be made into an object... +LL | fn bar(&self, x: &Self); + | ^^^^^ ...because method `bar` references the `Self` type in this parameter + = help: consider moving `bar` to another trait + = note: required for the cast from `&T` to `&dyn Bar` + +error[E0038]: the trait `Baz` cannot be made into an object + --> $DIR/object-safety-mentions-Self.rs:30:5 + | +LL | t + | ^ `Baz` cannot be made into an object + | +note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + --> $DIR/object-safety-mentions-Self.rs:15:22 + | +LL | trait Baz { + | --- this trait cannot be made into an object... +LL | fn baz(&self) -> Self; + | ^^^^ ...because method `baz` references the `Self` type in its return type + = help: consider moving `baz` to another trait + = note: required for the cast from `&T` to `&dyn Baz` + +error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0038`. diff --git a/tests/ui/object-safety/object-safety-mentions-Self.rs b/tests/ui/object-safety/object-safety-mentions-Self.rs index 412d16ff3c7..91582aa6a04 100644 --- a/tests/ui/object-safety/object-safety-mentions-Self.rs +++ b/tests/ui/object-safety/object-safety-mentions-Self.rs @@ -22,13 +22,13 @@ trait Quux { fn make_bar<T:Bar>(t: &T) -> &dyn Bar { //[curr]~^ ERROR E0038 t - //[object_safe_for_dispatch]~^ ERROR E0038 + //~^ ERROR E0038 } fn make_baz<T:Baz>(t: &T) -> &dyn Baz { //[curr]~^ ERROR E0038 t - //[object_safe_for_dispatch]~^ ERROR E0038 + //~^ ERROR E0038 } fn make_quux<T:Quux>(t: &T) -> &dyn Quux { diff --git a/tests/ui/object-safety/object-safety-no-static.curr.stderr b/tests/ui/object-safety/object-safety-no-static.curr.stderr index c9e076c6577..8e5b0cbf9dd 100644 --- a/tests/ui/object-safety/object-safety-no-static.curr.stderr +++ b/tests/ui/object-safety/object-safety-no-static.curr.stderr @@ -21,6 +21,53 @@ help: alternatively, consider constraining `foo` so it does not apply to trait o LL | fn foo() where Self: Sized {} | +++++++++++++++++ -error: aborting due to 1 previous error +error[E0038]: the trait `Foo` cannot be made into an object + --> $DIR/object-safety-no-static.rs:22:12 + | +LL | let b: Box<dyn Foo> = Box::new(Bar); + | ^^^^^^^^^^^^ `Foo` cannot be made into an object + | +note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + --> $DIR/object-safety-no-static.rs:9:8 + | +LL | trait Foo { + | --- this trait cannot be made into an object... +LL | fn foo() {} + | ^^^ ...because associated function `foo` has no `self` parameter + = help: only type `Bar` implements the trait, consider using it directly instead +help: consider turning `foo` into a method by giving it a `&self` argument + | +LL | fn foo(&self) {} + | +++++ +help: alternatively, consider constraining `foo` so it does not apply to trait objects + | +LL | fn foo() where Self: Sized {} + | +++++++++++++++++ + +error[E0038]: the trait `Foo` cannot be made into an object + --> $DIR/object-safety-no-static.rs:22:27 + | +LL | let b: Box<dyn Foo> = Box::new(Bar); + | ^^^^^^^^^^^^^ `Foo` cannot be made into an object + | +note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + --> $DIR/object-safety-no-static.rs:9:8 + | +LL | trait Foo { + | --- this trait cannot be made into an object... +LL | fn foo() {} + | ^^^ ...because associated function `foo` has no `self` parameter + = help: only type `Bar` implements the trait, consider using it directly instead + = note: required for the cast from `Box<Bar>` to `Box<dyn Foo>` +help: consider turning `foo` into a method by giving it a `&self` argument + | +LL | fn foo(&self) {} + | +++++ +help: alternatively, consider constraining `foo` so it does not apply to trait objects + | +LL | fn foo() where Self: Sized {} + | +++++++++++++++++ + +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0038`. diff --git a/tests/ui/object-safety/object-safety-no-static.rs b/tests/ui/object-safety/object-safety-no-static.rs index 03b62217483..abfaa11c9e4 100644 --- a/tests/ui/object-safety/object-safety-no-static.rs +++ b/tests/ui/object-safety/object-safety-no-static.rs @@ -20,5 +20,6 @@ impl Foo for Bar {} fn main() { let b: Box<dyn Foo> = Box::new(Bar); - //[object_safe_for_dispatch]~^ ERROR E0038 + //~^ ERROR E0038 + //[curr]~| ERROR E0038 } diff --git a/tests/ui/object-safety/object-safety-sized-2.curr.stderr b/tests/ui/object-safety/object-safety-sized-2.curr.stderr index 7b91c4d665c..03b078c2a44 100644 --- a/tests/ui/object-safety/object-safety-sized-2.curr.stderr +++ b/tests/ui/object-safety/object-safety-sized-2.curr.stderr @@ -12,6 +12,21 @@ LL | trait Bar LL | where Self : Sized | ^^^^^ ...because it requires `Self: Sized` -error: aborting due to 1 previous error +error[E0038]: the trait `Bar` cannot be made into an object + --> $DIR/object-safety-sized-2.rs:16:5 + | +LL | t + | ^ `Bar` cannot be made into an object + | +note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + --> $DIR/object-safety-sized-2.rs:9:18 + | +LL | trait Bar + | --- this trait cannot be made into an object... +LL | where Self : Sized + | ^^^^^ ...because it requires `Self: Sized` + = note: required for the cast from `&T` to `&dyn Bar` + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0038`. diff --git a/tests/ui/object-safety/object-safety-sized-2.rs b/tests/ui/object-safety/object-safety-sized-2.rs index 1e79b8cd917..607b7c68f7f 100644 --- a/tests/ui/object-safety/object-safety-sized-2.rs +++ b/tests/ui/object-safety/object-safety-sized-2.rs @@ -14,7 +14,7 @@ trait Bar fn make_bar<T:Bar>(t: &T) -> &dyn Bar { //[curr]~^ ERROR E0038 t - //[object_safe_for_dispatch]~^ ERROR E0038 + //~^ ERROR E0038 } fn main() { diff --git a/tests/ui/object-safety/object-safety-sized.curr.stderr b/tests/ui/object-safety/object-safety-sized.curr.stderr index 66b5239745b..0513780a81f 100644 --- a/tests/ui/object-safety/object-safety-sized.curr.stderr +++ b/tests/ui/object-safety/object-safety-sized.curr.stderr @@ -1,17 +1,32 @@ error[E0038]: the trait `Bar` cannot be made into an object - --> $DIR/object-safety-sized.rs:12:31 + --> $DIR/object-safety-sized.rs:12:32 | -LL | fn make_bar<T:Bar>(t: &T) -> &dyn Bar { - | ^^^^^^^ `Bar` cannot be made into an object +LL | fn make_bar<T: Bar>(t: &T) -> &dyn Bar { + | ^^^^^^^ `Bar` cannot be made into an object | note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> - --> $DIR/object-safety-sized.rs:8:13 + --> $DIR/object-safety-sized.rs:8:12 | -LL | trait Bar : Sized { - | --- ^^^^^ ...because it requires `Self: Sized` +LL | trait Bar: Sized { + | --- ^^^^^ ...because it requires `Self: Sized` | | | this trait cannot be made into an object... -error: aborting due to 1 previous error +error[E0038]: the trait `Bar` cannot be made into an object + --> $DIR/object-safety-sized.rs:14:5 + | +LL | t + | ^ `Bar` cannot be made into an object + | +note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> + --> $DIR/object-safety-sized.rs:8:12 + | +LL | trait Bar: Sized { + | --- ^^^^^ ...because it requires `Self: Sized` + | | + | this trait cannot be made into an object... + = note: required for the cast from `&T` to `&dyn Bar` + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0038`. diff --git a/tests/ui/object-safety/object-safety-sized.object_safe_for_dispatch.stderr b/tests/ui/object-safety/object-safety-sized.object_safe_for_dispatch.stderr index 1d0ffcffd04..d988293c0e9 100644 --- a/tests/ui/object-safety/object-safety-sized.object_safe_for_dispatch.stderr +++ b/tests/ui/object-safety/object-safety-sized.object_safe_for_dispatch.stderr @@ -5,10 +5,10 @@ LL | t | ^ `Bar` cannot be made into an object | note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> - --> $DIR/object-safety-sized.rs:8:13 + --> $DIR/object-safety-sized.rs:8:12 | -LL | trait Bar : Sized { - | --- ^^^^^ ...because it requires `Self: Sized` +LL | trait Bar: Sized { + | --- ^^^^^ ...because it requires `Self: Sized` | | | this trait cannot be made into an object... = note: required for the cast from `&T` to `&dyn Bar` diff --git a/tests/ui/object-safety/object-safety-sized.rs b/tests/ui/object-safety/object-safety-sized.rs index b424b892d3b..ab7aa57611d 100644 --- a/tests/ui/object-safety/object-safety-sized.rs +++ b/tests/ui/object-safety/object-safety-sized.rs @@ -5,15 +5,14 @@ #![cfg_attr(object_safe_for_dispatch, feature(object_safe_for_dispatch))] -trait Bar : Sized { +trait Bar: Sized { fn bar<T>(&self, t: T); } -fn make_bar<T:Bar>(t: &T) -> &dyn Bar { +fn make_bar<T: Bar>(t: &T) -> &dyn Bar { //[curr]~^ ERROR E0038 t - //[object_safe_for_dispatch]~^ ERROR E0038 + //~^ ERROR E0038 } -fn main() { -} +fn main() {} diff --git a/tests/ui/overloaded/overloaded-calls-nontuple.rs b/tests/ui/overloaded/overloaded-calls-nontuple.rs index 32a3b93e0a1..aaae39d8506 100644 --- a/tests/ui/overloaded/overloaded-calls-nontuple.rs +++ b/tests/ui/overloaded/overloaded-calls-nontuple.rs @@ -20,11 +20,12 @@ impl FnOnce<isize> for S { type Output = isize; extern "rust-call" fn call_once(mut self, z: isize) -> isize { //~^ ERROR functions with the "rust-call" ABI must take a single non-self tuple argument - self.call_mut(z) + self.call_mut(z) //~ ERROR `isize` is not a tuple } } fn main() { let mut s = S { x: 1, y: 2 }; - drop(s(3)) + drop(s(3)) //~ ERROR `isize` is not a tuple + //~^ ERROR cannot use call notation } diff --git a/tests/ui/overloaded/overloaded-calls-nontuple.stderr b/tests/ui/overloaded/overloaded-calls-nontuple.stderr index 2e160078259..45a84fc4d7b 100644 --- a/tests/ui/overloaded/overloaded-calls-nontuple.stderr +++ b/tests/ui/overloaded/overloaded-calls-nontuple.stderr @@ -28,7 +28,30 @@ error[E0277]: functions with the "rust-call" ABI must take a single non-self tup LL | extern "rust-call" fn call_once(mut self, z: isize) -> isize { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Tuple` is not implemented for `isize` -error: aborting due to 4 previous errors +error[E0277]: `isize` is not a tuple + --> $DIR/overloaded-calls-nontuple.rs:23:23 + | +LL | self.call_mut(z) + | -------- ^ the trait `Tuple` is not implemented for `isize` + | | + | required by a bound introduced by this call + | +note: required by a bound in `call_mut` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL + +error[E0059]: cannot use call notation; the first type parameter for the function trait is neither a tuple nor unit + --> $DIR/overloaded-calls-nontuple.rs:29:10 + | +LL | drop(s(3)) + | ^^^^ + +error[E0277]: `isize` is not a tuple + --> $DIR/overloaded-calls-nontuple.rs:29:10 + | +LL | drop(s(3)) + | ^^^^ the trait `Tuple` is not implemented for `isize` + +error: aborting due to 7 previous errors Some errors have detailed explanations: E0059, E0277. For more information about an error, try `rustc --explain E0059`. diff --git a/tests/ui/parser/variadic-ffi-nested-syntactic-fail.rs b/tests/ui/parser/variadic-ffi-nested-syntactic-fail.rs index f1238ec240f..4da9ad84bab 100644 --- a/tests/ui/parser/variadic-ffi-nested-syntactic-fail.rs +++ b/tests/ui/parser/variadic-ffi-nested-syntactic-fail.rs @@ -5,9 +5,6 @@ fn f2<'a>(x: u8, y: Vec<&'a ...>) {} //~^ ERROR C-variadic type `...` may not be nested inside another type fn main() { - // While this is an error, wf-checks happen before typeck, and if any wf-checks - // encountered errors, we do not continue to typeck, even if the items are - // unrelated. - // FIXME(oli-obk): make this report a type mismatch again. let _recovery_witness: () = 0; + //~^ ERROR: mismatched types } diff --git a/tests/ui/parser/variadic-ffi-nested-syntactic-fail.stderr b/tests/ui/parser/variadic-ffi-nested-syntactic-fail.stderr index 7ca6a6d1bbf..8b9d676a45d 100644 --- a/tests/ui/parser/variadic-ffi-nested-syntactic-fail.stderr +++ b/tests/ui/parser/variadic-ffi-nested-syntactic-fail.stderr @@ -10,6 +10,15 @@ error[E0743]: C-variadic type `...` may not be nested inside another type LL | fn f2<'a>(x: u8, y: Vec<&'a ...>) {} | ^^^ -error: aborting due to 2 previous errors +error[E0308]: mismatched types + --> $DIR/variadic-ffi-nested-syntactic-fail.rs:8:33 + | +LL | let _recovery_witness: () = 0; + | -- ^ expected `()`, found integer + | | + | expected due to this + +error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0743`. +Some errors have detailed explanations: E0308, E0743. +For more information about an error, try `rustc --explain E0308`. diff --git a/tests/ui/pattern/usefulness/const-partial_eq-fallback-ice.stderr b/tests/ui/pattern/usefulness/const-partial_eq-fallback-ice.stderr index 59b454d3981..2a1cd3a7aa4 100644 --- a/tests/ui/pattern/usefulness/const-partial_eq-fallback-ice.stderr +++ b/tests/ui/pattern/usefulness/const-partial_eq-fallback-ice.stderr @@ -20,10 +20,4 @@ LL | if let CONSTANT = &&MyType { = note: for more information, see issue #120362 <https://github.com/rust-lang/rust/issues/120362> = note: the traits must be derived, manual `impl`s are not sufficient = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details -note: the lint level is defined here - --> $DIR/const-partial_eq-fallback-ice.rs:1:10 - | -LL | #![allow(warnings)] - | ^^^^^^^^ - = note: `#[allow(indirect_structural_match)]` implied by `#[allow(warnings)]` diff --git a/tests/ui/proc-macro/bad-projection.rs b/tests/ui/proc-macro/bad-projection.rs index c7cffdc9b47..c3ac624b600 100644 --- a/tests/ui/proc-macro/bad-projection.rs +++ b/tests/ui/proc-macro/bad-projection.rs @@ -14,4 +14,5 @@ trait Project { pub fn uwu() -> <() as Project>::Assoc {} //~^ ERROR the trait bound `(): Project` is not satisfied //~| ERROR the trait bound `(): Project` is not satisfied +//~| ERROR the trait bound `(): Project` is not satisfied //~| ERROR function is expected to take 1 argument, but it takes 0 arguments diff --git a/tests/ui/proc-macro/bad-projection.stderr b/tests/ui/proc-macro/bad-projection.stderr index aea5d6d7c84..8e0d8461849 100644 --- a/tests/ui/proc-macro/bad-projection.stderr +++ b/tests/ui/proc-macro/bad-projection.stderr @@ -35,7 +35,19 @@ help: this trait has no implementations, consider adding one LL | trait Project { | ^^^^^^^^^^^^^ -error: aborting due to 3 previous errors +error[E0277]: the trait bound `(): Project` is not satisfied + --> $DIR/bad-projection.rs:14:40 + | +LL | pub fn uwu() -> <() as Project>::Assoc {} + | ^^ the trait `Project` is not implemented for `()` + | +help: this trait has no implementations, consider adding one + --> $DIR/bad-projection.rs:9:1 + | +LL | trait Project { + | ^^^^^^^^^^^^^ + +error: aborting due to 4 previous errors Some errors have detailed explanations: E0277, E0593. For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/proc-macro/generate-mod.stderr b/tests/ui/proc-macro/generate-mod.stderr index db629b5b5e2..cbe6b14ca9a 100644 --- a/tests/ui/proc-macro/generate-mod.stderr +++ b/tests/ui/proc-macro/generate-mod.stderr @@ -139,11 +139,6 @@ LL | #[derive(generate_mod::CheckDeriveLint)] // OK, lint is suppressed | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #83583 <https://github.com/rust-lang/rust/issues/83583> -note: the lint level is defined here - --> $DIR/generate-mod.rs:30:10 - | -LL | #[derive(generate_mod::CheckDeriveLint)] // OK, lint is suppressed - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: this warning originates in the derive macro `generate_mod::CheckDeriveLint` (in Nightly builds, run with -Z macro-backtrace for more info) Future breakage diagnostic: @@ -155,10 +150,5 @@ LL | #[derive(generate_mod::CheckDeriveLint)] // OK, lint is suppressed | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #83583 <https://github.com/rust-lang/rust/issues/83583> -note: the lint level is defined here - --> $DIR/generate-mod.rs:30:10 - | -LL | #[derive(generate_mod::CheckDeriveLint)] // OK, lint is suppressed - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: this warning originates in the derive macro `generate_mod::CheckDeriveLint` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/proc-macro/issue-104884-trait-impl-sugg-err.rs b/tests/ui/proc-macro/issue-104884-trait-impl-sugg-err.rs index a0d619c4566..1e387326b2e 100644 --- a/tests/ui/proc-macro/issue-104884-trait-impl-sugg-err.rs +++ b/tests/ui/proc-macro/issue-104884-trait-impl-sugg-err.rs @@ -14,7 +14,9 @@ struct PriorityQueueEntry<T> { //~^ ERROR can't compare `PriorityQueue<T>` with `PriorityQueue<T>` //~| ERROR the trait bound `PriorityQueue<T>: Eq` is not satisfied //~| ERROR can't compare `T` with `T` +//~| ERROR `BinaryHeap<PriorityQueueEntry<T>>` is not an iterator +//~| ERROR no field `height` on type `&PriorityQueue<T>` struct PriorityQueue<T>(BinaryHeap<PriorityQueueEntry<T>>); - +//~^ ERROR can't compare `BinaryHeap<PriorityQueueEntry<T>>` with `_` fn main() {} diff --git a/tests/ui/proc-macro/issue-104884-trait-impl-sugg-err.stderr b/tests/ui/proc-macro/issue-104884-trait-impl-sugg-err.stderr index 3b2a5e70188..6fa639877d3 100644 --- a/tests/ui/proc-macro/issue-104884-trait-impl-sugg-err.stderr +++ b/tests/ui/proc-macro/issue-104884-trait-impl-sugg-err.stderr @@ -34,6 +34,38 @@ note: required by a bound in `Ord` --> $SRC_DIR/core/src/cmp.rs:LL:COL = note: this error originates in the derive macro `AddImpl` which comes from the expansion of the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info) -error: aborting due to 3 previous errors +error[E0277]: can't compare `BinaryHeap<PriorityQueueEntry<T>>` with `_` + --> $DIR/issue-104884-trait-impl-sugg-err.rs:20:25 + | +LL | #[derive(PartialOrd, AddImpl)] + | ---------- in this derive macro expansion +... +LL | struct PriorityQueue<T>(BinaryHeap<PriorityQueueEntry<T>>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `BinaryHeap<PriorityQueueEntry<T>> < _` and `BinaryHeap<PriorityQueueEntry<T>> > _` + | + = help: the trait `PartialOrd<_>` is not implemented for `BinaryHeap<PriorityQueueEntry<T>>` + = note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0599]: `BinaryHeap<PriorityQueueEntry<T>>` is not an iterator + --> $DIR/issue-104884-trait-impl-sugg-err.rs:13:22 + | +LL | #[derive(PartialOrd, AddImpl)] + | ^^^^^^^ `BinaryHeap<PriorityQueueEntry<T>>` is not an iterator + | + = note: the following trait bounds were not satisfied: + `BinaryHeap<PriorityQueueEntry<T>>: Iterator` + which is required by `&mut BinaryHeap<PriorityQueueEntry<T>>: Iterator` + = note: this error originates in the derive macro `AddImpl` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0609]: no field `height` on type `&PriorityQueue<T>` + --> $DIR/issue-104884-trait-impl-sugg-err.rs:13:22 + | +LL | #[derive(PartialOrd, AddImpl)] + | ^^^^^^^ unknown field + | + = note: this error originates in the derive macro `AddImpl` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to 6 previous errors -For more information about this error, try `rustc --explain E0277`. +Some errors have detailed explanations: E0277, E0599, E0609. +For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/regions/regions-free-region-ordering-callee-4.rs b/tests/ui/regions/regions-free-region-ordering-callee-4.rs index de58dd0b10f..af9f3124cc7 100644 --- a/tests/ui/regions/regions-free-region-ordering-callee-4.rs +++ b/tests/ui/regions/regions-free-region-ordering-callee-4.rs @@ -6,6 +6,7 @@ fn ordering4<'a, 'b, F>(a: &'a usize, b: &'b usize, x: F) where F: FnOnce(&'a &' //~^ ERROR reference has a longer lifetime than the data it references // Do not infer ordering from closure argument types. let z: Option<&'a &'b usize> = None; + //~^ ERROR may not live long enough } fn main() {} diff --git a/tests/ui/regions/regions-free-region-ordering-callee-4.stderr b/tests/ui/regions/regions-free-region-ordering-callee-4.stderr index 1c8f1c1e472..e6218079952 100644 --- a/tests/ui/regions/regions-free-region-ordering-callee-4.stderr +++ b/tests/ui/regions/regions-free-region-ordering-callee-4.stderr @@ -15,6 +15,19 @@ note: but the referenced data is only valid for the lifetime `'b` as defined her LL | fn ordering4<'a, 'b, F>(a: &'a usize, b: &'b usize, x: F) where F: FnOnce(&'a &'b usize) { | ^^ -error: aborting due to 1 previous error +error: lifetime may not live long enough + --> $DIR/regions-free-region-ordering-callee-4.rs:8:12 + | +LL | fn ordering4<'a, 'b, F>(a: &'a usize, b: &'b usize, x: F) where F: FnOnce(&'a &'b usize) { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +... +LL | let z: Option<&'a &'b usize> = None; + | ^^^^^^^^^^^^^^^^^^^^^ requires that `'b` must outlive `'a` + | + = help: consider adding the following bound: `'b: 'a` + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0491`. 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 429548f119b..4d77a551f64 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 @@ -21,6 +21,7 @@ trait Trait2<'a, 'b> { 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 } fn main() { } 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 1555e5981c5..b17d1e0ab11 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,6 +9,19 @@ 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 1 previous error +error[E0277]: the trait bound `for<'z> T: Trait2<'y, 'z>` is not satisfied + --> $DIR/regions-implied-bounds-projection-gap-hr-1.rs:23:1 + | +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 For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/resolve/issue-120559.rs b/tests/ui/resolve/issue-120559.rs new file mode 100644 index 00000000000..e874e840de7 --- /dev/null +++ b/tests/ui/resolve/issue-120559.rs @@ -0,0 +1,5 @@ +use std::io::Read; + +fn f<T: Read, U, Read>() {} //~ ERROR expected trait, found type parameter `Read` + +fn main() {} diff --git a/tests/ui/resolve/issue-120559.stderr b/tests/ui/resolve/issue-120559.stderr new file mode 100644 index 00000000000..9150fb38ad5 --- /dev/null +++ b/tests/ui/resolve/issue-120559.stderr @@ -0,0 +1,14 @@ +error[E0404]: expected trait, found type parameter `Read` + --> $DIR/issue-120559.rs:3:9 + | +LL | use std::io::Read; + | ---- you might have meant to refer to this trait +LL | +LL | fn f<T: Read, U, Read>() {} + | ^^^^ ---- found this type parameter + | | + | not a trait + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0404`. diff --git a/tests/ui/resolve/issue-3907-2.rs b/tests/ui/resolve/issue-3907-2.rs index 46f145e63e1..0ebaea08e18 100644 --- a/tests/ui/resolve/issue-3907-2.rs +++ b/tests/ui/resolve/issue-3907-2.rs @@ -10,5 +10,6 @@ struct S { fn bar(_x: Foo) {} //~^ ERROR E0038 +//~| ERROR E0277 fn main() {} diff --git a/tests/ui/resolve/issue-3907-2.stderr b/tests/ui/resolve/issue-3907-2.stderr index 2693daa3c7a..364edb788c6 100644 --- a/tests/ui/resolve/issue-3907-2.stderr +++ b/tests/ui/resolve/issue-3907-2.stderr @@ -10,6 +10,20 @@ note: for a trait to be "object safe" it needs to allow building a vtable to all LL | fn bar(); | ^^^ the trait cannot be made into an object because associated function `bar` has no `self` parameter -error: aborting due to 1 previous error +error[E0277]: the size for values of type `(dyn issue_3907::Foo + 'static)` cannot be known at compilation time + --> $DIR/issue-3907-2.rs:11:8 + | +LL | fn bar(_x: Foo) {} + | ^^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `(dyn issue_3907::Foo + 'static)` + = help: unsized fn params are gated as an unstable feature +help: function arguments must have a statically known size, borrowed types always have a known size + | +LL | fn bar(_x: &Foo) {} + | + + +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0038`. +Some errors have detailed explanations: E0038, E0277. +For more information about an error, try `rustc --explain E0038`. diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/specializing-constness-2.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/specializing-constness-2.stderr index 5210a694201..e5b9493b3ce 100644 --- a/tests/ui/rfcs/rfc-2632-const-trait-impl/specializing-constness-2.stderr +++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/specializing-constness-2.stderr @@ -7,6 +7,16 @@ LL | impl<T: Default> A for T { LL | impl<T: Default + ~const Sup> const A for T { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation -error: aborting due to 1 previous error +error[E0308]: mismatched types + --> $DIR/specializing-constness-2.rs:27:5 + | +LL | <T as A>::a(); + | ^^^^^^^^^^^^^ expected `host`, found `true` + | + = note: expected constant `host` + found constant `true` + +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0119`. +Some errors have detailed explanations: E0119, E0308. +For more information about an error, try `rustc --explain E0119`. diff --git a/tests/ui/self/arbitrary-self-from-method-substs.default.stderr b/tests/ui/self/arbitrary-self-from-method-substs.default.stderr index 4cc69666b88..bd0519f66c0 100644 --- a/tests/ui/self/arbitrary-self-from-method-substs.default.stderr +++ b/tests/ui/self/arbitrary-self-from-method-substs.default.stderr @@ -9,6 +9,7 @@ LL | fn get<R: Deref<Target = Self>>(self: R) -> u32 { = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date = help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) +ERROR rustc_hir_typeck::method::confirm Foo was a subtype of &Foo but now is not? error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/simd/array-trait.rs b/tests/ui/simd/array-trait.rs index 883d718c49b..27a7df17d66 100644 --- a/tests/ui/simd/array-trait.rs +++ b/tests/ui/simd/array-trait.rs @@ -23,6 +23,7 @@ impl Simd for i32x4 { pub struct T<S: Simd>([S::Lane; S::SIZE]); //~^ ERROR unconstrained generic constant //~| ERROR SIMD vector element type should be a primitive scalar +//~| ERROR unconstrained generic constant extern "platform-intrinsic" { fn simd_insert<T, E>(x: T, idx: u32, y: E) -> T; @@ -37,6 +38,7 @@ pub fn main() { } for i in 0_i32..4 { assert_eq!(i, simd_extract(t, i as u32)); + //~^ ERROR: use of moved value: `t` } } } diff --git a/tests/ui/simd/array-trait.stderr b/tests/ui/simd/array-trait.stderr index cf6026912aa..bbaead569df 100644 --- a/tests/ui/simd/array-trait.stderr +++ b/tests/ui/simd/array-trait.stderr @@ -12,6 +12,29 @@ error[E0077]: SIMD vector element type should be a primitive scalar (integer/flo LL | pub struct T<S: Simd>([S::Lane; S::SIZE]); | ^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 2 previous errors +error: unconstrained generic constant + --> $DIR/array-trait.rs:23:23 + | +LL | #[derive(Copy, Clone)] + | ----- in this derive macro expansion +LL | pub struct T<S: Simd>([S::Lane; S::SIZE]); + | ^^^^^^^^^^^^^^^^^^ + | + = help: try adding a `where` bound using this expression: `where [(); S::SIZE]:` + = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0382]: use of moved value: `t` + --> $DIR/array-trait.rs:40:40 + | +LL | let mut t = T::<i32x4>([0; 4]); + | ----- move occurs because `t` has type `T<i32x4>`, which does not implement the `Copy` trait +... +LL | for i in 0_i32..4 { + | ----------------- inside of this loop +LL | assert_eq!(i, simd_extract(t, i as u32)); + | ^ value moved here, in previous iteration of loop + +error: aborting due to 4 previous errors -For more information about this error, try `rustc --explain E0077`. +Some errors have detailed explanations: E0077, E0382. +For more information about an error, try `rustc --explain E0077`. diff --git a/tests/ui/span/issue-35987.stderr b/tests/ui/span/issue-35987.stderr index 4c4b100da3d..d3014f276fd 100644 --- a/tests/ui/span/issue-35987.stderr +++ b/tests/ui/span/issue-35987.stderr @@ -8,11 +8,6 @@ LL | impl<T: Clone, Add> Add for Foo<T> { | --- ^^^ not a trait | | | found this type parameter - | -help: consider importing this trait instead - | -LL + use std::ops::Add; - | error: aborting due to 1 previous error diff --git a/tests/ui/specialization/defaultimpl/specialization-trait-not-implemented.rs b/tests/ui/specialization/defaultimpl/specialization-trait-not-implemented.rs index 6834d573629..344dd7bb288 100644 --- a/tests/ui/specialization/defaultimpl/specialization-trait-not-implemented.rs +++ b/tests/ui/specialization/defaultimpl/specialization-trait-not-implemented.rs @@ -20,5 +20,5 @@ default impl<T> Foo for T { fn main() { println!("{}", MyStruct.foo_one()); - //~^ ERROR the method + //~^ ERROR no method named `foo_one` found for struct `MyStruct` in the current scope } diff --git a/tests/ui/specialization/defaultimpl/specialization-trait-not-implemented.stderr b/tests/ui/specialization/defaultimpl/specialization-trait-not-implemented.stderr index e9b0845ccf7..74f81bb023e 100644 --- a/tests/ui/specialization/defaultimpl/specialization-trait-not-implemented.stderr +++ b/tests/ui/specialization/defaultimpl/specialization-trait-not-implemented.stderr @@ -8,27 +8,15 @@ LL | #![feature(specialization)] = help: consider using `min_specialization` instead, which is more stable and complete = note: `#[warn(incomplete_features)]` on by default -error[E0599]: the method `foo_one` exists for struct `MyStruct`, but its trait bounds were not satisfied +error[E0599]: no method named `foo_one` found for struct `MyStruct` in the current scope --> $DIR/specialization-trait-not-implemented.rs:22:29 | LL | struct MyStruct; - | --------------- method `foo_one` not found for this struct because it doesn't satisfy `MyStruct: Foo` + | --------------- method `foo_one` not found for this struct ... LL | println!("{}", MyStruct.foo_one()); - | ^^^^^^^ method cannot be called on `MyStruct` due to unsatisfied trait bounds + | ^^^^^^^ method not found in `MyStruct` | -note: trait bound `MyStruct: Foo` was not satisfied - --> $DIR/specialization-trait-not-implemented.rs:14:1 - | -LL | default impl<T> Foo for T { - | ^^^^^^^^^^^^^^^^---^^^^^- - | | - | unsatisfied trait bound introduced here -note: the trait `Foo` must be implemented - --> $DIR/specialization-trait-not-implemented.rs:7:1 - | -LL | trait Foo { - | ^^^^^^^^^ = help: items from traits can only be used if the trait is implemented and in scope note: `Foo` defines an item `foo_one`, perhaps you need to implement it --> $DIR/specialization-trait-not-implemented.rs:7:1 diff --git a/tests/ui/specialization/defaultimpl/validation.rs b/tests/ui/specialization/defaultimpl/validation.rs index 8558a1efb82..4049c4ea14c 100644 --- a/tests/ui/specialization/defaultimpl/validation.rs +++ b/tests/ui/specialization/defaultimpl/validation.rs @@ -7,6 +7,7 @@ struct Z; default impl S {} //~ ERROR inherent impls cannot be `default` default unsafe impl Send for S {} //~ ERROR impls of auto traits cannot be default +//~^ ERROR `S` cannot be sent between threads safely default impl !Send for Z {} //~ ERROR impls of auto traits cannot be default //~^ ERROR negative impls cannot be default impls diff --git a/tests/ui/specialization/defaultimpl/validation.stderr b/tests/ui/specialization/defaultimpl/validation.stderr index eb6dc9355a3..5f62e8dce17 100644 --- a/tests/ui/specialization/defaultimpl/validation.stderr +++ b/tests/ui/specialization/defaultimpl/validation.stderr @@ -26,8 +26,19 @@ LL | default unsafe impl Send for S {} | | | default because of this +error[E0277]: `S` cannot be sent between threads safely + --> $DIR/validation.rs:9:1 + | +LL | default unsafe impl Send for S {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `S` cannot be sent between threads safely + | + = help: the trait `Send` is not implemented for `S` + = help: the trait `Send` is implemented for `S` + = help: see issue #48214 + = help: add `#![feature(trivial_bounds)]` to the crate attributes to enable + error: impls of auto traits cannot be default - --> $DIR/validation.rs:10:15 + --> $DIR/validation.rs:11:15 | LL | default impl !Send for Z {} | ------- ^^^^ auto trait @@ -35,17 +46,18 @@ LL | default impl !Send for Z {} | default because of this error[E0750]: negative impls cannot be default impls - --> $DIR/validation.rs:10:1 + --> $DIR/validation.rs:11:1 | LL | default impl !Send for Z {} | ^^^^^^^ ^ error[E0750]: negative impls cannot be default impls - --> $DIR/validation.rs:14:1 + --> $DIR/validation.rs:15:1 | LL | default impl !Tr for S {} | ^^^^^^^ ^ -error: aborting due to 5 previous errors; 1 warning emitted +error: aborting due to 6 previous errors; 1 warning emitted -For more information about this error, try `rustc --explain E0750`. +Some errors have detailed explanations: E0277, E0750. +For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/specialization/issue-45814.current.stderr b/tests/ui/specialization/issue-45814.current.stderr index da0dff78e26..b89d3073a8f 100644 --- a/tests/ui/specialization/issue-45814.current.stderr +++ b/tests/ui/specialization/issue-45814.current.stderr @@ -1,14 +1,12 @@ -error[E0275]: overflow evaluating the requirement `T: Trait<_>` - | - = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_45814`) -note: required for `T` to implement `Trait<_>` - --> $DIR/issue-45814.rs:9:20 +error[E0119]: conflicting implementations of trait `Trait<_>` + --> $DIR/issue-45814.rs:10:1 | LL | default impl<T, U> Trait<T> for U {} - | ^^^^^^^^ ^ - = note: 128 redundant requirements hidden - = note: required for `T` to implement `Trait<_>` + | --------------------------------- first implementation here +LL | +LL | impl<T> Trait<<T as Iterator>::Item> for T {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0275`. +For more information about this error, try `rustc --explain E0119`. diff --git a/tests/ui/specialization/issue-45814.negative.stderr b/tests/ui/specialization/issue-45814.negative.stderr index da0dff78e26..b89d3073a8f 100644 --- a/tests/ui/specialization/issue-45814.negative.stderr +++ b/tests/ui/specialization/issue-45814.negative.stderr @@ -1,14 +1,12 @@ -error[E0275]: overflow evaluating the requirement `T: Trait<_>` - | - = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_45814`) -note: required for `T` to implement `Trait<_>` - --> $DIR/issue-45814.rs:9:20 +error[E0119]: conflicting implementations of trait `Trait<_>` + --> $DIR/issue-45814.rs:10:1 | LL | default impl<T, U> Trait<T> for U {} - | ^^^^^^^^ ^ - = note: 128 redundant requirements hidden - = note: required for `T` to implement `Trait<_>` + | --------------------------------- first implementation here +LL | +LL | impl<T> Trait<<T as Iterator>::Item> for T {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0275`. +For more information about this error, try `rustc --explain E0119`. diff --git a/tests/ui/specialization/issue-45814.rs b/tests/ui/specialization/issue-45814.rs index fce236390c2..832d734d945 100644 --- a/tests/ui/specialization/issue-45814.rs +++ b/tests/ui/specialization/issue-45814.rs @@ -1,4 +1,3 @@ -//~ ERROR overflow evaluating the requirement `T: Trait<_>` // revisions: current negative #![feature(specialization)] #![cfg_attr(negative, feature(with_negative_coherence))] @@ -9,5 +8,6 @@ pub trait Trait<T> {} default impl<T, U> Trait<T> for U {} impl<T> Trait<<T as Iterator>::Item> for T {} +//~^ ERROR conflicting implementations of trait `Trait<_>` fn main() {} diff --git a/tests/ui/specialization/min_specialization/bad-const-wf-doesnt-specialize.rs b/tests/ui/specialization/min_specialization/bad-const-wf-doesnt-specialize.rs index a0ee7714417..f89a463bc58 100644 --- a/tests/ui/specialization/min_specialization/bad-const-wf-doesnt-specialize.rs +++ b/tests/ui/specialization/min_specialization/bad-const-wf-doesnt-specialize.rs @@ -6,6 +6,7 @@ struct S<const L: usize>; impl<const N: i32> Copy for S<N> {} +//~^ ERROR: mismatched types impl<const M: usize> Copy for S<M> {} //~^ ERROR: conflicting implementations of trait `Copy` for type `S<_>` diff --git a/tests/ui/specialization/min_specialization/bad-const-wf-doesnt-specialize.stderr b/tests/ui/specialization/min_specialization/bad-const-wf-doesnt-specialize.stderr index 2953bc95917..1dac58e1f69 100644 --- a/tests/ui/specialization/min_specialization/bad-const-wf-doesnt-specialize.stderr +++ b/tests/ui/specialization/min_specialization/bad-const-wf-doesnt-specialize.stderr @@ -1,11 +1,19 @@ error[E0119]: conflicting implementations of trait `Copy` for type `S<_>` - --> $DIR/bad-const-wf-doesnt-specialize.rs:9:1 + --> $DIR/bad-const-wf-doesnt-specialize.rs:10:1 | LL | impl<const N: i32> Copy for S<N> {} | -------------------------------- first implementation here +LL | LL | impl<const M: usize> Copy for S<M> {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `S<_>` -error: aborting due to 1 previous error +error[E0308]: mismatched types + --> $DIR/bad-const-wf-doesnt-specialize.rs:8:31 + | +LL | impl<const N: i32> Copy for S<N> {} + | ^ expected `usize`, found `i32` + +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0119`. +Some errors have detailed explanations: E0119, E0308. +For more information about an error, try `rustc --explain E0119`. diff --git a/tests/ui/specialization/min_specialization/issue-79224.rs b/tests/ui/specialization/min_specialization/issue-79224.rs index a118cb28b38..6ddd3d79ccf 100644 --- a/tests/ui/specialization/min_specialization/issue-79224.rs +++ b/tests/ui/specialization/min_specialization/issue-79224.rs @@ -20,6 +20,7 @@ impl<B: ?Sized> Display for Cow<'_, B> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { //~^ ERROR: the trait bound `B: Clone` is not satisfied [E0277] //~| ERROR: the trait bound `B: Clone` is not satisfied [E0277] + //~| ERROR: the trait bound `B: Clone` is not satisfied [E0277] write!(f, "foo") } } diff --git a/tests/ui/specialization/min_specialization/issue-79224.stderr b/tests/ui/specialization/min_specialization/issue-79224.stderr index da19ed44ce6..db88be88a81 100644 --- a/tests/ui/specialization/min_specialization/issue-79224.stderr +++ b/tests/ui/specialization/min_specialization/issue-79224.stderr @@ -34,6 +34,24 @@ help: consider further restricting this bound LL | impl<B: ?Sized + std::clone::Clone> Display for Cow<'_, B> { | +++++++++++++++++++ -error: aborting due to 3 previous errors +error[E0277]: the trait bound `B: Clone` is not satisfied + --> $DIR/issue-79224.rs:20:62 + | +LL | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + | ______________________________________________________________^ +LL | | +LL | | +LL | | +LL | | write!(f, "foo") +LL | | } + | |_____^ the trait `Clone` is not implemented for `B`, which is required by `B: ToOwned` + | + = note: required for `B` to implement `ToOwned` +help: consider further restricting this bound + | +LL | impl<B: ?Sized + std::clone::Clone> Display for Cow<'_, B> { + | +++++++++++++++++++ + +error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/suggestions/fn-trait-notation.fixed b/tests/ui/suggestions/fn-trait-notation.fixed index 6cb97df4a85..fcf00a17002 100644 --- a/tests/ui/suggestions/fn-trait-notation.fixed +++ b/tests/ui/suggestions/fn-trait-notation.fixed @@ -7,12 +7,14 @@ where H: Fn(i32) -> i32, //~ ERROR E0658 { f(3); + //~^ ERROR: cannot use call notation + //~| ERROR: `i32` is not a tuple g(3, 4); h(3) } fn main() { - e0658( + e0658( //~ ERROR: mismatched types |a| a, |a, b| (b, a), |a| a, diff --git a/tests/ui/suggestions/fn-trait-notation.rs b/tests/ui/suggestions/fn-trait-notation.rs index 91251614930..715bcf71d47 100644 --- a/tests/ui/suggestions/fn-trait-notation.rs +++ b/tests/ui/suggestions/fn-trait-notation.rs @@ -7,12 +7,14 @@ where H: Fn<(i32,), Output = i32>, //~ ERROR E0658 { f(3); + //~^ ERROR: cannot use call notation + //~| ERROR: `i32` is not a tuple g(3, 4); h(3) } fn main() { - e0658( + e0658( //~ ERROR: mismatched types |a| a, |a, b| (b, a), |a| a, diff --git a/tests/ui/suggestions/fn-trait-notation.stderr b/tests/ui/suggestions/fn-trait-notation.stderr index b221af18bfc..9b47c8c02a7 100644 --- a/tests/ui/suggestions/fn-trait-notation.stderr +++ b/tests/ui/suggestions/fn-trait-notation.stderr @@ -37,7 +37,40 @@ LL | F: Fn<i32, Output = i32>, note: required by a bound in `Fn` --> $SRC_DIR/core/src/ops/function.rs:LL:COL -error: aborting due to 4 previous errors +error[E0059]: cannot use call notation; the first type parameter for the function trait is neither a tuple nor unit + --> $DIR/fn-trait-notation.rs:9:5 + | +LL | f(3); + | ^^^^ + +error[E0277]: `i32` is not a tuple + --> $DIR/fn-trait-notation.rs:9:5 + | +LL | f(3); + | ^^^^ the trait `Tuple` is not implemented for `i32` + +error[E0308]: mismatched types + --> $DIR/fn-trait-notation.rs:17:5 + | +LL | / e0658( +LL | | |a| a, +LL | | |a, b| (b, a), +LL | | |a| a, +LL | | ); + | |_____^ types differ + | + = note: expected trait `Fn<i32>` + found trait `Fn(_)` +note: required by a bound in `e0658` + --> $DIR/fn-trait-notation.rs:4:8 + | +LL | fn e0658<F, G, H>(f: F, g: G, h: H) -> i32 + | ----- required by a bound in this function +LL | where +LL | F: Fn<i32, Output = i32>, + | ^^^^^^^^^^^^^^^^^^^^^ required by this bound in `e0658` + +error: aborting due to 7 previous errors -Some errors have detailed explanations: E0059, E0658. +Some errors have detailed explanations: E0059, E0277, E0308, E0658. For more information about an error, try `rustc --explain E0059`. diff --git a/tests/ui/suggestions/missing-bound-in-derive-copy-impl-2.fixed b/tests/ui/suggestions/missing-bound-in-derive-copy-impl-2.fixed index ac0b14fba83..269ebd2b75a 100644 --- a/tests/ui/suggestions/missing-bound-in-derive-copy-impl-2.fixed +++ b/tests/ui/suggestions/missing-bound-in-derive-copy-impl-2.fixed @@ -2,15 +2,17 @@ use std::fmt::Debug; #[derive(Debug, Copy, Clone)] -pub struct Vector2<T: Debug + Copy + Clone>{ +pub struct Vector2<T: Debug + Copy + Clone> { pub x: T, - pub y: T + pub y: T, } #[derive(Debug, Copy, Clone)] -pub struct AABB<K: Debug + std::marker::Copy>{ +pub struct AABB<K: Debug + std::marker::Copy + std::marker::Copy + std::marker::Copy + std::marker::Copy> { pub loc: Vector2<K>, //~ ERROR the trait bound `K: Copy` is not satisfied - pub size: Vector2<K> + //~^ ERROR the trait bound `K: Copy` is not satisfied + //~| ERROR the trait bound `K: Copy` is not satisfied + pub size: Vector2<K>, //~ ERROR the trait bound `K: Copy` is not satisfied } fn main() {} diff --git a/tests/ui/suggestions/missing-bound-in-derive-copy-impl-2.rs b/tests/ui/suggestions/missing-bound-in-derive-copy-impl-2.rs index 31f8cd6fcf7..e9455f918bc 100644 --- a/tests/ui/suggestions/missing-bound-in-derive-copy-impl-2.rs +++ b/tests/ui/suggestions/missing-bound-in-derive-copy-impl-2.rs @@ -2,15 +2,17 @@ use std::fmt::Debug; #[derive(Debug, Copy, Clone)] -pub struct Vector2<T: Debug + Copy + Clone>{ +pub struct Vector2<T: Debug + Copy + Clone> { pub x: T, - pub y: T + pub y: T, } #[derive(Debug, Copy, Clone)] -pub struct AABB<K: Debug>{ +pub struct AABB<K: Debug> { pub loc: Vector2<K>, //~ ERROR the trait bound `K: Copy` is not satisfied - pub size: Vector2<K> + //~^ ERROR the trait bound `K: Copy` is not satisfied + //~| ERROR the trait bound `K: Copy` is not satisfied + pub size: Vector2<K>, //~ ERROR the trait bound `K: Copy` is not satisfied } fn main() {} diff --git a/tests/ui/suggestions/missing-bound-in-derive-copy-impl-2.stderr b/tests/ui/suggestions/missing-bound-in-derive-copy-impl-2.stderr index f9db1e1ec00..a2a78ddc705 100644 --- a/tests/ui/suggestions/missing-bound-in-derive-copy-impl-2.stderr +++ b/tests/ui/suggestions/missing-bound-in-derive-copy-impl-2.stderr @@ -7,13 +7,80 @@ LL | pub loc: Vector2<K>, note: required by a bound in `Vector2` --> $DIR/missing-bound-in-derive-copy-impl-2.rs:5:31 | -LL | pub struct Vector2<T: Debug + Copy + Clone>{ +LL | pub struct Vector2<T: Debug + Copy + Clone> { | ^^^^ required by this bound in `Vector2` help: consider further restricting this bound | -LL | pub struct AABB<K: Debug + std::marker::Copy>{ +LL | pub struct AABB<K: Debug + std::marker::Copy> { | +++++++++++++++++++ -error: aborting due to 1 previous error +error[E0277]: the trait bound `K: Copy` is not satisfied + --> $DIR/missing-bound-in-derive-copy-impl-2.rs:12:5 + | +LL | #[derive(Debug, Copy, Clone)] + | ----- in this derive macro expansion +LL | pub struct AABB<K: Debug> { +LL | pub loc: Vector2<K>, + | ^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `K`, which is required by `Vector2<K>: Debug` + | +note: required for `Vector2<K>` to implement `Debug` + --> $DIR/missing-bound-in-derive-copy-impl-2.rs:4:10 + | +LL | #[derive(Debug, Copy, Clone)] + | ^^^^^ +LL | pub struct Vector2<T: Debug + Copy + Clone> { + | ---- unsatisfied trait bound introduced in this `derive` macro + = note: required for the cast from `&Vector2<K>` to `&dyn Debug` + = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info) +help: consider further restricting this bound + | +LL | pub struct AABB<K: Debug + std::marker::Copy> { + | +++++++++++++++++++ + +error[E0277]: the trait bound `K: Copy` is not satisfied + --> $DIR/missing-bound-in-derive-copy-impl-2.rs:12:5 + | +LL | #[derive(Debug, Copy, Clone)] + | ----- in this derive macro expansion +LL | pub struct AABB<K: Debug> { +LL | pub loc: Vector2<K>, + | ^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `K`, which is required by `Vector2<K>: Clone` + | +note: required for `Vector2<K>` to implement `Clone` + --> $DIR/missing-bound-in-derive-copy-impl-2.rs:4:23 + | +LL | #[derive(Debug, Copy, Clone)] + | ^^^^^ +LL | pub struct Vector2<T: Debug + Copy + Clone> { + | ---- unsatisfied trait bound introduced in this `derive` macro + = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) +help: consider further restricting this bound + | +LL | pub struct AABB<K: Debug + std::marker::Copy> { + | +++++++++++++++++++ + +error[E0277]: the trait bound `K: Copy` is not satisfied + --> $DIR/missing-bound-in-derive-copy-impl-2.rs:15:5 + | +LL | #[derive(Debug, Copy, Clone)] + | ----- in this derive macro expansion +... +LL | pub size: Vector2<K>, + | ^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `K`, which is required by `Vector2<K>: Clone` + | +note: required for `Vector2<K>` to implement `Clone` + --> $DIR/missing-bound-in-derive-copy-impl-2.rs:4:23 + | +LL | #[derive(Debug, Copy, Clone)] + | ^^^^^ +LL | pub struct Vector2<T: Debug + Copy + Clone> { + | ---- unsatisfied trait bound introduced in this `derive` macro + = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) +help: consider further restricting this bound + | +LL | pub struct AABB<K: Debug + std::marker::Copy> { + | +++++++++++++++++++ + +error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/suggestions/missing-bound-in-derive-copy-impl-3.fixed b/tests/ui/suggestions/missing-bound-in-derive-copy-impl-3.fixed index 53476ee8c59..8a91e2d5f0d 100644 --- a/tests/ui/suggestions/missing-bound-in-derive-copy-impl-3.fixed +++ b/tests/ui/suggestions/missing-bound-in-derive-copy-impl-3.fixed @@ -8,9 +8,10 @@ pub struct Vector2<T: Debug + Copy + Clone>{ } #[derive(Debug, Copy, Clone)] //~ ERROR the trait `Copy` cannot be implemented for this type -pub struct AABB<K: Copy + Debug + std::fmt::Debug>{ +pub struct AABB<K: Copy + Debug + std::fmt::Debug + std::fmt::Debug + std::fmt::Debug>{ pub loc: Vector2<K>, //~ ERROR `K` doesn't implement `Debug` - pub size: Vector2<K> + //~^ ERROR `K` doesn't implement `Debug` + pub size: Vector2<K> //~ ERROR `K` doesn't implement `Debug` } fn main() {} diff --git a/tests/ui/suggestions/missing-bound-in-derive-copy-impl-3.rs b/tests/ui/suggestions/missing-bound-in-derive-copy-impl-3.rs index 08c4f344e4e..c10f9d46010 100644 --- a/tests/ui/suggestions/missing-bound-in-derive-copy-impl-3.rs +++ b/tests/ui/suggestions/missing-bound-in-derive-copy-impl-3.rs @@ -10,7 +10,8 @@ pub struct Vector2<T: Debug + Copy + Clone>{ #[derive(Debug, Copy, Clone)] //~ ERROR the trait `Copy` cannot be implemented for this type pub struct AABB<K: Copy>{ pub loc: Vector2<K>, //~ ERROR `K` doesn't implement `Debug` - pub size: Vector2<K> + //~^ ERROR `K` doesn't implement `Debug` + pub size: Vector2<K> //~ ERROR `K` doesn't implement `Debug` } fn main() {} diff --git a/tests/ui/suggestions/missing-bound-in-derive-copy-impl-3.stderr b/tests/ui/suggestions/missing-bound-in-derive-copy-impl-3.stderr index bfb96b4076b..2ade0e974e4 100644 --- a/tests/ui/suggestions/missing-bound-in-derive-copy-impl-3.stderr +++ b/tests/ui/suggestions/missing-bound-in-derive-copy-impl-3.stderr @@ -34,7 +34,37 @@ help: consider further restricting this bound LL | pub struct AABB<K: Copy + std::fmt::Debug>{ | +++++++++++++++++ -error: aborting due to 2 previous errors +error[E0277]: `K` doesn't implement `Debug` + --> $DIR/missing-bound-in-derive-copy-impl-3.rs:12:5 + | +LL | #[derive(Debug, Copy, Clone)] + | ----- in this derive macro expansion +LL | pub struct AABB<K: Copy>{ +LL | pub loc: Vector2<K>, + | ^^^^^^^^^^^^^^^^^^^ `K` cannot be formatted using `{:?}` because it doesn't implement `Debug` + | + = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) +help: consider further restricting this bound + | +LL | pub struct AABB<K: Copy + std::fmt::Debug>{ + | +++++++++++++++++ + +error[E0277]: `K` doesn't implement `Debug` + --> $DIR/missing-bound-in-derive-copy-impl-3.rs:14:5 + | +LL | #[derive(Debug, Copy, Clone)] + | ----- in this derive macro expansion +... +LL | pub size: Vector2<K> + | ^^^^^^^^^^^^^^^^^^^^ `K` cannot be formatted using `{:?}` because it doesn't implement `Debug` + | + = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) +help: consider further restricting this bound + | +LL | pub struct AABB<K: Copy + std::fmt::Debug>{ + | +++++++++++++++++ + +error: aborting due to 4 previous errors Some errors have detailed explanations: E0204, E0277. For more information about an error, try `rustc --explain E0204`. diff --git a/tests/ui/suggestions/missing-bound-in-derive-copy-impl.rs b/tests/ui/suggestions/missing-bound-in-derive-copy-impl.rs index 2f1ebc1f133..0ffc1b8f7a2 100644 --- a/tests/ui/suggestions/missing-bound-in-derive-copy-impl.rs +++ b/tests/ui/suggestions/missing-bound-in-derive-copy-impl.rs @@ -1,17 +1,22 @@ use std::fmt::Debug; #[derive(Debug, Copy, Clone)] -pub struct Vector2<T: Debug + Copy + Clone>{ +pub struct Vector2<T: Debug + Copy + Clone> { pub x: T, - pub y: T + pub y: T, } #[derive(Debug, Copy, Clone)] //~ ERROR the trait `Copy` cannot be implemented for this type -pub struct AABB<K>{ +pub struct AABB<K> { pub loc: Vector2<K>, //~^ ERROR doesn't implement `Debug` //~| ERROR `K: Copy` is not satisfied - pub size: Vector2<K> + //~| ERROR doesn't implement `Debug` + //~| ERROR `K: Copy` is not satisfied + //~| ERROR `K: Copy` is not satisfied + pub size: Vector2<K>, + //~^ ERROR doesn't implement `Debug` + //~| ERROR `K: Copy` is not satisfied } fn main() {} diff --git a/tests/ui/suggestions/missing-bound-in-derive-copy-impl.stderr b/tests/ui/suggestions/missing-bound-in-derive-copy-impl.stderr index f3213e1a4c8..2ae0871b815 100644 --- a/tests/ui/suggestions/missing-bound-in-derive-copy-impl.stderr +++ b/tests/ui/suggestions/missing-bound-in-derive-copy-impl.stderr @@ -3,7 +3,7 @@ error[E0204]: the trait `Copy` cannot be implemented for this type | LL | #[derive(Debug, Copy, Clone)] | ^^^^ -LL | pub struct AABB<K>{ +LL | pub struct AABB<K> { LL | pub loc: Vector2<K>, | ------------------- this field does not implement `Copy` | @@ -15,7 +15,7 @@ LL | pub loc: Vector2<K>, = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider restricting type parameter `K` | -LL | pub struct AABB<K: Debug>{ +LL | pub struct AABB<K: Debug> { | +++++++ error[E0277]: `K` doesn't implement `Debug` @@ -27,11 +27,11 @@ LL | pub loc: Vector2<K>, note: required by a bound in `Vector2` --> $DIR/missing-bound-in-derive-copy-impl.rs:4:23 | -LL | pub struct Vector2<T: Debug + Copy + Clone>{ +LL | pub struct Vector2<T: Debug + Copy + Clone> { | ^^^^^ required by this bound in `Vector2` help: consider restricting type parameter `K` | -LL | pub struct AABB<K: std::fmt::Debug>{ +LL | pub struct AABB<K: std::fmt::Debug> { | +++++++++++++++++ error[E0277]: the trait bound `K: Copy` is not satisfied @@ -43,14 +43,111 @@ LL | pub loc: Vector2<K>, note: required by a bound in `Vector2` --> $DIR/missing-bound-in-derive-copy-impl.rs:4:31 | -LL | pub struct Vector2<T: Debug + Copy + Clone>{ +LL | pub struct Vector2<T: Debug + Copy + Clone> { | ^^^^ required by this bound in `Vector2` help: consider restricting type parameter `K` | -LL | pub struct AABB<K: std::marker::Copy>{ +LL | pub struct AABB<K: std::marker::Copy> { | +++++++++++++++++++ -error: aborting due to 3 previous errors +error[E0277]: the trait bound `K: Copy` is not satisfied + --> $DIR/missing-bound-in-derive-copy-impl.rs:11:5 + | +LL | #[derive(Debug, Copy, Clone)] + | ----- in this derive macro expansion +LL | pub struct AABB<K> { +LL | pub loc: Vector2<K>, + | ^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `K`, which is required by `Vector2<K>: Debug` + | +note: required for `Vector2<K>` to implement `Debug` + --> $DIR/missing-bound-in-derive-copy-impl.rs:3:10 + | +LL | #[derive(Debug, Copy, Clone)] + | ^^^^^ +LL | pub struct Vector2<T: Debug + Copy + Clone> { + | ---- unsatisfied trait bound introduced in this `derive` macro + = note: required for the cast from `&Vector2<K>` to `&dyn Debug` + = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info) +help: consider restricting type parameter `K` + | +LL | pub struct AABB<K: std::marker::Copy> { + | +++++++++++++++++++ + +error[E0277]: `K` doesn't implement `Debug` + --> $DIR/missing-bound-in-derive-copy-impl.rs:11:5 + | +LL | #[derive(Debug, Copy, Clone)] + | ----- in this derive macro expansion +LL | pub struct AABB<K> { +LL | pub loc: Vector2<K>, + | ^^^^^^^^^^^^^^^^^^^ `K` cannot be formatted using `{:?}` because it doesn't implement `Debug` + | + = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) +help: consider restricting type parameter `K` + | +LL | pub struct AABB<K: std::fmt::Debug> { + | +++++++++++++++++ + +error[E0277]: the trait bound `K: Copy` is not satisfied + --> $DIR/missing-bound-in-derive-copy-impl.rs:11:5 + | +LL | #[derive(Debug, Copy, Clone)] + | ----- in this derive macro expansion +LL | pub struct AABB<K> { +LL | pub loc: Vector2<K>, + | ^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `K`, which is required by `Vector2<K>: Clone` + | +note: required for `Vector2<K>` to implement `Clone` + --> $DIR/missing-bound-in-derive-copy-impl.rs:3:23 + | +LL | #[derive(Debug, Copy, Clone)] + | ^^^^^ +LL | pub struct Vector2<T: Debug + Copy + Clone> { + | ---- unsatisfied trait bound introduced in this `derive` macro + = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) +help: consider restricting type parameter `K` + | +LL | pub struct AABB<K: std::marker::Copy> { + | +++++++++++++++++++ + +error[E0277]: `K` doesn't implement `Debug` + --> $DIR/missing-bound-in-derive-copy-impl.rs:17:5 + | +LL | #[derive(Debug, Copy, Clone)] + | ----- in this derive macro expansion +... +LL | pub size: Vector2<K>, + | ^^^^^^^^^^^^^^^^^^^^ `K` cannot be formatted using `{:?}` because it doesn't implement `Debug` + | + = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) +help: consider restricting type parameter `K` + | +LL | pub struct AABB<K: std::fmt::Debug> { + | +++++++++++++++++ + +error[E0277]: the trait bound `K: Copy` is not satisfied + --> $DIR/missing-bound-in-derive-copy-impl.rs:17:5 + | +LL | #[derive(Debug, Copy, Clone)] + | ----- in this derive macro expansion +... +LL | pub size: Vector2<K>, + | ^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `K`, which is required by `Vector2<K>: Clone` + | +note: required for `Vector2<K>` to implement `Clone` + --> $DIR/missing-bound-in-derive-copy-impl.rs:3:23 + | +LL | #[derive(Debug, Copy, Clone)] + | ^^^^^ +LL | pub struct Vector2<T: Debug + Copy + Clone> { + | ---- unsatisfied trait bound introduced in this `derive` macro + = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) +help: consider restricting type parameter `K` + | +LL | pub struct AABB<K: std::marker::Copy> { + | +++++++++++++++++++ + +error: aborting due to 8 previous errors Some errors have detailed explanations: E0204, E0277. For more information about an error, try `rustc --explain E0204`. diff --git a/tests/ui/suggestions/object-unsafe-trait-references-self.rs b/tests/ui/suggestions/object-unsafe-trait-references-self.rs index 07bf053e996..4b3d5faba46 100644 --- a/tests/ui/suggestions/object-unsafe-trait-references-self.rs +++ b/tests/ui/suggestions/object-unsafe-trait-references-self.rs @@ -1,6 +1,9 @@ trait Trait { fn baz(&self, _: Self) {} + //~^ ERROR the size for values of type `Self` cannot be known fn bat(&self) -> Self {} + //~^ ERROR mismatched types + //~| ERROR the size for values of type `Self` cannot be known } fn bar(x: &dyn Trait) {} //~ ERROR the trait `Trait` cannot be made into an object diff --git a/tests/ui/suggestions/object-unsafe-trait-references-self.stderr b/tests/ui/suggestions/object-unsafe-trait-references-self.stderr index 54f19fe9da4..64270068471 100644 --- a/tests/ui/suggestions/object-unsafe-trait-references-self.stderr +++ b/tests/ui/suggestions/object-unsafe-trait-references-self.stderr @@ -1,5 +1,5 @@ error[E0038]: the trait `Trait` cannot be made into an object - --> $DIR/object-unsafe-trait-references-self.rs:6:12 + --> $DIR/object-unsafe-trait-references-self.rs:9:12 | LL | fn bar(x: &dyn Trait) {} | ^^^^^^^^^ `Trait` cannot be made into an object @@ -11,25 +11,67 @@ LL | trait Trait { | ----- this trait cannot be made into an object... LL | fn baz(&self, _: Self) {} | ^^^^ ...because method `baz` references the `Self` type in this parameter +LL | LL | fn bat(&self) -> Self {} | ^^^^ ...because method `bat` references the `Self` type in its return type = help: consider moving `baz` to another trait = help: consider moving `bat` to another trait error[E0038]: the trait `Other` cannot be made into an object - --> $DIR/object-unsafe-trait-references-self.rs:10:12 + --> $DIR/object-unsafe-trait-references-self.rs:13:12 | LL | fn foo(x: &dyn Other) {} | ^^^^^^^^^ `Other` cannot be made into an object | note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> - --> $DIR/object-unsafe-trait-references-self.rs:8:14 + --> $DIR/object-unsafe-trait-references-self.rs:11:14 | LL | trait Other: Sized {} | ----- ^^^^^ ...because it requires `Self: Sized` | | | this trait cannot be made into an object... -error: aborting due to 2 previous errors +error[E0277]: the size for values of type `Self` cannot be known at compilation time + --> $DIR/object-unsafe-trait-references-self.rs:2:19 + | +LL | fn baz(&self, _: Self) {} + | ^ doesn't have a size known at compile-time + | + = help: unsized fn params are gated as an unstable feature +help: consider further restricting `Self` + | +LL | fn baz(&self, _: Self) where Self: Sized {} + | +++++++++++++++++ +help: function arguments must have a statically known size, borrowed types always have a known size + | +LL | fn baz(&self, _: &Self) {} + | + + +error[E0308]: mismatched types + --> $DIR/object-unsafe-trait-references-self.rs:4:27 + | +LL | trait Trait { + | ----------- expected this type parameter +... +LL | fn bat(&self) -> Self {} + | ^^ expected type parameter `Self`, found `()` + | + = note: expected type parameter `Self` + found unit type `()` + +error[E0277]: the size for values of type `Self` cannot be known at compilation time + --> $DIR/object-unsafe-trait-references-self.rs:4:22 + | +LL | fn bat(&self) -> Self {} + | ^^^^ doesn't have a size known at compile-time + | + = note: the return type of a function must have a statically known size +help: consider further restricting `Self` + | +LL | fn bat(&self) -> Self where Self: Sized {} + | +++++++++++++++++ + +error: aborting due to 5 previous errors -For more information about this error, try `rustc --explain E0038`. +Some errors have detailed explanations: E0038, E0277, E0308. +For more information about an error, try `rustc --explain E0038`. diff --git a/tests/ui/thread-local/thread-local-static.rs b/tests/ui/thread-local/thread-local-static.rs index dac9259a6a6..a2c1954881f 100644 --- a/tests/ui/thread-local/thread-local-static.rs +++ b/tests/ui/thread-local/thread-local-static.rs @@ -2,14 +2,14 @@ #![feature(thread_local)] #![feature(const_swap)] +#![allow(static_mut_ref)] #[thread_local] static mut STATIC_VAR_2: [u32; 8] = [4; 8]; const fn g(x: &mut [u32; 8]) { //~^ ERROR mutable references are not allowed std::mem::swap(x, &mut STATIC_VAR_2) - //~^ WARN mutable reference of mutable static is discouraged [static_mut_ref] - //~^^ ERROR thread-local statics cannot be accessed + //~^ ERROR thread-local statics cannot be accessed //~| ERROR mutable references are not allowed //~| ERROR use of mutable static is unsafe } diff --git a/tests/ui/thread-local/thread-local-static.stderr b/tests/ui/thread-local/thread-local-static.stderr index 3dd1e2d4000..a6499fd15ec 100644 --- a/tests/ui/thread-local/thread-local-static.stderr +++ b/tests/ui/thread-local/thread-local-static.stderr @@ -1,20 +1,5 @@ -warning: mutable reference of mutable static is discouraged - --> $DIR/thread-local-static.rs:10:23 - | -LL | std::mem::swap(x, &mut STATIC_VAR_2) - | ^^^^^^^^^^^^^^^^^ mutable reference of mutable static - | - = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447> - = note: reference of mutable static is a hard error from 2024 edition - = note: mutable statics can be written to by multiple threads: aliasing violations or data races will cause undefined behavior - = note: `#[warn(static_mut_ref)]` on by default -help: mutable references are dangerous since if there's any other pointer or reference used for that static while the reference lives, that's UB; use `addr_of_mut!` instead to create a raw pointer - | -LL | std::mem::swap(x, addr_of_mut!(STATIC_VAR_2)) - | ~~~~~~~~~~~~~~~~~~~~~~~~~~ - error[E0133]: use of mutable static is unsafe and requires unsafe function or block - --> $DIR/thread-local-static.rs:10:28 + --> $DIR/thread-local-static.rs:11:28 | LL | std::mem::swap(x, &mut STATIC_VAR_2) | ^^^^^^^^^^^^ use of mutable static @@ -22,7 +7,7 @@ LL | std::mem::swap(x, &mut STATIC_VAR_2) = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior error[E0658]: mutable references are not allowed in constant functions - --> $DIR/thread-local-static.rs:8:12 + --> $DIR/thread-local-static.rs:9:12 | LL | const fn g(x: &mut [u32; 8]) { | ^ @@ -32,13 +17,13 @@ LL | const fn g(x: &mut [u32; 8]) { = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0625]: thread-local statics cannot be accessed at compile-time - --> $DIR/thread-local-static.rs:10:28 + --> $DIR/thread-local-static.rs:11:28 | LL | std::mem::swap(x, &mut STATIC_VAR_2) | ^^^^^^^^^^^^ error[E0658]: mutable references are not allowed in constant functions - --> $DIR/thread-local-static.rs:10:23 + --> $DIR/thread-local-static.rs:11:23 | LL | std::mem::swap(x, &mut STATIC_VAR_2) | ^^^^^^^^^^^^^^^^^ @@ -47,7 +32,7 @@ LL | std::mem::swap(x, &mut STATIC_VAR_2) = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error: aborting due to 4 previous errors; 1 warning emitted +error: aborting due to 4 previous errors Some errors have detailed explanations: E0133, E0625, E0658. For more information about an error, try `rustc --explain E0133`. diff --git a/tests/ui/thread-local/thread-local-static.thir.stderr b/tests/ui/thread-local/thread-local-static.thir.stderr deleted file mode 100644 index 2043b268c09..00000000000 --- a/tests/ui/thread-local/thread-local-static.thir.stderr +++ /dev/null @@ -1,59 +0,0 @@ -warning: mutable reference of mutable static is discouraged - --> $DIR/thread-local-static.rs:12:23 - | -LL | std::mem::swap(x, &mut STATIC_VAR_2) - | ^^^^^^^^^^^^^^^^^ mutable reference of mutable static - | - = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447> - = note: reference of mutable static is a hard error from 2024 edition - = note: mutable statics can be written to by multiple threads: aliasing violations or data races will cause undefined behavior - = note: `#[warn(static_mut_ref)]` on by default -help: mutable references are dangerous since if there's any other pointer or reference used for that static while the reference lives, that's UB; use `addr_of_mut!` instead to create a raw pointer - | -LL | std::mem::swap(x, addr_of_mut!(STATIC_VAR_2)) - | ~~~~~~~~~~~~~~~~~~~~~~~~~~ - -error[E0658]: mutable references are not allowed in constant functions - --> $DIR/thread-local-static.rs:10:12 - | -LL | const fn g(x: &mut [u32; 8]) { - | ^ - | - = note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information - = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable - -error[E0625]: thread-local statics cannot be accessed at compile-time - --> $DIR/thread-local-static.rs:12:28 - | -LL | std::mem::swap(x, &mut STATIC_VAR_2) - | ^^^^^^^^^^^^ - -error[E0013]: constant functions cannot refer to statics - --> $DIR/thread-local-static.rs:12:28 - | -LL | std::mem::swap(x, &mut STATIC_VAR_2) - | ^^^^^^^^^^^^ - | - = help: consider extracting the value of the `static` to a `const`, and referring to that - -error[E0658]: mutable references are not allowed in constant functions - --> $DIR/thread-local-static.rs:12:23 - | -LL | std::mem::swap(x, &mut STATIC_VAR_2) - | ^^^^^^^^^^^^^^^^^ - | - = note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information - = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable - -error[E0133]: use of mutable static is unsafe and requires unsafe function or block - --> $DIR/thread-local-static.rs:12:23 - | -LL | std::mem::swap(x, &mut STATIC_VAR_2) - | ^^^^^^^^^^^^^^^^^ use of mutable static - | - = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior - -error: aborting due to 5 previous errors; 1 warning emitted - -Some errors have detailed explanations: E0013, E0133, E0625, E0658. -For more information about an error, try `rustc --explain E0013`. diff --git a/tests/ui/trait-bounds/impl-bound-with-references-error.rs b/tests/ui/trait-bounds/impl-bound-with-references-error.rs index e5d0a1aaed0..5ba35da8383 100644 --- a/tests/ui/trait-bounds/impl-bound-with-references-error.rs +++ b/tests/ui/trait-bounds/impl-bound-with-references-error.rs @@ -13,7 +13,7 @@ where //~^ ERROR cannot find type `Cow` in this scope [E0412] { fn from(text: T) -> Self { - LabelText::Plain(text.into()) + LabelText::Plain(text.into()) //~ ERROR expected function, found `LabelText` } } diff --git a/tests/ui/trait-bounds/impl-bound-with-references-error.stderr b/tests/ui/trait-bounds/impl-bound-with-references-error.stderr index 63280b8616f..b3ac5544e38 100644 --- a/tests/ui/trait-bounds/impl-bound-with-references-error.stderr +++ b/tests/ui/trait-bounds/impl-bound-with-references-error.stderr @@ -21,7 +21,18 @@ LL | | T: Into<Cow<'static, str>>, = note: conflicting implementation in crate `core`: - impl<T> From<T> for T; -error: aborting due to 2 previous errors +error[E0618]: expected function, found `LabelText` + --> $DIR/impl-bound-with-references-error.rs:16:9 + | +LL | Plain, + | ----- `LabelText::Plain` defined here +... +LL | LabelText::Plain(text.into()) + | ^^^^^^^^^^^^^^^^------------- + | | + | call expression requires function + +error: aborting due to 3 previous errors -Some errors have detailed explanations: E0119, E0412. +Some errors have detailed explanations: E0119, E0412, E0618. For more information about an error, try `rustc --explain E0119`. diff --git a/tests/ui/trait-impl-bound-suggestions.fixed b/tests/ui/trait-impl-bound-suggestions.fixed index fb11286a175..342841b4838 100644 --- a/tests/ui/trait-impl-bound-suggestions.fixed +++ b/tests/ui/trait-impl-bound-suggestions.fixed @@ -10,19 +10,21 @@ struct ConstrainedStruct<X: Copy> { } #[allow(dead_code)] -trait InsufficientlyConstrainedGeneric<X=()> where X: std::marker::Copy { +trait InsufficientlyConstrainedGeneric<X=()> where Self: Sized, X: std::marker::Copy, X: std::marker::Copy { fn return_the_constrained_type(&self, x: X) -> ConstrainedStruct<X> { //~^ ERROR the trait bound `X: Copy` is not satisfied ConstrainedStruct { x } + //~^ ERROR the trait bound `X: Copy` is not satisfied } } // Regression test for #120838 #[allow(dead_code)] -trait InsufficientlyConstrainedGenericWithEmptyWhere<X=()> where X: std::marker::Copy { +trait InsufficientlyConstrainedGenericWithEmptyWhere<X=()> where Self: Sized, X: std::marker::Copy, X: std::marker::Copy { fn return_the_constrained_type(&self, x: X) -> ConstrainedStruct<X> { //~^ ERROR the trait bound `X: Copy` is not satisfied ConstrainedStruct { x } + //~^ ERROR the trait bound `X: Copy` is not satisfied } } diff --git a/tests/ui/trait-impl-bound-suggestions.rs b/tests/ui/trait-impl-bound-suggestions.rs index 46130a5e766..9a494402260 100644 --- a/tests/ui/trait-impl-bound-suggestions.rs +++ b/tests/ui/trait-impl-bound-suggestions.rs @@ -10,19 +10,21 @@ struct ConstrainedStruct<X: Copy> { } #[allow(dead_code)] -trait InsufficientlyConstrainedGeneric<X=()> { +trait InsufficientlyConstrainedGeneric<X=()> where Self: Sized { fn return_the_constrained_type(&self, x: X) -> ConstrainedStruct<X> { //~^ ERROR the trait bound `X: Copy` is not satisfied ConstrainedStruct { x } + //~^ ERROR the trait bound `X: Copy` is not satisfied } } // Regression test for #120838 #[allow(dead_code)] -trait InsufficientlyConstrainedGenericWithEmptyWhere<X=()> where { +trait InsufficientlyConstrainedGenericWithEmptyWhere<X=()> where Self: Sized { fn return_the_constrained_type(&self, x: X) -> ConstrainedStruct<X> { //~^ ERROR the trait bound `X: Copy` is not satisfied ConstrainedStruct { x } + //~^ ERROR the trait bound `X: Copy` is not satisfied } } diff --git a/tests/ui/trait-impl-bound-suggestions.stderr b/tests/ui/trait-impl-bound-suggestions.stderr index 9883c5bda01..6a75cbdf639 100644 --- a/tests/ui/trait-impl-bound-suggestions.stderr +++ b/tests/ui/trait-impl-bound-suggestions.stderr @@ -11,11 +11,11 @@ LL | struct ConstrainedStruct<X: Copy> { | ^^^^ required by this bound in `ConstrainedStruct` help: consider further restricting type parameter `X` | -LL | trait InsufficientlyConstrainedGeneric<X=()> where X: std::marker::Copy { - | ++++++++++++++++++++++++++ +LL | trait InsufficientlyConstrainedGeneric<X=()> where Self: Sized, X: std::marker::Copy { + | ++++++++++++++++++++++ error[E0277]: the trait bound `X: Copy` is not satisfied - --> $DIR/trait-impl-bound-suggestions.rs:23:52 + --> $DIR/trait-impl-bound-suggestions.rs:24:52 | LL | fn return_the_constrained_type(&self, x: X) -> ConstrainedStruct<X> { | ^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `X` @@ -27,9 +27,41 @@ LL | struct ConstrainedStruct<X: Copy> { | ^^^^ required by this bound in `ConstrainedStruct` help: consider further restricting type parameter `X` | -LL | trait InsufficientlyConstrainedGenericWithEmptyWhere<X=()> where X: std::marker::Copy { - | ++++++++++++++++++++ +LL | trait InsufficientlyConstrainedGenericWithEmptyWhere<X=()> where Self: Sized, X: std::marker::Copy { + | ++++++++++++++++++++++ -error: aborting due to 2 previous errors +error[E0277]: the trait bound `X: Copy` is not satisfied + --> $DIR/trait-impl-bound-suggestions.rs:16:29 + | +LL | ConstrainedStruct { x } + | ^ the trait `Copy` is not implemented for `X` + | +note: required by a bound in `ConstrainedStruct` + --> $DIR/trait-impl-bound-suggestions.rs:8:29 + | +LL | struct ConstrainedStruct<X: Copy> { + | ^^^^ required by this bound in `ConstrainedStruct` +help: consider further restricting type parameter `X` + | +LL | trait InsufficientlyConstrainedGeneric<X=()> where Self: Sized, X: std::marker::Copy { + | ++++++++++++++++++++++ + +error[E0277]: the trait bound `X: Copy` is not satisfied + --> $DIR/trait-impl-bound-suggestions.rs:26:29 + | +LL | ConstrainedStruct { x } + | ^ the trait `Copy` is not implemented for `X` + | +note: required by a bound in `ConstrainedStruct` + --> $DIR/trait-impl-bound-suggestions.rs:8:29 + | +LL | struct ConstrainedStruct<X: Copy> { + | ^^^^ required by this bound in `ConstrainedStruct` +help: consider further restricting type parameter `X` + | +LL | trait InsufficientlyConstrainedGenericWithEmptyWhere<X=()> where Self: Sized, X: std::marker::Copy { + | ++++++++++++++++++++++ + +error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/issue-106072.rs b/tests/ui/traits/issue-106072.rs index d38d3c3b286..8adbac46a5b 100644 --- a/tests/ui/traits/issue-106072.rs +++ b/tests/ui/traits/issue-106072.rs @@ -1,5 +1,6 @@ #[derive(Clone)] //~ trait objects must include the `dyn` keyword //~^ ERROR: the size for values of type `(dyn Foo + 'static)` cannot be known +//~| ERROR: return type cannot have an unboxed trait object struct Foo; trait Foo {} //~ the name `Foo` is defined multiple times fn main() {} diff --git a/tests/ui/traits/issue-106072.stderr b/tests/ui/traits/issue-106072.stderr index aadadc45f21..6476c8b3237 100644 --- a/tests/ui/traits/issue-106072.stderr +++ b/tests/ui/traits/issue-106072.stderr @@ -1,5 +1,5 @@ error[E0428]: the name `Foo` is defined multiple times - --> $DIR/issue-106072.rs:4:1 + --> $DIR/issue-106072.rs:5:1 | LL | struct Foo; | ----------- previous definition of the type `Foo` here @@ -19,6 +19,14 @@ note: required by a bound in `Clone` --> $SRC_DIR/core/src/clone.rs:LL:COL = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) +error[E0746]: return type cannot have an unboxed trait object + --> $DIR/issue-106072.rs:1:10 + | +LL | #[derive(Clone)] + | ^^^^^ doesn't have a size known at compile-time + | + = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) + error[E0782]: trait objects must include the `dyn` keyword --> $DIR/issue-106072.rs:1:10 | @@ -27,7 +35,7 @@ LL | #[derive(Clone)] | = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) -error: aborting due to 3 previous errors +error: aborting due to 4 previous errors -Some errors have detailed explanations: E0277, E0428, E0782. +Some errors have detailed explanations: E0277, E0428, E0746, E0782. For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/issue-33140-hack-boundaries.stderr b/tests/ui/traits/issue-33140-hack-boundaries.stderr index 06e1dfd3727..d9c4efbb721 100644 --- a/tests/ui/traits/issue-33140-hack-boundaries.stderr +++ b/tests/ui/traits/issue-33140-hack-boundaries.stderr @@ -77,9 +77,4 @@ LL | impl Trait0 for dyn Send {} | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #56484 <https://github.com/rust-lang/rust/issues/56484> -note: the lint level is defined here - --> $DIR/issue-33140-hack-boundaries.rs:2:10 - | -LL | #![allow(order_dependent_trait_objects)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/issues/issue-5008-borrowed-traitobject-method-call.rs b/tests/ui/traits/issue-5008-borrowed-traitobject-method-call.rs index fc869ae4fec..fc869ae4fec 100644 --- a/tests/ui/issues/issue-5008-borrowed-traitobject-method-call.rs +++ b/tests/ui/traits/issue-5008-borrowed-traitobject-method-call.rs diff --git a/tests/ui/traits/issue-50480.rs b/tests/ui/traits/issue-50480.rs index cc7ea32eb3a..ccd35a850f2 100644 --- a/tests/ui/traits/issue-50480.rs +++ b/tests/ui/traits/issue-50480.rs @@ -6,12 +6,15 @@ struct Foo(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String); //~| ERROR cannot find type `N` in this scope //~| ERROR cannot find type `N` in this scope //~| ERROR `i32` is not an iterator +//~| ERROR `i32` is not an iterator #[derive(Clone, Copy)] //~^ ERROR the trait `Copy` cannot be implemented for this type +//~| ERROR `i32` is not an iterator struct Bar<T>(T, N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String); //~^ ERROR cannot find type `NotDefined` in this scope //~| ERROR cannot find type `N` in this scope //~| ERROR `i32` is not an iterator +//~| ERROR `i32` is not an iterator fn main() {} diff --git a/tests/ui/traits/issue-50480.stderr b/tests/ui/traits/issue-50480.stderr index 68d3d5c80d0..6c019f59b09 100644 --- a/tests/ui/traits/issue-50480.stderr +++ b/tests/ui/traits/issue-50480.stderr @@ -38,7 +38,7 @@ LL | struct Foo<NotDefined>(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, St | ++++++++++++ error[E0412]: cannot find type `N` in this scope - --> $DIR/issue-50480.rs:12:18 + --> $DIR/issue-50480.rs:14:18 | LL | struct Bar<T>(T, N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String); | - ^ @@ -55,7 +55,7 @@ LL | struct Bar<T, N>(T, N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, Strin | +++ error[E0412]: cannot find type `NotDefined` in this scope - --> $DIR/issue-50480.rs:12:21 + --> $DIR/issue-50480.rs:14:21 | LL | struct Bar<T>(T, N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String); | ^^^^^^^^^^ not found in this scope @@ -74,11 +74,11 @@ LL | struct Foo(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String); = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0204]: the trait `Copy` cannot be implemented for this type - --> $DIR/issue-50480.rs:10:17 + --> $DIR/issue-50480.rs:11:17 | LL | #[derive(Clone, Copy)] | ^^^^ -LL | +... LL | struct Bar<T>(T, N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String); | -------- ------ this field does not implement `Copy` | | @@ -96,15 +96,47 @@ LL | struct Foo(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String); = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end` error[E0277]: `i32` is not an iterator - --> $DIR/issue-50480.rs:12:33 + --> $DIR/issue-50480.rs:14:33 + | +LL | struct Bar<T>(T, N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String); + | ^^^^^^^^^^^^^^^^^^^^^^^ `i32` is not an iterator + | + = help: the trait `Iterator` is not implemented for `i32` + = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end` + +error[E0277]: `i32` is not an iterator + --> $DIR/issue-50480.rs:3:28 + | +LL | struct Foo(N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String); + | ^^^ `i32` is not an iterator + | + = help: the trait `Iterator` is not implemented for `i32` + = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end` + +error[E0277]: `i32` is not an iterator + --> $DIR/issue-50480.rs:11:10 + | +LL | #[derive(Clone, Copy)] + | ^^^^^ `i32` is not an iterator + | + = help: the trait `Iterator` is not implemented for `i32` + = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end` + = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0277]: `i32` is not an iterator + --> $DIR/issue-50480.rs:14:33 | +LL | #[derive(Clone, Copy)] + | ----- in this derive macro expansion +... LL | struct Bar<T>(T, N, NotDefined, <i32 as Iterator>::Item, Vec<i32>, String); | ^^^^^^^^^^^^^^^^^^^^^^^ `i32` is not an iterator | = help: the trait `Iterator` is not implemented for `i32` = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end` + = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) -error: aborting due to 10 previous errors +error: aborting due to 13 previous errors Some errors have detailed explanations: E0204, E0277, E0412. For more information about an error, try `rustc --explain E0204`. diff --git a/tests/ui/traits/next-solver/deduce-closure-signature-after-normalization.rs b/tests/ui/traits/next-solver/deduce-closure-signature-after-normalization.rs index 08f26686b2f..f9f5a1dc24d 100644 --- a/tests/ui/traits/next-solver/deduce-closure-signature-after-normalization.rs +++ b/tests/ui/traits/next-solver/deduce-closure-signature-after-normalization.rs @@ -1,9 +1,10 @@ // compile-flags: -Znext-solver -// check-pass - +// FIXME(-Znext-solver): This test is currently broken because the `deduce_closure_signature` +// is unable to look at nested obligations. trait Foo { fn test() -> impl Fn(u32) -> u32 { |x| x.count_ones() + //~^ ERROR type annotations needed } } diff --git a/tests/ui/traits/next-solver/deduce-closure-signature-after-normalization.stderr b/tests/ui/traits/next-solver/deduce-closure-signature-after-normalization.stderr new file mode 100644 index 00000000000..3d7cd1af467 --- /dev/null +++ b/tests/ui/traits/next-solver/deduce-closure-signature-after-normalization.stderr @@ -0,0 +1,14 @@ +error[E0282]: type annotations needed + --> $DIR/deduce-closure-signature-after-normalization.rs:6:10 + | +LL | |x| x.count_ones() + | ^ - type must be known at this point + | +help: consider giving this closure parameter an explicit type + | +LL | |x: /* Type */| x.count_ones() + | ++++++++++++ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/traits/next-solver/dont-type_of-tait-in-defining-scope.is_send.stderr b/tests/ui/traits/next-solver/dont-type_of-tait-in-defining-scope.is_send.stderr index bafc4ba18a7..158fefd1538 100644 --- a/tests/ui/traits/next-solver/dont-type_of-tait-in-defining-scope.is_send.stderr +++ b/tests/ui/traits/next-solver/dont-type_of-tait-in-defining-scope.is_send.stderr @@ -1,16 +1,9 @@ -error[E0283]: type annotations needed: cannot satisfy `Foo: Send` +error[E0284]: type annotations needed: cannot satisfy `Foo == _` --> $DIR/dont-type_of-tait-in-defining-scope.rs:15:18 | 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:12:18 - | -LL | fn needs_send<T: Send>() {} - | ^^^^ required by this bound in `needs_send` + | ^^^ cannot satisfy `Foo == _` error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0283`. +For more information about this error, try `rustc --explain E0284`. diff --git a/tests/ui/traits/next-solver/dont-type_of-tait-in-defining-scope.not_send.stderr b/tests/ui/traits/next-solver/dont-type_of-tait-in-defining-scope.not_send.stderr index bafc4ba18a7..158fefd1538 100644 --- a/tests/ui/traits/next-solver/dont-type_of-tait-in-defining-scope.not_send.stderr +++ b/tests/ui/traits/next-solver/dont-type_of-tait-in-defining-scope.not_send.stderr @@ -1,16 +1,9 @@ -error[E0283]: type annotations needed: cannot satisfy `Foo: Send` +error[E0284]: type annotations needed: cannot satisfy `Foo == _` --> $DIR/dont-type_of-tait-in-defining-scope.rs:15:18 | 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:12:18 - | -LL | fn needs_send<T: Send>() {} - | ^^^^ required by this bound in `needs_send` + | ^^^ cannot satisfy `Foo == _` error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0283`. +For more information about this error, try `rustc --explain E0284`. diff --git a/tests/ui/traits/next-solver/dont-type_of-tait-in-defining-scope.rs b/tests/ui/traits/next-solver/dont-type_of-tait-in-defining-scope.rs index ef0360248b5..9720a653e2b 100644 --- a/tests/ui/traits/next-solver/dont-type_of-tait-in-defining-scope.rs +++ b/tests/ui/traits/next-solver/dont-type_of-tait-in-defining-scope.rs @@ -13,7 +13,7 @@ fn needs_send<T: Send>() {} fn test(_: Foo) { needs_send::<Foo>(); - //~^ ERROR type annotations needed: cannot satisfy `Foo: Send` + //~^ ERROR type annotations needed: cannot satisfy `Foo == _` } fn defines(_: Foo) { diff --git a/tests/ui/traits/next-solver/normalize-param-env-2.stderr b/tests/ui/traits/next-solver/normalize-param-env-2.stderr index a52022e539e..86729eb8a4b 100644 --- a/tests/ui/traits/next-solver/normalize-param-env-2.stderr +++ b/tests/ui/traits/next-solver/normalize-param-env-2.stderr @@ -30,6 +30,30 @@ LL | Self::Assoc: A<T>, | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`normalize_param_env_2`) -error: aborting due to 3 previous errors +error[E0275]: overflow evaluating the requirement `(): A<T>` + --> $DIR/normalize-param-env-2.rs:27:10 + | +LL | <() as A<T>>::f(); + | ^^ + | + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`normalize_param_env_2`) + +error[E0275]: overflow evaluating the requirement `<() as A<T>>::Assoc: A<T>` + --> $DIR/normalize-param-env-2.rs:27:9 + | +LL | <() as A<T>>::f(); + | ^^^^^^^^^^^^^^^^^ + | + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`normalize_param_env_2`) +note: required by a bound in `A::f` + --> $DIR/normalize-param-env-2.rs:14:22 + | +LL | fn f() + | - required by a bound in this associated function +LL | where +LL | Self::Assoc: A<T>, + | ^^^^ required by this bound in `A::f` + +error: aborting due to 5 previous errors For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/traits/next-solver/normalize-param-env-4.next.stderr b/tests/ui/traits/next-solver/normalize-param-env-4.next.stderr index dec820c61b0..2a017fac104 100644 --- a/tests/ui/traits/next-solver/normalize-param-env-4.next.stderr +++ b/tests/ui/traits/next-solver/normalize-param-env-4.next.stderr @@ -14,6 +14,19 @@ LL | <T as Trait>::Assoc: Trait, | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`normalize_param_env_4`) -error: aborting due to 2 previous errors +error[E0275]: overflow evaluating the requirement `T: Trait` + --> $DIR/normalize-param-env-4.rs:31:19 + | +LL | impls_trait::<T>(); + | ^ + | + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`normalize_param_env_4`) +note: required by a bound in `impls_trait` + --> $DIR/normalize-param-env-4.rs:14:19 + | +LL | fn impls_trait<T: Trait>() {} + | ^^^^^ required by this bound in `impls_trait` + +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/traits/next-solver/specialization-transmute.rs b/tests/ui/traits/next-solver/specialization-transmute.rs index d96936f60f7..9b35a267743 100644 --- a/tests/ui/traits/next-solver/specialization-transmute.rs +++ b/tests/ui/traits/next-solver/specialization-transmute.rs @@ -15,7 +15,7 @@ impl<T> Default for T { // This will be fixed by #111994 fn intu(&self) -> &Self::Id { //~^ ERROR type annotations needed - self + self //~ ERROR cannot satisfy } } @@ -25,6 +25,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); // this call should then error + let s = transmute::<u8, Option<NonZeroU8>>(0); //~ ERROR cannot satisfy assert_eq!(s, None); } diff --git a/tests/ui/traits/next-solver/specialization-transmute.stderr b/tests/ui/traits/next-solver/specialization-transmute.stderr index ea1ae387f56..c87612d6a26 100644 --- a/tests/ui/traits/next-solver/specialization-transmute.stderr +++ b/tests/ui/traits/next-solver/specialization-transmute.stderr @@ -16,13 +16,31 @@ error[E0284]: type annotations needed: cannot satisfy `<T as Default>::Id == _` LL | fn intu(&self) -> &Self::Id { | ^^^^^^^^^ cannot satisfy `<T as Default>::Id == _` +error[E0284]: type annotations needed: cannot satisfy `T <: <T as Default>::Id` + --> $DIR/specialization-transmute.rs:18:9 + | +LL | self + | ^^^^ cannot satisfy `T <: <T as Default>::Id` + +error[E0284]: type annotations needed: cannot satisfy `<u8 as Default>::Id == Option<NonZero<u8>>` + --> $DIR/specialization-transmute.rs:28:13 + | +LL | let s = transmute::<u8, Option<NonZeroU8>>(0); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot satisfy `<u8 as Default>::Id == Option<NonZero<u8>>` + | +note: required by a bound in `transmute` + --> $DIR/specialization-transmute.rs:22:25 + | +LL | fn transmute<T: Default<Id = U>, U: Copy>(t: T) -> U { + | ^^^^^^ required by this bound in `transmute` + error[E0282]: type annotations needed --> $DIR/specialization-transmute.rs:14:23 | LL | default type Id = T; | ^ cannot infer type for associated type `<T as Default>::Id` -error: aborting due to 3 previous errors; 1 warning emitted +error: aborting due to 5 previous errors; 1 warning emitted Some errors have detailed explanations: E0282, E0284. For more information about an error, try `rustc --explain E0282`. diff --git a/tests/ui/transmutability/issue-101739-1.rs b/tests/ui/transmutability/issue-101739-1.rs index 2b966609108..f2c2a471f72 100644 --- a/tests/ui/transmutability/issue-101739-1.rs +++ b/tests/ui/transmutability/issue-101739-1.rs @@ -7,6 +7,7 @@ mod assert { where Dst: BikeshedIntrinsicFrom<Src, Context, ASSUME_ALIGNMENT>, //~ ERROR cannot find type `Dst` in this scope //~^ the constant `ASSUME_ALIGNMENT` is not of type `Assume` + //~| ERROR: mismatched types { } } diff --git a/tests/ui/transmutability/issue-101739-1.stderr b/tests/ui/transmutability/issue-101739-1.stderr index bf947d0ea4a..e87693f247d 100644 --- a/tests/ui/transmutability/issue-101739-1.stderr +++ b/tests/ui/transmutability/issue-101739-1.stderr @@ -13,6 +13,13 @@ LL | Dst: BikeshedIntrinsicFrom<Src, Context, ASSUME_ALIGNMENT>, note: required by a bound in `BikeshedIntrinsicFrom` --> $SRC_DIR/core/src/mem/transmutability.rs:LL:COL -error: aborting due to 2 previous errors +error[E0308]: mismatched types + --> $DIR/issue-101739-1.rs:8:50 + | +LL | Dst: BikeshedIntrinsicFrom<Src, Context, ASSUME_ALIGNMENT>, + | ^^^^^^^^^^^^^^^^ expected `Assume`, found `bool` + +error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0412`. +Some errors have detailed explanations: E0308, E0412. +For more information about an error, try `rustc --explain E0308`. diff --git a/tests/ui/transmutability/issue-101739-2.rs b/tests/ui/transmutability/issue-101739-2.rs index 4cde9152032..8d670ec17ca 100644 --- a/tests/ui/transmutability/issue-101739-2.rs +++ b/tests/ui/transmutability/issue-101739-2.rs @@ -19,7 +19,7 @@ mod assert { //~^ ERROR: the constant `ASSUME_ALIGNMENT` is not of type `Assume` Src, Context, - ASSUME_ALIGNMENT, + ASSUME_ALIGNMENT, //~ ERROR: mismatched types ASSUME_LIFETIMES, ASSUME_VALIDITY, ASSUME_VISIBILITY, diff --git a/tests/ui/transmutability/issue-101739-2.stderr b/tests/ui/transmutability/issue-101739-2.stderr index aed47f33f0d..adbb5ff5aff 100644 --- a/tests/ui/transmutability/issue-101739-2.stderr +++ b/tests/ui/transmutability/issue-101739-2.stderr @@ -25,6 +25,13 @@ LL | | >, note: required by a bound in `BikeshedIntrinsicFrom` --> $SRC_DIR/core/src/mem/transmutability.rs:LL:COL -error: aborting due to 2 previous errors +error[E0308]: mismatched types + --> $DIR/issue-101739-2.rs:22:13 + | +LL | ASSUME_ALIGNMENT, + | ^^^^^^^^^^^^^^^^ expected `Assume`, found `bool` + +error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0107`. +Some errors have detailed explanations: E0107, E0308. +For more information about an error, try `rustc --explain E0107`. diff --git a/tests/ui/treat-err-as-bug/eagerly-emit.rs b/tests/ui/treat-err-as-bug/eagerly-emit.rs deleted file mode 100644 index ede190575d5..00000000000 --- a/tests/ui/treat-err-as-bug/eagerly-emit.rs +++ /dev/null @@ -1,10 +0,0 @@ -// compile-flags: -Zeagerly-emit-delayed-bugs - -trait Foo {} - -fn main() {} - -fn f() -> impl Foo { - //~^ ERROR the trait bound `i32: Foo` is not satisfied - 1i32 -} diff --git a/tests/ui/treat-err-as-bug/eagerly-emit.stderr b/tests/ui/treat-err-as-bug/eagerly-emit.stderr deleted file mode 100644 index 4ae596435aa..00000000000 --- a/tests/ui/treat-err-as-bug/eagerly-emit.stderr +++ /dev/null @@ -1,20 +0,0 @@ -error: trimmed_def_paths constructed but no error emitted; use `DelayDm` for lints or `with_no_trimmed_paths` for debugging - -error[E0277]: the trait bound `i32: Foo` is not satisfied - --> $DIR/eagerly-emit.rs:7:11 - | -LL | fn f() -> impl Foo { - | ^^^^^^^^ the trait `Foo` is not implemented for `i32` -LL | -LL | 1i32 - | ---- return type was inferred to be `i32` here - | -help: this trait has no implementations, consider adding one - --> $DIR/eagerly-emit.rs:3:1 - | -LL | trait Foo {} - | ^^^^^^^^^ - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/type-alias-impl-trait/self-referential-2.stderr b/tests/ui/type-alias-impl-trait/self-referential-2.current.stderr index ab57812ba9b..019e01a07d3 100644 --- a/tests/ui/type-alias-impl-trait/self-referential-2.stderr +++ b/tests/ui/type-alias-impl-trait/self-referential-2.current.stderr @@ -1,5 +1,5 @@ error[E0277]: can't compare `i32` with `Foo` - --> $DIR/self-referential-2.rs:6:13 + --> $DIR/self-referential-2.rs:9:13 | LL | fn bar() -> Bar { | ^^^ no implementation for `i32 == Foo` diff --git a/tests/ui/type-alias-impl-trait/self-referential-2.rs b/tests/ui/type-alias-impl-trait/self-referential-2.rs index 8781196c39f..3a765a2e3ef 100644 --- a/tests/ui/type-alias-impl-trait/self-referential-2.rs +++ b/tests/ui/type-alias-impl-trait/self-referential-2.rs @@ -1,10 +1,13 @@ +// revisions: current next +//[next] compile-flags: -Znext-solver +//[next] check-pass #![feature(type_alias_impl_trait)] type Foo = impl std::fmt::Debug; type Bar = impl PartialEq<Foo>; fn bar() -> Bar { - 42_i32 //~^ ERROR can't compare `i32` with `Foo` + 42_i32 //[current]~^ ERROR can't compare `i32` with `Foo` } fn main() {} diff --git a/tests/ui/type-alias-impl-trait/type-alias-impl-trait-tuple.next.stderr b/tests/ui/type-alias-impl-trait/type-alias-impl-trait-tuple.next.stderr new file mode 100644 index 00000000000..b380dc66f03 --- /dev/null +++ b/tests/ui/type-alias-impl-trait/type-alias-impl-trait-tuple.next.stderr @@ -0,0 +1,15 @@ +error[E0284]: type annotations needed: cannot satisfy `Foo == _` + --> $DIR/type-alias-impl-trait-tuple.rs:21:24 + | +LL | Blah { my_foo: make_foo(), my_u8: 12 } + | ^^^^^^^^^^ cannot satisfy `Foo == _` + +error[E0284]: type annotations needed: cannot satisfy `Foo == _` + --> $DIR/type-alias-impl-trait-tuple.rs:25:10 + | +LL | (self.my_foo, self.my_u8, make_foo()) + | ^^^^^^^^^^^ cannot satisfy `Foo == _` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0284`. diff --git a/tests/ui/type-alias-impl-trait/type-alias-impl-trait-tuple.rs b/tests/ui/type-alias-impl-trait/type-alias-impl-trait-tuple.rs index 1f2d0e47ea3..7bf899a96be 100644 --- a/tests/ui/type-alias-impl-trait/type-alias-impl-trait-tuple.rs +++ b/tests/ui/type-alias-impl-trait/type-alias-impl-trait-tuple.rs @@ -1,4 +1,6 @@ -// check-pass +// revisions: current next +//[next] compile-flags: -Znext-solver +//[current] check-pass #![feature(type_alias_impl_trait)] #![allow(dead_code)] @@ -17,9 +19,11 @@ struct Blah { impl Blah { fn new() -> Blah { Blah { my_foo: make_foo(), my_u8: 12 } + //[next]~^ ERROR type annotations needed: cannot satisfy `Foo == _` } fn into_inner(self) -> (Foo, u8, Foo) { (self.my_foo, self.my_u8, make_foo()) + //[next]~^ ERROR type annotations needed: cannot satisfy `Foo == _` } } 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.current.stderr index 7d7cad874fa..22a3d7bd32f 100644 --- a/tests/ui/type-alias-impl-trait/type_of_a_let.stderr +++ b/tests/ui/type-alias-impl-trait/type_of_a_let.current.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `x` - --> $DIR/type_of_a_let.rs:16:16 + --> $DIR/type_of_a_let.rs:20:16 | LL | let x: Foo = 22_u32; | - move occurs because `x` has type `Foo`, which does not implement the `Copy` trait @@ -9,7 +9,7 @@ LL | same_type((x, y)); | ^ value used here after move error[E0382]: use of moved value: `y` - --> $DIR/type_of_a_let.rs:17:6 + --> $DIR/type_of_a_let.rs:21:6 | LL | let y: Foo = x; | - move occurs because `y` has type `Foo`, which does not implement the `Copy` trait 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 36161171555..0f4dac6c683 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 @@ -1,3 +1,7 @@ +// revisions: current next +//[next] compile-flags: -Znext-solver +//[next] check-pass + #![feature(type_alias_impl_trait)] #![allow(dead_code)] @@ -13,8 +17,8 @@ fn foo1() -> (u32, Foo) { fn foo2() -> (u32, Foo) { let x: Foo = 22_u32; let y: Foo = x; - same_type((x, y)); //~ ERROR use of moved value - (y, todo!()) //~ ERROR use of moved value + same_type((x, y)); //[current]~ ERROR use of moved value + (y, todo!()) //[current]~ ERROR use of moved value } fn same_type<T>(x: (T, T)) {} diff --git a/tests/ui/type/type-check/issue-40294.rs b/tests/ui/type/type-check/issue-40294.rs index 5493a4e5f10..46ba2296163 100644 --- a/tests/ui/type/type-check/issue-40294.rs +++ b/tests/ui/type/type-check/issue-40294.rs @@ -6,7 +6,7 @@ fn foo<'a,'b,T>(x: &'a T, y: &'b T) where &'a T : Foo, //~ ERROR type annotations needed &'b T : Foo { - x.foo(); + x.foo(); //~ ERROR type annotations needed y.foo(); } diff --git a/tests/ui/type/type-check/issue-40294.stderr b/tests/ui/type/type-check/issue-40294.stderr index c6c1d689324..178ea69563a 100644 --- a/tests/ui/type/type-check/issue-40294.stderr +++ b/tests/ui/type/type-check/issue-40294.stderr @@ -12,6 +12,20 @@ LL | where &'a T : Foo, LL | &'b T : Foo | ^^^ -error: aborting due to 1 previous error +error[E0283]: type annotations needed: cannot satisfy `&T: Foo` + --> $DIR/issue-40294.rs:9:7 + | +LL | x.foo(); + | ^^^ + | +note: multiple `impl`s or `where` clauses satisfying `&T: Foo` found + --> $DIR/issue-40294.rs:6:19 + | +LL | where &'a T : Foo, + | ^^^ +LL | &'b T : Foo + | ^^^ + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0283`. diff --git a/tests/ui/typeck/typeck_type_placeholder_item.rs b/tests/ui/typeck/typeck_type_placeholder_item.rs index 591a7278ddc..a95b44e807c 100644 --- a/tests/ui/typeck/typeck_type_placeholder_item.rs +++ b/tests/ui/typeck/typeck_type_placeholder_item.rs @@ -47,7 +47,7 @@ impl Test9 { fn test11(x: &usize) -> &_ { //~^ ERROR the placeholder `_` is not allowed within types on item signatures for return types - &x + &x //~ ERROR cannot return reference to function parameter } unsafe fn test12(x: *const usize) -> *const *const _ { @@ -229,3 +229,5 @@ fn evens_squared(n: usize) -> _ { const _: _ = (1..10).filter(|x| x % 2 == 0).map(|x| x * x); //~^ ERROR the placeholder +//~| ERROR cannot call non-const +//~| ERROR cannot call non-const diff --git a/tests/ui/typeck/typeck_type_placeholder_item.stderr b/tests/ui/typeck/typeck_type_placeholder_item.stderr index bfcc76c1dae..18f6edad5c0 100644 --- a/tests/ui/typeck/typeck_type_placeholder_item.stderr +++ b/tests/ui/typeck/typeck_type_placeholder_item.stderr @@ -666,7 +666,31 @@ LL | type F: std::ops::Fn(_); LL | impl Qux for Struct { | ^^^^^^^^^^^^^^^^^^^ missing `F` in implementation -error: aborting due to 72 previous errors +error[E0515]: cannot return reference to function parameter `x` + --> $DIR/typeck_type_placeholder_item.rs:50:5 + | +LL | &x + | ^^ returns a reference to data owned by the current function + +error[E0015]: cannot call non-const fn `<std::ops::Range<i32> as Iterator>::filter::<{closure@$DIR/typeck_type_placeholder_item.rs:230:29: 230:32}>` in constants + --> $DIR/typeck_type_placeholder_item.rs:230:22 + | +LL | const _: _ = (1..10).filter(|x| x % 2 == 0).map(|x| x * x); + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = note: calls in constants are limited to constant functions, tuple structs and tuple variants + = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable + +error[E0015]: cannot call non-const fn `<Filter<std::ops::Range<i32>, {closure@$DIR/typeck_type_placeholder_item.rs:230:29: 230:32}> as Iterator>::map::<i32, {closure@$DIR/typeck_type_placeholder_item.rs:230:49: 230:52}>` in constants + --> $DIR/typeck_type_placeholder_item.rs:230:45 + | +LL | const _: _ = (1..10).filter(|x| x % 2 == 0).map(|x| x * x); + | ^^^^^^^^^^^^^^ + | + = note: calls in constants are limited to constant functions, tuple structs and tuple variants + = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable + +error: aborting due to 75 previous errors -Some errors have detailed explanations: E0046, E0121, E0282, E0403. -For more information about an error, try `rustc --explain E0046`. +Some errors have detailed explanations: E0015, E0046, E0121, E0282, E0403, E0515. +For more information about an error, try `rustc --explain E0015`. diff --git a/tests/ui/ufcs/ufcs-explicit-self-bad.rs b/tests/ui/ufcs/ufcs-explicit-self-bad.rs index 3bb3d906d11..29586dccfc9 100644 --- a/tests/ui/ufcs/ufcs-explicit-self-bad.rs +++ b/tests/ui/ufcs/ufcs-explicit-self-bad.rs @@ -7,7 +7,7 @@ struct Foo { impl Foo { fn foo(self: isize, x: isize) -> isize { //~^ ERROR invalid `self` parameter type - self.f + x + self.f + x //~ ERROR: doesn't have fields } } @@ -53,8 +53,10 @@ fn main() { f: 1, }); println!("{}", foo.foo(2)); + //~^ ERROR: no method named `foo` let bar = Box::new(Bar { f: 1, }); println!("{} {}", bar.foo(2), bar.bar(2)); + //~^ ERROR: no method named `bar` } diff --git a/tests/ui/ufcs/ufcs-explicit-self-bad.stderr b/tests/ui/ufcs/ufcs-explicit-self-bad.stderr index b0e71507a2e..7c250775475 100644 --- a/tests/ui/ufcs/ufcs-explicit-self-bad.stderr +++ b/tests/ui/ufcs/ufcs-explicit-self-bad.stderr @@ -118,7 +118,25 @@ note: ...does not necessarily outlive the anonymous lifetime defined here LL | fn dummy3(self: &&Bar<T>) {} | ^^^^^^^ -error: aborting due to 8 previous errors +error[E0610]: `isize` is a primitive type and therefore doesn't have fields + --> $DIR/ufcs-explicit-self-bad.rs:10:14 + | +LL | self.f + x + | ^ + +error[E0599]: no method named `foo` found for struct `Box<Foo>` in the current scope + --> $DIR/ufcs-explicit-self-bad.rs:55:24 + | +LL | println!("{}", foo.foo(2)); + | ^^^ method not found in `Box<Foo>` + +error[E0599]: no method named `bar` found for struct `Box<Bar<isize>>` in the current scope + --> $DIR/ufcs-explicit-self-bad.rs:60:39 + | +LL | println!("{} {}", bar.foo(2), bar.bar(2)); + | ^^^ method not found in `Box<Bar<isize>>` + +error: aborting due to 11 previous errors -Some errors have detailed explanations: E0053, E0307, E0308. +Some errors have detailed explanations: E0053, E0307, E0308, E0599, E0610. For more information about an error, try `rustc --explain E0053`. diff --git a/tests/ui/unboxed-closures/non-tupled-arg-mismatch.rs b/tests/ui/unboxed-closures/non-tupled-arg-mismatch.rs index d2e48600227..2278285bf8f 100644 --- a/tests/ui/unboxed-closures/non-tupled-arg-mismatch.rs +++ b/tests/ui/unboxed-closures/non-tupled-arg-mismatch.rs @@ -4,5 +4,5 @@ fn a<F: Fn<usize>>(f: F) {} //~^ ERROR type parameter to bare `Fn` trait must be a tuple fn main() { - a(|_: usize| {}); + a(|_: usize| {}); //~ ERROR: mismatched types } diff --git a/tests/ui/unboxed-closures/non-tupled-arg-mismatch.stderr b/tests/ui/unboxed-closures/non-tupled-arg-mismatch.stderr index 66d393c67c5..0d4265ddf8b 100644 --- a/tests/ui/unboxed-closures/non-tupled-arg-mismatch.stderr +++ b/tests/ui/unboxed-closures/non-tupled-arg-mismatch.stderr @@ -7,6 +7,21 @@ LL | fn a<F: Fn<usize>>(f: F) {} note: required by a bound in `Fn` --> $SRC_DIR/core/src/ops/function.rs:LL:COL -error: aborting due to 1 previous error +error[E0308]: mismatched types + --> $DIR/non-tupled-arg-mismatch.rs:7:5 + | +LL | a(|_: usize| {}); + | ^^^^^^^^^^^^^^^^ types differ + | + = note: expected trait `Fn<usize>` + found trait `Fn(usize)` +note: required by a bound in `a` + --> $DIR/non-tupled-arg-mismatch.rs:3:9 + | +LL | fn a<F: Fn<usize>>(f: F) {} + | ^^^^^^^^^ required by this bound in `a` + +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0059`. +Some errors have detailed explanations: E0059, E0308. +For more information about an error, try `rustc --explain E0059`. diff --git a/tests/ui/wf/wf-in-fn-ret.rs b/tests/ui/wf/wf-in-fn-ret.rs index 4c9535184ff..3e9b9787cc5 100644 --- a/tests/ui/wf/wf-in-fn-ret.rs +++ b/tests/ui/wf/wf-in-fn-ret.rs @@ -3,12 +3,13 @@ #![feature(rustc_attrs)] #![allow(dead_code)] -struct MustBeCopy<T:Copy> { - t: T +struct MustBeCopy<T: Copy> { + t: T, } fn bar<T>() -> MustBeCopy<T> //~ ERROR E0277 +//~^ ERROR mismatched types { } -fn main() { } +fn main() {} diff --git a/tests/ui/wf/wf-in-fn-ret.stderr b/tests/ui/wf/wf-in-fn-ret.stderr index 85cf78c5987..1ae49a348cc 100644 --- a/tests/ui/wf/wf-in-fn-ret.stderr +++ b/tests/ui/wf/wf-in-fn-ret.stderr @@ -5,15 +5,27 @@ LL | fn bar<T>() -> MustBeCopy<T> | ^^^^^^^^^^^^^ the trait `Copy` is not implemented for `T` | note: required by a bound in `MustBeCopy` - --> $DIR/wf-in-fn-ret.rs:6:21 + --> $DIR/wf-in-fn-ret.rs:6:22 | -LL | struct MustBeCopy<T:Copy> { - | ^^^^ required by this bound in `MustBeCopy` +LL | struct MustBeCopy<T: Copy> { + | ^^^^ required by this bound in `MustBeCopy` help: consider restricting type parameter `T` | LL | fn bar<T: std::marker::Copy>() -> MustBeCopy<T> | +++++++++++++++++++ -error: aborting due to 1 previous error +error[E0308]: mismatched types + --> $DIR/wf-in-fn-ret.rs:10:16 + | +LL | fn bar<T>() -> MustBeCopy<T> + | --- ^^^^^^^^^^^^^ expected `MustBeCopy<T>`, found `()` + | | + | implicitly returns `()` as its body has no tail or `return` expression + | + = note: expected struct `MustBeCopy<T>` + found unit type `()` + +error: aborting due to 2 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`. |
