diff --git a/crates/oxc_transformer/src/helpers/stack/non_empty.rs b/crates/oxc_transformer/src/helpers/stack/non_empty.rs index ecbb4a4a2634f..ef7403ae9634d 100644 --- a/crates/oxc_transformer/src/helpers/stack/non_empty.rs +++ b/crates/oxc_transformer/src/helpers/stack/non_empty.rs @@ -206,12 +206,12 @@ impl NonEmptyStack { unsafe { self.push_slow(value) }; } else { // Capacity for at least 1 more entry - self.cursor = new_cursor; // SAFETY: We checked there is capacity for 1 more entry, so `self.cursor` is in bounds. // `self.cursor` was aligned for `T`, and we added `size_of::()` to pointer. // `size_of::()` is always a multiple of `T`'s alignment, so `self.cursor` must still be // aligned for `T`. - unsafe { self.cursor.as_ptr().write(value) }; + unsafe { new_cursor.as_ptr().write(value) }; + self.cursor = new_cursor; } }