From cf2dff2b1e3fa55fa5415d524200070d0d7aacfe Mon Sep 17 00:00:00 2001 From: Albert Larsan <74931857+albertlarsan68@users.noreply.github.com> Date: Thu, 5 Jan 2023 09:13:28 +0100 Subject: Move /src/test to /tests --- src/test/ui/array-slice-vec/slice.rs | 81 ------------------------------------ 1 file changed, 81 deletions(-) delete mode 100644 src/test/ui/array-slice-vec/slice.rs (limited to 'src/test/ui/array-slice-vec/slice.rs') diff --git a/src/test/ui/array-slice-vec/slice.rs b/src/test/ui/array-slice-vec/slice.rs deleted file mode 100644 index a514e202773..00000000000 --- a/src/test/ui/array-slice-vec/slice.rs +++ /dev/null @@ -1,81 +0,0 @@ -// run-pass -#![allow(unused_variables)] - -// Test slicing sugar. - -extern crate core; -use core::ops::{Index, IndexMut, Range, RangeTo, RangeFrom, RangeFull}; - -static mut COUNT: usize = 0; - -struct Foo; - -impl Index> for Foo { - type Output = Foo; - fn index(&self, index: Range) -> &Foo { - unsafe { COUNT += 1; } - self - } -} -impl Index> for Foo { - type Output = Foo; - fn index(&self, index: RangeTo) -> &Foo { - unsafe { COUNT += 1; } - self - } -} -impl Index> for Foo { - type Output = Foo; - fn index(&self, index: RangeFrom) -> &Foo { - unsafe { COUNT += 1; } - self - } -} -impl Index for Foo { - type Output = Foo; - fn index(&self, _index: RangeFull) -> &Foo { - unsafe { COUNT += 1; } - self - } -} - -impl IndexMut> for Foo { - fn index_mut(&mut self, index: Range) -> &mut Foo { - unsafe { COUNT += 1; } - self - } -} -impl IndexMut> for Foo { - fn index_mut(&mut self, index: RangeTo) -> &mut Foo { - unsafe { COUNT += 1; } - self - } -} -impl IndexMut> for Foo { - fn index_mut(&mut self, index: RangeFrom) -> &mut Foo { - unsafe { COUNT += 1; } - self - } -} -impl IndexMut for Foo { - fn index_mut(&mut self, _index: RangeFull) -> &mut Foo { - unsafe { COUNT += 1; } - self - } -} - - -fn main() { - let mut x = Foo; - let _ = &x[..]; - let _ = &x[Foo..]; - let _ = &x[..Foo]; - let _ = &x[Foo..Foo]; - let _ = &mut x[..]; - let _ = &mut x[Foo..]; - let _ = &mut x[..Foo]; - let _ = &mut x[Foo..Foo]; - unsafe { - assert_eq!(COUNT, 8); - } -} -- cgit 1.4.1-3-g733a5