Skip to content

Commit 67c2a36

Browse files
committed
fix(lexer_core): gate unsafe_code expect on x86_64 only
The #[expect(unsafe_code)] on prefetch_buffer() is only fulfilled on x86_64 where the prefetch intrinsics use unsafe. On aarch64 (macOS CI), the cfg-gated block is compiled out, leaving the expectation unfulfilled and triggering -D unfulfilled-lint-expectations. Use #[cfg_attr(target_arch = "x86_64", expect(...))] so the lint expectation only exists on the architecture that needs it.
1 parent 7ace759 commit 67c2a36

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

  • compiler/ori_lexer_core/src/source_buffer

compiler/ori_lexer_core/src/source_buffer/mod.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,10 @@ fn detect_interior_nulls(source: &[u8], issues: &mut Vec<EncodingIssue>) {
212212
///
213213
/// Warms up L1 cache for the scanner's initial reads. On platforms without
214214
/// prefetch support, this is a no-op.
215-
#[expect(unsafe_code, reason = "x86_64 prefetch intrinsics require unsafe")]
215+
#[cfg_attr(
216+
target_arch = "x86_64",
217+
expect(unsafe_code, reason = "x86_64 prefetch intrinsics require unsafe")
218+
)]
216219
fn prefetch_buffer(buf: &[u8]) {
217220
#[cfg(target_arch = "x86_64")]
218221
{

0 commit comments

Comments
 (0)