libstd => 2018

This commit is contained in:
Taiki Endo 2019-02-11 04:23:21 +09:00
parent 7e001e5c6c
commit 93b6d9e086
284 changed files with 1989 additions and 2024 deletions

View file

@ -6,6 +6,7 @@ build = "build.rs"
license = "MIT/Apache-2.0"
repository = "https://github.com/rust-lang/rust.git"
description = "The Rust Standard Library"
edition = "2018"
[lib]
name = "std"

View file

@ -64,7 +64,8 @@
use core::sync::atomic::{AtomicPtr, Ordering};
use core::{mem, ptr};
use core::ptr::NonNull;
use sys_common::util::dumb_print;
use crate::sys_common::util::dumb_print;
#[stable(feature = "alloc_module", since = "1.28.0")]
#[doc(inline)]
@ -208,7 +209,7 @@ pub fn rust_oom(layout: Layout) -> ! {
unsafe { mem::transmute(hook) }
};
hook(layout);
unsafe { ::sys::abort_internal(); }
unsafe { crate::sys::abort_internal(); }
}
#[cfg(not(test))]

View file

@ -1,7 +1,5 @@
#![deny(warnings)]
extern crate cc;
use std::env;
fn main() {

View file

@ -1,8 +1,6 @@
#![cfg(test)]
extern crate test;
use self::test::Bencher;
use test::Bencher;
#[bench]
fn new_drop(b: &mut Bencher) {

View file

@ -1,18 +1,18 @@
use self::Entry::*;
use self::VacantEntryState::*;
use intrinsics::unlikely;
use collections::CollectionAllocErr;
use cell::Cell;
use borrow::Borrow;
use cmp::max;
use fmt::{self, Debug};
use crate::intrinsics::unlikely;
use crate::collections::CollectionAllocErr;
use crate::cell::Cell;
use crate::borrow::Borrow;
use crate::cmp::max;
use crate::fmt::{self, Debug};
#[allow(deprecated)]
use hash::{Hash, Hasher, BuildHasher, SipHasher13};
use iter::{FromIterator, FusedIterator};
use mem::{self, replace};
use ops::{Deref, DerefMut, Index};
use sys;
use crate::hash::{Hash, Hasher, BuildHasher, SipHasher13};
use crate::iter::{FromIterator, FusedIterator};
use crate::mem::{self, replace};
use crate::ops::{Deref, DerefMut, Index};
use crate::sys;
use super::table::{self, Bucket, EmptyBucket, Fallibility, FullBucket, FullBucketMut, RawTable,
SafeHash};
@ -3328,7 +3328,7 @@ mod test_map {
use super::HashMap;
use super::Entry::{Occupied, Vacant};
use super::RandomState;
use cell::RefCell;
use crate::cell::RefCell;
use rand::{thread_rng, Rng};
use realstd::collections::CollectionAllocErr::*;
use realstd::mem::size_of;

View file

@ -1,8 +1,8 @@
use borrow::Borrow;
use fmt;
use hash::{Hash, BuildHasher};
use iter::{Chain, FromIterator, FusedIterator};
use ops::{BitOr, BitAnd, BitXor, Sub};
use crate::borrow::Borrow;
use crate::fmt;
use crate::hash::{Hash, BuildHasher};
use crate::iter::{Chain, FromIterator, FusedIterator};
use crate::ops::{BitOr, BitAnd, BitXor, Sub};
use super::Recover;
use super::map::{self, HashMap, Keys, RandomState};
@ -1751,7 +1751,7 @@ fn test_drain() {
#[test]
fn test_replace() {
use hash;
use crate::hash;
#[derive(Debug)]
struct Foo(&'static str, i32);

View file

@ -1,12 +1,11 @@
use alloc::{Global, Alloc, Layout, LayoutErr, handle_alloc_error};
use collections::CollectionAllocErr;
use hash::{BuildHasher, Hash, Hasher};
use marker;
use mem::{size_of, needs_drop};
use mem;
use ops::{Deref, DerefMut};
use ptr::{self, Unique, NonNull};
use hint;
use crate::alloc::{Global, Alloc, Layout, LayoutErr, handle_alloc_error};
use crate::collections::CollectionAllocErr;
use crate::hash::{BuildHasher, Hash, Hasher};
use crate::marker;
use crate::mem::{self, size_of, needs_drop};
use crate::ops::{Deref, DerefMut};
use crate::ptr::{self, Unique, NonNull};
use crate::hint;
use self::BucketState::*;

View file

@ -412,7 +412,7 @@
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_deprecated(reason = "moved to `std::ops::Bound`", since = "1.26.0")]
#[doc(hidden)]
pub use ops::Bound;
pub use crate::ops::Bound;
#[stable(feature = "rust1", since = "1.0.0")]
pub use alloc_crate::collections::{BinaryHeap, BTreeMap, BTreeSet};
#[stable(feature = "rust1", since = "1.0.0")]

View file

@ -13,13 +13,13 @@
#![stable(feature = "env", since = "1.0.0")]
use error::Error;
use ffi::{OsStr, OsString};
use fmt;
use io;
use path::{Path, PathBuf};
use sys;
use sys::os as os_imp;
use crate::error::Error;
use crate::ffi::{OsStr, OsString};
use crate::fmt;
use crate::io;
use crate::path::{Path, PathBuf};
use crate::sys;
use crate::sys::os as os_imp;
/// Returns the current working directory as a [`PathBuf`].
///
@ -800,7 +800,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
/// Constants associated with the current target
#[stable(feature = "env", since = "1.0.0")]
pub mod consts {
use sys::env::os;
use crate::sys::env::os;
/// A string describing the architecture of the CPU that is currently
/// in use.
@ -972,7 +972,7 @@ mod arch {
mod tests {
use super::*;
use path::Path;
use crate::path::Path;
#[test]
#[cfg_attr(target_os = "emscripten", ignore)]
@ -995,7 +995,7 @@ fn test() {
#[test]
#[cfg(windows)]
fn split_paths_windows() {
use path::PathBuf;
use crate::path::PathBuf;
fn check_parse(unparsed: &str, parsed: &[&str]) -> bool {
split_paths(unparsed).collect::<Vec<_>>() ==
@ -1017,7 +1017,7 @@ fn check_parse(unparsed: &str, parsed: &[&str]) -> bool {
#[test]
#[cfg(unix)]
fn split_paths_unix() {
use path::PathBuf;
use crate::path::PathBuf;
fn check_parse(unparsed: &str, parsed: &[&str]) -> bool {
split_paths(unparsed).collect::<Vec<_>>() ==
@ -1034,7 +1034,7 @@ fn check_parse(unparsed: &str, parsed: &[&str]) -> bool {
#[test]
#[cfg(unix)]
fn join_paths_unix() {
use ffi::OsStr;
use crate::ffi::OsStr;
fn test_eq(input: &[&str], output: &str) -> bool {
&*join_paths(input.iter().cloned()).unwrap() ==
@ -1052,7 +1052,7 @@ fn test_eq(input: &[&str], output: &str) -> bool {
#[test]
#[cfg(windows)]
fn join_paths_windows() {
use ffi::OsStr;
use crate::ffi::OsStr;
fn test_eq(input: &[&str], output: &str) -> bool {
&*join_paths(input.iter().cloned()).unwrap() ==

View file

@ -13,17 +13,18 @@
// coherence challenge (e.g., specialization, neg impls, etc) we can
// reconsider what crate these items belong in.
use alloc::{AllocErr, LayoutErr, CannotReallocInPlace};
use any::TypeId;
use borrow::Cow;
use cell;
use char;
use core::array;
use fmt::{self, Debug, Display};
use mem::transmute;
use num;
use str;
use string;
use crate::alloc::{AllocErr, LayoutErr, CannotReallocInPlace};
use crate::any::TypeId;
use crate::borrow::Cow;
use crate::cell;
use crate::char;
use crate::fmt::{self, Debug, Display};
use crate::mem::transmute;
use crate::num;
use crate::str;
use crate::string;
/// `Error` is a trait representing the basic expectations for error values,
/// i.e., values of type `E` in [`Result<T, E>`]. Errors must describe
@ -852,7 +853,7 @@ pub fn downcast<T: Error + 'static>(self: Box<Self>)
#[cfg(test)]
mod tests {
use super::Error;
use fmt;
use crate::fmt;
#[derive(Debug, PartialEq)]
struct A;

View file

@ -9,9 +9,9 @@
#![allow(missing_docs)]
#[cfg(not(test))]
use intrinsics;
use crate::intrinsics;
#[cfg(not(test))]
use sys::cmath;
use crate::sys::cmath;
#[stable(feature = "rust1", since = "1.0.0")]
pub use core::f32::{RADIX, MANTISSA_DIGITS, DIGITS, EPSILON};
@ -488,7 +488,7 @@ pub fn log(self, base: f32) -> f32 { self.ln() / base.ln() }
#[inline]
pub fn log2(self) -> f32 {
#[cfg(target_os = "android")]
return ::sys::android::log2f32(self);
return crate::sys::android::log2f32(self);
#[cfg(not(target_os = "android"))]
return unsafe { intrinsics::log2f32(self) };
}
@ -932,7 +932,7 @@ pub fn asinh(self) -> f32 {
#[inline]
pub fn acosh(self) -> f32 {
match self {
x if x < 1.0 => ::f32::NAN,
x if x < 1.0 => crate::f32::NAN,
x => (x + ((x * x) - 1.0).sqrt()).ln(),
}
}
@ -960,10 +960,10 @@ pub fn atanh(self) -> f32 {
#[cfg(test)]
mod tests {
use f32;
use f32::*;
use num::*;
use num::FpCategory as Fp;
use crate::f32;
use crate::f32::*;
use crate::num::*;
use crate::num::FpCategory as Fp;
#[test]
fn test_num_f32() {

View file

@ -9,9 +9,9 @@
#![allow(missing_docs)]
#[cfg(not(test))]
use intrinsics;
use crate::intrinsics;
#[cfg(not(test))]
use sys::cmath;
use crate::sys::cmath;
#[stable(feature = "rust1", since = "1.0.0")]
pub use core::f64::{RADIX, MANTISSA_DIGITS, DIGITS, EPSILON};
@ -436,7 +436,7 @@ pub fn log(self, base: f64) -> f64 { self.ln() / base.ln() }
pub fn log2(self) -> f64 {
self.log_wrapper(|n| {
#[cfg(target_os = "android")]
return ::sys::android::log2f64(n);
return crate::sys::android::log2f64(n);
#[cfg(not(target_os = "android"))]
return unsafe { intrinsics::log2f64(n) };
})
@ -906,10 +906,10 @@ fn log_wrapper<F: Fn(f64) -> f64>(self, log_fn: F) -> f64 {
#[cfg(test)]
mod tests {
use f64;
use f64::*;
use num::*;
use num::FpCategory as Fp;
use crate::f64;
use crate::f64::*;
use crate::num::*;
use crate::num::FpCategory as Fp;
#[test]
fn test_num_f64() {

View file

@ -1,19 +1,19 @@
use ascii;
use borrow::{Cow, Borrow};
use cmp::Ordering;
use error::Error;
use fmt::{self, Write};
use io;
use mem;
use memchr;
use ops;
use os::raw::c_char;
use ptr;
use rc::Rc;
use slice;
use str::{self, Utf8Error};
use sync::Arc;
use sys;
use crate::ascii;
use crate::borrow::{Cow, Borrow};
use crate::cmp::Ordering;
use crate::error::Error;
use crate::fmt::{self, Write};
use crate::io;
use crate::mem;
use crate::memchr;
use crate::ops;
use crate::os::raw::c_char;
use crate::ptr;
use crate::rc::Rc;
use crate::slice;
use crate::str::{self, Utf8Error};
use crate::sync::Arc;
use crate::sys;
/// A type representing an owned, C-compatible, nul-terminated string with no nul bytes in the
/// middle.
@ -1303,12 +1303,12 @@ fn as_ref(&self) -> &CStr {
#[cfg(test)]
mod tests {
use super::*;
use os::raw::c_char;
use borrow::Cow::{Borrowed, Owned};
use hash::{Hash, Hasher};
use collections::hash_map::DefaultHasher;
use rc::Rc;
use sync::Arc;
use crate::os::raw::c_char;
use crate::borrow::Cow::{Borrowed, Owned};
use crate::hash::{Hash, Hasher};
use crate::collections::hash_map::DefaultHasher;
use crate::rc::Rc;
use crate::sync::Arc;
#[test]
fn c_to_rust() {

View file

@ -1,13 +1,13 @@
use borrow::{Borrow, Cow};
use fmt;
use ops;
use cmp;
use hash::{Hash, Hasher};
use rc::Rc;
use sync::Arc;
use crate::borrow::{Borrow, Cow};
use crate::fmt;
use crate::ops;
use crate::cmp;
use crate::hash::{Hash, Hasher};
use crate::rc::Rc;
use crate::sync::Arc;
use sys::os_str::{Buf, Slice};
use sys_common::{AsInner, IntoInner, FromInner};
use crate::sys::os_str::{Buf, Slice};
use crate::sys_common::{AsInner, IntoInner, FromInner};
/// A type that can represent owned, mutable platform-native strings, but is
/// cheaply inter-convertible with Rust strings.
@ -968,10 +968,10 @@ fn as_inner(&self) -> &Slice {
#[cfg(test)]
mod tests {
use super::*;
use sys_common::{AsInner, IntoInner};
use crate::sys_common::{AsInner, IntoInner};
use rc::Rc;
use sync::Arc;
use crate::rc::Rc;
use crate::sync::Arc;
#[test]
fn test_os_string_with_capacity() {

View file

@ -7,13 +7,13 @@
#![stable(feature = "rust1", since = "1.0.0")]
use fmt;
use ffi::OsString;
use io::{self, SeekFrom, Seek, Read, Initializer, Write};
use path::{Path, PathBuf};
use sys::fs as fs_imp;
use sys_common::{AsInnerMut, FromInner, AsInner, IntoInner};
use time::SystemTime;
use crate::fmt;
use crate::ffi::OsString;
use crate::io::{self, SeekFrom, Seek, Read, Initializer, Write};
use crate::path::{Path, PathBuf};
use crate::sys::fs as fs_imp;
use crate::sys_common::{AsInnerMut, FromInner, AsInner, IntoInner};
use crate::time::SystemTime;
/// A reference to an open file on the filesystem.
///
@ -2096,26 +2096,27 @@ fn as_inner_mut(&mut self) -> &mut fs_imp::DirBuilder {
#[cfg(all(test, not(any(target_os = "cloudabi", target_os = "emscripten"))))]
mod tests {
use io::prelude::*;
use crate::io::prelude::*;
use crate::fs::{self, File, OpenOptions};
use crate::io::{ErrorKind, SeekFrom};
use crate::path::Path;
use crate::str;
use crate::sys_common::io::test::{TempDir, tmpdir};
use crate::thread;
use fs::{self, File, OpenOptions};
use io::{ErrorKind, SeekFrom};
use path::Path;
use rand::{rngs::StdRng, FromEntropy, RngCore};
use str;
use sys_common::io::test::{TempDir, tmpdir};
use thread;
#[cfg(windows)]
use os::windows::fs::{symlink_dir, symlink_file};
use crate::os::windows::fs::{symlink_dir, symlink_file};
#[cfg(windows)]
use sys::fs::symlink_junction;
use crate::sys::fs::symlink_junction;
#[cfg(unix)]
use os::unix::fs::symlink as symlink_dir;
use crate::os::unix::fs::symlink as symlink_dir;
#[cfg(unix)]
use os::unix::fs::symlink as symlink_file;
use crate::os::unix::fs::symlink as symlink_file;
#[cfg(unix)]
use os::unix::fs::symlink as symlink_junction;
use crate::os::unix::fs::symlink as symlink_junction;
macro_rules! check { ($e:expr) => (
match $e {
@ -2334,7 +2335,7 @@ fn file_test_io_eof() {
#[test]
#[cfg(unix)]
fn file_test_io_read_write_at() {
use os::unix::fs::FileExt;
use crate::os::unix::fs::FileExt;
let tmpdir = tmpdir();
let filename = tmpdir.join("file_rt_io_file_test_read_write_at.txt");
@ -2390,7 +2391,7 @@ fn file_test_io_read_write_at() {
#[test]
#[cfg(unix)]
fn set_get_unix_permissions() {
use os::unix::fs::PermissionsExt;
use crate::os::unix::fs::PermissionsExt;
let tmpdir = tmpdir();
let filename = &tmpdir.join("set_get_unix_permissions");
@ -2411,7 +2412,7 @@ fn set_get_unix_permissions() {
#[test]
#[cfg(windows)]
fn file_test_io_seek_read_write() {
use os::windows::fs::FileExt;
use crate::os::windows::fs::FileExt;
let tmpdir = tmpdir();
let filename = tmpdir.join("file_rt_io_file_test_seek_read_write.txt");
@ -3013,7 +3014,7 @@ fn truncate_works() {
#[test]
fn open_flavors() {
use fs::OpenOptions as OO;
use crate::fs::OpenOptions as OO;
fn c<T: Clone>(t: &T) -> T { t.clone() }
let tmpdir = tmpdir();

View file

@ -1,12 +1,12 @@
//! Buffering wrappers for I/O traits
use io::prelude::*;
use crate::io::prelude::*;
use cmp;
use error;
use fmt;
use io::{self, Initializer, DEFAULT_BUF_SIZE, Error, ErrorKind, SeekFrom, IoVec, IoVecMut};
use memchr;
use crate::cmp;
use crate::error;
use crate::fmt;
use crate::io::{self, Initializer, DEFAULT_BUF_SIZE, Error, ErrorKind, SeekFrom, IoVec, IoVecMut};
use crate::memchr;
/// The `BufReader` struct adds buffering to any reader.
///
@ -977,11 +977,10 @@ fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
#[cfg(test)]
mod tests {
use io::prelude::*;
use io::{self, BufReader, BufWriter, LineWriter, SeekFrom};
use sync::atomic::{AtomicUsize, Ordering};
use thread;
use test;
use crate::io::prelude::*;
use crate::io::{self, BufReader, BufWriter, LineWriter, SeekFrom};
use crate::sync::atomic::{AtomicUsize, Ordering};
use crate::thread;
/// A dummy reader intended at testing short-reads propagation.
pub struct ShortReader {

View file

@ -1,8 +1,9 @@
use io::prelude::*;
use crate::io::prelude::*;
use crate::cmp;
use crate::io::{self, Initializer, SeekFrom, Error, ErrorKind, IoVec, IoVecMut};
use core::convert::TryInto;
use cmp;
use io::{self, Initializer, SeekFrom, Error, ErrorKind, IoVec, IoVecMut};
/// A `Cursor` wraps an in-memory buffer and provides it with a
/// [`Seek`] implementation.
@ -378,8 +379,8 @@ fn flush(&mut self) -> io::Result<()> { Ok(()) }
#[cfg(test)]
mod tests {
use io::prelude::*;
use io::{Cursor, SeekFrom, IoVec, IoVecMut};
use crate::io::prelude::*;
use crate::io::{Cursor, SeekFrom, IoVec, IoVecMut};
#[test]
fn test_vec_writer() {

View file

@ -1,8 +1,8 @@
use error;
use fmt;
use result;
use sys;
use convert::From;
use crate::error;
use crate::fmt;
use crate::result;
use crate::sys;
use crate::convert::From;
/// A specialized [`Result`](../result/enum.Result.html) type for I/O
/// operations.
@ -566,10 +566,10 @@ fn _is_sync_send<T: Sync+Send>() {}
#[cfg(test)]
mod test {
use super::{Error, ErrorKind, Repr, Custom};
use error;
use fmt;
use sys::os::error_string;
use sys::decode_error_kind;
use crate::error;
use crate::fmt;
use crate::sys::os::error_string;
use crate::sys::decode_error_kind;
#[test]
fn test_debug_error() {

View file

@ -1,8 +1,8 @@
use cmp;
use io::{self, SeekFrom, Read, Initializer, Write, Seek, BufRead, Error, ErrorKind, IoVecMut,
use crate::cmp;
use crate::io::{self, SeekFrom, Read, Initializer, Write, Seek, BufRead, Error, ErrorKind, IoVecMut,
IoVec};
use fmt;
use mem;
use crate::fmt;
use crate::mem;
// =============================================================================
// Forwarding implementations
@ -323,8 +323,7 @@ fn flush(&mut self) -> io::Result<()> { Ok(()) }
#[cfg(test)]
mod tests {
use io::prelude::*;
use test;
use crate::io::prelude::*;
#[bench]
fn bench_read_slice(b: &mut test::Bencher) {

View file

@ -1,8 +1,8 @@
use cell::Cell;
use ptr;
use sync::Arc;
use sys_common;
use sys_common::mutex::Mutex;
use crate::cell::Cell;
use crate::ptr;
use crate::sync::Arc;
use crate::sys_common;
use crate::sys_common::mutex::Mutex;
pub struct Lazy<T> {
// We never call `lock.init()`, so it is UB to attempt to acquire this mutex reentrantly!

View file

@ -259,14 +259,14 @@
#![stable(feature = "rust1", since = "1.0.0")]
use cmp;
use fmt;
use slice;
use str;
use memchr;
use ops::{Deref, DerefMut};
use ptr;
use sys;
use crate::cmp;
use crate::fmt;
use crate::slice;
use crate::str;
use crate::memchr;
use crate::ops::{Deref, DerefMut};
use crate::ptr;
use crate::sys;
#[stable(feature = "rust1", since = "1.0.0")]
pub use self::buffered::{BufReader, BufWriter, LineWriter};
@ -297,7 +297,7 @@
mod util;
mod stdio;
const DEFAULT_BUF_SIZE: usize = ::sys_common::io::DEFAULT_BUF_SIZE;
const DEFAULT_BUF_SIZE: usize = crate::sys_common::io::DEFAULT_BUF_SIZE;
struct Guard<'a> { buf: &'a mut Vec<u8>, len: usize }
@ -2155,10 +2155,9 @@ fn next(&mut self) -> Option<Result<String>> {
#[cfg(test)]
mod tests {
use io::prelude::*;
use io;
use crate::io::prelude::*;
use crate::io;
use super::Cursor;
use test;
use super::repeat;
#[test]

View file

@ -1,13 +1,13 @@
use io::prelude::*;
use crate::io::prelude::*;
use cell::RefCell;
use fmt;
use io::lazy::Lazy;
use io::{self, Initializer, BufReader, LineWriter};
use sync::{Arc, Mutex, MutexGuard};
use sys::stdio;
use sys_common::remutex::{ReentrantMutex, ReentrantMutexGuard};
use thread::LocalKey;
use crate::cell::RefCell;
use crate::fmt;
use crate::io::lazy::Lazy;
use crate::io::{self, Initializer, BufReader, LineWriter};
use crate::sync::{Arc, Mutex, MutexGuard};
use crate::sys::stdio;
use crate::sys_common::remutex::{ReentrantMutex, ReentrantMutexGuard};
use crate::thread::LocalKey;
/// Stdout used by print! and println! macros
thread_local! {
@ -668,8 +668,8 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
issue = "0")]
#[doc(hidden)]
pub fn set_panic(sink: Option<Box<dyn Write + Send>>) -> Option<Box<dyn Write + Send>> {
use panicking::LOCAL_STDERR;
use mem;
use crate::panicking::LOCAL_STDERR;
use crate::mem;
LOCAL_STDERR.with(move |slot| {
mem::replace(&mut *slot.borrow_mut(), sink)
}).and_then(|mut s| {
@ -692,7 +692,7 @@ pub fn set_panic(sink: Option<Box<dyn Write + Send>>) -> Option<Box<dyn Write +
issue = "0")]
#[doc(hidden)]
pub fn set_print(sink: Option<Box<dyn Write + Send>>) -> Option<Box<dyn Write + Send>> {
use mem;
use crate::mem;
LOCAL_STDOUT.with(move |slot| {
mem::replace(&mut *slot.borrow_mut(), sink)
}).and_then(|mut s| {
@ -749,14 +749,14 @@ pub fn _print(args: fmt::Arguments) {
issue = "0")]
#[doc(hidden)]
pub fn _eprint(args: fmt::Arguments) {
use panicking::LOCAL_STDERR;
use crate::panicking::LOCAL_STDERR;
print_to(args, &LOCAL_STDERR, stderr, "stderr");
}
#[cfg(test)]
mod tests {
use panic::{UnwindSafe, RefUnwindSafe};
use thread;
use crate::panic::{UnwindSafe, RefUnwindSafe};
use crate::thread;
use super::*;
#[test]

View file

@ -1,8 +1,8 @@
#![allow(missing_copy_implementations)]
use fmt;
use io::{self, Read, Initializer, Write, ErrorKind, BufRead, IoVec, IoVecMut};
use mem;
use crate::fmt;
use crate::io::{self, Read, Initializer, Write, ErrorKind, BufRead, IoVec, IoVecMut};
use crate::mem;
/// Copies the entire contents of a reader into a writer.
///
@ -224,8 +224,8 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
#[cfg(test)]
mod tests {
use io::prelude::*;
use io::{copy, sink, empty, repeat};
use crate::io::prelude::*;
use crate::io::{copy, sink, empty, repeat};
#[test]
fn copy_copies() {

View file

@ -209,6 +209,10 @@
#![deny(intra_doc_link_resolution_failure)]
#![deny(missing_debug_implementations)]
#![deny(rust_2018_idioms)]
#![allow(explicit_outlives_requirements)]
#![allow(elided_lifetimes_in_paths)]
// Tell the compiler to link to either panic_abort or panic_unwind
#![needs_panic_runtime]
@ -272,7 +276,6 @@
#![feature(maybe_uninit)]
#![feature(needs_panic_runtime)]
#![feature(never_type)]
#![feature(nll)]
#![feature(non_exhaustive)]
#![feature(on_unimplemented)]
#![feature(optin_builtin_traits)]
@ -313,29 +316,25 @@
// Access to Bencher, etc.
#[cfg(test)] extern crate test;
#[cfg(test)] extern crate rand;
// Re-export a few macros from core
#[stable(feature = "rust1", since = "1.0.0")]
pub use core::{assert_eq, assert_ne, debug_assert, debug_assert_eq, debug_assert_ne};
#[stable(feature = "rust1", since = "1.0.0")]
pub use core::{unreachable, unimplemented, write, writeln, try};
pub use core::{unreachable, unimplemented, write, writeln, r#try};
#[allow(unused_imports)] // macros from `alloc` are not used on all platforms
#[macro_use]
extern crate alloc as alloc_crate;
#[doc(masked)]
#[allow(unused_extern_crates)]
extern crate libc;
extern crate rustc_demangle;
// We always need an unwinder currently for backtraces
#[doc(masked)]
#[allow(unused_extern_crates)]
extern crate unwind;
#[cfg(feature = "backtrace")]
extern crate backtrace_sys;
// During testing, this crate is not actually the "real" std library, but rather
// it links to the real std library, which was compiled from this same source
// code. So any lang items std defines are conditionally excluded (or else they

View file

@ -333,7 +333,7 @@ macro_rules! dbg {
#[cfg_attr(stage0, allow_internal_unstable)]
#[cfg_attr(not(stage0), allow_internal_unstable(gen_future, generators))]
#[allow_internal_unsafe]
macro_rules! await {
macro_rules! r#await {
($e:expr) => { {
let mut pinned = $e;
loop {

View file

@ -22,7 +22,7 @@
/// ```
#[inline]
pub fn memchr(needle: u8, haystack: &[u8]) -> Option<usize> {
::sys::memchr::memchr(needle, haystack)
crate::sys::memchr::memchr(needle, haystack)
}
/// A safe interface to `memrchr`.
@ -42,7 +42,7 @@ pub fn memchr(needle: u8, haystack: &[u8]) -> Option<usize> {
/// ```
#[inline]
pub fn memrchr(needle: u8, haystack: &[u8]) -> Option<usize> {
::sys::memchr::memrchr(needle, haystack)
crate::sys::memchr::memrchr(needle, haystack)
}
#[cfg(test)]

View file

@ -1,16 +1,16 @@
use fmt;
use hash;
use io;
use mem;
use net::{ntoh, hton, IpAddr, Ipv4Addr, Ipv6Addr};
use option;
use sys::net::netc as c;
use sys_common::{FromInner, AsInner, IntoInner};
use sys_common::net::LookupHost;
use vec;
use iter;
use slice;
use convert::TryInto;
use crate::fmt;
use crate::hash;
use crate::io;
use crate::mem;
use crate::net::{ntoh, hton, IpAddr, Ipv4Addr, Ipv6Addr};
use crate::option;
use crate::sys::net::netc as c;
use crate::sys_common::{FromInner, AsInner, IntoInner};
use crate::sys_common::net::LookupHost;
use crate::vec;
use crate::iter;
use crate::slice;
use crate::convert::TryInto;
/// An internet socket address, either IPv4 or IPv6.
///
@ -921,8 +921,8 @@ fn to_socket_addrs(&self) -> io::Result<vec::IntoIter<SocketAddr>> {
#[cfg(all(test, not(target_os = "emscripten")))]
mod tests {
use net::*;
use net::test::{tsa, sa6, sa4};
use crate::net::*;
use crate::net::test::{tsa, sa6, sa4};
#[test]
fn to_socket_addr_ipaddr_u16() {

View file

@ -3,11 +3,11 @@
be to be stable",
issue = "27709")]
use cmp::Ordering;
use fmt;
use hash;
use sys::net::netc as c;
use sys_common::{AsInner, FromInner};
use crate::cmp::Ordering;
use crate::fmt;
use crate::hash;
use crate::sys::net::netc as c;
use crate::sys_common::{AsInner, FromInner};
/// An IP address, either IPv4 or IPv6.
///
@ -1509,9 +1509,9 @@ fn from(ip: u128) -> Ipv6Addr {
// Tests for this module
#[cfg(all(test, not(target_os = "emscripten")))]
mod tests {
use net::*;
use net::Ipv6MulticastScope::*;
use net::test::{tsa, sa6, sa4};
use crate::net::*;
use crate::net::Ipv6MulticastScope::*;
use crate::net::test::{tsa, sa6, sa4};
#[test]
fn test_from_str_ipv4() {

View file

@ -28,7 +28,7 @@
#![stable(feature = "rust1", since = "1.0.0")]
use io::{self, Error, ErrorKind};
use crate::io::{self, Error, ErrorKind};
#[stable(feature = "rust1", since = "1.0.0")]
pub use self::ip::{IpAddr, Ipv4Addr, Ipv6Addr, Ipv6MulticastScope};

View file

@ -3,10 +3,10 @@
//! This module is "publicly exported" through the `FromStr` implementations
//! below.
use error::Error;
use fmt;
use net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV4, SocketAddrV6};
use str::FromStr;
use crate::error::Error;
use crate::fmt;
use crate::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV4, SocketAddrV6};
use crate::str::FromStr;
struct Parser<'a> {
// parsing as ASCII, so can use byte array

View file

@ -1,11 +1,11 @@
use io::prelude::*;
use crate::io::prelude::*;
use fmt;
use io::{self, Initializer, IoVec, IoVecMut};
use net::{ToSocketAddrs, SocketAddr, Shutdown};
use sys_common::net as net_imp;
use sys_common::{AsInner, FromInner, IntoInner};
use time::Duration;
use crate::fmt;
use crate::io::{self, Initializer, IoVec, IoVecMut};
use crate::net::{ToSocketAddrs, SocketAddr, Shutdown};
use crate::sys_common::net as net_imp;
use crate::sys_common::{AsInner, FromInner, IntoInner};
use crate::time::Duration;
/// A TCP stream between a local and a remote socket.
///
@ -929,14 +929,14 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
#[cfg(all(test, not(any(target_os = "cloudabi", target_os = "emscripten"))))]
mod tests {
use io::{ErrorKind, IoVec, IoVecMut};
use io::prelude::*;
use net::*;
use net::test::{next_test_ip4, next_test_ip6};
use sync::mpsc::channel;
use sys_common::AsInner;
use time::{Instant, Duration};
use thread;
use crate::io::{ErrorKind, IoVec, IoVecMut};
use crate::io::prelude::*;
use crate::net::*;
use crate::net::test::{next_test_ip4, next_test_ip6};
use crate::sync::mpsc::channel;
use crate::sys_common::AsInner;
use crate::time::{Instant, Duration};
use crate::thread;
fn each_ip(f: &mut dyn FnMut(SocketAddr)) {
f(next_test_ip4());

View file

@ -1,8 +1,8 @@
#![allow(warnings)] // not used on emscripten
use env;
use net::{SocketAddr, SocketAddrV4, SocketAddrV6, Ipv4Addr, Ipv6Addr, ToSocketAddrs};
use sync::atomic::{AtomicUsize, Ordering};
use crate::env;
use crate::net::{SocketAddr, SocketAddrV4, SocketAddrV6, Ipv4Addr, Ipv6Addr, ToSocketAddrs};
use crate::sync::atomic::{AtomicUsize, Ordering};
static PORT: AtomicUsize = AtomicUsize::new(0);

View file

@ -1,9 +1,9 @@
use fmt;
use io::{self, Error, ErrorKind};
use net::{ToSocketAddrs, SocketAddr, Ipv4Addr, Ipv6Addr};
use sys_common::net as net_imp;
use sys_common::{AsInner, FromInner, IntoInner};
use time::Duration;
use crate::fmt;
use crate::io::{self, Error, ErrorKind};
use crate::net::{ToSocketAddrs, SocketAddr, Ipv4Addr, Ipv6Addr};
use crate::sys_common::net as net_imp;
use crate::sys_common::{AsInner, FromInner, IntoInner};
use crate::time::Duration;
/// A UDP socket.
///
@ -808,13 +808,13 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
#[cfg(all(test, not(any(target_os = "cloudabi", target_os = "emscripten"))))]
mod tests {
use io::ErrorKind;
use net::*;
use net::test::{next_test_ip4, next_test_ip6};
use sync::mpsc::channel;
use sys_common::AsInner;
use time::{Instant, Duration};
use thread;
use crate::io::ErrorKind;
use crate::net::*;
use crate::net::test::{next_test_ip4, next_test_ip6};
use crate::sync::mpsc::channel;
use crate::sys_common::AsInner;
use crate::time::{Instant, Duration};
use crate::thread;
fn each_ip(f: &mut dyn FnMut(SocketAddr, SocketAddr)) {
f(next_test_ip4(), next_test_ip4());

View file

@ -14,8 +14,8 @@
#[stable(feature = "nonzero", since = "1.28.0")]
pub use core::num::{NonZeroU8, NonZeroU16, NonZeroU32, NonZeroU64, NonZeroU128, NonZeroUsize};
#[cfg(test)] use fmt;
#[cfg(test)] use ops::{Add, Sub, Mul, Div, Rem};
#[cfg(test)] use crate::fmt;
#[cfg(test)] use crate::ops::{Add, Sub, Mul, Div, Rem};
/// Helper function for testing numeric operations
#[cfg(test)]
@ -35,16 +35,16 @@ pub fn test_num<T>(ten: T, two: T) where
#[cfg(test)]
mod tests {
use u8;
use u16;
use u32;
use u64;
use usize;
use ops::Mul;
use crate::u8;
use crate::u16;
use crate::u32;
use crate::u64;
use crate::usize;
use crate::ops::Mul;
#[test]
fn test_saturating_add_uint() {
use usize::MAX;
use crate::usize::MAX;
assert_eq!(3_usize.saturating_add(5_usize), 8_usize);
assert_eq!(3_usize.saturating_add(MAX-1), MAX);
assert_eq!(MAX.saturating_add(MAX), MAX);
@ -53,7 +53,7 @@ fn test_saturating_add_uint() {
#[test]
fn test_saturating_sub_uint() {
use usize::MAX;
use crate::usize::MAX;
assert_eq!(5_usize.saturating_sub(3_usize), 2_usize);
assert_eq!(3_usize.saturating_sub(5_usize), 0_usize);
assert_eq!(0_usize.saturating_sub(1_usize), 0_usize);
@ -62,7 +62,7 @@ fn test_saturating_sub_uint() {
#[test]
fn test_saturating_add_int() {
use isize::{MIN,MAX};
use crate::isize::{MIN,MAX};
assert_eq!(3i32.saturating_add(5), 8);
assert_eq!(3isize.saturating_add(MAX-1), MAX);
assert_eq!(MAX.saturating_add(MAX), MAX);
@ -74,7 +74,7 @@ fn test_saturating_add_int() {
#[test]
fn test_saturating_sub_int() {
use isize::{MIN,MAX};
use crate::isize::{MIN,MAX};
assert_eq!(3i32.saturating_sub(5), -2);
assert_eq!(MIN.saturating_sub(1), MIN);
assert_eq!((-2isize).saturating_sub(MAX), MIN);
@ -232,8 +232,8 @@ fn test_uint_to_str_overflow() {
assert_eq!(u64_val.to_string(), "0");
}
fn from_str<T: ::str::FromStr>(t: &str) -> Option<T> {
::str::FromStr::from_str(t).ok()
fn from_str<T: crate::str::FromStr>(t: &str) -> Option<T> {
crate::str::FromStr::from_str(t).ok()
}
#[test]
@ -275,8 +275,7 @@ fn test_uint_from_str_overflow() {
#[cfg(test)]
mod bench {
extern crate test;
use self::test::Bencher;
use test::Bencher;
#[bench]
fn bench_pow_function(b: &mut Bencher) {

View file

@ -1,12 +1,10 @@
#![stable(feature = "metadata_ext", since = "1.1.0")]
use libc;
use fs::Metadata;
use sys_common::AsInner;
use crate::fs::Metadata;
use crate::sys_common::AsInner;
#[allow(deprecated)]
use os::android::raw;
use crate::os::android::raw;
/// OS-specific extensions to [`fs::Metadata`].
///

View file

@ -8,7 +8,7 @@
definitions")]
#![allow(deprecated)]
use os::raw::c_long;
use crate::os::raw::c_long;
#[stable(feature = "pthread_t", since = "1.8.0")]
pub type pthread_t = c_long;
@ -19,8 +19,8 @@
#[cfg(any(target_arch = "arm", target_arch = "x86"))]
mod arch {
use os::raw::{c_uint, c_uchar, c_ulonglong, c_longlong, c_ulong};
use os::unix::raw::{uid_t, gid_t};
use crate::os::raw::{c_uint, c_uchar, c_ulonglong, c_longlong, c_ulong};
use crate::os::unix::raw::{uid_t, gid_t};
#[stable(feature = "raw_ext", since = "1.1.0")]
pub type dev_t = u64;
@ -89,8 +89,8 @@ pub struct stat {
#[cfg(target_arch = "aarch64")]
mod arch {
use os::raw::{c_uchar, c_ulong};
use os::unix::raw::{uid_t, gid_t};
use crate::os::raw::{c_uchar, c_ulong};
use crate::os::unix::raw::{uid_t, gid_t};
#[stable(feature = "raw_ext", since = "1.1.0")]
pub type dev_t = u64;
@ -157,8 +157,8 @@ pub struct stat {
#[cfg(target_arch = "x86_64")]
mod arch {
use os::raw::{c_uint, c_long, c_ulong};
use os::unix::raw::{uid_t, gid_t};
use crate::os::raw::{c_uint, c_long, c_ulong};
use crate::os::unix::raw::{uid_t, gid_t};
#[stable(feature = "raw_ext", since = "1.1.0")]
pub type dev_t = u64;

View file

@ -1,12 +1,10 @@
#![stable(feature = "metadata_ext", since = "1.1.0")]
use libc;
use fs::Metadata;
use sys_common::AsInner;
use crate::fs::Metadata;
use crate::sys_common::AsInner;
#[allow(deprecated)]
use os::bitrig::raw;
use crate::os::bitrig::raw;
/// OS-specific extensions to [`fs::Metadata`].
///

View file

@ -8,8 +8,8 @@
definitions")]
#![allow(deprecated)]
use os::raw::c_long;
use os::unix::raw::{uid_t, gid_t};
use crate::os::raw::c_long;
use crate::os::unix::raw::{uid_t, gid_t};
#[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = u64;
#[stable(feature = "raw_ext", since = "1.1.0")] pub type blksize_t = u64;

View file

@ -1,12 +1,10 @@
#![stable(feature = "metadata_ext", since = "1.1.0")]
use libc;
use fs::Metadata;
use sys_common::AsInner;
use crate::fs::Metadata;
use crate::sys_common::AsInner;
#[allow(deprecated)]
use os::dragonfly::raw;
use crate::os::dragonfly::raw;
/// OS-specific extensions to [`fs::Metadata`].
///

View file

@ -8,7 +8,7 @@
definitions")]
#![allow(deprecated)]
use os::raw::c_long;
use crate::os::raw::c_long;
#[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = u64;
#[stable(feature = "raw_ext", since = "1.1.0")] pub type blksize_t = u64;

View file

@ -1,12 +1,10 @@
#![stable(feature = "metadata_ext", since = "1.1.0")]
use libc;
use fs::Metadata;
use sys_common::AsInner;
use crate::fs::Metadata;
use crate::sys_common::AsInner;
#[allow(deprecated)]
use os::emscripten::raw;
use crate::os::emscripten::raw;
/// OS-specific extensions to [`fs::Metadata`].
///

View file

@ -10,7 +10,7 @@
definitions")]
#![allow(deprecated)]
use os::raw::{c_long, c_short, c_uint, c_ulong};
use crate::os::raw::{c_long, c_short, c_uint, c_ulong};
#[stable(feature = "raw_ext", since = "1.1.0")] pub type dev_t = u64;
#[stable(feature = "raw_ext", since = "1.1.0")] pub type mode_t = u32;

View file

@ -11,34 +11,35 @@
///
/// [ABI documentation]: https://docs.rs/fortanix-sgx-abi/
pub mod usercalls {
pub use sys::abi::usercalls::*;
pub use crate::sys::abi::usercalls::*;
/// Primitives for allocating memory in userspace as well as copying data
/// to and from user memory.
pub mod alloc {
pub use sys::abi::usercalls::alloc::*;
pub use crate::sys::abi::usercalls::alloc::*;
}
/// Lowest-level interfaces to usercalls and usercall ABI type definitions.
pub mod raw {
pub use sys::abi::usercalls::raw::{do_usercall, Usercalls as UsercallNrs};
pub use sys::abi::usercalls::raw::{accept_stream, alloc, async_queues, bind_stream, close,
connect_stream, exit, flush, free, insecure_time,
pub use crate::sys::abi::usercalls::raw::{do_usercall, Usercalls as UsercallNrs};
pub use crate::sys::abi::usercalls::raw::{accept_stream, alloc, async_queues, bind_stream,
close, connect_stream, exit, flush, free, insecure_time,
launch_thread, read, read_alloc, send, wait, write};
// fortanix-sgx-abi re-exports
pub use sys::abi::usercalls::raw::{ByteBuffer, FifoDescriptor, Return, Usercall};
pub use sys::abi::usercalls::raw::Error;
pub use sys::abi::usercalls::raw::{EV_RETURNQ_NOT_EMPTY, EV_UNPARK, EV_USERCALLQ_NOT_FULL,
FD_STDERR, FD_STDIN, FD_STDOUT, RESULT_SUCCESS,
USERCALL_USER_DEFINED, WAIT_INDEFINITE, WAIT_NO};
pub use sys::abi::usercalls::raw::{Fd, Result, Tcs};
pub use crate::sys::abi::usercalls::raw::{ByteBuffer, FifoDescriptor, Return, Usercall};
pub use crate::sys::abi::usercalls::raw::Error;
pub use crate::sys::abi::usercalls::raw::{EV_RETURNQ_NOT_EMPTY, EV_UNPARK,
EV_USERCALLQ_NOT_FULL, FD_STDERR, FD_STDIN, FD_STDOUT,
RESULT_SUCCESS, USERCALL_USER_DEFINED, WAIT_INDEFINITE,
WAIT_NO};
pub use crate::sys::abi::usercalls::raw::{Fd, Result, Tcs};
}
}
/// Functions for querying mapping information for pointers.
pub mod mem {
pub use sys::abi::mem::*;
pub use crate::sys::abi::mem::*;
}
pub use sys::ext::{io, arch, ffi};
pub use crate::sys::ext::{io, arch, ffi};

View file

@ -1,12 +1,10 @@
#![stable(feature = "metadata_ext", since = "1.1.0")]
use libc;
use fs::Metadata;
use sys_common::AsInner;
use crate::fs::Metadata;
use crate::sys_common::AsInner;
#[allow(deprecated)]
use os::freebsd::raw;
use crate::os::freebsd::raw;
/// OS-specific extensions to [`fs::Metadata`].
///

View file

@ -8,7 +8,7 @@
definitions")]
#![allow(deprecated)]
use os::raw::c_long;
use crate::os::raw::c_long;
#[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = u64;
#[stable(feature = "raw_ext", since = "1.1.0")] pub type blksize_t = u64;

View file

@ -1,7 +1,7 @@
#![stable(feature = "metadata_ext", since = "1.1.0")]
use fs::Metadata;
use sys_common::AsInner;
use crate::fs::Metadata;
use crate::sys_common::AsInner;
/// OS-specific extensions to [`fs::Metadata`].
///

View file

@ -8,7 +8,7 @@
definitions")]
#![allow(deprecated)]
use os::raw::c_ulong;
use crate::os::raw::c_ulong;
#[stable(feature = "raw_ext", since = "1.1.0")] pub type dev_t = u64;
#[stable(feature = "raw_ext", since = "1.1.0")] pub type mode_t = u32;
@ -25,7 +25,7 @@
target_arch = "powerpc",
target_arch = "arm"))]
mod arch {
use os::raw::{c_long, c_short, c_uint};
use crate::os::raw::{c_long, c_short, c_uint};
#[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = u64;
#[stable(feature = "raw_ext", since = "1.1.0")] pub type blksize_t = u64;
@ -81,7 +81,7 @@ pub struct stat {
#[cfg(target_arch = "mips")]
mod arch {
use os::raw::{c_long, c_ulong};
use crate::os::raw::{c_long, c_ulong};
#[cfg(target_env = "musl")]
#[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = i64;
@ -151,7 +151,7 @@ mod arch {
#[cfg(target_arch = "aarch64")]
mod arch {
use os::raw::{c_long, c_int};
use crate::os::raw::{c_long, c_int};
#[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = u64;
#[stable(feature = "raw_ext", since = "1.1.0")] pub type blksize_t = u64;
@ -207,7 +207,7 @@ pub struct stat {
#[cfg(target_arch = "x86_64")]
mod arch {
use os::raw::{c_long, c_int};
use crate::os::raw::{c_long, c_int};
#[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = u64;
#[stable(feature = "raw_ext", since = "1.1.0")] pub type blksize_t = u64;

View file

@ -1,12 +1,10 @@
#![stable(feature = "metadata_ext", since = "1.1.0")]
use libc;
use fs::Metadata;
use sys_common::AsInner;
use crate::fs::Metadata;
use crate::sys_common::AsInner;
#[allow(deprecated)]
use os::haiku::raw;
use crate::os::haiku::raw;
/// OS-specific extensions to [`fs::Metadata`].
///

View file

@ -4,8 +4,8 @@
#![allow(deprecated)]
use os::raw::{c_long};
use os::unix::raw::{uid_t, gid_t};
use crate::os::raw::{c_long};
use crate::os::unix::raw::{uid_t, gid_t};
// Use the direct definition of usize, instead of uintptr_t like in libc
#[stable(feature = "pthread_t", since = "1.8.0")] pub type pthread_t = usize;

View file

@ -1,12 +1,10 @@
#![stable(feature = "metadata_ext", since = "1.1.0")]
use libc;
use fs::Metadata;
use sys_common::AsInner;
use crate::fs::Metadata;
use crate::sys_common::AsInner;
#[allow(deprecated)]
use os::hermit::raw;
use crate::os::hermit::raw;
/// OS-specific extensions to [`fs::Metadata`].
///

View file

@ -1,12 +1,10 @@
#![stable(feature = "metadata_ext", since = "1.1.0")]
use libc;
use fs::Metadata;
use sys_common::AsInner;
use crate::fs::Metadata;
use crate::sys_common::AsInner;
#[allow(deprecated)]
use os::ios::raw;
use crate::os::ios::raw;
/// OS-specific extensions to [`fs::Metadata`].
///

View file

@ -8,7 +8,7 @@
definitions")]
#![allow(deprecated)]
use os::raw::c_long;
use crate::os::raw::c_long;
#[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = u64;
#[stable(feature = "raw_ext", since = "1.1.0")] pub type blksize_t = u64;

View file

@ -1,12 +1,10 @@
#![stable(feature = "metadata_ext", since = "1.1.0")]
use libc;
use fs::Metadata;
use sys_common::AsInner;
use crate::fs::Metadata;
use crate::sys_common::AsInner;
#[allow(deprecated)]
use os::linux::raw;
use crate::os::linux::raw;
/// OS-specific extensions to [`fs::Metadata`].
///

View file

@ -9,7 +9,7 @@
#![allow(deprecated)]
#![allow(missing_debug_implementations)]
use os::raw::c_ulong;
use crate::os::raw::c_ulong;
#[stable(feature = "raw_ext", since = "1.1.0")] pub type dev_t = u64;
#[stable(feature = "raw_ext", since = "1.1.0")] pub type mode_t = u32;
@ -28,7 +28,7 @@
target_arch = "asmjs",
target_arch = "wasm32"))]
mod arch {
use os::raw::{c_long, c_short, c_uint};
use crate::os::raw::{c_long, c_short, c_uint};
#[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = u64;
#[stable(feature = "raw_ext", since = "1.1.0")] pub type blksize_t = u64;
@ -84,7 +84,7 @@ pub struct stat {
#[cfg(target_arch = "mips")]
mod arch {
use os::raw::{c_long, c_ulong};
use crate::os::raw::{c_long, c_ulong};
#[cfg(target_env = "musl")]
#[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = i64;
@ -156,7 +156,7 @@ mod arch {
#[cfg(target_arch = "aarch64")]
mod arch {
use os::raw::{c_long, c_int};
use crate::os::raw::{c_long, c_int};
#[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = u64;
#[stable(feature = "raw_ext", since = "1.1.0")] pub type blksize_t = u64;
@ -212,7 +212,7 @@ pub struct stat {
#[cfg(any(target_arch = "x86_64", target_arch = "powerpc64"))]
mod arch {
use os::raw::{c_long, c_int};
use crate::os::raw::{c_long, c_int};
#[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = u64;
#[stable(feature = "raw_ext", since = "1.1.0")] pub type blksize_t = u64;

View file

@ -1,12 +1,10 @@
#![stable(feature = "metadata_ext", since = "1.1.0")]
use libc;
use fs::Metadata;
use sys_common::AsInner;
use crate::fs::Metadata;
use crate::sys_common::AsInner;
#[allow(deprecated)]
use os::macos::raw;
use crate::os::macos::raw;
/// OS-specific extensions to [`fs::Metadata`].
///

View file

@ -8,7 +8,7 @@
definitions")]
#![allow(deprecated)]
use os::raw::c_long;
use crate::os::raw::c_long;
#[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = u64;
#[stable(feature = "raw_ext", since = "1.1.0")] pub type blksize_t = u64;

View file

@ -12,10 +12,10 @@
// cross-platform way in the documentation
#[stable(feature = "rust1", since = "1.0.0")]
pub use sys::unix_ext as unix;
pub use crate::sys::unix_ext as unix;
#[stable(feature = "rust1", since = "1.0.0")]
pub use sys::windows_ext as windows;
pub use crate::sys::windows_ext as windows;
#[doc(cfg(target_os = "linux"))]
pub mod linux;
@ -26,11 +26,11 @@
#[cfg(any(target_os = "redox", unix))]
#[stable(feature = "rust1", since = "1.0.0")]
pub use sys::ext as unix;
pub use crate::sys::ext as unix;
#[cfg(windows)]
#[stable(feature = "rust1", since = "1.0.0")]
pub use sys::ext as windows;
pub use crate::sys::ext as windows;
#[cfg(any(target_os = "linux", target_os = "l4re"))]
pub mod linux;

View file

@ -1,12 +1,10 @@
#![stable(feature = "metadata_ext", since = "1.1.0")]
use libc;
use fs::Metadata;
use sys_common::AsInner;
use crate::fs::Metadata;
use crate::sys_common::AsInner;
#[allow(deprecated)]
use os::netbsd::raw;
use crate::os::netbsd::raw;
/// OS-specific extensions to [`fs::Metadata`].
///

View file

@ -8,8 +8,8 @@
definitions")]
#![allow(deprecated)]
use os::raw::c_long;
use os::unix::raw::{uid_t, gid_t};
use crate::os::raw::c_long;
use crate::os::unix::raw::{uid_t, gid_t};
#[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = u64;
#[stable(feature = "raw_ext", since = "1.1.0")] pub type blksize_t = u64;

View file

@ -1,12 +1,10 @@
#![stable(feature = "metadata_ext", since = "1.1.0")]
use libc;
use fs::Metadata;
use sys_common::AsInner;
use crate::fs::Metadata;
use crate::sys_common::AsInner;
#[allow(deprecated)]
use os::openbsd::raw;
use crate::os::openbsd::raw;
/// OS-specific extensions to [`fs::Metadata`].
///

View file

@ -8,7 +8,7 @@
definitions")]
#![allow(deprecated)]
use os::raw::c_long;
use crate::os::raw::c_long;
#[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = u64;
#[stable(feature = "raw_ext", since = "1.1.0")] pub type blksize_t = u64;

View file

@ -86,9 +86,8 @@
#[cfg(test)]
#[allow(unused_imports)]
mod tests {
use any::TypeId;
use libc;
use mem;
use crate::any::TypeId;
use crate::mem;
macro_rules! ok {
($($t:ident)*) => {$(
@ -99,7 +98,7 @@ macro_rules! ok {
#[test]
fn same() {
use os::raw;
use crate::os::raw;
ok!(c_char c_schar c_uchar c_short c_ushort c_int c_uint c_long c_ulong
c_longlong c_ulonglong c_float c_double);
}

View file

@ -1,12 +1,10 @@
#![stable(feature = "metadata_ext", since = "1.1.0")]
use libc;
use fs::Metadata;
use sys_common::AsInner;
use crate::fs::Metadata;
use crate::sys_common::AsInner;
#[allow(deprecated)]
use os::solaris::raw;
use crate::os::solaris::raw;
/// OS-specific extensions to [`fs::Metadata`].
///

View file

@ -8,8 +8,8 @@
definitions")]
#![allow(deprecated)]
use os::raw::c_long;
use os::unix::raw::{uid_t, gid_t};
use crate::os::raw::c_long;
use crate::os::unix::raw::{uid_t, gid_t};
#[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = u64;
#[stable(feature = "raw_ext", since = "1.1.0")] pub type blksize_t = u64;

View file

@ -2,21 +2,21 @@
#![stable(feature = "std_panic", since = "1.9.0")]
use any::Any;
use cell::UnsafeCell;
use fmt;
use future::Future;
use pin::Pin;
use ops::{Deref, DerefMut};
use panicking;
use ptr::{Unique, NonNull};
use rc::Rc;
use sync::{Arc, Mutex, RwLock, atomic};
use task::{Waker, Poll};
use thread::Result;
use crate::any::Any;
use crate::cell::UnsafeCell;
use crate::fmt;
use crate::future::Future;
use crate::pin::Pin;
use crate::ops::{Deref, DerefMut};
use crate::panicking;
use crate::ptr::{Unique, NonNull};
use crate::rc::Rc;
use crate::sync::{Arc, Mutex, RwLock, atomic};
use crate::task::{Waker, Poll};
use crate::thread::Result;
#[stable(feature = "panic_hooks", since = "1.10.0")]
pub use panicking::{take_hook, set_hook};
pub use crate::panicking::{take_hook, set_hook};
#[stable(feature = "panic_hooks", since = "1.10.0")]
pub use core::panic::{PanicInfo, Location};
@ -385,7 +385,7 @@ fn poll(self: Pin<&mut Self>, waker: &Waker) -> Poll<Self::Output> {
#[stable(feature = "catch_unwind", since = "1.9.0")]
pub fn catch_unwind<F: FnOnce() -> R + UnwindSafe, R>(f: F) -> Result<R> {
unsafe {
panicking::try(f)
panicking::r#try(f)
}
}

View file

@ -8,22 +8,22 @@
//! * Shims around "try"
use core::panic::BoxMeUp;
use io::prelude::*;
use any::Any;
use cell::RefCell;
use core::panic::{PanicInfo, Location};
use fmt;
use intrinsics;
use mem;
use ptr;
use raw;
use sys::stdio::panic_output;
use sys_common::rwlock::RWLock;
use sys_common::thread_info;
use sys_common::util;
use thread;
use crate::io::prelude::*;
use crate::any::Any;
use crate::cell::RefCell;
use crate::fmt;
use crate::intrinsics;
use crate::mem;
use crate::ptr;
use crate::raw;
use crate::sys::stdio::panic_output;
use crate::sys_common::rwlock::RWLock;
use crate::sys_common::thread_info;
use crate::sys_common::util;
use crate::thread;
thread_local! {
pub static LOCAL_STDERR: RefCell<Option<Box<dyn Write + Send>>> = {
@ -159,7 +159,7 @@ pub fn take_hook() -> Box<dyn Fn(&PanicInfo) + 'static + Sync + Send> {
fn default_hook(info: &PanicInfo) {
#[cfg(feature = "backtrace")]
use sys_common::backtrace;
use crate::sys_common::backtrace;
// If this is a double panic, make sure that we print a backtrace
// for this panic. Otherwise only print it if logging is enabled.
@ -186,13 +186,13 @@ fn default_hook(info: &PanicInfo) {
let thread = thread_info::current_thread();
let name = thread.as_ref().and_then(|t| t.name()).unwrap_or("<unnamed>");
let write = |err: &mut dyn (::io::Write)| {
let write = |err: &mut dyn crate::io::Write| {
let _ = writeln!(err, "thread '{}' panicked at '{}', {}",
name, msg, location);
#[cfg(feature = "backtrace")]
{
use sync::atomic::{AtomicBool, Ordering};
use crate::sync::atomic::{AtomicBool, Ordering};
static FIRST_PANIC: AtomicBool = AtomicBool::new(true);
@ -221,7 +221,7 @@ fn default_hook(info: &PanicInfo) {
#[doc(hidden)]
#[unstable(feature = "update_panic_count", issue = "0")]
pub fn update_panic_count(amt: isize) -> usize {
use cell::Cell;
use crate::cell::Cell;
thread_local! { static PANIC_COUNT: Cell<usize> = Cell::new(0) }
PANIC_COUNT.with(|c| {
@ -235,7 +235,7 @@ pub fn update_panic_count(amt: isize) -> usize {
pub use realstd::rt::update_panic_count;
/// Invoke a closure, capturing the cause of an unwinding panic if one occurs.
pub unsafe fn try<R, F: FnOnce() -> R>(f: F) -> Result<R, Box<dyn Any + Send>> {
pub unsafe fn r#try<R, F: FnOnce() -> R>(f: F) -> Result<R, Box<dyn Any + Send>> {
#[allow(unions_with_drop_fields)]
union Data<F, R> {
f: F,
@ -352,7 +352,7 @@ fn new(inner: &'a fmt::Arguments<'a>) -> PanicPayload<'a> {
}
fn fill(&mut self) -> &mut String {
use fmt::Write;
use crate::fmt::Write;
let inner = self.inner;
self.string.get_or_insert_with(|| {

View file

@ -67,22 +67,22 @@
#![stable(feature = "rust1", since = "1.0.0")]
use borrow::{Borrow, Cow};
use cmp;
use error::Error;
use fmt;
use fs;
use hash::{Hash, Hasher};
use io;
use iter::{self, FusedIterator};
use ops::{self, Deref};
use rc::Rc;
use str::FromStr;
use sync::Arc;
use crate::borrow::{Borrow, Cow};
use crate::cmp;
use crate::error::Error;
use crate::fmt;
use crate::fs;
use crate::hash::{Hash, Hasher};
use crate::io;
use crate::iter::{self, FusedIterator};
use crate::ops::{self, Deref};
use crate::rc::Rc;
use crate::str::FromStr;
use crate::sync::Arc;
use ffi::{OsStr, OsString};
use crate::ffi::{OsStr, OsString};
use sys::path::{is_sep_byte, is_verbatim_sep, MAIN_SEP_STR, parse_prefix};
use crate::sys::path::{is_sep_byte, is_verbatim_sep, MAIN_SEP_STR, parse_prefix};
////////////////////////////////////////////////////////////////////////////////
// GENERAL NOTES
@ -279,7 +279,7 @@ pub fn is_separator(c: char) -> bool {
///
/// For example, `/` on Unix and `\` on Windows.
#[stable(feature = "rust1", since = "1.0.0")]
pub const MAIN_SEPARATOR: char = ::sys::path::MAIN_SEP;
pub const MAIN_SEPARATOR: char = crate::sys::path::MAIN_SEP;
////////////////////////////////////////////////////////////////////////////////
// Misc helpers
@ -2819,8 +2819,8 @@ fn description(&self) -> &str { "prefix not found" }
mod tests {
use super::*;
use rc::Rc;
use sync::Arc;
use crate::rc::Rc;
use crate::sync::Arc;
macro_rules! t(
($path:expr, iter: $iter:expr) => (
@ -2907,7 +2907,7 @@ macro_rules! t(
#[test]
fn into() {
use borrow::Cow;
use crate::borrow::Cow;
let static_path = Path::new("/home/foo");
let static_cow_path: Cow<'static, Path> = static_path.into();
@ -4007,7 +4007,7 @@ macro_rules! tfe(
#[test]
fn test_eq_receivers() {
use borrow::Cow;
use crate::borrow::Cow;
let borrowed: &Path = Path::new("foo/bar");
let mut owned: PathBuf = PathBuf::new();
@ -4032,8 +4032,8 @@ macro_rules! t {
#[test]
pub fn test_compare() {
use hash::{Hash, Hasher};
use collections::hash_map::DefaultHasher;
use crate::hash::{Hash, Hasher};
use crate::collections::hash_map::DefaultHasher;
fn hash<T: Hash>(t: T) -> u64 {
let mut s = DefaultHasher::new();

View file

@ -9,41 +9,41 @@
// Re-exported core operators
#[stable(feature = "rust1", since = "1.0.0")]
#[doc(no_inline)]
pub use marker::{Copy, Send, Sized, Sync, Unpin};
pub use crate::marker::{Copy, Send, Sized, Sync, Unpin};
#[stable(feature = "rust1", since = "1.0.0")]
#[doc(no_inline)]
pub use ops::{Drop, Fn, FnMut, FnOnce};
pub use crate::ops::{Drop, Fn, FnMut, FnOnce};
// Re-exported functions
#[stable(feature = "rust1", since = "1.0.0")]
#[doc(no_inline)]
pub use mem::drop;
pub use crate::mem::drop;
// Re-exported types and traits
#[stable(feature = "rust1", since = "1.0.0")]
#[doc(no_inline)]
pub use clone::Clone;
pub use crate::clone::Clone;
#[stable(feature = "rust1", since = "1.0.0")]
#[doc(no_inline)]
pub use cmp::{PartialEq, PartialOrd, Eq, Ord};
pub use crate::cmp::{PartialEq, PartialOrd, Eq, Ord};
#[stable(feature = "rust1", since = "1.0.0")]
#[doc(no_inline)]
pub use convert::{AsRef, AsMut, Into, From};
pub use crate::convert::{AsRef, AsMut, Into, From};
#[stable(feature = "rust1", since = "1.0.0")]
#[doc(no_inline)]
pub use default::Default;
pub use crate::default::Default;
#[stable(feature = "rust1", since = "1.0.0")]
#[doc(no_inline)]
pub use iter::{Iterator, Extend, IntoIterator};
pub use crate::iter::{Iterator, Extend, IntoIterator};
#[stable(feature = "rust1", since = "1.0.0")]
#[doc(no_inline)]
pub use iter::{DoubleEndedIterator, ExactSizeIterator};
pub use crate::iter::{DoubleEndedIterator, ExactSizeIterator};
#[stable(feature = "rust1", since = "1.0.0")]
#[doc(no_inline)]
pub use option::Option::{self, Some, None};
pub use crate::option::Option::{self, Some, None};
#[stable(feature = "rust1", since = "1.0.0")]
#[doc(no_inline)]
pub use result::Result::{self, Ok, Err};
pub use crate::result::Result::{self, Ok, Err};
// The file so far is equivalent to src/libcore/prelude/v1.rs,
@ -54,16 +54,16 @@
#[stable(feature = "rust1", since = "1.0.0")]
#[doc(no_inline)]
pub use boxed::Box;
pub use crate::boxed::Box;
#[stable(feature = "rust1", since = "1.0.0")]
#[doc(no_inline)]
pub use borrow::ToOwned;
pub use crate::borrow::ToOwned;
#[stable(feature = "rust1", since = "1.0.0")]
#[doc(no_inline)]
pub use slice::SliceConcatExt;
pub use crate::slice::SliceConcatExt;
#[stable(feature = "rust1", since = "1.0.0")]
#[doc(no_inline)]
pub use string::{String, ToString};
pub use crate::string::{String, ToString};
#[stable(feature = "rust1", since = "1.0.0")]
#[doc(no_inline)]
pub use vec::Vec;
pub use crate::vec::Vec;

View file

@ -106,17 +106,17 @@
#![stable(feature = "process", since = "1.0.0")]
use io::prelude::*;
use crate::io::prelude::*;
use ffi::OsStr;
use fmt;
use fs;
use io::{self, Initializer};
use path::Path;
use str;
use sys::pipe::{read2, AnonPipe};
use sys::process as imp;
use sys_common::{AsInner, AsInnerMut, FromInner, IntoInner};
use crate::ffi::OsStr;
use crate::fmt;
use crate::fs;
use crate::io::{self, Initializer};
use crate::path::Path;
use crate::str;
use crate::sys::pipe::{read2, AnonPipe};
use crate::sys::process as imp;
use crate::sys_common::{AsInner, AsInnerMut, FromInner, IntoInner};
/// Representation of a running or exited child process.
///
@ -1481,8 +1481,8 @@ pub fn wait_with_output(mut self) -> io::Result<Output> {
/// [platform-specific behavior]: #platform-specific-behavior
#[stable(feature = "rust1", since = "1.0.0")]
pub fn exit(code: i32) -> ! {
::sys_common::cleanup();
::sys::os::exit(code)
crate::sys_common::cleanup();
crate::sys::os::exit(code)
}
/// Terminates the process in an abnormal fashion.
@ -1543,7 +1543,7 @@ pub fn exit(code: i32) -> ! {
/// [panic hook]: ../../std/panic/fn.set_hook.html
#[stable(feature = "process_abort", since = "1.17.0")]
pub fn abort() -> ! {
unsafe { ::sys::abort_internal() };
unsafe { crate::sys::abort_internal() };
}
/// Returns the OS-assigned process identifier associated with this process.
@ -1561,7 +1561,7 @@ pub fn abort() -> ! {
///
#[stable(feature = "getpid", since = "1.26.0")]
pub fn id() -> u32 {
::sys::os::getpid()
crate::sys::os::getpid()
}
/// A trait for implementing arbitrary return types in the `main` function.
@ -1623,10 +1623,10 @@ fn report(self) -> i32 {
#[cfg(all(test, not(any(target_os = "cloudabi", target_os = "emscripten"))))]
mod tests {
use io::prelude::*;
use crate::io::prelude::*;
use io::ErrorKind;
use str;
use crate::io::ErrorKind;
use crate::str;
use super::{Command, Output, Stdio};
// FIXME(#10380) these tests should not all be ignored on android.
@ -1671,7 +1671,7 @@ fn exit_reported_right() {
#[cfg(unix)]
#[cfg_attr(target_os = "android", ignore)]
fn signal_reported_right() {
use os::unix::process::ExitStatusExt;
use crate::os::unix::process::ExitStatusExt;
let mut p = Command::new("/bin/sh")
.arg("-c").arg("read a")
@ -1741,8 +1741,8 @@ fn stdin_works() {
#[cfg_attr(target_os = "android", ignore)]
#[cfg(unix)]
fn uid_works() {
use os::unix::prelude::*;
use libc;
use crate::os::unix::prelude::*;
let mut p = Command::new("/bin/sh")
.arg("-c").arg("true")
.uid(unsafe { libc::getuid() })
@ -1755,8 +1755,7 @@ fn uid_works() {
#[cfg_attr(target_os = "android", ignore)]
#[cfg(unix)]
fn uid_to_root_fails() {
use os::unix::prelude::*;
use libc;
use crate::os::unix::prelude::*;
// if we're already root, this isn't a valid test. Most of the bots run
// as non-root though (android is an exception).
@ -1881,7 +1880,7 @@ pub fn env_cmd() -> Command {
#[test]
fn test_override_env() {
use env;
use crate::env;
// In some build environments (such as chrooted Nix builds), `env` can
// only be found in the explicitly-provided PATH env variable, not in
@ -1910,7 +1909,7 @@ fn test_add_to_env() {
#[test]
fn test_capture_env_at_spawn() {
use env;
use crate::env;
let mut cmd = env_cmd();
cmd.env("RUN_TEST_NEW_ENV1", "123");
@ -1985,8 +1984,8 @@ fn test_interior_nul_in_env_value_is_error() {
#[test]
#[cfg(windows)]
fn test_creation_flags() {
use os::windows::process::CommandExt;
use sys::c::{BOOL, DWORD, INFINITE};
use crate::os::windows::process::CommandExt;
use crate::sys::c::{BOOL, DWORD, INFINITE};
#[repr(C, packed)]
struct DEBUG_EVENT {
pub event_code: DWORD,

View file

@ -14,18 +14,18 @@
// Re-export some of our utilities which are expected by other crates.
pub use panicking::{begin_panic, begin_panic_fmt, update_panic_count};
pub use crate::panicking::{begin_panic, begin_panic_fmt, update_panic_count};
// To reduce the generated code of the new `lang_start`, this function is doing
// the real work.
#[cfg(not(test))]
fn lang_start_internal(main: &(dyn Fn() -> i32 + Sync + ::panic::RefUnwindSafe),
fn lang_start_internal(main: &(dyn Fn() -> i32 + Sync + crate::panic::RefUnwindSafe),
argc: isize, argv: *const *const u8) -> isize {
use panic;
use sys;
use sys_common;
use sys_common::thread_info;
use thread::Thread;
use crate::panic;
use crate::sys;
use crate::sys_common;
use crate::sys_common::thread_info;
use crate::thread::Thread;
sys::init();
@ -46,7 +46,7 @@ fn lang_start_internal(main: &(dyn Fn() -> i32 + Sync + ::panic::RefUnwindSafe),
// Let's run some code!
#[cfg(feature = "backtrace")]
let exit_code = panic::catch_unwind(|| {
::sys_common::backtrace::__rust_begin_short_backtrace(move || main())
sys_common::backtrace::__rust_begin_short_backtrace(move || main())
});
#[cfg(not(feature = "backtrace"))]
let exit_code = panic::catch_unwind(move || main());
@ -58,7 +58,7 @@ fn lang_start_internal(main: &(dyn Fn() -> i32 + Sync + ::panic::RefUnwindSafe),
#[cfg(not(test))]
#[lang = "start"]
fn lang_start<T: ::process::Termination + 'static>
fn lang_start<T: crate::process::Termination + 'static>
(main: fn() -> T, argc: isize, argv: *const *const u8) -> isize
{
lang_start_internal(&move || main().report(), argc, argv)

View file

@ -1,5 +1,5 @@
use fmt;
use sync::{Mutex, Condvar};
use crate::fmt;
use crate::sync::{Mutex, Condvar};
/// A barrier enables multiple threads to synchronize the beginning
/// of some computation.
@ -181,9 +181,9 @@ pub fn is_leader(&self) -> bool { self.0 }
#[cfg(test)]
mod tests {
use sync::{Arc, Barrier};
use sync::mpsc::{channel, TryRecvError};
use thread;
use crate::sync::{Arc, Barrier};
use crate::sync::mpsc::{channel, TryRecvError};
use crate::thread;
#[test]
#[cfg_attr(target_os = "emscripten", ignore)]

View file

@ -1,10 +1,10 @@
use fmt;
use sync::atomic::{AtomicUsize, Ordering};
use sync::{mutex, MutexGuard, PoisonError};
use sys_common::condvar as sys;
use sys_common::mutex as sys_mutex;
use sys_common::poison::{self, LockResult};
use time::{Duration, Instant};
use crate::fmt;
use crate::sync::atomic::{AtomicUsize, Ordering};
use crate::sync::{mutex, MutexGuard, PoisonError};
use crate::sys_common::condvar as sys;
use crate::sys_common::mutex as sys_mutex;
use crate::sys_common::poison::{self, LockResult};
use crate::time::{Duration, Instant};
/// A type indicating whether a timed wait on a condition variable returned
/// due to a time out or not.
@ -612,12 +612,12 @@ fn drop(&mut self) {
#[cfg(test)]
mod tests {
/// #![feature(wait_until)]
use sync::mpsc::channel;
use sync::{Condvar, Mutex, Arc};
use sync::atomic::{AtomicBool, Ordering};
use thread;
use time::Duration;
use u64;
use crate::sync::mpsc::channel;
use crate::sync::{Condvar, Mutex, Arc};
use crate::sync::atomic::{AtomicBool, Ordering};
use crate::thread;
use crate::time::Duration;
use crate::u64;
#[test]
fn smoke() {

View file

@ -165,7 +165,7 @@
#[stable(feature = "rust1", since = "1.0.0")]
pub use self::once::{Once, OnceState, ONCE_INIT};
#[stable(feature = "rust1", since = "1.0.0")]
pub use sys_common::poison::{PoisonError, TryLockError, TryLockResult, LockResult};
pub use crate::sys_common::poison::{PoisonError, TryLockError, TryLockResult, LockResult};
#[stable(feature = "rust1", since = "1.0.0")]
pub use self::rwlock::{RwLock, RwLockReadGuard, RwLockWriteGuard};

View file

@ -1,10 +1,10 @@
//! Generic support for building blocking abstractions.
use thread::{self, Thread};
use sync::atomic::{AtomicBool, Ordering};
use sync::Arc;
use mem;
use time::Instant;
use crate::thread::{self, Thread};
use crate::sync::atomic::{AtomicBool, Ordering};
use crate::sync::Arc;
use crate::mem;
use crate::time::Instant;
struct Inner {
thread: Thread,

View file

@ -1,4 +1,4 @@
use ops::{Deref, DerefMut};
use crate::ops::{Deref, DerefMut};
#[derive(Copy, Clone, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[repr(align(64))]

View file

@ -266,12 +266,12 @@
// And now that you've seen all the races that I found and attempted to fix,
// here's the code for you to find some more!
use sync::Arc;
use error;
use fmt;
use mem;
use cell::UnsafeCell;
use time::{Duration, Instant};
use crate::sync::Arc;
use crate::error;
use crate::fmt;
use crate::mem;
use crate::cell::UnsafeCell;
use crate::time::{Duration, Instant};
#[unstable(feature = "mpsc_select", issue = "27800")]
pub use self::select::{Select, Handle};
@ -1822,10 +1822,10 @@ fn from(err: RecvError) -> RecvTimeoutError {
#[cfg(all(test, not(target_os = "emscripten")))]
mod tests {
use env;
use super::*;
use thread;
use time::{Duration, Instant};
use crate::env;
use crate::thread;
use crate::time::{Duration, Instant};
pub fn stress_factor() -> usize {
match env::var("RUST_TEST_STRESS") {
@ -2514,10 +2514,10 @@ fn issue_32114() {
#[cfg(all(test, not(target_os = "emscripten")))]
mod sync_tests {
use env;
use thread;
use super::*;
use time::Duration;
use crate::env;
use crate::thread;
use crate::time::Duration;
pub fn stress_factor() -> usize {
match env::var("RUST_TEST_STRESS") {

View file

@ -15,8 +15,9 @@
use core::ptr;
use core::cell::UnsafeCell;
use boxed::Box;
use sync::atomic::{AtomicPtr, Ordering};
use crate::boxed::Box;
use crate::sync::atomic::{AtomicPtr, Ordering};
/// A result of the `pop` function.
pub enum PopResult<T> {
@ -120,10 +121,10 @@ fn drop(&mut self) {
#[cfg(all(test, not(target_os = "emscripten")))]
mod tests {
use sync::mpsc::channel;
use super::{Queue, Data, Empty, Inconsistent};
use sync::Arc;
use thread;
use crate::sync::mpsc::channel;
use crate::sync::Arc;
use crate::thread;
#[test]
fn test_full() {

View file

@ -27,12 +27,12 @@
pub use self::SelectionResult::*;
use self::MyUpgrade::*;
use sync::mpsc::Receiver;
use sync::mpsc::blocking::{self, SignalToken};
use cell::UnsafeCell;
use ptr;
use sync::atomic::{AtomicUsize, Ordering};
use time::Instant;
use crate::sync::mpsc::Receiver;
use crate::sync::mpsc::blocking::{self, SignalToken};
use crate::cell::UnsafeCell;
use crate::ptr;
use crate::sync::atomic::{AtomicUsize, Ordering};
use crate::time::Instant;
// Various states you can find a port in.
const EMPTY: usize = 0; // initial state: no data, no blocked receiver

View file

@ -46,16 +46,14 @@
#![rustc_deprecated(since = "1.32.0",
reason = "channel selection will be removed in a future release")]
use fmt;
use core::cell::{Cell, UnsafeCell};
use core::marker;
use core::ptr;
use core::usize;
use sync::mpsc::{Receiver, RecvError};
use sync::mpsc::blocking::{self, SignalToken};
use crate::fmt;
use crate::sync::mpsc::{Receiver, RecvError};
use crate::sync::mpsc::blocking::{self, SignalToken};
/// The "receiver set" of the select interface. This structure is used to manage
/// a set of receivers which are being selected over.

View file

@ -2,8 +2,8 @@
/// This file exists to hack around https://github.com/rust-lang/rust/issues/47238
use thread;
use sync::mpsc::*;
use crate::thread;
use crate::sync::mpsc::*;
// Don't use the libstd version so we can pull in the right Select structure
// (std::comm points at the wrong one)

View file

@ -14,16 +14,16 @@
use core::intrinsics::abort;
use core::isize;
use cell::UnsafeCell;
use ptr;
use sync::atomic::{AtomicUsize, AtomicIsize, AtomicBool, Ordering};
use sync::mpsc::blocking::{self, SignalToken};
use sync::mpsc::mpsc_queue as mpsc;
use sync::mpsc::select::StartResult::*;
use sync::mpsc::select::StartResult;
use sync::{Mutex, MutexGuard};
use thread;
use time::Instant;
use crate::cell::UnsafeCell;
use crate::ptr;
use crate::sync::atomic::{AtomicUsize, AtomicIsize, AtomicBool, Ordering};
use crate::sync::mpsc::blocking::{self, SignalToken};
use crate::sync::mpsc::mpsc_queue as mpsc;
use crate::sync::mpsc::select::StartResult::*;
use crate::sync::mpsc::select::StartResult;
use crate::sync::{Mutex, MutexGuard};
use crate::thread;
use crate::time::Instant;
const DISCONNECTED: isize = isize::MIN;
const FUDGE: isize = 1024;

View file

@ -6,11 +6,11 @@
// http://www.1024cores.net/home/lock-free-algorithms/queues/unbounded-spsc-queue
use boxed::Box;
use core::ptr;
use core::cell::UnsafeCell;
use sync::atomic::{AtomicPtr, AtomicUsize, Ordering};
use crate::boxed::Box;
use crate::sync::atomic::{AtomicPtr, AtomicUsize, Ordering};
use super::cache_aligned::CacheAligned;
@ -233,10 +233,10 @@ fn drop(&mut self) {
#[cfg(all(test, not(target_os = "emscripten")))]
mod tests {
use sync::Arc;
use super::Queue;
use thread;
use sync::mpsc::channel;
use crate::sync::Arc;
use crate::thread;
use crate::sync::mpsc::channel;
#[test]
fn smoke() {

View file

@ -12,17 +12,18 @@
pub use self::SelectionResult::*;
use self::Message::*;
use cell::UnsafeCell;
use core::cmp;
use core::isize;
use ptr;
use thread;
use time::Instant;
use sync::atomic::{AtomicIsize, AtomicUsize, Ordering, AtomicBool};
use sync::mpsc::Receiver;
use sync::mpsc::blocking::{self, SignalToken};
use sync::mpsc::spsc_queue as spsc;
use crate::cell::UnsafeCell;
use crate::ptr;
use crate::thread;
use crate::time::Instant;
use crate::sync::atomic::{AtomicIsize, AtomicUsize, Ordering, AtomicBool};
use crate::sync::mpsc::Receiver;
use crate::sync::mpsc::blocking::{self, SignalToken};
use crate::sync::mpsc::spsc_queue as spsc;
const DISCONNECTED: isize = isize::MIN;
#[cfg(test)]

View file

@ -31,11 +31,11 @@
use core::mem;
use core::ptr;
use sync::atomic::{Ordering, AtomicUsize};
use sync::mpsc::blocking::{self, WaitToken, SignalToken};
use sync::mpsc::select::StartResult::{self, Installed, Abort};
use sync::{Mutex, MutexGuard};
use time::Instant;
use crate::sync::atomic::{Ordering, AtomicUsize};
use crate::sync::mpsc::blocking::{self, WaitToken, SignalToken};
use crate::sync::mpsc::select::StartResult::{self, Installed, Abort};
use crate::sync::{Mutex, MutexGuard};
use crate::time::Instant;
const MAX_REFCOUNT: usize = (isize::MAX) as usize;

View file

@ -1,10 +1,10 @@
use cell::UnsafeCell;
use fmt;
use mem;
use ops::{Deref, DerefMut};
use ptr;
use sys_common::mutex as sys;
use sys_common::poison::{self, TryLockError, TryLockResult, LockResult};
use crate::cell::UnsafeCell;
use crate::fmt;
use crate::mem;
use crate::ops::{Deref, DerefMut};
use crate::ptr;
use crate::sys_common::mutex as sys;
use crate::sys_common::poison::{self, TryLockError, TryLockResult, LockResult};
/// A mutual exclusion primitive useful for protecting shared data
///
@ -471,10 +471,10 @@ pub fn guard_poison<'a, T: ?Sized>(guard: &MutexGuard<'a, T>) -> &'a poison::Fla
#[cfg(all(test, not(target_os = "emscripten")))]
mod tests {
use sync::mpsc::channel;
use sync::{Arc, Mutex, Condvar};
use sync::atomic::{AtomicUsize, Ordering};
use thread;
use crate::sync::mpsc::channel;
use crate::sync::{Arc, Mutex, Condvar};
use crate::sync::atomic::{AtomicUsize, Ordering};
use crate::thread;
struct Packet<T>(Arc<(Mutex<T>, Condvar)>);

View file

@ -52,11 +52,11 @@
// You'll find a few more details in the implementation, but that's the gist of
// it!
use fmt;
use marker;
use ptr;
use sync::atomic::{AtomicUsize, AtomicBool, Ordering};
use thread::{self, Thread};
use crate::fmt;
use crate::marker;
use crate::ptr;
use crate::sync::atomic::{AtomicUsize, AtomicBool, Ordering};
use crate::thread::{self, Thread};
/// A synchronization primitive which can be used to run a one-time global
/// initialization. Useful for one-time initialization for FFI or related
@ -514,9 +514,9 @@ pub fn poisoned(&self) -> bool {
#[cfg(all(test, not(target_os = "emscripten")))]
mod tests {
use panic;
use sync::mpsc::channel;
use thread;
use crate::panic;
use crate::sync::mpsc::channel;
use crate::thread;
use super::Once;
#[test]

View file

@ -1,10 +1,10 @@
use cell::UnsafeCell;
use fmt;
use mem;
use ops::{Deref, DerefMut};
use ptr;
use sys_common::poison::{self, LockResult, TryLockError, TryLockResult};
use sys_common::rwlock as sys;
use crate::cell::UnsafeCell;
use crate::fmt;
use crate::mem;
use crate::ops::{Deref, DerefMut};
use crate::ptr;
use crate::sys_common::poison::{self, LockResult, TryLockError, TryLockResult};
use crate::sys_common::rwlock as sys;
/// A reader-writer lock
///
@ -554,10 +554,10 @@ fn drop(&mut self) {
#[cfg(all(test, not(target_os = "emscripten")))]
mod tests {
use rand::{self, Rng};
use sync::mpsc::channel;
use thread;
use sync::{Arc, RwLock, TryLockError};
use sync::atomic::{AtomicUsize, Ordering};
use crate::sync::mpsc::channel;
use crate::thread;
use crate::sync::{Arc, RwLock, TryLockError};
use crate::sync::atomic::{AtomicUsize, Ordering};
#[derive(Eq, PartialEq, Debug)]
struct NonCopy(i32);

View file

@ -1090,10 +1090,10 @@ pub union auxv_union {
#[test]
#[cfg(target_pointer_width = "32")]
fn auxv_layout_test_32() {
assert_eq!(::core::mem::size_of::<auxv>(), 8);
assert_eq!(::core::mem::align_of::<auxv>(), 4);
assert_eq!(core::mem::size_of::<auxv>(), 8);
assert_eq!(core::mem::align_of::<auxv>(), 4);
unsafe {
let obj: auxv = ::core::mem::uninitialized();
let obj: auxv = core::mem::uninitialized();
let base = &obj as *const _ as usize;
assert_eq!(&obj.a_type as *const _ as usize - base, 0);
assert_eq!(&obj.union.a_val as *const _ as usize - base, 4);
@ -1103,10 +1103,10 @@ fn auxv_layout_test_32() {
#[test]
#[cfg(target_pointer_width = "64")]
fn auxv_layout_test_64() {
assert_eq!(::core::mem::size_of::<auxv>(), 16);
assert_eq!(::core::mem::align_of::<auxv>(), 8);
assert_eq!(core::mem::size_of::<auxv>(), 16);
assert_eq!(core::mem::align_of::<auxv>(), 8);
unsafe {
let obj: auxv = ::core::mem::uninitialized();
let obj: auxv = core::mem::uninitialized();
let base = &obj as *const _ as usize;
assert_eq!(&obj.a_type as *const _ as usize - base, 0);
assert_eq!(&obj.union.a_val as *const _ as usize - base, 8);
@ -1124,10 +1124,10 @@ pub struct ciovec {
#[test]
#[cfg(target_pointer_width = "32")]
fn ciovec_layout_test_32() {
assert_eq!(::core::mem::size_of::<ciovec>(), 8);
assert_eq!(::core::mem::align_of::<ciovec>(), 4);
assert_eq!(core::mem::size_of::<ciovec>(), 8);
assert_eq!(core::mem::align_of::<ciovec>(), 4);
unsafe {
let obj: ciovec = ::core::mem::uninitialized();
let obj: ciovec = core::mem::uninitialized();
let base = &obj as *const _ as usize;
assert_eq!(&obj.buf.0 as *const _ as usize - base, 0);
assert_eq!(&obj.buf.1 as *const _ as usize - base, 4);
@ -1136,10 +1136,10 @@ fn ciovec_layout_test_32() {
#[test]
#[cfg(target_pointer_width = "64")]
fn ciovec_layout_test_64() {
assert_eq!(::core::mem::size_of::<ciovec>(), 16);
assert_eq!(::core::mem::align_of::<ciovec>(), 8);
assert_eq!(core::mem::size_of::<ciovec>(), 16);
assert_eq!(core::mem::align_of::<ciovec>(), 8);
unsafe {
let obj: ciovec = ::core::mem::uninitialized();
let obj: ciovec = core::mem::uninitialized();
let base = &obj as *const _ as usize;
assert_eq!(&obj.buf.0 as *const _ as usize - base, 0);
assert_eq!(&obj.buf.1 as *const _ as usize - base, 8);
@ -1164,10 +1164,10 @@ pub struct dirent {
}
#[test]
fn dirent_layout_test() {
assert_eq!(::core::mem::size_of::<dirent>(), 24);
assert_eq!(::core::mem::align_of::<dirent>(), 8);
assert_eq!(core::mem::size_of::<dirent>(), 24);
assert_eq!(core::mem::align_of::<dirent>(), 8);
unsafe {
let obj: dirent = ::core::mem::uninitialized();
let obj: dirent = core::mem::uninitialized();
let base = &obj as *const _ as usize;
assert_eq!(&obj.d_next as *const _ as usize - base, 0);
assert_eq!(&obj.d_ino as *const _ as usize - base, 8);
@ -1228,10 +1228,10 @@ pub struct event_proc_terminate {
}
#[test]
fn event_layout_test() {
assert_eq!(::core::mem::size_of::<event>(), 32);
assert_eq!(::core::mem::align_of::<event>(), 8);
assert_eq!(core::mem::size_of::<event>(), 32);
assert_eq!(core::mem::align_of::<event>(), 8);
unsafe {
let obj: event = ::core::mem::uninitialized();
let obj: event = core::mem::uninitialized();
let base = &obj as *const _ as usize;
assert_eq!(&obj.userdata as *const _ as usize - base, 0);
assert_eq!(&obj.error as *const _ as usize - base, 8);
@ -1262,10 +1262,10 @@ pub struct fdstat {
}
#[test]
fn fdstat_layout_test() {
assert_eq!(::core::mem::size_of::<fdstat>(), 24);
assert_eq!(::core::mem::align_of::<fdstat>(), 8);
assert_eq!(core::mem::size_of::<fdstat>(), 24);
assert_eq!(core::mem::align_of::<fdstat>(), 8);
unsafe {
let obj: fdstat = ::core::mem::uninitialized();
let obj: fdstat = core::mem::uninitialized();
let base = &obj as *const _ as usize;
assert_eq!(&obj.fs_filetype as *const _ as usize - base, 0);
assert_eq!(&obj.fs_flags as *const _ as usize - base, 2);
@ -1299,10 +1299,10 @@ pub struct filestat {
}
#[test]
fn filestat_layout_test() {
assert_eq!(::core::mem::size_of::<filestat>(), 56);
assert_eq!(::core::mem::align_of::<filestat>(), 8);
assert_eq!(core::mem::size_of::<filestat>(), 56);
assert_eq!(core::mem::align_of::<filestat>(), 8);
unsafe {
let obj: filestat = ::core::mem::uninitialized();
let obj: filestat = core::mem::uninitialized();
let base = &obj as *const _ as usize;
assert_eq!(&obj.st_dev as *const _ as usize - base, 0);
assert_eq!(&obj.st_ino as *const _ as usize - base, 8);
@ -1325,10 +1325,10 @@ pub struct iovec {
#[test]
#[cfg(target_pointer_width = "32")]
fn iovec_layout_test_32() {
assert_eq!(::core::mem::size_of::<iovec>(), 8);
assert_eq!(::core::mem::align_of::<iovec>(), 4);
assert_eq!(core::mem::size_of::<iovec>(), 8);
assert_eq!(core::mem::align_of::<iovec>(), 4);
unsafe {
let obj: iovec = ::core::mem::uninitialized();
let obj: iovec = core::mem::uninitialized();
let base = &obj as *const _ as usize;
assert_eq!(&obj.buf.0 as *const _ as usize - base, 0);
assert_eq!(&obj.buf.1 as *const _ as usize - base, 4);
@ -1337,10 +1337,10 @@ fn iovec_layout_test_32() {
#[test]
#[cfg(target_pointer_width = "64")]
fn iovec_layout_test_64() {
assert_eq!(::core::mem::size_of::<iovec>(), 16);
assert_eq!(::core::mem::align_of::<iovec>(), 8);
assert_eq!(core::mem::size_of::<iovec>(), 16);
assert_eq!(core::mem::align_of::<iovec>(), 8);
unsafe {
let obj: iovec = ::core::mem::uninitialized();
let obj: iovec = core::mem::uninitialized();
let base = &obj as *const _ as usize;
assert_eq!(&obj.buf.0 as *const _ as usize - base, 0);
assert_eq!(&obj.buf.1 as *const _ as usize - base, 8);
@ -1360,10 +1360,10 @@ pub struct lookup {
}
#[test]
fn lookup_layout_test() {
assert_eq!(::core::mem::size_of::<lookup>(), 8);
assert_eq!(::core::mem::align_of::<lookup>(), 4);
assert_eq!(core::mem::size_of::<lookup>(), 8);
assert_eq!(core::mem::align_of::<lookup>(), 4);
unsafe {
let obj: lookup = ::core::mem::uninitialized();
let obj: lookup = core::mem::uninitialized();
let base = &obj as *const _ as usize;
assert_eq!(&obj.fd as *const _ as usize - base, 0);
assert_eq!(&obj.flags as *const _ as usize - base, 4);
@ -1394,10 +1394,10 @@ pub struct recv_in {
#[test]
#[cfg(target_pointer_width = "32")]
fn recv_in_layout_test_32() {
assert_eq!(::core::mem::size_of::<recv_in>(), 20);
assert_eq!(::core::mem::align_of::<recv_in>(), 4);
assert_eq!(core::mem::size_of::<recv_in>(), 20);
assert_eq!(core::mem::align_of::<recv_in>(), 4);
unsafe {
let obj: recv_in = ::core::mem::uninitialized();
let obj: recv_in = core::mem::uninitialized();
let base = &obj as *const _ as usize;
assert_eq!(&obj.ri_data.0 as *const _ as usize - base, 0);
assert_eq!(&obj.ri_data.1 as *const _ as usize - base, 4);
@ -1409,10 +1409,10 @@ fn recv_in_layout_test_32() {
#[test]
#[cfg(target_pointer_width = "64")]
fn recv_in_layout_test_64() {
assert_eq!(::core::mem::size_of::<recv_in>(), 40);
assert_eq!(::core::mem::align_of::<recv_in>(), 8);
assert_eq!(core::mem::size_of::<recv_in>(), 40);
assert_eq!(core::mem::align_of::<recv_in>(), 8);
unsafe {
let obj: recv_in = ::core::mem::uninitialized();
let obj: recv_in = core::mem::uninitialized();
let base = &obj as *const _ as usize;
assert_eq!(&obj.ri_data.0 as *const _ as usize - base, 0);
assert_eq!(&obj.ri_data.1 as *const _ as usize - base, 8);
@ -1438,10 +1438,10 @@ pub struct recv_out {
#[test]
#[cfg(target_pointer_width = "32")]
fn recv_out_layout_test_32() {
assert_eq!(::core::mem::size_of::<recv_out>(), 52);
assert_eq!(::core::mem::align_of::<recv_out>(), 4);
assert_eq!(core::mem::size_of::<recv_out>(), 52);
assert_eq!(core::mem::align_of::<recv_out>(), 4);
unsafe {
let obj: recv_out = ::core::mem::uninitialized();
let obj: recv_out = core::mem::uninitialized();
let base = &obj as *const _ as usize;
assert_eq!(&obj.ro_datalen as *const _ as usize - base, 0);
assert_eq!(&obj.ro_fdslen as *const _ as usize - base, 4);
@ -1452,10 +1452,10 @@ fn recv_out_layout_test_32() {
#[test]
#[cfg(target_pointer_width = "64")]
fn recv_out_layout_test_64() {
assert_eq!(::core::mem::size_of::<recv_out>(), 64);
assert_eq!(::core::mem::align_of::<recv_out>(), 8);
assert_eq!(core::mem::size_of::<recv_out>(), 64);
assert_eq!(core::mem::align_of::<recv_out>(), 8);
unsafe {
let obj: recv_out = ::core::mem::uninitialized();
let obj: recv_out = core::mem::uninitialized();
let base = &obj as *const _ as usize;
assert_eq!(&obj.ro_datalen as *const _ as usize - base, 0);
assert_eq!(&obj.ro_fdslen as *const _ as usize - base, 8);
@ -1480,10 +1480,10 @@ pub struct send_in {
#[test]
#[cfg(target_pointer_width = "32")]
fn send_in_layout_test_32() {
assert_eq!(::core::mem::size_of::<send_in>(), 20);
assert_eq!(::core::mem::align_of::<send_in>(), 4);
assert_eq!(core::mem::size_of::<send_in>(), 20);
assert_eq!(core::mem::align_of::<send_in>(), 4);
unsafe {
let obj: send_in = ::core::mem::uninitialized();
let obj: send_in = core::mem::uninitialized();
let base = &obj as *const _ as usize;
assert_eq!(&obj.si_data.0 as *const _ as usize - base, 0);
assert_eq!(&obj.si_data.1 as *const _ as usize - base, 4);
@ -1495,10 +1495,10 @@ fn send_in_layout_test_32() {
#[test]
#[cfg(target_pointer_width = "64")]
fn send_in_layout_test_64() {
assert_eq!(::core::mem::size_of::<send_in>(), 40);
assert_eq!(::core::mem::align_of::<send_in>(), 8);
assert_eq!(core::mem::size_of::<send_in>(), 40);
assert_eq!(core::mem::align_of::<send_in>(), 8);
unsafe {
let obj: send_in = ::core::mem::uninitialized();
let obj: send_in = core::mem::uninitialized();
let base = &obj as *const _ as usize;
assert_eq!(&obj.si_data.0 as *const _ as usize - base, 0);
assert_eq!(&obj.si_data.1 as *const _ as usize - base, 8);
@ -1518,10 +1518,10 @@ pub struct send_out {
#[test]
#[cfg(target_pointer_width = "32")]
fn send_out_layout_test_32() {
assert_eq!(::core::mem::size_of::<send_out>(), 4);
assert_eq!(::core::mem::align_of::<send_out>(), 4);
assert_eq!(core::mem::size_of::<send_out>(), 4);
assert_eq!(core::mem::align_of::<send_out>(), 4);
unsafe {
let obj: send_out = ::core::mem::uninitialized();
let obj: send_out = core::mem::uninitialized();
let base = &obj as *const _ as usize;
assert_eq!(&obj.so_datalen as *const _ as usize - base, 0);
}
@ -1529,10 +1529,10 @@ fn send_out_layout_test_32() {
#[test]
#[cfg(target_pointer_width = "64")]
fn send_out_layout_test_64() {
assert_eq!(::core::mem::size_of::<send_out>(), 8);
assert_eq!(::core::mem::align_of::<send_out>(), 8);
assert_eq!(core::mem::size_of::<send_out>(), 8);
assert_eq!(core::mem::align_of::<send_out>(), 8);
unsafe {
let obj: send_out = ::core::mem::uninitialized();
let obj: send_out = core::mem::uninitialized();
let base = &obj as *const _ as usize;
assert_eq!(&obj.so_datalen as *const _ as usize - base, 0);
}
@ -1647,10 +1647,10 @@ pub struct subscription_proc_terminate {
#[test]
#[cfg(target_pointer_width = "32")]
fn subscription_layout_test_32() {
assert_eq!(::core::mem::size_of::<subscription>(), 56);
assert_eq!(::core::mem::align_of::<subscription>(), 8);
assert_eq!(core::mem::size_of::<subscription>(), 56);
assert_eq!(core::mem::align_of::<subscription>(), 8);
unsafe {
let obj: subscription = ::core::mem::uninitialized();
let obj: subscription = core::mem::uninitialized();
let base = &obj as *const _ as usize;
assert_eq!(&obj.userdata as *const _ as usize - base, 0);
assert_eq!(&obj.unused as *const _ as usize - base, 8);
@ -1674,10 +1674,10 @@ fn subscription_layout_test_32() {
#[test]
#[cfg(target_pointer_width = "64")]
fn subscription_layout_test_64() {
assert_eq!(::core::mem::size_of::<subscription>(), 56);
assert_eq!(::core::mem::align_of::<subscription>(), 8);
assert_eq!(core::mem::size_of::<subscription>(), 56);
assert_eq!(core::mem::align_of::<subscription>(), 8);
unsafe {
let obj: subscription = ::core::mem::uninitialized();
let obj: subscription = core::mem::uninitialized();
let base = &obj as *const _ as usize;
assert_eq!(&obj.userdata as *const _ as usize - base, 0);
assert_eq!(&obj.unused as *const _ as usize - base, 8);
@ -1728,10 +1728,10 @@ pub struct tcb {
#[test]
#[cfg(target_pointer_width = "32")]
fn tcb_layout_test_32() {
assert_eq!(::core::mem::size_of::<tcb>(), 4);
assert_eq!(::core::mem::align_of::<tcb>(), 4);
assert_eq!(core::mem::size_of::<tcb>(), 4);
assert_eq!(core::mem::align_of::<tcb>(), 4);
unsafe {
let obj: tcb = ::core::mem::uninitialized();
let obj: tcb = core::mem::uninitialized();
let base = &obj as *const _ as usize;
assert_eq!(&obj.parent as *const _ as usize - base, 0);
}
@ -1739,10 +1739,10 @@ fn tcb_layout_test_32() {
#[test]
#[cfg(target_pointer_width = "64")]
fn tcb_layout_test_64() {
assert_eq!(::core::mem::size_of::<tcb>(), 8);
assert_eq!(::core::mem::align_of::<tcb>(), 8);
assert_eq!(core::mem::size_of::<tcb>(), 8);
assert_eq!(core::mem::align_of::<tcb>(), 8);
unsafe {
let obj: tcb = ::core::mem::uninitialized();
let obj: tcb = core::mem::uninitialized();
let base = &obj as *const _ as usize;
assert_eq!(&obj.parent as *const _ as usize - base, 0);
}
@ -1773,10 +1773,10 @@ pub struct threadattr {
#[test]
#[cfg(target_pointer_width = "32")]
fn threadattr_layout_test_32() {
assert_eq!(::core::mem::size_of::<threadattr>(), 16);
assert_eq!(::core::mem::align_of::<threadattr>(), 4);
assert_eq!(core::mem::size_of::<threadattr>(), 16);
assert_eq!(core::mem::align_of::<threadattr>(), 4);
unsafe {
let obj: threadattr = ::core::mem::uninitialized();
let obj: threadattr = core::mem::uninitialized();
let base = &obj as *const _ as usize;
assert_eq!(&obj.entry_point as *const _ as usize - base, 0);
assert_eq!(&obj.stack.0 as *const _ as usize - base, 4);
@ -1787,10 +1787,10 @@ fn threadattr_layout_test_32() {
#[test]
#[cfg(target_pointer_width = "64")]
fn threadattr_layout_test_64() {
assert_eq!(::core::mem::size_of::<threadattr>(), 32);
assert_eq!(::core::mem::align_of::<threadattr>(), 8);
assert_eq!(core::mem::size_of::<threadattr>(), 32);
assert_eq!(core::mem::align_of::<threadattr>(), 8);
unsafe {
let obj: threadattr = ::core::mem::uninitialized();
let obj: threadattr = core::mem::uninitialized();
let base = &obj as *const _ as usize;
assert_eq!(&obj.entry_point as *const _ as usize - base, 0);
assert_eq!(&obj.stack.0 as *const _ as usize - base, 8);

View file

@ -1,4 +1,4 @@
pub use sys::cloudabi::shims::args::*;
pub use crate::sys::cloudabi::shims::args::*;
#[allow(dead_code)]
pub fn init(_: isize, _: *const *const u8) {}

View file

@ -1,9 +1,10 @@
use error::Error;
use ffi::CStr;
use intrinsics;
use io;
use libc;
use sys_common::backtrace::Frame;
use crate::error::Error;
use crate::ffi::CStr;
use crate::fmt;
use crate::intrinsics;
use crate::io;
use crate::sys_common::backtrace::Frame;
use unwind as uw;
pub struct BacktraceContext;
@ -22,8 +23,8 @@ fn description(&self) -> &'static str {
}
}
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)
}
}

View file

@ -1,10 +1,10 @@
use cell::UnsafeCell;
use mem;
use sync::atomic::{AtomicU32, Ordering};
use sys::cloudabi::abi;
use sys::mutex::{self, Mutex};
use sys::time::checked_dur2intervals;
use time::Duration;
use crate::cell::UnsafeCell;
use crate::mem;
use crate::sync::atomic::{AtomicU32, Ordering};
use crate::sys::cloudabi::abi;
use crate::sys::mutex::{self, Mutex};
use crate::sys::time::checked_dur2intervals;
use crate::time::Duration;
extern "C" {
#[thread_local]

View file

@ -1,5 +1,5 @@
use libc;
use mem;
use crate::io::ErrorKind;
use crate::mem;
#[path = "../unix/alloc.rs"]
pub mod alloc;
@ -32,29 +32,29 @@
#[allow(dead_code)]
pub fn init() {}
pub fn decode_error_kind(errno: i32) -> ::io::ErrorKind {
pub fn decode_error_kind(errno: i32) -> ErrorKind {
match errno {
x if x == abi::errno::ACCES as i32 => ::io::ErrorKind::PermissionDenied,
x if x == abi::errno::ADDRINUSE as i32 => ::io::ErrorKind::AddrInUse,
x if x == abi::errno::ADDRNOTAVAIL as i32 => ::io::ErrorKind::AddrNotAvailable,
x if x == abi::errno::AGAIN as i32 => ::io::ErrorKind::WouldBlock,
x if x == abi::errno::CONNABORTED as i32 => ::io::ErrorKind::ConnectionAborted,
x if x == abi::errno::CONNREFUSED as i32 => ::io::ErrorKind::ConnectionRefused,
x if x == abi::errno::CONNRESET as i32 => ::io::ErrorKind::ConnectionReset,
x if x == abi::errno::EXIST as i32 => ::io::ErrorKind::AlreadyExists,
x if x == abi::errno::INTR as i32 => ::io::ErrorKind::Interrupted,
x if x == abi::errno::INVAL as i32 => ::io::ErrorKind::InvalidInput,
x if x == abi::errno::NOENT as i32 => ::io::ErrorKind::NotFound,
x if x == abi::errno::NOTCONN as i32 => ::io::ErrorKind::NotConnected,
x if x == abi::errno::PERM as i32 => ::io::ErrorKind::PermissionDenied,
x if x == abi::errno::PIPE as i32 => ::io::ErrorKind::BrokenPipe,
x if x == abi::errno::TIMEDOUT as i32 => ::io::ErrorKind::TimedOut,
_ => ::io::ErrorKind::Other,
x if x == abi::errno::ACCES as i32 => ErrorKind::PermissionDenied,
x if x == abi::errno::ADDRINUSE as i32 => ErrorKind::AddrInUse,
x if x == abi::errno::ADDRNOTAVAIL as i32 => ErrorKind::AddrNotAvailable,
x if x == abi::errno::AGAIN as i32 => ErrorKind::WouldBlock,
x if x == abi::errno::CONNABORTED as i32 => ErrorKind::ConnectionAborted,
x if x == abi::errno::CONNREFUSED as i32 => ErrorKind::ConnectionRefused,
x if x == abi::errno::CONNRESET as i32 => ErrorKind::ConnectionReset,
x if x == abi::errno::EXIST as i32 => ErrorKind::AlreadyExists,
x if x == abi::errno::INTR as i32 => ErrorKind::Interrupted,
x if x == abi::errno::INVAL as i32 => ErrorKind::InvalidInput,
x if x == abi::errno::NOENT as i32 => ErrorKind::NotFound,
x if x == abi::errno::NOTCONN as i32 => ErrorKind::NotConnected,
x if x == abi::errno::PERM as i32 => ErrorKind::PermissionDenied,
x if x == abi::errno::PIPE as i32 => ErrorKind::BrokenPipe,
x if x == abi::errno::TIMEDOUT as i32 => ErrorKind::TimedOut,
_ => ErrorKind::Other,
}
}
pub unsafe fn abort_internal() -> ! {
::core::intrinsics::abort();
core::intrinsics::abort();
}
pub use libc::strlen;

View file

@ -1,8 +1,8 @@
use cell::UnsafeCell;
use mem;
use sync::atomic::{AtomicU32, Ordering};
use sys::cloudabi::abi;
use sys::rwlock::{self, RWLock};
use crate::cell::UnsafeCell;
use crate::mem;
use crate::sync::atomic::{AtomicU32, Ordering};
use crate::sys::cloudabi::abi;
use crate::sys::rwlock::{self, RWLock};
extern "C" {
#[thread_local]

View file

@ -1,8 +1,9 @@
use ffi::CStr;
use libc::{self, c_int};
use str;
use crate::ffi::CStr;
use crate::str;
pub use sys::cloudabi::shims::os::*;
use libc::c_int;
pub use crate::sys::cloudabi::shims::os::*;
pub fn errno() -> i32 {
extern "C" {

View file

@ -1,7 +1,7 @@
use cell::UnsafeCell;
use mem;
use sync::atomic::{AtomicU32, Ordering};
use sys::cloudabi::abi;
use crate::cell::UnsafeCell;
use crate::mem;
use crate::sync::atomic::{AtomicU32, Ordering};
use crate::sys::cloudabi::abi;
extern "C" {
#[thread_local]

View file

@ -1,4 +1,4 @@
use ffi::OsString;
use crate::ffi::OsString;
pub struct Args(());

View file

@ -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);

View file

@ -1,4 +1,4 @@
use io;
use crate::io;
pub mod args;
pub mod env;

View file

@ -1,10 +1,11 @@
use fmt;
use io::{self, IoVec, IoVecMut};
use net::{Ipv4Addr, Ipv6Addr, Shutdown, SocketAddr};
use time::Duration;
use sys::{unsupported, Void};
use convert::TryFrom;
use crate::fmt;
use crate::io::{self, IoVec, IoVecMut};
use crate::net::{Ipv4Addr, Ipv6Addr, Shutdown, SocketAddr};
use crate::time::Duration;
use crate::sys::{unsupported, Void};
use crate::convert::TryFrom;
#[allow(unused_extern_crates)]
pub extern crate libc as netc;
pub struct TcpStream(Void);

View file

@ -1,10 +1,10 @@
use error::Error as StdError;
use ffi::{OsStr, OsString};
use fmt;
use io;
use iter;
use path::{self, PathBuf};
use sys::{unsupported, Void};
use crate::error::Error as StdError;
use crate::ffi::{OsStr, OsString};
use crate::fmt;
use crate::io;
use crate::iter;
use crate::path::{self, PathBuf};
use crate::sys::{unsupported, Void};
pub fn getcwd() -> io::Result<PathBuf> {
unsupported()

Some files were not shown because too many files have changed in this diff Show more