Skip to content

Commit 8b71b64

Browse files
committed
auto merge of #11333 : cmr/rust/triage2, r=alexcrichton
2 parents bae091e + 2097570 commit 8b71b64

File tree

12 files changed

+95
-44
lines changed

12 files changed

+95
-44
lines changed

src/etc/get-snapshot.py

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -32,40 +32,6 @@ def unpack_snapshot(triple, dl_path):
3232
tar.close()
3333
shutil.rmtree(download_unpack_base)
3434

35-
def determine_curr_snapshot(triple):
36-
i = 0
37-
platform = get_platform(triple)
38-
39-
found_file = False
40-
found_snap = False
41-
hsh = None
42-
date = None
43-
rev = None
44-
45-
f = open(snapshotfile)
46-
for line in f.readlines():
47-
i += 1
48-
parsed = parse_line(i, line)
49-
if (not parsed): continue
50-
51-
if found_snap and parsed["type"] == "file":
52-
if parsed["platform"] == platform:
53-
hsh = parsed["hash"]
54-
found_file = True
55-
break;
56-
elif parsed["type"] == "snapshot":
57-
date = parsed["date"]
58-
rev = parsed["rev"]
59-
found_snap = True
60-
61-
if not found_snap:
62-
raise Exception("no snapshot entries in file")
63-
64-
if not found_file:
65-
raise Exception("no snapshot file found for platform %s, rev %s" %
66-
(platform, rev))
67-
68-
return full_snapshot_name(date, rev, platform, hsh)
6935

7036
# Main
7137

src/etc/snapshot.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,3 +194,41 @@ def in_tar_name(fn):
194194
shutil.move(file0, file1)
195195

196196
return file1
197+
198+
def determine_curr_snapshot_info(triple):
199+
i = 0
200+
platform = get_platform(triple)
201+
202+
found_file = False
203+
found_snap = False
204+
hsh = None
205+
date = None
206+
rev = None
207+
208+
f = open(snapshotfile)
209+
for line in f.readlines():
210+
i += 1
211+
parsed = parse_line(i, line)
212+
if (not parsed): continue
213+
214+
if found_snap and parsed["type"] == "file":
215+
if parsed["platform"] == platform:
216+
hsh = parsed["hash"]
217+
found_file = True
218+
break;
219+
elif parsed["type"] == "snapshot":
220+
date = parsed["date"]
221+
rev = parsed["rev"]
222+
found_snap = True
223+
224+
if not found_snap:
225+
raise Exception("no snapshot entries in file")
226+
227+
if not found_file:
228+
raise Exception("no snapshot file found for platform %s, rev %s" %
229+
(platform, rev))
230+
231+
return (date, rev, platform, hsh)
232+
233+
def determine_curr_snapshot(triple):
234+
return full_snapshot_name(*determine_curr_snapshot_info(triple))

src/etc/tidy.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
import sys, fileinput, subprocess, re
55
from licenseck import *
6+
import snapshot
67

78
err=0
89
cols=100
@@ -51,7 +52,19 @@ def do_license_check(name, contents):
5152
report_err("TODO is deprecated; use FIXME")
5253
match = re.match(r'^.*//\s*(NOTE.*)$', line)
5354
if match:
54-
report_warn(match.group(1))
55+
m = match.group(1)
56+
if "snap" in m.lower():
57+
report_warn(match.group(1))
58+
match = re.match(r'^.*//\s*SNAP\s+(\w+)', line)
59+
if match:
60+
hsh = match.group(1)
61+
a, b, c, phash = snapshot.determine_curr_snapshot_info()
62+
if not phash.startswith(hsh):
63+
report_err("Snapshot out of date: " + line)
64+
else:
65+
if "SNAP" in line:
66+
report_warn("Unmatched SNAP line: " + line)
67+
5568
if (line.find('\t') != -1 and
5669
fileinput.filename().find("Makefile") == -1):
5770
report_err("tab character")

