Skip to content

Commit 57ddd6b

Browse files
committed
Update rustc
2 parents dfddfa7 + 95272a0 commit 57ddd6b

File tree

964 files changed

+26842
-12743
lines changed

Some content is hidden

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

964 files changed

+26842
-12743
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,3 +103,6 @@ version.texi
103103
.cargo
104104
!src/vendor/**
105105
/src/target/
106+
107+
no_llvm_build
108+

.travis.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ matrix:
1212
fast_finish: true
1313
include:
1414
# Images used in testing PR and try-build should be run first.
15-
- env: IMAGE=x86_64-gnu-llvm-3.7 RUST_BACKTRACE=1
15+
- env: IMAGE=x86_64-gnu-llvm-3.9 RUST_BACKTRACE=1
1616
if: type = pull_request OR branch = auto
1717

1818
- env: IMAGE=dist-x86_64-linux DEPLOY=1
@@ -36,7 +36,7 @@ matrix:
3636
NO_LLVM_ASSERTIONS=1
3737
NO_DEBUG_ASSERTIONS=1
3838
os: osx
39-
osx_image: xcode7
39+
osx_image: xcode7.3
4040
if: branch = auto
4141
4242
# macOS builders. These are placed near the beginning because they are very
@@ -57,7 +57,7 @@ matrix:
5757
NO_LLVM_ASSERTIONS=1
5858
NO_DEBUG_ASSERTIONS=1
5959
os: osx
60-
osx_image: xcode8.2
60+
osx_image: xcode8.3
6161
if: branch = auto
6262
6363
- env: >
@@ -71,7 +71,7 @@ matrix:
7171
NO_LLVM_ASSERTIONS=1
7272
NO_DEBUG_ASSERTIONS=1
7373
os: osx
74-
osx_image: xcode8.2
74+
osx_image: xcode8.3
7575
if: branch = auto
7676
7777
# OSX builders producing releases. These do not run the full test suite and
@@ -91,7 +91,7 @@ matrix:
9191
NO_LLVM_ASSERTIONS=1
9292
NO_DEBUG_ASSERTIONS=1
9393
os: osx
94-
osx_image: xcode7
94+
osx_image: xcode7.3
9595
if: branch = auto
9696
9797
- env: >
@@ -105,7 +105,7 @@ matrix:
105105
NO_LLVM_ASSERTIONS=1
106106
NO_DEBUG_ASSERTIONS=1
107107
os: osx
108-
osx_image: xcode7
108+
osx_image: xcode7.3
109109
if: branch = auto
110110
111111
# Linux builders, remaining docker images
@@ -115,6 +115,8 @@ matrix:
115115
if: branch = auto
116116
- env: IMAGE=cross DEPLOY=1
117117
if: branch = auto
118+
- env: IMAGE=cross2 DEPLOY=1
119+
if: branch = auto
118120
- env: IMAGE=dist-aarch64-linux DEPLOY=1
119121
if: branch = auto
120122
- env: IMAGE=dist-android DEPLOY=1
@@ -125,8 +127,6 @@ matrix:
125127
if: branch = auto
126128
- env: IMAGE=dist-armv7-linux DEPLOY=1
127129
if: branch = auto
128-
- env: IMAGE=dist-fuchsia DEPLOY=1
129-
if: branch = auto
130130
- env: IMAGE=dist-i586-gnu-i686-musl DEPLOY=1
131131
if: branch = auto
132132
- env: IMAGE=dist-i686-freebsd DEPLOY=1

CONTRIBUTING.md

Lines changed: 140 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Contributing to Rust
2+
[contributing-to-rust]: #contributing-to-rust
23

34
Thank you for your interest in contributing to Rust! There are many ways to
45
contribute, and we appreciate all of them. This document is a bit long, so here's
@@ -18,18 +19,20 @@ hop on [#rust-internals][pound-rust-internals].
1819

1920
As a reminder, all contributors are expected to follow our [Code of Conduct][coc].
2021

21-
[pound-rust-internals]: http://chat.mibbit.com/?server=irc.mozilla.org&channel=%23rust-internals
22+
[pound-rust-internals]: https://chat.mibbit.com/?server=irc.mozilla.org&channel=%23rust-internals
2223
[internals]: https://internals.rust-lang.org
2324
[coc]: https://www.rust-lang.org/conduct.html
2425

2526
## Feature Requests
27+
[feature-requests]: #feature-requests
2628

2729
To request a change to the way that the Rust language works, please open an
2830
issue in the [RFCs repository](https://github.com/rust-lang/rfcs/issues/new)
2931
rather than this one. New features and other significant language changes
3032
must go through the RFC process.
3133

3234
## Bug Reports
35+
[bug-reports]: #bug-reports
3336

3437
While bugs are unfortunate, they're a reality in software. We can't fix what we
3538
don't know about, so please report liberally. If you're not sure if something
@@ -80,6 +83,7 @@ $ RUST_BACKTRACE=1 rustc ...
8083
```
8184

8285
## The Build System
86+
[the-build-system]: #the-build-system
8387

8488
Rust's build system allows you to bootstrap the compiler, run tests &
8589
benchmarks, generate documentation, install a fresh build of Rust, and more.
@@ -94,6 +98,7 @@ system internals, try asking in [`#rust-internals`][pound-rust-internals].
9498
[bootstrap]: https://github.com/rust-lang/rust/tree/master/src/bootstrap/
9599

96100
### Configuration
101+
[configuration]: #configuration
97102

98103
Before you can start building the compiler you need to configure the build for
99104
your system. In most cases, that will just mean using the defaults provided
@@ -125,6 +130,11 @@ file. If you still have a `config.mk` file in your directory - from
125130
`./configure` - you may need to delete it for `config.toml` to work.
126131

127132
### Building
133+
[building]: #building
134+
135+
Dependencies
136+
- [build dependencies](README.md#building-from-source)
137+
- `gdb` 6.2.0 minimum, 7.1 or later recommended for test builds
128138

129139
The build system uses the `x.py` script to control the build process. This script
130140
is used to build, test, and document various parts of the compiler. You can
@@ -194,6 +204,7 @@ Note: Previously `./configure` and `make` were used to build this project.
194204
They are still available, but `x.py` is the recommended build system.
195205

196206
### Useful commands
207+
[useful-commands]: #useful-commands
197208

198209
Some common invocations of `x.py` are:
199210

@@ -234,6 +245,7 @@ Some common invocations of `x.py` are:
234245
code.
235246

236247
### Using your local build
248+
[using-local-build]: #using-local-build
237249

238250
If you use Rustup to manage your rust install, it has a feature called ["custom
239251
toolchains"][toolchain-link] that you can use to access your newly-built compiler
@@ -262,6 +274,7 @@ stage 1. `python x.py build --stage 1 src/libstd src/tools/rustdoc` will build
262274
rustdoc and libstd, which will allow rustdoc to be run with that toolchain.)
263275

264276
## Pull Requests
277+
[pull-requests]: #pull-requests
265278

266279
Pull requests are the primary mechanism we use to change Rust. GitHub itself
267280
has some [great documentation][pull-requests] on using the Pull Request feature.
@@ -326,32 +339,144 @@ it can be found
326339
[here](https://github.com/rust-lang/rust-wiki-backup/blob/master/Note-testsuite.md).
327340

328341
### External Dependencies
342+
[external-dependencies]: #external-dependencies
329343

330344
Currently building Rust will also build the following external projects:
331345

332346
* [clippy](https://github.com/rust-lang-nursery/rust-clippy)
347+
* [miri](https://github.com/solson/miri)
333348

334349
If your changes break one of these projects, you need to fix them by opening
335-
a pull request against the broken project. When you have opened a pull request,
336-
you can point the submodule at your pull request by calling
350+
a pull request against the broken project asking to put the fix on a branch.
351+
Then you can disable the tool building via `src/tools/toolstate.toml`.
352+
Once the branch containing your fix is likely to be merged, you can point
353+
the affected submodule at this branch.
354+
355+
Don't forget to also add your changes with
337356

338357
```
339-
git fetch origin pull/$id_of_your_pr/head:my_pr
340-
git checkout my_pr
358+
git add path/to/submodule
341359
```
342360

343-
within the submodule's directory. Don't forget to also add your changes with
361+
outside the submodule.
344362

363+
In order to prepare your PR, you can run the build locally by doing
364+
`./x.py build src/tools/TOOL`. If you will be editing the sources
365+
there, you may wish to set `submodules = false` in the `config.toml`
366+
to prevent `x.py` from resetting to the original branch.
367+
368+
#### Breaking Tools Built With The Compiler
369+
[breaking-tools-built-with-the-compiler]: #breaking-tools-built-with-the-compiler
370+
371+
Rust's build system builds a number of tools that make use of the
372+
internals of the compiler. This includes clippy,
373+
[RLS](https://github.com/rust-lang-nursery/rls) and
374+
[rustfmt](https://github.com/rust-lang-nursery/rustfmt). If these tools
375+
break because of your changes, you may run into a sort of "chicken and egg"
376+
problem. These tools rely on the latest compiler to be built so you can't update
377+
them to reflect your changes to the compiler until those changes are merged into
378+
the compiler. At the same time, you can't get your changes merged into the compiler
379+
because the rust-lang/rust build won't pass until those tools build and pass their
380+
tests.
381+
382+
That means that, in the default state, you can't update the compiler without first
383+
fixing rustfmt, rls and the other tools that the compiler builds.
384+
385+
Luckily, a feature was [added to Rust's build](https://github.com/rust-lang/rust/pull/45243)
386+
to make all of this easy to handle. The idea is that you mark the tools as "broken",
387+
so that the rust-lang/rust build passes without trying to build them, then land the change
388+
in the compiler, wait for a nightly, and go update the tools that you broke. Once you're done
389+
and the tools are working again, you go back in the compiler and change the tools back
390+
from "broken".
391+
392+
This should avoid a bunch of synchronization dances and is also much easier on contributors as
393+
there's no need to block on rls/rustfmt/other tools changes going upstream.
394+
395+
Here are those same steps in detail:
396+
397+
1. (optional) First, if it doesn't exist already, create a `config.toml` by copying
398+
`config.toml.example` in the root directory of the Rust repository.
399+
Set `submodules = false` in the `[build]` section. This will prevent `x.py`
400+
from resetting to the original branch after you make your changes. If you
401+
need to [update any submodules to their latest versions][updating-submodules],
402+
see the section of this file about that for more information.
403+
2. (optional) Run `./x.py test src/tools/rustfmt` (substituting the submodule
404+
that broke for `rustfmt`). Fix any errors in the submodule (and possibly others).
405+
3. (optional) Make commits for your changes and send them to upstream repositories as a PR.
406+
4. (optional) Maintainers of these submodules will **not** merge the PR. The PR can't be
407+
merged because CI will be broken. You'll want to write a message on the PR referencing
408+
your change, and how the PR should be merged once your change makes it into a nightly.
409+
5. Update `src/tools/toolstate.toml` to indicate that the tool in question is "broken",
410+
that will disable building it on CI. See the documentation in that file for the exact
411+
configuration values you can use.
412+
6. Commit the changes to `src/tools/toolstate.toml`, **do not update submodules in your commit**,
413+
and then update the PR you have for rust-lang/rust.
414+
7. Wait for your PR to merge.
415+
8. Wait for a nightly
416+
9. (optional) Help land your PR on the upstream repository now that your changes are in nightly.
417+
10. (optional) Send a PR to rust-lang/rust updating the submodule, reverting `src/tools/toolstate.toml` back to a "building" or "testing" state.
418+
419+
#### Updating submodules
420+
[updating-submodules]: #updating-submodules
421+
422+
These instructions are specific to updating `rustfmt`, however they may apply
423+
to the other submodules as well. Please help by improving these instructions
424+
if you find any discrepencies or special cases that need to be addressed.
425+
426+
To update the `rustfmt` submodule, start by running the appropriate
427+
[`git submodule` command](https://git-scm.com/book/en/v2/Git-Tools-Submodules).
428+
For example, to update to the latest commit on the remote master branch,
429+
you may want to run:
345430
```
346-
git add path/to/submodule
431+
git submodule update --remote src/tools/rustfmt
347432
```
433+
If you run `./x.py build` now, and you are lucky, it may just work. If you see
434+
an error message about patches that did not resolve to any crates, you will need
435+
to complete a few more steps which are outlined with their rationale below.
348436

349-
outside the submodule.
437+
*(This error may change in the future to include more information.)*
438+
```
439+
error: failed to resolve patches for `https://github.com/rust-lang-nursery/rustfmt`
440+
441+
Caused by:
442+
patch for `rustfmt-nightly` in `https://github.com/rust-lang-nursery/rustfmt` did not resolve to any crates
443+
failed to run: ~/rust/build/x86_64-unknown-linux-gnu/stage0/bin/cargo build --manifest-path ~/rust/src/bootstrap/Cargo.toml
444+
```
445+
446+
If you haven't used the `[patch]`
447+
section of `Cargo.toml` before, there is [some relevant documentation about it
448+
in the cargo docs](http://doc.crates.io/manifest.html#the-patch-section). In
449+
addition to that, you should read the
450+
[Overriding dependencies](http://doc.crates.io/specifying-dependencies.html#overriding-dependencies)
451+
section of the documentation as well.
452+
453+
Specifically, the following [section in Overriding dependencies](http://doc.crates.io/specifying-dependencies.html#testing-a-bugfix) reveals what the problem is:
454+
455+
> Next up we need to ensure that our lock file is updated to use this new version of uuid so our project uses the locally checked out copy instead of one from crates.io. The way [patch] works is that it'll load the dependency at ../path/to/uuid and then whenever crates.io is queried for versions of uuid it'll also return the local version.
456+
>
457+
> This means that the version number of the local checkout is significant and will affect whether the patch is used. Our manifest declared uuid = "1.0" which means we'll only resolve to >= 1.0.0, < 2.0.0, and Cargo's greedy resolution algorithm also means that we'll resolve to the maximum version within that range. Typically this doesn't matter as the version of the git repository will already be greater or match the maximum version published on crates.io, but it's important to keep this in mind!
458+
459+
This says that when we updated the submodule, the version number in our
460+
`src/tools/rustfmt/Cargo.toml` changed. The new version is different from
461+
the version in `Cargo.lock`, so the build can no longer continue.
462+
463+
To resolve this, we need to update `Cargo.lock`. Luckily, cargo provides a
464+
command to do this easily.
465+
466+
First, go into the `src/` directory since that is where `Cargo.toml` is in
467+
the rust repository. Then run, `cargo update -p rustfmt-nightly` to solve
468+
the problem.
469+
470+
```
471+
$ cd src
472+
$ cargo update -p rustfmt-nightly
473+
```
350474

351-
It can also be more convenient during development to set `submodules = false`
352-
in the `config.toml` to prevent `x.py` from resetting to the original branch.
475+
This should change the version listed in `src/Cargo.lock` to the new version you updated
476+
the submodule to. Running `./x.py build` should work now.
353477

354478
## Writing Documentation
479+
[writing-documentation]: #writing-documentation
355480

356481
Documentation improvements are very welcome. The source of `doc.rust-lang.org`
357482
is located in `src/doc` in the tree, and standard API documentation is generated
@@ -382,6 +507,7 @@ reference to `doc/reference.html`. The CSS might be messed up, but you can
382507
verify that the HTML is right.
383508

384509
## Issue Triage
510+
[issue-triage]: #issue-triage
385511

386512
Sometimes, an issue will stay open, even though the bug has been fixed. And
387513
sometimes, the original bug may go stale because something has changed in the
@@ -449,6 +575,7 @@ If you're looking for somewhere to start, check out the [E-easy][eeasy] tag.
449575
[rfcbot]: https://github.com/dikaiosune/rust-dashboard/blob/master/RFCBOT.md
450576

451577
## Out-of-tree Contributions
578+
[out-of-tree-contributions]: #out-of-tree-contributions
452579

453580
There are a number of other ways to contribute to Rust that don't deal with
454581
this repository.
@@ -468,11 +595,13 @@ valuable!
468595
[community-library]: https://github.com/rust-lang/rfcs/labels/A-community-library
469596

470597
## Helpful Links and Information
598+
[helpful-info]: #helpful-info
471599

472600
For people new to Rust, and just starting to contribute, or even for
473601
more seasoned developers, some useful places to look for information
474602
are:
475603

604+
* [Rust Forge][rustforge] contains additional documentation, including write-ups of how to achieve common tasks
476605
* The [Rust Internals forum][rif], a place to ask questions and
477606
discuss Rust's internals
478607
* The [generated documentation for rust's compiler][gdfrustc]
@@ -488,6 +617,7 @@ are:
488617
[gsearchdocs]: https://www.google.com/search?q=site:doc.rust-lang.org+your+query+here
489618
[rif]: http://internals.rust-lang.org
490619
[rr]: https://doc.rust-lang.org/book/README.html
620+
[rustforge]: https://forge.rust-lang.org/
491621
[tlgba]: http://tomlee.co/2014/04/a-more-detailed-tour-of-the-rust-compiler/
492622
[ro]: http://www.rustaceans.org/
493623
[rctd]: ./src/test/COMPILER_TESTS.md

0 commit comments

Comments
 (0)