Skip to content

Register new snapshots #20353

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 1 commit into from
Dec 31, 2014
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
9 changes: 0 additions & 9 deletions src/libcollections/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -989,20 +989,11 @@ pub trait ToString {
}

impl<T: fmt::Show> ToString for T {
// NOTE(stage0): Remove cfg after a snapshot
#[cfg(not(stage0))]
fn to_string(&self) -> String {
let mut buf = Vec::<u8>::new();
let _ = fmt::write(&mut buf, format_args!("{}", *self));
String::from_utf8(buf).unwrap()
}
// NOTE(stage0): Remove method after a snapshot
#[cfg(stage0)]
fn to_string(&self) -> String {
let mut buf = Vec::<u8>::new();
let _ = format_args!(|args| fmt::write(&mut buf, args), "{}", self);
String::from_utf8(buf).unwrap()
}
}

impl IntoCow<'static, String, str> for String {
Expand Down
9 changes: 0 additions & 9 deletions src/libcore/fmt/float.rs
Original file line number Diff line number Diff line change
Expand Up @@ -325,18 +325,9 @@ pub fn float_to_str_bytes_common<T: Float, U, F>(

let mut filler = Filler { buf: &mut buf, end: &mut end };
match sign {
// NOTE(stage0): Remove cfg after a snapshot
#[cfg(not(stage0))]
SignNeg => {
let _ = fmt::write(&mut filler, format_args!("{:-}", exp));
}
// NOTE(stage0): Remove match arm after a snapshot
#[cfg(stage0)]
SignNeg => {
let _ = format_args!(|args| {
fmt::write(&mut filler, args)
}, "{:-}", exp);
}
}
}
}
Expand Down
85 changes: 0 additions & 85 deletions src/libcore/fmt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,21 +70,11 @@ pub trait FormatWriter {
/// This function will return an instance of `FormatError` on error.
fn write(&mut self, bytes: &[u8]) -> Result;

// NOTE(stage0): Remove cfg after a snapshot
#[cfg(not(stage0))]
/// Glue for usage of the `write!` macro with implementers of this trait.
///
/// This method should generally not be invoked manually, but rather through
/// the `write!` macro itself.
fn write_fmt(&mut self, args: Arguments) -> Result { write(self, args) }

// NOTE(stage0): Remove method after a snapshot
#[cfg(stage0)]
/// Glue for usage of the `write!` macro with implementers of this trait.
///
/// This method should generally not be invoked manually, but rather through
/// the `write!` macro itself.
fn write_fmt(&mut self, args: &Arguments) -> Result { write(self, args) }
}

/// A struct to represent both where to emit formatting strings to and how they
Expand Down Expand Up @@ -204,17 +194,9 @@ pub struct Arguments<'a> {
}

impl<'a> Show for Arguments<'a> {
// NOTE(stage0): Remove cfg after a snapshot
#[cfg(not(stage0))]
fn fmt(&self, fmt: &mut Formatter) -> Result {
write(fmt.buf, *self)
}

// NOTE(stage0): Remove method after a snapshot
#[cfg(stage0)]
fn fmt(&self, fmt: &mut Formatter) -> Result {
write(fmt.buf, self)
}
}

/// When a format is not otherwise specified, types are formatted by ascribing
Expand Down Expand Up @@ -287,8 +269,6 @@ static DEFAULT_ARGUMENT: rt::Argument<'static> = rt::Argument {
}
};

// NOTE(stage0): Remove cfg after a snapshot
#[cfg(not(stage0))]
/// The `write` function takes an output stream, a precompiled format string,
/// and a list of arguments. The arguments will be formatted according to the
/// specified format string into the output stream provided.
Expand Down Expand Up @@ -342,61 +322,6 @@ pub fn write(output: &mut FormatWriter, args: Arguments) -> Result {
Ok(())
}

