Skip to content

Commit

Permalink
fix: Ensure Guard's drop method is removed at opt-level=s for `…
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
cblh committed Aug 9, 2024
1 parent 7680a3c commit 8b0a25d
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions core/src/array/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());

Expand Down

0 comments on commit 8b0a25d

Please sign in to comment.