diff options
| author | Caio <c410.f3r@gmail.com> | 2021-11-18 12:09:34 -0300 |
|---|---|---|
| committer | Caio <c410.f3r@gmail.com> | 2021-11-18 12:09:34 -0300 |
| commit | 41d9abd76cd514aca23e3409fe6896a3a7d61d1a (patch) | |
| tree | aff7d6c42e88201c903006083095106fd082f16b /src/test/ui/pattern | |
| parent | 6414e0b5b308d3ae27da83c6a25098cc8aadc1a9 (diff) | |
| download | rust-41d9abd76cd514aca23e3409fe6896a3a7d61d1a.tar.gz rust-41d9abd76cd514aca23e3409fe6896a3a7d61d1a.zip | |
Move some tests to more reasonable directories
Diffstat (limited to 'src/test/ui/pattern')
| -rw-r--r-- | src/test/ui/pattern/ignore-all-the-things.rs | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/test/ui/pattern/ignore-all-the-things.rs b/src/test/ui/pattern/ignore-all-the-things.rs new file mode 100644 index 00000000000..5980e1a857f --- /dev/null +++ b/src/test/ui/pattern/ignore-all-the-things.rs @@ -0,0 +1,44 @@ +// run-pass + +#![allow(non_shorthand_field_patterns)] +#![allow(dead_code)] +#![allow(unused_variables)] + +struct Foo(isize, isize, isize, isize); +struct Bar{a: isize, b: isize, c: isize, d: isize} + +pub fn main() { + let Foo(..) = Foo(5, 5, 5, 5); + let Foo(..) = Foo(5, 5, 5, 5); + let Bar{..} = Bar{a: 5, b: 5, c: 5, d: 5}; + let (..) = (5, 5, 5, 5); + let Foo(a, b, ..) = Foo(5, 5, 5, 5); + let Foo(.., d) = Foo(5, 5, 5, 5); + let (a, b, ..) = (5, 5, 5, 5); + let (.., c, d) = (5, 5, 5, 5); + let Bar{b: b, ..} = Bar{a: 5, b: 5, c: 5, d: 5}; + match [5, 5, 5, 5] { + [..] => { } + } + match [5, 5, 5, 5] { + [a, ..] => { } + } + match [5, 5, 5, 5] { + [.., b] => { } + } + match [5, 5, 5, 5] { + [a, .., b] => { } + } + match [5, 5, 5] { + [..] => { } + } + match [5, 5, 5] { + [a, ..] => { } + } + match [5, 5, 5] { + [.., a] => { } + } + match [5, 5, 5] { + [a, .., b] => { } + } +} |
