From 449562231727dd5f8fec97cd9e2e2c2ffed6d618 Mon Sep 17 00:00:00 2001 From: WangRunji Date: Mon, 19 Nov 2018 15:46:40 +0800 Subject: [PATCH] update `process` crate to 2018 edition --- crate/process/Cargo.toml | 1 + crate/process/src/lib.rs | 15 ++++----------- crate/process/src/process_manager.rs | 7 ++++--- crate/process/src/processor.rs | 5 +++-- crate/process/src/scheduler.rs | 1 + crate/process/src/thread.rs | 7 ++++--- 6 files changed, 17 insertions(+), 19 deletions(-) diff --git a/crate/process/Cargo.toml b/crate/process/Cargo.toml index 72a3883..d882789 100644 --- a/crate/process/Cargo.toml +++ b/crate/process/Cargo.toml @@ -2,6 +2,7 @@ name = "ucore-process" version = "0.1.0" authors = ["WangRunji "] +edition = "2018" [dependencies] log = "0.4" diff --git a/crate/process/src/lib.rs b/crate/process/src/lib.rs index 2b45ca6..ac55f7e 100644 --- a/crate/process/src/lib.rs +++ b/crate/process/src/lib.rs @@ -1,4 +1,4 @@ -#![no_std] +#![cfg_attr(not(test), no_std)] #![feature(alloc)] #![feature(const_fn)] #![feature(linkage)] @@ -6,16 +6,9 @@ #![feature(vec_resize_default)] #![feature(asm)] #![feature(exact_size_is_empty)] +#![feature(extern_crate_item_prelude)] extern crate alloc; -#[macro_use] -extern crate log; -extern crate spin; - -// To use `println!` in test -#[cfg(test)] -#[macro_use] -extern crate std; mod process_manager; mod processor; @@ -24,5 +17,5 @@ pub mod thread; mod event_hub; mod interrupt; -pub use process_manager::*; -pub use processor::Processor; +pub use crate::process_manager::*; +pub use crate::processor::Processor; diff --git a/crate/process/src/process_manager.rs b/crate/process/src/process_manager.rs index 36dfb89..b6e8af6 100644 --- a/crate/process/src/process_manager.rs +++ b/crate/process/src/process_manager.rs @@ -1,10 +1,11 @@ use alloc::boxed::Box; use alloc::sync::Arc; +use alloc::vec::Vec; use spin::Mutex; -use scheduler::Scheduler; +use log::*; use core::cell::UnsafeCell; -use alloc::vec::Vec; -use event_hub::EventHub; +use crate::scheduler::Scheduler; +use crate::event_hub::EventHub; struct Process { id: Pid, diff --git a/crate/process/src/processor.rs b/crate/process/src/processor.rs index f0b3a4e..ef617fe 100644 --- a/crate/process/src/processor.rs +++ b/crate/process/src/processor.rs @@ -1,9 +1,10 @@ use alloc::boxed::Box; use alloc::sync::Arc; use spin::Mutex; +use log::*; use core::cell::UnsafeCell; -use process_manager::*; -use interrupt; +use crate::process_manager::*; +use crate::interrupt; /// Process executor /// diff --git a/crate/process/src/scheduler.rs b/crate/process/src/scheduler.rs index 9ab52fa..55e10e6 100644 --- a/crate/process/src/scheduler.rs +++ b/crate/process/src/scheduler.rs @@ -1,4 +1,5 @@ use alloc::{collections::BinaryHeap, vec::Vec}; +use log::*; type Pid = usize; diff --git a/crate/process/src/thread.rs b/crate/process/src/thread.rs index 130c82e..d333bc1 100644 --- a/crate/process/src/thread.rs +++ b/crate/process/src/thread.rs @@ -11,9 +11,10 @@ use alloc::collections::BTreeMap; use core::marker::PhantomData; use core::ptr; use core::time::Duration; -use processor::*; -use process_manager::*; -use scheduler::Scheduler; +use log::*; +use crate::processor::*; +use crate::process_manager::*; +use crate::scheduler::Scheduler; #[linkage = "weak"] #[no_mangle]