From 218caa410aa38c29984be31a5229b9fa717560ee Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:13 +0200 Subject: Merging upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- src/test/ui/binding/match-vec-alternatives.rs | 80 --------------------------- 1 file changed, 80 deletions(-) delete mode 100644 src/test/ui/binding/match-vec-alternatives.rs (limited to 'src/test/ui/binding/match-vec-alternatives.rs') diff --git a/src/test/ui/binding/match-vec-alternatives.rs b/src/test/ui/binding/match-vec-alternatives.rs deleted file mode 100644 index af95eb95d..000000000 --- a/src/test/ui/binding/match-vec-alternatives.rs +++ /dev/null @@ -1,80 +0,0 @@ -// run-pass - -fn match_vecs<'a, T>(l1: &'a [T], l2: &'a [T]) -> &'static str { - match (l1, l2) { - (&[], &[]) => "both empty", - (&[], &[..]) | (&[..], &[]) => "one empty", - (&[..], &[..]) => "both non-empty" - } -} - -fn match_vecs_cons<'a, T>(l1: &'a [T], l2: &'a [T]) -> &'static str { - match (l1, l2) { - (&[], &[]) => "both empty", - (&[], &[_, ..]) | (&[_, ..], &[]) => "one empty", - (&[_, ..], &[_, ..]) => "both non-empty" - } -} - -fn match_vecs_snoc<'a, T>(l1: &'a [T], l2: &'a [T]) -> &'static str { - match (l1, l2) { - (&[], &[]) => "both empty", - (&[], &[.., _]) | (&[.., _], &[]) => "one empty", - (&[.., _], &[.., _]) => "both non-empty" - } -} - -fn match_nested_vecs_cons<'a, T>(l1: Option<&'a [T]>, l2: Result<&'a [T], ()>) -> &'static str { - match (l1, l2) { - (Some(&[]), Ok(&[])) => "Some(empty), Ok(empty)", - (Some(&[_, ..]), Ok(_)) | (Some(&[_, ..]), Err(())) => "Some(non-empty), any", - (None, Ok(&[])) | (None, Err(())) | (None, Ok(&[_])) => "None, Ok(less than one element)", - (None, Ok(&[_, _, ..])) => "None, Ok(at least two elements)", - _ => "other" - } -} - -fn match_nested_vecs_snoc<'a, T>(l1: Option<&'a [T]>, l2: Result<&'a [T], ()>) -> &'static str { - match (l1, l2) { - (Some(&[]), Ok(&[])) => "Some(empty), Ok(empty)", - (Some(&[.., _]), Ok(_)) | (Some(&[.., _]), Err(())) => "Some(non-empty), any", - (None, Ok(&[])) | (None, Err(())) | (None, Ok(&[_])) => "None, Ok(less than one element)", - (None, Ok(&[.., _, _])) => "None, Ok(at least two elements)", - _ => "other" - } -} - -fn main() { - assert_eq!(match_vecs(&[1, 2], &[2, 3]), "both non-empty"); - assert_eq!(match_vecs(&[], &[1, 2, 3, 4]), "one empty"); - assert_eq!(match_vecs::(&[], &[]), "both empty"); - assert_eq!(match_vecs(&[1, 2, 3], &[]), "one empty"); - - assert_eq!(match_vecs_cons(&[1, 2], &[2, 3]), "both non-empty"); - assert_eq!(match_vecs_cons(&[], &[1, 2, 3, 4]), "one empty"); - assert_eq!(match_vecs_cons::(&[], &[]), "both empty"); - assert_eq!(match_vecs_cons(&[1, 2, 3], &[]), "one empty"); - - assert_eq!(match_vecs_snoc(&[1, 2], &[2, 3]), "both non-empty"); - assert_eq!(match_vecs_snoc(&[], &[1, 2, 3, 4]), "one empty"); - assert_eq!(match_vecs_snoc::(&[], &[]), "both empty"); - assert_eq!(match_vecs_snoc(&[1, 2, 3], &[]), "one empty"); - - assert_eq!(match_nested_vecs_cons(None, Ok::<&[_], ()>(&[4_usize, 2_usize])), - "None, Ok(at least two elements)"); - assert_eq!(match_nested_vecs_cons::(None, Err(())), "None, Ok(less than one element)"); - assert_eq!(match_nested_vecs_cons::(Some::<&[_]>(&[]), Ok::<&[_], ()>(&[])), - "Some(empty), Ok(empty)"); - assert_eq!(match_nested_vecs_cons(Some::<&[_]>(&[1]), Err(())), "Some(non-empty), any"); - assert_eq!(match_nested_vecs_cons(Some::<&[_]>(&[(42, ())]), Ok::<&[_], ()>(&[(1, ())])), - "Some(non-empty), any"); - - assert_eq!(match_nested_vecs_snoc(None, Ok::<&[_], ()>(&[4_usize, 2_usize])), - "None, Ok(at least two elements)"); - assert_eq!(match_nested_vecs_snoc::(None, Err(())), "None, Ok(less than one element)"); - assert_eq!(match_nested_vecs_snoc::(Some::<&[_]>(&[]), Ok::<&[_], ()>(&[])), - "Some(empty), Ok(empty)"); - assert_eq!(match_nested_vecs_snoc(Some::<&[_]>(&[1]), Err(())), "Some(non-empty), any"); - assert_eq!(match_nested_vecs_snoc(Some::<&[_]>(&[(42, ())]), Ok::<&[_], ()>(&[(1, ())])), - "Some(non-empty), any"); -} -- cgit v1.2.3