Skip to content

Commit 74dc845

Browse files
committed
Merge branch 'master' into redox
2 parents 123d08b + ac919fc commit 74dc845

File tree

299 files changed

+2972
-1276
lines changed

Some content is hidden

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

299 files changed

+2972
-1276
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ before_install:
1515
script:
1616
- docker run -v `pwd`:/build rust
1717
sh -c "
18-
./configure --enable-rustbuild --llvm-root=/usr/lib/llvm-3.7 &&
18+
./configure --enable-rustbuild --llvm-root=/usr/lib/llvm-3.7 --enable-quiet-tests &&
1919
make tidy &&
2020
make check -j4
2121
"

configure

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,11 +507,16 @@ case $CFG_CPUTYPE in
507507
CFG_CPUTYPE=arm
508508
;;
509509

510-
armv7l)
510+
armv6l)
511511
CFG_CPUTYPE=arm
512512
CFG_OSTYPE="${CFG_OSTYPE}eabihf"
513513
;;
514514

515+
armv7l)
516+
CFG_CPUTYPE=armv7
517+
CFG_OSTYPE="${CFG_OSTYPE}eabihf"
518+
;;
519+
515520
aarch64)
516521
CFG_CPUTYPE=aarch64
517522
;;
@@ -610,6 +615,7 @@ opt docs 1 "build standard library documentation"
610615
opt compiler-docs 0 "build compiler documentation"
611616
opt optimize-tests 1 "build tests with optimizations"
612617
opt debuginfo-tests 0 "build tests with debugger metadata"
618+
opt quiet-tests 0 "enable quieter output when running tests"
613619
opt libcpp 1 "build llvm with libc++ instead of libstdc++ when using clang"
614620
opt llvm-assertions 0 "build LLVM with assertions"
615621
opt debug-assertions 0 "build with debugging assertions"

src/bootstrap/check.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,10 @@ pub fn compiletest(build: &Build,
187187
cmd.arg("--verbose");
188188
}
189189

190+
if build.config.quiet_tests {
191+
cmd.arg("--quiet");
192+
}
193+
190194
// Only pass correct values for these flags for the `run-make` suite as it
191195
// requires that a C++ compiler was configured which isn't always the case.
192196
if suite == "run-make" {
@@ -277,7 +281,13 @@ fn markdown_test(build: &Build, compiler: &Compiler, markdown: &Path) {
277281
build.add_rustc_lib_path(compiler, &mut cmd);
278282
cmd.arg("--test");
279283
cmd.arg(markdown);
280-
cmd.arg("--test-args").arg(build.flags.args.join(" "));
284+
285+
let mut test_args = build.flags.args.join(" ");
286+
if build.config.quiet_tests {
287+
test_args.push_str(" --quiet");
288+
}
289+
cmd.arg("--test-args").arg(test_args);
290+
281291
build.run(&mut cmd);
282292
}
283293

@@ -367,6 +377,11 @@ pub fn krate(build: &Build,
367377
dylib_path.insert(0, build.sysroot_libdir(compiler, target));
368378
cargo.env(dylib_path_var(), env::join_paths(&dylib_path).unwrap());
369379

380+
if build.config.quiet_tests {
381+
cargo.arg("--");
382+
cargo.arg("--quiet");
383+
}
384+
370385
if target.contains("android") {
371386
build.run(cargo.arg("--no-run"));
372387
krate_android(build, compiler, target, mode);

src/bootstrap/config.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ pub struct Config {
7777

7878
// misc
7979
pub channel: String,
80+
pub quiet_tests: bool,
8081
// Fallback musl-root for all targets
8182
pub musl_root: Option<PathBuf>,
8283
pub prefix: Option<String>,
@@ -338,6 +339,7 @@ impl Config {
338339
("RPATH", self.rust_rpath),
339340
("OPTIMIZE_TESTS", self.rust_optimize_tests),
340341
("DEBUGINFO_TESTS", self.rust_debuginfo_tests),
342+
("QUIET_TESTS", self.quiet_tests),
341343
("LOCAL_REBUILD", self.local_rebuild),
342344
("NINJA", self.ninja),
343345
("CODEGEN_TESTS", self.codegen_tests),

src/doc/book/closures.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -510,12 +510,11 @@ fn factory() -> Box<Fn(i32) -> i32> {
510510
511511
Box::new(|x| x + num)
512512
}
513-
# fn main() {
513+
514514
let f = factory();
515515
516516
let answer = f(1);
517517
assert_eq!(6, answer);
518-
# }
519518
```
520519

521520
There’s just one last problem:
@@ -540,12 +539,11 @@ fn factory() -> Box<Fn(i32) -> i32> {
540539

541540
Box::new(move |x| x + num)
542541
}
543-
fn main() {
542+
544543
let f = factory();
545544

546545
let answer = f(1);
547546
assert_eq!(6, answer);
548-
}
549547
```
550548

551549
By making the inner closure a `move Fn`, we create a new stack frame for our

src/doc/book/guessing-game.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,6 @@ numbers. A bare number like above is actually shorthand for `^0.3.0`,
362362
meaning "anything compatible with 0.3.0".
363363
If we wanted to use only `0.3.0` exactly, we could say `rand="=0.3.0"`
364364
(note the two equal signs).
365-
And if we wanted to use the latest version we could use `rand="*"`.
366365
We could also use a range of versions.
367366
[Cargo’s documentation][cargodoc] contains more details.
368367

src/doc/book/testing.md

Lines changed: 39 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,11 @@ Cargo will automatically generate a simple test when you make a new project.
2424
Here's the contents of `src/lib.rs`:
2525

2626
```rust
27-
# fn main() {}
28-
#[test]
29-
fn it_works() {
27+
#[cfg(test)]
28+
mod tests {
29+
#[test]
30+
fn it_works() {
31+
}
3032
}
3133
```
3234

@@ -36,11 +38,11 @@ currently has no body. That's good enough to pass! We can run the tests with
3638

3739
```bash
3840
$ cargo test
39-
Compiling adder v0.0.1 (file:///home/you/projects/adder)
40-
Running target/adder-91b3e234d4ed382a
41+
Compiling adder v0.1.0 (file:///home/you/projects/adder)
42+
Running target/debug/deps/adder-91b3e234d4ed382a
4143

4244
running 1 test
43-
test it_works ... ok
45+
test tests::it_works ... ok
4446

4547
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
4648

@@ -56,7 +58,7 @@ for the test we wrote, and another for documentation tests. We'll talk about
5658
those later. For now, see this line:
5759

5860
```text
59-
test it_works ... ok
61+
test tests::it_works ... ok
6062
```
6163

6264
Note the `it_works`. This comes from the name of our function:
@@ -89,31 +91,30 @@ run our tests again:
8991

9092
```bash
9193
$ cargo test
92-
Compiling adder v0.0.1 (file:///home/you/projects/adder)
93-
Running target/adder-91b3e234d4ed382a
94+
Compiling adder v0.1.0 (file:///home/you/projects/adder)
95+
Running target/debug/deps/adder-91b3e234d4ed382a
9496

9597
running 1 test
96-
test it_works ... FAILED
98+
test tests::it_works ... FAILED
9799

98100
failures:
99101

100-
---- it_works stdout ----
101-
thread 'it_works' panicked at 'assertion failed: false', /home/steve/tmp/adder/src/lib.rs:3
102-
102+
---- test::it_works stdout ----
103+
thread 'tests::it_works' panicked at 'assertion failed: false', src/lib.rs:5
103104

104105

105106
failures:
106-
it_works
107+
tests::it_works
107108

108109
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured
109110

110-
thread 'main' panicked at 'Some tests failed', /home/steve/src/rust/src/libtest/lib.rs:247
111+
error: test failed
111112
```
112113

113114
Rust indicates that our test failed:
114115

115116
```text
116-
test it_works ... FAILED
117+
test tests::it_works ... FAILED
117118
```
118119

119120
And that's reflected in the summary line:
@@ -159,11 +160,11 @@ This test will now succeed if we `panic!` and fail if we complete. Let's try it:
159160

160161
```bash
161162
$ cargo test
162-
Compiling adder v0.0.1 (file:///home/you/projects/adder)
163-
Running target/adder-91b3e234d4ed382a
163+
Compiling adder v0.1.0 (file:///home/you/projects/adder)
164+
Running target/debug/deps/adder-91b3e234d4ed382a
164165

165166
running 1 test
166-
test it_works ... ok
167+
test tests::it_works ... ok
167168

168169
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
169170

@@ -191,11 +192,11 @@ passes:
191192

192193
```bash
193194
$ cargo test
194-
Compiling adder v0.0.1 (file:///home/you/projects/adder)
195-
Running target/adder-91b3e234d4ed382a
195+
Compiling adder v0.1.0 (file:///home/you/projects/adder)
196+
Running target/debug/deps/adder-91b3e234d4ed382a
196197

197198
running 1 test
198-
test it_works ... ok
199+
test tests::it_works ... ok
199200

200201
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
201202

@@ -262,8 +263,8 @@ not:
262263

263264
```bash
264265
$ cargo test
265-
Compiling adder v0.0.1 (file:///home/you/projects/adder)
266-
Running target/adder-91b3e234d4ed382a
266+
Compiling adder v0.1.0 (file:///home/you/projects/adder)
267+
Running target/debug/deps/adder-91b3e234d4ed382a
267268

268269
running 2 tests
269270
test expensive_test ... ignored
@@ -282,7 +283,7 @@ The expensive tests can be run explicitly using `cargo test -- --ignored`:
282283

283284
```bash
284285
$ cargo test -- --ignored
285-
Running target/adder-91b3e234d4ed382a
286+
Running target/debug/deps/adder-91b3e234d4ed382a
286287

287288
running 1 test
288289
test expensive_test ... ok
@@ -302,8 +303,11 @@ which is why the command is `cargo test -- --ignored`.
302303
# The `tests` module
303304

304305
There is one way in which our existing example is not idiomatic: it's
305-
missing the `tests` module. The idiomatic way of writing our example
306-
looks like this:
306+
missing the `tests` module. You might have noticed this test module was
307+
present in the code that was initially generated with `cargo new` but
308+
was missing from our last example. Let's explain what this does.
309+
310+
The idiomatic way of writing our example looks like this:
307311

308312
```rust,ignore
309313
# fn main() {}
@@ -356,8 +360,8 @@ Note the different `use` line. Now we run our tests:
356360
```bash
357361
$ cargo test
358362
Updating registry `https://github.com/rust-lang/crates.io-index`
359-
Compiling adder v0.0.1 (file:///home/you/projects/adder)
360-
Running target/adder-91b3e234d4ed382a
363+
Compiling adder v0.1.0 (file:///home/you/projects/adder)
364+
Running target/debug/deps/adder-91b3e234d4ed382a
361365

362366
running 1 test
363367
test tests::it_works ... ok
@@ -404,15 +408,15 @@ Let's run them:
404408

405409
```bash
406410
$ cargo test
407-
Compiling adder v0.0.1 (file:///home/you/projects/adder)
408-
Running target/adder-91b3e234d4ed382a
411+
Compiling adder v0.1.0 (file:///home/you/projects/adder)
412+
Running target/debug/deps/adder-91b3e234d4ed382a
409413

410414
running 1 test
411415
test tests::it_works ... ok
412416

413417
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
414418

415-
Running target/lib-c18e7d3494509e74
419+
Running target/debug/integration_test-68064b69521c828a
416420

417421
running 1 test
418422
test it_works ... ok
@@ -490,15 +494,15 @@ Let's run the tests again:
490494

491495
```bash
492496
$ cargo test
493-
Compiling adder v0.0.1 (file:///home/steve/tmp/adder)
494-
Running target/adder-91b3e234d4ed382a
497+
Compiling adder v0.1.0. (file:///home/you/projects/adder)
498+
Running target/debug/deps/adder-91b3e234d4ed382a
495499

496500
running 1 test
497501
test tests::it_works ... ok
498502

499503
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
500504

501-
Running target/lib-c18e7d3494509e74
505+
Running target/debug/integration_test-68064b69521c828a
502506

503507
running 1 test
504508
test it_works ... ok

src/libcollections/slice.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1170,7 +1170,7 @@ impl<T> [T] {
11701170
/// let x = s.into_vec();
11711171
/// // `s` cannot be used anymore because it has been converted into `x`.
11721172
///
1173-
/// assert_eq!(x, vec!(10, 40, 30));
1173+
/// assert_eq!(x, vec![10, 40, 30]);
11741174
/// ```
11751175
#[stable(feature = "rust1", since = "1.0.0")]
11761176
#[inline]

src/libcollections/vec.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,15 +148,15 @@ use super::range::RangeArgument;
148148
/// [`Index`] trait. An example will be more explicit:
149149
///
150150
/// ```
151-
/// let v = vec!(0, 2, 4, 6);
151+
/// let v = vec![0, 2, 4, 6];
152152
/// println!("{}", v[1]); // it will display '2'
153153
/// ```
154154
///
155155
/// However be careful: if you try to access an index which isn't in the `Vec`,
156156
/// your software will panic! You cannot do this:
157157
///
158158
/// ```ignore
159-
/// let v = vec!(0, 2, 4, 6);
159+
/// let v = vec![0, 2, 4, 6];
160160
/// println!("{}", v[6]); // it will panic!
161161
/// ```
162162
///
@@ -173,7 +173,7 @@ use super::range::RangeArgument;
173173
/// // ...
174174
/// }
175175
///
176-
/// let v = vec!(0, 1);
176+
/// let v = vec![0, 1];
177177
/// read_slice(&v);
178178
///
179179
/// // ... and that's all!

0 commit comments

Comments
 (0)