ty::Ref(..) => PatKind::Deref { subpattern: subpatterns.nth(0).unwrap() },
- ty::Slice(_) | ty::Array(..) => {
- PatKind::Slice { prefix: subpatterns.collect(), slice: None, suffix: vec![] }
- }
+ ty::Slice(_) | ty::Array(..) => match self {
+ FixedLenSlice(_) => {
+ PatKind::Slice { prefix: subpatterns.collect(), slice: None, suffix: vec![] }
+ }
+ VarLenSlice(_) => {
+ let prefix = subpatterns.collect();
+ let wild = Pat { ty, span: DUMMY_SP, kind: Box::new(PatKind::Wild) };
+ PatKind::Slice { prefix, slice: Some(wild), suffix: vec![] }
+ }
+ _ => bug!("bad slice pattern {:?} {:?}", self, ty),
+ },
_ => match *self {
ConstantValue(value, _) => PatKind::Constant { value },
-error[E0005]: refutable pattern in function argument: `&[]`, `&[_]` and `&[_, _, _]` not covered
+error[E0005]: refutable pattern in function argument: `&[]`, `&[_]` and `&[_, _, _, ..]` not covered
--> $DIR/const_let_refutable.rs:3:16
|
LL | const fn slice([a, b]: &[i32]) -> i32 {
- | ^^^^^^ patterns `&[]`, `&[_]` and `&[_, _, _]` not covered
+ | ^^^^^^ patterns `&[]`, `&[_]` and `&[_, _, _, ..]` not covered
error[E0723]: can only call other `const fn` within a `const fn`, but `const <&i32 as std::ops::Add>::add` is not stable as `const fn`
--> $DIR/const_let_refutable.rs:4:5
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
-error[E0004]: non-exhaustive patterns: `&[]` not covered
+error[E0004]: non-exhaustive patterns: `&[..]` not covered
--> $DIR/match-byte-array-patterns-2.rs:10:11
|
LL | match buf {
- | ^^^ pattern `&[]` not covered
+ | ^^^ pattern `&[..]` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
}
let vec = vec![0.5f32];
let vec: &[f32] = &vec;
- match *vec { //~ ERROR non-exhaustive patterns: `[_, _, _, _]` not covered
+ match *vec { //~ ERROR non-exhaustive patterns: `[_, _, _, _, ..]` not covered
[0.1, 0.2, 0.3] => (),
[0.1, 0.2] => (),
[0.1] => (),
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
-error[E0004]: non-exhaustive patterns: `[_, _, _, _]` not covered
+error[E0004]: non-exhaustive patterns: `[_, _, _, _, ..]` not covered
--> $DIR/non-exhaustive-match.rs:47:11
|
LL | match *vec {
- | ^^^^ pattern `[_, _, _, _]` not covered
+ | ^^^^ pattern `[_, _, _, _, ..]` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
[true, .., true] => {}
}
match s {
- //~^ ERROR `&[_]` not covered
+ //~^ ERROR `&[_, ..]` not covered
[] => {}
}
match s {
- //~^ ERROR `&[_, _]` not covered
+ //~^ ERROR `&[_, _, ..]` not covered
[] => {}
[_] => {}
}
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
-error[E0004]: non-exhaustive patterns: `&[_]` not covered
+error[E0004]: non-exhaustive patterns: `&[_, ..]` not covered
--> $DIR/slice-patterns.rs:50:11
|
LL | match s {
- | ^ pattern `&[_]` not covered
+ | ^ pattern `&[_, ..]` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
-error[E0004]: non-exhaustive patterns: `&[_, _]` not covered
+error[E0004]: non-exhaustive patterns: `&[_, _, ..]` not covered
--> $DIR/slice-patterns.rs:54:11
|
LL | match s {
- | ^ pattern `&[_, _]` not covered
+ | ^ pattern `&[_, _, ..]` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
-error[E0004]: non-exhaustive patterns: `&[_]` not covered
+error[E0004]: non-exhaustive patterns: `&[_, ..]` not covered
--> $DIR/uninhabited-matches-feature-gated.rs:21:19
|
LL | let _ = match x {
- | ^ pattern `&[_]` not covered
+ | ^ pattern `&[_, ..]` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms