mirror of
https://git.proxmox.com/git/rustc
synced 2025-08-16 02:31:13 +00:00
New upstream version 1.38.0+dfsg1
This commit is contained in:
parent
dc9dc13558
commit
416331ca66
@ -179,7 +179,6 @@ Speaking of tests, Rust has a comprehensive test suite. More information about
|
|||||||
it can be found [here][rctd].
|
it can be found [here][rctd].
|
||||||
|
|
||||||
### External Dependencies
|
### External Dependencies
|
||||||
[external-dependencies]: #external-dependencies
|
|
||||||
|
|
||||||
Currently building Rust will also build the following external projects:
|
Currently building Rust will also build the following external projects:
|
||||||
|
|
||||||
@ -209,7 +208,6 @@ Breakage is not allowed in the beta and stable channels, and must be addressed
|
|||||||
before the PR is merged.
|
before the PR is merged.
|
||||||
|
|
||||||
#### Breaking Tools Built With The Compiler
|
#### Breaking Tools Built With The Compiler
|
||||||
[breaking-tools-built-with-the-compiler]: #breaking-tools-built-with-the-compiler
|
|
||||||
|
|
||||||
Rust's build system builds a number of tools that make use of the
|
Rust's build system builds a number of tools that make use of the
|
||||||
internals of the compiler. This includes
|
internals of the compiler. This includes
|
||||||
@ -242,7 +240,7 @@ Here are those same steps in detail:
|
|||||||
`config.toml.example` in the root directory of the Rust repository.
|
`config.toml.example` in the root directory of the Rust repository.
|
||||||
Set `submodules = false` in the `[build]` section. This will prevent `x.py`
|
Set `submodules = false` in the `[build]` section. This will prevent `x.py`
|
||||||
from resetting to the original branch after you make your changes. If you
|
from resetting to the original branch after you make your changes. If you
|
||||||
need to [update any submodules to their latest versions][updating-submodules],
|
need to [update any submodules to their latest versions](#updating-submodules),
|
||||||
see the section of this file about that for more information.
|
see the section of this file about that for more information.
|
||||||
2. (optional) Run `./x.py test src/tools/rustfmt` (substituting the submodule
|
2. (optional) Run `./x.py test src/tools/rustfmt` (substituting the submodule
|
||||||
that broke for `rustfmt`). Fix any errors in the submodule (and possibly others).
|
that broke for `rustfmt`). Fix any errors in the submodule (and possibly others).
|
||||||
@ -256,7 +254,6 @@ Here are those same steps in detail:
|
|||||||
8. (optional) Send a PR to rust-lang/rust updating the submodule.
|
8. (optional) Send a PR to rust-lang/rust updating the submodule.
|
||||||
|
|
||||||
#### Updating submodules
|
#### Updating submodules
|
||||||
[updating-submodules]: #updating-submodules
|
|
||||||
|
|
||||||
These instructions are specific to updating `rustfmt`, however they may apply
|
These instructions are specific to updating `rustfmt`, however they may apply
|
||||||
to the other submodules as well. Please help by improving these instructions
|
to the other submodules as well. Please help by improving these instructions
|
||||||
@ -310,7 +307,6 @@ This should change the version listed in `Cargo.lock` to the new version you upd
|
|||||||
the submodule to. Running `./x.py build` should work now.
|
the submodule to. Running `./x.py build` should work now.
|
||||||
|
|
||||||
## Writing Documentation
|
## Writing Documentation
|
||||||
[writing-documentation]: #writing-documentation
|
|
||||||
|
|
||||||
Documentation improvements are very welcome. The source of `doc.rust-lang.org`
|
Documentation improvements are very welcome. The source of `doc.rust-lang.org`
|
||||||
is located in `src/doc` in the tree, and standard API documentation is generated
|
is located in `src/doc` in the tree, and standard API documentation is generated
|
||||||
@ -337,7 +333,6 @@ tracker in that repo is also a great way to find things that need doing. There
|
|||||||
are issues for beginners and advanced compiler devs alike!
|
are issues for beginners and advanced compiler devs alike!
|
||||||
|
|
||||||
## Issue Triage
|
## Issue Triage
|
||||||
[issue-triage]: #issue-triage
|
|
||||||
|
|
||||||
Sometimes, an issue will stay open, even though the bug has been fixed. And
|
Sometimes, an issue will stay open, even though the bug has been fixed. And
|
||||||
sometimes, the original bug may go stale because something has changed in the
|
sometimes, the original bug may go stale because something has changed in the
|
||||||
@ -405,7 +400,6 @@ If you're looking for somewhere to start, check out the [E-easy][eeasy] tag.
|
|||||||
[rfcbot]: https://github.com/anp/rfcbot-rs/
|
[rfcbot]: https://github.com/anp/rfcbot-rs/
|
||||||
|
|
||||||
## Out-of-tree Contributions
|
## Out-of-tree Contributions
|
||||||
[out-of-tree-contributions]: #out-of-tree-contributions
|
|
||||||
|
|
||||||
There are a number of other ways to contribute to Rust that don't deal with
|
There are a number of other ways to contribute to Rust that don't deal with
|
||||||
this repository.
|
this repository.
|
||||||
@ -425,7 +419,6 @@ valuable!
|
|||||||
[community-library]: https://github.com/rust-lang/rfcs/labels/A-community-library
|
[community-library]: https://github.com/rust-lang/rfcs/labels/A-community-library
|
||||||
|
|
||||||
## Helpful Links and Information
|
## Helpful Links and Information
|
||||||
[helpful-info]: #helpful-info
|
|
||||||
|
|
||||||
For people new to Rust, and just starting to contribute, or even for
|
For people new to Rust, and just starting to contribute, or even for
|
||||||
more seasoned developers, some useful places to look for information
|
more seasoned developers, some useful places to look for information
|
||||||
|
1442
Cargo.lock
generated
1442
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
80
README.md
80
README.md
@ -6,7 +6,6 @@ standard library, and documentation.
|
|||||||
[Rust]: https://www.rust-lang.org
|
[Rust]: https://www.rust-lang.org
|
||||||
|
|
||||||
## Quick Start
|
## Quick Start
|
||||||
[quick-start]: #quick-start
|
|
||||||
|
|
||||||
Read ["Installation"] from [The Book].
|
Read ["Installation"] from [The Book].
|
||||||
|
|
||||||
@ -14,11 +13,15 @@ Read ["Installation"] from [The Book].
|
|||||||
[The Book]: https://doc.rust-lang.org/book/index.html
|
[The Book]: https://doc.rust-lang.org/book/index.html
|
||||||
|
|
||||||
## Installing from Source
|
## Installing from Source
|
||||||
[building-from-source]: #building-from-source
|
|
||||||
|
|
||||||
_Note: If you wish to contribute to the compiler, you should read
|
_Note: If you wish to contribute to the compiler, you should read [this
|
||||||
[this chapter](https://rust-lang.github.io/rustc-guide/how-to-build-and-run.html)
|
chapter][rustcguidebuild] of the rustc-guide instead of this section._
|
||||||
of the rustc-guide instead._
|
|
||||||
|
The Rust build system has a Python script called `x.py` to bootstrap building
|
||||||
|
the compiler. More information about it may be found by running `./x.py --help`
|
||||||
|
or reading the [rustc guide][rustcguidebuild].
|
||||||
|
|
||||||
|
[rustcguidebuild]: https://rust-lang.github.io/rustc-guide/how-to-build-and-run.html
|
||||||
|
|
||||||
### Building on *nix
|
### Building on *nix
|
||||||
1. Make sure you have installed the dependencies:
|
1. Make sure you have installed the dependencies:
|
||||||
@ -39,43 +42,36 @@ of the rustc-guide instead._
|
|||||||
|
|
||||||
[source]: https://github.com/rust-lang/rust
|
[source]: https://github.com/rust-lang/rust
|
||||||
|
|
||||||
3. Build and install:
|
3. Configure the build settings:
|
||||||
|
|
||||||
|
The Rust build system uses a file named `config.toml` in the root of the
|
||||||
|
source tree to determine various configuration settings for the build.
|
||||||
|
Copy the default `config.toml.example` to `config.toml` to get started.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ ./x.py build && sudo ./x.py install
|
$ cp config.toml.example config.toml
|
||||||
```
|
```
|
||||||
|
|
||||||
If after running `sudo ./x.py install` you see an error message like
|
It is recommended that if you plan to use the Rust build system to create
|
||||||
|
an installation (using `./x.py install`) that you set the `prefix` value
|
||||||
|
in the `[install]` section to a directory that you have write permissions.
|
||||||
|
|
||||||
```
|
4. Build and install:
|
||||||
error: failed to load source for a dependency on 'cc'
|
|
||||||
|
```sh
|
||||||
|
$ ./x.py build && ./x.py install
|
||||||
```
|
```
|
||||||
|
|
||||||
then run these two commands and then try `sudo ./x.py install` again:
|
When complete, `./x.py install` will place several programs into
|
||||||
|
`$PREFIX/bin`: `rustc`, the Rust compiler, and `rustdoc`, the
|
||||||
```
|
|
||||||
$ cargo install cargo-vendor
|
|
||||||
```
|
|
||||||
|
|
||||||
```
|
|
||||||
$ cargo vendor
|
|
||||||
```
|
|
||||||
|
|
||||||
> ***Note:*** Install locations can be adjusted by copying the config file
|
|
||||||
> from `./config.toml.example` to `./config.toml`, and
|
|
||||||
> adjusting the `prefix` option under `[install]`. Various other options, such
|
|
||||||
> as enabling debug information, are also supported, and are documented in
|
|
||||||
> the config file.
|
|
||||||
|
|
||||||
When complete, `sudo ./x.py install` will place several programs into
|
|
||||||
`/usr/local/bin`: `rustc`, the Rust compiler, and `rustdoc`, the
|
|
||||||
API-documentation tool. This install does not include [Cargo],
|
API-documentation tool. This install does not include [Cargo],
|
||||||
Rust's package manager, which you may also want to build.
|
Rust's package manager. To build and install Cargo, you may
|
||||||
|
run `./x.py install cargo` or set the `build.extended` key in
|
||||||
|
`config.toml` to `true` to build and install all tools.
|
||||||
|
|
||||||
[Cargo]: https://github.com/rust-lang/cargo
|
[Cargo]: https://github.com/rust-lang/cargo
|
||||||
|
|
||||||
### Building on Windows
|
### Building on Windows
|
||||||
[building-on-windows]: #building-on-windows
|
|
||||||
|
|
||||||
There are two prominent ABIs in use on Windows: the native (MSVC) ABI used by
|
There are two prominent ABIs in use on Windows: the native (MSVC) ABI used by
|
||||||
Visual Studio, and the GNU ABI used by the GCC toolchain. Which version of Rust
|
Visual Studio, and the GNU ABI used by the GCC toolchain. Which version of Rust
|
||||||
@ -85,7 +81,6 @@ for interop with GNU software built using the MinGW/MSYS2 toolchain use the GNU
|
|||||||
build.
|
build.
|
||||||
|
|
||||||
#### MinGW
|
#### MinGW
|
||||||
[windows-mingw]: #windows-mingw
|
|
||||||
|
|
||||||
[MSYS2][msys2] can be used to easily build Rust on Windows:
|
[MSYS2][msys2] can be used to easily build Rust on Windows:
|
||||||
|
|
||||||
@ -126,7 +121,6 @@ build.
|
|||||||
```
|
```
|
||||||
|
|
||||||
#### MSVC
|
#### MSVC
|
||||||
[windows-msvc]: #windows-msvc
|
|
||||||
|
|
||||||
MSVC builds of Rust additionally require an installation of Visual Studio 2017
|
MSVC builds of Rust additionally require an installation of Visual Studio 2017
|
||||||
(or later) so `rustc` can use its linker. The simplest way is to get the
|
(or later) so `rustc` can use its linker. The simplest way is to get the
|
||||||
@ -155,7 +149,6 @@ by manually calling the appropriate vcvars file before running the bootstrap.
|
|||||||
```
|
```
|
||||||
|
|
||||||
#### Specifying an ABI
|
#### Specifying an ABI
|
||||||
[specifying-an-abi]: #specifying-an-abi
|
|
||||||
|
|
||||||
Each specific ABI can also be used from either environment (for example, using
|
Each specific ABI can also be used from either environment (for example, using
|
||||||
the GNU ABI in PowerShell) by using an explicit build triple. The available
|
the GNU ABI in PowerShell) by using an explicit build triple. The available
|
||||||
@ -169,11 +162,10 @@ Windows build triples are:
|
|||||||
|
|
||||||
The build triple can be specified by either specifying `--build=<triple>` when
|
The build triple can be specified by either specifying `--build=<triple>` when
|
||||||
invoking `x.py` commands, or by copying the `config.toml` file (as described
|
invoking `x.py` commands, or by copying the `config.toml` file (as described
|
||||||
in Building From Source), and modifying the `build` option under the `[build]`
|
in [Installing From Source](#installing-from-source)), and modifying the
|
||||||
section.
|
`build` option under the `[build]` section.
|
||||||
|
|
||||||
### Configure and Make
|
### Configure and Make
|
||||||
[configure-and-make]: #configure-and-make
|
|
||||||
|
|
||||||
While it's not the recommended build system, this project also provides a
|
While it's not the recommended build system, this project also provides a
|
||||||
configure script and makefile (the latter of which just invokes `x.py`).
|
configure script and makefile (the latter of which just invokes `x.py`).
|
||||||
@ -188,7 +180,6 @@ When using the configure script, the generated `config.mk` file may override the
|
|||||||
`config.mk` file.
|
`config.mk` file.
|
||||||
|
|
||||||
## Building Documentation
|
## Building Documentation
|
||||||
[building-documentation]: #building-documentation
|
|
||||||
|
|
||||||
If you’d like to build the documentation, it’s almost the same:
|
If you’d like to build the documentation, it’s almost the same:
|
||||||
|
|
||||||
@ -201,7 +192,6 @@ the ABI used. I.e., if the ABI was `x86_64-pc-windows-msvc`, the directory will
|
|||||||
`build\x86_64-pc-windows-msvc\doc`.
|
`build\x86_64-pc-windows-msvc\doc`.
|
||||||
|
|
||||||
## Notes
|
## Notes
|
||||||
[notes]: #notes
|
|
||||||
|
|
||||||
Since the Rust compiler is written in Rust, it must be built by a
|
Since the Rust compiler is written in Rust, it must be built by a
|
||||||
precompiled "snapshot" version of itself (made in an earlier stage of
|
precompiled "snapshot" version of itself (made in an earlier stage of
|
||||||
@ -210,11 +200,11 @@ fetch snapshots, and an OS that can execute the available snapshot binaries.
|
|||||||
|
|
||||||
Snapshot binaries are currently built and tested on several platforms:
|
Snapshot binaries are currently built and tested on several platforms:
|
||||||
|
|
||||||
| Platform / Architecture | x86 | x86_64 |
|
| Platform / Architecture | x86 | x86_64 |
|
||||||
|--------------------------|-----|--------|
|
|----------------------------|-----|--------|
|
||||||
| Windows (7, 8, 10, ...) | ✓ | ✓ |
|
| Windows (7, 8, 10, ...) | ✓ | ✓ |
|
||||||
| Linux (2.6.18 or later) | ✓ | ✓ |
|
| Linux (2.6.18 or later) | ✓ | ✓ |
|
||||||
| OSX (10.7 Lion or later) | ✓ | ✓ |
|
| macOS (10.7 Lion or later) | ✓ | ✓ |
|
||||||
|
|
||||||
You may find that other platforms work, but these are our officially
|
You may find that other platforms work, but these are our officially
|
||||||
supported build environments that are most likely to work.
|
supported build environments that are most likely to work.
|
||||||
@ -224,7 +214,6 @@ There is more advice about hacking on Rust in [CONTRIBUTING.md].
|
|||||||
[CONTRIBUTING.md]: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md
|
[CONTRIBUTING.md]: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md
|
||||||
|
|
||||||
## Getting Help
|
## Getting Help
|
||||||
[getting-help]: #getting-help
|
|
||||||
|
|
||||||
The Rust community congregates in a few places:
|
The Rust community congregates in a few places:
|
||||||
|
|
||||||
@ -237,7 +226,6 @@ The Rust community congregates in a few places:
|
|||||||
[users.rust-lang.org]: https://users.rust-lang.org/
|
[users.rust-lang.org]: https://users.rust-lang.org/
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
[contributing]: #contributing
|
|
||||||
|
|
||||||
To contribute to Rust, please see [CONTRIBUTING](CONTRIBUTING.md).
|
To contribute to Rust, please see [CONTRIBUTING](CONTRIBUTING.md).
|
||||||
|
|
||||||
@ -258,7 +246,6 @@ Also, you may find the [rustdocs for the compiler itself][rustdocs] useful.
|
|||||||
[rustdocs]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc/
|
[rustdocs]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc/
|
||||||
|
|
||||||
## License
|
## License
|
||||||
[license]: #license
|
|
||||||
|
|
||||||
Rust is primarily distributed under the terms of both the MIT license
|
Rust is primarily distributed under the terms of both the MIT license
|
||||||
and the Apache License (Version 2.0), with portions covered by various
|
and the Apache License (Version 2.0), with portions covered by various
|
||||||
@ -268,7 +255,6 @@ See [LICENSE-APACHE](LICENSE-APACHE), [LICENSE-MIT](LICENSE-MIT), and
|
|||||||
[COPYRIGHT](COPYRIGHT) for details.
|
[COPYRIGHT](COPYRIGHT) for details.
|
||||||
|
|
||||||
## Trademark
|
## Trademark
|
||||||
[trademark]: #trademark
|
|
||||||
|
|
||||||
The Rust programming language is an open source, community project governed
|
The Rust programming language is an open source, community project governed
|
||||||
by a core team. It is also sponsored by the Mozilla Foundation (“Mozilla”),
|
by a core team. It is also sponsored by the Mozilla Foundation (“Mozilla”),
|
||||||
|
131
RELEASES.md
131
RELEASES.md
@ -1,3 +1,117 @@
|
|||||||
|
Version 1.38.0 (2019-09-26)
|
||||||
|
==========================
|
||||||
|
|
||||||
|
Language
|
||||||
|
--------
|
||||||
|
- [The `#[global_allocator]` attribute can now be used in submodules.][62735]
|
||||||
|
- [The `#[deprecated]` attribute can now be used on macros.][62042]
|
||||||
|
|
||||||
|
Compiler
|
||||||
|
--------
|
||||||
|
- [Added pipelined compilation support to `rustc`.][62766] This will
|
||||||
|
improve compilation times in some cases. For further information please refer
|
||||||
|
to the [_"Evaluating pipelined rustc compilation"_][pipeline-internals] thread.
|
||||||
|
- [Added tier 3\* support for the `aarch64-uwp-windows-msvc`, `i686-uwp-windows-gnu`,
|
||||||
|
`i686-uwp-windows-msvc`, `x86_64-uwp-windows-gnu`, and
|
||||||
|
`x86_64-uwp-windows-msvc` targets.][60260]
|
||||||
|
- [Added tier 3 support for the `armv7-unknown-linux-gnueabi` and
|
||||||
|
`armv7-unknown-linux-musleabi` targets.][63107]
|
||||||
|
- [Added tier 3 support for the `hexagon-unknown-linux-musl` target.][62814]
|
||||||
|
- [Added tier 3 support for the `riscv32i-unknown-none-elf` target.][62784]
|
||||||
|
|
||||||
|
\* Refer to Rust's [platform support page][forge-platform-support] for more
|
||||||
|
information on Rust's tiered platform support.
|
||||||
|
|
||||||
|
Libraries
|
||||||
|
---------
|
||||||
|
- [`ascii::EscapeDefault` now implements `Clone` and `Display`.][63421]
|
||||||
|
- [Derive macros for prelude traits (e.g. `Clone`, `Debug`, `Hash`) are now
|
||||||
|
available at the same path as the trait.][63056] (e.g. The `Clone` derive macro
|
||||||
|
is available at `std::clone::Clone`). This also makes all built-in macros
|
||||||
|
available in `std`/`core` root. e.g. `std::include_bytes!`.
|
||||||
|
- [`str::Chars` now implements `Debug`.][63000]
|
||||||
|
- [`slice::{concat, connect, join}` now accepts `&[T]` in addition to `&T`.][62528]
|
||||||
|
- [`*const T` and `*mut T` now implement `marker::Unpin`.][62583]
|
||||||
|
- [`Arc<[T]>` and `Rc<[T]>` now implement `FromIterator<T>`.][61953]
|
||||||
|
- [Added euclidean remainder and division operations (`div_euclid`,
|
||||||
|
`rem_euclid`) to all numeric primitives.][61884] Additionally `checked`,
|
||||||
|
`overflowing`, and `wrapping` versions are available for all
|
||||||
|
integer primitives.
|
||||||
|
- [`thread::AccessError` now implements `Clone`, `Copy`, `Eq`, `Error`, and
|
||||||
|
`PartialEq`.][61491]
|
||||||
|
- [`iter::{StepBy, Peekable, Take}` now implement `DoubleEndedIterator`.][61457]
|
||||||
|
|
||||||
|
Stabilized APIs
|
||||||
|
---------------
|
||||||
|
- [`<*const T>::cast`]
|
||||||
|
- [`<*mut T>::cast`]
|
||||||
|
- [`Duration::as_secs_f32`]
|
||||||
|
- [`Duration::as_secs_f64`]
|
||||||
|
- [`Duration::div_duration_f32`]
|
||||||
|
- [`Duration::div_duration_f64`]
|
||||||
|
- [`Duration::div_f32`]
|
||||||
|
- [`Duration::div_f64`]
|
||||||
|
- [`Duration::from_secs_f32`]
|
||||||
|
- [`Duration::from_secs_f64`]
|
||||||
|
- [`Duration::mul_f32`]
|
||||||
|
- [`Duration::mul_f64`]
|
||||||
|
- [`any::type_name`]
|
||||||
|
|
||||||
|
Cargo
|
||||||
|
-----
|
||||||
|
- [Added pipelined compilation support to `cargo`.][cargo/7143]
|
||||||
|
- [You can now pass the `--features` option multiple times to enable
|
||||||
|
multiple features.][cargo/7084]
|
||||||
|
|
||||||
|
Misc
|
||||||
|
----
|
||||||
|
- [`rustc` will now warn about some incorrect uses of
|
||||||
|
`mem::{uninitialized, zeroed}` that are known to cause undefined behaviour.][63346]
|
||||||
|
|
||||||
|
Compatibility Notes
|
||||||
|
-------------------
|
||||||
|
- Unfortunately the [`x86_64-unknown-uefi` platform can not be built][62785]
|
||||||
|
with rustc 1.39.0.
|
||||||
|
- The [`armv7-unknown-linux-gnueabihf` platform is also known to have
|
||||||
|
issues][62896] for certain crates such as libc.
|
||||||
|
|
||||||
|
[60260]: https://github.com/rust-lang/rust/pull/60260/
|
||||||
|
[61457]: https://github.com/rust-lang/rust/pull/61457/
|
||||||
|
[61491]: https://github.com/rust-lang/rust/pull/61491/
|
||||||
|
[61884]: https://github.com/rust-lang/rust/pull/61884/
|
||||||
|
[61953]: https://github.com/rust-lang/rust/pull/61953/
|
||||||
|
[62042]: https://github.com/rust-lang/rust/pull/62042/
|
||||||
|
[62528]: https://github.com/rust-lang/rust/pull/62528/
|
||||||
|
[62583]: https://github.com/rust-lang/rust/pull/62583/
|
||||||
|
[62735]: https://github.com/rust-lang/rust/pull/62735/
|
||||||
|
[62766]: https://github.com/rust-lang/rust/pull/62766/
|
||||||
|
[62784]: https://github.com/rust-lang/rust/pull/62784/
|
||||||
|
[62785]: https://github.com/rust-lang/rust/issues/62785/
|
||||||
|
[62814]: https://github.com/rust-lang/rust/pull/62814/
|
||||||
|
[62896]: https://github.com/rust-lang/rust/issues/62896/
|
||||||
|
[63000]: https://github.com/rust-lang/rust/pull/63000/
|
||||||
|
[63056]: https://github.com/rust-lang/rust/pull/63056/
|
||||||
|
[63107]: https://github.com/rust-lang/rust/pull/63107/
|
||||||
|
[63346]: https://github.com/rust-lang/rust/pull/63346/
|
||||||
|
[63421]: https://github.com/rust-lang/rust/pull/63421/
|
||||||
|
[cargo/7084]: https://github.com/rust-lang/cargo/pull/7084/
|
||||||
|
[cargo/7143]: https://github.com/rust-lang/cargo/pull/7143/
|
||||||
|
[`<*const T>::cast`]: https://doc.rust-lang.org/std/primitive.pointer.html#method.cast
|
||||||
|
[`<*mut T>::cast`]: https://doc.rust-lang.org/std/primitive.pointer.html#method.cast
|
||||||
|
[`Duration::as_secs_f32`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.as_secs_f32
|
||||||
|
[`Duration::as_secs_f64`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.as_secs_f64
|
||||||
|
[`Duration::div_duration_f32`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.div_duration_f32
|
||||||
|
[`Duration::div_duration_f64`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.div_duration_f64
|
||||||
|
[`Duration::div_f32`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.div_f32
|
||||||
|
[`Duration::div_f64`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.div_f64
|
||||||
|
[`Duration::from_secs_f32`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.from_secs_f32
|
||||||
|
[`Duration::from_secs_f64`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.from_secs_f64
|
||||||
|
[`Duration::mul_f32`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.mul_f32
|
||||||
|
[`Duration::mul_f64`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.mul_f64
|
||||||
|
[`any::type_name`]: https://doc.rust-lang.org/std/any/fn.type_name.html
|
||||||
|
[forge-platform-support]: https://forge.rust-lang.org/platform-support.html
|
||||||
|
[pipeline-internals]: https://internals.rust-lang.org/t/evaluating-pipelined-rustc-compilation/10199
|
||||||
|
|
||||||
Version 1.37.0 (2019-08-15)
|
Version 1.37.0 (2019-08-15)
|
||||||
==========================
|
==========================
|
||||||
|
|
||||||
@ -22,7 +136,7 @@ Language
|
|||||||
- [You can now use `_` as an identifier for consts.][61347] e.g. You can write
|
- [You can now use `_` as an identifier for consts.][61347] e.g. You can write
|
||||||
`const _: u32 = 5;`.
|
`const _: u32 = 5;`.
|
||||||
- [You can now use `#[repr(align(X)]` on enums.][61229]
|
- [You can now use `#[repr(align(X)]` on enums.][61229]
|
||||||
- [The `?`/_"Kleene"_ macro operator is now available in the
|
- [The `?` Kleene macro operator is now available in the
|
||||||
2015 edition.][60932]
|
2015 edition.][60932]
|
||||||
|
|
||||||
Compiler
|
Compiler
|
||||||
@ -179,10 +293,8 @@ Misc
|
|||||||
|
|
||||||
Compatibility Notes
|
Compatibility Notes
|
||||||
-------------------
|
-------------------
|
||||||
- [`std::arch::x86::_rdtsc` returns `u64` instead of `i64`][stdsimd/559]
|
|
||||||
- [`std::arch::x86_64::_mm_shuffle_ps` takes an `i32` instead of `u32` for `mask`][stdsimd/522]
|
|
||||||
- With the stabilisation of `mem::MaybeUninit`, `mem::uninitialized` use is no
|
- With the stabilisation of `mem::MaybeUninit`, `mem::uninitialized` use is no
|
||||||
longer recommended, and will be deprecated in 1.38.0.
|
longer recommended, and will be deprecated in 1.39.0.
|
||||||
|
|
||||||
[60318]: https://github.com/rust-lang/rust/pull/60318/
|
[60318]: https://github.com/rust-lang/rust/pull/60318/
|
||||||
[60364]: https://github.com/rust-lang/rust/pull/60364/
|
[60364]: https://github.com/rust-lang/rust/pull/60364/
|
||||||
@ -217,8 +329,7 @@ Compatibility Notes
|
|||||||
[`task::Poll`]: https://doc.rust-lang.org/beta/std/task/enum.Poll.html
|
[`task::Poll`]: https://doc.rust-lang.org/beta/std/task/enum.Poll.html
|
||||||
[clippy-1-36-0]: https://github.com/rust-lang/rust-clippy/blob/master/CHANGELOG.md#rust-136
|
[clippy-1-36-0]: https://github.com/rust-lang/rust-clippy/blob/master/CHANGELOG.md#rust-136
|
||||||
[cargo-1-36-0]: https://github.com/rust-lang/cargo/blob/master/CHANGELOG.md#cargo-136-2019-07-04
|
[cargo-1-36-0]: https://github.com/rust-lang/cargo/blob/master/CHANGELOG.md#cargo-136-2019-07-04
|
||||||
[stdsimd/522]: https://github.com/rust-lang-nursery/stdsimd/issues/522
|
|
||||||
[stdsimd/559]: https://github.com/rust-lang-nursery/stdsimd/issues/559
|
|
||||||
|
|
||||||
Version 1.35.0 (2019-05-23)
|
Version 1.35.0 (2019-05-23)
|
||||||
==========================
|
==========================
|
||||||
@ -542,7 +653,7 @@ Compiler
|
|||||||
--------
|
--------
|
||||||
- [You can now set a linker flavor for `rustc` with the `-Clinker-flavor`
|
- [You can now set a linker flavor for `rustc` with the `-Clinker-flavor`
|
||||||
command line argument.][56351]
|
command line argument.][56351]
|
||||||
- [The mininum required LLVM version has been bumped to 6.0.][56642]
|
- [The minimum required LLVM version has been bumped to 6.0.][56642]
|
||||||
- [Added support for the PowerPC64 architecture on FreeBSD.][57615]
|
- [Added support for the PowerPC64 architecture on FreeBSD.][57615]
|
||||||
- [The `x86_64-fortanix-unknown-sgx` target support has been upgraded to
|
- [The `x86_64-fortanix-unknown-sgx` target support has been upgraded to
|
||||||
tier 2 support.][57130] Visit the [platform support][platform-support] page for
|
tier 2 support.][57130] Visit the [platform support][platform-support] page for
|
||||||
@ -973,7 +1084,7 @@ Compiler
|
|||||||
|
|
||||||
Libraries
|
Libraries
|
||||||
---------
|
---------
|
||||||
- [You can now convert `num::NonZero*` types to their raw equivalvents using the
|
- [You can now convert `num::NonZero*` types to their raw equivalents using the
|
||||||
`From` trait.][54240] E.g. `u8` now implements `From<NonZeroU8>`.
|
`From` trait.][54240] E.g. `u8` now implements `From<NonZeroU8>`.
|
||||||
- [You can now convert a `&Option<T>` into `Option<&T>` and `&mut Option<T>`
|
- [You can now convert a `&Option<T>` into `Option<&T>` and `&mut Option<T>`
|
||||||
into `Option<&mut T>` using the `From` trait.][53218]
|
into `Option<&mut T>` using the `From` trait.][53218]
|
||||||
@ -1166,7 +1277,7 @@ Security Notes
|
|||||||
caused by an integer overflow. This has been fixed by deterministically
|
caused by an integer overflow. This has been fixed by deterministically
|
||||||
panicking when an overflow happens.
|
panicking when an overflow happens.
|
||||||
|
|
||||||
Thank you to Scott McMurray for responsibily disclosing this vulnerability to
|
Thank you to Scott McMurray for responsibly disclosing this vulnerability to
|
||||||
us.
|
us.
|
||||||
|
|
||||||
|
|
||||||
@ -1438,7 +1549,7 @@ Security Notes
|
|||||||
given machine. This release fixes that vulnerability; you can read
|
given machine. This release fixes that vulnerability; you can read
|
||||||
more about this on the [blog][rustdoc-sec]. The associated CVE is [CVE-2018-1000622].
|
more about this on the [blog][rustdoc-sec]. The associated CVE is [CVE-2018-1000622].
|
||||||
|
|
||||||
Thank you to Red Hat for responsibily disclosing this vulnerability to us.
|
Thank you to Red Hat for responsibly disclosing this vulnerability to us.
|
||||||
|
|
||||||
Compatibility Notes
|
Compatibility Notes
|
||||||
-------------------
|
-------------------
|
||||||
|
@ -57,14 +57,13 @@
|
|||||||
# support. You'll need to write a target specification at least, and most
|
# support. You'll need to write a target specification at least, and most
|
||||||
# likely, teach rustc about the C ABI of the target. Get in touch with the
|
# likely, teach rustc about the C ABI of the target. Get in touch with the
|
||||||
# Rust team and file an issue if you need assistance in porting!
|
# Rust team and file an issue if you need assistance in porting!
|
||||||
#targets = "X86;ARM;AArch64;Mips;PowerPC;SystemZ;MSP430;Sparc;NVPTX;Hexagon"
|
#targets = "AArch64;ARM;Hexagon;MSP430;Mips;NVPTX;PowerPC;RISCV;Sparc;SystemZ;WebAssembly;X86"
|
||||||
|
|
||||||
# LLVM experimental targets to build support for. These targets are specified in
|
# LLVM experimental targets to build support for. These targets are specified in
|
||||||
# the same format as above, but since these targets are experimental, they are
|
# the same format as above, but since these targets are experimental, they are
|
||||||
# not built by default and the experimental Rust compilation targets that depend
|
# not built by default and the experimental Rust compilation targets that depend
|
||||||
# on them will not work unless the user opts in to building them. By default the
|
# on them will not work unless the user opts in to building them.
|
||||||
# `WebAssembly` and `RISCV` targets are enabled when compiling LLVM from scratch.
|
#experimental-targets = ""
|
||||||
#experimental-targets = "WebAssembly;RISCV"
|
|
||||||
|
|
||||||
# Cap the number of parallel linker invocations when compiling LLVM.
|
# Cap the number of parallel linker invocations when compiling LLVM.
|
||||||
# This can be useful when building LLVM with debug info, which significantly
|
# This can be useful when building LLVM with debug info, which significantly
|
||||||
@ -369,10 +368,6 @@
|
|||||||
# When creating source tarballs whether or not to create a source tarball.
|
# When creating source tarballs whether or not to create a source tarball.
|
||||||
#dist-src = false
|
#dist-src = false
|
||||||
|
|
||||||
# Whether to also run the Miri tests suite when running tests.
|
|
||||||
# As a side-effect also generates MIR for all libraries.
|
|
||||||
#test-miri = false
|
|
||||||
|
|
||||||
# After building or testing extended tools (e.g. clippy and rustfmt), append the
|
# After building or testing extended tools (e.g. clippy and rustfmt), append the
|
||||||
# result (broken, compiling, testing) into this JSON file.
|
# result (broken, compiling, testing) into this JSON file.
|
||||||
#save-toolstates = "/path/to/toolstates.json"
|
#save-toolstates = "/path/to/toolstates.json"
|
||||||
|
@ -1 +1 @@
|
|||||||
eae3437dfe991621e8afdc82734f4a172d7ddf9b
|
625451e376bb2e5283fc4741caa0a3e8a2ca4d54
|
@ -5,10 +5,7 @@ This directory contains the source code of the rust project, including:
|
|||||||
|
|
||||||
For more information on how various parts of the compiler work, see the [rustc guide].
|
For more information on how various parts of the compiler work, see the [rustc guide].
|
||||||
|
|
||||||
There is also useful content in the following READMEs, which are gradually being moved over to the guide:
|
There is also useful content in this README:
|
||||||
- https://github.com/rust-lang/rust/tree/master/src/librustc/ty/query
|
https://github.com/rust-lang/rust/tree/master/src/librustc/infer/lexical_region_resolve.
|
||||||
- https://github.com/rust-lang/rust/tree/master/src/librustc/dep_graph
|
|
||||||
- https://github.com/rust-lang/rust/tree/master/src/librustc/infer/higher_ranked
|
|
||||||
- https://github.com/rust-lang/rust/tree/master/src/librustc/infer/lexical_region_resolve
|
|
||||||
|
|
||||||
[rustc guide]: https://rust-lang.github.io/rustc-guide/about-this-guide.html
|
[rustc guide]: https://rust-lang.github.io/rustc-guide/about-this-guide.html
|
||||||
|
@ -55,11 +55,11 @@ The script accepts commands, flags, and arguments to determine what to do:
|
|||||||
# run all unit tests
|
# run all unit tests
|
||||||
./x.py test
|
./x.py test
|
||||||
|
|
||||||
# execute the run-pass test suite
|
# execute the UI test suite
|
||||||
./x.py test src/test/run-pass
|
./x.py test src/test/ui
|
||||||
|
|
||||||
# execute only some tests in the run-pass test suite
|
# execute only some tests in the UI test suite
|
||||||
./x.py test src/test/run-pass --test-args substring-of-test-name
|
./x.py test src/test/ui --test-args substring-of-test-name
|
||||||
|
|
||||||
# execute tests in the standard library in stage0
|
# execute tests in the standard library in stage0
|
||||||
./x.py test --stage 0 src/libstd
|
./x.py test --stage 0 src/libstd
|
||||||
@ -215,7 +215,7 @@ build/
|
|||||||
|
|
||||||
# Output for all compiletest-based test suites
|
# Output for all compiletest-based test suites
|
||||||
test/
|
test/
|
||||||
run-pass/
|
ui/
|
||||||
compile-fail/
|
compile-fail/
|
||||||
debuginfo/
|
debuginfo/
|
||||||
...
|
...
|
||||||
|
@ -5,7 +5,8 @@
|
|||||||
//! parent directory, and otherwise documentation can be found throughout the `build`
|
//! parent directory, and otherwise documentation can be found throughout the `build`
|
||||||
//! directory in each respective module.
|
//! directory in each respective module.
|
||||||
|
|
||||||
#![deny(warnings)]
|
// NO-RUSTC-WRAPPER
|
||||||
|
#![deny(warnings, rust_2018_idioms, unused_lifetimes)]
|
||||||
|
|
||||||
use std::env;
|
use std::env;
|
||||||
|
|
||||||
|
@ -15,7 +15,8 @@
|
|||||||
//! switching compilers for the bootstrap and for build scripts will probably
|
//! switching compilers for the bootstrap and for build scripts will probably
|
||||||
//! never get replaced.
|
//! never get replaced.
|
||||||
|
|
||||||
#![deny(warnings)]
|
// NO-RUSTC-WRAPPER
|
||||||
|
#![deny(warnings, rust_2018_idioms, unused_lifetimes)]
|
||||||
|
|
||||||
use std::env;
|
use std::env;
|
||||||
use std::ffi::OsString;
|
use std::ffi::OsString;
|
||||||
@ -91,17 +92,16 @@ fn main() {
|
|||||||
cmd.args(&args)
|
cmd.args(&args)
|
||||||
.env(bootstrap::util::dylib_path_var(),
|
.env(bootstrap::util::dylib_path_var(),
|
||||||
env::join_paths(&dylib_path).unwrap());
|
env::join_paths(&dylib_path).unwrap());
|
||||||
let mut maybe_crate = None;
|
|
||||||
|
|
||||||
// Get the name of the crate we're compiling, if any.
|
// Get the name of the crate we're compiling, if any.
|
||||||
let maybe_crate_name = args.windows(2)
|
let crate_name = args.windows(2)
|
||||||
.find(|a| &*a[0] == "--crate-name")
|
.find(|args| args[0] == "--crate-name")
|
||||||
.map(|crate_name| &*crate_name[1]);
|
.and_then(|args| args[1].to_str());
|
||||||
|
|
||||||
if let Some(current_crate) = maybe_crate_name {
|
if let Some(crate_name) = crate_name {
|
||||||
if let Some(target) = env::var_os("RUSTC_TIME") {
|
if let Some(target) = env::var_os("RUSTC_TIME") {
|
||||||
if target == "all" ||
|
if target == "all" ||
|
||||||
target.into_string().unwrap().split(",").any(|c| c.trim() == current_crate)
|
target.into_string().unwrap().split(",").any(|c| c.trim() == crate_name)
|
||||||
{
|
{
|
||||||
cmd.arg("-Ztime");
|
cmd.arg("-Ztime");
|
||||||
}
|
}
|
||||||
@ -125,10 +125,29 @@ fn main() {
|
|||||||
cmd.arg(format!("-Cdebuginfo={}", debuginfo_level));
|
cmd.arg(format!("-Cdebuginfo={}", debuginfo_level));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if env::var_os("RUSTC_DENY_WARNINGS").is_some() &&
|
||||||
|
env::var_os("RUSTC_EXTERNAL_TOOL").is_none() {
|
||||||
|
// When extending this list, search for `NO-RUSTC-WRAPPER` and add the new lints
|
||||||
|
// there as well, some code doesn't go through this `rustc` wrapper.
|
||||||
|
cmd.arg("-Dwarnings");
|
||||||
|
cmd.arg("-Drust_2018_idioms");
|
||||||
|
cmd.arg("-Dunused_lifetimes");
|
||||||
|
// cfg(not(bootstrap)): Remove this during the next stage 0 compiler update.
|
||||||
|
// `-Drustc::internal` is a new feature and `rustc_version` mis-reports the `stage`.
|
||||||
|
let cfg_not_bootstrap = stage != "0" && crate_name != Some("rustc_version");
|
||||||
|
if cfg_not_bootstrap && use_internal_lints(crate_name) {
|
||||||
|
cmd.arg("-Zunstable-options");
|
||||||
|
cmd.arg("-Drustc::internal");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if let Some(target) = target {
|
if let Some(target) = target {
|
||||||
// The stage0 compiler has a special sysroot distinct from what we
|
// The stage0 compiler has a special sysroot distinct from what we
|
||||||
// actually downloaded, so we just always pass the `--sysroot` option.
|
// actually downloaded, so we just always pass the `--sysroot` option,
|
||||||
cmd.arg("--sysroot").arg(&sysroot);
|
// unless one is already set.
|
||||||
|
if !args.iter().any(|arg| arg == "--sysroot") {
|
||||||
|
cmd.arg("--sysroot").arg(&sysroot);
|
||||||
|
}
|
||||||
|
|
||||||
cmd.arg("-Zexternal-macro-backtrace");
|
cmd.arg("-Zexternal-macro-backtrace");
|
||||||
|
|
||||||
@ -167,9 +186,6 @@ fn main() {
|
|||||||
cmd.arg(format!("-Clinker={}", target_linker));
|
cmd.arg(format!("-Clinker={}", target_linker));
|
||||||
}
|
}
|
||||||
|
|
||||||
let crate_name = maybe_crate_name.unwrap();
|
|
||||||
maybe_crate = Some(crate_name);
|
|
||||||
|
|
||||||
// If we're compiling specifically the `panic_abort` crate then we pass
|
// If we're compiling specifically the `panic_abort` crate then we pass
|
||||||
// the `-C panic=abort` option. Note that we do not do this for any
|
// the `-C panic=abort` option. Note that we do not do this for any
|
||||||
// other crate intentionally as this is the only crate for now that we
|
// other crate intentionally as this is the only crate for now that we
|
||||||
@ -182,8 +198,8 @@ fn main() {
|
|||||||
// `compiler_builtins` are unconditionally compiled with panic=abort to
|
// `compiler_builtins` are unconditionally compiled with panic=abort to
|
||||||
// workaround undefined references to `rust_eh_unwind_resume` generated
|
// workaround undefined references to `rust_eh_unwind_resume` generated
|
||||||
// otherwise, see issue https://github.com/rust-lang/rust/issues/43095.
|
// otherwise, see issue https://github.com/rust-lang/rust/issues/43095.
|
||||||
if crate_name == "panic_abort" ||
|
if crate_name == Some("panic_abort") ||
|
||||||
crate_name == "compiler_builtins" && stage != "0" {
|
crate_name == Some("compiler_builtins") && stage != "0" {
|
||||||
cmd.arg("-C").arg("panic=abort");
|
cmd.arg("-C").arg("panic=abort");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -196,7 +212,7 @@ fn main() {
|
|||||||
|
|
||||||
// The compiler builtins are pretty sensitive to symbols referenced in
|
// The compiler builtins are pretty sensitive to symbols referenced in
|
||||||
// libcore and such, so we never compile them with debug assertions.
|
// libcore and such, so we never compile them with debug assertions.
|
||||||
if crate_name == "compiler_builtins" {
|
if crate_name == Some("compiler_builtins") {
|
||||||
cmd.arg("-C").arg("debug-assertions=no");
|
cmd.arg("-C").arg("debug-assertions=no");
|
||||||
} else {
|
} else {
|
||||||
cmd.arg("-C").arg(format!("debug-assertions={}", debug_assertions));
|
cmd.arg("-C").arg(format!("debug-assertions={}", debug_assertions));
|
||||||
@ -272,20 +288,6 @@ fn main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// When running miri tests, we need to generate MIR for all libraries
|
|
||||||
if env::var("TEST_MIRI").ok().map_or(false, |val| val == "true") {
|
|
||||||
// The flags here should be kept in sync with `add_miri_default_args`
|
|
||||||
// in miri's `src/lib.rs`.
|
|
||||||
cmd.arg("-Zalways-encode-mir");
|
|
||||||
cmd.arg("--cfg=miri");
|
|
||||||
// These options are preferred by miri, to be able to perform better validation,
|
|
||||||
// but the bootstrap compiler might not understand them.
|
|
||||||
if stage != "0" {
|
|
||||||
cmd.arg("-Zmir-emit-retag");
|
|
||||||
cmd.arg("-Zmir-opt-level=0");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if let Ok(map) = env::var("RUSTC_DEBUGINFO_MAP") {
|
if let Ok(map) = env::var("RUSTC_DEBUGINFO_MAP") {
|
||||||
cmd.arg("--remap-path-prefix").arg(&map);
|
cmd.arg("--remap-path-prefix").arg(&map);
|
||||||
}
|
}
|
||||||
@ -305,9 +307,6 @@ fn main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is required for internal lints.
|
|
||||||
cmd.arg("-Zunstable-options");
|
|
||||||
|
|
||||||
// Force all crates compiled by this compiler to (a) be unstable and (b)
|
// Force all crates compiled by this compiler to (a) be unstable and (b)
|
||||||
// allow the `rustc_private` feature to link to other unstable crates
|
// allow the `rustc_private` feature to link to other unstable crates
|
||||||
// also in the sysroot. We also do this for host crates, since those
|
// also in the sysroot. We also do this for host crates, since those
|
||||||
@ -320,13 +319,6 @@ fn main() {
|
|||||||
cmd.arg("--cfg").arg("parallel_compiler");
|
cmd.arg("--cfg").arg("parallel_compiler");
|
||||||
}
|
}
|
||||||
|
|
||||||
if env::var_os("RUSTC_DENY_WARNINGS").is_some() && env::var_os("RUSTC_EXTERNAL_TOOL").is_none()
|
|
||||||
{
|
|
||||||
cmd.arg("-Dwarnings");
|
|
||||||
cmd.arg("-Dbare_trait_objects");
|
|
||||||
cmd.arg("-Drust_2018_idioms");
|
|
||||||
}
|
|
||||||
|
|
||||||
if verbose > 1 {
|
if verbose > 1 {
|
||||||
eprintln!(
|
eprintln!(
|
||||||
"rustc command: {:?}={:?} {:?}",
|
"rustc command: {:?}={:?} {:?}",
|
||||||
@ -349,7 +341,7 @@ fn main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if env::var_os("RUSTC_PRINT_STEP_TIMINGS").is_some() {
|
if env::var_os("RUSTC_PRINT_STEP_TIMINGS").is_some() {
|
||||||
if let Some(krate) = maybe_crate {
|
if let Some(crate_name) = crate_name {
|
||||||
let start = Instant::now();
|
let start = Instant::now();
|
||||||
let status = cmd
|
let status = cmd
|
||||||
.status()
|
.status()
|
||||||
@ -358,7 +350,7 @@ fn main() {
|
|||||||
|
|
||||||
let is_test = args.iter().any(|a| a == "--test");
|
let is_test = args.iter().any(|a| a == "--test");
|
||||||
eprintln!("[RUSTC-TIMING] {} test:{} {}.{:03}",
|
eprintln!("[RUSTC-TIMING] {} test:{} {}.{:03}",
|
||||||
krate.to_string_lossy(),
|
crate_name,
|
||||||
is_test,
|
is_test,
|
||||||
dur.as_secs(),
|
dur.as_secs(),
|
||||||
dur.subsec_nanos() / 1_000_000);
|
dur.subsec_nanos() / 1_000_000);
|
||||||
@ -377,6 +369,14 @@ fn main() {
|
|||||||
std::process::exit(code);
|
std::process::exit(code);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Rustc crates for which internal lints are in effect.
|
||||||
|
fn use_internal_lints(crate_name: Option<&str>) -> bool {
|
||||||
|
crate_name.map_or(false, |crate_name| {
|
||||||
|
crate_name.starts_with("rustc") || crate_name.starts_with("syntax") ||
|
||||||
|
["arena", "fmt_macros"].contains(&crate_name)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
fn exec_cmd(cmd: &mut Command) -> io::Result<i32> {
|
fn exec_cmd(cmd: &mut Command) -> io::Result<i32> {
|
||||||
use std::os::unix::process::CommandExt;
|
use std::os::unix::process::CommandExt;
|
||||||
|
@ -2,7 +2,8 @@
|
|||||||
//!
|
//!
|
||||||
//! See comments in `src/bootstrap/rustc.rs` for more information.
|
//! See comments in `src/bootstrap/rustc.rs` for more information.
|
||||||
|
|
||||||
#![deny(warnings)]
|
// NO-RUSTC-WRAPPER
|
||||||
|
#![deny(warnings, rust_2018_idioms, unused_lifetimes)]
|
||||||
|
|
||||||
use std::env;
|
use std::env;
|
||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
|
@ -735,6 +735,47 @@ class RustBuild(object):
|
|||||||
"""Set download URL for development environment"""
|
"""Set download URL for development environment"""
|
||||||
self._download_url = 'https://dev-static.rust-lang.org'
|
self._download_url = 'https://dev-static.rust-lang.org'
|
||||||
|
|
||||||
|
def check_vendored_status(self):
|
||||||
|
"""Check that vendoring is configured properly"""
|
||||||
|
vendor_dir = os.path.join(self.rust_root, 'vendor')
|
||||||
|
if 'SUDO_USER' in os.environ and not self.use_vendored_sources:
|
||||||
|
if os.environ.get('USER') != os.environ['SUDO_USER']:
|
||||||
|
self.use_vendored_sources = True
|
||||||
|
print('info: looks like you are running this command under `sudo`')
|
||||||
|
print(' and so in order to preserve your $HOME this will now')
|
||||||
|
print(' use vendored sources by default.')
|
||||||
|
if not os.path.exists(vendor_dir):
|
||||||
|
print('error: vendoring required, but vendor directory does not exist.')
|
||||||
|
print(' Run `cargo vendor` without sudo to initialize the '
|
||||||
|
'vendor directory.')
|
||||||
|
raise Exception("{} not found".format(vendor_dir))
|
||||||
|
|
||||||
|
if self.use_vendored_sources:
|
||||||
|
if not os.path.exists('.cargo'):
|
||||||
|
os.makedirs('.cargo')
|
||||||
|
with output('.cargo/config') as cargo_config:
|
||||||
|
cargo_config.write(
|
||||||
|
"[source.crates-io]\n"
|
||||||
|
"replace-with = 'vendored-sources'\n"
|
||||||
|
"registry = 'https://example.com'\n"
|
||||||
|
"\n"
|
||||||
|
"[source.vendored-sources]\n"
|
||||||
|
"directory = '{}/vendor'\n"
|
||||||
|
.format(self.rust_root))
|
||||||
|
else:
|
||||||
|
if os.path.exists('.cargo'):
|
||||||
|
shutil.rmtree('.cargo')
|
||||||
|
|
||||||
|
def ensure_vendored(self):
|
||||||
|
"""Ensure that the vendored sources are available if needed"""
|
||||||
|
vendor_dir = os.path.join(self.rust_root, 'vendor')
|
||||||
|
# Note that this does not handle updating the vendored dependencies if
|
||||||
|
# the rust git repository is updated. Normal development usually does
|
||||||
|
# not use vendoring, so hopefully this isn't too much of a problem.
|
||||||
|
if self.use_vendored_sources and not os.path.exists(vendor_dir):
|
||||||
|
run([self.cargo(), "vendor"],
|
||||||
|
verbose=self.verbose, cwd=self.rust_root)
|
||||||
|
|
||||||
|
|
||||||
def bootstrap(help_triggered):
|
def bootstrap(help_triggered):
|
||||||
"""Configure, fetch, build and run the initial bootstrap"""
|
"""Configure, fetch, build and run the initial bootstrap"""
|
||||||
@ -776,30 +817,7 @@ def bootstrap(help_triggered):
|
|||||||
|
|
||||||
build.use_locked_deps = '\nlocked-deps = true' in build.config_toml
|
build.use_locked_deps = '\nlocked-deps = true' in build.config_toml
|
||||||
|
|
||||||
if 'SUDO_USER' in os.environ and not build.use_vendored_sources:
|
build.check_vendored_status()
|
||||||
if os.environ.get('USER') != os.environ['SUDO_USER']:
|
|
||||||
build.use_vendored_sources = True
|
|
||||||
print('info: looks like you are running this command under `sudo`')
|
|
||||||
print(' and so in order to preserve your $HOME this will now')
|
|
||||||
print(' use vendored sources by default. Note that if this')
|
|
||||||
print(' does not work you should run a normal build first')
|
|
||||||
print(' before running a command like `sudo ./x.py install`')
|
|
||||||
|
|
||||||
if build.use_vendored_sources:
|
|
||||||
if not os.path.exists('.cargo'):
|
|
||||||
os.makedirs('.cargo')
|
|
||||||
with output('.cargo/config') as cargo_config:
|
|
||||||
cargo_config.write("""
|
|
||||||
[source.crates-io]
|
|
||||||
replace-with = 'vendored-sources'
|
|
||||||
registry = 'https://example.com'
|
|
||||||
|
|
||||||
[source.vendored-sources]
|
|
||||||
directory = '{}/vendor'
|
|
||||||
""".format(build.rust_root))
|
|
||||||
else:
|
|
||||||
if os.path.exists('.cargo'):
|
|
||||||
shutil.rmtree('.cargo')
|
|
||||||
|
|
||||||
data = stage0_data(build.rust_root)
|
data = stage0_data(build.rust_root)
|
||||||
build.date = data['date']
|
build.date = data['date']
|
||||||
@ -815,6 +833,7 @@ def bootstrap(help_triggered):
|
|||||||
build.build = args.build or build.build_triple()
|
build.build = args.build or build.build_triple()
|
||||||
build.download_stage0()
|
build.download_stage0()
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
|
build.ensure_vendored()
|
||||||
build.build_bootstrap()
|
build.build_bootstrap()
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
|
|
||||||
|
@ -371,7 +371,6 @@ impl<'a> Builder<'a> {
|
|||||||
Kind::Test => describe!(
|
Kind::Test => describe!(
|
||||||
test::Tidy,
|
test::Tidy,
|
||||||
test::Ui,
|
test::Ui,
|
||||||
test::RunPass,
|
|
||||||
test::CompileFail,
|
test::CompileFail,
|
||||||
test::RunFail,
|
test::RunFail,
|
||||||
test::RunPassValgrind,
|
test::RunPassValgrind,
|
||||||
@ -382,10 +381,8 @@ impl<'a> Builder<'a> {
|
|||||||
test::Incremental,
|
test::Incremental,
|
||||||
test::Debuginfo,
|
test::Debuginfo,
|
||||||
test::UiFullDeps,
|
test::UiFullDeps,
|
||||||
test::RunPassFullDeps,
|
|
||||||
test::Rustdoc,
|
test::Rustdoc,
|
||||||
test::Pretty,
|
test::Pretty,
|
||||||
test::RunPassPretty,
|
|
||||||
test::RunFailPretty,
|
test::RunFailPretty,
|
||||||
test::RunPassValgrindPretty,
|
test::RunPassValgrindPretty,
|
||||||
test::Crate,
|
test::Crate,
|
||||||
@ -405,6 +402,7 @@ impl<'a> Builder<'a> {
|
|||||||
test::TheBook,
|
test::TheBook,
|
||||||
test::UnstableBook,
|
test::UnstableBook,
|
||||||
test::RustcBook,
|
test::RustcBook,
|
||||||
|
test::RustcGuide,
|
||||||
test::EmbeddedBook,
|
test::EmbeddedBook,
|
||||||
test::EditionGuide,
|
test::EditionGuide,
|
||||||
test::Rustfmt,
|
test::Rustfmt,
|
||||||
@ -545,15 +543,6 @@ impl<'a> Builder<'a> {
|
|||||||
parent: Cell::new(None),
|
parent: Cell::new(None),
|
||||||
};
|
};
|
||||||
|
|
||||||
if kind == Kind::Dist {
|
|
||||||
assert!(
|
|
||||||
!builder.config.test_miri,
|
|
||||||
"Do not distribute with miri enabled.\n\
|
|
||||||
The distributed libraries would include all MIR (increasing binary size).
|
|
||||||
The distributed MIR would include validation statements."
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
builder
|
builder
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -983,7 +972,6 @@ impl<'a> Builder<'a> {
|
|||||||
PathBuf::from("/path/to/nowhere/rustdoc/not/required")
|
PathBuf::from("/path/to/nowhere/rustdoc/not/required")
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
.env("TEST_MIRI", self.config.test_miri.to_string())
|
|
||||||
.env("RUSTC_ERROR_METADATA_DST", self.extended_error_dir());
|
.env("RUSTC_ERROR_METADATA_DST", self.extended_error_dir());
|
||||||
|
|
||||||
if let Some(host_linker) = self.linker(compiler.host) {
|
if let Some(host_linker) = self.linker(compiler.host) {
|
||||||
|
@ -629,7 +629,6 @@ fn test_with_no_doc_stage0() {
|
|||||||
fn test_exclude() {
|
fn test_exclude() {
|
||||||
let mut config = configure(&[], &[]);
|
let mut config = configure(&[], &[]);
|
||||||
config.exclude = vec![
|
config.exclude = vec![
|
||||||
"src/test/run-pass".into(),
|
|
||||||
"src/tools/tidy".into(),
|
"src/tools/tidy".into(),
|
||||||
];
|
];
|
||||||
config.cmd = Subcommand::Test {
|
config.cmd = Subcommand::Test {
|
||||||
@ -648,11 +647,9 @@ fn test_exclude() {
|
|||||||
let builder = Builder::new(&build);
|
let builder = Builder::new(&build);
|
||||||
builder.run_step_descriptions(&Builder::get_step_descriptions(Kind::Test), &[]);
|
builder.run_step_descriptions(&Builder::get_step_descriptions(Kind::Test), &[]);
|
||||||
|
|
||||||
// Ensure we have really excluded run-pass & tidy
|
// Ensure we have really excluded tidy
|
||||||
assert!(!builder.cache.contains::<test::RunPass>());
|
|
||||||
assert!(!builder.cache.contains::<test::Tidy>());
|
assert!(!builder.cache.contains::<test::Tidy>());
|
||||||
|
|
||||||
// Ensure other tests are not affected.
|
// Ensure other tests are not affected.
|
||||||
assert!(builder.cache.contains::<test::RunPassFullDeps>());
|
|
||||||
assert!(builder.cache.contains::<test::RustdocUi>());
|
assert!(builder.cache.contains::<test::RustdocUi>());
|
||||||
}
|
}
|
||||||
|
@ -266,8 +266,10 @@ impl Cache {
|
|||||||
.expect("invalid type mapped");
|
.expect("invalid type mapped");
|
||||||
stepcache.get(step).cloned()
|
stepcache.get(step).cloned()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
impl Cache {
|
||||||
pub fn all<S: Ord + Copy + Step>(&mut self) -> Vec<(S, S::Output)> {
|
pub fn all<S: Ord + Copy + Step>(&mut self) -> Vec<(S, S::Output)> {
|
||||||
let cache = self.0.get_mut();
|
let cache = self.0.get_mut();
|
||||||
let type_id = TypeId::of::<S>();
|
let type_id = TypeId::of::<S>();
|
||||||
@ -279,7 +281,6 @@ impl Cache {
|
|||||||
v
|
v
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
pub fn contains<S: Step>(&self) -> bool {
|
pub fn contains<S: Step>(&self) -> bool {
|
||||||
self.0.borrow().contains_key(&TypeId::of::<S>())
|
self.0.borrow().contains_key(&TypeId::of::<S>())
|
||||||
}
|
}
|
||||||
|
@ -45,6 +45,8 @@ fn cc2ar(cc: &Path, target: &str) -> Option<PathBuf> {
|
|||||||
Some(PathBuf::from("ar"))
|
Some(PathBuf::from("ar"))
|
||||||
} else if target.contains("openbsd") {
|
} else if target.contains("openbsd") {
|
||||||
Some(PathBuf::from("ar"))
|
Some(PathBuf::from("ar"))
|
||||||
|
} else if target.contains("vxworks") {
|
||||||
|
Some(PathBuf::from("vx-ar"))
|
||||||
} else {
|
} else {
|
||||||
let parent = cc.parent().unwrap();
|
let parent = cc.parent().unwrap();
|
||||||
let file = cc.file_name().unwrap().to_str().unwrap();
|
let file = cc.file_name().unwrap().to_str().unwrap();
|
||||||
|
@ -13,7 +13,7 @@ use build_helper::output;
|
|||||||
use crate::Build;
|
use crate::Build;
|
||||||
|
|
||||||
// The version number
|
// The version number
|
||||||
pub const CFG_RELEASE_NUM: &str = "1.37.0";
|
pub const CFG_RELEASE_NUM: &str = "1.38.0";
|
||||||
|
|
||||||
pub struct GitInfo {
|
pub struct GitInfo {
|
||||||
inner: Option<Info>,
|
inner: Option<Info>,
|
||||||
|
@ -50,7 +50,6 @@ impl Step for Std {
|
|||||||
let mut cargo = builder.cargo(compiler, Mode::Std, target, cargo_subcommand(builder.kind));
|
let mut cargo = builder.cargo(compiler, Mode::Std, target, cargo_subcommand(builder.kind));
|
||||||
std_cargo(builder, &compiler, target, &mut cargo);
|
std_cargo(builder, &compiler, target, &mut cargo);
|
||||||
|
|
||||||
let _folder = builder.fold_output(|| format!("stage{}-std", compiler.stage));
|
|
||||||
builder.info(&format!("Checking std artifacts ({} -> {})", &compiler.host, target));
|
builder.info(&format!("Checking std artifacts ({} -> {})", &compiler.host, target));
|
||||||
run_cargo(builder,
|
run_cargo(builder,
|
||||||
&mut cargo,
|
&mut cargo,
|
||||||
@ -99,7 +98,6 @@ impl Step for Rustc {
|
|||||||
cargo_subcommand(builder.kind));
|
cargo_subcommand(builder.kind));
|
||||||
rustc_cargo(builder, &mut cargo);
|
rustc_cargo(builder, &mut cargo);
|
||||||
|
|
||||||
let _folder = builder.fold_output(|| format!("stage{}-rustc", compiler.stage));
|
|
||||||
builder.info(&format!("Checking compiler artifacts ({} -> {})", &compiler.host, target));
|
builder.info(&format!("Checking compiler artifacts ({} -> {})", &compiler.host, target));
|
||||||
run_cargo(builder,
|
run_cargo(builder,
|
||||||
&mut cargo,
|
&mut cargo,
|
||||||
@ -153,7 +151,6 @@ impl Step for CodegenBackend {
|
|||||||
|
|
||||||
// We won't build LLVM if it's not available, as it shouldn't affect `check`.
|
// We won't build LLVM if it's not available, as it shouldn't affect `check`.
|
||||||
|
|
||||||
let _folder = builder.fold_output(|| format!("stage{}-rustc_codegen_llvm", compiler.stage));
|
|
||||||
run_cargo(builder,
|
run_cargo(builder,
|
||||||
&mut cargo,
|
&mut cargo,
|
||||||
args(builder.kind),
|
args(builder.kind),
|
||||||
@ -190,7 +187,6 @@ impl Step for Test {
|
|||||||
let mut cargo = builder.cargo(compiler, Mode::Test, target, cargo_subcommand(builder.kind));
|
let mut cargo = builder.cargo(compiler, Mode::Test, target, cargo_subcommand(builder.kind));
|
||||||
test_cargo(builder, &compiler, target, &mut cargo);
|
test_cargo(builder, &compiler, target, &mut cargo);
|
||||||
|
|
||||||
let _folder = builder.fold_output(|| format!("stage{}-test", compiler.stage));
|
|
||||||
builder.info(&format!("Checking test artifacts ({} -> {})", &compiler.host, target));
|
builder.info(&format!("Checking test artifacts ({} -> {})", &compiler.host, target));
|
||||||
run_cargo(builder,
|
run_cargo(builder,
|
||||||
&mut cargo,
|
&mut cargo,
|
||||||
@ -239,7 +235,6 @@ impl Step for Rustdoc {
|
|||||||
SourceType::InTree,
|
SourceType::InTree,
|
||||||
&[]);
|
&[]);
|
||||||
|
|
||||||
let _folder = builder.fold_output(|| format!("stage{}-rustdoc", compiler.stage));
|
|
||||||
println!("Checking rustdoc artifacts ({} -> {})", &compiler.host, target);
|
println!("Checking rustdoc artifacts ({} -> {})", &compiler.host, target);
|
||||||
run_cargo(builder,
|
run_cargo(builder,
|
||||||
&mut cargo,
|
&mut cargo,
|
||||||
|
@ -95,7 +95,6 @@ impl Step for Std {
|
|||||||
let mut cargo = builder.cargo(compiler, Mode::Std, target, "build");
|
let mut cargo = builder.cargo(compiler, Mode::Std, target, "build");
|
||||||
std_cargo(builder, &compiler, target, &mut cargo);
|
std_cargo(builder, &compiler, target, &mut cargo);
|
||||||
|
|
||||||
let _folder = builder.fold_output(|| format!("stage{}-std", compiler.stage));
|
|
||||||
builder.info(&format!("Building stage{} std artifacts ({} -> {})", compiler.stage,
|
builder.info(&format!("Building stage{} std artifacts ({} -> {})", compiler.stage,
|
||||||
&compiler.host, target));
|
&compiler.host, target));
|
||||||
run_cargo(builder,
|
run_cargo(builder,
|
||||||
@ -326,7 +325,7 @@ impl Step for StartupObjects {
|
|||||||
fn run(self, builder: &Builder<'_>) {
|
fn run(self, builder: &Builder<'_>) {
|
||||||
let for_compiler = self.compiler;
|
let for_compiler = self.compiler;
|
||||||
let target = self.target;
|
let target = self.target;
|
||||||
if !target.contains("pc-windows-gnu") {
|
if !target.contains("windows-gnu") {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -422,7 +421,6 @@ impl Step for Test {
|
|||||||
let mut cargo = builder.cargo(compiler, Mode::Test, target, "build");
|
let mut cargo = builder.cargo(compiler, Mode::Test, target, "build");
|
||||||
test_cargo(builder, &compiler, target, &mut cargo);
|
test_cargo(builder, &compiler, target, &mut cargo);
|
||||||
|
|
||||||
let _folder = builder.fold_output(|| format!("stage{}-test", compiler.stage));
|
|
||||||
builder.info(&format!("Building stage{} test artifacts ({} -> {})", compiler.stage,
|
builder.info(&format!("Building stage{} test artifacts ({} -> {})", compiler.stage,
|
||||||
&compiler.host, target));
|
&compiler.host, target));
|
||||||
run_cargo(builder,
|
run_cargo(builder,
|
||||||
@ -555,7 +553,6 @@ impl Step for Rustc {
|
|||||||
let mut cargo = builder.cargo(compiler, Mode::Rustc, target, "build");
|
let mut cargo = builder.cargo(compiler, Mode::Rustc, target, "build");
|
||||||
rustc_cargo(builder, &mut cargo);
|
rustc_cargo(builder, &mut cargo);
|
||||||
|
|
||||||
let _folder = builder.fold_output(|| format!("stage{}-rustc", compiler.stage));
|
|
||||||
builder.info(&format!("Building stage{} compiler artifacts ({} -> {})",
|
builder.info(&format!("Building stage{} compiler artifacts ({} -> {})",
|
||||||
compiler.stage, &compiler.host, target));
|
compiler.stage, &compiler.host, target));
|
||||||
run_cargo(builder,
|
run_cargo(builder,
|
||||||
@ -710,7 +707,6 @@ impl Step for CodegenBackend {
|
|||||||
|
|
||||||
let tmp_stamp = out_dir.join(".tmp.stamp");
|
let tmp_stamp = out_dir.join(".tmp.stamp");
|
||||||
|
|
||||||
let _folder = builder.fold_output(|| format!("stage{}-rustc_codegen_llvm", compiler.stage));
|
|
||||||
let files = run_cargo(builder,
|
let files = run_cargo(builder,
|
||||||
cargo.arg("--features").arg(features),
|
cargo.arg("--features").arg(features),
|
||||||
vec![],
|
vec![],
|
||||||
@ -1130,6 +1126,7 @@ pub fn run_cargo(builder: &Builder<'_>,
|
|||||||
// Skip files like executables
|
// Skip files like executables
|
||||||
if !filename.ends_with(".rlib") &&
|
if !filename.ends_with(".rlib") &&
|
||||||
!filename.ends_with(".lib") &&
|
!filename.ends_with(".lib") &&
|
||||||
|
!filename.ends_with(".a") &&
|
||||||
!is_dylib(&filename) &&
|
!is_dylib(&filename) &&
|
||||||
!(is_check && filename.ends_with(".rmeta")) {
|
!(is_check && filename.ends_with(".rmeta")) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -75,7 +75,7 @@ pub struct Config {
|
|||||||
pub llvm_link_shared: bool,
|
pub llvm_link_shared: bool,
|
||||||
pub llvm_clang_cl: Option<String>,
|
pub llvm_clang_cl: Option<String>,
|
||||||
pub llvm_targets: Option<String>,
|
pub llvm_targets: Option<String>,
|
||||||
pub llvm_experimental_targets: String,
|
pub llvm_experimental_targets: Option<String>,
|
||||||
pub llvm_link_jobs: Option<u32>,
|
pub llvm_link_jobs: Option<u32>,
|
||||||
pub llvm_version_suffix: Option<String>,
|
pub llvm_version_suffix: Option<String>,
|
||||||
pub llvm_use_linker: Option<String>,
|
pub llvm_use_linker: Option<String>,
|
||||||
@ -128,7 +128,6 @@ pub struct Config {
|
|||||||
pub low_priority: bool,
|
pub low_priority: bool,
|
||||||
pub channel: String,
|
pub channel: String,
|
||||||
pub verbose_tests: bool,
|
pub verbose_tests: bool,
|
||||||
pub test_miri: bool,
|
|
||||||
pub save_toolstates: Option<PathBuf>,
|
pub save_toolstates: Option<PathBuf>,
|
||||||
pub print_step_timings: bool,
|
pub print_step_timings: bool,
|
||||||
pub missing_tools: bool,
|
pub missing_tools: bool,
|
||||||
@ -315,7 +314,6 @@ struct Rust {
|
|||||||
debug: Option<bool>,
|
debug: Option<bool>,
|
||||||
dist_src: Option<bool>,
|
dist_src: Option<bool>,
|
||||||
verbose_tests: Option<bool>,
|
verbose_tests: Option<bool>,
|
||||||
test_miri: Option<bool>,
|
|
||||||
incremental: Option<bool>,
|
incremental: Option<bool>,
|
||||||
save_toolstates: Option<String>,
|
save_toolstates: Option<String>,
|
||||||
codegen_backends: Option<Vec<String>>,
|
codegen_backends: Option<Vec<String>>,
|
||||||
@ -375,7 +373,6 @@ impl Config {
|
|||||||
config.codegen_tests = true;
|
config.codegen_tests = true;
|
||||||
config.ignore_git = false;
|
config.ignore_git = false;
|
||||||
config.rust_dist_src = true;
|
config.rust_dist_src = true;
|
||||||
config.test_miri = false;
|
|
||||||
config.rust_codegen_backends = vec![INTERNER.intern_str("llvm")];
|
config.rust_codegen_backends = vec![INTERNER.intern_str("llvm")];
|
||||||
config.rust_codegen_backends_dir = "codegen-backends".to_owned();
|
config.rust_codegen_backends_dir = "codegen-backends".to_owned();
|
||||||
config.deny_warnings = true;
|
config.deny_warnings = true;
|
||||||
@ -405,7 +402,7 @@ impl Config {
|
|||||||
config.incremental = flags.incremental;
|
config.incremental = flags.incremental;
|
||||||
config.dry_run = flags.dry_run;
|
config.dry_run = flags.dry_run;
|
||||||
config.keep_stage = flags.keep_stage;
|
config.keep_stage = flags.keep_stage;
|
||||||
if let Some(value) = flags.warnings {
|
if let Some(value) = flags.deny_warnings {
|
||||||
config.deny_warnings = value;
|
config.deny_warnings = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -524,8 +521,7 @@ impl Config {
|
|||||||
set(&mut config.llvm_static_stdcpp, llvm.static_libstdcpp);
|
set(&mut config.llvm_static_stdcpp, llvm.static_libstdcpp);
|
||||||
set(&mut config.llvm_link_shared, llvm.link_shared);
|
set(&mut config.llvm_link_shared, llvm.link_shared);
|
||||||
config.llvm_targets = llvm.targets.clone();
|
config.llvm_targets = llvm.targets.clone();
|
||||||
config.llvm_experimental_targets = llvm.experimental_targets.clone()
|
config.llvm_experimental_targets = llvm.experimental_targets.clone();
|
||||||
.unwrap_or_else(|| "WebAssembly;RISCV".to_string());
|
|
||||||
config.llvm_link_jobs = llvm.link_jobs;
|
config.llvm_link_jobs = llvm.link_jobs;
|
||||||
config.llvm_version_suffix = llvm.version_suffix.clone();
|
config.llvm_version_suffix = llvm.version_suffix.clone();
|
||||||
config.llvm_clang_cl = llvm.clang_cl.clone();
|
config.llvm_clang_cl = llvm.clang_cl.clone();
|
||||||
@ -558,7 +554,6 @@ impl Config {
|
|||||||
set(&mut config.channel, rust.channel.clone());
|
set(&mut config.channel, rust.channel.clone());
|
||||||
set(&mut config.rust_dist_src, rust.dist_src);
|
set(&mut config.rust_dist_src, rust.dist_src);
|
||||||
set(&mut config.verbose_tests, rust.verbose_tests);
|
set(&mut config.verbose_tests, rust.verbose_tests);
|
||||||
set(&mut config.test_miri, rust.test_miri);
|
|
||||||
// in the case "false" is set explicitly, do not overwrite the command line args
|
// in the case "false" is set explicitly, do not overwrite the command line args
|
||||||
if let Some(true) = rust.incremental {
|
if let Some(true) = rust.incremental {
|
||||||
config.incremental = true;
|
config.incremental = true;
|
||||||
@ -571,7 +566,7 @@ impl Config {
|
|||||||
config.rustc_default_linker = rust.default_linker.clone();
|
config.rustc_default_linker = rust.default_linker.clone();
|
||||||
config.musl_root = rust.musl_root.clone().map(PathBuf::from);
|
config.musl_root = rust.musl_root.clone().map(PathBuf::from);
|
||||||
config.save_toolstates = rust.save_toolstates.clone().map(PathBuf::from);
|
config.save_toolstates = rust.save_toolstates.clone().map(PathBuf::from);
|
||||||
set(&mut config.deny_warnings, rust.deny_warnings.or(flags.warnings));
|
set(&mut config.deny_warnings, flags.deny_warnings.or(rust.deny_warnings));
|
||||||
set(&mut config.backtrace_on_ice, rust.backtrace_on_ice);
|
set(&mut config.backtrace_on_ice, rust.backtrace_on_ice);
|
||||||
set(&mut config.rust_verify_llvm_ir, rust.verify_llvm_ir);
|
set(&mut config.rust_verify_llvm_ir, rust.verify_llvm_ir);
|
||||||
set(&mut config.rust_remap_debuginfo, rust.remap_debuginfo);
|
set(&mut config.rust_remap_debuginfo, rust.remap_debuginfo);
|
||||||
|
@ -36,7 +36,6 @@ o("docs", "build.docs", "build standard library documentation")
|
|||||||
o("compiler-docs", "build.compiler-docs", "build compiler documentation")
|
o("compiler-docs", "build.compiler-docs", "build compiler documentation")
|
||||||
o("optimize-tests", "rust.optimize-tests", "build tests with optimizations")
|
o("optimize-tests", "rust.optimize-tests", "build tests with optimizations")
|
||||||
o("parallel-compiler", "rust.parallel-compiler", "build a multi-threaded rustc")
|
o("parallel-compiler", "rust.parallel-compiler", "build a multi-threaded rustc")
|
||||||
o("test-miri", "rust.test-miri", "run miri's test suite")
|
|
||||||
o("verbose-tests", "rust.verbose-tests", "enable verbose output when running tests")
|
o("verbose-tests", "rust.verbose-tests", "enable verbose output when running tests")
|
||||||
o("ccache", "llvm.ccache", "invoke gcc/clang via ccache to reuse object files between builds")
|
o("ccache", "llvm.ccache", "invoke gcc/clang via ccache to reuse object files between builds")
|
||||||
o("sccache", None, "invoke gcc/clang via sccache to reuse object files between builds")
|
o("sccache", None, "invoke gcc/clang via sccache to reuse object files between builds")
|
||||||
@ -125,7 +124,9 @@ v("musl-root-armhf", "target.arm-unknown-linux-musleabihf.musl-root",
|
|||||||
"arm-unknown-linux-musleabihf install directory")
|
"arm-unknown-linux-musleabihf install directory")
|
||||||
v("musl-root-armv5te", "target.armv5te-unknown-linux-musleabi.musl-root",
|
v("musl-root-armv5te", "target.armv5te-unknown-linux-musleabi.musl-root",
|
||||||
"armv5te-unknown-linux-musleabi install directory")
|
"armv5te-unknown-linux-musleabi install directory")
|
||||||
v("musl-root-armv7", "target.armv7-unknown-linux-musleabihf.musl-root",
|
v("musl-root-armv7", "target.armv7-unknown-linux-musleabi.musl-root",
|
||||||
|
"armv7-unknown-linux-musleabi install directory")
|
||||||
|
v("musl-root-armv7hf", "target.armv7-unknown-linux-musleabihf.musl-root",
|
||||||
"armv7-unknown-linux-musleabihf install directory")
|
"armv7-unknown-linux-musleabihf install directory")
|
||||||
v("musl-root-aarch64", "target.aarch64-unknown-linux-musl.musl-root",
|
v("musl-root-aarch64", "target.aarch64-unknown-linux-musl.musl-root",
|
||||||
"aarch64-unknown-linux-musl install directory")
|
"aarch64-unknown-linux-musl install directory")
|
||||||
|
@ -808,6 +808,7 @@ fn copy_src_dirs(builder: &Builder<'_>, src_dirs: &[&str], exclude_dirs: &[&str]
|
|||||||
"llvm-project/lld", "llvm-project\\lld",
|
"llvm-project/lld", "llvm-project\\lld",
|
||||||
"llvm-project/lldb", "llvm-project\\lldb",
|
"llvm-project/lldb", "llvm-project\\lldb",
|
||||||
"llvm-project/llvm", "llvm-project\\llvm",
|
"llvm-project/llvm", "llvm-project\\llvm",
|
||||||
|
"llvm-project/compiler-rt", "llvm-project\\compiler-rt",
|
||||||
];
|
];
|
||||||
if spath.contains("llvm-project") && !spath.ends_with("llvm-project")
|
if spath.contains("llvm-project") && !spath.ends_with("llvm-project")
|
||||||
&& !LLVM_PROJECTS.iter().any(|path| spath.contains(path))
|
&& !LLVM_PROJECTS.iter().any(|path| spath.contains(path))
|
||||||
@ -903,7 +904,7 @@ impl Step for Src {
|
|||||||
"src/libtest",
|
"src/libtest",
|
||||||
"src/libterm",
|
"src/libterm",
|
||||||
"src/libprofiler_builtins",
|
"src/libprofiler_builtins",
|
||||||
"src/stdsimd",
|
"src/stdarch",
|
||||||
"src/libproc_macro",
|
"src/libproc_macro",
|
||||||
"src/tools/rustc-std-workspace-core",
|
"src/tools/rustc-std-workspace-core",
|
||||||
"src/tools/rustc-std-workspace-alloc",
|
"src/tools/rustc-std-workspace-alloc",
|
||||||
@ -935,8 +936,6 @@ impl Step for Src {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const CARGO_VENDOR_VERSION: &str = "0.1.22";
|
|
||||||
|
|
||||||
#[derive(Debug, PartialOrd, Ord, Copy, Clone, Hash, PartialEq, Eq)]
|
#[derive(Debug, PartialOrd, Ord, Copy, Clone, Hash, PartialEq, Eq)]
|
||||||
pub struct PlainSourceTarball;
|
pub struct PlainSourceTarball;
|
||||||
|
|
||||||
@ -998,26 +997,6 @@ impl Step for PlainSourceTarball {
|
|||||||
|
|
||||||
// If we're building from git sources, we need to vendor a complete distribution.
|
// If we're building from git sources, we need to vendor a complete distribution.
|
||||||
if builder.rust_info.is_git() {
|
if builder.rust_info.is_git() {
|
||||||
// Get cargo-vendor installed, if it isn't already.
|
|
||||||
let mut has_cargo_vendor = false;
|
|
||||||
let mut cmd = Command::new(&builder.initial_cargo);
|
|
||||||
for line in output(cmd.arg("install").arg("--list")).lines() {
|
|
||||||
has_cargo_vendor |= line.starts_with("cargo-vendor ");
|
|
||||||
}
|
|
||||||
if !has_cargo_vendor {
|
|
||||||
let mut cmd = builder.cargo(
|
|
||||||
builder.compiler(0, builder.config.build),
|
|
||||||
Mode::ToolBootstrap,
|
|
||||||
builder.config.build,
|
|
||||||
"install"
|
|
||||||
);
|
|
||||||
cmd.arg("--force")
|
|
||||||
.arg("--debug")
|
|
||||||
.arg("--vers").arg(CARGO_VENDOR_VERSION)
|
|
||||||
.arg("cargo-vendor");
|
|
||||||
builder.run(&mut cmd);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Vendor all Cargo dependencies
|
// Vendor all Cargo dependencies
|
||||||
let mut cmd = Command::new(&builder.initial_cargo);
|
let mut cmd = Command::new(&builder.initial_cargo);
|
||||||
cmd.arg("vendor")
|
cmd.arg("vendor")
|
||||||
|
@ -23,7 +23,7 @@ use crate::cache::{INTERNER, Interned};
|
|||||||
use crate::config::Config;
|
use crate::config::Config;
|
||||||
|
|
||||||
macro_rules! book {
|
macro_rules! book {
|
||||||
($($name:ident, $path:expr, $book_name:expr, $book_ver:expr;)+) => {
|
($($name:ident, $path:expr, $book_name:expr;)+) => {
|
||||||
$(
|
$(
|
||||||
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
|
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
|
||||||
pub struct $name {
|
pub struct $name {
|
||||||
@ -49,7 +49,6 @@ macro_rules! book {
|
|||||||
builder.ensure(RustbookSrc {
|
builder.ensure(RustbookSrc {
|
||||||
target: self.target,
|
target: self.target,
|
||||||
name: INTERNER.intern_str($book_name),
|
name: INTERNER.intern_str($book_name),
|
||||||
version: $book_ver,
|
|
||||||
src: doc_src(builder),
|
src: doc_src(builder),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -61,21 +60,15 @@ macro_rules! book {
|
|||||||
// NOTE: When adding a book here, make sure to ALSO build the book by
|
// NOTE: When adding a book here, make sure to ALSO build the book by
|
||||||
// adding a build step in `src/bootstrap/builder.rs`!
|
// adding a build step in `src/bootstrap/builder.rs`!
|
||||||
book!(
|
book!(
|
||||||
EditionGuide, "src/doc/edition-guide", "edition-guide", RustbookVersion::Latest;
|
EditionGuide, "src/doc/edition-guide", "edition-guide";
|
||||||
EmbeddedBook, "src/doc/embedded-book", "embedded-book", RustbookVersion::Latest;
|
EmbeddedBook, "src/doc/embedded-book", "embedded-book";
|
||||||
Nomicon, "src/doc/nomicon", "nomicon", RustbookVersion::Latest;
|
Nomicon, "src/doc/nomicon", "nomicon";
|
||||||
Reference, "src/doc/reference", "reference", RustbookVersion::MdBook1;
|
Reference, "src/doc/reference", "reference";
|
||||||
RustByExample, "src/doc/rust-by-example", "rust-by-example", RustbookVersion::Latest;
|
RustByExample, "src/doc/rust-by-example", "rust-by-example";
|
||||||
RustcBook, "src/doc/rustc", "rustc", RustbookVersion::MdBook1;
|
RustcBook, "src/doc/rustc", "rustc";
|
||||||
RustdocBook, "src/doc/rustdoc", "rustdoc", RustbookVersion::Latest;
|
RustdocBook, "src/doc/rustdoc", "rustdoc";
|
||||||
);
|
);
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
|
|
||||||
enum RustbookVersion {
|
|
||||||
MdBook1,
|
|
||||||
Latest,
|
|
||||||
}
|
|
||||||
|
|
||||||
fn doc_src(builder: &Builder<'_>) -> Interned<PathBuf> {
|
fn doc_src(builder: &Builder<'_>) -> Interned<PathBuf> {
|
||||||
INTERNER.intern_path(builder.src.join("src/doc"))
|
INTERNER.intern_path(builder.src.join("src/doc"))
|
||||||
}
|
}
|
||||||
@ -108,7 +101,6 @@ impl Step for UnstableBook {
|
|||||||
target: self.target,
|
target: self.target,
|
||||||
name: INTERNER.intern_str("unstable-book"),
|
name: INTERNER.intern_str("unstable-book"),
|
||||||
src: builder.md_doc_out(self.target),
|
src: builder.md_doc_out(self.target),
|
||||||
version: RustbookVersion::Latest,
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -162,7 +154,6 @@ struct RustbookSrc {
|
|||||||
target: Interned<String>,
|
target: Interned<String>,
|
||||||
name: Interned<String>,
|
name: Interned<String>,
|
||||||
src: Interned<PathBuf>,
|
src: Interned<PathBuf>,
|
||||||
version: RustbookVersion,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Step for RustbookSrc {
|
impl Step for RustbookSrc {
|
||||||
@ -194,18 +185,11 @@ impl Step for RustbookSrc {
|
|||||||
builder.info(&format!("Rustbook ({}) - {}", target, name));
|
builder.info(&format!("Rustbook ({}) - {}", target, name));
|
||||||
let _ = fs::remove_dir_all(&out);
|
let _ = fs::remove_dir_all(&out);
|
||||||
|
|
||||||
let vers = match self.version {
|
|
||||||
RustbookVersion::MdBook1 => "1",
|
|
||||||
RustbookVersion::Latest => "3",
|
|
||||||
};
|
|
||||||
|
|
||||||
builder.run(rustbook_cmd
|
builder.run(rustbook_cmd
|
||||||
.arg("build")
|
.arg("build")
|
||||||
.arg(&src)
|
.arg(&src)
|
||||||
.arg("-d")
|
.arg("-d")
|
||||||
.arg(out)
|
.arg(out));
|
||||||
.arg("-m")
|
|
||||||
.arg(vers));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -251,7 +235,6 @@ impl Step for TheBook {
|
|||||||
builder.ensure(RustbookSrc {
|
builder.ensure(RustbookSrc {
|
||||||
target,
|
target,
|
||||||
name: INTERNER.intern_string(name.to_string()),
|
name: INTERNER.intern_string(name.to_string()),
|
||||||
version: RustbookVersion::Latest,
|
|
||||||
src: doc_src(builder),
|
src: doc_src(builder),
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -261,7 +244,6 @@ impl Step for TheBook {
|
|||||||
builder.ensure(RustbookSrc {
|
builder.ensure(RustbookSrc {
|
||||||
target,
|
target,
|
||||||
name: INTERNER.intern_string(source_name),
|
name: INTERNER.intern_string(source_name),
|
||||||
version: RustbookVersion::Latest,
|
|
||||||
src: doc_src(builder),
|
src: doc_src(builder),
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -269,7 +251,6 @@ impl Step for TheBook {
|
|||||||
builder.ensure(RustbookSrc {
|
builder.ensure(RustbookSrc {
|
||||||
target,
|
target,
|
||||||
name: INTERNER.intern_string(source_name),
|
name: INTERNER.intern_string(source_name),
|
||||||
version: RustbookVersion::Latest,
|
|
||||||
src: doc_src(builder),
|
src: doc_src(builder),
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -277,7 +258,6 @@ impl Step for TheBook {
|
|||||||
builder.ensure(RustbookSrc {
|
builder.ensure(RustbookSrc {
|
||||||
target,
|
target,
|
||||||
name: INTERNER.intern_string(source_name),
|
name: INTERNER.intern_string(source_name),
|
||||||
version: RustbookVersion::Latest,
|
|
||||||
src: doc_src(builder),
|
src: doc_src(builder),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -33,8 +33,11 @@ pub struct Flags {
|
|||||||
pub rustc_error_format: Option<String>,
|
pub rustc_error_format: Option<String>,
|
||||||
pub dry_run: bool,
|
pub dry_run: bool,
|
||||||
|
|
||||||
// true => deny
|
// This overrides the deny-warnings configuation option,
|
||||||
pub warnings: Option<bool>,
|
// which passes -Dwarnings to the compiler invocations.
|
||||||
|
//
|
||||||
|
// true => deny, false => allow
|
||||||
|
pub deny_warnings: Option<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub enum Subcommand {
|
pub enum Subcommand {
|
||||||
@ -327,7 +330,7 @@ Arguments:
|
|||||||
This subcommand accepts a number of paths to directories to tests that
|
This subcommand accepts a number of paths to directories to tests that
|
||||||
should be compiled and run. For example:
|
should be compiled and run. For example:
|
||||||
|
|
||||||
./x.py test src/test/run-pass
|
./x.py test src/test/ui
|
||||||
./x.py test src/libstd --test-args hash_map
|
./x.py test src/libstd --test-args hash_map
|
||||||
./x.py test src/libstd --stage 0 --no-doc
|
./x.py test src/libstd --stage 0 --no-doc
|
||||||
./x.py test src/test/ui --bless
|
./x.py test src/test/ui --bless
|
||||||
@ -468,7 +471,7 @@ Arguments:
|
|||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|p| p.into())
|
.map(|p| p.into())
|
||||||
.collect::<Vec<_>>(),
|
.collect::<Vec<_>>(),
|
||||||
warnings: matches.opt_str("warnings").map(|v| v == "deny"),
|
deny_warnings: parse_deny_warnings(&matches),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -549,3 +552,18 @@ fn split(s: &[String]) -> Vec<String> {
|
|||||||
.map(|s| s.to_string())
|
.map(|s| s.to_string())
|
||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn parse_deny_warnings(matches: &getopts::Matches) -> Option<bool> {
|
||||||
|
match matches.opt_str("warnings").as_ref().map(|v| v.as_str()) {
|
||||||
|
Some("deny") => Some(true),
|
||||||
|
Some("allow") => Some(false),
|
||||||
|
Some(value) => {
|
||||||
|
eprintln!(
|
||||||
|
r#"invalid value for --warnings: {:?}, expected "allow" or "deny""#,
|
||||||
|
value,
|
||||||
|
);
|
||||||
|
process::exit(1);
|
||||||
|
},
|
||||||
|
None => None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -103,8 +103,9 @@
|
|||||||
//! More documentation can be found in each respective module below, and you can
|
//! More documentation can be found in each respective module below, and you can
|
||||||
//! also check out the `src/bootstrap/README.md` file for more information.
|
//! also check out the `src/bootstrap/README.md` file for more information.
|
||||||
|
|
||||||
#![deny(rust_2018_idioms)]
|
// NO-RUSTC-WRAPPER
|
||||||
#![deny(warnings)]
|
#![deny(warnings, rust_2018_idioms, unused_lifetimes)]
|
||||||
|
|
||||||
#![feature(core_intrinsics)]
|
#![feature(core_intrinsics)]
|
||||||
#![feature(drain_filter)]
|
#![feature(drain_filter)]
|
||||||
|
|
||||||
@ -124,11 +125,11 @@ use std::os::unix::fs::symlink as symlink_file;
|
|||||||
use std::os::windows::fs::symlink_file;
|
use std::os::windows::fs::symlink_file;
|
||||||
|
|
||||||
use build_helper::{
|
use build_helper::{
|
||||||
mtime, output, run_silent, run_suppressed, t, try_run_silent, try_run_suppressed,
|
mtime, output, run, run_suppressed, t, try_run, try_run_suppressed,
|
||||||
};
|
};
|
||||||
use filetime::FileTime;
|
use filetime::FileTime;
|
||||||
|
|
||||||
use crate::util::{exe, libdir, OutputFolder, CiEnv};
|
use crate::util::{exe, libdir, CiEnv};
|
||||||
|
|
||||||
mod cc_detect;
|
mod cc_detect;
|
||||||
mod channel;
|
mod channel;
|
||||||
@ -539,9 +540,7 @@ impl Build {
|
|||||||
Mode::Rustc => "-rustc",
|
Mode::Rustc => "-rustc",
|
||||||
Mode::Codegen => "-codegen",
|
Mode::Codegen => "-codegen",
|
||||||
Mode::ToolBootstrap => "-bootstrap-tools",
|
Mode::ToolBootstrap => "-bootstrap-tools",
|
||||||
Mode::ToolStd => "-tools",
|
Mode::ToolStd | Mode::ToolTest | Mode::ToolRustc => "-tools",
|
||||||
Mode::ToolTest => "-tools",
|
|
||||||
Mode::ToolRustc => "-tools",
|
|
||||||
};
|
};
|
||||||
self.out.join(&*compiler.host)
|
self.out.join(&*compiler.host)
|
||||||
.join(format!("stage{}{}", compiler.stage, suffix))
|
.join(format!("stage{}{}", compiler.stage, suffix))
|
||||||
@ -681,7 +680,7 @@ impl Build {
|
|||||||
fn run(&self, cmd: &mut Command) {
|
fn run(&self, cmd: &mut Command) {
|
||||||
if self.config.dry_run { return; }
|
if self.config.dry_run { return; }
|
||||||
self.verbose(&format!("running: {:?}", cmd));
|
self.verbose(&format!("running: {:?}", cmd));
|
||||||
run_silent(cmd)
|
run(cmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Runs a command, printing out nice contextual information if it fails.
|
/// Runs a command, printing out nice contextual information if it fails.
|
||||||
@ -697,7 +696,7 @@ impl Build {
|
|||||||
fn try_run(&self, cmd: &mut Command) -> bool {
|
fn try_run(&self, cmd: &mut Command) -> bool {
|
||||||
if self.config.dry_run { return true; }
|
if self.config.dry_run { return true; }
|
||||||
self.verbose(&format!("running: {:?}", cmd));
|
self.verbose(&format!("running: {:?}", cmd));
|
||||||
try_run_silent(cmd)
|
try_run(cmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Runs a command, printing out nice contextual information if it fails.
|
/// Runs a command, printing out nice contextual information if it fails.
|
||||||
@ -1092,19 +1091,6 @@ impl Build {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Fold the output of the commands after this method into a group. The fold
|
|
||||||
/// ends when the returned object is dropped. Folding can only be used in
|
|
||||||
/// the Travis CI environment.
|
|
||||||
pub fn fold_output<D, F>(&self, name: F) -> Option<OutputFolder>
|
|
||||||
where D: Into<String>, F: FnOnce() -> D
|
|
||||||
{
|
|
||||||
if !self.config.dry_run && self.ci_env == CiEnv::Travis {
|
|
||||||
Some(OutputFolder::new(name().into()))
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Updates the actual toolstate of a tool.
|
/// Updates the actual toolstate of a tool.
|
||||||
///
|
///
|
||||||
/// The toolstates are saved to the file specified by the key
|
/// The toolstates are saved to the file specified by the key
|
||||||
@ -1325,7 +1311,7 @@ fn chmod(path: &Path, perms: u32) {
|
|||||||
fn chmod(_path: &Path, _perms: u32) {}
|
fn chmod(_path: &Path, _perms: u32) {}
|
||||||
|
|
||||||
|
|
||||||
impl<'a> Compiler {
|
impl Compiler {
|
||||||
pub fn with_stage(mut self, stage: u32) -> Compiler {
|
pub fn with_stage(mut self, stage: u32) -> Compiler {
|
||||||
self.stage = stage;
|
self.stage = stage;
|
||||||
self
|
self
|
||||||
|
@ -48,10 +48,8 @@ check:
|
|||||||
$(Q)$(BOOTSTRAP) test $(BOOTSTRAP_ARGS)
|
$(Q)$(BOOTSTRAP) test $(BOOTSTRAP_ARGS)
|
||||||
check-aux:
|
check-aux:
|
||||||
$(Q)$(BOOTSTRAP) test \
|
$(Q)$(BOOTSTRAP) test \
|
||||||
src/test/run-pass/pretty \
|
|
||||||
src/test/run-fail/pretty \
|
src/test/run-fail/pretty \
|
||||||
src/test/run-pass-valgrind/pretty \
|
src/test/run-pass-valgrind/pretty \
|
||||||
src/test/run-pass-fulldeps/pretty \
|
|
||||||
$(AUX_ARGS) \
|
$(AUX_ARGS) \
|
||||||
$(BOOTSTRAP_ARGS)
|
$(BOOTSTRAP_ARGS)
|
||||||
check-bootstrap:
|
check-bootstrap:
|
||||||
@ -75,9 +73,7 @@ check-stage2-T-x86_64-unknown-linux-musl-H-x86_64-unknown-linux-gnu:
|
|||||||
|
|
||||||
TESTS_IN_2 := \
|
TESTS_IN_2 := \
|
||||||
src/test/ui \
|
src/test/ui \
|
||||||
src/test/run-pass \
|
|
||||||
src/test/compile-fail \
|
src/test/compile-fail \
|
||||||
src/test/run-pass-fulldeps \
|
|
||||||
src/tools/linkchecker
|
src/tools/linkchecker
|
||||||
|
|
||||||
ci-subset-1:
|
ci-subset-1:
|
||||||
|
@ -104,7 +104,6 @@ impl Step for Llvm {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let _folder = builder.fold_output(|| "llvm");
|
|
||||||
let descriptor = if emscripten { "Emscripten " } else { "" };
|
let descriptor = if emscripten { "Emscripten " } else { "" };
|
||||||
builder.info(&format!("Building {}LLVM for {}", descriptor, target));
|
builder.info(&format!("Building {}LLVM for {}", descriptor, target));
|
||||||
let _time = util::timeit(&builder);
|
let _time = util::timeit(&builder);
|
||||||
@ -126,14 +125,18 @@ impl Step for Llvm {
|
|||||||
} else {
|
} else {
|
||||||
match builder.config.llvm_targets {
|
match builder.config.llvm_targets {
|
||||||
Some(ref s) => s,
|
Some(ref s) => s,
|
||||||
None => "X86;ARM;AArch64;Mips;PowerPC;SystemZ;MSP430;Sparc;NVPTX;Hexagon",
|
None => "AArch64;ARM;Hexagon;MSP430;Mips;NVPTX;PowerPC;RISCV;\
|
||||||
|
Sparc;SystemZ;WebAssembly;X86",
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let llvm_exp_targets = if self.emscripten {
|
let llvm_exp_targets = if self.emscripten {
|
||||||
""
|
""
|
||||||
} else {
|
} else {
|
||||||
&builder.config.llvm_experimental_targets[..]
|
match builder.config.llvm_experimental_targets {
|
||||||
|
Some(ref s) => s,
|
||||||
|
None => "",
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let assertions = if builder.config.llvm_assertions {"ON"} else {"OFF"};
|
let assertions = if builder.config.llvm_assertions {"ON"} else {"OFF"};
|
||||||
@ -151,6 +154,7 @@ impl Step for Llvm {
|
|||||||
.define("WITH_POLLY", "OFF")
|
.define("WITH_POLLY", "OFF")
|
||||||
.define("LLVM_ENABLE_TERMINFO", "OFF")
|
.define("LLVM_ENABLE_TERMINFO", "OFF")
|
||||||
.define("LLVM_ENABLE_LIBEDIT", "OFF")
|
.define("LLVM_ENABLE_LIBEDIT", "OFF")
|
||||||
|
.define("LLVM_ENABLE_Z3_SOLVER", "OFF")
|
||||||
.define("LLVM_PARALLEL_COMPILE_JOBS", builder.jobs().to_string())
|
.define("LLVM_PARALLEL_COMPILE_JOBS", builder.jobs().to_string())
|
||||||
.define("LLVM_TARGET_ARCH", target.split('-').next().unwrap())
|
.define("LLVM_TARGET_ARCH", target.split('-').next().unwrap())
|
||||||
.define("LLVM_DEFAULT_TARGET_TRIPLE", target);
|
.define("LLVM_DEFAULT_TARGET_TRIPLE", target);
|
||||||
@ -493,7 +497,6 @@ impl Step for Lld {
|
|||||||
return out_dir
|
return out_dir
|
||||||
}
|
}
|
||||||
|
|
||||||
let _folder = builder.fold_output(|| "lld");
|
|
||||||
builder.info(&format!("Building LLD for {}", target));
|
builder.info(&format!("Building LLD for {}", target));
|
||||||
let _time = util::timeit(&builder);
|
let _time = util::timeit(&builder);
|
||||||
t!(fs::create_dir_all(&out_dir));
|
t!(fs::create_dir_all(&out_dir));
|
||||||
@ -548,7 +551,7 @@ impl Step for TestHelpers {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Compiles the `rust_test_helpers.c` library which we used in various
|
/// Compiles the `rust_test_helpers.c` library which we used in various
|
||||||
/// `run-pass` test suites for ABI testing.
|
/// `run-pass` tests for ABI testing.
|
||||||
fn run(self, builder: &Builder<'_>) {
|
fn run(self, builder: &Builder<'_>) {
|
||||||
if builder.config.dry_run {
|
if builder.config.dry_run {
|
||||||
return;
|
return;
|
||||||
@ -560,7 +563,6 @@ impl Step for TestHelpers {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
let _folder = builder.fold_output(|| "build_test_helpers");
|
|
||||||
builder.info("Building test helpers");
|
builder.info("Building test helpers");
|
||||||
t!(fs::create_dir_all(&dst));
|
t!(fs::create_dir_all(&dst));
|
||||||
let mut cfg = cc::Build::new();
|
let mut cfg = cc::Build::new();
|
||||||
|
@ -78,8 +78,11 @@ pub fn check(build: &mut Build) {
|
|||||||
|
|
||||||
// We need cmake, but only if we're actually building LLVM or sanitizers.
|
// We need cmake, but only if we're actually building LLVM or sanitizers.
|
||||||
let building_llvm = build.hosts.iter()
|
let building_llvm = build.hosts.iter()
|
||||||
.filter_map(|host| build.config.target_config.get(host))
|
.map(|host| build.config.target_config
|
||||||
.any(|config| config.llvm_config.is_none());
|
.get(host)
|
||||||
|
.map(|config| config.llvm_config.is_none())
|
||||||
|
.unwrap_or(true))
|
||||||
|
.any(|build_llvm_ourselves| build_llvm_ourselves);
|
||||||
if building_llvm || build.config.sanitizers {
|
if building_llvm || build.config.sanitizers {
|
||||||
cmd_finder.must_have("cmake");
|
cmd_finder.must_have("cmake");
|
||||||
}
|
}
|
||||||
@ -106,6 +109,14 @@ pub fn check(build: &mut Build) {
|
|||||||
build.config.ninja = true;
|
build.config.ninja = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if build.config.lldb_enabled {
|
||||||
|
cmd_finder.must_have("swig");
|
||||||
|
let out = output(Command::new("swig").arg("-version"));
|
||||||
|
if !out.contains("SWIG Version 3") && !out.contains("SWIG Version 4") {
|
||||||
|
panic!("Ensure that Swig 3.x.x or 4.x.x is installed.");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
build.config.python = build.config.python.take().map(|p| cmd_finder.must_have(p))
|
build.config.python = build.config.python.take().map(|p| cmd_finder.must_have(p))
|
||||||
|
@ -229,6 +229,9 @@ impl Step for Cargo {
|
|||||||
cargo.env("CFG_DISABLE_CROSS_TESTS", "1");
|
cargo.env("CFG_DISABLE_CROSS_TESTS", "1");
|
||||||
// Disable a test that has issues with mingw.
|
// Disable a test that has issues with mingw.
|
||||||
cargo.env("CARGO_TEST_DISABLE_GIT_CLI", "1");
|
cargo.env("CARGO_TEST_DISABLE_GIT_CLI", "1");
|
||||||
|
// Forcibly disable tests using nightly features since any changes to
|
||||||
|
// those features won't be able to land.
|
||||||
|
cargo.env("CARGO_TEST_DISABLE_NIGHTLY", "1");
|
||||||
|
|
||||||
try_run(
|
try_run(
|
||||||
builder,
|
builder,
|
||||||
@ -360,11 +363,9 @@ pub struct Miri {
|
|||||||
impl Step for Miri {
|
impl Step for Miri {
|
||||||
type Output = ();
|
type Output = ();
|
||||||
const ONLY_HOSTS: bool = true;
|
const ONLY_HOSTS: bool = true;
|
||||||
const DEFAULT: bool = true;
|
|
||||||
|
|
||||||
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
|
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
|
||||||
let test_miri = run.builder.config.test_miri;
|
run.path("src/tools/miri")
|
||||||
run.path("src/tools/miri").default_condition(test_miri)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn make_run(run: RunConfig<'_>) {
|
fn make_run(run: RunConfig<'_>) {
|
||||||
@ -386,26 +387,92 @@ impl Step for Miri {
|
|||||||
extra_features: Vec::new(),
|
extra_features: Vec::new(),
|
||||||
});
|
});
|
||||||
if let Some(miri) = miri {
|
if let Some(miri) = miri {
|
||||||
let mut cargo = tool::prepare_tool_cargo(builder,
|
// # Run `cargo miri setup`.
|
||||||
compiler,
|
// As a side-effect, this will install xargo.
|
||||||
Mode::ToolRustc,
|
let mut cargo = tool::prepare_tool_cargo(
|
||||||
host,
|
builder,
|
||||||
"test",
|
compiler,
|
||||||
"src/tools/miri",
|
Mode::ToolRustc,
|
||||||
SourceType::Submodule,
|
host,
|
||||||
&[]);
|
"run",
|
||||||
|
"src/tools/miri",
|
||||||
|
SourceType::Submodule,
|
||||||
|
&[],
|
||||||
|
);
|
||||||
|
cargo
|
||||||
|
.arg("--bin")
|
||||||
|
.arg("cargo-miri")
|
||||||
|
.arg("--")
|
||||||
|
.arg("miri")
|
||||||
|
.arg("setup");
|
||||||
|
|
||||||
|
// Tell `cargo miri` not to worry about the sysroot mismatch (we built with
|
||||||
|
// stage1 but run with stage2).
|
||||||
|
cargo.env("MIRI_SKIP_SYSROOT_CHECK", "1");
|
||||||
|
// Tell `cargo miri setup` where to find the sources.
|
||||||
|
cargo.env("XARGO_RUST_SRC", builder.src.join("src"));
|
||||||
|
// Debug things.
|
||||||
|
cargo.env("RUST_BACKTRACE", "1");
|
||||||
|
// Configure `cargo install` path, and let cargo-miri know that that's where
|
||||||
|
// xargo ends up.
|
||||||
|
cargo.env("CARGO_INSTALL_ROOT", &builder.out); // cargo adds a `bin/`
|
||||||
|
cargo.env("XARGO", builder.out.join("bin").join("xargo"));
|
||||||
|
|
||||||
|
if !try_run(builder, &mut cargo) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// # Determine where Miri put its sysroot.
|
||||||
|
// To this end, we run `cargo miri setup --env` and capture the output.
|
||||||
|
// (We do this separately from the above so that when the setup actually
|
||||||
|
// happens we get some output.)
|
||||||
|
// We re-use the `cargo` from above.
|
||||||
|
cargo.arg("--env");
|
||||||
|
|
||||||
|
// FIXME: Is there a way in which we can re-use the usual `run` helpers?
|
||||||
|
let miri_sysroot = if builder.config.dry_run {
|
||||||
|
String::new()
|
||||||
|
} else {
|
||||||
|
builder.verbose(&format!("running: {:?}", cargo));
|
||||||
|
let out = cargo.output()
|
||||||
|
.expect("We already ran `cargo miri setup` before and that worked");
|
||||||
|
assert!(out.status.success(), "`cargo miri setup` returned with non-0 exit code");
|
||||||
|
// Output is "MIRI_SYSROOT=<str>\n".
|
||||||
|
let stdout = String::from_utf8(out.stdout)
|
||||||
|
.expect("`cargo miri setup` stdout is not valid UTF-8");
|
||||||
|
let stdout = stdout.trim();
|
||||||
|
builder.verbose(&format!("`cargo miri setup --env` returned: {:?}", stdout));
|
||||||
|
let sysroot = stdout.splitn(2, '=')
|
||||||
|
.nth(1).expect("`cargo miri setup` stdout did not contain '='");
|
||||||
|
sysroot.to_owned()
|
||||||
|
};
|
||||||
|
|
||||||
|
// # Run `cargo test`.
|
||||||
|
let mut cargo = tool::prepare_tool_cargo(
|
||||||
|
builder,
|
||||||
|
compiler,
|
||||||
|
Mode::ToolRustc,
|
||||||
|
host,
|
||||||
|
"test",
|
||||||
|
"src/tools/miri",
|
||||||
|
SourceType::Submodule,
|
||||||
|
&[],
|
||||||
|
);
|
||||||
|
|
||||||
// miri tests need to know about the stage sysroot
|
// miri tests need to know about the stage sysroot
|
||||||
cargo.env("MIRI_SYSROOT", builder.sysroot(compiler));
|
cargo.env("MIRI_SYSROOT", miri_sysroot);
|
||||||
cargo.env("RUSTC_TEST_SUITE", builder.rustc(compiler));
|
cargo.env("RUSTC_TEST_SUITE", builder.rustc(compiler));
|
||||||
cargo.env("RUSTC_LIB_PATH", builder.rustc_libdir(compiler));
|
cargo.env("RUSTC_LIB_PATH", builder.rustc_libdir(compiler));
|
||||||
cargo.env("MIRI_PATH", miri);
|
cargo.env("MIRI_PATH", miri);
|
||||||
|
|
||||||
builder.add_rustc_lib_path(compiler, &mut cargo);
|
builder.add_rustc_lib_path(compiler, &mut cargo);
|
||||||
|
|
||||||
if try_run(builder, &mut cargo) {
|
if !try_run(builder, &mut cargo) {
|
||||||
builder.save_toolstate("miri", ToolState::TestPass);
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// # Done!
|
||||||
|
builder.save_toolstate("miri", ToolState::TestPass);
|
||||||
} else {
|
} else {
|
||||||
eprintln!("failed to test miri: could not build");
|
eprintln!("failed to test miri: could not build");
|
||||||
}
|
}
|
||||||
@ -713,7 +780,6 @@ impl Step for Tidy {
|
|||||||
cmd.arg("--verbose");
|
cmd.arg("--verbose");
|
||||||
}
|
}
|
||||||
|
|
||||||
let _folder = builder.fold_output(|| "tidy");
|
|
||||||
builder.info("tidy check");
|
builder.info("tidy check");
|
||||||
try_run(builder, &mut cmd);
|
try_run(builder, &mut cmd);
|
||||||
}
|
}
|
||||||
@ -821,13 +887,6 @@ default_test_with_compare_mode!(Ui {
|
|||||||
compare_mode: "nll"
|
compare_mode: "nll"
|
||||||
});
|
});
|
||||||
|
|
||||||
default_test_with_compare_mode!(RunPass {
|
|
||||||
path: "src/test/run-pass",
|
|
||||||
mode: "run-pass",
|
|
||||||
suite: "run-pass",
|
|
||||||
compare_mode: "nll"
|
|
||||||
});
|
|
||||||
|
|
||||||
default_test!(CompileFail {
|
default_test!(CompileFail {
|
||||||
path: "src/test/compile-fail",
|
path: "src/test/compile-fail",
|
||||||
mode: "compile-fail",
|
mode: "compile-fail",
|
||||||
@ -882,12 +941,6 @@ host_test!(UiFullDeps {
|
|||||||
suite: "ui-fulldeps"
|
suite: "ui-fulldeps"
|
||||||
});
|
});
|
||||||
|
|
||||||
host_test!(RunPassFullDeps {
|
|
||||||
path: "src/test/run-pass-fulldeps",
|
|
||||||
mode: "run-pass",
|
|
||||||
suite: "run-pass-fulldeps"
|
|
||||||
});
|
|
||||||
|
|
||||||
host_test!(Rustdoc {
|
host_test!(Rustdoc {
|
||||||
path: "src/test/rustdoc",
|
path: "src/test/rustdoc",
|
||||||
mode: "rustdoc",
|
mode: "rustdoc",
|
||||||
@ -899,13 +952,6 @@ host_test!(Pretty {
|
|||||||
mode: "pretty",
|
mode: "pretty",
|
||||||
suite: "pretty"
|
suite: "pretty"
|
||||||
});
|
});
|
||||||
test!(RunPassPretty {
|
|
||||||
path: "src/test/run-pass/pretty",
|
|
||||||
mode: "pretty",
|
|
||||||
suite: "run-pass",
|
|
||||||
default: false,
|
|
||||||
host: true
|
|
||||||
});
|
|
||||||
test!(RunFailPretty {
|
test!(RunFailPretty {
|
||||||
path: "src/test/run-fail/pretty",
|
path: "src/test/run-fail/pretty",
|
||||||
mode: "pretty",
|
mode: "pretty",
|
||||||
@ -1310,7 +1356,6 @@ impl Step for Compiletest {
|
|||||||
|
|
||||||
builder.ci_env.force_coloring_in_ci(&mut cmd);
|
builder.ci_env.force_coloring_in_ci(&mut cmd);
|
||||||
|
|
||||||
let _folder = builder.fold_output(|| format!("test_{}", suite));
|
|
||||||
builder.info(&format!(
|
builder.info(&format!(
|
||||||
"Check compiletest suite={} mode={} ({} -> {})",
|
"Check compiletest suite={} mode={} ({} -> {})",
|
||||||
suite, mode, &compiler.host, target
|
suite, mode, &compiler.host, target
|
||||||
@ -1320,7 +1365,6 @@ impl Step for Compiletest {
|
|||||||
|
|
||||||
if let Some(compare_mode) = compare_mode {
|
if let Some(compare_mode) = compare_mode {
|
||||||
cmd.arg("--compare-mode").arg(compare_mode);
|
cmd.arg("--compare-mode").arg(compare_mode);
|
||||||
let _folder = builder.fold_output(|| format!("test_{}_{}", suite, compare_mode));
|
|
||||||
builder.info(&format!(
|
builder.info(&format!(
|
||||||
"Check compiletest suite={} mode={} compare_mode={} ({} -> {})",
|
"Check compiletest suite={} mode={} compare_mode={} ({} -> {})",
|
||||||
suite, mode, compare_mode, &compiler.host, target
|
suite, mode, compare_mode, &compiler.host, target
|
||||||
@ -1364,7 +1408,6 @@ impl Step for DocTest {
|
|||||||
// tests for all files that end in `*.md`
|
// tests for all files that end in `*.md`
|
||||||
let mut stack = vec![builder.src.join(self.path)];
|
let mut stack = vec![builder.src.join(self.path)];
|
||||||
let _time = util::timeit(&builder);
|
let _time = util::timeit(&builder);
|
||||||
let _folder = builder.fold_output(|| format!("test_{}", self.name));
|
|
||||||
|
|
||||||
let mut files = Vec::new();
|
let mut files = Vec::new();
|
||||||
while let Some(p) = stack.pop() {
|
while let Some(p) = stack.pop() {
|
||||||
@ -1495,10 +1538,9 @@ impl Step for ErrorIndex {
|
|||||||
.env("CFG_BUILD", &builder.config.build)
|
.env("CFG_BUILD", &builder.config.build)
|
||||||
.env("RUSTC_ERROR_METADATA_DST", builder.extended_error_dir());
|
.env("RUSTC_ERROR_METADATA_DST", builder.extended_error_dir());
|
||||||
|
|
||||||
let _folder = builder.fold_output(|| "test_error_index");
|
|
||||||
builder.info(&format!("Testing error-index stage{}", compiler.stage));
|
builder.info(&format!("Testing error-index stage{}", compiler.stage));
|
||||||
let _time = util::timeit(&builder);
|
let _time = util::timeit(&builder);
|
||||||
builder.run(&mut tool);
|
builder.run_quiet(&mut tool);
|
||||||
markdown_test(builder, compiler, &output);
|
markdown_test(builder, compiler, &output);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1530,6 +1572,34 @@ fn markdown_test(builder: &Builder<'_>, compiler: Compiler, markdown: &Path) ->
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
|
||||||
|
pub struct RustcGuide;
|
||||||
|
|
||||||
|
impl Step for RustcGuide {
|
||||||
|
type Output = ();
|
||||||
|
const DEFAULT: bool = false;
|
||||||
|
const ONLY_HOSTS: bool = true;
|
||||||
|
|
||||||
|
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
|
||||||
|
run.path("src/doc/rustc-guide")
|
||||||
|
}
|
||||||
|
|
||||||
|
fn make_run(run: RunConfig<'_>) {
|
||||||
|
run.builder.ensure(RustcGuide);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn run(self, builder: &Builder<'_>) {
|
||||||
|
let src = builder.src.join("src/doc/rustc-guide");
|
||||||
|
let mut rustbook_cmd = builder.tool_cmd(Tool::Rustbook);
|
||||||
|
let toolstate = if try_run(builder, rustbook_cmd.arg("linkcheck").arg(&src)) {
|
||||||
|
ToolState::TestPass
|
||||||
|
} else {
|
||||||
|
ToolState::TestFail
|
||||||
|
};
|
||||||
|
builder.save_toolstate("rustc-guide", toolstate);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
|
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
|
||||||
pub struct CrateLibrustc {
|
pub struct CrateLibrustc {
|
||||||
compiler: Compiler,
|
compiler: Compiler,
|
||||||
@ -1794,14 +1864,6 @@ impl Step for Crate {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
let _folder = builder.fold_output(|| {
|
|
||||||
format!(
|
|
||||||
"{}_stage{}-{}",
|
|
||||||
test_kind.subcommand(),
|
|
||||||
compiler.stage,
|
|
||||||
krate
|
|
||||||
)
|
|
||||||
});
|
|
||||||
builder.info(&format!(
|
builder.info(&format!(
|
||||||
"{} {} stage{} ({} -> {})",
|
"{} {} stage{} ({} -> {})",
|
||||||
test_kind, krate, compiler.stage, &compiler.host, target
|
test_kind, krate, compiler.stage, &compiler.host, target
|
||||||
@ -1869,8 +1931,6 @@ impl Step for CrateRustdoc {
|
|||||||
cargo.arg("--quiet");
|
cargo.arg("--quiet");
|
||||||
}
|
}
|
||||||
|
|
||||||
let _folder = builder
|
|
||||||
.fold_output(|| format!("{}_stage{}-rustdoc", test_kind.subcommand(), compiler.stage));
|
|
||||||
builder.info(&format!(
|
builder.info(&format!(
|
||||||
"{} rustdoc stage{} ({} -> {})",
|
"{} rustdoc stage{} ({} -> {})",
|
||||||
test_kind, compiler.stage, &compiler.host, target
|
test_kind, compiler.stage, &compiler.host, target
|
||||||
|
@ -9,7 +9,7 @@ use build_helper::t;
|
|||||||
use crate::Mode;
|
use crate::Mode;
|
||||||
use crate::Compiler;
|
use crate::Compiler;
|
||||||
use crate::builder::{Step, RunConfig, ShouldRun, Builder};
|
use crate::builder::{Step, RunConfig, ShouldRun, Builder};
|
||||||
use crate::util::{exe, add_lib_path};
|
use crate::util::{exe, add_lib_path, CiEnv};
|
||||||
use crate::compile;
|
use crate::compile;
|
||||||
use crate::channel::GitInfo;
|
use crate::channel::GitInfo;
|
||||||
use crate::channel;
|
use crate::channel;
|
||||||
@ -74,7 +74,6 @@ impl Step for ToolBuild {
|
|||||||
&self.extra_features,
|
&self.extra_features,
|
||||||
);
|
);
|
||||||
|
|
||||||
let _folder = builder.fold_output(|| format!("stage{}-{}", compiler.stage, tool));
|
|
||||||
builder.info(&format!("Building stage{} tool {} ({})", compiler.stage, tool, target));
|
builder.info(&format!("Building stage{} tool {} ({})", compiler.stage, tool, target));
|
||||||
let mut duplicates = Vec::new();
|
let mut duplicates = Vec::new();
|
||||||
let is_expected = compile::stream_cargo(builder, &mut cargo, vec![], &mut |msg| {
|
let is_expected = compile::stream_cargo(builder, &mut cargo, vec![], &mut |msg| {
|
||||||
@ -109,36 +108,63 @@ impl Step for ToolBuild {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't worry about libs that turn out to be host dependencies
|
// Don't worry about compiles that turn out to be host
|
||||||
// or build scripts, we only care about target dependencies that
|
// dependencies or build scripts. To skip these we look for
|
||||||
// are in `deps`.
|
// anything that goes in `.../release/deps` but *doesn't* go in
|
||||||
if let Some(maybe_target) = val.1
|
// `$target/release/deps`. This ensure that outputs in
|
||||||
.parent() // chop off file name
|
// `$target/release` are still considered candidates for
|
||||||
.and_then(|p| p.parent()) // chop off `deps`
|
// deduplication.
|
||||||
.and_then(|p| p.parent()) // chop off `release`
|
if let Some(parent) = val.1.parent() {
|
||||||
.and_then(|p| p.file_name())
|
if parent.ends_with("release/deps") {
|
||||||
.and_then(|p| p.to_str())
|
let maybe_target = parent
|
||||||
{
|
.parent()
|
||||||
if maybe_target != &*target {
|
.and_then(|p| p.parent())
|
||||||
continue
|
.and_then(|p| p.file_name())
|
||||||
|
.and_then(|p| p.to_str())
|
||||||
|
.unwrap();
|
||||||
|
if maybe_target != &*target {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Record that we've built an artifact for `id`, and if one was
|
||||||
|
// already listed then we need to see if we reused the same
|
||||||
|
// artifact or produced a duplicate.
|
||||||
let mut artifacts = builder.tool_artifacts.borrow_mut();
|
let mut artifacts = builder.tool_artifacts.borrow_mut();
|
||||||
let prev_artifacts = artifacts
|
let prev_artifacts = artifacts
|
||||||
.entry(target)
|
.entry(target)
|
||||||
.or_default();
|
.or_default();
|
||||||
if let Some(prev) = prev_artifacts.get(&*id) {
|
let prev = match prev_artifacts.get(&*id) {
|
||||||
if prev.1 != val.1 {
|
Some(prev) => prev,
|
||||||
duplicates.push((
|
None => {
|
||||||
id.to_string(),
|
prev_artifacts.insert(id.to_string(), val);
|
||||||
val,
|
continue;
|
||||||
prev.clone(),
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
return
|
};
|
||||||
|
if prev.1 == val.1 {
|
||||||
|
return; // same path, same artifact
|
||||||
}
|
}
|
||||||
prev_artifacts.insert(id.to_string(), val);
|
|
||||||
|
// If the paths are different and one of them *isn't* inside of
|
||||||
|
// `release/deps`, then it means it's probably in
|
||||||
|
// `$target/release`, or it's some final artifact like
|
||||||
|
// `libcargo.rlib`. In these situations Cargo probably just
|
||||||
|
// copied it up from `$target/release/deps/libcargo-xxxx.rlib`,
|
||||||
|
// so if the features are equal we can just skip it.
|
||||||
|
let prev_no_hash = prev.1.parent().unwrap().ends_with("release/deps");
|
||||||
|
let val_no_hash = val.1.parent().unwrap().ends_with("release/deps");
|
||||||
|
if prev.2 == val.2 || !prev_no_hash || !val_no_hash {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ... and otherwise this looks like we duplicated some sort of
|
||||||
|
// compilation, so record it to generate an error later.
|
||||||
|
duplicates.push((
|
||||||
|
id.to_string(),
|
||||||
|
val,
|
||||||
|
prev.clone(),
|
||||||
|
));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -253,11 +279,26 @@ pub fn prepare_tool_cargo(
|
|||||||
cargo
|
cargo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn rustbook_features() -> Vec<String> {
|
||||||
|
let mut features = Vec::new();
|
||||||
|
|
||||||
|
// Due to CI budged and risk of spurious failures we want to limit jobs running this check.
|
||||||
|
// At same time local builds should run it regardless of the platform.
|
||||||
|
// `CiEnv::None` means it's local build and `CHECK_LINKS` is defined in x86_64-gnu-tools to
|
||||||
|
// explicitly enable it on single job
|
||||||
|
if CiEnv::current() == CiEnv::None || env::var("CHECK_LINKS").is_ok() {
|
||||||
|
features.push("linkcheck".to_string());
|
||||||
|
}
|
||||||
|
|
||||||
|
features
|
||||||
|
}
|
||||||
|
|
||||||
macro_rules! bootstrap_tool {
|
macro_rules! bootstrap_tool {
|
||||||
($(
|
($(
|
||||||
$name:ident, $path:expr, $tool_name:expr
|
$name:ident, $path:expr, $tool_name:expr
|
||||||
$(,llvm_tools = $llvm:expr)*
|
$(,llvm_tools = $llvm:expr)*
|
||||||
$(,is_external_tool = $external:expr)*
|
$(,is_external_tool = $external:expr)*
|
||||||
|
$(,features = $features:expr)*
|
||||||
;
|
;
|
||||||
)+) => {
|
)+) => {
|
||||||
#[derive(Copy, PartialEq, Eq, Clone)]
|
#[derive(Copy, PartialEq, Eq, Clone)]
|
||||||
@ -324,7 +365,12 @@ macro_rules! bootstrap_tool {
|
|||||||
} else {
|
} else {
|
||||||
SourceType::InTree
|
SourceType::InTree
|
||||||
},
|
},
|
||||||
extra_features: Vec::new(),
|
extra_features: {
|
||||||
|
// FIXME(#60643): avoid this lint by using `_`
|
||||||
|
let mut _tmp = Vec::new();
|
||||||
|
$(_tmp.extend($features);)*
|
||||||
|
_tmp
|
||||||
|
},
|
||||||
}).expect("expected to build -- essential tool")
|
}).expect("expected to build -- essential tool")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -333,7 +379,7 @@ macro_rules! bootstrap_tool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bootstrap_tool!(
|
bootstrap_tool!(
|
||||||
Rustbook, "src/tools/rustbook", "rustbook";
|
Rustbook, "src/tools/rustbook", "rustbook", features = rustbook_features();
|
||||||
UnstableBookGen, "src/tools/unstable-book-gen", "unstable-book-gen";
|
UnstableBookGen, "src/tools/unstable-book-gen", "unstable-book-gen";
|
||||||
Tidy, "src/tools/tidy", "tidy";
|
Tidy, "src/tools/tidy", "tidy";
|
||||||
Linkchecker, "src/tools/linkchecker", "linkchecker";
|
Linkchecker, "src/tools/linkchecker", "linkchecker";
|
||||||
@ -482,7 +528,6 @@ impl Step for Rustdoc {
|
|||||||
&[],
|
&[],
|
||||||
);
|
);
|
||||||
|
|
||||||
let _folder = builder.fold_output(|| format!("stage{}-rustdoc", target_compiler.stage));
|
|
||||||
builder.info(&format!("Building rustdoc for stage{} ({})",
|
builder.info(&format!("Building rustdoc for stage{} ({})",
|
||||||
target_compiler.stage, target_compiler.host));
|
target_compiler.stage, target_compiler.host));
|
||||||
builder.run(&mut cargo);
|
builder.run(&mut cargo);
|
||||||
|
@ -6,10 +6,10 @@
|
|||||||
use std::env;
|
use std::env;
|
||||||
use std::str;
|
use std::str;
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::io::{self, Write};
|
use std::io;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
use std::time::{SystemTime, Instant};
|
use std::time::Instant;
|
||||||
|
|
||||||
use build_helper::t;
|
use build_helper::t;
|
||||||
|
|
||||||
@ -254,78 +254,12 @@ pub fn symlink_dir(config: &Config, src: &Path, dest: &Path) -> io::Result<()> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// An RAII structure that indicates all output until this instance is dropped
|
|
||||||
/// is part of the same group.
|
|
||||||
///
|
|
||||||
/// On Travis CI, these output will be folded by default, together with the
|
|
||||||
/// elapsed time in this block. This reduces noise from unnecessary logs,
|
|
||||||
/// allowing developers to quickly identify the error.
|
|
||||||
///
|
|
||||||
/// Travis CI supports folding by printing `travis_fold:start:<name>` and
|
|
||||||
/// `travis_fold:end:<name>` around the block. Time elapsed is recognized
|
|
||||||
/// similarly with `travis_time:[start|end]:<name>`. These are undocumented, but
|
|
||||||
/// can easily be deduced from source code of the [Travis build commands].
|
|
||||||
///
|
|
||||||
/// [Travis build commands]:
|
|
||||||
/// https://github.com/travis-ci/travis-build/blob/f603c0089/lib/travis/build/templates/header.sh
|
|
||||||
pub struct OutputFolder {
|
|
||||||
name: String,
|
|
||||||
start_time: SystemTime, // we need SystemTime to get the UNIX timestamp.
|
|
||||||
}
|
|
||||||
|
|
||||||
impl OutputFolder {
|
|
||||||
/// Creates a new output folder with the given group name.
|
|
||||||
pub fn new(name: String) -> OutputFolder {
|
|
||||||
// "\r" moves the cursor to the beginning of the line, and "\x1b[0K" is
|
|
||||||
// the ANSI escape code to clear from the cursor to end of line.
|
|
||||||
// Travis seems to have trouble when _not_ using "\r\x1b[0K", that will
|
|
||||||
// randomly put lines to the top of the webpage.
|
|
||||||
print!("travis_fold:start:{0}\r\x1b[0Ktravis_time:start:{0}\r\x1b[0K", name);
|
|
||||||
OutputFolder {
|
|
||||||
name,
|
|
||||||
start_time: SystemTime::now(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Drop for OutputFolder {
|
|
||||||
fn drop(&mut self) {
|
|
||||||
use std::time::*;
|
|
||||||
use std::u64;
|
|
||||||
|
|
||||||
fn to_nanos(duration: Result<Duration, SystemTimeError>) -> u64 {
|
|
||||||
match duration {
|
|
||||||
Ok(d) => d.as_secs() * 1_000_000_000 + d.subsec_nanos() as u64,
|
|
||||||
Err(_) => u64::MAX,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let end_time = SystemTime::now();
|
|
||||||
let duration = end_time.duration_since(self.start_time);
|
|
||||||
let start = self.start_time.duration_since(UNIX_EPOCH);
|
|
||||||
let finish = end_time.duration_since(UNIX_EPOCH);
|
|
||||||
println!(
|
|
||||||
"travis_fold:end:{0}\r\x1b[0K\n\
|
|
||||||
travis_time:end:{0}:start={1},finish={2},duration={3}\r\x1b[0K",
|
|
||||||
self.name,
|
|
||||||
to_nanos(start),
|
|
||||||
to_nanos(finish),
|
|
||||||
to_nanos(duration)
|
|
||||||
);
|
|
||||||
io::stdout().flush().unwrap();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The CI environment rustbuild is running in. This mainly affects how the logs
|
/// The CI environment rustbuild is running in. This mainly affects how the logs
|
||||||
/// are printed.
|
/// are printed.
|
||||||
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
|
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
|
||||||
pub enum CiEnv {
|
pub enum CiEnv {
|
||||||
/// Not a CI environment.
|
/// Not a CI environment.
|
||||||
None,
|
None,
|
||||||
/// The Travis CI environment, for Linux (including Docker) and macOS builds.
|
|
||||||
Travis,
|
|
||||||
/// The AppVeyor environment, for Windows builds.
|
|
||||||
AppVeyor,
|
|
||||||
/// The Azure Pipelines environment, for Linux (including Docker), Windows, and macOS builds.
|
/// The Azure Pipelines environment, for Linux (including Docker), Windows, and macOS builds.
|
||||||
AzurePipelines,
|
AzurePipelines,
|
||||||
}
|
}
|
||||||
@ -333,11 +267,7 @@ pub enum CiEnv {
|
|||||||
impl CiEnv {
|
impl CiEnv {
|
||||||
/// Obtains the current CI environment.
|
/// Obtains the current CI environment.
|
||||||
pub fn current() -> CiEnv {
|
pub fn current() -> CiEnv {
|
||||||
if env::var("TRAVIS").ok().map_or(false, |e| &*e == "true") {
|
if env::var("TF_BUILD").ok().map_or(false, |e| &*e == "True") {
|
||||||
CiEnv::Travis
|
|
||||||
} else if env::var("APPVEYOR").ok().map_or(false, |e| &*e == "True") {
|
|
||||||
CiEnv::AppVeyor
|
|
||||||
} else if env::var("TF_BUILD").ok().map_or(false, |e| &*e == "True") {
|
|
||||||
CiEnv::AzurePipelines
|
CiEnv::AzurePipelines
|
||||||
} else {
|
} else {
|
||||||
CiEnv::None
|
CiEnv::None
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#![deny(rust_2018_idioms)]
|
// NO-RUSTC-WRAPPER
|
||||||
|
#![deny(warnings, rust_2018_idioms, unused_lifetimes)]
|
||||||
|
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
@ -44,18 +45,19 @@ pub fn restore_library_path() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn run(cmd: &mut Command) {
|
/// Run the command, printing what we are running.
|
||||||
|
pub fn run_verbose(cmd: &mut Command) {
|
||||||
println!("running: {:?}", cmd);
|
println!("running: {:?}", cmd);
|
||||||
run_silent(cmd);
|
run(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn run_silent(cmd: &mut Command) {
|
pub fn run(cmd: &mut Command) {
|
||||||
if !try_run_silent(cmd) {
|
if !try_run(cmd) {
|
||||||
std::process::exit(1);
|
std::process::exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn try_run_silent(cmd: &mut Command) -> bool {
|
pub fn try_run(cmd: &mut Command) -> bool {
|
||||||
let status = match cmd.status() {
|
let status = match cmd.status() {
|
||||||
Ok(status) => status,
|
Ok(status) => status,
|
||||||
Err(e) => fail(&format!(
|
Err(e) => fail(&format!(
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
awscli==1.16.201
|
|
||||||
botocore==1.12.191
|
|
||||||
colorama==0.3.9
|
|
||||||
docutils==0.14
|
|
||||||
jmespath==0.9.4
|
|
||||||
pyasn1==0.4.5
|
|
||||||
python-dateutil==2.8.0
|
|
||||||
PyYAML==5.1
|
|
||||||
rsa==3.4.2
|
|
||||||
s3transfer==0.2.1
|
|
||||||
six==1.12.0
|
|
||||||
urllib3==1.25.3
|
|
||||||
futures==3.3.0; python_version < '3.0'
|
|
@ -7,7 +7,7 @@ trigger:
|
|||||||
- auto
|
- auto
|
||||||
|
|
||||||
variables:
|
variables:
|
||||||
- group: real-prod-credentials
|
- group: prod-credentials
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
- job: Linux
|
- job: Linux
|
||||||
@ -174,7 +174,7 @@ jobs:
|
|||||||
|
|
||||||
dist-x86_64-apple:
|
dist-x86_64-apple:
|
||||||
SCRIPT: ./x.py dist
|
SCRIPT: ./x.py dist
|
||||||
RUST_CONFIGURE_ARGS: --target=aarch64-apple-ios,armv7-apple-ios,armv7s-apple-ios,i386-apple-ios,x86_64-apple-ios --enable-full-tools --enable-sanitizers --enable-profiler --enable-lldb --set rust.jemalloc
|
RUST_CONFIGURE_ARGS: --target=aarch64-apple-ios,armv7-apple-ios,armv7s-apple-ios,i386-apple-ios,x86_64-apple-ios --enable-full-tools --enable-sanitizers --enable-profiler --set rust.jemalloc
|
||||||
DEPLOY: 1
|
DEPLOY: 1
|
||||||
RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
|
RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
|
||||||
MACOSX_DEPLOYMENT_TARGET: 10.7
|
MACOSX_DEPLOYMENT_TARGET: 10.7
|
||||||
@ -184,7 +184,7 @@ jobs:
|
|||||||
|
|
||||||
dist-x86_64-apple-alt:
|
dist-x86_64-apple-alt:
|
||||||
SCRIPT: ./x.py dist
|
SCRIPT: ./x.py dist
|
||||||
RUST_CONFIGURE_ARGS: --enable-extended --enable-profiler --enable-lldb --set rust.jemalloc
|
RUST_CONFIGURE_ARGS: --enable-extended --enable-profiler --set rust.jemalloc
|
||||||
DEPLOY_ALT: 1
|
DEPLOY_ALT: 1
|
||||||
RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
|
RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
|
||||||
MACOSX_DEPLOYMENT_TARGET: 10.7
|
MACOSX_DEPLOYMENT_TARGET: 10.7
|
||||||
@ -202,7 +202,7 @@ jobs:
|
|||||||
|
|
||||||
dist-i686-apple:
|
dist-i686-apple:
|
||||||
SCRIPT: ./x.py dist
|
SCRIPT: ./x.py dist
|
||||||
RUST_CONFIGURE_ARGS: --build=i686-apple-darwin --enable-full-tools --enable-profiler --enable-lldb --set rust.jemalloc
|
RUST_CONFIGURE_ARGS: --build=i686-apple-darwin --enable-full-tools --enable-profiler --set rust.jemalloc
|
||||||
DEPLOY: 1
|
DEPLOY: 1
|
||||||
RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
|
RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
|
||||||
MACOSX_DEPLOYMENT_TARGET: 10.7
|
MACOSX_DEPLOYMENT_TARGET: 10.7
|
||||||
@ -254,7 +254,7 @@ jobs:
|
|||||||
x86_64-msvc-tools:
|
x86_64-msvc-tools:
|
||||||
MSYS_BITS: 64
|
MSYS_BITS: 64
|
||||||
SCRIPT: src/ci/docker/x86_64-gnu-tools/checktools.sh x.py /tmp/toolstates.json windows
|
SCRIPT: src/ci/docker/x86_64-gnu-tools/checktools.sh x.py /tmp/toolstates.json windows
|
||||||
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --save-toolstates=/tmp/toolstates.json --enable-test-miri
|
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --save-toolstates=/tmp/toolstates.json
|
||||||
|
|
||||||
# 32/64-bit MinGW builds.
|
# 32/64-bit MinGW builds.
|
||||||
#
|
#
|
||||||
@ -273,7 +273,7 @@ jobs:
|
|||||||
MSYS_BITS: 32
|
MSYS_BITS: 32
|
||||||
RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu
|
RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu
|
||||||
SCRIPT: make ci-subset-1
|
SCRIPT: make ci-subset-1
|
||||||
MINGW_URL: https://rust-lang-ci2.s3.amazonaws.com/rust-ci-mirror
|
MINGW_URL: https://rust-lang-ci-mirrors.s3-us-west-1.amazonaws.com/rustc
|
||||||
MINGW_ARCHIVE: i686-6.3.0-release-posix-dwarf-rt_v5-rev2.7z
|
MINGW_ARCHIVE: i686-6.3.0-release-posix-dwarf-rt_v5-rev2.7z
|
||||||
MINGW_DIR: mingw32
|
MINGW_DIR: mingw32
|
||||||
# FIXME(#59637)
|
# FIXME(#59637)
|
||||||
@ -283,14 +283,14 @@ jobs:
|
|||||||
MSYS_BITS: 32
|
MSYS_BITS: 32
|
||||||
RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu
|
RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu
|
||||||
SCRIPT: make ci-subset-2
|
SCRIPT: make ci-subset-2
|
||||||
MINGW_URL: https://rust-lang-ci2.s3.amazonaws.com/rust-ci-mirror
|
MINGW_URL: https://rust-lang-ci-mirrors.s3-us-west-1.amazonaws.com/rustc
|
||||||
MINGW_ARCHIVE: i686-6.3.0-release-posix-dwarf-rt_v5-rev2.7z
|
MINGW_ARCHIVE: i686-6.3.0-release-posix-dwarf-rt_v5-rev2.7z
|
||||||
MINGW_DIR: mingw32
|
MINGW_DIR: mingw32
|
||||||
x86_64-mingw-1:
|
x86_64-mingw-1:
|
||||||
MSYS_BITS: 64
|
MSYS_BITS: 64
|
||||||
SCRIPT: make ci-subset-1
|
SCRIPT: make ci-subset-1
|
||||||
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-gnu
|
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-gnu
|
||||||
MINGW_URL: https://rust-lang-ci2.s3.amazonaws.com/rust-ci-mirror
|
MINGW_URL: https://rust-lang-ci-mirrors.s3-us-west-1.amazonaws.com/rustc
|
||||||
MINGW_ARCHIVE: x86_64-6.3.0-release-posix-seh-rt_v5-rev2.7z
|
MINGW_ARCHIVE: x86_64-6.3.0-release-posix-seh-rt_v5-rev2.7z
|
||||||
MINGW_DIR: mingw64
|
MINGW_DIR: mingw64
|
||||||
# FIXME(#59637)
|
# FIXME(#59637)
|
||||||
@ -300,7 +300,7 @@ jobs:
|
|||||||
MSYS_BITS: 64
|
MSYS_BITS: 64
|
||||||
SCRIPT: make ci-subset-2
|
SCRIPT: make ci-subset-2
|
||||||
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-gnu
|
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-gnu
|
||||||
MINGW_URL: https://rust-lang-ci2.s3.amazonaws.com/rust-ci-mirror
|
MINGW_URL: https://rust-lang-ci-mirrors.s3-us-west-1.amazonaws.com/rustc
|
||||||
MINGW_ARCHIVE: x86_64-6.3.0-release-posix-seh-rt_v5-rev2.7z
|
MINGW_ARCHIVE: x86_64-6.3.0-release-posix-seh-rt_v5-rev2.7z
|
||||||
MINGW_DIR: mingw64
|
MINGW_DIR: mingw64
|
||||||
|
|
||||||
@ -327,7 +327,7 @@ jobs:
|
|||||||
MSYS_BITS: 32
|
MSYS_BITS: 32
|
||||||
RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu --enable-full-tools --enable-profiler
|
RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu --enable-full-tools --enable-profiler
|
||||||
SCRIPT: python x.py dist
|
SCRIPT: python x.py dist
|
||||||
MINGW_URL: https://rust-lang-ci2.s3.amazonaws.com/rust-ci-mirror
|
MINGW_URL: https://rust-lang-ci-mirrors.s3-us-west-1.amazonaws.com/rustc
|
||||||
MINGW_ARCHIVE: i686-6.3.0-release-posix-dwarf-rt_v5-rev2.7z
|
MINGW_ARCHIVE: i686-6.3.0-release-posix-dwarf-rt_v5-rev2.7z
|
||||||
MINGW_DIR: mingw32
|
MINGW_DIR: mingw32
|
||||||
DIST_REQUIRE_ALL_TOOLS: 1
|
DIST_REQUIRE_ALL_TOOLS: 1
|
||||||
@ -336,7 +336,7 @@ jobs:
|
|||||||
MSYS_BITS: 64
|
MSYS_BITS: 64
|
||||||
SCRIPT: python x.py dist
|
SCRIPT: python x.py dist
|
||||||
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-gnu --enable-full-tools --enable-profiler
|
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-gnu --enable-full-tools --enable-profiler
|
||||||
MINGW_URL: https://rust-lang-ci2.s3.amazonaws.com/rust-ci-mirror
|
MINGW_URL: https://rust-lang-ci-mirrors.s3-us-west-1.amazonaws.com/rustc
|
||||||
MINGW_ARCHIVE: x86_64-6.3.0-release-posix-seh-rt_v5-rev2.7z
|
MINGW_ARCHIVE: x86_64-6.3.0-release-posix-seh-rt_v5-rev2.7z
|
||||||
MINGW_DIR: mingw64
|
MINGW_DIR: mingw64
|
||||||
DIST_REQUIRE_ALL_TOOLS: 1
|
DIST_REQUIRE_ALL_TOOLS: 1
|
||||||
|
@ -7,7 +7,7 @@ trigger:
|
|||||||
- master
|
- master
|
||||||
|
|
||||||
variables:
|
variables:
|
||||||
- group: real-prod-credentials
|
- group: prod-credentials
|
||||||
|
|
||||||
pool:
|
pool:
|
||||||
vmImage: ubuntu-16.04
|
vmImage: ubuntu-16.04
|
||||||
|
@ -6,6 +6,9 @@ trigger: none
|
|||||||
pr:
|
pr:
|
||||||
- master
|
- master
|
||||||
|
|
||||||
|
variables:
|
||||||
|
- group: public-credentials
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
- job: Linux
|
- job: Linux
|
||||||
timeoutInMinutes: 600
|
timeoutInMinutes: 600
|
||||||
@ -20,14 +23,13 @@ jobs:
|
|||||||
mingw-check:
|
mingw-check:
|
||||||
IMAGE: mingw-check
|
IMAGE: mingw-check
|
||||||
|
|
||||||
# TODO: enable this job if the commit message matches this regex, need tools
|
- job: LinuxTools
|
||||||
# figure out how to get the current commit message on azure and stick it in a
|
timeoutInMinutes: 600
|
||||||
# condition somewhere
|
pool:
|
||||||
# if: commit_message =~ /(?i:^update.*\b(rls|rustfmt|clippy|miri|cargo)\b)/
|
vmImage: ubuntu-16.04
|
||||||
# - job: Linux-x86_64-gnu-tools
|
steps:
|
||||||
# pool:
|
- template: steps/run.yml
|
||||||
# vmImage: ubuntu-16.04
|
parameters:
|
||||||
# steps:
|
only_on_updated_submodules: 'yes'
|
||||||
# - template: steps/run.yml
|
variables:
|
||||||
# variables:
|
IMAGE: x86_64-gnu-tools
|
||||||
# IMAGE: x86_64-gnu-tools
|
|
||||||
|
@ -26,12 +26,18 @@ steps:
|
|||||||
#
|
#
|
||||||
# Original downloaded here came from
|
# Original downloaded here came from
|
||||||
# http://releases.llvm.org/7.0.0/LLVM-7.0.0-win64.exe
|
# http://releases.llvm.org/7.0.0/LLVM-7.0.0-win64.exe
|
||||||
- script: |
|
# That installer was run through `wine` on Linux and then the resulting
|
||||||
powershell -Command "$ProgressPreference = 'SilentlyContinue'; iwr -outf %TEMP%\LLVM-7.0.0-win64.exe https://rust-lang-ci2.s3.amazonaws.com/rust-ci-mirror/LLVM-7.0.0-win64.exe"
|
# installation directory (found in `$HOME/.wine/drive_c/Program Files/LLVM`) was
|
||||||
set CLANG_DIR=%CD%\citools\clang-rust
|
# packaged up into a tarball. We've had issues otherwise that the installer will
|
||||||
%TEMP%\LLVM-7.0.0-win64.exe /S /NCRC /D=%CLANG_DIR%
|
# randomly hang, provide not a lot of useful information, pollute global state,
|
||||||
set RUST_CONFIGURE_ARGS=%RUST_CONFIGURE_ARGS% --set llvm.clang-cl=%CLANG_DIR%\bin\clang-cl.exe
|
# etc. In general the tarball is just more confined and easier to deal with when
|
||||||
echo ##vso[task.setvariable variable=RUST_CONFIGURE_ARGS]%RUST_CONFIGURE_ARGS%
|
# working with various CI environments.
|
||||||
|
- bash: |
|
||||||
|
set -e
|
||||||
|
mkdir -p citools
|
||||||
|
cd citools
|
||||||
|
curl -f https://rust-lang-ci-mirrors.s3-us-west-1.amazonaws.com/rustc/LLVM-7.0.0-win64.tar.gz | tar xzf -
|
||||||
|
echo "##vso[task.setvariable variable=RUST_CONFIGURE_ARGS]$RUST_CONFIGURE_ARGS --set llvm.clang-cl=`pwd`/clang-rust/bin/clang-cl.exe"
|
||||||
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'), eq(variables['MINGW_URL'],''))
|
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'), eq(variables['MINGW_URL'],''))
|
||||||
displayName: Install clang (Windows)
|
displayName: Install clang (Windows)
|
||||||
|
|
||||||
|
@ -2,14 +2,14 @@ steps:
|
|||||||
|
|
||||||
- bash: |
|
- bash: |
|
||||||
set -e
|
set -e
|
||||||
curl -fo /usr/local/bin/sccache https://rust-lang-ci2.s3.amazonaws.com/rust-ci-mirror/2018-04-02-sccache-x86_64-apple-darwin
|
curl -fo /usr/local/bin/sccache https://rust-lang-ci-mirrors.s3-us-west-1.amazonaws.com/rustc/2018-04-02-sccache-x86_64-apple-darwin
|
||||||
chmod +x /usr/local/bin/sccache
|
chmod +x /usr/local/bin/sccache
|
||||||
displayName: Install sccache (OSX)
|
displayName: Install sccache (OSX)
|
||||||
condition: and(succeeded(), eq(variables['Agent.OS'], 'Darwin'))
|
condition: and(succeeded(), eq(variables['Agent.OS'], 'Darwin'))
|
||||||
|
|
||||||
- script: |
|
- script: |
|
||||||
md sccache
|
md sccache
|
||||||
powershell -Command "$ProgressPreference = 'SilentlyContinue'; iwr -outf sccache\sccache.exe https://rust-lang-ci2.s3.amazonaws.com/rust-ci-mirror/2018-04-26-sccache-x86_64-pc-windows-msvc"
|
powershell -Command "$ProgressPreference = 'SilentlyContinue'; iwr -outf sccache\sccache.exe https://rust-lang-ci-mirrors.s3-us-west-1.amazonaws.com/rustc/2018-04-26-sccache-x86_64-pc-windows-msvc"
|
||||||
echo ##vso[task.prependpath]%CD%\sccache
|
echo ##vso[task.prependpath]%CD%\sccache
|
||||||
displayName: Install sccache (Windows)
|
displayName: Install sccache (Windows)
|
||||||
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
|
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
|
||||||
|
@ -1,4 +1,29 @@
|
|||||||
steps:
|
steps:
|
||||||
|
# We use the WIX toolset to create combined installers for Windows, and these
|
||||||
|
# binaries are downloaded from
|
||||||
|
# https://github.com/wixtoolset/wix3 originally
|
||||||
|
- bash: |
|
||||||
|
set -e
|
||||||
|
curl -O https://rust-lang-ci-mirrors.s3-us-west-1.amazonaws.com/rustc/wix311-binaries.zip
|
||||||
|
echo "##vso[task.setvariable variable=WIX]`pwd`/wix"
|
||||||
|
mkdir -p wix/bin
|
||||||
|
cd wix/bin
|
||||||
|
7z x ../../wix311-binaries.zip
|
||||||
|
displayName: Install wix
|
||||||
|
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
|
||||||
|
|
||||||
|
# We use InnoSetup and its `iscc` program to also create combined installers.
|
||||||
|
# Honestly at this point WIX above and `iscc` are just holdovers from
|
||||||
|
# oh-so-long-ago and are required for creating installers on Windows. I think
|
||||||
|
# one is MSI installers and one is EXE, but they're not used so frequently at
|
||||||
|
# this point anyway so perhaps it's a wash!
|
||||||
|
- script: |
|
||||||
|
powershell -Command "$ProgressPreference = 'SilentlyContinue'; iwr -outf is-install.exe https://rust-lang-ci-mirrors.s3-us-west-1.amazonaws.com/rustc/2017-08-22-is.exe"
|
||||||
|
is-install.exe /VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP-
|
||||||
|
echo ##vso[task.prependpath]C:\Program Files (x86)\Inno Setup 5
|
||||||
|
displayName: Install InnoSetup
|
||||||
|
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
|
||||||
|
|
||||||
# We've had issues with the default drive in use running out of space during a
|
# We've had issues with the default drive in use running out of space during a
|
||||||
# build, and it looks like the `C:` drive has more space than the default `D:`
|
# build, and it looks like the `C:` drive has more space than the default `D:`
|
||||||
# drive. We should probably confirm this with the azure pipelines team at some
|
# drive. We should probably confirm this with the azure pipelines team at some
|
||||||
@ -84,7 +109,7 @@ steps:
|
|||||||
# Note that this is originally from the github releases patch of Ninja
|
# Note that this is originally from the github releases patch of Ninja
|
||||||
- script: |
|
- script: |
|
||||||
md ninja
|
md ninja
|
||||||
powershell -Command "$ProgressPreference = 'SilentlyContinue'; iwr -outf 2017-03-15-ninja-win.zip https://rust-lang-ci2.s3.amazonaws.com/rust-ci-mirror/2017-03-15-ninja-win.zip"
|
powershell -Command "$ProgressPreference = 'SilentlyContinue'; iwr -outf 2017-03-15-ninja-win.zip https://rust-lang-ci-mirrors.s3-us-west-1.amazonaws.com/rustc/2017-03-15-ninja-win.zip"
|
||||||
7z x -oninja 2017-03-15-ninja-win.zip
|
7z x -oninja 2017-03-15-ninja-win.zip
|
||||||
del 2017-03-15-ninja-win.zip
|
del 2017-03-15-ninja-win.zip
|
||||||
set RUST_CONFIGURE_ARGS=%RUST_CONFIGURE_ARGS% --enable-ninja
|
set RUST_CONFIGURE_ARGS=%RUST_CONFIGURE_ARGS% --enable-ninja
|
||||||
|
@ -6,6 +6,11 @@
|
|||||||
#
|
#
|
||||||
# Check travis config for `gdb --batch` command to print all crash logs
|
# Check travis config for `gdb --batch` command to print all crash logs
|
||||||
|
|
||||||
|
parameters:
|
||||||
|
# When this parameter is set to anything other than an empty string the tests
|
||||||
|
# will only be executed when the commit updates submodules
|
||||||
|
only_on_updated_submodules: ''
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
# Disable automatic line ending conversion, which is enabled by default on
|
# Disable automatic line ending conversion, which is enabled by default on
|
||||||
@ -21,6 +26,22 @@ steps:
|
|||||||
- checkout: self
|
- checkout: self
|
||||||
fetchDepth: 2
|
fetchDepth: 2
|
||||||
|
|
||||||
|
# Set the SKIP_JOB environment variable if this job is supposed to only run
|
||||||
|
# when submodules are updated and they were not. The following time consuming
|
||||||
|
# tasks will be skipped when the environment variable is present.
|
||||||
|
- ${{ if parameters.only_on_updated_submodules }}:
|
||||||
|
- bash: |
|
||||||
|
set -e
|
||||||
|
# Submodules pseudo-files inside git have the 160000 permissions, so when
|
||||||
|
# those files are present in the diff a submodule was updated.
|
||||||
|
if git diff HEAD^ | grep "^index .* 160000" >/dev/null 2>&1; then
|
||||||
|
echo "Executing the job since submodules are updated"
|
||||||
|
else
|
||||||
|
echo "Not executing this job since no submodules were updated"
|
||||||
|
echo "##vso[task.setvariable variable=SKIP_JOB;]1"
|
||||||
|
fi
|
||||||
|
displayName: Decide whether to run this job
|
||||||
|
|
||||||
# Spawn a background process to collect CPU usage statistics which we'll upload
|
# Spawn a background process to collect CPU usage statistics which we'll upload
|
||||||
# at the end of the build. See the comments in the script here for more
|
# at the end of the build. See the comments in the script here for more
|
||||||
# information.
|
# information.
|
||||||
@ -30,10 +51,6 @@ steps:
|
|||||||
- bash: printenv | sort
|
- bash: printenv | sort
|
||||||
displayName: Show environment variables
|
displayName: Show environment variables
|
||||||
|
|
||||||
# Log the date, even on failure. Attempting to debug SSL certificate errors.
|
|
||||||
- bash: date
|
|
||||||
displayName: Print out date (before build)
|
|
||||||
|
|
||||||
- bash: |
|
- bash: |
|
||||||
set -e
|
set -e
|
||||||
df -h
|
df -h
|
||||||
@ -45,17 +62,6 @@ steps:
|
|||||||
- template: install-sccache.yml
|
- template: install-sccache.yml
|
||||||
- template: install-clang.yml
|
- template: install-clang.yml
|
||||||
|
|
||||||
# Install some dependencies needed to build LLDB/Clang, currently only needed
|
|
||||||
# during the `dist` target
|
|
||||||
- bash: |
|
|
||||||
set -e
|
|
||||||
brew update
|
|
||||||
brew install xz
|
|
||||||
brew install swig@3
|
|
||||||
brew link --force swig@3
|
|
||||||
displayName: Install build dependencies (OSX)
|
|
||||||
condition: and(succeeded(), eq(variables['Agent.OS'], 'Darwin'), eq(variables['SCRIPT'],'./x.py dist'))
|
|
||||||
|
|
||||||
# Switch to XCode 9.3 on OSX since it seems to be the last version that supports
|
# Switch to XCode 9.3 on OSX since it seems to be the last version that supports
|
||||||
# i686-apple-darwin. We'll eventually want to upgrade this and it will probably
|
# i686-apple-darwin. We'll eventually want to upgrade this and it will probably
|
||||||
# force us to drop i686-apple-darwin, but let's keep the wheels turning for now.
|
# force us to drop i686-apple-darwin, but let's keep the wheels turning for now.
|
||||||
@ -75,7 +81,7 @@ steps:
|
|||||||
echo '{"ipv6":true,"fixed-cidr-v6":"fd9a:8454:6789:13f7::/64"}' | sudo tee /etc/docker/daemon.json
|
echo '{"ipv6":true,"fixed-cidr-v6":"fd9a:8454:6789:13f7::/64"}' | sudo tee /etc/docker/daemon.json
|
||||||
sudo service docker restart
|
sudo service docker restart
|
||||||
displayName: Enable IPv6
|
displayName: Enable IPv6
|
||||||
condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux'))
|
condition: and(succeeded(), not(variables.SKIP_JOB), eq(variables['Agent.OS'], 'Linux'))
|
||||||
|
|
||||||
# Disable automatic line ending conversion (again). On Windows, when we're
|
# Disable automatic line ending conversion (again). On Windows, when we're
|
||||||
# installing dependencies, something switches the git configuration directory or
|
# installing dependencies, something switches the git configuration directory or
|
||||||
@ -91,12 +97,12 @@ steps:
|
|||||||
set -e
|
set -e
|
||||||
mkdir -p $HOME/rustsrc
|
mkdir -p $HOME/rustsrc
|
||||||
$BUILD_SOURCESDIRECTORY/src/ci/init_repo.sh . $HOME/rustsrc
|
$BUILD_SOURCESDIRECTORY/src/ci/init_repo.sh . $HOME/rustsrc
|
||||||
condition: and(succeeded(), ne(variables['Agent.OS'], 'Windows_NT'))
|
condition: and(succeeded(), not(variables.SKIP_JOB), ne(variables['Agent.OS'], 'Windows_NT'))
|
||||||
displayName: Check out submodules (Unix)
|
displayName: Check out submodules (Unix)
|
||||||
- script: |
|
- script: |
|
||||||
if not exist D:\cache\rustsrc\NUL mkdir D:\cache\rustsrc
|
if not exist C:\cache\rustsrc\NUL mkdir C:\cache\rustsrc
|
||||||
sh src/ci/init_repo.sh . /d/cache/rustsrc
|
sh src/ci/init_repo.sh . /c/cache/rustsrc
|
||||||
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
|
condition: and(succeeded(), not(variables.SKIP_JOB), eq(variables['Agent.OS'], 'Windows_NT'))
|
||||||
displayName: Check out submodules (Windows)
|
displayName: Check out submodules (Windows)
|
||||||
|
|
||||||
# See also the disable for autocrlf above, this just checks that it worked
|
# See also the disable for autocrlf above, this just checks that it worked
|
||||||
@ -121,21 +127,17 @@ steps:
|
|||||||
|
|
||||||
# Ensure the `aws` CLI is installed so we can deploy later on, cache docker
|
# Ensure the `aws` CLI is installed so we can deploy later on, cache docker
|
||||||
# images, etc.
|
# images, etc.
|
||||||
- bash: |
|
- bash: src/ci/install-awscli.sh
|
||||||
set -e
|
env:
|
||||||
source src/ci/shared.sh
|
AGENT_OS: $(Agent.OS)
|
||||||
sudo apt-get install -y python3-setuptools
|
condition: and(succeeded(), not(variables.SKIP_JOB))
|
||||||
retry pip3 install -r src/ci/awscli-requirements.txt --upgrade --user
|
displayName: Install awscli
|
||||||
echo "##vso[task.prependpath]$HOME/.local/bin"
|
|
||||||
displayName: Install awscli (Linux)
|
|
||||||
condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux'))
|
|
||||||
- script: pip install -r src/ci/awscli-requirements.txt
|
|
||||||
displayName: Install awscli (non-Linux)
|
|
||||||
condition: and(succeeded(), ne(variables['Agent.OS'], 'Linux'))
|
|
||||||
|
|
||||||
# Configure our CI_JOB_NAME variable which log analyzers can use for the main
|
# Configure our CI_JOB_NAME variable which log analyzers can use for the main
|
||||||
# step to see what's going on.
|
# step to see what's going on.
|
||||||
- bash: echo "##vso[task.setvariable variable=CI_JOB_NAME]$SYSTEM_JOBNAME"
|
- bash: |
|
||||||
|
builder=$(echo $AGENT_JOBNAME | cut -d ' ' -f 2)
|
||||||
|
echo "##vso[task.setvariable variable=CI_JOB_NAME]$builder"
|
||||||
displayName: Configure Job Name
|
displayName: Configure Job Name
|
||||||
|
|
||||||
# As a quick smoke check on the otherwise very fast mingw-check linux builder
|
# As a quick smoke check on the otherwise very fast mingw-check linux builder
|
||||||
@ -147,7 +149,7 @@ steps:
|
|||||||
python2.7 "$BUILD_SOURCESDIRECTORY/src/tools/publish_toolstate.py" "$(git rev-parse HEAD)" "$(git log --format=%s -n1 HEAD)" "" ""
|
python2.7 "$BUILD_SOURCESDIRECTORY/src/tools/publish_toolstate.py" "$(git rev-parse HEAD)" "$(git log --format=%s -n1 HEAD)" "" ""
|
||||||
cd ..
|
cd ..
|
||||||
rm -rf rust-toolstate
|
rm -rf rust-toolstate
|
||||||
condition: and(succeeded(), eq(variables['IMAGE'], 'mingw-check'))
|
condition: and(succeeded(), not(variables.SKIP_JOB), eq(variables['IMAGE'], 'mingw-check'))
|
||||||
displayName: Verify the publish_toolstate script works
|
displayName: Verify the publish_toolstate script works
|
||||||
|
|
||||||
- bash: |
|
- bash: |
|
||||||
@ -166,8 +168,10 @@ steps:
|
|||||||
env:
|
env:
|
||||||
CI: true
|
CI: true
|
||||||
SRC: .
|
SRC: .
|
||||||
AWS_SECRET_ACCESS_KEY: $(AWS_SECRET_ACCESS_KEY)
|
AWS_ACCESS_KEY_ID: $(SCCACHE_AWS_ACCESS_KEY_ID)
|
||||||
|
AWS_SECRET_ACCESS_KEY: $(SCCACHE_AWS_SECRET_ACCESS_KEY)
|
||||||
TOOLSTATE_REPO_ACCESS_TOKEN: $(TOOLSTATE_REPO_ACCESS_TOKEN)
|
TOOLSTATE_REPO_ACCESS_TOKEN: $(TOOLSTATE_REPO_ACCESS_TOKEN)
|
||||||
|
condition: and(succeeded(), not(variables.SKIP_JOB))
|
||||||
displayName: Run build
|
displayName: Run build
|
||||||
|
|
||||||
# If we're a deploy builder, use the `aws` command to publish everything to our
|
# If we're a deploy builder, use the `aws` command to publish everything to our
|
||||||
@ -189,8 +193,9 @@ steps:
|
|||||||
fi
|
fi
|
||||||
retry aws s3 cp --no-progress --recursive --acl public-read ./$upload_dir s3://$DEPLOY_BUCKET/$deploy_dir/$BUILD_SOURCEVERSION
|
retry aws s3 cp --no-progress --recursive --acl public-read ./$upload_dir s3://$DEPLOY_BUCKET/$deploy_dir/$BUILD_SOURCEVERSION
|
||||||
env:
|
env:
|
||||||
AWS_SECRET_ACCESS_KEY: $(AWS_SECRET_ACCESS_KEY)
|
AWS_ACCESS_KEY_ID: $(UPLOAD_AWS_ACCESS_KEY_ID)
|
||||||
condition: and(succeeded(), or(eq(variables.DEPLOY, '1'), eq(variables.DEPLOY_ALT, '1')))
|
AWS_SECRET_ACCESS_KEY: $(UPLOAD_AWS_SECRET_ACCESS_KEY)
|
||||||
|
condition: and(succeeded(), not(variables.SKIP_JOB), or(eq(variables.DEPLOY, '1'), eq(variables.DEPLOY_ALT, '1')))
|
||||||
displayName: Upload artifacts
|
displayName: Upload artifacts
|
||||||
|
|
||||||
# Upload CPU usage statistics that we've been gathering this whole time. Always
|
# Upload CPU usage statistics that we've been gathering this whole time. Always
|
||||||
@ -198,12 +203,8 @@ steps:
|
|||||||
# errors here ever fail the build since this is just informational.
|
# errors here ever fail the build since this is just informational.
|
||||||
- bash: aws s3 cp --acl public-read cpu-usage.csv s3://$DEPLOY_BUCKET/rustc-builds/$BUILD_SOURCEVERSION/cpu-$SYSTEM_JOBNAME.csv
|
- bash: aws s3 cp --acl public-read cpu-usage.csv s3://$DEPLOY_BUCKET/rustc-builds/$BUILD_SOURCEVERSION/cpu-$SYSTEM_JOBNAME.csv
|
||||||
env:
|
env:
|
||||||
AWS_SECRET_ACCESS_KEY: $(AWS_SECRET_ACCESS_KEY)
|
AWS_ACCESS_KEY_ID: $(UPLOAD_AWS_ACCESS_KEY_ID)
|
||||||
condition: variables['AWS_SECRET_ACCESS_KEY']
|
AWS_SECRET_ACCESS_KEY: $(UPLOAD_AWS_SECRET_ACCESS_KEY)
|
||||||
|
condition: variables['UPLOAD_AWS_SECRET_ACCESS_KEY']
|
||||||
continueOnError: true
|
continueOnError: true
|
||||||
displayName: Upload CPU usage statistics
|
displayName: Upload CPU usage statistics
|
||||||
|
|
||||||
# Log the date, even on failure. Attempting to debug SSL certificate errors.
|
|
||||||
- bash: date
|
|
||||||
continueOnError: true
|
|
||||||
displayName: Print out date (after build)
|
|
||||||
|
@ -3,7 +3,7 @@ trigger:
|
|||||||
- try
|
- try
|
||||||
|
|
||||||
variables:
|
variables:
|
||||||
- group: real-prod-credentials
|
- group: prod-credentials
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
- job: Linux
|
- job: Linux
|
||||||
@ -36,7 +36,7 @@ jobs:
|
|||||||
# matrix:
|
# matrix:
|
||||||
# dist-x86_64-apple:
|
# dist-x86_64-apple:
|
||||||
# SCRIPT: ./x.py dist
|
# SCRIPT: ./x.py dist
|
||||||
# RUST_CONFIGURE_ARGS: --target=aarch64-apple-ios,armv7-apple-ios,armv7s-apple-ios,i386-apple-ios,x86_64-apple-ios --enable-full-tools --enable-sanitizers --enable-profiler --enable-lldb --set rust.jemalloc
|
# RUST_CONFIGURE_ARGS: --target=aarch64-apple-ios,armv7-apple-ios,armv7s-apple-ios,i386-apple-ios,x86_64-apple-ios --enable-full-tools --enable-sanitizers --enable-profiler --set rust.jemalloc
|
||||||
# DEPLOY: 1
|
# DEPLOY: 1
|
||||||
# RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
|
# RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
|
||||||
# MACOSX_DEPLOYMENT_TARGET: 10.7
|
# MACOSX_DEPLOYMENT_TARGET: 10.7
|
||||||
@ -46,7 +46,7 @@ jobs:
|
|||||||
#
|
#
|
||||||
# dist-x86_64-apple-alt:
|
# dist-x86_64-apple-alt:
|
||||||
# SCRIPT: ./x.py dist
|
# SCRIPT: ./x.py dist
|
||||||
# RUST_CONFIGURE_ARGS: --enable-extended --enable-profiler --enable-lldb --set rust.jemalloc
|
# RUST_CONFIGURE_ARGS: --enable-extended --enable-profiler --set rust.jemalloc
|
||||||
# DEPLOY_ALT: 1
|
# DEPLOY_ALT: 1
|
||||||
# RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
|
# RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
|
||||||
# MACOSX_DEPLOYMENT_TARGET: 10.7
|
# MACOSX_DEPLOYMENT_TARGET: 10.7
|
||||||
|
@ -20,7 +20,7 @@ Images will output artifacts in an `obj` dir at the root of a repository.
|
|||||||
|
|
||||||
- Each directory, excluding `scripts` and `disabled`, corresponds to a docker image
|
- Each directory, excluding `scripts` and `disabled`, corresponds to a docker image
|
||||||
- `scripts` contains files shared by docker images
|
- `scripts` contains files shared by docker images
|
||||||
- `disabled` contains images that are not built on travis
|
- `disabled` contains images that are not built on CI
|
||||||
|
|
||||||
## Docker Toolbox on Windows
|
## Docker Toolbox on Windows
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ RUN arm-linux-gnueabihf-gcc addentropy.c -o rootfs/addentropy -static
|
|||||||
|
|
||||||
# TODO: What is this?!
|
# TODO: What is this?!
|
||||||
# Source of the file: https://github.com/vfdev-5/qemu-rpi2-vexpress/raw/master/vexpress-v2p-ca15-tc1.dtb
|
# Source of the file: https://github.com/vfdev-5/qemu-rpi2-vexpress/raw/master/vexpress-v2p-ca15-tc1.dtb
|
||||||
RUN curl -O https://rust-lang-ci2.s3.amazonaws.com/rust-ci-mirror/vexpress-v2p-ca15-tc1.dtb
|
RUN curl -O https://rust-lang-ci-mirrors.s3-us-west-1.amazonaws.com/rustc/vexpress-v2p-ca15-tc1.dtb
|
||||||
|
|
||||||
COPY scripts/sccache.sh /scripts/
|
COPY scripts/sccache.sh /scripts/
|
||||||
RUN sh /scripts/sccache.sh
|
RUN sh /scripts/sccache.sh
|
||||||
|
@ -32,7 +32,7 @@ ENV TARGETS=asmjs-unknown-emscripten
|
|||||||
ENV RUST_CONFIGURE_ARGS --enable-emscripten --disable-optimize-tests
|
ENV RUST_CONFIGURE_ARGS --enable-emscripten --disable-optimize-tests
|
||||||
|
|
||||||
ENV SCRIPT python2.7 ../x.py test --target $TARGETS \
|
ENV SCRIPT python2.7 ../x.py test --target $TARGETS \
|
||||||
src/test/run-pass \
|
src/test/ui \
|
||||||
src/test/run-fail \
|
src/test/run-fail \
|
||||||
src/libstd \
|
src/libstd \
|
||||||
src/liballoc \
|
src/liballoc \
|
||||||
|
@ -36,7 +36,3 @@ ENV HOSTS=powerpc-unknown-linux-gnu
|
|||||||
|
|
||||||
ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs
|
ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs
|
||||||
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS
|
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS
|
||||||
|
|
||||||
# FIXME(#36150) this will fail the bootstrap. Probably means something bad is
|
|
||||||
# happening!
|
|
||||||
ENV NO_LLVM_ASSERTIONS 1
|
|
||||||
|
@ -64,7 +64,7 @@ RUN env \
|
|||||||
env \
|
env \
|
||||||
CC=arm-linux-gnueabihf-gcc CFLAGS="-march=armv7-a" \
|
CC=arm-linux-gnueabihf-gcc CFLAGS="-march=armv7-a" \
|
||||||
CXX=arm-linux-gnueabihf-g++ CXXFLAGS="-march=armv7-a" \
|
CXX=arm-linux-gnueabihf-g++ CXXFLAGS="-march=armv7-a" \
|
||||||
bash musl.sh armv7 && \
|
bash musl.sh armv7hf && \
|
||||||
env \
|
env \
|
||||||
CC=aarch64-linux-gnu-gcc \
|
CC=aarch64-linux-gnu-gcc \
|
||||||
CXX=aarch64-linux-gnu-g++ \
|
CXX=aarch64-linux-gnu-g++ \
|
||||||
@ -104,7 +104,9 @@ ENV TARGETS=$TARGETS,armv5te-unknown-linux-musleabi
|
|||||||
ENV TARGETS=$TARGETS,armv7-unknown-linux-musleabihf
|
ENV TARGETS=$TARGETS,armv7-unknown-linux-musleabihf
|
||||||
ENV TARGETS=$TARGETS,aarch64-unknown-linux-musl
|
ENV TARGETS=$TARGETS,aarch64-unknown-linux-musl
|
||||||
ENV TARGETS=$TARGETS,sparc64-unknown-linux-gnu
|
ENV TARGETS=$TARGETS,sparc64-unknown-linux-gnu
|
||||||
ENV TARGETS=$TARGETS,x86_64-unknown-redox
|
# FIXME: temporarily disable the redox builder,
|
||||||
|
# see: https://github.com/rust-lang/rust/issues/63160
|
||||||
|
# ENV TARGETS=$TARGETS,x86_64-unknown-redox
|
||||||
ENV TARGETS=$TARGETS,thumbv6m-none-eabi
|
ENV TARGETS=$TARGETS,thumbv6m-none-eabi
|
||||||
ENV TARGETS=$TARGETS,thumbv7m-none-eabi
|
ENV TARGETS=$TARGETS,thumbv7m-none-eabi
|
||||||
ENV TARGETS=$TARGETS,thumbv7em-none-eabi
|
ENV TARGETS=$TARGETS,thumbv7em-none-eabi
|
||||||
@ -112,6 +114,7 @@ ENV TARGETS=$TARGETS,thumbv7em-none-eabihf
|
|||||||
ENV TARGETS=$TARGETS,thumbv8m.base-none-eabi
|
ENV TARGETS=$TARGETS,thumbv8m.base-none-eabi
|
||||||
ENV TARGETS=$TARGETS,thumbv8m.main-none-eabi
|
ENV TARGETS=$TARGETS,thumbv8m.main-none-eabi
|
||||||
ENV TARGETS=$TARGETS,thumbv8m.main-none-eabihf
|
ENV TARGETS=$TARGETS,thumbv8m.main-none-eabihf
|
||||||
|
ENV TARGETS=$TARGETS,riscv32i-unknown-none-elf
|
||||||
ENV TARGETS=$TARGETS,riscv32imc-unknown-none-elf
|
ENV TARGETS=$TARGETS,riscv32imc-unknown-none-elf
|
||||||
ENV TARGETS=$TARGETS,riscv32imac-unknown-none-elf
|
ENV TARGETS=$TARGETS,riscv32imac-unknown-none-elf
|
||||||
ENV TARGETS=$TARGETS,riscv64imac-unknown-none-elf
|
ENV TARGETS=$TARGETS,riscv64imac-unknown-none-elf
|
||||||
@ -134,7 +137,7 @@ ENV RUST_CONFIGURE_ARGS \
|
|||||||
--musl-root-armv5te=/musl-armv5te \
|
--musl-root-armv5te=/musl-armv5te \
|
||||||
--musl-root-arm=/musl-arm \
|
--musl-root-arm=/musl-arm \
|
||||||
--musl-root-armhf=/musl-armhf \
|
--musl-root-armhf=/musl-armhf \
|
||||||
--musl-root-armv7=/musl-armv7 \
|
--musl-root-armv7hf=/musl-armv7hf \
|
||||||
--musl-root-aarch64=/musl-aarch64 \
|
--musl-root-aarch64=/musl-aarch64 \
|
||||||
--musl-root-mips=/musl-mips \
|
--musl-root-mips=/musl-mips \
|
||||||
--musl-root-mipsel=/musl-mipsel \
|
--musl-root-mipsel=/musl-mipsel \
|
||||||
|
@ -5,7 +5,7 @@ mkdir /usr/local/mips-linux-musl
|
|||||||
# originally from
|
# originally from
|
||||||
# https://downloads.openwrt.org/snapshots/trunk/ar71xx/generic/
|
# https://downloads.openwrt.org/snapshots/trunk/ar71xx/generic/
|
||||||
# OpenWrt-Toolchain-ar71xx-generic_gcc-5.3.0_musl-1.1.16.Linux-x86_64.tar.bz2
|
# OpenWrt-Toolchain-ar71xx-generic_gcc-5.3.0_musl-1.1.16.Linux-x86_64.tar.bz2
|
||||||
URL="https://rust-lang-ci2.s3.amazonaws.com/rust-ci-mirror"
|
URL="https://rust-lang-ci-mirrors.s3-us-west-1.amazonaws.com/rustc"
|
||||||
FILE="OpenWrt-Toolchain-ar71xx-generic_gcc-5.3.0_musl-1.1.16.Linux-x86_64.tar.bz2"
|
FILE="OpenWrt-Toolchain-ar71xx-generic_gcc-5.3.0_musl-1.1.16.Linux-x86_64.tar.bz2"
|
||||||
curl -L "$URL/$FILE" | tar xjf - -C /usr/local/mips-linux-musl --strip-components=2
|
curl -L "$URL/$FILE" | tar xjf - -C /usr/local/mips-linux-musl --strip-components=2
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ mkdir /usr/local/mipsel-linux-musl
|
|||||||
# Note that this originally came from:
|
# Note that this originally came from:
|
||||||
# https://downloads.openwrt.org/snapshots/trunk/malta/generic/
|
# https://downloads.openwrt.org/snapshots/trunk/malta/generic/
|
||||||
# OpenWrt-Toolchain-malta-le_gcc-5.3.0_musl-1.1.15.Linux-x86_64.tar.bz2
|
# OpenWrt-Toolchain-malta-le_gcc-5.3.0_musl-1.1.15.Linux-x86_64.tar.bz2
|
||||||
URL="https://rust-lang-ci2.s3.amazonaws.com/libc"
|
URL="https://rust-lang-ci-mirrors.s3-us-west-1.amazonaws.com/rustc"
|
||||||
FILE="OpenWrt-Toolchain-malta-le_gcc-5.3.0_musl-1.1.15.Linux-x86_64.tar.bz2"
|
FILE="OpenWrt-Toolchain-malta-le_gcc-5.3.0_musl-1.1.15.Linux-x86_64.tar.bz2"
|
||||||
curl -L "$URL/$FILE" | tar xjf - -C /usr/local/mipsel-linux-musl --strip-components=2
|
curl -L "$URL/$FILE" | tar xjf - -C /usr/local/mipsel-linux-musl --strip-components=2
|
||||||
|
|
||||||
|
@ -8,7 +8,8 @@ RUN sed -i 's/^# deb-src/deb-src/' /etc/apt/sources.list
|
|||||||
|
|
||||||
RUN apt-get update && apt-get build-dep -y clang llvm && apt-get install -y --no-install-recommends \
|
RUN apt-get update && apt-get build-dep -y clang llvm && apt-get install -y --no-install-recommends \
|
||||||
build-essential \
|
build-essential \
|
||||||
gcc-multilib \
|
# gcc-multilib can not be installed together with gcc-arm-linux-gnueabi
|
||||||
|
gcc-7-multilib \
|
||||||
libedit-dev \
|
libedit-dev \
|
||||||
libgmp-dev \
|
libgmp-dev \
|
||||||
libisl-dev \
|
libisl-dev \
|
||||||
@ -21,11 +22,20 @@ RUN apt-get update && apt-get build-dep -y clang llvm && apt-get install -y --no
|
|||||||
unzip \
|
unzip \
|
||||||
# Needed for apt-key to work:
|
# Needed for apt-key to work:
|
||||||
dirmngr \
|
dirmngr \
|
||||||
gpg-agent
|
gpg-agent \
|
||||||
|
g++-7-arm-linux-gnueabi
|
||||||
|
|
||||||
RUN apt-key adv --batch --yes --keyserver keyserver.ubuntu.com --recv-keys 74DA7924C5513486
|
RUN apt-key adv --batch --yes --keyserver keyserver.ubuntu.com --recv-keys 74DA7924C5513486
|
||||||
RUN add-apt-repository -y 'deb http://apt.dilos.org/dilos dilos2 main'
|
RUN add-apt-repository -y 'deb http://apt.dilos.org/dilos dilos2 main'
|
||||||
|
|
||||||
|
WORKDIR /build
|
||||||
|
COPY scripts/musl.sh /build
|
||||||
|
RUN env \
|
||||||
|
CC=arm-linux-gnueabi-gcc-7 CFLAGS="-march=armv7-a" \
|
||||||
|
CXX=arm-linux-gnueabi-g++-7 CXXFLAGS="-march=armv7-a" \
|
||||||
|
bash musl.sh armv7 && \
|
||||||
|
rm -rf /build/*
|
||||||
|
|
||||||
WORKDIR /tmp
|
WORKDIR /tmp
|
||||||
COPY dist-various-2/shared.sh /tmp/
|
COPY dist-various-2/shared.sh /tmp/
|
||||||
COPY dist-various-2/build-cloudabi-toolchain.sh /tmp/
|
COPY dist-various-2/build-cloudabi-toolchain.sh /tmp/
|
||||||
@ -58,7 +68,11 @@ ENV \
|
|||||||
CXX_sparcv9_sun_solaris=sparcv9-sun-solaris2.10-g++ \
|
CXX_sparcv9_sun_solaris=sparcv9-sun-solaris2.10-g++ \
|
||||||
AR_x86_64_sun_solaris=x86_64-sun-solaris2.10-ar \
|
AR_x86_64_sun_solaris=x86_64-sun-solaris2.10-ar \
|
||||||
CC_x86_64_sun_solaris=x86_64-sun-solaris2.10-gcc \
|
CC_x86_64_sun_solaris=x86_64-sun-solaris2.10-gcc \
|
||||||
CXX_x86_64_sun_solaris=x86_64-sun-solaris2.10-g++
|
CXX_x86_64_sun_solaris=x86_64-sun-solaris2.10-g++ \
|
||||||
|
CC_armv7_unknown_linux_gnueabi=arm-linux-gnueabi-gcc-7 \
|
||||||
|
CXX_armv7_unknown_linux_gnueabi=arm-linux-gnueabi-g++-7 \
|
||||||
|
CC=gcc-7 \
|
||||||
|
CXX=g++-7
|
||||||
|
|
||||||
ENV CARGO_TARGET_X86_64_FUCHSIA_AR /usr/local/bin/llvm-ar
|
ENV CARGO_TARGET_X86_64_FUCHSIA_AR /usr/local/bin/llvm-ar
|
||||||
ENV CARGO_TARGET_X86_64_FUCHSIA_RUSTFLAGS \
|
ENV CARGO_TARGET_X86_64_FUCHSIA_RUSTFLAGS \
|
||||||
@ -81,9 +95,19 @@ ENV TARGETS=$TARGETS,x86_64-unknown-linux-gnux32
|
|||||||
ENV TARGETS=$TARGETS,x86_64-unknown-cloudabi
|
ENV TARGETS=$TARGETS,x86_64-unknown-cloudabi
|
||||||
ENV TARGETS=$TARGETS,x86_64-fortanix-unknown-sgx
|
ENV TARGETS=$TARGETS,x86_64-fortanix-unknown-sgx
|
||||||
ENV TARGETS=$TARGETS,nvptx64-nvidia-cuda
|
ENV TARGETS=$TARGETS,nvptx64-nvidia-cuda
|
||||||
|
ENV TARGETS=$TARGETS,armv7-unknown-linux-gnueabi
|
||||||
|
ENV TARGETS=$TARGETS,armv7-unknown-linux-musleabi
|
||||||
|
|
||||||
ENV X86_FORTANIX_SGX_LIBS="/x86_64-fortanix-unknown-sgx/lib/"
|
ENV X86_FORTANIX_SGX_LIBS="/x86_64-fortanix-unknown-sgx/lib/"
|
||||||
|
|
||||||
|
# As per https://bugs.launchpad.net/ubuntu/+source/gcc-defaults/+bug/1300211
|
||||||
|
# we need asm in the search path for gcc-7 (for gnux32) but not in the search path of the
|
||||||
|
# cross compilers.
|
||||||
|
# Luckily one of the folders is /usr/local/include so symlink /usr/include/asm-generic there
|
||||||
|
RUN ln -s /usr/include/asm-generic /usr/local/include/asm
|
||||||
|
|
||||||
ENV RUST_CONFIGURE_ARGS --enable-extended --enable-lld --disable-docs \
|
ENV RUST_CONFIGURE_ARGS --enable-extended --enable-lld --disable-docs \
|
||||||
--set target.wasm32-wasi.wasi-root=/wasm32-wasi
|
--set target.wasm32-wasi.wasi-root=/wasm32-wasi \
|
||||||
|
--musl-root-armv7=/musl-armv7
|
||||||
|
|
||||||
ENV SCRIPT python2.7 ../x.py dist --target $TARGETS
|
ENV SCRIPT python2.7 ../x.py dist --target $TARGETS
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
set -ex
|
set -ex
|
||||||
|
|
||||||
# Originally from https://releases.llvm.org/8.0.0/clang+llvm-8.0.0-x86_64-linux-gnu-ubuntu-14.04.tar.xz
|
# Originally from https://releases.llvm.org/8.0.0/clang+llvm-8.0.0-x86_64-linux-gnu-ubuntu-14.04.tar.xz
|
||||||
curl https://rust-lang-ci2.s3.amazonaws.com/rust-ci-mirror/clang%2Bllvm-8.0.0-x86_64-linux-gnu-ubuntu-14.04.tar.xz | \
|
curl https://rust-lang-ci-mirrors.s3-us-west-1.amazonaws.com/rustc/clang%2Bllvm-8.0.0-x86_64-linux-gnu-ubuntu-14.04.tar.xz | \
|
||||||
tar xJf -
|
tar xJf -
|
||||||
export PATH=`pwd`/clang+llvm-8.0.0-x86_64-linux-gnu-ubuntu-14.04/bin:$PATH
|
export PATH=`pwd`/clang+llvm-8.0.0-x86_64-linux-gnu-ubuntu-14.04/bin:$PATH
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ set -ex
|
|||||||
source shared.sh
|
source shared.sh
|
||||||
|
|
||||||
VERSION=1.0.2k
|
VERSION=1.0.2k
|
||||||
URL=https://rust-lang-ci2.s3.amazonaws.com/rust-ci-mirror/openssl-$VERSION.tar.gz
|
URL=https://rust-lang-ci-mirrors.s3-us-west-1.amazonaws.com/rustc/openssl-$VERSION.tar.gz
|
||||||
|
|
||||||
curl $URL | tar xzf -
|
curl $URL | tar xzf -
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ cd netbsd
|
|||||||
|
|
||||||
mkdir -p /x-tools/x86_64-unknown-netbsd/sysroot
|
mkdir -p /x-tools/x86_64-unknown-netbsd/sysroot
|
||||||
|
|
||||||
URL=https://rust-lang-ci2.s3.amazonaws.com/rust-ci-mirror
|
URL=https://rust-lang-ci-mirrors.s3-us-west-1.amazonaws.com/rustc
|
||||||
|
|
||||||
# Originally from ftp://ftp.netbsd.org/pub/NetBSD/NetBSD-$BSD/source/sets/*.tgz
|
# Originally from ftp://ftp.netbsd.org/pub/NetBSD/NetBSD-$BSD/source/sets/*.tgz
|
||||||
curl $URL/2018-03-01-netbsd-src.tgz | tar xzf -
|
curl $URL/2018-03-01-netbsd-src.tgz | tar xzf -
|
||||||
|
@ -17,9 +17,6 @@ dist=$objdir/build/dist
|
|||||||
|
|
||||||
source "$ci_dir/shared.sh"
|
source "$ci_dir/shared.sh"
|
||||||
|
|
||||||
travis_fold start build_docker
|
|
||||||
travis_time_start
|
|
||||||
|
|
||||||
if [ -f "$docker_dir/$image/Dockerfile" ]; then
|
if [ -f "$docker_dir/$image/Dockerfile" ]; then
|
||||||
if [ "$CI" != "" ]; then
|
if [ "$CI" != "" ]; then
|
||||||
hash_key=/tmp/.docker-hash-key.txt
|
hash_key=/tmp/.docker-hash-key.txt
|
||||||
@ -94,7 +91,6 @@ elif [ -f "$docker_dir/disabled/$image/Dockerfile" ]; then
|
|||||||
echo Cannot run disabled images on CI!
|
echo Cannot run disabled images on CI!
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
# retry messes with the pipe from tar to docker. Not needed on non-travis
|
|
||||||
# Transform changes the context of disabled Dockerfiles to match the enabled ones
|
# Transform changes the context of disabled Dockerfiles to match the enabled ones
|
||||||
tar --transform 's#^./disabled/#./#' -C $docker_dir -c . | docker \
|
tar --transform 's#^./disabled/#./#' -C $docker_dir -c . | docker \
|
||||||
build \
|
build \
|
||||||
@ -107,9 +103,6 @@ else
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
travis_fold end build_docker
|
|
||||||
travis_time_finish
|
|
||||||
|
|
||||||
mkdir -p $HOME/.cargo
|
mkdir -p $HOME/.cargo
|
||||||
mkdir -p $objdir/tmp
|
mkdir -p $objdir/tmp
|
||||||
mkdir -p $objdir/cores
|
mkdir -p $objdir/cores
|
||||||
@ -132,28 +125,61 @@ fi
|
|||||||
# goes ahead and sets it for all builders.
|
# goes ahead and sets it for all builders.
|
||||||
args="$args --privileged"
|
args="$args --privileged"
|
||||||
|
|
||||||
exec docker \
|
# Things get a little weird if this script is already running in a docker
|
||||||
|
# container. If we're already in a docker container then we assume it's set up
|
||||||
|
# to do docker-in-docker where we have access to a working `docker` command.
|
||||||
|
#
|
||||||
|
# If this is the case (we check via the presence of `/.dockerenv`)
|
||||||
|
# then we can't actually use the `--volume` argument. Typically we use
|
||||||
|
# `--volume` to efficiently share the build and source directory between this
|
||||||
|
# script and the container we're about to spawn. If we're inside docker already
|
||||||
|
# though the `--volume` argument maps the *host's* folder to the container we're
|
||||||
|
# about to spawn, when in fact we want the folder in this container itself. To
|
||||||
|
# work around this we use a recipe cribbed from
|
||||||
|
# https://circleci.com/docs/2.0/building-docker-images/#mounting-folders to
|
||||||
|
# create a temporary container with a volume. We then copy the entire source
|
||||||
|
# directory into this container, and then use that copy in the container we're
|
||||||
|
# about to spawn. Finally after the build finishes we re-extract the object
|
||||||
|
# directory.
|
||||||
|
#
|
||||||
|
# Note that none of this is necessary if we're *not* in a docker-in-docker
|
||||||
|
# scenario. If this script is run on a bare metal host then we share a bunch of
|
||||||
|
# data directories to share as much data as possible. Note that we also use
|
||||||
|
# `LOCAL_USER_ID` (recognized in `src/ci/run.sh`) to ensure that files are all
|
||||||
|
# read/written as the same user as the bare-metal user.
|
||||||
|
if [ -f /.dockerenv ]; then
|
||||||
|
docker create -v /checkout --name checkout alpine:3.4 /bin/true
|
||||||
|
docker cp . checkout:/checkout
|
||||||
|
args="$args --volumes-from checkout"
|
||||||
|
else
|
||||||
|
args="$args --volume $root_dir:/checkout:ro"
|
||||||
|
args="$args --volume $objdir:/checkout/obj"
|
||||||
|
args="$args --volume $HOME/.cargo:/cargo"
|
||||||
|
args="$args --volume $HOME/rustsrc:$HOME/rustsrc"
|
||||||
|
args="$args --env LOCAL_USER_ID=`id -u`"
|
||||||
|
fi
|
||||||
|
|
||||||
|
docker \
|
||||||
run \
|
run \
|
||||||
--volume "$root_dir:/checkout:ro" \
|
|
||||||
--volume "$objdir:/checkout/obj" \
|
|
||||||
--workdir /checkout/obj \
|
--workdir /checkout/obj \
|
||||||
--env SRC=/checkout \
|
--env SRC=/checkout \
|
||||||
$args \
|
$args \
|
||||||
--env CARGO_HOME=/cargo \
|
--env CARGO_HOME=/cargo \
|
||||||
--env DEPLOY \
|
--env DEPLOY \
|
||||||
--env DEPLOY_ALT \
|
--env DEPLOY_ALT \
|
||||||
--env LOCAL_USER_ID=`id -u` \
|
|
||||||
--env CI \
|
--env CI \
|
||||||
--env TRAVIS \
|
|
||||||
--env TRAVIS_BRANCH \
|
|
||||||
--env TF_BUILD \
|
--env TF_BUILD \
|
||||||
--env BUILD_SOURCEBRANCHNAME \
|
--env BUILD_SOURCEBRANCHNAME \
|
||||||
--env TOOLSTATE_REPO_ACCESS_TOKEN \
|
--env TOOLSTATE_REPO_ACCESS_TOKEN \
|
||||||
--env TOOLSTATE_REPO \
|
--env TOOLSTATE_REPO \
|
||||||
|
--env TOOLSTATE_PUBLISH \
|
||||||
--env CI_JOB_NAME="${CI_JOB_NAME-$IMAGE}" \
|
--env CI_JOB_NAME="${CI_JOB_NAME-$IMAGE}" \
|
||||||
--volume "$HOME/.cargo:/cargo" \
|
|
||||||
--volume "$HOME/rustsrc:$HOME/rustsrc" \
|
|
||||||
--init \
|
--init \
|
||||||
--rm \
|
--rm \
|
||||||
rust-ci \
|
rust-ci \
|
||||||
/checkout/src/ci/run.sh
|
/checkout/src/ci/run.sh
|
||||||
|
|
||||||
|
if [ -f /.dockerenv ]; then
|
||||||
|
rm -rf $objdir
|
||||||
|
docker cp checkout:/checkout/obj $objdir
|
||||||
|
fi
|
||||||
|
@ -23,8 +23,9 @@ REPOSITORIES = [
|
|||||||
HOST_OS = "linux"
|
HOST_OS = "linux"
|
||||||
|
|
||||||
# Mirroring options
|
# Mirroring options
|
||||||
MIRROR_BUCKET = "rust-lang-ci2"
|
MIRROR_BUCKET = "rust-lang-ci-mirrors"
|
||||||
MIRROR_BASE_DIR = "rust-ci-mirror/android/"
|
MIRROR_BUCKET_REGION = "us-west-1"
|
||||||
|
MIRROR_BASE_DIR = "rustc/android/"
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import hashlib
|
import hashlib
|
||||||
@ -144,7 +145,8 @@ def cli_install(args):
|
|||||||
lockfile = Lockfile(args.lockfile)
|
lockfile = Lockfile(args.lockfile)
|
||||||
for package in lockfile.packages.values():
|
for package in lockfile.packages.values():
|
||||||
# Download the file from the mirror into a temp file
|
# Download the file from the mirror into a temp file
|
||||||
url = "https://" + MIRROR_BUCKET + ".s3.amazonaws.com/" + MIRROR_BASE_DIR
|
url = "https://" + MIRROR_BUCKET + ".s3-" + MIRROR_BUCKET_REGION + \
|
||||||
|
".amazonaws.com/" + MIRROR_BASE_DIR
|
||||||
downloaded = package.download(url)
|
downloaded = package.download(url)
|
||||||
# Extract the file in a temporary directory
|
# Extract the file in a temporary directory
|
||||||
extract_dir = tempfile.mkdtemp()
|
extract_dir = tempfile.mkdtemp()
|
||||||
|
@ -59,7 +59,7 @@ done
|
|||||||
|
|
||||||
# Originally downloaded from:
|
# Originally downloaded from:
|
||||||
# https://download.freebsd.org/ftp/releases/${freebsd_arch}/${freebsd_version}-RELEASE/base.txz
|
# https://download.freebsd.org/ftp/releases/${freebsd_arch}/${freebsd_version}-RELEASE/base.txz
|
||||||
URL=https://rust-lang-ci2.s3.amazonaws.com/rust-ci-mirror/2019-04-04-freebsd-${freebsd_arch}-${freebsd_version}-RELEASE-base.txz
|
URL=https://rust-lang-ci-mirrors.s3-us-west-1.amazonaws.com/rustc/2019-04-04-freebsd-${freebsd_arch}-${freebsd_version}-RELEASE-base.txz
|
||||||
curl "$URL" | tar xJf - -C "$sysroot" --wildcards "${files_to_extract[@]}"
|
curl "$URL" | tar xJf - -C "$sysroot" --wildcards "${files_to_extract[@]}"
|
||||||
|
|
||||||
# Fix up absolute symlinks from the system image. This can be removed
|
# Fix up absolute symlinks from the system image. This can be removed
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
set -ex
|
set -ex
|
||||||
|
|
||||||
curl -fo /usr/local/bin/sccache \
|
curl -fo /usr/local/bin/sccache \
|
||||||
https://rust-lang-ci2.s3.amazonaws.com/rust-ci-mirror/2018-04-02-sccache-x86_64-unknown-linux-musl
|
https://rust-lang-ci-mirrors.s3-us-west-1.amazonaws.com/rustc/2018-04-02-sccache-x86_64-unknown-linux-musl
|
||||||
|
|
||||||
chmod +x /usr/local/bin/sccache
|
chmod +x /usr/local/bin/sccache
|
||||||
|
@ -11,6 +11,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|||||||
cmake \
|
cmake \
|
||||||
sudo \
|
sudo \
|
||||||
gdb \
|
gdb \
|
||||||
|
libssl-dev \
|
||||||
|
pkg-config \
|
||||||
xz-utils \
|
xz-utils \
|
||||||
wget \
|
wget \
|
||||||
patch
|
patch
|
||||||
@ -41,7 +43,6 @@ ENV WASM_TARGETS=wasm32-unknown-unknown
|
|||||||
ENV WASM_SCRIPT python2.7 /checkout/x.py test --target $WASM_TARGETS \
|
ENV WASM_SCRIPT python2.7 /checkout/x.py test --target $WASM_TARGETS \
|
||||||
src/test/run-make \
|
src/test/run-make \
|
||||||
src/test/ui \
|
src/test/ui \
|
||||||
src/test/run-pass \
|
|
||||||
src/test/compile-fail \
|
src/test/compile-fail \
|
||||||
src/test/mir-opt \
|
src/test/mir-opt \
|
||||||
src/test/codegen-units \
|
src/test/codegen-units \
|
||||||
|
@ -17,6 +17,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|||||||
cmake \
|
cmake \
|
||||||
sudo \
|
sudo \
|
||||||
gdb \
|
gdb \
|
||||||
|
libssl-dev \
|
||||||
|
pkg-config \
|
||||||
xz-utils \
|
xz-utils \
|
||||||
lld \
|
lld \
|
||||||
clang
|
clang
|
||||||
@ -31,7 +33,6 @@ ENV RUST_CONFIGURE_ARGS \
|
|||||||
--build=x86_64-unknown-linux-gnu \
|
--build=x86_64-unknown-linux-gnu \
|
||||||
--enable-debug \
|
--enable-debug \
|
||||||
--enable-lld \
|
--enable-lld \
|
||||||
--enable-lldb \
|
|
||||||
--enable-optimize \
|
--enable-optimize \
|
||||||
--set llvm.use-linker=lld \
|
--set llvm.use-linker=lld \
|
||||||
--set target.x86_64-unknown-linux-gnu.linker=clang \
|
--set target.x86_64-unknown-linux-gnu.linker=clang \
|
||||||
|
@ -11,6 +11,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|||||||
cmake \
|
cmake \
|
||||||
sudo \
|
sudo \
|
||||||
gdb \
|
gdb \
|
||||||
|
libssl-dev \
|
||||||
|
pkg-config \
|
||||||
xz-utils
|
xz-utils
|
||||||
|
|
||||||
COPY scripts/sccache.sh /scripts/
|
COPY scripts/sccache.sh /scripts/
|
||||||
|
@ -13,6 +13,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|||||||
gdb \
|
gdb \
|
||||||
llvm-6.0-tools \
|
llvm-6.0-tools \
|
||||||
libedit-dev \
|
libedit-dev \
|
||||||
|
libssl-dev \
|
||||||
|
pkg-config \
|
||||||
zlib1g-dev \
|
zlib1g-dev \
|
||||||
xz-utils
|
xz-utils
|
||||||
|
|
||||||
|
@ -11,6 +11,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|||||||
cmake \
|
cmake \
|
||||||
sudo \
|
sudo \
|
||||||
gdb \
|
gdb \
|
||||||
|
libssl-dev \
|
||||||
|
pkg-config \
|
||||||
xz-utils
|
xz-utils
|
||||||
|
|
||||||
COPY scripts/sccache.sh /scripts/
|
COPY scripts/sccache.sh /scripts/
|
||||||
|
@ -21,8 +21,10 @@ COPY x86_64-gnu-tools/checkregression.py /tmp/
|
|||||||
COPY x86_64-gnu-tools/checktools.sh /tmp/
|
COPY x86_64-gnu-tools/checktools.sh /tmp/
|
||||||
COPY x86_64-gnu-tools/repo.sh /tmp/
|
COPY x86_64-gnu-tools/repo.sh /tmp/
|
||||||
|
|
||||||
|
# Run rustbook with `linkcheck` feature enabled
|
||||||
|
ENV CHECK_LINKS 1
|
||||||
|
|
||||||
ENV RUST_CONFIGURE_ARGS \
|
ENV RUST_CONFIGURE_ARGS \
|
||||||
--build=x86_64-unknown-linux-gnu \
|
--build=x86_64-unknown-linux-gnu \
|
||||||
--enable-test-miri \
|
|
||||||
--save-toolstates=/tmp/toolstates.json
|
--save-toolstates=/tmp/toolstates.json
|
||||||
ENV SCRIPT /tmp/checktools.sh ../x.py /tmp/toolstates.json linux
|
ENV SCRIPT /tmp/checktools.sh ../x.py /tmp/toolstates.json linux
|
||||||
|
@ -1,9 +1,18 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
## This script has two purposes: detect any tool that *regressed*, which is used
|
||||||
|
## during the week before the beta branches to reject PRs; and detect any tool
|
||||||
|
## that *changed* to see if we need to update the toolstate repo.
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import json
|
import json
|
||||||
|
|
||||||
|
# Regressions for these tools during the beta cutoff week do not cause failure.
|
||||||
|
# See `status_check` in `checktools.sh` for tools that have to pass on the
|
||||||
|
# beta/stable branches.
|
||||||
|
REGRESSION_OK = ["rustc-guide", "miri", "embedded-book"]
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
os_name = sys.argv[1]
|
os_name = sys.argv[1]
|
||||||
toolstate_file = sys.argv[2]
|
toolstate_file = sys.argv[2]
|
||||||
@ -32,7 +41,8 @@ if __name__ == '__main__':
|
|||||||
'The state of "{}" has {} from "{}" to "{}"'
|
'The state of "{}" has {} from "{}" to "{}"'
|
||||||
.format(tool, verb, state, new_state)
|
.format(tool, verb, state, new_state)
|
||||||
)
|
)
|
||||||
regressed = True
|
if not (verb == 'regressed' and tool in REGRESSION_OK):
|
||||||
|
regressed = True
|
||||||
|
|
||||||
if regressed:
|
if regressed:
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
@ -25,6 +25,7 @@ python2.7 "$X_PY" test --no-fail-fast \
|
|||||||
src/doc/rust-by-example \
|
src/doc/rust-by-example \
|
||||||
src/doc/embedded-book \
|
src/doc/embedded-book \
|
||||||
src/doc/edition-guide \
|
src/doc/edition-guide \
|
||||||
|
src/doc/rustc-guide \
|
||||||
src/tools/clippy \
|
src/tools/clippy \
|
||||||
src/tools/rls \
|
src/tools/rls \
|
||||||
src/tools/rustfmt \
|
src/tools/rustfmt \
|
||||||
@ -41,7 +42,7 @@ check_tool_failed() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# This function checks that if a tool's submodule changed, the tool's state must improve
|
# This function checks that if a tool's submodule changed, the tool's state must improve
|
||||||
verify_status() {
|
verify_submodule_changed() {
|
||||||
echo "Verifying status of $1..."
|
echo "Verifying status of $1..."
|
||||||
if echo "$CHANGED_FILES" | grep -q "^M[[:blank:]]$2$"; then
|
if echo "$CHANGED_FILES" | grep -q "^M[[:blank:]]$2$"; then
|
||||||
echo "This PR updated '$2', verifying if status is 'test-pass'..."
|
echo "This PR updated '$2', verifying if status is 'test-pass'..."
|
||||||
@ -66,7 +67,7 @@ verify_status() {
|
|||||||
check_dispatch() {
|
check_dispatch() {
|
||||||
if [ "$1" = submodule_changed ]; then
|
if [ "$1" = submodule_changed ]; then
|
||||||
# ignore $2 (branch id)
|
# ignore $2 (branch id)
|
||||||
verify_status $3 $4
|
verify_submodule_changed $3 $4
|
||||||
elif [ "$2" = beta ]; then
|
elif [ "$2" = beta ]; then
|
||||||
echo "Requiring test passing for $3..."
|
echo "Requiring test passing for $3..."
|
||||||
if check_tool_failed "$3"; then
|
if check_tool_failed "$3"; then
|
||||||
@ -75,7 +76,12 @@ check_dispatch() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# list all tools here
|
# List all tools here.
|
||||||
|
# This function gets called with "submodule_changed" for each PR that changed a submodule,
|
||||||
|
# and with "beta_required" for each PR that lands on beta/stable.
|
||||||
|
# The purpose of this function is to *reject* PRs if a tool is not "test-pass" and
|
||||||
|
# (a) the tool's submodule has been updated, or (b) we landed on beta/stable and the
|
||||||
|
# tool has to "test-pass" on that branch.
|
||||||
status_check() {
|
status_check() {
|
||||||
check_dispatch $1 beta book src/doc/book
|
check_dispatch $1 beta book src/doc/book
|
||||||
check_dispatch $1 beta nomicon src/doc/nomicon
|
check_dispatch $1 beta nomicon src/doc/nomicon
|
||||||
@ -85,9 +91,13 @@ status_check() {
|
|||||||
check_dispatch $1 beta rls src/tools/rls
|
check_dispatch $1 beta rls src/tools/rls
|
||||||
check_dispatch $1 beta rustfmt src/tools/rustfmt
|
check_dispatch $1 beta rustfmt src/tools/rustfmt
|
||||||
check_dispatch $1 beta clippy-driver src/tools/clippy
|
check_dispatch $1 beta clippy-driver src/tools/clippy
|
||||||
# these tools are not required for beta to successfully branch
|
# These tools are not required on the beta/stable branches, but they *do* cause
|
||||||
|
# PRs to fail if a submodule update does not fix them.
|
||||||
|
# They will still cause failure during the beta cutoff week, unless `checkregression.py`
|
||||||
|
# exempts them from that.
|
||||||
check_dispatch $1 nightly miri src/tools/miri
|
check_dispatch $1 nightly miri src/tools/miri
|
||||||
check_dispatch $1 nightly embedded-book src/doc/embedded-book
|
check_dispatch $1 nightly embedded-book src/doc/embedded-book
|
||||||
|
check_dispatch $1 nightly rustc-guide src/doc/rustc-guide
|
||||||
}
|
}
|
||||||
|
|
||||||
# If this PR is intended to update one of these tools, do not let the build pass
|
# If this PR is intended to update one of these tools, do not let the build pass
|
||||||
@ -96,12 +106,14 @@ status_check() {
|
|||||||
status_check "submodule_changed"
|
status_check "submodule_changed"
|
||||||
|
|
||||||
CHECK_NOT="$(readlink -f "$(dirname $0)/checkregression.py")"
|
CHECK_NOT="$(readlink -f "$(dirname $0)/checkregression.py")"
|
||||||
|
# This callback is called by `commit_toolstate_change`, see `repo.sh`.
|
||||||
change_toolstate() {
|
change_toolstate() {
|
||||||
# only update the history
|
# only update the history
|
||||||
if python2.7 "$CHECK_NOT" "$OS" "$TOOLSTATE_FILE" "_data/latest.json" changed; then
|
if python2.7 "$CHECK_NOT" "$OS" "$TOOLSTATE_FILE" "_data/latest.json" changed; then
|
||||||
echo 'Toolstate is not changed. Not updating.'
|
echo 'Toolstate is not changed. Not updating.'
|
||||||
else
|
else
|
||||||
if [ $SIX_WEEK_CYCLE -ge 35 ]; then
|
if [ $SIX_WEEK_CYCLE -ge 35 ]; then
|
||||||
|
# Reject any regressions during the week before beta cutoff.
|
||||||
python2.7 "$CHECK_NOT" "$OS" "$TOOLSTATE_FILE" "_data/latest.json" regressed
|
python2.7 "$CHECK_NOT" "$OS" "$TOOLSTATE_FILE" "_data/latest.json" regressed
|
||||||
fi
|
fi
|
||||||
sed -i "1 a\\
|
sed -i "1 a\\
|
||||||
@ -111,7 +123,7 @@ $COMMIT\t$(cat "$TOOLSTATE_FILE")
|
|||||||
}
|
}
|
||||||
|
|
||||||
if [ "$RUST_RELEASE_CHANNEL" = nightly ]; then
|
if [ "$RUST_RELEASE_CHANNEL" = nightly ]; then
|
||||||
if [ -n "${TOOLSTATE_REPO_ACCESS_TOKEN+is_set}" ]; then
|
if [ -n "${TOOLSTATE_PUBLISH+is_set}" ]; then
|
||||||
. "$(dirname $0)/repo.sh"
|
. "$(dirname $0)/repo.sh"
|
||||||
MESSAGE_FILE=$(mktemp -t msg.XXXXXX)
|
MESSAGE_FILE=$(mktemp -t msg.XXXXXX)
|
||||||
echo "($OS CI update)" > "$MESSAGE_FILE"
|
echo "($OS CI update)" > "$MESSAGE_FILE"
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
#
|
#
|
||||||
# The function relies on a GitHub bot user, which should have a Personal access
|
# The function relies on a GitHub bot user, which should have a Personal access
|
||||||
# token defined in the environment variable $TOOLSTATE_REPO_ACCESS_TOKEN. If for
|
# token defined in the environment variable $TOOLSTATE_REPO_ACCESS_TOKEN. If for
|
||||||
# some reason you need to change the token, please update `.travis.yml` and
|
# some reason you need to change the token, please update the Azure Pipelines
|
||||||
# `appveyor.yml`:
|
# variable group.
|
||||||
#
|
#
|
||||||
# 1. Generate a new Personal access token:
|
# 1. Generate a new Personal access token:
|
||||||
#
|
#
|
||||||
@ -18,28 +18,9 @@
|
|||||||
# Save it somewhere secure, as the token would be gone once you leave
|
# Save it somewhere secure, as the token would be gone once you leave
|
||||||
# the page.
|
# the page.
|
||||||
#
|
#
|
||||||
# 2. Encrypt the token for Travis CI
|
# 2. Update the variable group in Azure Pipelines
|
||||||
#
|
#
|
||||||
# * Install the `travis` tool locally (`gem install travis`).
|
# * Ping a member of the infrastructure team to do this.
|
||||||
# * Encrypt the token:
|
|
||||||
# ```
|
|
||||||
# travis -r rust-lang/rust encrypt \
|
|
||||||
# TOOLSTATE_REPO_ACCESS_TOKEN=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
|
||||||
# ```
|
|
||||||
# * Copy output to replace the existing one in `.travis.yml`.
|
|
||||||
# * Details of this step can be found in
|
|
||||||
# <https://docs.travis-ci.com/user/encryption-keys/>
|
|
||||||
#
|
|
||||||
# 3. Encrypt the token for AppVeyor
|
|
||||||
#
|
|
||||||
# * Login to AppVeyor using your main account, and login as the rust-lang
|
|
||||||
# organization.
|
|
||||||
# * Open the ["Encrypt data" tool](https://ci.appveyor.com/tools/encrypt)
|
|
||||||
# * Paste the 40-digit token into the "Value to encrypt" box, then click
|
|
||||||
# "Encrypt"
|
|
||||||
# * Copy the output to replace the existing one in `appveyor.yml`.
|
|
||||||
# * Details of this step can be found in
|
|
||||||
# <https://www.appveyor.com/docs/how-to/git-push/>
|
|
||||||
#
|
#
|
||||||
# 4. Replace the email address below if the bot account identity is changed
|
# 4. Replace the email address below if the bot account identity is changed
|
||||||
#
|
#
|
||||||
@ -62,6 +43,13 @@ commit_toolstate_change() {
|
|||||||
MESSAGE_FILE="$1"
|
MESSAGE_FILE="$1"
|
||||||
shift
|
shift
|
||||||
for RETRY_COUNT in 1 2 3 4 5; do
|
for RETRY_COUNT in 1 2 3 4 5; do
|
||||||
|
# Call the callback.
|
||||||
|
# - If we are in the `auto` branch (pre-landing), this is called from `checktools.sh` and
|
||||||
|
# the callback is `change_toolstate` in that file. The purpose of this is to publish the
|
||||||
|
# test results (the new commit-to-toolstate mapping) in the toolstate repo.
|
||||||
|
# - If we are in the `master` branch (post-landing), this is called by the CI pipeline
|
||||||
|
# and the callback is `src/tools/publish_toolstate.py`. The purpose is to publish
|
||||||
|
# the new "current" toolstate in the toolstate repo.
|
||||||
"$@"
|
"$@"
|
||||||
# `git commit` failing means nothing to commit.
|
# `git commit` failing means nothing to commit.
|
||||||
FAILURE=0
|
FAILURE=0
|
||||||
|
@ -11,6 +11,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|||||||
cmake \
|
cmake \
|
||||||
sudo \
|
sudo \
|
||||||
gdb \
|
gdb \
|
||||||
|
libssl-dev \
|
||||||
|
pkg-config \
|
||||||
xz-utils
|
xz-utils
|
||||||
|
|
||||||
COPY scripts/sccache.sh /scripts/
|
COPY scripts/sccache.sh /scripts/
|
||||||
|
@ -11,9 +11,6 @@ set -o nounset
|
|||||||
ci_dir=$(cd $(dirname $0) && pwd)
|
ci_dir=$(cd $(dirname $0) && pwd)
|
||||||
. "$ci_dir/shared.sh"
|
. "$ci_dir/shared.sh"
|
||||||
|
|
||||||
travis_fold start init_repo
|
|
||||||
travis_time_start
|
|
||||||
|
|
||||||
REPO_DIR="$1"
|
REPO_DIR="$1"
|
||||||
CACHE_DIR="$2"
|
CACHE_DIR="$2"
|
||||||
|
|
||||||
@ -73,5 +70,3 @@ retry sh -c "git submodule deinit -f $use_git && \
|
|||||||
git submodule sync && \
|
git submodule sync && \
|
||||||
git submodule update -j 16 --init --recursive $use_git"
|
git submodule update -j 16 --init --recursive $use_git"
|
||||||
wait
|
wait
|
||||||
travis_fold end init_repo
|
|
||||||
travis_time_finish
|
|
||||||
|
35
src/ci/install-awscli.sh
Executable file
35
src/ci/install-awscli.sh
Executable file
@ -0,0 +1,35 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# This script downloads and installs awscli from the packages mirrored in our
|
||||||
|
# own S3 bucket. This follows the recommendations at:
|
||||||
|
#
|
||||||
|
# https://packaging.python.org/guides/index-mirrors-and-caches/#caching-with-pip
|
||||||
|
#
|
||||||
|
# To create a new mirrored copy you can run the command:
|
||||||
|
#
|
||||||
|
# pip wheel awscli
|
||||||
|
#
|
||||||
|
# Before compressing please make sure all the wheels end with `-none-any.whl`.
|
||||||
|
# If that's not the case you'll need to remove the non-cross-platform ones and
|
||||||
|
# replace them with the .tar.gz downloaded from https://pypi.org. Also make
|
||||||
|
# sure it's possible to call this script with both Python 2 and Python 3.
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
IFS=$'\n\t'
|
||||||
|
|
||||||
|
MIRROR="https://rust-lang-ci-mirrors.s3-us-west-1.amazonaws.com/rustc/2019-07-27-awscli.tar"
|
||||||
|
DEPS_DIR="/tmp/awscli-deps"
|
||||||
|
|
||||||
|
pip="pip"
|
||||||
|
pipflags=""
|
||||||
|
if [[ "${AGENT_OS}" == "Linux" ]]; then
|
||||||
|
pip="pip3"
|
||||||
|
pipflags="--user"
|
||||||
|
|
||||||
|
sudo apt-get install -y python3-setuptools
|
||||||
|
echo "##vso[task.prependpath]$HOME/.local/bin"
|
||||||
|
fi
|
||||||
|
|
||||||
|
mkdir -p "${DEPS_DIR}"
|
||||||
|
curl "${MIRROR}" | tar xf - -C "${DEPS_DIR}"
|
||||||
|
"${pip}" install ${pipflags} --no-index "--find-links=${DEPS_DIR}" awscli
|
||||||
|
rm -rf "${DEPS_DIR}"
|
@ -25,7 +25,7 @@ source "$ci_dir/shared.sh"
|
|||||||
|
|
||||||
branch_name=$(getCIBranch)
|
branch_name=$(getCIBranch)
|
||||||
|
|
||||||
if [ ! isCI ] || [ "$branch_name" = "auto" ]; then
|
if [ ! isCI ] || [ "$branch_name" = "auto" ] || [ "$branch_name" = "try" ]; then
|
||||||
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --set build.print-step-timings --enable-verbose-tests"
|
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --set build.print-step-timings --enable-verbose-tests"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -91,27 +91,14 @@ if [ "$RUN_CHECK_WITH_PARALLEL_QUERIES" != "" ]; then
|
|||||||
rm -rf build
|
rm -rf build
|
||||||
fi
|
fi
|
||||||
|
|
||||||
travis_fold start configure
|
|
||||||
travis_time_start
|
|
||||||
$SRC/configure $RUST_CONFIGURE_ARGS
|
$SRC/configure $RUST_CONFIGURE_ARGS
|
||||||
travis_fold end configure
|
|
||||||
travis_time_finish
|
|
||||||
|
|
||||||
travis_fold start make-prepare
|
|
||||||
travis_time_start
|
|
||||||
retry make prepare
|
retry make prepare
|
||||||
travis_fold end make-prepare
|
|
||||||
travis_time_finish
|
|
||||||
|
|
||||||
travis_fold start check-bootstrap
|
|
||||||
travis_time_start
|
|
||||||
make check-bootstrap
|
make check-bootstrap
|
||||||
travis_fold end check-bootstrap
|
|
||||||
travis_time_finish
|
|
||||||
|
|
||||||
# Display the CPU and memory information. This helps us know why the CI timing
|
# Display the CPU and memory information. This helps us know why the CI timing
|
||||||
# is fluctuating.
|
# is fluctuating.
|
||||||
travis_fold start log-system-info
|
|
||||||
if isOSX; then
|
if isOSX; then
|
||||||
system_profiler SPHardwareDataType || true
|
system_profiler SPHardwareDataType || true
|
||||||
sysctl hw || true
|
sysctl hw || true
|
||||||
@ -121,19 +108,14 @@ else
|
|||||||
cat /proc/meminfo || true
|
cat /proc/meminfo || true
|
||||||
ncpus=$(grep processor /proc/cpuinfo | wc -l)
|
ncpus=$(grep processor /proc/cpuinfo | wc -l)
|
||||||
fi
|
fi
|
||||||
travis_fold end log-system-info
|
|
||||||
|
|
||||||
if [ ! -z "$SCRIPT" ]; then
|
if [ ! -z "$SCRIPT" ]; then
|
||||||
sh -x -c "$SCRIPT"
|
sh -x -c "$SCRIPT"
|
||||||
else
|
else
|
||||||
do_make() {
|
do_make() {
|
||||||
travis_fold start "make-$1"
|
|
||||||
travis_time_start
|
|
||||||
echo "make -j $ncpus $1"
|
echo "make -j $ncpus $1"
|
||||||
make -j $ncpus $1
|
make -j $ncpus $1
|
||||||
local retval=$?
|
local retval=$?
|
||||||
travis_fold end "make-$1"
|
|
||||||
travis_time_finish
|
|
||||||
return $retval
|
return $retval
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,53 +25,13 @@ function retry {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function isCI {
|
function isCI {
|
||||||
[ "$CI" = "true" ] || [ "$TRAVIS" = "true" ] || [ "$TF_BUILD" = "True" ]
|
[ "$CI" = "true" ] || [ "$TF_BUILD" = "True" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
function isOSX {
|
function isOSX {
|
||||||
[ "$TRAVIS_OS_NAME" = "osx" ] || [ "$AGENT_OS" = "Darwin" ]
|
[ "$AGENT_OS" = "Darwin" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
function getCIBranch {
|
function getCIBranch {
|
||||||
if [ "$TRAVIS" = "true" ]; then
|
echo "$BUILD_SOURCEBRANCHNAME"
|
||||||
echo "$TRAVIS_BRANCH"
|
|
||||||
elif [ "$APPVEYOR" = "True" ]; then
|
|
||||||
echo "$APPVEYOR_REPO_BRANCH"
|
|
||||||
else
|
|
||||||
echo "$BUILD_SOURCEBRANCHNAME"
|
|
||||||
fi;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ! declare -F travis_fold; then
|
|
||||||
if [ "${TRAVIS-false}" = 'true' ]; then
|
|
||||||
# This is a trimmed down copy of
|
|
||||||
# https://github.com/travis-ci/travis-build/blob/master/lib/travis/build/templates/header.sh
|
|
||||||
travis_fold() {
|
|
||||||
echo -en "travis_fold:$1:$2\r\033[0K"
|
|
||||||
}
|
|
||||||
travis_time_start() {
|
|
||||||
travis_timer_id=$(printf %08x $(( RANDOM * RANDOM )))
|
|
||||||
travis_start_time=$(travis_nanoseconds)
|
|
||||||
echo -en "travis_time:start:$travis_timer_id\r\033[0K"
|
|
||||||
}
|
|
||||||
travis_time_finish() {
|
|
||||||
travis_end_time=$(travis_nanoseconds)
|
|
||||||
local duration=$(($travis_end_time-$travis_start_time))
|
|
||||||
local msg="travis_time:end:$travis_timer_id"
|
|
||||||
echo -en "\n$msg:start=$travis_start_time,finish=$travis_end_time,duration=$duration\r\033[0K"
|
|
||||||
}
|
|
||||||
if [ $(uname) = 'Darwin' ]; then
|
|
||||||
travis_nanoseconds() {
|
|
||||||
date -u '+%s000000000'
|
|
||||||
}
|
|
||||||
else
|
|
||||||
travis_nanoseconds() {
|
|
||||||
date -u '+%s%N'
|
|
||||||
}
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
travis_fold() { return 0; }
|
|
||||||
travis_time_start() { return 0; }
|
|
||||||
travis_time_finish() { return 0; }
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
@ -22,9 +22,8 @@ removing some of the modules and functions. We’ll show two ways to call the
|
|||||||
the crate root. The `eat_at_restaurant` function is part of our library crate’s
|
the crate root. The `eat_at_restaurant` function is part of our library crate’s
|
||||||
public API, so we mark it with the `pub` keyword. In the [”Exposing Paths with
|
public API, so we mark it with the `pub` keyword. In the [”Exposing Paths with
|
||||||
the `pub` Keyword”][pub]<!-- ignore --> section, we’ll go into more detail
|
the `pub` Keyword”][pub]<!-- ignore --> section, we’ll go into more detail
|
||||||
about `pub`.
|
about `pub`. Note that this example won’t compile just yet; we’ll explain why
|
||||||
|
in a bit.
|
||||||
Note that this example won’t compile just yet; we’ll explain why in a bit.
|
|
||||||
|
|
||||||
<span class="filename">Filename: src/lib.rs</span>
|
<span class="filename">Filename: src/lib.rs</span>
|
||||||
|
|
||||||
|
@ -291,14 +291,14 @@ crate.
|
|||||||
|
|
||||||
If we’re using multiple items defined in the same package or same module,
|
If we’re using multiple items defined in the same package or same module,
|
||||||
listing each item on its own line can take up a lot of vertical space in our
|
listing each item on its own line can take up a lot of vertical space in our
|
||||||
files. For example, these two `use` statements we had in Listing 2-4 in the
|
files. For example, these two `use` statements we had in the Guessing Game in
|
||||||
Guessing Game bring items from `std` into scope:
|
Listing 2-4 bring items from `std` into scope:
|
||||||
|
|
||||||
<span class="filename">Filename: src/main.rs</span>
|
<span class="filename">Filename: src/main.rs</span>
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
use std::cmp::Ordering;
|
|
||||||
use std::io;
|
use std::io;
|
||||||
|
use std::cmp::Ordering;
|
||||||
// ---snip---
|
// ---snip---
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -528,7 +528,7 @@ fn main() -> Result<(), Box<dyn Error>> {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
The `Box<dyn Error>` type is called a *trait object*, which we’ll talk about in
|
The `Box<dyn Error>` type is called a trait object, which we’ll talk about in
|
||||||
the [“Using Trait Objects that Allow for Values of Different
|
the [“Using Trait Objects that Allow for Values of Different
|
||||||
Types”][trait-objects]<!-- ignore --> section in Chapter 17. For now, you can
|
Types”][trait-objects]<!-- ignore --> section in Chapter 17. For now, you can
|
||||||
read `Box<dyn Error>` to mean “any kind of error.” Using `?` in a `main`
|
read `Box<dyn Error>` to mean “any kind of error.” Using `?` in a `main`
|
||||||
|
@ -282,11 +282,12 @@ larger rectangle can indeed hold a smaller rectangle</span>
|
|||||||
|
|
||||||
Note that we’ve added a new line inside the `tests` module: `use super::*;`.
|
Note that we’ve added a new line inside the `tests` module: `use super::*;`.
|
||||||
The `tests` module is a regular module that follows the usual visibility rules
|
The `tests` module is a regular module that follows the usual visibility rules
|
||||||
we covered in Chapter 7 in the [“Modules as the Privacy
|
we covered in Chapter 7 in the [“Paths for Referring to an Item in the Module
|
||||||
Boundary”][modules-as-privacy-boundary]<!-- ignore --> section. Because the
|
Tree”][paths-for-referring-to-an-item-in-the-module-tree]<!-- ignore -->
|
||||||
`tests` module is an inner module, we need to bring the code under test in the
|
section. Because the `tests` module is an inner module, we need to bring the
|
||||||
outer module into the scope of the inner module. We use a glob here so anything
|
code under test in the outer module into the scope of the inner module. We use
|
||||||
we define in the outer module is available to this `tests` module.
|
a glob here so anything we define in the outer module is available to this
|
||||||
|
`tests` module.
|
||||||
|
|
||||||
We’ve named our test `larger_can_hold_smaller`, and we’ve created the two
|
We’ve named our test `larger_can_hold_smaller`, and we’ve created the two
|
||||||
`Rectangle` instances that we need. Then we called the `assert!` macro and
|
`Rectangle` instances that we need. Then we called the `assert!` macro and
|
||||||
@ -849,4 +850,4 @@ ch08-02-strings.html#concatenation-with-the--operator-or-the-format-macro
|
|||||||
ch11-02-running-tests.html#controlling-how-tests-are-run
|
ch11-02-running-tests.html#controlling-how-tests-are-run
|
||||||
[derivable-traits]: appendix-03-derivable-traits.html
|
[derivable-traits]: appendix-03-derivable-traits.html
|
||||||
[doc-comments]: ch14-02-publishing-to-crates-io.html#documentation-comments-as-tests
|
[doc-comments]: ch14-02-publishing-to-crates-io.html#documentation-comments-as-tests
|
||||||
[modules-as-privacy-boundary]: ch07-02-defining-modules-to-control-scope-and-privacy.html
|
[paths-for-referring-to-an-item-in-the-module-tree]: ch07-03-paths-for-referring-to-an-item-in-the-module-tree.html
|
||||||
|
@ -291,7 +291,7 @@ fn it_adds_two() {
|
|||||||
```
|
```
|
||||||
|
|
||||||
Note that the `mod common;` declaration is the same as the module declaration
|
Note that the `mod common;` declaration is the same as the module declaration
|
||||||
we demonstrated in Listing 7-25. Then in the test function, we can call the
|
we demonstrated in Listing 7-21. Then in the test function, we can call the
|
||||||
`common::setup()` function.
|
`common::setup()` function.
|
||||||
|
|
||||||
#### Integration Tests for Binary Crates
|
#### Integration Tests for Binary Crates
|
||||||
|
@ -298,7 +298,7 @@ definition in `hello_macro`, we’ll have to change the implementation of the
|
|||||||
procedural macro in `hello_macro_derive` as well. The two crates will need to
|
procedural macro in `hello_macro_derive` as well. The two crates will need to
|
||||||
be published separately, and programmers using these crates will need to add
|
be published separately, and programmers using these crates will need to add
|
||||||
both as dependencies and bring them both into scope. We could instead have the
|
both as dependencies and bring them both into scope. We could instead have the
|
||||||
`hello_macro` crate use `hello_macro_derive` as a dependency and reexport the
|
`hello_macro` crate use `hello_macro_derive` as a dependency and re-export the
|
||||||
procedural macro code. However, the way we’ve structured the project makes it
|
procedural macro code. However, the way we’ve structured the project makes it
|
||||||
possible for programmers to use `hello_macro` even if they don’t want the
|
possible for programmers to use `hello_macro` even if they don’t want the
|
||||||
`derive` functionality.
|
`derive` functionality.
|
||||||
|
@ -2,15 +2,14 @@
|
|||||||
|
|
||||||
*by Steve Klabnik and Carol Nichols, with contributions from the Rust Community*
|
*by Steve Klabnik and Carol Nichols, with contributions from the Rust Community*
|
||||||
|
|
||||||
Welcome to *The Rust Programming Language* book! This version of the text assumes
|
This version of the text assumes you’re using Rust 1.31.0 or later with
|
||||||
you’re using Rust 1.31.0 or later with `edition="2018"` in *Cargo.toml* of
|
`edition="2018"` in *Cargo.toml* of all projects to use Rust 2018 Edition
|
||||||
all projects to use Rust 2018 Edition idioms. See the [“Installation” section
|
idioms. See the [“Installation” section of Chapter 1][install]<!-- ignore -->
|
||||||
of Chapter 1][install]<!-- ignore --> to install or update Rust, and see the
|
to install or update Rust, and see the new [Appendix E][editions]<!-- ignore
|
||||||
new [Appendix E][editions]<!-- ignore --> for information on what editions of
|
--> for information on editions.
|
||||||
Rust are.
|
|
||||||
|
|
||||||
The 2018 Edition of the Rust language includes a number of improvements that
|
The 2018 Edition of the Rust language includes a number of improvements that
|
||||||
make Rust more ergonomic and easier to learn. This printing of the book
|
make Rust more ergonomic and easier to learn. This iteration of the book
|
||||||
contains a number of changes to reflect those improvements:
|
contains a number of changes to reflect those improvements:
|
||||||
|
|
||||||
- Chapter 7, “Managing Growing Projects with Packages, Crates, and Modules,”
|
- Chapter 7, “Managing Growing Projects with Packages, Crates, and Modules,”
|
||||||
@ -20,7 +19,7 @@ contains a number of changes to reflect those improvements:
|
|||||||
Types that Implement Traits” that explain the new `impl Trait` syntax.
|
Types that Implement Traits” that explain the new `impl Trait` syntax.
|
||||||
- Chapter 11 has a new section titled “Using `Result<T, E>` in Tests” that
|
- Chapter 11 has a new section titled “Using `Result<T, E>` in Tests” that
|
||||||
shows how to write tests that use the `?` operator.
|
shows how to write tests that use the `?` operator.
|
||||||
- The “Advanced Lifetimes” section of Chapter 19 was removed because compiler
|
- The “Advanced Lifetimes” section in Chapter 19 was removed because compiler
|
||||||
improvements have made the constructs in that section even rarer.
|
improvements have made the constructs in that section even rarer.
|
||||||
- The previous Appendix D, “Macros,” has been expanded to include procedural
|
- The previous Appendix D, “Macros,” has been expanded to include procedural
|
||||||
macros and was moved to the “Macros” section in Chapter 19.
|
macros and was moved to the “Macros” section in Chapter 19.
|
||||||
@ -31,7 +30,7 @@ contains a number of changes to reflect those improvements:
|
|||||||
- We fixed a number of small errors and imprecise wording throughout the book.
|
- We fixed a number of small errors and imprecise wording throughout the book.
|
||||||
Thank you to the readers who reported them!
|
Thank you to the readers who reported them!
|
||||||
|
|
||||||
Note that any code in the first printing of *The Rust Programming Language*
|
Note that any code in earlier iterations of *The Rust Programming Language*
|
||||||
that compiled will continue to compile without `edition="2018"` in the
|
that compiled will continue to compile without `edition="2018"` in the
|
||||||
project’s *Cargo.toml*, even as you update the Rust compiler version you’re
|
project’s *Cargo.toml*, even as you update the Rust compiler version you’re
|
||||||
using. That’s Rust’s backward compatibility guarantees at work!
|
using. That’s Rust’s backward compatibility guarantees at work!
|
||||||
|
@ -2,9 +2,7 @@ language: rust
|
|||||||
cache: cargo
|
cache: cargo
|
||||||
rust: nightly
|
rust: nightly
|
||||||
before_script:
|
before_script:
|
||||||
- (test -x $HOME/.cargo/bin/cargo-install-update || cargo install cargo-update)
|
- cargo install mdbook -Z install-upgrade
|
||||||
- (test -x $HOME/.cargo/bin/mdbook || cargo install mdbook)
|
|
||||||
- cargo install-update -a
|
|
||||||
- mdbook --version
|
- mdbook --version
|
||||||
script:
|
script:
|
||||||
- mdbook build
|
- mdbook build
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# The Rust Edition Guide
|
# The Rust Edition Guide
|
||||||
|
|
||||||
[](https://travis-ci.org/rust-lang-nursery/edition-guide)
|
[](https://travis-ci.com/rust-lang-nursery/edition-guide)
|
||||||
|
|
||||||
This book explains the concept of "editions", major new eras in [Rust]'s
|
This book explains the concept of "editions", major new eras in [Rust]'s
|
||||||
development. You can [read the book
|
development. You can [read the book
|
||||||
@ -35,7 +35,7 @@ $ mdbook serve
|
|||||||
```
|
```
|
||||||
|
|
||||||
This serves the book at http://localhost:3000, and rebuilds it on changes.
|
This serves the book at http://localhost:3000, and rebuilds it on changes.
|
||||||
You can now view the book in your web browser. If you make changes to the book's source code,
|
You can now view the book in your web browser. If you make changes to the book's source code,
|
||||||
you should only need to refresh your browser to see them.
|
you should only need to refresh your browser to see them.
|
||||||
|
|
||||||
_Firefox:_
|
_Firefox:_
|
||||||
|
@ -47,8 +47,8 @@ So how much speedup do you actually get? Like most performance related
|
|||||||
questions, the answer is "it depends." Here are some very un-scientific
|
questions, the answer is "it depends." Here are some very un-scientific
|
||||||
benchmarks at the time of writing.
|
benchmarks at the time of writing.
|
||||||
|
|
||||||
| build | performance | check performance | speedup |
|
| use case | build performance | check performance | speedup |
|
||||||
|--------|-------------|-------------------|---------|
|
|--------|-------------|-------------------|---------|
|
||||||
| initial compile | 11s | 5.6s | 1.96x |
|
| initial compile | 11s | 5.6s | 1.96x |
|
||||||
| second compile (no changes) | 3s | 1.9s | 1.57x |
|
| second compile (no changes) | 3s | 1.9s | 1.57x |
|
||||||
| third compile with small change | 5.8s | 3s | 1.93x |
|
| third compile with small change | 5.8s | 3s | 1.93x |
|
||||||
|
@ -19,6 +19,8 @@ And then use it with
|
|||||||
$ mdbook --help
|
$ mdbook --help
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Cargo Extensions
|
||||||
|
|
||||||
As an example of extending Cargo, you can use the [`cargo-update`](https://crates.io/crates/cargo-update)
|
As an example of extending Cargo, you can use the [`cargo-update`](https://crates.io/crates/cargo-update)
|
||||||
package. To install it:
|
package. To install it:
|
||||||
|
|
||||||
@ -26,9 +28,5 @@ package. To install it:
|
|||||||
$ cargo install cargo-update
|
$ cargo install cargo-update
|
||||||
```
|
```
|
||||||
|
|
||||||
This will allow you to use this command, which checks everything you've `cargo install`'d and
|
This will allow you to use `cargo install-update -a` command, which checks everything you've `cargo install`'d and
|
||||||
updates it to the latest version:
|
updates it to the latest version.
|
||||||
|
|
||||||
```console
|
|
||||||
$ cargo install-update -a
|
|
||||||
```
|
|
||||||
|
@ -12,12 +12,12 @@ In Rust 2018, we have made a couple of changes to the macros-by-example syntax.
|
|||||||
|
|
||||||
For example, consider the following Rust 2015 code:
|
For example, consider the following Rust 2015 code:
|
||||||
|
|
||||||
```rust2018
|
```rust
|
||||||
macro_rules! foo {
|
macro_rules! foo {
|
||||||
($a:ident, $b:expr) => {
|
($a:ident, $b:expr) => {
|
||||||
println!("{}", $a);
|
println!("{}", $a);
|
||||||
println!("{}", $b);
|
println!("{}", $b);
|
||||||
}
|
};
|
||||||
($a:ident) => {
|
($a:ident) => {
|
||||||
println!("{}", $a);
|
println!("{}", $a);
|
||||||
}
|
}
|
||||||
@ -29,7 +29,7 @@ but you need a whole other matcher to represent this possibility. This is
|
|||||||
annoying if your matchers are long. In Rust 2018, one can simply write the
|
annoying if your matchers are long. In Rust 2018, one can simply write the
|
||||||
following:
|
following:
|
||||||
|
|
||||||
```rust2018
|
```rust
|
||||||
macro_rules! foo {
|
macro_rules! foo {
|
||||||
($a:ident $(, $b:expr)?) => {
|
($a:ident $(, $b:expr)?) => {
|
||||||
println!("{}", $a);
|
println!("{}", $a);
|
||||||
|
@ -169,10 +169,8 @@ mod submodule {
|
|||||||
In Rust 2015, if you have a submodule:
|
In Rust 2015, if you have a submodule:
|
||||||
|
|
||||||
```rust,ignore
|
```rust,ignore
|
||||||
/// foo.rs
|
// This `mod` declaration looks for the `foo` module in
|
||||||
/// or
|
// `foo.rs` or `foo/mod.rs`.
|
||||||
/// foo/mod.rs
|
|
||||||
|
|
||||||
mod foo;
|
mod foo;
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -180,23 +178,43 @@ It can live in `foo.rs` or `foo/mod.rs`. If it has submodules of its own, it
|
|||||||
*must* be `foo/mod.rs`. So a `bar` submodule of `foo` would live at
|
*must* be `foo/mod.rs`. So a `bar` submodule of `foo` would live at
|
||||||
`foo/bar.rs`.
|
`foo/bar.rs`.
|
||||||
|
|
||||||
In Rust 2018, `mod.rs` is no longer needed.
|
In Rust 2018 the restriction that a module with submodules must be named
|
||||||
|
`mod.rs` is lifted. `foo.rs` can just be `foo.rs`,
|
||||||
```rust,ignore
|
|
||||||
/// foo.rs
|
|
||||||
/// foo/bar.rs
|
|
||||||
|
|
||||||
mod foo;
|
|
||||||
|
|
||||||
/// in foo.rs
|
|
||||||
mod bar;
|
|
||||||
```
|
|
||||||
|
|
||||||
`foo.rs` can just be `foo.rs`,
|
|
||||||
and the submodule is still `foo/bar.rs`. This eliminates the special
|
and the submodule is still `foo/bar.rs`. This eliminates the special
|
||||||
name, and if you have a bunch of files open in your editor, you can clearly
|
name, and if you have a bunch of files open in your editor, you can clearly
|
||||||
see their names, instead of having a bunch of tabs named `mod.rs`.
|
see their names, instead of having a bunch of tabs named `mod.rs`.
|
||||||
|
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Rust 2015</th>
|
||||||
|
<th>Rust 2018</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<pre>
|
||||||
|
.
|
||||||
|
├── lib.rs
|
||||||
|
└── foo/
|
||||||
|
├── mod.rs
|
||||||
|
└── bar.rs
|
||||||
|
</pre>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<pre>
|
||||||
|
.
|
||||||
|
├── lib.rs
|
||||||
|
├── foo.rs
|
||||||
|
└── foo/
|
||||||
|
└── bar.rs
|
||||||
|
</pre>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
### `use` paths
|
### `use` paths
|
||||||
|
|
||||||

|

|
||||||
|
@ -16,11 +16,9 @@ struct StrWrap<'a>(&'a str);
|
|||||||
In Rust 2015, you might have written:
|
In Rust 2015, you might have written:
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
// Rust 2015
|
# use std::fmt;
|
||||||
|
|
||||||
use std::fmt;
|
|
||||||
|
|
||||||
# struct StrWrap<'a>(&'a str);
|
# struct StrWrap<'a>(&'a str);
|
||||||
|
// Rust 2015
|
||||||
|
|
||||||
fn make_wrapper(string: &str) -> StrWrap {
|
fn make_wrapper(string: &str) -> StrWrap {
|
||||||
StrWrap(string)
|
StrWrap(string)
|
||||||
@ -38,7 +36,6 @@ In Rust 2018, you can instead write:
|
|||||||
```rust
|
```rust
|
||||||
# use std::fmt;
|
# use std::fmt;
|
||||||
# struct StrWrap<'a>(&'a str);
|
# struct StrWrap<'a>(&'a str);
|
||||||
|
|
||||||
// Rust 2018
|
// Rust 2018
|
||||||
|
|
||||||
fn make_wrapper(string: &str) -> StrWrap<'_> {
|
fn make_wrapper(string: &str) -> StrWrap<'_> {
|
||||||
|
@ -145,15 +145,7 @@ information to know more about the functions you're trying to call.
|
|||||||
$ rustup component add rust-src
|
$ rustup component add rust-src
|
||||||
```
|
```
|
||||||
|
|
||||||
### The "preview" components
|
### `rustfmt` for automatic code formatting
|
||||||
|
|
||||||
There are several components in a "preview" stage. These components currently
|
|
||||||
have `-preview` in their name, and this indicates that they're not quite 100%
|
|
||||||
ready for general consumption yet. Please try them out and give us feedback,
|
|
||||||
but know that they do not follow Rust's stability guarantees, and are still
|
|
||||||
actively changing, possibly in backwards-incompatible ways.
|
|
||||||
|
|
||||||
#### `rustfmt-preview` for automatic code formatting
|
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
@ -161,7 +153,7 @@ If you'd like to have your code automatically formatted, you can
|
|||||||
install this component:
|
install this component:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ rustup component add rustfmt-preview
|
$ rustup component add rustfmt
|
||||||
```
|
```
|
||||||
|
|
||||||
This will install two tools, `rustfmt` and `cargo-fmt`, that will reformat your
|
This will install two tools, `rustfmt` and `cargo-fmt`, that will reformat your
|
||||||
@ -173,7 +165,7 @@ $ cargo fmt
|
|||||||
|
|
||||||
will reformat your entire Cargo project.
|
will reformat your entire Cargo project.
|
||||||
|
|
||||||
#### `rls-preview` for IDE integration
|
### `rls` for IDE integration
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
@ -182,17 +174,18 @@ protocol](http://langserver.org/). To gain support for Rust with these IDEs,
|
|||||||
you'll need to install the Rust language sever, aka the "RLS":
|
you'll need to install the Rust language sever, aka the "RLS":
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ rustup component add rls-preview
|
$ rustup component add rls
|
||||||
```
|
```
|
||||||
|
|
||||||
Your IDE should take it from there.
|
For more information about integrating this into your IDE, see the [RLS
|
||||||
|
documentation](https://github.com/rust-lang/rls).
|
||||||
|
|
||||||
#### `clippy-preview` for more lints
|
### `clippy` for more lints
|
||||||
|
|
||||||
For even more lints to help you write Rust code, you can install `clippy`:
|
For even more lints to help you write Rust code, you can install `clippy`:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ rustup component add clippy-preview
|
$ rustup component add clippy
|
||||||
```
|
```
|
||||||
|
|
||||||
This will install `cargo-clippy` for you:
|
This will install `cargo-clippy` for you:
|
||||||
@ -202,7 +195,15 @@ $ cargo clippy
|
|||||||
```
|
```
|
||||||
|
|
||||||
For more, check out [clippy's
|
For more, check out [clippy's
|
||||||
documentation](https://github.com/rust-lang-nursery/rust-clippy).
|
documentation](https://github.com/rust-lang/rust-clippy).
|
||||||
|
|
||||||
|
### The "preview" components
|
||||||
|
|
||||||
|
There are several components in a "preview" stage. These components currently
|
||||||
|
have `-preview` in their name, and this indicates that they're not quite 100%
|
||||||
|
ready for general consumption yet. Please try them out and give us feedback,
|
||||||
|
but know that they do not follow Rust's stability guarantees, and are still
|
||||||
|
actively changing, possibly in backwards-incompatible ways.
|
||||||
|
|
||||||
#### `llvm-tools-preview` for using extra LLVM tools
|
#### `llvm-tools-preview` for using extra LLVM tools
|
||||||
|
|
||||||
|
@ -8,42 +8,43 @@ error message system was created.
|
|||||||
|
|
||||||
For example, here's some code that produces an error:
|
For example, here's some code that produces an error:
|
||||||
|
|
||||||
```rust,ignore
|
```rust,compile_fail
|
||||||
fn main() {
|
fn main() {
|
||||||
let mut x = 5;
|
let mut x = 5;
|
||||||
|
|
||||||
let y = &x;
|
let y = &x;
|
||||||
|
|
||||||
x += 1;
|
x += 1;
|
||||||
|
println!("{} {}", x, y);
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Here's the error in Rust 1.11:
|
Here's the error in Rust 1.11:
|
||||||
|
|
||||||
```text
|
```text
|
||||||
foo.rs:6:5: 6:11 error: cannot assign to `x` because it is borrowed [E0506]
|
foo.rs:4:5: 4:11 error: cannot assign to `x` because it is borrowed [E0506]
|
||||||
foo.rs:6 x += 1;
|
foo.rs:4 x += 1;
|
||||||
^~~~~~
|
^~~~~~
|
||||||
foo.rs:4:14: 4:15 note: borrow of `x` occurs here
|
foo.rs:3:14: 3:15 note: borrow of `x` occurs here
|
||||||
foo.rs:4 let y = &x;
|
foo.rs:3 let y = &x;
|
||||||
^
|
^
|
||||||
foo.rs:6:5: 6:11 help: run `rustc --explain E0506` to see a detailed explanation
|
foo.rs:4:5: 4:11 help: run `rustc --explain E0506` to see a detailed explanation
|
||||||
|
error: aborting due to previous error
|
||||||
```
|
```
|
||||||
|
|
||||||
Here's the error in Rust 1.28:
|
Here's the error in Rust 1.28:
|
||||||
|
|
||||||
```text
|
```text
|
||||||
error[E0506]: cannot assign to `x` because it is borrowed
|
error[E0506]: cannot assign to `x` because it is borrowed
|
||||||
--> foo.rs:6:5
|
--> foo.rs:4:5
|
||||||
|
|
|
|
||||||
4 | let y = &x;
|
3 | let y = &x;
|
||||||
| - borrow of `x` occurs here
|
| - borrow of `x` occurs here
|
||||||
5 |
|
4 | x += 1;
|
||||||
6 | x += 1;
|
|
||||||
| ^^^^^^ assignment to borrowed `x` occurs here
|
| ^^^^^^ assignment to borrowed `x` occurs here
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0506`.
|
||||||
```
|
```
|
||||||
|
|
||||||
This error isn't terribly different, but shows off how the format has changed. It shows
|
This error isn't terribly different, but shows off how the format has changed. It shows
|
||||||
off your code in context, rather than just showing the text of the lines themselves.
|
off your code in context, rather than just showing the text of the lines themselves.
|
||||||
|
@ -512,6 +512,66 @@ Since we can't move the `GPIOA` out of the `&Option`, we need to convert it to
|
|||||||
an `&Option<&GPIOA>` with `as_ref()`, which we can finally `unwrap()` to obtain
|
an `&Option<&GPIOA>` with `as_ref()`, which we can finally `unwrap()` to obtain
|
||||||
the `&GPIOA` which lets us modify the peripheral.
|
the `&GPIOA` which lets us modify the peripheral.
|
||||||
|
|
||||||
|
If we need a mutable references to shared resources, then `borrow_mut` and `deref_mut`
|
||||||
|
should be used instead. The following code shows an example using the TIM2 timer.
|
||||||
|
|
||||||
|
```rust,ignore
|
||||||
|
use core::cell::RefCell;
|
||||||
|
use core::ops::DerefMut;
|
||||||
|
use cortex_m::interrupt::{self, Mutex};
|
||||||
|
use cortex_m::asm::wfi;
|
||||||
|
use stm32f4::stm32f405;
|
||||||
|
|
||||||
|
static G_TIM: Mutex<RefCell<Option<Timer<stm32::TIM2>>>> =
|
||||||
|
Mutex::new(RefCell::new(None));
|
||||||
|
|
||||||
|
#[entry]
|
||||||
|
fn main() -> ! {
|
||||||
|
let mut cp = cm::Peripherals::take().unwrap();
|
||||||
|
let dp = stm32f405::Peripherals::take().unwrap();
|
||||||
|
|
||||||
|
// Some sort of timer configuration function.
|
||||||
|
// Assume it configures the TIM2 timer, its NVIC interrupt,
|
||||||
|
// and finally starts the timer.
|
||||||
|
let tim = configure_timer_interrupt(&mut cp, dp);
|
||||||
|
|
||||||
|
interrupt::free(|cs| {
|
||||||
|
G_TIM.borrow(cs).replace(Some(tim));
|
||||||
|
});
|
||||||
|
|
||||||
|
loop {
|
||||||
|
wfi();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[interrupt]
|
||||||
|
fn timer() {
|
||||||
|
interrupt::free(|cs| {
|
||||||
|
if let Some(ref mut tim)) = G_TIM.borrow(cs).borrow_mut().deref_mut() {
|
||||||
|
tim.start(1.hz());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
> **NOTE**
|
||||||
|
>
|
||||||
|
> At the moment, the `cortex-m` crate hides const versions of some functions
|
||||||
|
> (including `Mutex::new()`) behind the `const-fn` feature. So you need to add
|
||||||
|
> the `const-fn` feature as a dependency for cortex-m in the Cargo.toml to make
|
||||||
|
> the above examples work:
|
||||||
|
>
|
||||||
|
> ``` toml
|
||||||
|
> [dependencies.cortex-m]
|
||||||
|
> version="0.6.0"
|
||||||
|
> features=["const-fn"]
|
||||||
|
> ```
|
||||||
|
> Meanwhile, `const-fn` has been working on stable Rust for some time now.
|
||||||
|
> So this additional switch in Cargo.toml will not be needed as soon as
|
||||||
|
> it is enabled in `cortex-m` by default.
|
||||||
|
>
|
||||||
|
|
||||||
Whew! This is safe, but it is also a little unwieldy. Is there anything else
|
Whew! This is safe, but it is also a little unwieldy. Is there anything else
|
||||||
we can do?
|
we can do?
|
||||||
|
|
||||||
|
@ -84,8 +84,8 @@ Rather than manually generating these interfaces, which may be tedious and error
|
|||||||
2. Write a `bindings.h` file, which `#include "..."`'s each of the files you gathered in step one
|
2. Write a `bindings.h` file, which `#include "..."`'s each of the files you gathered in step one
|
||||||
3. Feed this `bindings.h` file, along with any compilation flags used to compile
|
3. Feed this `bindings.h` file, along with any compilation flags used to compile
|
||||||
your code into `bindgen`. Tip: use `Builder.ctypes_prefix("cty")` /
|
your code into `bindgen`. Tip: use `Builder.ctypes_prefix("cty")` /
|
||||||
`--ctypes-prefix=cty` to make the generated code `#![no_std]` compatible.
|
`--ctypes-prefix=cty` and `Builder.use_core()` to make the generated code `#![no_std]` compatible.
|
||||||
4. `bindgen` will produce the generated Rust code to the output of the terminal window. This file may be piped to a file in your project, such as `bindings.rs`. You may use this file in your Rust project to interact with C/C++ code compiled and linked as an external library
|
4. `bindgen` will produce the generated Rust code to the output of the terminal window. This file may be piped to a file in your project, such as `bindings.rs`. You may use this file in your Rust project to interact with C/C++ code compiled and linked as an external library. Tip: don't forget to use the [`cty`](https://crates.io/crates/cty) crate if your types in the generated bindings are prefixed with `cty`.
|
||||||
|
|
||||||
[bindgen]: https://github.com/rust-lang-nursery/rust-bindgen
|
[bindgen]: https://github.com/rust-lang-nursery/rust-bindgen
|
||||||
[bindgen user's manual]: https://rust-lang.github.io/rust-bindgen/
|
[bindgen user's manual]: https://rust-lang.github.io/rust-bindgen/
|
||||||
|
@ -45,7 +45,7 @@ The contents may not match exactly but you should get the last line about
|
|||||||
breakpoints and watchpoints. If you got it then terminate the OpenOCD process
|
breakpoints and watchpoints. If you got it then terminate the OpenOCD process
|
||||||
and move to the [next section].
|
and move to the [next section].
|
||||||
|
|
||||||
[next section]: ../hardware.md
|
[next section]: ../../start/index.md
|
||||||
|
|
||||||
If you didn't get the "breakpoints" line then try the following command.
|
If you didn't get the "breakpoints" line then try the following command.
|
||||||
|
|
||||||
|
@ -82,6 +82,7 @@ fn main() -> ! {
|
|||||||
syst.set_clock_source(SystClkSource::Core);
|
syst.set_clock_source(SystClkSource::Core);
|
||||||
// this is configured for the LM3S6965 which has a default CPU clock of 12 MHz
|
// this is configured for the LM3S6965 which has a default CPU clock of 12 MHz
|
||||||
syst.set_reload(12_000_000);
|
syst.set_reload(12_000_000);
|
||||||
|
syst.clear_current();
|
||||||
syst.enable_counter();
|
syst.enable_counter();
|
||||||
syst.enable_interrupt();
|
syst.enable_interrupt();
|
||||||
|
|
||||||
|
@ -6,11 +6,11 @@ Nicknamed "the Nomicon."
|
|||||||
|
|
||||||
## NOTE: This is a draft document, and may contain serious errors
|
## NOTE: This is a draft document, and may contain serious errors
|
||||||
|
|
||||||
> Instead of the programs I had hoped for, there came only a shuddering blackness
|
> Instead of the programs I had hoped for, there came only a shuddering
|
||||||
and ineffable loneliness; and I saw at last a fearful truth which no one had
|
blackness and ineffable loneliness; and I saw at last a fearful truth which no
|
||||||
ever dared to breathe before — the unwhisperable secret of secrets — The fact
|
one had ever dared to breathe before — the unwhisperable secret of secrets — The
|
||||||
that this language of stone and stridor is not a sentient perpetuation of Rust
|
fact that this language of stone and stridor is not a sentient perpetuation of
|
||||||
as London is of Old London and Paris of Old Paris, but that it is in fact
|
Rust as London is of Old London and Paris of Old Paris, but that it is in fact
|
||||||
quite unsafe, its sprawling body imperfectly embalmed and infested with queer
|
quite unsafe, its sprawling body imperfectly embalmed and infested with queer
|
||||||
animate things which have nothing to do with it as it was in compilation.
|
animate things which have nothing to do with it as it was in compilation.
|
||||||
|
|
||||||
@ -23,40 +23,30 @@ infinitesimal fragments of despair.
|
|||||||
|
|
||||||
Building the Nomicon requires [mdBook]. To get it:
|
Building the Nomicon requires [mdBook]. To get it:
|
||||||
|
|
||||||
[mdBook]: https://github.com/azerupi/mdBook
|
[mdBook]: https://github.com/rust-lang-nursery/mdBook
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ cargo install mdbook
|
$ cargo install mdbook
|
||||||
```
|
```
|
||||||
|
|
||||||
### Building
|
### `mdbook` usage
|
||||||
|
|
||||||
To build the Nomicon:
|
To build the Nomicon use the `build` sub-command:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ mdbook build
|
$ mdbook build
|
||||||
```
|
```
|
||||||
|
|
||||||
The output will be in the `book` subdirectory. To check it out, open it in
|
The output will be placed in the `book` subdirectory. To check it out, open the
|
||||||
your web browser.
|
`index.html` file in your web browser. You can pass the `--open` flag to `mdbook
|
||||||
|
build` and it'll open the index page in your default browser (if the process is
|
||||||
|
successful) just like with `cargo doc --open`:
|
||||||
|
|
||||||
_Firefox:_
|
|
||||||
```bash
|
```bash
|
||||||
$ firefox book/index.html # Linux
|
$ mdbook build --open
|
||||||
$ open -a "Firefox" book/index.html # OS X
|
|
||||||
$ Start-Process "firefox.exe" .\book\index.html # Windows (PowerShell)
|
|
||||||
$ start firefox.exe .\book\index.html # Windows (Cmd)
|
|
||||||
```
|
```
|
||||||
|
|
||||||
_Chrome:_
|
There is also a `test` sub-command to test all code samples contained in the book:
|
||||||
```bash
|
|
||||||
$ google-chrome book/index.html # Linux
|
|
||||||
$ open -a "Google Chrome" book/index.html # OS X
|
|
||||||
$ Start-Process "chrome.exe" .\book\index.html # Windows (PowerShell)
|
|
||||||
$ start chrome.exe .\book\index.html # Windows (Cmd)
|
|
||||||
```
|
|
||||||
|
|
||||||
To run the tests:
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ mdbook test
|
$ mdbook test
|
||||||
@ -64,7 +54,8 @@ $ mdbook test
|
|||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
Given that the Nomicon is still in a draft state, we'd love your help! Please feel free to open
|
Given that the Nomicon is still in a draft state, we'd love your help! Please
|
||||||
issues about anything, and send in PRs for things you'd like to fix or change. If your change is
|
feel free to open issues about anything, and send in PRs for things you'd like
|
||||||
large, please open an issue first, so we can make sure that it's something we'd accept before you
|
to fix or change. If your change is large, please open an issue first, so we can
|
||||||
go through the work of getting a PR together.
|
make sure that it's something we'd accept before you go through the work of
|
||||||
|
getting a PR together.
|
||||||
|
@ -17,7 +17,7 @@ language — this book contains lots of useful information.
|
|||||||
Unlike *[The Rust Programming Language][trpl]*, we will be assuming considerable
|
Unlike *[The Rust Programming Language][trpl]*, we will be assuming considerable
|
||||||
prior knowledge. In particular, you should be comfortable with basic systems
|
prior knowledge. In particular, you should be comfortable with basic systems
|
||||||
programming and Rust. If you don't feel comfortable with these topics, you
|
programming and Rust. If you don't feel comfortable with these topics, you
|
||||||
should consider [reading The Book][trpl] first. That said, we won't assume you
|
should consider reading [The Book][trpl] first. That said, we won't assume you
|
||||||
have read it, and we will take care to occasionally give a refresher on the
|
have read it, and we will take care to occasionally give a refresher on the
|
||||||
basics where appropriate. You can skip straight to this book if you want;
|
basics where appropriate. You can skip straight to this book if you want;
|
||||||
just know that we won't be explaining everything from the ground up.
|
just know that we won't be explaining everything from the ground up.
|
||||||
|
@ -25,7 +25,7 @@ let y;
|
|||||||
There are some more complex situations which are not possible to desugar using
|
There are some more complex situations which are not possible to desugar using
|
||||||
scopes, but the order is still defined ‒ variables are dropped in the reverse
|
scopes, but the order is still defined ‒ variables are dropped in the reverse
|
||||||
order of their definition, fields of structs and tuples in order of their
|
order of their definition, fields of structs and tuples in order of their
|
||||||
definition. There are some more details about order of drop in [rfc1875].
|
definition. There are some more details about order of drop in [RFC 1857][rfc1857].
|
||||||
|
|
||||||
Let's do this:
|
Let's do this:
|
||||||
|
|
||||||
|
@ -80,7 +80,6 @@ This will eventually get fixed.
|
|||||||
|
|
||||||
```rust,edition2018,compile_fail
|
```rust,edition2018,compile_fail
|
||||||
# use std::collections::HashMap;
|
# use std::collections::HashMap;
|
||||||
# use std::cmp::Eq;
|
|
||||||
# use std::hash::Hash;
|
# use std::hash::Hash;
|
||||||
fn get_default<'m, K, V>(map: &'m mut HashMap<K, V>, key: K) -> &'m mut V
|
fn get_default<'m, K, V>(map: &'m mut HashMap<K, V>, key: K) -> &'m mut V
|
||||||
where
|
where
|
||||||
|
@ -4,7 +4,7 @@ Get out of our way type system! We're going to reinterpret these bits or die
|
|||||||
trying! Even though this book is all about doing things that are unsafe, I
|
trying! Even though this book is all about doing things that are unsafe, I
|
||||||
really can't emphasize that you should deeply think about finding Another Way
|
really can't emphasize that you should deeply think about finding Another Way
|
||||||
than the operations covered in this section. This is really, truly, the most
|
than the operations covered in this section. This is really, truly, the most
|
||||||
horribly unsafe thing you can do in Rust. The railguards here are dental floss.
|
horribly unsafe thing you can do in Rust. The guardrails here are dental floss.
|
||||||
|
|
||||||
[`mem::transmute<T, U>`][transmute] takes a value of type `T` and reinterprets
|
[`mem::transmute<T, U>`][transmute] takes a value of type `T` and reinterprets
|
||||||
it to have type `U`. The only restriction is that the `T` and `U` are verified
|
it to have type `U`. The only restriction is that the `T` and `U` are verified
|
||||||
|
@ -4,7 +4,7 @@ rust:
|
|||||||
- nightly
|
- nightly
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- travis_retry curl -Lf https://github.com/rust-lang-nursery/mdBook/releases/download/v0.1.7/mdbook-v0.1.7-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=$HOME/.cargo/bin
|
- travis_retry curl -Lf https://github.com/rust-lang-nursery/mdBook/releases/download/v0.3.1/mdbook-v0.3.1-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=$HOME/.cargo/bin
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- export PATH=$PATH:/home/travis/.cargo/bin && mdbook test
|
- export PATH=$PATH:/home/travis/.cargo/bin && mdbook test
|
||||||
|
@ -4,5 +4,5 @@ title = "The Rust Reference"
|
|||||||
author = "The Rust Project Developers"
|
author = "The Rust Project Developers"
|
||||||
|
|
||||||
[output.html]
|
[output.html]
|
||||||
|
additional-css = ["theme/reference.css"]
|
||||||
additional-css = ["src/theme/reference.css"]
|
git-repository-url = "https://github.com/rust-lang-nursery/reference/"
|
||||||
|
@ -85,11 +85,11 @@ to specify the symbol name.
|
|||||||
pub fn name_in_rust() { }
|
pub fn name_in_rust() { }
|
||||||
```
|
```
|
||||||
|
|
||||||
[_MetaNameValueStr_]: attributes.html#meta-item-attribute-syntax
|
[_MetaNameValueStr_]: attributes.md#meta-item-attribute-syntax
|
||||||
[`static` items]: items/static-items.html
|
[`static` items]: items/static-items.md
|
||||||
[attribute]: attributes.html
|
[attribute]: attributes.md
|
||||||
[extern functions]: items/functions.html#extern-functions
|
[extern functions]: items/functions.md#extern-functions
|
||||||
[external blocks]: items/external-blocks.html
|
[external blocks]: items/external-blocks.md
|
||||||
[function]: items/functions.html
|
[function]: items/functions.md
|
||||||
[item]: items.html
|
[item]: items.md
|
||||||
[static]: items/static-items.html
|
[static]: items/static-items.md
|
||||||
|
@ -237,72 +237,72 @@ The following is an index of all built-in attributes.
|
|||||||
- `feature` — Used to enable unstable or experimental compiler features. See
|
- `feature` — Used to enable unstable or experimental compiler features. See
|
||||||
[The Unstable Book] for features implemented in `rustc`.
|
[The Unstable Book] for features implemented in `rustc`.
|
||||||
|
|
||||||
[Doc comments]: comments.html#doc-comments
|
[Doc comments]: comments.md#doc-comments
|
||||||
[ECMA-334]: https://www.ecma-international.org/publications/standards/Ecma-334.htm
|
[ECMA-334]: https://www.ecma-international.org/publications/standards/Ecma-334.htm
|
||||||
[ECMA-335]: https://www.ecma-international.org/publications/standards/Ecma-335.htm
|
[ECMA-335]: https://www.ecma-international.org/publications/standards/Ecma-335.htm
|
||||||
[Expression Attributes]: expressions.html#expression-attributes
|
[Expression Attributes]: expressions.md#expression-attributes
|
||||||
[IDENTIFIER]: identifiers.html
|
[IDENTIFIER]: identifiers.md
|
||||||
[RAW_STRING_LITERAL]: tokens.html#raw-string-literals
|
[RAW_STRING_LITERAL]: tokens.md#raw-string-literals
|
||||||
[STRING_LITERAL]: tokens.html#string-literals
|
[STRING_LITERAL]: tokens.md#string-literals
|
||||||
[The Rustdoc Book]: ../rustdoc/the-doc-attribute.html
|
[The Rustdoc Book]: ../rustdoc/the-doc-attribute.html
|
||||||
[The Unstable Book]: ../unstable-book/index.html
|
[The Unstable Book]: ../unstable-book/index.html
|
||||||
[_DelimTokenTree_]: macros.html
|
[_DelimTokenTree_]: macros.md
|
||||||
[_LiteralExpression_]: expressions/literal-expr.html
|
[_LiteralExpression_]: expressions/literal-expr.md
|
||||||
[_SimplePath_]: paths.html#simple-paths
|
[_SimplePath_]: paths.md#simple-paths
|
||||||
[`allow`]: attributes/diagnostics.html#lint-check-attributes
|
[`allow`]: attributes/diagnostics.md#lint-check-attributes
|
||||||
[`cfg_attr`]: conditional-compilation.html#the-cfg_attr-attribute
|
[`cfg_attr`]: conditional-compilation.md#the-cfg_attr-attribute
|
||||||
[`cfg`]: conditional-compilation.html#the-cfg-attribute
|
[`cfg`]: conditional-compilation.md#the-cfg-attribute
|
||||||
[`cold`]: attributes/codegen.html#the-cold-attribute
|
[`cold`]: attributes/codegen.md#the-cold-attribute
|
||||||
[`crate_name`]: crates-and-source-files.html#the-crate_name-attribute
|
[`crate_name`]: crates-and-source-files.md#the-crate_name-attribute
|
||||||
[`crate_type`]: linkage.html
|
[`crate_type`]: linkage.md
|
||||||
[`deny`]: attributes/diagnostics.html#lint-check-attributes
|
[`deny`]: attributes/diagnostics.md#lint-check-attributes
|
||||||
[`deprecated`]: attributes/diagnostics.html#the-deprecated-attribute
|
[`deprecated`]: attributes/diagnostics.md#the-deprecated-attribute
|
||||||
[`derive`]: attributes/derive.html
|
[`derive`]: attributes/derive.md
|
||||||
[`export_name`]: abi.html#the-export_name-attribute
|
[`export_name`]: abi.md#the-export_name-attribute
|
||||||
[`forbid`]: attributes/diagnostics.html#lint-check-attributes
|
[`forbid`]: attributes/diagnostics.md#lint-check-attributes
|
||||||
[`global_allocator`]: runtime.html#the-global_allocator-attribute
|
[`global_allocator`]: runtime.md#the-global_allocator-attribute
|
||||||
[`ignore`]: attributes/testing.html#the-ignore-attribute
|
[`ignore`]: attributes/testing.md#the-ignore-attribute
|
||||||
[`inline`]: attributes/codegen.html#the-inline-attribute
|
[`inline`]: attributes/codegen.md#the-inline-attribute
|
||||||
[`link_name`]: items/external-blocks.html#the-link_name-attribute
|
[`link_name`]: items/external-blocks.md#the-link_name-attribute
|
||||||
[`link_section`]: abi.html#the-link_section-attribute
|
[`link_section`]: abi.md#the-link_section-attribute
|
||||||
[`link`]: items/external-blocks.html#the-link-attribute
|
[`link`]: items/external-blocks.md#the-link-attribute
|
||||||
[`macro_export`]: macros-by-example.html#path-based-scope
|
[`macro_export`]: macros-by-example.md#path-based-scope
|
||||||
[`macro_use`]: macros-by-example.html#the-macro_use-attribute
|
[`macro_use`]: macros-by-example.md#the-macro_use-attribute
|
||||||
[`meta` macro fragment specifier]: macros-by-example.html
|
[`meta` macro fragment specifier]: macros-by-example.md
|
||||||
[`must_use`]: attributes/diagnostics.html#the-must_use-attribute
|
[`must_use`]: attributes/diagnostics.md#the-must_use-attribute
|
||||||
[`no_builtins`]: attributes/codegen.html#the-no_builtins-attribute
|
[`no_builtins`]: attributes/codegen.md#the-no_builtins-attribute
|
||||||
[`no_implicit_prelude`]: items/modules.html#prelude-items
|
[`no_implicit_prelude`]: items/modules.md#prelude-items
|
||||||
[`no_link`]: items/extern-crates.html#the-no_link-attribute
|
[`no_link`]: items/extern-crates.md#the-no_link-attribute
|
||||||
[`no_main`]: crates-and-source-files.html#the-no_main-attribute
|
[`no_main`]: crates-and-source-files.md#the-no_main-attribute
|
||||||
[`no_mangle`]: abi.html#the-no_mangle-attribute
|
[`no_mangle`]: abi.md#the-no_mangle-attribute
|
||||||
[`no_std`]: crates-and-source-files.html#preludes-and-no_std
|
[`no_std`]: crates-and-source-files.md#preludes-and-no_std
|
||||||
[`panic_handler`]: runtime.html#the-panic_handler-attribute
|
[`panic_handler`]: runtime.md#the-panic_handler-attribute
|
||||||
[`path`]: items/modules.html#the-path-attribute
|
[`path`]: items/modules.md#the-path-attribute
|
||||||
[`proc_macro_attribute`]: procedural-macros.html#attribute-macros
|
[`proc_macro_attribute`]: procedural-macros.md#attribute-macros
|
||||||
[`proc_macro_derive`]: procedural-macros.html#derive-macros
|
[`proc_macro_derive`]: procedural-macros.md#derive-macros
|
||||||
[`proc_macro`]: procedural-macros.html#function-like-procedural-macros
|
[`proc_macro`]: procedural-macros.md#function-like-procedural-macros
|
||||||
[`recursion_limit`]: attributes/limits.html#the-recursion_limit-attribute
|
[`recursion_limit`]: attributes/limits.md#the-recursion_limit-attribute
|
||||||
[`repr`]: type-layout.html#representations
|
[`repr`]: type-layout.md#representations
|
||||||
[`should_panic`]: attributes/testing.html#the-should_panic-attribute
|
[`should_panic`]: attributes/testing.md#the-should_panic-attribute
|
||||||
[`target_feature`]: attributes/codegen.html#the-target_feature-attribute
|
[`target_feature`]: attributes/codegen.md#the-target_feature-attribute
|
||||||
[`test`]: attributes/testing.html#the-test-attribute
|
[`test`]: attributes/testing.md#the-test-attribute
|
||||||
[`type_length_limit`]: attributes/limits.html#the-type_length_limit-attribute
|
[`type_length_limit`]: attributes/limits.md#the-type_length_limit-attribute
|
||||||
[`used`]: abi.html#the-used-attribute
|
[`used`]: abi.md#the-used-attribute
|
||||||
[`warn`]: attributes/diagnostics.html#lint-check-attributes
|
[`warn`]: attributes/diagnostics.md#lint-check-attributes
|
||||||
[`windows_subsystem`]: runtime.html#the-windows_subsystem-attribute
|
[`windows_subsystem`]: runtime.md#the-windows_subsystem-attribute
|
||||||
[attribute macros]: procedural-macros.html#attribute-macros
|
[attribute macros]: procedural-macros.md#attribute-macros
|
||||||
[block expressions]: expressions/block-expr.html
|
[block expressions]: expressions/block-expr.md
|
||||||
[built-in attributes]: #built-in-attributes-index
|
[built-in attributes]: #built-in-attributes-index
|
||||||
[derive macro helper attributes]: procedural-macros.html#derive-macro-helper-attributes
|
[derive macro helper attributes]: procedural-macros.md#derive-macro-helper-attributes
|
||||||
[enum]: items/enumerations.html
|
[enum]: items/enumerations.md
|
||||||
[expression statement]: statements.html#expression-statements
|
[expression statement]: statements.md#expression-statements
|
||||||
[external blocks]: items/external-blocks.html
|
[external blocks]: items/external-blocks.md
|
||||||
[functions]: items/functions.html
|
[functions]: items/functions.md
|
||||||
[generics]: items/generics.html
|
[generics]: items/generics.md
|
||||||
[implementations]: items/implementations.html
|
[implementations]: items/implementations.md
|
||||||
[item declarations]: items.html
|
[item declarations]: items.md
|
||||||
[match expressions]: expressions/match-expr.html
|
[match expressions]: expressions/match-expr.md
|
||||||
[modules]: items/modules.html
|
[modules]: items/modules.md
|
||||||
[statements]: statements.html
|
[statements]: statements.md
|
||||||
[struct]: items/structs.html
|
[struct]: items/structs.md
|
||||||
[union]: items/unions.html
|
[union]: items/unions.md
|
||||||
|
@ -139,15 +139,15 @@ feature detection on the x86 platforms.
|
|||||||
> may be enabled or disabled for an entire crate with the
|
> may be enabled or disabled for an entire crate with the
|
||||||
> [`-C target-feature`] flag.
|
> [`-C target-feature`] flag.
|
||||||
|
|
||||||
[_MetaListNameValueStr_]: attributes.html#meta-item-attribute-syntax
|
[_MetaListNameValueStr_]: ../attributes.md#meta-item-attribute-syntax
|
||||||
[`-C target-cpu`]: ../rustc/codegen-options/index.html#target-cpu
|
[`-C target-cpu`]: ../../rustc/codegen-options/index.html#target-cpu
|
||||||
[`-C target-feature`]: ../rustc/codegen-options/index.html#target-feature
|
[`-C target-feature`]: ../../rustc/codegen-options/index.html#target-feature
|
||||||
[`is_x86_feature_detected`]: ../std/macro.is_x86_feature_detected.html
|
[`is_x86_feature_detected`]: ../../std/macro.is_x86_feature_detected.html
|
||||||
[`target_feature` conditional compilation option]: conditional-compilation.html#target_feature
|
[`target_feature` conditional compilation option]: ../conditional-compilation.md#target_feature
|
||||||
[attribute]: attributes.html
|
[attribute]: ../attributes.md
|
||||||
[attributes]: attributes.html
|
[attributes]: ../attributes.md
|
||||||
[functions]: items/functions.html
|
[functions]: ../items/functions.md
|
||||||
[target architecture]: conditional-compilation.html#target_arch
|
[target architecture]: ../conditional-compilation.md#target_arch
|
||||||
[trait]: items/traits.html
|
[trait]: ../items/traits.md
|
||||||
[undefined behavior]: behavior-considered-undefined.html
|
[undefined behavior]: ../behavior-considered-undefined.md
|
||||||
[unsafe function]: unsafe-functions.html
|
[unsafe function]: ../unsafe-functions.md
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user