Logo
Explore Help
Register Sign In
rust-lang/rust
1
0
Fork 0
You've already forked rust
Code Issues Pull Requests Actions 1 Packages Projects Releases Wiki Activity
Files
359bfa901b9d8eddbed7b88b6716dbb77b7bfb95
rust/tests/ui/pattern/usefulness/match-slice-patterns.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

13 lines
252 B
Rust
Raw Normal View History

_match: correct max_slice_length logic The logic used to be wildly wrong, but before the HAIR patch its wrongness was hidden by another bug. Fixes #37598.
2016-11-05 13:32:35 +02:00
fn check(list: &[Option<()>]) {
match list {
Use VarLenSlice consistently when splitting constructors The previous behaviour ignored slice lengths above a certain length because it could not do otherwise. We now have VarLenSlice however, that can represent the ignored lengths to make the algorithm more consistent. This does not change the correctness of the algorithm, but makes it easier to reason about. As a nice side-effect, exhaustiveness errors have improved: they now capture all missing lengths instead of only the shortest.
2019-11-05 16:30:04 +00:00
//~^ ERROR `&[_, Some(_), .., None, _]` not covered
_match: correct max_slice_length logic The logic used to be wildly wrong, but before the HAIR patch its wrongness was hidden by another bug. Fixes #37598.
2016-11-05 13:32:35 +02:00
&[] => {},
&[_] => {},
&[_, _] => {},
&[_, None, ..] => {},
&[.., Some(_), _] => {},
}
}
fn main() {}
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.24.6 Page: 3961ms Template: 3ms
English
Bahasa Indonesia Deutsch English Español Français Gaeilge Italiano Latviešu Magyar nyelv Nederlands Polski Português de Portugal Português do Brasil Suomi Svenska Türkçe Čeština Ελληνικά Български Русский Українська فارسی മലയാളം 日本語 简体中文 繁體中文(台灣) 繁體中文(香港) 한국어
Licenses API