Skip to content

Commit 88f3fbc

Browse files
committed
inline const for offset
1 parent 24d932d commit 88f3fbc

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/lib.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![feature(inline_const)]
12
use std::{
23
marker::PhantomData,
34
mem::{offset_of, MaybeUninit},
@@ -281,14 +282,14 @@ impl<T> ListHead<T> {
281282
#[inline(always)]
282283
unsafe fn inner(&self) -> &Inner<T> {
283284
&*(ptr::from_ref(self)
284-
.byte_offset(Self::offset())
285+
.byte_offset(const { Self::offset() })
285286
.cast::<Inner<T>>())
286287
}
287288

288289
#[inline(always)]
289290
unsafe fn inner_mut(&mut self) -> &mut Inner<T> {
290291
&mut *(ptr::from_mut(self)
291-
.byte_offset(Self::offset())
292+
.byte_offset(const { Self::offset() })
292293
.cast::<Inner<T>>())
293294
}
294295

0 commit comments

Comments
 (0)