Skip to content

Commit 8d0d8f9

Browse files
committed
---
yaml --- r: 274330 b: refs/heads/stable c: a891c72 h: refs/heads/master
1 parent 15e5a5f commit 8d0d8f9

File tree

170 files changed

+2600
-1731
lines changed

Some content is hidden

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

170 files changed

+2600
-1731
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ refs/heads/tmp: e06d2ad9fcd5027bcaac5b08fc9aa39a49d0ecd3
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: c0221c8897db309a79990367476177b1230bb264
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828
32-
refs/heads/stable: 9cfa1916fa06fa5fa809d6d7807a6f978e35c67d
32+
refs/heads/stable: a891c72976824993ecb4a8749d9f16dbeceaeeed
3333
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375
3434
refs/tags/1.1.0: bc3c16f09287e5545c1d3f76b7abd54f2eca868b
3535
refs/tags/1.2.0: f557861f822c34f07270347b94b5280de20a597e

branches/stable/CONTRIBUTING.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ links to the major sections:
66

77
* [Feature Requests](#feature-requests)
88
* [Bug Reports](#bug-reports)
9+
* [The Build System](#the-build-system)
910
* [Pull Requests](#pull-requests)
1011
* [Writing Documentation](#writing-documentation)
1112
* [Issue Triage](#issue-triage)
@@ -77,6 +78,66 @@ to do this is to invoke `rustc` like this:
7778
$ RUST_BACKTRACE=1 rustc ...
7879
```
7980

81+
## The Build System
82+
83+
Rust's build system allows you to bootstrap the compiler, run tests &
84+
benchmarks, generate documentation, install a fresh build of Rust, and more.
85+
It's your best friend when working on Rust, allowing you to compile & test
86+
your contributions before submission.
87+
88+
All the configuration for the build system lives in [the `mk` directory][mkdir]
89+
in the project root. It can be hard to follow in places, as it uses some
90+
advanced Make features which make for some challenging reading. If you have
91+
questions on the build system internals, try asking in
92+
[`#rust-internals`][pound-rust-internals].
93+
94+
[mkdir]: https://github.com/rust-lang/rust/tree/master/mk/
95+
96+
### Configuration
97+
98+
Before you can start building the compiler you need to configure the build for
99+
your system. In most cases, that will just mean using the defaults provided
100+
for Rust. Configuring involves invoking the `configure` script in the project
101+
root.
102+
103+
```
104+
./configure
105+
```
106+
107+
There are large number of options accepted by this script to alter the
108+
configuration used later in the build process. Some options to note:
109+
110+
- `--enable-debug` - Build a debug version of the compiler (disables optimizations)
111+
- `--enable-optimize` - Enable optimizations (can be used with `--enable-debug`
112+
to make a debug build with optimizations)
113+
- `--disable-valgrind-rpass` - Don't run tests with valgrind
114+
- `--enable-clang` - Prefer clang to gcc for building dependencies (e.g., LLVM)
115+
- `--enable-ccache` - Invoke clang/gcc with ccache to re-use object files between builds
116+
- `--enable-compiler-docs` - Build compiler documentation
117+
118+
To see a full list of options, run `./configure --help`.
119+
120+
### Useful Targets
121+
122+
Some common make targets are:
123+
124+
- `make rustc-stage1` - build up to (and including) the first stage. For most
125+
cases we don't need to build the stage2 compiler, so we can save time by not
126+
building it. The stage1 compiler is a fully functioning compiler and
127+
(probably) will be enough to determine if your change works as expected.
128+
- `make check` - build the full compiler & run all tests (takes a while). This
129+
is what gets run by the continuous integration system against your pull
130+
request. You should run this before submitting to make sure your tests pass
131+
& everything builds in the correct manner.
132+
- `make check-stage1-std NO_REBUILD=1` - test the standard library without
133+
rebuilding the entire compiler
134+
- `make check TESTNAME=<path-to-test-file>.rs` - Run a single test file
135+
- `make check-stage1-rpass TESTNAME=<path-to-test-file>.rs` - Run a single
136+
rpass test with the stage1 compiler (this will be quicker than running the
137+
command above as we only build the stage1 compiler, not the entire thing).
138+
You can also leave off the `-rpass` to run all stage1 test types.
139+
- `make check-stage1-coretest` - Run stage1 tests in `libcore`.
140+
80141
## Pull Requests
81142

82143
Pull requests are the primary mechanism we use to change Rust. GitHub itself

branches/stable/configure

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1051,7 +1051,7 @@ then
10511051
esac
10521052
else
10531053
case $CFG_CLANG_VERSION in
1054-
(3.2* | 3.3* | 3.4* | 3.5* | 3.6* | 3.7* | 3.8*)
1054+
(3.2* | 3.3* | 3.4* | 3.5* | 3.6* | 3.7* | 3.8* | 3.9*)
10551055
step_msg "found ok version of CLANG: $CFG_CLANG_VERSION"
10561056
;;
10571057
(*)

branches/stable/mk/target.mk

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,6 @@ export CFG_COMPILER_HOST_TRIPLE
1717
export CFG_DEFAULT_LINKER
1818
export CFG_DEFAULT_AR
1919

20-
# The standard libraries should be held up to a higher standard than any old
21-
# code, make sure that these common warnings are denied by default. These can
22-
# be overridden during development temporarily. For stage0, we allow warnings
23-
# which may be bugs in stage0 (should be fixed in stage1+)
24-
RUST_LIB_FLAGS_ST0 += -W warnings
25-
RUST_LIB_FLAGS_ST1 += -D warnings
26-
RUST_LIB_FLAGS_ST2 += -D warnings
27-
2820
# Macro that generates the full list of dependencies for a crate at a particular
2921
# stage/target/host tuple.
3022
#

branches/stable/src/doc/book/crates-and-modules.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -567,10 +567,11 @@ to it as "sayings". Similarly, the first `use` statement pulls in the
567567
`ja_greetings` as opposed to simply `greetings`. This can help to avoid
568568
ambiguity when importing similarly-named items from different places.
569569
570-
The second `use` statement uses a star glob to bring in _all_ symbols from the
571-
`sayings::japanese::farewells` module. As you can see we can later refer to
570+
The second `use` statement uses a star glob to bring in all public symbols from
571+
the `sayings::japanese::farewells` module. As you can see we can later refer to
572572
the Japanese `goodbye` function with no module qualifiers. This kind of glob
573-
should be used sparingly.
573+
should be used sparingly. It’s worth noting that it only imports the public
574+
symbols, even if the code doing the globbing is in the same module.
574575
575576
The third `use` statement bears more explanation. It's using "brace expansion"
576577
globbing to compress three `use` statements into one (this sort of syntax

branches/stable/src/doc/book/error-handling.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1512,7 +1512,7 @@ and [`rustc-serialize`](https://crates.io/crates/rustc-serialize) crates.
15121512

15131513
We're not going to spend a lot of time on setting up a project with
15141514
Cargo because it is already covered well in [the Cargo
1515-
section](../book/hello-cargo.html) and [Cargo's documentation][14].
1515+
section](getting-started.html#hello-cargo) and [Cargo's documentation][14].
15161516

15171517
To get started from scratch, run `cargo new --bin city-pop` and make sure your
15181518
`Cargo.toml` looks something like this:

branches/stable/src/doc/book/getting-started.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,10 @@ variable. If it isn't, run the installer again, select "Change" on the "Change,
167167
repair, or remove installation" page and ensure "Add to PATH" is installed on
168168
the local hard drive.
169169

170+
Rust does not do its own linking, and so you’ll need to have a linker
171+
installed. Doing so will depend on your specific system, consult its
172+
documentation for more details.
173+
170174
If not, there are a number of places where we can get help. The easiest is
171175
[the #rust IRC channel on irc.mozilla.org][irc], which we can access through
172176
[Mibbit][mibbit]. Click that link, and we'll be chatting with other Rustaceans
@@ -511,15 +515,17 @@ programming languages. For complex projects composed of multiple crates, it’s
511515
much easier to let Cargo coordinate the build. Using Cargo, you can run `cargo
512516
build`, and it should work the right way.
513517

514-
## Building for Release
518+
### Building for Release
515519

516-
When your project is finally ready for release, you can use `cargo build
520+
When your project is ready for release, you can use `cargo build
517521
--release` to compile your project with optimizations. These optimizations make
518522
your Rust code run faster, but turning them on makes your program take longer
519523
to compile. This is why there are two different profiles, one for development,
520524
and one for building the final program you’ll give to a user.
521525

522-
Running this command also causes Cargo to create a new file called
526+
### What Is That `Cargo.lock`?
527+
528+
Running `cargo build` also causes Cargo to create a new file called
523529
*Cargo.lock*, which looks like this:
524530

525531
```toml
@@ -602,11 +608,11 @@ This chapter covered the basics that will serve you well through the rest of
602608
this book, and the rest of your time with Rust. Now that you’ve got the tools
603609
down, we'll cover more about the Rust language itself.
604610

605-
You have two options: Dive into a project with ‘[Learn Rust][learnrust]’, or
611+
You have two options: Dive into a project with ‘[Tutorial: Guessing Game][guessinggame]’, or
606612
start from the bottom and work your way up with ‘[Syntax and
607613
Semantics][syntax]’. More experienced systems programmers will probably prefer
608-
Learn Rust’, while those from dynamic backgrounds may enjoy either. Different
614+
Tutorial: Guessing Game’, while those from dynamic backgrounds may enjoy either. Different
609615
people learn differently! Choose whatever’s right for you.
610616

611-
[learnrust]: learn-rust.html
617+
[guessinggame]: guessing-game.html
612618
[syntax]: syntax-and-semantics.html

branches/stable/src/doc/book/learn-rust.md

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

branches/stable/src/doc/book/loops.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ for x in 0..10 {
195195
You may also encounter situations where you have nested loops and need to
196196
specify which one your `break` or `continue` statement is for. Like most
197197
other languages, by default a `break` or `continue` will apply to innermost
198-
loop. In a situation where you would like to a `break` or `continue` for one
198+
loop. In a situation where you would like to `break` or `continue` for one
199199
of the outer loops, you can use labels to specify which loop the `break` or
200200
`continue` statement applies to. This will only print when both `x` and `y` are
201201
odd:

branches/stable/src/doc/book/macros.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -478,9 +478,9 @@ which syntactic form it matches.
478478

479479
There are additional rules regarding the next token after a metavariable:
480480

481-
* `expr` variables may only be followed by one of: `=> , ;`
482-
* `ty` and `path` variables may only be followed by one of: `=> , : = > as`
483-
* `pat` variables may only be followed by one of: `=> , = if in`
481+
* `expr` and `stmt` variables may only be followed by one of: `=> , ;`
482+
* `ty` and `path` variables may only be followed by one of: `=> , = | ; : > [ { as where`
483+
* `pat` variables may only be followed by one of: `=> , = | if in`
484484
* Other variables may be followed by any token.
485485

486486
These rules provide some flexibility for Rust’s syntax to evolve without

branches/stable/src/doc/book/syntax-index.md

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

33
## Keywords
44

5-
* `as`: primitive casting. See [Casting Between Types (`as`)].
5+
* `as`: primitive casting, or disambiguating the specific trait containing an item. See [Casting Between Types (`as`)], [Universal Function Call Syntax (Angle-bracket Form)], [Associated Types].
66
* `break`: break out of loop. See [Loops (Ending Iteration Early)].
77
* `const`: constant items and constant raw pointers. See [`const` and `static`], [Raw Pointers].
88
* `continue`: continue to next loop iteration. See [Loops (Ending Iteration Early)].
@@ -115,8 +115,11 @@
115115
* `::path`: path relative to the crate root (*i.e.* an explicitly absolute path). See [Crates and Modules (Re-exporting with `pub use`)].
116116
* `self::path`: path relative to the current module (*i.e.* an explicitly relative path). See [Crates and Modules (Re-exporting with `pub use`)].
117117
* `super::path`: path relative to the parent of the current module. See [Crates and Modules (Re-exporting with `pub use`)].
118-
* `type::ident`: associated constants, functions, and types. See [Associated Types].
118+
* `type::ident`, `<type as trait>::ident`: associated constants, functions, and types. See [Associated Types].
119119
* `<type>::…`: associated item for a type which cannot be directly named (*e.g.* `<&T>::…`, `<[T]>::…`, *etc.*). See [Associated Types].
120+
* `trait::method(…)`: disambiguating a method call by naming the trait which defines it. See [Universal Function Call Syntax].
121+
* `type::method(…)`: disambiguating a method call by naming the type for which it's defined. See [Universal Function Call Syntax].
122+
* `<type as trait>::method(…)`: disambiguating a method call by naming the trait _and_ type. See [Universal Function Call Syntax (Angle-bracket Form)].
120123

121124
<!-- Generics -->
122125

@@ -132,7 +135,8 @@
132135
<!-- Constraints -->
133136

134137
* `T: U`: generic parameter `T` constrained to types that implement `U`. See [Traits].
135-
* `T: 'a`: generic type `T` must outlive lifetime `'a`.
138+
* `T: 'a`: generic type `T` must outlive lifetime `'a`. When we say that a type 'outlives' the lifetime, we mean that it cannot transitively contain any references with lifetimes shorter than `'a`.
139+
* `T : 'static`: The generic type `T` contains no borrowed references other than `'static` ones.
136140
* `'b: 'a`: generic lifetime `'b` must outlive lifetime `'a`.
137141
* `T: ?Sized`: allow generic type parameter to be a dynamically-sized type. See [Unsized Types (`?Sized`)].
138142
* `'a + trait`, `trait + trait`: compound type constraint. See [Traits (Multiple Trait Bounds)].
@@ -234,6 +238,8 @@
234238
[Traits (`where` clause)]: traits.html#where-clause
235239
[Traits (Multiple Trait Bounds)]: traits.html#multiple-trait-bounds
236240
[Traits]: traits.html
241+
[Universal Function Call Syntax]: ufcs.html
242+
[Universal Function Call Syntax (Angle-bracket Form)]: ufcs.html#angle-bracket-form
237243
[Unsafe]: unsafe.html
238244
[Unsized Types (`?Sized`)]: unsized-types.html#sized
239245
[Variable Bindings]: variable-bindings.html

branches/stable/src/doc/reference.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2095,7 +2095,7 @@ along with their default settings. [Compiler
20952095
plugins](book/compiler-plugins.html#lint-plugins) can provide additional lint checks.
20962096

20972097
```{.ignore}
2098-
mod m1 {
2098+
pub mod m1 {
20992099
// Missing documentation is ignored here
21002100
#[allow(missing_docs)]
21012101
pub fn undocumented_one() -> i32 { 1 }
@@ -2115,9 +2115,9 @@ check on and off:
21152115

21162116
```{.ignore}
21172117
#[warn(missing_docs)]
2118-
mod m2{
2118+
pub mod m2{
21192119
#[allow(missing_docs)]
2120-
mod nested {
2120+
pub mod nested {
21212121
// Missing documentation is ignored here
21222122
pub fn undocumented_one() -> i32 { 1 }
21232123
@@ -2137,7 +2137,7 @@ that lint check:
21372137

21382138
```{.ignore}
21392139
#[forbid(missing_docs)]
2140-
mod m3 {
2140+
pub mod m3 {
21412141
// Attempting to toggle warning signals an error here
21422142
#[allow(missing_docs)]
21432143
/// Returns 2.

branches/stable/src/liballoc/boxed_test.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ use core::ops::Deref;
1515
use core::result::Result::{Ok, Err};
1616
use core::clone::Clone;
1717

18-
use std::boxed;
1918
use std::boxed::Box;
2019

2120
#[test]

branches/stable/src/liballoc/lib.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,35 +70,33 @@
7070
test(no_crate_inject, attr(allow(unused_variables), deny(warnings))))]
7171
#![no_std]
7272
#![needs_allocator]
73+
#![cfg_attr(not(stage0), deny(warnings))]
7374

7475
#![feature(allocator)]
7576
#![feature(box_syntax)]
7677
#![feature(coerce_unsized)]
78+
#![feature(const_fn)]
7779
#![feature(core_intrinsics)]
7880
#![feature(custom_attribute)]
81+
#![feature(drop_in_place)]
82+
#![feature(dropck_parametricity)]
7983
#![feature(fundamental)]
8084
#![feature(lang_items)]
85+
#![feature(needs_allocator)]
8186
#![feature(optin_builtin_traits)]
8287
#![feature(placement_in_syntax)]
83-
#![feature(placement_new_protocol)]
84-
#![feature(raw)]
8588
#![feature(shared)]
8689
#![feature(staged_api)]
8790
#![feature(unboxed_closures)]
8891
#![feature(unique)]
8992
#![feature(unsafe_no_drop_flag, filling_drop)]
90-
#![feature(dropck_parametricity)]
9193
#![feature(unsize)]
92-
#![feature(drop_in_place)]
93-
#![feature(fn_traits)]
94-
#![feature(const_fn)]
95-
96-
#![feature(needs_allocator)]
9794

9895
// Issue# 30592: Systematically use alloc_system during stage0 since jemalloc
9996
// might be unavailable or disabled
10097
#![cfg_attr(stage0, feature(alloc_system))]
10198

99+
#![cfg_attr(not(test), feature(raw, fn_traits, placement_new_protocol))]
102100
#![cfg_attr(test, feature(test, rustc_private, box_heap))]
103101

104102
#[cfg(stage0)]

branches/stable/src/liballoc_jemalloc/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
reason = "this library is unlikely to be stabilized in its current \
1717
form or name",
1818
issue = "27783")]
19+
#![cfg_attr(not(stage0), deny(warnings))]
1920
#![feature(allocator)]
2021
#![feature(libc)]
2122
#![feature(staged_api)]

branches/stable/src/liballoc_system/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#![crate_type = "rlib"]
1313
#![no_std]
1414
#![allocator]
15+
#![cfg_attr(not(stage0), deny(warnings))]
1516
#![unstable(feature = "alloc_system",
1617
reason = "this library is unlikely to be stabilized in its current \
1718
form or name",

branches/stable/src/libarena/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
2828
html_root_url = "https://doc.rust-lang.org/nightly/",
2929
test(no_crate_inject, attr(deny(warnings))))]
30+
#![cfg_attr(not(stage0), deny(warnings))]
3031

3132
#![feature(alloc)]
3233
#![feature(core_intrinsics)]

0 commit comments

Comments
 (0)