// NOTE(stage0): Remove function after a snapshot
#[cfg(stage0)]
/// The `write` function takes an output stream, a precompiled format string,
/// and a list of arguments. The arguments will be formatted according to the
/// specified format string into the output stream provided.
///
/// # Arguments
///
/// * output - the buffer to write output to
/// * args - the precompiled arguments generated by `format_args!`
#[experimental = "libcore and I/O have yet to be reconciled, and this is an \
implementation detail which should not otherwise be exported"]
pub fn write(output: &mut FormatWriter, args: &Arguments) -> Result {
let mut formatter = Formatter {
flags: 0,
width: None,
precision: None,
buf: output,
align: rt::AlignUnknown,
fill: ' ',
args: args.args,
curarg: args.args.iter(),
};

let mut pieces = args.pieces.iter();

match args.fmt {
None => {
// We can use default formatting parameters for all arguments.
for _ in range(0, args.args.len()) {
try!(formatter.buf.write(pieces.next().unwrap().as_bytes()));
try!(formatter.run(&DEFAULT_ARGUMENT));
}
}
Some(fmt) => {
// Every spec has a corresponding argument that is preceded by
// a string piece.
for (arg, piece) in fmt.iter().zip(pieces.by_ref()) {
try!(formatter.buf.write(piece.as_bytes()));
try!(formatter.run(arg));
}
}
}

// There can be only one trailing string piece left.
match pieces.next() {
Some(piece) => {
try!(formatter.buf.write(piece.as_bytes()));
}
None => {}
}

Ok(())
}

impl<'a> Formatter<'a> {

// First up is the collection of functions used to execute a format string
Expand Down Expand Up @@ -603,22 +528,12 @@ impl<'a> Formatter<'a> {
self.buf.write(data)
}

// NOTE(stage0): Remove cfg after a snapshot
#[cfg(not(stage0))]
/// Writes some formatted information into this instance
#[unstable = "reconciling core and I/O may alter this definition"]
pub fn write_fmt(&mut self, fmt: Arguments) -> Result {
write(self.buf, fmt)
}

// NOTE(stage0): Remove method after a snapshot
#[cfg(stage0)]
/// Writes some formatted information into this instance
#[unstable = "reconciling core and I/O may alter this definition"]
pub fn write_fmt(&mut self, fmt: &Arguments) -> Result {
write(self.buf, fmt)
}

/// Flags for formatting (packed version of rt::Flag)
#[experimental = "return type may change and method was just created"]
pub fn flags(&self) -> uint { self.flags }
Expand Down
53 changes: 0 additions & 53 deletions src/libcore/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

#![macro_escape]

// NOTE(stage0): Remove cfg after a snapshot
#[cfg(not(stage0))]
/// Entry point of task panic, for details, see std::macros
#[macro_export]
macro_rules! panic {
Expand All @@ -32,44 +30,6 @@ macro_rules! panic {
});
}

