Skip to content

Various fixes #11250

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

Closed
wants to merge 7 commits into from
Closed
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
34 changes: 0 additions & 34 deletions src/etc/get-snapshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
38 changes: 38 additions & 0 deletions src/etc/snapshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
15 changes: 14 additions & 1 deletion src/etc/tidy.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import sys, fileinput, subprocess, re
from licenseck import *
import snapshot

err=0
cols=100
Expand Down Expand Up @@ -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")
Expand Down
4 changes: 3 additions & 1 deletion src/libextra/getopts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand All @@ -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));
}
Expand Down
1 change: 0 additions & 1 deletion src/librustc/middle/check_match.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions src/libstd/ascii.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 1 addition & 2 deletions src/libstd/io/net/udp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
11 changes: 9 additions & 2 deletions src/libstd/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ pub mod sync;

/* Runtime and platform support */

#[unstable]
pub mod libc;
pub mod c_str;
pub mod os;
Expand All @@ -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;
Expand All @@ -183,7 +183,13 @@ pub mod mem;

/* Unsupported interfaces */

#[unstable]
pub mod repr;
#[unstable]
pub mod reflect;

// Private APIs
#[unstable]
pub mod unstable;


Expand All @@ -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
Expand Down
1 change: 0 additions & 1 deletion src/libstd/rt/local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
11 changes: 10 additions & 1 deletion src/libstd/rt/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<Task>);
local.get().stack_bounds()
}

impl Drop for Task {
fn drop(&mut self) {
rtdebug!("called drop for a task: {}", borrow::to_uint(self));
Expand Down
23 changes: 23 additions & 0 deletions src/test/compile-fail/struct-pattern-match-useless.rs
Original file line number Diff line number Diff line change
@@ -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
}

}
2 changes: 1 addition & 1 deletion src/test/run-pass/reflect-visit-type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
6 changes: 5 additions & 1 deletion src/test/run-pass/struct-pattern-matching.rs
Original file line number Diff line number Diff line change
@@ -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.
//
Expand All @@ -18,4 +18,8 @@ pub fn main() {
match a {
Foo { x: x, y: y } => println!("yes, {}, {}", x, y)
}

match a {
Foo { .. } => ()
}
}