src/libextra/getopts.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1522,6 +1522,9 @@ mod tests {
15221522
optmulti("l")
15231523
];
15241524
1525+
// short and verbose should always be in the same order. if they
1526+
// aren't the test will fail (and in mysterious ways)
1527+
15251528
let verbose = ~[
15261529
groups::reqopt("b", "banana", "Desc", "VAL"),
15271530
groups::optopt("a", "apple", "Desc", "VAL"),
@@ -1533,7 +1536,6 @@ mod tests {
15331536
let sample_args = ~[~"--kiwi", ~"15", ~"--apple", ~"1", ~"k",
15341537
~"-p", ~"16", ~"l", ~"35"];
15351538
1536-
// FIXME #4681: sort options here?
15371539
assert!(getopts(sample_args, short)
15381540
== groups::getopts(sample_args, verbose));
15391541
}

src/librustc/middle/check_match.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,6 @@ fn specialize(cx: &MatchCheckCtxt,
673673

674674
DefFn(..) |
675675
DefStruct(..) => {
676-
// FIXME #4731: Is this right? --pcw
677676
let new_args;
678677
match args {
679678
Some(args) => new_args = args,

src/libstd/ascii.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,7 @@ mod tests {
577577
#[test] #[should_fail]
578578
fn test_ascii_fail_char_slice() { 'λ'.to_ascii(); }
579579
580+
#[test]
580581
fn test_opt() {
581582
assert_eq!(65u8.to_ascii_opt(), Some(Ascii { chr: 65u8 }));
582583
assert_eq!(255u8.to_ascii_opt(), None);

src/libstd/io/net/udp.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,8 @@ impl Writer for UdpStream {
9999
#[cfg(test)]
100100
mod test {
101101
use super::*;
102-
use io::net::ip::{Ipv4Addr, SocketAddr};
102+
use io::net::ip::{SocketAddr};
103103
use io::*;
104-
use io::test::*;
105104
use prelude::*;
106105

107106
iotest!(fn bind_error() {

src/libstd/lib.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ pub mod sync;
163163

164164
/* Runtime and platform support */
165165

166+
#[unstable]
166167
pub mod libc;
167168
pub mod c_str;
168169
pub mod os;
@@ -172,9 +173,8 @@ pub mod rand;
172173
pub mod run;
173174
pub mod cast;
174175
pub mod fmt;
175-
pub mod repr;
176176
pub mod cleanup;
177-
pub mod reflect;
177+
#[deprecated]
178178
pub mod condition;
179179
pub mod logging;
180180
pub mod util;
@@ -183,7 +183,13 @@ pub mod mem;
183183

184184
/* Unsupported interfaces */
185185

186+
#[unstable]
187+
pub mod repr;
188+
#[unstable]
189+
pub mod reflect;
190+
186191
// Private APIs
192+
#[unstable]
187193
pub mod unstable;
188194

189195

@@ -195,6 +201,7 @@ mod cmath;
195201

196202
// FIXME #7809: This shouldn't be pub, and it should be reexported under 'unstable'
197203
// but name resolution doesn't work without it being pub.
204+
#[unstable]
198205
pub mod rt;
199206

200207
// A curious inner-module that's not exported that contains the binding

src/libstd/rt/local.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ mod test {
5454
use unstable::run_in_bare_thread;
5555
use super::*;
5656
use rt::task::Task;
57-
use rt::local_ptr;
5857

5958
#[test]
6059
fn thread_local_task_smoke_test() {
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
struct Foo {
12+
x: int,
13+
y: int,
14+
}
15+
16+
pub fn main() {
17+
let a = Foo { x: 1, y: 2 };
18+
match a {
19+
Foo { x: x, y: y } => (),
20+
Foo { .. } => () //~ ERROR unreachable pattern
21+
}
22+
23+
}

src/test/run-pass/reflect-visit-type.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ impl TyVisitor for MyVisitor {
6565
fn visit_estr_uniq(&mut self) -> bool { true }
6666
fn visit_estr_slice(&mut self) -> bool { true }
6767
fn visit_estr_fixed(&mut self,
68-
_sz: uint, _sz: uint,
68+
_sz: uint, _sz2: uint,
6969
_align: uint) -> bool { true }
7070

7171
fn visit_box(&mut self, _mtbl: uint, _inner: *TyDesc) -> bool { true }

src/test/run-pass/struct-pattern-matching.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -18,4 +18,8 @@ pub fn main() {
1818
match a {
1919
Foo { x: x, y: y } => println!("yes, {}, {}", x, y)
2020
}
21+
22+
match a {
23+
Foo { .. } => ()
24+
}
2125
}

0 commit comments

Comments
 (0)