Merge remote-tracking branch 'rust-lang/master'

Conflicts:
	src/libcore/cmp.rs
	src/libcore/fmt/mod.rs
	src/libcore/iter.rs
	src/libcore/marker.rs
	src/libcore/num/f32.rs
	src/libcore/num/f64.rs
	src/libcore/result.rs
	src/libcore/str/mod.rs
	src/librustc/lint/builtin.rs
	src/librustc/lint/context.rs
	src/libstd/sync/mpsc/mod.rs
	src/libstd/sync/poison.rs
This commit is contained in:
Brian Anderson 2015-01-25 19:03:10 -08:00
commit d179ba3b8e
88 changed files with 5485 additions and 559 deletions

View file

@ -0,0 +1,22 @@
// Copyright 2015 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.
// error-pattern: requires `copy` lang_item
#![feature(lang_items, start)]
#![no_std]
#[lang = "sized"]
trait Sized {}
#[start]
fn main(_: int, _: *const *const u8) -> int {
0
}

View file

@ -0,0 +1,66 @@
// 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.
#![deny(unconditional_recursion)]
#![allow(dead_code)]
fn foo() { //~ ERROR function cannot return without recurring
foo(); //~ NOTE recursive call site
}
fn bar() {
if true {
bar()
}
}
fn baz() { //~ ERROR function cannot return without recurring
if true {
baz() //~ NOTE recursive call site
} else {
baz() //~ NOTE recursive call site
}
}
fn qux() {
loop {}
}
fn quz() -> bool { //~ ERROR function cannot return without recurring
if true {
while quz() {} //~ NOTE recursive call site
true
} else {
loop { quz(); } //~ NOTE recursive call site
}
}
trait Foo {
fn bar(&self) { //~ ERROR function cannot return without recurring
self.bar() //~ NOTE recursive call site
}
}
impl Foo for Box<Foo+'static> {
fn bar(&self) { //~ ERROR function cannot return without recurring
loop {
self.bar() //~ NOTE recursive call site
}
}
}
struct Baz;
impl Baz {
fn qux(&self) { //~ ERROR function cannot return without recurring
self.qux(); //~ NOTE recursive call site
}
}
fn main() {}

View file

@ -12,12 +12,12 @@ fn f<T>() {}
fn main() {
false == false == false;
//~^ ERROR: Chained comparison operators require parentheses
//~^ ERROR: chained comparison operators require parentheses
false == 0 < 2;
//~^ ERROR: Chained comparison operators require parentheses
//~^ ERROR: chained comparison operators require parentheses
f<X>();
//~^ ERROR: Chained comparison operators require parentheses
//~^^ HELP: use ::< instead of < if you meant to specify type arguments
//~^ ERROR: chained comparison operators require parentheses
//~^^ HELP: use `::<...>` instead of `<...>`
}

View file

@ -15,6 +15,6 @@ fn f<X>() {}
pub fn main() {
f<type>();
//~^ ERROR expected identifier, found keyword `type`
//~^^ ERROR: Chained comparison operators require parentheses
//~^^^ HELP: use ::< instead of < if you meant to specify type arguments
//~^^ ERROR: chained comparison
//~^^^ HELP: use `::<
}

View file

@ -36,6 +36,12 @@
// gdb-command:print void_droid_gdb->internals
// gdb-check:$6 = (isize *) 0x0
// gdb-command:print nested_non_zero_yep
// gdb-check:$7 = {RUST$ENCODED$ENUM$1$2$Nope = {10.5, {a = 10, b = 20, c = [...]}}}
// gdb-command:print nested_non_zero_nope
// gdb-check:$8 = {RUST$ENCODED$ENUM$1$2$Nope = {[...], {a = [...], b = [...], c = 0x0}}}
// gdb-command:continue
@ -67,6 +73,12 @@
// lldb-command:print none_str
// lldb-check:[...]$7 = None
// lldb-command:print nested_non_zero_yep
// lldb-check:[...]$8 = Yep(10.5, NestedNonZeroField { a: 10, b: 20, c: &[...] })
// lldb-command:print nested_non_zero_nope
// lldb-check:[...]$9 = Nope
#![omit_gdb_pretty_printer_section]
@ -102,6 +114,17 @@ struct NamedFieldsRepr<'a> {
internals: &'a isize
}
struct NestedNonZeroField<'a> {
a: u16,
b: u32,
c: &'a char,
}
enum NestedNonZero<'a> {
Yep(f64, NestedNonZeroField<'a>),
Nope
}
fn main() {
let some_str: Option<&'static str> = Some("abc");
@ -124,6 +147,17 @@ fn main() {
let void_droid = NamedFields::Void;
let void_droid_gdb: &NamedFieldsRepr = unsafe { std::mem::transmute(&NamedFields::Void) };
let x = 'x';
let nested_non_zero_yep = NestedNonZero::Yep(
10.5,
NestedNonZeroField {
a: 10,
b: 20,
c: &x
});
let nested_non_zero_nope = NestedNonZero::Nope;
zzz(); // #break
}

View file

@ -8,33 +8,54 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use std::io::{TempDir, Command, fs};
use std::slice::SliceExt;
use std::io::{Command, fs, USER_RWX};
use std::os;
use std::path::BytesContainer;
use std::rand::random;
fn main() {
// If we're the child, make sure we were invoked correctly
let args = os::args();
if args.len() > 1 && args[1].as_slice() == "child" {
return assert_eq!(args[0].as_slice(), "mytest");
// FIXME: This should check the whole `args[0]` instead of just
// checking that it ends_with the executable name. This
// is needed because of Windows, which has a different behavior.
// See #15149 for more info.
return assert!(args[0].ends_with(&format!("mytest{}", os::consts::EXE_SUFFIX)[]));
}
test();
}
fn test() {
// If we're the parent, copy our own binary to a tempr directory, and then
// make it executable.
let dir = TempDir::new("mytest").unwrap();
let me = os::self_exe_name().unwrap();
let dest = dir.path().join(format!("mytest{}", os::consts::EXE_SUFFIX));
fs::copy(&me, &dest).unwrap();
// If we're the parent, copy our own binary to a new directory.
let my_path = os::self_exe_name().unwrap();
let my_dir = my_path.dir_path();
// Append the temp directory to our own PATH.
let random_u32: u32 = random();
let child_dir = Path::new(my_dir.join(format!("issue-15149-child-{}",
random_u32)));
fs::mkdir(&child_dir, USER_RWX).unwrap();
let child_path = child_dir.join(format!("mytest{}",
os::consts::EXE_SUFFIX));
fs::copy(&my_path, &child_path).unwrap();
// Append the new directory to our own PATH.
let mut path = os::split_paths(os::getenv("PATH").unwrap_or(String::new()));
path.push(dir.path().clone());
path.push(child_dir.clone());
let path = os::join_paths(path.as_slice()).unwrap();
Command::new("mytest").env("PATH", path.as_slice())
.arg("child")
.spawn().unwrap();
let child_output = Command::new("mytest").env("PATH", path.as_slice())
.arg("child")
.output().unwrap();
assert!(child_output.status.success(),
format!("child assertion failed\n child stdout:\n {}\n child stderr:\n {}",
child_output.output.container_as_str().unwrap(),
child_output.error.container_as_str().unwrap()));
fs::rmdir_recursive(&child_dir).unwrap();
}

View file

@ -0,0 +1,20 @@
// Copyright 2015 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.
// compile-flags: --test
// no-pretty-expanded
extern crate test;
#[bench]
fn bench_explicit_return_type(_: &mut ::test::Bencher) -> () {}
#[test]
fn test_explicit_return_type() -> () {}