diff options
| author | bstrie <865233+bstrie@users.noreply.github.com> | 2021-11-08 15:51:56 -0500 |
|---|---|---|
| committer | bstrie <865233+bstrie@users.noreply.github.com> | 2021-11-08 15:51:56 -0500 |
| commit | 61b1394ac7d16bcb73684952c77f8239effe9dbe (patch) | |
| tree | d9a7da8da4549160a96fed337ed02fd7a2374a52 /library/core/src/array | |
| parent | 3024efff59368d6271dab1a8ac78434175647e9b (diff) | |
| download | rust-61b1394ac7d16bcb73684952c77f8239effe9dbe.tar.gz rust-61b1394ac7d16bcb73684952c77f8239effe9dbe.zip | |
Attempt to address perf regressions with #[inline]
Diffstat (limited to 'library/core/src/array')
| -rw-r--r-- | library/core/src/array/mod.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/library/core/src/array/mod.rs b/library/core/src/array/mod.rs index 98cd7e8e1ae..089f1f36390 100644 --- a/library/core/src/array/mod.rs +++ b/library/core/src/array/mod.rs @@ -331,18 +331,20 @@ impl<T: Ord, const N: usize> Ord for [T; N] { } #[cfg(not(bootstrap))] -#[stable(feature = "copy_clone_array_lib", since = "1.55.0")] +#[stable(feature = "copy_clone_array_lib", since = "1.58.0")] impl<T: Copy, const N: usize> Copy for [T; N] {} #[cfg(not(bootstrap))] -#[stable(feature = "copy_clone_array_lib", since = "1.55.0")] +#[stable(feature = "copy_clone_array_lib", since = "1.58.0")] impl<T: Clone, const N: usize> Clone for [T; N] { + #[inline] fn clone(&self) -> Self { // SAFETY: we know for certain that this iterator will yield exactly `N` // items. unsafe { collect_into_array_unchecked(&mut self.iter().cloned()) } } + #[inline] fn clone_from(&mut self, other: &Self) { self.clone_from_slice(other); } |