// NOTE(stage0): Remove macro after a snapshot
#[cfg(stage0)]
/// Entry point of task panic, for details, see std::macros
#[macro_export]
macro_rules! panic {
() => (
panic!("{}", "explicit panic")
);
($msg:expr) => ({
static _MSG_FILE_LINE: (&'static str, &'static str, uint) = ($msg, file!(), line!());
::core::panicking::panic(&_MSG_FILE_LINE)
});
($fmt:expr, $($arg:tt)*) => ({
// a closure can't have return type !, so we need a full
// function to pass to format_args!, *and* we need the
// file and line numbers right here; so an inner bare fn
// is our only choice.
//
// LLVM doesn't tend to inline this, presumably because begin_unwind_fmt
// is #[cold] and #[inline(never)] and because this is flagged as cold
// as returning !. We really do want this to be inlined, however,
// because it's just a tiny wrapper. Small wins (156K to 149K in size)
// were seen when forcing this to be inlined, and that number just goes
// up with the number of calls to panic!()
//
// The leading _'s are to avoid dead code warnings if this is
// used inside a dead function. Just `#[allow(dead_code)]` is
// insufficient, since the user may have
// `#[forbid(dead_code)]` and which cannot be overridden.
#[inline(always)]
fn _run_fmt(fmt: &::std::fmt::Arguments) -> ! {
static _FILE_LINE: (&'static str, uint) = (file!(), line!());
::core::panicking::panic_fmt(fmt, &_FILE_LINE)
}
format_args!(_run_fmt, $fmt, $($arg)*)
});
}

/// Runtime assertion, for details see std::macros
#[macro_export]
macro_rules! assert {
Expand Down Expand Up @@ -119,25 +79,12 @@ macro_rules! try {
($e:expr) => (match $e { Ok(e) => e, Err(e) => return Err(e) })
}

// NOTE(stage0): Remove cfg after a snapshot
#[cfg(not(stage0))]
/// Writing a formatted string into a writer
#[macro_export]
macro_rules! write {
($dst:expr, $($arg:tt)*) => ((&mut *$dst).write_fmt(format_args!($($arg)*)))
}

// NOTE(stage0): Remove macro after a snapshot
#[cfg(stage0)]
/// Writing a formatted string into a writer
#[macro_export]
macro_rules! write {
($dst:expr, $($arg:tt)*) => ({
let dst = &mut *$dst;
format_args!(|args| { dst.write_fmt(args) }, $($arg)*)
})
}

/// Writing a formatted string plus a newline into a writer
#[macro_export]
macro_rules! writeln {
Expand Down
99 changes: 0 additions & 99 deletions src/libcore/ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,58 +292,6 @@ rem_impl! { uint u8 u16 u32 u64 int i8 i16 i32 i64 }
rem_float_impl! { f32, fmodf }
rem_float_impl! { f64, fmod }

/// The `Neg` trait is used to specify the functionality of unary `-`.
///
/// # Example
///
/// A trivial implementation of `Neg`. When `-Foo` happens, it ends up calling
/// `neg`, and therefore, `main` prints `Negating!`.
///
/// ```
/// #[deriving(Copy)]
/// struct Foo;
///
/// impl Neg<Foo> for Foo {
/// fn neg(&self) -> Foo {
/// println!("Negating!");
/// *self
/// }
/// }
///
/// fn main() {
/// -Foo;
/// }
/// ```
// NOTE(stage0): Remove trait after a snapshot
#[cfg(stage0)]
#[lang="neg"]
pub trait Neg<Result> for Sized? {
/// The method for the unary `-` operator
fn neg(&self) -> Result;
}

// NOTE(stage0): Remove macro after a snapshot
#[cfg(stage0)]
macro_rules! neg_impl {
($($t:ty)*) => ($(
impl Neg<$t> for $t {
#[inline]
fn neg(&self) -> $t { -*self }
}
)*)
}

// NOTE(stage0): Remove macro after a snapshot
#[cfg(stage0)]
macro_rules! neg_uint_impl {
($t:ty, $t_signed:ty) => {
impl Neg<$t> for $t {
#[inline]
fn neg(&self) -> $t { -(*self as $t_signed) as $t }
}
}
}

/// The `Neg` trait is used to specify the functionality of unary `-`.
///
/// # Example
Expand All @@ -367,14 +315,12 @@ macro_rules! neg_uint_impl {
/// -Foo;
/// }
/// ```
#[cfg(not(stage0))] // NOTE(stage0): Remove cfg after a snapshot
#[lang="neg"]
pub trait Neg<Result> {
/// The method for the unary `-` operator
fn neg(self) -> Result;
}

#[cfg(not(stage0))] // NOTE(stage0): Remove cfg after a snapshot
macro_rules! neg_impl {
($($t:ty)*) => ($(
impl Neg<$t> for $t {
Expand All @@ -384,7 +330,6 @@ macro_rules! neg_impl {
)*)
}

#[cfg(not(stage0))] // NOTE(stage0): Remove cfg after a snapshot
macro_rules! neg_uint_impl {
($t:ty, $t_signed:ty) => {
impl Neg<$t> for $t {
Expand All @@ -403,48 +348,6 @@ neg_uint_impl! { u32, i32 }
neg_uint_impl! { u64, i64 }


/// The `Not` trait is used to specify the functionality of unary `!`.
///
/// # Example
///
/// A trivial implementation of `Not`. When `!Foo` happens, it ends up calling
/// `not`, and therefore, `main` prints `Not-ing!`.
///
/// ```
/// #[deriving(Copy)]
/// struct Foo;
///
/// impl Not<Foo> for Foo {
/// fn not(&self) -> Foo {
/// println!("Not-ing!");
/// *self
/// }
/// }
///
/// fn main() {
/// !Foo;
/// }
/// ```
// NOTE(stage0): Remove macro after a snapshot
#[cfg(stage0)]
#[lang="not"]
pub trait Not<Result> for Sized? {
/// The method for the unary `!` operator
fn not(&self) -> Result;
}


// NOTE(stage0): Remove macro after a snapshot
#[cfg(stage0)]
macro_rules! not_impl {
($($t:ty)*) => ($(
impl Not<$t> for $t {
#[inline]
fn not(&self) -> $t { !*self }
}
)*)
}

/// The `Not` trait is used to specify the functionality of unary `!`.
///
/// # Example
Expand All @@ -468,14 +371,12 @@ macro_rules! not_impl {
/// !Foo;
/// }
/// ```
#[cfg(not(stage0))] // NOTE(stage0): Remove cfg after a snapshot
#[lang="not"]
pub trait Not<Result> {
/// The method for the unary `!` operator
fn not(self) -> Result;
}

#[cfg(not(stage0))] // NOTE(stage0): Remove cfg after a snapshot
macro_rules! not_impl {
($($t:ty)*) => ($(
impl Not<$t> for $t {
Expand Down
Loading