diff --git a/src/arch.rs b/src/arch.rs index 5734f7f..ff31178 100644 --- a/src/arch.rs +++ b/src/arch.rs @@ -90,13 +90,13 @@ pub unsafe fn set_sp_limit(limit: *const u8) { } #[inline] -fn align_down_mut(sp: *mut T, n: uint) -> *mut T { - let sp = (sp as uint) & !(n - 1); +fn align_down_mut(sp: *mut T, n: usize) -> *mut T { + let sp = (sp as usize) & !(n - 1); sp as *mut T } // ptr::offset_mut is positive ints only #[inline] -pub fn offset_mut(ptr: *mut T, count: int) -> *mut T { - (ptr as int + count * (size_of::() as int)) as *mut T +pub fn offset_mut(ptr: *mut T, count: isize) -> *mut T { + (ptr as isize + count * (size_of::() as isize)) as *mut T } diff --git a/src/lib.rs b/src/lib.rs index 2c0843a..8765a16 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,4 +1,4 @@ -#![feature(phase, asm)] +#![feature(asm)] #![no_std] #[macro_use] diff --git a/src/main.rs b/src/main.rs index 20d0a9d..2ce02b7 100644 --- a/src/main.rs +++ b/src/main.rs @@ -7,9 +7,9 @@ use lwkt::Context; use fn_box::FnBox; fn main() { - let f = box move |:| { + let f = Box::new(move |:| { println!("Hello, world!") - }; + }); let mut native = unsafe { Context::native() }; @@ -24,7 +24,7 @@ fn main() { } } - let mut ctx = box { (&mut native as *mut Context, null_mut()) }; + let mut ctx = Box::new((&mut native as *mut Context, null_mut())); let mut green = Context::new(init, &mut *ctx as *mut _, f); ctx.1 = &mut green as *mut Context; diff --git a/src/platform.rs b/src/platform.rs index 48525c1..de69ed0 100644 --- a/src/platform.rs +++ b/src/platform.rs @@ -22,20 +22,20 @@ const STACK_FLAGS: libc::c_int = libc::MAP_STACK | libc::MAP_ANON; impl Stack { - pub fn new(size: uint) -> Stack { + pub fn new(size: usize) -> Stack { let buf = match MemoryMap::new(size, &[MapReadable, MapWritable, MapNonStandardFlags(STACK_FLAGS)]) { Ok(map) => map, - Err(e) => panic!("mmap for stack of size {} failed: {}", size, e) + Err(e) => panic!("mmap for stack of size {} failed: {:?}", size, e) }; if !protect_last_page(&buf) { - panic!("Could not memory-protect guard page. stack={}, errno={}", + panic!("Could not memory-protect guard page. stack={:p}, errno={}", buf.data(), errno()); } let valgrind_id = unsafe { - stack_register(buf.data().offset(buf.len() as int) as *const _, + stack_register(buf.data().offset(buf.len() as isize) as *const _, buf.data() as *const _) }; @@ -65,13 +65,13 @@ impl Drop for Stack { impl Stack { pub fn top(&mut self) -> *mut u8 { unsafe { - self.buf.data().offset(self.buf.len() as int) + self.buf.data().offset(self.buf.len() as isize) } } pub fn limit(&self) -> *const u8 { unsafe { - self.buf.data().offset(page_size() as int) as *const _ + self.buf.data().offset(page_size() as isize) as *const _ } } } diff --git a/src/stack.rs b/src/stack.rs index a481ad5..0a9af93 100644 --- a/src/stack.rs +++ b/src/stack.rs @@ -9,7 +9,7 @@ pub enum Stack { } impl Stack { - pub fn new(size: uint) -> Stack { + pub fn new(size: usize) -> Stack { Stack::Managed(platform::Stack::new(size)) }