Skip to content

Commit

Permalink
kerncore: add must_use and inline(always)
Browse files Browse the repository at this point in the history
The missing must_use was just an oversight -- access check functions
that return flags, instead of faulting or returning Result, should
always be must_use.

inline(always) turns out to significantly improve performance of
Task::can_access by specializing the generated code for the predicate it
uses.
  • Loading branch information
cbiffle committed Jan 25, 2025
1 parent ace1762 commit 75ab62f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions sys/kerncore/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ impl<T: MemoryRegion> MemoryRegion for &T {
/// that meet the `region_ok` condition.
///
/// `false` otherwise.
#[must_use]
#[inline(always)]
pub fn can_access<S, R>(
slice: S,
table: &[R],
Expand Down

0 comments on commit 75ab62f

Please sign in to comment.