diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2020-01-08 20:02:10 +0300 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2020-01-09 21:23:12 +0300 |
| commit | 642669c74d97b79a9a9f7300dfac3bb86bb75d97 (patch) | |
| tree | 4a1e418219e538592050960fd7bdf806802aa84b /src/test/ui/pattern | |
| parent | 41318e9a267024fb36162382e26944d235aa71cd (diff) | |
| download | rust-642669c74d97b79a9a9f7300dfac3bb86bb75d97.tar.gz rust-642669c74d97b79a9a9f7300dfac3bb86bb75d97.zip | |
Update tests
Diffstat (limited to 'src/test/ui/pattern')
6 files changed, 63 insertions, 16 deletions
diff --git a/src/test/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-and-ref.rs b/src/test/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-and-ref.rs index 88eda9afec7..559925c282f 100644 --- a/src/test/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-and-ref.rs +++ b/src/test/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-and-ref.rs @@ -101,6 +101,7 @@ fn main() { //~^ ERROR cannot borrow `a` as mutable because it is also borrowed as immutable //~| ERROR cannot borrow `a` as mutable because it is also borrowed as immutable //~| ERROR cannot move out of `b` in pattern guard + //~| ERROR cannot move out of `b` in pattern guard _ => {} } match Ok(U) { @@ -108,6 +109,7 @@ fn main() { //~^ ERROR cannot borrow `a` as immutable because it is also borrowed as mutable //~| ERROR cannot borrow `a` as immutable because it is also borrowed as mutable //~| ERROR cannot move out of `a` in pattern guard + //~| ERROR cannot move out of `a` in pattern guard _ => {} } diff --git a/src/test/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-and-ref.stderr b/src/test/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-and-ref.stderr index b068a6125b6..b5c26a1fa03 100644 --- a/src/test/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-and-ref.stderr +++ b/src/test/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-and-ref.stderr @@ -191,7 +191,7 @@ LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { drop(b); false | immutable borrow occurs here error: cannot borrow `a` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-pat-ref-mut-and-ref.rs:107:9 + --> $DIR/borrowck-pat-ref-mut-and-ref.rs:108:9 | LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { drop(a); false } => {} | ---------^^^^^^-----^ @@ -200,7 +200,7 @@ LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { drop(a); false | mutable borrow occurs here error: cannot borrow `a` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-pat-ref-mut-and-ref.rs:107:33 + --> $DIR/borrowck-pat-ref-mut-and-ref.rs:108:33 | LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { drop(a); false } => {} | ---------^^^^^^^-----^ @@ -209,7 +209,7 @@ LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { drop(a); false | mutable borrow occurs here error: cannot borrow `a` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-pat-ref-mut-and-ref.rs:114:9 + --> $DIR/borrowck-pat-ref-mut-and-ref.rs:116:9 | LL | let ref a @ (ref mut b, ref mut c) = (U, U); | -----^^^^---------^^---------^ @@ -219,7 +219,7 @@ LL | let ref a @ (ref mut b, ref mut c) = (U, U); | immutable borrow occurs here error: cannot borrow `a` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-pat-ref-mut-and-ref.rs:119:9 + --> $DIR/borrowck-pat-ref-mut-and-ref.rs:121:9 | LL | let ref a @ (ref mut b, ref mut c) = (U, U); | -----^^^^---------^^---------^ @@ -229,7 +229,7 @@ LL | let ref a @ (ref mut b, ref mut c) = (U, U); | immutable borrow occurs here error: cannot borrow `a` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-pat-ref-mut-and-ref.rs:126:9 + --> $DIR/borrowck-pat-ref-mut-and-ref.rs:128:9 | LL | let ref a @ (ref mut b, ref mut c) = (U, U); | -----^^^^---------^^---------^ @@ -239,7 +239,7 @@ LL | let ref a @ (ref mut b, ref mut c) = (U, U); | immutable borrow occurs here error: cannot borrow `a` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-pat-ref-mut-and-ref.rs:131:9 + --> $DIR/borrowck-pat-ref-mut-and-ref.rs:133:9 | LL | let ref mut a @ (ref b, ref c) = (U, U); | ---------^^^^-----^^-----^ @@ -359,8 +359,24 @@ LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { drop(b); false | = note: variables bound in patterns cannot be moved from until after the end of the pattern guard +error[E0507]: cannot move out of `b` in pattern guard + --> $DIR/borrowck-pat-ref-mut-and-ref.rs:100:66 + | +LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { drop(b); false } => {} + | ^ move occurs because `b` has type `&mut main::U`, which does not implement the `Copy` trait + | + = note: variables bound in patterns cannot be moved from until after the end of the pattern guard + +error[E0507]: cannot move out of `a` in pattern guard + --> $DIR/borrowck-pat-ref-mut-and-ref.rs:108:66 + | +LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { drop(a); false } => {} + | ^ move occurs because `a` has type `&mut std::result::Result<main::U, main::U>`, which does not implement the `Copy` trait + | + = note: variables bound in patterns cannot be moved from until after the end of the pattern guard + error[E0507]: cannot move out of `a` in pattern guard - --> $DIR/borrowck-pat-ref-mut-and-ref.rs:107:66 + --> $DIR/borrowck-pat-ref-mut-and-ref.rs:108:66 | LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { drop(a); false } => {} | ^ move occurs because `a` has type `&mut std::result::Result<main::U, main::U>`, which does not implement the `Copy` trait @@ -368,7 +384,7 @@ LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { drop(a); false = note: variables bound in patterns cannot be moved from until after the end of the pattern guard error[E0502]: cannot borrow `_` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-pat-ref-mut-and-ref.rs:119:18 + --> $DIR/borrowck-pat-ref-mut-and-ref.rs:121:18 | LL | let ref a @ (ref mut b, ref mut c) = (U, U); | ---------^^^^^^^^^------------ @@ -380,7 +396,7 @@ LL | drop(a); | - immutable borrow later used here error[E0502]: cannot borrow `_` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-pat-ref-mut-and-ref.rs:119:29 + --> $DIR/borrowck-pat-ref-mut-and-ref.rs:121:29 | LL | let ref a @ (ref mut b, ref mut c) = (U, U); | --------------------^^^^^^^^^- @@ -392,7 +408,7 @@ LL | drop(a); | - immutable borrow later used here error[E0502]: cannot borrow `_` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-pat-ref-mut-and-ref.rs:126:18 + --> $DIR/borrowck-pat-ref-mut-and-ref.rs:128:18 | LL | let ref a @ (ref mut b, ref mut c) = (U, U); | ---------^^^^^^^^^------------ @@ -404,7 +420,7 @@ LL | drop(a); | - immutable borrow later used here error[E0502]: cannot borrow `_` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-pat-ref-mut-and-ref.rs:126:29 + --> $DIR/borrowck-pat-ref-mut-and-ref.rs:128:29 | LL | let ref a @ (ref mut b, ref mut c) = (U, U); | --------------------^^^^^^^^^- @@ -415,7 +431,7 @@ LL | let ref a @ (ref mut b, ref mut c) = (U, U); LL | drop(a); | - immutable borrow later used here -error: aborting due to 43 previous errors +error: aborting due to 45 previous errors Some errors have detailed explanations: E0502, E0507, E0594. For more information about an error, try `rustc --explain E0502`. diff --git a/src/test/ui/pattern/patkind-litrange-no-expr.rs b/src/test/ui/pattern/patkind-litrange-no-expr.rs index def6c62459e..5b3db2e57c8 100644 --- a/src/test/ui/pattern/patkind-litrange-no-expr.rs +++ b/src/test/ui/pattern/patkind-litrange-no-expr.rs @@ -18,7 +18,8 @@ enum_number!(Change { Pos = 1, Neg = -1, Arith = 1 + 1, //~ ERROR arbitrary expressions aren't allowed in patterns - //~^ ERROR only char and numeric types are allowed in range patterns + //~| ERROR arbitrary expressions aren't allowed in patterns + //~| ERROR only char and numeric types are allowed in range patterns }); fn main() {} diff --git a/src/test/ui/pattern/patkind-litrange-no-expr.stderr b/src/test/ui/pattern/patkind-litrange-no-expr.stderr index 78768d282e7..70dd1a9263f 100644 --- a/src/test/ui/pattern/patkind-litrange-no-expr.stderr +++ b/src/test/ui/pattern/patkind-litrange-no-expr.stderr @@ -4,6 +4,12 @@ error: arbitrary expressions aren't allowed in patterns LL | Arith = 1 + 1, | ^^^^^ +error: arbitrary expressions aren't allowed in patterns + --> $DIR/patkind-litrange-no-expr.rs:20:13 + | +LL | Arith = 1 + 1, + | ^^^^^ + error[E0029]: only char and numeric types are allowed in range patterns --> $DIR/patkind-litrange-no-expr.rs:20:13 | @@ -13,6 +19,6 @@ LL | $( $value ..= 42 => Some($name::$variant), )* // PatKind::R LL | Arith = 1 + 1, | ^^^^^ this is of type `_` but it should be `char` or numeric -error: aborting due to 2 previous errors +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0029`. diff --git a/src/test/ui/pattern/usefulness/match-range-fail-dominate.rs b/src/test/ui/pattern/usefulness/match-range-fail-dominate.rs index 7de7b7e79be..37c4ccda0f5 100644 --- a/src/test/ui/pattern/usefulness/match-range-fail-dominate.rs +++ b/src/test/ui/pattern/usefulness/match-range-fail-dominate.rs @@ -34,11 +34,15 @@ fn main() { //~^ WARNING floating-point types cannot be used in patterns //~| WARNING floating-point types cannot be used in patterns //~| WARNING floating-point types cannot be used in patterns + //~| WARNING floating-point types cannot be used in patterns + //~| WARNING this was previously accepted by the compiler //~| WARNING this was previously accepted by the compiler //~| WARNING this was previously accepted by the compiler //~| WARNING this was previously accepted by the compiler 0.02f64 => {} //~ ERROR unreachable pattern //~^ WARNING floating-point types cannot be used in patterns + //~| WARNING floating-point types cannot be used in patterns + //~| WARNING this was previously accepted by the compiler //~| WARNING this was previously accepted by the compiler _ => {} }; diff --git a/src/test/ui/pattern/usefulness/match-range-fail-dominate.stderr b/src/test/ui/pattern/usefulness/match-range-fail-dominate.stderr index c15186d2558..8412a113664 100644 --- a/src/test/ui/pattern/usefulness/match-range-fail-dominate.stderr +++ b/src/test/ui/pattern/usefulness/match-range-fail-dominate.stderr @@ -48,7 +48,7 @@ LL | 0.01f64 ..= 6.5f64 => {} = note: for more information, see issue #41620 <https://github.com/rust-lang/rust/issues/41620> warning: floating-point types cannot be used in patterns - --> $DIR/match-range-fail-dominate.rs:40:7 + --> $DIR/match-range-fail-dominate.rs:42:7 | LL | 0.02f64 => {} | ^^^^^^^ @@ -57,7 +57,7 @@ LL | 0.02f64 => {} = note: for more information, see issue #41620 <https://github.com/rust-lang/rust/issues/41620> error: unreachable pattern - --> $DIR/match-range-fail-dominate.rs:40:7 + --> $DIR/match-range-fail-dominate.rs:42:7 | LL | 0.02f64 => {} | ^^^^^^^ @@ -71,5 +71,23 @@ LL | 0.01f64 ..= 6.5f64 => {} = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #41620 <https://github.com/rust-lang/rust/issues/41620> +warning: floating-point types cannot be used in patterns + --> $DIR/match-range-fail-dominate.rs:33:19 + | +LL | 0.01f64 ..= 6.5f64 => {} + | ^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #41620 <https://github.com/rust-lang/rust/issues/41620> + +warning: floating-point types cannot be used in patterns + --> $DIR/match-range-fail-dominate.rs:42:7 + | +LL | 0.02f64 => {} + | ^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #41620 <https://github.com/rust-lang/rust/issues/41620> + error: aborting due to 5 previous errors |
