diff options
| author | bors <bors@rust-lang.org> | 2019-02-28 11:38:40 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-02-28 11:38:40 +0000 |
| commit | 190feb65290d39d7ab6d44e994bd99188d339f16 (patch) | |
| tree | 0dc440124b61d17495c4b8e4e680b38cd7b0fa13 /src/libstd/sys/sgx | |
| parent | 7e001e5c6c7c090b41416a57d4be412ed3ccd937 (diff) | |
| parent | aad9e29f52988c55cd8cee2bd181a2e3c9d436a4 (diff) | |
| download | rust-190feb65290d39d7ab6d44e994bd99188d339f16.tar.gz rust-190feb65290d39d7ab6d44e994bd99188d339f16.zip | |
Auto merge of #58208 - taiki-e:libstd-2018, r=Centril
libstd => 2018 Transitions `libstd` to Rust 2018; cc #58099 r? @Centril
Diffstat (limited to 'src/libstd/sys/sgx')
28 files changed, 163 insertions, 162 deletions
diff --git a/src/libstd/sys/sgx/abi/mod.rs b/src/libstd/sys/sgx/abi/mod.rs index 509a1990d97..7426f7be9e9 100644 --- a/src/libstd/sys/sgx/abi/mod.rs +++ b/src/libstd/sys/sgx/abi/mod.rs @@ -1,5 +1,5 @@ use core::sync::atomic::{AtomicUsize, Ordering}; -use io::Write; +use crate::io::Write; // runtime features mod reloc; @@ -37,7 +37,7 @@ unsafe extern "C" fn tcs_init(secondary: bool) { }, // We need to wait until the initialization is done. BUSY => while RELOC_STATE.load(Ordering::Acquire) == BUSY { - ::core::arch::x86_64::_mm_pause() + core::arch::x86_64::_mm_pause() }, // Initialization is done. DONE => {}, diff --git a/src/libstd/sys/sgx/abi/panic.rs b/src/libstd/sys/sgx/abi/panic.rs index b2afacc70b8..83411cb5b4c 100644 --- a/src/libstd/sys/sgx/abi/panic.rs +++ b/src/libstd/sys/sgx/abi/panic.rs @@ -1,7 +1,7 @@ use super::usercalls::{alloc::UserRef, self}; -use cmp; -use io::{self, Write}; -use mem; +use crate::cmp; +use crate::io::{self, Write}; +use crate::mem; extern "C" { fn take_debug_panic_buf_ptr() -> *mut u8; diff --git a/src/libstd/sys/sgx/abi/reloc.rs b/src/libstd/sys/sgx/abi/reloc.rs index 4dd41d70bd7..a39841bc36f 100644 --- a/src/libstd/sys/sgx/abi/reloc.rs +++ b/src/libstd/sys/sgx/abi/reloc.rs @@ -1,4 +1,4 @@ -use slice::from_raw_parts; +use crate::slice::from_raw_parts; use super::mem; const R_X86_64_RELATIVE: u32 = 8; diff --git a/src/libstd/sys/sgx/abi/tls.rs b/src/libstd/sys/sgx/abi/tls.rs index e1fc3696845..b2a812c7231 100644 --- a/src/libstd/sys/sgx/abi/tls.rs +++ b/src/libstd/sys/sgx/abi/tls.rs @@ -1,8 +1,8 @@ -use sync::atomic::{AtomicUsize, Ordering}; -use ptr; -use mem; -use cell::Cell; -use num::NonZeroUsize; +use crate::sync::atomic::{AtomicUsize, Ordering}; +use crate::ptr; +use crate::mem; +use crate::cell::Cell; +use crate::num::NonZeroUsize; use self::sync_bitset::*; #[cfg(target_pointer_width="64")] @@ -152,9 +152,9 @@ impl Tls { } mod sync_bitset { - use sync::atomic::{AtomicUsize, Ordering}; - use iter::{Enumerate, Peekable}; - use slice::Iter; + use crate::sync::atomic::{AtomicUsize, Ordering}; + use crate::iter::{Enumerate, Peekable}; + use crate::slice::Iter; use super::{TLS_KEYS_BITSET_SIZE, USIZE_BITS}; /// A bitset that can be used synchronously. diff --git a/src/libstd/sys/sgx/abi/usercalls/alloc.rs b/src/libstd/sys/sgx/abi/usercalls/alloc.rs index 0ccbbbc6501..b787bd1a5ab 100644 --- a/src/libstd/sys/sgx/abi/usercalls/alloc.rs +++ b/src/libstd/sys/sgx/abi/usercalls/alloc.rs @@ -1,11 +1,11 @@ #![allow(unused)] -use ptr::{self, NonNull}; -use mem; -use cell::UnsafeCell; -use slice; -use ops::{Deref, DerefMut, Index, IndexMut, CoerceUnsized}; -use slice::SliceIndex; +use crate::ptr::{self, NonNull}; +use crate::mem; +use crate::cell::UnsafeCell; +use crate::slice; +use crate::ops::{Deref, DerefMut, Index, IndexMut, CoerceUnsized}; +use crate::slice::SliceIndex; use fortanix_sgx_abi::*; use super::super::mem::is_user_range; diff --git a/src/libstd/sys/sgx/abi/usercalls/mod.rs b/src/libstd/sys/sgx/abi/usercalls/mod.rs index 511d6e9e927..d84b6154cbe 100644 --- a/src/libstd/sys/sgx/abi/usercalls/mod.rs +++ b/src/libstd/sys/sgx/abi/usercalls/mod.rs @@ -1,5 +1,5 @@ -use io::{Error as IoError, Result as IoResult}; -use time::Duration; +use crate::io::{Error as IoError, Result as IoResult}; +use crate::time::Duration; pub(crate) mod alloc; #[macro_use] @@ -22,7 +22,7 @@ pub fn read(fd: Fd, buf: &mut [u8]) -> IoResult<usize> { #[unstable(feature = "sgx_platform", issue = "56975")] pub fn read_alloc(fd: Fd) -> IoResult<Vec<u8>> { unsafe { - let userbuf = ByteBuffer { data: ::ptr::null_mut(), len: 0 }; + let userbuf = ByteBuffer { data: crate::ptr::null_mut(), len: 0 }; let mut userbuf = alloc::User::new_from_enclave(&userbuf); raw::read_alloc(fd, userbuf.as_raw_mut_ptr()).from_sgx_result()?; Ok(userbuf.copy_user_buffer()) diff --git a/src/libstd/sys/sgx/abi/usercalls/raw.rs b/src/libstd/sys/sgx/abi/usercalls/raw.rs index 447f20584f8..ad0b6d7b3d8 100644 --- a/src/libstd/sys/sgx/abi/usercalls/raw.rs +++ b/src/libstd/sys/sgx/abi/usercalls/raw.rs @@ -3,8 +3,8 @@ #[unstable(feature = "sgx_platform", issue = "56975")] pub use fortanix_sgx_abi::*; -use ptr::NonNull; -use num::NonZeroU64; +use crate::ptr::NonNull; +use crate::num::NonZeroU64; #[repr(C)] struct UsercallReturn(u64, u64); @@ -35,7 +35,7 @@ pub unsafe fn do_usercall(nr: NonZeroU64, p1: u64, p2: u64, p3: u64, p4: u64, ab type Register = u64; trait RegisterArgument { - fn from_register(Register) -> Self; + fn from_register(_: Register) -> Self; fn into_register(self) -> Register; } diff --git a/src/libstd/sys/sgx/alloc.rs b/src/libstd/sys/sgx/alloc.rs index 95284190bdd..94dc8ec25b5 100644 --- a/src/libstd/sys/sgx/alloc.rs +++ b/src/libstd/sys/sgx/alloc.rs @@ -1,6 +1,4 @@ -extern crate dlmalloc; - -use alloc::{GlobalAlloc, Layout, System}; +use crate::alloc::{GlobalAlloc, Layout, System}; use super::waitqueue::SpinMutex; diff --git a/src/libstd/sys/sgx/args.rs b/src/libstd/sys/sgx/args.rs index bc138a64019..b73bf9213b7 100644 --- a/src/libstd/sys/sgx/args.rs +++ b/src/libstd/sys/sgx/args.rs @@ -1,9 +1,9 @@ -use ffi::OsString; use super::abi::usercalls::{alloc, raw::ByteBuffer}; -use sync::atomic::{AtomicUsize, Ordering}; -use sys::os_str::Buf; -use sys_common::FromInner; -use slice; +use crate::ffi::OsString; +use crate::sync::atomic::{AtomicUsize, Ordering}; +use crate::sys::os_str::Buf; +use crate::sys_common::FromInner; +use crate::slice; static ARGS: AtomicUsize = AtomicUsize::new(0); type ArgsStore = Vec<OsString>; diff --git a/src/libstd/sys/sgx/backtrace.rs b/src/libstd/sys/sgx/backtrace.rs index 2b8e1da0579..d0361574e39 100644 --- a/src/libstd/sys/sgx/backtrace.rs +++ b/src/libstd/sys/sgx/backtrace.rs @@ -1,9 +1,10 @@ -use io; -use error::Error; -use libc; -use sys_common::backtrace::Frame; +use crate::io; +use crate::error::Error; +use crate::fmt; +use crate::sys_common::backtrace::Frame; +use crate::sys::sgx::abi::mem::image_base; + use unwind as uw; -use sys::sgx::abi::mem::image_base; pub struct BacktraceContext; @@ -21,8 +22,8 @@ impl Error for UnwindError { } } -impl ::fmt::Display for UnwindError { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { +impl fmt::Display for UnwindError { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{}: {:?}", self.description(), self.0) } } diff --git a/src/libstd/sys/sgx/condvar.rs b/src/libstd/sys/sgx/condvar.rs index b42e5490c72..e9a7684f74d 100644 --- a/src/libstd/sys/sgx/condvar.rs +++ b/src/libstd/sys/sgx/condvar.rs @@ -1,5 +1,5 @@ -use sys::mutex::Mutex; -use time::Duration; +use crate::sys::mutex::Mutex; +use crate::time::Duration; use super::waitqueue::{WaitVariable, WaitQueue, SpinMutex}; diff --git a/src/libstd/sys/sgx/ext/arch.rs b/src/libstd/sys/sgx/ext/arch.rs index 97f7d9181a5..53fb371947a 100644 --- a/src/libstd/sys/sgx/ext/arch.rs +++ b/src/libstd/sys/sgx/ext/arch.rs @@ -4,7 +4,7 @@ //! Software Developer's Manual, Volume 3, Chapter 40. #![unstable(feature = "sgx_platform", issue = "56975")] -use mem::MaybeUninit; +use crate::mem::MaybeUninit; /// Wrapper struct to force 16-byte alignment. #[repr(align(16))] diff --git a/src/libstd/sys/sgx/ext/ffi.rs b/src/libstd/sys/sgx/ext/ffi.rs index 7b0ffea49ae..ad7ade9b17d 100644 --- a/src/libstd/sys/sgx/ext/ffi.rs +++ b/src/libstd/sys/sgx/ext/ffi.rs @@ -2,10 +2,10 @@ #![unstable(feature = "sgx_platform", issue = "56975")] -use ffi::{OsStr, OsString}; -use mem; -use sys::os_str::Buf; -use sys_common::{FromInner, IntoInner, AsInner}; +use crate::ffi::{OsStr, OsString}; +use crate::mem; +use crate::sys::os_str::Buf; +use crate::sys_common::{FromInner, IntoInner, AsInner}; /// SGX-specific extensions to [`OsString`]. /// diff --git a/src/libstd/sys/sgx/ext/io.rs b/src/libstd/sys/sgx/ext/io.rs index 1eb269783c5..fc88d10d3ed 100644 --- a/src/libstd/sys/sgx/ext/io.rs +++ b/src/libstd/sys/sgx/ext/io.rs @@ -4,9 +4,9 @@ //! description of [`TryIntoRawFd`](trait.TryIntoRawFd.html) for more details. #![unstable(feature = "sgx_platform", issue = "56975")] -pub use sys::abi::usercalls::raw::Fd as RawFd; -use net; -use sys::{self, AsInner, FromInner, IntoInner, TryIntoInner}; +pub use crate::sys::abi::usercalls::raw::Fd as RawFd; +use crate::net; +use crate::sys::{self, AsInner, FromInner, IntoInner, TryIntoInner}; /// A trait to extract the raw SGX file descriptor from an underlying /// object. diff --git a/src/libstd/sys/sgx/fd.rs b/src/libstd/sys/sgx/fd.rs index 69077728b1a..a9924f55f12 100644 --- a/src/libstd/sys/sgx/fd.rs +++ b/src/libstd/sys/sgx/fd.rs @@ -1,8 +1,8 @@ use fortanix_sgx_abi::Fd; -use io; -use mem; -use sys::{AsInner, FromInner, IntoInner}; +use crate::io; +use crate::mem; +use crate::sys::{AsInner, FromInner, IntoInner}; use super::abi::usercalls; #[derive(Debug)] diff --git a/src/libstd/sys/sgx/fs.rs b/src/libstd/sys/sgx/fs.rs index 8b1c4476bc4..485d2c87fbd 100644 --- a/src/libstd/sys/sgx/fs.rs +++ b/src/libstd/sys/sgx/fs.rs @@ -1,10 +1,10 @@ -use ffi::OsString; -use fmt; -use hash::{Hash, Hasher}; -use io::{self, SeekFrom}; -use path::{Path, PathBuf}; -use sys::time::SystemTime; -use sys::{unsupported, Void}; +use crate::ffi::OsString; +use crate::fmt; +use crate::hash::{Hash, Hasher}; +use crate::io::{self, SeekFrom}; +use crate::path::{Path, PathBuf}; +use crate::sys::time::SystemTime; +use crate::sys::{unsupported, Void}; pub struct File(Void); diff --git a/src/libstd/sys/sgx/mod.rs b/src/libstd/sys/sgx/mod.rs index 403dd61187f..325df7688f3 100644 --- a/src/libstd/sys/sgx/mod.rs +++ b/src/libstd/sys/sgx/mod.rs @@ -3,8 +3,9 @@ //! This module contains the facade (aka platform-specific) implementations of //! OS level functionality for Fortanix SGX. -use os::raw::c_char; -use sync::atomic::{AtomicBool, Ordering}; +use crate::io::ErrorKind; +use crate::os::raw::c_char; +use crate::sync::atomic::{AtomicBool, Ordering}; pub mod abi; mod waitqueue; @@ -41,12 +42,12 @@ pub fn init() { /// This function is used to implement functionality that simply doesn't exist. /// Programs relying on this functionality will need to deal with the error. -pub fn unsupported<T>() -> ::io::Result<T> { +pub fn unsupported<T>() -> crate::io::Result<T> { Err(unsupported_err()) } -pub fn unsupported_err() -> ::io::Error { - ::io::Error::new(::io::ErrorKind::Other, +pub fn unsupported_err() -> crate::io::Error { + crate::io::Error::new(ErrorKind::Other, "operation not supported on SGX yet") } @@ -55,58 +56,58 @@ pub fn unsupported_err() -> ::io::Error { /// returned, the program might very well be able to function normally. This is /// what happens when `SGX_INEFFECTIVE_ERROR` is set to `true`. If it is /// `false`, the behavior is the same as `unsupported`. -pub fn sgx_ineffective<T>(v: T) -> ::io::Result<T> { +pub fn sgx_ineffective<T>(v: T) -> crate::io::Result<T> { static SGX_INEFFECTIVE_ERROR: AtomicBool = AtomicBool::new(false); if SGX_INEFFECTIVE_ERROR.load(Ordering::Relaxed) { - Err(::io::Error::new(::io::ErrorKind::Other, + Err(crate::io::Error::new(ErrorKind::Other, "operation can't be trusted to have any effect on SGX")) } else { Ok(v) } } -pub fn decode_error_kind(code: i32) -> ::io::ErrorKind { +pub fn decode_error_kind(code: i32) -> ErrorKind { use fortanix_sgx_abi::Error; // FIXME: not sure how to make sure all variants of Error are covered if code == Error::NotFound as _ { - ::io::ErrorKind::NotFound + ErrorKind::NotFound } else if code == Error::PermissionDenied as _ { - ::io::ErrorKind::PermissionDenied + ErrorKind::PermissionDenied } else if code == Error::ConnectionRefused as _ { - ::io::ErrorKind::ConnectionRefused + ErrorKind::ConnectionRefused } else if code == Error::ConnectionReset as _ { - ::io::ErrorKind::ConnectionReset + ErrorKind::ConnectionReset } else if code == Error::ConnectionAborted as _ { - ::io::ErrorKind::ConnectionAborted + ErrorKind::ConnectionAborted } else if code == Error::NotConnected as _ { - ::io::ErrorKind::NotConnected + ErrorKind::NotConnected } else if code == Error::AddrInUse as _ { - ::io::ErrorKind::AddrInUse + ErrorKind::AddrInUse } else if code == Error::AddrNotAvailable as _ { - ::io::ErrorKind::AddrNotAvailable + ErrorKind::AddrNotAvailable } else if code == Error::BrokenPipe as _ { - ::io::ErrorKind::BrokenPipe + ErrorKind::BrokenPipe } else if code == Error::AlreadyExists as _ { - ::io::ErrorKind::AlreadyExists + ErrorKind::AlreadyExists } else if code == Error::WouldBlock as _ { - ::io::ErrorKind::WouldBlock + ErrorKind::WouldBlock } else if code == Error::InvalidInput as _ { - ::io::ErrorKind::InvalidInput + ErrorKind::InvalidInput } else if code == Error::InvalidData as _ { - ::io::ErrorKind::InvalidData + ErrorKind::InvalidData } else if code == Error::TimedOut as _ { - ::io::ErrorKind::TimedOut + ErrorKind::TimedOut } else if code == Error::WriteZero as _ { - ::io::ErrorKind::WriteZero + ErrorKind::WriteZero } else if code == Error::Interrupted as _ { - ::io::ErrorKind::Interrupted + ErrorKind::Interrupted } else if code == Error::Other as _ { - ::io::ErrorKind::Other + ErrorKind::Other } else if code == Error::UnexpectedEof as _ { - ::io::ErrorKind::UnexpectedEof + ErrorKind::UnexpectedEof } else { - ::io::ErrorKind::Other + ErrorKind::Other } } @@ -131,9 +132,9 @@ pub unsafe fn abort_internal() -> ! { pub fn hashmap_random_keys() -> (u64, u64) { fn rdrand64() -> u64 { unsafe { - let mut ret: u64 = ::mem::uninitialized(); + let mut ret: u64 = crate::mem::uninitialized(); for _ in 0..10 { - if ::arch::x86_64::_rdrand64_step(&mut ret) == 1 { + if crate::arch::x86_64::_rdrand64_step(&mut ret) == 1 { return ret; } } @@ -143,7 +144,7 @@ pub fn hashmap_random_keys() -> (u64, u64) { (rdrand64(), rdrand64()) } -pub use sys_common::{AsInner, FromInner, IntoInner}; +pub use crate::sys_common::{AsInner, FromInner, IntoInner}; pub trait TryIntoInner<Inner>: Sized { fn try_into_inner(self) -> Result<Inner, Self>; diff --git a/src/libstd/sys/sgx/net.rs b/src/libstd/sys/sgx/net.rs index c4c2de43ff7..ab8b2681393 100644 --- a/src/libstd/sys/sgx/net.rs +++ b/src/libstd/sys/sgx/net.rs @@ -1,12 +1,12 @@ -use fmt; -use io::{self, IoVec, IoVecMut}; -use net::{SocketAddr, Shutdown, Ipv4Addr, Ipv6Addr, ToSocketAddrs}; -use time::Duration; -use sys::{unsupported, Void, sgx_ineffective, AsInner, FromInner, IntoInner, TryIntoInner}; -use sys::fd::FileDesc; -use convert::TryFrom; -use error; -use sync::Arc; +use crate::fmt; +use crate::io::{self, IoVec, IoVecMut}; +use crate::net::{SocketAddr, Shutdown, Ipv4Addr, Ipv6Addr, ToSocketAddrs}; +use crate::time::Duration; +use crate::sys::{unsupported, Void, sgx_ineffective, AsInner, FromInner, IntoInner, TryIntoInner}; +use crate::sys::fd::FileDesc; +use crate::convert::TryFrom; +use crate::error; +use crate::sync::Arc; use super::abi::usercalls; diff --git a/src/libstd/sys/sgx/os.rs b/src/libstd/sys/sgx/os.rs index b1e4d371a67..2725e66ce5d 100644 --- a/src/libstd/sys/sgx/os.rs +++ b/src/libstd/sys/sgx/os.rs @@ -1,17 +1,17 @@ use fortanix_sgx_abi::{Error, RESULT_SUCCESS}; -use error::Error as StdError; -use ffi::{OsString, OsStr}; -use fmt; -use io; -use path::{self, PathBuf}; -use str; -use sys::{unsupported, Void, sgx_ineffective, decode_error_kind}; -use collections::HashMap; -use vec; -use sync::Mutex; -use sync::atomic::{AtomicUsize, Ordering}; -use sync::Once; +use crate::error::Error as StdError; +use crate::ffi::{OsString, OsStr}; +use crate::fmt; +use crate::io; +use crate::path::{self, PathBuf}; +use crate::str; +use crate::sys::{unsupported, Void, sgx_ineffective, decode_error_kind}; +use crate::collections::HashMap; +use crate::vec; +use crate::sync::Mutex; +use crate::sync::atomic::{AtomicUsize, Ordering}; +use crate::sync::Once; pub fn errno() -> i32 { RESULT_SUCCESS diff --git a/src/libstd/sys/sgx/os_str.rs b/src/libstd/sys/sgx/os_str.rs index 9d5e084feb2..79b43458d00 100644 --- a/src/libstd/sys/sgx/os_str.rs +++ b/src/libstd/sys/sgx/os_str.rs @@ -1,14 +1,15 @@ /// The underlying OsString/OsStr implementation on Unix systems: just /// a `Vec<u8>`/`[u8]`. -use borrow::Cow; -use fmt; -use str; -use mem; -use rc::Rc; -use sync::Arc; -use sys_common::{AsInner, IntoInner}; -use sys_common::bytestring::debug_fmt_bytestring; +use crate::borrow::Cow; +use crate::fmt; +use crate::str; +use crate::mem; +use crate::rc::Rc; +use crate::sync::Arc; +use crate::sys_common::{AsInner, IntoInner}; +use crate::sys_common::bytestring::debug_fmt_bytestring; + use core::str::lossy::Utf8Lossy; #[derive(Clone, Hash)] diff --git a/src/libstd/sys/sgx/path.rs b/src/libstd/sys/sgx/path.rs index 90b1fa7c97b..1115de1fbe5 100644 --- a/src/libstd/sys/sgx/path.rs +++ b/src/libstd/sys/sgx/path.rs @@ -1,5 +1,5 @@ -use path::Prefix; -use ffi::OsStr; +use crate::path::Prefix; +use crate::ffi::OsStr; #[inline] pub fn is_sep_byte(b: u8) -> bool { diff --git a/src/libstd/sys/sgx/pipe.rs b/src/libstd/sys/sgx/pipe.rs index ac48a6dc033..2582b993b60 100644 --- a/src/libstd/sys/sgx/pipe.rs +++ b/src/libstd/sys/sgx/pipe.rs @@ -1,5 +1,5 @@ -use io; -use sys::Void; +use crate::io; +use crate::sys::Void; pub struct AnonPipe(Void); diff --git a/src/libstd/sys/sgx/process.rs b/src/libstd/sys/sgx/process.rs index 5357d931c73..c49daaa1632 100644 --- a/src/libstd/sys/sgx/process.rs +++ b/src/libstd/sys/sgx/process.rs @@ -1,10 +1,10 @@ -use ffi::OsStr; -use fmt; -use io; -use sys::fs::File; -use sys::pipe::AnonPipe; -use sys::{unsupported, Void}; -use sys_common::process::{CommandEnv, DefaultEnvKey}; +use crate::ffi::OsStr; +use crate::fmt; +use crate::io; +use crate::sys::fs::File; +use crate::sys::pipe::AnonPipe; +use crate::sys::{unsupported, Void}; +use crate::sys_common::process::{CommandEnv, DefaultEnvKey}; //////////////////////////////////////////////////////////////////////////////// // Command diff --git a/src/libstd/sys/sgx/rwlock.rs b/src/libstd/sys/sgx/rwlock.rs index 4dfbe86d14f..372760bbf26 100644 --- a/src/libstd/sys/sgx/rwlock.rs +++ b/src/libstd/sys/sgx/rwlock.rs @@ -1,12 +1,12 @@ -use alloc::{self, Layout}; -use num::NonZeroUsize; -use slice; -use str; +use crate::alloc::{self, Layout}; +use crate::num::NonZeroUsize; +use crate::slice; +use crate::str; use super::waitqueue::{ try_lock_or_false, NotifiedTcs, SpinMutex, SpinMutexGuard, WaitQueue, WaitVariable, }; -use mem; +use crate::mem; pub struct RWLock { readers: SpinMutex<WaitVariable<Option<NonZeroUsize>>>, @@ -206,7 +206,7 @@ pub unsafe extern "C" fn __rust_print_err(m: *mut u8, s: i32) { #[no_mangle] // NB. used by both libunwind and libpanic_abort pub unsafe extern "C" fn __rust_abort() { - ::sys::abort_internal(); + crate::sys::abort_internal(); } #[no_mangle] @@ -224,8 +224,8 @@ mod tests { use super::*; use core::array::FixedSizeArray; - use mem::MaybeUninit; - use {mem, ptr}; + use crate::mem::MaybeUninit; + use crate::{mem, ptr}; // The below test verifies that the bytes of initialized RWLock are the ones // we use in libunwind. diff --git a/src/libstd/sys/sgx/stdio.rs b/src/libstd/sys/sgx/stdio.rs index 57d66ed9a85..f2c6892bfb7 100644 --- a/src/libstd/sys/sgx/stdio.rs +++ b/src/libstd/sys/sgx/stdio.rs @@ -1,7 +1,7 @@ use fortanix_sgx_abi as abi; -use io; -use sys::fd::FileDesc; +use crate::io; +use crate::sys::fd::FileDesc; pub struct Stdin(()); pub struct Stdout(()); @@ -52,7 +52,7 @@ impl io::Write for Stderr { } } -pub const STDIN_BUF_SIZE: usize = ::sys_common::io::DEFAULT_BUF_SIZE; +pub const STDIN_BUF_SIZE: usize = crate::sys_common::io::DEFAULT_BUF_SIZE; pub fn is_ebadf(err: &io::Error) -> bool { // FIXME: Rust normally maps Unix EBADF to `Other` diff --git a/src/libstd/sys/sgx/thread.rs b/src/libstd/sys/sgx/thread.rs index b4bdb03e61a..13569062ac1 100644 --- a/src/libstd/sys/sgx/thread.rs +++ b/src/libstd/sys/sgx/thread.rs @@ -1,7 +1,7 @@ -use boxed::FnBox; -use ffi::CStr; -use io; -use time::Duration; +use crate::boxed::FnBox; +use crate::ffi::CStr; +use crate::io; +use crate::time::Duration; use super::abi::usercalls; @@ -10,9 +10,9 @@ pub struct Thread(task_queue::JoinHandle); pub const DEFAULT_MIN_STACK_SIZE: usize = 4096; mod task_queue { - use sync::{Mutex, MutexGuard, Once}; - use sync::mpsc; - use boxed::FnBox; + use crate::sync::{Mutex, MutexGuard, Once}; + use crate::sync::mpsc; + use crate::boxed::FnBox; pub type JoinHandle = mpsc::Receiver<()>; diff --git a/src/libstd/sys/sgx/time.rs b/src/libstd/sys/sgx/time.rs index 407fe72b0e6..e4f789c3e36 100644 --- a/src/libstd/sys/sgx/time.rs +++ b/src/libstd/sys/sgx/time.rs @@ -1,4 +1,4 @@ -use time::Duration; +use crate::time::Duration; use super::abi::usercalls; #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Debug, Hash)] diff --git a/src/libstd/sys/sgx/waitqueue.rs b/src/libstd/sys/sgx/waitqueue.rs index aec643b3175..1dbf2afbf49 100644 --- a/src/libstd/sys/sgx/waitqueue.rs +++ b/src/libstd/sys/sgx/waitqueue.rs @@ -10,8 +10,8 @@ /// recorded in the enclave. The wakeup event state is protected by a spinlock. /// The queue and associated wait state are stored in a `WaitVariable`. -use ops::{Deref, DerefMut}; -use num::NonZeroUsize; +use crate::ops::{Deref, DerefMut}; +use crate::num::NonZeroUsize; use fortanix_sgx_abi::{Tcs, EV_UNPARK, WAIT_INDEFINITE}; use super::abi::usercalls; @@ -211,8 +211,8 @@ impl WaitQueue { /// A doubly-linked list where callers are in charge of memory allocation /// of the nodes in the list. mod unsafe_list { - use ptr::NonNull; - use mem; + use crate::ptr::NonNull; + use crate::mem; pub struct UnsafeListEntry<T> { next: NonNull<UnsafeListEntry<T>>, @@ -341,7 +341,7 @@ mod unsafe_list { #[cfg(test)] mod tests { use super::*; - use cell::Cell; + use crate::cell::Cell; unsafe fn assert_empty<T>(list: &mut UnsafeList<T>) { assert!(list.pop().is_none(), "assertion failed: list is not empty"); @@ -404,9 +404,9 @@ mod unsafe_list { /// Trivial spinlock-based implementation of `sync::Mutex`. // FIXME: Perhaps use Intel TSX to avoid locking? mod spin_mutex { - use cell::UnsafeCell; - use sync::atomic::{AtomicBool, Ordering, spin_loop_hint}; - use ops::{Deref, DerefMut}; + use crate::cell::UnsafeCell; + use crate::sync::atomic::{AtomicBool, Ordering, spin_loop_hint}; + use crate::ops::{Deref, DerefMut}; #[derive(Default)] pub struct SpinMutex<T> { @@ -496,8 +496,8 @@ mod spin_mutex { #![allow(deprecated)] use super::*; - use sync::Arc; - use thread; + use crate::sync::Arc; + use crate::thread; #[test] fn sleep() { @@ -519,8 +519,8 @@ mod spin_mutex { #[cfg(test)] mod tests { use super::*; - use sync::Arc; - use thread; + use crate::sync::Arc; + use crate::thread; #[test] fn queue() { |
