From 59e723d09958ec368a1ebb0ec691401d7c9cca9f Mon Sep 17 00:00:00 2001 From: edef Date: Wed, 24 Dec 2014 07:28:21 +0100 Subject: [PATCH] free ourselves from the shackles of libstd --- src/arch.rs | 5 +++-- src/context.rs | 7 +++++-- src/lib.rs | 9 ++++++++- src/platform.rs | 6 ++++-- src/stack.rs | 2 +- 5 files changed, 21 insertions(+), 8 deletions(-) diff --git a/src/arch.rs b/src/arch.rs index 4c1daba..a484e98 100644 --- a/src/arch.rs +++ b/src/arch.rs @@ -1,5 +1,6 @@ -use std::simd::u64x2; -use std::mem::{size_of, zeroed}; +use core::prelude::*; +use core::simd::u64x2; +use core::mem::{size_of, zeroed}; use stack::Stack; diff --git a/src/context.rs b/src/context.rs index aaf30f4..789f392 100644 --- a/src/context.rs +++ b/src/context.rs @@ -1,5 +1,8 @@ -use std::mem::transmute; -use std::raw; +use core::prelude::*; + +use core::mem::transmute; +use core::raw; +use alloc::boxed::Box; use fn_box::FnBox; use stack::Stack; diff --git a/src/lib.rs b/src/lib.rs index 0ffff79..c908701 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,8 +1,15 @@ -#![feature(default_type_params, macro_rules)] +#![feature(default_type_params, macro_rules, phase, globs)] +#![no_std] + +#[phase(plugin, link)] +extern crate core; +extern crate alloc; extern crate fn_box; pub use context::Context; +mod std { pub use core::fmt; } + #[macro_escape] mod macros; diff --git a/src/platform.rs b/src/platform.rs index 9e15e0f..e3be6da 100644 --- a/src/platform.rs +++ b/src/platform.rs @@ -1,6 +1,8 @@ extern crate libc; -use std::os::{errno, page_size, MemoryMap, MapReadable, MapWritable, - MapNonStandardFlags}; +extern crate std; +use self::std::prelude::*; +use self::std::os::{errno, page_size, MemoryMap, MapReadable, MapWritable, + MapNonStandardFlags}; extern "C" { #[link_name = "lwt_stack_register"] diff --git a/src/stack.rs b/src/stack.rs index 18bfbd5..a481ad5 100644 --- a/src/stack.rs +++ b/src/stack.rs @@ -1,5 +1,5 @@ use platform; -use std::ptr; +use core::ptr; pub enum Stack { Native {