Skip to content

Commit

Permalink
comment on inline const fn offset()
Browse files Browse the repository at this point in the history
  • Loading branch information
Congyuwang committed Mar 3, 2024
1 parent a1b03fe commit d522a62
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,8 @@ impl<T> ListHead<T> {
.cast::<Inner<T>>())
}

/// The compiler will compile this into a inlined constant
/// even without inline const feature.
#[inline(always)]
const fn offset() -> isize {
-(offset_of!(Inner<T>, list) as isize)
Expand Down

0 comments on commit d522a62

Please sign in to comment.