Skip to content

Commit bfc8075

Browse files
committed
---
yaml --- r: 172770 b: refs/heads/try c: 629bcdd h: refs/heads/master v: v3
1 parent 46ba0c6 commit bfc8075

19 files changed

+63
-101
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 170c4399e614fe599c3d41306b3429ca8b3b68c6
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 5b3cd3900ceda838f5798c30ab96ceb41f962534
5-
refs/heads/try: 099b411e080d302ec0dc5f3aebe53d76c50acfc7
5+
refs/heads/try: 629bcdd873dbe5d84977609a1114e0c3613b96c4
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
88
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

branches/try/src/compiletest/header.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ pub struct TestProps {
4242
pub pretty_compare_only: bool,
4343
// Patterns which must not appear in the output of a cfail test.
4444
pub forbid_output: Vec<String>,
45+
// Ignore errors which originate from a command line span
46+
pub ignore_command_line: bool,
4547
}
4648

4749
// Load any test directives embedded in the file
@@ -60,6 +62,8 @@ pub fn load_props(testfile: &Path) -> TestProps {
6062
let mut pretty_mode = None;
6163
let mut pretty_compare_only = false;
6264
let mut forbid_output = Vec::new();
65+
let mut ignore_command_line = false;
66+
6367
iter_header(testfile, |ln| {
6468
match parse_error_pattern(ln) {
6569
Some(ep) => error_patterns.push(ep),
@@ -102,6 +106,10 @@ pub fn load_props(testfile: &Path) -> TestProps {
102106
pretty_compare_only = parse_pretty_compare_only(ln);
103107
}
104108

109+
if !ignore_command_line {
110+
ignore_command_line = parse_ignore_command_line(ln);
111+
}
112+
105113
match parse_aux_build(ln) {
106114
Some(ab) => { aux_builds.push(ab); }
107115
None => {}
@@ -140,6 +148,7 @@ pub fn load_props(testfile: &Path) -> TestProps {
140148
pretty_mode: pretty_mode.unwrap_or("normal".to_string()),
141149
pretty_compare_only: pretty_compare_only,
142150
forbid_output: forbid_output,
151+
ignore_command_line: ignore_command_line,
143152
}
144153
}
145154

@@ -291,6 +300,10 @@ fn parse_pretty_compare_only(line: &str) -> bool {
291300
parse_name_directive(line, "pretty-compare-only")
292301
}
293302

303+
fn parse_ignore_command_line(line: &str) -> bool {
304+
parse_name_directive(line, "ignore-command-line")
305+
}
306+
294307
fn parse_exec_env(line: &str) -> Option<(String, String)> {
295308
parse_name_value_directive(line, "exec-env").map(|nv| {
296309
// nv is either FOO or FOO=BAR

branches/try/src/compiletest/runtest.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ fn run_cfail_test(config: &Config, props: &TestProps, testfile: &Path) {
104104
if !props.error_patterns.is_empty() {
105105
fatal("both error pattern and expected errors specified");
106106
}
107-
check_expected_errors(expected_errors, testfile, &proc_res);
107+
check_expected_errors(props, expected_errors, testfile, &proc_res);
108108
} else {
109109
check_error_patterns(props, testfile, output_to_check.as_slice(), &proc_res);
110110
}
@@ -941,7 +941,8 @@ fn check_forbid_output(props: &TestProps,
941941
}
942942
}
943943

944-
fn check_expected_errors(expected_errors: Vec<errors::ExpectedError> ,
944+
fn check_expected_errors(props: &TestProps,
945+
expected_errors: Vec<errors::ExpectedError> ,
945946
testfile: &Path,
946947
proc_res: &ProcRes) {
947948

@@ -996,6 +997,11 @@ fn check_expected_errors(expected_errors: Vec<errors::ExpectedError> ,
996997
was_expected = true;
997998
}
998999

1000+
if line.starts_with("<command line option>") &&
1001+
props.ignore_command_line {
1002+
was_expected = true;
1003+
}
1004+
9991005
if !was_expected && is_compiler_error_or_warning(line) {
10001006
fatal_proc_rec(format!("unexpected compiler error or warning: '{}'",
10011007
line).as_slice(),

branches/try/src/doc/trpl/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ navigate through the menu on the left.
1111
## Basics
1212

1313
This section is a linear introduction to the basic syntax and semantics of
14-
Rust. It has individual sections on each part of Rust's syntax, and culminates
14+
Rust. It has individual sections on each part of Rust's syntax, and cumulates
1515
in a small project: a guessing game.
1616

1717
After reading "Basics," you will have a good foundation to learn more about
@@ -27,7 +27,7 @@ and will be able to understand most Rust code and write more complex programs.
2727

2828
## Advanced
2929

30-
In a similar fashion to "Intermediate," this section is full of individual,
30+
In a similar fashion to "Intermediate," this setion is full of individual,
3131
deep-dive chapters, which stand alone and can be read in any order. These
3232
chapters focus on the most complex features, as well as some things that
3333
are only available in upcoming versions of Rust.

branches/try/src/doc/trpl/advanced.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
% Advanced
22

3-
In a similar fashion to "Intermediate," this section is full of individual,
3+
In a similar fashion to "Intermediate," this setion is full of individual,
44
deep-dive chapters, which stand alone and can be read in any order. These
55
chapters focus on the most complex features, as well as some things that
66
are only available in upcoming versions of Rust.
Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
% Conclusion
22

33
We covered a lot of ground here. When you've mastered everything in this Guide,
4-
you will have a firm grasp of Rust development. There's a whole lot more
5-
out there, though, we've just covered the surface. There's tons of topics that
6-
you can dig deeper into, e.g. by reading the API documentation of the
7-
[standard library](http://doc.rust-lang.org/std/), by discovering solutions for
8-
common problems on [Rust by Example](http://rustbyexample.com/), or by browsing
9-
crates written by the community on [crates.io](https://crates.io/).
4+
you will have a firm grasp of basic Rust development. There's a whole lot more
5+
out there, we've just covered the surface. There's tons of topics that you can
6+
dig deeper into, and we've built specialized guides for many of them. To learn
7+
more, dig into the [full documentation
8+
index](index.html).
109

1110
Happy hacking!

branches/try/src/doc/trpl/hello-cargo.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Rust projects, and so it is assumed that Rust projects will use Cargo from the
77
beginning.
88

99
Cargo manages three things: building your code, downloading the dependencies
10-
your code needs, and building those dependencies. At first, your
10+
your code needs, and building the dependencies your code needs. At first, your
1111
program doesn't have any dependencies, so we'll only be using the first part of
1212
its functionality. Eventually, we'll add more. Since we started off by using
1313
Cargo, it'll be easy to add later.

branches/try/src/doc/trpl/ownership.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ Here are the three rules:
488488
parameter.
489489

490490
* If there is exactly one input lifetime, elided or not, that lifetime is
491-
assigned to all elided lifetimes in the return values of that function.
491+
assigned to all elided lifetimes in the return values of that function..
492492

493493
* If there are multiple input lifetimes, but one of them is `&self` or `&mut
494494
self`, the lifetime of `self` is assigned to all elided output lifetimes.

branches/try/src/doc/trpl/testing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ extern crate adder;
309309
310310
#[test]
311311
fn it_works() {
312-
assert_eq!(4, adder::add_two(2));
312+
assert_eq(4, adder::add_two(2));
313313
}
314314
```
315315

branches/try/src/libcollections/macros.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2014-2015 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
//
@@ -12,10 +12,6 @@
1212
#[macro_export]
1313
#[stable]
1414
macro_rules! vec {
15-
($x:expr; $y:expr) => ({
16-
let xs: $crate::boxed::Box<[_]> = $crate::boxed::Box::new([$x; $y]);
17-
$crate::slice::SliceExt::into_vec(xs)
18-
});
1915
($($x:expr),*) => ({
2016
let xs: $crate::boxed::Box<[_]> = $crate::boxed::Box::new([$($x),*]);
2117
$crate::slice::SliceExt::into_vec(xs)

branches/try/src/librustc_typeck/astconv.rs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -582,19 +582,6 @@ fn ast_path_to_trait_ref<'a,'tcx>(
582582

583583
let (regions, types, assoc_bindings) = match path.segments.last().unwrap().parameters {
584584
ast::AngleBracketedParameters(ref data) => {
585-
// For now, require that parenthetical notation be used
586-
// only with `Fn()` etc.
587-
if !this.tcx().sess.features.borrow().unboxed_closures &&
588-
this.tcx().lang_items.fn_trait_kind(trait_def_id).is_some()
589-
{
590-
this.tcx().sess.span_err(path.span,
591-
"angle-bracket notation is not stable when \
592-
used with the `Fn` family of traits, use parentheses");
593-
span_help!(this.tcx().sess, path.span,
594-
"add `#![feature(unboxed_closures)]` to \
595-
the crate attributes to enable");
596-
}
597-
598585
convert_angle_bracketed_parameters(this, &shifted_rscope, data)
599586
}
600587
ast::ParenthesizedParameters(ref data) => {

branches/try/src/libsyntax/diagnostic.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ pub use self::RenderSpan::*;
1313
pub use self::ColorConfig::*;
1414
use self::Destination::*;
1515

16-
use codemap::{COMMAND_LINE_SP, COMMAND_LINE_EXPN, Pos, Span};
16+
use codemap::{COMMAND_LINE_SP, Pos, Span};
1717
use codemap;
1818
use diagnostics;
1919

@@ -393,10 +393,7 @@ impl Emitter for EmitterWriter {
393393
fn emit(dst: &mut EmitterWriter, cm: &codemap::CodeMap, rsp: RenderSpan,
394394
msg: &str, code: Option<&str>, lvl: Level, custom: bool) -> io::IoResult<()> {
395395
let sp = rsp.span();
396-
397-
// We cannot check equality directly with COMMAND_LINE_SP
398-
// since PartialEq is manually implemented to ignore the ExpnId
399-
let ss = if sp.expn_id == COMMAND_LINE_EXPN {
396+
let ss = if sp == COMMAND_LINE_SP {
400397
"<command line option>".to_string()
401398
} else {
402399
cm.span_to_string(sp)

branches/try/src/test/bench/shootout-binarytrees.rs

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -44,26 +44,30 @@ use std::iter::range_step;
4444
use std::thread::Thread;
4545
use arena::TypedArena;
4646

47-
enum Tree<'a> {
48-
Nil,
49-
Node(&'a Tree<'a>, &'a Tree<'a>, int)
47+
struct Tree<'a> {
48+
l: Option<&'a Tree<'a>>,
49+
r: Option<&'a Tree<'a>>,
50+
i: i32
5051
}
5152

52-
fn item_check(t: &Tree) -> int {
53+
fn item_check(t: &Option<&Tree>) -> i32 {
5354
match *t {
54-
Tree::Nil => 0,
55-
Tree::Node(l, r, i) => i + item_check(l) - item_check(r)
55+
None => 0,
56+
Some(&Tree { ref l, ref r, i }) => i + item_check(l) - item_check(r)
5657
}
5758
}
5859

59-
fn bottom_up_tree<'r>(arena: &'r TypedArena<Tree<'r>>, item: int, depth: int)
60-
-> &'r Tree<'r> {
60+
fn bottom_up_tree<'r>(arena: &'r TypedArena<Tree<'r>>, item: i32, depth: i32)
61+
-> Option<&'r Tree<'r>> {
6162
if depth > 0 {
62-
arena.alloc(Tree::Node(bottom_up_tree(arena, 2 * item - 1, depth - 1),
63-
bottom_up_tree(arena, 2 * item, depth - 1),
64-
item))
63+
let t: &Tree<'r> = arena.alloc(Tree {
64+
l: bottom_up_tree(arena, 2 * item - 1, depth - 1),
65+
r: bottom_up_tree(arena, 2 * item, depth - 1),
66+
i: item
67+
});
68+
Some(t)
6569
} else {
66-
arena.alloc(Tree::Nil)
70+
None
6771
}
6872
}
6973

@@ -86,22 +90,22 @@ fn main() {
8690
let tree = bottom_up_tree(&arena, 0, depth);
8791

8892
println!("stretch tree of depth {}\t check: {}",
89-
depth, item_check(tree));
93+
depth, item_check(&tree));
9094
}
9195

9296
let long_lived_arena = TypedArena::new();
9397
let long_lived_tree = bottom_up_tree(&long_lived_arena, 0, max_depth);
9498

9599
let messages = range_step(min_depth, max_depth + 1, 2).map(|depth| {
96100
use std::num::Int;
97-
let iterations = 2i.pow((max_depth - depth + min_depth) as uint);
101+
let iterations = 2.pow((max_depth - depth + min_depth) as usize);
98102
Thread::scoped(move|| {
99103
let mut chk = 0;
100-
for i in range(1, iterations + 1) {
104+
for i in 1 .. iterations + 1 {
101105
let arena = TypedArena::new();
102106
let a = bottom_up_tree(&arena, i, depth);
103107
let b = bottom_up_tree(&arena, -i, depth);
104-
chk += item_check(a) + item_check(b);
108+
chk += item_check(&a) + item_check(&b);
105109
}
106110
format!("{}\t trees of depth {}\t check: {}",
107111
iterations * 2, depth, chk)
@@ -113,5 +117,5 @@ fn main() {
113117
}
114118

115119
println!("long lived tree of depth {}\t check: {}",
116-
max_depth, item_check(long_lived_tree));
120+
max_depth, item_check(&long_lived_tree));
117121
}

branches/try/src/test/compile-fail/feature-gate-unboxed-closures-manual-impls.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@
1111
#![allow(dead_code)]
1212

1313
struct Foo;
14-
impl Fn() for Foo { //~ ERROR manual implementations of `Fn` are experimental
14+
impl Fn<(), ()> for Foo { //~ ERROR manual implementations of `Fn` are experimental
1515
extern "rust-call" fn call(&self, args: ()) -> () {}
1616
}
1717
struct Bar;
18-
impl FnMut() for Bar { //~ ERROR manual implementations of `FnMut` are experimental
18+
impl FnMut<(), ()> for Bar { //~ ERROR manual implementations of `FnMut` are experimental
1919
extern "rust-call" fn call_mut(&self, args: ()) -> () {}
2020
}
2121
struct Baz;
22-
impl FnOnce() for Baz { //~ ERROR manual implementations of `FnOnce` are experimental
22+
impl FnOnce<(), ()> for Baz { //~ ERROR manual implementations of `FnOnce` are experimental
2323
extern "rust-call" fn call_once(&self, args: ()) -> () {}
2424
}
2525

branches/try/src/test/compile-fail/feature-gate-unboxed-closures-method-calls.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
#![allow(dead_code)]
1212

13-
fn foo<F: Fn()>(mut f: F) {
13+
fn foo<F: Fn<(), ()>>(mut f: F) {
1414
f.call(()); //~ ERROR explicit use of unboxed closure method `call`
1515
f.call_mut(()); //~ ERROR explicit use of unboxed closure method `call_mut`
1616
f.call_once(()); //~ ERROR explicit use of unboxed closure method `call_once`

branches/try/src/test/compile-fail/feature-gate-unboxed-closures-ufcs-calls.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
#![allow(dead_code)]
1212

13-
fn foo<F: Fn()>(mut f: F, mut g: F) {
13+
fn foo<F: Fn<(), ()>>(mut f: F, mut g: F) {
1414
Fn::call(&g, ()); //~ ERROR explicit use of unboxed closure method `call`
1515
FnMut::call_mut(&mut g, ()); //~ ERROR explicit use of unboxed closure method `call_mut`
1616
FnOnce::call_once(g, ()); //~ ERROR explicit use of unboxed closure method `call_once`

branches/try/src/test/compile-fail/recursion.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
//~^^^^^^^^^^ ERROR overflow
11+
// ignore-command-line: See https://github.com/rust-lang/rust/issues/20747
1212
//
1313
// We also get a second error message at the top of file (dummy
1414
// span). This is not helpful, but also kind of annoying to prevent,

branches/try/src/test/compile-fail/unboxed-closure-sugar-not-used-on-fn.rs

Lines changed: 0 additions & 23 deletions
This file was deleted.

branches/try/src/test/run-pass/vec-macro-repeat.rs

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)