Skip to content

Commit ee10753

Browse files
committed
rename the inherent step methods
This avoids any confusion between the trait methods and inherent methods.
1 parent bae6119 commit ee10753

File tree

3 files changed

+14
-13
lines changed

3 files changed

+14
-13
lines changed

src/addr.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ impl VirtAddr {
226226
}
227227

228228
// FIXME: Move this into the `Step` impl, once `Step` is stabilized.
229-
pub(crate) fn steps_between(start: &Self, end: &Self) -> Option<usize> {
229+
pub(crate) fn steps_between_impl(start: &Self, end: &Self) -> Option<usize> {
230230
let mut steps = end.0.checked_sub(start.0)?;
231231

232232
// Check if we jumped the gap.
@@ -238,7 +238,7 @@ impl VirtAddr {
238238
}
239239

240240
// FIXME: Move this into the `Step` impl, once `Step` is stabilized.
241-
pub(crate) fn forward_checked(start: Self, count: usize) -> Option<Self> {
241+
pub(crate) fn forward_checked_impl(start: Self, count: usize) -> Option<Self> {
242242
let offset = u64::try_from(count).ok()?;
243243
if offset > ADDRESS_SPACE_SIZE {
244244
return None;
@@ -380,11 +380,11 @@ impl Sub<VirtAddr> for VirtAddr {
380380
#[cfg(feature = "step_trait")]
381381
impl Step for VirtAddr {
382382
fn steps_between(start: &Self, end: &Self) -> Option<usize> {
383-
Self::steps_between(start, end)
383+
Self::steps_between_impl(start, end)
384384
}
385385

386386
fn forward_checked(start: Self, count: usize) -> Option<Self> {
387-
Self::forward_checked(start, count)
387+
Self::forward_checked_impl(start, count)
388388
}
389389

390390
fn backward_checked(start: Self, count: usize) -> Option<Self> {

src/instructions/tlb.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -298,14 +298,14 @@ where
298298
if let Some(mut pages) = self.page_range {
299299
while !pages.is_empty() {
300300
// Calculate out how many pages we still need to flush.
301-
let count = Page::<S>::steps_between(&pages.start, &pages.end).unwrap();
301+
let count = Page::<S>::steps_between_impl(&pages.start, &pages.end).unwrap();
302302

303303
// Make sure that we never jump the gap in the address space when flushing.
304304
let second_half_start =
305305
Page::<S>::containing_address(VirtAddr::new(0xffff_8000_0000_0000));
306306
let count = if pages.start < second_half_start {
307307
let count_to_second_half =
308-
Page::steps_between(&pages.start, &second_half_start).unwrap();
308+
Page::steps_between_impl(&pages.start, &second_half_start).unwrap();
309309
cmp::min(count, count_to_second_half)
310310
} else {
311311
count
@@ -331,7 +331,8 @@ where
331331
// Even if the count is zero, one page is still flushed and so
332332
// we need to advance by at least one.
333333
let inc_count = cmp::max(count, 1);
334-
pages.start = Page::forward_checked(pages.start, usize::from(inc_count)).unwrap();
334+
pages.start =
335+
Page::forward_checked_impl(pages.start, usize::from(inc_count)).unwrap();
335336
}
336337
} else {
337338
unsafe {

src/structures/paging/page.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -150,15 +150,15 @@ impl<S: PageSize> Page<S> {
150150
}
151151

152152
// FIXME: Move this into the `Step` impl, once `Step` is stabilized.
153-
pub(crate) fn steps_between(start: &Self, end: &Self) -> Option<usize> {
154-
VirtAddr::steps_between(&start.start_address, &end.start_address)
153+
pub(crate) fn steps_between_impl(start: &Self, end: &Self) -> Option<usize> {
154+
VirtAddr::steps_between_impl(&start.start_address, &end.start_address)
155155
.map(|steps| steps / S::SIZE as usize)
156156
}
157157

158158
// FIXME: Move this into the `Step` impl, once `Step` is stabilized.
159-
pub(crate) fn forward_checked(start: Self, count: usize) -> Option<Self> {
159+
pub(crate) fn forward_checked_impl(start: Self, count: usize) -> Option<Self> {
160160
let count = count.checked_mul(S::SIZE as usize)?;
161-
let start_address = VirtAddr::forward_checked(start.start_address, count)?;
161+
let start_address = VirtAddr::forward_checked_impl(start.start_address, count)?;
162162
Some(Self {
163163
start_address,
164164
size: PhantomData,
@@ -286,11 +286,11 @@ impl<S: PageSize> Sub<Self> for Page<S> {
286286
#[cfg(feature = "step_trait")]
287287
impl<S: PageSize> Step for Page<S> {
288288
fn steps_between(start: &Self, end: &Self) -> Option<usize> {
289-
Self::steps_between(start, end)
289+
Self::steps_between_impl(start, end)
290290
}
291291

292292
fn forward_checked(start: Self, count: usize) -> Option<Self> {
293-
Self::forward_checked(start, count)
293+
Self::forward_checked_impl(start, count)
294294
}
295295

296296
fn backward_checked(start: Self, count: usize) -> Option<Self> {

0 commit comments

Comments
 (0)