Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/test-utils/src/minicore.rs')
| -rw-r--r-- | crates/test-utils/src/minicore.rs | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/crates/test-utils/src/minicore.rs b/crates/test-utils/src/minicore.rs index 118b9ad631..308dc5892e 100644 --- a/crates/test-utils/src/minicore.rs +++ b/crates/test-utils/src/minicore.rs @@ -143,6 +143,12 @@ pub mod clone { pub trait Clone: Sized { fn clone(&self) -> Self; } + + impl<T> Clone for &T { + fn clone(&self) -> Self { + *self + } + } // region:derive #[rustc_builtin_macro] pub macro Clone($item:item) {} @@ -885,12 +891,19 @@ pub mod iter { self } } - pub struct IntoIter<T, const N: usize>([T; N]); + struct IndexRange { + start: usize, + end: usize, + } + pub struct IntoIter<T, const N: usize> { + data: [T; N], + range: IndexRange, + } impl<T, const N: usize> IntoIterator for [T; N] { type Item = T; type IntoIter = IntoIter<T, N>; fn into_iter(self) -> I { - IntoIter(self) + IntoIter { data: self, range: IndexRange { start: 0, end: self.len() } } } } impl<T, const N: usize> Iterator for IntoIter<T, N> { |