From d84f0c8d329017c95cbf73418be8e804b0a10472 Mon Sep 17 00:00:00 2001 From: Dylan MacKenzie Date: Thu, 25 Jun 2020 17:43:48 -0700 Subject: [PATCH] Update tests --- src/test/compile-fail/issue-52443.rs | 8 +- src/test/ui/async-await/issue-70594.rs | 1 - src/test/ui/async-await/issue-70594.stderr | 13 +- src/test/ui/closures/issue-52437.rs | 1 - src/test/ui/closures/issue-52437.stderr | 13 +- .../ui/consts/const-eval/infinite_loop.rs | 1 - .../ui/consts/const-eval/infinite_loop.stderr | 20 +-- src/test/ui/consts/const-eval/issue-52442.rs | 3 +- .../ui/consts/const-eval/issue-52442.stderr | 11 +- src/test/ui/consts/const-eval/issue-52475.rs | 1 - .../ui/consts/const-eval/issue-52475.stderr | 20 +-- src/test/ui/consts/const-eval/issue-62272.rs | 11 -- .../ui/consts/const-eval/issue-62272.stderr | 21 --- src/test/ui/consts/const-eval/issue-70723.rs | 2 - .../ui/consts/const-eval/issue-70723.stderr | 2 +- src/test/ui/consts/const-eval/livedrop.rs | 3 - src/test/ui/consts/const-eval/livedrop.stderr | 2 +- src/test/ui/consts/const-labeled-break.rs | 9 +- src/test/ui/consts/const-labeled-break.stderr | 12 -- .../const_eval_limit_not_reached.rs | 1 - .../const_limit/const_eval_limit_reached.rs | 1 - .../const_eval_limit_reached.stderr | 2 +- src/test/ui/consts/control-flow/basics.rs | 1 - .../control-flow/drop-fail.precise.stderr | 4 +- src/test/ui/consts/control-flow/drop-fail.rs | 1 - .../control-flow/drop-fail.stock.stderr | 8 +- src/test/ui/consts/control-flow/drop-pass.rs | 1 - .../ui/consts/control-flow/drop-precise.rs | 1 - .../control-flow/interior-mutability.rs | 2 - .../control-flow/interior-mutability.stderr | 6 +- src/test/ui/consts/control-flow/loop.rs | 36 ++--- .../{loop.loop_.stderr => loop.stderr} | 4 +- .../ui/consts/control-flow/loop.stock.stderr | 151 ------------------ src/test/ui/consts/min_const_fn/loop_ice.rs | 5 - .../ui/consts/min_const_fn/loop_ice.stderr | 12 -- .../ui/internal/internal-unstable-const.rs | 8 +- .../internal/internal-unstable-const.stderr | 13 +- src/test/ui/issues/issue-51714.rs | 1 - src/test/ui/issues/issue-51714.stderr | 14 +- .../hir-const-check.rs | 7 +- .../hir-const-check.stderr | 11 +- .../tests/ui/redundant_pattern_matching.fixed | 2 - .../tests/ui/redundant_pattern_matching.rs | 2 - .../ui/redundant_pattern_matching.stderr | 56 +++---- ...undant_pattern_matching_const_result.fixed | 2 - ...redundant_pattern_matching_const_result.rs | 2 - ...ndant_pattern_matching_const_result.stderr | 12 +- 47 files changed, 105 insertions(+), 415 deletions(-) delete mode 100644 src/test/ui/consts/const-eval/issue-62272.rs delete mode 100644 src/test/ui/consts/const-eval/issue-62272.stderr delete mode 100644 src/test/ui/consts/const-labeled-break.stderr rename src/test/ui/consts/control-flow/{loop.loop_.stderr => loop.stderr} (88%) delete mode 100644 src/test/ui/consts/control-flow/loop.stock.stderr delete mode 100644 src/test/ui/consts/min_const_fn/loop_ice.rs delete mode 100644 src/test/ui/consts/min_const_fn/loop_ice.stderr diff --git a/src/test/compile-fail/issue-52443.rs b/src/test/compile-fail/issue-52443.rs index 00aca1d14baa..21bd62522190 100644 --- a/src/test/compile-fail/issue-52443.rs +++ b/src/test/compile-fail/issue-52443.rs @@ -1,11 +1,11 @@ fn main() { [(); & { loop { continue } } ]; //~ ERROR mismatched types - //~^ ERROR `loop` is not allowed in a `const` + [(); loop { break }]; //~ ERROR mismatched types - //~^ ERROR `loop` is not allowed in a `const` + [(); {while true {break}; 0}]; - //~^ ERROR `while` is not allowed in a `const` - //~| WARN denote infinite loops with + //~^ WARN denote infinite loops with + [(); { for _ in 0usize.. {}; 0}]; //~^ ERROR `for` is not allowed in a `const` //~| ERROR calls in constants are limited to constant functions diff --git a/src/test/ui/async-await/issue-70594.rs b/src/test/ui/async-await/issue-70594.rs index 34d12db8806d..9e7c5847b3b2 100644 --- a/src/test/ui/async-await/issue-70594.rs +++ b/src/test/ui/async-await/issue-70594.rs @@ -4,7 +4,6 @@ async fn fun() { [1; ().await]; //~^ error: `await` is only allowed inside `async` functions and blocks //~| error: `.await` is not allowed in a `const` - //~| error: `loop` is not allowed in a `const` //~| error: `.await` is not allowed in a `const` //~| error: `()` is not a future } diff --git a/src/test/ui/async-await/issue-70594.stderr b/src/test/ui/async-await/issue-70594.stderr index 1b7abe317222..badb7ae9f6f6 100644 --- a/src/test/ui/async-await/issue-70594.stderr +++ b/src/test/ui/async-await/issue-70594.stderr @@ -12,15 +12,6 @@ error[E0744]: `.await` is not allowed in a `const` LL | [1; ().await]; | ^^^^^^^^ -error[E0658]: `loop` is not allowed in a `const` - --> $DIR/issue-70594.rs:4:9 - | -LL | [1; ().await]; - | ^^^^^^^^ - | - = note: see issue #52000 for more information - = help: add `#![feature(const_loop)]` to the crate attributes to enable - error[E0744]: `.await` is not allowed in a `const` --> $DIR/issue-70594.rs:4:9 | @@ -36,7 +27,7 @@ LL | [1; ().await]; = help: the trait `std::future::Future` is not implemented for `()` = note: required by `std::future::Future::poll` -error: aborting due to 5 previous errors +error: aborting due to 4 previous errors -Some errors have detailed explanations: E0277, E0658, E0728, E0744. +Some errors have detailed explanations: E0277, E0728, E0744. For more information about an error, try `rustc --explain E0277`. diff --git a/src/test/ui/closures/issue-52437.rs b/src/test/ui/closures/issue-52437.rs index 634638e1335b..f79a0bd35486 100644 --- a/src/test/ui/closures/issue-52437.rs +++ b/src/test/ui/closures/issue-52437.rs @@ -1,7 +1,6 @@ fn main() { [(); &(&'static: loop { |x| {}; }) as *const _ as usize] //~^ ERROR: invalid label name `'static` - //~| ERROR: `loop` is not allowed in a `const` //~| ERROR: type annotations needed //~| ERROR mismatched types } diff --git a/src/test/ui/closures/issue-52437.stderr b/src/test/ui/closures/issue-52437.stderr index acb59c7b02d1..54825cb746d4 100644 --- a/src/test/ui/closures/issue-52437.stderr +++ b/src/test/ui/closures/issue-52437.stderr @@ -4,15 +4,6 @@ error: invalid label name `'static` LL | [(); &(&'static: loop { |x| {}; }) as *const _ as usize] | ^^^^^^^ -error[E0658]: `loop` is not allowed in a `const` - --> $DIR/issue-52437.rs:2:13 - | -LL | [(); &(&'static: loop { |x| {}; }) as *const _ as usize] - | ^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #52000 for more information - = help: add `#![feature(const_loop)]` to the crate attributes to enable - error[E0282]: type annotations needed --> $DIR/issue-52437.rs:2:30 | @@ -27,7 +18,7 @@ LL | fn main() { LL | [(); &(&'static: loop { |x| {}; }) as *const _ as usize] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found array `[(); _]` -error: aborting due to 4 previous errors +error: aborting due to 3 previous errors -Some errors have detailed explanations: E0282, E0308, E0658. +Some errors have detailed explanations: E0282, E0308. For more information about an error, try `rustc --explain E0282`. diff --git a/src/test/ui/consts/const-eval/infinite_loop.rs b/src/test/ui/consts/const-eval/infinite_loop.rs index 7c2c40dd6fc0..14a573ccf5ac 100644 --- a/src/test/ui/consts/const-eval/infinite_loop.rs +++ b/src/test/ui/consts/const-eval/infinite_loop.rs @@ -4,7 +4,6 @@ fn main() { let _ = [(); { let mut n = 113383; // #20 in https://oeis.org/A006884 while n != 0 { - //~^ ERROR `while` is not allowed in a `const` n = if n % 2 == 0 { n/2 } else { 3*n + 1 }; //~^ ERROR evaluation of constant value failed } diff --git a/src/test/ui/consts/const-eval/infinite_loop.stderr b/src/test/ui/consts/const-eval/infinite_loop.stderr index df96f32516c4..d01376e59594 100644 --- a/src/test/ui/consts/const-eval/infinite_loop.stderr +++ b/src/test/ui/consts/const-eval/infinite_loop.stderr @@ -1,23 +1,9 @@ -error[E0658]: `while` is not allowed in a `const` - --> $DIR/infinite_loop.rs:6:9 - | -LL | / while n != 0 { -LL | | -LL | | n = if n % 2 == 0 { n/2 } else { 3*n + 1 }; -LL | | -LL | | } - | |_________^ - | - = note: see issue #52000 for more information - = help: add `#![feature(const_loop)]` to the crate attributes to enable - error[E0080]: evaluation of constant value failed - --> $DIR/infinite_loop.rs:8:17 + --> $DIR/infinite_loop.rs:7:17 | LL | n = if n % 2 == 0 { n/2 } else { 3*n + 1 }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ exceeded interpreter step limit (see `#[const_eval_limit]`) -error: aborting due to 2 previous errors +error: aborting due to previous error -Some errors have detailed explanations: E0080, E0658. -For more information about an error, try `rustc --explain E0080`. +For more information about this error, try `rustc --explain E0080`. diff --git a/src/test/ui/consts/const-eval/issue-52442.rs b/src/test/ui/consts/const-eval/issue-52442.rs index 07fb491015a8..ea24578c7dd0 100644 --- a/src/test/ui/consts/const-eval/issue-52442.rs +++ b/src/test/ui/consts/const-eval/issue-52442.rs @@ -1,6 +1,5 @@ fn main() { [(); { &loop { break } as *const _ as usize } ]; - //~^ ERROR `loop` is not allowed in a `const` - //~| ERROR casting pointers to integers in constants is unstable + //~^ ERROR casting pointers to integers in constants is unstable //~| ERROR evaluation of constant value failed } diff --git a/src/test/ui/consts/const-eval/issue-52442.stderr b/src/test/ui/consts/const-eval/issue-52442.stderr index eda2dbf0b6b1..53a87837e16e 100644 --- a/src/test/ui/consts/const-eval/issue-52442.stderr +++ b/src/test/ui/consts/const-eval/issue-52442.stderr @@ -1,12 +1,3 @@ -error[E0658]: `loop` is not allowed in a `const` - --> $DIR/issue-52442.rs:2:14 - | -LL | [(); { &loop { break } as *const _ as usize } ]; - | ^^^^^^^^^^^^^^ - | - = note: see issue #52000 for more information - = help: add `#![feature(const_loop)]` to the crate attributes to enable - error[E0658]: casting pointers to integers in constants is unstable --> $DIR/issue-52442.rs:2:13 | @@ -22,7 +13,7 @@ error[E0080]: evaluation of constant value failed LL | [(); { &loop { break } as *const _ as usize } ]; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ "pointer-to-integer cast" needs an rfc before being allowed inside constants -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors Some errors have detailed explanations: E0080, E0658. For more information about an error, try `rustc --explain E0080`. diff --git a/src/test/ui/consts/const-eval/issue-52475.rs b/src/test/ui/consts/const-eval/issue-52475.rs index 869f0b981af7..ce65407bbab0 100644 --- a/src/test/ui/consts/const-eval/issue-52475.rs +++ b/src/test/ui/consts/const-eval/issue-52475.rs @@ -3,7 +3,6 @@ fn main() { let mut x = &0; let mut n = 0; while n < 5 { - //~^ ERROR `while` is not allowed in a `const` n = (n + 1) % 5; //~ ERROR evaluation of constant value failed x = &0; // Materialize a new AllocId } diff --git a/src/test/ui/consts/const-eval/issue-52475.stderr b/src/test/ui/consts/const-eval/issue-52475.stderr index c41000e71351..8536ff02c6da 100644 --- a/src/test/ui/consts/const-eval/issue-52475.stderr +++ b/src/test/ui/consts/const-eval/issue-52475.stderr @@ -1,23 +1,9 @@ -error[E0658]: `while` is not allowed in a `const` - --> $DIR/issue-52475.rs:5:9 - | -LL | / while n < 5 { -LL | | -LL | | n = (n + 1) % 5; -LL | | x = &0; // Materialize a new AllocId -LL | | } - | |_________^ - | - = note: see issue #52000 for more information - = help: add `#![feature(const_loop)]` to the crate attributes to enable - error[E0080]: evaluation of constant value failed - --> $DIR/issue-52475.rs:7:17 + --> $DIR/issue-52475.rs:6:17 | LL | n = (n + 1) % 5; | ^^^^^^^^^^^ exceeded interpreter step limit (see `#[const_eval_limit]`) -error: aborting due to 2 previous errors +error: aborting due to previous error -Some errors have detailed explanations: E0080, E0658. -For more information about an error, try `rustc --explain E0080`. +For more information about this error, try `rustc --explain E0080`. diff --git a/src/test/ui/consts/const-eval/issue-62272.rs b/src/test/ui/consts/const-eval/issue-62272.rs deleted file mode 100644 index 19abd91252db..000000000000 --- a/src/test/ui/consts/const-eval/issue-62272.rs +++ /dev/null @@ -1,11 +0,0 @@ -// `loop`s unconditionally-broken-from used to be allowed in constants, but are now forbidden by -// the HIR const-checker. -// -// See https://github.com/rust-lang/rust/pull/66170 and -// https://github.com/rust-lang/rust/issues/62272. - -const FOO: () = loop { break; }; //~ ERROR `loop` is not allowed in a `const` - -fn main() { - [FOO; { let x; loop { x = 5; break; } x }]; //~ ERROR `loop` is not allowed in a `const` -} diff --git a/src/test/ui/consts/const-eval/issue-62272.stderr b/src/test/ui/consts/const-eval/issue-62272.stderr deleted file mode 100644 index 380f68bee09c..000000000000 --- a/src/test/ui/consts/const-eval/issue-62272.stderr +++ /dev/null @@ -1,21 +0,0 @@ -error[E0658]: `loop` is not allowed in a `const` - --> $DIR/issue-62272.rs:7:17 - | -LL | const FOO: () = loop { break; }; - | ^^^^^^^^^^^^^^^ - | - = note: see issue #52000 for more information - = help: add `#![feature(const_loop)]` to the crate attributes to enable - -error[E0658]: `loop` is not allowed in a `const` - --> $DIR/issue-62272.rs:10:20 - | -LL | [FOO; { let x; loop { x = 5; break; } x }]; - | ^^^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #52000 for more information - = help: add `#![feature(const_loop)]` to the crate attributes to enable - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/consts/const-eval/issue-70723.rs b/src/test/ui/consts/const-eval/issue-70723.rs index 8b79d5d53c5c..3c81afa67a69 100644 --- a/src/test/ui/consts/const-eval/issue-70723.rs +++ b/src/test/ui/consts/const-eval/issue-70723.rs @@ -1,5 +1,3 @@ -#![feature(const_loop)] - static _X: () = loop {}; //~ ERROR could not evaluate static initializer fn main() {} diff --git a/src/test/ui/consts/const-eval/issue-70723.stderr b/src/test/ui/consts/const-eval/issue-70723.stderr index 687d6565a716..09fb3e060dc4 100644 --- a/src/test/ui/consts/const-eval/issue-70723.stderr +++ b/src/test/ui/consts/const-eval/issue-70723.stderr @@ -1,5 +1,5 @@ error[E0080]: could not evaluate static initializer - --> $DIR/issue-70723.rs:3:17 + --> $DIR/issue-70723.rs:1:17 | LL | static _X: () = loop {}; | ^^^^^^^ exceeded interpreter step limit (see `#[const_eval_limit]`) diff --git a/src/test/ui/consts/const-eval/livedrop.rs b/src/test/ui/consts/const-eval/livedrop.rs index f00d1c70659f..66b7d0580808 100644 --- a/src/test/ui/consts/const-eval/livedrop.rs +++ b/src/test/ui/consts/const-eval/livedrop.rs @@ -1,6 +1,3 @@ -#![feature(const_if_match)] -#![feature(const_loop)] - const _: Option> = { let mut never_returned = Some(Vec::new()); let mut always_returned = None; //~ ERROR destructors cannot be evaluated at compile-time diff --git a/src/test/ui/consts/const-eval/livedrop.stderr b/src/test/ui/consts/const-eval/livedrop.stderr index b802d23d9a89..1e8b4230c6f1 100644 --- a/src/test/ui/consts/const-eval/livedrop.stderr +++ b/src/test/ui/consts/const-eval/livedrop.stderr @@ -1,5 +1,5 @@ error[E0493]: destructors cannot be evaluated at compile-time - --> $DIR/livedrop.rs:6:9 + --> $DIR/livedrop.rs:3:9 | LL | let mut always_returned = None; | ^^^^^^^^^^^^^^^^^^^ constants cannot evaluate destructors diff --git a/src/test/ui/consts/const-labeled-break.rs b/src/test/ui/consts/const-labeled-break.rs index 45e3cf438888..6864f7247ad5 100644 --- a/src/test/ui/consts/const-labeled-break.rs +++ b/src/test/ui/consts/const-labeled-break.rs @@ -1,12 +1,11 @@ +// run-pass + // Using labeled break in a while loop has caused an illegal instruction being // generated, and an ICE later. // // See https://github.com/rust-lang/rust/issues/51350 for more information. -// -// It is now forbidden by the HIR const-checker. -// -// See https://github.com/rust-lang/rust/pull/66170. -const CRASH: () = 'a: while break 'a {}; //~ ERROR `while` is not allowed in a `const` +#[allow(unreachable_code)] +const _: () = 'a: while break 'a {}; fn main() {} diff --git a/src/test/ui/consts/const-labeled-break.stderr b/src/test/ui/consts/const-labeled-break.stderr deleted file mode 100644 index 1e24bb4ab98d..000000000000 --- a/src/test/ui/consts/const-labeled-break.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0658]: `while` is not allowed in a `const` - --> $DIR/const-labeled-break.rs:10:19 - | -LL | const CRASH: () = 'a: while break 'a {}; - | ^^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #52000 for more information - = help: add `#![feature(const_loop)]` to the crate attributes to enable - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/consts/const_limit/const_eval_limit_not_reached.rs b/src/test/ui/consts/const_limit/const_eval_limit_not_reached.rs index fa56de065ae8..629d1f02a30f 100644 --- a/src/test/ui/consts/const_limit/const_eval_limit_not_reached.rs +++ b/src/test/ui/consts/const_limit/const_eval_limit_not_reached.rs @@ -1,7 +1,6 @@ // check-pass #![feature(const_eval_limit)] -#![feature(const_loop)] // This needs to be higher than the number of loop iterations since each pass through the loop may // hit more than one terminator. diff --git a/src/test/ui/consts/const_limit/const_eval_limit_reached.rs b/src/test/ui/consts/const_limit/const_eval_limit_reached.rs index a98a17f95d21..069dac00c9ac 100644 --- a/src/test/ui/consts/const_limit/const_eval_limit_reached.rs +++ b/src/test/ui/consts/const_limit/const_eval_limit_reached.rs @@ -1,5 +1,4 @@ #![feature(const_eval_limit)] -#![feature(const_loop)] #![const_eval_limit = "500"] const X: usize = { diff --git a/src/test/ui/consts/const_limit/const_eval_limit_reached.stderr b/src/test/ui/consts/const_limit/const_eval_limit_reached.stderr index 2c4f4ebd99ae..8785c9e54b9b 100644 --- a/src/test/ui/consts/const_limit/const_eval_limit_reached.stderr +++ b/src/test/ui/consts/const_limit/const_eval_limit_reached.stderr @@ -1,5 +1,5 @@ error: any use of this value will cause an error - --> $DIR/const_eval_limit_reached.rs:7:11 + --> $DIR/const_eval_limit_reached.rs:6:5 | LL | / const X: usize = { LL | | let mut x = 0; diff --git a/src/test/ui/consts/control-flow/basics.rs b/src/test/ui/consts/control-flow/basics.rs index 3701f349d070..6dd6192941d3 100644 --- a/src/test/ui/consts/control-flow/basics.rs +++ b/src/test/ui/consts/control-flow/basics.rs @@ -3,7 +3,6 @@ // run-pass #![feature(const_panic)] -#![feature(const_loop)] #![feature(const_fn)] const X: u32 = 4; diff --git a/src/test/ui/consts/control-flow/drop-fail.precise.stderr b/src/test/ui/consts/control-flow/drop-fail.precise.stderr index f4edfaf72bed..0b0b2443a4a4 100644 --- a/src/test/ui/consts/control-flow/drop-fail.precise.stderr +++ b/src/test/ui/consts/control-flow/drop-fail.precise.stderr @@ -1,11 +1,11 @@ error[E0493]: destructors cannot be evaluated at compile-time - --> $DIR/drop-fail.rs:9:9 + --> $DIR/drop-fail.rs:8:9 | LL | let x = Some(Vec::new()); | ^ constants cannot evaluate destructors error[E0493]: destructors cannot be evaluated at compile-time - --> $DIR/drop-fail.rs:40:9 + --> $DIR/drop-fail.rs:39:9 | LL | let mut tmp = None; | ^^^^^^^ constants cannot evaluate destructors diff --git a/src/test/ui/consts/control-flow/drop-fail.rs b/src/test/ui/consts/control-flow/drop-fail.rs index 94deeb8c54ca..efa5a11c941e 100644 --- a/src/test/ui/consts/control-flow/drop-fail.rs +++ b/src/test/ui/consts/control-flow/drop-fail.rs @@ -1,6 +1,5 @@ // revisions: stock precise -#![feature(const_loop)] #![cfg_attr(precise, feature(const_precise_live_drops))] // `x` is *not* always moved into the final value and may be dropped inside the initializer. diff --git a/src/test/ui/consts/control-flow/drop-fail.stock.stderr b/src/test/ui/consts/control-flow/drop-fail.stock.stderr index 94734222117f..72ca4fa08bc4 100644 --- a/src/test/ui/consts/control-flow/drop-fail.stock.stderr +++ b/src/test/ui/consts/control-flow/drop-fail.stock.stderr @@ -1,5 +1,5 @@ error[E0493]: destructors cannot be evaluated at compile-time - --> $DIR/drop-fail.rs:9:9 + --> $DIR/drop-fail.rs:8:9 | LL | let x = Some(Vec::new()); | ^ constants cannot evaluate destructors @@ -8,7 +8,7 @@ LL | }; | - value is dropped here error[E0493]: destructors cannot be evaluated at compile-time - --> $DIR/drop-fail.rs:22:9 + --> $DIR/drop-fail.rs:21:9 | LL | let vec_tuple = (Vec::new(),); | ^^^^^^^^^ constants cannot evaluate destructors @@ -17,7 +17,7 @@ LL | }; | - value is dropped here error[E0493]: destructors cannot be evaluated at compile-time - --> $DIR/drop-fail.rs:30:9 + --> $DIR/drop-fail.rs:29:9 | LL | let x: Result<_, Vec> = Ok(Vec::new()); | ^ constants cannot evaluate destructors @@ -26,7 +26,7 @@ LL | }; | - value is dropped here error[E0493]: destructors cannot be evaluated at compile-time - --> $DIR/drop-fail.rs:40:9 + --> $DIR/drop-fail.rs:39:9 | LL | let mut tmp = None; | ^^^^^^^ constants cannot evaluate destructors diff --git a/src/test/ui/consts/control-flow/drop-pass.rs b/src/test/ui/consts/control-flow/drop-pass.rs index 2ef8e08d7449..95f954a59a8d 100644 --- a/src/test/ui/consts/control-flow/drop-pass.rs +++ b/src/test/ui/consts/control-flow/drop-pass.rs @@ -1,7 +1,6 @@ // run-pass // revisions: stock precise -#![feature(const_loop)] #![cfg_attr(precise, feature(const_precise_live_drops))] // `x` is always moved into the final value and is not dropped inside the initializer. diff --git a/src/test/ui/consts/control-flow/drop-precise.rs b/src/test/ui/consts/control-flow/drop-precise.rs index 058c5608ec1b..4ecc5ef78dd5 100644 --- a/src/test/ui/consts/control-flow/drop-precise.rs +++ b/src/test/ui/consts/control-flow/drop-precise.rs @@ -1,7 +1,6 @@ // run-pass // gate-test-const_precise_live_drops -#![feature(const_loop)] #![feature(const_precise_live_drops)] const _: Vec = { diff --git a/src/test/ui/consts/control-flow/interior-mutability.rs b/src/test/ui/consts/control-flow/interior-mutability.rs index cabdf4a929b1..a6d44237b0d9 100644 --- a/src/test/ui/consts/control-flow/interior-mutability.rs +++ b/src/test/ui/consts/control-flow/interior-mutability.rs @@ -1,8 +1,6 @@ // Ensure that *any* assignment to the return place of a value with interior mutability // disqualifies it from promotion. -#![feature(const_loop)] - use std::cell::Cell; const X: Option> = { diff --git a/src/test/ui/consts/control-flow/interior-mutability.stderr b/src/test/ui/consts/control-flow/interior-mutability.stderr index 8f18ae1816a4..4f9c7d34c35f 100644 --- a/src/test/ui/consts/control-flow/interior-mutability.stderr +++ b/src/test/ui/consts/control-flow/interior-mutability.stderr @@ -1,5 +1,5 @@ error[E0716]: temporary value dropped while borrowed - --> $DIR/interior-mutability.rs:42:26 + --> $DIR/interior-mutability.rs:40:26 | LL | let x: &'static _ = &X; | ---------- ^ creates a temporary which is freed while still in use @@ -10,7 +10,7 @@ LL | } | - temporary value is freed at the end of this statement error[E0716]: temporary value dropped while borrowed - --> $DIR/interior-mutability.rs:43:26 + --> $DIR/interior-mutability.rs:41:26 | LL | let y: &'static _ = &Y; | ---------- ^ creates a temporary which is freed while still in use @@ -21,7 +21,7 @@ LL | } | - temporary value is freed at the end of this statement error[E0716]: temporary value dropped while borrowed - --> $DIR/interior-mutability.rs:44:26 + --> $DIR/interior-mutability.rs:42:26 | LL | let z: &'static _ = &Z; | ---------- ^ creates a temporary which is freed while still in use diff --git a/src/test/ui/consts/control-flow/loop.rs b/src/test/ui/consts/control-flow/loop.rs index 30cc3d1b1aff..2b8561a26448 100644 --- a/src/test/ui/consts/control-flow/loop.rs +++ b/src/test/ui/consts/control-flow/loop.rs @@ -1,29 +1,22 @@ -// Ensure that loops are forbidden in a const context unless `#![feature(const_loop)]` is enabled. +const _: () = loop { break (); }; -// gate-test-const_loop -// revisions: stock loop_ - -#![cfg_attr(loop_, feature(const_loop))] - -const _: () = loop {}; //[stock]~ ERROR `loop` is not allowed in a `const` - -static FOO: i32 = loop { break 4; }; //[stock]~ ERROR `loop` is not allowed in a `static` +static FOO: i32 = loop { break 4; }; const fn foo() { - loop {} //[stock]~ ERROR `loop` is not allowed in a `const fn` + loop {} } pub trait Foo { - const BAR: i32 = loop { break 4; }; //[stock]~ ERROR `loop` is not allowed in a `const` + const BAR: i32 = loop { break 4; }; } impl Foo for () { - const BAR: i32 = loop { break 4; }; //[stock]~ ERROR `loop` is not allowed in a `const` + const BAR: i32 = loop { break 4; }; } fn non_const_outside() { const fn const_inside() { - loop {} //[stock]~ ERROR `loop` is not allowed in a `const fn` + loop {} } } @@ -36,7 +29,6 @@ const fn const_outside() { fn main() { let x = [0; { while false {} - //[stock]~^ ERROR `while` is not allowed in a `const` 4 }]; } @@ -44,11 +36,11 @@ fn main() { const _: i32 = { let mut x = 0; - while x < 4 { //[stock]~ ERROR `while` is not allowed in a `const` + while x < 4 { x += 1; } - while x < 8 { //[stock]~ ERROR `while` is not allowed in a `const` + while x < 8 { x += 1; } @@ -58,11 +50,11 @@ const _: i32 = { const _: i32 = { let mut x = 0; - for i in 0..4 { //[stock,loop_]~ ERROR `for` is not allowed in a `const` + for i in 0..4 { //~ ERROR `for` is not allowed in a `const` x += i; } - for i in 0..4 { //[stock,loop_]~ ERROR `for` is not allowed in a `const` + for i in 0..4 { //~ ERROR `for` is not allowed in a `const` x += i; } @@ -72,14 +64,14 @@ const _: i32 = { const _: i32 = { let mut x = 0; - loop { //[stock]~ ERROR `loop` is not allowed in a `const` + loop { x += 1; if x == 4 { break; } } - loop { //[stock]~ ERROR `loop` is not allowed in a `const` + loop { x += 1; if x == 8 { break; @@ -91,7 +83,7 @@ const _: i32 = { const _: i32 = { let mut x = 0; - while let None = Some(x) { } //[stock]~ ERROR `while` is not allowed in a `const` - while let None = Some(x) { } //[stock]~ ERROR `while` is not allowed in a `const` + while let None = Some(x) { } + while let None = Some(x) { } x }; diff --git a/src/test/ui/consts/control-flow/loop.loop_.stderr b/src/test/ui/consts/control-flow/loop.stderr similarity index 88% rename from src/test/ui/consts/control-flow/loop.loop_.stderr rename to src/test/ui/consts/control-flow/loop.stderr index c40cee6620e1..7b99fa4fe460 100644 --- a/src/test/ui/consts/control-flow/loop.loop_.stderr +++ b/src/test/ui/consts/control-flow/loop.stderr @@ -1,5 +1,5 @@ error[E0744]: `for` is not allowed in a `const` - --> $DIR/loop.rs:61:5 + --> $DIR/loop.rs:53:5 | LL | / for i in 0..4 { LL | | x += i; @@ -7,7 +7,7 @@ LL | | } | |_____^ error[E0744]: `for` is not allowed in a `const` - --> $DIR/loop.rs:65:5 + --> $DIR/loop.rs:57:5 | LL | / for i in 0..4 { LL | | x += i; diff --git a/src/test/ui/consts/control-flow/loop.stock.stderr b/src/test/ui/consts/control-flow/loop.stock.stderr deleted file mode 100644 index a9ac3929bba1..000000000000 --- a/src/test/ui/consts/control-flow/loop.stock.stderr +++ /dev/null @@ -1,151 +0,0 @@ -error[E0658]: `loop` is not allowed in a `const` - --> $DIR/loop.rs:8:15 - | -LL | const _: () = loop {}; - | ^^^^^^^ - | - = note: see issue #52000 for more information - = help: add `#![feature(const_loop)]` to the crate attributes to enable - -error[E0658]: `loop` is not allowed in a `static` - --> $DIR/loop.rs:10:19 - | -LL | static FOO: i32 = loop { break 4; }; - | ^^^^^^^^^^^^^^^^^ - | - = note: see issue #52000 for more information - = help: add `#![feature(const_loop)]` to the crate attributes to enable - -error[E0658]: `loop` is not allowed in a `const fn` - --> $DIR/loop.rs:13:5 - | -LL | loop {} - | ^^^^^^^ - | - = note: see issue #52000 for more information - = help: add `#![feature(const_loop)]` to the crate attributes to enable - -error[E0658]: `loop` is not allowed in a `const fn` - --> $DIR/loop.rs:26:9 - | -LL | loop {} - | ^^^^^^^ - | - = note: see issue #52000 for more information - = help: add `#![feature(const_loop)]` to the crate attributes to enable - -error[E0658]: `while` is not allowed in a `const` - --> $DIR/loop.rs:38:9 - | -LL | while false {} - | ^^^^^^^^^^^^^^ - | - = note: see issue #52000 for more information - = help: add `#![feature(const_loop)]` to the crate attributes to enable - -error[E0658]: `while` is not allowed in a `const` - --> $DIR/loop.rs:47:5 - | -LL | / while x < 4 { -LL | | x += 1; -LL | | } - | |_____^ - | - = note: see issue #52000 for more information - = help: add `#![feature(const_loop)]` to the crate attributes to enable - -error[E0658]: `while` is not allowed in a `const` - --> $DIR/loop.rs:51:5 - | -LL | / while x < 8 { -LL | | x += 1; -LL | | } - | |_____^ - | - = note: see issue #52000 for more information - = help: add `#![feature(const_loop)]` to the crate attributes to enable - -error[E0744]: `for` is not allowed in a `const` - --> $DIR/loop.rs:61:5 - | -LL | / for i in 0..4 { -LL | | x += i; -LL | | } - | |_____^ - -error[E0744]: `for` is not allowed in a `const` - --> $DIR/loop.rs:65:5 - | -LL | / for i in 0..4 { -LL | | x += i; -LL | | } - | |_____^ - -error[E0658]: `loop` is not allowed in a `const` - --> $DIR/loop.rs:75:5 - | -LL | / loop { -LL | | x += 1; -LL | | if x == 4 { -LL | | break; -LL | | } -LL | | } - | |_____^ - | - = note: see issue #52000 for more information - = help: add `#![feature(const_loop)]` to the crate attributes to enable - -error[E0658]: `loop` is not allowed in a `const` - --> $DIR/loop.rs:82:5 - | -LL | / loop { -LL | | x += 1; -LL | | if x == 8 { -LL | | break; -LL | | } -LL | | } - | |_____^ - | - = note: see issue #52000 for more information - = help: add `#![feature(const_loop)]` to the crate attributes to enable - -error[E0658]: `while` is not allowed in a `const` - --> $DIR/loop.rs:94:5 - | -LL | while let None = Some(x) { } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #52000 for more information - = help: add `#![feature(const_loop)]` to the crate attributes to enable - -error[E0658]: `while` is not allowed in a `const` - --> $DIR/loop.rs:95:5 - | -LL | while let None = Some(x) { } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #52000 for more information - = help: add `#![feature(const_loop)]` to the crate attributes to enable - -error[E0658]: `loop` is not allowed in a `const` - --> $DIR/loop.rs:17:22 - | -LL | const BAR: i32 = loop { break 4; }; - | ^^^^^^^^^^^^^^^^^ - | - = note: see issue #52000 for more information - = help: add `#![feature(const_loop)]` to the crate attributes to enable - -error[E0658]: `loop` is not allowed in a `const` - --> $DIR/loop.rs:21:22 - | -LL | const BAR: i32 = loop { break 4; }; - | ^^^^^^^^^^^^^^^^^ - | - = note: see issue #52000 for more information - = help: add `#![feature(const_loop)]` to the crate attributes to enable - -error: aborting due to 15 previous errors - -Some errors have detailed explanations: E0658, E0744. -For more information about an error, try `rustc --explain E0658`. diff --git a/src/test/ui/consts/min_const_fn/loop_ice.rs b/src/test/ui/consts/min_const_fn/loop_ice.rs deleted file mode 100644 index 754a1d7c2a3a..000000000000 --- a/src/test/ui/consts/min_const_fn/loop_ice.rs +++ /dev/null @@ -1,5 +0,0 @@ -const fn foo() { - loop {} //~ ERROR `loop` is not allowed in a `const fn` -} - -fn main() {} diff --git a/src/test/ui/consts/min_const_fn/loop_ice.stderr b/src/test/ui/consts/min_const_fn/loop_ice.stderr deleted file mode 100644 index f48b7396e77c..000000000000 --- a/src/test/ui/consts/min_const_fn/loop_ice.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0658]: `loop` is not allowed in a `const fn` - --> $DIR/loop_ice.rs:2:5 - | -LL | loop {} - | ^^^^^^^ - | - = note: see issue #52000 for more information - = help: add `#![feature(const_loop)]` to the crate attributes to enable - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/internal/internal-unstable-const.rs b/src/test/ui/internal/internal-unstable-const.rs index a32338c6546c..3b3a2950942d 100644 --- a/src/test/ui/internal/internal-unstable-const.rs +++ b/src/test/ui/internal/internal-unstable-const.rs @@ -1,12 +1,14 @@ +// Don't allow unstable features in stable functions without `allow_internal_unstable`. + #![stable(feature = "rust1", since = "1.0.0")] #![feature(staged_api)] -#![feature(const_loop, const_fn)] +#![feature(const_transmute, const_fn)] #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_stable(feature = "rust1", since = "1.0.0")] -const fn foo() -> i32 { - loop { return 42; } //~ ERROR `loop` is not allowed in a `const fn` +pub const fn foo() -> i32 { + unsafe { std::mem::transmute(4u32) } //~ ERROR is not stable as `const fn` } fn main() {} diff --git a/src/test/ui/internal/internal-unstable-const.stderr b/src/test/ui/internal/internal-unstable-const.stderr index a43e014b1c64..5a2c58f3928d 100644 --- a/src/test/ui/internal/internal-unstable-const.stderr +++ b/src/test/ui/internal/internal-unstable-const.stderr @@ -1,9 +1,12 @@ -error[E0744]: `loop` is not allowed in a `const fn` - --> $DIR/internal-unstable-const.rs:9:5 +error[E0723]: can only call other `const fn` within a `const fn`, but `const std::intrinsics::transmute::` is not stable as `const fn` + --> $DIR/internal-unstable-const.rs:11:14 | -LL | loop { return 42; } - | ^^^^^^^^^^^^^^^^^^^ +LL | unsafe { std::mem::transmute(4u32) } + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #57563 for more information + = help: add `#![feature(const_fn)]` to the crate attributes to enable error: aborting due to previous error -For more information about this error, try `rustc --explain E0744`. +For more information about this error, try `rustc --explain E0723`. diff --git a/src/test/ui/issues/issue-51714.rs b/src/test/ui/issues/issue-51714.rs index 782037a1fe5d..0dc588d75c65 100644 --- a/src/test/ui/issues/issue-51714.rs +++ b/src/test/ui/issues/issue-51714.rs @@ -10,5 +10,4 @@ fn main() { [(); return while let Some(n) = Some(0) {}]; //~^ ERROR return statement outside of function body - //~| ERROR `while` is not allowed in a `const` } diff --git a/src/test/ui/issues/issue-51714.stderr b/src/test/ui/issues/issue-51714.stderr index 71d4022a6d41..023d9013ab4e 100644 --- a/src/test/ui/issues/issue-51714.stderr +++ b/src/test/ui/issues/issue-51714.stderr @@ -1,12 +1,3 @@ -error[E0658]: `while` is not allowed in a `const` - --> $DIR/issue-51714.rs:11:17 - | -LL | [(); return while let Some(n) = Some(0) {}]; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #52000 for more information - = help: add `#![feature(const_loop)]` to the crate attributes to enable - error[E0572]: return statement outside of function body --> $DIR/issue-51714.rs:2:14 | @@ -31,7 +22,6 @@ error[E0572]: return statement outside of function body LL | [(); return while let Some(n) = Some(0) {}]; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 5 previous errors +error: aborting due to 4 previous errors -Some errors have detailed explanations: E0572, E0658. -For more information about an error, try `rustc --explain E0572`. +For more information about this error, try `rustc --explain E0572`. diff --git a/src/test/ui/rfc-2632-const-trait-impl/hir-const-check.rs b/src/test/ui/rfc-2632-const-trait-impl/hir-const-check.rs index 6154b484d343..655d4d7400b7 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/hir-const-check.rs +++ b/src/test/ui/rfc-2632-const-trait-impl/hir-const-check.rs @@ -4,12 +4,13 @@ #![allow(incomplete_features)] pub trait MyTrait { - fn method(&self); + fn method(&self) -> Option<()>; } impl const MyTrait for () { - fn method(&self) { - loop {} //~ ERROR `loop` is not allowed in a `const fn` + fn method(&self) -> Option<()> { + Some(())?; //~ ERROR `?` is not allowed in a `const fn` + None } } diff --git a/src/test/ui/rfc-2632-const-trait-impl/hir-const-check.stderr b/src/test/ui/rfc-2632-const-trait-impl/hir-const-check.stderr index ec4040605353..8c76d7eb597b 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/hir-const-check.stderr +++ b/src/test/ui/rfc-2632-const-trait-impl/hir-const-check.stderr @@ -1,12 +1,9 @@ -error[E0658]: `loop` is not allowed in a `const fn` +error[E0744]: `?` is not allowed in a `const fn` --> $DIR/hir-const-check.rs:12:9 | -LL | loop {} - | ^^^^^^^ - | - = note: see issue #52000 for more information - = help: add `#![feature(const_loop)]` to the crate attributes to enable +LL | Some(())?; + | ^^^^^^^^^ error: aborting due to previous error -For more information about this error, try `rustc --explain E0658`. +For more information about this error, try `rustc --explain E0744`. diff --git a/src/tools/clippy/tests/ui/redundant_pattern_matching.fixed b/src/tools/clippy/tests/ui/redundant_pattern_matching.fixed index 6ba5cfb1d717..8b4e2d21331c 100644 --- a/src/tools/clippy/tests/ui/redundant_pattern_matching.fixed +++ b/src/tools/clippy/tests/ui/redundant_pattern_matching.fixed @@ -1,7 +1,5 @@ // run-rustfix -#![feature(const_if_match)] -#![feature(const_loop)] #![warn(clippy::all)] #![warn(clippy::redundant_pattern_matching)] #![allow(clippy::unit_arg, unused_must_use, clippy::needless_bool, deprecated)] diff --git a/src/tools/clippy/tests/ui/redundant_pattern_matching.rs b/src/tools/clippy/tests/ui/redundant_pattern_matching.rs index 17de66f9ad0e..b0904e41b6f4 100644 --- a/src/tools/clippy/tests/ui/redundant_pattern_matching.rs +++ b/src/tools/clippy/tests/ui/redundant_pattern_matching.rs @@ -1,7 +1,5 @@ // run-rustfix -#![feature(const_if_match)] -#![feature(const_loop)] #![warn(clippy::all)] #![warn(clippy::redundant_pattern_matching)] #![allow(clippy::unit_arg, unused_must_use, clippy::needless_bool, deprecated)] diff --git a/src/tools/clippy/tests/ui/redundant_pattern_matching.stderr b/src/tools/clippy/tests/ui/redundant_pattern_matching.stderr index 1b9a4b40a2f0..51a6f4350d32 100644 --- a/src/tools/clippy/tests/ui/redundant_pattern_matching.stderr +++ b/src/tools/clippy/tests/ui/redundant_pattern_matching.stderr @@ -1,5 +1,5 @@ error: redundant pattern matching, consider using `is_ok()` - --> $DIR/redundant_pattern_matching.rs:10:12 + --> $DIR/redundant_pattern_matching.rs:8:12 | LL | if let Ok(_) = Ok::(42) {} | -------^^^^^--------------------- help: try this: `if Ok::(42).is_ok()` @@ -7,67 +7,67 @@ LL | if let Ok(_) = Ok::(42) {} = note: `-D clippy::redundant-pattern-matching` implied by `-D warnings` error: redundant pattern matching, consider using `is_err()` - --> $DIR/redundant_pattern_matching.rs:12:12 + --> $DIR/redundant_pattern_matching.rs:10:12 | LL | if let Err(_) = Err::(42) {} | -------^^^^^^---------------------- help: try this: `if Err::(42).is_err()` error: redundant pattern matching, consider using `is_none()` - --> $DIR/redundant_pattern_matching.rs:14:12 + --> $DIR/redundant_pattern_matching.rs:12:12 | LL | if let None = None::<()> {} | -------^^^^------------- help: try this: `if None::<()>.is_none()` error: redundant pattern matching, consider using `is_some()` - --> $DIR/redundant_pattern_matching.rs:16:12 + --> $DIR/redundant_pattern_matching.rs:14:12 | LL | if let Some(_) = Some(42) {} | -------^^^^^^^----------- help: try this: `if Some(42).is_some()` error: redundant pattern matching, consider using `is_some()` - --> $DIR/redundant_pattern_matching.rs:18:12 + --> $DIR/redundant_pattern_matching.rs:16:12 | LL | if let Some(_) = Some(42) { | -------^^^^^^^----------- help: try this: `if Some(42).is_some()` error: redundant pattern matching, consider using `is_some()` - --> $DIR/redundant_pattern_matching.rs:24:15 + --> $DIR/redundant_pattern_matching.rs:22:15 | LL | while let Some(_) = Some(42) {} | ----------^^^^^^^----------- help: try this: `while Some(42).is_some()` error: redundant pattern matching, consider using `is_none()` - --> $DIR/redundant_pattern_matching.rs:26:15 + --> $DIR/redundant_pattern_matching.rs:24:15 | LL | while let None = Some(42) {} | ----------^^^^----------- help: try this: `while Some(42).is_none()` error: redundant pattern matching, consider using `is_none()` - --> $DIR/redundant_pattern_matching.rs:28:15 + --> $DIR/redundant_pattern_matching.rs:26:15 | LL | while let None = None::<()> {} | ----------^^^^------------- help: try this: `while None::<()>.is_none()` error: redundant pattern matching, consider using `is_ok()` - --> $DIR/redundant_pattern_matching.rs:30:15 + --> $DIR/redundant_pattern_matching.rs:28:15 | LL | while let Ok(_) = Ok::(10) {} | ----------^^^^^--------------------- help: try this: `while Ok::(10).is_ok()` error: redundant pattern matching, consider using `is_err()` - --> $DIR/redundant_pattern_matching.rs:32:15 + --> $DIR/redundant_pattern_matching.rs:30:15 | LL | while let Err(_) = Ok::(10) {} | ----------^^^^^^--------------------- help: try this: `while Ok::(10).is_err()` error: redundant pattern matching, consider using `is_some()` - --> $DIR/redundant_pattern_matching.rs:35:15 + --> $DIR/redundant_pattern_matching.rs:33:15 | LL | while let Some(_) = v.pop() { | ----------^^^^^^^---------- help: try this: `while v.pop().is_some()` error: redundant pattern matching, consider using `is_ok()` - --> $DIR/redundant_pattern_matching.rs:51:5 + --> $DIR/redundant_pattern_matching.rs:49:5 | LL | / match Ok::(42) { LL | | Ok(_) => true, @@ -76,7 +76,7 @@ LL | | }; | |_____^ help: try this: `Ok::(42).is_ok()` error: redundant pattern matching, consider using `is_err()` - --> $DIR/redundant_pattern_matching.rs:56:5 + --> $DIR/redundant_pattern_matching.rs:54:5 | LL | / match Ok::(42) { LL | | Ok(_) => false, @@ -85,7 +85,7 @@ LL | | }; | |_____^ help: try this: `Ok::(42).is_err()` error: redundant pattern matching, consider using `is_err()` - --> $DIR/redundant_pattern_matching.rs:61:5 + --> $DIR/redundant_pattern_matching.rs:59:5 | LL | / match Err::(42) { LL | | Ok(_) => false, @@ -94,7 +94,7 @@ LL | | }; | |_____^ help: try this: `Err::(42).is_err()` error: redundant pattern matching, consider using `is_ok()` - --> $DIR/redundant_pattern_matching.rs:66:5 + --> $DIR/redundant_pattern_matching.rs:64:5 | LL | / match Err::(42) { LL | | Ok(_) => true, @@ -103,7 +103,7 @@ LL | | }; | |_____^ help: try this: `Err::(42).is_ok()` error: redundant pattern matching, consider using `is_some()` - --> $DIR/redundant_pattern_matching.rs:71:5 + --> $DIR/redundant_pattern_matching.rs:69:5 | LL | / match Some(42) { LL | | Some(_) => true, @@ -112,7 +112,7 @@ LL | | }; | |_____^ help: try this: `Some(42).is_some()` error: redundant pattern matching, consider using `is_none()` - --> $DIR/redundant_pattern_matching.rs:76:5 + --> $DIR/redundant_pattern_matching.rs:74:5 | LL | / match None::<()> { LL | | Some(_) => false, @@ -121,7 +121,7 @@ LL | | }; | |_____^ help: try this: `None::<()>.is_none()` error: redundant pattern matching, consider using `is_none()` - --> $DIR/redundant_pattern_matching.rs:81:13 + --> $DIR/redundant_pattern_matching.rs:79:13 | LL | let _ = match None::<()> { | _____________^ @@ -131,61 +131,61 @@ LL | | }; | |_____^ help: try this: `None::<()>.is_none()` error: redundant pattern matching, consider using `is_ok()` - --> $DIR/redundant_pattern_matching.rs:86:20 + --> $DIR/redundant_pattern_matching.rs:84:20 | LL | let _ = if let Ok(_) = Ok::(4) { true } else { false }; | -------^^^^^--------------------- help: try this: `if Ok::(4).is_ok()` error: redundant pattern matching, consider using `is_some()` - --> $DIR/redundant_pattern_matching.rs:89:20 + --> $DIR/redundant_pattern_matching.rs:87:20 | LL | let x = if let Some(_) = opt { true } else { false }; | -------^^^^^^^------ help: try this: `if opt.is_some()` error: redundant pattern matching, consider using `is_some()` - --> $DIR/redundant_pattern_matching.rs:95:20 + --> $DIR/redundant_pattern_matching.rs:93:20 | LL | let _ = if let Some(_) = gen_opt() { | -------^^^^^^^------------ help: try this: `if gen_opt().is_some()` error: redundant pattern matching, consider using `is_none()` - --> $DIR/redundant_pattern_matching.rs:97:19 + --> $DIR/redundant_pattern_matching.rs:95:19 | LL | } else if let None = gen_opt() { | -------^^^^------------ help: try this: `if gen_opt().is_none()` error: redundant pattern matching, consider using `is_ok()` - --> $DIR/redundant_pattern_matching.rs:99:19 + --> $DIR/redundant_pattern_matching.rs:97:19 | LL | } else if let Ok(_) = gen_res() { | -------^^^^^------------ help: try this: `if gen_res().is_ok()` error: redundant pattern matching, consider using `is_err()` - --> $DIR/redundant_pattern_matching.rs:101:19 + --> $DIR/redundant_pattern_matching.rs:99:19 | LL | } else if let Err(_) = gen_res() { | -------^^^^^^------------ help: try this: `if gen_res().is_err()` error: redundant pattern matching, consider using `is_some()` - --> $DIR/redundant_pattern_matching.rs:134:19 + --> $DIR/redundant_pattern_matching.rs:132:19 | LL | while let Some(_) = r#try!(result_opt()) {} | ----------^^^^^^^----------------------- help: try this: `while r#try!(result_opt()).is_some()` error: redundant pattern matching, consider using `is_some()` - --> $DIR/redundant_pattern_matching.rs:135:16 + --> $DIR/redundant_pattern_matching.rs:133:16 | LL | if let Some(_) = r#try!(result_opt()) {} | -------^^^^^^^----------------------- help: try this: `if r#try!(result_opt()).is_some()` error: redundant pattern matching, consider using `is_some()` - --> $DIR/redundant_pattern_matching.rs:141:12 + --> $DIR/redundant_pattern_matching.rs:139:12 | LL | if let Some(_) = m!() {} | -------^^^^^^^------- help: try this: `if m!().is_some()` error: redundant pattern matching, consider using `is_some()` - --> $DIR/redundant_pattern_matching.rs:142:15 + --> $DIR/redundant_pattern_matching.rs:140:15 | LL | while let Some(_) = m!() {} | ----------^^^^^^^------- help: try this: `while m!().is_some()` diff --git a/src/tools/clippy/tests/ui/redundant_pattern_matching_const_result.fixed b/src/tools/clippy/tests/ui/redundant_pattern_matching_const_result.fixed index c8bc5458067d..8a81e92f04a7 100644 --- a/src/tools/clippy/tests/ui/redundant_pattern_matching_const_result.fixed +++ b/src/tools/clippy/tests/ui/redundant_pattern_matching_const_result.fixed @@ -1,7 +1,5 @@ // run-rustfix -#![feature(const_if_match)] -#![feature(const_loop)] #![feature(const_result)] #![warn(clippy::redundant_pattern_matching)] #![allow(unused)] diff --git a/src/tools/clippy/tests/ui/redundant_pattern_matching_const_result.rs b/src/tools/clippy/tests/ui/redundant_pattern_matching_const_result.rs index 75f37ec15c62..1cd515441d13 100644 --- a/src/tools/clippy/tests/ui/redundant_pattern_matching_const_result.rs +++ b/src/tools/clippy/tests/ui/redundant_pattern_matching_const_result.rs @@ -1,7 +1,5 @@ // run-rustfix -#![feature(const_if_match)] -#![feature(const_loop)] #![feature(const_result)] #![warn(clippy::redundant_pattern_matching)] #![allow(unused)] diff --git a/src/tools/clippy/tests/ui/redundant_pattern_matching_const_result.stderr b/src/tools/clippy/tests/ui/redundant_pattern_matching_const_result.stderr index c32292f0eee8..8ecd72158d33 100644 --- a/src/tools/clippy/tests/ui/redundant_pattern_matching_const_result.stderr +++ b/src/tools/clippy/tests/ui/redundant_pattern_matching_const_result.stderr @@ -1,5 +1,5 @@ error: redundant pattern matching, consider using `is_ok()` - --> $DIR/redundant_pattern_matching_const_result.rs:12:12 + --> $DIR/redundant_pattern_matching_const_result.rs:10:12 | LL | if let Ok(_) = Ok::(42) {} | -------^^^^^--------------------- help: try this: `if Ok::(42).is_ok()` @@ -7,25 +7,25 @@ LL | if let Ok(_) = Ok::(42) {} = note: `-D clippy::redundant-pattern-matching` implied by `-D warnings` error: redundant pattern matching, consider using `is_err()` - --> $DIR/redundant_pattern_matching_const_result.rs:14:12 + --> $DIR/redundant_pattern_matching_const_result.rs:12:12 | LL | if let Err(_) = Err::(42) {} | -------^^^^^^---------------------- help: try this: `if Err::(42).is_err()` error: redundant pattern matching, consider using `is_ok()` - --> $DIR/redundant_pattern_matching_const_result.rs:16:15 + --> $DIR/redundant_pattern_matching_const_result.rs:14:15 | LL | while let Ok(_) = Ok::(10) {} | ----------^^^^^--------------------- help: try this: `while Ok::(10).is_ok()` error: redundant pattern matching, consider using `is_err()` - --> $DIR/redundant_pattern_matching_const_result.rs:18:15 + --> $DIR/redundant_pattern_matching_const_result.rs:16:15 | LL | while let Err(_) = Ok::(10) {} | ----------^^^^^^--------------------- help: try this: `while Ok::(10).is_err()` error: redundant pattern matching, consider using `is_ok()` - --> $DIR/redundant_pattern_matching_const_result.rs:20:5 + --> $DIR/redundant_pattern_matching_const_result.rs:18:5 | LL | / match Ok::(42) { LL | | Ok(_) => true, @@ -34,7 +34,7 @@ LL | | }; | |_____^ help: try this: `Ok::(42).is_ok()` error: redundant pattern matching, consider using `is_err()` - --> $DIR/redundant_pattern_matching_const_result.rs:25:5 + --> $DIR/redundant_pattern_matching_const_result.rs:23:5 | LL | / match Err::(42) { LL | | Ok(_) => false,