From bca0c5f2a939999dcb8d83d06a793f39f4815736 Mon Sep 17 00:00:00 2001
From: burlinchen <chenbeiliuhuo@gmail.com>
Date: Fri, 9 Aug 2024 11:10:30 +0800
Subject: [PATCH] fix: Ensure `Guard`'s `drop` method is removed at
 `opt-level=s` for `Copy` types

Added `#[inline]` to the `drop` method in the `Guard` implementation to ensure that the method is removed by the compiler at optimization level `opt-level=s` for `Copy` types. This change aims to align the method's behavior with optimization expectations and ensure it does not affect performance.
---
 library/core/src/array/mod.rs | 1 +
 1 file changed, 1 insertion(+)

diff --git a/library/core/src/array/mod.rs b/library/core/src/array/mod.rs
index 5c826b9993f..61c713c9e81 100644
--- a/library/core/src/array/mod.rs
+++ b/library/core/src/array/mod.rs
@@ -889,6 +889,7 @@ impl<T> Guard<'_, T> {
 }
 
 impl<T> Drop for Guard<'_, T> {
+    #[inline]
     fn drop(&mut self) {
         debug_assert!(self.initialized <= self.array_mut.len());