Skip to content

Commit

Permalink
Auto merge of rust-lang#58208 - taiki-e:libstd-2018, r=Centril
Browse files Browse the repository at this point in the history
libstd => 2018

Transitions `libstd` to Rust 2018; cc rust-lang#58099

r? @Centril
  • Loading branch information
bors committed Feb 28, 2019
2 parents 7e001e5 + aad9e29 commit 190feb6
Show file tree
Hide file tree
Showing 291 changed files with 2,030 additions and 2,060 deletions.
1 change: 1 addition & 0 deletions src/libstd/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
5 changes: 3 additions & 2 deletions src/libstd/alloc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -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))]
Expand Down
2 changes: 0 additions & 2 deletions src/libstd/build.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#![deny(warnings)]

extern crate cc;

use std::env;

fn main() {
Expand Down
4 changes: 1 addition & 3 deletions src/libstd/collections/hash/bench.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#![cfg(test)]

extern crate test;

use self::test::Bencher;
use test::Bencher;

#[bench]
fn new_drop(b: &mut Bencher) {
Expand Down
24 changes: 12 additions & 12 deletions src/libstd/collections/hash/map.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand Down Expand Up @@ -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;
Expand Down
12 changes: 6 additions & 6 deletions src/libstd/collections/hash/set.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand Down Expand Up @@ -1751,7 +1751,7 @@ mod test_set {

#[test]
fn test_replace() {
use hash;
use crate::hash;

#[derive(Debug)]
struct Foo(&'static str, i32);
Expand Down
17 changes: 8 additions & 9 deletions src/libstd/collections/hash/table.rs
Original file line number Diff line number Diff line change
@@ -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::*;

Expand Down
2 changes: 1 addition & 1 deletion src/libstd/collections/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand Down
26 changes: 13 additions & 13 deletions src/libstd/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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`].
///
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -972,7 +972,7 @@ mod arch {
mod tests {
use super::*;

use path::Path;
use crate::path::Path;

#[test]
#[cfg_attr(target_os = "emscripten", ignore)]
Expand All @@ -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<_>>() ==
Expand All @@ -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<_>>() ==
Expand All @@ -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() ==
Expand All @@ -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() ==
Expand Down
23 changes: 12 additions & 11 deletions src/libstd/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down
16 changes: 8 additions & 8 deletions src/libstd/f32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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) };
}
Expand Down Expand Up @@ -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(),
}
}
Expand Down Expand Up @@ -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() {
Expand Down
14 changes: 7 additions & 7 deletions src/libstd/f64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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) };
})
Expand Down Expand Up @@ -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() {
Expand Down
44 changes: 22 additions & 22 deletions src/libstd/ffi/c_str.rs
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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() {
Expand Down
Loading

0 comments on commit 190feb6

Please sign in to comment.