Skip to content

Commit

Permalink
Register snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
brson committed Sep 11, 2014
1 parent 9f6d27c commit 38e7e4b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 64 deletions.
4 changes: 1 addition & 3 deletions src/etc/get-snapshot.py
Expand Up @@ -52,9 +52,7 @@ def unpack_snapshot(triple, dl_path):
if len(sys.argv) == 3:
dl_path = sys.argv[2]
else:
# There are no 64-bit Windows snapshots yet, so we'll use 32-bit ones instead, for now
snap_triple = triple if triple != "x86_64-w64-mingw32" else "i686-w64-mingw32"
snap = determine_curr_snapshot(snap_triple)
snap = determine_curr_snapshot(triple)
dl = os.path.join(download_dir_base, snap)
url = download_url_base + "/" + snap
print("determined most recent snapshot: " + snap)
Expand Down
61 changes: 0 additions & 61 deletions src/libcore/fmt/mod.rs
Expand Up @@ -113,7 +113,6 @@ impl<'a> Arguments<'a> {
/// Arguments structure. The compiler inserts an `unsafe` block to call this,
/// which is valid because the compiler performs all necessary validation to
/// ensure that the resulting call to format/write would be safe.
#[cfg(not(stage0))]
#[doc(hidden)] #[inline]
pub unsafe fn new<'a>(pieces: &'static [&'static str],
args: &'a [Argument<'a>]) -> Arguments<'a> {
Expand All @@ -127,7 +126,6 @@ impl<'a> Arguments<'a> {
/// This function is used to specify nonstandard formatting parameters.
/// The `pieces` array must be at least as long as `fmt` to construct
/// a valid Arguments structure.
#[cfg(not(stage0))]
#[doc(hidden)] #[inline]
pub unsafe fn with_placeholders<'a>(pieces: &'static [&'static str],
fmt: &'static [rt::Argument<'static>],
Expand All @@ -138,13 +136,6 @@ impl<'a> Arguments<'a> {
args: args
}
}

#[cfg(stage0)]
#[doc(hidden)] #[inline]
pub unsafe fn new<'a>(fmt: &'static [rt::Piece<'static>],
args: &'a [Argument<'a>]) -> Arguments<'a> {
Arguments{ fmt: mem::transmute(fmt), args: args }
}
}

/// This structure represents a safely precompiled version of a format string
Expand All @@ -156,7 +147,6 @@ impl<'a> Arguments<'a> {
/// and pass it to a function or closure, passed as the first argument. The
/// macro validates the format string at compile-time so usage of the `write`
/// and `format` functions can be safely performed.
#[cfg(not(stage0))]
pub struct Arguments<'a> {
// Format string pieces to print.
pieces: &'a [&'a str],
Expand All @@ -169,12 +159,6 @@ pub struct Arguments<'a> {
args: &'a [Argument<'a>],
}

#[cfg(stage0)] #[doc(hidden)]
pub struct Arguments<'a> {
fmt: &'a [rt::Piece<'a>],
args: &'a [Argument<'a>],
}

impl<'a> Show for Arguments<'a> {
fn fmt(&self, fmt: &mut Formatter) -> Result {
write(fmt.buf, self)
Expand Down Expand Up @@ -296,7 +280,6 @@ uniform_fn_call_workaround! {
secret_upper_exp, UpperExp;
}

#[cfg(not(stage0))]
static DEFAULT_ARGUMENT: rt::Argument<'static> = rt::Argument {
position: rt::ArgumentNext,
format: rt::FormatSpec {
Expand All @@ -316,7 +299,6 @@ static DEFAULT_ARGUMENT: rt::Argument<'static> = rt::Argument {
///
/// * output - the buffer to write output to
/// * args - the precompiled arguments generated by `format_args!`
#[cfg(not(stage0))]
pub fn write(output: &mut FormatWriter, args: &Arguments) -> Result {
let mut formatter = Formatter {
flags: 0,
Expand Down Expand Up @@ -360,30 +342,11 @@ pub fn write(output: &mut FormatWriter, args: &Arguments) -> Result {
Ok(())
}

#[cfg(stage0)] #[doc(hidden)]
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(),
};
for piece in args.fmt.iter() {
try!(formatter.run(piece));
}
Ok(())
}

impl<'a> Formatter<'a> {

// First up is the collection of functions used to execute a format string
// at runtime. This consumes all of the compile-time statics generated by
// the format! syntax extension.
#[cfg(not(stage0))]
fn run(&mut self, arg: &rt::Argument) -> Result {
// Fill in the format parameters into the formatter
self.fill = arg.format.fill;
Expand All @@ -402,30 +365,6 @@ impl<'a> Formatter<'a> {
(value.formatter)(value.value, self)
}

#[cfg(stage0)] #[doc(hidden)]
fn run(&mut self, piece: &rt::Piece) -> Result {
match *piece {
rt::String(s) => self.buf.write(s.as_bytes()),
rt::Argument(ref arg) => {
// Fill in the format parameters into the formatter
self.fill = arg.format.fill;
self.align = arg.format.align;
self.flags = arg.format.flags;
self.width = self.getcount(&arg.format.width);
self.precision = self.getcount(&arg.format.precision);

// Extract the correct argument
let value = match arg.position {
rt::ArgumentNext => { *self.curarg.next().unwrap() }
rt::ArgumentIs(i) => self.args[i],
};

// Then actually do some printing
(value.formatter)(value.value, self)
}
}
}

fn getcount(&mut self, cnt: &rt::Count) -> Option<uint> {
match *cnt {
rt::CountIs(n) => { Some(n) }
Expand Down
9 changes: 9 additions & 0 deletions src/snapshots.txt
@@ -1,3 +1,12 @@
S 2014-09-10 6faa4f3
winnt-x86_64 939eb546469cb936441cff3b6f2478f562f77c46
winnt-i386 cfe4f8b519bb9d62588f9310a8f94bc919d5423b
linux-x86_64 72c92895fa9a1dba7880073f2b2b5d0e3e1a2ab6
linux-i386 6f5464c9ab191d93bfea0894ca7c6f90c3506f2b
freebsd-x86_64 648f35800ba98f1121d418b6d0c13c63b7a8951b
macos-i386 545fc45a0071142714639c6be377e6d308c3a4e1
macos-x86_64 8b44fbbbd1ba519d2e83d0d5ce1f6053d3cab8c6

S 2014-09-05 67b97ab
freebsd-x86_64 5ed208394cb2a378ddfaa005b6298d2f142ad47f
linux-i386 d90866947bfa09738cf8540d17a8eedc70988fcc
Expand Down

5 comments on commit 38e7e4b

@bors
Copy link
Contributor

@bors bors commented on 38e7e4b Sep 12, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from alexcrichton
at brson@38e7e4b

@bors
Copy link
Contributor

@bors bors commented on 38e7e4b Sep 12, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging brson/rust/snaps = 38e7e4b into auto

@bors
Copy link
Contributor

@bors bors commented on 38e7e4b Sep 12, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

brson/rust/snaps = 38e7e4b merged ok, testing candidate = e9278c9

@bors
Copy link
Contributor

@bors bors commented on 38e7e4b Sep 12, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on 38e7e4b Sep 12, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = e9278c9

Please sign in to comment.