fix(data_structures): fix compilation failure on older Rust versions (#6526)

I thought I was being clever, but too clever = stupid.

The dummy code designed to flag when our MSRV is bumped and supports `NonNull::add` would fail to compile on Rust versions below 1.80.0. Precisely because of the condition this code is testing - it's not supported!

Fix this by skipping compilation unless running clippy.
This commit is contained in:
overlookmotel 2024-10-13 17:32:10 +00:00
parent 97c8a3608f
commit 7cc05f1626

View file

@ -14,8 +14,9 @@ use std::{cmp::Ordering, ptr::NonNull as NativeNonNull};
#[derive(Debug)]
pub struct NonNull<T>(NativeNonNull<T>);
#[expect(dead_code, clippy::incompatible_msrv)]
unsafe fn non_null_add_is_not_stable(ptr: NativeNonNull<u8>) -> NativeNonNull<u8> {
#[cfg(clippy)]
#[expect(clippy::incompatible_msrv)]
unsafe fn _non_null_add_is_not_stable(ptr: NativeNonNull<u8>) -> NativeNonNull<u8> {
ptr.add(1)
}