Update existing tests for or-patterns
This commit is contained in:
parent
a20969c489
commit
30058df867
28 changed files with 361 additions and 399 deletions
|
@ -10,18 +10,18 @@ fn main() {
|
|||
// ...
|
||||
// _3 = std::option::Option::<bool>::Some(const true,);
|
||||
// _4 = discriminant(_3);
|
||||
// switchInt(move _4) -> [1isize: bb3, otherwise: bb2];
|
||||
// switchInt(move _4) -> [1isize: bb2, otherwise: bb1];
|
||||
// }
|
||||
// bb1: {
|
||||
// _2 = const 42i32;
|
||||
// goto -> bb4;
|
||||
// }
|
||||
// bb2: {
|
||||
// _2 = const 10i32;
|
||||
// goto -> bb4;
|
||||
// }
|
||||
// bb2: {
|
||||
// switchInt(((_3 as Some).0: bool)) -> [false: bb1, otherwise: bb3];
|
||||
// }
|
||||
// bb3: {
|
||||
// switchInt(((_3 as Some).0: bool)) -> [false: bb2, otherwise: bb1];
|
||||
// _2 = const 42i32;
|
||||
// goto -> bb4;
|
||||
// }
|
||||
// bb4: {
|
||||
// _1 = Add(move _2, const 0i32);
|
||||
|
@ -33,18 +33,18 @@ fn main() {
|
|||
// ...
|
||||
// _3 = const Scalar(0x01) : std::option::Option<bool>;
|
||||
// _4 = const 1isize;
|
||||
// switchInt(const 1isize) -> [1isize: bb3, otherwise: bb2];
|
||||
// switchInt(const 1isize) -> [1isize: bb2, otherwise: bb1];
|
||||
// }
|
||||
// bb1: {
|
||||
// _2 = const 42i32;
|
||||
// goto -> bb4;
|
||||
// }
|
||||
// bb2: {
|
||||
// _2 = const 10i32;
|
||||
// goto -> bb4;
|
||||
// }
|
||||
// bb2: {
|
||||
// switchInt(const true) -> [false: bb1, otherwise: bb3];
|
||||
// }
|
||||
// bb3: {
|
||||
// switchInt(const true) -> [false: bb2, otherwise: bb1];
|
||||
// _2 = const 42i32;
|
||||
// goto -> bb4;
|
||||
// }
|
||||
// bb4: {
|
||||
// _1 = Add(move _2, const 0i32);
|
||||
|
|
|
@ -32,41 +32,12 @@ fn main() {
|
|||
// bb2: {
|
||||
// StorageDead(_4);
|
||||
// _5 = discriminant(_3);
|
||||
// switchInt(move _5) -> [0isize: bb10, 1isize: bb5, otherwise: bb4];
|
||||
// switchInt(move _5) -> [0isize: bb4, 1isize: bb6, otherwise: bb5];
|
||||
// }
|
||||
// bb3 (cleanup): {
|
||||
// drop(_2) -> bb1;
|
||||
// }
|
||||
// bb4: {
|
||||
// unreachable;
|
||||
// }
|
||||
// bb5: {
|
||||
// StorageLive(_6);
|
||||
// _6 = ((_3 as Err).0: std::option::NoneError);
|
||||
// StorageLive(_8);
|
||||
// StorageLive(_9);
|
||||
// _9 = _6;
|
||||
// _8 = const <std::option::NoneError as std::convert::From<std::option::NoneError>>::from(move _9) -> [return: bb7, unwind: bb3];
|
||||
// }
|
||||
// bb6: {
|
||||
// return;
|
||||
// }
|
||||
// bb7: {
|
||||
// StorageDead(_9);
|
||||
// _0 = const <std::option::Option<std::boxed::Box<u32>> as std::ops::Try>::from_error(move _8) -> [return: bb8, unwind: bb3];
|
||||
// }
|
||||
// bb8: {
|
||||
// StorageDead(_8);
|
||||
// StorageDead(_6);
|
||||
// drop(_2) -> bb9;
|
||||
// }
|
||||
// bb9: {
|
||||
// StorageDead(_2);
|
||||
// StorageDead(_1);
|
||||
// StorageDead(_3);
|
||||
// goto -> bb6;
|
||||
// }
|
||||
// bb10: {
|
||||
// StorageLive(_10);
|
||||
// _10 = ((_3 as Ok).0: u32);
|
||||
// (*_2) = _10;
|
||||
|
@ -74,6 +45,35 @@ fn main() {
|
|||
// _1 = move _2;
|
||||
// drop(_2) -> [return: bb12, unwind: bb11];
|
||||
// }
|
||||
// bb5: {
|
||||
// unreachable;
|
||||
// }
|
||||
// bb6: {
|
||||
// StorageLive(_6);
|
||||
// _6 = ((_3 as Err).0: std::option::NoneError);
|
||||
// StorageLive(_8);
|
||||
// StorageLive(_9);
|
||||
// _9 = _6;
|
||||
// _8 = const <std::option::NoneError as std::convert::From<std::option::NoneError>>::from(move _9) -> [return: bb8, unwind: bb3];
|
||||
// }
|
||||
// bb7: {
|
||||
// return;
|
||||
// }
|
||||
// bb8: {
|
||||
// StorageDead(_9);
|
||||
// _0 = const <std::option::Option<std::boxed::Box<u32>> as std::ops::Try>::from_error(move _8) -> [return: bb9, unwind: bb3];
|
||||
// }
|
||||
// bb9: {
|
||||
// StorageDead(_8);
|
||||
// StorageDead(_6);
|
||||
// drop(_2) -> bb10;
|
||||
// }
|
||||
// bb10: {
|
||||
// StorageDead(_2);
|
||||
// StorageDead(_1);
|
||||
// StorageDead(_3);
|
||||
// goto -> bb7;
|
||||
// }
|
||||
// bb11 (cleanup): {
|
||||
// drop(_1) -> bb1;
|
||||
// }
|
||||
|
@ -85,7 +85,7 @@ fn main() {
|
|||
// bb13: {
|
||||
// StorageDead(_1);
|
||||
// StorageDead(_3);
|
||||
// goto -> bb6;
|
||||
// goto -> bb7;
|
||||
// }
|
||||
// }
|
||||
// END rustc.test.ElaborateDrops.before.mir
|
||||
|
|
|
@ -28,10 +28,7 @@ const CASES: &[(bool, bool, bool, i32)] = &[
|
|||
|
||||
fn main() {
|
||||
for &(cond, items_1, items_2, result) in CASES {
|
||||
assert_eq!(
|
||||
complicated_match(cond, (items_1, items_2, String::new())),
|
||||
result,
|
||||
);
|
||||
assert_eq!(complicated_match(cond, (items_1, items_2, String::new())), result,);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -64,31 +61,38 @@ fn main() {
|
|||
// }
|
||||
// bb0: {
|
||||
// FakeRead(ForMatchedPlace, _2);
|
||||
// switchInt((_2.0: bool)) -> [false: bb2, otherwise: bb5];
|
||||
// switchInt((_2.0: bool)) -> [false: bb2, otherwise: bb3];
|
||||
// }
|
||||
// bb1 (cleanup): {
|
||||
// resume;
|
||||
// }
|
||||
// bb2: {
|
||||
// falseEdges -> [real: bb8, imaginary: bb3];
|
||||
// bb2: { // pre-binding for arm 1 first pattern
|
||||
// falseEdges -> [real: bb9, imaginary: bb4];
|
||||
// }
|
||||
// bb3: {
|
||||
// falseEdges -> [real: bb17, imaginary: bb4];
|
||||
// switchInt((_2.1: bool)) -> [false: bb4, otherwise: bb5];
|
||||
// }
|
||||
// bb4: {
|
||||
// falseEdges -> [real: bb25, imaginary: bb26];
|
||||
// bb4: { // pre-binding for arm 1 second pattern
|
||||
// falseEdges -> [real: bb18, imaginary: bb6];
|
||||
// }
|
||||
// bb5: {
|
||||
// switchInt((_2.1: bool)) -> [false: bb3, otherwise: bb6];
|
||||
// switchInt((_2.0: bool)) -> [false: bb7, otherwise: bb6];
|
||||
// }
|
||||
// bb6: {
|
||||
// switchInt((_2.0: bool)) -> [false: bb26, otherwise: bb4];
|
||||
// bb6: { // pre-binding for arm 2 first pattern
|
||||
// falseEdges -> [real: bb26, imaginary: bb7];
|
||||
// }
|
||||
// bb7: { // arm 1
|
||||
// bb7: { // bindings for arm 2 - second pattern
|
||||
// StorageLive(_15);
|
||||
// _15 = (_2.1: bool);
|
||||
// StorageLive(_16);
|
||||
// _16 = move (_2.2: std::string::String);
|
||||
// goto -> bb25;
|
||||
// }
|
||||
// bb8: { // arm 1
|
||||
// _0 = const 1i32;
|
||||
// drop(_7) -> [return: bb23, unwind: bb13];
|
||||
// drop(_7) -> [return: bb24, unwind: bb14];
|
||||
// }
|
||||
// bb8: { // guard - first time
|
||||
// bb9: { // guard - first time
|
||||
// StorageLive(_6);
|
||||
// _6 = &(_2.1: bool);
|
||||
// StorageLive(_8);
|
||||
|
@ -99,34 +103,34 @@ fn main() {
|
|||
// StorageLive(_10);
|
||||
// _10 = _1;
|
||||
// FakeRead(ForMatchedPlace, _10);
|
||||
// switchInt(_10) -> [false: bb10, otherwise: bb9];
|
||||
// switchInt(_10) -> [false: bb11, otherwise: bb10];
|
||||
// }
|
||||
// bb9: {
|
||||
// falseEdges -> [real: bb11, imaginary: bb10];
|
||||
// bb10: {
|
||||
// falseEdges -> [real: bb12, imaginary: bb11];
|
||||
// }
|
||||
// bb10: { // `else` block - first time
|
||||
// bb11: { // `else` block - first time
|
||||
// _9 = (*_6);
|
||||
// StorageDead(_10);
|
||||
// switchInt(move _9) -> [false: bb16, otherwise: bb15];
|
||||
// switchInt(move _9) -> [false: bb17, otherwise: bb16];
|
||||
// }
|
||||
// bb11: { // `return 3` - first time
|
||||
// bb12: { // `return 3` - first time
|
||||
// _0 = const 3i32;
|
||||
// StorageDead(_10);
|
||||
// StorageDead(_9);
|
||||
// StorageDead(_8);
|
||||
// StorageDead(_6);
|
||||
// goto -> bb14;
|
||||
// goto -> bb15;
|
||||
// }
|
||||
// bb12: {
|
||||
// bb13: {
|
||||
// return;
|
||||
// }
|
||||
// bb13 (cleanup): {
|
||||
// bb14 (cleanup): {
|
||||
// drop(_2) -> bb1;
|
||||
// }
|
||||
// bb14: {
|
||||
// drop(_2) -> [return: bb12, unwind: bb1];
|
||||
// }
|
||||
// bb15: {
|
||||
// drop(_2) -> [return: bb13, unwind: bb1];
|
||||
// }
|
||||
// bb16: {
|
||||
// StorageDead(_9);
|
||||
// FakeRead(ForMatchGuard, _3);
|
||||
// FakeRead(ForMatchGuard, _4);
|
||||
|
@ -136,15 +140,15 @@ fn main() {
|
|||
// _5 = (_2.1: bool);
|
||||
// StorageLive(_7);
|
||||
// _7 = move (_2.2: std::string::String);
|
||||
// goto -> bb7;
|
||||
// goto -> bb8;
|
||||
// }
|
||||
// bb16: { // guard otherwise case - first time
|
||||
// bb17: { // guard otherwise case - first time
|
||||
// StorageDead(_9);
|
||||
// StorageDead(_8);
|
||||
// StorageDead(_6);
|
||||
// falseEdges -> [real: bb5, imaginary: bb3];
|
||||
// falseEdges -> [real: bb3, imaginary: bb4];
|
||||
// }
|
||||
// bb17: { // guard - second time
|
||||
// bb18: { // guard - second time
|
||||
// StorageLive(_6);
|
||||
// _6 = &(_2.0: bool);
|
||||
// StorageLive(_8);
|
||||
|
@ -155,25 +159,25 @@ fn main() {
|
|||
// StorageLive(_13);
|
||||
// _13 = _1;
|
||||
// FakeRead(ForMatchedPlace, _13);
|
||||
// switchInt(_13) -> [false: bb19, otherwise: bb18];
|
||||
// switchInt(_13) -> [false: bb20, otherwise: bb19];
|
||||
// }
|
||||
// bb18: {
|
||||
// falseEdges -> [real: bb20, imaginary: bb19];
|
||||
// bb19: {
|
||||
// falseEdges -> [real: bb21, imaginary: bb20];
|
||||
// }
|
||||
// bb19: { // `else` block - second time
|
||||
// bb20: { // `else` block - second time
|
||||
// _12 = (*_6);
|
||||
// StorageDead(_13);
|
||||
// switchInt(move _12) -> [false: bb22, otherwise: bb21];
|
||||
// switchInt(move _12) -> [false: bb23, otherwise: bb22];
|
||||
// }
|
||||
// bb20: {
|
||||
// bb21: {
|
||||
// _0 = const 3i32;
|
||||
// StorageDead(_13);
|
||||
// StorageDead(_12);
|
||||
// StorageDead(_8);
|
||||
// StorageDead(_6);
|
||||
// goto -> bb14;
|
||||
// goto -> bb15;
|
||||
// }
|
||||
// bb21: { // bindings for arm 1
|
||||
// bb22: { // bindings for arm 1
|
||||
// StorageDead(_12);
|
||||
// FakeRead(ForMatchGuard, _3);
|
||||
// FakeRead(ForMatchGuard, _4);
|
||||
|
@ -183,46 +187,40 @@ fn main() {
|
|||
// _5 = (_2.0: bool);
|
||||
// StorageLive(_7);
|
||||
// _7 = move (_2.2: std::string::String);
|
||||
// goto -> bb7;
|
||||
// goto -> bb8;
|
||||
// }
|
||||
// bb22: { // Guard otherwise case - second time
|
||||
// bb23: { // Guard otherwise case - second time
|
||||
// StorageDead(_12);
|
||||
// StorageDead(_8);
|
||||
// StorageDead(_6);
|
||||
// falseEdges -> [real: bb6, imaginary: bb4];
|
||||
// falseEdges -> [real: bb5, imaginary: bb6];
|
||||
// }
|
||||
// bb23: { // rest of arm 1
|
||||
// bb24: { // rest of arm 1
|
||||
// StorageDead(_7);
|
||||
// StorageDead(_5);
|
||||
// StorageDead(_8);
|
||||
// StorageDead(_6);
|
||||
// goto -> bb28;
|
||||
// }
|
||||
// bb24: { // arm 2
|
||||
// bb25: { // arm 2
|
||||
// _0 = const 2i32;
|
||||
// drop(_16) -> [return: bb27, unwind: bb13];
|
||||
// drop(_16) -> [return: bb27, unwind: bb14];
|
||||
// }
|
||||
// bb25: { // bindings for arm 2 - first pattern
|
||||
// bb26: { // bindings for arm 2 - first pattern
|
||||
// StorageLive(_15);
|
||||
// _15 = (_2.1: bool);
|
||||
// StorageLive(_16);
|
||||
// _16 = move (_2.2: std::string::String);
|
||||
// goto -> bb24;
|
||||
// }
|
||||
// bb26: { // bindings for arm 2 - second pattern
|
||||
// StorageLive(_15);
|
||||
// _15 = (_2.1: bool);
|
||||
// StorageLive(_16);
|
||||
// _16 = move (_2.2: std::string::String);
|
||||
// goto -> bb24;
|
||||
// goto -> bb25;
|
||||
// }
|
||||
|
||||
// bb27: { // rest of arm 2
|
||||
// StorageDead(_16);
|
||||
// StorageDead(_15);
|
||||
// goto -> bb28;
|
||||
// }
|
||||
// bb28: {
|
||||
// drop(_2) -> [return: bb12, unwind: bb1];
|
||||
// drop(_2) -> [return: bb13, unwind: bb1];
|
||||
// }
|
||||
// END rustc.complicated_match.SimplifyCfg-initial.after.mir
|
||||
// START rustc.complicated_match.ElaborateDrops.after.mir
|
||||
|
|
|
@ -45,21 +45,21 @@ fn main() {
|
|||
// _2 = std::option::Option::<i32>::Some(const 42i32,);
|
||||
// FakeRead(ForMatchedPlace, _2);
|
||||
// _3 = discriminant(_2);
|
||||
// switchInt(move _3) -> [0isize: bb4, 1isize: bb2, otherwise: bb5];
|
||||
// switchInt(move _3) -> [0isize: bb2, 1isize: bb3, otherwise: bb5];
|
||||
// }
|
||||
// bb1 (cleanup): {
|
||||
// resume;
|
||||
// }
|
||||
// bb2: {
|
||||
// falseEdges -> [real: bb6, imaginary: bb3]; //pre_binding1
|
||||
// }
|
||||
// bb3: {
|
||||
// falseEdges -> [real: bb10, imaginary: bb4]; //pre_binding2
|
||||
// }
|
||||
// bb4: { //pre_binding3 and arm3
|
||||
// bb2: { // pre_binding3 and arm3
|
||||
// _1 = (const 3i32, const 3i32);
|
||||
// goto -> bb11;
|
||||
// }
|
||||
// bb3: {
|
||||
// falseEdges -> [real: bb6, imaginary: bb4]; //pre_binding1
|
||||
// }
|
||||
// bb4: {
|
||||
// falseEdges -> [real: bb10, imaginary: bb2]; //pre_binding2
|
||||
// }
|
||||
// bb5: {
|
||||
// unreachable;
|
||||
// }
|
||||
|
@ -91,7 +91,7 @@ fn main() {
|
|||
// bb9: { // to pre_binding2
|
||||
// StorageDead(_7);
|
||||
// StorageDead(_6);
|
||||
// goto -> bb3;
|
||||
// goto -> bb4;
|
||||
// }
|
||||
// bb10: { // arm2
|
||||
// StorageLive(_9);
|
||||
|
@ -103,7 +103,7 @@ fn main() {
|
|||
// StorageDead(_9);
|
||||
// goto -> bb11;
|
||||
// }
|
||||
// bb11: { // arm3
|
||||
// bb11: {
|
||||
// StorageDead(_2);
|
||||
// StorageDead(_1);
|
||||
// _0 = ();
|
||||
|
@ -117,31 +117,41 @@ fn main() {
|
|||
// _2 = std::option::Option::<i32>::Some(const 42i32,);
|
||||
// FakeRead(ForMatchedPlace, _2);
|
||||
// _3 = discriminant(_2);
|
||||
// switchInt(move _3) -> [0isize: bb3, 1isize: bb2, otherwise: bb4];
|
||||
// switchInt(move _3) -> [0isize: bb2, 1isize: bb3, otherwise: bb5];
|
||||
// }
|
||||
// bb1 (cleanup): {
|
||||
// resume;
|
||||
// }
|
||||
// bb2: {
|
||||
// falseEdges -> [real: bb5, imaginary: bb3];
|
||||
// bb2: { // pre_binding2
|
||||
// falseEdges -> [real: bb10, imaginary: bb4];
|
||||
// }
|
||||
// bb3: {
|
||||
// falseEdges -> [real: bb9, imaginary: bb10];
|
||||
// bb3: { // pre_binding1
|
||||
// falseEdges -> [real: bb6, imaginary: bb2];
|
||||
// }
|
||||
// bb4: { // to arm3 (can skip 2 since this is `Some`)
|
||||
// bb4: { // binding3 and arm3
|
||||
// StorageLive(_9);
|
||||
// _9 = ((_2 as Some).0: i32);
|
||||
// StorageLive(_10);
|
||||
// _10 = _9;
|
||||
// _1 = (const 2i32, move _10);
|
||||
// StorageDead(_10);
|
||||
// StorageDead(_9);
|
||||
// goto -> bb11;
|
||||
// }
|
||||
// bb5: {
|
||||
// unreachable;
|
||||
// }
|
||||
// bb5: { // binding1 and guard
|
||||
// bb6: {
|
||||
// StorageLive(_6);
|
||||
// _6 = &((_2 as Some).0: i32);
|
||||
// _4 = &shallow _2;
|
||||
// StorageLive(_7);
|
||||
// _7 = const guard() -> [return: bb6, unwind: bb1];
|
||||
// _7 = const guard() -> [return: bb7, unwind: bb1];
|
||||
// }
|
||||
// bb6: { // end of guard
|
||||
// switchInt(move _7) -> [false: bb8, otherwise: bb7];
|
||||
// bb7: { // end of guard
|
||||
// switchInt(move _7) -> [false: bb9, otherwise: bb8];
|
||||
// }
|
||||
// bb7: {
|
||||
// bb8: {
|
||||
// StorageDead(_7);
|
||||
// FakeRead(ForMatchGuard, _4);
|
||||
// FakeRead(ForGuardBinding, _6);
|
||||
|
@ -155,25 +165,15 @@ fn main() {
|
|||
// StorageDead(_6);
|
||||
// goto -> bb11;
|
||||
// }
|
||||
// bb8: { // to pre_binding3 (can skip 2 since this is `Some`)
|
||||
// bb9: { // to pre_binding3 (can skip 2 since this is `Some`)
|
||||
// StorageDead(_7);
|
||||
// StorageDead(_6);
|
||||
// falseEdges -> [real: bb10, imaginary: bb3];
|
||||
// falseEdges -> [real: bb4, imaginary: bb2];
|
||||
// }
|
||||
// bb9: { // arm2
|
||||
// bb10: { // arm2
|
||||
// _1 = (const 3i32, const 3i32);
|
||||
// goto -> bb11;
|
||||
// }
|
||||
// bb10: { // binding3 and arm3
|
||||
// StorageLive(_9);
|
||||
// _9 = ((_2 as Some).0: i32);
|
||||
// StorageLive(_10);
|
||||
// _10 = _9;
|
||||
// _1 = (const 2i32, move _10);
|
||||
// StorageDead(_10);
|
||||
// StorageDead(_9);
|
||||
// goto -> bb11;
|
||||
// }
|
||||
// bb11: {
|
||||
// StorageDead(_2);
|
||||
// StorageDead(_1);
|
||||
|
@ -188,31 +188,38 @@ fn main() {
|
|||
// _2 = std::option::Option::<i32>::Some(const 1i32,);
|
||||
// FakeRead(ForMatchedPlace, _2);
|
||||
// _4 = discriminant(_2);
|
||||
// switchInt(move _4) -> [1isize: bb2, otherwise: bb3];
|
||||
// switchInt(move _4) -> [1isize: bb3, otherwise: bb2];
|
||||
// }
|
||||
// bb1 (cleanup): {
|
||||
// resume;
|
||||
// }
|
||||
// bb2: {
|
||||
// falseEdges -> [real: bb5, imaginary: bb3];
|
||||
// falseEdges -> [real: bb10, imaginary: bb5];
|
||||
// }
|
||||
// bb3: {
|
||||
// falseEdges -> [real: bb9, imaginary: bb4];
|
||||
// falseEdges -> [real: bb6, imaginary: bb2];
|
||||
// }
|
||||
// bb4: {
|
||||
// falseEdges -> [real: bb10, imaginary: bb14];
|
||||
// StorageLive(_14);
|
||||
// _14 = _2;
|
||||
// _1 = const 4i32;
|
||||
// StorageDead(_14);
|
||||
// goto -> bb15;
|
||||
// }
|
||||
// bb5: {
|
||||
// falseEdges -> [real: bb11, imaginary: bb4];
|
||||
// }
|
||||
// bb6: { //end of guard1
|
||||
// StorageLive(_7);
|
||||
// _7 = &((_2 as Some).0: i32);
|
||||
// _5 = &shallow _2;
|
||||
// StorageLive(_8);
|
||||
// _8 = const guard() -> [return: bb6, unwind: bb1];
|
||||
// }
|
||||
// bb6: { //end of guard1
|
||||
// switchInt(move _8) -> [false: bb8, otherwise: bb7];
|
||||
// _8 = const guard() -> [return: bb7, unwind: bb1];
|
||||
// }
|
||||
// bb7: {
|
||||
// switchInt(move _8) -> [false: bb9, otherwise: bb8];
|
||||
// }
|
||||
// bb8: {
|
||||
// StorageDead(_8);
|
||||
// FakeRead(ForMatchGuard, _5);
|
||||
// FakeRead(ForGuardBinding, _7);
|
||||
|
@ -223,32 +230,32 @@ fn main() {
|
|||
// StorageDead(_7);
|
||||
// goto -> bb15;
|
||||
// }
|
||||
// bb8: {
|
||||
// bb9: {
|
||||
// StorageDead(_8);
|
||||
// StorageDead(_7);
|
||||
// falseEdges -> [real: bb3, imaginary: bb3];
|
||||
// falseEdges -> [real: bb2, imaginary: bb2];
|
||||
// }
|
||||
// bb9: { // binding2 & arm2
|
||||
// bb10: { // binding2 & arm2
|
||||
// StorageLive(_9);
|
||||
// _9 = _2;
|
||||
// _1 = const 2i32;
|
||||
// StorageDead(_9);
|
||||
// goto -> bb15;
|
||||
// }
|
||||
// bb10: { // binding3: Some(y) if guard2(y)
|
||||
// bb11: { // binding3: Some(y) if guard2(y)
|
||||
// StorageLive(_11);
|
||||
// _11 = &((_2 as Some).0: i32);
|
||||
// _5 = &shallow _2;
|
||||
// StorageLive(_12);
|
||||
// StorageLive(_13);
|
||||
// _13 = (*_11);
|
||||
// _12 = const guard2(move _13) -> [return: bb11, unwind: bb1];
|
||||
// _12 = const guard2(move _13) -> [return: bb12, unwind: bb1];
|
||||
// }
|
||||
// bb11: { // end of guard2
|
||||
// bb12: { // end of guard2
|
||||
// StorageDead(_13);
|
||||
// switchInt(move _12) -> [false: bb13, otherwise: bb12];
|
||||
// switchInt(move _12) -> [false: bb14, otherwise: bb13];
|
||||
// }
|
||||
// bb12: { // binding4 & arm4
|
||||
// bb13: { // binding4 & arm4
|
||||
// StorageDead(_12);
|
||||
// FakeRead(ForMatchGuard, _5);
|
||||
// FakeRead(ForGuardBinding, _11);
|
||||
|
@ -259,17 +266,10 @@ fn main() {
|
|||
// StorageDead(_11);
|
||||
// goto -> bb15;
|
||||
// }
|
||||
// bb13: {
|
||||
// bb14: {
|
||||
// StorageDead(_12);
|
||||
// StorageDead(_11);
|
||||
// falseEdges -> [real: bb14, imaginary: bb14];
|
||||
// }
|
||||
// bb14: {
|
||||
// StorageLive(_14);
|
||||
// _14 = _2;
|
||||
// _1 = const 4i32;
|
||||
// StorageDead(_14);
|
||||
// goto -> bb15;
|
||||
// falseEdges -> [real: bb4, imaginary: bb4];
|
||||
// }
|
||||
// bb15: {
|
||||
// StorageDead(_2);
|
||||
|
|
|
@ -20,35 +20,35 @@ fn main() {
|
|||
// START rustc.main.SimplifyCfg-initial.after.mir
|
||||
// bb0: {
|
||||
// ...
|
||||
// switchInt(move _6) -> [false: bb6, otherwise: bb5];
|
||||
// switchInt(move _6) -> [false: bb4, otherwise: bb1];
|
||||
// }
|
||||
// bb1: {
|
||||
// falseEdges -> [real: bb9, imaginary: bb2];
|
||||
// _7 = Lt(_1, const 10i32);
|
||||
// switchInt(move _7) -> [false: bb4, otherwise: bb2];
|
||||
// }
|
||||
// bb2: {
|
||||
// falseEdges -> [real: bb12, imaginary: bb3];
|
||||
// falseEdges -> [real: bb9, imaginary: bb6];
|
||||
// }
|
||||
// bb3: {
|
||||
// falseEdges -> [real: bb13, imaginary: bb4];
|
||||
// }
|
||||
// bb4: {
|
||||
// _3 = const 3i32;
|
||||
// goto -> bb14;
|
||||
// }
|
||||
// bb4: {
|
||||
// _4 = Le(const 10i32, _1);
|
||||
// switchInt(move _4) -> [false: bb7, otherwise: bb5];
|
||||
// }
|
||||
// bb5: {
|
||||
// _7 = Lt(_1, const 10i32);
|
||||
// switchInt(move _7) -> [false: bb6, otherwise: bb1];
|
||||
// _5 = Le(_1, const 20i32);
|
||||
// switchInt(move _5) -> [false: bb7, otherwise: bb6];
|
||||
// }
|
||||
// bb6: {
|
||||
// _4 = Le(const 10i32, _1);
|
||||
// switchInt(move _4) -> [false: bb8, otherwise: bb7];
|
||||
// falseEdges -> [real: bb12, imaginary: bb8];
|
||||
// }
|
||||
// bb7: {
|
||||
// _5 = Le(_1, const 20i32);
|
||||
// switchInt(move _5) -> [false: bb8, otherwise: bb2];
|
||||
// switchInt(_1) -> [-1i32: bb8, otherwise: bb3];
|
||||
// }
|
||||
// bb8: {
|
||||
// switchInt(_1) -> [-1i32: bb3, otherwise: bb4];
|
||||
// falseEdges -> [real: bb13, imaginary: bb3];
|
||||
// }
|
||||
// bb9: {
|
||||
// _8 = &shallow _1;
|
||||
|
@ -64,7 +64,7 @@ fn main() {
|
|||
// }
|
||||
// bb11: {
|
||||
// StorageDead(_9);
|
||||
// falseEdges -> [real: bb4, imaginary: bb2];
|
||||
// falseEdges -> [real: bb3, imaginary: bb6];
|
||||
// }
|
||||
// bb12: {
|
||||
// _3 = const 1i32;
|
||||
|
|
|
@ -19,17 +19,17 @@ fn main() {
|
|||
// bb0: {
|
||||
// FakeRead(ForMatchedPlace, _1);
|
||||
// _3 = discriminant(_1);
|
||||
// switchInt(move _3) -> [1isize: bb3, otherwise: bb2];
|
||||
// switchInt(move _3) -> [1isize: bb2, otherwise: bb1];
|
||||
// }
|
||||
// bb1: {
|
||||
// goto -> bb4;
|
||||
// }
|
||||
// bb2: {
|
||||
// _0 = const 1i32;
|
||||
// goto -> bb7;
|
||||
// }
|
||||
// bb2: {
|
||||
// switchInt((*(*((_1 as Some).0: &'<empty> &'<empty> i32)))) -> [0i32: bb3, otherwise: bb1];
|
||||
// }
|
||||
// bb3: {
|
||||
// switchInt((*(*((_1 as Some).0: &'<empty> &'<empty> i32)))) -> [0i32: bb1, otherwise: bb2];
|
||||
// goto -> bb4;
|
||||
// }
|
||||
// bb4: {
|
||||
// _4 = &shallow _1;
|
||||
|
@ -51,7 +51,7 @@ fn main() {
|
|||
// }
|
||||
// bb6: {
|
||||
// StorageDead(_8);
|
||||
// goto -> bb2;
|
||||
// goto -> bb1;
|
||||
// }
|
||||
// bb7: {
|
||||
// return;
|
||||
|
@ -65,17 +65,17 @@ fn main() {
|
|||
// bb0: {
|
||||
// nop;
|
||||
// _3 = discriminant(_1);
|
||||
// switchInt(move _3) -> [1isize: bb3, otherwise: bb2];
|
||||
// switchInt(move _3) -> [1isize: bb2, otherwise: bb1];
|
||||
// }
|
||||
// bb1: {
|
||||
// goto -> bb4;
|
||||
// }
|
||||
// bb2: {
|
||||
// _0 = const 1i32;
|
||||
// goto -> bb7;
|
||||
// }
|
||||
// bb2: {
|
||||
// switchInt((*(*((_1 as Some).0: &'<empty> &'<empty> i32)))) -> [0i32: bb3, otherwise: bb1];
|
||||
// }
|
||||
// bb3: {
|
||||
// switchInt((*(*((_1 as Some).0: &'<empty> &'<empty> i32)))) -> [0i32: bb1, otherwise: bb2];
|
||||
// goto -> bb4;
|
||||
// }
|
||||
// bb4: {
|
||||
// nop;
|
||||
|
@ -97,7 +97,7 @@ fn main() {
|
|||
// }
|
||||
// bb6: {
|
||||
// StorageDead(_8);
|
||||
// goto -> bb2;
|
||||
// goto -> bb1;
|
||||
// }
|
||||
// bb7: {
|
||||
// return;
|
||||
|
|
|
@ -47,22 +47,22 @@ fn main() {
|
|||
// }
|
||||
// bb0: {
|
||||
// _5 = discriminant(_1);
|
||||
// switchInt(move _5) -> [0isize: bb3, otherwise: bb1];
|
||||
// switchInt(move _5) -> [0isize: bb1, otherwise: bb2];
|
||||
// }
|
||||
// bb1: {
|
||||
// _6 = ((_1 as Err).0: i32);
|
||||
// ((_0 as Err).0: i32) = move _6;
|
||||
// discriminant(_0) = 1;
|
||||
// goto -> bb2;
|
||||
// }
|
||||
// bb2: {
|
||||
// return;
|
||||
// }
|
||||
// bb3: {
|
||||
// _10 = ((_1 as Ok).0: u32);
|
||||
// ((_0 as Ok).0: u32) = move _10;
|
||||
// discriminant(_0) = 0;
|
||||
// goto -> bb2;
|
||||
// goto -> bb3;
|
||||
// }
|
||||
// bb2: {
|
||||
// _6 = ((_1 as Err).0: i32);
|
||||
// ((_0 as Err).0: i32) = move _6;
|
||||
// discriminant(_0) = 1;
|
||||
// goto -> bb3;
|
||||
// }
|
||||
// bb3: {
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// END rustc.try_identity.SimplifyArmIdentity.before.mir
|
||||
|
@ -106,22 +106,22 @@ fn main() {
|
|||
// }
|
||||
// bb0: {
|
||||
// _5 = discriminant(_1);
|
||||
// switchInt(move _5) -> [0isize: bb3, otherwise: bb1];
|
||||
// switchInt(move _5) -> [0isize: bb1, otherwise: bb2];
|
||||
// }
|
||||
// bb1: {
|
||||
// _0 = move _1;
|
||||
// nop;
|
||||
// nop;
|
||||
// goto -> bb2;
|
||||
// goto -> bb3;
|
||||
// }
|
||||
// bb2: {
|
||||
// return;
|
||||
// }
|
||||
// bb3: {
|
||||
// _0 = move _1;
|
||||
// nop;
|
||||
// nop;
|
||||
// goto -> bb2;
|
||||
// goto -> bb3;
|
||||
// }
|
||||
// bb3: {
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// END rustc.try_identity.SimplifyArmIdentity.after.mir
|
||||
|
@ -165,16 +165,16 @@ fn main() {
|
|||
// }
|
||||
// bb0: {
|
||||
// _5 = discriminant(_1);
|
||||
// goto -> bb2;
|
||||
// goto -> bb1;
|
||||
// }
|
||||
// bb1: {
|
||||
// return;
|
||||
// }
|
||||
// bb2: {
|
||||
// _0 = move _1;
|
||||
// nop;
|
||||
// nop;
|
||||
// goto -> bb1;
|
||||
// goto -> bb2;
|
||||
// }
|
||||
// bb2: {
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// END rustc.try_identity.SimplifyBranchSame.after.mir
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
fn main() {}
|
||||
|
||||
const fn slice([a, b]: &[i32]) -> i32 { //~ ERROR refutable pattern in function argument
|
||||
a + b //~ ERROR can only call other `const fn` within a `const fn`
|
||||
//~^ ERROR use of possibly-uninitialized variable: `a`
|
||||
//~| ERROR use of possibly-uninitialized variable: `b`
|
||||
const fn slice(&[a, b]: &[i32]) -> i32 {
|
||||
//~^ ERROR refutable pattern in function argument
|
||||
//~| ERROR loops and conditional expressions are not stable in const fn
|
||||
a + b
|
||||
}
|
||||
|
|
|
@ -1,31 +1,19 @@
|
|||
error[E0005]: refutable pattern in function argument: `&[]`, `&[_]` and `&[_, _, _, ..]` not covered
|
||||
--> $DIR/const_let_refutable.rs:3:16
|
||||
|
|
||||
LL | const fn slice([a, b]: &[i32]) -> i32 {
|
||||
| ^^^^^^ patterns `&[]`, `&[_]` and `&[_, _, _, ..]` not covered
|
||||
LL | const fn slice(&[a, b]: &[i32]) -> i32 {
|
||||
| ^^^^^^^ patterns `&[]`, `&[_]` and `&[_, _, _, ..]` not covered
|
||||
|
||||
error[E0723]: can only call other `const fn` within a `const fn`, but `const <&i32 as std::ops::Add>::add` is not stable as `const fn`
|
||||
--> $DIR/const_let_refutable.rs:4:5
|
||||
error[E0723]: loops and conditional expressions are not stable in const fn
|
||||
--> $DIR/const_let_refutable.rs:3:17
|
||||
|
|
||||
LL | a + b
|
||||
| ^^^^^
|
||||
LL | const fn slice(&[a, b]: &[i32]) -> i32 {
|
||||
| ^^^^^^
|
||||
|
|
||||
= note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
|
||||
= help: add `#![feature(const_fn)]` to the crate attributes to enable
|
||||
|
||||
error[E0381]: use of possibly-uninitialized variable: `a`
|
||||
--> $DIR/const_let_refutable.rs:4:5
|
||||
|
|
||||
LL | a + b
|
||||
| ^ use of possibly-uninitialized `a`
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
error[E0381]: use of possibly-uninitialized variable: `b`
|
||||
--> $DIR/const_let_refutable.rs:4:9
|
||||
|
|
||||
LL | a + b
|
||||
| ^ use of possibly-uninitialized `b`
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0005, E0381, E0723.
|
||||
Some errors have detailed explanations: E0005, E0723.
|
||||
For more information about an error, try `rustc --explain E0005`.
|
||||
|
|
|
@ -10,7 +10,6 @@ fn transmute<T, U>(t: T) -> U {
|
|||
let Helper::U(u) = Helper::T(t, []);
|
||||
//~^ ERROR refutable pattern in local binding: `T(_, _)` not covered
|
||||
u
|
||||
//~^ ERROR use of possibly-uninitialized variable: `u`
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -19,13 +19,6 @@ help: you might want to use `if let` to ignore the variant that isn't matched
|
|||
LL | if let Helper::U(u) = Helper::T(t, []) { /* */ }
|
||||
|
|
||||
|
||||
error[E0381]: use of possibly-uninitialized variable: `u`
|
||||
--> $DIR/empty-never-array.rs:12:5
|
||||
|
|
||||
LL | u
|
||||
| ^ use of possibly-uninitialized `u`
|
||||
error: aborting due to previous error
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0005, E0381.
|
||||
For more information about an error, try `rustc --explain E0005`.
|
||||
For more information about this error, try `rustc --explain E0005`.
|
||||
|
|
|
@ -4,6 +4,5 @@ fn main() {
|
|||
for &[x,y,z] in values.chunks(3).filter(|&xs| xs.len() == 3) {
|
||||
//~^ ERROR refutable pattern in `for` loop binding: `&[]`, `&[_]`, `&[_, _]` and 1 more not
|
||||
println!("y={}", y);
|
||||
//~^ ERROR borrow of possibly-uninitialized variable: `y`
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,13 +4,6 @@ error[E0005]: refutable pattern in `for` loop binding: `&[]`, `&[_]`, `&[_, _]`
|
|||
LL | for &[x,y,z] in values.chunks(3).filter(|&xs| xs.len() == 3) {
|
||||
| ^^^^^^^^ patterns `&[]`, `&[_]`, `&[_, _]` and 1 more not covered
|
||||
|
||||
error[E0381]: borrow of possibly-uninitialized variable: `y`
|
||||
--> $DIR/issue-15381.rs:6:26
|
||||
|
|
||||
LL | println!("y={}", y);
|
||||
| ^ use of possibly-uninitialized `y`
|
||||
error: aborting due to previous error
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0005, E0381.
|
||||
For more information about an error, try `rustc --explain E0005`.
|
||||
For more information about this error, try `rustc --explain E0005`.
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
// edition:2018
|
||||
|
||||
// check-pass
|
||||
|
||||
#![feature(or_patterns)]
|
||||
|
||||
fn main() {
|
||||
|
@ -11,35 +13,29 @@ fn main() {
|
|||
let Ok(ref mut a) | Err(ref mut a) = Ok(0);
|
||||
|
||||
// Two levels:
|
||||
enum Tri<S, T, U> { V1(S), V2(T), V3(U) }
|
||||
enum Tri<S, T, U> {
|
||||
V1(S),
|
||||
V2(T),
|
||||
V3(U),
|
||||
}
|
||||
use Tri::*;
|
||||
|
||||
let Ok((V1(a) | V2(a) | V3(a), b)) | Err(Ok((a, b)) | Err((a, b)))
|
||||
: Result<_, Result<_, _>>
|
||||
= Ok((V1(1), 1));
|
||||
let Ok((V1(a) | V2(a) | V3(a), b)) | Err(Ok((a, b)) | Err((a, b))): Result<_, Result<_, _>> =
|
||||
Ok((V1(1), 1));
|
||||
|
||||
let Ok((V1(a) | V2(a) | V3(a), ref b)) | Err(Ok((a, ref b)) | Err((a, ref b)))
|
||||
: Result<_, Result<_, _>>
|
||||
= Ok((V1(1), 1));
|
||||
let Ok((V1(a) | V2(a) | V3(a), ref b)) | Err(Ok((a, ref b)) | Err((a, ref b))): Result<
|
||||
_,
|
||||
Result<_, _>,
|
||||
> = Ok((V1(1), 1));
|
||||
|
||||
// Three levels:
|
||||
let (
|
||||
a,
|
||||
Err((ref mut b, ref c, d)) |
|
||||
Ok((
|
||||
Ok(
|
||||
V1((ref c, d)) |
|
||||
V2((d, ref c)) |
|
||||
V3((ref c, Ok((_, d)) | Err((d, _))))
|
||||
) |
|
||||
Err((ref c, d)),
|
||||
ref mut b
|
||||
))
|
||||
) =
|
||||
(1, Ok((Ok(V3((1, Ok((1, 1))))), 1)));
|
||||
|
||||
// FIXME(or_patterns; Centril | dlrobertson): remove this line below and
|
||||
// change this test to check-pass once MIR can handle or-patterns with bindings.
|
||||
let () = 0;
|
||||
//~^ ERROR mismatched types
|
||||
Err((ref mut b, ref c, d))
|
||||
| Ok((
|
||||
Ok(V1((ref c, d)) | V2((d, ref c)) | V3((ref c, Ok((_, d)) | Err((d, _)))))
|
||||
| Err((ref c, d)),
|
||||
ref mut b,
|
||||
)),
|
||||
): (_, Result<_, _>) = (1, Ok((Ok(V3((1, Ok::<_, (i32, i32)>((1, 1))))), 1)));
|
||||
}
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/consistent-bindings.rs:43:9
|
||||
|
|
||||
LL | let () = 0;
|
||||
| ^^ expected integer, found `()`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
|
@ -1,13 +1,8 @@
|
|||
#![feature(or_patterns)]
|
||||
#![deny(unreachable_patterns)]
|
||||
|
||||
// We wrap patterns in a tuple because top-level or-patterns are special-cased for now.
|
||||
// We wrap patterns in a tuple because top-level or-patterns were special-cased.
|
||||
fn main() {
|
||||
// Get the fatal error out of the way
|
||||
match (0u8,) {
|
||||
(0 | _,) => {} //~^ ERROR or-patterns are not fully implemented yet
|
||||
}
|
||||
|
||||
match (0u8, 0u8) {
|
||||
//~^ ERROR non-exhaustive patterns: `(2u8..=std::u8::MAX, _)`
|
||||
(0 | 1, 2 | 3) => {}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error[E0004]: non-exhaustive patterns: `(2u8..=std::u8::MAX, _)` not covered
|
||||
--> $DIR/exhaustiveness-non-exhaustive.rs:13:11
|
||||
--> $DIR/exhaustiveness-non-exhaustive.rs:6:11
|
||||
|
|
||||
LL | match (0u8, 0u8) {
|
||||
| ^^^^^^^^^^ pattern `(2u8..=std::u8::MAX, _)` not covered
|
||||
|
@ -7,7 +7,7 @@ LL | match (0u8, 0u8) {
|
|||
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
|
||||
|
||||
error[E0004]: non-exhaustive patterns: `((4u8..=std::u8::MAX))` not covered
|
||||
--> $DIR/exhaustiveness-non-exhaustive.rs:17:11
|
||||
--> $DIR/exhaustiveness-non-exhaustive.rs:10:11
|
||||
|
|
||||
LL | match ((0u8,),) {
|
||||
| ^^^^^^^^^ pattern `((4u8..=std::u8::MAX))` not covered
|
||||
|
@ -15,19 +15,13 @@ LL | match ((0u8,),) {
|
|||
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
|
||||
|
||||
error[E0004]: non-exhaustive patterns: `(Some(2u8..=std::u8::MAX))` not covered
|
||||
--> $DIR/exhaustiveness-non-exhaustive.rs:21:11
|
||||
--> $DIR/exhaustiveness-non-exhaustive.rs:14:11
|
||||
|
|
||||
LL | match (Some(0u8),) {
|
||||
| ^^^^^^^^^^^^ pattern `(Some(2u8..=std::u8::MAX))` not covered
|
||||
|
|
||||
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
|
||||
|
||||
error: or-patterns are not fully implemented yet
|
||||
--> $DIR/exhaustiveness-non-exhaustive.rs:9:10
|
||||
|
|
||||
LL | (0 | _,) => {}
|
||||
| ^^^^^
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0004`.
|
||||
|
|
|
@ -1,13 +1,10 @@
|
|||
#![feature(or_patterns)]
|
||||
#![deny(unreachable_patterns)]
|
||||
|
||||
// We wrap patterns in a tuple because top-level or-patterns are special-cased for now.
|
||||
fn main() {
|
||||
// Get the fatal error out of the way
|
||||
match (0,) {
|
||||
(0 | _,) => {} //~^ ERROR or-patterns are not fully implemented yet
|
||||
}
|
||||
// check-pass
|
||||
|
||||
// We wrap patterns in a tuple because top-level or-patterns were special-cased.
|
||||
fn main() {
|
||||
match (0,) {
|
||||
(1 | 2,) => {}
|
||||
_ => {}
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
error: or-patterns are not fully implemented yet
|
||||
--> $DIR/exhaustiveness-pass.rs:9:10
|
||||
|
|
||||
LL | (0 | _,) => {}
|
||||
| ^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
|
@ -1,13 +1,8 @@
|
|||
#![feature(or_patterns)]
|
||||
#![deny(unreachable_patterns)]
|
||||
|
||||
// We wrap patterns in a tuple because top-level or-patterns are special-cased for now.
|
||||
// We wrap patterns in a tuple because top-level or-patterns were special-cased.
|
||||
fn main() {
|
||||
// Get the fatal error out of the way
|
||||
match (0u8,) {
|
||||
(0 | _,) => {} //~^ ERROR or-patterns are not fully implemented yet
|
||||
}
|
||||
|
||||
match (0u8,) {
|
||||
(1 | 2,) => {}
|
||||
(1,) => {} //~ ERROR unreachable pattern
|
||||
|
|
|
@ -1,110 +1,104 @@
|
|||
error: unreachable pattern
|
||||
--> $DIR/exhaustiveness-unreachable-pattern.rs:15:9
|
||||
--> $DIR/exhaustiveness-unreachable-pattern.rs:8:9
|
||||
|
|
||||
LL | (1,) => {}
|
||||
| ^^^^
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/exhaustiveness-unreachable-pattern.rs:3:9
|
||||
--> $DIR/exhaustiveness-unreachable-pattern.rs:2:9
|
||||
|
|
||||
LL | #![deny(unreachable_patterns)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: unreachable pattern
|
||||
--> $DIR/exhaustiveness-unreachable-pattern.rs:20:9
|
||||
--> $DIR/exhaustiveness-unreachable-pattern.rs:13:9
|
||||
|
|
||||
LL | (2,) => {}
|
||||
| ^^^^
|
||||
|
||||
error: unreachable pattern
|
||||
--> $DIR/exhaustiveness-unreachable-pattern.rs:26:9
|
||||
--> $DIR/exhaustiveness-unreachable-pattern.rs:19:9
|
||||
|
|
||||
LL | (1 | 2,) => {}
|
||||
| ^^^^^^^^
|
||||
|
||||
error: unreachable pattern
|
||||
--> $DIR/exhaustiveness-unreachable-pattern.rs:31:9
|
||||
--> $DIR/exhaustiveness-unreachable-pattern.rs:24:9
|
||||
|
|
||||
LL | (1, 3) => {}
|
||||
| ^^^^^^
|
||||
|
||||
error: unreachable pattern
|
||||
--> $DIR/exhaustiveness-unreachable-pattern.rs:32:9
|
||||
--> $DIR/exhaustiveness-unreachable-pattern.rs:25:9
|
||||
|
|
||||
LL | (1, 4) => {}
|
||||
| ^^^^^^
|
||||
|
||||
error: unreachable pattern
|
||||
--> $DIR/exhaustiveness-unreachable-pattern.rs:33:9
|
||||
--> $DIR/exhaustiveness-unreachable-pattern.rs:26:9
|
||||
|
|
||||
LL | (2, 4) => {}
|
||||
| ^^^^^^
|
||||
|
||||
error: unreachable pattern
|
||||
--> $DIR/exhaustiveness-unreachable-pattern.rs:34:9
|
||||
--> $DIR/exhaustiveness-unreachable-pattern.rs:27:9
|
||||
|
|
||||
LL | (2 | 1, 4) => {}
|
||||
| ^^^^^^^^^^
|
||||
|
||||
error: unreachable pattern
|
||||
--> $DIR/exhaustiveness-unreachable-pattern.rs:36:9
|
||||
--> $DIR/exhaustiveness-unreachable-pattern.rs:29:9
|
||||
|
|
||||
LL | (1, 4 | 5) => {}
|
||||
| ^^^^^^^^^^
|
||||
|
||||
error: unreachable pattern
|
||||
--> $DIR/exhaustiveness-unreachable-pattern.rs:41:9
|
||||
--> $DIR/exhaustiveness-unreachable-pattern.rs:34:9
|
||||
|
|
||||
LL | (Some(1),) => {}
|
||||
| ^^^^^^^^^^
|
||||
|
||||
error: unreachable pattern
|
||||
--> $DIR/exhaustiveness-unreachable-pattern.rs:42:9
|
||||
--> $DIR/exhaustiveness-unreachable-pattern.rs:35:9
|
||||
|
|
||||
LL | (None,) => {}
|
||||
| ^^^^^^^
|
||||
|
||||
error: unreachable pattern
|
||||
--> $DIR/exhaustiveness-unreachable-pattern.rs:47:9
|
||||
--> $DIR/exhaustiveness-unreachable-pattern.rs:40:9
|
||||
|
|
||||
LL | ((1..=4,),) => {},
|
||||
LL | ((1..=4,),) => {}
|
||||
| ^^^^^^^^^^^
|
||||
|
||||
error: unreachable pattern
|
||||
--> $DIR/exhaustiveness-unreachable-pattern.rs:53:12
|
||||
--> $DIR/exhaustiveness-unreachable-pattern.rs:45:14
|
||||
|
|
||||
LL | | 1,) => {}
|
||||
LL | (1 | 1,) => {}
|
||||
| ^
|
||||
|
||||
error: unreachable pattern
|
||||
--> $DIR/exhaustiveness-unreachable-pattern.rs:60:15
|
||||
--> $DIR/exhaustiveness-unreachable-pattern.rs:52:15
|
||||
|
|
||||
LL | | 0] => {}
|
||||
| ^
|
||||
|
||||
error: unreachable pattern
|
||||
--> $DIR/exhaustiveness-unreachable-pattern.rs:58:15
|
||||
--> $DIR/exhaustiveness-unreachable-pattern.rs:50:15
|
||||
|
|
||||
LL | | 0
|
||||
| ^
|
||||
|
||||
error: unreachable pattern
|
||||
--> $DIR/exhaustiveness-unreachable-pattern.rs:68:10
|
||||
--> $DIR/exhaustiveness-unreachable-pattern.rs:60:10
|
||||
|
|
||||
LL | [1
|
||||
| ^
|
||||
|
||||
error: unreachable pattern
|
||||
--> $DIR/exhaustiveness-unreachable-pattern.rs:74:14
|
||||
--> $DIR/exhaustiveness-unreachable-pattern.rs:66:14
|
||||
|
|
||||
LL | Some(0
|
||||
| ^
|
||||
|
||||
error: or-patterns are not fully implemented yet
|
||||
--> $DIR/exhaustiveness-unreachable-pattern.rs:9:10
|
||||
|
|
||||
LL | (0 | _,) => {}
|
||||
| ^^^^^
|
||||
|
||||
error: aborting due to 17 previous errors
|
||||
error: aborting due to 16 previous errors
|
||||
|
||||
|
|
|
@ -30,6 +30,8 @@ fn main() {
|
|||
let x = Ok(3);
|
||||
let Ok(y) | Err(y) = x;
|
||||
//~^ ERROR or-pattern is not allowed in a `const`
|
||||
//~| ERROR constant contains unimplemented expression type
|
||||
//~| ERROR constant contains unimplemented expression type
|
||||
2
|
||||
}];
|
||||
}
|
||||
|
|
|
@ -52,6 +52,19 @@ LL | let Ok(y) | Err(y) = x;
|
|||
= note: for more information, see https://github.com/rust-lang/rust/issues/49146
|
||||
= help: add `#![feature(const_if_match)]` to the crate attributes to enable
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
error[E0019]: constant contains unimplemented expression type
|
||||
--> $DIR/feature-gate-const-fn.rs:31:25
|
||||
|
|
||||
LL | let Ok(y) | Err(y) = x;
|
||||
| ^
|
||||
|
||||
For more information about this error, try `rustc --explain E0658`.
|
||||
error[E0019]: constant contains unimplemented expression type
|
||||
--> $DIR/feature-gate-const-fn.rs:31:16
|
||||
|
|
||||
LL | let Ok(y) | Err(y) = x;
|
||||
| ^
|
||||
|
||||
error: aborting due to 8 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0019, E0658.
|
||||
For more information about an error, try `rustc --explain E0019`.
|
||||
|
|
|
@ -6,7 +6,6 @@ fn foo(res: Result<u32, &R>) -> u32 {
|
|||
let Ok(x) = res;
|
||||
//~^ ERROR refutable pattern
|
||||
x
|
||||
//~^ ERROR use of possibly-uninitialized variable: `x`
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -11,13 +11,6 @@ help: you might want to use `if let` to ignore the variant that isn't matched
|
|||
LL | if let Ok(x) = res { /* */ }
|
||||
|
|
||||
|
||||
error[E0381]: use of possibly-uninitialized variable: `x`
|
||||
--> $DIR/recursive-types-are-not-uninhabited.rs:8:5
|
||||
|
|
||||
LL | x
|
||||
| ^ use of possibly-uninitialized `x`
|
||||
error: aborting due to previous error
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0005, E0381.
|
||||
For more information about an error, try `rustc --explain E0005`.
|
||||
For more information about this error, try `rustc --explain E0005`.
|
||||
|
|
|
@ -65,13 +65,18 @@ LL | match &(e.clone(), e.clone()) {
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
LL |
|
||||
LL | &(Either::One(_t), Either::Two(_u))
|
||||
| -----------------------------------
|
||||
| | | |
|
||||
| | | ...and here
|
||||
| | data moved here
|
||||
| help: consider removing the `&`: `(Either::One(_t), Either::Two(_u))`
|
||||
| -- -- ...and here
|
||||
| |
|
||||
| data moved here
|
||||
|
|
||||
= note: move occurs because these variables have types that don't implement the `Copy` trait
|
||||
help: consider removing the `&`
|
||||
|
|
||||
LL | (Either::One(_t), Either::Two(_u))
|
||||
LL |
|
||||
LL |
|
||||
LL | | &(Either::Two(_t), Either::One(_u)) => (),
|
||||
|
|
||||
|
||||
error[E0507]: cannot move out of a shared reference
|
||||
--> $DIR/duplicate-suggestions.rs:70:11
|
||||
|
@ -170,13 +175,18 @@ LL | match &mut (em.clone(), em.clone()) {
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
LL |
|
||||
LL | &mut (Either::One(_t), Either::Two(_u))
|
||||
| ---------------------------------------
|
||||
| | | |
|
||||
| | | ...and here
|
||||
| | data moved here
|
||||
| help: consider removing the `&mut`: `(Either::One(_t), Either::Two(_u))`
|
||||
| -- -- ...and here
|
||||
| |
|
||||
| data moved here
|
||||
|
|
||||
= note: move occurs because these variables have types that don't implement the `Copy` trait
|
||||
help: consider removing the `&mut`
|
||||
|
|
||||
LL | (Either::One(_t), Either::Two(_u))
|
||||
LL |
|
||||
LL |
|
||||
LL | | &mut (Either::Two(_t), Either::One(_u)) => (),
|
||||
|
|
||||
|
||||
error[E0507]: cannot move out of a mutable reference
|
||||
--> $DIR/duplicate-suggestions.rs:122:11
|
||||
|
|
|
@ -263,11 +263,18 @@ LL | match r {
|
|||
| ^
|
||||
LL |
|
||||
LL | &Either::One(_t)
|
||||
| ----------------
|
||||
| | |
|
||||
| | data moved here
|
||||
| | move occurs because `_t` has type `X`, which does not implement the `Copy` trait
|
||||
| help: consider removing the `&`: `Either::One(_t)`
|
||||
| --
|
||||
| |
|
||||
| data moved here
|
||||
| move occurs because `_t` has type `X`, which does not implement the `Copy` trait
|
||||
|
|
||||
help: consider removing the `&`
|
||||
|
|
||||
LL | Either::One(_t)
|
||||
LL |
|
||||
LL |
|
||||
LL | | &Either::Two(_t) => (),
|
||||
|
|
||||
|
||||
error[E0507]: cannot move out of `r.0` which is behind a shared reference
|
||||
--> $DIR/simple.rs:188:11
|
||||
|
@ -502,11 +509,18 @@ LL | match &e {
|
|||
| ^^
|
||||
LL |
|
||||
LL | &Either::One(_t)
|
||||
| ----------------
|
||||
| | |
|
||||
| | data moved here
|
||||
| | move occurs because `_t` has type `X`, which does not implement the `Copy` trait
|
||||
| help: consider removing the `&`: `Either::One(_t)`
|
||||
| --
|
||||
| |
|
||||
| data moved here
|
||||
| move occurs because `_t` has type `X`, which does not implement the `Copy` trait
|
||||
|
|
||||
help: consider removing the `&`
|
||||
|
|
||||
LL | Either::One(_t)
|
||||
LL |
|
||||
LL |
|
||||
LL | | &Either::Two(_t) => (),
|
||||
|
|
||||
|
||||
error[E0507]: cannot move out of a shared reference
|
||||
--> $DIR/simple.rs:308:11
|
||||
|
@ -571,11 +585,18 @@ LL | match &mut em {
|
|||
| ^^^^^^^
|
||||
LL |
|
||||
LL | &mut Either::One(_t)
|
||||
| --------------------
|
||||
| | |
|
||||
| | data moved here
|
||||
| | move occurs because `_t` has type `X`, which does not implement the `Copy` trait
|
||||
| help: consider removing the `&mut`: `Either::One(_t)`
|
||||
| --
|
||||
| |
|
||||
| data moved here
|
||||
| move occurs because `_t` has type `X`, which does not implement the `Copy` trait
|
||||
|
|
||||
help: consider removing the `&mut`
|
||||
|
|
||||
LL | Either::One(_t)
|
||||
LL |
|
||||
LL |
|
||||
LL | | &mut Either::Two(_t) => (),
|
||||
|
|
||||
|
||||
error[E0507]: cannot move out of a mutable reference
|
||||
--> $DIR/simple.rs:343:11
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue