Skip to content

Commit 4657021

Browse files
committed
---
yaml --- r: 192255 b: refs/heads/master c: 3112716 h: refs/heads/master i: 192253: f5c8dde 192251: 16fd6bc 192247: e08263e 192239: 8815667 192223: 3f9b8cb 192191: 19193a6 192127: 474ee04 191999: e6d8ade v: v3
1 parent 33ac1d0 commit 4657021

File tree

2,073 files changed

+11161
-6847
lines changed

Some content is hidden

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

2,073 files changed

+11161
-6847
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: f945190e6352a1bc965a117569532643319b400f
2+
refs/heads/master: 3112716f123bc0f6f69c4df26894241f41c488ce
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: a923278c6278c63468d74772c58dbf788e88f58c
55
refs/heads/try: ce76bff75603a754d092456285ff455eb871633d

trunk/Makefile.in

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,7 @@
9797
# make check-stage1-rpass TESTNAME=my-shiny-new-test
9898
#
9999
# // Having trouble figuring out which test is failing? Turn off parallel tests
100-
# make check-stage1-std RUST_TEST_TASKS=1
101-
#
102-
# This is hardly all there is to know of The Rust Build System's
103-
# mysteries. The tale continues on the wiki[1].
104-
#
105-
# [1]: https://github.com/rust-lang/rust/wiki/Note-testsuite
100+
# make check-stage1-std RUST_TEST_THREADS=1
106101
#
107102
# If you really feel like getting your hands dirty, then:
108103
#

trunk/configure

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -479,10 +479,19 @@ esac
479479
# Detect 64 bit linux systems with 32 bit userland and force 32 bit compilation
480480
if [ $CFG_OSTYPE = unknown-linux-gnu -a $CFG_CPUTYPE = x86_64 ]
481481
then
482-
file -L "$SHELL" | grep -q "x86[_-]64"
483-
if [ $? != 0 ]; then
484-
CFG_CPUTYPE=i686
482+
# $SHELL does not exist in standard 'sh', so probably only exists
483+
# if configure is running in an interactive bash shell. /usr/bin/env
484+
# exists *everywhere*.
485+
BIN_TO_PROBE="$SHELL"
486+
if [ -z "$BIN_TO_PROBE" -a -e "/usr/bin/env" ]; then
487+
BIN_TO_PROBE="/usr/bin/env"
485488
fi
489+
if [ -n "$BIN_TO_PROBE" ]; then
490+
file -L "$BIN_TO_PROBE" | grep -q "x86[_-]64"
491+
if [ $? != 0 ]; then
492+
CFG_CPUTYPE=i686
493+
fi
494+
fi
486495
fi
487496

488497

trunk/man/rustc.1

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,28 @@ full debug info with variable and type information.
242242
\fBopt\-level\fR=\fIVAL\fR
243243
Optimize with possible levels 0\[en]3
244244

245+
.SH ENVIRONMENT
246+
247+
Some of these affect the output of the compiler, while others affect programs
248+
which link to the standard library.
249+
250+
.TP
251+
\fBRUST_TEST_THREADS\fR
252+
The test framework Rust provides executes tests in parallel. This variable sets
253+
the maximum number of threads used for this purpose.
254+
255+
.TP
256+
\fBRUST_TEST_NOCAPTURE\fR
257+
A synonym for the --nocapture flag.
258+
259+
.TP
260+
\fBRUST_MIN_STACK\fR
261+
Sets the minimum stack size for new threads.
262+
263+
.TP
264+
\fBRUST_BACKTRACE\fR
265+
If set, produces a backtrace in the output of a program which panics.
266+
245267
.SH "EXAMPLES"
246268
To build an executable from a source file with a main function:
247269
$ rustc \-o hello hello.rs

trunk/src/compiletest/compiletest.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@
1919
#![feature(unboxed_closures)]
2020
#![feature(std_misc)]
2121
#![feature(test)]
22-
#![feature(core)]
2322
#![feature(path_ext)]
23+
#![feature(convert)]
24+
#![feature(str_char)]
2425

2526
#![deny(warnings)]
2627

