Skip to content

Commit c52d0b8

Browse files
committed
---
yaml --- r: 144617 b: refs/heads/try2 c: fb0b388 h: refs/heads/master i: 144615: 84bbcf9 v: v3
1 parent bfd89ff commit c52d0b8

File tree

236 files changed

+2606
-4305
lines changed

Some content is hidden

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

236 files changed

+2606
-4305
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 66593a733d763e01e6765c7a52476c7693eb211a
8+
refs/heads/try2: fb0b388804ec6b4535e73a890feda7372182486f
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/doc/rust.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ break
209209
do
210210
else enum extern
211211
false fn for
212-
if impl in
212+
if impl
213213
let loop
214214
match mod mut
215215
priv pub

branches/try2/doc/tutorial-container.md

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,14 +105,18 @@ impl Iterator<int> for ZeroStream {
105105
}
106106
~~~
107107
108+
In general, you cannot rely on the behavior of the `next()` method after it has
109+
returned `None`. Some iterators may return `None` forever. Others may behave
110+
differently.
111+
108112
## Container iterators
109113
110114
Containers implement iteration over the contained elements by returning an
111115
iterator object. For example, vector slices several iterators available:
112116
113117
* `iter()` and `rev_iter()`, for immutable references to the elements
114118
* `mut_iter()` and `mut_rev_iter()`, for mutable references to the elements
115-
* `move_iter()` and `move_rev_iter`, to move the elements out by-value
119+
* `move_iter()` and `move_rev_iter()`, to move the elements out by-value
116120
117121
A typical mutable container will implement at least `iter()`, `mut_iter()` and
118122
`move_iter()` along with the reverse variants if it maintains an order.
@@ -149,7 +153,7 @@ let result = xs.iter().fold(0, |accumulator, item| accumulator - *item);
149153
assert_eq!(result, -41);
150154
~~~
151155
152-
Some adaptors return an adaptor object implementing the `Iterator` trait itself:
156+
Most adaptors return an adaptor object implementing the `Iterator` trait itself:
153157
154158
~~~
155159
let xs = [1, 9, 2, 3, 14, 12];
@@ -158,6 +162,35 @@ let sum = xs.iter().chain(ys.iter()).fold(0, |a, b| a + *b);
158162
assert_eq!(sum, 57);
159163
~~~
160164
165+
Some iterator adaptors may return `None` before exhausting the underlying
166+
iterator. Additionally, if these iterator adaptors are called again after
167+
returning `None`, they may call their underlying iterator again even if the
168+
adaptor will continue to return `None` forever. This may not be desired if the
169+
underlying iterator has side-effects.
170+
171+
In order to provide a guarantee about behavior once `None` has been returned, an
172+
iterator adaptor named `fuse()` is provided. This returns an iterator that will
173+
never call its underlying iterator again once `None` has been returned:
174+
175+
~~~
176+
let xs = [1,2,3,4,5];
177+
let mut calls = 0;
178+
let it = xs.iter().scan((), |_, x| {
179+
calls += 1;
180+
if *x < 3 { Some(x) } else { None }});
181+
// the iterator will only yield 1 and 2 before returning None
182+
// If we were to call it 5 times, calls would end up as 5, despite only 2 values
183+
// being yielded (and therefore 3 unique calls being made). The fuse() adaptor
184+
// can fix this.
185+
let mut it = it.fuse();
186+
it.next();
187+
it.next();
188+
it.next();
189+
it.next();
190+
it.next();
191+
assert_eq!(calls, 3);
192+
~~~
193+
161194
## For loops
162195
163196
The function `range` (or `range_inclusive`) allows to simply iterate through a given range:

branches/try2/mk/stage0.mk

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@ $(HBIN0_H_$(CFG_BUILD_TRIPLE))/:
66
$(HLIB0_H_$(CFG_BUILD_TRIPLE))/:
77
mkdir -p $@
88

9-
SNAPSHOT_RUSTC_POST_CLEANUP=$(HBIN0_H_$(CFG_BUILD_TRIPLE))/rustc$(X_$(CFG_BUILD_TRIPLE))
10-
11-
$(SNAPSHOT_RUSTC_POST_CLEANUP): \
9+
$(HBIN0_H_$(CFG_BUILD_TRIPLE))/rustc$(X_$(CFG_BUILD_TRIPLE)): \
1210
$(S)src/snapshots.txt \
1311
$(S)src/etc/get-snapshot.py $(MKFILE_DEPS) \
1412
| $(HBIN0_H_$(CFG_BUILD_TRIPLE))/

