mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 17:24:06 +00:00
Update tests
This commit is contained in:
parent
7c46e42512
commit
d84f0c8d32
@ -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
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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 <https://github.com/rust-lang/rust/issues/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`.
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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 <https://github.com/rust-lang/rust/issues/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`.
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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 <https://github.com/rust-lang/rust/issues/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`.
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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 <https://github.com/rust-lang/rust/issues/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`.
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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 <https://github.com/rust-lang/rust/issues/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`.
|
||||
|
@ -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`
|
||||
}
|
@ -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 <https://github.com/rust-lang/rust/issues/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 <https://github.com/rust-lang/rust/issues/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`.
|
@ -1,5 +1,3 @@
|
||||
#![feature(const_loop)]
|
||||
|
||||
static _X: () = loop {}; //~ ERROR could not evaluate static initializer
|
||||
|
||||
fn main() {}
|
||||
|
@ -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]`)
|
||||
|
@ -1,6 +1,3 @@
|
||||
#![feature(const_if_match)]
|
||||
#![feature(const_loop)]
|
||||
|
||||
const _: Option<Vec<i32>> = {
|
||||
let mut never_returned = Some(Vec::new());
|
||||
let mut always_returned = None; //~ ERROR destructors cannot be evaluated at compile-time
|
||||
|
@ -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
|
||||
|
@ -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() {}
|
||||
|
@ -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 <https://github.com/rust-lang/rust/issues/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`.
|
@ -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.
|
||||
|
@ -1,5 +1,4 @@
|
||||
#![feature(const_eval_limit)]
|
||||
#![feature(const_loop)]
|
||||
#![const_eval_limit = "500"]
|
||||
|
||||
const X: usize = {
|
||||
|
@ -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;
|
||||
|
@ -3,7 +3,6 @@
|
||||
// run-pass
|
||||
|
||||
#![feature(const_panic)]
|
||||
#![feature(const_loop)]
|
||||
#![feature(const_fn)]
|
||||
|
||||
const X: u32 = 4;
|
||||
|
@ -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
|
||||
|
@ -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.
|
||||
|
@ -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<i32>> = 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
|
||||
|
@ -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.
|
||||
|
@ -1,7 +1,6 @@
|
||||
// run-pass
|
||||
// gate-test-const_precise_live_drops
|
||||
|
||||
#![feature(const_loop)]
|
||||
#![feature(const_precise_live_drops)]
|
||||
|
||||
const _: Vec<i32> = {
|
||||
|
@ -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<Cell<i32>> = {
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
};
|
||||
|
@ -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;
|
@ -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 <https://github.com/rust-lang/rust/issues/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 <https://github.com/rust-lang/rust/issues/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 <https://github.com/rust-lang/rust/issues/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 <https://github.com/rust-lang/rust/issues/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 <https://github.com/rust-lang/rust/issues/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 <https://github.com/rust-lang/rust/issues/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 <https://github.com/rust-lang/rust/issues/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 <https://github.com/rust-lang/rust/issues/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 <https://github.com/rust-lang/rust/issues/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 <https://github.com/rust-lang/rust/issues/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 <https://github.com/rust-lang/rust/issues/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 <https://github.com/rust-lang/rust/issues/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 <https://github.com/rust-lang/rust/issues/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`.
|
@ -1,5 +0,0 @@
|
||||
const fn foo() {
|
||||
loop {} //~ ERROR `loop` is not allowed in a `const fn`
|
||||
}
|
||||
|
||||
fn main() {}
|
@ -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 <https://github.com/rust-lang/rust/issues/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`.
|
@ -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() {}
|
||||
|
@ -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::<u32, i32>` 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 <https://github.com/rust-lang/rust/issues/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`.
|
||||
|
@ -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`
|
||||
}
|
||||
|
@ -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 <https://github.com/rust-lang/rust/issues/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`.
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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 <https://github.com/rust-lang/rust/issues/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`.
|
||||
|
@ -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)]
|
||||
|
@ -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)]
|
||||
|
@ -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::<i32, i32>(42) {}
|
||||
| -------^^^^^--------------------- help: try this: `if Ok::<i32, i32>(42).is_ok()`
|
||||
@ -7,67 +7,67 @@ LL | if let Ok(_) = Ok::<i32, i32>(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::<i32, i32>(42) {}
|
||||
| -------^^^^^^---------------------- help: try this: `if Err::<i32, i32>(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::<i32, i32>(10) {}
|
||||
| ----------^^^^^--------------------- help: try this: `while Ok::<i32, i32>(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::<i32, i32>(10) {}
|
||||
| ----------^^^^^^--------------------- help: try this: `while Ok::<i32, i32>(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::<i32, i32>(42) {
|
||||
LL | | Ok(_) => true,
|
||||
@ -76,7 +76,7 @@ LL | | };
|
||||
| |_____^ help: try this: `Ok::<i32, i32>(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::<i32, i32>(42) {
|
||||
LL | | Ok(_) => false,
|
||||
@ -85,7 +85,7 @@ LL | | };
|
||||
| |_____^ help: try this: `Ok::<i32, i32>(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::<i32, i32>(42) {
|
||||
LL | | Ok(_) => false,
|
||||
@ -94,7 +94,7 @@ LL | | };
|
||||
| |_____^ help: try this: `Err::<i32, i32>(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::<i32, i32>(42) {
|
||||
LL | | Ok(_) => true,
|
||||
@ -103,7 +103,7 @@ LL | | };
|
||||
| |_____^ help: try this: `Err::<i32, i32>(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::<usize, ()>(4) { true } else { false };
|
||||
| -------^^^^^--------------------- help: try this: `if Ok::<usize, ()>(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()`
|
||||
|
@ -1,7 +1,5 @@
|
||||
// run-rustfix
|
||||
|
||||
#![feature(const_if_match)]
|
||||
#![feature(const_loop)]
|
||||
#![feature(const_result)]
|
||||
#![warn(clippy::redundant_pattern_matching)]
|
||||
#![allow(unused)]
|
||||
|
@ -1,7 +1,5 @@
|
||||
// run-rustfix
|
||||
|
||||
#![feature(const_if_match)]
|
||||
#![feature(const_loop)]
|
||||
#![feature(const_result)]
|
||||
#![warn(clippy::redundant_pattern_matching)]
|
||||
#![allow(unused)]
|
||||
|
@ -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::<i32, i32>(42) {}
|
||||
| -------^^^^^--------------------- help: try this: `if Ok::<i32, i32>(42).is_ok()`
|
||||
@ -7,25 +7,25 @@ LL | if let Ok(_) = Ok::<i32, i32>(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::<i32, i32>(42) {}
|
||||
| -------^^^^^^---------------------- help: try this: `if Err::<i32, i32>(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::<i32, i32>(10) {}
|
||||
| ----------^^^^^--------------------- help: try this: `while Ok::<i32, i32>(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::<i32, i32>(10) {}
|
||||
| ----------^^^^^^--------------------- help: try this: `while Ok::<i32, i32>(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::<i32, i32>(42) {
|
||||
LL | | Ok(_) => true,
|
||||
@ -34,7 +34,7 @@ LL | | };
|
||||
| |_____^ help: try this: `Ok::<i32, i32>(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::<i32, i32>(42) {
|
||||
LL | | Ok(_) => false,
|
||||
|
Loading…
Reference in New Issue
Block a user