update tests

This commit is contained in:
mark 2020-11-21 16:05:17 -06:00
parent fd516af66d
commit b9ecba30bc
74 changed files with 324 additions and 656 deletions

View file

@ -1,7 +1,5 @@
// Test that simple or-patterns don't get expanded to exponentially large CFGs
#![feature(or_patterns)]
// EMIT_MIR exponential_or.match_tuple.SimplifyCfg-initial.after.mir
fn match_tuple(x: (u32, bool, Option<i32>, u32)) -> u32 {
match x {

View file

@ -1,83 +1,83 @@
// MIR for `match_tuple` after SimplifyCfg-initial
fn match_tuple(_1: (u32, bool, Option<i32>, u32)) -> u32 {
debug x => _1; // in scope 0 at $DIR/exponential-or.rs:6:16: 6:17
let mut _0: u32; // return place in scope 0 at $DIR/exponential-or.rs:6:53: 6:56
let mut _2: isize; // in scope 0 at $DIR/exponential-or.rs:8:37: 8:48
let mut _3: bool; // in scope 0 at $DIR/exponential-or.rs:8:70: 8:77
let mut _4: bool; // in scope 0 at $DIR/exponential-or.rs:8:70: 8:77
let mut _5: bool; // in scope 0 at $DIR/exponential-or.rs:8:62: 8:67
let mut _6: bool; // in scope 0 at $DIR/exponential-or.rs:8:62: 8:67
let _7: u32; // in scope 0 at $DIR/exponential-or.rs:8:10: 8:21
let _8: u32; // in scope 0 at $DIR/exponential-or.rs:8:57: 8:78
let mut _9: u32; // in scope 0 at $DIR/exponential-or.rs:8:83: 8:84
let mut _10: u32; // in scope 0 at $DIR/exponential-or.rs:8:87: 8:88
debug x => _1; // in scope 0 at $DIR/exponential-or.rs:4:16: 4:17
let mut _0: u32; // return place in scope 0 at $DIR/exponential-or.rs:4:53: 4:56
let mut _2: isize; // in scope 0 at $DIR/exponential-or.rs:6:37: 6:48
let mut _3: bool; // in scope 0 at $DIR/exponential-or.rs:6:70: 6:77
let mut _4: bool; // in scope 0 at $DIR/exponential-or.rs:6:70: 6:77
let mut _5: bool; // in scope 0 at $DIR/exponential-or.rs:6:62: 6:67
let mut _6: bool; // in scope 0 at $DIR/exponential-or.rs:6:62: 6:67
let _7: u32; // in scope 0 at $DIR/exponential-or.rs:6:10: 6:21
let _8: u32; // in scope 0 at $DIR/exponential-or.rs:6:57: 6:78
let mut _9: u32; // in scope 0 at $DIR/exponential-or.rs:6:83: 6:84
let mut _10: u32; // in scope 0 at $DIR/exponential-or.rs:6:87: 6:88
scope 1 {
debug y => _7; // in scope 1 at $DIR/exponential-or.rs:8:10: 8:21
debug z => _8; // in scope 1 at $DIR/exponential-or.rs:8:57: 8:78
debug y => _7; // in scope 1 at $DIR/exponential-or.rs:6:10: 6:21
debug z => _8; // in scope 1 at $DIR/exponential-or.rs:6:57: 6:78
}
bb0: {
FakeRead(ForMatchedPlace, _1); // scope 0 at $DIR/exponential-or.rs:7:11: 7:12
switchInt((_1.0: u32)) -> [1_u32: bb2, 4_u32: bb2, otherwise: bb1]; // scope 0 at $DIR/exponential-or.rs:8:15: 8:16
FakeRead(ForMatchedPlace, _1); // scope 0 at $DIR/exponential-or.rs:5:11: 5:12
switchInt((_1.0: u32)) -> [1_u32: bb2, 4_u32: bb2, otherwise: bb1]; // scope 0 at $DIR/exponential-or.rs:6:15: 6:16
}
bb1: {
_0 = const 0_u32; // scope 0 at $DIR/exponential-or.rs:9:14: 9:15
goto -> bb10; // scope 0 at $DIR/exponential-or.rs:7:5: 10:6
_0 = const 0_u32; // scope 0 at $DIR/exponential-or.rs:7:14: 7:15
goto -> bb10; // scope 0 at $DIR/exponential-or.rs:5:5: 8:6
}
bb2: {
_2 = discriminant((_1.2: std::option::Option<i32>)); // scope 0 at $DIR/exponential-or.rs:8:37: 8:48
switchInt(move _2) -> [0_isize: bb4, 1_isize: bb3, otherwise: bb1]; // scope 0 at $DIR/exponential-or.rs:8:37: 8:48
_2 = discriminant((_1.2: std::option::Option<i32>)); // scope 0 at $DIR/exponential-or.rs:6:37: 6:48
switchInt(move _2) -> [0_isize: bb4, 1_isize: bb3, otherwise: bb1]; // scope 0 at $DIR/exponential-or.rs:6:37: 6:48
}
bb3: {
switchInt((((_1.2: std::option::Option<i32>) as Some).0: i32)) -> [1_i32: bb4, 8_i32: bb4, otherwise: bb1]; // scope 0 at $DIR/exponential-or.rs:8:42: 8:43
switchInt((((_1.2: std::option::Option<i32>) as Some).0: i32)) -> [1_i32: bb4, 8_i32: bb4, otherwise: bb1]; // scope 0 at $DIR/exponential-or.rs:6:42: 6:43
}
bb4: {
_5 = Le(const 6_u32, (_1.3: u32)); // scope 0 at $DIR/exponential-or.rs:8:62: 8:67
switchInt(move _5) -> [false: bb6, otherwise: bb5]; // scope 0 at $DIR/exponential-or.rs:8:62: 8:67
_5 = Le(const 6_u32, (_1.3: u32)); // scope 0 at $DIR/exponential-or.rs:6:62: 6:67
switchInt(move _5) -> [false: bb6, otherwise: bb5]; // scope 0 at $DIR/exponential-or.rs:6:62: 6:67
}
bb5: {
_6 = Le((_1.3: u32), const 9_u32); // scope 0 at $DIR/exponential-or.rs:8:62: 8:67
switchInt(move _6) -> [false: bb6, otherwise: bb8]; // scope 0 at $DIR/exponential-or.rs:8:62: 8:67
_6 = Le((_1.3: u32), const 9_u32); // scope 0 at $DIR/exponential-or.rs:6:62: 6:67
switchInt(move _6) -> [false: bb6, otherwise: bb8]; // scope 0 at $DIR/exponential-or.rs:6:62: 6:67
}
bb6: {
_3 = Le(const 13_u32, (_1.3: u32)); // scope 0 at $DIR/exponential-or.rs:8:70: 8:77
switchInt(move _3) -> [false: bb1, otherwise: bb7]; // scope 0 at $DIR/exponential-or.rs:8:70: 8:77
_3 = Le(const 13_u32, (_1.3: u32)); // scope 0 at $DIR/exponential-or.rs:6:70: 6:77
switchInt(move _3) -> [false: bb1, otherwise: bb7]; // scope 0 at $DIR/exponential-or.rs:6:70: 6:77
}
bb7: {
_4 = Le((_1.3: u32), const 16_u32); // scope 0 at $DIR/exponential-or.rs:8:70: 8:77
switchInt(move _4) -> [false: bb1, otherwise: bb8]; // scope 0 at $DIR/exponential-or.rs:8:70: 8:77
_4 = Le((_1.3: u32), const 16_u32); // scope 0 at $DIR/exponential-or.rs:6:70: 6:77
switchInt(move _4) -> [false: bb1, otherwise: bb8]; // scope 0 at $DIR/exponential-or.rs:6:70: 6:77
}
bb8: {
falseEdge -> [real: bb9, imaginary: bb1]; // scope 0 at $DIR/exponential-or.rs:8:9: 8:79
falseEdge -> [real: bb9, imaginary: bb1]; // scope 0 at $DIR/exponential-or.rs:6:9: 6:79
}
bb9: {
StorageLive(_7); // scope 0 at $DIR/exponential-or.rs:8:10: 8:21
_7 = (_1.0: u32); // scope 0 at $DIR/exponential-or.rs:8:10: 8:21
StorageLive(_8); // scope 0 at $DIR/exponential-or.rs:8:57: 8:78
_8 = (_1.3: u32); // scope 0 at $DIR/exponential-or.rs:8:57: 8:78
StorageLive(_9); // scope 1 at $DIR/exponential-or.rs:8:83: 8:84
_9 = _7; // scope 1 at $DIR/exponential-or.rs:8:83: 8:84
StorageLive(_10); // scope 1 at $DIR/exponential-or.rs:8:87: 8:88
_10 = _8; // scope 1 at $DIR/exponential-or.rs:8:87: 8:88
_0 = BitXor(move _9, move _10); // scope 1 at $DIR/exponential-or.rs:8:83: 8:88
StorageDead(_10); // scope 1 at $DIR/exponential-or.rs:8:87: 8:88
StorageDead(_9); // scope 1 at $DIR/exponential-or.rs:8:87: 8:88
StorageDead(_8); // scope 0 at $DIR/exponential-or.rs:8:87: 8:88
StorageDead(_7); // scope 0 at $DIR/exponential-or.rs:8:87: 8:88
goto -> bb10; // scope 0 at $DIR/exponential-or.rs:7:5: 10:6
StorageLive(_7); // scope 0 at $DIR/exponential-or.rs:6:10: 6:21
_7 = (_1.0: u32); // scope 0 at $DIR/exponential-or.rs:6:10: 6:21
StorageLive(_8); // scope 0 at $DIR/exponential-or.rs:6:57: 6:78
_8 = (_1.3: u32); // scope 0 at $DIR/exponential-or.rs:6:57: 6:78
StorageLive(_9); // scope 1 at $DIR/exponential-or.rs:6:83: 6:84
_9 = _7; // scope 1 at $DIR/exponential-or.rs:6:83: 6:84
StorageLive(_10); // scope 1 at $DIR/exponential-or.rs:6:87: 6:88
_10 = _8; // scope 1 at $DIR/exponential-or.rs:6:87: 6:88
_0 = BitXor(move _9, move _10); // scope 1 at $DIR/exponential-or.rs:6:83: 6:88
StorageDead(_10); // scope 1 at $DIR/exponential-or.rs:6:87: 6:88
StorageDead(_9); // scope 1 at $DIR/exponential-or.rs:6:87: 6:88
StorageDead(_8); // scope 0 at $DIR/exponential-or.rs:6:87: 6:88
StorageDead(_7); // scope 0 at $DIR/exponential-or.rs:6:87: 6:88
goto -> bb10; // scope 0 at $DIR/exponential-or.rs:5:5: 8:6
}
bb10: {
return; // scope 0 at $DIR/exponential-or.rs:11:2: 11:2
return; // scope 0 at $DIR/exponential-or.rs:9:2: 9:2
}
}

View file

@ -1,7 +1,6 @@
// EMIT_MIR issue_75439.foo.MatchBranchSimplification.diff
#![feature(const_fn_transmute)]
#![feature(or_patterns)]
use std::mem::transmute;

View file

@ -2,17 +2,17 @@
+ // MIR for `foo` after MatchBranchSimplification
fn foo(_1: [u8; 16]) -> Option<[u8; 4]> {
debug bytes => _1; // in scope 0 at $DIR/issue-75439.rs:8:12: 8:17
let mut _0: std::option::Option<[u8; 4]>; // return place in scope 0 at $DIR/issue-75439.rs:8:32: 8:47
let _2: [u32; 4]; // in scope 0 at $DIR/issue-75439.rs:10:9: 10:15
let mut _3: [u8; 16]; // in scope 0 at $DIR/issue-75439.rs:10:47: 10:52
let mut _5: [u8; 4]; // in scope 0 at $DIR/issue-75439.rs:13:14: 13:38
let mut _6: u32; // in scope 0 at $DIR/issue-75439.rs:13:33: 13:35
debug bytes => _1; // in scope 0 at $DIR/issue-75439.rs:7:12: 7:17
let mut _0: std::option::Option<[u8; 4]>; // return place in scope 0 at $DIR/issue-75439.rs:7:32: 7:47
let _2: [u32; 4]; // in scope 0 at $DIR/issue-75439.rs:9:9: 9:15
let mut _3: [u8; 16]; // in scope 0 at $DIR/issue-75439.rs:9:47: 9:52
let mut _5: [u8; 4]; // in scope 0 at $DIR/issue-75439.rs:12:14: 12:38
let mut _6: u32; // in scope 0 at $DIR/issue-75439.rs:12:33: 12:35
scope 1 {
debug dwords => _2; // in scope 1 at $DIR/issue-75439.rs:10:9: 10:15
let _4: u32; // in scope 1 at $DIR/issue-75439.rs:12:27: 12:29
debug dwords => _2; // in scope 1 at $DIR/issue-75439.rs:9:9: 9:15
let _4: u32; // in scope 1 at $DIR/issue-75439.rs:11:27: 11:29
scope 3 {
debug ip => _4; // in scope 3 at $DIR/issue-75439.rs:12:27: 12:29
debug ip => _4; // in scope 3 at $DIR/issue-75439.rs:11:27: 11:29
scope 4 {
}
}
@ -21,67 +21,67 @@
}
bb0: {
StorageLive(_2); // scope 0 at $DIR/issue-75439.rs:10:9: 10:15
StorageLive(_3); // scope 2 at $DIR/issue-75439.rs:10:47: 10:52
_3 = _1; // scope 2 at $DIR/issue-75439.rs:10:47: 10:52
_2 = transmute::<[u8; 16], [u32; 4]>(move _3) -> bb1; // scope 2 at $DIR/issue-75439.rs:10:37: 10:53
StorageLive(_2); // scope 0 at $DIR/issue-75439.rs:9:9: 9:15
StorageLive(_3); // scope 2 at $DIR/issue-75439.rs:9:47: 9:52
_3 = _1; // scope 2 at $DIR/issue-75439.rs:9:47: 9:52
_2 = transmute::<[u8; 16], [u32; 4]>(move _3) -> bb1; // scope 2 at $DIR/issue-75439.rs:9:37: 9:53
// mir::Constant
// + span: $DIR/issue-75439.rs:10:37: 10:46
// + span: $DIR/issue-75439.rs:9:37: 9:46
// + literal: Const { ty: unsafe extern "rust-intrinsic" fn([u8; 16]) -> [u32; 4] {std::intrinsics::transmute::<[u8; 16], [u32; 4]>}, val: Value(Scalar(<ZST>)) }
}
bb1: {
StorageDead(_3); // scope 2 at $DIR/issue-75439.rs:10:52: 10:53
switchInt(_2[0 of 4]) -> [0_u32: bb2, otherwise: bb4]; // scope 1 at $DIR/issue-75439.rs:12:13: 12:14
StorageDead(_3); // scope 2 at $DIR/issue-75439.rs:9:52: 9:53
switchInt(_2[0 of 4]) -> [0_u32: bb2, otherwise: bb4]; // scope 1 at $DIR/issue-75439.rs:11:13: 11:14
}
bb2: {
switchInt(_2[1 of 4]) -> [0_u32: bb3, otherwise: bb4]; // scope 1 at $DIR/issue-75439.rs:12:16: 12:17
switchInt(_2[1 of 4]) -> [0_u32: bb3, otherwise: bb4]; // scope 1 at $DIR/issue-75439.rs:11:16: 11:17
}
bb3: {
switchInt(_2[2 of 4]) -> [0_u32: bb6, 4294901760_u32: bb7, otherwise: bb4]; // scope 1 at $DIR/issue-75439.rs:12:19: 12:20
switchInt(_2[2 of 4]) -> [0_u32: bb6, 4294901760_u32: bb7, otherwise: bb4]; // scope 1 at $DIR/issue-75439.rs:11:19: 11:20
}
bb4: {
discriminant(_0) = 0; // scope 1 at $DIR/issue-75439.rs:15:9: 15:13
goto -> bb9; // scope 1 at $DIR/issue-75439.rs:12:5: 16:6
discriminant(_0) = 0; // scope 1 at $DIR/issue-75439.rs:14:9: 14:13
goto -> bb9; // scope 1 at $DIR/issue-75439.rs:11:5: 15:6
}
bb5: {
StorageLive(_5); // scope 3 at $DIR/issue-75439.rs:13:14: 13:38
StorageLive(_6); // scope 4 at $DIR/issue-75439.rs:13:33: 13:35
_6 = _4; // scope 4 at $DIR/issue-75439.rs:13:33: 13:35
_5 = transmute::<u32, [u8; 4]>(move _6) -> bb8; // scope 4 at $DIR/issue-75439.rs:13:23: 13:36
StorageLive(_5); // scope 3 at $DIR/issue-75439.rs:12:14: 12:38
StorageLive(_6); // scope 4 at $DIR/issue-75439.rs:12:33: 12:35
_6 = _4; // scope 4 at $DIR/issue-75439.rs:12:33: 12:35
_5 = transmute::<u32, [u8; 4]>(move _6) -> bb8; // scope 4 at $DIR/issue-75439.rs:12:23: 12:36
// mir::Constant
// + span: $DIR/issue-75439.rs:13:23: 13:32
// + span: $DIR/issue-75439.rs:12:23: 12:32
// + literal: Const { ty: unsafe extern "rust-intrinsic" fn(u32) -> [u8; 4] {std::intrinsics::transmute::<u32, [u8; 4]>}, val: Value(Scalar(<ZST>)) }
}
bb6: {
StorageLive(_4); // scope 1 at $DIR/issue-75439.rs:12:27: 12:29
_4 = _2[3 of 4]; // scope 1 at $DIR/issue-75439.rs:12:27: 12:29
goto -> bb5; // scope 1 at $DIR/issue-75439.rs:12:5: 16:6
StorageLive(_4); // scope 1 at $DIR/issue-75439.rs:11:27: 11:29
_4 = _2[3 of 4]; // scope 1 at $DIR/issue-75439.rs:11:27: 11:29
goto -> bb5; // scope 1 at $DIR/issue-75439.rs:11:5: 15:6
}
bb7: {
StorageLive(_4); // scope 1 at $DIR/issue-75439.rs:12:27: 12:29
_4 = _2[3 of 4]; // scope 1 at $DIR/issue-75439.rs:12:27: 12:29
goto -> bb5; // scope 1 at $DIR/issue-75439.rs:12:5: 16:6
StorageLive(_4); // scope 1 at $DIR/issue-75439.rs:11:27: 11:29
_4 = _2[3 of 4]; // scope 1 at $DIR/issue-75439.rs:11:27: 11:29
goto -> bb5; // scope 1 at $DIR/issue-75439.rs:11:5: 15:6
}
bb8: {
StorageDead(_6); // scope 4 at $DIR/issue-75439.rs:13:35: 13:36
((_0 as Some).0: [u8; 4]) = move _5; // scope 3 at $DIR/issue-75439.rs:13:9: 13:39
discriminant(_0) = 1; // scope 3 at $DIR/issue-75439.rs:13:9: 13:39
StorageDead(_5); // scope 3 at $DIR/issue-75439.rs:13:38: 13:39
StorageDead(_4); // scope 1 at $DIR/issue-75439.rs:14:5: 14:6
goto -> bb9; // scope 1 at $DIR/issue-75439.rs:12:5: 16:6
StorageDead(_6); // scope 4 at $DIR/issue-75439.rs:12:35: 12:36
((_0 as Some).0: [u8; 4]) = move _5; // scope 3 at $DIR/issue-75439.rs:12:9: 12:39
discriminant(_0) = 1; // scope 3 at $DIR/issue-75439.rs:12:9: 12:39
StorageDead(_5); // scope 3 at $DIR/issue-75439.rs:12:38: 12:39
StorageDead(_4); // scope 1 at $DIR/issue-75439.rs:13:5: 13:6
goto -> bb9; // scope 1 at $DIR/issue-75439.rs:11:5: 15:6
}
bb9: {
StorageDead(_2); // scope 0 at $DIR/issue-75439.rs:17:1: 17:2
return; // scope 0 at $DIR/issue-75439.rs:17:2: 17:2
StorageDead(_2); // scope 0 at $DIR/issue-75439.rs:16:1: 16:2
return; // scope 0 at $DIR/issue-75439.rs:16:2: 16:2
}
}

View file

@ -1,6 +1,5 @@
// Tests using a combination of pattern features has the expected borrow checking behavior
#![feature(bindings_after_at)]
#![feature(or_patterns)]
#![feature(box_patterns)]
enum Test {

View file

@ -1,5 +1,5 @@
error: cannot borrow value as mutable because it is also borrowed as immutable
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:38:9
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:37:9
|
LL | ref foo @ [.., ref mut bar] => (),
| -------^^^^^^^^-----------^
@ -8,7 +8,7 @@ LL | ref foo @ [.., ref mut bar] => (),
| immutable borrow, by `foo`, occurs here
error: cannot borrow value as mutable because it is also borrowed as immutable
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:122:9
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:121:9
|
LL | ref foo @ Some(box ref mut s) => (),
| -------^^^^^^^^^^^^---------^
@ -17,7 +17,7 @@ LL | ref foo @ Some(box ref mut s) => (),
| immutable borrow, by `foo`, occurs here
error[E0382]: borrow of moved value: `x`
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:20:5
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:19:5
|
LL | fn bindings_after_at_slice_patterns_move_binding(x: [String; 4]) {
| - move occurs because `x` has type `[String; 4]`, which does not implement the `Copy` trait
@ -29,7 +29,7 @@ LL | &x;
| ^^ value borrowed here after move
error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:30:5
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:29:5
|
LL | ref mut foo @ [.., _] => Some(foo),
| --------------------- mutable borrow occurs here
@ -41,7 +41,7 @@ LL | drop(r);
| - mutable borrow later used here
error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:52:5
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:51:5
|
LL | [ref foo @ .., ref bar] => Some(foo),
| ------------ immutable borrow occurs here
@ -53,7 +53,7 @@ LL | drop(r);
| - immutable borrow later used here
error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:64:5
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:63:5
|
LL | ref foo @ [.., ref bar] => Some(foo),
| ----------------------- immutable borrow occurs here
@ -65,7 +65,7 @@ LL | drop(r);
| - immutable borrow later used here
error[E0382]: borrow of moved value: `x`
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:78:5
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:77:5
|
LL | fn bindings_after_at_or_patterns_move(x: Option<Test>) {
| - move occurs because `x` has type `Option<Test>`, which does not implement the `Copy` trait
@ -80,7 +80,7 @@ LL | &x;
| ^^ value borrowed here after move
error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:88:5
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:87:5
|
LL | ref foo @ Some(Test::Foo | Test::Bar) => Some(foo),
| ------------------------------------- immutable borrow occurs here
@ -92,7 +92,7 @@ LL | drop(r);
| - immutable borrow later used here
error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:100:5
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:99:5
|
LL | ref mut foo @ Some(Test::Foo | Test::Bar) => Some(foo),
| ----------------------------------------- mutable borrow occurs here
@ -104,7 +104,7 @@ LL | drop(r);
| - mutable borrow later used here
error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:114:5
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:113:5
|
LL | ref foo @ Some(box ref s) => Some(foo),
| ------------------------- immutable borrow occurs here
@ -116,7 +116,7 @@ LL | drop(r);
| - immutable borrow later used here
error[E0382]: borrow of moved value: `x`
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:136:5
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:135:5
|
LL | fn bindings_after_at_slice_patterns_or_patterns_moves(x: [Option<Test>; 4]) {
| - move occurs because `x` has type `[Option<Test>; 4]`, which does not implement the `Copy` trait
@ -131,7 +131,7 @@ LL | &x;
| ^^ value borrowed here after move
error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:146:5
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:145:5
|
LL | ref a @ [ref b @ .., Some(Test::Foo | Test::Bar)] => Some(a),
| ------------------------------------------------- immutable borrow occurs here
@ -143,7 +143,7 @@ LL | drop(r);
| - immutable borrow later used here
error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:158:5
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:157:5
|
LL | ref a @ [ref b @ .., Some(Test::Foo | Test::Bar)] => Some(b),
| ---------- immutable borrow occurs here
@ -155,7 +155,7 @@ LL | drop(r);
| - immutable borrow later used here
error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:172:5
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:171:5
|
LL | [_, ref a @ Some(box ref b), ..] => Some(a),
| ----------------------- immutable borrow occurs here
@ -167,7 +167,7 @@ LL | drop(r);
| - immutable borrow later used here
error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:188:5
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:187:5
|
LL | [_, ref a @ Some(box Test::Foo | box Test::Bar), ..] => Some(a),
| ------------------------------------------- immutable borrow occurs here
@ -179,7 +179,7 @@ LL | drop(r);
| - immutable borrow later used here
error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:202:5
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:201:5
|
LL | [_, ref mut a @ Some(box Test::Foo | box Test::Bar), ..] => Some(a),
| ----------------------------------------------- mutable borrow occurs here
@ -191,7 +191,7 @@ LL | drop(r);
| - mutable borrow later used here
error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:216:5
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:215:5
|
LL | ref a @ [_, ref b @ Some(box Test::Foo | box Test::Bar), ..] => Some(a),
| ------------------------------------------------------------ immutable borrow occurs here

View file

@ -1,8 +1,6 @@
// Test that borrow check considers all choices in an or pattern, even the
// unreachable ones.
#![feature(or_patterns)]
fn or_pattern_moves_all(x: ((String, String),)) {
match x {
((y, _) | (_, y),) => (),

View file

@ -1,5 +1,5 @@
error[E0382]: borrow of moved value: `x.0.0`
--> $DIR/or-patterns.rs:10:5
--> $DIR/or-patterns.rs:8:5
|
LL | ((y, _) | (_, y),) => (),
| - value moved here
@ -10,7 +10,7 @@ LL | &x.0 .0;
= note: move occurs because `x.0.0` has type `String`, which does not implement the `Copy` trait
error[E0382]: borrow of moved value: `x.0.1`
--> $DIR/or-patterns.rs:12:5
--> $DIR/or-patterns.rs:10:5
|
LL | ((y, _) | (_, y),) => (),
| - value moved here
@ -21,7 +21,7 @@ LL | &x.0 .1;
= note: move occurs because `x.0.1` has type `String`, which does not implement the `Copy` trait
error[E0502]: cannot borrow `x.0.0` as mutable because it is also borrowed as immutable
--> $DIR/or-patterns.rs:20:5
--> $DIR/or-patterns.rs:18:5
|
LL | ((ref y, _) | (_, ref y),) => y,
| ----- immutable borrow occurs here
@ -33,7 +33,7 @@ LL | drop(r);
| - immutable borrow later used here
error[E0502]: cannot borrow `x.0.1` as mutable because it is also borrowed as immutable
--> $DIR/or-patterns.rs:22:5
--> $DIR/or-patterns.rs:20:5
|
LL | ((ref y, _) | (_, ref y),) => y,
| ----- immutable borrow occurs here
@ -45,7 +45,7 @@ LL | drop(r);
| - immutable borrow later used here
error[E0502]: cannot borrow `x.0.0` as immutable because it is also borrowed as mutable
--> $DIR/or-patterns.rs:31:5
--> $DIR/or-patterns.rs:29:5
|
LL | ((ref mut y, _) | (_, ref mut y),) => y,
| --------- mutable borrow occurs here
@ -57,7 +57,7 @@ LL | drop(r);
| - mutable borrow later used here
error[E0502]: cannot borrow `x.0.1` as immutable because it is also borrowed as mutable
--> $DIR/or-patterns.rs:33:5
--> $DIR/or-patterns.rs:31:5
|
LL | ((ref mut y, _) | (_, ref mut y),) => y,
| --------- mutable borrow occurs here
@ -69,7 +69,7 @@ LL | drop(r);
| - mutable borrow later used here
error[E0382]: borrow of moved value: `x.0.0`
--> $DIR/or-patterns.rs:40:5
--> $DIR/or-patterns.rs:38:5
|
LL | let ((y, _) | (_, y),) = x;
| - value moved here
@ -79,7 +79,7 @@ LL | &x.0 .0;
= note: move occurs because `x.0.0` has type `String`, which does not implement the `Copy` trait
error[E0382]: borrow of moved value: `x.0.1`
--> $DIR/or-patterns.rs:42:5
--> $DIR/or-patterns.rs:40:5
|
LL | let ((y, _) | (_, y),) = x;
| - value moved here
@ -90,7 +90,7 @@ LL | &x.0 .1;
= note: move occurs because `x.0.1` has type `String`, which does not implement the `Copy` trait
error[E0502]: cannot borrow `x.0.0` as mutable because it is also borrowed as immutable
--> $DIR/or-patterns.rs:48:5
--> $DIR/or-patterns.rs:46:5
|
LL | let ((ref r, _) | (_, ref r),) = x;
| ----- immutable borrow occurs here
@ -101,7 +101,7 @@ LL | drop(r);
| - immutable borrow later used here
error[E0502]: cannot borrow `x.0.1` as mutable because it is also borrowed as immutable
--> $DIR/or-patterns.rs:50:5
--> $DIR/or-patterns.rs:48:5
|
LL | let ((ref r, _) | (_, ref r),) = x;
| ----- immutable borrow occurs here
@ -113,7 +113,7 @@ LL | drop(r);
| - immutable borrow later used here
error[E0502]: cannot borrow `x.0.0` as immutable because it is also borrowed as mutable
--> $DIR/or-patterns.rs:57:5
--> $DIR/or-patterns.rs:55:5
|
LL | let ((ref mut r, _) | (_, ref mut r),) = x;
| --------- mutable borrow occurs here
@ -124,7 +124,7 @@ LL | drop(r);
| - mutable borrow later used here
error[E0502]: cannot borrow `x.0.1` as immutable because it is also borrowed as mutable
--> $DIR/or-patterns.rs:59:5
--> $DIR/or-patterns.rs:57:5
|
LL | let ((ref mut r, _) | (_, ref mut r),) = x;
| --------- mutable borrow occurs here

View file

@ -47,19 +47,46 @@ error: unexpected `,` in pattern
--> $DIR/issue-48492-tuple-destructure-missing-parens.rs:67:10
|
LL | for x, _barr_body in women.iter().map(|woman| woman.allosomes.clone()) {
| -^----------- help: try adding parentheses to match on a tuple: `(x, _barr_body)`
| ^
|
help: try adding parentheses to match on a tuple...
|
LL | for (x, _barr_body) in women.iter().map(|woman| woman.allosomes.clone()) {
| ^^^^^^^^^^^^^^^
help: ...or a vertical bar to match on multiple alternatives
|
LL | for x | _barr_body in women.iter().map(|woman| woman.allosomes.clone()) {
| ^^^^^^^^^^^^^^
error: unexpected `,` in pattern
--> $DIR/issue-48492-tuple-destructure-missing-parens.rs:75:10
|
LL | for x, y @ Allosome::Y(_) in men.iter().map(|man| man.allosomes.clone()) {
| -^------------------- help: try adding parentheses to match on a tuple: `(x, y @ Allosome::Y(_))`
| ^
|
help: try adding parentheses to match on a tuple...
|
LL | for (x, y @ Allosome::Y(_)) in men.iter().map(|man| man.allosomes.clone()) {
| ^^^^^^^^^^^^^^^^^^^^^^^
help: ...or a vertical bar to match on multiple alternatives
|
LL | for x | y @ Allosome::Y(_) in men.iter().map(|man| man.allosomes.clone()) {
| ^^^^^^^^^^^^^^^^^^^^^^
error: unexpected `,` in pattern
--> $DIR/issue-48492-tuple-destructure-missing-parens.rs:84:14
|
LL | let women, men: (Vec<Genome>, Vec<Genome>) = genomes.iter().cloned()
| -----^---- help: try adding parentheses to match on a tuple: `(women, men)`
| ^
|
help: try adding parentheses to match on a tuple...
|
LL | let (women, men): (Vec<Genome>, Vec<Genome>) = genomes.iter().cloned()
| ^^^^^^^^^^^^
help: ...or a vertical bar to match on multiple alternatives
|
LL | let women | men: (Vec<Genome>, Vec<Genome>) = genomes.iter().cloned()
| ^^^^^^^^^^^
error: aborting due to 6 previous errors

View file

@ -1,7 +1,6 @@
// run-rustfix
#![feature(box_patterns, stmt_expr_attributes)]
#![feature(or_patterns)]
#![allow(
dead_code,

View file

@ -1,7 +1,6 @@
// run-rustfix
#![feature(box_patterns, stmt_expr_attributes)]
#![feature(or_patterns)]
#![allow(
dead_code,

View file

@ -1,149 +1,149 @@
error: unnecessary parentheses around pattern
--> $DIR/issue-54538-unused-parens-lint.rs:17:9
--> $DIR/issue-54538-unused-parens-lint.rs:16:9
|
LL | let (a) = 0;
| ^^^ help: remove these parentheses
|
note: the lint level is defined here
--> $DIR/issue-54538-unused-parens-lint.rs:14:9
--> $DIR/issue-54538-unused-parens-lint.rs:13:9
|
LL | #![deny(unused_parens)]
| ^^^^^^^^^^^^^
error: unnecessary parentheses around pattern
--> $DIR/issue-54538-unused-parens-lint.rs:18:9
--> $DIR/issue-54538-unused-parens-lint.rs:17:9
|
LL | for (a) in 0..1 {}
| ^^^ help: remove these parentheses
error: unnecessary parentheses around pattern
--> $DIR/issue-54538-unused-parens-lint.rs:19:12
--> $DIR/issue-54538-unused-parens-lint.rs:18:12
|
LL | if let (a) = 0 {}
| ^^^ help: remove these parentheses
error: unnecessary parentheses around pattern
--> $DIR/issue-54538-unused-parens-lint.rs:20:15
--> $DIR/issue-54538-unused-parens-lint.rs:19:15
|
LL | while let (a) = 0 {}
| ^^^ help: remove these parentheses
error: unnecessary parentheses around pattern
--> $DIR/issue-54538-unused-parens-lint.rs:21:12
--> $DIR/issue-54538-unused-parens-lint.rs:20:12
|
LL | fn foo((a): u8) {}
| ^^^ help: remove these parentheses
error: unnecessary parentheses around pattern
--> $DIR/issue-54538-unused-parens-lint.rs:22:14
--> $DIR/issue-54538-unused-parens-lint.rs:21:14
|
LL | let _ = |(a): u8| 0;
| ^^^ help: remove these parentheses
error: unnecessary parentheses around pattern
--> $DIR/issue-54538-unused-parens-lint.rs:50:12
--> $DIR/issue-54538-unused-parens-lint.rs:49:12
|
LL | if let (0 | 1) = 0 {}
| ^^^^^^^ help: remove these parentheses
error: unnecessary parentheses around pattern
--> $DIR/issue-54538-unused-parens-lint.rs:51:13
--> $DIR/issue-54538-unused-parens-lint.rs:50:13
|
LL | if let ((0 | 1),) = (0,) {}
| ^^^^^^^ help: remove these parentheses
error: unnecessary parentheses around pattern
--> $DIR/issue-54538-unused-parens-lint.rs:52:13
--> $DIR/issue-54538-unused-parens-lint.rs:51:13
|
LL | if let [(0 | 1)] = [0] {}
| ^^^^^^^ help: remove these parentheses
error: unnecessary parentheses around pattern
--> $DIR/issue-54538-unused-parens-lint.rs:53:16
--> $DIR/issue-54538-unused-parens-lint.rs:52:16
|
LL | if let 0 | (1 | 2) = 0 {}
| ^^^^^^^ help: remove these parentheses
error: unnecessary parentheses around pattern
--> $DIR/issue-54538-unused-parens-lint.rs:55:15
--> $DIR/issue-54538-unused-parens-lint.rs:54:15
|
LL | if let TS((0 | 1)) = TS(0) {}
| ^^^^^^^ help: remove these parentheses
error: unnecessary parentheses around pattern
--> $DIR/issue-54538-unused-parens-lint.rs:57:20
--> $DIR/issue-54538-unused-parens-lint.rs:56:20
|
LL | if let NS { f: (0 | 1) } = (NS { f: 0 }) {}
| ^^^^^^^ help: remove these parentheses
error: unnecessary parentheses around pattern
--> $DIR/issue-54538-unused-parens-lint.rs:67:9
--> $DIR/issue-54538-unused-parens-lint.rs:66:9
|
LL | (_) => {}
| ^^^ help: remove these parentheses
error: unnecessary parentheses around pattern
--> $DIR/issue-54538-unused-parens-lint.rs:67:9
|
LL | (y) => {}
| ^^^ help: remove these parentheses
error: unnecessary parentheses around pattern
--> $DIR/issue-54538-unused-parens-lint.rs:68:9
|
LL | (y) => {}
| ^^^ help: remove these parentheses
error: unnecessary parentheses around pattern
--> $DIR/issue-54538-unused-parens-lint.rs:69:9
|
LL | (ref r) => {}
| ^^^^^^^ help: remove these parentheses
error: unnecessary parentheses around pattern
--> $DIR/issue-54538-unused-parens-lint.rs:70:9
--> $DIR/issue-54538-unused-parens-lint.rs:69:9
|
LL | (e @ 1...2) => {}
| ^^^^^^^^^^^ help: remove these parentheses
error: unnecessary parentheses around pattern
--> $DIR/issue-54538-unused-parens-lint.rs:76:9
--> $DIR/issue-54538-unused-parens-lint.rs:75:9
|
LL | (e @ &(1...2)) => {}
| ^^^^^^^^^^^^^^ help: remove these parentheses
error: unnecessary parentheses around pattern
--> $DIR/issue-54538-unused-parens-lint.rs:77:10
--> $DIR/issue-54538-unused-parens-lint.rs:76:10
|
LL | &(_) => {}
| ^^^ help: remove these parentheses
error: unnecessary parentheses around pattern
--> $DIR/issue-54538-unused-parens-lint.rs:88:9
--> $DIR/issue-54538-unused-parens-lint.rs:87:9
|
LL | (_) => {}
| ^^^ help: remove these parentheses
error: unnecessary parentheses around pattern
--> $DIR/issue-54538-unused-parens-lint.rs:89:9
--> $DIR/issue-54538-unused-parens-lint.rs:88:9
|
LL | (y) => {}
| ^^^ help: remove these parentheses
error: unnecessary parentheses around pattern
--> $DIR/issue-54538-unused-parens-lint.rs:90:9
--> $DIR/issue-54538-unused-parens-lint.rs:89:9
|
LL | (ref r) => {}
| ^^^^^^^ help: remove these parentheses
error: unnecessary parentheses around pattern
--> $DIR/issue-54538-unused-parens-lint.rs:91:9
--> $DIR/issue-54538-unused-parens-lint.rs:90:9
|
LL | (e @ 1..=2) => {}
| ^^^^^^^^^^^ help: remove these parentheses
error: unnecessary parentheses around pattern
--> $DIR/issue-54538-unused-parens-lint.rs:97:9
--> $DIR/issue-54538-unused-parens-lint.rs:96:9
|
LL | (e @ &(1..=2)) => {}
| ^^^^^^^^^^^^^^ help: remove these parentheses
error: unnecessary parentheses around pattern
--> $DIR/issue-54538-unused-parens-lint.rs:98:10
--> $DIR/issue-54538-unused-parens-lint.rs:97:10
|
LL | &(_) => {}
| ^^^ help: remove these parentheses

View file

@ -1,7 +1,6 @@
// FIXME: should be run-rustfix, but rustfix doesn't currently support multipart suggestions, see
// #53934
#![feature(or_patterns)]
#![deny(unused)]
pub enum MyEnum {

View file

@ -1,11 +1,11 @@
error: unused variable: `j`
--> $DIR/issue-67691-unused-field-in-or-pattern.rs:21:16
--> $DIR/issue-67691-unused-field-in-or-pattern.rs:20:16
|
LL | A { i, j } | B { i, j } => {
| ^ ^
|
note: the lint level is defined here
--> $DIR/issue-67691-unused-field-in-or-pattern.rs:5:9
--> $DIR/issue-67691-unused-field-in-or-pattern.rs:4:9
|
LL | #![deny(unused)]
| ^^^^^^
@ -16,7 +16,7 @@ LL | A { i, j: _ } | B { i, j: _ } => {
| ^^^^ ^^^^
error: unused variable: `j`
--> $DIR/issue-67691-unused-field-in-or-pattern.rs:31:16
--> $DIR/issue-67691-unused-field-in-or-pattern.rs:30:16
|
LL | A { i, ref j } | B { i, ref j } => {
| ^^^^^ ^^^^^
@ -27,7 +27,7 @@ LL | A { i, j: _ } | B { i, j: _ } => {
| ^^^^ ^^^^
error: unused variable: `j`
--> $DIR/issue-67691-unused-field-in-or-pattern.rs:41:21
--> $DIR/issue-67691-unused-field-in-or-pattern.rs:40:21
|
LL | Some(A { i, j } | B { i, j }) => {
| ^ ^
@ -38,7 +38,7 @@ LL | Some(A { i, j: _ } | B { i, j: _ }) => {
| ^^^^ ^^^^
error: unused variable: `j`
--> $DIR/issue-67691-unused-field-in-or-pattern.rs:53:21
--> $DIR/issue-67691-unused-field-in-or-pattern.rs:52:21
|
LL | Some(A { i, ref j } | B { i, ref j }) => {
| ^^^^^ ^^^^^
@ -49,7 +49,7 @@ LL | Some(A { i, j: _ } | B { i, j: _ }) => {
| ^^^^ ^^^^
error: unused variable: `i`
--> $DIR/issue-67691-unused-field-in-or-pattern.rs:63:24
--> $DIR/issue-67691-unused-field-in-or-pattern.rs:62:24
|
LL | MixedEnum::A { i } | MixedEnum::B(i) => {
| ^ ^
@ -60,7 +60,7 @@ LL | MixedEnum::A { i: _ } | MixedEnum::B(_) => {
| ^^^^ ^
error: unused variable: `i`
--> $DIR/issue-67691-unused-field-in-or-pattern.rs:71:24
--> $DIR/issue-67691-unused-field-in-or-pattern.rs:70:24
|
LL | MixedEnum::A { ref i } | MixedEnum::B(ref i) => {
| ^^^^^ ^^^^^

View file

@ -1,6 +1,5 @@
// run-pass
#![feature(or_patterns)]
#![feature(edition_macro_pats)]
macro_rules! foo {

View file

@ -1,7 +1,5 @@
// run-pass
#![feature(or_patterns)]
fn main() {
assert!(f("", 0));
assert!(f("a", 1));

View file

@ -1,8 +1,6 @@
// This test ensures that the "already bound identifier in a product pattern"
// correctly accounts for or-patterns.
#![feature(or_patterns)]
enum E<T> { A(T, T), B(T) }
use E::*;

View file

@ -1,89 +1,89 @@
error[E0416]: identifier `a` is bound more than once in the same pattern
--> $DIR/already-bound-name.rs:11:13
--> $DIR/already-bound-name.rs:9:13
|
LL | let (a, a) = (0, 1); // Standard duplication without an or-pattern.
| ^ used in a pattern more than once
error[E0416]: identifier `a` is bound more than once in the same pattern
--> $DIR/already-bound-name.rs:14:15
--> $DIR/already-bound-name.rs:12:15
|
LL | let (a, A(a, _) | B(a)) = (0, A(1, 2));
| ^ used in a pattern more than once
error[E0416]: identifier `a` is bound more than once in the same pattern
--> $DIR/already-bound-name.rs:14:25
--> $DIR/already-bound-name.rs:12:25
|
LL | let (a, A(a, _) | B(a)) = (0, A(1, 2));
| ^ used in a pattern more than once
error[E0416]: identifier `a` is bound more than once in the same pattern
--> $DIR/already-bound-name.rs:18:26
--> $DIR/already-bound-name.rs:16:26
|
LL | let (A(a, _) | B(a), a) = (A(0, 1), 2);
| ^ used in a pattern more than once
error[E0416]: identifier `a` is bound more than once in the same pattern
--> $DIR/already-bound-name.rs:21:15
--> $DIR/already-bound-name.rs:19:15
|
LL | let (A(a, a) | B(a)) = A(0, 1);
| ^ used in a pattern more than once
error[E0416]: identifier `a` is bound more than once in the same pattern
--> $DIR/already-bound-name.rs:24:22
--> $DIR/already-bound-name.rs:22:22
|
LL | let (B(a) | A(a, a)) = A(0, 1);
| ^ used in a pattern more than once
error[E0416]: identifier `a` is bound more than once in the same pattern
--> $DIR/already-bound-name.rs:28:21
--> $DIR/already-bound-name.rs:26:21
|
LL | B(a) | A(a, a) => {} // Let's ensure `match` has no funny business.
| ^ used in a pattern more than once
error[E0416]: identifier `a` is bound more than once in the same pattern
--> $DIR/already-bound-name.rs:32:37
--> $DIR/already-bound-name.rs:30:37
|
LL | let (B(A(a, _) | B(a)) | A(a, A(a, _) | B(a))) = B(B(1));
| ^ used in a pattern more than once
error[E0416]: identifier `a` is bound more than once in the same pattern
--> $DIR/already-bound-name.rs:32:47
--> $DIR/already-bound-name.rs:30:47
|
LL | let (B(A(a, _) | B(a)) | A(a, A(a, _) | B(a))) = B(B(1));
| ^ used in a pattern more than once
error[E0416]: identifier `a` is bound more than once in the same pattern
--> $DIR/already-bound-name.rs:37:37
--> $DIR/already-bound-name.rs:35:37
|
LL | let (B(_) | A(A(a, _) | B(a), A(a, _) | B(a))) = B(B(1));
| ^ used in a pattern more than once
error[E0416]: identifier `a` is bound more than once in the same pattern
--> $DIR/already-bound-name.rs:37:47
--> $DIR/already-bound-name.rs:35:47
|
LL | let (B(_) | A(A(a, _) | B(a), A(a, _) | B(a))) = B(B(1));
| ^ used in a pattern more than once
error[E0408]: variable `a` is not bound in all patterns
--> $DIR/already-bound-name.rs:37:10
--> $DIR/already-bound-name.rs:35:10
|
LL | let (B(_) | A(A(a, _) | B(a), A(a, _) | B(a))) = B(B(1));
| ^^^^ pattern doesn't bind `a` - variable not in all patterns
error[E0416]: identifier `a` is bound more than once in the same pattern
--> $DIR/already-bound-name.rs:42:50
--> $DIR/already-bound-name.rs:40:50
|
LL | let (B(A(a, _) | B(a)) | A(A(a, _) | B(a), A(a, _) | B(a))) = B(B(1));
| ^ used in a pattern more than once
error[E0416]: identifier `a` is bound more than once in the same pattern
--> $DIR/already-bound-name.rs:42:60
--> $DIR/already-bound-name.rs:40:60
|
LL | let (B(A(a, _) | B(a)) | A(A(a, _) | B(a), A(a, _) | B(a))) = B(B(1));
| ^ used in a pattern more than once
error[E0308]: mismatched types
--> $DIR/already-bound-name.rs:32:32
--> $DIR/already-bound-name.rs:30:32
|
LL | let (B(A(a, _) | B(a)) | A(a, A(a, _) | B(a))) = B(B(1));
| - ^ ------- this expression has type `E<E<{integer}>>`

View file

@ -3,8 +3,6 @@
// run-pass
#![feature(or_patterns)]
#[derive(Debug)]
enum Test {
Foo,

View file

@ -3,8 +3,6 @@
// run-pass
#![feature(or_patterns)]
#[derive(Debug, PartialEq)]
enum MatchArm {
Arm(usize),

View file

@ -1,7 +1,5 @@
// run-pass
#![feature(or_patterns)]
fn two_bindings(x: &((bool, bool), u8)) -> u8 {
match x {
&((true, y) | (y, true), z @ (0 | 4)) => (y as u8) + z,

View file

@ -1,7 +1,5 @@
// run-pass
#![feature(or_patterns)]
fn or_at(x: Result<u32, u32>) -> u32 {
match x {
Ok(x @ 4) | Err(x @ (6 | 8)) => x,

View file

@ -2,7 +2,6 @@
// run-pass
#![feature(or_patterns)]
#![feature(box_patterns)]
#[derive(Debug, PartialEq)]

View file

@ -4,8 +4,6 @@
// check-pass
#![feature(or_patterns)]
fn main() {
// One level:
let (Ok(a) | Err(a)) = Ok(0);

View file

@ -1,5 +1,4 @@
// check-pass
#![feature(or_patterns)]
const fn foo((Ok(a) | Err(a)): Result<i32, i32>) {
let x = Ok(3);

View file

@ -1,4 +1,3 @@
#![feature(or_patterns)]
#![deny(unreachable_patterns)]
// We wrap patterns in a tuple because top-level or-patterns were special-cased.

View file

@ -1,5 +1,5 @@
error[E0004]: non-exhaustive patterns: `(2_u8..=u8::MAX, _)` not covered
--> $DIR/exhaustiveness-non-exhaustive.rs:6:11
--> $DIR/exhaustiveness-non-exhaustive.rs:5:11
|
LL | match (0u8, 0u8) {
| ^^^^^^^^^^ pattern `(2_u8..=u8::MAX, _)` not covered
@ -8,7 +8,7 @@ LL | match (0u8, 0u8) {
= note: the matched value is of type `(u8, u8)`
error[E0004]: non-exhaustive patterns: `((4_u8..=u8::MAX))` not covered
--> $DIR/exhaustiveness-non-exhaustive.rs:10:11
--> $DIR/exhaustiveness-non-exhaustive.rs:9:11
|
LL | match ((0u8,),) {
| ^^^^^^^^^ pattern `((4_u8..=u8::MAX))` not covered
@ -17,7 +17,7 @@ LL | match ((0u8,),) {
= note: the matched value is of type `((u8,),)`
error[E0004]: non-exhaustive patterns: `(Some(2_u8..=u8::MAX))` not covered
--> $DIR/exhaustiveness-non-exhaustive.rs:14:11
--> $DIR/exhaustiveness-non-exhaustive.rs:13:11
|
LL | match (Some(0u8),) {
| ^^^^^^^^^^^^ pattern `(Some(2_u8..=u8::MAX))` not covered

View file

@ -1,4 +1,3 @@
#![feature(or_patterns)]
#![deny(unreachable_patterns)]
// check-pass

View file

@ -1,4 +1,3 @@
#![feature(or_patterns)]
#![deny(unreachable_patterns)]
// We wrap patterns in a tuple because top-level or-patterns were special-cased.

View file

@ -1,138 +1,138 @@
error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:8:9
--> $DIR/exhaustiveness-unreachable-pattern.rs:7:9
|
LL | (1,) => {}
| ^^^^
|
note: the lint level is defined here
--> $DIR/exhaustiveness-unreachable-pattern.rs:2:9
--> $DIR/exhaustiveness-unreachable-pattern.rs:1:9
|
LL | #![deny(unreachable_patterns)]
| ^^^^^^^^^^^^^^^^^^^^
error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:13:9
--> $DIR/exhaustiveness-unreachable-pattern.rs:12:9
|
LL | (2,) => {}
| ^^^^
error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:19:9
--> $DIR/exhaustiveness-unreachable-pattern.rs:18:9
|
LL | (1 | 2,) => {}
| ^^^^^^^^
error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:24:9
--> $DIR/exhaustiveness-unreachable-pattern.rs:23:9
|
LL | (1, 3) => {}
| ^^^^^^
error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:25:9
--> $DIR/exhaustiveness-unreachable-pattern.rs:24:9
|
LL | (1, 4) => {}
| ^^^^^^
error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:26:9
--> $DIR/exhaustiveness-unreachable-pattern.rs:25:9
|
LL | (2, 4) => {}
| ^^^^^^
error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:27:9
--> $DIR/exhaustiveness-unreachable-pattern.rs:26:9
|
LL | (2 | 1, 4) => {}
| ^^^^^^^^^^
error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:29:9
--> $DIR/exhaustiveness-unreachable-pattern.rs:28:9
|
LL | (1, 4 | 5) => {}
| ^^^^^^^^^^
error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:37:9
--> $DIR/exhaustiveness-unreachable-pattern.rs:36:9
|
LL | (Some(1),) => {}
| ^^^^^^^^^^
error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:38:9
--> $DIR/exhaustiveness-unreachable-pattern.rs:37:9
|
LL | (None,) => {}
| ^^^^^^^
error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:43:9
--> $DIR/exhaustiveness-unreachable-pattern.rs:42:9
|
LL | ((1..=4,),) => {}
| ^^^^^^^^^^^
error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:48:14
--> $DIR/exhaustiveness-unreachable-pattern.rs:47:14
|
LL | (1 | 1,) => {}
| ^
error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:52:19
--> $DIR/exhaustiveness-unreachable-pattern.rs:51:19
|
LL | (0 | 1) | 1 => {}
| ^
error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:58:14
--> $DIR/exhaustiveness-unreachable-pattern.rs:57:14
|
LL | 0 | (0 | 0) => {}
| ^
error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:58:18
--> $DIR/exhaustiveness-unreachable-pattern.rs:57:18
|
LL | 0 | (0 | 0) => {}
| ^
error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:66:13
--> $DIR/exhaustiveness-unreachable-pattern.rs:65:13
|
LL | / Some(
LL | | 0 | 0) => {}
| |______________________^
error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:72:15
--> $DIR/exhaustiveness-unreachable-pattern.rs:71:15
|
LL | | 0
| ^
error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:74:15
--> $DIR/exhaustiveness-unreachable-pattern.rs:73:15
|
LL | | 0] => {}
| ^
error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:82:10
--> $DIR/exhaustiveness-unreachable-pattern.rs:81:10
|
LL | [1
| ^
error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:94:10
--> $DIR/exhaustiveness-unreachable-pattern.rs:93:10
|
LL | [true
| ^^^^
error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:101:36
--> $DIR/exhaustiveness-unreachable-pattern.rs:100:36
|
LL | (true | false, None | Some(true
| ^^^^
error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:106:14
--> $DIR/exhaustiveness-unreachable-pattern.rs:105:14
|
LL | (true
| ^^^^
@ -143,25 +143,25 @@ LL | (true | false, None | Some(t_or_f!())) => {}
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:117:14
--> $DIR/exhaustiveness-unreachable-pattern.rs:116:14
|
LL | Some(0
| ^
error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:136:19
--> $DIR/exhaustiveness-unreachable-pattern.rs:135:19
|
LL | | false) => {}
| ^^^^^
error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:144:15
--> $DIR/exhaustiveness-unreachable-pattern.rs:143:15
|
LL | | true) => {}
| ^^^^
error: unreachable pattern
--> $DIR/exhaustiveness-unreachable-pattern.rs:150:15
--> $DIR/exhaustiveness-unreachable-pattern.rs:149:15
|
LL | | true,
| ^^^^

View file

@ -1,8 +0,0 @@
// Test feature gating for a sole leading `|` in `let`.
fn main() {}
#[cfg(FALSE)]
fn gated_leading_vert_in_let() {
for | A in 0 {} //~ ERROR or-patterns syntax is experimental
}

View file

@ -1,12 +0,0 @@
error[E0658]: or-patterns syntax is experimental
--> $DIR/feature-gate-or_patterns-leading-for.rs:7:9
|
LL | for | A in 0 {}
| ^
|
= note: see issue #54883 <https://github.com/rust-lang/rust/issues/54883> for more information
= help: add `#![feature(or_patterns)]` to the crate attributes to enable
error: aborting due to previous error
For more information about this error, try `rustc --explain E0658`.

View file

@ -1,9 +0,0 @@
// Test feature gating for a sole leading `|` in `let`.
fn main() {}
#[cfg(FALSE)]
fn gated_leading_vert_in_let() {
let | A; //~ ERROR or-patterns syntax is experimental
//~^ ERROR top-level or-patterns are not allowed
}

View file

@ -1,18 +0,0 @@
error: top-level or-patterns are not allowed in `let` bindings
--> $DIR/feature-gate-or_patterns-leading-let.rs:7:9
|
LL | let | A;
| ^^^ help: remove the `|`: `A`
error[E0658]: or-patterns syntax is experimental
--> $DIR/feature-gate-or_patterns-leading-let.rs:7:9
|
LL | let | A;
| ^
|
= note: see issue #54883 <https://github.com/rust-lang/rust/issues/54883> for more information
= help: add `#![feature(or_patterns)]` to the crate attributes to enable
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0658`.

View file

@ -1,54 +0,0 @@
fn main() {}
pub fn example(x: Option<usize>) {
match x {
Some(0 | 1 | 2) => {}
//~^ ERROR: or-patterns syntax is experimental
_ => {}
}
}
// Test the `pat` macro fragment parser:
macro_rules! accept_pat {
($p:pat) => {}
}
accept_pat!((p | q)); //~ ERROR or-patterns syntax is experimental
accept_pat!((p | q,)); //~ ERROR or-patterns syntax is experimental
accept_pat!(TS(p | q)); //~ ERROR or-patterns syntax is experimental
accept_pat!(NS { f: p | q }); //~ ERROR or-patterns syntax is experimental
accept_pat!([p | q]); //~ ERROR or-patterns syntax is experimental
// Non-macro tests:
#[cfg(FALSE)]
fn or_patterns() {
// Gated:
let | A | B; //~ ERROR or-patterns syntax is experimental
//~^ ERROR top-level or-patterns are not allowed
let A | B; //~ ERROR or-patterns syntax is experimental
//~^ ERROR top-level or-patterns are not allowed
for | A | B in 0 {} //~ ERROR or-patterns syntax is experimental
for A | B in 0 {} //~ ERROR or-patterns syntax is experimental
fn fun((A | B): _) {} //~ ERROR or-patterns syntax is experimental
let _ = |(A | B): u8| (); //~ ERROR or-patterns syntax is experimental
let (A | B); //~ ERROR or-patterns syntax is experimental
let (A | B,); //~ ERROR or-patterns syntax is experimental
let A(B | C); //~ ERROR or-patterns syntax is experimental
let E::V(B | C); //~ ERROR or-patterns syntax is experimental
let S { f1: B | C, f2 }; //~ ERROR or-patterns syntax is experimental
let E::V { f1: B | C, f2 }; //~ ERROR or-patterns syntax is experimental
let [A | B]; //~ ERROR or-patterns syntax is experimental
// Top level of `while`, `if`, and `match` arms are allowed:
while let | A = 0 {}
while let A | B = 0 {}
if let | A = 0 {}
if let A | B = 0 {}
match 0 {
| A => {},
A | B => {},
}
}

View file

@ -1,186 +0,0 @@
error: top-level or-patterns are not allowed in `let` bindings
--> $DIR/feature-gate-or_patterns.rs:28:9
|
LL | let | A | B;
| ^^^^^^^ help: wrap the pattern in parentheses: `(A | B)`
error: top-level or-patterns are not allowed in `let` bindings
--> $DIR/feature-gate-or_patterns.rs:30:9
|
LL | let A | B;
| ^^^^^ help: wrap the pattern in parentheses: `(A | B)`
error[E0658]: or-patterns syntax is experimental
--> $DIR/feature-gate-or_patterns.rs:5:14
|
LL | Some(0 | 1 | 2) => {}
| ^^^^^^^^^
|
= note: see issue #54883 <https://github.com/rust-lang/rust/issues/54883> for more information
= help: add `#![feature(or_patterns)]` to the crate attributes to enable
error[E0658]: or-patterns syntax is experimental
--> $DIR/feature-gate-or_patterns.rs:28:9
|
LL | let | A | B;
| ^^^^^^^
|
= note: see issue #54883 <https://github.com/rust-lang/rust/issues/54883> for more information
= help: add `#![feature(or_patterns)]` to the crate attributes to enable
error[E0658]: or-patterns syntax is experimental
--> $DIR/feature-gate-or_patterns.rs:30:9
|
LL | let A | B;
| ^^^^^
|
= note: see issue #54883 <https://github.com/rust-lang/rust/issues/54883> for more information
= help: add `#![feature(or_patterns)]` to the crate attributes to enable
error[E0658]: or-patterns syntax is experimental
--> $DIR/feature-gate-or_patterns.rs:32:9
|
LL | for | A | B in 0 {}
| ^^^^^^^
|
= note: see issue #54883 <https://github.com/rust-lang/rust/issues/54883> for more information
= help: add `#![feature(or_patterns)]` to the crate attributes to enable
error[E0658]: or-patterns syntax is experimental
--> $DIR/feature-gate-or_patterns.rs:33:9
|
LL | for A | B in 0 {}
| ^^^^^
|
= note: see issue #54883 <https://github.com/rust-lang/rust/issues/54883> for more information
= help: add `#![feature(or_patterns)]` to the crate attributes to enable
error[E0658]: or-patterns syntax is experimental
--> $DIR/feature-gate-or_patterns.rs:34:13
|
LL | fn fun((A | B): _) {}
| ^^^^^
|
= note: see issue #54883 <https://github.com/rust-lang/rust/issues/54883> for more information
= help: add `#![feature(or_patterns)]` to the crate attributes to enable
error[E0658]: or-patterns syntax is experimental
--> $DIR/feature-gate-or_patterns.rs:35:15
|
LL | let _ = |(A | B): u8| ();
| ^^^^^
|
= note: see issue #54883 <https://github.com/rust-lang/rust/issues/54883> for more information
= help: add `#![feature(or_patterns)]` to the crate attributes to enable
error[E0658]: or-patterns syntax is experimental
--> $DIR/feature-gate-or_patterns.rs:36:10
|
LL | let (A | B);
| ^^^^^
|
= note: see issue #54883 <https://github.com/rust-lang/rust/issues/54883> for more information
= help: add `#![feature(or_patterns)]` to the crate attributes to enable
error[E0658]: or-patterns syntax is experimental
--> $DIR/feature-gate-or_patterns.rs:37:10
|
LL | let (A | B,);
| ^^^^^
|
= note: see issue #54883 <https://github.com/rust-lang/rust/issues/54883> for more information
= help: add `#![feature(or_patterns)]` to the crate attributes to enable
error[E0658]: or-patterns syntax is experimental
--> $DIR/feature-gate-or_patterns.rs:38:11
|
LL | let A(B | C);
| ^^^^^
|
= note: see issue #54883 <https://github.com/rust-lang/rust/issues/54883> for more information
= help: add `#![feature(or_patterns)]` to the crate attributes to enable
error[E0658]: or-patterns syntax is experimental
--> $DIR/feature-gate-or_patterns.rs:39:14
|
LL | let E::V(B | C);
| ^^^^^
|
= note: see issue #54883 <https://github.com/rust-lang/rust/issues/54883> for more information
= help: add `#![feature(or_patterns)]` to the crate attributes to enable
error[E0658]: or-patterns syntax is experimental
--> $DIR/feature-gate-or_patterns.rs:40:17
|
LL | let S { f1: B | C, f2 };
| ^^^^^
|
= note: see issue #54883 <https://github.com/rust-lang/rust/issues/54883> for more information
= help: add `#![feature(or_patterns)]` to the crate attributes to enable
error[E0658]: or-patterns syntax is experimental
--> $DIR/feature-gate-or_patterns.rs:41:20
|
LL | let E::V { f1: B | C, f2 };
| ^^^^^
|
= note: see issue #54883 <https://github.com/rust-lang/rust/issues/54883> for more information
= help: add `#![feature(or_patterns)]` to the crate attributes to enable
error[E0658]: or-patterns syntax is experimental
--> $DIR/feature-gate-or_patterns.rs:42:10
|
LL | let [A | B];
| ^^^^^
|
= note: see issue #54883 <https://github.com/rust-lang/rust/issues/54883> for more information
= help: add `#![feature(or_patterns)]` to the crate attributes to enable
error[E0658]: or-patterns syntax is experimental
--> $DIR/feature-gate-or_patterns.rs:16:14
|
LL | accept_pat!((p | q));
| ^^^^^
|
= note: see issue #54883 <https://github.com/rust-lang/rust/issues/54883> for more information
= help: add `#![feature(or_patterns)]` to the crate attributes to enable
error[E0658]: or-patterns syntax is experimental
--> $DIR/feature-gate-or_patterns.rs:17:14
|
LL | accept_pat!((p | q,));
| ^^^^^
|
= note: see issue #54883 <https://github.com/rust-lang/rust/issues/54883> for more information
= help: add `#![feature(or_patterns)]` to the crate attributes to enable
error[E0658]: or-patterns syntax is experimental
--> $DIR/feature-gate-or_patterns.rs:18:16
|
LL | accept_pat!(TS(p | q));
| ^^^^^
|
= note: see issue #54883 <https://github.com/rust-lang/rust/issues/54883> for more information
= help: add `#![feature(or_patterns)]` to the crate attributes to enable
error[E0658]: or-patterns syntax is experimental
--> $DIR/feature-gate-or_patterns.rs:19:21
|
LL | accept_pat!(NS { f: p | q });
| ^^^^^
|
= note: see issue #54883 <https://github.com/rust-lang/rust/issues/54883> for more information
= help: add `#![feature(or_patterns)]` to the crate attributes to enable
error[E0658]: or-patterns syntax is experimental
--> $DIR/feature-gate-or_patterns.rs:20:14
|
LL | accept_pat!([p | q]);
| ^^^^^
|
= note: see issue #54883 <https://github.com/rust-lang/rust/issues/54883> for more information
= help: add `#![feature(or_patterns)]` to the crate attributes to enable
error: aborting due to 21 previous errors
For more information about this error, try `rustc --explain E0658`.

View file

@ -2,7 +2,6 @@
// run-rustfix
#![feature(or_patterns)]
#![allow(warnings)]
fn main() {}

View file

@ -2,7 +2,6 @@
// run-rustfix
#![feature(or_patterns)]
#![allow(warnings)]
fn main() {}

View file

@ -1,5 +1,5 @@
error: top-level or-patterns are not allowed in function parameters
--> $DIR/fn-param-wrap-parens.rs:14:9
--> $DIR/fn-param-wrap-parens.rs:13:9
|
LL | fn fun1(A | B: E) {}
| ^^^^^ help: wrap the pattern in parentheses: `(A | B)`

View file

@ -1,8 +1,6 @@
// Check that or patterns are lowered correctly in `for` loops.
// run-pass
#![feature(or_patterns)]
fn main() {
let v = vec![Ok(2), Err(3), Ok(5)];
let mut w = Vec::new();

View file

@ -1,8 +1,6 @@
// Check that or patterns are lowered correctly in `if let` and `while let` expressions.
// run-pass
#![feature(or_patterns)]
fn main() {
let mut opt = Some(3);
let mut w = Vec::new();

View file

@ -1,6 +1,5 @@
// This test ensures that or patterns require binding mode consistency across arms.
#![feature(or_patterns)]
#![allow(non_camel_case_types)]
fn main() {
// One level:

View file

@ -1,5 +1,5 @@
error[E0409]: variable `a` is bound inconsistently across alternatives separated by `|`
--> $DIR/inconsistent-modes.rs:7:26
--> $DIR/inconsistent-modes.rs:6:26
|
LL | let (Ok(a) | Err(ref a)): Result<&u8, u8> = Ok(&0);
| - ^ bound in different ways
@ -7,7 +7,7 @@ LL | let (Ok(a) | Err(ref a)): Result<&u8, u8> = Ok(&0);
| first binding
error[E0409]: variable `a` is bound inconsistently across alternatives separated by `|`
--> $DIR/inconsistent-modes.rs:9:30
--> $DIR/inconsistent-modes.rs:8:30
|
LL | let (Ok(ref mut a) | Err(a)): Result<u8, &mut u8> = Ok(0);
| - ^ bound in different ways
@ -15,25 +15,25 @@ LL | let (Ok(ref mut a) | Err(a)): Result<u8, &mut u8> = Ok(0);
| first binding
error[E0409]: variable `a` is bound inconsistently across alternatives separated by `|`
--> $DIR/inconsistent-modes.rs:11:34
--> $DIR/inconsistent-modes.rs:10:34
|
LL | let (Ok(ref a) | Err(ref mut a)): Result<&u8, &mut u8> = Ok(&0);
| - first binding ^ bound in different ways
error[E0409]: variable `a` is bound inconsistently across alternatives separated by `|`
--> $DIR/inconsistent-modes.rs:14:40
--> $DIR/inconsistent-modes.rs:13:40
|
LL | let (Ok((ref a, b)) | Err((ref mut a, ref b))) = Ok((0, &0));
| - first binding ^ bound in different ways
error[E0409]: variable `b` is bound inconsistently across alternatives separated by `|`
--> $DIR/inconsistent-modes.rs:14:47
--> $DIR/inconsistent-modes.rs:13:47
|
LL | let (Ok((ref a, b)) | Err((ref mut a, ref b))) = Ok((0, &0));
| - first binding ^ bound in different ways
error[E0409]: variable `a` is bound inconsistently across alternatives separated by `|`
--> $DIR/inconsistent-modes.rs:20:39
--> $DIR/inconsistent-modes.rs:19:39
|
LL | let (Ok(Ok(a) | Err(a)) | Err(ref a)) = Err(0);
| - ^ bound in different ways
@ -41,7 +41,7 @@ LL | let (Ok(Ok(a) | Err(a)) | Err(ref a)) = Err(0);
| first binding
error[E0409]: variable `a` is bound inconsistently across alternatives separated by `|`
--> $DIR/inconsistent-modes.rs:24:34
--> $DIR/inconsistent-modes.rs:23:34
|
LL | let (Ok([Ok((Ok(ref a) | Err(a),)) | Err(a)]) | Err(a)) = Err(&1);
| - ^ bound in different ways
@ -49,7 +49,7 @@ LL | let (Ok([Ok((Ok(ref a) | Err(a),)) | Err(a)]) | Err(a)) = Err(&1);
| first binding
error[E0308]: mismatched types
--> $DIR/inconsistent-modes.rs:11:26
--> $DIR/inconsistent-modes.rs:10:26
|
LL | let (Ok(ref a) | Err(ref mut a)): Result<&u8, &mut u8> = Ok(&0);
| ----- ^^^^^^^^^ -------------------- expected due to this
@ -62,7 +62,7 @@ LL | let (Ok(ref a) | Err(ref mut a)): Result<&u8, &mut u8> = Ok(&0);
= note: a binding must have the same type in all alternatives
error[E0308]: mismatched types
--> $DIR/inconsistent-modes.rs:14:32
--> $DIR/inconsistent-modes.rs:13:32
|
LL | let (Ok((ref a, b)) | Err((ref mut a, ref b))) = Ok((0, &0));
| ----- ^^^^^^^^^ ----------- this expression has type `Result<({integer}, &{integer}), (_, _)>`

View file

@ -2,8 +2,6 @@
// check-pass
#![feature(or_patterns)]
fn foo((Some(_) | None): Option<u32>) {}
fn main() {

View file

@ -1,7 +1,5 @@
// check-pass
#![feature(or_patterns)]
enum MyEnum {
FirstCase(u8),
OtherCase(u16),

View file

@ -1,5 +1,3 @@
#![feature(or_patterns)]
fn main() {
let (0 | (1 | 2)) = 0; //~ ERROR refutable pattern in local binding
match 0 {

View file

@ -1,5 +1,5 @@
error[E0005]: refutable pattern in local binding: `i32::MIN..=-1_i32` and `3_i32..=i32::MAX` not covered
--> $DIR/issue-69875-should-have-been-expanded-earlier-non-exhaustive.rs:4:10
--> $DIR/issue-69875-should-have-been-expanded-earlier-non-exhaustive.rs:2:10
|
LL | let (0 | (1 | 2)) = 0;
| ^^^^^^^^^^^ patterns `i32::MIN..=-1_i32` and `3_i32..=i32::MAX` not covered
@ -13,7 +13,7 @@ LL | if let (0 | (1 | 2)) = 0 { /* */ }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0004]: non-exhaustive patterns: `i32::MIN..=-1_i32` and `3_i32..=i32::MAX` not covered
--> $DIR/issue-69875-should-have-been-expanded-earlier-non-exhaustive.rs:5:11
--> $DIR/issue-69875-should-have-been-expanded-earlier-non-exhaustive.rs:3:11
|
LL | match 0 {
| ^ patterns `i32::MIN..=-1_i32` and `3_i32..=i32::MAX` not covered

View file

@ -1,7 +1,5 @@
// check-pass
#![feature(or_patterns)]
fn main() {
let (0 | (1 | _)) = 0;
if let 0 | (1 | 2) = 0 {}

View file

@ -2,7 +2,6 @@
#![deny(unreachable_patterns)]
#![feature(or_patterns)]
fn main() {
match (3,42) {
(a,_) | (_,a) if a > 10 => {println!("{}", a)}

View file

@ -1,5 +1,3 @@
#![feature(or_patterns)]
// run-pass
fn or_pat_let(x: Result<u32, u32>) -> u32 {

View file

@ -3,8 +3,6 @@
// ignore-test
// FIXME(mark-i-m): enable this test again when 2021 machinery is available
#![feature(or_patterns)]
use Foo::*;
#[derive(Eq, PartialEq, Debug)]

View file

@ -1,8 +1,6 @@
// Regression test for #71297
// edition:2018
#![feature(or_patterns)]
async fn a((x | s): String) {}
//~^ ERROR variable `x` is not bound in all patterns
//~| ERROR variable `s` is not bound in all patterns

View file

@ -1,5 +1,5 @@
error[E0408]: variable `s` is not bound in all patterns
--> $DIR/mismatched-bindings-async-fn.rs:6:13
--> $DIR/mismatched-bindings-async-fn.rs:4:13
|
LL | async fn a((x | s): String) {}
| ^ - variable not in all patterns
@ -7,7 +7,7 @@ LL | async fn a((x | s): String) {}
| pattern doesn't bind `s`
error[E0408]: variable `x` is not bound in all patterns
--> $DIR/mismatched-bindings-async-fn.rs:6:17
--> $DIR/mismatched-bindings-async-fn.rs:4:17
|
LL | async fn a((x | s): String) {}
| - ^ pattern doesn't bind `x`
@ -15,7 +15,7 @@ LL | async fn a((x | s): String) {}
| variable not in all patterns
error[E0408]: variable `s` is not bound in all patterns
--> $DIR/mismatched-bindings-async-fn.rs:11:10
--> $DIR/mismatched-bindings-async-fn.rs:9:10
|
LL | let (x | s) = String::new();
| ^ - variable not in all patterns
@ -23,7 +23,7 @@ LL | let (x | s) = String::new();
| pattern doesn't bind `s`
error[E0408]: variable `x` is not bound in all patterns
--> $DIR/mismatched-bindings-async-fn.rs:11:14
--> $DIR/mismatched-bindings-async-fn.rs:9:14
|
LL | let (x | s) = String::new();
| - ^ pattern doesn't bind `x`

View file

@ -2,7 +2,6 @@
// edition:2018
#![feature(or_patterns)]
#![allow(non_camel_case_types)]
fn main() {}

View file

@ -1,5 +1,5 @@
error[E0408]: variable `beta` is not bound in all patterns
--> $DIR/missing-bindings.rs:20:10
--> $DIR/missing-bindings.rs:19:10
|
LL | let (alpha | beta | charlie) = alpha;
| ^^^^^ ---- ^^^^^^^ pattern doesn't bind `beta`
@ -8,7 +8,7 @@ LL | let (alpha | beta | charlie) = alpha;
| pattern doesn't bind `beta`
error[E0408]: variable `beta` is not bound in all patterns
--> $DIR/missing-bindings.rs:22:14
--> $DIR/missing-bindings.rs:21:14
|
LL | Some(alpha | beta) => {}
| ^^^^^ ---- variable not in all patterns
@ -16,7 +16,7 @@ LL | Some(alpha | beta) => {}
| pattern doesn't bind `beta`
error[E0408]: variable `a` is not bound in all patterns
--> $DIR/missing-bindings.rs:34:20
--> $DIR/missing-bindings.rs:33:20
|
LL | let (A(a, _) | _) = X;
| - ^ pattern doesn't bind `a`
@ -24,7 +24,7 @@ LL | let (A(a, _) | _) = X;
| variable not in all patterns
error[E0408]: variable `a` is not bound in all patterns
--> $DIR/missing-bindings.rs:35:10
--> $DIR/missing-bindings.rs:34:10
|
LL | let (_ | B(a)) = X;
| ^ - variable not in all patterns
@ -32,7 +32,7 @@ LL | let (_ | B(a)) = X;
| pattern doesn't bind `a`
error[E0408]: variable `a` is not bound in all patterns
--> $DIR/missing-bindings.rs:36:10
--> $DIR/missing-bindings.rs:35:10
|
LL | let (A(..) | B(a)) = X;
| ^^^^^ - variable not in all patterns
@ -40,7 +40,7 @@ LL | let (A(..) | B(a)) = X;
| pattern doesn't bind `a`
error[E0408]: variable `a` is not bound in all patterns
--> $DIR/missing-bindings.rs:37:20
--> $DIR/missing-bindings.rs:36:20
|
LL | let (A(a, _) | B(_)) = X;
| - ^^^^ pattern doesn't bind `a`
@ -48,7 +48,7 @@ LL | let (A(a, _) | B(_)) = X;
| variable not in all patterns
error[E0408]: variable `a` is not bound in all patterns
--> $DIR/missing-bindings.rs:38:20
--> $DIR/missing-bindings.rs:37:20
|
LL | let (A(_, a) | B(_)) = X;
| - ^^^^ pattern doesn't bind `a`
@ -56,7 +56,7 @@ LL | let (A(_, a) | B(_)) = X;
| variable not in all patterns
error[E0408]: variable `b` is not bound in all patterns
--> $DIR/missing-bindings.rs:39:20
--> $DIR/missing-bindings.rs:38:20
|
LL | let (A(a, b) | B(a)) = X;
| - ^^^^ pattern doesn't bind `b`
@ -64,7 +64,7 @@ LL | let (A(a, b) | B(a)) = X;
| variable not in all patterns
error[E0408]: variable `a` is not bound in all patterns
--> $DIR/missing-bindings.rs:43:10
--> $DIR/missing-bindings.rs:42:10
|
LL | let (A(A(..) | B(_), _) | B(a)) = Y;
| ^^^^^^^^^^^^^^^^^^ - variable not in all patterns
@ -72,7 +72,7 @@ LL | let (A(A(..) | B(_), _) | B(a)) = Y;
| pattern doesn't bind `a`
error[E0408]: variable `a` is not bound in all patterns
--> $DIR/missing-bindings.rs:44:12
--> $DIR/missing-bindings.rs:43:12
|
LL | let (A(A(..) | B(a), _) | B(A(a, _) | B(a))) = Y;
| ^^^^^ - variable not in all patterns
@ -80,7 +80,7 @@ LL | let (A(A(..) | B(a), _) | B(A(a, _) | B(a))) = Y;
| pattern doesn't bind `a`
error[E0408]: variable `a` is not bound in all patterns
--> $DIR/missing-bindings.rs:46:22
--> $DIR/missing-bindings.rs:45:22
|
LL | let (A(A(a, b) | B(c), d) | B(e)) = Y;
| - ^^^^ pattern doesn't bind `a`
@ -88,7 +88,7 @@ LL | let (A(A(a, b) | B(c), d) | B(e)) = Y;
| variable not in all patterns
error[E0408]: variable `b` is not bound in all patterns
--> $DIR/missing-bindings.rs:46:22
--> $DIR/missing-bindings.rs:45:22
|
LL | let (A(A(a, b) | B(c), d) | B(e)) = Y;
| - ^^^^ pattern doesn't bind `b`
@ -96,7 +96,7 @@ LL | let (A(A(a, b) | B(c), d) | B(e)) = Y;
| variable not in all patterns
error[E0408]: variable `c` is not bound in all patterns
--> $DIR/missing-bindings.rs:46:12
--> $DIR/missing-bindings.rs:45:12
|
LL | let (A(A(a, b) | B(c), d) | B(e)) = Y;
| ^^^^^^^ - variable not in all patterns
@ -104,7 +104,7 @@ LL | let (A(A(a, b) | B(c), d) | B(e)) = Y;
| pattern doesn't bind `c`
error[E0408]: variable `a` is not bound in all patterns
--> $DIR/missing-bindings.rs:46:33
--> $DIR/missing-bindings.rs:45:33
|
LL | let (A(A(a, b) | B(c), d) | B(e)) = Y;
| - ^^^^ pattern doesn't bind `a`
@ -112,7 +112,7 @@ LL | let (A(A(a, b) | B(c), d) | B(e)) = Y;
| variable not in all patterns
error[E0408]: variable `b` is not bound in all patterns
--> $DIR/missing-bindings.rs:46:33
--> $DIR/missing-bindings.rs:45:33
|
LL | let (A(A(a, b) | B(c), d) | B(e)) = Y;
| - ^^^^ pattern doesn't bind `b`
@ -120,7 +120,7 @@ LL | let (A(A(a, b) | B(c), d) | B(e)) = Y;
| variable not in all patterns
error[E0408]: variable `c` is not bound in all patterns
--> $DIR/missing-bindings.rs:46:33
--> $DIR/missing-bindings.rs:45:33
|
LL | let (A(A(a, b) | B(c), d) | B(e)) = Y;
| - ^^^^ pattern doesn't bind `c`
@ -128,7 +128,7 @@ LL | let (A(A(a, b) | B(c), d) | B(e)) = Y;
| variable not in all patterns
error[E0408]: variable `d` is not bound in all patterns
--> $DIR/missing-bindings.rs:46:33
--> $DIR/missing-bindings.rs:45:33
|
LL | let (A(A(a, b) | B(c), d) | B(e)) = Y;
| - ^^^^ pattern doesn't bind `d`
@ -136,7 +136,7 @@ LL | let (A(A(a, b) | B(c), d) | B(e)) = Y;
| variable not in all patterns
error[E0408]: variable `e` is not bound in all patterns
--> $DIR/missing-bindings.rs:46:10
--> $DIR/missing-bindings.rs:45:10
|
LL | let (A(A(a, b) | B(c), d) | B(e)) = Y;
| ^^^^^^^^^^^^^^^^^^^^ - variable not in all patterns
@ -144,7 +144,7 @@ LL | let (A(A(a, b) | B(c), d) | B(e)) = Y;
| pattern doesn't bind `e`
error[E0408]: variable `a` is not bound in all patterns
--> $DIR/missing-bindings.rs:62:29
--> $DIR/missing-bindings.rs:61:29
|
LL | Ok(a) | Err(_),
| - ^^^^^^ pattern doesn't bind `a`
@ -152,7 +152,7 @@ LL | Ok(a) | Err(_),
| variable not in all patterns
error[E0408]: variable `a` is not bound in all patterns
--> $DIR/missing-bindings.rs:70:21
--> $DIR/missing-bindings.rs:69:21
|
LL | A(_, a) |
| - variable not in all patterns
@ -160,7 +160,7 @@ LL | B(b),
| ^^^^ pattern doesn't bind `a`
error[E0408]: variable `b` is not bound in all patterns
--> $DIR/missing-bindings.rs:69:21
--> $DIR/missing-bindings.rs:68:21
|
LL | A(_, a) |
| ^^^^^^^ pattern doesn't bind `b`
@ -168,7 +168,7 @@ LL | B(b),
| - variable not in all patterns
error[E0408]: variable `a` is not bound in all patterns
--> $DIR/missing-bindings.rs:73:17
--> $DIR/missing-bindings.rs:72:17
|
LL | A(_, a) |
| - variable not in all patterns
@ -177,7 +177,7 @@ LL | B(_)
| ^^^^ pattern doesn't bind `a`
error[E0408]: variable `b` is not bound in all patterns
--> $DIR/missing-bindings.rs:73:17
--> $DIR/missing-bindings.rs:72:17
|
LL | B(b),
| - variable not in all patterns
@ -186,7 +186,7 @@ LL | B(_)
| ^^^^ pattern doesn't bind `b`
error[E0408]: variable `a` is not bound in all patterns
--> $DIR/missing-bindings.rs:77:13
--> $DIR/missing-bindings.rs:76:13
|
LL | B(Ok(a) | Err(a))
| - variable not in all patterns
@ -198,7 +198,7 @@ LL | V3(c),
| ^^^^^ pattern doesn't bind `a`
error[E0408]: variable `b` is not bound in all patterns
--> $DIR/missing-bindings.rs:58:13
--> $DIR/missing-bindings.rs:57:13
|
LL | / V1(
LL | |
@ -216,7 +216,7 @@ LL | V3(c),
| ^^^^^ pattern doesn't bind `b`
error[E0408]: variable `c` is not bound in all patterns
--> $DIR/missing-bindings.rs:58:13
--> $DIR/missing-bindings.rs:57:13
|
LL | / V1(
LL | |

View file

@ -4,7 +4,6 @@
// 2) or-patterns should work with simplifyable patterns.
// run-pass
#![feature(or_patterns)]
pub fn test(x: Option<usize>) -> bool {
match x {

View file

@ -1,4 +1,4 @@
#![feature(or_patterns)]
//! Test for `||` in or-patterns
fn main() {
let x = 3;

View file

@ -1,8 +1,6 @@
// Here we test type checking of bindings when combined with or-patterns.
// Specifically, we ensure that introducing bindings of different types result in type errors.
#![feature(or_patterns)]
fn main() {
enum Blah {
A(isize, isize, usize),

View file

@ -1,5 +1,5 @@
error[E0308]: mismatched types
--> $DIR/or-patterns-binding-type-mismatch.rs:13:39
--> $DIR/or-patterns-binding-type-mismatch.rs:11:39
|
LL | match Blah::A(1, 1, 2) {
| ---------------- this expression has type `Blah`
@ -11,7 +11,7 @@ LL | Blah::A(_, x, y) | Blah::B(x, y) => {}
= note: in the same arm, a binding must have the same type in all alternatives
error[E0308]: mismatched types
--> $DIR/or-patterns-binding-type-mismatch.rs:17:44
--> $DIR/or-patterns-binding-type-mismatch.rs:15:44
|
LL | match Some(Blah::A(1, 1, 2)) {
| ---------------------- this expression has type `Option<Blah>`
@ -23,7 +23,7 @@ LL | Some(Blah::A(_, x, y) | Blah::B(x, y)) => {}
= note: in the same arm, a binding must have the same type in all alternatives
error[E0308]: mismatched types
--> $DIR/or-patterns-binding-type-mismatch.rs:21:19
--> $DIR/or-patterns-binding-type-mismatch.rs:19:19
|
LL | match (0u8, 1u16) {
| ----------- this expression has type `(u8, u16)`
@ -35,7 +35,7 @@ LL | (x, y) | (y, x) => {}
= note: in the same arm, a binding must have the same type in all alternatives
error[E0308]: mismatched types
--> $DIR/or-patterns-binding-type-mismatch.rs:21:22
--> $DIR/or-patterns-binding-type-mismatch.rs:19:22
|
LL | match (0u8, 1u16) {
| ----------- this expression has type `(u8, u16)`
@ -47,7 +47,7 @@ LL | (x, y) | (y, x) => {}
= note: in the same arm, a binding must have the same type in all alternatives
error[E0308]: mismatched types
--> $DIR/or-patterns-binding-type-mismatch.rs:26:41
--> $DIR/or-patterns-binding-type-mismatch.rs:24:41
|
LL | match Some((0u8, Some((1u16, 2u32)))) {
| ------------------------------- this expression has type `Option<(u8, Option<(u16, u32)>)>`
@ -59,7 +59,7 @@ LL | Some((x, Some((y, z)))) | Some((y, Some((x, z) | (z, x)))) => {}
= note: in the same arm, a binding must have the same type in all alternatives
error[E0308]: mismatched types
--> $DIR/or-patterns-binding-type-mismatch.rs:26:50
--> $DIR/or-patterns-binding-type-mismatch.rs:24:50
|
LL | match Some((0u8, Some((1u16, 2u32)))) {
| ------------------------------- this expression has type `Option<(u8, Option<(u16, u32)>)>`
@ -71,7 +71,7 @@ LL | Some((x, Some((y, z)))) | Some((y, Some((x, z) | (z, x)))) => {}
= note: in the same arm, a binding must have the same type in all alternatives
error[E0308]: mismatched types
--> $DIR/or-patterns-binding-type-mismatch.rs:26:59
--> $DIR/or-patterns-binding-type-mismatch.rs:24:59
|
LL | match Some((0u8, Some((1u16, 2u32)))) {
| ------------------------------- this expression has type `Option<(u8, Option<(u16, u32)>)>`
@ -83,7 +83,7 @@ LL | Some((x, Some((y, z)))) | Some((y, Some((x, z) | (z, x)))) => {}
= note: in the same arm, a binding must have the same type in all alternatives
error[E0308]: mismatched types
--> $DIR/or-patterns-binding-type-mismatch.rs:26:62
--> $DIR/or-patterns-binding-type-mismatch.rs:24:62
|
LL | match Some((0u8, Some((1u16, 2u32)))) {
| ------------------------------- this expression has type `Option<(u8, Option<(u16, u32)>)>`
@ -93,7 +93,7 @@ LL | Some((x, Some((y, z)))) | Some((y, Some((x, z) | (z, x)))) => {}
= note: in the same arm, a binding must have the same type in all alternatives
error[E0308]: mismatched types
--> $DIR/or-patterns-binding-type-mismatch.rs:34:42
--> $DIR/or-patterns-binding-type-mismatch.rs:32:42
|
LL | if let Blah::A(_, x, y) | Blah::B(x, y) = Blah::A(1, 1, 2) {
| - ^ ---------------- this expression has type `Blah`
@ -104,7 +104,7 @@ LL | if let Blah::A(_, x, y) | Blah::B(x, y) = Blah::A(1, 1, 2) {
= note: a binding must have the same type in all alternatives
error[E0308]: mismatched types
--> $DIR/or-patterns-binding-type-mismatch.rs:38:47
--> $DIR/or-patterns-binding-type-mismatch.rs:36:47
|
LL | if let Some(Blah::A(_, x, y) | Blah::B(x, y)) = Some(Blah::A(1, 1, 2)) {
| - ^ ---------------------- this expression has type `Option<Blah>`
@ -115,7 +115,7 @@ LL | if let Some(Blah::A(_, x, y) | Blah::B(x, y)) = Some(Blah::A(1, 1, 2))
= note: a binding must have the same type in all alternatives
error[E0308]: mismatched types
--> $DIR/or-patterns-binding-type-mismatch.rs:42:22
--> $DIR/or-patterns-binding-type-mismatch.rs:40:22
|
LL | if let (x, y) | (y, x) = (0u8, 1u16) {
| - ^ ----------- this expression has type `(u8, u16)`
@ -126,7 +126,7 @@ LL | if let (x, y) | (y, x) = (0u8, 1u16) {
= note: a binding must have the same type in all alternatives
error[E0308]: mismatched types
--> $DIR/or-patterns-binding-type-mismatch.rs:42:25
--> $DIR/or-patterns-binding-type-mismatch.rs:40:25
|
LL | if let (x, y) | (y, x) = (0u8, 1u16) {
| - ^ ----------- this expression has type `(u8, u16)`
@ -137,7 +137,7 @@ LL | if let (x, y) | (y, x) = (0u8, 1u16) {
= note: a binding must have the same type in all alternatives
error[E0308]: mismatched types
--> $DIR/or-patterns-binding-type-mismatch.rs:47:44
--> $DIR/or-patterns-binding-type-mismatch.rs:45:44
|
LL | if let Some((x, Some((y, z)))) | Some((y, Some((x, z) | (z, x))))
| - ^ expected `u16`, found `u8`
@ -150,7 +150,7 @@ LL | = Some((0u8, Some((1u16, 2u32))))
= note: a binding must have the same type in all alternatives
error[E0308]: mismatched types
--> $DIR/or-patterns-binding-type-mismatch.rs:47:53
--> $DIR/or-patterns-binding-type-mismatch.rs:45:53
|
LL | if let Some((x, Some((y, z)))) | Some((y, Some((x, z) | (z, x))))
| - ^ expected `u8`, found `u16`
@ -163,7 +163,7 @@ LL | = Some((0u8, Some((1u16, 2u32))))
= note: a binding must have the same type in all alternatives
error[E0308]: mismatched types
--> $DIR/or-patterns-binding-type-mismatch.rs:47:62
--> $DIR/or-patterns-binding-type-mismatch.rs:45:62
|
LL | if let Some((x, Some((y, z)))) | Some((y, Some((x, z) | (z, x))))
| - ^ expected `u32`, found `u16`
@ -176,7 +176,7 @@ LL | = Some((0u8, Some((1u16, 2u32))))
= note: a binding must have the same type in all alternatives
error[E0308]: mismatched types
--> $DIR/or-patterns-binding-type-mismatch.rs:47:65
--> $DIR/or-patterns-binding-type-mismatch.rs:45:65
|
LL | if let Some((x, Some((y, z)))) | Some((y, Some((x, z) | (z, x))))
| - first introduced with type `u8` here ^ expected `u8`, found `u32`
@ -187,7 +187,7 @@ LL | = Some((0u8, Some((1u16, 2u32))))
= note: a binding must have the same type in all alternatives
error[E0308]: mismatched types
--> $DIR/or-patterns-binding-type-mismatch.rs:55:40
--> $DIR/or-patterns-binding-type-mismatch.rs:53:40
|
LL | let (Blah::A(_, x, y) | Blah::B(x, y)) = Blah::A(1, 1, 2);
| - ^ ---------------- this expression has type `Blah`
@ -198,7 +198,7 @@ LL | let (Blah::A(_, x, y) | Blah::B(x, y)) = Blah::A(1, 1, 2);
= note: a binding must have the same type in all alternatives
error[E0308]: mismatched types
--> $DIR/or-patterns-binding-type-mismatch.rs:58:20
--> $DIR/or-patterns-binding-type-mismatch.rs:56:20
|
LL | let ((x, y) | (y, x)) = (0u8, 1u16);
| - ^ ----------- this expression has type `(u8, u16)`
@ -209,7 +209,7 @@ LL | let ((x, y) | (y, x)) = (0u8, 1u16);
= note: a binding must have the same type in all alternatives
error[E0308]: mismatched types
--> $DIR/or-patterns-binding-type-mismatch.rs:58:23
--> $DIR/or-patterns-binding-type-mismatch.rs:56:23
|
LL | let ((x, y) | (y, x)) = (0u8, 1u16);
| - ^ ----------- this expression has type `(u8, u16)`
@ -220,7 +220,7 @@ LL | let ((x, y) | (y, x)) = (0u8, 1u16);
= note: a binding must have the same type in all alternatives
error[E0308]: mismatched types
--> $DIR/or-patterns-binding-type-mismatch.rs:62:42
--> $DIR/or-patterns-binding-type-mismatch.rs:60:42
|
LL | fn f1((Blah::A(_, x, y) | Blah::B(x, y)): Blah) {}
| - ^ ---- expected due to this
@ -231,7 +231,7 @@ LL | fn f1((Blah::A(_, x, y) | Blah::B(x, y)): Blah) {}
= note: a binding must have the same type in all alternatives
error[E0308]: mismatched types
--> $DIR/or-patterns-binding-type-mismatch.rs:65:22
--> $DIR/or-patterns-binding-type-mismatch.rs:63:22
|
LL | fn f2(((x, y) | (y, x)): (u8, u16)) {}
| - ^ --------- expected due to this
@ -242,7 +242,7 @@ LL | fn f2(((x, y) | (y, x)): (u8, u16)) {}
= note: a binding must have the same type in all alternatives
error[E0308]: mismatched types
--> $DIR/or-patterns-binding-type-mismatch.rs:65:25
--> $DIR/or-patterns-binding-type-mismatch.rs:63:25
|
LL | fn f2(((x, y) | (y, x)): (u8, u16)) {}
| - ^ --------- expected due to this

View file

@ -2,7 +2,6 @@
// check-pass
#![feature(or_patterns)]
#![allow(irrefutable_let_patterns)]
fn main() {

View file

@ -1,8 +1,6 @@
// Test some cases where or-patterns may ostensibly be allowed but are in fact not.
// This is not a semantic test. We only test parsing.
#![feature(or_patterns)]
fn main() {}
enum E { A, B }

View file

@ -1,29 +1,29 @@
error: top-level or-patterns are not allowed in function parameters
--> $DIR/or-patterns-syntactic-fail.rs:17:13
--> $DIR/or-patterns-syntactic-fail.rs:15:13
|
LL | fn fun1(A | B: E) {}
| ^^^^^ help: wrap the pattern in parentheses: `(A | B)`
error: top-level or-patterns are not allowed in function parameters
--> $DIR/or-patterns-syntactic-fail.rs:20:13
--> $DIR/or-patterns-syntactic-fail.rs:18:13
|
LL | fn fun2(| A | B: E) {}
| ^^^^^^^ help: wrap the pattern in parentheses: `(A | B)`
error: top-level or-patterns are not allowed in `let` bindings
--> $DIR/or-patterns-syntactic-fail.rs:25:9
--> $DIR/or-patterns-syntactic-fail.rs:23:9
|
LL | let A | B: E = A;
| ^^^^^ help: wrap the pattern in parentheses: `(A | B)`
error: top-level or-patterns are not allowed in `let` bindings
--> $DIR/or-patterns-syntactic-fail.rs:28:9
--> $DIR/or-patterns-syntactic-fail.rs:26:9
|
LL | let | A | B: E = A;
| ^^^^^^^ help: wrap the pattern in parentheses: `(A | B)`
error[E0369]: no implementation for `E | ()`
--> $DIR/or-patterns-syntactic-fail.rs:13:22
--> $DIR/or-patterns-syntactic-fail.rs:11:22
|
LL | let _ = |A | B: E| ();
| ----^ -- ()

View file

@ -3,8 +3,6 @@
// check-pass
#![feature(or_patterns)]
fn main() {}
// Test the `pat` macro fragment parser:

View file

@ -2,7 +2,6 @@
// run-rustfix
#![feature(or_patterns)]
#![allow(warnings)]
fn main() {}

View file

@ -2,7 +2,6 @@
// run-rustfix
#![feature(or_patterns)]
#![allow(warnings)]
fn main() {}

View file

@ -1,11 +1,11 @@
error: top-level or-patterns are not allowed in function parameters
--> $DIR/remove-leading-vert.rs:12:14
--> $DIR/remove-leading-vert.rs:11:14
|
LL | fn fun1( | A: E) {}
| ^^^ help: remove the `|`: `A`
error: unexpected `||` before function parameter
--> $DIR/remove-leading-vert.rs:13:14
--> $DIR/remove-leading-vert.rs:12:14
|
LL | fn fun2( || A: E) {}
| ^^ help: remove the `||`
@ -13,31 +13,31 @@ LL | fn fun2( || A: E) {}
= note: alternatives in or-patterns are separated with `|`, not `||`
error: unexpected token `||` in pattern
--> $DIR/remove-leading-vert.rs:15:11
--> $DIR/remove-leading-vert.rs:14:11
|
LL | let ( || A): (E);
| ^^ help: use a single `|` to separate multiple alternative patterns: `|`
error: unexpected token `||` in pattern
--> $DIR/remove-leading-vert.rs:18:11
--> $DIR/remove-leading-vert.rs:17:11
|
LL | let [ || A ]: [E; 1];
| ^^ help: use a single `|` to separate multiple alternative patterns: `|`
error: unexpected token `||` in pattern
--> $DIR/remove-leading-vert.rs:20:13
--> $DIR/remove-leading-vert.rs:19:13
|
LL | let TS( || A ): TS;
| ^^ help: use a single `|` to separate multiple alternative patterns: `|`
error: unexpected token `||` in pattern
--> $DIR/remove-leading-vert.rs:22:17
--> $DIR/remove-leading-vert.rs:21:17
|
LL | let NS { f: || A }: NS;
| ^^ help: use a single `|` to separate multiple alternative patterns: `|`
error: a trailing `|` is not allowed in an or-pattern
--> $DIR/remove-leading-vert.rs:27:13
--> $DIR/remove-leading-vert.rs:26:13
|
LL | let ( A | ): E;
| - ^ help: remove the `|`
@ -45,7 +45,7 @@ LL | let ( A | ): E;
| while parsing this or-pattern starting here
error: a trailing `|` is not allowed in an or-pattern
--> $DIR/remove-leading-vert.rs:28:12
--> $DIR/remove-leading-vert.rs:27:12
|
LL | let (a |,): (E,);
| - ^ help: remove the `|`
@ -53,7 +53,7 @@ LL | let (a |,): (E,);
| while parsing this or-pattern starting here
error: a trailing `|` is not allowed in an or-pattern
--> $DIR/remove-leading-vert.rs:29:17
--> $DIR/remove-leading-vert.rs:28:17
|
LL | let ( A | B | ): E;
| - ^ help: remove the `|`
@ -61,7 +61,7 @@ LL | let ( A | B | ): E;
| while parsing this or-pattern starting here
error: a trailing `|` is not allowed in an or-pattern
--> $DIR/remove-leading-vert.rs:30:17
--> $DIR/remove-leading-vert.rs:29:17
|
LL | let [ A | B | ]: [E; 1];
| - ^ help: remove the `|`
@ -69,7 +69,7 @@ LL | let [ A | B | ]: [E; 1];
| while parsing this or-pattern starting here
error: a trailing `|` is not allowed in an or-pattern
--> $DIR/remove-leading-vert.rs:31:18
--> $DIR/remove-leading-vert.rs:30:18
|
LL | let S { f: B | };
| - ^ help: remove the `|`
@ -77,7 +77,7 @@ LL | let S { f: B | };
| while parsing this or-pattern starting here
error: unexpected token `||` in pattern
--> $DIR/remove-leading-vert.rs:32:13
--> $DIR/remove-leading-vert.rs:31:13
|
LL | let ( A || B | ): E;
| - ^^ help: use a single `|` to separate multiple alternative patterns: `|`
@ -85,7 +85,7 @@ LL | let ( A || B | ): E;
| while parsing this or-pattern starting here
error: a trailing `|` is not allowed in an or-pattern
--> $DIR/remove-leading-vert.rs:32:18
--> $DIR/remove-leading-vert.rs:31:18
|
LL | let ( A || B | ): E;
| - ^ help: remove the `|`
@ -93,7 +93,7 @@ LL | let ( A || B | ): E;
| while parsing this or-pattern starting here
error: a trailing `|` is not allowed in an or-pattern
--> $DIR/remove-leading-vert.rs:35:11
--> $DIR/remove-leading-vert.rs:34:11
|
LL | A | => {}
| - ^ help: remove the `|`
@ -101,7 +101,7 @@ LL | A | => {}
| while parsing this or-pattern starting here
error: a trailing `|` is not allowed in an or-pattern
--> $DIR/remove-leading-vert.rs:36:11
--> $DIR/remove-leading-vert.rs:35:11
|
LL | A || => {}
| - ^^ help: remove the `||`
@ -111,7 +111,7 @@ LL | A || => {}
= note: alternatives in or-patterns are separated with `|`, not `||`
error: unexpected token `||` in pattern
--> $DIR/remove-leading-vert.rs:37:11
--> $DIR/remove-leading-vert.rs:36:11
|
LL | A || B | => {}
| - ^^ help: use a single `|` to separate multiple alternative patterns: `|`
@ -119,7 +119,7 @@ LL | A || B | => {}
| while parsing this or-pattern starting here
error: a trailing `|` is not allowed in an or-pattern
--> $DIR/remove-leading-vert.rs:37:16
--> $DIR/remove-leading-vert.rs:36:16
|
LL | A || B | => {}
| - ^ help: remove the `|`
@ -127,7 +127,7 @@ LL | A || B | => {}
| while parsing this or-pattern starting here
error: a trailing `|` is not allowed in an or-pattern
--> $DIR/remove-leading-vert.rs:39:17
--> $DIR/remove-leading-vert.rs:38:17
|
LL | | A | B | => {}
| - ^ help: remove the `|`
@ -135,7 +135,7 @@ LL | | A | B | => {}
| while parsing this or-pattern starting here
error: a trailing `|` is not allowed in an or-pattern
--> $DIR/remove-leading-vert.rs:46:11
--> $DIR/remove-leading-vert.rs:45:11
|
LL | let a | : u8 = 0;
| - ^ help: remove the `|`
@ -143,7 +143,7 @@ LL | let a | : u8 = 0;
| while parsing this or-pattern starting here
error: a trailing `|` is not allowed in an or-pattern
--> $DIR/remove-leading-vert.rs:47:11
--> $DIR/remove-leading-vert.rs:46:11
|
LL | let a | = 0;
| - ^ help: remove the `|`
@ -151,7 +151,7 @@ LL | let a | = 0;
| while parsing this or-pattern starting here
error: a trailing `|` is not allowed in an or-pattern
--> $DIR/remove-leading-vert.rs:48:11
--> $DIR/remove-leading-vert.rs:47:11
|
LL | let a | ;
| - ^ help: remove the `|`

View file

@ -2,8 +2,6 @@
// run-pass
#![feature(or_patterns)]
fn search(target: (bool, bool, bool)) -> u32 {
let x = ((false, true), (false, true), (false, true));
let mut guard_count = 0;

View file

@ -2,8 +2,6 @@
// run-pass
#![feature(or_patterns)]
#[derive(Debug, PartialEq)]
enum MatchArm {
Arm(usize),

View file

@ -1,7 +1,5 @@
// run-pass
#![feature(or_patterns)]
#[derive(Debug)]
enum Other {
One,

View file

@ -3,7 +3,6 @@
// run-pass
#![feature(bindings_after_at)]
#![feature(or_patterns)]
#![feature(box_patterns)]
#[derive(Debug, PartialEq)]

View file

@ -3,7 +3,6 @@
// run-pass
#![feature(bindings_after_at)]
#![feature(or_patterns)]
#[derive(Debug, PartialEq)]
enum MatchArm {

View file

@ -3,7 +3,6 @@
// run-pass
#![feature(bindings_after_at)]
#![feature(or_patterns)]
#[derive(Debug, PartialEq)]
enum MatchArm {

View file

@ -2,7 +2,6 @@
// The code that is tested here lives in resolve (see `resolve_pattern_inner`).
#![feature(bindings_after_at)]
#![feature(or_patterns)]
fn main() {
fn f(a @ a @ a: ()) {}

View file

@ -1,59 +1,59 @@
error[E0415]: identifier `a` is bound more than once in this parameter list
--> $DIR/pat-at-same-name-both.rs:8:14
--> $DIR/pat-at-same-name-both.rs:7:14
|
LL | fn f(a @ a @ a: ()) {}
| ^ used as parameter more than once
error[E0415]: identifier `a` is bound more than once in this parameter list
--> $DIR/pat-at-same-name-both.rs:8:18
--> $DIR/pat-at-same-name-both.rs:7:18
|
LL | fn f(a @ a @ a: ()) {}
| ^ used as parameter more than once
error[E0416]: identifier `a` is bound more than once in the same pattern
--> $DIR/pat-at-same-name-both.rs:13:20
--> $DIR/pat-at-same-name-both.rs:12:20
|
LL | Ok(a @ b @ a)
| ^ used in a pattern more than once
error[E0416]: identifier `a` is bound more than once in the same pattern
--> $DIR/pat-at-same-name-both.rs:15:23
--> $DIR/pat-at-same-name-both.rs:14:23
|
LL | | Err(a @ b @ a)
| ^ used in a pattern more than once
error[E0416]: identifier `a` is bound more than once in the same pattern
--> $DIR/pat-at-same-name-both.rs:20:13
--> $DIR/pat-at-same-name-both.rs:19:13
|
LL | let a @ a @ a = ();
| ^ used in a pattern more than once
error[E0416]: identifier `a` is bound more than once in the same pattern
--> $DIR/pat-at-same-name-both.rs:20:17
--> $DIR/pat-at-same-name-both.rs:19:17
|
LL | let a @ a @ a = ();
| ^ used in a pattern more than once
error[E0416]: identifier `a` is bound more than once in the same pattern
--> $DIR/pat-at-same-name-both.rs:23:21
--> $DIR/pat-at-same-name-both.rs:22:21
|
LL | let ref a @ ref a = ();
| ^ used in a pattern more than once
error[E0416]: identifier `a` is bound more than once in the same pattern
--> $DIR/pat-at-same-name-both.rs:25:29
--> $DIR/pat-at-same-name-both.rs:24:29
|
LL | let ref mut a @ ref mut a = ();
| ^ used in a pattern more than once
error[E0416]: identifier `a` is bound more than once in the same pattern
--> $DIR/pat-at-same-name-both.rs:28:17
--> $DIR/pat-at-same-name-both.rs:27:17
|
LL | let a @ (Ok(a) | Err(a)) = Ok(());
| ^ used in a pattern more than once
error[E0416]: identifier `a` is bound more than once in the same pattern
--> $DIR/pat-at-same-name-both.rs:28:26
--> $DIR/pat-at-same-name-both.rs:27:26
|
LL | let a @ (Ok(a) | Err(a)) = Ok(());
| ^ used in a pattern more than once