about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-01-06 08:41:45 -0800
committerbors <bors@rust-lang.org>2014-01-06 08:41:45 -0800
commit8b71b6415dd16dc694bc7d3b1a99d0116b6a0cee (patch)
tree36a072b3674753d32ee7f96e1e1c25e7993e4000
parentbae091e5171c90803e9c40fb01a76d1b0b6f4321 (diff)
parent2097570f4ca354d2f0d18c52659c472cda4fab08 (diff)
downloadrust-8b71b6415dd16dc694bc7d3b1a99d0116b6a0cee.tar.gz
rust-8b71b6415dd16dc694bc7d3b1a99d0116b6a0cee.zip
auto merge of #11333 : cmr/rust/triage2, r=alexcrichton
-rwxr-xr-xsrc/etc/get-snapshot.py34
-rw-r--r--src/etc/snapshot.py38
-rw-r--r--src/etc/tidy.py15
-rw-r--r--src/libextra/getopts.rs4
-rw-r--r--src/librustc/middle/check_match.rs1
-rw-r--r--src/libstd/ascii.rs1
-rw-r--r--src/libstd/io/net/udp.rs3
-rw-r--r--src/libstd/lib.rs11
-rw-r--r--src/libstd/rt/local.rs1
-rw-r--r--src/test/compile-fail/struct-pattern-match-useless.rs23
-rw-r--r--src/test/run-pass/reflect-visit-type.rs2
-rw-r--r--src/test/run-pass/struct-pattern-matching.rs6
12 files changed, 95 insertions, 44 deletions
diff --git a/src/etc/get-snapshot.py b/src/etc/get-snapshot.py
index 2e547dbbcd1..fb14deabf24 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 5ac035942bf..8aeee7e22eb 100644
--- a/src/etc/snapshot.py
+++ b/src/etc/snapshot.py
@@ -194,3 +194,41 @@ def make_snapshot(stage, triple):
     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 4815bc601f6..3364ddcb678 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 @@ try:
                 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 5debc999192..78baa4f7ec8 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 4688760d6c1..b9d2c320cce 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 974bc454c66..adc10c456e3 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 b4f79b285b7..8994f6b461a 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 1d24c2c66f8..492059ebb70 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 b4a6f06c2a4..37596b35015 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/test/compile-fail/struct-pattern-match-useless.rs b/src/test/compile-fail/struct-pattern-match-useless.rs
new file mode 100644
index 00000000000..b9c0be9276d
--- /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 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, 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 5acb072fd2d..de50bb3bfed 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 d2b038fab0e..6033554d0cb 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 { .. } => ()
+    }
 }