Skip to content

Commit 018ccef

Browse files
committed
fix(util::Align): replace num::One with iter::Step
The `num::One` and `num::Zero` traits were removed on nightly. See the tracking issue rust-lang/rust#27739
1 parent b592ab3 commit 018ccef

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

util/src/lib.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@
1010
#![crate_name = "util"]
1111
#![no_std]
1212

13-
#![feature(zero_one)]
13+
#![feature(step_trait)]
1414
// #[cfg(not(test))] extern crate vga;
1515

16-
use core::{fmt, ops, num};
16+
use core::{fmt, ops};
1717
use ops::*;
18-
use num::One;
18+
use core::iter::Step;
19+
// use core::num::One;
1920

2021
pub mod io;
2122

@@ -29,16 +30,17 @@ impl fmt::Debug for Void {
2930
}
3031
}
3132

32-
pub trait Align: Sized + Copy + One
33+
pub trait Align: Sized + Copy //+ One
3334
+ Add<Output=Self> + Sub<Output=Self>
3435
+ BitAnd<Output=Self> + Not<Output=Self>
36+
+ Step
3537
{
3638
#[inline] fn align_up(&self, to: Self) -> Self {
37-
let align = to - One::one();
39+
let align = to.sub_one();
3840
(*self + align) & !align
3941
}
4042
#[inline] fn align_down(&self, to: Self) -> Self {
41-
*self & !(to - One::one())
43+
*self & !to.sub_one()
4244
}
4345
}
4446

0 commit comments

Comments
 (0)