From 360432f1e8794de58cd94f34c9c17ad65871e5b5 Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Mon, 15 Apr 2019 11:23:21 +0900 Subject: [PATCH] libcore => 2018 --- src/libcore/Cargo.toml | 1 + src/libcore/alloc.rs | 12 ++--- src/libcore/any.rs | 4 +- src/libcore/array.rs | 14 ++--- src/libcore/ascii.rs | 6 +-- src/libcore/benches/lib.rs | 1 - src/libcore/cell.rs | 12 ++--- src/libcore/char/convert.rs | 9 ++-- src/libcore/char/decode.rs | 3 +- src/libcore/char/methods.rs | 9 ++-- src/libcore/char/mod.rs | 8 +-- src/libcore/clone.rs | 4 +- src/libcore/cmp.rs | 4 +- src/libcore/convert.rs | 2 +- src/libcore/ffi.rs | 2 +- src/libcore/fmt/builders.rs | 2 +- src/libcore/fmt/float.rs | 6 +-- src/libcore/fmt/mod.rs | 16 +++--- src/libcore/fmt/num.rs | 14 ++--- src/libcore/future/future.rs | 8 +-- src/libcore/hash/mod.rs | 9 ++-- src/libcore/hash/sip.rs | 10 ++-- src/libcore/hint.rs | 2 +- src/libcore/internal_macros.rs | 10 ++-- src/libcore/intrinsics.rs | 4 +- src/libcore/iter/adapters/chain.rs | 5 +- src/libcore/iter/adapters/flatten.rs | 5 +- src/libcore/iter/adapters/mod.rs | 11 ++-- src/libcore/iter/adapters/zip.rs | 3 +- src/libcore/iter/mod.rs | 2 +- src/libcore/iter/range.rs | 10 ++-- src/libcore/iter/sources.rs | 8 +-- src/libcore/iter/traits/accum.rs | 4 +- src/libcore/iter/traits/double_ended.rs | 4 +- src/libcore/iter/traits/iterator.rs | 4 +- src/libcore/lib.rs | 4 ++ src/libcore/marker.rs | 8 +-- src/libcore/mem.rs | 18 +++---- src/libcore/num/bignum.rs | 60 +++++++++++----------- src/libcore/num/dec2flt/algorithm.rs | 14 ++--- src/libcore/num/dec2flt/mod.rs | 4 +- src/libcore/num/dec2flt/num.rs | 4 +- src/libcore/num/dec2flt/rawfp.rs | 18 +++---- src/libcore/num/f32.rs | 4 +- src/libcore/num/f64.rs | 4 +- src/libcore/num/flt2dec/decoder.rs | 6 +-- src/libcore/num/flt2dec/mod.rs | 2 +- src/libcore/num/flt2dec/strategy/dragon.rs | 10 ++-- src/libcore/num/flt2dec/strategy/grisu.rs | 8 +-- src/libcore/num/mod.rs | 38 +++++++------- src/libcore/num/wrapping.rs | 2 +- src/libcore/ops/mod.rs | 4 +- src/libcore/ops/range.rs | 4 +- src/libcore/ops/unsize.rs | 2 +- src/libcore/option.rs | 6 +-- src/libcore/panic.rs | 4 +- src/libcore/panicking.rs | 4 +- src/libcore/pin.rs | 8 +-- src/libcore/prelude/v1.rs | 22 ++++---- src/libcore/ptr.rs | 26 +++++----- src/libcore/result.rs | 6 +-- src/libcore/slice/memchr.rs | 6 +-- src/libcore/slice/mod.rs | 49 +++++++++--------- src/libcore/slice/rotate.rs | 6 +-- src/libcore/slice/sort.rs | 6 +-- src/libcore/str/lossy.rs | 9 ++-- src/libcore/str/mod.rs | 22 ++++---- src/libcore/str/pattern.rs | 8 +-- src/libcore/sync/atomic.rs | 10 ++-- src/libcore/task/poll.rs | 4 +- src/libcore/task/wake.rs | 4 +- src/libcore/tests/lib.rs | 1 - src/libcore/tests/num/int_macros.rs | 2 +- src/libcore/tests/num/uint_macros.rs | 3 +- src/libcore/time.rs | 10 ++-- src/libcore/tuple.rs | 4 +- src/libcore/unicode/mod.rs | 6 +-- src/libcore/unicode/tables.rs | 4 +- src/libcore/unit.rs | 2 +- 79 files changed, 342 insertions(+), 332 deletions(-) diff --git a/src/libcore/Cargo.toml b/src/libcore/Cargo.toml index fa2ab11243b6c..ede5fff5f4a0e 100644 --- a/src/libcore/Cargo.toml +++ b/src/libcore/Cargo.toml @@ -4,6 +4,7 @@ name = "core" version = "0.0.0" autotests = false autobenches = false +edition = "2018" [lib] name = "core" diff --git a/src/libcore/alloc.rs b/src/libcore/alloc.rs index e842020561d35..18354945a1e51 100644 --- a/src/libcore/alloc.rs +++ b/src/libcore/alloc.rs @@ -2,12 +2,12 @@ #![stable(feature = "alloc_module", since = "1.28.0")] -use cmp; -use fmt; -use mem; -use usize; -use ptr::{self, NonNull}; -use num::NonZeroUsize; +use crate::cmp; +use crate::fmt; +use crate::mem; +use crate::usize; +use crate::ptr::{self, NonNull}; +use crate::num::NonZeroUsize; /// Represents the combination of a starting address and /// a total capacity of the returned block. diff --git a/src/libcore/any.rs b/src/libcore/any.rs index 01ab523a4c3f6..a4827aa36edd0 100644 --- a/src/libcore/any.rs +++ b/src/libcore/any.rs @@ -61,8 +61,8 @@ #![stable(feature = "rust1", since = "1.0.0")] -use fmt; -use intrinsics; +use crate::fmt; +use crate::intrinsics; /////////////////////////////////////////////////////////////////////////////// // Any trait diff --git a/src/libcore/array.rs b/src/libcore/array.rs index dcd9ce6dad756..3c445db69bbb4 100644 --- a/src/libcore/array.rs +++ b/src/libcore/array.rs @@ -9,13 +9,13 @@ integer constants", issue = "27778")] -use borrow::{Borrow, BorrowMut}; -use cmp::Ordering; -use convert::TryFrom; -use fmt; -use hash::{Hash, self}; -use marker::Unsize; -use slice::{Iter, IterMut}; +use crate::borrow::{Borrow, BorrowMut}; +use crate::cmp::Ordering; +use crate::convert::TryFrom; +use crate::fmt; +use crate::hash::{Hash, self}; +use crate::marker::Unsize; +use crate::slice::{Iter, IterMut}; /// Utility trait implemented only on arrays of fixed size /// diff --git a/src/libcore/ascii.rs b/src/libcore/ascii.rs index 7a06aa2b0d397..953fe9ca2b9f8 100644 --- a/src/libcore/ascii.rs +++ b/src/libcore/ascii.rs @@ -11,9 +11,9 @@ #![stable(feature = "core_ascii", since = "1.26.0")] -use fmt; -use ops::Range; -use iter::FusedIterator; +use crate::fmt; +use crate::ops::Range; +use crate::iter::FusedIterator; /// An iterator over the escaped version of a byte. /// diff --git a/src/libcore/benches/lib.rs b/src/libcore/benches/lib.rs index 707cdd5f450ea..dea2963d9ac83 100644 --- a/src/libcore/benches/lib.rs +++ b/src/libcore/benches/lib.rs @@ -1,7 +1,6 @@ #![feature(flt2dec)] #![feature(test)] -extern crate core; extern crate test; mod any; diff --git a/src/libcore/cell.rs b/src/libcore/cell.rs index 5325b339151dc..1c55e62539a85 100644 --- a/src/libcore/cell.rs +++ b/src/libcore/cell.rs @@ -186,12 +186,12 @@ #![stable(feature = "rust1", since = "1.0.0")] -use cmp::Ordering; -use fmt::{self, Debug, Display}; -use marker::Unsize; -use mem; -use ops::{Deref, DerefMut, CoerceUnsized}; -use ptr; +use crate::cmp::Ordering; +use crate::fmt::{self, Debug, Display}; +use crate::marker::Unsize; +use crate::mem; +use crate::ops::{Deref, DerefMut, CoerceUnsized}; +use crate::ptr; /// A mutable memory location. /// diff --git a/src/libcore/char/convert.rs b/src/libcore/char/convert.rs index 6a5abfb408f5b..ec273746111ee 100644 --- a/src/libcore/char/convert.rs +++ b/src/libcore/char/convert.rs @@ -1,9 +1,10 @@ //! Character conversions. -use convert::TryFrom; -use fmt; -use mem::transmute; -use str::FromStr; +use crate::convert::TryFrom; +use crate::fmt; +use crate::mem::transmute; +use crate::str::FromStr; + use super::MAX; /// Converts a `u32` to a `char`. diff --git a/src/libcore/char/decode.rs b/src/libcore/char/decode.rs index 133c9169df858..ed92eca08bf7f 100644 --- a/src/libcore/char/decode.rs +++ b/src/libcore/char/decode.rs @@ -1,6 +1,7 @@ //! UTF-8 and UTF-16 decoding iterators -use fmt; +use crate::fmt; + use super::from_u32_unchecked; /// An iterator that decodes UTF-16 encoded code points from an iterator of `u16`s. diff --git a/src/libcore/char/methods.rs b/src/libcore/char/methods.rs index 122e5f3affdc2..18557e0c11d89 100644 --- a/src/libcore/char/methods.rs +++ b/src/libcore/char/methods.rs @@ -1,10 +1,11 @@ //! impl char {} -use slice; -use str::from_utf8_unchecked_mut; +use crate::slice; +use crate::str::from_utf8_unchecked_mut; +use crate::unicode::printable::is_printable; +use crate::unicode::tables::{conversions, derived_property, general_category, property}; + use super::*; -use unicode::printable::is_printable; -use unicode::tables::{conversions, derived_property, general_category, property}; #[lang = "char"] impl char { diff --git a/src/libcore/char/mod.rs b/src/libcore/char/mod.rs index 6683976642d40..39186273d62db 100644 --- a/src/libcore/char/mod.rs +++ b/src/libcore/char/mod.rs @@ -37,12 +37,12 @@ pub use self::decode::{decode_utf16, DecodeUtf16, DecodeUtf16Error}; // unstable re-exports #[unstable(feature = "unicode_version", issue = "49726")] -pub use unicode::tables::UNICODE_VERSION; +pub use crate::unicode::tables::UNICODE_VERSION; #[unstable(feature = "unicode_version", issue = "49726")] -pub use unicode::version::UnicodeVersion; +pub use crate::unicode::version::UnicodeVersion; -use fmt::{self, Write}; -use iter::FusedIterator; +use crate::fmt::{self, Write}; +use crate::iter::FusedIterator; // UTF-8 ranges and tags for encoding characters const TAG_CONT: u8 = 0b1000_0000; diff --git a/src/libcore/clone.rs b/src/libcore/clone.rs index ed90b7de26417..9e32acb97d360 100644 --- a/src/libcore/clone.rs +++ b/src/libcore/clone.rs @@ -142,13 +142,13 @@ pub trait Clone : Sized { #[unstable(feature = "derive_clone_copy", reason = "deriving hack, should not be public", issue = "0")] -pub struct AssertParamIsClone { _field: ::marker::PhantomData } +pub struct AssertParamIsClone { _field: crate::marker::PhantomData } #[doc(hidden)] #[allow(missing_debug_implementations)] #[unstable(feature = "derive_clone_copy", reason = "deriving hack, should not be public", issue = "0")] -pub struct AssertParamIsCopy { _field: ::marker::PhantomData } +pub struct AssertParamIsCopy { _field: crate::marker::PhantomData } /// Implementations of `Clone` for primitive types. /// diff --git a/src/libcore/cmp.rs b/src/libcore/cmp.rs index 14908108fc5a6..59088e4329177 100644 --- a/src/libcore/cmp.rs +++ b/src/libcore/cmp.rs @@ -265,7 +265,7 @@ pub trait Eq: PartialEq { #[unstable(feature = "derive_eq", reason = "deriving hack, should not be public", issue = "0")] -pub struct AssertParamIsEq { _field: ::marker::PhantomData } +pub struct AssertParamIsEq { _field: crate::marker::PhantomData } /// An `Ordering` is the result of a comparison between two values. /// @@ -884,7 +884,7 @@ pub fn max(v1: T, v2: T) -> T { // Implementation of PartialEq, Eq, PartialOrd and Ord for primitive types mod impls { - use cmp::Ordering::{self, Less, Greater, Equal}; + use crate::cmp::Ordering::{self, Less, Greater, Equal}; macro_rules! partial_eq_impl { ($($t:ty)*) => ($( diff --git a/src/libcore/convert.rs b/src/libcore/convert.rs index e903bd936c484..cf92babcb400c 100644 --- a/src/libcore/convert.rs +++ b/src/libcore/convert.rs @@ -40,7 +40,7 @@ #![stable(feature = "rust1", since = "1.0.0")] -use fmt; +use crate::fmt; /// An identity function. /// diff --git a/src/libcore/ffi.rs b/src/libcore/ffi.rs index 896710609642a..004fafc5a0b65 100644 --- a/src/libcore/ffi.rs +++ b/src/libcore/ffi.rs @@ -4,7 +4,7 @@ //! Utilities related to FFI bindings. -use ::fmt; +use crate::fmt; /// Equivalent to C's `void` type when used as a [pointer]. /// diff --git a/src/libcore/fmt/builders.rs b/src/libcore/fmt/builders.rs index df3852973b8dd..e78381ba0c482 100644 --- a/src/libcore/fmt/builders.rs +++ b/src/libcore/fmt/builders.rs @@ -1,4 +1,4 @@ -use fmt; +use crate::fmt; struct PadAdapter<'a> { buf: &'a mut (dyn fmt::Write + 'a), diff --git a/src/libcore/fmt/float.rs b/src/libcore/fmt/float.rs index 5f4c6f7b0a3f0..5fc2cd4b8d0a3 100644 --- a/src/libcore/fmt/float.rs +++ b/src/libcore/fmt/float.rs @@ -1,6 +1,6 @@ -use fmt::{Formatter, Result, LowerExp, UpperExp, Display, Debug}; -use mem::MaybeUninit; -use num::flt2dec; +use crate::fmt::{Formatter, Result, LowerExp, UpperExp, Display, Debug}; +use crate::mem::MaybeUninit; +use crate::num::flt2dec; // Don't inline this so callers don't use the stack space this function // requires unless they have to. diff --git a/src/libcore/fmt/mod.rs b/src/libcore/fmt/mod.rs index 7efb7f31298bf..1ccd6ec898f8b 100644 --- a/src/libcore/fmt/mod.rs +++ b/src/libcore/fmt/mod.rs @@ -2,14 +2,14 @@ #![stable(feature = "rust1", since = "1.0.0")] -use cell::{UnsafeCell, Cell, RefCell, Ref, RefMut}; -use marker::PhantomData; -use mem; -use num::flt2dec; -use ops::Deref; -use result; -use slice; -use str; +use crate::cell::{UnsafeCell, Cell, RefCell, Ref, RefMut}; +use crate::marker::PhantomData; +use crate::mem; +use crate::num::flt2dec; +use crate::ops::Deref; +use crate::result; +use crate::slice; +use crate::str; mod float; mod num; diff --git a/src/libcore/fmt/num.rs b/src/libcore/fmt/num.rs index e96dbcaa14416..6ad9cc6223953 100644 --- a/src/libcore/fmt/num.rs +++ b/src/libcore/fmt/num.rs @@ -1,12 +1,12 @@ //! Integer and floating-point number formatting -use fmt; -use ops::{Div, Rem, Sub}; -use str; -use slice; -use ptr; -use mem::MaybeUninit; +use crate::fmt; +use crate::ops::{Div, Rem, Sub}; +use crate::str; +use crate::slice; +use crate::ptr; +use crate::mem::MaybeUninit; #[doc(hidden)] trait Int: PartialEq + PartialOrd + Div + Rem + @@ -196,7 +196,7 @@ macro_rules! impl_Display { unsafe { // need at least 16 bits for the 4-characters-at-a-time to work. - assert!(::mem::size_of::<$u>() >= 2); + assert!(crate::mem::size_of::<$u>() >= 2); // eagerly decode 4 characters at a time while n >= 10000 { diff --git a/src/libcore/future/future.rs b/src/libcore/future/future.rs index 114a6b9336777..ea54b5a66996a 100644 --- a/src/libcore/future/future.rs +++ b/src/libcore/future/future.rs @@ -2,10 +2,10 @@ reason = "futures in libcore are unstable", issue = "50547")] -use marker::Unpin; -use ops; -use pin::Pin; -use task::{Context, Poll}; +use crate::marker::Unpin; +use crate::ops; +use crate::pin::Pin; +use crate::task::{Context, Poll}; /// A future represents an asynchronous computation. /// diff --git a/src/libcore/hash/mod.rs b/src/libcore/hash/mod.rs index 973d41c14492e..46f7f90e4649d 100644 --- a/src/libcore/hash/mod.rs +++ b/src/libcore/hash/mod.rs @@ -81,8 +81,8 @@ #![stable(feature = "rust1", since = "1.0.0")] -use fmt; -use marker; +use crate::fmt; +use crate::marker; #[stable(feature = "rust1", since = "1.0.0")] #[allow(deprecated)] @@ -541,8 +541,9 @@ impl Eq for BuildHasherDefault {} ////////////////////////////////////////////////////////////////////////////// mod impls { - use mem; - use slice; + use crate::mem; + use crate::slice; + use super::*; macro_rules! impl_write { diff --git a/src/libcore/hash/sip.rs b/src/libcore/hash/sip.rs index 235c79307ab8d..19aeafd882ef1 100644 --- a/src/libcore/hash/sip.rs +++ b/src/libcore/hash/sip.rs @@ -2,10 +2,10 @@ #![allow(deprecated)] // the types in this module are deprecated -use marker::PhantomData; -use ptr; -use cmp; -use mem; +use crate::marker::PhantomData; +use crate::ptr; +use crate::cmp; +use crate::mem; /// An implementation of SipHash 1-3. /// @@ -269,7 +269,7 @@ impl super::Hasher for Hasher { #[inline] fn write_usize(&mut self, i: usize) { let bytes = unsafe { - ::slice::from_raw_parts(&i as *const usize as *const u8, mem::size_of::()) + crate::slice::from_raw_parts(&i as *const usize as *const u8, mem::size_of::()) }; self.short_write(bytes); } diff --git a/src/libcore/hint.rs b/src/libcore/hint.rs index 89bf364096896..94eddbeda2b86 100644 --- a/src/libcore/hint.rs +++ b/src/libcore/hint.rs @@ -2,7 +2,7 @@ //! Hints to compiler that affects how code should be emitted or optimized. -use intrinsics; +use crate::intrinsics; /// Informs the compiler that this point in the code is not reachable, enabling /// further optimizations. diff --git a/src/libcore/internal_macros.rs b/src/libcore/internal_macros.rs index ee6b7d3db48a6..dd5b92857be63 100644 --- a/src/libcore/internal_macros.rs +++ b/src/libcore/internal_macros.rs @@ -81,9 +81,7 @@ macro_rules! forward_ref_op_assign { macro_rules! impl_fn_for_zst { ($( $( #[$attr: meta] )* - // FIXME: when libcore is in the 2018 edition, use `?` repetition in - // $( <$( $li : lifetime ),+> )? - struct $Name: ident impl$( <$( $lifetime : lifetime ),+> )* Fn = + struct $Name: ident impl$( <$( $lifetime : lifetime ),+> )? Fn = |$( $arg: ident: $ArgTy: ty ),*| -> $ReturnTy: ty $body: block; )+) => { @@ -91,14 +89,14 @@ macro_rules! impl_fn_for_zst { $( #[$attr] )* struct $Name; - impl $( <$( $lifetime ),+> )* Fn<($( $ArgTy, )*)> for $Name { + impl $( <$( $lifetime ),+> )? Fn<($( $ArgTy, )*)> for $Name { #[inline] extern "rust-call" fn call(&self, ($( $arg, )*): ($( $ArgTy, )*)) -> $ReturnTy { $body } } - impl $( <$( $lifetime ),+> )* FnMut<($( $ArgTy, )*)> for $Name { + impl $( <$( $lifetime ),+> )? FnMut<($( $ArgTy, )*)> for $Name { #[inline] extern "rust-call" fn call_mut( &mut self, @@ -108,7 +106,7 @@ macro_rules! impl_fn_for_zst { } } - impl $( <$( $lifetime ),+> )* FnOnce<($( $ArgTy, )*)> for $Name { + impl $( <$( $lifetime ),+> )? FnOnce<($( $ArgTy, )*)> for $Name { type Output = $ReturnTy; #[inline] diff --git a/src/libcore/intrinsics.rs b/src/libcore/intrinsics.rs index 05acd7bd01187..782a7ba455984 100644 --- a/src/libcore/intrinsics.rs +++ b/src/libcore/intrinsics.rs @@ -39,7 +39,7 @@ #[stable(feature = "drop_in_place", since = "1.8.0")] #[rustc_deprecated(reason = "no longer an intrinsic - use `ptr::drop_in_place` directly", since = "1.18.0")] -pub use ptr::drop_in_place; +pub use crate::ptr::drop_in_place; extern "rust-intrinsic" { // N.B., these intrinsics take raw pointers because they mutate aliased @@ -1291,7 +1291,7 @@ extern "rust-intrinsic" { /// platforms this is a `*mut *mut T` which is filled in by the compiler and /// on MSVC it's `*mut [usize; 2]`. For more information see the compiler's /// source as well as std's catch implementation. - pub fn try(f: fn(*mut u8), data: *mut u8, local_ptr: *mut u8) -> i32; + pub fn r#try(f: fn(*mut u8), data: *mut u8, local_ptr: *mut u8) -> i32; /// Emits a `!nontemporal` store according to LLVM (see their docs). /// Probably will never become stable. diff --git a/src/libcore/iter/adapters/chain.rs b/src/libcore/iter/adapters/chain.rs index 573b096fb463e..11e13149bc2c9 100644 --- a/src/libcore/iter/adapters/chain.rs +++ b/src/libcore/iter/adapters/chain.rs @@ -1,5 +1,6 @@ -use ops::Try; -use usize; +use crate::ops::Try; +use crate::usize; + use super::super::{Iterator, DoubleEndedIterator, FusedIterator, TrustedLen}; /// An iterator that strings two iterators together. diff --git a/src/libcore/iter/adapters/flatten.rs b/src/libcore/iter/adapters/flatten.rs index 40f6865d38bcf..8eb81fbb2c6e4 100644 --- a/src/libcore/iter/adapters/flatten.rs +++ b/src/libcore/iter/adapters/flatten.rs @@ -1,5 +1,6 @@ -use fmt; -use ops::Try; +use crate::fmt; +use crate::ops::Try; + use super::super::{Iterator, DoubleEndedIterator, FusedIterator}; use super::Map; diff --git a/src/libcore/iter/adapters/mod.rs b/src/libcore/iter/adapters/mod.rs index cccd51b577930..ce18b4b97ad66 100644 --- a/src/libcore/iter/adapters/mod.rs +++ b/src/libcore/iter/adapters/mod.rs @@ -1,8 +1,9 @@ -use cmp; -use fmt; -use ops::Try; -use usize; -use intrinsics; +use crate::cmp; +use crate::fmt; +use crate::ops::Try; +use crate::usize; +use crate::intrinsics; + use super::{Iterator, DoubleEndedIterator, ExactSizeIterator, FusedIterator, TrustedLen}; use super::LoopState; diff --git a/src/libcore/iter/adapters/zip.rs b/src/libcore/iter/adapters/zip.rs index 3548d0e282602..06f047d92872e 100644 --- a/src/libcore/iter/adapters/zip.rs +++ b/src/libcore/iter/adapters/zip.rs @@ -1,4 +1,5 @@ -use cmp; +use crate::cmp; + use super::super::{Iterator, DoubleEndedIterator, ExactSizeIterator, FusedIterator, TrustedLen}; /// An iterator that iterates two other iterators simultaneously. diff --git a/src/libcore/iter/mod.rs b/src/libcore/iter/mod.rs index e6a616b680228..fd7498119bf49 100644 --- a/src/libcore/iter/mod.rs +++ b/src/libcore/iter/mod.rs @@ -306,7 +306,7 @@ #![stable(feature = "rust1", since = "1.0.0")] -use ops::Try; +use crate::ops::Try; #[stable(feature = "rust1", since = "1.0.0")] pub use self::traits::Iterator; diff --git a/src/libcore/iter/range.rs b/src/libcore/iter/range.rs index aefed1890fef8..f8a975cc8d47f 100644 --- a/src/libcore/iter/range.rs +++ b/src/libcore/iter/range.rs @@ -1,7 +1,7 @@ -use convert::TryFrom; -use mem; -use ops::{self, Add, Sub, Try}; -use usize; +use crate::convert::TryFrom; +use crate::mem; +use crate::ops::{self, Add, Sub, Try}; +use crate::usize; use super::{FusedIterator, TrustedLen}; @@ -321,7 +321,7 @@ impl Iterator for ops::RangeInclusive { } if let Some(plus_n) = self.start.add_usize(n) { - use cmp::Ordering::*; + use crate::cmp::Ordering::*; match plus_n.partial_cmp(&self.end) { Some(Less) => { diff --git a/src/libcore/iter/sources.rs b/src/libcore/iter/sources.rs index 7934e5880d7d2..c4f6fbf0ff222 100644 --- a/src/libcore/iter/sources.rs +++ b/src/libcore/iter/sources.rs @@ -1,6 +1,6 @@ -use fmt; -use marker; -use usize; +use crate::fmt; +use crate::marker; +use crate::usize; use super::{FusedIterator, TrustedLen}; @@ -283,7 +283,7 @@ pub const fn empty() -> Empty { #[derive(Clone, Debug)] #[stable(feature = "iter_once", since = "1.2.0")] pub struct Once { - inner: ::option::IntoIter + inner: crate::option::IntoIter } #[stable(feature = "iter_once", since = "1.2.0")] diff --git a/src/libcore/iter/traits/accum.rs b/src/libcore/iter/traits/accum.rs index dfe1d2a1006d7..7815fe9c59d08 100644 --- a/src/libcore/iter/traits/accum.rs +++ b/src/libcore/iter/traits/accum.rs @@ -1,5 +1,5 @@ -use ops::{Mul, Add}; -use num::Wrapping; +use crate::ops::{Mul, Add}; +use crate::num::Wrapping; /// Trait to represent types that can be created by summing up an iterator. /// diff --git a/src/libcore/iter/traits/double_ended.rs b/src/libcore/iter/traits/double_ended.rs index 2976afc0b4f81..06de95c082724 100644 --- a/src/libcore/iter/traits/double_ended.rs +++ b/src/libcore/iter/traits/double_ended.rs @@ -1,5 +1,5 @@ -use ops::Try; -use iter::LoopState; +use crate::ops::Try; +use crate::iter::LoopState; /// An iterator able to yield elements from both ends. /// diff --git a/src/libcore/iter/traits/iterator.rs b/src/libcore/iter/traits/iterator.rs index 6df4a457655c5..9da593c86bdfb 100644 --- a/src/libcore/iter/traits/iterator.rs +++ b/src/libcore/iter/traits/iterator.rs @@ -1,5 +1,5 @@ -use cmp::Ordering; -use ops::Try; +use crate::cmp::Ordering; +use crate::ops::Try; use super::super::LoopState; use super::super::{Chain, Cycle, Copied, Cloned, Enumerate, Filter, FilterMap, Fuse}; diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs index 615549f47bbd6..0d660b002da60 100644 --- a/src/libcore/lib.rs +++ b/src/libcore/lib.rs @@ -63,6 +63,10 @@ #![warn(missing_debug_implementations)] #![deny(intra_doc_link_resolution_failure)] // rustdoc is run without -D warnings +#![deny(rust_2018_idioms)] +#![allow(explicit_outlives_requirements)] +#![allow(elided_lifetimes_in_paths)] + #![feature(allow_internal_unstable)] #![feature(arbitrary_self_types)] #![feature(asm)] diff --git a/src/libcore/marker.rs b/src/libcore/marker.rs index 9b1ead7edd68b..74f685a6de20e 100644 --- a/src/libcore/marker.rs +++ b/src/libcore/marker.rs @@ -6,10 +6,10 @@ #![stable(feature = "rust1", since = "1.0.0")] -use cell::UnsafeCell; -use cmp; -use hash::Hash; -use hash::Hasher; +use crate::cell::UnsafeCell; +use crate::cmp; +use crate::hash::Hash; +use crate::hash::Hasher; /// Types that can be transferred across thread boundaries. /// diff --git a/src/libcore/mem.rs b/src/libcore/mem.rs index e887426554701..e2bd4b4a39a9d 100644 --- a/src/libcore/mem.rs +++ b/src/libcore/mem.rs @@ -5,18 +5,18 @@ #![stable(feature = "rust1", since = "1.0.0")] -use clone; -use cmp; -use fmt; -use hash; -use intrinsics; -use marker::{Copy, PhantomData, Sized}; -use ptr; -use ops::{Deref, DerefMut}; +use crate::clone; +use crate::cmp; +use crate::fmt; +use crate::hash; +use crate::intrinsics; +use crate::marker::{Copy, PhantomData, Sized}; +use crate::ptr; +use crate::ops::{Deref, DerefMut}; #[stable(feature = "rust1", since = "1.0.0")] #[doc(inline)] -pub use intrinsics::transmute; +pub use crate::intrinsics::transmute; /// Takes ownership and "forgets" about the value **without running its destructor**. /// diff --git a/src/libcore/num/bignum.rs b/src/libcore/num/bignum.rs index c3a42a0fc0494..64699e85d0c88 100644 --- a/src/libcore/num/bignum.rs +++ b/src/libcore/num/bignum.rs @@ -17,8 +17,8 @@ issue = "0")] #![macro_use] -use mem; -use intrinsics; +use crate::mem; +use crate::intrinsics; /// Arithmetic operations required by bignums. pub trait FullOps: Sized { @@ -128,7 +128,7 @@ macro_rules! define_bignum { /// Makes a bignum from `u64` value. pub fn from_u64(mut v: u64) -> $name { - use mem; + use crate::mem; let mut base = [0; $n]; let mut sz = 0; @@ -150,7 +150,7 @@ macro_rules! define_bignum { /// Returns the `i`-th bit where bit 0 is the least significant one. /// In other words, the bit with weight `2^i`. pub fn get_bit(&self, i: usize) -> u8 { - use mem; + use crate::mem; let digitbits = mem::size_of::<$ty>() * 8; let d = i / digitbits; @@ -166,7 +166,7 @@ macro_rules! define_bignum { /// Returns the number of bits necessary to represent this value. Note that zero /// is considered to need 0 bits. pub fn bit_length(&self) -> usize { - use mem; + use crate::mem; // Skip over the most significant digits which are zero. let digits = self.digits(); @@ -190,8 +190,8 @@ macro_rules! define_bignum { /// Adds `other` to itself and returns its own mutable reference. pub fn add<'a>(&'a mut self, other: &$name) -> &'a mut $name { - use cmp; - use num::bignum::FullOps; + use crate::cmp; + use crate::num::bignum::FullOps; let mut sz = cmp::max(self.size, other.size); let mut carry = false; @@ -209,7 +209,7 @@ macro_rules! define_bignum { } pub fn add_small(&mut self, other: $ty) -> &mut $name { - use num::bignum::FullOps; + use crate::num::bignum::FullOps; let (mut carry, v) = self.base[0].full_add(other, false); self.base[0] = v; @@ -228,8 +228,8 @@ macro_rules! define_bignum { /// Subtracts `other` from itself and returns its own mutable reference. pub fn sub<'a>(&'a mut self, other: &$name) -> &'a mut $name { - use cmp; - use num::bignum::FullOps; + use crate::cmp; + use crate::num::bignum::FullOps; let sz = cmp::max(self.size, other.size); let mut noborrow = true; @@ -246,7 +246,7 @@ macro_rules! define_bignum { /// Multiplies itself by a digit-sized `other` and returns its own /// mutable reference. pub fn mul_small(&mut self, other: $ty) -> &mut $name { - use num::bignum::FullOps; + use crate::num::bignum::FullOps; let mut sz = self.size; let mut carry = 0; @@ -265,7 +265,7 @@ macro_rules! define_bignum { /// Multiplies itself by `2^bits` and returns its own mutable reference. pub fn mul_pow2(&mut self, bits: usize) -> &mut $name { - use mem; + use crate::mem; let digitbits = mem::size_of::<$ty>() * 8; let digits = bits / digitbits; @@ -306,8 +306,8 @@ macro_rules! define_bignum { /// Multiplies itself by `5^e` and returns its own mutable reference. pub fn mul_pow5(&mut self, mut e: usize) -> &mut $name { - use mem; - use num::bignum::SMALL_POW5; + use crate::mem; + use crate::num::bignum::SMALL_POW5; // There are exactly n trailing zeros on 2^n, and the only relevant digit sizes // are consecutive powers of two, so this is well suited index for the table. @@ -338,7 +338,7 @@ macro_rules! define_bignum { pub fn mul_digits<'a>(&'a mut self, other: &[$ty]) -> &'a mut $name { // the internal routine. works best when aa.len() <= bb.len(). fn mul_inner(ret: &mut [$ty; $n], aa: &[$ty], bb: &[$ty]) -> usize { - use num::bignum::FullOps; + use crate::num::bignum::FullOps; let mut retsz = 0; for (i, &a) in aa.iter().enumerate() { @@ -375,7 +375,7 @@ macro_rules! define_bignum { /// Divides itself by a digit-sized `other` and returns its own /// mutable reference *and* the remainder. pub fn div_rem_small(&mut self, other: $ty) -> (&mut $name, $ty) { - use num::bignum::FullOps; + use crate::num::bignum::FullOps; assert!(other > 0); @@ -392,7 +392,7 @@ macro_rules! define_bignum { /// Divide self by another bignum, overwriting `q` with the quotient and `r` with the /// remainder. pub fn div_rem(&self, d: &$name, q: &mut $name, r: &mut $name) { - use mem; + use crate::mem; // Stupid slow base-2 long division taken from // https://en.wikipedia.org/wiki/Division_algorithm @@ -429,22 +429,22 @@ macro_rules! define_bignum { } } - impl ::cmp::PartialEq for $name { + impl crate::cmp::PartialEq for $name { fn eq(&self, other: &$name) -> bool { self.base[..] == other.base[..] } } - impl ::cmp::Eq for $name { + impl crate::cmp::Eq for $name { } - impl ::cmp::PartialOrd for $name { - fn partial_cmp(&self, other: &$name) -> ::option::Option<::cmp::Ordering> { - ::option::Option::Some(self.cmp(other)) + impl crate::cmp::PartialOrd for $name { + fn partial_cmp(&self, other: &$name) -> crate::option::Option { + crate::option::Option::Some(self.cmp(other)) } } - impl ::cmp::Ord for $name { - fn cmp(&self, other: &$name) -> ::cmp::Ordering { - use cmp::max; + impl crate::cmp::Ord for $name { + fn cmp(&self, other: &$name) -> crate::cmp::Ordering { + use crate::cmp::max; let sz = max(self.size, other.size); let lhs = self.base[..sz].iter().cloned().rev(); let rhs = other.base[..sz].iter().cloned().rev(); @@ -452,15 +452,15 @@ macro_rules! define_bignum { } } - impl ::clone::Clone for $name { + impl crate::clone::Clone for $name { fn clone(&self) -> $name { $name { size: self.size, base: self.base } } } - impl ::fmt::Debug for $name { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - use mem; + impl crate::fmt::Debug for $name { + fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + use crate::mem; let sz = if self.size < 1 {1} else {self.size}; let digitlen = mem::size_of::<$ty>() * 2; @@ -469,7 +469,7 @@ macro_rules! define_bignum { for &v in self.base[..sz-1].iter().rev() { write!(f, "_{:01$x}", v, digitlen)?; } - ::result::Result::Ok(()) + crate::result::Result::Ok(()) } } ) diff --git a/src/libcore/num/dec2flt/algorithm.rs b/src/libcore/num/dec2flt/algorithm.rs index a83134a6b2ca4..fa3c8075378ca 100644 --- a/src/libcore/num/dec2flt/algorithm.rs +++ b/src/libcore/num/dec2flt/algorithm.rs @@ -1,11 +1,11 @@ //! The various algorithms from the paper. -use cmp::min; -use cmp::Ordering::{Less, Equal, Greater}; -use num::diy_float::Fp; -use num::dec2flt::table; -use num::dec2flt::rawfp::{self, Unpacked, RawFloat, fp_to_float, next_float, prev_float}; -use num::dec2flt::num::{self, Big}; +use crate::cmp::min; +use crate::cmp::Ordering::{Less, Equal, Greater}; +use crate::num::diy_float::Fp; +use crate::num::dec2flt::table; +use crate::num::dec2flt::rawfp::{self, Unpacked, RawFloat, fp_to_float, next_float, prev_float}; +use crate::num::dec2flt::num::{self, Big}; /// Number of significand bits in Fp const P: u32 = 64; @@ -35,7 +35,7 @@ mod fpu_precision { // computations are performed in the desired precision. #[cfg(all(target_arch="x86", not(target_feature="sse2")))] mod fpu_precision { - use mem::size_of; + use crate::mem::size_of; /// A structure used to preserve the original value of the FPU control word, so that it can be /// restored when the structure is dropped. diff --git a/src/libcore/num/dec2flt/mod.rs b/src/libcore/num/dec2flt/mod.rs index d62cdae0688be..dcfa2d352a818 100644 --- a/src/libcore/num/dec2flt/mod.rs +++ b/src/libcore/num/dec2flt/mod.rs @@ -82,8 +82,8 @@ reason = "internal routines only exposed for testing", issue = "0")] -use fmt; -use str::FromStr; +use crate::fmt; +use crate::str::FromStr; use self::parse::{parse_decimal, Decimal, Sign, ParseResult}; use self::num::digits_to_big; diff --git a/src/libcore/num/dec2flt/num.rs b/src/libcore/num/dec2flt/num.rs index 126713185711b..4d50516ce546b 100644 --- a/src/libcore/num/dec2flt/num.rs +++ b/src/libcore/num/dec2flt/num.rs @@ -2,9 +2,9 @@ // FIXME This module's name is a bit unfortunate, since other modules also import `core::num`. -use cmp::Ordering::{self, Less, Equal, Greater}; +use crate::cmp::Ordering::{self, Less, Equal, Greater}; -pub use num::bignum::Big32x40 as Big; +pub use crate::num::bignum::Big32x40 as Big; /// Test whether truncating all bits less significant than `ones_place` introduces /// a relative error less, equal, or greater than 0.5 ULP. diff --git a/src/libcore/num/dec2flt/rawfp.rs b/src/libcore/num/dec2flt/rawfp.rs index b65f539b29c97..fdbdaa238e0f2 100644 --- a/src/libcore/num/dec2flt/rawfp.rs +++ b/src/libcore/num/dec2flt/rawfp.rs @@ -17,15 +17,15 @@ //! Many functions in this module only handle normal numbers. The dec2flt routines conservatively //! take the universally-correct slow path (Algorithm M) for very small and very large numbers. //! That algorithm needs only next_float() which does handle subnormals and zeros. -use cmp::Ordering::{Less, Equal, Greater}; -use convert::{TryFrom, TryInto}; -use ops::{Add, Mul, Div, Neg}; -use fmt::{Debug, LowerExp}; -use num::diy_float::Fp; -use num::FpCategory::{Infinite, Zero, Subnormal, Normal, Nan}; -use num::FpCategory; -use num::dec2flt::num::{self, Big}; -use num::dec2flt::table; +use crate::cmp::Ordering::{Less, Equal, Greater}; +use crate::convert::{TryFrom, TryInto}; +use crate::ops::{Add, Mul, Div, Neg}; +use crate::fmt::{Debug, LowerExp}; +use crate::num::diy_float::Fp; +use crate::num::FpCategory::{Infinite, Zero, Subnormal, Normal, Nan}; +use crate::num::FpCategory; +use crate::num::dec2flt::num::{self, Big}; +use crate::num::dec2flt::table; #[derive(Copy, Clone, Debug)] pub struct Unpacked { diff --git a/src/libcore/num/f32.rs b/src/libcore/num/f32.rs index dc0580764acb7..3f8d142c8457a 100644 --- a/src/libcore/num/f32.rs +++ b/src/libcore/num/f32.rs @@ -7,8 +7,8 @@ #![stable(feature = "rust1", since = "1.0.0")] -use mem; -use num::FpCategory; +use crate::mem; +use crate::num::FpCategory; /// The radix or base of the internal representation of `f32`. #[stable(feature = "rust1", since = "1.0.0")] diff --git a/src/libcore/num/f64.rs b/src/libcore/num/f64.rs index c3677f8c8faea..7f19101fe6ef8 100644 --- a/src/libcore/num/f64.rs +++ b/src/libcore/num/f64.rs @@ -7,8 +7,8 @@ #![stable(feature = "rust1", since = "1.0.0")] -use mem; -use num::FpCategory; +use crate::mem; +use crate::num::FpCategory; /// The radix or base of the internal representation of `f64`. #[stable(feature = "rust1", since = "1.0.0")] diff --git a/src/libcore/num/flt2dec/decoder.rs b/src/libcore/num/flt2dec/decoder.rs index a8da31d3e4858..6c75d00f6b24a 100644 --- a/src/libcore/num/flt2dec/decoder.rs +++ b/src/libcore/num/flt2dec/decoder.rs @@ -1,8 +1,8 @@ //! Decodes a floating-point value into individual parts and error ranges. -use {f32, f64}; -use num::FpCategory; -use num::dec2flt::rawfp::RawFloat; +use crate::{f32, f64}; +use crate::num::FpCategory; +use crate::num::dec2flt::rawfp::RawFloat; /// Decoded unsigned finite value, such that: /// diff --git a/src/libcore/num/flt2dec/mod.rs b/src/libcore/num/flt2dec/mod.rs index c9a9375ec590e..6d42a77744966 100644 --- a/src/libcore/num/flt2dec/mod.rs +++ b/src/libcore/num/flt2dec/mod.rs @@ -120,7 +120,7 @@ functions. reason = "internal routines only exposed for testing", issue = "0")] -use i16; +use crate::i16; pub use self::decoder::{decode, DecodableFloat, FullDecoded, Decoded}; pub mod estimator; diff --git a/src/libcore/num/flt2dec/strategy/dragon.rs b/src/libcore/num/flt2dec/strategy/dragon.rs index 582fe22f85406..35fb4b927589f 100644 --- a/src/libcore/num/flt2dec/strategy/dragon.rs +++ b/src/libcore/num/flt2dec/strategy/dragon.rs @@ -4,12 +4,12 @@ //! [^1]: Burger, R. G. and Dybvig, R. K. 1996. Printing floating-point numbers //! quickly and accurately. SIGPLAN Not. 31, 5 (May. 1996), 108-116. -use cmp::Ordering; +use crate::cmp::Ordering; -use num::flt2dec::{Decoded, MAX_SIG_DIGITS, round_up}; -use num::flt2dec::estimator::estimate_scaling_factor; -use num::bignum::Digit32 as Digit; -use num::bignum::Big32x40 as Big; +use crate::num::flt2dec::{Decoded, MAX_SIG_DIGITS, round_up}; +use crate::num::flt2dec::estimator::estimate_scaling_factor; +use crate::num::bignum::Digit32 as Digit; +use crate::num::bignum::Big32x40 as Big; static POW10: [Digit; 10] = [1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000]; diff --git a/src/libcore/num/flt2dec/strategy/grisu.rs b/src/libcore/num/flt2dec/strategy/grisu.rs index aa21fcffa5c61..61b50ec8ca566 100644 --- a/src/libcore/num/flt2dec/strategy/grisu.rs +++ b/src/libcore/num/flt2dec/strategy/grisu.rs @@ -5,8 +5,8 @@ //! [^1]: Florian Loitsch. 2010. Printing floating-point numbers quickly and //! accurately with integers. SIGPLAN Not. 45, 6 (June 2010), 233-243. -use num::diy_float::Fp; -use num::flt2dec::{Decoded, MAX_SIG_DIGITS, round_up}; +use crate::num::diy_float::Fp; +use crate::num::flt2dec::{Decoded, MAX_SIG_DIGITS, round_up}; // see the comments in `format_shortest_opt` for the rationale. @@ -418,7 +418,7 @@ pub fn format_shortest_opt(d: &Decoded, /// /// This should be used for most cases. pub fn format_shortest(d: &Decoded, buf: &mut [u8]) -> (/*#digits*/ usize, /*exp*/ i16) { - use num::flt2dec::strategy::dragon::format_shortest as fallback; + use crate::num::flt2dec::strategy::dragon::format_shortest as fallback; match format_shortest_opt(d, buf) { Some(ret) => ret, None => fallback(d, buf), @@ -675,7 +675,7 @@ pub fn format_exact_opt(d: &Decoded, buf: &mut [u8], limit: i16) /// /// This should be used for most cases. pub fn format_exact(d: &Decoded, buf: &mut [u8], limit: i16) -> (/*#digits*/ usize, /*exp*/ i16) { - use num::flt2dec::strategy::dragon::format_exact as fallback; + use crate::num::flt2dec::strategy::dragon::format_exact as fallback; match format_exact_opt(d, buf, limit) { Some(ret) => ret, None => fallback(d, buf, limit), diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index b372bd3cb07bd..24afc945e9313 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -2,12 +2,12 @@ #![stable(feature = "rust1", since = "1.0.0")] -use convert::{TryFrom, Infallible}; -use fmt; -use intrinsics; -use mem; -use ops; -use str::FromStr; +use crate::convert::{TryFrom, Infallible}; +use crate::fmt; +use crate::intrinsics; +use crate::mem; +use crate::ops; +use crate::str::FromStr; macro_rules! impl_nonzero_fmt { ( #[$stability: meta] ( $( $Trait: ident ),+ ) for $Ty: ident ) => { @@ -3939,7 +3939,7 @@ impl u8 { #[inline] pub fn is_ascii_alphabetic(&self) -> bool { match *self { - b'A'...b'Z' | b'a'...b'z' => true, + b'A'..=b'Z' | b'a'..=b'z' => true, _ => false } } @@ -3974,7 +3974,7 @@ impl u8 { #[inline] pub fn is_ascii_uppercase(&self) -> bool { match *self { - b'A'...b'Z' => true, + b'A'..=b'Z' => true, _ => false } } @@ -4009,7 +4009,7 @@ impl u8 { #[inline] pub fn is_ascii_lowercase(&self) -> bool { match *self { - b'a'...b'z' => true, + b'a'..=b'z' => true, _ => false } } @@ -4047,7 +4047,7 @@ impl u8 { #[inline] pub fn is_ascii_alphanumeric(&self) -> bool { match *self { - b'0'...b'9' | b'A'...b'Z' | b'a'...b'z' => true, + b'0'..=b'9' | b'A'..=b'Z' | b'a'..=b'z' => true, _ => false } } @@ -4082,7 +4082,7 @@ impl u8 { #[inline] pub fn is_ascii_digit(&self) -> bool { match *self { - b'0'...b'9' => true, + b'0'..=b'9' => true, _ => false } } @@ -4120,7 +4120,7 @@ impl u8 { #[inline] pub fn is_ascii_hexdigit(&self) -> bool { match *self { - b'0'...b'9' | b'A'...b'F' | b'a'...b'f' => true, + b'0'..=b'9' | b'A'..=b'F' | b'a'..=b'f' => true, _ => false } } @@ -4159,7 +4159,7 @@ impl u8 { #[inline] pub fn is_ascii_punctuation(&self) -> bool { match *self { - b'!'...b'/' | b':'...b'@' | b'['...b'`' | b'{'...b'~' => true, + b'!'..=b'/' | b':'..=b'@' | b'['..=b'`' | b'{'..=b'~' => true, _ => false } } @@ -4194,7 +4194,7 @@ impl u8 { #[inline] pub fn is_ascii_graphic(&self) -> bool { match *self { - b'!'...b'~' => true, + b'!'..=b'~' => true, _ => false } } @@ -4283,7 +4283,7 @@ impl u8 { #[inline] pub fn is_ascii_control(&self) -> bool { match *self { - b'\0'...b'\x1F' | b'\x7F' => true, + b'\0'..=b'\x1F' | b'\x7F' => true, _ => false } } @@ -4573,7 +4573,7 @@ try_from_lower_bounded!(isize, usize); #[cfg(target_pointer_width = "16")] mod ptr_try_from_impls { use super::TryFromIntError; - use convert::TryFrom; + use crate::convert::TryFrom; try_from_upper_bounded!(usize, u8); try_from_unbounded!(usize, u16, u32, u64, u128); @@ -4596,7 +4596,7 @@ mod ptr_try_from_impls { #[cfg(target_pointer_width = "32")] mod ptr_try_from_impls { use super::TryFromIntError; - use convert::TryFrom; + use crate::convert::TryFrom; try_from_upper_bounded!(usize, u8, u16); try_from_unbounded!(usize, u32, u64, u128); @@ -4622,7 +4622,7 @@ mod ptr_try_from_impls { #[cfg(target_pointer_width = "64")] mod ptr_try_from_impls { use super::TryFromIntError; - use convert::TryFrom; + use crate::convert::TryFrom; try_from_upper_bounded!(usize, u8, u16, u32); try_from_unbounded!(usize, u64, u128); @@ -4826,7 +4826,7 @@ impl fmt::Display for ParseIntError { } #[stable(feature = "rust1", since = "1.0.0")] -pub use num::dec2flt::ParseFloatError; +pub use crate::num::dec2flt::ParseFloatError; // Conversion traits for primitive integer and float types // Conversions T -> T are covered by a blanket impl and therefore excluded diff --git a/src/libcore/num/wrapping.rs b/src/libcore/num/wrapping.rs index 9cd5108ade411..a3491bc3dc664 100644 --- a/src/libcore/num/wrapping.rs +++ b/src/libcore/num/wrapping.rs @@ -1,6 +1,6 @@ use super::Wrapping; -use ops::*; +use crate::ops::*; #[allow(unused_macros)] macro_rules! sh_impl_signed { diff --git a/src/libcore/ops/mod.rs b/src/libcore/ops/mod.rs index 0ca64f28ff309..5d1d3efd4120f 100644 --- a/src/libcore/ops/mod.rs +++ b/src/libcore/ops/mod.rs @@ -152,7 +152,7 @@ mod function; mod generator; mod index; mod range; -mod try; +mod r#try; mod unsize; #[stable(feature = "rust1", since = "1.0.0")] @@ -187,7 +187,7 @@ pub use self::range::{Range, RangeFrom, RangeFull, RangeTo}; pub use self::range::{RangeInclusive, RangeToInclusive, RangeBounds, Bound}; #[unstable(feature = "try_trait", issue = "42327")] -pub use self::try::Try; +pub use self::r#try::Try; #[unstable(feature = "generator_trait", issue = "43122")] pub use self::generator::{Generator, GeneratorState}; diff --git a/src/libcore/ops/range.rs b/src/libcore/ops/range.rs index 5b6023f2e2cbb..e13df04c2cedd 100644 --- a/src/libcore/ops/range.rs +++ b/src/libcore/ops/range.rs @@ -1,5 +1,5 @@ -use fmt; -use hash::{Hash, Hasher}; +use crate::fmt; +use crate::hash::{Hash, Hasher}; /// An unbounded range (`..`). /// diff --git a/src/libcore/ops/unsize.rs b/src/libcore/ops/unsize.rs index bd95ddf060ee4..09231ee06ce89 100644 --- a/src/libcore/ops/unsize.rs +++ b/src/libcore/ops/unsize.rs @@ -1,4 +1,4 @@ -use marker::Unsize; +use crate::marker::Unsize; /// Trait that indicates that this is a pointer or a wrapper for one, /// where unsizing can be performed on the pointee. diff --git a/src/libcore/option.rs b/src/libcore/option.rs index 68ef087d84b90..7ce9a73a78205 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -135,9 +135,9 @@ #![stable(feature = "rust1", since = "1.0.0")] -use iter::{FromIterator, FusedIterator, TrustedLen}; -use {hint, mem, ops::{self, Deref}}; -use pin::Pin; +use crate::iter::{FromIterator, FusedIterator, TrustedLen}; +use crate::{hint, mem, ops::{self, Deref}}; +use crate::pin::Pin; // Note that this is not a lang item per se, but it has a hidden dependency on // `Iterator`, which is one. The compiler assumes that the `next` method of diff --git a/src/libcore/panic.rs b/src/libcore/panic.rs index 1abc0a18a9cc9..bcb87bdd098fc 100644 --- a/src/libcore/panic.rs +++ b/src/libcore/panic.rs @@ -4,8 +4,8 @@ reason = "newly available in libcore", issue = "44489")] -use any::Any; -use fmt; +use crate::any::Any; +use crate::fmt; /// A struct providing information about a panic. /// diff --git a/src/libcore/panicking.rs b/src/libcore/panicking.rs index d9cdb2a2b8a9f..4b991b8792576 100644 --- a/src/libcore/panicking.rs +++ b/src/libcore/panicking.rs @@ -26,8 +26,8 @@ and related macros", issue = "0")] -use fmt; -use panic::{Location, PanicInfo}; +use crate::fmt; +use crate::panic::{Location, PanicInfo}; #[cold] // never inline unless panic_immediate_abort to avoid code diff --git a/src/libcore/pin.rs b/src/libcore/pin.rs index d1ebe5ed72adf..538e1aa481cfe 100644 --- a/src/libcore/pin.rs +++ b/src/libcore/pin.rs @@ -263,10 +263,10 @@ #![stable(feature = "pin", since = "1.33.0")] -use fmt; -use marker::{Sized, Unpin}; -use cmp::{self, PartialEq, PartialOrd}; -use ops::{Deref, DerefMut, Receiver, CoerceUnsized, DispatchFromDyn}; +use crate::fmt; +use crate::marker::{Sized, Unpin}; +use crate::cmp::{self, PartialEq, PartialOrd}; +use crate::ops::{Deref, DerefMut, Receiver, CoerceUnsized, DispatchFromDyn}; /// A pinned pointer. /// diff --git a/src/libcore/prelude/v1.rs b/src/libcore/prelude/v1.rs index b53494edbf401..501a41d0d1c76 100644 --- a/src/libcore/prelude/v1.rs +++ b/src/libcore/prelude/v1.rs @@ -9,38 +9,38 @@ // Re-exported core operators #[stable(feature = "core_prelude", since = "1.4.0")] #[doc(no_inline)] -pub use marker::{Copy, Send, Sized, Sync, Unpin}; +pub use crate::marker::{Copy, Send, Sized, Sync, Unpin}; #[stable(feature = "core_prelude", since = "1.4.0")] #[doc(no_inline)] -pub use ops::{Drop, Fn, FnMut, FnOnce}; +pub use crate::ops::{Drop, Fn, FnMut, FnOnce}; // Re-exported functions #[stable(feature = "core_prelude", since = "1.4.0")] #[doc(no_inline)] -pub use mem::drop; +pub use crate::mem::drop; // Re-exported types and traits #[stable(feature = "core_prelude", since = "1.4.0")] #[doc(no_inline)] -pub use clone::Clone; +pub use crate::clone::Clone; #[stable(feature = "core_prelude", since = "1.4.0")] #[doc(no_inline)] -pub use cmp::{PartialEq, PartialOrd, Eq, Ord}; +pub use crate::cmp::{PartialEq, PartialOrd, Eq, Ord}; #[stable(feature = "core_prelude", since = "1.4.0")] #[doc(no_inline)] -pub use convert::{AsRef, AsMut, Into, From}; +pub use crate::convert::{AsRef, AsMut, Into, From}; #[stable(feature = "core_prelude", since = "1.4.0")] #[doc(no_inline)] -pub use default::Default; +pub use crate::default::Default; #[stable(feature = "core_prelude", since = "1.4.0")] #[doc(no_inline)] -pub use iter::{Iterator, Extend, IntoIterator}; +pub use crate::iter::{Iterator, Extend, IntoIterator}; #[stable(feature = "core_prelude", since = "1.4.0")] #[doc(no_inline)] -pub use iter::{DoubleEndedIterator, ExactSizeIterator}; +pub use crate::iter::{DoubleEndedIterator, ExactSizeIterator}; #[stable(feature = "core_prelude", since = "1.4.0")] #[doc(no_inline)] -pub use option::Option::{self, Some, None}; +pub use crate::option::Option::{self, Some, None}; #[stable(feature = "core_prelude", since = "1.4.0")] #[doc(no_inline)] -pub use result::Result::{self, Ok, Err}; +pub use crate::result::Result::{self, Ok, Err}; diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs index 4a7a16b2c94e0..32dcb5bff3691 100644 --- a/src/libcore/ptr.rs +++ b/src/libcore/ptr.rs @@ -63,24 +63,24 @@ #![stable(feature = "rust1", since = "1.0.0")] -use convert::From; -use intrinsics; -use ops::{CoerceUnsized, DispatchFromDyn}; -use fmt; -use hash; -use marker::{PhantomData, Unsize}; -use mem::{self, MaybeUninit}; +use crate::convert::From; +use crate::intrinsics; +use crate::ops::{CoerceUnsized, DispatchFromDyn}; +use crate::fmt; +use crate::hash; +use crate::marker::{PhantomData, Unsize}; +use crate::mem::{self, MaybeUninit}; -use cmp::Ordering::{self, Less, Equal, Greater}; +use crate::cmp::Ordering::{self, Less, Equal, Greater}; #[stable(feature = "rust1", since = "1.0.0")] -pub use intrinsics::copy_nonoverlapping; +pub use crate::intrinsics::copy_nonoverlapping; #[stable(feature = "rust1", since = "1.0.0")] -pub use intrinsics::copy; +pub use crate::intrinsics::copy; #[stable(feature = "rust1", since = "1.0.0")] -pub use intrinsics::write_bytes; +pub use crate::intrinsics::write_bytes; /// Executes the destructor (if any) of the pointed-to value. /// @@ -2402,7 +2402,7 @@ pub(crate) unsafe fn align_offset(p: *const T, a: usize) -> usize { } } - let stride = ::mem::size_of::(); + let stride = mem::size_of::(); let a_minus_one = a.wrapping_sub(1); let pmoda = p as usize & a_minus_one; @@ -2580,7 +2580,7 @@ pub fn eq(a: *const T, b: *const T) -> bool { /// ``` #[stable(feature = "ptr_hash", since = "1.35.0")] pub fn hash(hashee: *const T, into: &mut S) { - use hash::Hash; + use crate::hash::Hash; hashee.hash(into); } diff --git a/src/libcore/result.rs b/src/libcore/result.rs index e22a9ebbca4c3..0277e52a9a648 100644 --- a/src/libcore/result.rs +++ b/src/libcore/result.rs @@ -230,9 +230,9 @@ #![stable(feature = "rust1", since = "1.0.0")] -use fmt; -use iter::{FromIterator, FusedIterator, TrustedLen}; -use ops::{self, Deref}; +use crate::fmt; +use crate::iter::{FromIterator, FusedIterator, TrustedLen}; +use crate::ops::{self, Deref}; /// `Result` is a type that represents either success ([`Ok`]) or failure ([`Err`]). /// diff --git a/src/libcore/slice/memchr.rs b/src/libcore/slice/memchr.rs index cbba546b8daba..45ab016c49628 100644 --- a/src/libcore/slice/memchr.rs +++ b/src/libcore/slice/memchr.rs @@ -1,8 +1,8 @@ // Original implementation taken from rust-memchr. // Copyright 2015 Andrew Gallant, bluss and Nicolas Koch -use cmp; -use mem; +use crate::cmp; +use crate::mem; const LO_U64: u64 = 0x0101010101010101; const HI_U64: u64 = 0x8080808080808080; @@ -32,7 +32,7 @@ fn repeat_byte(b: u8) -> usize { #[cfg(not(target_pointer_width = "16"))] #[inline] fn repeat_byte(b: u8) -> usize { - (b as usize) * (::usize::MAX / 255) + (b as usize) * (crate::usize::MAX / 255) } /// Returns the first index matching the byte `x` in `text`. diff --git a/src/libcore/slice/mod.rs b/src/libcore/slice/mod.rs index 122ef9c79c276..44d56c60b7899 100644 --- a/src/libcore/slice/mod.rs +++ b/src/libcore/slice/mod.rs @@ -20,20 +20,20 @@ // * The `raw` and `bytes` submodules. // * Boilerplate trait implementations. -use cmp::Ordering::{self, Less, Equal, Greater}; -use cmp; -use fmt; -use intrinsics::assume; -use isize; -use iter::*; -use ops::{FnMut, Try, self}; -use option::Option; -use option::Option::{None, Some}; -use result::Result; -use result::Result::{Ok, Err}; -use ptr; -use mem; -use marker::{Copy, Send, Sync, Sized, self}; +use crate::cmp::Ordering::{self, Less, Equal, Greater}; +use crate::cmp; +use crate::fmt; +use crate::intrinsics::assume; +use crate::isize; +use crate::iter::*; +use crate::ops::{FnMut, Try, self}; +use crate::option::Option; +use crate::option::Option::{None, Some}; +use crate::result::Result; +use crate::result::Result::{Ok, Err}; +use crate::ptr; +use crate::mem; +use crate::marker::{Copy, Send, Sync, Sized, self}; #[unstable(feature = "slice_internals", issue = "0", reason = "exposed from core to be reused in std; use the memchr crate")] @@ -2256,13 +2256,14 @@ impl [T] { // Luckily since all this is constant-evaluated... performance here matters not! #[inline] fn gcd(a: usize, b: usize) -> usize { + use crate::intrinsics; // iterative stein’s algorithm // We should still make this `const fn` (and revert to recursive algorithm if we do) // because relying on llvm to consteval all this is… well, it makes me uncomfortable. let (ctz_a, mut ctz_b) = unsafe { if a == 0 { return b; } if b == 0 { return a; } - (::intrinsics::cttz_nonzero(a), ::intrinsics::cttz_nonzero(b)) + (intrinsics::cttz_nonzero(a), intrinsics::cttz_nonzero(b)) }; let k = ctz_a.min(ctz_b); let mut a = a >> ctz_a; @@ -2271,21 +2272,21 @@ impl [T] { // remove all factors of 2 from b b >>= ctz_b; if a > b { - ::mem::swap(&mut a, &mut b); + mem::swap(&mut a, &mut b); } b = b - a; unsafe { if b == 0 { break; } - ctz_b = ::intrinsics::cttz_nonzero(b); + ctz_b = intrinsics::cttz_nonzero(b); } } a << k } - let gcd: usize = gcd(::mem::size_of::(), ::mem::size_of::()); - let ts: usize = ::mem::size_of::() / gcd; - let us: usize = ::mem::size_of::() / gcd; + let gcd: usize = gcd(mem::size_of::(), mem::size_of::()); + let ts: usize = mem::size_of::() / gcd; + let us: usize = mem::size_of::() / gcd; // Armed with this knowledge, we can find how many `U`s we can fit! let us_len = self.len() / ts * us; @@ -2326,7 +2327,7 @@ impl [T] { #[stable(feature = "slice_align_to", since = "1.30.0")] pub unsafe fn align_to(&self) -> (&[T], &[U], &[T]) { // Note that most of this function will be constant-evaluated, - if ::mem::size_of::() == 0 || ::mem::size_of::() == 0 { + if mem::size_of::() == 0 || mem::size_of::() == 0 { // handle ZSTs specially, which is – don't handle them at all. return (self, &[], &[]); } @@ -2334,7 +2335,7 @@ impl [T] { // First, find at what point do we split between the first and 2nd slice. Easy with // ptr.align_offset. let ptr = self.as_ptr(); - let offset = ::ptr::align_offset(ptr, ::mem::align_of::()); + let offset = crate::ptr::align_offset(ptr, mem::align_of::()); if offset > self.len() { (self, &[], &[]) } else { @@ -2379,7 +2380,7 @@ impl [T] { #[stable(feature = "slice_align_to", since = "1.30.0")] pub unsafe fn align_to_mut(&mut self) -> (&mut [T], &mut [U], &mut [T]) { // Note that most of this function will be constant-evaluated, - if ::mem::size_of::() == 0 || ::mem::size_of::() == 0 { + if mem::size_of::() == 0 || mem::size_of::() == 0 { // handle ZSTs specially, which is – don't handle them at all. return (self, &mut [], &mut []); } @@ -2387,7 +2388,7 @@ impl [T] { // First, find at what point do we split between the first and 2nd slice. Easy with // ptr.align_offset. let ptr = self.as_ptr(); - let offset = ::ptr::align_offset(ptr, ::mem::align_of::()); + let offset = crate::ptr::align_offset(ptr, mem::align_of::()); if offset > self.len() { (self, &mut [], &mut []) } else { diff --git a/src/libcore/slice/rotate.rs b/src/libcore/slice/rotate.rs index 8f10c3576a787..f69b219715aa1 100644 --- a/src/libcore/slice/rotate.rs +++ b/src/libcore/slice/rotate.rs @@ -1,6 +1,6 @@ -use cmp; -use mem::{self, MaybeUninit}; -use ptr; +use crate::cmp; +use crate::mem::{self, MaybeUninit}; +use crate::ptr; /// Rotation is much faster if it has access to a little bit of memory. This /// union provides a RawVec-like interface, but to a fixed-size stack buffer. diff --git a/src/libcore/slice/sort.rs b/src/libcore/slice/sort.rs index 68f1fb4b526ad..c293b1900187e 100644 --- a/src/libcore/slice/sort.rs +++ b/src/libcore/slice/sort.rs @@ -6,9 +6,9 @@ //! Unstable sorting is compatible with libcore because it doesn't allocate memory, unlike our //! stable sorting implementation. -use cmp; -use mem::{self, MaybeUninit}; -use ptr; +use crate::cmp; +use crate::mem::{self, MaybeUninit}; +use crate::ptr; /// When dropped, copies from `src` into `dest`. struct CopyOnDrop { diff --git a/src/libcore/str/lossy.rs b/src/libcore/str/lossy.rs index b3e8527c4ae0b..16dd4fe6135be 100644 --- a/src/libcore/str/lossy.rs +++ b/src/libcore/str/lossy.rs @@ -1,8 +1,7 @@ -use char; -use str as core_str; -use fmt; -use fmt::Write; -use mem; +use crate::char; +use crate::str as core_str; +use crate::fmt::{self, Write}; +use crate::mem; /// Lossy UTF-8 string. #[unstable(feature = "str_internals", issue = "0")] diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs index 8d28be621d647..f4bb887dd2943 100644 --- a/src/libcore/str/mod.rs +++ b/src/libcore/str/mod.rs @@ -7,14 +7,14 @@ use self::pattern::Pattern; use self::pattern::{Searcher, ReverseSearcher, DoubleEndedSearcher}; -use char; -use fmt::{self, Write}; -use iter::{Map, Cloned, FusedIterator, TrustedLen, TrustedRandomAccess, Filter}; -use iter::{Flatten, FlatMap, Chain}; -use slice::{self, SliceIndex, Split as SliceSplit}; -use mem; -use ops::Try; -use option; +use crate::char; +use crate::fmt::{self, Write}; +use crate::iter::{Map, Cloned, FusedIterator, TrustedLen, TrustedRandomAccess, Filter}; +use crate::iter::{Flatten, FlatMap, Chain}; +use crate::slice::{self, SliceIndex, Split as SliceSplit}; +use crate::mem; +use crate::ops::Try; +use crate::option; pub mod pattern; @@ -1557,9 +1557,9 @@ Section: Trait implementations */ mod traits { - use cmp::Ordering; - use ops; - use slice::{self, SliceIndex}; + use crate::cmp::Ordering; + use crate::ops; + use crate::slice::{self, SliceIndex}; /// Implements ordering of strings. /// diff --git a/src/libcore/str/pattern.rs b/src/libcore/str/pattern.rs index 2571780ad0bab..5dd4aec5e5a57 100644 --- a/src/libcore/str/pattern.rs +++ b/src/libcore/str/pattern.rs @@ -7,10 +7,10 @@ reason = "API not fully fleshed out and ready to be stabilized", issue = "27721")] -use cmp; -use fmt; -use slice::memchr; -use usize; +use crate::cmp; +use crate::fmt; +use crate::slice::memchr; +use crate::usize; // Pattern diff --git a/src/libcore/sync/atomic.rs b/src/libcore/sync/atomic.rs index 26b59969e18af..7ae91b3049814 100644 --- a/src/libcore/sync/atomic.rs +++ b/src/libcore/sync/atomic.rs @@ -118,11 +118,11 @@ use self::Ordering::*; -use intrinsics; -use cell::UnsafeCell; -use fmt; +use crate::intrinsics; +use crate::cell::UnsafeCell; +use crate::fmt; -use hint::spin_loop; +use crate::hint::spin_loop; /// Signals the processor that it is entering a busy-wait spin-loop. /// @@ -195,7 +195,7 @@ pub struct AtomicPtr { impl Default for AtomicPtr { /// Creates a null `AtomicPtr`. fn default() -> AtomicPtr { - AtomicPtr::new(::ptr::null_mut()) + AtomicPtr::new(crate::ptr::null_mut()) } } diff --git a/src/libcore/task/poll.rs b/src/libcore/task/poll.rs index c811f96ace3ba..ecf03afb88e2a 100644 --- a/src/libcore/task/poll.rs +++ b/src/libcore/task/poll.rs @@ -2,8 +2,8 @@ reason = "futures in libcore are unstable", issue = "50547")] -use ops::Try; -use result::Result; +use crate::ops::Try; +use crate::result::Result; /// Indicates whether a value is available or if the current task has been /// scheduled to receive a wakeup instead. diff --git a/src/libcore/task/wake.rs b/src/libcore/task/wake.rs index 006cbbb6ce6bd..1d3140070f351 100644 --- a/src/libcore/task/wake.rs +++ b/src/libcore/task/wake.rs @@ -2,8 +2,8 @@ reason = "futures in libcore are unstable", issue = "50547")] -use fmt; -use marker::{PhantomData, Unpin}; +use crate::fmt; +use crate::marker::{PhantomData, Unpin}; /// A `RawWaker` allows the implementor of a task executor to create a [`Waker`] /// which provides customized wakeup behavior. diff --git a/src/libcore/tests/lib.rs b/src/libcore/tests/lib.rs index 392a0ffabe3d6..fcdeb57f482a9 100644 --- a/src/libcore/tests/lib.rs +++ b/src/libcore/tests/lib.rs @@ -35,7 +35,6 @@ extern crate core; extern crate test; -extern crate rand; mod any; mod array; diff --git a/src/libcore/tests/num/int_macros.rs b/src/libcore/tests/num/int_macros.rs index 4881f79ec248a..92409465d7f2a 100644 --- a/src/libcore/tests/num/int_macros.rs +++ b/src/libcore/tests/num/int_macros.rs @@ -6,7 +6,7 @@ mod tests { use core::ops::{Shl, Shr, Not, BitXor, BitAnd, BitOr}; use core::mem; - use num; + use crate::num; #[test] fn test_overflows() { diff --git a/src/libcore/tests/num/uint_macros.rs b/src/libcore/tests/num/uint_macros.rs index 6e81542b6ec88..04ed14f3d0897 100644 --- a/src/libcore/tests/num/uint_macros.rs +++ b/src/libcore/tests/num/uint_macros.rs @@ -2,11 +2,12 @@ macro_rules! uint_module { ($T:ident, $T_i:ident) => ( #[cfg(test)] mod tests { use core::$T_i::*; - use num; use core::ops::{BitOr, BitAnd, BitXor, Shl, Shr, Not}; use std::str::FromStr; use std::mem; + use crate::num; + #[test] fn test_overflows() { assert!(MAX > 0); diff --git a/src/libcore/time.rs b/src/libcore/time.rs index ae6d8078fd236..9bb187e7de9f6 100644 --- a/src/libcore/time.rs +++ b/src/libcore/time.rs @@ -12,9 +12,9 @@ //! assert_eq!(Duration::new(5, 0), Duration::from_secs(5)); //! ``` -use {fmt, u64}; -use iter::Sum; -use ops::{Add, Sub, Mul, Div, AddAssign, SubAssign, MulAssign, DivAssign}; +use crate::{fmt, u64}; +use crate::iter::Sum; +use crate::ops::{Add, Sub, Mul, Div, AddAssign, SubAssign, MulAssign, DivAssign}; const NANOS_PER_SEC: u32 = 1_000_000_000; const NANOS_PER_MILLI: u32 = 1_000_000; @@ -921,7 +921,7 @@ impl fmt::Debug for Duration { // Determine the end of the buffer: if precision is set, we just // use as many digits from the buffer (capped to 9). If it isn't // set, we only use all digits up to the last non-zero one. - let end = f.precision().map(|p| ::cmp::min(p, 9)).unwrap_or(pos); + let end = f.precision().map(|p| crate::cmp::min(p, 9)).unwrap_or(pos); // If we haven't emitted a single fractional digit and the precision // wasn't set to a non-zero value, we don't print the decimal point. @@ -931,7 +931,7 @@ impl fmt::Debug for Duration { // We are only writing ASCII digits into the buffer and it was // initialized with '0's, so it contains valid UTF8. let s = unsafe { - ::str::from_utf8_unchecked(&buf[..end]) + crate::str::from_utf8_unchecked(&buf[..end]) }; // If the user request a precision > 9, we pad '0's at the end. diff --git a/src/libcore/tuple.rs b/src/libcore/tuple.rs index a82666d8f70f8..f05780f4a6270 100644 --- a/src/libcore/tuple.rs +++ b/src/libcore/tuple.rs @@ -1,7 +1,7 @@ // See src/libstd/primitive_docs.rs for documentation. -use cmp::*; -use cmp::Ordering::*; +use crate::cmp::*; +use crate::cmp::Ordering::*; // macro for implementing n-ary tuple functions and operations macro_rules! tuple_impls { diff --git a/src/libcore/unicode/mod.rs b/src/libcore/unicode/mod.rs index 3b86246269f62..272727def61d6 100644 --- a/src/libcore/unicode/mod.rs +++ b/src/libcore/unicode/mod.rs @@ -8,13 +8,13 @@ pub(crate) mod version; // For use in liballoc, not re-exported in libstd. pub mod derived_property { - pub use unicode::tables::derived_property::{Case_Ignorable, Cased}; + pub use crate::unicode::tables::derived_property::{Case_Ignorable, Cased}; } pub mod conversions { - pub use unicode::tables::conversions::{to_lower, to_upper}; + pub use crate::unicode::tables::conversions::{to_lower, to_upper}; } // For use in libsyntax pub mod property { - pub use unicode::tables::property::Pattern_White_Space; + pub use crate::unicode::tables::property::Pattern_White_Space; } diff --git a/src/libcore/unicode/tables.rs b/src/libcore/unicode/tables.rs index edef4ca361e4f..758cdb0b7cfba 100644 --- a/src/libcore/unicode/tables.rs +++ b/src/libcore/unicode/tables.rs @@ -2,8 +2,8 @@ #![allow(missing_docs, non_upper_case_globals, non_snake_case)] -use unicode::version::UnicodeVersion; -use unicode::bool_trie::{BoolTrie, SmallBoolTrie}; +use crate::unicode::version::UnicodeVersion; +use crate::unicode::bool_trie::{BoolTrie, SmallBoolTrie}; /// The version of [Unicode](http://www.unicode.org/) that the Unicode parts of /// `char` and `str` methods are based on. diff --git a/src/libcore/unit.rs b/src/libcore/unit.rs index 540025d77bb4c..bf01ceb8b2d3e 100644 --- a/src/libcore/unit.rs +++ b/src/libcore/unit.rs @@ -1,4 +1,4 @@ -use iter::FromIterator; +use crate::iter::FromIterator; /// Collapses all unit items from an iterator into one. ///