branches/try2/mk/target.mk

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,28 +27,18 @@ WFLAGS_ST2 = -D warnings
2727
# $(2) is the target triple
2828
# $(3) is the host triple
2929

30-
# Every recipe in TARGET_STAGE_N outputs to $$(TLIB$(1)_T_$(2)_H_$(3),
31-
# a directory that can be cleaned out during the middle of a run of
32-
# the get-snapshot.py script. Therefore, every recipe needs to have
33-
# an order-only dependency either on $(SNAPSHOT_RUSTC_POST_CLEANUP) or
34-
# on $$(TSREQ$(1)_T_$(2)_H_$(3)), to ensure that no products will be
35-
# put into the target area until after the get-snapshot.py script has
36-
# had its chance to clean it out; otherwise the other products will be
37-
# inadvertantly included in the clean out.
3830

3931
define TARGET_STAGE_N
4032

4133
$$(TLIB$(1)_T_$(2)_H_$(3))/libmorestack.a: \
4234
rt/$(2)/stage$(1)/arch/$$(HOST_$(2))/libmorestack.a \
43-
| $$(TLIB$(1)_T_$(2)_H_$(3))/ \
44-
$(SNAPSHOT_RUSTC_POST_CLEANUP)
35+
| $$(TLIB$(1)_T_$(2)_H_$(3))/
4536
@$$(call E, cp: $$@)
4637
$$(Q)cp $$< $$@
4738

4839
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_RUNTIME_$(2)): \
4940
rt/$(2)/stage$(1)/$(CFG_RUNTIME_$(2)) \
50-
| $$(TLIB$(1)_T_$(2)_H_$(3))/ \
51-
$(SNAPSHOT_RUSTC_POST_CLEANUP)
41+
| $$(TLIB$(1)_T_$(2)_H_$(3))/
5242
@$$(call E, cp: $$@)
5343
$$(Q)cp $$< $$@
5444

@@ -87,8 +77,7 @@ ifneq ($$(findstring $(2),$$(CFG_HOST_TRIPLES)),)
8777

8878
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_RUSTLLVM_$(3)): \
8979
rustllvm/$(2)/$(CFG_RUSTLLVM_$(3)) \
90-
| $$(TLIB$(1)_T_$(2)_H_$(3))/ \
91-
$(SNAPSHOT_RUSTC_POST_CLEANUP)
80+
| $$(TLIB$(1)_T_$(2)_H_$(3))/
9281
@$$(call E, cp: $$@)
9382
$$(Q)cp $$< $$@
9483

