libstd => 2018
This commit is contained in:
parent
7e001e5c6c
commit
93b6d9e086
284 changed files with 1989 additions and 2024 deletions
|
@ -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"
|
||||
|
|
|
@ -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))]
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
#![deny(warnings)]
|
||||
|
||||
extern crate cc;
|
||||
|
||||
use std::env;
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
#![cfg(test)]
|
||||
|
||||
extern crate test;
|
||||
|
||||
use self::test::Bencher;
|
||||
use test::Bencher;
|
||||
|
||||
#[bench]
|
||||
fn new_drop(b: &mut Bencher) {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 @@ mod test_set {
|
|||
|
||||
#[test]
|
||||
fn test_replace() {
|
||||
use hash;
|
||||
use crate::hash;
|
||||
|
||||
#[derive(Debug)]
|
||||
struct Foo(&'static str, i32);
|
||||
|
|
|
@ -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::*;
|
||||
|
||||
|
|
|
@ -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")]
|
||||
|
|
|
@ -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 @@ impl fmt::Debug for ArgsOs {
|
|||
/// 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 @@ mod tests {
|
|||
#[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 @@ mod tests {
|
|||
#[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 @@ mod tests {
|
|||
#[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 @@ mod tests {
|
|||
#[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() ==
|
||||
|
|
|
@ -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 @@ impl dyn Error + Send + Sync {
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::Error;
|
||||
use fmt;
|
||||
use crate::fmt;
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
struct A;
|
||||
|
|
|
@ -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 @@ impl f32 {
|
|||
#[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 @@ impl 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 @@ impl 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() {
|
||||
|
|
|
@ -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 @@ impl f64 {
|
|||
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 @@ impl 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() {
|
||||
|
|
|
@ -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 @@ impl AsRef<CStr> for CString {
|
|||
#[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() {
|
||||
|
|
|
@ -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 @@ impl AsInner<Slice> for OsStr {
|
|||
#[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() {
|
||||
|
|
|
@ -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 @@ impl AsInnerMut<fs_imp::DirBuilder> for 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 @@ mod tests {
|
|||
#[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 @@ mod tests {
|
|||
#[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 @@ mod tests {
|
|||
#[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 @@ mod tests {
|
|||
|
||||
#[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();
|
||||
|
|
|
@ -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 @@ impl<W: Write> fmt::Debug for LineWriter<W> where W: fmt::Debug {
|
|||
|
||||
#[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 {
|
||||
|
|
|
@ -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 @@ impl Write for Cursor<Box<[u8]>> {
|
|||
|
||||
#[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() {
|
||||
|
|
|
@ -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 _assert_error_is_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() {
|
||||
|
|
|
@ -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 @@ impl Write for Vec<u8> {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use io::prelude::*;
|
||||
use test;
|
||||
use crate::io::prelude::*;
|
||||
|
||||
#[bench]
|
||||
fn bench_read_slice(b: &mut test::Bencher) {
|
||||
|
|
|
@ -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!
|
||||
|
|
|
@ -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 lazy;
|
|||
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 @@ impl<B: BufRead> Iterator for Lines<B> {
|
|||
|
||||
#[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]
|
||||
|
|
|
@ -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 @@ impl fmt::Debug for StderrLock<'_> {
|
|||
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]
|
||||
|
|
|
@ -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 @@ impl fmt::Debug for Sink {
|
|||
|
||||
#[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() {
|
||||
|
|
|
@ -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 @@ use prelude::v1::*;
|
|||
|
||||
// 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
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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)]
|
||||
|
|
|
@ -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 @@ impl ToSocketAddrs for String {
|
|||
|
||||
#[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() {
|
||||
|
|
|
@ -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 @@ impl From<[u16; 8]> for IpAddr {
|
|||
// 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() {
|
||||
|
|
|
@ -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};
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 @@ impl fmt::Debug for TcpListener {
|
|||
|
||||
#[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());
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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 @@ impl fmt::Debug for UdpSocket {
|
|||
|
||||
#[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());
|
||||
|
|
|
@ -14,8 +14,8 @@ pub use core::num::Wrapping;
|
|||
#[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 @@ mod tests {
|
|||
|
||||
#[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 @@ mod tests {
|
|||
|
||||
#[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 @@ mod tests {
|
|||
|
||||
#[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 @@ mod tests {
|
|||
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 @@ mod tests {
|
|||
|
||||
#[cfg(test)]
|
||||
mod bench {
|
||||
extern crate test;
|
||||
use self::test::Bencher;
|
||||
use test::Bencher;
|
||||
|
||||
#[bench]
|
||||
fn bench_pow_function(b: &mut Bencher) {
|
||||
|
|
|
@ -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`].
|
||||
///
|
||||
|
|
|
@ -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 @@ pub use self::arch::{dev_t, mode_t, blkcnt_t, blksize_t, ino_t, nlink_t, off_t,
|
|||
|
||||
#[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 @@ mod arch {
|
|||
|
||||
#[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 @@ mod arch {
|
|||
|
||||
#[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;
|
||||
|
|
|
@ -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`].
|
||||
///
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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`].
|
||||
///
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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`].
|
||||
///
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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};
|
||||
|
|
|
@ -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`].
|
||||
///
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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`].
|
||||
///
|
||||
|
|
|
@ -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 @@ pub use self::arch::{off_t, ino_t, nlink_t, blksize_t, blkcnt_t, stat, time_t};
|
|||
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 @@ mod arch {
|
|||
|
||||
#[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 @@ mod arch {
|
|||
|
||||
#[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;
|
||||
|
|
|
@ -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`].
|
||||
///
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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`].
|
||||
///
|
||||
|
|
|
@ -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`].
|
||||
///
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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`].
|
||||
///
|
||||
|
|
|
@ -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 @@ pub use self::arch::{off_t, ino_t, nlink_t, blksize_t, blkcnt_t, stat, time_t};
|
|||
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 @@ mod arch {
|
|||
|
||||
#[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 @@ mod arch {
|
|||
|
||||
#[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;
|
||||
|
|
|
@ -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`].
|
||||
///
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -12,10 +12,10 @@ cfg_if! {
|
|||
// 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_if! {
|
|||
|
||||
#[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;
|
||||
|
|
|
@ -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`].
|
||||
///
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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`].
|
||||
///
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -86,9 +86,8 @@ pub use core::ffi::c_void;
|
|||
#[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 @@ mod tests {
|
|||
|
||||
#[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);
|
||||
}
|
||||
|
|
|
@ -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`].
|
||||
///
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 @@ impl<F: Future> Future for AssertUnwindSafe<F> {
|
|||
#[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)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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 continue_panic_fmt(info: &PanicInfo) -> ! {
|
|||
}
|
||||
|
||||
fn fill(&mut self) -> &mut String {
|
||||
use fmt::Write;
|
||||
use crate::fmt::Write;
|
||||
|
||||
let inner = self.inner;
|
||||
self.string.get_or_insert_with(|| {
|
||||
|
|
|
@ -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 @@ impl Error for StripPrefixError {
|
|||
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 @@ mod tests {
|
|||
|
||||
#[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 @@ mod tests {
|
|||
|
||||
#[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 @@ mod tests {
|
|||
|
||||
#[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();
|
||||
|
|
|
@ -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 @@ pub use result::Result::{self, Ok, Err};
|
|||
|
||||
#[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;
|
||||
|
|
|
@ -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 @@ impl Child {
|
|||
/// [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 @@ impl Termination for ExitCode {
|
|||
|
||||
#[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 @@ mod tests {
|
|||
#[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 @@ mod tests {
|
|||
#[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 @@ mod tests {
|
|||
#[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 @@ mod tests {
|
|||
|
||||
#[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 @@ mod tests {
|
|||
|
||||
#[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 @@ mod tests {
|
|||
#[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,
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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 @@ impl BarrierWaitResult {
|
|||
|
||||
#[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)]
|
||||
|
|
|
@ -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 @@ impl Drop for Condvar {
|
|||
#[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() {
|
||||
|
|
|
@ -165,7 +165,7 @@ pub use self::mutex::{Mutex, MutexGuard};
|
|||
#[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};
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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))]
|
||||
|
|
|
@ -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 @@ impl From<RecvError> for 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 @@ mod tests {
|
|||
|
||||
#[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") {
|
||||
|
|
|
@ -15,8 +15,9 @@ pub use self::PopResult::*;
|
|||
|
||||
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 @@ impl<T> Drop for Queue<T> {
|
|||
|
||||
#[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() {
|
||||
|
|
|
@ -27,12 +27,12 @@ pub use self::UpgradeResult::*;
|
|||
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
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -14,16 +14,16 @@ use core::cmp;
|
|||
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;
|
||||
|
|
|
@ -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 @@ impl<T, ProducerAddition, ConsumerAddition> Drop for Queue<T, ProducerAddition,
|
|||
|
||||
#[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() {
|
||||
|
|
|
@ -12,17 +12,18 @@ pub use self::UpgradeResult::*;
|
|||
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)]
|
||||
|
|
|
@ -31,11 +31,11 @@ use core::isize;
|
|||
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;
|
||||
|
||||
|
|
|
@ -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)>);
|
||||
|
||||
|
|
|
@ -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 @@ impl OnceState {
|
|||
|
||||
#[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]
|
||||
|
|
|
@ -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 @@ impl<T: ?Sized> Drop for RwLockWriteGuard<'_, T> {
|
|||
#[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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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) {}
|
||||
|
|
|
@ -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 @@ 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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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 @@ pub use self::shims::*;
|
|||
#[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;
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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" {
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use ffi::OsString;
|
||||
use crate::ffi::OsString;
|
||||
|
||||
pub struct Args(());
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use io;
|
||||
use crate::io;
|
||||
|
||||
pub mod args;
|
||||
pub mod env;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
Loading…
Add table
Reference in a new issue