From 018ccef9cd696883d49df5e9598ad2b724a56ef1 Mon Sep 17 00:00:00 2001 From: Eliza Weisman Date: Thu, 25 May 2017 11:24:10 -0400 Subject: [PATCH] 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 --- util/src/lib.rs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/util/src/lib.rs b/util/src/lib.rs index 4db1ce16..9eddf14f 100644 --- a/util/src/lib.rs +++ b/util/src/lib.rs @@ -10,12 +10,13 @@ #![crate_name = "util"] #![no_std] -#![feature(zero_one)] +#![feature(step_trait)] // #[cfg(not(test))] extern crate vga; -use core::{fmt, ops, num}; +use core::{fmt, ops}; use ops::*; -use num::One; +use core::iter::Step; +// use core::num::One; pub mod io; @@ -29,16 +30,17 @@ impl fmt::Debug for Void { } } -pub trait Align: Sized + Copy + One +pub trait Align: Sized + Copy //+ One + Add + Sub + BitAnd + Not + + Step { #[inline] fn align_up(&self, to: Self) -> Self { - let align = to - One::one(); + let align = to.sub_one(); (*self + align) & !align } #[inline] fn align_down(&self, to: Self) -> Self { - *self & !(to - One::one()) + *self & !to.sub_one() } }