branches/try2/mk/tests.mk

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -476,15 +476,15 @@ RFAIL_RC := $(wildcard $(S)src/test/run-fail/*.rc)
476476
RFAIL_RS := $(wildcard $(S)src/test/run-fail/*.rs)
477477
CFAIL_RC := $(wildcard $(S)src/test/compile-fail/*.rc)
478478
CFAIL_RS := $(wildcard $(S)src/test/compile-fail/*.rs)
479-
BENCH_RS := $(wildcard $(S)src/test/bench/*.rs)
479+
BENCH_RS := $(wildcard $(S)src/test/bench/rt/*.rs $(S)src/test/bench/shootout/*.rs $(S)src/test/bench/std/*.rs $(S)src/test/bench/*.rs)
480480
PRETTY_RS := $(wildcard $(S)src/test/pretty/*.rs)
481481
DEBUGINFO_RS := $(wildcard $(S)src/test/debug-info/*.rs)
482482
CODEGEN_RS := $(wildcard $(S)src/test/codegen/*.rs)
483483
CODEGEN_CC := $(wildcard $(S)src/test/codegen/*.cc)
484484

485485
# perf tests are the same as bench tests only they run under
486486
# a performance monitor.
487-
PERF_RS := $(wildcard $(S)src/test/bench/*.rs)
487+
PERF_RS := $(BENCH_RS)
488488

489489
RPASS_TESTS := $(RPASS_RC) $(RPASS_RS)
490490
RPASS_FULL_TESTS := $(RPASS_FULL_RC) $(RPASS_FULL_RS)
@@ -516,7 +516,7 @@ CTEST_BUILD_BASE_cfail = compile-fail
516516
CTEST_MODE_cfail = compile-fail
517517
CTEST_RUNTOOL_cfail = $(CTEST_RUNTOOL)
518518

519-
CTEST_SRC_BASE_bench = bench
519+
CTEST_SRC_BASE_bench = bench bench/rt bench/shootout bench/std
520520
CTEST_BUILD_BASE_bench = bench
521521
CTEST_MODE_bench = run-pass
522522
CTEST_RUNTOOL_bench = $(CTEST_RUNTOOL)
@@ -610,7 +610,8 @@ define DEF_RUN_COMPILETEST
610610

611611
CTEST_ARGS$(1)-T-$(2)-H-$(3)-$(4) := \
612612
$$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3)) \
613-
--src-base $$(S)src/test/$$(CTEST_SRC_BASE_$(4))/ \
613+
$(foreach base,$$(CTEST_SRC_BASE_$(4)), \
614+
--src-base $$(S)src/test/$$(base))/ \
614615
--build-base $(3)/test/$$(CTEST_BUILD_BASE_$(4))/ \
615616
--ratchet-metrics $(call TEST_RATCHET_FILE,$(1),$(2),$(3),$(4)) \
616617
--mode $$(CTEST_MODE_$(4)) \
@@ -869,8 +870,7 @@ $(foreach host,$(CFG_HOST_TRIPLES), \
869870
$(eval $(foreach target,$(CFG_TARGET_TRIPLES), \
870871
$(eval $(call DEF_CHECK_FAST_FOR_T_H,,$(target),$(host))))))
871872

872-
check-fast: tidy check-fast-H-$(CFG_BUILD_TRIPLE) check-stage2-std check-stage2-extra
873-
$(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log
873+
check-fast: tidy check-fast-H-$(CFG_BUILD_TRIPLE)
874874

875875
define DEF_CHECK_FAST_FOR_H
876876

branches/try2/src/compiletest/common.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ pub struct config {
3636
llvm_bin_path: Option<Path>,
3737

3838
// The directory containing the tests to run
39-
src_base: Path,
39+
src_base: ~[Path],
4040

4141
// The directory where programs should be built
4242
build_base: Path,
@@ -83,6 +83,9 @@ pub struct config {
8383
// Run tests using the JIT
8484
jit: bool,
8585

86+
// Run tests using the new runtime
87+
newrt: bool,
88+
8689
// Target system to be tested
8790
target: ~str,
8891

branches/try2/src/compiletest/compiletest.rs

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use std::os;
1919
use std::f64;
2020

2121
use extra::getopts;
22-
use extra::getopts::groups::{optopt, optflag, reqopt};
22+
use extra::getopts::groups::{optopt, optflag, reqopt, optmulti};
2323
use extra::test;
2424

2525
use common::config;
@@ -49,19 +49,19 @@ pub fn main() {
4949
pub fn parse_config(args: ~[~str]) -> config {
5050

5151
let groups : ~[getopts::groups::OptGroup] =
52-
~[reqopt("", "compile-lib-path", "path to host shared libraries", "PATH"),
53-
reqopt("", "run-lib-path", "path to target shared libraries", "PATH"),
54-
reqopt("", "rustc-path", "path to rustc to use for compiling", "PATH"),
55-
optopt("", "clang-path", "path to executable for codegen tests", "PATH"),
56-
optopt("", "llvm-bin-path", "path to directory holding llvm binaries", "DIR"),
57-
reqopt("", "src-base", "directory to scan for test files", "PATH"),
58-
reqopt("", "build-base", "directory to deposit test outputs", "PATH"),
59-
reqopt("", "aux-base", "directory to find auxiliary test files", "PATH"),
60-
reqopt("", "stage-id", "the target-stage identifier", "stageN-TARGET"),
61-
reqopt("", "mode", "which sort of compile tests to run",
62-
"(compile-fail|run-fail|run-pass|pretty|debug-info)"),
63-
optflag("", "ignored", "run tests marked as ignored / xfailed"),
64-
optopt("", "runtool", "supervisor program to run tests under \
52+
~[reqopt ("", "compile-lib-path", "path to host shared libraries", "PATH"),
53+
reqopt ("", "run-lib-path", "path to target shared libraries", "PATH"),
54+
reqopt ("", "rustc-path", "path to rustc to use for compiling", "PATH"),
55+
optopt ("", "clang-path", "path to executable for codegen tests", "PATH"),
56+
optopt ("", "llvm-bin-path", "path to directory holding llvm binaries", "DIR"),
57+
optmulti ("", "src-base", "directory to scan for test files", "PATH"),
58+
reqopt ("", "build-base", "directory to deposit test outputs", "PATH"),
59+
reqopt ("", "aux-base", "directory to find auxiliary test files", "PATH"),
60+
reqopt ("", "stage-id", "the target-stage identifier", "stageN-TARGET"),
61+
reqopt ("", "mode", "which sort of compile tests to run",
62+
" (compile-fail|run-fail|run-pass|pretty|debug-info)"),
63+
optflag ("", "ignored", "run tests marked as ignored / xfailed"),
64+
optopt ("", "runtool", "supervisor program to run tests under \
6565
(eg. emulator, valgrind)", "PROGRAM"),
6666
optopt("", "rustcflags", "flags to pass to rustc", "FLAGS"),
6767
optflag("", "verbose", "run tests verbosely, showing all output"),
@@ -71,6 +71,7 @@ pub fn parse_config(args: ~[~str]) -> config {
7171
optopt("", "ratchet-noise-percent",
7272
"percent change in metrics to consider noise", "N"),
7373
optflag("", "jit", "run tests under the JIT"),
74+
optflag("", "newrt", "run tests on the new runtime / scheduler"),
7475
optopt("", "target", "the target to build for", "TARGET"),
7576
optopt("", "adb-path", "path to the android debugger", "PATH"),
7677
optopt("", "adb-test-dir", "path to tests for the android debugger", "PATH"),
@@ -105,13 +106,15 @@ pub fn parse_config(args: ~[~str]) -> config {
105106
Path(getopts::opt_str(m, nm))
106107
}
107108

109+
let src_base = getopts::opt_strs(matches, "src-base");
110+
108111
config {
109112
compile_lib_path: getopts::opt_str(matches, "compile-lib-path"),
110113
run_lib_path: getopts::opt_str(matches, "run-lib-path"),
111114
rustc_path: opt_path(matches, "rustc-path"),
112115
clang_path: getopts::opt_maybe_str(matches, "clang-path").map_move(|s| Path(s)),
113116
llvm_bin_path: getopts::opt_maybe_str(matches, "llvm-bin-path").map_move(|s| Path(s)),
114-
src_base: opt_path(matches, "src-base"),
117+
src_base: src_base.iter().map(|x| Path(x.clone())).collect(),
115118
build_base: opt_path(matches, "build-base"),
116119
aux_base: opt_path(matches, "aux-base"),
117120
stage_id: getopts::opt_str(matches, "stage-id"),
@@ -134,6 +137,7 @@ pub fn parse_config(args: ~[~str]) -> config {
134137
runtool: getopts::opt_maybe_str(matches, "runtool"),
135138
rustcflags: getopts::opt_maybe_str(matches, "rustcflags"),
136139
jit: getopts::opt_present(matches, "jit"),
140+
newrt: getopts::opt_present(matches, "newrt"),
137141
target: opt_str2(getopts::opt_maybe_str(matches, "target")).to_str(),
138142
adb_path: opt_str2(getopts::opt_maybe_str(matches, "adb-path")).to_str(),
139143
adb_test_dir:
@@ -167,6 +171,7 @@ pub fn log_config(config: &config) {
167171
logv(c, fmt!("runtool: %s", opt_str(&config.runtool)));
168172
logv(c, fmt!("rustcflags: %s", opt_str(&config.rustcflags)));
169173
logv(c, fmt!("jit: %b", config.jit));
174+
logv(c, fmt!("newrt: %b", config.newrt));
170175
logv(c, fmt!("target: %s", config.target));
171176
logv(c, fmt!("adb_path: %s", config.adb_path));
172177
logv(c, fmt!("adb_test_dir: %s", config.adb_test_dir));
@@ -245,7 +250,7 @@ pub fn make_tests(config: &config) -> ~[test::TestDescAndFn] {
245250
debug!("making tests from %s",
246251
config.src_base.to_str());
247252
let mut tests = ~[];
248-
let dirs = os::list_dir_path(&config.src_base);
253+
let dirs = config.src_base.iter().flat_map(|x| os::list_dir_path(x).move_iter()).to_owned_vec();
249254
for file in dirs.iter() {
250255
let file = file.clone();
251256
debug!("inspecting file %s", file.to_str());

branches/try2/src/compiletest/runtest.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -547,13 +547,15 @@ fn compile_test_(config: &config, props: &TestProps,
547547
fn exec_compiled_test(config: &config, props: &TestProps,
548548
testfile: &Path) -> ProcRes {
549549

550+
// If testing the new runtime then set the RUST_NEWRT env var
550551
let env = props.exec_env.clone();
552+
let env = if config.newrt { env + &[(~"RUST_NEWRT", ~"1")] } else { env };
551553

552554
match config.target {
553555

554556
~"arm-linux-androideabi" => {
555557
if (config.adb_device_status) {
556-
_arm_exec_compiled_test(config, props, testfile, env)
558+
_arm_exec_compiled_test(config, props, testfile)
557559
} else {
558560
_dummy_exec_compiled_test(config, props, testfile)
559561
}
@@ -779,7 +781,7 @@ stderr:\n\
779781
}
780782

781783
fn _arm_exec_compiled_test(config: &config, props: &TestProps,
782-
testfile: &Path, env: ~[(~str, ~str)]) -> ProcRes {
784+
testfile: &Path) -> ProcRes {
783785

784786
let args = make_run_args(config, props, testfile);
785787
let cmdline = make_cmdline("", args.prog, args.args);
@@ -805,9 +807,6 @@ fn _arm_exec_compiled_test(config: &config, props: &TestProps,
805807

806808
// run test via adb_run_wrapper
807809
runargs.push(~"shell");
808-
for (key, val) in env.move_iter() {
809-
runargs.push(fmt!("%s=%s", key, val));
810-
}
811810
runargs.push(fmt!("%s/adb_run_wrapper.sh", config.adb_test_dir));
812811
runargs.push(fmt!("%s", config.adb_test_dir));
813812
runargs.push(fmt!("%s", prog_short));

branches/try2/src/etc/emacs/rust-mode.el

Lines changed: 5 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
;; Url: https://github.com/mozilla/rust
66

77
(eval-when-compile (require 'cl))
8-
(eval-when-compile (require 'misc))
98

109
;; Syntax definitions and helpers
1110
(defvar rust-mode-syntax-table
@@ -58,39 +57,19 @@
5857
;; A closing brace is 1 level unindended
5958
((looking-at "}") (* rust-indent-offset (- level 1)))
6059

61-
; Doc comments in /** style with leading * indent to line up the *s
62-
((and (nth 4 (syntax-ppss)) (looking-at "*"))
63-
(+ 1 (* rust-indent-offset level)))
64-
6560
;; If we're in any other token-tree / sexp, then:
6661
;; - [ or ( means line up with the opening token
6762
;; - { means indent to either nesting-level * rust-indent-offset,
6863
;; or one further indent from that if either current line
6964
;; begins with 'else', or previous line didn't end in
70-
;; semi, comma or brace (other than whitespace and line
71-
;; comments) , and wasn't an attribute. But if we have
72-
;; something after the open brace and ending with a comma,
73-
;; treat it as fields and align them. PHEW.
65+
;; semi, comma or brace, and wasn't an attribute. PHEW.
7466
((> level 0)
7567
(let ((pt (point)))
7668
(rust-rewind-irrelevant)
7769
(backward-up-list)
78-
(cond
79-
((and
80-
(looking-at "[[(]")
81-
; We don't want to indent out to the open bracket if the
82-
; open bracket ends the line
83-
(save-excursion
84-
(forward-char)
85-
(not (looking-at "[[:space:]]*\\(?://.*\\)?$"))))
86-
(+ 1 (current-column)))
87-
;; Check for fields on the same line as the open curly brace:
88-
((looking-at "{[[:blank:]]*[^}\n]*,[[:space:]]*$")
70+
(if (looking-at "[[(]")
71+
(+ 1 (current-column))
8972
(progn
90-
(forward-char)
91-
(forward-to-word 1)
92-
(current-column)))
93-
(t (progn
9473
(goto-char pt)
9574
(back-to-indentation)
9675
(if (looking-at "\\<else\\>")
@@ -100,12 +79,12 @@
10079
(beginning-of-line)
10180
(rust-rewind-irrelevant)
10281
(end-of-line)
103-
(if (looking-back "[,;{}(][[:space:]]*\\(?://.*\\)?")
82+
(if (looking-back "[{};,]")
10483
(* rust-indent-offset level)
10584
(back-to-indentation)
10685
(if (looking-at "#")
10786
(* rust-indent-offset level)
108-
(* rust-indent-offset (+ 1 level)))))))))))
87+
(* rust-indent-offset (+ 1 level))))))))))
10988

11089
;; Otherwise we're in a column-zero definition
11190
(t 0))))))

0 commit comments

Comments
 (0)