diff --git a/src/tools/tidy/src/issues.txt b/src/tools/tidy/src/issues.txt index a533598cb4bd..d889a1c0c034 100644 --- a/src/tools/tidy/src/issues.txt +++ b/src/tools/tidy/src/issues.txt @@ -1726,14 +1726,6 @@ ui/moves/issue-46099-move-in-macro.rs ui/moves/issue-72649-uninit-in-loop.rs ui/moves/issue-75904-move-closure-loop.rs ui/moves/issue-99470-move-out-of-some.rs -ui/never_type/issue-10176.rs -ui/never_type/issue-13352.rs -ui/never_type/issue-2149.rs -ui/never_type/issue-44402.rs -ui/never_type/issue-51506.rs -ui/never_type/issue-52443.rs -ui/never_type/issue-5500-1.rs -ui/never_type/issue-96335.rs ui/nll/closure-requirements/issue-58127-mutliple-requirements.rs ui/nll/issue-112604-closure-output-normalize.rs ui/nll/issue-16223.rs diff --git a/tests/ui/never_type/regress/issue-5500-1.rs b/tests/ui/never_type/regress/address-of-never.rs similarity index 53% rename from tests/ui/never_type/regress/issue-5500-1.rs rename to tests/ui/never_type/regress/address-of-never.rs index 802bfa5f79bf..4ab05a1fa8f5 100644 --- a/tests/ui/never_type/regress/issue-5500-1.rs +++ b/tests/ui/never_type/regress/address-of-never.rs @@ -1,8 +1,7 @@ +// Regression test for , +// check that you can take a reference to the never type. +// //@ edition:2015..2021 -// MIR doesn't generate an error because the assignment isn't reachable. This -// is OK because the test is here to check that the compiler doesn't ICE (cf. -// #5500). - //@ check-pass struct TrieMapIterator<'a> { diff --git a/tests/ui/never_type/regress/divergent-block-with-tail.stderr b/tests/ui/never_type/regress/divergent-block-with-tail.stderr index 90d0d4260d2d..1f205e896788 100644 --- a/tests/ui/never_type/regress/divergent-block-with-tail.stderr +++ b/tests/ui/never_type/regress/divergent-block-with-tail.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/diverging-tuple-parts-39485.rs:9:5 + --> $DIR/divergent-block-with-tail.rs:12:5 | LL | &panic!() | ^^^^^^^^^ expected `()`, found `&_` @@ -17,7 +17,7 @@ LL + panic!() | error[E0308]: mismatched types - --> $DIR/diverging-tuple-parts-39485.rs:13:5 + --> $DIR/divergent-block-with-tail.rs:17:5 | LL | fn f() -> isize { | ----- expected `isize` because of return type diff --git a/tests/ui/never_type/regress/issue-13352.rs b/tests/ui/never_type/regress/issue-13352.rs deleted file mode 100644 index 9c884a33c5fe..000000000000 --- a/tests/ui/never_type/regress/issue-13352.rs +++ /dev/null @@ -1,9 +0,0 @@ -fn foo(_: Box) {} - -fn main() { - foo(loop { - std::process::exit(0); - }); - 2_usize + (loop {}); - //~^ ERROR E0277 -} diff --git a/tests/ui/never_type/regress/issue-13352.stderr b/tests/ui/never_type/regress/issue-13352.stderr deleted file mode 100644 index 5fcbb4aab993..000000000000 --- a/tests/ui/never_type/regress/issue-13352.stderr +++ /dev/null @@ -1,28 +0,0 @@ -error[E0277]: cannot add `()` to `usize` - --> $DIR/issue-13352.rs:7:13 - | -LL | 2_usize + (loop {}); - | ^ no implementation for `usize + ()` - | - = help: the trait `Add<()>` is not implemented for `usize` -help: the following other types implement trait `Add` - --> $SRC_DIR/core/src/ops/arith.rs:LL:COL - | - = note: `usize` implements `Add` - ::: $SRC_DIR/core/src/ops/arith.rs:LL:COL - | - = note: in this macro invocation - --> $SRC_DIR/core/src/internal_macros.rs:LL:COL - | - = note: `&usize` implements `Add` - ::: $SRC_DIR/core/src/internal_macros.rs:LL:COL - | - = note: `usize` implements `Add<&usize>` - ::: $SRC_DIR/core/src/internal_macros.rs:LL:COL - | - = note: `&usize` implements `Add` - = note: this error originates in the macro `add_impl` (in Nightly builds, run with -Z macro-backtrace for more info) - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/never_type/regress/issue-44402.rs b/tests/ui/never_type/regress/issue-44402.rs deleted file mode 100644 index ae8c59a5cf06..000000000000 --- a/tests/ui/never_type/regress/issue-44402.rs +++ /dev/null @@ -1,34 +0,0 @@ -// Regression test for -// -// Previously inhabitedness check was handling cycles incorrectly causing this -// to not compile. -// -//@ check-pass - -#![allow(dead_code)] -#![feature(never_type)] -#![feature(exhaustive_patterns)] - -struct Foo { - field1: !, - field2: Option<&'static Bar>, -} - -struct Bar { - field1: &'static Foo -} - -fn test_a() { - let x: Option = None; - match x { None => () } -} - -fn test_b() { - let x: Option = None; - match x { - Some(_) => (), - None => () - } -} - -fn main() {} diff --git a/tests/ui/never_type/regress/issue-52443.rs b/tests/ui/never_type/regress/loop-in-array-length.rs similarity index 84% rename from tests/ui/never_type/regress/issue-52443.rs rename to tests/ui/never_type/regress/loop-in-array-length.rs index f505719bfcee..77e21ff9a794 100644 --- a/tests/ui/never_type/regress/issue-52443.rs +++ b/tests/ui/never_type/regress/loop-in-array-length.rs @@ -1,3 +1,5 @@ +// Regression test for + fn main() { [(); & { loop { continue } } ]; //~ ERROR mismatched types diff --git a/tests/ui/never_type/regress/issue-52443.stderr b/tests/ui/never_type/regress/loop-in-array-length.stderr similarity index 89% rename from tests/ui/never_type/regress/issue-52443.stderr rename to tests/ui/never_type/regress/loop-in-array-length.stderr index d754bc415781..a51eb46fb244 100644 --- a/tests/ui/never_type/regress/issue-52443.stderr +++ b/tests/ui/never_type/regress/loop-in-array-length.stderr @@ -1,5 +1,5 @@ warning: denote infinite loops with `loop { ... }` - --> $DIR/issue-52443.rs:6:11 + --> $DIR/loop-in-array-length.rs:8:11 | LL | [(); {while true {break}; 0}]; | ^^^^^^^^^^ help: use `loop` @@ -7,7 +7,7 @@ LL | [(); {while true {break}; 0}]; = note: `#[warn(while_true)]` on by default error[E0308]: mismatched types - --> $DIR/issue-52443.rs:2:10 + --> $DIR/loop-in-array-length.rs:4:10 | LL | [(); & { loop { continue } } ]; | ^^^^^^^^^^^^^^^^^^^^^^^ expected `usize`, found `&_` @@ -21,7 +21,7 @@ LL + [(); { loop { continue } } ]; | error[E0308]: mismatched types - --> $DIR/issue-52443.rs:4:17 + --> $DIR/loop-in-array-length.rs:6:17 | LL | [(); loop { break }]; | ^^^^^ expected `usize`, found `()` @@ -32,7 +32,7 @@ LL | [(); loop { break 42 }]; | ++ error[E0277]: the trait bound `std::ops::RangeFrom: const Iterator` is not satisfied - --> $DIR/issue-52443.rs:9:21 + --> $DIR/loop-in-array-length.rs:11:21 | LL | [(); { for _ in 0usize.. {}; 0}]; | ^^^^^^^^ required by a bound introduced by this call @@ -42,7 +42,7 @@ note: trait `Iterator` is implemented but not `const` = note: required for `std::ops::RangeFrom` to implement `const IntoIterator` error[E0277]: the trait bound `std::ops::RangeFrom: const Iterator` is not satisfied - --> $DIR/issue-52443.rs:9:21 + --> $DIR/loop-in-array-length.rs:11:21 | LL | [(); { for _ in 0usize.. {}; 0}]; | ^^^^^^^^ diff --git a/tests/ui/never_type/regress/issue-96335.rs b/tests/ui/never_type/regress/malformed-range-to-never.rs similarity index 57% rename from tests/ui/never_type/regress/issue-96335.rs rename to tests/ui/never_type/regress/malformed-range-to-never.rs index 411a7c9df657..415177b5f7dc 100644 --- a/tests/ui/never_type/regress/issue-96335.rs +++ b/tests/ui/never_type/regress/malformed-range-to-never.rs @@ -1,3 +1,5 @@ +// Regression test for + fn main() { 0.....{loop{}1}; //~^ ERROR unexpected token diff --git a/tests/ui/never_type/regress/issue-96335.stderr b/tests/ui/never_type/regress/malformed-range-to-never.stderr similarity index 89% rename from tests/ui/never_type/regress/issue-96335.stderr rename to tests/ui/never_type/regress/malformed-range-to-never.stderr index 1193973d5ee8..37c99430127d 100644 --- a/tests/ui/never_type/regress/issue-96335.stderr +++ b/tests/ui/never_type/regress/malformed-range-to-never.stderr @@ -1,5 +1,5 @@ error: unexpected token: `...` - --> $DIR/issue-96335.rs:2:6 + --> $DIR/malformed-range-to-never.rs:4:6 | LL | 0.....{loop{}1}; | ^^^ @@ -16,7 +16,7 @@ LL + 0..=..{loop{}1}; | error[E0308]: mismatched types - --> $DIR/issue-96335.rs:2:9 + --> $DIR/malformed-range-to-never.rs:4:9 | LL | 0.....{loop{}1}; | ----^^^^^^^^^^^ diff --git a/tests/ui/never_type/regress/never-as-function-argument.rs b/tests/ui/never_type/regress/never-as-function-argument.rs new file mode 100644 index 000000000000..c19db508e7c8 --- /dev/null +++ b/tests/ui/never_type/regress/never-as-function-argument.rs @@ -0,0 +1,13 @@ +// Regression test for , +// check that the never type can be used as a function argument. +// +//@run-pass + +fn foo(_: Box) {} + +fn main() { + #[expect(unreachable_code)] + foo(loop { + std::process::exit(0); + }); +} diff --git a/tests/ui/never_type/regress/issue-51506.rs b/tests/ui/never_type/regress/never-as-spec-default-associated-type.rs similarity index 100% rename from tests/ui/never_type/regress/issue-51506.rs rename to tests/ui/never_type/regress/never-as-spec-default-associated-type.rs diff --git a/tests/ui/never_type/regress/issue-51506.stderr b/tests/ui/never_type/regress/never-as-spec-default-associated-type.stderr similarity index 80% rename from tests/ui/never_type/regress/issue-51506.stderr rename to tests/ui/never_type/regress/never-as-spec-default-associated-type.stderr index 0e666e017f9c..bcb2c7dfae8e 100644 --- a/tests/ui/never_type/regress/issue-51506.stderr +++ b/tests/ui/never_type/regress/never-as-spec-default-associated-type.stderr @@ -1,12 +1,12 @@ error[E0277]: `!` is not an iterator - --> $DIR/issue-51506.rs:15:24 + --> $DIR/never-as-spec-default-associated-type.rs:15:24 | LL | default type Out = !; | ^ `!` is not an iterator | = help: the trait `Iterator` is not implemented for `!` note: required by a bound in `Trait::Out` - --> $DIR/issue-51506.rs:9:15 + --> $DIR/never-as-spec-default-associated-type.rs:9:15 | LL | type Out: Iterator; | ^^^^^^^^^^^^^^^^^^^^ required by this bound in `Trait::Out` diff --git a/tests/ui/parser/return-without-semicolon-in-match.rs b/tests/ui/parser/return-without-semicolon-in-match.rs index a8d13254f101..bb613ce16c73 100644 --- a/tests/ui/parser/return-without-semicolon-in-match.rs +++ b/tests/ui/parser/return-without-semicolon-in-match.rs @@ -1,12 +1,13 @@ // Tests that `return` without a semicolon parses correctly in a match arm. // See // -//@ run-pass +//@ check-pass -fn f() { +fn _f() { + #[rustfmt::skip] let _x = match true { - true => { 10 } - false => { return } + true => { 10 }, + false => { return }, }; }