@@ -116,7 +117,7 @@ pub fn parse_config(args: Vec<String> ) -> Config {
116117

117118
fn opt_path(m: &getopts::Matches, nm: &str) -> PathBuf {
118119
match m.opt_str(nm) {
119-
Some(s) => PathBuf::new(&s),
120+
Some(s) => PathBuf::from(&s),
120121
None => panic!("no option (=path) found for {}", nm),
121122
}
122123
}
@@ -131,18 +132,18 @@ pub fn parse_config(args: Vec<String> ) -> Config {
131132
compile_lib_path: matches.opt_str("compile-lib-path").unwrap(),
132133
run_lib_path: matches.opt_str("run-lib-path").unwrap(),
133134
rustc_path: opt_path(matches, "rustc-path"),
134-
clang_path: matches.opt_str("clang-path").map(|s| PathBuf::new(&s)),
135+
clang_path: matches.opt_str("clang-path").map(|s| PathBuf::from(&s)),
135136
valgrind_path: matches.opt_str("valgrind-path"),
136137
force_valgrind: matches.opt_present("force-valgrind"),
137-
llvm_bin_path: matches.opt_str("llvm-bin-path").map(|s| PathBuf::new(&s)),
138+
llvm_bin_path: matches.opt_str("llvm-bin-path").map(|s| PathBuf::from(&s)),
138139
src_base: opt_path(matches, "src-base"),
139140
build_base: opt_path(matches, "build-base"),
140141
aux_base: opt_path(matches, "aux-base"),
141142
stage_id: matches.opt_str("stage-id").unwrap(),
142143
mode: matches.opt_str("mode").unwrap().parse().ok().expect("invalid mode"),
143144
run_ignored: matches.opt_present("ignored"),
144145
filter: filter,
145-
logfile: matches.opt_str("logfile").map(|s| PathBuf::new(&s)),
146+
logfile: matches.opt_str("logfile").map(|s| PathBuf::from(&s)),
146147
runtool: matches.opt_str("runtool"),
147148
host_rustcflags: matches.opt_str("host-rustcflags"),
148149
target_rustcflags: matches.opt_str("target-rustcflags"),
@@ -225,15 +226,15 @@ pub fn run_tests(config: &Config) {
225226
// android debug-info test uses remote debugger
226227
// so, we test 1 task at once.
227228
// also trying to isolate problems with adb_run_wrapper.sh ilooping
228-
env::set_var("RUST_TEST_TASKS","1");
229+
env::set_var("RUST_TEST_THREADS","1");
229230
}
230231

231232
match config.mode {
232233
DebugInfoLldb => {
233234
// Some older versions of LLDB seem to have problems with multiple
234235
// instances running in parallel, so only run one test task at a
235236
// time.
236-
env::set_var("RUST_TEST_TASKS", "1");
237+
env::set_var("RUST_TEST_THREADS", "1");
237238
}
238239
_ => { /* proceed */ }
239240
}

trunk/src/compiletest/header.rs

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ pub struct TestProps {
4040
pub check_stdout: bool,
4141
// Don't force a --crate-type=dylib flag on the command line
4242
pub no_prefer_dynamic: bool,
43-
// Don't run --pretty expanded when running pretty printing tests
44-
pub no_pretty_expanded: bool,
43+
// Run --pretty expanded when running pretty printing tests
44+
pub pretty_expanded: bool,
4545
// Which pretty mode are we testing with, default to 'normal'
4646
pub pretty_mode: String,
4747
// Only compare pretty output and don't try compiling
@@ -62,7 +62,7 @@ pub fn load_props(testfile: &Path) -> TestProps {
6262
let mut force_host = false;
6363
let mut check_stdout = false;
6464
let mut no_prefer_dynamic = false;
65-
let mut no_pretty_expanded = false;
65+
let mut pretty_expanded = false;
6666
let mut pretty_mode = None;
6767
let mut pretty_compare_only = false;
6868
let mut forbid_output = Vec::new();
@@ -96,8 +96,8 @@ pub fn load_props(testfile: &Path) -> TestProps {
9696
no_prefer_dynamic = parse_no_prefer_dynamic(ln);
9797
}
9898

99-
if !no_pretty_expanded {
100-
no_pretty_expanded = parse_no_pretty_expanded(ln);
99+
if !pretty_expanded {
100+
pretty_expanded = parse_pretty_expanded(ln);
101101
}
102102

103103
if pretty_mode.is_none() {
@@ -131,7 +131,7 @@ pub fn load_props(testfile: &Path) -> TestProps {
131131
true
132132
});
133133

134-
for key in vec!["RUST_TEST_NOCAPTURE", "RUST_TEST_TASKS"] {
134+
for key in vec!["RUST_TEST_NOCAPTURE", "RUST_TEST_THREADS"] {
135135
match env::var(key) {
136136
Ok(val) =>
137137
if exec_env.iter().find(|&&(ref x, _)| *x == key.to_string()).is_none() {
@@ -152,7 +152,7 @@ pub fn load_props(testfile: &Path) -> TestProps {
152152
force_host: force_host,
153153
check_stdout: check_stdout,
154154
no_prefer_dynamic: no_prefer_dynamic,
155-
no_pretty_expanded: no_pretty_expanded,
155+
pretty_expanded: pretty_expanded,
156156
pretty_mode: pretty_mode.unwrap_or("normal".to_string()),
157157
pretty_compare_only: pretty_compare_only,
158158
forbid_output: forbid_output,
@@ -163,6 +163,9 @@ pub fn is_test_ignored(config: &Config, testfile: &Path) -> bool {
163163
fn ignore_target(config: &Config) -> String {
164164
format!("ignore-{}", util::get_os(&config.target))
165165
}
166+
fn ignore_architecture(config: &Config) -> String {
167+
format!("ignore-{}", util::get_arch(&config.target))
168+
}
166169
fn ignore_stage(config: &Config) -> String {
167170
format!("ignore-{}",
168171
config.stage_id.split('-').next().unwrap())
@@ -226,6 +229,7 @@ pub fn is_test_ignored(config: &Config, testfile: &Path) -> bool {
226229
let val = iter_header(testfile, &mut |ln| {
227230
!parse_name_directive(ln, "ignore-test") &&
228231
!parse_name_directive(ln, &ignore_target(config)) &&
232+
!parse_name_directive(ln, &ignore_architecture(config)) &&
229233
!parse_name_directive(ln, &ignore_stage(config)) &&
230234
!(config.mode == common::Pretty && parse_name_directive(ln, "ignore-pretty")) &&
231235
!(config.target != config.host && parse_name_directive(ln, "ignore-cross-compile")) &&
@@ -291,8 +295,8 @@ fn parse_no_prefer_dynamic(line: &str) -> bool {
291295
parse_name_directive(line, "no-prefer-dynamic")
292296
}
293297

294-
fn parse_no_pretty_expanded(line: &str) -> bool {
295-
parse_name_directive(line, "no-pretty-expanded")
298+
fn parse_pretty_expanded(line: &str) -> bool {
299+
parse_name_directive(line, "pretty-expanded")
296300
}
297301

298302
fn parse_pretty_mode(line: &str) -> Option<String> {
@@ -324,10 +328,10 @@ fn parse_exec_env(line: &str) -> Option<(String, String)> {
324328

325329
fn parse_pp_exact(line: &str, testfile: &Path) -> Option<PathBuf> {
326330
match parse_name_value_directive(line, "pp-exact") {
327-
Some(s) => Some(PathBuf::new(&s)),
331+
Some(s) => Some(PathBuf::from(&s)),
328332
None => {
329333
if parse_name_directive(line, "pp-exact") {
330-
testfile.file_name().map(|s| PathBuf::new(s))
334+
testfile.file_name().map(|s| PathBuf::from(s))
331335
} else {
332336
None
333337
}
@@ -336,7 +340,8 @@ fn parse_pp_exact(line: &str, testfile: &Path) -> Option<PathBuf> {
336340
}
337341

338342
fn parse_name_directive(line: &str, directive: &str) -> bool {
339-
line.contains(directive)
343+
// This 'no-' rule is a quick hack to allow pretty-expanded and no-pretty-expanded to coexist
344+
line.contains(directive) && !line.contains(&("no-".to_string() + directive))
340345
}
341346

342347
pub fn parse_name_value_directive(line: &str, directive: &str)

trunk/src/compiletest/procsrv.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@
1010

1111
#![allow(deprecated)] // for old path, for dynamic_lib
1212

13-
use std::process::{ExitStatus, Command, Child, Output, Stdio};
14-
use std::io::prelude::*;
1513
use std::dynamic_lib::DynamicLibrary;
14+
use std::io::prelude::*;
15+
use std::old_path::Path;
16+
use std::process::{ExitStatus, Command, Child, Output, Stdio};
1617

1718
fn add_target_env(cmd: &mut Command, lib_path: &str, aux_path: Option<&str>) {
1819
// Need to be sure to put both the lib_path and the aux path in the dylib

trunk/src/compiletest/runtest.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ fn run_pretty_test(config: &Config, props: &TestProps, testfile: &Path) {
245245
if !proc_res.status.success() {
246246
fatal_proc_rec("pretty-printed source does not typecheck", &proc_res);
247247
}
248-
if props.no_pretty_expanded { return }
248+
if !props.pretty_expanded { return }
249249

250250
// additionally, run `--pretty expanded` and try to build it.
251251
let proc_res = print_source(config, props, testfile, srcs[round].clone(), "expanded");
@@ -1052,22 +1052,22 @@ fn scan_char(haystack: &str, needle: char, idx: &mut uint) -> bool {
10521052
if *idx >= haystack.len() {
10531053
return false;
10541054
}
1055-
let range = haystack.char_range_at(*idx);
1056-
if range.ch != needle {
1055+
let ch = haystack.char_at(*idx);
1056+
if ch != needle {
10571057
return false;
10581058
}
1059-
*idx = range.next;
1059+
*idx += ch.len_utf8();
10601060
return true;
10611061
}
10621062

10631063
fn scan_integer(haystack: &str, idx: &mut uint) -> bool {
10641064
let mut i = *idx;
10651065
while i < haystack.len() {
1066-
let range = haystack.char_range_at(i);
1067-
if range.ch < '0' || '9' < range.ch {
1066+
let ch = haystack.char_at(i);
1067+
if ch < '0' || '9' < ch {
10681068
break;
10691069
}
1070-
i = range.next;
1070+
i += ch.len_utf8();
10711071
}
10721072
if i == *idx {
10731073
return false;
@@ -1083,9 +1083,9 @@ fn scan_string(haystack: &str, needle: &str, idx: &mut uint) -> bool {
10831083
if haystack_i >= haystack.len() {
10841084
return false;
10851085
}
1086-
let range = haystack.char_range_at(haystack_i);
1087-
haystack_i = range.next;
1088-
if !scan_char(needle, range.ch, &mut needle_i) {
1086+
let ch = haystack.char_at(haystack_i);
1087+
haystack_i += ch.len_utf8();
1088+
if !scan_char(needle, ch, &mut needle_i) {
10891089
return false;
10901090
}
10911091
}
@@ -1440,7 +1440,7 @@ fn aux_output_dir_name(config: &Config, testfile: &Path) -> PathBuf {
14401440
}
14411441

14421442
fn output_testname(testfile: &Path) -> PathBuf {
1443-
PathBuf::new(testfile.file_stem().unwrap())
1443+
PathBuf::from(testfile.file_stem().unwrap())
14441444
}
14451445

14461446
fn output_base_name(config: &Config, testfile: &Path) -> PathBuf {

trunk/src/compiletest/util.rs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,23 @@ const OS_TABLE: &'static [(&'static str, &'static str)] = &[
2525
("openbsd", "openbsd"),
2626
];
2727

28+
const ARCH_TABLE: &'static [(&'static str, &'static str)] = &[
29+
("i386", "x86"),
30+
("i686", "x86"),
31+
("amd64", "x86_64"),
32+
("x86_64", "x86_64"),
33+
("sparc", "sparc"),
34+
("powerpc", "powerpc"),
35+
("arm64", "aarch64"),
36+
("arm", "arm"),
37+
("aarch64", "aarch64"),
38+
("mips", "mips"),
39+
("xcore", "xcore"),
40+
("msp430", "msp430"),
41+
("hexagon", "hexagon"),
42+
("s390x", "systemz"),
43+
];
44+
2845
pub fn get_os(triple: &str) -> &'static str {
2946
for &(triple_os, os) in OS_TABLE {
3047
if triple.contains(triple_os) {
@@ -33,6 +50,14 @@ pub fn get_os(triple: &str) -> &'static str {
3350
}
3451
panic!("Cannot determine OS from triple");
3552
}
53+
pub fn get_arch(triple: &str) -> &'static str {
54+
for &(triple_arch, arch) in ARCH_TABLE {
55+
if triple.contains(triple_arch) {
56+
return arch
57+
}
58+
}
59+
panic!("Cannot determine Architecture from triple");
60+
}
3661

3762
pub fn make_new_path(path: &str) -> String {
3863
assert!(cfg!(windows));

trunk/src/doc/intro.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -446,16 +446,16 @@ It gives us this error:
446446
error: aborting due to previous error
447447
```
448448
449-
It mentions that "captured outer variable in an `FnMut` closure".
450-
Because we declared the closure as a moving closure, and it referred
451-
to `numbers`, the closure will try to take ownership of the
452-
vector. But the closure itself is created in a loop, and hence we will
453-
actually create three closures, one for every iteration of the
454-
loop. This means that all three of those closures would try to own
455-
`numbers`, which is impossible -- `numbers` must have just one
456-
owner. Rust detects this and gives us the error: we claim that
457-
`numbers` has ownership, but our code tries to make three owners. This
458-
may cause a safety problem, so Rust disallows it.
449+
This is a little confusing because there are two closures here: the one passed
450+
to `map`, and the one passed to `thread::scoped`. In this case, the closure for
451+
`thread::scoped` is attempting to reference `numbers`, a `Vec<i32>`. This
452+
closure is a `FnOnce` closure, as that’s what `thread::scoped` takes as an
453+
argument. `FnOnce` closures take ownership of their environment. That’s fine,
454+
but there’s one detail: because of `map`, we’re going to make three of these
455+
closures. And since all three try to take ownership of `numbers`, that would be
456+
a problem. That’s what it means by ‘cannot move out of captured outer
457+
variable’: our `thread::scoped` closure wants to take ownership, and it can’t,
458+
because the closure for `map` won’t let it.
459459
460460
What to do here? Rust has two types that helps us: `Arc<T>` and `Mutex<T>`.
461461
*Arc* stands for "atomically reference counted". In other words, an Arc will

0 commit comments

Comments
 (0)