diff options
| author | Albert Larsan <74931857+albertlarsan68@users.noreply.github.com> | 2023-01-05 09:13:28 +0100 |
|---|---|---|
| committer | Albert Larsan <74931857+albertlarsan68@users.noreply.github.com> | 2023-01-11 09:32:08 +0000 |
| commit | cf2dff2b1e3fa55fa5415d524200070d0d7aacfe (patch) | |
| tree | 40a88d9a46aaf3e8870676eb2538378b75a263eb /src/test/ui/or-patterns/missing-bindings.rs | |
| parent | ca855e6e42787ecd062d81d53336fe6788ef51a9 (diff) | |
| download | rust-cf2dff2b1e3fa55fa5415d524200070d0d7aacfe.tar.gz rust-cf2dff2b1e3fa55fa5415d524200070d0d7aacfe.zip | |
Move /src/test to /tests
Diffstat (limited to 'src/test/ui/or-patterns/missing-bindings.rs')
| -rw-r--r-- | src/test/ui/or-patterns/missing-bindings.rs | 81 |
1 files changed, 0 insertions, 81 deletions
diff --git a/src/test/ui/or-patterns/missing-bindings.rs b/src/test/ui/or-patterns/missing-bindings.rs deleted file mode 100644 index 7c26012c0e9..00000000000 --- a/src/test/ui/or-patterns/missing-bindings.rs +++ /dev/null @@ -1,81 +0,0 @@ -// This test ensures that or patterns do not allow missing bindings in any of the arms. - -// edition:2018 - -#![allow(non_camel_case_types)] - -fn main() {} - -fn check_handling_of_paths() { - mod bar { - pub enum foo { - alpha, - beta, - charlie - } - } - - use bar::foo::{alpha, charlie}; - let (alpha | beta | charlie) = alpha; //~ ERROR variable `beta` is not bound in all patterns - match Some(alpha) { - Some(alpha | beta) => {} //~ ERROR variable `beta` is not bound in all patterns - } -} - -fn check_misc_nesting() { - enum E<T> { A(T, T), B(T) } - use E::*; - enum Vars3<S, T, U> { V1(S), V2(T), V3(U) } - use Vars3::*; - - // One level: - const X: E<u8> = B(0); - let (A(a, _) | _) = X; //~ ERROR variable `a` is not bound in all patterns - let (_ | B(a)) = X; //~ ERROR variable `a` is not bound in all patterns - let (A(..) | B(a)) = X; //~ ERROR variable `a` is not bound in all patterns - let (A(a, _) | B(_)) = X; //~ ERROR variable `a` is not bound in all patterns - let (A(_, a) | B(_)) = X; //~ ERROR variable `a` is not bound in all patterns - let (A(a, b) | B(a)) = X; //~ ERROR variable `b` is not bound in all patterns - - // Two levels: - const Y: E<E<u8>> = B(B(0)); - let (A(A(..) | B(_), _) | B(a)) = Y; //~ ERROR variable `a` is not bound in all patterns - let (A(A(..) | B(a), _) | B(A(a, _) | B(a))) = Y; - //~^ ERROR variable `a` is not bound in all patterns - let (A(A(a, b) | B(c), d) | B(e)) = Y; - //~^ ERROR variable `a` is not bound in all patterns - //~| ERROR variable `a` is not bound in all patterns - //~| ERROR variable `b` is not bound in all patterns - //~| ERROR variable `b` is not bound in all patterns - //~| ERROR variable `c` is not bound in all patterns - //~| ERROR variable `c` is not bound in all patterns - //~| ERROR variable `d` is not bound in all patterns - //~| ERROR variable `e` is not bound in all patterns - - // Three levels: - let ( - V1( - //~^ ERROR variable `b` is not bound in all patterns - //~| ERROR variable `c` is not bound in all patterns - A( - Ok(a) | Err(_), //~ ERROR variable `a` is not bound in all patterns - _ - ) | - B(Ok(a) | Err(a)) - ) | - V2( - A( - A(_, a) | //~ ERROR variable `b` is not bound in all patterns - B(b), //~ ERROR variable `a` is not bound in all patterns - _ - ) | - B(_) - //~^ ERROR variable `a` is not bound in all patterns - //~| ERROR variable `b` is not bound in all patterns - ) | - V3(c), - //~^ ERROR variable `a` is not bound in all patterns - ) - : (Vars3<E<Result<u8, u8>>, E<E<u8>>, u8>,) - = (V3(0),); -} |
