diff --git a/src/etc/get-snapshot.py b/src/etc/get-snapshot.py index 2e547dbbcd185..fb14deabf241b 100755 --- a/src/etc/get-snapshot.py +++ b/src/etc/get-snapshot.py @@ -32,40 +32,6 @@ def unpack_snapshot(triple, dl_path): tar.close() shutil.rmtree(download_unpack_base) -def determine_curr_snapshot(triple): - i = 0 - platform = get_platform(triple) - - found_file = False - found_snap = False - hsh = None - date = None - rev = None - - f = open(snapshotfile) - for line in f.readlines(): - i += 1 - parsed = parse_line(i, line) - if (not parsed): continue - - if found_snap and parsed["type"] == "file": - if parsed["platform"] == platform: - hsh = parsed["hash"] - found_file = True - break; - elif parsed["type"] == "snapshot": - date = parsed["date"] - rev = parsed["rev"] - found_snap = True - - if not found_snap: - raise Exception("no snapshot entries in file") - - if not found_file: - raise Exception("no snapshot file found for platform %s, rev %s" % - (platform, rev)) - - return full_snapshot_name(date, rev, platform, hsh) # Main diff --git a/src/etc/snapshot.py b/src/etc/snapshot.py index 5ac035942bffd..8aeee7e22ebe4 100644 --- a/src/etc/snapshot.py +++ b/src/etc/snapshot.py @@ -194,3 +194,41 @@ def in_tar_name(fn): shutil.move(file0, file1) return file1 + +def determine_curr_snapshot_info(triple): + i = 0 + platform = get_platform(triple) + + found_file = False + found_snap = False + hsh = None + date = None + rev = None + + f = open(snapshotfile) + for line in f.readlines(): + i += 1 + parsed = parse_line(i, line) + if (not parsed): continue + + if found_snap and parsed["type"] == "file": + if parsed["platform"] == platform: + hsh = parsed["hash"] + found_file = True + break; + elif parsed["type"] == "snapshot": + date = parsed["date"] + rev = parsed["rev"] + found_snap = True + + if not found_snap: + raise Exception("no snapshot entries in file") + + if not found_file: + raise Exception("no snapshot file found for platform %s, rev %s" % + (platform, rev)) + + return (date, rev, platform, hsh) + +def determine_curr_snapshot(triple): + return full_snapshot_name(*determine_curr_snapshot_info(triple)) diff --git a/src/etc/tidy.py b/src/etc/tidy.py index 4815bc601f69a..3364ddcb67807 100644 --- a/src/etc/tidy.py +++ b/src/etc/tidy.py @@ -3,6 +3,7 @@ import sys, fileinput, subprocess, re from licenseck import * +import snapshot err=0 cols=100 @@ -51,7 +52,19 @@ def do_license_check(name, contents): report_err("TODO is deprecated; use FIXME") match = re.match(r'^.*//\s*(NOTE.*)$', line) if match: - report_warn(match.group(1)) + m = match.group(1) + if "snap" in m.lower(): + report_warn(match.group(1)) + match = re.match(r'^.*//\s*SNAP\s+(\w+)', line) + if match: + hsh = match.group(1) + a, b, c, phash = snapshot.determine_curr_snapshot_info() + if not phash.startswith(hsh): + report_err("Snapshot out of date: " + line) + else: + if "SNAP" in line: + report_warn("Unmatched SNAP line: " + line) + if (line.find('\t') != -1 and fileinput.filename().find("Makefile") == -1): report_err("tab character") diff --git a/src/libextra/getopts.rs b/src/libextra/getopts.rs index 5debc9991928e..78baa4f7ec8bf 100644 --- a/src/libextra/getopts.rs +++ b/src/libextra/getopts.rs @@ -1522,6 +1522,9 @@ mod tests { optmulti("l") ]; + // short and verbose should always be in the same order. if they + // aren't the test will fail (and in mysterious ways) + let verbose = ~[ groups::reqopt("b", "banana", "Desc", "VAL"), groups::optopt("a", "apple", "Desc", "VAL"), @@ -1533,7 +1536,6 @@ mod tests { let sample_args = ~[~"--kiwi", ~"15", ~"--apple", ~"1", ~"k", ~"-p", ~"16", ~"l", ~"35"]; - // FIXME #4681: sort options here? assert!(getopts(sample_args, short) == groups::getopts(sample_args, verbose)); } diff --git a/src/librustc/middle/check_match.rs b/src/librustc/middle/check_match.rs index 079c275026887..5739225a5eae9 100644 --- a/src/librustc/middle/check_match.rs +++ b/src/librustc/middle/check_match.rs @@ -673,7 +673,6 @@ fn specialize(cx: &MatchCheckCtxt, DefFn(..) | DefStruct(..) => { - // FIXME #4731: Is this right? --pcw let new_args; match args { Some(args) => new_args = args, diff --git a/src/libstd/ascii.rs b/src/libstd/ascii.rs index 974bc454c6628..adc10c456e350 100644 --- a/src/libstd/ascii.rs +++ b/src/libstd/ascii.rs @@ -577,6 +577,7 @@ mod tests { #[test] #[should_fail] fn test_ascii_fail_char_slice() { 'λ'.to_ascii(); } + #[test] fn test_opt() { assert_eq!(65u8.to_ascii_opt(), Some(Ascii { chr: 65u8 })); assert_eq!(255u8.to_ascii_opt(), None); diff --git a/src/libstd/io/net/udp.rs b/src/libstd/io/net/udp.rs index b4f79b285b777..8994f6b461a7d 100644 --- a/src/libstd/io/net/udp.rs +++ b/src/libstd/io/net/udp.rs @@ -99,9 +99,8 @@ impl Writer for UdpStream { #[cfg(test)] mod test { use super::*; - use io::net::ip::{Ipv4Addr, SocketAddr}; + use io::net::ip::{SocketAddr}; use io::*; - use io::test::*; use prelude::*; iotest!(fn bind_error() { diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index 1d24c2c66f80a..492059ebb706a 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -163,6 +163,7 @@ pub mod sync; /* Runtime and platform support */ +#[unstable] pub mod libc; pub mod c_str; pub mod os; @@ -172,9 +173,8 @@ pub mod rand; pub mod run; pub mod cast; pub mod fmt; -pub mod repr; pub mod cleanup; -pub mod reflect; +#[deprecated] pub mod condition; pub mod logging; pub mod util; @@ -183,7 +183,13 @@ pub mod mem; /* Unsupported interfaces */ +#[unstable] +pub mod repr; +#[unstable] +pub mod reflect; + // Private APIs +#[unstable] pub mod unstable; @@ -195,6 +201,7 @@ mod cmath; // FIXME #7809: This shouldn't be pub, and it should be reexported under 'unstable' // but name resolution doesn't work without it being pub. +#[unstable] pub mod rt; // A curious inner-module that's not exported that contains the binding diff --git a/src/libstd/rt/local.rs b/src/libstd/rt/local.rs index b4a6f06c2a4c4..37596b3501542 100644 --- a/src/libstd/rt/local.rs +++ b/src/libstd/rt/local.rs @@ -54,7 +54,6 @@ mod test { use unstable::run_in_bare_thread; use super::*; use rt::task::Task; - use rt::local_ptr; #[test] fn thread_local_task_smoke_test() { diff --git a/src/libstd/rt/task.rs b/src/libstd/rt/task.rs index 3efa979e51515..725b3f4239c70 100644 --- a/src/libstd/rt/task.rs +++ b/src/libstd/rt/task.rs @@ -284,12 +284,21 @@ impl Task { /// Returns the stack bounds for this task in (lo, hi) format. The stack /// bounds may not be known for all tasks, so the return value may be - /// `None`. + /// `None`. In particular, using native threads, the first thread (the one + /// the OS spawns) has unknown bounds. pub fn stack_bounds(&self) -> Option<(uint, uint)> { self.imp.get_ref().stack_bounds() } } +pub fn stack_bounds() -> Option<(uint, uint)> { + //! Returns the stack bounds (lo, hi) for the running task. Is a + //! convenience function around Task::stack_bounds + + let mut local = Local::borrow(None::); + local.get().stack_bounds() +} + impl Drop for Task { fn drop(&mut self) { rtdebug!("called drop for a task: {}", borrow::to_uint(self)); diff --git a/src/test/compile-fail/struct-pattern-match-useless.rs b/src/test/compile-fail/struct-pattern-match-useless.rs new file mode 100644 index 0000000000000..b9c0be9276dab --- /dev/null +++ b/src/test/compile-fail/struct-pattern-match-useless.rs @@ -0,0 +1,23 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +struct Foo { + x: int, + y: int, +} + +pub fn main() { + let a = Foo { x: 1, y: 2 }; + match a { + Foo { x: x, y: y } => (), + Foo { .. } => () //~ ERROR unreachable pattern + } + +} diff --git a/src/test/run-pass/reflect-visit-type.rs b/src/test/run-pass/reflect-visit-type.rs index 5acb072fd2d37..de50bb3bfed9b 100644 --- a/src/test/run-pass/reflect-visit-type.rs +++ b/src/test/run-pass/reflect-visit-type.rs @@ -65,7 +65,7 @@ impl TyVisitor for MyVisitor { fn visit_estr_uniq(&mut self) -> bool { true } fn visit_estr_slice(&mut self) -> bool { true } fn visit_estr_fixed(&mut self, - _sz: uint, _sz: uint, + _sz: uint, _sz2: uint, _align: uint) -> bool { true } fn visit_box(&mut self, _mtbl: uint, _inner: *TyDesc) -> bool { true } diff --git a/src/test/run-pass/struct-pattern-matching.rs b/src/test/run-pass/struct-pattern-matching.rs index d2b038fab0e9d..6033554d0cbee 100644 --- a/src/test/run-pass/struct-pattern-matching.rs +++ b/src/test/run-pass/struct-pattern-matching.rs @@ -1,4 +1,4 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // @@ -18,4 +18,8 @@ pub fn main() { match a { Foo { x: x, y: y } => println!("yes, {}, {}", x, y) } + + match a { + Foo { .. } => () + } }