From 61b1394ac7d16bcb73684952c77f8239effe9dbe Mon Sep 17 00:00:00 2001 From: bstrie <865233+bstrie@users.noreply.github.com> Date: Mon, 8 Nov 2021 15:51:56 -0500 Subject: [PATCH] Attempt to address perf regressions with #[inline] --- library/core/src/array/mod.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/library/core/src/array/mod.rs b/library/core/src/array/mod.rs index 98cd7e8e1ae72..089f1f3639062 100644 --- a/library/core/src/array/mod.rs +++ b/library/core/src/array/mod.rs @@ -331,18 +331,20 @@ impl 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 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 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); }