Skip to content

Commit 0671ed7

Browse files
committed
---
yaml --- r: 98206 b: refs/heads/master c: 2952685 h: refs/heads/master v: v3
1 parent 3398acd commit 0671ed7

File tree

166 files changed

+6322
-4882
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

166 files changed

+6322
-4882
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: f125b71c0081acebbfcdd60bfe517d7e4dd388d4
2+
refs/heads/master: 2952685917cb17a3d849cb02d17ce71ccecfb855
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: b6400f998497c3958f40997a71756ead344a776d
55
refs/heads/try: c274a6888410ce3e357e014568b43310ed787d36

trunk/doc/complement-cheatsheet.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ let reader : File = File::open(&path).unwrap_or_else(on_error);
6262
Use the [`lines`](http://static.rust-lang.org/doc/master/std/io/trait.Buffer.html#method.lines) method on a [`BufferedReader`](http://static.rust-lang.org/doc/master/std/io/buffered/struct.BufferedReader.html).
6363

6464
~~~
65-
use std::io::buffered::BufferedReader;
66-
# use std::io::mem::MemReader;
65+
use std::io::BufferedReader;
66+
# use std::io::MemReader;
6767
6868
# let reader = MemReader::new(~[]);
6969

trunk/doc/guide-conditions.md

Lines changed: 20 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,11 @@ An example program that does this task reads like this:
4646
~~~~
4747
# #[allow(unused_imports)];
4848
# extern mod extra;
49-
use std::io::buffered::BufferedReader;
50-
use std::io::File;
49+
use std::io::{BufferedReader, File};
5150
# mod BufferedReader {
5251
# use std::io::File;
53-
# use std::io::mem::MemReader;
54-
# use std::io::buffered::BufferedReader;
52+
# use std::io::MemReader;
53+
# use std::io::BufferedReader;
5554
# static s : &'static [u8] = bytes!("1 2\n\
5655
# 34 56\n\
5756
# 789 123\n\
@@ -245,13 +244,12 @@ and trapping its exit status using `task::try`:
245244
~~~~
246245
# #[allow(unused_imports)];
247246
# extern mod extra;
248-
use std::io::buffered::BufferedReader;
249-
use std::io::File;
247+
use std::io::{BufferedReader, File};
250248
use std::task;
251249
# mod BufferedReader {
252250
# use std::io::File;
253-
# use std::io::mem::MemReader;
254-
# use std::io::buffered::BufferedReader;
251+
# use std::io::MemReader;
252+
# use std::io::BufferedReader;
255253
# static s : &'static [u8] = bytes!("1 2\n\
256254
# 34 56\n\
257255
# 789 123\n\
@@ -350,12 +348,11 @@ but similarly clear as the version that used `fail!` in the logic where the erro
350348
~~~~
351349
# #[allow(unused_imports)];
352350
# extern mod extra;
353-
use std::io::buffered::BufferedReader;
354-
use std::io::File;
351+
use std::io::{BufferedReader, File};
355352
# mod BufferedReader {
356353
# use std::io::File;
357-
# use std::io::mem::MemReader;
358-
# use std::io::buffered::BufferedReader;
354+
# use std::io::MemReader;
355+
# use std::io::BufferedReader;
359356
# static s : &'static [u8] = bytes!("1 2\n\
360357
# 34 56\n\
361358
# 789 123\n\
@@ -420,12 +417,11 @@ and replaces bad input lines with the pair `(-1,-1)`:
420417
~~~~
421418
# #[allow(unused_imports)];
422419
# extern mod extra;
423-
use std::io::buffered::BufferedReader;
424-
use std::io::File;
420+
use std::io::{BufferedReader, File};
425421
# mod BufferedReader {
426422
# use std::io::File;
427-
# use std::io::mem::MemReader;
428-
# use std::io::buffered::BufferedReader;
423+
# use std::io::MemReader;
424+
# use std::io::BufferedReader;
429425
# static s : &'static [u8] = bytes!("1 2\n\
430426
# 34 56\n\
431427
# 789 123\n\
@@ -496,12 +492,11 @@ Changing the condition's return type from `(int,int)` to `Option<(int,int)>` wil
496492
~~~~
497493
# #[allow(unused_imports)];
498494
# extern mod extra;
499-
use std::io::buffered::BufferedReader;
500-
use std::io::File;
495+
use std::io::{BufferedReader, File};
501496
# mod BufferedReader {
502497
# use std::io::File;
503-
# use std::io::mem::MemReader;
504-
# use std::io::buffered::BufferedReader;
498+
# use std::io::MemReader;
499+
# use std::io::BufferedReader;
505500
# static s : &'static [u8] = bytes!("1 2\n\
506501
# 34 56\n\
507502
# 789 123\n\
@@ -582,12 +577,11 @@ This can be encoded in the handler API by introducing a helper type: `enum Malfo
582577
~~~~
583578
# #[allow(unused_imports)];
584579
# extern mod extra;
585-
use std::io::buffered::BufferedReader;
586580
use std::io::File;
587581
# mod BufferedReader {
588582
# use std::io::File;
589-
# use std::io::mem::MemReader;
590-
# use std::io::buffered::BufferedReader;
583+
# use std::io::MemReader;
584+
# use std::io::BufferedReader;
591585
# static s : &'static [u8] = bytes!("1 2\n\
592586
# 34 56\n\
593587
# 789 123\n\
@@ -707,12 +701,11 @@ a second condition and a helper function will suffice:
707701
~~~~
708702
# #[allow(unused_imports)];
709703
# extern mod extra;
710-
use std::io::buffered::BufferedReader;
711-
use std::io::File;
704+
use std::io::{BufferedReader, File};
712705
# mod BufferedReader {
713706
# use std::io::File;
714-
# use std::io::mem::MemReader;
715-
# use std::io::buffered::BufferedReader;
707+
# use std::io::MemReader;
708+
# use std::io::BufferedReader;
716709
# static s : &'static [u8] = bytes!("1 2\n\
717710
# 34 56\n\
718711
# 789 123\n\

trunk/doc/guide-tasks.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ be distributed on the available cores.
290290
fn partial_sum(start: uint) -> f64 {
291291
let mut local_sum = 0f64;
292292
for num in range(start*100000, (start+1)*100000) {
293-
local_sum += (num as f64 + 1.0).pow(&-2.0);
293+
local_sum += (num as f64 + 1.0).powf(&-2.0);
294294
}
295295
local_sum
296296
}
@@ -326,7 +326,7 @@ a single large vector of floats. Each task needs the full vector to perform its
326326
use extra::arc::Arc;
327327
328328
fn pnorm(nums: &~[f64], p: uint) -> f64 {
329-
nums.iter().fold(0.0, |a,b| a+(*b).pow(&(p as f64)) ).pow(&(1.0 / (p as f64)))
329+
nums.iter().fold(0.0, |a,b| a+(*b).powf(&(p as f64)) ).powf(&(1.0 / (p as f64)))
330330
}
331331
332332
fn main() {

trunk/doc/guide-testing.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ mod tests {
6363
}
6464
~~~
6565

66-
Additionally #[test] items behave as if they also have the
67-
#[cfg(test)] attribute, and will not be compiled when the --test flag
66+
Additionally `#[test]` items behave as if they also have the
67+
`#[cfg(test)]` attribute, and will not be compiled when the --test flag
6868
is not used.
6969

7070
Tests that should not be run can be annotated with the 'ignore'

trunk/doc/rust.md

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -806,7 +806,9 @@ path_glob : ident [ "::" path_glob ] ?
806806

807807
A _use declaration_ creates one or more local name bindings synonymous
808808
with some other [path](#paths).
809-
Usually a `use` declaration is used to shorten the path required to refer to a module item.
809+
Usually a `use` declaration is used to shorten the path required to refer to a
810+
module item. These declarations may appear at the top of [modules](#modules) and
811+
[blocks](#blocks).
810812

811813
*Note*: Unlike in many languages,
812814
`use` declarations in Rust do *not* declare linkage dependency with external crates.
@@ -2318,14 +2320,24 @@ let base = Point3d {x: 1, y: 2, z: 3};
23182320
Point3d {y: 0, z: 10, .. base};
23192321
~~~~
23202322

2321-
### Record expressions
2323+
### Block expressions
23222324

23232325
~~~~ {.ebnf .gram}
2324-
rec_expr : '{' ident ':' expr
2325-
[ ',' ident ':' expr ] *
2326-
[ ".." expr ] '}'
2326+
block_expr : '{' [ view_item ] *
2327+
[ stmt ';' | item ] *
2328+
[ expr ] '}'
23272329
~~~~
23282330

2331+
A _block expression_ is similar to a module in terms of the declarations that
2332+
are possible. Each block conceptually introduces a new namespace scope. View
2333+
items can bring new names into scopes and declared items are in scope for only
2334+
the block itself.
2335+
2336+
A block will execute each statement sequentially, and then execute the
2337+
expression (if given). If the final expression is omitted, the type and return
2338+
value of the block are `()`, but if it is provided, the type and return value
2339+
of the block are that of the expression itself.
2340+
23292341
### Method-call expressions
23302342

23312343
~~~~ {.ebnf .gram}

trunk/mk/tests.mk

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -626,9 +626,10 @@ CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3) := \
626626
--aux-base $$(S)src/test/auxiliary/ \
627627
--stage-id stage$(1)-$(2) \
628628
--target $(2) \
629+
--host $(3) \
629630
--adb-path=$(CFG_ADB) \
630631
--adb-test-dir=$(CFG_ADB_TEST_DIR) \
631-
--rustcflags "$(RUSTC_FLAGS_$(2)) $$(CTEST_RUSTC_FLAGS) --target=$(2)" \
632+
--rustcflags "$(RUSTC_FLAGS_$(2)) $$(CTEST_RUSTC_FLAGS)" \
632633
$$(CTEST_TESTARGS)
633634

634635
CTEST_DEPS_rpass_$(1)-T-$(2)-H-$(3) = $$(RPASS_TESTS)

trunk/src/compiletest/common.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ pub struct config {
8686
// Target system to be tested
8787
target: ~str,
8888

89+
// Host triple for the compiler being invoked
90+
host: ~str,
91+
8992
// Extra parameter to run adb on arm-linux-androideabi
9093
adb_path: ~str,
9194

trunk/src/compiletest/compiletest.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ pub fn parse_config(args: ~[~str]) -> config {
7373
"percent change in metrics to consider noise", "N"),
7474
optflag("", "jit", "run tests under the JIT"),
7575
optopt("", "target", "the target to build for", "TARGET"),
76+
optopt("", "host", "the host to build for", "HOST"),
7677
optopt("", "adb-path", "path to the android debugger", "PATH"),
7778
optopt("", "adb-test-dir", "path to tests for the android debugger", "PATH"),
7879
optopt("", "test-shard", "run shard A, of B shards, worth of the testsuite", "A.B"),
@@ -134,6 +135,7 @@ pub fn parse_config(args: ~[~str]) -> config {
134135
rustcflags: matches.opt_str("rustcflags"),
135136
jit: matches.opt_present("jit"),
136137
target: opt_str2(matches.opt_str("target")).to_str(),
138+
host: opt_str2(matches.opt_str("host")).to_str(),
137139
adb_path: opt_str2(matches.opt_str("adb-path")).to_str(),
138140
adb_test_dir:
139141
opt_str2(matches.opt_str("adb-test-dir")).to_str(),
@@ -167,6 +169,7 @@ pub fn log_config(config: &config) {
167169
logv(c, format!("rustcflags: {}", opt_str(&config.rustcflags)));
168170
logv(c, format!("jit: {}", config.jit));
169171
logv(c, format!("target: {}", config.target));
172+
logv(c, format!("host: {}", config.host));
170173
logv(c, format!("adb_path: {}", config.adb_path));
171174
logv(c, format!("adb_test_dir: {}", config.adb_test_dir));
172175
logv(c, format!("adb_device_status: {}", config.adb_device_status));

trunk/src/compiletest/errors.rs

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

11-
use std::io::buffered::BufferedReader;
12-
use std::io::File;
11+
use std::io::{BufferedReader, File};
1312

1413
pub struct ExpectedError { line: uint, kind: ~str, msg: ~str }
1514

trunk/src/compiletest/header.rs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ pub struct TestProps {
2828
debugger_cmds: ~[~str],
2929
// Lines to check if they appear in the expected debugger output
3030
check_lines: ~[~str],
31+
// Flag to force a crate to be built with the host architecture
32+
force_host: bool,
3133
}
3234

3335
// Load any test directives embedded in the file
@@ -39,6 +41,7 @@ pub fn load_props(testfile: &Path) -> TestProps {
3941
let mut pp_exact = None;
4042
let mut debugger_cmds = ~[];
4143
let mut check_lines = ~[];
44+
let mut force_host = false;
4245
iter_header(testfile, |ln| {
4346
match parse_error_pattern(ln) {
4447
Some(ep) => error_patterns.push(ep),
@@ -53,6 +56,10 @@ pub fn load_props(testfile: &Path) -> TestProps {
5356
pp_exact = parse_pp_exact(ln, testfile);
5457
}
5558

59+
if !force_host {
60+
force_host = parse_force_host(ln);
61+
}
62+
5663
match parse_aux_build(ln) {
5764
Some(ab) => { aux_builds.push(ab); }
5865
None => {}
@@ -82,7 +89,8 @@ pub fn load_props(testfile: &Path) -> TestProps {
8289
aux_builds: aux_builds,
8390
exec_env: exec_env,
8491
debugger_cmds: debugger_cmds,
85-
check_lines: check_lines
92+
check_lines: check_lines,
93+
force_host: force_host,
8694
};
8795
}
8896

@@ -107,8 +115,7 @@ pub fn is_test_ignored(config: &config, testfile: &Path) -> bool {
107115
}
108116

109117
fn iter_header(testfile: &Path, it: |&str| -> bool) -> bool {
110-
use std::io::buffered::BufferedReader;
111-
use std::io::File;
118+
use std::io::{BufferedReader, File};
112119

113120
let mut rdr = BufferedReader::new(File::open(testfile).unwrap());
114121
for ln in rdr.lines() {
@@ -142,6 +149,10 @@ fn parse_check_line(line: &str) -> Option<~str> {
142149
parse_name_value_directive(line, ~"check")
143150
}
144151

152+
fn parse_force_host(line: &str) -> bool {
153+
parse_name_directive(line, "force-host")
154+
}
155+
145156
fn parse_exec_env(line: &str) -> Option<(~str, ~str)> {
146157
parse_name_value_directive(line, ~"exec-env").map(|nv| {
147158
// nv is either FOO or FOO=BAR

trunk/src/compiletest/runtest.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -691,8 +691,9 @@ fn compose_and_run_compiler(
691691

692692
for rel_ab in props.aux_builds.iter() {
693693
let abs_ab = config.aux_base.join(rel_ab.as_slice());
694+
let aux_props = load_props(&abs_ab);
694695
let aux_args =
695-
make_compile_args(config, props, ~[~"--lib"] + extra_link_args,
696+
make_compile_args(config, &aux_props, ~[~"--lib"] + extra_link_args,
696697
|a,b| make_lib_name(a, b, testfile), &abs_ab);
697698
let auxres = compose_and_run(config, &abs_ab, aux_args, ~[],
698699
config.compile_lib_path, None);
@@ -738,10 +739,16 @@ fn make_compile_args(config: &config,
738739
testfile: &Path)
739740
-> ProcArgs {
740741
let xform_file = xform(config, testfile);
742+
let target = if props.force_host {
743+
config.host.as_slice()
744+
} else {
745+
config.target.as_slice()
746+
};
741747
// FIXME (#9639): This needs to handle non-utf8 paths
742748
let mut args = ~[testfile.as_str().unwrap().to_owned(),
743749
~"-o", xform_file.as_str().unwrap().to_owned(),
744-
~"-L", config.build_base.as_str().unwrap().to_owned()]
750+
~"-L", config.build_base.as_str().unwrap().to_owned(),
751+
~"--target=" + target]
745752
+ extras;
746753
args.push_all_move(split_maybe_args(&config.rustcflags));
747754
args.push_all_move(split_maybe_args(&props.compile_flags));

trunk/src/etc/check-summary.py

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,30 @@
77
summaries = []
88
def summarise(fname):
99
summary = {}
10-
fd = open(fname)
11-
for line in fd:
12-
status, test = line.strip().split(' ', 1)
13-
if not summary.has_key(status):
14-
summary[status] = []
15-
summary[status].append(test)
16-
summaries.append((fname, summary))
10+
with open(fname) as fd:
11+
for line in fd:
12+
splitline = line.strip().split(' ')
13+
if len(splitline) == 1:
14+
continue
15+
status = splitline[0]
16+
test = splitline[-1]
17+
# track bench runs
18+
if splitline[1] == 'ns/iter':
19+
status = 'bench'
20+
if not summary.has_key(status):
21+
summary[status] = []
22+
summary[status].append(test)
23+
summaries.append((fname, summary))
1724
def count(t):
1825
return sum(map(lambda (f, s): len(s.get(t, [])), summaries))
1926
logfiles = sys.argv[1:]
2027
map(summarise, logfiles)
2128
ok = count('ok')
2229
failed = count('failed')
2330
ignored = count('ignored')
24-
print "summary of %d test runs: %d passed; %d failed; %d ignored" % \
25-
(len(logfiles), ok, failed, ignored)
31+
measured = count('bench')
32+
print "summary of %d test runs: %d passed; %d failed; %d ignored; %d measured" % \
33+
(len(logfiles), ok, failed, ignored, measured)
2634
print ""
2735
if failed > 0:
2836
print "failed tests:"

0 commit comments

Comments
 (0)