From 64d98f8ee037282c35007b64c2649055c56af1db Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:03 +0200 Subject: Merging upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- ...-slice-pattern-element-loan-array-no-overlap.rs | 64 ---------------------- 1 file changed, 64 deletions(-) delete mode 100644 src/test/ui/borrowck/borrowck-slice-pattern-element-loan-array-no-overlap.rs (limited to 'src/test/ui/borrowck/borrowck-slice-pattern-element-loan-array-no-overlap.rs') diff --git a/src/test/ui/borrowck/borrowck-slice-pattern-element-loan-array-no-overlap.rs b/src/test/ui/borrowck/borrowck-slice-pattern-element-loan-array-no-overlap.rs deleted file mode 100644 index a8e56f648..000000000 --- a/src/test/ui/borrowck/borrowck-slice-pattern-element-loan-array-no-overlap.rs +++ /dev/null @@ -1,64 +0,0 @@ -// check-pass - -fn nop(_s: &[& i32]) {} -fn nop_subslice(_s: &[i32]) {} - -fn const_index_ok(s: &mut [i32; 4]) { - let [ref first, ref second, _, ref fourth, ..] = *s; - let [_, _, ref mut third, ..] = *s; - nop(&[first, second, third, fourth]); -} - -fn const_index_from_end_ok(s: &mut [i32; 4]) { - let [.., ref fourth, ref third, _, ref first] = *s; - let [.., ref mut second, _] = *s; - nop(&[first, second, third, fourth]); -} - -fn const_index_mixed(s: &mut [i32; 6]) { - let [.., _, ref from_end4, ref from_end3, _, ref from_end1] = *s; - - let [ref mut from_begin0, ..] = *s; - nop(&[from_begin0, from_end1, from_end3, from_end4]); - let [_, ref mut from_begin1, ..] = *s; - nop(&[from_begin1, from_end1, from_end3, from_end4]); - - let [ref from_begin0, ref from_begin1, _, ref from_begin3, _, ..] = *s; - - let [.., ref mut from_end1] = *s; - nop(&[from_begin0, from_begin1, from_begin3, from_end1]); - let [.., ref mut from_end2, _] = *s; - nop(&[from_begin0, from_begin1, from_begin3, from_end2]); - let [.., ref mut from_end4, _, _, _] = *s; - nop(&[from_begin0, from_begin1, from_begin3, from_end4]); -} - -fn const_index_and_subslice_ok(s: &mut [i32; 4]) { - let [ref first, ref second, ..] = *s; - let [_, _, ref mut tail @ ..] = *s; - nop(&[first, second]); - nop_subslice(tail); -} - -fn const_index_and_subslice_from_end_ok(s: &mut [i32; 4]) { - let [.., ref second, ref first] = *s; - let [ref mut tail @ .., _, _] = *s; - nop(&[first, second]); - nop_subslice(tail); -} - -fn subslices(s: &mut [i32; 4]) { - let [_, _, ref s1 @ ..] = *s; - let [ref mut s2 @ .., _, _] = *s; - nop_subslice(s1); - nop_subslice(s2); -} - -fn main() { - let mut v = [1,2,3,4]; - const_index_ok(&mut v); - const_index_from_end_ok(&mut v); - const_index_and_subslice_ok(&mut v); - const_index_and_subslice_from_end_ok(&mut v); - subslices(&mut v); -} -- cgit v1.2.3