Skip to content

libcore => 2018 #58702

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/libcore/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ name = "core"
version = "0.0.0"
autotests = false
autobenches = false
edition = "2018"

[lib]
name = "core"
Expand Down
12 changes: 6 additions & 6 deletions src/libcore/alloc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions src/libcore/any.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@
#![stable(feature = "rust1", since = "1.0.0")]

use fmt;
use intrinsics;
use crate::fmt;
use crate::intrinsics;

///////////////////////////////////////////////////////////////////////////////
// Any trait
Expand Down
14 changes: 7 additions & 7 deletions src/libcore/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
///
Expand Down
6 changes: 3 additions & 3 deletions src/libcore/ascii.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
///
Expand Down
1 change: 0 additions & 1 deletion src/libcore/benches/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#![feature(flt2dec)]
#![feature(test)]

extern crate core;
extern crate test;

mod any;
Expand Down
12 changes: 6 additions & 6 deletions src/libcore/cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
///
Expand Down
9 changes: 5 additions & 4 deletions src/libcore/char/convert.rs
Original file line number Diff line number Diff line change
@@ -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`.
Expand Down
3 changes: 2 additions & 1 deletion src/libcore/char/decode.rs
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
9 changes: 5 additions & 4 deletions src/libcore/char/methods.rs
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
8 changes: 4 additions & 4 deletions src/libcore/char/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/libcore/clone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<T: Clone + ?Sized> { _field: ::marker::PhantomData<T> }
pub struct AssertParamIsClone<T: Clone + ?Sized> { _field: crate::marker::PhantomData<T> }
#[doc(hidden)]
#[allow(missing_debug_implementations)]
#[unstable(feature = "derive_clone_copy",
reason = "deriving hack, should not be public",
issue = "0")]
pub struct AssertParamIsCopy<T: Copy + ?Sized> { _field: ::marker::PhantomData<T> }
pub struct AssertParamIsCopy<T: Copy + ?Sized> { _field: crate::marker::PhantomData<T> }

/// Implementations of `Clone` for primitive types.
///
Expand Down
4 changes: 2 additions & 2 deletions src/libcore/cmp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ pub trait Eq: PartialEq<Self> {
#[unstable(feature = "derive_eq",
reason = "deriving hack, should not be public",
issue = "0")]
pub struct AssertParamIsEq<T: Eq + ?Sized> { _field: ::marker::PhantomData<T> }
pub struct AssertParamIsEq<T: Eq + ?Sized> { _field: crate::marker::PhantomData<T> }

/// An `Ordering` is the result of a comparison between two values.
///
Expand Down Expand Up @@ -884,7 +884,7 @@ pub fn max<T: Ord>(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)*) => ($(
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/convert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

#![stable(feature = "rust1", since = "1.0.0")]

use fmt;
use crate::fmt;

/// An identity function.
///
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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].
///
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/fmt/builders.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use fmt;
use crate::fmt;

struct PadAdapter<'a> {
buf: &'a mut (dyn fmt::Write + 'a),
Expand Down
6 changes: 3 additions & 3 deletions src/libcore/fmt/float.rs
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
16 changes: 8 additions & 8 deletions src/libcore/fmt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
14 changes: 7 additions & 7 deletions src/libcore/fmt/num.rs
Original file line number Diff line number Diff line change
@@ -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<Output=Self> + Rem<Output=Self> +
Expand Down Expand Up @@ -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 {
Expand Down
8 changes: 4 additions & 4 deletions src/libcore/future/future.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
///
Expand Down
9 changes: 5 additions & 4 deletions src/libcore/hash/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -541,8 +541,9 @@ impl<H> Eq for BuildHasherDefault<H> {}
//////////////////////////////////////////////////////////////////////////////

mod impls {
use mem;
use slice;
use crate::mem;
use crate::slice;

use super::*;

macro_rules! impl_write {
Expand Down
10 changes: 5 additions & 5 deletions src/libcore/hash/sip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
///
Expand Down Expand Up @@ -269,7 +269,7 @@ impl<S: Sip> super::Hasher for Hasher<S> {
#[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::<usize>())
crate::slice::from_raw_parts(&i as *const usize as *const u8, mem::size_of::<usize>())
};
self.short_write(bytes);
}
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/hint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
10 changes: 4 additions & 6 deletions src/libcore/internal_macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,24 +81,22 @@ 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;
)+) => {
$(
$( #[$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,
Expand All @@ -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]
Expand Down
Loading