From 05aa064fd5b6a0412f6bed95ac5e44a7737373c9 Mon Sep 17 00:00:00 2001 From: overlookmotel Date: Sat, 17 May 2025 12:26:18 +0100 Subject: [PATCH] fix(allocator/vec): fix lint error in Miri --- .github/workflows/miri.yml | 6 ++++-- crates/oxc_allocator/src/vec2/mod.rs | 5 ++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/miri.yml b/.github/workflows/miri.yml index 21d1bc511243d..be94f10279f20 100644 --- a/.github/workflows/miri.yml +++ b/.github/workflows/miri.yml @@ -49,7 +49,9 @@ jobs: rustup override set nightly cargo miri setup + # `--lib --bins --tests` omits doctests, which Miri can't run + # https://github.com/oxc-project/oxc/pull/11092 - name: Test with Miri run: | - cargo miri test --doc --all-features -p oxc_ast -p oxc_data_structures - cargo miri test -p oxc_parser -p oxc_transformer + cargo miri test --lib --bins --tests --all-features -p oxc_ast -p oxc_data_structures + cargo miri test --lib --bins --tests -p oxc_parser -p oxc_transformer diff --git a/crates/oxc_allocator/src/vec2/mod.rs b/crates/oxc_allocator/src/vec2/mod.rs index 5207f02e9c2e9..c2637f52c7dfe 100644 --- a/crates/oxc_allocator/src/vec2/mod.rs +++ b/crates/oxc_allocator/src/vec2/mod.rs @@ -1643,7 +1643,10 @@ impl<'bump, T: 'bump> Vec<'bump, T> { /// except by the pointer `other`, and that they are not read after this call. #[inline] unsafe fn append_elements(&mut self, other: *const [T]) { - let count = (*other).len(); + // See https://github.com/oxc-project/oxc/pull/11092 for why this `#[allow]` attribute. + // TODO: Remove this once we bump MSRV and it's no longer required. + #[allow(clippy::needless_borrow, clippy::allow_attributes)] + let count = (&*other).len(); self.reserve(count); let len = self.len(); ptr::copy_nonoverlapping(other as *const T, self.as_mut_ptr().add(len), count);