Merge branch 'master' into update-rls-data-for-save-analysis
This commit is contained in:
commit
bca47e42b2
16
.travis.yml
16
.travis.yml
|
@ -12,7 +12,7 @@ matrix:
|
|||
fast_finish: true
|
||||
include:
|
||||
# Images used in testing PR and try-build should be run first.
|
||||
- env: IMAGE=x86_64-gnu-llvm-3.7 RUST_BACKTRACE=1
|
||||
- env: IMAGE=x86_64-gnu-llvm-3.9 RUST_BACKTRACE=1
|
||||
if: type = pull_request OR branch = auto
|
||||
|
||||
- env: IMAGE=dist-x86_64-linux DEPLOY=1
|
||||
|
@ -36,7 +36,7 @@ matrix:
|
|||
NO_LLVM_ASSERTIONS=1
|
||||
NO_DEBUG_ASSERTIONS=1
|
||||
os: osx
|
||||
osx_image: xcode7
|
||||
osx_image: xcode7.3
|
||||
if: branch = auto
|
||||
|
||||
# macOS builders. These are placed near the beginning because they are very
|
||||
|
@ -57,7 +57,7 @@ matrix:
|
|||
NO_LLVM_ASSERTIONS=1
|
||||
NO_DEBUG_ASSERTIONS=1
|
||||
os: osx
|
||||
osx_image: xcode8.2
|
||||
osx_image: xcode8.3
|
||||
if: branch = auto
|
||||
|
||||
- env: >
|
||||
|
@ -71,7 +71,7 @@ matrix:
|
|||
NO_LLVM_ASSERTIONS=1
|
||||
NO_DEBUG_ASSERTIONS=1
|
||||
os: osx
|
||||
osx_image: xcode8.2
|
||||
osx_image: xcode8.3
|
||||
if: branch = auto
|
||||
|
||||
# OSX builders producing releases. These do not run the full test suite and
|
||||
|
@ -91,7 +91,7 @@ matrix:
|
|||
NO_LLVM_ASSERTIONS=1
|
||||
NO_DEBUG_ASSERTIONS=1
|
||||
os: osx
|
||||
osx_image: xcode7
|
||||
osx_image: xcode7.3
|
||||
if: branch = auto
|
||||
|
||||
- env: >
|
||||
|
@ -105,7 +105,7 @@ matrix:
|
|||
NO_LLVM_ASSERTIONS=1
|
||||
NO_DEBUG_ASSERTIONS=1
|
||||
os: osx
|
||||
osx_image: xcode7
|
||||
osx_image: xcode7.3
|
||||
if: branch = auto
|
||||
|
||||
# Linux builders, remaining docker images
|
||||
|
@ -115,6 +115,8 @@ matrix:
|
|||
if: branch = auto
|
||||
- env: IMAGE=cross DEPLOY=1
|
||||
if: branch = auto
|
||||
- env: IMAGE=cross2 DEPLOY=1
|
||||
if: branch = auto
|
||||
- env: IMAGE=dist-aarch64-linux DEPLOY=1
|
||||
if: branch = auto
|
||||
- env: IMAGE=dist-android DEPLOY=1
|
||||
|
@ -125,8 +127,6 @@ matrix:
|
|||
if: branch = auto
|
||||
- env: IMAGE=dist-armv7-linux DEPLOY=1
|
||||
if: branch = auto
|
||||
- env: IMAGE=dist-fuchsia DEPLOY=1
|
||||
if: branch = auto
|
||||
- env: IMAGE=dist-i586-gnu-i686-musl DEPLOY=1
|
||||
if: branch = auto
|
||||
- env: IMAGE=dist-i686-freebsd DEPLOY=1
|
||||
|
|
|
@ -6,7 +6,7 @@ A version of this document [can be found online](https://www.rust-lang.org/condu
|
|||
|
||||
**Contact**: [rust-mods@rust-lang.org](mailto:rust-mods@rust-lang.org)
|
||||
|
||||
* We are committed to providing a friendly, safe and welcoming environment for all, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, nationality, or other similar characteristic.
|
||||
* We are committed to providing a friendly, safe and welcoming environment for all, regardless of level of experience, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, nationality, or other similar characteristic.
|
||||
* On IRC, please avoid using overtly sexual nicknames or other nicknames that might detract from a friendly, safe and welcoming environment for all.
|
||||
* Please be kind and courteous. There's no need to be mean or rude.
|
||||
* Respect that people have differences of opinion and that every design or implementation choice carries a trade-off and numerous costs. There is seldom a right answer.
|
||||
|
|
116
CONTRIBUTING.md
116
CONTRIBUTING.md
|
@ -360,8 +360,120 @@ git add path/to/submodule
|
|||
|
||||
outside the submodule.
|
||||
|
||||
It can also be more convenient during development to set `submodules = false`
|
||||
in the `config.toml` to prevent `x.py` from resetting to the original branch.
|
||||
In order to prepare your PR, you can run the build locally by doing
|
||||
`./x.py build src/tools/TOOL`. If you will be editing the sources
|
||||
there, you may wish to set `submodules = false` in the `config.toml`
|
||||
to prevent `x.py` from resetting to the original branch.
|
||||
|
||||
#### 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
|
||||
internals of the compiler. This includes clippy,
|
||||
[RLS](https://github.com/rust-lang-nursery/rls) and
|
||||
[rustfmt](https://github.com/rust-lang-nursery/rustfmt). If these tools
|
||||
break because of your changes, you may run into a sort of "chicken and egg"
|
||||
problem. These tools rely on the latest compiler to be built so you can't update
|
||||
them to reflect your changes to the compiler until those changes are merged into
|
||||
the compiler. At the same time, you can't get your changes merged into the compiler
|
||||
because the rust-lang/rust build won't pass until those tools build and pass their
|
||||
tests.
|
||||
|
||||
That means that, in the default state, you can't update the compiler without first
|
||||
fixing rustfmt, rls and the other tools that the compiler builds.
|
||||
|
||||
Luckily, a feature was [added to Rust's build](https://github.com/rust-lang/rust/pull/45243)
|
||||
to make all of this easy to handle. The idea is that you mark the tools as "broken",
|
||||
so that the rust-lang/rust build passes without trying to build them, then land the change
|
||||
in the compiler, wait for a nightly, and go update the tools that you broke. Once you're done
|
||||
and the tools are working again, you go back in the compiler and change the tools back
|
||||
from "broken".
|
||||
|
||||
This should avoid a bunch of synchronization dances and is also much easier on contributors as
|
||||
there's no need to block on rls/rustfmt/other tools changes going upstream.
|
||||
|
||||
Here are those same steps in detail:
|
||||
|
||||
1. (optional) First, if it doesn't exist already, create a `config.toml` by copying
|
||||
`config.toml.example` in the root directory of the Rust repository.
|
||||
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
|
||||
need to [update any submodules to their latest versions][updating-submodules],
|
||||
see the section of this file about that for more information.
|
||||
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).
|
||||
3. (optional) Make commits for your changes and send them to upstream repositories as a PR.
|
||||
4. (optional) Maintainers of these submodules will **not** merge the PR. The PR can't be
|
||||
merged because CI will be broken. You'll want to write a message on the PR referencing
|
||||
your change, and how the PR should be merged once your change makes it into a nightly.
|
||||
5. Update `src/tools/toolstate.toml` to indicate that the tool in question is "broken",
|
||||
that will disable building it on CI. See the documentation in that file for the exact
|
||||
configuration values you can use.
|
||||
6. Commit the changes to `src/tools/toolstate.toml`, **do not update submodules in your commit**,
|
||||
and then update the PR you have for rust-lang/rust.
|
||||
7. Wait for your PR to merge.
|
||||
8. Wait for a nightly
|
||||
9. (optional) Help land your PR on the upstream repository now that your changes are in nightly.
|
||||
10. (optional) Send a PR to rust-lang/rust updating the submodule, reverting `src/tools/toolstate.toml` back to a "building" or "testing" state.
|
||||
|
||||
#### Updating submodules
|
||||
[updating-submodules]: #updating-submodules
|
||||
|
||||
These instructions are specific to updating `rustfmt`, however they may apply
|
||||
to the other submodules as well. Please help by improving these instructions
|
||||
if you find any discrepencies or special cases that need to be addressed.
|
||||
|
||||
To update the `rustfmt` submodule, start by running the appropriate
|
||||
[`git submodule` command](https://git-scm.com/book/en/v2/Git-Tools-Submodules).
|
||||
For example, to update to the latest commit on the remote master branch,
|
||||
you may want to run:
|
||||
```
|
||||
git submodule update --remote src/tools/rustfmt
|
||||
```
|
||||
If you run `./x.py build` now, and you are lucky, it may just work. If you see
|
||||
an error message about patches that did not resolve to any crates, you will need
|
||||
to complete a few more steps which are outlined with their rationale below.
|
||||
|
||||
*(This error may change in the future to include more information.)*
|
||||
```
|
||||
error: failed to resolve patches for `https://github.com/rust-lang-nursery/rustfmt`
|
||||
|
||||
Caused by:
|
||||
patch for `rustfmt-nightly` in `https://github.com/rust-lang-nursery/rustfmt` did not resolve to any crates
|
||||
failed to run: ~/rust/build/x86_64-unknown-linux-gnu/stage0/bin/cargo build --manifest-path ~/rust/src/bootstrap/Cargo.toml
|
||||
```
|
||||
|
||||
If you haven't used the `[patch]`
|
||||
section of `Cargo.toml` before, there is [some relevant documentation about it
|
||||
in the cargo docs](http://doc.crates.io/manifest.html#the-patch-section). In
|
||||
addition to that, you should read the
|
||||
[Overriding dependencies](http://doc.crates.io/specifying-dependencies.html#overriding-dependencies)
|
||||
section of the documentation as well.
|
||||
|
||||
Specifically, the following [section in Overriding dependencies](http://doc.crates.io/specifying-dependencies.html#testing-a-bugfix) reveals what the problem is:
|
||||
|
||||
> Next up we need to ensure that our lock file is updated to use this new version of uuid so our project uses the locally checked out copy instead of one from crates.io. The way [patch] works is that it'll load the dependency at ../path/to/uuid and then whenever crates.io is queried for versions of uuid it'll also return the local version.
|
||||
>
|
||||
> This means that the version number of the local checkout is significant and will affect whether the patch is used. Our manifest declared uuid = "1.0" which means we'll only resolve to >= 1.0.0, < 2.0.0, and Cargo's greedy resolution algorithm also means that we'll resolve to the maximum version within that range. Typically this doesn't matter as the version of the git repository will already be greater or match the maximum version published on crates.io, but it's important to keep this in mind!
|
||||
|
||||
This says that when we updated the submodule, the version number in our
|
||||
`src/tools/rustfmt/Cargo.toml` changed. The new version is different from
|
||||
the version in `Cargo.lock`, so the build can no longer continue.
|
||||
|
||||
To resolve this, we need to update `Cargo.lock`. Luckily, cargo provides a
|
||||
command to do this easily.
|
||||
|
||||
First, go into the `src/` directory since that is where `Cargo.toml` is in
|
||||
the rust repository. Then run, `cargo update -p rustfmt-nightly` to solve
|
||||
the problem.
|
||||
|
||||
```
|
||||
$ cd src
|
||||
$ cargo update -p rustfmt-nightly
|
||||
```
|
||||
|
||||
This should change the version listed in `src/Cargo.lock` to the new version you updated
|
||||
the submodule to. Running `./x.py build` should work now.
|
||||
|
||||
## Writing Documentation
|
||||
[writing-documentation]: #writing-documentation
|
||||
|
|
|
@ -16,6 +16,7 @@ Read ["Installation"] from [The Book].
|
|||
## Building from Source
|
||||
[building-from-source]: #building-from-source
|
||||
|
||||
### Building on *nix
|
||||
1. Make sure you have installed the dependencies:
|
||||
|
||||
* `g++` 4.7 or later or `clang++` 3.x or later
|
||||
|
@ -193,7 +194,7 @@ Snapshot binaries are currently built and tested on several platforms:
|
|||
You may find that other platforms work, but these are our officially
|
||||
supported build environments that are most likely to work.
|
||||
|
||||
Rust currently needs between 600MiB and 1.5GiB to build, depending on platform.
|
||||
Rust currently needs between 600MiB and 1.5GiB of RAM to build, depending on platform.
|
||||
If it hits swap, it will take a very long time to build.
|
||||
|
||||
There is more advice about hacking on Rust in [CONTRIBUTING.md].
|
||||
|
|
12
RELEASES.md
12
RELEASES.md
|
@ -3,12 +3,6 @@ Version 1.21.0 (2017-10-12)
|
|||
|
||||
Language
|
||||
--------
|
||||
- [Relaxed path syntax. You can now add type parameters to values][43540]
|
||||
Example:
|
||||
```rust
|
||||
my_macro!(Vec<i32>::new); // Always worked
|
||||
my_macro!(Vec::<i32>::new); // Now works
|
||||
```
|
||||
- [You can now use static references for literals.][43838]
|
||||
Example:
|
||||
```rust
|
||||
|
@ -16,6 +10,12 @@ Language
|
|||
let x: &'static u32 = &0;
|
||||
}
|
||||
```
|
||||
- [Relaxed path syntax. Optional `::` before `<` is now allowed in all contexts.][43540]
|
||||
Example:
|
||||
```rust
|
||||
my_macro!(Vec<i32>::new); // Always worked
|
||||
my_macro!(Vec::<i32>::new); // Now works
|
||||
```
|
||||
|
||||
Compiler
|
||||
--------
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
# If an external LLVM root is specified, we automatically check the version by
|
||||
# default to make sure it's within the range that we're expecting, but setting
|
||||
# this flag will indicate that this version check should not be done.
|
||||
#version-check = false
|
||||
#version-check = true
|
||||
|
||||
# Link libstdc++ statically into the librustc_llvm instead of relying on a
|
||||
# dynamic version to be available.
|
||||
|
@ -250,14 +250,11 @@
|
|||
# Whether or not `panic!`s generate backtraces (RUST_BACKTRACE)
|
||||
#backtrace = true
|
||||
|
||||
# The default linker that will be used by the generated compiler. Note that this
|
||||
# is not the linker used to link said compiler.
|
||||
# The default linker that will be hard-coded into the generated compiler for
|
||||
# targets that don't specify linker explicitly in their target specifications.
|
||||
# Note that this is not the linker used to link said compiler.
|
||||
#default-linker = "cc"
|
||||
|
||||
# The default ar utility that will be used by the generated compiler if LLVM
|
||||
# cannot be used. Note that this is not used to assemble said compiler.
|
||||
#default-ar = "ar"
|
||||
|
||||
# The "channel" for the Rust build to produce. The stable/beta channels only
|
||||
# allow using stable features, whereas the nightly and dev channels allow using
|
||||
# nightly features
|
||||
|
@ -303,7 +300,7 @@
|
|||
# =============================================================================
|
||||
[target.x86_64-unknown-linux-gnu]
|
||||
|
||||
# C compiler to be used to compiler C code and link Rust code. Note that the
|
||||
# C compiler to be used to compiler C code. Note that the
|
||||
# default value is platform specific, and if not specified it may also depend on
|
||||
# what platform is crossing to what platform.
|
||||
#cc = "cc"
|
||||
|
@ -312,6 +309,15 @@
|
|||
# This is only used for host targets.
|
||||
#cxx = "c++"
|
||||
|
||||
# Archiver to be used to assemble static libraries compiled from C/C++ code.
|
||||
# Note: an absolute path should be used, otherwise LLVM build will break.
|
||||
#ar = "ar"
|
||||
|
||||
# Linker to be used to link Rust code. Note that the
|
||||
# default value is platform specific, and if not specified it may also depend on
|
||||
# what platform is crossing to what platform.
|
||||
#linker = "cc"
|
||||
|
||||
# Path to the `llvm-config` binary of the installation of a custom LLVM to link
|
||||
# against. Note that if this is specifed we don't compile LLVM at all for this
|
||||
# target.
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
[root]
|
||||
name = "workspace_symbol"
|
||||
version = "0.1.0"
|
||||
|
||||
[[package]]
|
||||
name = "advapi32-sys"
|
||||
version = "0.2.0"
|
||||
|
@ -42,7 +38,7 @@ dependencies = [
|
|||
"alloc 0.0.0",
|
||||
"alloc_system 0.0.0",
|
||||
"build_helper 0.1.0",
|
||||
"cc 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cc 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"core 0.0.0",
|
||||
"libc 0.0.0",
|
||||
]
|
||||
|
@ -99,7 +95,7 @@ name = "backtrace-sys"
|
|||
version = "0.1.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"cc 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cc 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
|
@ -132,7 +128,7 @@ name = "bootstrap"
|
|||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"build_helper 0.1.0",
|
||||
"cc 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cc 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cmake 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"filetime 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"getopts 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -195,7 +191,7 @@ dependencies = [
|
|||
"hex 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"home 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ignore 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"jobserver 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"jobserver 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libgit2-sys 0.6.15 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -220,6 +216,16 @@ dependencies = [
|
|||
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cargo_metadata"
|
||||
version = "0.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"serde 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_derive 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_json 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cargotest"
|
||||
version = "0.1.0"
|
||||
|
@ -242,7 +248,7 @@ version = "0.1.0"
|
|||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.0.0"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
|
@ -266,27 +272,56 @@ dependencies = [
|
|||
"yaml-rust 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clippy"
|
||||
version = "0.0.166"
|
||||
dependencies = [
|
||||
"cargo_metadata 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"clippy-mini-macro-test 0.1.0",
|
||||
"clippy_lints 0.0.166",
|
||||
"compiletest_rs 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"duct 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_derive 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clippy-mini-macro-test"
|
||||
version = "0.1.0"
|
||||
|
||||
[[package]]
|
||||
name = "clippy_lints"
|
||||
version = "0.0.166"
|
||||
dependencies = [
|
||||
"itertools 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"pulldown-cmark 0.0.15 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quine-mc_cluskey 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"regex-syntax 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"semver 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_derive 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"toml 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-normalization 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cmake"
|
||||
version = "0.1.26"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"cc 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "collections"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"alloc 0.0.0",
|
||||
"core 0.0.0",
|
||||
"cc 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "compiler_builtins"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"cc 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cc 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"core 0.0.0",
|
||||
]
|
||||
|
||||
|
@ -303,6 +338,15 @@ dependencies = [
|
|||
"rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "compiletest_rs"
|
||||
version = "0.2.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "completion"
|
||||
version = "0.1.0"
|
||||
|
@ -403,7 +447,7 @@ name = "curl-sys"
|
|||
version = "0.3.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"cc 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cc 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libz-sys 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"openssl-sys 0.9.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -465,6 +509,22 @@ name = "dtoa"
|
|||
version = "0.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "duct"
|
||||
version = "0.8.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"error-chain 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazycell 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"os_pipe 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"shared_child 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "either"
|
||||
version = "1.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "enum_primitive"
|
||||
version = "0.1.1"
|
||||
|
@ -491,6 +551,14 @@ dependencies = [
|
|||
"regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "error-chain"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"backtrace 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "error-chain"
|
||||
version = "0.11.0"
|
||||
|
@ -736,6 +804,14 @@ dependencies = [
|
|||
"xz2 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "itertools"
|
||||
version = "0.6.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"either 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "itoa"
|
||||
version = "0.3.4"
|
||||
|
@ -743,7 +819,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
|
||||
[[package]]
|
||||
name = "jobserver"
|
||||
version = "0.1.6"
|
||||
version = "0.1.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"libc 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -800,6 +876,11 @@ name = "lazy_static"
|
|||
version = "0.2.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "lazycell"
|
||||
version = "0.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.0.0"
|
||||
|
@ -817,7 +898,7 @@ name = "libgit2-sys"
|
|||
version = "0.6.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"cc 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cc 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cmake 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"curl-sys 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -844,7 +925,7 @@ name = "libz-sys"
|
|||
version = "1.0.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"cc 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cc 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"vcpkg 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -864,7 +945,7 @@ name = "lzma-sys"
|
|||
version = "0.1.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"cc 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cc 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"filetime 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -952,7 +1033,7 @@ name = "miniz-sys"
|
|||
version = "0.1.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"cc 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cc 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
|
@ -983,6 +1064,17 @@ dependencies = [
|
|||
"ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nix"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num"
|
||||
version = "0.1.40"
|
||||
|
@ -1084,12 +1176,22 @@ name = "openssl-sys"
|
|||
version = "0.9.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"cc 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cc 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"vcpkg 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "os_pipe"
|
||||
version = "0.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"nix 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "owning_ref"
|
||||
version = "0.3.3"
|
||||
|
@ -1188,7 +1290,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
name = "profiler_builtins"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"cc 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cc 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"core 0.0.0",
|
||||
]
|
||||
|
||||
|
@ -1209,6 +1311,15 @@ dependencies = [
|
|||
"bitflags 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pulldown-cmark"
|
||||
version = "0.0.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"getopts 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pulldown-cmark"
|
||||
version = "0.1.0"
|
||||
|
@ -1223,6 +1334,11 @@ name = "quick-error"
|
|||
version = "1.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "quine-mc_cluskey"
|
||||
version = "0.2.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "0.2.3"
|
||||
|
@ -1405,7 +1521,7 @@ dependencies = [
|
|||
"flate2 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"fmt_macros 0.0.0",
|
||||
"graphviz 0.0.0",
|
||||
"jobserver 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"jobserver 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc_back 0.0.0",
|
||||
|
@ -1480,6 +1596,7 @@ dependencies = [
|
|||
"graphviz 0.0.0",
|
||||
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc 0.0.0",
|
||||
"rustc_back 0.0.0",
|
||||
"rustc_errors 0.0.0",
|
||||
"rustc_mir 0.0.0",
|
||||
"syntax 0.0.0",
|
||||
|
@ -1587,7 +1704,6 @@ version = "0.0.0"
|
|||
dependencies = [
|
||||
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc 0.0.0",
|
||||
"rustc_back 0.0.0",
|
||||
"rustc_const_eval 0.0.0",
|
||||
"syntax 0.0.0",
|
||||
"syntax_pos 0.0.0",
|
||||
|
@ -1599,7 +1715,7 @@ version = "0.0.0"
|
|||
dependencies = [
|
||||
"bitflags 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"build_helper 0.1.0",
|
||||
"cc 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cc 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc_cratesio_shim 0.0.0",
|
||||
]
|
||||
|
||||
|
@ -1731,9 +1847,9 @@ name = "rustc_trans"
|
|||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"bitflags 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cc 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cc 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"flate2 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"jobserver 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"jobserver 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num_cpus 1.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -1763,6 +1879,7 @@ dependencies = [
|
|||
"owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc 0.0.0",
|
||||
"rustc_back 0.0.0",
|
||||
"rustc_data_structures 0.0.0",
|
||||
"syntax 0.0.0",
|
||||
"syntax_pos 0.0.0",
|
||||
]
|
||||
|
@ -1800,7 +1917,7 @@ name = "rustdoc"
|
|||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"build_helper 0.1.0",
|
||||
"cc 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cc 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"html-diff 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -1869,6 +1986,14 @@ dependencies = [
|
|||
"smallvec 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "semver"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "semver"
|
||||
version = "0.8.0"
|
||||
|
@ -1930,6 +2055,16 @@ dependencies = [
|
|||
name = "serialize"
|
||||
version = "0.0.0"
|
||||
|
||||
[[package]]
|
||||
name = "shared_child"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "shell-escape"
|
||||
version = "0.1.3"
|
||||
|
@ -1970,8 +2105,6 @@ dependencies = [
|
|||
"alloc_jemalloc 0.0.0",
|
||||
"alloc_system 0.0.0",
|
||||
"build_helper 0.1.0",
|
||||
"cc 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"collections 0.0.0",
|
||||
"compiler_builtins 0.0.0",
|
||||
"core 0.0.0",
|
||||
"libc 0.0.0",
|
||||
|
@ -2413,6 +2546,10 @@ dependencies = [
|
|||
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "workspace_symbol"
|
||||
version = "0.1.0"
|
||||
|
||||
[[package]]
|
||||
name = "ws2_32-sys"
|
||||
version = "0.2.1"
|
||||
|
@ -2457,10 +2594,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
"checksum bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4efd02e230a02e18f92fc2735f44597385ed02ad8f831e7c1c1156ee5e1ab3a5"
|
||||
"checksum bitflags 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f5cde24d1b2e2216a726368b2363a273739c91f4e3eb4e0dd12d672d396ad989"
|
||||
"checksum bufstream 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "f2f382711e76b9de6c744cc00d0497baba02fb00a787f088c879f01d09468e32"
|
||||
"checksum cc 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7db2f146208d7e0fbee761b09cd65a7f51ccc38705d4e7262dad4d73b12a76b1"
|
||||
"checksum cargo_metadata 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "be1057b8462184f634c3a208ee35b0f935cfd94b694b26deadccd98732088d7b"
|
||||
"checksum cc 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2c674f0870e3dbd4105184ea035acb1c32c8ae69939c9e228d2b11bbfe29efad"
|
||||
"checksum cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d4c819a1287eb618df47cc647173c5c4c66ba19d888a6e50d605672aed3140de"
|
||||
"checksum clap 2.26.2 (registry+https://github.com/rust-lang/crates.io-index)" = "3451e409013178663435d6f15fdb212f14ee4424a3d74f979d081d0a66b6f1f2"
|
||||
"checksum cmake 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)" = "357c07e7a1fc95732793c1edb5901e1a1f305cfcf63a90eb12dbd22bdb6b789d"
|
||||
"checksum compiletest_rs 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "2741d378feb7a434dba54228c89a70b4e427fee521de67cdda3750b8a0265f5a"
|
||||
"checksum conv 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "78ff10625fd0ac447827aa30ea8b861fead473bb60aeb73af6c1c58caf0d1299"
|
||||
"checksum core-foundation 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "5909502e547762013619f4c4e01cc7393c20fe2d52d7fa471c1210adb2320dc7"
|
||||
"checksum core-foundation-sys 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "bc9fb3d6cb663e6fd7cf1c63f9b144ee2b1e4a78595a0451dd34bff85b9a3387"
|
||||
|
@ -2477,10 +2616,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
"checksum diff 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "0a515461b6c8c08419850ced27bc29e86166dcdcde8fbe76f8b1f0589bb49472"
|
||||
"checksum docopt 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3b5b93718f8b3e5544fcc914c43de828ca6c6ace23e0332c6080a2977b49787a"
|
||||
"checksum dtoa 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "09c3753c3db574d215cba4ea76018483895d7bff25a31b49ba45db21c48e50ab"
|
||||
"checksum duct 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e45aa15fe0a8a8f511e6d834626afd55e49b62e5c8802e18328a87e8a8f6065c"
|
||||
"checksum either 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e311a7479512fbdf858fb54d91ec59f3b9f85bc0113659f46bba12b199d273ce"
|
||||
"checksum enum_primitive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "be4551092f4d519593039259a9ed8daedf0da12e5109c5280338073eaeb81180"
|
||||
"checksum env_logger 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "15abd780e45b3ea4f76b4e9a26ff4843258dd8a3eed2775a0e7368c2e7936c2f"
|
||||
"checksum env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3ddf21e73e016298f5cb37d6ef8e8da8e39f91f9ec8b0df44b7deb16a9f8cd5b"
|
||||
"checksum error-chain 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ff511d5dc435d703f4971bc399647c9bc38e20cb41452e3b9feb4765419ed3f3"
|
||||
"checksum error-chain 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6930e04918388a9a2e41d518c25cf679ccafe26733fb4127dbf21993f2575d46"
|
||||
"checksum filetime 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "6ab199bf38537c6f38792669e081e0bb278b9b7405bba2642e4e5d15bf732c0e"
|
||||
"checksum flate2 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)" = "e6234dd4468ae5d1e2dbb06fe2b058696fdc50a339c68a393aefbf00bc81e423"
|
||||
"checksum fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6cc484842f1e2884faf56f529f960cc12ad8c71ce96cc7abba0a067c98fee344"
|
||||
|
@ -2501,13 +2643,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
"checksum html5ever 0.18.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a49d5001dd1bddf042ea41ed4e0a671d50b1bf187e66b349d7ec613bdce4ad90"
|
||||
"checksum idna 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "014b298351066f1512874135335d62a789ffe78a9974f94b43ed5621951eaf7d"
|
||||
"checksum ignore 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b3fcaf2365eb14b28ec7603c98c06cc531f19de9eb283d89a3dff8417c8c99f5"
|
||||
"checksum itertools 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "d3f2be4da1690a039e9ae5fd575f706a63ad5a2120f161b1d653c9da3930dd21"
|
||||
"checksum itoa 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8324a32baf01e2ae060e9de58ed0bc2320c9a2833491ee36cd3b4c414de4db8c"
|
||||
"checksum jobserver 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "443ae8bc0af6c106e6e8b77e04684faecc1a5ce94e058f4c2b0a037b0ea1b133"
|
||||
"checksum jobserver 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "931b04e5e57d88cc909528f0d701db36a870b72a052648ded8baf80f9f445e0f"
|
||||
"checksum jsonrpc-core 7.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b1acd0f9934da94466d2370f36832b9b19271b4abdfdb5e69f0bcd991ebcd515"
|
||||
"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
|
||||
"checksum kuchiki 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ef2ea4f2f7883cd7c6772b06c14abca01a2cc1f75c426cebffcf6b3b925ef9fc"
|
||||
"checksum languageserver-types 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d52e477b23bf52cd3ca0f9fc6c5d14be954eec97e3b9cdfbd962d911bd533caf"
|
||||
"checksum lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3b37545ab726dd833ec6420aaba8231c5b320814b9029ad585555d2a03e94fbf"
|
||||
"checksum lazycell 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3b585b7a6811fb03aa10e74b278a0f00f8dd9b45dc681f148bb29fa5cb61859b"
|
||||
"checksum libc 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)" = "d1419b2939a0bc44b77feb34661583c7546b532b192feab36249ab584b86856c"
|
||||
"checksum libgit2-sys 0.6.15 (registry+https://github.com/rust-lang/crates.io-index)" = "205fc37e829c5b36de63d14c8dc8b62c5a6a2519b16318ed0977079ca97256a9"
|
||||
"checksum libssh2-sys 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0db4ec23611747ef772db1c4d650f8bd762f07b461727ec998f953c614024b75"
|
||||
|
@ -2525,6 +2669,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
"checksum miniz-sys 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "609ce024854aeb19a0ef7567d348aaa5a746b32fb72e336df7fcc16869d7e2b4"
|
||||
"checksum miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919"
|
||||
"checksum net2 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)" = "3a80f842784ef6c9a958b68b7516bc7e35883c614004dd94959a4dca1b716c09"
|
||||
"checksum nix 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "47e49f6982987135c5e9620ab317623e723bd06738fd85377e8d55f57c8b6487"
|
||||
"checksum num 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "a311b77ebdc5dd4cf6449d81e4135d9f0e3b153839ac90e648a8ef538f923525"
|
||||
"checksum num-bigint 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "8fd0f8dbb4c0960998958a796281d88c16fbe68d87b1baa6f31e2979e81fd0bd"
|
||||
"checksum num-complex 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "503e668405c5492d67cf662a81e05be40efe2e6bcf10f7794a07bd9865e704e6"
|
||||
|
@ -2537,6 +2682,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
"checksum openssl 0.9.19 (registry+https://github.com/rust-lang/crates.io-index)" = "816914b22eb15671d62c73442a51978f311e911d6a6f6cbdafa6abce1b5038fc"
|
||||
"checksum openssl-probe 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d98df0270d404ccd3c050a41d579c52d1db15375168bb3471e04ec0f5f378daf"
|
||||
"checksum openssl-sys 0.9.19 (registry+https://github.com/rust-lang/crates.io-index)" = "1e4c63a7d559c1e5afa6d6a9e6fa34bbc5f800ffc9ae08b72c605420b0c4f5e8"
|
||||
"checksum os_pipe 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "998bfbb3042e715190fe2a41abfa047d7e8cb81374d2977d7f100eacd8619cb1"
|
||||
"checksum owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cdf84f41639e037b484f93433aa3897863b561ed65c6e59c7073d7c561710f37"
|
||||
"checksum percent-encoding 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "de154f638187706bde41d9b4738748933d64e6b37bdbffc0b47a97d16a6ae356"
|
||||
"checksum pest 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0a6dda33d67c26f0aac90d324ab2eb7239c819fc7b2552fe9faa4fe88441edc8"
|
||||
|
@ -2549,8 +2695,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
"checksum procedural-masquerade 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c93cdc1fb30af9ddf3debc4afbdb0f35126cbd99daa229dd76cdd5349b41d989"
|
||||
"checksum psapi-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "abcd5d1a07d360e29727f757a9decb3ce8bc6e0efa8969cfaad669a8317a2478"
|
||||
"checksum pulldown-cmark 0.0.14 (registry+https://github.com/rust-lang/crates.io-index)" = "d9ab1e588ef8efd702c7ed9d2bd774db5e6f4d878bb5a1a9f371828fbdff6973"
|
||||
"checksum pulldown-cmark 0.0.15 (registry+https://github.com/rust-lang/crates.io-index)" = "378e941dbd392c101f2cb88097fa4d7167bc421d4b88de3ff7dbee503bc3233b"
|
||||
"checksum pulldown-cmark 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a656fdb8b6848f896df5e478a0eb9083681663e37dcb77dd16981ff65329fe8b"
|
||||
"checksum quick-error 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "eda5fe9b71976e62bc81b781206aaa076401769b2143379d3eb2118388babac4"
|
||||
"checksum quine-mc_cluskey 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "07589615d719a60c8dd8a4622e7946465dfef20d1a428f969e3443e7386d5f45"
|
||||
"checksum quote 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4c5cf478fe1006dbcc72567121d23dbdae5f1632386068c5c86ff4f645628504"
|
||||
"checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a"
|
||||
"checksum racer 2.0.10 (registry+https://github.com/rust-lang/crates.io-index)" = "f120c7510ef7aff254aeb06067fb6fac573ec96a1660e194787cf9dced412bf0"
|
||||
|
@ -2571,6 +2719,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
"checksum scoped-tls 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f417c22df063e9450888a7561788e9bd46d3bb3c1466435b4eccb903807f147d"
|
||||
"checksum scopeguard 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "59a076157c1e2dc561d8de585151ee6965d910dd4dcb5dabb7ae3e83981a6c57"
|
||||
"checksum selectors 0.18.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e3c89b1c6a3c029c82263f7dd2d44d0005ee7374eb09e254ab59dede4353a8c0"
|
||||
"checksum semver 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a3186ec9e65071a2095434b1f5bb24838d4e8e130f584c790f6033c79943537"
|
||||
"checksum semver 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bee2bc909ab2d8d60dab26e8cad85b25d795b14603a0dcb627b78b9d30b6454b"
|
||||
"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
|
||||
"checksum serde 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)" = "6a7046c9d4c6c522d10b2d098f9bebe2bef227e0e74044d8c1bfcf6b476af799"
|
||||
|
@ -2578,6 +2727,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
"checksum serde_derive_internals 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bd381f6d01a6616cdba8530492d453b7761b456ba974e98768a18cad2cd76f58"
|
||||
"checksum serde_ignored 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "190e9765dcedb56be63b6e0993a006c7e3b071a016a304736e4a315dc01fb142"
|
||||
"checksum serde_json 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "d243424e06f9f9c39e3cd36147470fd340db785825e367625f79298a6ac6b7ac"
|
||||
"checksum shared_child 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "099b38928dbe4a0a01fcd8c233183072f14a7d126a34bed05880869be66e14cc"
|
||||
"checksum shell-escape 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "dd5cc96481d54583947bfe88bf30c23d53f883c6cd0145368b69989d97b84ef8"
|
||||
"checksum siphasher 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0df90a788073e8d0235a67e50441d47db7c8ad9debd91cbf43736a2a92d36537"
|
||||
"checksum smallvec 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4f8266519bc1d17d0b5b16f6c21295625d562841c708f6376f49028a43e9c11e"
|
||||
|
|
|
@ -5,6 +5,7 @@ members = [
|
|||
"libstd",
|
||||
"libtest",
|
||||
"tools/cargotest",
|
||||
"tools/clippy",
|
||||
"tools/compiletest",
|
||||
"tools/error_index_generator",
|
||||
"tools/linkchecker",
|
||||
|
|
|
@ -34,7 +34,7 @@ cmake = "0.1.23"
|
|||
filetime = "0.1"
|
||||
num_cpus = "1.0"
|
||||
getopts = "0.2"
|
||||
cc = "1.0"
|
||||
cc = "1.0.1"
|
||||
libc = "0.2"
|
||||
serde = "1.0.8"
|
||||
serde_derive = "1.0.8"
|
||||
|
|
|
@ -39,7 +39,7 @@ The script accepts commands, flags, and arguments to determine what to do:
|
|||
```
|
||||
|
||||
If files are dirty that would normally be rebuilt from stage 0, that can be
|
||||
overidden using `--keep-stage 0`. Using `--keep-stage n` will skip all steps
|
||||
overridden using `--keep-stage 0`. Using `--keep-stage n` will skip all steps
|
||||
that belong to stage n or earlier:
|
||||
|
||||
```
|
||||
|
@ -126,17 +126,17 @@ install a nightly, presumably using `rustup`. You will then want to
|
|||
configure your directory to use this build, like so:
|
||||
|
||||
```
|
||||
# configure to use local rust instead of downloding a beta.
|
||||
# configure to use local rust instead of downloading a beta.
|
||||
# `--local-rust-root` is optional here. If elided, we will
|
||||
# use whatever rustc we find on your PATH.
|
||||
> configure --enable-rustbuild --local-rust-root=~/.cargo/ --enable-local-rebuild
|
||||
> ./configure --local-rust-root=~/.cargo/ --enable-local-rebuild
|
||||
```
|
||||
|
||||
After that, you can use the `--incremental` flag to actually do
|
||||
incremental builds:
|
||||
|
||||
```
|
||||
> ../x.py build --incremental
|
||||
> ./x.py build --incremental
|
||||
```
|
||||
|
||||
The `--incremental` flag will store incremental compilation artifacts
|
||||
|
|
|
@ -31,8 +31,6 @@ extern crate bootstrap;
|
|||
|
||||
use std::env;
|
||||
use std::ffi::OsString;
|
||||
use std::io;
|
||||
use std::io::prelude::*;
|
||||
use std::str::FromStr;
|
||||
use std::path::PathBuf;
|
||||
use std::process::{Command, ExitStatus};
|
||||
|
@ -122,19 +120,14 @@ fn main() {
|
|||
cmd.arg("-L").arg(&root);
|
||||
}
|
||||
|
||||
// Pass down extra flags, commonly used to configure `-Clinker` when
|
||||
// cross compiling.
|
||||
if let Ok(s) = env::var("RUSTC_FLAGS") {
|
||||
cmd.args(&s.split(" ").filter(|s| !s.is_empty()).collect::<Vec<_>>());
|
||||
// Override linker if necessary.
|
||||
if let Ok(target_linker) = env::var("RUSTC_TARGET_LINKER") {
|
||||
cmd.arg(format!("-Clinker={}", target_linker));
|
||||
}
|
||||
|
||||
// Pass down incremental directory, if any.
|
||||
if let Ok(dir) = env::var("RUSTC_INCREMENTAL") {
|
||||
cmd.arg(format!("-Zincremental={}", dir));
|
||||
|
||||
if verbose > 0 {
|
||||
cmd.arg("-Zincremental-info");
|
||||
}
|
||||
}
|
||||
|
||||
let crate_name = args.windows(2)
|
||||
|
@ -182,6 +175,9 @@ fn main() {
|
|||
if let Ok(s) = env::var("RUSTC_CODEGEN_UNITS") {
|
||||
cmd.arg("-C").arg(format!("codegen-units={}", s));
|
||||
}
|
||||
if stage != "0" && env::var("RUSTC_THINLTO").is_ok() {
|
||||
cmd.arg("-Ccodegen-units=16").arg("-Zthinlto");
|
||||
}
|
||||
|
||||
// Emit save-analysis info.
|
||||
if env::var("RUSTC_SAVE_ANALYSIS") == Ok("api".to_string()) {
|
||||
|
@ -258,6 +254,11 @@ fn main() {
|
|||
if env::var_os("RUSTC_FORCE_UNSTABLE").is_some() {
|
||||
cmd.arg("-Z").arg("force-unstable-if-unmarked");
|
||||
}
|
||||
} else {
|
||||
// Override linker if necessary.
|
||||
if let Ok(host_linker) = env::var("RUSTC_HOST_LINKER") {
|
||||
cmd.arg(format!("-Clinker={}", host_linker));
|
||||
}
|
||||
}
|
||||
|
||||
let color = match env::var("RUSTC_COLOR") {
|
||||
|
@ -270,7 +271,7 @@ fn main() {
|
|||
}
|
||||
|
||||
if verbose > 1 {
|
||||
writeln!(&mut io::stderr(), "rustc command: {:?}", cmd).unwrap();
|
||||
eprintln!("rustc command: {:?}", cmd);
|
||||
}
|
||||
|
||||
// Actually run the compiler!
|
||||
|
|
|
@ -47,6 +47,17 @@ fn main() {
|
|||
if env::var_os("RUSTC_FORCE_UNSTABLE").is_some() {
|
||||
cmd.arg("-Z").arg("force-unstable-if-unmarked");
|
||||
}
|
||||
if let Some(linker) = env::var_os("RUSTC_TARGET_LINKER") {
|
||||
cmd.arg("--linker").arg(linker).arg("-Z").arg("unstable-options");
|
||||
}
|
||||
|
||||
// Bootstrap's Cargo-command builder sets this variable to the current Rust version; let's pick
|
||||
// it up so we can make rustdoc print this into the docs
|
||||
if let Some(version) = env::var_os("RUSTDOC_CRATE_VERSION") {
|
||||
// This "unstable-options" can be removed when `--crate-version` is stabilized
|
||||
cmd.arg("-Z").arg("unstable-options")
|
||||
.arg("--crate-version").arg(version);
|
||||
}
|
||||
|
||||
std::process::exit(match cmd.status() {
|
||||
Ok(s) => s.code().unwrap_or(1),
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
# option. This file may not be copied, modified, or distributed
|
||||
# except according to those terms.
|
||||
|
||||
from __future__ import print_function
|
||||
from __future__ import absolute_import, division, print_function
|
||||
import argparse
|
||||
import contextlib
|
||||
import datetime
|
||||
|
@ -302,6 +302,7 @@ def default_build_triple():
|
|||
|
||||
return "{}-{}".format(cputype, ostype)
|
||||
|
||||
|
||||
class RustBuild(object):
|
||||
"""Provide all the methods required to build Rust"""
|
||||
def __init__(self):
|
||||
|
@ -498,7 +499,7 @@ class RustBuild(object):
|
|||
|
||||
If the key does not exists, the result is None:
|
||||
|
||||
>>> rb.get_toml("key3") == None
|
||||
>>> rb.get_toml("key3") is None
|
||||
True
|
||||
"""
|
||||
for line in self.config_toml.splitlines():
|
||||
|
@ -531,7 +532,7 @@ class RustBuild(object):
|
|||
"""
|
||||
config = self.get_toml(program)
|
||||
if config:
|
||||
return config
|
||||
return os.path.expanduser(config)
|
||||
return os.path.join(self.bin_root(), "bin", "{}{}".format(
|
||||
program, self.exe_suffix()))
|
||||
|
||||
|
@ -647,7 +648,8 @@ class RustBuild(object):
|
|||
if not ((module.endswith("llvm") and
|
||||
self.get_toml('llvm-config')) or
|
||||
(module.endswith("jemalloc") and
|
||||
self.get_toml('jemalloc')))]
|
||||
(self.get_toml('use-jemalloc') == "false" or
|
||||
self.get_toml('jemalloc'))))]
|
||||
run(["git", "submodule", "update",
|
||||
"--init", "--recursive"] + submodules,
|
||||
cwd=self.rust_root, verbose=self.verbose)
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
"""Bootstrap tests"""
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
import os
|
||||
import doctest
|
||||
import unittest
|
||||
|
|
|
@ -413,12 +413,15 @@ impl<'a> Builder<'a> {
|
|||
pub fn rustdoc_cmd(&self, host: Interned<String>) -> Command {
|
||||
let mut cmd = Command::new(&self.out.join("bootstrap/debug/rustdoc"));
|
||||
let compiler = self.compiler(self.top_stage, host);
|
||||
cmd
|
||||
.env("RUSTC_STAGE", compiler.stage.to_string())
|
||||
.env("RUSTC_SYSROOT", self.sysroot(compiler))
|
||||
.env("RUSTC_LIBDIR", self.sysroot_libdir(compiler, self.build.build))
|
||||
.env("CFG_RELEASE_CHANNEL", &self.build.config.channel)
|
||||
.env("RUSTDOC_REAL", self.rustdoc(host));
|
||||
cmd.env("RUSTC_STAGE", compiler.stage.to_string())
|
||||
.env("RUSTC_SYSROOT", self.sysroot(compiler))
|
||||
.env("RUSTC_LIBDIR", self.sysroot_libdir(compiler, self.build.build))
|
||||
.env("CFG_RELEASE_CHANNEL", &self.build.config.channel)
|
||||
.env("RUSTDOC_REAL", self.rustdoc(host))
|
||||
.env("RUSTDOC_CRATE_VERSION", self.build.rust_version());
|
||||
if let Some(linker) = self.build.linker(host) {
|
||||
cmd.env("RUSTC_TARGET_LINKER", linker);
|
||||
}
|
||||
cmd
|
||||
}
|
||||
|
||||
|
@ -468,8 +471,6 @@ impl<'a> Builder<'a> {
|
|||
.env("RUSTC", self.out.join("bootstrap/debug/rustc"))
|
||||
.env("RUSTC_REAL", self.rustc(compiler))
|
||||
.env("RUSTC_STAGE", stage.to_string())
|
||||
.env("RUSTC_CODEGEN_UNITS",
|
||||
self.config.rust_codegen_units.to_string())
|
||||
.env("RUSTC_DEBUG_ASSERTIONS",
|
||||
self.config.rust_debug_assertions.to_string())
|
||||
.env("RUSTC_SYSROOT", self.sysroot(compiler))
|
||||
|
@ -481,8 +482,18 @@ impl<'a> Builder<'a> {
|
|||
} else {
|
||||
PathBuf::from("/path/to/nowhere/rustdoc/not/required")
|
||||
})
|
||||
.env("TEST_MIRI", self.config.test_miri.to_string())
|
||||
.env("RUSTC_FLAGS", self.rustc_flags(target).join(" "));
|
||||
.env("TEST_MIRI", self.config.test_miri.to_string());
|
||||
|
||||
if let Some(n) = self.config.rust_codegen_units {
|
||||
cargo.env("RUSTC_CODEGEN_UNITS", n.to_string());
|
||||
}
|
||||
|
||||
if let Some(host_linker) = self.build.linker(compiler.host) {
|
||||
cargo.env("RUSTC_HOST_LINKER", host_linker);
|
||||
}
|
||||
if let Some(target_linker) = self.build.linker(target) {
|
||||
cargo.env("RUSTC_TARGET_LINKER", target_linker);
|
||||
}
|
||||
|
||||
if mode != Mode::Tool {
|
||||
// Tools don't get debuginfo right now, e.g. cargo and rls don't
|
||||
|
@ -556,17 +567,35 @@ impl<'a> Builder<'a> {
|
|||
|
||||
cargo.env("RUSTC_VERBOSE", format!("{}", self.verbosity));
|
||||
|
||||
// Specify some various options for build scripts used throughout
|
||||
// the build.
|
||||
// Throughout the build Cargo can execute a number of build scripts
|
||||
// compiling C/C++ code and we need to pass compilers, archivers, flags, etc
|
||||
// obtained previously to those build scripts.
|
||||
// Build scripts use either the `cc` crate or `configure/make` so we pass
|
||||
// the options through environment variables that are fetched and understood by both.
|
||||
//
|
||||
// FIXME: the guard against msvc shouldn't need to be here
|
||||
if !target.contains("msvc") {
|
||||
cargo.env(format!("CC_{}", target), self.cc(target))
|
||||
.env(format!("AR_{}", target), self.ar(target).unwrap()) // only msvc is None
|
||||
.env(format!("CFLAGS_{}", target), self.cflags(target).join(" "));
|
||||
let cc = self.cc(target);
|
||||
cargo.env(format!("CC_{}", target), cc)
|
||||
.env("CC", cc);
|
||||
|
||||
let cflags = self.cflags(target).join(" ");
|
||||
cargo.env(format!("CFLAGS_{}", target), cflags.clone())
|
||||
.env("CFLAGS", cflags.clone());
|
||||
|
||||
if let Some(ar) = self.ar(target) {
|
||||
let ranlib = format!("{} s", ar.display());
|
||||
cargo.env(format!("AR_{}", target), ar)
|
||||
.env("AR", ar)
|
||||
.env(format!("RANLIB_{}", target), ranlib.clone())
|
||||
.env("RANLIB", ranlib);
|
||||
}
|
||||
|
||||
if let Ok(cxx) = self.cxx(target) {
|
||||
cargo.env(format!("CXX_{}", target), cxx);
|
||||
cargo.env(format!("CXX_{}", target), cxx)
|
||||
.env("CXX", cxx)
|
||||
.env(format!("CXXFLAGS_{}", target), cflags.clone())
|
||||
.env("CXXFLAGS", cflags);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -574,6 +603,9 @@ impl<'a> Builder<'a> {
|
|||
cargo.env("RUSTC_SAVE_ANALYSIS", "api".to_string());
|
||||
}
|
||||
|
||||
// For `cargo doc` invocations, make rustdoc print the Rust version into the docs
|
||||
cargo.env("RUSTDOC_CRATE_VERSION", self.build.rust_version());
|
||||
|
||||
// Environment variables *required* throughout the build
|
||||
//
|
||||
// FIXME: should update code to not require this env var
|
||||
|
@ -582,12 +614,20 @@ impl<'a> Builder<'a> {
|
|||
// Set this for all builds to make sure doc builds also get it.
|
||||
cargo.env("CFG_RELEASE_CHANNEL", &self.build.config.channel);
|
||||
|
||||
if self.is_verbose() {
|
||||
if self.is_very_verbose() {
|
||||
cargo.arg("-v");
|
||||
}
|
||||
// FIXME: cargo bench does not accept `--release`
|
||||
if self.config.rust_optimize && cmd != "bench" {
|
||||
cargo.arg("--release");
|
||||
|
||||
if mode != Mode::Libstd &&
|
||||
self.config.rust_codegen_units.is_none() &&
|
||||
self.build.is_rust_llvm(compiler.host)
|
||||
|
||||
{
|
||||
cargo.env("RUSTC_THINLTO", "1");
|
||||
}
|
||||
}
|
||||
if self.config.locked_deps {
|
||||
cargo.arg("--locked");
|
||||
|
|
|
@ -31,20 +31,51 @@
|
|||
//! ever be probed for. Instead the compilers found here will be used for
|
||||
//! everything.
|
||||
|
||||
use std::collections::HashSet;
|
||||
use std::{env, iter};
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::process::Command;
|
||||
use std::iter;
|
||||
|
||||
use build_helper::{cc2ar, output};
|
||||
use build_helper::output;
|
||||
use cc;
|
||||
|
||||
use Build;
|
||||
use config::Target;
|
||||
use cache::Interned;
|
||||
|
||||
// The `cc` crate doesn't provide a way to obtain a path to the detected archiver,
|
||||
// so use some simplified logic here. First we respect the environment variable `AR`, then
|
||||
// try to infer the archiver path from the C compiler path.
|
||||
// In the future this logic should be replaced by calling into the `cc` crate.
|
||||
fn cc2ar(cc: &Path, target: &str) -> Option<PathBuf> {
|
||||
if let Some(ar) = env::var_os("AR") {
|
||||
Some(PathBuf::from(ar))
|
||||
} else if target.contains("msvc") {
|
||||
None
|
||||
} else if target.contains("musl") {
|
||||
Some(PathBuf::from("ar"))
|
||||
} else if target.contains("openbsd") {
|
||||
Some(PathBuf::from("ar"))
|
||||
} else {
|
||||
let parent = cc.parent().unwrap();
|
||||
let file = cc.file_name().unwrap().to_str().unwrap();
|
||||
for suffix in &["gcc", "cc", "clang"] {
|
||||
if let Some(idx) = file.rfind(suffix) {
|
||||
let mut file = file[..idx].to_owned();
|
||||
file.push_str("ar");
|
||||
return Some(parent.join(&file));
|
||||
}
|
||||
}
|
||||
Some(parent.join(file))
|
||||
}
|
||||
}
|
||||
|
||||
pub fn find(build: &mut Build) {
|
||||
// For all targets we're going to need a C compiler for building some shims
|
||||
// and such as well as for being a linker for Rust code.
|
||||
for target in build.targets.iter().chain(&build.hosts).cloned().chain(iter::once(build.build)) {
|
||||
let targets = build.targets.iter().chain(&build.hosts).cloned().chain(iter::once(build.build))
|
||||
.collect::<HashSet<_>>();
|
||||
for target in targets.into_iter() {
|
||||
let mut cfg = cc::Build::new();
|
||||
cfg.cargo_metadata(false).opt_level(0).warnings(false).debug(false)
|
||||
.target(&target).host(&build.build);
|
||||
|
@ -57,16 +88,23 @@ pub fn find(build: &mut Build) {
|
|||
}
|
||||
|
||||
let compiler = cfg.get_compiler();
|
||||
let ar = cc2ar(compiler.path(), &target);
|
||||
let ar = if let ar @ Some(..) = config.and_then(|c| c.ar.clone()) {
|
||||
ar
|
||||
} else {
|
||||
cc2ar(compiler.path(), &target)
|
||||
};
|
||||
|
||||
build.verbose(&format!("CC_{} = {:?}", &target, compiler.path()));
|
||||
if let Some(ref ar) = ar {
|
||||
build.cc.insert(target, compiler);
|
||||
if let Some(ar) = ar {
|
||||
build.verbose(&format!("AR_{} = {:?}", &target, ar));
|
||||
build.ar.insert(target, ar);
|
||||
}
|
||||
build.cc.insert(target, (compiler, ar));
|
||||
}
|
||||
|
||||
// For all host triples we need to find a C++ compiler as well
|
||||
for host in build.hosts.iter().cloned().chain(iter::once(build.build)) {
|
||||
let hosts = build.hosts.iter().cloned().chain(iter::once(build.build)).collect::<HashSet<_>>();
|
||||
for host in hosts.into_iter() {
|
||||
let mut cfg = cc::Build::new();
|
||||
cfg.cargo_metadata(false).opt_level(0).warnings(false).debug(false).cpp(true)
|
||||
.target(&host).host(&build.build);
|
||||
|
|
|
@ -246,8 +246,11 @@ impl Step for Rls {
|
|||
let compiler = builder.compiler(stage, host);
|
||||
|
||||
builder.ensure(tool::Rls { compiler, target: self.host });
|
||||
let mut cargo = builder.cargo(compiler, Mode::Tool, host, "test");
|
||||
cargo.arg("--manifest-path").arg(build.src.join("src/tools/rls/Cargo.toml"));
|
||||
let mut cargo = tool::prepare_tool_cargo(builder,
|
||||
compiler,
|
||||
host,
|
||||
"test",
|
||||
"src/tools/rls");
|
||||
|
||||
// Don't build tests dynamically, just a pain to work with
|
||||
cargo.env("RUSTC_NO_PREFER_DYNAMIC", "1");
|
||||
|
@ -291,8 +294,11 @@ impl Step for Rustfmt {
|
|||
let compiler = builder.compiler(stage, host);
|
||||
|
||||
builder.ensure(tool::Rustfmt { compiler, target: self.host });
|
||||
let mut cargo = builder.cargo(compiler, Mode::Tool, host, "test");
|
||||
cargo.arg("--manifest-path").arg(build.src.join("src/tools/rustfmt/Cargo.toml"));
|
||||
let mut cargo = tool::prepare_tool_cargo(builder,
|
||||
compiler,
|
||||
host,
|
||||
"test",
|
||||
"src/tools/rustfmt");
|
||||
|
||||
// Don't build tests dynamically, just a pain to work with
|
||||
cargo.env("RUSTC_NO_PREFER_DYNAMIC", "1");
|
||||
|
@ -334,30 +340,34 @@ impl Step for Miri {
|
|||
let host = self.host;
|
||||
let compiler = builder.compiler(1, host);
|
||||
|
||||
let miri = builder.ensure(tool::Miri { compiler, target: self.host });
|
||||
let mut cargo = builder.cargo(compiler, Mode::Tool, host, "test");
|
||||
cargo.arg("--manifest-path").arg(build.src.join("src/tools/miri/Cargo.toml"));
|
||||
if let Some(miri) = builder.ensure(tool::Miri { compiler, target: self.host }) {
|
||||
let mut cargo = builder.cargo(compiler, Mode::Tool, host, "test");
|
||||
cargo.arg("--manifest-path").arg(build.src.join("src/tools/miri/Cargo.toml"));
|
||||
|
||||
// Don't build tests dynamically, just a pain to work with
|
||||
cargo.env("RUSTC_NO_PREFER_DYNAMIC", "1");
|
||||
// miri tests need to know about the stage sysroot
|
||||
cargo.env("MIRI_SYSROOT", builder.sysroot(compiler));
|
||||
cargo.env("RUSTC_TEST_SUITE", builder.rustc(compiler));
|
||||
cargo.env("RUSTC_LIB_PATH", builder.rustc_libdir(compiler));
|
||||
cargo.env("MIRI_PATH", miri);
|
||||
// Don't build tests dynamically, just a pain to work with
|
||||
cargo.env("RUSTC_NO_PREFER_DYNAMIC", "1");
|
||||
// miri tests need to know about the stage sysroot
|
||||
cargo.env("MIRI_SYSROOT", builder.sysroot(compiler));
|
||||
cargo.env("RUSTC_TEST_SUITE", builder.rustc(compiler));
|
||||
cargo.env("RUSTC_LIB_PATH", builder.rustc_libdir(compiler));
|
||||
cargo.env("MIRI_PATH", miri);
|
||||
|
||||
builder.add_rustc_lib_path(compiler, &mut cargo);
|
||||
builder.add_rustc_lib_path(compiler, &mut cargo);
|
||||
|
||||
try_run_expecting(
|
||||
build,
|
||||
&mut cargo,
|
||||
builder.build.config.toolstate.miri.passes(ToolState::Testing),
|
||||
);
|
||||
try_run_expecting(
|
||||
build,
|
||||
&mut cargo,
|
||||
builder.build.config.toolstate.miri.passes(ToolState::Testing),
|
||||
);
|
||||
} else {
|
||||
eprintln!("failed to test miri: could not build");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
|
||||
pub struct Clippy {
|
||||
stage: u32,
|
||||
host: Interned<String>,
|
||||
}
|
||||
|
||||
|
@ -372,6 +382,7 @@ impl Step for Clippy {
|
|||
|
||||
fn make_run(run: RunConfig) {
|
||||
run.builder.ensure(Clippy {
|
||||
stage: run.builder.top_stage,
|
||||
host: run.target,
|
||||
});
|
||||
}
|
||||
|
@ -379,25 +390,31 @@ impl Step for Clippy {
|
|||
/// Runs `cargo test` for clippy.
|
||||
fn run(self, builder: &Builder) {
|
||||
let build = builder.build;
|
||||
let stage = self.stage;
|
||||
let host = self.host;
|
||||
let compiler = builder.compiler(1, host);
|
||||
let compiler = builder.compiler(stage, host);
|
||||
|
||||
let _clippy = builder.ensure(tool::Clippy { compiler, target: self.host });
|
||||
let mut cargo = builder.cargo(compiler, Mode::Tool, host, "test");
|
||||
cargo.arg("--manifest-path").arg(build.src.join("src/tools/clippy/Cargo.toml"));
|
||||
if let Some(clippy) = builder.ensure(tool::Clippy { compiler, target: self.host }) {
|
||||
let mut cargo = builder.cargo(compiler, Mode::Tool, host, "test");
|
||||
cargo.arg("--manifest-path").arg(build.src.join("src/tools/clippy/Cargo.toml"));
|
||||
|
||||
// Don't build tests dynamically, just a pain to work with
|
||||
cargo.env("RUSTC_NO_PREFER_DYNAMIC", "1");
|
||||
// clippy tests need to know about the stage sysroot
|
||||
cargo.env("SYSROOT", builder.sysroot(compiler));
|
||||
// Don't build tests dynamically, just a pain to work with
|
||||
cargo.env("RUSTC_NO_PREFER_DYNAMIC", "1");
|
||||
// clippy tests need to know about the stage sysroot
|
||||
cargo.env("SYSROOT", builder.sysroot(compiler));
|
||||
// clippy tests need to find the driver
|
||||
cargo.env("CLIPPY_DRIVER_PATH", clippy);
|
||||
|
||||
builder.add_rustc_lib_path(compiler, &mut cargo);
|
||||
builder.add_rustc_lib_path(compiler, &mut cargo);
|
||||
|
||||
try_run_expecting(
|
||||
build,
|
||||
&mut cargo,
|
||||
builder.build.config.toolstate.clippy.passes(ToolState::Testing),
|
||||
);
|
||||
try_run_expecting(
|
||||
build,
|
||||
&mut cargo,
|
||||
builder.build.config.toolstate.clippy.passes(ToolState::Testing),
|
||||
);
|
||||
} else {
|
||||
eprintln!("failed to test clippy: could not build");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -736,12 +753,14 @@ impl Step for Compiletest {
|
|||
flags.push("-g".to_string());
|
||||
}
|
||||
|
||||
let mut hostflags = build.rustc_flags(compiler.host);
|
||||
hostflags.extend(flags.clone());
|
||||
if let Some(linker) = build.linker(target) {
|
||||
cmd.arg("--linker").arg(linker);
|
||||
}
|
||||
|
||||
let hostflags = flags.clone();
|
||||
cmd.arg("--host-rustcflags").arg(hostflags.join(" "));
|
||||
|
||||
let mut targetflags = build.rustc_flags(target);
|
||||
targetflags.extend(flags);
|
||||
let mut targetflags = flags.clone();
|
||||
targetflags.push(format!("-Lnative={}",
|
||||
build.test_helpers_out(target).display()));
|
||||
cmd.arg("--target-rustcflags").arg(targetflags.join(" "));
|
||||
|
@ -795,6 +814,9 @@ impl Step for Compiletest {
|
|||
.arg("--cflags").arg(build.cflags(target).join(" "))
|
||||
.arg("--llvm-components").arg(llvm_components.trim())
|
||||
.arg("--llvm-cxxflags").arg(llvm_cxxflags.trim());
|
||||
if let Some(ar) = build.ar(target) {
|
||||
cmd.arg("--ar").arg(ar);
|
||||
}
|
||||
}
|
||||
}
|
||||
if suite == "run-make" && !build.config.llvm_enabled {
|
||||
|
@ -820,7 +842,7 @@ impl Step for Compiletest {
|
|||
// Note that if we encounter `PATH` we make sure to append to our own `PATH`
|
||||
// rather than stomp over it.
|
||||
if target.contains("msvc") {
|
||||
for &(ref k, ref v) in build.cc[&target].0.env() {
|
||||
for &(ref k, ref v) in build.cc[&target].env() {
|
||||
if k != "PATH" {
|
||||
cmd.env(k, v);
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ use build_helper::{output, mtime, up_to_date};
|
|||
use filetime::FileTime;
|
||||
use serde_json;
|
||||
|
||||
use util::{exe, libdir, is_dylib, copy};
|
||||
use util::{exe, libdir, is_dylib, copy, read_stamp_file, CiEnv};
|
||||
use {Build, Compiler, Mode};
|
||||
use native;
|
||||
use tool;
|
||||
|
@ -102,7 +102,7 @@ impl Step for Std {
|
|||
copy_musl_third_party_objects(build, target, &libdir);
|
||||
}
|
||||
|
||||
let out_dir = build.cargo_out(compiler, Mode::Libstd, target);
|
||||
let out_dir = build.stage_out(compiler, Mode::Libstd);
|
||||
build.clear_if_dirty(&out_dir, &builder.rustc(compiler));
|
||||
let mut cargo = builder.cargo(compiler, Mode::Libstd, target, "build");
|
||||
std_cargo(build, &compiler, target, &mut cargo);
|
||||
|
@ -354,7 +354,7 @@ impl Step for Test {
|
|||
let _folder = build.fold_output(|| format!("stage{}-test", compiler.stage));
|
||||
println!("Building stage{} test artifacts ({} -> {})", compiler.stage,
|
||||
&compiler.host, target);
|
||||
let out_dir = build.cargo_out(compiler, Mode::Libtest, target);
|
||||
let out_dir = build.stage_out(compiler, Mode::Libtest);
|
||||
build.clear_if_dirty(&out_dir, &libstd_stamp(build, compiler, target));
|
||||
let mut cargo = builder.cargo(compiler, Mode::Libtest, target, "build");
|
||||
test_cargo(build, &compiler, target, &mut cargo);
|
||||
|
@ -480,8 +480,9 @@ impl Step for Rustc {
|
|||
println!("Building stage{} compiler artifacts ({} -> {})",
|
||||
compiler.stage, &compiler.host, target);
|
||||
|
||||
let out_dir = build.cargo_out(compiler, Mode::Librustc, target);
|
||||
build.clear_if_dirty(&out_dir, &libtest_stamp(build, compiler, target));
|
||||
let stage_out = builder.stage_out(compiler, Mode::Librustc);
|
||||
build.clear_if_dirty(&stage_out, &libstd_stamp(build, compiler, target));
|
||||
build.clear_if_dirty(&stage_out, &libtest_stamp(build, compiler, target));
|
||||
|
||||
let mut cargo = builder.cargo(compiler, Mode::Librustc, target, "build");
|
||||
rustc_cargo(build, &compiler, target, &mut cargo);
|
||||
|
@ -560,9 +561,6 @@ pub fn rustc_cargo(build: &Build,
|
|||
if let Some(ref s) = build.config.rustc_default_linker {
|
||||
cargo.env("CFG_DEFAULT_LINKER", s);
|
||||
}
|
||||
if let Some(ref s) = build.config.rustc_default_ar {
|
||||
cargo.env("CFG_DEFAULT_AR", s);
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
|
||||
|
@ -760,15 +758,7 @@ impl Step for Assemble {
|
|||
/// `sysroot_dst` provided.
|
||||
fn add_to_sysroot(sysroot_dst: &Path, stamp: &Path) {
|
||||
t!(fs::create_dir_all(&sysroot_dst));
|
||||
let mut contents = Vec::new();
|
||||
t!(t!(File::open(stamp)).read_to_end(&mut contents));
|
||||
// This is the method we use for extracting paths from the stamp file passed to us. See
|
||||
// run_cargo for more information (in this file).
|
||||
for part in contents.split(|b| *b == 0) {
|
||||
if part.is_empty() {
|
||||
continue
|
||||
}
|
||||
let path = Path::new(t!(str::from_utf8(part)));
|
||||
for path in read_stamp_file(stamp) {
|
||||
copy(&path, &sysroot_dst.join(path.file_name().unwrap()));
|
||||
}
|
||||
}
|
||||
|
@ -802,7 +792,7 @@ fn run_cargo(build: &Build, cargo: &mut Command, stamp: &Path) {
|
|||
cargo.arg("--message-format").arg("json")
|
||||
.stdout(Stdio::piped());
|
||||
|
||||
if stderr_isatty() {
|
||||
if stderr_isatty() && build.ci_env == CiEnv::None {
|
||||
// since we pass message-format=json to cargo, we need to tell the rustc
|
||||
// wrapper to give us colored output if necessary. This is because we
|
||||
// only want Cargo's JSON output, not rustcs.
|
||||
|
@ -941,6 +931,8 @@ fn run_cargo(build: &Build, cargo: &mut Command, stamp: &Path) {
|
|||
let max = max.unwrap();
|
||||
let max_path = max_path.unwrap();
|
||||
if stamp_contents == new_contents && max <= stamp_mtime {
|
||||
build.verbose(&format!("not updating {:?}; contents equal and {} <= {}",
|
||||
stamp, max, stamp_mtime));
|
||||
return
|
||||
}
|
||||
if max > stamp_mtime {
|
||||
|
|
|
@ -81,14 +81,13 @@ pub struct Config {
|
|||
|
||||
// rust codegen options
|
||||
pub rust_optimize: bool,
|
||||
pub rust_codegen_units: u32,
|
||||
pub rust_codegen_units: Option<u32>,
|
||||
pub rust_debug_assertions: bool,
|
||||
pub rust_debuginfo: bool,
|
||||
pub rust_debuginfo_lines: bool,
|
||||
pub rust_debuginfo_only_std: bool,
|
||||
pub rust_rpath: bool,
|
||||
pub rustc_default_linker: Option<String>,
|
||||
pub rustc_default_ar: Option<String>,
|
||||
pub rust_optimize_tests: bool,
|
||||
pub rust_debuginfo_tests: bool,
|
||||
pub rust_dist_src: bool,
|
||||
|
@ -144,6 +143,8 @@ pub struct Target {
|
|||
pub jemalloc: Option<PathBuf>,
|
||||
pub cc: Option<PathBuf>,
|
||||
pub cxx: Option<PathBuf>,
|
||||
pub ar: Option<PathBuf>,
|
||||
pub linker: Option<PathBuf>,
|
||||
pub ndk: Option<PathBuf>,
|
||||
pub crt_static: Option<bool>,
|
||||
pub musl_root: Option<PathBuf>,
|
||||
|
@ -262,7 +263,6 @@ struct Rust {
|
|||
use_jemalloc: Option<bool>,
|
||||
backtrace: Option<bool>,
|
||||
default_linker: Option<String>,
|
||||
default_ar: Option<String>,
|
||||
channel: Option<String>,
|
||||
musl_root: Option<String>,
|
||||
rpath: Option<bool>,
|
||||
|
@ -284,6 +284,8 @@ struct TomlTarget {
|
|||
jemalloc: Option<String>,
|
||||
cc: Option<String>,
|
||||
cxx: Option<String>,
|
||||
ar: Option<String>,
|
||||
linker: Option<String>,
|
||||
android_ndk: Option<String>,
|
||||
crt_static: Option<bool>,
|
||||
musl_root: Option<String>,
|
||||
|
@ -297,6 +299,7 @@ impl Config {
|
|||
let mut config = Config::default();
|
||||
config.llvm_enabled = true;
|
||||
config.llvm_optimize = true;
|
||||
config.llvm_version_check = true;
|
||||
config.use_jemalloc = true;
|
||||
config.backtrace = true;
|
||||
config.rust_optimize = true;
|
||||
|
@ -304,7 +307,6 @@ impl Config {
|
|||
config.submodules = true;
|
||||
config.docs = true;
|
||||
config.rust_rpath = true;
|
||||
config.rust_codegen_units = 1;
|
||||
config.channel = "dev".to_string();
|
||||
config.codegen_tests = true;
|
||||
config.ignore_git = false;
|
||||
|
@ -464,12 +466,11 @@ impl Config {
|
|||
set(&mut config.quiet_tests, rust.quiet_tests);
|
||||
set(&mut config.test_miri, rust.test_miri);
|
||||
config.rustc_default_linker = rust.default_linker.clone();
|
||||
config.rustc_default_ar = rust.default_ar.clone();
|
||||
config.musl_root = rust.musl_root.clone().map(PathBuf::from);
|
||||
|
||||
match rust.codegen_units {
|
||||
Some(0) => config.rust_codegen_units = num_cpus::get() as u32,
|
||||
Some(n) => config.rust_codegen_units = n,
|
||||
Some(0) => config.rust_codegen_units = Some(num_cpus::get() as u32),
|
||||
Some(n) => config.rust_codegen_units = Some(n),
|
||||
None => {}
|
||||
}
|
||||
}
|
||||
|
@ -487,8 +488,10 @@ impl Config {
|
|||
if let Some(ref s) = cfg.android_ndk {
|
||||
target.ndk = Some(env::current_dir().unwrap().join(s));
|
||||
}
|
||||
target.cxx = cfg.cxx.clone().map(PathBuf::from);
|
||||
target.cc = cfg.cc.clone().map(PathBuf::from);
|
||||
target.cxx = cfg.cxx.clone().map(PathBuf::from);
|
||||
target.ar = cfg.ar.clone().map(PathBuf::from);
|
||||
target.linker = cfg.linker.clone().map(PathBuf::from);
|
||||
target.crt_static = cfg.crt_static.clone();
|
||||
target.musl_root = cfg.musl_root.clone().map(PathBuf::from);
|
||||
target.qemu_rootfs = cfg.qemu_rootfs.clone().map(PathBuf::from);
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
# ignore-tidy-linelength
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
import sys
|
||||
import os
|
||||
rust_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
|
@ -19,21 +20,26 @@ rust_dir = os.path.dirname(rust_dir)
|
|||
sys.path.append(os.path.join(rust_dir, "src", "bootstrap"))
|
||||
import bootstrap
|
||||
|
||||
class Option:
|
||||
|
||||
class Option(object):
|
||||
def __init__(self, name, rustbuild, desc, value):
|
||||
self.name = name
|
||||
self.rustbuild = rustbuild
|
||||
self.desc = desc
|
||||
self.value = value
|
||||
|
||||
|
||||
options = []
|
||||
|
||||
|
||||
def o(*args):
|
||||
options.append(Option(*args, value=False))
|
||||
|
||||
|
||||
def v(*args):
|
||||
options.append(Option(*args, value=True))
|
||||
|
||||
|
||||
o("debug", "rust.debug", "debug mode; disables optimization unless `--enable-optimize` given")
|
||||
o("docs", "build.docs", "build standard library documentation")
|
||||
o("compiler-docs", "build.compiler-docs", "build compiler documentation")
|
||||
|
@ -119,9 +125,8 @@ v("experimental-targets", "llvm.experimental-targets",
|
|||
"experimental LLVM targets to build")
|
||||
v("release-channel", "rust.channel", "the name of the release channel to build")
|
||||
|
||||
# Used on systems where "cc" and "ar" are unavailable
|
||||
# Used on systems where "cc" is unavailable
|
||||
v("default-linker", "rust.default-linker", "the default linker")
|
||||
v("default-ar", "rust.default-ar", "the default ar")
|
||||
|
||||
# Many of these are saved below during the "writing configuration" step
|
||||
# (others are conditionally saved).
|
||||
|
@ -136,13 +141,16 @@ v("target", None, "GNUs ./configure syntax LLVM target triples")
|
|||
|
||||
v("set", None, "set arbitrary key/value pairs in TOML configuration")
|
||||
|
||||
|
||||
def p(msg):
|
||||
print("configure: " + msg)
|
||||
|
||||
|
||||
def err(msg):
|
||||
print("configure: error: " + msg)
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
if '--help' in sys.argv or '-h' in sys.argv:
|
||||
print('Usage: ./configure [options]')
|
||||
print('')
|
||||
|
@ -208,7 +216,7 @@ while i < len(sys.argv):
|
|||
continue
|
||||
|
||||
found = True
|
||||
if not option.name in known_args:
|
||||
if option.name not in known_args:
|
||||
known_args[option.name] = []
|
||||
known_args[option.name].append((option, value))
|
||||
break
|
||||
|
@ -227,27 +235,30 @@ if 'option-checking' not in known_args or known_args['option-checking'][1]:
|
|||
# TOML we're going to write out
|
||||
config = {}
|
||||
|
||||
|
||||
def build():
|
||||
if 'build' in known_args:
|
||||
return known_args['build'][0][1]
|
||||
return bootstrap.default_build_triple()
|
||||
|
||||
def set(key, value):
|
||||
s = "{:20} := {}".format(key, value)
|
||||
if len(s) < 70:
|
||||
p(s)
|
||||
else:
|
||||
p(s[:70] + " ...")
|
||||
|
||||
arr = config
|
||||
parts = key.split('.')
|
||||
for i, part in enumerate(parts):
|
||||
if i == len(parts) - 1:
|
||||
arr[part] = value
|
||||
else:
|
||||
if not part in arr:
|
||||
arr[part] = {}
|
||||
arr = arr[part]
|
||||
def set(key, value):
|
||||
s = "{:20} := {}".format(key, value)
|
||||
if len(s) < 70:
|
||||
p(s)
|
||||
else:
|
||||
p(s[:70] + " ...")
|
||||
|
||||
arr = config
|
||||
parts = key.split('.')
|
||||
for i, part in enumerate(parts):
|
||||
if i == len(parts) - 1:
|
||||
arr[part] = value
|
||||
else:
|
||||
if part not in arr:
|
||||
arr[part] = {}
|
||||
arr = arr[part]
|
||||
|
||||
|
||||
for key in known_args:
|
||||
# The `set` option is special and can be passed a bunch of times
|
||||
|
@ -345,8 +356,9 @@ for target in configured_targets:
|
|||
targets[target] = sections['target'][:]
|
||||
targets[target][0] = targets[target][0].replace("x86_64-unknown-linux-gnu", target)
|
||||
|
||||
|
||||
# Here we walk through the constructed configuration we have from the parsed
|
||||
# command line arguemnts. We then apply each piece of configuration by
|
||||
# command line arguments. We then apply each piece of configuration by
|
||||
# basically just doing a `sed` to change the various configuration line to what
|
||||
# we've got configure.
|
||||
def to_toml(value):
|
||||
|
@ -360,7 +372,8 @@ def to_toml(value):
|
|||
elif isinstance(value, str):
|
||||
return "'" + value + "'"
|
||||
else:
|
||||
raise 'no toml'
|
||||
raise RuntimeError('no toml')
|
||||
|
||||
|
||||
def configure_section(lines, config):
|
||||
for key in config:
|
||||
|
@ -375,10 +388,11 @@ def configure_section(lines, config):
|
|||
if not found:
|
||||
raise RuntimeError("failed to find config line for {}".format(key))
|
||||
|
||||
|
||||
for section_key in config:
|
||||
section_config = config[section_key]
|
||||
if not section_key in sections:
|
||||
raise RuntimeError("config key {} not in sections".format(key))
|
||||
if section_key not in sections:
|
||||
raise RuntimeError("config key {} not in sections".format(section_key))
|
||||
|
||||
if section_key == 'target':
|
||||
for target in section_config:
|
||||
|
@ -407,11 +421,6 @@ with open('Makefile', 'w') as f:
|
|||
contents = contents.replace("$(CFG_PYTHON)", sys.executable)
|
||||
f.write(contents)
|
||||
|
||||
# Finally, clean up with a bit of a help message
|
||||
relpath = os.path.dirname(__file__)
|
||||
if relpath == '':
|
||||
relpath = '.'
|
||||
|
||||
p("")
|
||||
p("run `python {}/x.py --help`".format(relpath))
|
||||
p("run `python {}/x.py --help`".format(rust_dir))
|
||||
p("")
|
||||
|
|
|
@ -176,7 +176,7 @@ fn make_win_dist(
|
|||
}
|
||||
}
|
||||
|
||||
let target_tools = ["gcc.exe", "ld.exe", "ar.exe", "dlltool.exe", "libwinpthread-1.dll"];
|
||||
let target_tools = ["gcc.exe", "ld.exe", "dlltool.exe", "libwinpthread-1.dll"];
|
||||
let mut rustc_dlls = vec!["libstdc++-6.dll", "libwinpthread-1.dll"];
|
||||
if target_triple.starts_with("i686-") {
|
||||
rustc_dlls.push("libgcc_s_dw2-1.dll");
|
||||
|
@ -630,7 +630,7 @@ impl Step for Analysis {
|
|||
let image = tmpdir(build).join(format!("{}-{}-image", name, target));
|
||||
|
||||
let src = build.stage_out(compiler, Mode::Libstd)
|
||||
.join(target).join("release").join("deps");
|
||||
.join(target).join(build.cargo_dir()).join("deps");
|
||||
|
||||
let image_src = src.join("save-analysis");
|
||||
let dst = image.join("lib/rustlib").join(target).join("analysis");
|
||||
|
@ -738,7 +738,6 @@ impl Step for Src {
|
|||
"src/liballoc_jemalloc",
|
||||
"src/liballoc_system",
|
||||
"src/libbacktrace",
|
||||
"src/libcollections",
|
||||
"src/libcompiler_builtins",
|
||||
"src/libcore",
|
||||
"src/liblibc",
|
||||
|
@ -1035,7 +1034,7 @@ pub struct Rls {
|
|||
}
|
||||
|
||||
impl Step for Rls {
|
||||
type Output = PathBuf;
|
||||
type Output = Option<PathBuf>;
|
||||
const ONLY_BUILD_TARGETS: bool = true;
|
||||
const ONLY_HOSTS: bool = true;
|
||||
|
||||
|
@ -1050,12 +1049,17 @@ impl Step for Rls {
|
|||
});
|
||||
}
|
||||
|
||||
fn run(self, builder: &Builder) -> PathBuf {
|
||||
fn run(self, builder: &Builder) -> Option<PathBuf> {
|
||||
let build = builder.build;
|
||||
let stage = self.stage;
|
||||
let target = self.target;
|
||||
assert!(build.config.extended);
|
||||
|
||||
if !builder.config.toolstate.rls.testing() {
|
||||
println!("skipping Dist RLS stage{} ({})", stage, target);
|
||||
return None
|
||||
}
|
||||
|
||||
println!("Dist RLS stage{} ({})", stage, target);
|
||||
let src = build.src.join("src/tools/rls");
|
||||
let release_num = build.release_num("rls");
|
||||
|
@ -1068,10 +1072,12 @@ impl Step for Rls {
|
|||
t!(fs::create_dir_all(&image));
|
||||
|
||||
// Prepare the image directory
|
||||
// We expect RLS to build, because we've exited this step above if tool
|
||||
// state for RLS isn't testing.
|
||||
let rls = builder.ensure(tool::Rls {
|
||||
compiler: builder.compiler(stage, build.build),
|
||||
target
|
||||
});
|
||||
}).expect("Rls to build: toolstate is testing");
|
||||
install(&rls, &image.join("bin"), 0o755);
|
||||
let doc = image.join("share/doc/rls");
|
||||
install(&src.join("README.md"), &doc, 0o644);
|
||||
|
@ -1102,7 +1108,7 @@ impl Step for Rls {
|
|||
.arg("--component-name=rls-preview");
|
||||
|
||||
build.run(&mut cmd);
|
||||
distdir(build).join(format!("{}-{}.tar.gz", name, target))
|
||||
Some(distdir(build).join(format!("{}-{}.tar.gz", name, target)))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1202,8 +1208,12 @@ impl Step for Extended {
|
|||
// upgrades rustc was upgraded before rust-std. To avoid rustc clobbering
|
||||
// the std files during uninstall. To do this ensure that rustc comes
|
||||
// before rust-std in the list below.
|
||||
let mut tarballs = vec![rustc_installer, cargo_installer, rls_installer,
|
||||
analysis_installer, std_installer];
|
||||
let mut tarballs = Vec::new();
|
||||
tarballs.push(rustc_installer);
|
||||
tarballs.push(cargo_installer);
|
||||
tarballs.extend(rls_installer.clone());
|
||||
tarballs.push(analysis_installer);
|
||||
tarballs.push(std_installer);
|
||||
if build.config.docs {
|
||||
tarballs.push(docs_installer);
|
||||
}
|
||||
|
@ -1245,35 +1255,38 @@ impl Step for Extended {
|
|||
}
|
||||
rtf.push_str("}");
|
||||
|
||||
fn filter(contents: &str, marker: &str) -> String {
|
||||
let start = format!("tool-{}-start", marker);
|
||||
let end = format!("tool-{}-end", marker);
|
||||
let mut lines = Vec::new();
|
||||
let mut omitted = false;
|
||||
for line in contents.lines() {
|
||||
if line.contains(&start) {
|
||||
omitted = true;
|
||||
} else if line.contains(&end) {
|
||||
omitted = false;
|
||||
} else if !omitted {
|
||||
lines.push(line);
|
||||
}
|
||||
}
|
||||
|
||||
lines.join("\n")
|
||||
}
|
||||
|
||||
let xform = |p: &Path| {
|
||||
let mut contents = String::new();
|
||||
t!(t!(File::open(p)).read_to_string(&mut contents));
|
||||
if rls_installer.is_none() {
|
||||
contents = filter(&contents, "rls");
|
||||
}
|
||||
let ret = tmp.join(p.file_name().unwrap());
|
||||
t!(t!(File::create(&ret)).write_all(contents.as_bytes()));
|
||||
return ret
|
||||
};
|
||||
|
||||
if target.contains("apple-darwin") {
|
||||
let pkg = tmp.join("pkg");
|
||||
let _ = fs::remove_dir_all(&pkg);
|
||||
t!(fs::create_dir_all(pkg.join("rustc")));
|
||||
t!(fs::create_dir_all(pkg.join("cargo")));
|
||||
t!(fs::create_dir_all(pkg.join("rust-docs")));
|
||||
t!(fs::create_dir_all(pkg.join("rust-std")));
|
||||
t!(fs::create_dir_all(pkg.join("rls")));
|
||||
t!(fs::create_dir_all(pkg.join("rust-analysis")));
|
||||
|
||||
cp_r(&work.join(&format!("{}-{}", pkgname(build, "rustc"), target)),
|
||||
&pkg.join("rustc"));
|
||||
cp_r(&work.join(&format!("{}-{}", pkgname(build, "cargo"), target)),
|
||||
&pkg.join("cargo"));
|
||||
cp_r(&work.join(&format!("{}-{}", pkgname(build, "rust-docs"), target)),
|
||||
&pkg.join("rust-docs"));
|
||||
cp_r(&work.join(&format!("{}-{}", pkgname(build, "rust-std"), target)),
|
||||
&pkg.join("rust-std"));
|
||||
cp_r(&work.join(&format!("{}-{}", pkgname(build, "rls"), target)),
|
||||
&pkg.join("rls"));
|
||||
cp_r(&work.join(&format!("{}-{}", pkgname(build, "rust-analysis"), target)),
|
||||
&pkg.join("rust-analysis"));
|
||||
|
||||
install(&etc.join("pkg/postinstall"), &pkg.join("rustc"), 0o755);
|
||||
install(&etc.join("pkg/postinstall"), &pkg.join("cargo"), 0o755);
|
||||
install(&etc.join("pkg/postinstall"), &pkg.join("rust-docs"), 0o755);
|
||||
install(&etc.join("pkg/postinstall"), &pkg.join("rust-std"), 0o755);
|
||||
install(&etc.join("pkg/postinstall"), &pkg.join("rls"), 0o755);
|
||||
install(&etc.join("pkg/postinstall"), &pkg.join("rust-analysis"), 0o755);
|
||||
|
||||
let pkgbuild = |component: &str| {
|
||||
let mut cmd = Command::new("pkgbuild");
|
||||
|
@ -1283,12 +1296,23 @@ impl Step for Extended {
|
|||
.arg(pkg.join(component).with_extension("pkg"));
|
||||
build.run(&mut cmd);
|
||||
};
|
||||
pkgbuild("rustc");
|
||||
pkgbuild("cargo");
|
||||
pkgbuild("rust-docs");
|
||||
pkgbuild("rust-std");
|
||||
pkgbuild("rls");
|
||||
pkgbuild("rust-analysis");
|
||||
|
||||
let prepare = |name: &str| {
|
||||
t!(fs::create_dir_all(pkg.join(name)));
|
||||
cp_r(&work.join(&format!("{}-{}", pkgname(build, name), target)),
|
||||
&pkg.join(name));
|
||||
install(&etc.join("pkg/postinstall"), &pkg.join(name), 0o755);
|
||||
pkgbuild(name);
|
||||
};
|
||||
prepare("rustc");
|
||||
prepare("cargo");
|
||||
prepare("rust-docs");
|
||||
prepare("rust-std");
|
||||
prepare("rust-analysis");
|
||||
|
||||
if rls_installer.is_some() {
|
||||
prepare("rls");
|
||||
}
|
||||
|
||||
// create an 'uninstall' package
|
||||
install(&etc.join("pkg/postinstall"), &pkg.join("uninstall"), 0o755);
|
||||
|
@ -1298,7 +1322,7 @@ impl Step for Extended {
|
|||
t!(t!(File::create(pkg.join("res/LICENSE.txt"))).write_all(license.as_bytes()));
|
||||
install(&etc.join("gfx/rust-logo.png"), &pkg.join("res"), 0o644);
|
||||
let mut cmd = Command::new("productbuild");
|
||||
cmd.arg("--distribution").arg(etc.join("pkg/Distribution.xml"))
|
||||
cmd.arg("--distribution").arg(xform(&etc.join("pkg/Distribution.xml")))
|
||||
.arg("--resources").arg(pkg.join("res"))
|
||||
.arg(distdir(build).join(format!("{}-{}.pkg",
|
||||
pkgname(build, "rust"),
|
||||
|
@ -1310,46 +1334,34 @@ impl Step for Extended {
|
|||
if target.contains("windows") {
|
||||
let exe = tmp.join("exe");
|
||||
let _ = fs::remove_dir_all(&exe);
|
||||
t!(fs::create_dir_all(exe.join("rustc")));
|
||||
t!(fs::create_dir_all(exe.join("cargo")));
|
||||
t!(fs::create_dir_all(exe.join("rls")));
|
||||
t!(fs::create_dir_all(exe.join("rust-analysis")));
|
||||
t!(fs::create_dir_all(exe.join("rust-docs")));
|
||||
t!(fs::create_dir_all(exe.join("rust-std")));
|
||||
cp_r(&work.join(&format!("{}-{}", pkgname(build, "rustc"), target))
|
||||
.join("rustc"),
|
||||
&exe.join("rustc"));
|
||||
cp_r(&work.join(&format!("{}-{}", pkgname(build, "cargo"), target))
|
||||
.join("cargo"),
|
||||
&exe.join("cargo"));
|
||||
cp_r(&work.join(&format!("{}-{}", pkgname(build, "rust-docs"), target))
|
||||
.join("rust-docs"),
|
||||
&exe.join("rust-docs"));
|
||||
cp_r(&work.join(&format!("{}-{}", pkgname(build, "rust-std"), target))
|
||||
.join(format!("rust-std-{}", target)),
|
||||
&exe.join("rust-std"));
|
||||
cp_r(&work.join(&format!("{}-{}", pkgname(build, "rls"), target)).join("rls-preview"),
|
||||
&exe.join("rls"));
|
||||
cp_r(&work.join(&format!("{}-{}", pkgname(build, "rust-analysis"), target))
|
||||
.join(format!("rust-analysis-{}", target)),
|
||||
&exe.join("rust-analysis"));
|
||||
|
||||
t!(fs::remove_file(exe.join("rustc/manifest.in")));
|
||||
t!(fs::remove_file(exe.join("cargo/manifest.in")));
|
||||
t!(fs::remove_file(exe.join("rust-docs/manifest.in")));
|
||||
t!(fs::remove_file(exe.join("rust-std/manifest.in")));
|
||||
t!(fs::remove_file(exe.join("rls/manifest.in")));
|
||||
t!(fs::remove_file(exe.join("rust-analysis/manifest.in")));
|
||||
|
||||
let prepare = |name: &str| {
|
||||
t!(fs::create_dir_all(exe.join(name)));
|
||||
let dir = if name == "rust-std" || name == "rust-analysis" {
|
||||
format!("{}-{}", name, target)
|
||||
} else if name == "rls" {
|
||||
"rls-preview".to_string()
|
||||
} else {
|
||||
name.to_string()
|
||||
};
|
||||
cp_r(&work.join(&format!("{}-{}", pkgname(build, name), target))
|
||||
.join(dir),
|
||||
&exe.join(name));
|
||||
t!(fs::remove_file(exe.join(name).join("manifest.in")));
|
||||
};
|
||||
prepare("rustc");
|
||||
prepare("cargo");
|
||||
prepare("rust-analysis");
|
||||
prepare("rust-docs");
|
||||
prepare("rust-std");
|
||||
if rls_installer.is_some() {
|
||||
prepare("rls");
|
||||
}
|
||||
if target.contains("windows-gnu") {
|
||||
t!(fs::create_dir_all(exe.join("rust-mingw")));
|
||||
cp_r(&work.join(&format!("{}-{}", pkgname(build, "rust-mingw"), target))
|
||||
.join("rust-mingw"),
|
||||
&exe.join("rust-mingw"));
|
||||
t!(fs::remove_file(exe.join("rust-mingw/manifest.in")));
|
||||
prepare("rust-mingw");
|
||||
}
|
||||
|
||||
install(&etc.join("exe/rust.iss"), &exe, 0o644);
|
||||
install(&xform(&etc.join("exe/rust.iss")), &exe, 0o644);
|
||||
install(&etc.join("exe/modpath.iss"), &exe, 0o644);
|
||||
install(&etc.join("exe/upgrade.iss"), &exe, 0o644);
|
||||
install(&etc.join("gfx/rust-logo.ico"), &exe, 0o644);
|
||||
|
@ -1413,16 +1425,18 @@ impl Step for Extended {
|
|||
.arg("-dr").arg("Std")
|
||||
.arg("-var").arg("var.StdDir")
|
||||
.arg("-out").arg(exe.join("StdGroup.wxs")));
|
||||
build.run(Command::new(&heat)
|
||||
.current_dir(&exe)
|
||||
.arg("dir")
|
||||
.arg("rls")
|
||||
.args(&heat_flags)
|
||||
.arg("-cg").arg("RlsGroup")
|
||||
.arg("-dr").arg("Rls")
|
||||
.arg("-var").arg("var.RlsDir")
|
||||
.arg("-out").arg(exe.join("RlsGroup.wxs"))
|
||||
.arg("-t").arg(etc.join("msi/remove-duplicates.xsl")));
|
||||
if rls_installer.is_some() {
|
||||
build.run(Command::new(&heat)
|
||||
.current_dir(&exe)
|
||||
.arg("dir")
|
||||
.arg("rls")
|
||||
.args(&heat_flags)
|
||||
.arg("-cg").arg("RlsGroup")
|
||||
.arg("-dr").arg("Rls")
|
||||
.arg("-var").arg("var.RlsDir")
|
||||
.arg("-out").arg(exe.join("RlsGroup.wxs"))
|
||||
.arg("-t").arg(etc.join("msi/remove-duplicates.xsl")));
|
||||
}
|
||||
build.run(Command::new(&heat)
|
||||
.current_dir(&exe)
|
||||
.arg("dir")
|
||||
|
@ -1456,26 +1470,30 @@ impl Step for Extended {
|
|||
.arg("-dDocsDir=rust-docs")
|
||||
.arg("-dCargoDir=cargo")
|
||||
.arg("-dStdDir=rust-std")
|
||||
.arg("-dRlsDir=rls")
|
||||
.arg("-dAnalysisDir=rust-analysis")
|
||||
.arg("-arch").arg(&arch)
|
||||
.arg("-out").arg(&output)
|
||||
.arg(&input);
|
||||
add_env(build, &mut cmd, target);
|
||||
|
||||
if rls_installer.is_some() {
|
||||
cmd.arg("-dRlsDir=rls");
|
||||
}
|
||||
if target.contains("windows-gnu") {
|
||||
cmd.arg("-dGccDir=rust-mingw");
|
||||
}
|
||||
build.run(&mut cmd);
|
||||
};
|
||||
candle(&etc.join("msi/rust.wxs"));
|
||||
candle(&xform(&etc.join("msi/rust.wxs")));
|
||||
candle(&etc.join("msi/ui.wxs"));
|
||||
candle(&etc.join("msi/rustwelcomedlg.wxs"));
|
||||
candle("RustcGroup.wxs".as_ref());
|
||||
candle("DocsGroup.wxs".as_ref());
|
||||
candle("CargoGroup.wxs".as_ref());
|
||||
candle("StdGroup.wxs".as_ref());
|
||||
candle("RlsGroup.wxs".as_ref());
|
||||
if rls_installer.is_some() {
|
||||
candle("RlsGroup.wxs".as_ref());
|
||||
}
|
||||
candle("AnalysisGroup.wxs".as_ref());
|
||||
|
||||
if target.contains("windows-gnu") {
|
||||
|
@ -1499,10 +1517,13 @@ impl Step for Extended {
|
|||
.arg("DocsGroup.wixobj")
|
||||
.arg("CargoGroup.wixobj")
|
||||
.arg("StdGroup.wixobj")
|
||||
.arg("RlsGroup.wixobj")
|
||||
.arg("AnalysisGroup.wixobj")
|
||||
.current_dir(&exe);
|
||||
|
||||
if rls_installer.is_some() {
|
||||
cmd.arg("RlsGroup.wixobj");
|
||||
}
|
||||
|
||||
if target.contains("windows-gnu") {
|
||||
cmd.arg("GccGroup.wixobj");
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ macro_rules! book {
|
|||
}
|
||||
|
||||
book!(
|
||||
Nomicon, "src/doc/book", "nomicon";
|
||||
Nomicon, "src/doc/nomicon", "nomicon";
|
||||
Reference, "src/doc/reference", "reference";
|
||||
Rustdoc, "src/doc/rustdoc", "rustdoc";
|
||||
);
|
||||
|
@ -490,7 +490,7 @@ impl Step for Std {
|
|||
// for which docs must be built.
|
||||
if !build.config.compiler_docs {
|
||||
cargo.arg("--no-deps");
|
||||
for krate in &["alloc", "collections", "core", "std", "std_unicode"] {
|
||||
for krate in &["alloc", "core", "std", "std_unicode"] {
|
||||
cargo.arg("-p").arg(krate);
|
||||
// Create all crate output directories first to make sure rustdoc uses
|
||||
// relative links.
|
||||
|
@ -623,11 +623,9 @@ impl Step for Rustc {
|
|||
compile::rustc_cargo(build, &compiler, target, &mut cargo);
|
||||
|
||||
if build.config.compiler_docs {
|
||||
// src/rustc/Cargo.toml contains bin crates called rustc and rustdoc
|
||||
// which would otherwise overwrite the docs for the real rustc and
|
||||
// rustdoc lib crates.
|
||||
cargo.arg("-p").arg("rustc_driver")
|
||||
.arg("-p").arg("rustdoc");
|
||||
// src/rustc/Cargo.toml contains a bin crate called rustc which
|
||||
// would otherwise overwrite the docs for the real rustc lib crate.
|
||||
cargo.arg("-p").arg("rustc_driver");
|
||||
} else {
|
||||
// Like with libstd above if compiler docs aren't enabled then we're not
|
||||
// documenting internal dependencies, so we have a whitelist.
|
||||
|
|
|
@ -240,10 +240,11 @@ pub struct Build {
|
|||
lldb_python_dir: Option<String>,
|
||||
|
||||
// Runtime state filled in later on
|
||||
// target -> (cc, ar)
|
||||
cc: HashMap<Interned<String>, (cc::Tool, Option<PathBuf>)>,
|
||||
// host -> (cc, ar)
|
||||
// C/C++ compilers and archiver for all targets
|
||||
cc: HashMap<Interned<String>, cc::Tool>,
|
||||
cxx: HashMap<Interned<String>, cc::Tool>,
|
||||
ar: HashMap<Interned<String>, PathBuf>,
|
||||
// Misc
|
||||
crates: HashMap<Interned<String>, Crate>,
|
||||
is_sudo: bool,
|
||||
ci_env: CiEnv,
|
||||
|
@ -324,6 +325,7 @@ impl Build {
|
|||
rls_info,
|
||||
cc: HashMap::new(),
|
||||
cxx: HashMap::new(),
|
||||
ar: HashMap::new(),
|
||||
crates: HashMap::new(),
|
||||
lldb_version: None,
|
||||
lldb_python_dir: None,
|
||||
|
@ -383,16 +385,19 @@ impl Build {
|
|||
/// Clear out `dir` if `input` is newer.
|
||||
///
|
||||
/// After this executes, it will also ensure that `dir` exists.
|
||||
fn clear_if_dirty(&self, dir: &Path, input: &Path) {
|
||||
fn clear_if_dirty(&self, dir: &Path, input: &Path) -> bool {
|
||||
let stamp = dir.join(".stamp");
|
||||
let mut cleared = false;
|
||||
if mtime(&stamp) < mtime(input) {
|
||||
self.verbose(&format!("Dirty - {}", dir.display()));
|
||||
let _ = fs::remove_dir_all(dir);
|
||||
cleared = true;
|
||||
} else if stamp.exists() {
|
||||
return
|
||||
return cleared;
|
||||
}
|
||||
t!(fs::create_dir_all(dir));
|
||||
t!(File::create(stamp));
|
||||
cleared
|
||||
}
|
||||
|
||||
/// Get the space-separated set of activated features for the standard
|
||||
|
@ -433,6 +438,12 @@ impl Build {
|
|||
if self.config.rust_optimize {"release"} else {"debug"}
|
||||
}
|
||||
|
||||
fn tools_dir(&self, compiler: Compiler) -> PathBuf {
|
||||
let out = self.out.join(&*compiler.host).join(format!("stage{}-tools-bin", compiler.stage));
|
||||
t!(fs::create_dir_all(&out));
|
||||
out
|
||||
}
|
||||
|
||||
/// Get the directory for incremental by-products when using the
|
||||
/// given compiler.
|
||||
fn incremental_dir(&self, compiler: Compiler) -> PathBuf {
|
||||
|
@ -612,7 +623,7 @@ impl Build {
|
|||
|
||||
/// Returns the path to the C compiler for the target specified.
|
||||
fn cc(&self, target: Interned<String>) -> &Path {
|
||||
self.cc[&target].0.path()
|
||||
self.cc[&target].path()
|
||||
}
|
||||
|
||||
/// Returns a list of flags to pass to the C compiler for the target
|
||||
|
@ -620,7 +631,7 @@ impl Build {
|
|||
fn cflags(&self, target: Interned<String>) -> Vec<String> {
|
||||
// Filter out -O and /O (the optimization flags) that we picked up from
|
||||
// cc-rs because the build scripts will determine that for themselves.
|
||||
let mut base = self.cc[&target].0.args().iter()
|
||||
let mut base = self.cc[&target].args().iter()
|
||||
.map(|s| s.to_string_lossy().into_owned())
|
||||
.filter(|s| !s.starts_with("-O") && !s.starts_with("/O"))
|
||||
.collect::<Vec<_>>();
|
||||
|
@ -644,7 +655,7 @@ impl Build {
|
|||
|
||||
/// Returns the path to the `ar` archive utility for the target specified.
|
||||
fn ar(&self, target: Interned<String>) -> Option<&Path> {
|
||||
self.cc[&target].1.as_ref().map(|p| &**p)
|
||||
self.ar.get(&target).map(|p| &**p)
|
||||
}
|
||||
|
||||
/// Returns the path to the C++ compiler for the target specified.
|
||||
|
@ -657,21 +668,17 @@ impl Build {
|
|||
}
|
||||
}
|
||||
|
||||
/// Returns flags to pass to the compiler to generate code for `target`.
|
||||
fn rustc_flags(&self, target: Interned<String>) -> Vec<String> {
|
||||
// New flags should be added here with great caution!
|
||||
//
|
||||
// It's quite unfortunate to **require** flags to generate code for a
|
||||
// target, so it should only be passed here if absolutely necessary!
|
||||
// Most default configuration should be done through target specs rather
|
||||
// than an entry here.
|
||||
|
||||
let mut base = Vec::new();
|
||||
if target != self.config.build && !target.contains("msvc") &&
|
||||
!target.contains("emscripten") {
|
||||
base.push(format!("-Clinker={}", self.cc(target).display()));
|
||||
/// Returns the path to the linker for the given target if it needs to be overriden.
|
||||
fn linker(&self, target: Interned<String>) -> Option<&Path> {
|
||||
if let Some(linker) = self.config.target_config.get(&target)
|
||||
.and_then(|c| c.linker.as_ref()) {
|
||||
Some(linker)
|
||||
} else if target != self.config.build &&
|
||||
!target.contains("msvc") && !target.contains("emscripten") {
|
||||
Some(self.cc(target))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
base
|
||||
}
|
||||
|
||||
/// Returns if this target should statically link the C runtime, if specified
|
||||
|
|
|
@ -227,6 +227,13 @@ impl Step for Llvm {
|
|||
cfg.build_arg("-j").build_arg(build.jobs().to_string());
|
||||
cfg.define("CMAKE_C_FLAGS", build.cflags(target).join(" "));
|
||||
cfg.define("CMAKE_CXX_FLAGS", build.cflags(target).join(" "));
|
||||
if let Some(ar) = build.ar(target) {
|
||||
if ar.is_absolute() {
|
||||
// LLVM build breaks if `CMAKE_AR` is a relative path, for some reason it
|
||||
// tries to resolve this path in the LLVM build directory.
|
||||
cfg.define("CMAKE_AR", sanitize_cc(ar));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
configure_compilers(&mut cfg);
|
||||
|
@ -252,11 +259,14 @@ fn check_llvm_version(build: &Build, llvm_config: &Path) {
|
|||
|
||||
let mut cmd = Command::new(llvm_config);
|
||||
let version = output(cmd.arg("--version"));
|
||||
if version.starts_with("3.5") || version.starts_with("3.6") ||
|
||||
version.starts_with("3.7") {
|
||||
return
|
||||
let mut parts = version.split('.').take(2)
|
||||
.filter_map(|s| s.parse::<u32>().ok());
|
||||
if let (Some(major), Some(minor)) = (parts.next(), parts.next()) {
|
||||
if major > 3 || (major == 3 && minor >= 9) {
|
||||
return
|
||||
}
|
||||
}
|
||||
panic!("\n\nbad LLVM version: {}, need >=3.5\n\n", version)
|
||||
panic!("\n\nbad LLVM version: {}, need >=3.9\n\n", version)
|
||||
}
|
||||
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
|
||||
|
@ -352,34 +362,51 @@ impl Step for Openssl {
|
|||
// originally from https://www.openssl.org/source/...
|
||||
let url = format!("https://s3-us-west-1.amazonaws.com/rust-lang-ci2/rust-ci-mirror/{}",
|
||||
name);
|
||||
let mut ok = false;
|
||||
let mut last_error = None;
|
||||
for _ in 0..3 {
|
||||
let status = Command::new("curl")
|
||||
.arg("-o").arg(&tmp)
|
||||
.arg("-f") // make curl fail if the URL does not return HTTP 200
|
||||
.arg(&url)
|
||||
.status()
|
||||
.expect("failed to spawn curl");
|
||||
if status.success() {
|
||||
ok = true;
|
||||
break
|
||||
|
||||
// Retry if download failed.
|
||||
if !status.success() {
|
||||
last_error = Some(status.to_string());
|
||||
continue;
|
||||
}
|
||||
|
||||
// Ensure the hash is correct.
|
||||
let mut shasum = if target.contains("apple") || build.build.contains("netbsd") {
|
||||
let mut cmd = Command::new("shasum");
|
||||
cmd.arg("-a").arg("256");
|
||||
cmd
|
||||
} else {
|
||||
Command::new("sha256sum")
|
||||
};
|
||||
let output = output(&mut shasum.arg(&tmp));
|
||||
let found = output.split_whitespace().next().unwrap();
|
||||
|
||||
// If the hash is wrong, probably the download is incomplete or S3 served an error
|
||||
// page. In any case, retry.
|
||||
if found != OPENSSL_SHA256 {
|
||||
last_error = Some(format!(
|
||||
"downloaded openssl sha256 different\n\
|
||||
expected: {}\n\
|
||||
found: {}\n",
|
||||
OPENSSL_SHA256,
|
||||
found
|
||||
));
|
||||
continue;
|
||||
}
|
||||
|
||||
// Everything is fine, so exit the retry loop.
|
||||
last_error = None;
|
||||
break;
|
||||
}
|
||||
if !ok {
|
||||
panic!("failed to download openssl source")
|
||||
}
|
||||
let mut shasum = if target.contains("apple") || build.build.contains("netbsd") {
|
||||
let mut cmd = Command::new("shasum");
|
||||
cmd.arg("-a").arg("256");
|
||||
cmd
|
||||
} else {
|
||||
Command::new("sha256sum")
|
||||
};
|
||||
let output = output(&mut shasum.arg(&tmp));
|
||||
let found = output.split_whitespace().next().unwrap();
|
||||
if found != OPENSSL_SHA256 {
|
||||
panic!("downloaded openssl sha256 different\n\
|
||||
expected: {}\n\
|
||||
found: {}\n", OPENSSL_SHA256, found);
|
||||
if let Some(error) = last_error {
|
||||
panic!("failed to download openssl source: {}", error);
|
||||
}
|
||||
t!(fs::rename(&tmp, &tarball));
|
||||
}
|
||||
|
|
|
@ -38,24 +38,40 @@ impl Step for CleanTools {
|
|||
run.never()
|
||||
}
|
||||
|
||||
/// Build a tool in `src/tools`
|
||||
///
|
||||
/// This will build the specified tool with the specified `host` compiler in
|
||||
/// `stage` into the normal cargo output directory.
|
||||
fn run(self, builder: &Builder) {
|
||||
let build = builder.build;
|
||||
let compiler = self.compiler;
|
||||
let target = self.target;
|
||||
let mode = self.mode;
|
||||
|
||||
let stamp = match mode {
|
||||
Mode::Libstd => libstd_stamp(build, compiler, target),
|
||||
Mode::Libtest => libtest_stamp(build, compiler, target),
|
||||
Mode::Librustc => librustc_stamp(build, compiler, target),
|
||||
_ => panic!(),
|
||||
// This is for the original compiler, but if we're forced to use stage 1, then
|
||||
// std/test/rustc stamps won't exist in stage 2, so we need to get those from stage 1, since
|
||||
// we copy the libs forward.
|
||||
let tools_dir = build.stage_out(compiler, Mode::Tool);
|
||||
let compiler = if builder.force_use_stage1(compiler, target) {
|
||||
builder.compiler(1, compiler.host)
|
||||
} else {
|
||||
compiler
|
||||
};
|
||||
let out_dir = build.cargo_out(compiler, Mode::Tool, target);
|
||||
build.clear_if_dirty(&out_dir, &stamp);
|
||||
|
||||
for &cur_mode in &[Mode::Libstd, Mode::Libtest, Mode::Librustc] {
|
||||
let stamp = match cur_mode {
|
||||
Mode::Libstd => libstd_stamp(build, compiler, target),
|
||||
Mode::Libtest => libtest_stamp(build, compiler, target),
|
||||
Mode::Librustc => librustc_stamp(build, compiler, target),
|
||||
_ => panic!(),
|
||||
};
|
||||
|
||||
if build.clear_if_dirty(&tools_dir, &stamp) {
|
||||
break;
|
||||
}
|
||||
|
||||
// If we are a rustc tool, and std changed, we also need to clear ourselves out -- our
|
||||
// dependencies depend on std. Therefore, we iterate up until our own mode.
|
||||
if mode == cur_mode {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -70,7 +86,7 @@ struct ToolBuild {
|
|||
}
|
||||
|
||||
impl Step for ToolBuild {
|
||||
type Output = PathBuf;
|
||||
type Output = Option<PathBuf>;
|
||||
|
||||
fn should_run(run: ShouldRun) -> ShouldRun {
|
||||
run.never()
|
||||
|
@ -80,7 +96,7 @@ impl Step for ToolBuild {
|
|||
///
|
||||
/// This will build the specified tool with the specified `host` compiler in
|
||||
/// `stage` into the normal cargo output directory.
|
||||
fn run(self, builder: &Builder) -> PathBuf {
|
||||
fn run(self, builder: &Builder) -> Option<PathBuf> {
|
||||
let build = builder.build;
|
||||
let compiler = self.compiler;
|
||||
let target = self.target;
|
||||
|
@ -100,7 +116,15 @@ impl Step for ToolBuild {
|
|||
|
||||
let mut cargo = prepare_tool_cargo(builder, compiler, target, "build", path);
|
||||
build.run_expecting(&mut cargo, expectation);
|
||||
build.cargo_out(compiler, Mode::Tool, target).join(exe(tool, &compiler.host))
|
||||
if expectation == BuildExpectation::Succeeding || expectation == BuildExpectation::None {
|
||||
let cargo_out = build.cargo_out(compiler, Mode::Tool, target)
|
||||
.join(exe(tool, &compiler.host));
|
||||
let bin = build.tools_dir(compiler).join(exe(tool, &compiler.host));
|
||||
copy(&cargo_out, &bin);
|
||||
Some(bin)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -169,12 +193,12 @@ macro_rules! tool {
|
|||
}
|
||||
|
||||
pub fn tool_default_stage(&self, tool: Tool) -> u32 {
|
||||
// Compile the error-index in the top stage as it depends on
|
||||
// rustdoc, so we want to avoid recompiling rustdoc twice if we
|
||||
// can. Otherwise compile everything else in stage0 as there's
|
||||
// no need to rebootstrap everything
|
||||
// Compile the error-index in the same stage as rustdoc to avoid
|
||||
// recompiling rustdoc twice if we can. Otherwise compile
|
||||
// everything else in stage0 as there's no need to rebootstrap
|
||||
// everything.
|
||||
match tool {
|
||||
Tool::ErrorIndex => self.top_stage,
|
||||
Tool::ErrorIndex if self.top_stage >= 2 => self.top_stage,
|
||||
_ => 0,
|
||||
}
|
||||
}
|
||||
|
@ -209,7 +233,7 @@ macro_rules! tool {
|
|||
mode: $mode,
|
||||
path: $path,
|
||||
expectation: BuildExpectation::None,
|
||||
})
|
||||
}).expect("expected to build -- BuildExpectation::None")
|
||||
}
|
||||
}
|
||||
)+
|
||||
|
@ -257,7 +281,7 @@ impl Step for RemoteTestServer {
|
|||
mode: Mode::Libstd,
|
||||
path: "src/tools/remote-test-server",
|
||||
expectation: BuildExpectation::None,
|
||||
})
|
||||
}).expect("expected to build -- BuildExpectation::None")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -375,7 +399,7 @@ impl Step for Cargo {
|
|||
mode: Mode::Librustc,
|
||||
path: "src/tools/cargo",
|
||||
expectation: BuildExpectation::None,
|
||||
})
|
||||
}).expect("BuildExpectation::None - expected to build")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -386,8 +410,8 @@ pub struct Clippy {
|
|||
}
|
||||
|
||||
impl Step for Clippy {
|
||||
type Output = PathBuf;
|
||||
const DEFAULT: bool = false;
|
||||
type Output = Option<PathBuf>;
|
||||
const DEFAULT: bool = true;
|
||||
const ONLY_HOSTS: bool = true;
|
||||
|
||||
fn should_run(run: ShouldRun) -> ShouldRun {
|
||||
|
@ -401,7 +425,7 @@ impl Step for Clippy {
|
|||
});
|
||||
}
|
||||
|
||||
fn run(self, builder: &Builder) -> PathBuf {
|
||||
fn run(self, builder: &Builder) -> Option<PathBuf> {
|
||||
// Clippy depends on procedural macros (serde), which requires a full host
|
||||
// compiler to be available, so we need to depend on that.
|
||||
builder.ensure(compile::Rustc {
|
||||
|
@ -411,7 +435,7 @@ impl Step for Clippy {
|
|||
builder.ensure(ToolBuild {
|
||||
compiler: self.compiler,
|
||||
target: self.target,
|
||||
tool: "clippy",
|
||||
tool: "clippy-driver",
|
||||
mode: Mode::Librustc,
|
||||
path: "src/tools/clippy",
|
||||
expectation: builder.build.config.toolstate.clippy.passes(ToolState::Compiling),
|
||||
|
@ -426,7 +450,7 @@ pub struct Rls {
|
|||
}
|
||||
|
||||
impl Step for Rls {
|
||||
type Output = PathBuf;
|
||||
type Output = Option<PathBuf>;
|
||||
const DEFAULT: bool = true;
|
||||
const ONLY_HOSTS: bool = true;
|
||||
|
||||
|
@ -442,7 +466,7 @@ impl Step for Rls {
|
|||
});
|
||||
}
|
||||
|
||||
fn run(self, builder: &Builder) -> PathBuf {
|
||||
fn run(self, builder: &Builder) -> Option<PathBuf> {
|
||||
builder.ensure(native::Openssl {
|
||||
target: self.target,
|
||||
});
|
||||
|
@ -470,7 +494,7 @@ pub struct Rustfmt {
|
|||
}
|
||||
|
||||
impl Step for Rustfmt {
|
||||
type Output = PathBuf;
|
||||
type Output = Option<PathBuf>;
|
||||
const DEFAULT: bool = true;
|
||||
const ONLY_HOSTS: bool = true;
|
||||
|
||||
|
@ -486,7 +510,7 @@ impl Step for Rustfmt {
|
|||
});
|
||||
}
|
||||
|
||||
fn run(self, builder: &Builder) -> PathBuf {
|
||||
fn run(self, builder: &Builder) -> Option<PathBuf> {
|
||||
builder.ensure(ToolBuild {
|
||||
compiler: self.compiler,
|
||||
target: self.target,
|
||||
|
@ -506,7 +530,7 @@ pub struct Miri {
|
|||
}
|
||||
|
||||
impl Step for Miri {
|
||||
type Output = PathBuf;
|
||||
type Output = Option<PathBuf>;
|
||||
const DEFAULT: bool = true;
|
||||
const ONLY_HOSTS: bool = true;
|
||||
|
||||
|
@ -522,7 +546,7 @@ impl Step for Miri {
|
|||
});
|
||||
}
|
||||
|
||||
fn run(self, builder: &Builder) -> PathBuf {
|
||||
fn run(self, builder: &Builder) -> Option<PathBuf> {
|
||||
builder.ensure(ToolBuild {
|
||||
compiler: self.compiler,
|
||||
target: self.target,
|
||||
|
@ -561,7 +585,7 @@ impl<'a> Builder<'a> {
|
|||
if compiler.host.contains("msvc") {
|
||||
let curpaths = env::var_os("PATH").unwrap_or_default();
|
||||
let curpaths = env::split_paths(&curpaths).collect::<Vec<_>>();
|
||||
for &(ref k, ref v) in self.cc[&compiler.host].0.env() {
|
||||
for &(ref k, ref v) in self.cc[&compiler.host].env() {
|
||||
if k != "PATH" {
|
||||
continue
|
||||
}
|
||||
|
|
|
@ -31,6 +31,13 @@ impl ToolState {
|
|||
BuildExpectation::Failing
|
||||
}
|
||||
}
|
||||
|
||||
pub fn testing(&self) -> bool {
|
||||
match *self {
|
||||
ToolState::Testing => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for ToolState {
|
||||
|
|
|
@ -14,8 +14,9 @@
|
|||
//! not a lot of interesting happenings here unfortunately.
|
||||
|
||||
use std::env;
|
||||
use std::fs;
|
||||
use std::io::{self, Write};
|
||||
use std::str;
|
||||
use std::fs::{self, File};
|
||||
use std::io::{self, Read, Write};
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::process::Command;
|
||||
use std::time::{SystemTime, Instant};
|
||||
|
@ -50,6 +51,22 @@ pub fn copy(src: &Path, dst: &Path) {
|
|||
t!(filetime::set_file_times(dst, atime, mtime));
|
||||
}
|
||||
|
||||
pub fn read_stamp_file(stamp: &Path) -> Vec<PathBuf> {
|
||||
let mut paths = Vec::new();
|
||||
let mut contents = Vec::new();
|
||||
t!(t!(File::open(stamp)).read_to_end(&mut contents));
|
||||
// This is the method we use for extracting paths from the stamp file passed to us. See
|
||||
// run_cargo for more information (in compile.rs).
|
||||
for part in contents.split(|b| *b == 0) {
|
||||
if part.is_empty() {
|
||||
continue
|
||||
}
|
||||
let path = PathBuf::from(t!(str::from_utf8(part)));
|
||||
paths.push(path);
|
||||
}
|
||||
paths
|
||||
}
|
||||
|
||||
/// Copies the `src` directory recursively to `dst`. Both are assumed to exist
|
||||
/// when this function is called.
|
||||
pub fn cp_r(src: &Path, dst: &Path) {
|
||||
|
|
|
@ -138,27 +138,6 @@ pub fn gnu_target(target: &str) -> String {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn cc2ar(cc: &Path, target: &str) -> Option<PathBuf> {
|
||||
if target.contains("msvc") {
|
||||
None
|
||||
} else if target.contains("musl") {
|
||||
Some(PathBuf::from("ar"))
|
||||
} else if target.contains("openbsd") {
|
||||
Some(PathBuf::from("ar"))
|
||||
} else {
|
||||
let parent = cc.parent().unwrap();
|
||||
let file = cc.file_name().unwrap().to_str().unwrap();
|
||||
for suffix in &["gcc", "cc", "clang"] {
|
||||
if let Some(idx) = file.rfind(suffix) {
|
||||
let mut file = file[..idx].to_owned();
|
||||
file.push_str("ar");
|
||||
return Some(parent.join(&file));
|
||||
}
|
||||
}
|
||||
Some(parent.join(file))
|
||||
}
|
||||
}
|
||||
|
||||
pub fn make(host: &str) -> PathBuf {
|
||||
if host.contains("bitrig") || host.contains("dragonfly") ||
|
||||
host.contains("freebsd") || host.contains("netbsd") ||
|
||||
|
|
|
@ -16,6 +16,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|||
COPY scripts/emscripten.sh /scripts/
|
||||
RUN bash /scripts/emscripten.sh
|
||||
|
||||
COPY scripts/sccache.sh /scripts/
|
||||
RUN sh /scripts/sccache.sh
|
||||
|
||||
ENV PATH=$PATH:/emsdk-portable
|
||||
ENV PATH=$PATH:/emsdk-portable/clang/e1.37.13_64bit/
|
||||
ENV PATH=$PATH:/emsdk-portable/emscripten/1.37.13/
|
||||
|
@ -28,7 +31,4 @@ ENV TARGETS=asmjs-unknown-emscripten
|
|||
|
||||
ENV RUST_CONFIGURE_ARGS --target=$TARGETS
|
||||
|
||||
ENV SCRIPT python2.7 ../x.py test --target $TARGETS
|
||||
|
||||
COPY scripts/sccache.sh /scripts/
|
||||
RUN sh /scripts/sccache.sh
|
||||
ENV SCRIPT python2.7 ../x.py test --target $TARGETS src/test/run-pass
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
set -ex
|
||||
|
||||
MUSL=1.1.16
|
||||
MUSL=1.1.17
|
||||
|
||||
hide_output() {
|
||||
set +x
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
FROM ubuntu:16.04
|
||||
|
||||
COPY scripts/cross-apt-packages.sh /scripts/
|
||||
RUN sh /scripts/cross-apt-packages.sh
|
||||
|
||||
RUN apt-get build-dep -y clang llvm && apt-get install -y --no-install-recommends \
|
||||
build-essential \
|
||||
gcc-multilib \
|
||||
libedit-dev \
|
||||
libgmp-dev \
|
||||
libisl-dev \
|
||||
libmpc-dev \
|
||||
libmpfr-dev \
|
||||
ninja-build \
|
||||
nodejs \
|
||||
python2.7-dev \
|
||||
software-properties-common \
|
||||
unzip
|
||||
|
||||
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-testing main'
|
||||
|
||||
WORKDIR /tmp
|
||||
COPY cross2/shared.sh cross2/build-fuchsia-toolchain.sh /tmp/
|
||||
COPY cross2/build-solaris-toolchain.sh /tmp/
|
||||
RUN /tmp/build-fuchsia-toolchain.sh
|
||||
RUN /tmp/build-solaris-toolchain.sh x86_64 amd64 solaris-i386
|
||||
RUN /tmp/build-solaris-toolchain.sh sparcv9 sparcv9 solaris-sparc
|
||||
|
||||
COPY scripts/sccache.sh /scripts/
|
||||
RUN sh /scripts/sccache.sh
|
||||
|
||||
ENV \
|
||||
AR_x86_64_unknown_fuchsia=x86_64-unknown-fuchsia-ar \
|
||||
CC_x86_64_unknown_fuchsia=x86_64-unknown-fuchsia-clang \
|
||||
CXX_x86_64_unknown_fuchsia=x86_64-unknown-fuchsia-clang++ \
|
||||
AR_aarch64_unknown_fuchsia=aarch64-unknown-fuchsia-ar \
|
||||
CC_aarch64_unknown_fuchsia=aarch64-unknown-fuchsia-clang \
|
||||
CXX_aarch64_unknown_fuchsia=aarch64-unknown-fuchsia-clang++ \
|
||||
AR_sparcv9_sun_solaris=sparcv9-sun-solaris2.10-ar \
|
||||
CC_sparcv9_sun_solaris=sparcv9-sun-solaris2.10-gcc \
|
||||
CXX_sparcv9_sun_solaris=sparcv9-sun-solaris2.10-g++ \
|
||||
AR_x86_64_sun_solaris=x86_64-sun-solaris2.10-ar \
|
||||
CC_x86_64_sun_solaris=x86_64-sun-solaris2.10-gcc \
|
||||
CXX_x86_64_sun_solaris=x86_64-sun-solaris2.10-g++
|
||||
|
||||
ENV TARGETS=x86_64-unknown-fuchsia
|
||||
ENV TARGETS=$TARGETS,aarch64-unknown-fuchsia
|
||||
ENV TARGETS=$TARGETS,sparcv9-sun-solaris
|
||||
ENV TARGETS=$TARGETS,x86_64-sun-solaris
|
||||
ENV TARGETS=$TARGETS,x86_64-unknown-linux-gnux32
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS --target=$TARGETS --enable-extended
|
||||
ENV SCRIPT python2.7 ../x.py dist --target $TARGETS
|
|
@ -0,0 +1,107 @@
|
|||
#!/bin/bash
|
||||
# Copyright 2016 The Rust Project Developers. See the COPYRIGHT
|
||||
# file at the top-level directory of this distribution and at
|
||||
# http://rust-lang.org/COPYRIGHT.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
# option. This file may not be copied, modified, or distributed
|
||||
# except according to those terms.
|
||||
|
||||
set -ex
|
||||
source shared.sh
|
||||
|
||||
ARCH=$1
|
||||
LIB_ARCH=$2
|
||||
APT_ARCH=$3
|
||||
BINUTILS=2.28.1
|
||||
GCC=6.4.0
|
||||
|
||||
# First up, build binutils
|
||||
mkdir binutils
|
||||
cd binutils
|
||||
|
||||
curl https://ftp.gnu.org/gnu/binutils/binutils-$BINUTILS.tar.xz | tar xJf -
|
||||
mkdir binutils-build
|
||||
cd binutils-build
|
||||
hide_output ../binutils-$BINUTILS/configure --target=$ARCH-sun-solaris2.10
|
||||
hide_output make -j10
|
||||
hide_output make install
|
||||
|
||||
cd ../..
|
||||
rm -rf binutils
|
||||
|
||||
# Next, download and install the relevant solaris packages
|
||||
mkdir solaris
|
||||
cd solaris
|
||||
|
||||
dpkg --add-architecture $APT_ARCH
|
||||
apt-get update
|
||||
apt-get download $(apt-cache depends --recurse --no-replaces \
|
||||
libc-dev:$APT_ARCH \
|
||||
libm-dev:$APT_ARCH \
|
||||
libpthread-dev:$APT_ARCH \
|
||||
libresolv-dev:$APT_ARCH \
|
||||
librt-dev:$APT_ARCH \
|
||||
libsocket-dev:$APT_ARCH \
|
||||
system-crt:$APT_ARCH \
|
||||
system-header:$APT_ARCH \
|
||||
| grep "^\w")
|
||||
|
||||
for deb in *$APT_ARCH.deb; do
|
||||
dpkg -x $deb .
|
||||
done
|
||||
|
||||
# Remove Solaris 11 functions that are optionally used by libbacktrace.
|
||||
# This is for Solaris 10 compatibility.
|
||||
rm usr/include/link.h
|
||||
patch -p0 << 'EOF'
|
||||
--- usr/include/string.h
|
||||
+++ usr/include/string10.h
|
||||
@@ -93 +92,0 @@
|
||||
-extern size_t strnlen(const char *, size_t);
|
||||
EOF
|
||||
|
||||
mkdir /usr/local/$ARCH-sun-solaris2.10/usr
|
||||
mv usr/include /usr/local/$ARCH-sun-solaris2.10/usr/include
|
||||
mv usr/lib/$LIB_ARCH/* /usr/local/$ARCH-sun-solaris2.10/lib
|
||||
mv lib/$LIB_ARCH/* /usr/local/$ARCH-sun-solaris2.10/lib
|
||||
|
||||
ln -s usr/include /usr/local/$ARCH-sun-solaris2.10/sys-include
|
||||
ln -s usr/include /usr/local/$ARCH-sun-solaris2.10/include
|
||||
|
||||
cd ..
|
||||
rm -rf solaris
|
||||
|
||||
# Finally, download and build gcc to target solaris
|
||||
mkdir gcc
|
||||
cd gcc
|
||||
|
||||
curl https://ftp.gnu.org/gnu/gcc/gcc-$GCC/gcc-$GCC.tar.xz | tar xJf -
|
||||
cd gcc-$GCC
|
||||
|
||||
mkdir ../gcc-build
|
||||
cd ../gcc-build
|
||||
hide_output ../gcc-$GCC/configure \
|
||||
--enable-languages=c,c++ \
|
||||
--target=$ARCH-sun-solaris2.10 \
|
||||
--with-gnu-as \
|
||||
--with-gnu-ld \
|
||||
--disable-multilib \
|
||||
--disable-nls \
|
||||
--disable-libgomp \
|
||||
--disable-libquadmath \
|
||||
--disable-libssp \
|
||||
--disable-libvtv \
|
||||
--disable-libcilkrts \
|
||||
--disable-libada \
|
||||
--disable-libsanitizer \
|
||||
--disable-libquadmath-support \
|
||||
--disable-lto
|
||||
|
||||
hide_output make -j10
|
||||
hide_output make install
|
||||
|
||||
cd ../..
|
||||
rm -rf gcc
|
|
@ -1,41 +0,0 @@
|
|||
FROM ubuntu:16.04
|
||||
|
||||
RUN apt-get update && apt-get build-dep -y clang llvm && apt-get install -y \
|
||||
build-essential \
|
||||
bzip2 \
|
||||
ca-certificates \
|
||||
cmake \
|
||||
curl \
|
||||
file \
|
||||
g++ \
|
||||
gdb \
|
||||
git \
|
||||
libedit-dev \
|
||||
make \
|
||||
ninja-build \
|
||||
nodejs \
|
||||
python2.7-dev \
|
||||
sudo \
|
||||
xz-utils \
|
||||
unzip
|
||||
|
||||
WORKDIR /tmp
|
||||
COPY dist-fuchsia/shared.sh dist-fuchsia/build-toolchain.sh /tmp/
|
||||
RUN /tmp/build-toolchain.sh
|
||||
|
||||
COPY scripts/sccache.sh /scripts/
|
||||
RUN sh /scripts/sccache.sh
|
||||
|
||||
ENV \
|
||||
AR_x86_64_unknown_fuchsia=x86_64-unknown-fuchsia-ar \
|
||||
CC_x86_64_unknown_fuchsia=x86_64-unknown-fuchsia-clang \
|
||||
CXX_x86_64_unknown_fuchsia=x86_64-unknown-fuchsia-clang++ \
|
||||
AR_aarch64_unknown_fuchsia=aarch64-unknown-fuchsia-ar \
|
||||
CC_aarch64_unknown_fuchsia=aarch64-unknown-fuchsia-clang \
|
||||
CXX_aarch64_unknown_fuchsia=aarch64-unknown-fuchsia-clang++
|
||||
|
||||
ENV TARGETS=x86_64-unknown-fuchsia
|
||||
ENV TARGETS=$TARGETS,aarch64-unknown-fuchsia
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS --target=$TARGETS --enable-extended
|
||||
ENV SCRIPT python2.7 ../x.py dist --target $TARGETS
|
|
@ -15,7 +15,7 @@ set -ex
|
|||
export CFLAGS="-fPIC -Wa,-mrelax-relocations=no"
|
||||
export CXXFLAGS="-Wa,-mrelax-relocations=no"
|
||||
|
||||
MUSL=musl-1.1.16
|
||||
MUSL=musl-1.1.17
|
||||
curl https://www.musl-libc.org/releases/$MUSL.tar.gz | tar xzf -
|
||||
cd $MUSL
|
||||
CC=gcc \
|
||||
|
|
|
@ -15,7 +15,7 @@ set -ex
|
|||
export CFLAGS="-fPIC -Wa,-mrelax-relocations=no"
|
||||
export CXXFLAGS="-Wa,-mrelax-relocations=no"
|
||||
|
||||
MUSL=musl-1.1.16
|
||||
MUSL=musl-1.1.17
|
||||
curl https://www.musl-libc.org/releases/$MUSL.tar.gz | tar xzf -
|
||||
cd $MUSL
|
||||
./configure --prefix=/musl-x86_64 --disable-shared
|
||||
|
|
|
@ -31,7 +31,7 @@ download_sysimage() {
|
|||
# Keep printing yes to accept the licenses
|
||||
while true; do echo yes; sleep 10; done | \
|
||||
/android/sdk/tools/android update sdk -a --no-ui \
|
||||
--filter "$filter"
|
||||
--filter "$filter" --no-https
|
||||
}
|
||||
|
||||
create_avd() {
|
||||
|
|
|
@ -11,7 +11,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|||
cmake \
|
||||
sudo \
|
||||
gdb \
|
||||
llvm-3.7-tools \
|
||||
llvm-3.9-tools \
|
||||
libedit-dev \
|
||||
zlib1g-dev \
|
||||
xz-utils
|
||||
|
@ -19,7 +19,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|||
COPY scripts/sccache.sh /scripts/
|
||||
RUN sh /scripts/sccache.sh
|
||||
|
||||
# using llvm-link-shared due to libffi issues -- see #34486
|
||||
ENV RUST_CONFIGURE_ARGS \
|
||||
--build=x86_64-unknown-linux-gnu \
|
||||
--llvm-root=/usr/lib/llvm-3.7
|
||||
--llvm-root=/usr/lib/llvm-3.9 \
|
||||
--enable-llvm-link-shared
|
||||
ENV RUST_CHECK_TARGET check
|
|
@ -152,9 +152,6 @@ never colorize output.
|
|||
|
||||
.SH CODEGEN OPTIONS
|
||||
|
||||
.TP
|
||||
\fBar\fR=\fI/path/to/ar\fR
|
||||
Path to the archive utility to use when assembling archives.
|
||||
.TP
|
||||
\fBlinker\fR=\fI/path/to/cc\fR
|
||||
Path to the linker utility to use when linking libraries, executables, and
|
||||
|
|
|
@ -96,11 +96,11 @@ Using this flag looks like this:
|
|||
$ rustdoc src/lib.rs --crate-name mycrate
|
||||
```
|
||||
|
||||
By default, `rustodc` assumes that the name of your crate is the same name
|
||||
By default, `rustdoc` assumes that the name of your crate is the same name
|
||||
as the `.rs` file. `--crate-name` lets you override this assumption with
|
||||
whatever name you choose.
|
||||
|
||||
## `-L`/`--library-path`:
|
||||
## `-L`/`--library-path`: where to look for dependencies
|
||||
|
||||
Using this flag looks like this:
|
||||
|
||||
|
@ -186,7 +186,7 @@ on documentation tests](documentation-tests.html).
|
|||
|
||||
See also `--test-args`.
|
||||
|
||||
## `--test-args`:
|
||||
## `--test-args`: pass options to test runner
|
||||
|
||||
Using this flag looks like this:
|
||||
|
||||
|
@ -199,7 +199,7 @@ For more, see [the chapter on documentation tests](documentation-tests.html).
|
|||
|
||||
See also `--test`.
|
||||
|
||||
## `--target`:
|
||||
## `--target`: generate documentation for the specified target triple
|
||||
|
||||
Using this flag looks like this:
|
||||
|
||||
|
@ -253,7 +253,7 @@ $ rustdoc README.md --html-before-content extra.html
|
|||
```
|
||||
|
||||
This flag takes a list of files, and inserts them inside the `<body>` tag but
|
||||
before the other content `rustodc` would normally produce in the rendered
|
||||
before the other content `rustdoc` would normally produce in the rendered
|
||||
documentation.
|
||||
|
||||
## `--html-after-content`: include more HTML after the content
|
||||
|
@ -266,7 +266,7 @@ $ rustdoc README.md --html-after-content extra.html
|
|||
```
|
||||
|
||||
This flag takes a list of files, and inserts them before the `</body>` tag but
|
||||
after the other content `rustodc` would normally produce in the rendered
|
||||
after the other content `rustdoc` would normally produce in the rendered
|
||||
documentation.
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
# `crate_visibility_modifier`
|
||||
|
||||
The tracking issue for this feature is: [#45388]
|
||||
|
||||
[#45388]: https://github.com/rust-lang/rust/issues/45388
|
||||
|
||||
-----
|
||||
|
||||
The `crate_visibility_modifier` feature allows the `crate` keyword to be used
|
||||
as a visibility modifier synonymous to `pub(crate)`, indicating that a type
|
||||
(function, _&c._) is to be visible to the entire enclosing crate, but not to
|
||||
other crates.
|
||||
|
||||
```rust
|
||||
#![feature(crate_visibility_modifier)]
|
||||
|
||||
crate struct Foo {
|
||||
bar: usize,
|
||||
}
|
||||
```
|
|
@ -227,3 +227,95 @@ A third function, `rust_eh_unwind_resume`, is also needed if the `custom_unwind_
|
|||
flag is set in the options of the compilation target. It allows customizing the
|
||||
process of resuming unwind at the end of the landing pads. The language item's name
|
||||
is `eh_unwind_resume`.
|
||||
|
||||
## List of all language items
|
||||
|
||||
This is a list of all language items in Rust along with where they are located in
|
||||
the source code.
|
||||
|
||||
- Primitives
|
||||
- `i8`: `libcore/num/mod.rs`
|
||||
- `i16`: `libcore/num/mod.rs`
|
||||
- `i32`: `libcore/num/mod.rs`
|
||||
- `i64`: `libcore/num/mod.rs`
|
||||
- `i128`: `libcore/num/mod.rs`
|
||||
- `isize`: `libcore/num/mod.rs`
|
||||
- `u8`: `libcore/num/mod.rs`
|
||||
- `u16`: `libcore/num/mod.rs`
|
||||
- `u32`: `libcore/num/mod.rs`
|
||||
- `u64`: `libcore/num/mod.rs`
|
||||
- `u128`: `libcore/num/mod.rs`
|
||||
- `usize`: `libcore/num/mod.rs`
|
||||
- `f32`: `libstd/f32.rs`
|
||||
- `f64`: `libstd/f64.rs`
|
||||
- `char`: `libstd_unicode/char.rs`
|
||||
- `slice`: `liballoc/slice.rs`
|
||||
- `str`: `liballoc/str.rs`
|
||||
- `const_ptr`: `libcore/ptr.rs`
|
||||
- `mut_ptr`: `libcore/ptr.rs`
|
||||
- `unsafe_cell`: `libcore/cell.rs`
|
||||
- Runtime
|
||||
- `start`: `libstd/rt.rs`
|
||||
- `eh_personality`: `libpanic_unwind/emcc.rs` (EMCC)
|
||||
- `eh_personality`: `libpanic_unwind/seh64_gnu.rs` (SEH64 GNU)
|
||||
- `eh_personality`: `libpanic_unwind/seh.rs` (SEH)
|
||||
- `eh_unwind_resume`: `libpanic_unwind/seh64_gnu.rs` (SEH64 GNU)
|
||||
- `eh_unwind_resume`: `libpanic_unwind/gcc.rs` (GCC)
|
||||
- `msvc_try_filter`: `libpanic_unwind/seh.rs` (SEH)
|
||||
- `panic`: `libcore/panicking.rs`
|
||||
- `panic_bounds_check`: `libcore/panicking.rs`
|
||||
- `panic_fmt`: `libcore/panicking.rs`
|
||||
- `panic_fmt`: `libstd/panicking.rs`
|
||||
- Allocations
|
||||
- `owned_box`: `liballoc/boxed.rs`
|
||||
- `exchange_malloc`: `liballoc/heap.rs`
|
||||
- `box_free`: `liballoc/heap.rs`
|
||||
- Operands
|
||||
- `not`: `libcore/ops/bit.rs`
|
||||
- `bitand`: `libcore/ops/bit.rs`
|
||||
- `bitor`: `libcore/ops/bit.rs`
|
||||
- `bitxor`: `libcore/ops/bit.rs`
|
||||
- `shl`: `libcore/ops/bit.rs`
|
||||
- `shr`: `libcore/ops/bit.rs`
|
||||
- `bitand_assign`: `libcore/ops/bit.rs`
|
||||
- `bitor_assign`: `libcore/ops/bit.rs`
|
||||
- `bitxor_assign`: `libcore/ops/bit.rs`
|
||||
- `shl_assign`: `libcore/ops/bit.rs`
|
||||
- `shr_assign`: `libcore/ops/bit.rs`
|
||||
- `deref`: `libcore/ops/deref.rs`
|
||||
- `deref_mut`: `libcore/ops/deref.rs`
|
||||
- `index`: `libcore/ops/index.rs`
|
||||
- `index_mut`: `libcore/ops/index.rs`
|
||||
- `add`: `libcore/ops/arith.rs`
|
||||
- `sub`: `libcore/ops/arith.rs`
|
||||
- `mul`: `libcore/ops/arith.rs`
|
||||
- `div`: `libcore/ops/arith.rs`
|
||||
- `rem`: `libcore/ops/arith.rs`
|
||||
- `neg`: `libcore/ops/arith.rs`
|
||||
- `add_assign`: `libcore/ops/arith.rs`
|
||||
- `sub_assign`: `libcore/ops/arith.rs`
|
||||
- `mul_assign`: `libcore/ops/arith.rs`
|
||||
- `div_assign`: `libcore/ops/arith.rs`
|
||||
- `rem_assign`: `libcore/ops/arith.rs`
|
||||
- `eq`: `libcore/cmp.rs`
|
||||
- `ord`: `libcore/cmp.rs`
|
||||
- Functions
|
||||
- `fn`: `libcore/ops/function.rs`
|
||||
- `fn_mut`: `libcore/ops/function.rs`
|
||||
- `fn_once`: `libcore/ops/function.rs`
|
||||
- `generator_state`: `libcore/ops/generator.rs`
|
||||
- `generator`: `libcore/ops/generator.rs`
|
||||
- Other
|
||||
- `coerce_unsized`: `libcore/ops/unsize.rs`
|
||||
- `drop`: `libcore/ops/drop.rs`
|
||||
- `drop_in_place`: `libcore/ptr.rs`
|
||||
- `clone`: `libcore/clone.rs`
|
||||
- `copy`: `libcore/marker.rs`
|
||||
- `send`: `libcore/marker.rs`
|
||||
- `sized`: `libcore/marker.rs`
|
||||
- `unsize`: `libcore/marker.rs`
|
||||
- `sync`: `libcore/marker.rs`
|
||||
- `phantom_data`: `libcore/marker.rs`
|
||||
- `freeze`: `libcore/marker.rs`
|
||||
- `debug_trait`: `libcore/fmt/mod.rs`
|
||||
- `non_zero`: `libcore/nonzero.rs`
|
|
@ -15,4 +15,34 @@ The `non_ascii_idents` feature adds support for non-ASCII identifiers.
|
|||
|
||||
const ε: f64 = 0.00001f64;
|
||||
const Π: f64 = 3.14f64;
|
||||
```
|
||||
```
|
||||
|
||||
## Changes to the language reference
|
||||
|
||||
> **<sup>Lexer:<sup>**
|
||||
> IDENTIFIER :
|
||||
> XID_start XID_continue<sup>\*</sup>
|
||||
> | `_` XID_continue<sup>+</sup>
|
||||
|
||||
An identifier is any nonempty Unicode string of the following form:
|
||||
|
||||
Either
|
||||
|
||||
* The first character has property [`XID_start`]
|
||||
* The remaining characters have property [`XID_continue`]
|
||||
|
||||
Or
|
||||
|
||||
* The first character is `_`
|
||||
* The identifier is more than one character, `_` alone is not an identifier
|
||||
* The remaining characters have property [`XID_continue`]
|
||||
|
||||
that does _not_ occur in the set of [strict keywords].
|
||||
|
||||
> **Note**: [`XID_start`] and [`XID_continue`] as character properties cover the
|
||||
> character ranges used to form the more familiar C and Java language-family
|
||||
> identifiers.
|
||||
|
||||
[`XID_start`]: http://unicode.org/cldr/utility/list-unicodeset.jsp?a=%5B%3AXID_Start%3A%5D&abb=on&g=&i=
|
||||
[`XID_continue`]: http://unicode.org/cldr/utility/list-unicodeset.jsp?a=%5B%3AXID_Continue%3A%5D&abb=on&g=&i=
|
||||
[strict keywords]: ../reference/keywords.html#strict-keywords
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
# `optin_builtin_traits`
|
||||
|
||||
The tracking issue for this feature is [#13231]
|
||||
|
||||
[#13231]: https://github.com/rust-lang/rust/issues/13231
|
||||
|
||||
----
|
||||
|
||||
The `optin_builtin_traits` feature gate allows you to define auto traits.
|
||||
|
||||
Auto traits, like [`Send`] or [`Sync`] in the standard library, are marker traits
|
||||
that are automatically implemented for every type, unless the type, or a type it contains,
|
||||
has explictly opted out via a negative impl.
|
||||
|
||||
[`Send`]: https://doc.rust-lang.org/std/marker/trait.Send.html
|
||||
[`Sync`]: https://doc.rust-lang.org/std/marker/trait.Sync.html
|
||||
|
||||
```rust,ignore
|
||||
impl !Type for Trait
|
||||
```
|
||||
|
||||
Example:
|
||||
|
||||
```rust
|
||||
#![feature(optin_builtin_traits)]
|
||||
|
||||
trait Valid {}
|
||||
|
||||
impl Valid for .. {}
|
||||
|
||||
struct True;
|
||||
struct False;
|
||||
|
||||
impl !Valid for False {}
|
||||
|
||||
struct MaybeValid<T>(T);
|
||||
|
||||
fn must_be_valid<T: Valid>(_t: T) { }
|
||||
|
||||
fn main() {
|
||||
// works
|
||||
must_be_valid( MaybeValid(True) );
|
||||
|
||||
// compiler error - trait bound not satisfied
|
||||
// must_be_valid( MaybeValid(False) );
|
||||
}
|
||||
```
|
|
@ -0,0 +1,25 @@
|
|||
# `unboxed_closures`
|
||||
|
||||
The tracking issue for this feature is [#29625]
|
||||
|
||||
See Also: [`fn_traits`](library-features/fn-traits.html)
|
||||
|
||||
[#29625]: https://github.com/rust-lang/rust/issues/29625
|
||||
|
||||
----
|
||||
|
||||
The `unboxed_closures` feature allows you to write functions using the `"rust-call"` ABI,
|
||||
required for implmenting the [`Fn*`] family of traits. `"rust-call"` functions must have
|
||||
exactly one (non self) argument, a tuple representing the argument list.
|
||||
|
||||
[`Fn*`]: https://doc.rust-lang.org/std/ops/trait.Fn.html
|
||||
|
||||
```rust
|
||||
#![feature(unboxed_closures)]
|
||||
|
||||
extern "rust-call" fn add_args(args: (u32, u32)) -> u32 {
|
||||
args.0 + args.1
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
```
|
|
@ -8,55 +8,6 @@ See also [`alloc_system`](library-features/alloc-system.html).
|
|||
|
||||
------------------------
|
||||
|
||||
The compiler currently ships two default allocators: `alloc_system` and
|
||||
`alloc_jemalloc` (some targets don't have jemalloc, however). These allocators
|
||||
are normal Rust crates and contain an implementation of the routines to
|
||||
allocate and deallocate memory. The standard library is not compiled assuming
|
||||
either one, and the compiler will decide which allocator is in use at
|
||||
compile-time depending on the type of output artifact being produced.
|
||||
|
||||
Binaries generated by the compiler will use `alloc_jemalloc` by default (where
|
||||
available). In this situation the compiler "controls the world" in the sense of
|
||||
it has power over the final link. Primarily this means that the allocator
|
||||
decision can be left up the compiler.
|
||||
|
||||
Dynamic and static libraries, however, will use `alloc_system` by default. Here
|
||||
Rust is typically a 'guest' in another application or another world where it
|
||||
cannot authoritatively decide what allocator is in use. As a result it resorts
|
||||
back to the standard APIs (e.g. `malloc` and `free`) for acquiring and releasing
|
||||
memory.
|
||||
|
||||
# Switching Allocators
|
||||
|
||||
Although the compiler's default choices may work most of the time, it's often
|
||||
necessary to tweak certain aspects. Overriding the compiler's decision about
|
||||
which allocator is in use is done simply by linking to the desired allocator:
|
||||
|
||||
```rust,no_run
|
||||
#![feature(alloc_system)]
|
||||
|
||||
extern crate alloc_system;
|
||||
|
||||
fn main() {
|
||||
let a = Box::new(4); // Allocates from the system allocator.
|
||||
println!("{}", a);
|
||||
}
|
||||
```
|
||||
|
||||
In this example the binary generated will not link to jemalloc by default but
|
||||
instead use the system allocator. Conversely to generate a dynamic library which
|
||||
uses jemalloc by default one would write:
|
||||
|
||||
```rust,ignore
|
||||
#![feature(alloc_jemalloc)]
|
||||
#![crate_type = "dylib"]
|
||||
|
||||
extern crate alloc_jemalloc;
|
||||
|
||||
pub fn foo() {
|
||||
let a = Box::new(4); // Allocates from jemalloc.
|
||||
println!("{}", a);
|
||||
}
|
||||
# fn main() {}
|
||||
```
|
||||
This feature has been replaced by [the `jemallocator` crate on crates.io.][jemallocator].
|
||||
|
||||
[jemallocator]: https://crates.io/crates/jemallocator
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
# `alloc_system`
|
||||
|
||||
The tracking issue for this feature is: [#33082]
|
||||
The tracking issue for this feature is: [#32838]
|
||||
|
||||
[#33082]: https://github.com/rust-lang/rust/issues/33082
|
||||
[#32838]: https://github.com/rust-lang/rust/issues/32838
|
||||
|
||||
See also [`alloc_jemalloc`](library-features/alloc-jemalloc.html).
|
||||
See also [`global_allocator`](language-features/global-allocator.html).
|
||||
|
||||
------------------------
|
||||
|
||||
|
@ -30,13 +30,18 @@ memory.
|
|||
|
||||
Although the compiler's default choices may work most of the time, it's often
|
||||
necessary to tweak certain aspects. Overriding the compiler's decision about
|
||||
which allocator is in use is done simply by linking to the desired allocator:
|
||||
which allocator is in use is done through the `#[global_allocator]` attribute:
|
||||
|
||||
```rust,no_run
|
||||
#![feature(alloc_system)]
|
||||
#![feature(alloc_system, global_allocator, allocator_api)]
|
||||
|
||||
extern crate alloc_system;
|
||||
|
||||
use alloc_system::System;
|
||||
|
||||
#[global_allocator]
|
||||
static A: System = System;
|
||||
|
||||
fn main() {
|
||||
let a = Box::new(4); // Allocates from the system allocator.
|
||||
println!("{}", a);
|
||||
|
@ -47,11 +52,22 @@ In this example the binary generated will not link to jemalloc by default but
|
|||
instead use the system allocator. Conversely to generate a dynamic library which
|
||||
uses jemalloc by default one would write:
|
||||
|
||||
(The `alloc_jemalloc` crate cannot be used to control the global allocator,
|
||||
crate.io’s `jemallocator` crate provides equivalent functionality.)
|
||||
|
||||
```toml
|
||||
# Cargo.toml
|
||||
[dependencies]
|
||||
jemallocator = "0.1"
|
||||
```
|
||||
```rust,ignore
|
||||
#![feature(alloc_jemalloc)]
|
||||
#![feature(global_allocator)]
|
||||
#![crate_type = "dylib"]
|
||||
|
||||
extern crate alloc_jemalloc;
|
||||
extern crate jemallocator;
|
||||
|
||||
#[global_allocator]
|
||||
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
|
||||
|
||||
pub fn foo() {
|
||||
let a = Box::new(4); // Allocates from jemalloc.
|
||||
|
@ -59,4 +75,3 @@ pub fn foo() {
|
|||
}
|
||||
# fn main() {}
|
||||
```
|
||||
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
# `collections`
|
||||
|
||||
This feature is internal to the Rust compiler and is not intended for general use.
|
||||
|
||||
------------------------
|
|
@ -0,0 +1,35 @@
|
|||
# `fn_traits`
|
||||
|
||||
The tracking issue for this feature is [#29625]
|
||||
|
||||
See Also: [`unboxed_closures`](language-features/unboxed-closures.html)
|
||||
|
||||
[#29625]: https://github.com/rust-lang/rust/issues/29625
|
||||
|
||||
----
|
||||
|
||||
The `fn_traits` feature allows for implementation of the [`Fn*`] traits
|
||||
for creating custom closure-like types.
|
||||
|
||||
[`Fn*`]: https://doc.rust-lang.org/std/ops/trait.Fn.html
|
||||
|
||||
```rust
|
||||
#![feature(unboxed_closures)]
|
||||
#![feature(fn_traits)]
|
||||
|
||||
struct Adder {
|
||||
a: u32
|
||||
}
|
||||
|
||||
impl FnOnce<(u32, )> for Adder {
|
||||
type Output = u32;
|
||||
extern "rust-call" fn call_once(self, b: (u32, )) -> Self::Output {
|
||||
self.a + b.0
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let adder = Adder { a: 3 };
|
||||
assert_eq!(adder(2), 5);
|
||||
}
|
||||
```
|
|
@ -248,7 +248,10 @@ class RustStringSlicePrinter(object):
|
|||
def to_string(self):
|
||||
(length, data_ptr) = rustpp.extract_length_and_ptr_from_slice(self.__val)
|
||||
raw_ptr = data_ptr.get_wrapped_value()
|
||||
return '"%s"' % raw_ptr.string(encoding="utf-8", length=length)
|
||||
return raw_ptr.lazy_string(encoding="utf-8", length=length)
|
||||
|
||||
def display_hint(self):
|
||||
return "string"
|
||||
|
||||
|
||||
class RustStdVecPrinter(object):
|
||||
|
@ -278,9 +281,11 @@ class RustStdStringPrinter(object):
|
|||
def to_string(self):
|
||||
vec = self.__val.get_child_at_index(0)
|
||||
(length, data_ptr, cap) = rustpp.extract_length_ptr_and_cap_from_std_vec(vec)
|
||||
return '"%s"' % data_ptr.get_wrapped_value().string(encoding="utf-8",
|
||||
length=length)
|
||||
return data_ptr.get_wrapped_value().lazy_string(encoding="utf-8",
|
||||
length=length)
|
||||
|
||||
def display_hint(self):
|
||||
return "string"
|
||||
|
||||
class RustOsStringPrinter(object):
|
||||
def __init__(self, val):
|
||||
|
@ -294,8 +299,10 @@ class RustOsStringPrinter(object):
|
|||
|
||||
(length, data_ptr, cap) = rustpp.extract_length_ptr_and_cap_from_std_vec(
|
||||
vec)
|
||||
return '"%s"' % data_ptr.get_wrapped_value().string(length=length)
|
||||
return data_ptr.get_wrapped_value().lazy_string(length=length)
|
||||
|
||||
def display_hint(self):
|
||||
return "string"
|
||||
|
||||
class RustCStyleVariantPrinter(object):
|
||||
def __init__(self, val):
|
||||
|
|
|
@ -46,7 +46,9 @@ Name: gcc; Description: "Linker and platform libraries"; Types: full
|
|||
Name: docs; Description: "HTML documentation"; Types: full
|
||||
Name: cargo; Description: "Cargo, the Rust package manager"; Types: full
|
||||
Name: std; Description: "The Rust Standard Library"; Types: full
|
||||
// tool-rls-start
|
||||
Name: rls; Description: "RLS, the Rust Language Server"
|
||||
// tool-rls-end
|
||||
|
||||
[Files]
|
||||
Source: "rustc/*.*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs; Components: rust
|
||||
|
@ -56,8 +58,10 @@ Source: "rust-mingw/*.*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs;
|
|||
Source: "rust-docs/*.*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs; Components: docs
|
||||
Source: "cargo/*.*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs; Components: cargo
|
||||
Source: "rust-std/*.*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs; Components: std
|
||||
// tool-rls-start
|
||||
Source: "rls/*.*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs; Components: rls
|
||||
Source: "rust-analysis/*.*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs; Components: rls
|
||||
// tool-rls-end
|
||||
|
||||
[Code]
|
||||
const
|
||||
|
|
|
@ -170,8 +170,10 @@
|
|||
<Directory Id="Docs" Name="." />
|
||||
<Directory Id="Cargo" Name="." />
|
||||
<Directory Id="Std" Name="." />
|
||||
<!-- tool-rls-start -->
|
||||
<Directory Id="Rls" Name="." />
|
||||
<Directory Id="Analysis" Name="." />
|
||||
<!-- tool-rls-end -->
|
||||
</Directory>
|
||||
</Directory>
|
||||
|
||||
|
@ -275,6 +277,7 @@
|
|||
<ComponentRef Id="PathEnvPerMachine" />
|
||||
<ComponentRef Id="PathEnvPerUser" />
|
||||
</Feature>
|
||||
<!-- tool-rls-start -->
|
||||
<Feature Id="RLS"
|
||||
Title="RLS, the Rust Language Server"
|
||||
Display="7"
|
||||
|
@ -283,6 +286,7 @@
|
|||
<ComponentGroupRef Id="RlsGroup" />
|
||||
<ComponentGroupRef Id="AnalysisGroup" />
|
||||
</Feature>
|
||||
<!-- tool-rls-end -->
|
||||
|
||||
<UIRef Id="RustUI" />
|
||||
</Product>
|
||||
|
|
|
@ -16,7 +16,9 @@
|
|||
<line choice="rust-std"/>
|
||||
<line choice="cargo"/>
|
||||
<line choice="rust-docs"/>
|
||||
<!-- tool-rls-start -->
|
||||
<line choice="rls"/>
|
||||
<!-- tool-rls-end -->
|
||||
</line>
|
||||
<line choice="uninstall" />
|
||||
</choices-outline>
|
||||
|
@ -62,6 +64,7 @@
|
|||
>
|
||||
<pkg-ref id="org.rust-lang.rust-docs"/>
|
||||
</choice>
|
||||
<!-- tool-rls-start -->
|
||||
<choice id="rls" visible="true"
|
||||
title="RLS" description="RLS, the Rust Language Server"
|
||||
selected="(!choices.uninstall.selected && choices['rls'].selected) || (choices.uninstall.selected && choices.install.selected)"
|
||||
|
@ -70,11 +73,14 @@
|
|||
<pkg-ref id="org.rust-lang.rls"/>
|
||||
<pkg-ref id="org.rust-lang.rust-analysis"/>
|
||||
</choice>
|
||||
<!-- tool-rls-end -->
|
||||
<pkg-ref id="org.rust-lang.rustc" version="0" onConclusion="none">rustc.pkg</pkg-ref>
|
||||
<pkg-ref id="org.rust-lang.cargo" version="0" onConclusion="none">cargo.pkg</pkg-ref>
|
||||
<pkg-ref id="org.rust-lang.rust-docs" version="0" onConclusion="none">rust-docs.pkg</pkg-ref>
|
||||
<pkg-ref id="org.rust-lang.rust-std" version="0" onConclusion="none">rust-std.pkg</pkg-ref>
|
||||
<!-- tool-rls-start -->
|
||||
<pkg-ref id="org.rust-lang.rls" version="0" onConclusion="none">rls.pkg</pkg-ref>
|
||||
<!-- tool-rls-end -->
|
||||
<pkg-ref id="org.rust-lang.rust-analysis" version="0" onConclusion="none">rust-analysis.pkg</pkg-ref>
|
||||
<pkg-ref id="org.rust-lang.uninstall" version="0" onConclusion="none">uninstall.pkg</pkg-ref>
|
||||
<background file="rust-logo.png" mime-type="image/png"
|
||||
|
|
|
@ -81,7 +81,7 @@ def execute_command(command_interpreter, command):
|
|||
|
||||
if res.Succeeded():
|
||||
if res.HasResult():
|
||||
print(normalize_whitespace(res.GetOutput()), end='\n')
|
||||
print(normalize_whitespace(res.GetOutput() or ''), end='\n')
|
||||
|
||||
# If the command introduced any breakpoints, make sure to register
|
||||
# them with the breakpoint
|
||||
|
|
|
@ -85,16 +85,23 @@ ident [a-zA-Z\x80-\xff_][a-zA-Z0-9\x80-\xff_]*
|
|||
<blockcomment>(.|\n) { }
|
||||
|
||||
_ { return UNDERSCORE; }
|
||||
abstract { return ABSTRACT; }
|
||||
alignof { return ALIGNOF; }
|
||||
as { return AS; }
|
||||
become { return BECOME; }
|
||||
box { return BOX; }
|
||||
break { return BREAK; }
|
||||
catch { return CATCH; }
|
||||
const { return CONST; }
|
||||
continue { return CONTINUE; }
|
||||
crate { return CRATE; }
|
||||
default { return DEFAULT; }
|
||||
do { return DO; }
|
||||
else { return ELSE; }
|
||||
enum { return ENUM; }
|
||||
extern { return EXTERN; }
|
||||
false { return FALSE; }
|
||||
final { return FINAL; }
|
||||
fn { return FN; }
|
||||
for { return FOR; }
|
||||
if { return IF; }
|
||||
|
@ -102,26 +109,36 @@ impl { return IMPL; }
|
|||
in { return IN; }
|
||||
let { return LET; }
|
||||
loop { return LOOP; }
|
||||
macro { return MACRO; }
|
||||
match { return MATCH; }
|
||||
mod { return MOD; }
|
||||
move { return MOVE; }
|
||||
mut { return MUT; }
|
||||
offsetof { return OFFSETOF; }
|
||||
override { return OVERRIDE; }
|
||||
priv { return PRIV; }
|
||||
proc { return PROC; }
|
||||
pure { return PURE; }
|
||||
pub { return PUB; }
|
||||
ref { return REF; }
|
||||
return { return RETURN; }
|
||||
self { return SELF; }
|
||||
sizeof { return SIZEOF; }
|
||||
static { return STATIC; }
|
||||
struct { return STRUCT; }
|
||||
super { return SUPER; }
|
||||
trait { return TRAIT; }
|
||||
true { return TRUE; }
|
||||
type { return TYPE; }
|
||||
typeof { return TYPEOF; }
|
||||
union { return UNION; }
|
||||
unsafe { return UNSAFE; }
|
||||
unsized { return UNSIZED; }
|
||||
use { return USE; }
|
||||
virtual { return VIRTUAL; }
|
||||
where { return WHERE; }
|
||||
while { return WHILE; }
|
||||
yield { return YIELD; }
|
||||
|
||||
{ident} { return IDENT; }
|
||||
|
||||
|
@ -189,25 +206,25 @@ while { return WHILE; }
|
|||
\>\>= { return SHREQ; }
|
||||
\> { return '>'; }
|
||||
|
||||
\x27 { BEGIN(ltorchar); yymore(); }
|
||||
<ltorchar>static { BEGIN(INITIAL); return STATIC_LIFETIME; }
|
||||
<ltorchar>{ident} { BEGIN(INITIAL); return LIFETIME; }
|
||||
<ltorchar>\\[nrt\\\x27\x220]\x27 { BEGIN(suffix); return LIT_CHAR; }
|
||||
<ltorchar>\\x[0-9a-fA-F]{2}\x27 { BEGIN(suffix); return LIT_CHAR; }
|
||||
<ltorchar>\\u\{[0-9a-fA-F]?{6}\}\x27 { BEGIN(suffix); return LIT_CHAR; }
|
||||
<ltorchar>.\x27 { BEGIN(suffix); return LIT_CHAR; }
|
||||
<ltorchar>[\x80-\xff]{2,4}\x27 { BEGIN(suffix); return LIT_CHAR; }
|
||||
<ltorchar><<EOF>> { BEGIN(INITIAL); return -1; }
|
||||
\x27 { BEGIN(ltorchar); yymore(); }
|
||||
<ltorchar>static { BEGIN(INITIAL); return STATIC_LIFETIME; }
|
||||
<ltorchar>{ident} { BEGIN(INITIAL); return LIFETIME; }
|
||||
<ltorchar>\\[nrt\\\x27\x220]\x27 { BEGIN(suffix); return LIT_CHAR; }
|
||||
<ltorchar>\\x[0-9a-fA-F]{2}\x27 { BEGIN(suffix); return LIT_CHAR; }
|
||||
<ltorchar>\\u\{([0-9a-fA-F]_*){1,6}\}\x27 { BEGIN(suffix); return LIT_CHAR; }
|
||||
<ltorchar>.\x27 { BEGIN(suffix); return LIT_CHAR; }
|
||||
<ltorchar>[\x80-\xff]{2,4}\x27 { BEGIN(suffix); return LIT_CHAR; }
|
||||
<ltorchar><<EOF>> { BEGIN(INITIAL); return -1; }
|
||||
|
||||
b\x22 { BEGIN(bytestr); yymore(); }
|
||||
<bytestr>\x22 { BEGIN(suffix); return LIT_BYTE_STR; }
|
||||
|
||||
<bytestr><<EOF>> { return -1; }
|
||||
<bytestr>\\[n\nrt\\\x27\x220] { yymore(); }
|
||||
<bytestr>\\x[0-9a-fA-F]{2} { yymore(); }
|
||||
<bytestr>\\u\{[0-9a-fA-F]?{6}\} { yymore(); }
|
||||
<bytestr>\\[^n\nrt\\\x27\x220] { return -1; }
|
||||
<bytestr>(.|\n) { yymore(); }
|
||||
<bytestr><<EOF>> { return -1; }
|
||||
<bytestr>\\[n\nrt\\\x27\x220] { yymore(); }
|
||||
<bytestr>\\x[0-9a-fA-F]{2} { yymore(); }
|
||||
<bytestr>\\u\{([0-9a-fA-F]_*){1,6}\} { yymore(); }
|
||||
<bytestr>\\[^n\nrt\\\x27\x220] { return -1; }
|
||||
<bytestr>(.|\n) { yymore(); }
|
||||
|
||||
br\x22 { BEGIN(rawbytestr_nohash); yymore(); }
|
||||
<rawbytestr_nohash>\x22 { BEGIN(suffix); return LIT_BYTE_STR_RAW; }
|
||||
|
@ -252,13 +269,13 @@ br/# {
|
|||
}
|
||||
<rawbytestr><<EOF>> { return -1; }
|
||||
|
||||
b\x27 { BEGIN(byte); yymore(); }
|
||||
<byte>\\[nrt\\\x27\x220]\x27 { BEGIN(INITIAL); return LIT_BYTE; }
|
||||
<byte>\\x[0-9a-fA-F]{2}\x27 { BEGIN(INITIAL); return LIT_BYTE; }
|
||||
<byte>\\u[0-9a-fA-F]{4}\x27 { BEGIN(INITIAL); return LIT_BYTE; }
|
||||
<byte>\\U[0-9a-fA-F]{8}\x27 { BEGIN(INITIAL); return LIT_BYTE; }
|
||||
<byte>.\x27 { BEGIN(INITIAL); return LIT_BYTE; }
|
||||
<byte><<EOF>> { BEGIN(INITIAL); return -1; }
|
||||
b\x27 { BEGIN(byte); yymore(); }
|
||||
<byte>\\[nrt\\\x27\x220]\x27 { BEGIN(INITIAL); return LIT_BYTE; }
|
||||
<byte>\\x[0-9a-fA-F]{2}\x27 { BEGIN(INITIAL); return LIT_BYTE; }
|
||||
<byte>\\u([0-9a-fA-F]_*){4}\x27 { BEGIN(INITIAL); return LIT_BYTE; }
|
||||
<byte>\\U([0-9a-fA-F]_*){8}\x27 { BEGIN(INITIAL); return LIT_BYTE; }
|
||||
<byte>.\x27 { BEGIN(INITIAL); return LIT_BYTE; }
|
||||
<byte><<EOF>> { BEGIN(INITIAL); return -1; }
|
||||
|
||||
r\x22 { BEGIN(rawstr); yymore(); }
|
||||
<rawstr>\x22 { BEGIN(suffix); return LIT_STR_RAW; }
|
||||
|
@ -310,12 +327,12 @@ r/# {
|
|||
\x22 { BEGIN(str); yymore(); }
|
||||
<str>\x22 { BEGIN(suffix); return LIT_STR; }
|
||||
|
||||
<str><<EOF>> { return -1; }
|
||||
<str>\\[n\nr\rt\\\x27\x220] { yymore(); }
|
||||
<str>\\x[0-9a-fA-F]{2} { yymore(); }
|
||||
<str>\\u\{[0-9a-fA-F]?{6}\} { yymore(); }
|
||||
<str>\\[^n\nrt\\\x27\x220] { return -1; }
|
||||
<str>(.|\n) { yymore(); }
|
||||
<str><<EOF>> { return -1; }
|
||||
<str>\\[n\nr\rt\\\x27\x220] { yymore(); }
|
||||
<str>\\x[0-9a-fA-F]{2} { yymore(); }
|
||||
<str>\\u\{([0-9a-fA-F]_*){1,6}\} { yymore(); }
|
||||
<str>\\[^n\nrt\\\x27\x220] { return -1; }
|
||||
<str>(.|\n) { yymore(); }
|
||||
|
||||
\<- { return LARROW; }
|
||||
-\> { return RARROW; }
|
||||
|
|
|
@ -62,13 +62,19 @@ extern char *yytext;
|
|||
// keywords
|
||||
%token SELF
|
||||
%token STATIC
|
||||
%token ABSTRACT
|
||||
%token ALIGNOF
|
||||
%token AS
|
||||
%token BECOME
|
||||
%token BREAK
|
||||
%token CATCH
|
||||
%token CRATE
|
||||
%token DO
|
||||
%token ELSE
|
||||
%token ENUM
|
||||
%token EXTERN
|
||||
%token FALSE
|
||||
%token FINAL
|
||||
%token FN
|
||||
%token FOR
|
||||
%token IF
|
||||
|
@ -76,19 +82,29 @@ extern char *yytext;
|
|||
%token IN
|
||||
%token LET
|
||||
%token LOOP
|
||||
%token MACRO
|
||||
%token MATCH
|
||||
%token MOD
|
||||
%token MOVE
|
||||
%token MUT
|
||||
%token OFFSETOF
|
||||
%token OVERRIDE
|
||||
%token PRIV
|
||||
%token PUB
|
||||
%token PURE
|
||||
%token REF
|
||||
%token RETURN
|
||||
%token SIZEOF
|
||||
%token STRUCT
|
||||
%token SUPER
|
||||
%token UNION
|
||||
%token UNSIZED
|
||||
%token TRUE
|
||||
%token TRAIT
|
||||
%token TYPE
|
||||
%token UNSAFE
|
||||
%token VIRTUAL
|
||||
%token YIELD
|
||||
%token DEFAULT
|
||||
%token USE
|
||||
%token WHILE
|
||||
|
@ -141,6 +157,10 @@ extern char *yytext;
|
|||
// 'foo:bar . <' is shifted (in a trait reference occurring in a
|
||||
// bounds list), parsing as foo:(bar<baz>) rather than (foo:bar)<baz>.
|
||||
%precedence IDENT
|
||||
// Put the weak keywords that can be used as idents here as well
|
||||
%precedence CATCH
|
||||
%precedence DEFAULT
|
||||
%precedence UNION
|
||||
|
||||
// A couple fake-precedence symbols to use in rules associated with +
|
||||
// and < in trailing type contexts. These come up when you have a type
|
||||
|
@ -161,13 +181,13 @@ extern char *yytext;
|
|||
%precedence FOR
|
||||
|
||||
// Binops & unops, and their precedences
|
||||
%precedence '?'
|
||||
%precedence BOX
|
||||
%precedence BOXPLACE
|
||||
%nonassoc DOTDOT
|
||||
|
||||
// RETURN needs to be lower-precedence than tokens that start
|
||||
// prefix_exprs
|
||||
%precedence RETURN
|
||||
%precedence RETURN YIELD
|
||||
|
||||
%right '=' SHLEQ SHREQ MINUSEQ ANDEQ OREQ PLUSEQ STAREQ SLASHEQ CARETEQ PERCENTEQ
|
||||
%right LARROW
|
||||
|
@ -321,6 +341,8 @@ view_path
|
|||
| path_no_types_allowed MOD_SEP '{' idents_or_self ',' '}' { $$ = mk_node("ViewPathList", 2, $1, $4); }
|
||||
| MOD_SEP '{' idents_or_self ',' '}' { $$ = mk_node("ViewPathList", 1, $3); }
|
||||
| path_no_types_allowed MOD_SEP '*' { $$ = mk_node("ViewPathGlob", 1, $1); }
|
||||
| MOD_SEP '*' { $$ = mk_atom("ViewPathGlob"); }
|
||||
| '*' { $$ = mk_atom("ViewPathGlob"); }
|
||||
| '{' '}' { $$ = mk_atom("ViewPathListEmpty"); }
|
||||
| '{' idents_or_self '}' { $$ = mk_node("ViewPathList", 1, $2); }
|
||||
| '{' idents_or_self ',' '}' { $$ = mk_node("ViewPathList", 1, $2); }
|
||||
|
@ -334,6 +356,7 @@ block_item
|
|||
| item_foreign_mod { $$ = mk_node("ItemForeignMod", 1, $1); }
|
||||
| item_struct
|
||||
| item_enum
|
||||
| item_union
|
||||
| item_trait
|
||||
| item_impl
|
||||
;
|
||||
|
@ -387,6 +410,7 @@ struct_decl_field
|
|||
struct_tuple_fields
|
||||
: struct_tuple_field { $$ = mk_node("StructFields", 1, $1); }
|
||||
| struct_tuple_fields ',' struct_tuple_field { $$ = ext_node($1, 1, $3); }
|
||||
| %empty { $$ = mk_none(); }
|
||||
;
|
||||
|
||||
struct_tuple_field
|
||||
|
@ -417,6 +441,11 @@ enum_args
|
|||
| %empty { $$ = mk_none(); }
|
||||
;
|
||||
|
||||
// unions
|
||||
item_union
|
||||
: UNION ident generic_params maybe_where_clause '{' struct_decl_fields '}' { $$ = mk_node("ItemUnion", 0); }
|
||||
| UNION ident generic_params maybe_where_clause '{' struct_decl_fields ',' '}' { $$ = mk_node("ItemUnion", 0); }
|
||||
|
||||
item_mod
|
||||
: MOD ident ';' { $$ = mk_node("ItemMod", 1, $2); }
|
||||
| MOD ident '{' maybe_mod_items '}' { $$ = mk_node("ItemMod", 2, $2, $4); }
|
||||
|
@ -475,7 +504,7 @@ visibility
|
|||
|
||||
idents_or_self
|
||||
: ident_or_self { $$ = mk_node("IdentsOrSelf", 1, $1); }
|
||||
| ident_or_self AS ident { $$ = mk_node("IdentsOrSelf", 2, $1, $3); }
|
||||
| idents_or_self AS ident { $$ = mk_node("IdentsOrSelf", 2, $1, $3); }
|
||||
| idents_or_self ',' ident_or_self { $$ = ext_node($1, 1, $3); }
|
||||
;
|
||||
|
||||
|
@ -515,6 +544,7 @@ trait_item
|
|||
: trait_const
|
||||
| trait_type
|
||||
| trait_method
|
||||
| maybe_outer_attrs item_macro { $$ = mk_node("TraitMacroItem", 2, $1, $2); }
|
||||
;
|
||||
|
||||
trait_const
|
||||
|
@ -547,36 +577,48 @@ trait_method
|
|||
;
|
||||
|
||||
type_method
|
||||
: attrs_and_vis maybe_unsafe FN ident generic_params fn_decl_with_self_allow_anon_params maybe_where_clause ';'
|
||||
: maybe_outer_attrs maybe_unsafe FN ident generic_params fn_decl_with_self_allow_anon_params maybe_where_clause ';'
|
||||
{
|
||||
$$ = mk_node("TypeMethod", 6, $1, $2, $4, $5, $6, $7);
|
||||
}
|
||||
| attrs_and_vis maybe_unsafe EXTERN maybe_abi FN ident generic_params fn_decl_with_self_allow_anon_params maybe_where_clause ';'
|
||||
| maybe_outer_attrs CONST maybe_unsafe FN ident generic_params fn_decl_with_self_allow_anon_params maybe_where_clause ';'
|
||||
{
|
||||
$$ = mk_node("TypeMethod", 6, $1, $3, $5, $6, $7, $8);
|
||||
}
|
||||
| maybe_outer_attrs maybe_unsafe EXTERN maybe_abi FN ident generic_params fn_decl_with_self_allow_anon_params maybe_where_clause ';'
|
||||
{
|
||||
$$ = mk_node("TypeMethod", 7, $1, $2, $4, $6, $7, $8, $9);
|
||||
}
|
||||
;
|
||||
|
||||
method
|
||||
: attrs_and_vis maybe_unsafe FN ident generic_params fn_decl_with_self_allow_anon_params maybe_where_clause inner_attrs_and_block
|
||||
: maybe_outer_attrs maybe_unsafe FN ident generic_params fn_decl_with_self_allow_anon_params maybe_where_clause inner_attrs_and_block
|
||||
{
|
||||
$$ = mk_node("Method", 7, $1, $2, $4, $5, $6, $7, $8);
|
||||
}
|
||||
| attrs_and_vis maybe_unsafe EXTERN maybe_abi FN ident generic_params fn_decl_with_self_allow_anon_params maybe_where_clause inner_attrs_and_block
|
||||
| maybe_outer_attrs CONST maybe_unsafe FN ident generic_params fn_decl_with_self_allow_anon_params maybe_where_clause inner_attrs_and_block
|
||||
{
|
||||
$$ = mk_node("Method", 7, $1, $3, $5, $6, $7, $8, $9);
|
||||
}
|
||||
| maybe_outer_attrs maybe_unsafe EXTERN maybe_abi FN ident generic_params fn_decl_with_self_allow_anon_params maybe_where_clause inner_attrs_and_block
|
||||
{
|
||||
$$ = mk_node("Method", 8, $1, $2, $4, $6, $7, $8, $9, $10);
|
||||
}
|
||||
;
|
||||
|
||||
impl_method
|
||||
: attrs_and_vis maybe_unsafe FN ident generic_params fn_decl_with_self maybe_where_clause inner_attrs_and_block
|
||||
: attrs_and_vis maybe_default maybe_unsafe FN ident generic_params fn_decl_with_self maybe_where_clause inner_attrs_and_block
|
||||
{
|
||||
$$ = mk_node("Method", 7, $1, $2, $4, $5, $6, $7, $8);
|
||||
$$ = mk_node("Method", 8, $1, $2, $3, $5, $6, $7, $8, $9);
|
||||
}
|
||||
| attrs_and_vis maybe_unsafe EXTERN maybe_abi FN ident generic_params fn_decl_with_self maybe_where_clause inner_attrs_and_block
|
||||
| attrs_and_vis maybe_default CONST maybe_unsafe FN ident generic_params fn_decl_with_self maybe_where_clause inner_attrs_and_block
|
||||
{
|
||||
$$ = mk_node("Method", 8, $1, $2, $4, $6, $7, $8, $9, $10);
|
||||
}
|
||||
| attrs_and_vis maybe_default maybe_unsafe EXTERN maybe_abi FN ident generic_params fn_decl_with_self maybe_where_clause inner_attrs_and_block
|
||||
{
|
||||
$$ = mk_node("Method", 9, $1, $2, $3, $5, $7, $8, $9, $10, $11);
|
||||
}
|
||||
;
|
||||
|
||||
// There are two forms of impl:
|
||||
|
@ -638,12 +680,17 @@ impl_item
|
|||
| impl_type
|
||||
;
|
||||
|
||||
maybe_default
|
||||
: DEFAULT { $$ = mk_atom("Default"); }
|
||||
| %empty { $$ = mk_none(); }
|
||||
;
|
||||
|
||||
impl_const
|
||||
: attrs_and_vis item_const { $$ = mk_node("ImplConst", 1, $1, $2); }
|
||||
: attrs_and_vis maybe_default item_const { $$ = mk_node("ImplConst", 3, $1, $2, $3); }
|
||||
;
|
||||
|
||||
impl_type
|
||||
: attrs_and_vis TYPE ident generic_params '=' ty_sum ';' { $$ = mk_node("ImplType", 4, $1, $3, $4, $6); }
|
||||
: attrs_and_vis maybe_default TYPE ident generic_params '=' ty_sum ';' { $$ = mk_node("ImplType", 5, $1, $2, $4, $5, $7); }
|
||||
;
|
||||
|
||||
item_fn
|
||||
|
@ -651,6 +698,10 @@ item_fn
|
|||
{
|
||||
$$ = mk_node("ItemFn", 5, $2, $3, $4, $5, $6);
|
||||
}
|
||||
| CONST FN ident generic_params fn_decl maybe_where_clause inner_attrs_and_block
|
||||
{
|
||||
$$ = mk_node("ItemFn", 5, $3, $4, $5, $6, $7);
|
||||
}
|
||||
;
|
||||
|
||||
item_unsafe_fn
|
||||
|
@ -658,6 +709,10 @@ item_unsafe_fn
|
|||
{
|
||||
$$ = mk_node("ItemUnsafeFn", 5, $3, $4, $5, $6, $7);
|
||||
}
|
||||
| CONST UNSAFE FN ident generic_params fn_decl maybe_where_clause inner_attrs_and_block
|
||||
{
|
||||
$$ = mk_node("ItemUnsafeFn", 5, $4, $5, $6, $7, $8);
|
||||
}
|
||||
| UNSAFE EXTERN maybe_abi FN ident generic_params fn_decl maybe_where_clause inner_attrs_and_block
|
||||
{
|
||||
$$ = mk_node("ItemUnsafeFn", 6, $3, $5, $6, $7, $8, $9);
|
||||
|
@ -723,12 +778,6 @@ inferrable_param
|
|||
: pat maybe_ty_ascription { $$ = mk_node("InferrableParam", 2, $1, $2); }
|
||||
;
|
||||
|
||||
maybe_unboxed_closure_kind
|
||||
: %empty
|
||||
| ':'
|
||||
| '&' maybe_mut ':'
|
||||
;
|
||||
|
||||
maybe_comma_params
|
||||
: ',' { $$ = mk_none(); }
|
||||
| ',' params { $$ = $2; }
|
||||
|
@ -784,7 +833,8 @@ ret_ty
|
|||
;
|
||||
|
||||
generic_params
|
||||
: '<' lifetimes '>' { $$ = mk_node("Generics", 2, $2, mk_none()); }
|
||||
: '<' '>' { $$ = mk_node("Generics", 2, mk_none(), mk_none()); }
|
||||
| '<' lifetimes '>' { $$ = mk_node("Generics", 2, $2, mk_none()); }
|
||||
| '<' lifetimes ',' '>' { $$ = mk_node("Generics", 2, $2, mk_none()); }
|
||||
| '<' lifetimes SHR { push_back('>'); $$ = mk_node("Generics", 2, $2, mk_none()); }
|
||||
| '<' lifetimes ',' SHR { push_back('>'); $$ = mk_node("Generics", 2, $2, mk_none()); }
|
||||
|
@ -837,6 +887,8 @@ path_no_types_allowed
|
|||
| MOD_SEP ident { $$ = mk_node("ViewPath", 1, $2); }
|
||||
| SELF { $$ = mk_node("ViewPath", 1, mk_atom("Self")); }
|
||||
| MOD_SEP SELF { $$ = mk_node("ViewPath", 1, mk_atom("Self")); }
|
||||
| SUPER { $$ = mk_node("ViewPath", 1, mk_atom("Super")); }
|
||||
| MOD_SEP SUPER { $$ = mk_node("ViewPath", 1, mk_atom("Super")); }
|
||||
| path_no_types_allowed MOD_SEP ident { $$ = ext_node($1, 1, $3); }
|
||||
;
|
||||
|
||||
|
@ -882,7 +934,7 @@ generic_args
|
|||
;
|
||||
|
||||
generic_values
|
||||
: maybe_lifetimes maybe_ty_sums_and_or_bindings { $$ = mk_node("GenericValues", 2, $1, $2); }
|
||||
: maybe_ty_sums_and_or_bindings { $$ = mk_node("GenericValues", 1, $1); }
|
||||
;
|
||||
|
||||
maybe_ty_sums_and_or_bindings
|
||||
|
@ -910,12 +962,11 @@ pat
|
|||
| ANDAND pat { $$ = mk_node("PatRegion", 1, mk_node("PatRegion", 1, $2)); }
|
||||
| '(' ')' { $$ = mk_atom("PatUnit"); }
|
||||
| '(' pat_tup ')' { $$ = mk_node("PatTup", 1, $2); }
|
||||
| '(' pat_tup ',' ')' { $$ = mk_node("PatTup", 1, $2); }
|
||||
| '[' pat_vec ']' { $$ = mk_node("PatVec", 1, $2); }
|
||||
| lit_or_path
|
||||
| lit_or_path DOTDOTDOT lit_or_path { $$ = mk_node("PatRange", 2, $1, $3); }
|
||||
| path_expr '{' pat_struct '}' { $$ = mk_node("PatStruct", 2, $1, $3); }
|
||||
| path_expr '(' DOTDOT ')' { $$ = mk_node("PatEnum", 1, $1); }
|
||||
| path_expr '(' ')' { $$ = mk_node("PatEnum", 2, $1, mk_none()); }
|
||||
| path_expr '(' pat_tup ')' { $$ = mk_node("PatEnum", 2, $1, $3); }
|
||||
| path_expr '!' maybe_ident delimited_token_trees { $$ = mk_node("PatMac", 3, $1, $3, $4); }
|
||||
| binding_mode ident { $$ = mk_node("PatIdent", 2, $1, $2); }
|
||||
|
@ -953,6 +1004,7 @@ pat_field
|
|||
| BOX binding_mode ident { $$ = mk_node("PatField", 3, mk_atom("box"), $2, $3); }
|
||||
| ident ':' pat { $$ = mk_node("PatField", 2, $1, $3); }
|
||||
| binding_mode ident ':' pat { $$ = mk_node("PatField", 3, $1, $2, $4); }
|
||||
| LIT_INTEGER ':' pat { $$ = mk_node("PatField", 2, mk_atom(yytext), $3); }
|
||||
;
|
||||
|
||||
pat_fields
|
||||
|
@ -965,11 +1017,26 @@ pat_struct
|
|||
| pat_fields ',' { $$ = mk_node("PatStruct", 2, $1, mk_atom("false")); }
|
||||
| pat_fields ',' DOTDOT { $$ = mk_node("PatStruct", 2, $1, mk_atom("true")); }
|
||||
| DOTDOT { $$ = mk_node("PatStruct", 1, mk_atom("true")); }
|
||||
| %empty { $$ = mk_node("PatStruct", 1, mk_none()); }
|
||||
;
|
||||
|
||||
pat_tup
|
||||
: pat { $$ = mk_node("pat_tup", 1, $1); }
|
||||
| pat_tup ',' pat { $$ = ext_node($1, 1, $3); }
|
||||
: pat_tup_elts { $$ = mk_node("PatTup", 2, $1, mk_none()); }
|
||||
| pat_tup_elts ',' { $$ = mk_node("PatTup", 2, $1, mk_none()); }
|
||||
| pat_tup_elts DOTDOT { $$ = mk_node("PatTup", 2, $1, mk_none()); }
|
||||
| pat_tup_elts ',' DOTDOT { $$ = mk_node("PatTup", 2, $1, mk_none()); }
|
||||
| pat_tup_elts DOTDOT ',' pat_tup_elts { $$ = mk_node("PatTup", 2, $1, $4); }
|
||||
| pat_tup_elts DOTDOT ',' pat_tup_elts ',' { $$ = mk_node("PatTup", 2, $1, $4); }
|
||||
| pat_tup_elts ',' DOTDOT ',' pat_tup_elts { $$ = mk_node("PatTup", 2, $1, $5); }
|
||||
| pat_tup_elts ',' DOTDOT ',' pat_tup_elts ',' { $$ = mk_node("PatTup", 2, $1, $5); }
|
||||
| DOTDOT ',' pat_tup_elts { $$ = mk_node("PatTup", 2, mk_none(), $3); }
|
||||
| DOTDOT ',' pat_tup_elts ',' { $$ = mk_node("PatTup", 2, mk_none(), $3); }
|
||||
| DOTDOT { $$ = mk_node("PatTup", 2, mk_none(), mk_none()); }
|
||||
;
|
||||
|
||||
pat_tup_elts
|
||||
: pat { $$ = mk_node("PatTupElts", 1, $1); }
|
||||
| pat_tup_elts ',' pat { $$ = ext_node($1, 1, $3); }
|
||||
;
|
||||
|
||||
pat_vec
|
||||
|
@ -1007,24 +1074,25 @@ ty
|
|||
;
|
||||
|
||||
ty_prim
|
||||
: %prec IDENT path_generic_args_without_colons { $$ = mk_node("TyPath", 2, mk_node("global", 1, mk_atom("false")), $1); }
|
||||
| %prec IDENT MOD_SEP path_generic_args_without_colons { $$ = mk_node("TyPath", 2, mk_node("global", 1, mk_atom("true")), $2); }
|
||||
| %prec IDENT SELF MOD_SEP path_generic_args_without_colons { $$ = mk_node("TyPath", 2, mk_node("self", 1, mk_atom("true")), $3); }
|
||||
| BOX ty { $$ = mk_node("TyBox", 1, $2); }
|
||||
| '*' maybe_mut_or_const ty { $$ = mk_node("TyPtr", 2, $2, $3); }
|
||||
| '&' ty { $$ = mk_node("TyRptr", 2, mk_atom("MutImmutable"), $2); }
|
||||
| '&' MUT ty { $$ = mk_node("TyRptr", 2, mk_atom("MutMutable"), $3); }
|
||||
| ANDAND ty { $$ = mk_node("TyRptr", 1, mk_node("TyRptr", 2, mk_atom("MutImmutable"), $2)); }
|
||||
| ANDAND MUT ty { $$ = mk_node("TyRptr", 1, mk_node("TyRptr", 2, mk_atom("MutMutable"), $3)); }
|
||||
| '&' lifetime maybe_mut ty { $$ = mk_node("TyRptr", 3, $2, $3, $4); }
|
||||
| ANDAND lifetime maybe_mut ty { $$ = mk_node("TyRptr", 1, mk_node("TyRptr", 3, $2, $3, $4)); }
|
||||
| '[' ty ']' { $$ = mk_node("TyVec", 1, $2); }
|
||||
| '[' ty ',' DOTDOT expr ']' { $$ = mk_node("TyFixedLengthVec", 2, $2, $5); }
|
||||
| '[' ty ';' expr ']' { $$ = mk_node("TyFixedLengthVec", 2, $2, $4); }
|
||||
| TYPEOF '(' expr ')' { $$ = mk_node("TyTypeof", 1, $3); }
|
||||
| UNDERSCORE { $$ = mk_atom("TyInfer"); }
|
||||
: %prec IDENT path_generic_args_without_colons { $$ = mk_node("TyPath", 2, mk_node("global", 1, mk_atom("false")), $1); }
|
||||
| %prec IDENT MOD_SEP path_generic_args_without_colons { $$ = mk_node("TyPath", 2, mk_node("global", 1, mk_atom("true")), $2); }
|
||||
| %prec IDENT SELF MOD_SEP path_generic_args_without_colons { $$ = mk_node("TyPath", 2, mk_node("self", 1, mk_atom("true")), $3); }
|
||||
| %prec IDENT path_generic_args_without_colons '!' maybe_ident delimited_token_trees { $$ = mk_node("TyMacro", 3, $1, $3, $4); }
|
||||
| %prec IDENT MOD_SEP path_generic_args_without_colons '!' maybe_ident delimited_token_trees { $$ = mk_node("TyMacro", 3, $2, $4, $5); }
|
||||
| BOX ty { $$ = mk_node("TyBox", 1, $2); }
|
||||
| '*' maybe_mut_or_const ty { $$ = mk_node("TyPtr", 2, $2, $3); }
|
||||
| '&' ty { $$ = mk_node("TyRptr", 2, mk_atom("MutImmutable"), $2); }
|
||||
| '&' MUT ty { $$ = mk_node("TyRptr", 2, mk_atom("MutMutable"), $3); }
|
||||
| ANDAND ty { $$ = mk_node("TyRptr", 1, mk_node("TyRptr", 2, mk_atom("MutImmutable"), $2)); }
|
||||
| ANDAND MUT ty { $$ = mk_node("TyRptr", 1, mk_node("TyRptr", 2, mk_atom("MutMutable"), $3)); }
|
||||
| '&' lifetime maybe_mut ty { $$ = mk_node("TyRptr", 3, $2, $3, $4); }
|
||||
| ANDAND lifetime maybe_mut ty { $$ = mk_node("TyRptr", 1, mk_node("TyRptr", 3, $2, $3, $4)); }
|
||||
| '[' ty ']' { $$ = mk_node("TyVec", 1, $2); }
|
||||
| '[' ty ',' DOTDOT expr ']' { $$ = mk_node("TyFixedLengthVec", 2, $2, $5); }
|
||||
| '[' ty ';' expr ']' { $$ = mk_node("TyFixedLengthVec", 2, $2, $4); }
|
||||
| TYPEOF '(' expr ')' { $$ = mk_node("TyTypeof", 1, $3); }
|
||||
| UNDERSCORE { $$ = mk_atom("TyInfer"); }
|
||||
| ty_bare_fn
|
||||
| ty_proc
|
||||
| for_in_type
|
||||
;
|
||||
|
||||
|
@ -1046,17 +1114,12 @@ ty_closure
|
|||
| OROR maybe_bounds ret_ty { $$ = mk_node("TyClosure", 2, $2, $3); }
|
||||
;
|
||||
|
||||
ty_proc
|
||||
: PROC generic_params fn_params maybe_bounds ret_ty { $$ = mk_node("TyProc", 4, $2, $3, $4, $5); }
|
||||
;
|
||||
|
||||
for_in_type
|
||||
: FOR '<' maybe_lifetimes '>' for_in_type_suffix { $$ = mk_node("ForInType", 2, $3, $5); }
|
||||
;
|
||||
|
||||
for_in_type_suffix
|
||||
: ty_proc
|
||||
| ty_bare_fn
|
||||
: ty_bare_fn
|
||||
| trait_ref
|
||||
| ty_closure
|
||||
;
|
||||
|
@ -1100,13 +1163,23 @@ ty_sums
|
|||
;
|
||||
|
||||
ty_sum
|
||||
: ty { $$ = mk_node("TySum", 1, $1); }
|
||||
| ty '+' ty_param_bounds { $$ = mk_node("TySum", 2, $1, $3); }
|
||||
: ty_sum_elt { $$ = mk_node("TySum", 1, $1); }
|
||||
| ty_sum '+' ty_sum_elt { $$ = ext_node($1, 1, $3); }
|
||||
;
|
||||
|
||||
ty_sum_elt
|
||||
: ty
|
||||
| lifetime
|
||||
;
|
||||
|
||||
ty_prim_sum
|
||||
: ty_prim { $$ = mk_node("TySum", 1, $1); }
|
||||
| ty_prim '+' ty_param_bounds { $$ = mk_node("TySum", 2, $1, $3); }
|
||||
: ty_prim_sum_elt { $$ = mk_node("TySum", 1, $1); }
|
||||
| ty_prim_sum '+' ty_prim_sum_elt { $$ = ext_node($1, 1, $3); }
|
||||
;
|
||||
|
||||
ty_prim_sum_elt
|
||||
: ty_prim
|
||||
| lifetime
|
||||
;
|
||||
|
||||
maybe_ty_param_bounds
|
||||
|
@ -1127,6 +1200,7 @@ boundseq
|
|||
polybound
|
||||
: FOR '<' maybe_lifetimes '>' bound { $$ = mk_node("PolyBound", 2, $3, $5); }
|
||||
| bound
|
||||
| '?' FOR '<' maybe_lifetimes '>' bound { $$ = mk_node("PolyBound", 2, $4, $6); }
|
||||
| '?' bound { $$ = $2; }
|
||||
;
|
||||
|
||||
|
@ -1244,11 +1318,6 @@ maybe_stmts
|
|||
// block, nonblock-prefix, and nonblock-nonprefix.
|
||||
//
|
||||
// In non-stmts contexts, expr can relax this trichotomy.
|
||||
//
|
||||
// There is also one other expr subtype: nonparen_expr disallows exprs
|
||||
// surrounded by parens (including tuple expressions), this is
|
||||
// necessary for BOX (place) expressions, so a parens expr following
|
||||
// the BOX is always parsed as the place.
|
||||
|
||||
stmts
|
||||
: stmt { $$ = mk_node("stmts", 1, $1); }
|
||||
|
@ -1256,14 +1325,15 @@ stmts
|
|||
;
|
||||
|
||||
stmt
|
||||
: let
|
||||
: maybe_outer_attrs let { $$ = $2; }
|
||||
| stmt_item
|
||||
| PUB stmt_item { $$ = $2; }
|
||||
| outer_attrs stmt_item { $$ = $2; }
|
||||
| outer_attrs PUB stmt_item { $$ = $3; }
|
||||
| full_block_expr
|
||||
| block
|
||||
| nonblock_expr ';'
|
||||
| maybe_outer_attrs block { $$ = $2; }
|
||||
| nonblock_expr ';'
|
||||
| outer_attrs nonblock_expr ';' { $$ = $2; }
|
||||
| ';' { $$ = mk_none(); }
|
||||
;
|
||||
|
||||
|
@ -1296,7 +1366,9 @@ path_expr
|
|||
// expressions.
|
||||
path_generic_args_with_colons
|
||||
: ident { $$ = mk_node("components", 1, $1); }
|
||||
| SUPER { $$ = mk_atom("Super"); }
|
||||
| path_generic_args_with_colons MOD_SEP ident { $$ = ext_node($1, 1, $3); }
|
||||
| path_generic_args_with_colons MOD_SEP SUPER { $$ = ext_node($1, 1, mk_atom("Super")); }
|
||||
| path_generic_args_with_colons MOD_SEP generic_args { $$ = ext_node($1, 1, $3); }
|
||||
;
|
||||
|
||||
|
@ -1313,6 +1385,7 @@ nonblock_expr
|
|||
| SELF { $$ = mk_node("ExprPath", 1, mk_node("ident", 1, mk_atom("self"))); }
|
||||
| macro_expr { $$ = mk_node("ExprMac", 1, $1); }
|
||||
| path_expr '{' struct_expr_fields '}' { $$ = mk_node("ExprStruct", 2, $1, $3); }
|
||||
| nonblock_expr '?' { $$ = mk_node("ExprTry", 1, $1); }
|
||||
| nonblock_expr '.' path_generic_args_with_colons { $$ = mk_node("ExprField", 2, $1, $3); }
|
||||
| nonblock_expr '.' LIT_INTEGER { $$ = mk_node("ExprTupleIndex", 1, $1); }
|
||||
| nonblock_expr '[' maybe_expr ']' { $$ = mk_node("ExprIndex", 2, $1, $3); }
|
||||
|
@ -1325,6 +1398,8 @@ nonblock_expr
|
|||
| RETURN expr { $$ = mk_node("ExprRet", 1, $2); }
|
||||
| BREAK { $$ = mk_node("ExprBreak", 0); }
|
||||
| BREAK lifetime { $$ = mk_node("ExprBreak", 1, $2); }
|
||||
| YIELD { $$ = mk_node("ExprYield", 0); }
|
||||
| YIELD expr { $$ = mk_node("ExprYield", 1, $2); }
|
||||
| nonblock_expr LARROW expr { $$ = mk_node("ExprInPlace", 2, $1, $3); }
|
||||
| nonblock_expr '=' expr { $$ = mk_node("ExprAssign", 2, $1, $3); }
|
||||
| nonblock_expr SHLEQ expr { $$ = mk_node("ExprAssignShl", 2, $1, $3); }
|
||||
|
@ -1360,8 +1435,8 @@ nonblock_expr
|
|||
| DOTDOT expr { $$ = mk_node("ExprRange", 2, mk_none(), $2); }
|
||||
| DOTDOT { $$ = mk_node("ExprRange", 2, mk_none(), mk_none()); }
|
||||
| nonblock_expr AS ty { $$ = mk_node("ExprCast", 2, $1, $3); }
|
||||
| BOX nonparen_expr { $$ = mk_node("ExprBox", 1, $2); }
|
||||
| %prec BOXPLACE BOX '(' maybe_expr ')' nonblock_expr { $$ = mk_node("ExprBox", 2, $3, $5); }
|
||||
| nonblock_expr ':' ty { $$ = mk_node("ExprTypeAscr", 2, $1, $3); }
|
||||
| BOX expr { $$ = mk_node("ExprBox", 1, $2); }
|
||||
| expr_qualified_path
|
||||
| nonblock_prefix_expr
|
||||
;
|
||||
|
@ -1373,6 +1448,7 @@ expr
|
|||
| SELF { $$ = mk_node("ExprPath", 1, mk_node("ident", 1, mk_atom("self"))); }
|
||||
| macro_expr { $$ = mk_node("ExprMac", 1, $1); }
|
||||
| path_expr '{' struct_expr_fields '}' { $$ = mk_node("ExprStruct", 2, $1, $3); }
|
||||
| expr '?' { $$ = mk_node("ExprTry", 1, $1); }
|
||||
| expr '.' path_generic_args_with_colons { $$ = mk_node("ExprField", 2, $1, $3); }
|
||||
| expr '.' LIT_INTEGER { $$ = mk_node("ExprTupleIndex", 1, $1); }
|
||||
| expr '[' maybe_expr ']' { $$ = mk_node("ExprIndex", 2, $1, $3); }
|
||||
|
@ -1385,6 +1461,8 @@ expr
|
|||
| RETURN expr { $$ = mk_node("ExprRet", 1, $2); }
|
||||
| BREAK { $$ = mk_node("ExprBreak", 0); }
|
||||
| BREAK ident { $$ = mk_node("ExprBreak", 1, $2); }
|
||||
| YIELD { $$ = mk_node("ExprYield", 0); }
|
||||
| YIELD expr { $$ = mk_node("ExprYield", 1, $2); }
|
||||
| expr LARROW expr { $$ = mk_node("ExprInPlace", 2, $1, $3); }
|
||||
| expr '=' expr { $$ = mk_node("ExprAssign", 2, $1, $3); }
|
||||
| expr SHLEQ expr { $$ = mk_node("ExprAssignShl", 2, $1, $3); }
|
||||
|
@ -1420,69 +1498,8 @@ expr
|
|||
| DOTDOT expr { $$ = mk_node("ExprRange", 2, mk_none(), $2); }
|
||||
| DOTDOT { $$ = mk_node("ExprRange", 2, mk_none(), mk_none()); }
|
||||
| expr AS ty { $$ = mk_node("ExprCast", 2, $1, $3); }
|
||||
| BOX nonparen_expr { $$ = mk_node("ExprBox", 1, $2); }
|
||||
| %prec BOXPLACE BOX '(' maybe_expr ')' expr { $$ = mk_node("ExprBox", 2, $3, $5); }
|
||||
| expr_qualified_path
|
||||
| block_expr
|
||||
| block
|
||||
| nonblock_prefix_expr
|
||||
;
|
||||
|
||||
nonparen_expr
|
||||
: lit { $$ = mk_node("ExprLit", 1, $1); }
|
||||
| %prec IDENT
|
||||
path_expr { $$ = mk_node("ExprPath", 1, $1); }
|
||||
| SELF { $$ = mk_node("ExprPath", 1, mk_node("ident", 1, mk_atom("self"))); }
|
||||
| macro_expr { $$ = mk_node("ExprMac", 1, $1); }
|
||||
| path_expr '{' struct_expr_fields '}' { $$ = mk_node("ExprStruct", 2, $1, $3); }
|
||||
| nonparen_expr '.' path_generic_args_with_colons { $$ = mk_node("ExprField", 2, $1, $3); }
|
||||
| nonparen_expr '.' LIT_INTEGER { $$ = mk_node("ExprTupleIndex", 1, $1); }
|
||||
| nonparen_expr '[' maybe_expr ']' { $$ = mk_node("ExprIndex", 2, $1, $3); }
|
||||
| nonparen_expr '(' maybe_exprs ')' { $$ = mk_node("ExprCall", 2, $1, $3); }
|
||||
| '[' vec_expr ']' { $$ = mk_node("ExprVec", 1, $2); }
|
||||
| CONTINUE { $$ = mk_node("ExprAgain", 0); }
|
||||
| CONTINUE ident { $$ = mk_node("ExprAgain", 1, $2); }
|
||||
| RETURN { $$ = mk_node("ExprRet", 0); }
|
||||
| RETURN expr { $$ = mk_node("ExprRet", 1, $2); }
|
||||
| BREAK { $$ = mk_node("ExprBreak", 0); }
|
||||
| BREAK ident { $$ = mk_node("ExprBreak", 1, $2); }
|
||||
| nonparen_expr LARROW nonparen_expr { $$ = mk_node("ExprInPlace", 2, $1, $3); }
|
||||
| nonparen_expr '=' nonparen_expr { $$ = mk_node("ExprAssign", 2, $1, $3); }
|
||||
| nonparen_expr SHLEQ nonparen_expr { $$ = mk_node("ExprAssignShl", 2, $1, $3); }
|
||||
| nonparen_expr SHREQ nonparen_expr { $$ = mk_node("ExprAssignShr", 2, $1, $3); }
|
||||
| nonparen_expr MINUSEQ nonparen_expr { $$ = mk_node("ExprAssignSub", 2, $1, $3); }
|
||||
| nonparen_expr ANDEQ nonparen_expr { $$ = mk_node("ExprAssignBitAnd", 2, $1, $3); }
|
||||
| nonparen_expr OREQ nonparen_expr { $$ = mk_node("ExprAssignBitOr", 2, $1, $3); }
|
||||
| nonparen_expr PLUSEQ nonparen_expr { $$ = mk_node("ExprAssignAdd", 2, $1, $3); }
|
||||
| nonparen_expr STAREQ nonparen_expr { $$ = mk_node("ExprAssignMul", 2, $1, $3); }
|
||||
| nonparen_expr SLASHEQ nonparen_expr { $$ = mk_node("ExprAssignDiv", 2, $1, $3); }
|
||||
| nonparen_expr CARETEQ nonparen_expr { $$ = mk_node("ExprAssignBitXor", 2, $1, $3); }
|
||||
| nonparen_expr PERCENTEQ nonparen_expr { $$ = mk_node("ExprAssignRem", 2, $1, $3); }
|
||||
| nonparen_expr OROR nonparen_expr { $$ = mk_node("ExprBinary", 3, mk_atom("BiOr"), $1, $3); }
|
||||
| nonparen_expr ANDAND nonparen_expr { $$ = mk_node("ExprBinary", 3, mk_atom("BiAnd"), $1, $3); }
|
||||
| nonparen_expr EQEQ nonparen_expr { $$ = mk_node("ExprBinary", 3, mk_atom("BiEq"), $1, $3); }
|
||||
| nonparen_expr NE nonparen_expr { $$ = mk_node("ExprBinary", 3, mk_atom("BiNe"), $1, $3); }
|
||||
| nonparen_expr '<' nonparen_expr { $$ = mk_node("ExprBinary", 3, mk_atom("BiLt"), $1, $3); }
|
||||
| nonparen_expr '>' nonparen_expr { $$ = mk_node("ExprBinary", 3, mk_atom("BiGt"), $1, $3); }
|
||||
| nonparen_expr LE nonparen_expr { $$ = mk_node("ExprBinary", 3, mk_atom("BiLe"), $1, $3); }
|
||||
| nonparen_expr GE nonparen_expr { $$ = mk_node("ExprBinary", 3, mk_atom("BiGe"), $1, $3); }
|
||||
| nonparen_expr '|' nonparen_expr { $$ = mk_node("ExprBinary", 3, mk_atom("BiBitOr"), $1, $3); }
|
||||
| nonparen_expr '^' nonparen_expr { $$ = mk_node("ExprBinary", 3, mk_atom("BiBitXor"), $1, $3); }
|
||||
| nonparen_expr '&' nonparen_expr { $$ = mk_node("ExprBinary", 3, mk_atom("BiBitAnd"), $1, $3); }
|
||||
| nonparen_expr SHL nonparen_expr { $$ = mk_node("ExprBinary", 3, mk_atom("BiShl"), $1, $3); }
|
||||
| nonparen_expr SHR nonparen_expr { $$ = mk_node("ExprBinary", 3, mk_atom("BiShr"), $1, $3); }
|
||||
| nonparen_expr '+' nonparen_expr { $$ = mk_node("ExprBinary", 3, mk_atom("BiAdd"), $1, $3); }
|
||||
| nonparen_expr '-' nonparen_expr { $$ = mk_node("ExprBinary", 3, mk_atom("BiSub"), $1, $3); }
|
||||
| nonparen_expr '*' nonparen_expr { $$ = mk_node("ExprBinary", 3, mk_atom("BiMul"), $1, $3); }
|
||||
| nonparen_expr '/' nonparen_expr { $$ = mk_node("ExprBinary", 3, mk_atom("BiDiv"), $1, $3); }
|
||||
| nonparen_expr '%' nonparen_expr { $$ = mk_node("ExprBinary", 3, mk_atom("BiRem"), $1, $3); }
|
||||
| nonparen_expr DOTDOT { $$ = mk_node("ExprRange", 2, $1, mk_none()); }
|
||||
| nonparen_expr DOTDOT nonparen_expr { $$ = mk_node("ExprRange", 2, $1, $3); }
|
||||
| DOTDOT nonparen_expr { $$ = mk_node("ExprRange", 2, mk_none(), $2); }
|
||||
| DOTDOT { $$ = mk_node("ExprRange", 2, mk_none(), mk_none()); }
|
||||
| nonparen_expr AS ty { $$ = mk_node("ExprCast", 2, $1, $3); }
|
||||
| BOX nonparen_expr { $$ = mk_node("ExprBox", 1, $2); }
|
||||
| %prec BOXPLACE BOX '(' maybe_expr ')' expr { $$ = mk_node("ExprBox", 1, $3, $5); }
|
||||
| expr ':' ty { $$ = mk_node("ExprTypeAscr", 2, $1, $3); }
|
||||
| BOX expr { $$ = mk_node("ExprBox", 1, $2); }
|
||||
| expr_qualified_path
|
||||
| block_expr
|
||||
| block
|
||||
|
@ -1495,6 +1512,7 @@ expr_nostruct
|
|||
path_expr { $$ = mk_node("ExprPath", 1, $1); }
|
||||
| SELF { $$ = mk_node("ExprPath", 1, mk_node("ident", 1, mk_atom("self"))); }
|
||||
| macro_expr { $$ = mk_node("ExprMac", 1, $1); }
|
||||
| expr_nostruct '?' { $$ = mk_node("ExprTry", 1, $1); }
|
||||
| expr_nostruct '.' path_generic_args_with_colons { $$ = mk_node("ExprField", 2, $1, $3); }
|
||||
| expr_nostruct '.' LIT_INTEGER { $$ = mk_node("ExprTupleIndex", 1, $1); }
|
||||
| expr_nostruct '[' maybe_expr ']' { $$ = mk_node("ExprIndex", 2, $1, $3); }
|
||||
|
@ -1507,6 +1525,8 @@ expr_nostruct
|
|||
| RETURN expr { $$ = mk_node("ExprRet", 1, $2); }
|
||||
| BREAK { $$ = mk_node("ExprBreak", 0); }
|
||||
| BREAK ident { $$ = mk_node("ExprBreak", 1, $2); }
|
||||
| YIELD { $$ = mk_node("ExprYield", 0); }
|
||||
| YIELD expr { $$ = mk_node("ExprYield", 1, $2); }
|
||||
| expr_nostruct LARROW expr_nostruct { $$ = mk_node("ExprInPlace", 2, $1, $3); }
|
||||
| expr_nostruct '=' expr_nostruct { $$ = mk_node("ExprAssign", 2, $1, $3); }
|
||||
| expr_nostruct SHLEQ expr_nostruct { $$ = mk_node("ExprAssignShl", 2, $1, $3); }
|
||||
|
@ -1542,8 +1562,8 @@ expr_nostruct
|
|||
| DOTDOT expr_nostruct { $$ = mk_node("ExprRange", 2, mk_none(), $2); }
|
||||
| DOTDOT { $$ = mk_node("ExprRange", 2, mk_none(), mk_none()); }
|
||||
| expr_nostruct AS ty { $$ = mk_node("ExprCast", 2, $1, $3); }
|
||||
| BOX nonparen_expr { $$ = mk_node("ExprBox", 1, $2); }
|
||||
| %prec BOXPLACE BOX '(' maybe_expr ')' expr_nostruct { $$ = mk_node("ExprBox", 1, $3, $5); }
|
||||
| expr_nostruct ':' ty { $$ = mk_node("ExprTypeAscr", 2, $1, $3); }
|
||||
| BOX expr { $$ = mk_node("ExprBox", 1, $2); }
|
||||
| expr_qualified_path
|
||||
| block_expr
|
||||
| block
|
||||
|
@ -1558,7 +1578,6 @@ nonblock_prefix_expr_nostruct
|
|||
| ANDAND maybe_mut expr_nostruct { $$ = mk_node("ExprAddrOf", 1, mk_node("ExprAddrOf", 2, $2, $3)); }
|
||||
| lambda_expr_nostruct
|
||||
| MOVE lambda_expr_nostruct { $$ = $2; }
|
||||
| proc_expr_nostruct
|
||||
;
|
||||
|
||||
nonblock_prefix_expr
|
||||
|
@ -1569,7 +1588,6 @@ nonblock_prefix_expr
|
|||
| ANDAND maybe_mut expr { $$ = mk_node("ExprAddrOf", 1, mk_node("ExprAddrOf", 2, $2, $3)); }
|
||||
| lambda_expr
|
||||
| MOVE lambda_expr { $$ = $2; }
|
||||
| proc_expr
|
||||
;
|
||||
|
||||
expr_qualified_path
|
||||
|
@ -1606,43 +1624,42 @@ maybe_as_trait_ref
|
|||
|
||||
lambda_expr
|
||||
: %prec LAMBDA
|
||||
OROR ret_ty expr { $$ = mk_node("ExprFnBlock", 3, mk_none(), $2, $3); }
|
||||
OROR ret_ty expr { $$ = mk_node("ExprFnBlock", 3, mk_none(), $2, $3); }
|
||||
| %prec LAMBDA
|
||||
'|' maybe_unboxed_closure_kind '|' ret_ty expr { $$ = mk_node("ExprFnBlock", 3, mk_none(), $4, $5); }
|
||||
'|' '|' ret_ty expr { $$ = mk_node("ExprFnBlock", 3, mk_none(), $3, $4); }
|
||||
| %prec LAMBDA
|
||||
'|' inferrable_params '|' ret_ty expr { $$ = mk_node("ExprFnBlock", 3, $2, $4, $5); }
|
||||
'|' inferrable_params '|' ret_ty expr { $$ = mk_node("ExprFnBlock", 3, $2, $4, $5); }
|
||||
| %prec LAMBDA
|
||||
'|' '&' maybe_mut ':' inferrable_params '|' ret_ty expr { $$ = mk_node("ExprFnBlock", 3, $5, $7, $8); }
|
||||
'|' inferrable_params OROR lambda_expr_no_first_bar { $$ = mk_node("ExprFnBlock", 3, $2, mk_none(), $4); }
|
||||
;
|
||||
|
||||
lambda_expr_no_first_bar
|
||||
: %prec LAMBDA
|
||||
'|' ret_ty expr { $$ = mk_node("ExprFnBlock", 3, mk_none(), $2, $3); }
|
||||
| %prec LAMBDA
|
||||
'|' ':' inferrable_params '|' ret_ty expr { $$ = mk_node("ExprFnBlock", 3, $3, $5, $6); }
|
||||
inferrable_params '|' ret_ty expr { $$ = mk_node("ExprFnBlock", 3, $1, $3, $4); }
|
||||
| %prec LAMBDA
|
||||
inferrable_params OROR lambda_expr_no_first_bar { $$ = mk_node("ExprFnBlock", 3, $1, mk_none(), $3); }
|
||||
;
|
||||
|
||||
lambda_expr_nostruct
|
||||
: %prec LAMBDA
|
||||
OROR expr_nostruct { $$ = mk_node("ExprFnBlock", 2, mk_none(), $2); }
|
||||
OROR expr_nostruct { $$ = mk_node("ExprFnBlock", 2, mk_none(), $2); }
|
||||
| %prec LAMBDA
|
||||
'|' maybe_unboxed_closure_kind '|' expr_nostruct { $$ = mk_node("ExprFnBlock", 2, mk_none(), $4); }
|
||||
'|' '|' ret_ty expr_nostruct { $$ = mk_node("ExprFnBlock", 3, mk_none(), $3, $4); }
|
||||
| %prec LAMBDA
|
||||
'|' inferrable_params '|' expr_nostruct { $$ = mk_node("ExprFnBlock", 2, $2, $4); }
|
||||
'|' inferrable_params '|' expr_nostruct { $$ = mk_node("ExprFnBlock", 2, $2, $4); }
|
||||
| %prec LAMBDA
|
||||
'|' '&' maybe_mut ':' inferrable_params '|' expr_nostruct { $$ = mk_node("ExprFnBlock", 2, $5, $7); }
|
||||
| %prec LAMBDA
|
||||
'|' ':' inferrable_params '|' expr_nostruct { $$ = mk_node("ExprFnBlock", 2, $3, $5); }
|
||||
|
||||
'|' inferrable_params OROR lambda_expr_nostruct_no_first_bar { $$ = mk_node("ExprFnBlock", 3, $2, mk_none(), $4); }
|
||||
;
|
||||
|
||||
proc_expr
|
||||
lambda_expr_nostruct_no_first_bar
|
||||
: %prec LAMBDA
|
||||
PROC '(' ')' expr { $$ = mk_node("ExprProc", 2, mk_none(), $4); }
|
||||
'|' ret_ty expr_nostruct { $$ = mk_node("ExprFnBlock", 3, mk_none(), $2, $3); }
|
||||
| %prec LAMBDA
|
||||
PROC '(' inferrable_params ')' expr { $$ = mk_node("ExprProc", 2, $3, $5); }
|
||||
;
|
||||
|
||||
proc_expr_nostruct
|
||||
: %prec LAMBDA
|
||||
PROC '(' ')' expr_nostruct { $$ = mk_node("ExprProc", 2, mk_none(), $4); }
|
||||
inferrable_params '|' ret_ty expr_nostruct { $$ = mk_node("ExprFnBlock", 3, $1, $3, $4); }
|
||||
| %prec LAMBDA
|
||||
PROC '(' inferrable_params ')' expr_nostruct { $$ = mk_node("ExprProc", 2, $3, $5); }
|
||||
inferrable_params OROR lambda_expr_nostruct_no_first_bar { $$ = mk_node("ExprFnBlock", 3, $1, mk_none(), $3); }
|
||||
;
|
||||
|
||||
vec_expr
|
||||
|
@ -1654,6 +1671,7 @@ struct_expr_fields
|
|||
: field_inits
|
||||
| field_inits ','
|
||||
| maybe_field_inits default_field_init { $$ = ext_node($1, 1, $2); }
|
||||
| %empty { $$ = mk_none(); }
|
||||
;
|
||||
|
||||
maybe_field_inits
|
||||
|
@ -1668,7 +1686,9 @@ field_inits
|
|||
;
|
||||
|
||||
field_init
|
||||
: ident ':' expr { $$ = mk_node("FieldInit", 2, $1, $3); }
|
||||
: ident { $$ = mk_node("FieldInit", 1, $1); }
|
||||
| ident ':' expr { $$ = mk_node("FieldInit", 2, $1, $3); }
|
||||
| LIT_INTEGER ':' expr { $$ = mk_node("FieldInit", 2, mk_atom(yytext), $3); }
|
||||
;
|
||||
|
||||
default_field_init
|
||||
|
@ -1689,10 +1709,18 @@ block_expr
|
|||
|
||||
full_block_expr
|
||||
: block_expr
|
||||
| full_block_expr '.' path_generic_args_with_colons %prec IDENT { $$ = mk_node("ExprField", 2, $1, $3); }
|
||||
| full_block_expr '.' path_generic_args_with_colons '[' maybe_expr ']' { $$ = mk_node("ExprIndex", 3, $1, $3, $5); }
|
||||
| full_block_expr '.' path_generic_args_with_colons '(' maybe_exprs ')' { $$ = mk_node("ExprCall", 3, $1, $3, $5); }
|
||||
| full_block_expr '.' LIT_INTEGER { $$ = mk_node("ExprTupleIndex", 1, $1); }
|
||||
| block_expr_dot
|
||||
;
|
||||
|
||||
block_expr_dot
|
||||
: block_expr '.' path_generic_args_with_colons %prec IDENT { $$ = mk_node("ExprField", 2, $1, $3); }
|
||||
| block_expr_dot '.' path_generic_args_with_colons %prec IDENT { $$ = mk_node("ExprField", 2, $1, $3); }
|
||||
| block_expr '.' path_generic_args_with_colons '[' maybe_expr ']' { $$ = mk_node("ExprIndex", 3, $1, $3, $5); }
|
||||
| block_expr_dot '.' path_generic_args_with_colons '[' maybe_expr ']' { $$ = mk_node("ExprIndex", 3, $1, $3, $5); }
|
||||
| block_expr '.' path_generic_args_with_colons '(' maybe_exprs ')' { $$ = mk_node("ExprCall", 3, $1, $3, $5); }
|
||||
| block_expr_dot '.' path_generic_args_with_colons '(' maybe_exprs ')' { $$ = mk_node("ExprCall", 3, $1, $3, $5); }
|
||||
| block_expr '.' LIT_INTEGER { $$ = mk_node("ExprTupleIndex", 1, $1); }
|
||||
| block_expr_dot '.' LIT_INTEGER { $$ = mk_node("ExprTupleIndex", 1, $1); }
|
||||
;
|
||||
|
||||
expr_match
|
||||
|
@ -1714,12 +1742,13 @@ match_clause
|
|||
;
|
||||
|
||||
nonblock_match_clause
|
||||
: maybe_outer_attrs pats_or maybe_guard FAT_ARROW nonblock_expr { $$ = mk_node("Arm", 4, $1, $2, $3, $5); }
|
||||
| maybe_outer_attrs pats_or maybe_guard FAT_ARROW full_block_expr { $$ = mk_node("Arm", 4, $1, $2, $3, $5); }
|
||||
: maybe_outer_attrs pats_or maybe_guard FAT_ARROW nonblock_expr { $$ = mk_node("ArmNonblock", 4, $1, $2, $3, $5); }
|
||||
| maybe_outer_attrs pats_or maybe_guard FAT_ARROW block_expr_dot { $$ = mk_node("ArmNonblock", 4, $1, $2, $3, $5); }
|
||||
;
|
||||
|
||||
block_match_clause
|
||||
: maybe_outer_attrs pats_or maybe_guard FAT_ARROW block { $$ = mk_node("Arm", 4, $1, $2, $3, $5); }
|
||||
: maybe_outer_attrs pats_or maybe_guard FAT_ARROW block { $$ = mk_node("ArmBlock", 4, $1, $2, $3, $5); }
|
||||
| maybe_outer_attrs pats_or maybe_guard FAT_ARROW block_expr { $$ = mk_node("ArmBlock", 4, $1, $2, $3, $5); }
|
||||
;
|
||||
|
||||
maybe_guard
|
||||
|
@ -1796,6 +1825,10 @@ maybe_ident
|
|||
|
||||
ident
|
||||
: IDENT { $$ = mk_node("ident", 1, mk_atom(yytext)); }
|
||||
// Weak keywords that can be used as identifiers
|
||||
| CATCH { $$ = mk_node("ident", 1, mk_atom(yytext)); }
|
||||
| DEFAULT { $$ = mk_node("ident", 1, mk_atom(yytext)); }
|
||||
| UNION { $$ = mk_node("ident", 1, mk_atom(yytext)); }
|
||||
;
|
||||
|
||||
unpaired_token
|
||||
|
@ -1836,13 +1869,20 @@ unpaired_token
|
|||
| LIFETIME { $$ = mk_atom(yytext); }
|
||||
| SELF { $$ = mk_atom(yytext); }
|
||||
| STATIC { $$ = mk_atom(yytext); }
|
||||
| ABSTRACT { $$ = mk_atom(yytext); }
|
||||
| ALIGNOF { $$ = mk_atom(yytext); }
|
||||
| AS { $$ = mk_atom(yytext); }
|
||||
| BECOME { $$ = mk_atom(yytext); }
|
||||
| BREAK { $$ = mk_atom(yytext); }
|
||||
| CATCH { $$ = mk_atom(yytext); }
|
||||
| CRATE { $$ = mk_atom(yytext); }
|
||||
| DEFAULT { $$ = mk_atom(yytext); }
|
||||
| DO { $$ = mk_atom(yytext); }
|
||||
| ELSE { $$ = mk_atom(yytext); }
|
||||
| ENUM { $$ = mk_atom(yytext); }
|
||||
| EXTERN { $$ = mk_atom(yytext); }
|
||||
| FALSE { $$ = mk_atom(yytext); }
|
||||
| FINAL { $$ = mk_atom(yytext); }
|
||||
| FN { $$ = mk_atom(yytext); }
|
||||
| FOR { $$ = mk_atom(yytext); }
|
||||
| IF { $$ = mk_atom(yytext); }
|
||||
|
@ -1850,21 +1890,31 @@ unpaired_token
|
|||
| IN { $$ = mk_atom(yytext); }
|
||||
| LET { $$ = mk_atom(yytext); }
|
||||
| LOOP { $$ = mk_atom(yytext); }
|
||||
| MACRO { $$ = mk_atom(yytext); }
|
||||
| MATCH { $$ = mk_atom(yytext); }
|
||||
| MOD { $$ = mk_atom(yytext); }
|
||||
| MOVE { $$ = mk_atom(yytext); }
|
||||
| MUT { $$ = mk_atom(yytext); }
|
||||
| OFFSETOF { $$ = mk_atom(yytext); }
|
||||
| OVERRIDE { $$ = mk_atom(yytext); }
|
||||
| PRIV { $$ = mk_atom(yytext); }
|
||||
| PUB { $$ = mk_atom(yytext); }
|
||||
| PURE { $$ = mk_atom(yytext); }
|
||||
| REF { $$ = mk_atom(yytext); }
|
||||
| RETURN { $$ = mk_atom(yytext); }
|
||||
| STRUCT { $$ = mk_atom(yytext); }
|
||||
| SIZEOF { $$ = mk_atom(yytext); }
|
||||
| SUPER { $$ = mk_atom(yytext); }
|
||||
| TRUE { $$ = mk_atom(yytext); }
|
||||
| TRAIT { $$ = mk_atom(yytext); }
|
||||
| TYPE { $$ = mk_atom(yytext); }
|
||||
| UNION { $$ = mk_atom(yytext); }
|
||||
| UNSAFE { $$ = mk_atom(yytext); }
|
||||
| UNSIZED { $$ = mk_atom(yytext); }
|
||||
| USE { $$ = mk_atom(yytext); }
|
||||
| VIRTUAL { $$ = mk_atom(yytext); }
|
||||
| WHILE { $$ = mk_atom(yytext); }
|
||||
| YIELD { $$ = mk_atom(yytext); }
|
||||
| CONTINUE { $$ = mk_atom(yytext); }
|
||||
| PROC { $$ = mk_atom(yytext); }
|
||||
| BOX { $$ = mk_atom(yytext); }
|
||||
|
@ -1942,4 +1992,4 @@ brackets_delimited_token_trees
|
|||
$2,
|
||||
mk_node("TTTok", 1, mk_atom("]")));
|
||||
}
|
||||
;
|
||||
;
|
||||
|
|
|
@ -30,6 +30,7 @@ enum Token {
|
|||
DOTDOT,
|
||||
DOTDOTDOT,
|
||||
MOD_SEP,
|
||||
LARROW,
|
||||
RARROW,
|
||||
FAT_ARROW,
|
||||
LIT_BYTE,
|
||||
|
@ -47,13 +48,20 @@ enum Token {
|
|||
// keywords
|
||||
SELF,
|
||||
STATIC,
|
||||
ABSTRACT,
|
||||
ALIGNOF,
|
||||
AS,
|
||||
BECOME,
|
||||
BREAK,
|
||||
CATCH,
|
||||
CRATE,
|
||||
DEFAULT,
|
||||
DO,
|
||||
ELSE,
|
||||
ENUM,
|
||||
EXTERN,
|
||||
FALSE,
|
||||
FINAL,
|
||||
FN,
|
||||
FOR,
|
||||
IF,
|
||||
|
@ -61,21 +69,31 @@ enum Token {
|
|||
IN,
|
||||
LET,
|
||||
LOOP,
|
||||
MACRO,
|
||||
MATCH,
|
||||
MOD,
|
||||
MOVE,
|
||||
MUT,
|
||||
OFFSETOF,
|
||||
OVERRIDE,
|
||||
PRIV,
|
||||
PUB,
|
||||
PURE,
|
||||
REF,
|
||||
RETURN,
|
||||
SIZEOF,
|
||||
STRUCT,
|
||||
SUPER,
|
||||
UNION,
|
||||
TRUE,
|
||||
TRAIT,
|
||||
TYPE,
|
||||
UNSAFE,
|
||||
UNSIZED,
|
||||
USE,
|
||||
VIRTUAL,
|
||||
WHILE,
|
||||
YIELD,
|
||||
CONTINUE,
|
||||
PROC,
|
||||
BOX,
|
||||
|
|
|
@ -70,7 +70,7 @@ impl Layout {
|
|||
///
|
||||
/// * `align` must be a power of two,
|
||||
///
|
||||
/// * `align` must not exceed 2^31 (i.e. `1 << 31`),
|
||||
/// * `align` must not exceed 2<sup>31</sup> (i.e. `1 << 31`),
|
||||
///
|
||||
/// * `size`, when rounded up to the nearest multiple of `align`,
|
||||
/// must not overflow (i.e. the rounded value must be less than
|
||||
|
@ -113,7 +113,7 @@ impl Layout {
|
|||
/// # Safety
|
||||
///
|
||||
/// This function is unsafe as it does not verify that `align` is
|
||||
/// a power-of-two that is also less than or equal to 2^31, nor
|
||||
/// a power-of-two that is also less than or equal to 2<sup>31</sup>, nor
|
||||
/// that `size` aligned to `align` fits within the address space
|
||||
/// (i.e. the `Layout::from_size_align` preconditions).
|
||||
#[inline]
|
||||
|
@ -227,7 +227,7 @@ impl Layout {
|
|||
};
|
||||
|
||||
// We can assume that `self.align` is a power-of-two that does
|
||||
// not exceed 2^31. Furthermore, `alloc_size` has already been
|
||||
// not exceed 2<sup>31</sup>. Furthermore, `alloc_size` has already been
|
||||
// rounded up to a multiple of `self.align`; therefore, the
|
||||
// call to `Layout::from_size_align` below should never panic.
|
||||
Some((Layout::from_size_align(alloc_size, self.align).unwrap(), padded_size))
|
||||
|
|
|
@ -52,8 +52,10 @@ const MAX_REFCOUNT: usize = (isize::MAX) as usize;
|
|||
/// also destroyed.
|
||||
///
|
||||
/// Shared references in Rust disallow mutation by default, and `Arc` is no
|
||||
/// exception. If you need to mutate through an `Arc`, use [`Mutex`][mutex],
|
||||
/// [`RwLock`][rwlock], or one of the [`Atomic`][atomic] types.
|
||||
/// exception: you cannot generally obtain a mutable reference to something
|
||||
/// inside an `Arc`. If you need to mutate through an `Arc`, use
|
||||
/// [`Mutex`][mutex], [`RwLock`][rwlock], or one of the [`Atomic`][atomic]
|
||||
/// types.
|
||||
///
|
||||
/// ## Thread Safety
|
||||
///
|
||||
|
|
|
@ -269,7 +269,38 @@ impl<T: ?Sized> Box<T> {
|
|||
#[stable(feature = "box_raw", since = "1.4.0")]
|
||||
#[inline]
|
||||
pub unsafe fn from_raw(raw: *mut T) -> Self {
|
||||
mem::transmute(raw)
|
||||
Box::from_unique(Unique::new_unchecked(raw))
|
||||
}
|
||||
|
||||
/// Constructs a `Box` from a `Unique<T>` pointer.
|
||||
///
|
||||
/// After calling this function, the memory is owned by a `Box` and `T` can
|
||||
/// then be destroyed and released upon drop.
|
||||
///
|
||||
/// # Safety
|
||||
///
|
||||
/// A `Unique<T>` can be safely created via [`Unique::new`] and thus doesn't
|
||||
/// necessarily own the data pointed to nor is the data guaranteed to live
|
||||
/// as long as the pointer.
|
||||
///
|
||||
/// [`Unique::new`]: ../../core/ptr/struct.Unique.html#method.new
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// #![feature(unique)]
|
||||
///
|
||||
/// fn main() {
|
||||
/// let x = Box::new(5);
|
||||
/// let ptr = Box::into_unique(x);
|
||||
/// let x = unsafe { Box::from_unique(ptr) };
|
||||
/// }
|
||||
/// ```
|
||||
#[unstable(feature = "unique", reason = "needs an RFC to flesh out design",
|
||||
issue = "27730")]
|
||||
#[inline]
|
||||
pub unsafe fn from_unique(u: Unique<T>) -> Self {
|
||||
mem::transmute(u)
|
||||
}
|
||||
|
||||
/// Consumes the `Box`, returning the wrapped raw pointer.
|
||||
|
@ -295,7 +326,7 @@ impl<T: ?Sized> Box<T> {
|
|||
#[stable(feature = "box_raw", since = "1.4.0")]
|
||||
#[inline]
|
||||
pub fn into_raw(b: Box<T>) -> *mut T {
|
||||
unsafe { mem::transmute(b) }
|
||||
Box::into_unique(b).as_ptr()
|
||||
}
|
||||
|
||||
/// Consumes the `Box`, returning the wrapped pointer as `Unique<T>`.
|
||||
|
@ -303,13 +334,18 @@ impl<T: ?Sized> Box<T> {
|
|||
/// After calling this function, the caller is responsible for the
|
||||
/// memory previously managed by the `Box`. In particular, the
|
||||
/// caller should properly destroy `T` and release the memory. The
|
||||
/// proper way to do so is to convert the raw pointer back into a
|
||||
/// `Box` with the [`Box::from_raw`] function.
|
||||
/// proper way to do so is to either convert the `Unique<T>` pointer:
|
||||
///
|
||||
/// - Into a `Box` with the [`Box::from_unique`] function.
|
||||
///
|
||||
/// - Into a raw pointer and back into a `Box` with the [`Box::from_raw`]
|
||||
/// function.
|
||||
///
|
||||
/// Note: this is an associated function, which means that you have
|
||||
/// to call it as `Box::into_unique(b)` instead of `b.into_unique()`. This
|
||||
/// is so that there is no conflict with a method on the inner type.
|
||||
///
|
||||
/// [`Box::from_unique`]: struct.Box.html#method.from_unique
|
||||
/// [`Box::from_raw`]: struct.Box.html#method.from_raw
|
||||
///
|
||||
/// # Examples
|
||||
|
|
|
@ -475,7 +475,6 @@
|
|||
//! them with the same character. For example, the `{` character is escaped with
|
||||
//! `{{` and the `}` character is escaped with `}}`.
|
||||
//!
|
||||
//! [`format!`]: ../../macro.format.html
|
||||
//! [`usize`]: ../../std/primitive.usize.html
|
||||
//! [`isize`]: ../../std/primitive.isize.html
|
||||
//! [`i8`]: ../../std/primitive.i8.html
|
||||
|
|
|
@ -121,6 +121,7 @@
|
|||
#![feature(unique)]
|
||||
#![feature(unsize)]
|
||||
#![feature(allocator_internals)]
|
||||
#![feature(on_unimplemented)]
|
||||
|
||||
#![cfg_attr(not(test), feature(fused, fn_traits, placement_new_protocol, swap_with_slice, i128))]
|
||||
#![cfg_attr(test, feature(test, box_heap))]
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
//! given value is destroyed, the pointed-to value is also destroyed.
|
||||
//!
|
||||
//! Shared references in Rust disallow mutation by default, and [`Rc`]
|
||||
//! is no exception: you cannot obtain a mutable reference to
|
||||
//! is no exception: you cannot generally obtain a mutable reference to
|
||||
//! something inside an [`Rc`]. If you need mutability, put a [`Cell`]
|
||||
//! or [`RefCell`] inside the [`Rc`]; see [an example of mutability
|
||||
//! inside an Rc][mutability].
|
||||
|
|
|
@ -959,13 +959,15 @@ impl str {
|
|||
/// assert_eq!(s.find("Léopard"), Some(13));
|
||||
/// ```
|
||||
///
|
||||
/// More complex patterns with closures:
|
||||
/// More complex patterns using point-free style and closures:
|
||||
///
|
||||
/// ```
|
||||
/// let s = "Löwe 老虎 Léopard";
|
||||
///
|
||||
/// assert_eq!(s.find(char::is_whitespace), Some(5));
|
||||
/// assert_eq!(s.find(char::is_lowercase), Some(1));
|
||||
/// assert_eq!(s.find(|c: char| c.is_whitespace() || c.is_lowercase()), Some(1));
|
||||
/// assert_eq!(s.find(|c: char| (c < 'o') && (c > 'a')), Some(4));
|
||||
/// ```
|
||||
///
|
||||
/// Not finding the pattern:
|
||||
|
|
|
@ -1543,6 +1543,7 @@ impl<T: Hash> Hash for Vec<T> {
|
|||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[rustc_on_unimplemented = "vector indices are of type `usize` or ranges of `usize`"]
|
||||
impl<T> Index<usize> for Vec<T> {
|
||||
type Output = T;
|
||||
|
||||
|
@ -1554,6 +1555,7 @@ impl<T> Index<usize> for Vec<T> {
|
|||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[rustc_on_unimplemented = "vector indices are of type `usize` or ranges of `usize`"]
|
||||
impl<T> IndexMut<usize> for Vec<T> {
|
||||
#[inline]
|
||||
fn index_mut(&mut self, index: usize) -> &mut T {
|
||||
|
@ -1562,8 +1564,8 @@ impl<T> IndexMut<usize> for Vec<T> {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[rustc_on_unimplemented = "vector indices are of type `usize` or ranges of `usize`"]
|
||||
impl<T> ops::Index<ops::Range<usize>> for Vec<T> {
|
||||
type Output = [T];
|
||||
|
||||
|
@ -1572,7 +1574,9 @@ impl<T> ops::Index<ops::Range<usize>> for Vec<T> {
|
|||
Index::index(&**self, index)
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[rustc_on_unimplemented = "vector indices are of type `usize` or ranges of `usize`"]
|
||||
impl<T> ops::Index<ops::RangeTo<usize>> for Vec<T> {
|
||||
type Output = [T];
|
||||
|
||||
|
@ -1581,7 +1585,9 @@ impl<T> ops::Index<ops::RangeTo<usize>> for Vec<T> {
|
|||
Index::index(&**self, index)
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[rustc_on_unimplemented = "vector indices are of type `usize` or ranges of `usize`"]
|
||||
impl<T> ops::Index<ops::RangeFrom<usize>> for Vec<T> {
|
||||
type Output = [T];
|
||||
|
||||
|
@ -1590,7 +1596,9 @@ impl<T> ops::Index<ops::RangeFrom<usize>> for Vec<T> {
|
|||
Index::index(&**self, index)
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[rustc_on_unimplemented = "vector indices are of type `usize` or ranges of `usize`"]
|
||||
impl<T> ops::Index<ops::RangeFull> for Vec<T> {
|
||||
type Output = [T];
|
||||
|
||||
|
@ -1599,7 +1607,9 @@ impl<T> ops::Index<ops::RangeFull> for Vec<T> {
|
|||
self
|
||||
}
|
||||
}
|
||||
|
||||
#[unstable(feature = "inclusive_range", reason = "recently added, follows RFC", issue = "28237")]
|
||||
#[rustc_on_unimplemented = "vector indices are of type `usize` or ranges of `usize`"]
|
||||
impl<T> ops::Index<ops::RangeInclusive<usize>> for Vec<T> {
|
||||
type Output = [T];
|
||||
|
||||
|
@ -1608,7 +1618,9 @@ impl<T> ops::Index<ops::RangeInclusive<usize>> for Vec<T> {
|
|||
Index::index(&**self, index)
|
||||
}
|
||||
}
|
||||
|
||||
#[unstable(feature = "inclusive_range", reason = "recently added, follows RFC", issue = "28237")]
|
||||
#[rustc_on_unimplemented = "vector indices are of type `usize` or ranges of `usize`"]
|
||||
impl<T> ops::Index<ops::RangeToInclusive<usize>> for Vec<T> {
|
||||
type Output = [T];
|
||||
|
||||
|
@ -1619,41 +1631,52 @@ impl<T> ops::Index<ops::RangeToInclusive<usize>> for Vec<T> {
|
|||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[rustc_on_unimplemented = "vector indices are of type `usize` or ranges of `usize`"]
|
||||
impl<T> ops::IndexMut<ops::Range<usize>> for Vec<T> {
|
||||
#[inline]
|
||||
fn index_mut(&mut self, index: ops::Range<usize>) -> &mut [T] {
|
||||
IndexMut::index_mut(&mut **self, index)
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[rustc_on_unimplemented = "vector indices are of type `usize` or ranges of `usize`"]
|
||||
impl<T> ops::IndexMut<ops::RangeTo<usize>> for Vec<T> {
|
||||
#[inline]
|
||||
fn index_mut(&mut self, index: ops::RangeTo<usize>) -> &mut [T] {
|
||||
IndexMut::index_mut(&mut **self, index)
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[rustc_on_unimplemented = "vector indices are of type `usize` or ranges of `usize`"]
|
||||
impl<T> ops::IndexMut<ops::RangeFrom<usize>> for Vec<T> {
|
||||
#[inline]
|
||||
fn index_mut(&mut self, index: ops::RangeFrom<usize>) -> &mut [T] {
|
||||
IndexMut::index_mut(&mut **self, index)
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[rustc_on_unimplemented = "vector indices are of type `usize` or ranges of `usize`"]
|
||||
impl<T> ops::IndexMut<ops::RangeFull> for Vec<T> {
|
||||
#[inline]
|
||||
fn index_mut(&mut self, _index: ops::RangeFull) -> &mut [T] {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
#[unstable(feature = "inclusive_range", reason = "recently added, follows RFC", issue = "28237")]
|
||||
#[rustc_on_unimplemented = "vector indices are of type `usize` or ranges of `usize`"]
|
||||
impl<T> ops::IndexMut<ops::RangeInclusive<usize>> for Vec<T> {
|
||||
#[inline]
|
||||
fn index_mut(&mut self, index: ops::RangeInclusive<usize>) -> &mut [T] {
|
||||
IndexMut::index_mut(&mut **self, index)
|
||||
}
|
||||
}
|
||||
|
||||
#[unstable(feature = "inclusive_range", reason = "recently added, follows RFC", issue = "28237")]
|
||||
#[rustc_on_unimplemented = "vector indices are of type `usize` or ranges of `usize`"]
|
||||
impl<T> ops::IndexMut<ops::RangeToInclusive<usize>> for Vec<T> {
|
||||
#[inline]
|
||||
fn index_mut(&mut self, index: ops::RangeToInclusive<usize>) -> &mut [T] {
|
||||
|
|
|
@ -19,7 +19,7 @@ libc = { path = "../rustc/libc_shim" }
|
|||
|
||||
[build-dependencies]
|
||||
build_helper = { path = "../build_helper" }
|
||||
cc = "1.0"
|
||||
cc = "1.0.1"
|
||||
|
||||
[features]
|
||||
debug = []
|
||||
|
|
|
@ -63,15 +63,6 @@ fn main() {
|
|||
_ => return,
|
||||
};
|
||||
|
||||
let compiler = cc::Build::new().get_compiler();
|
||||
// only msvc returns None for ar so unwrap is okay
|
||||
let ar = build_helper::cc2ar(compiler.path(), &target).unwrap();
|
||||
let cflags = compiler.args()
|
||||
.iter()
|
||||
.map(|s| s.to_str().unwrap())
|
||||
.collect::<Vec<_>>()
|
||||
.join(" ");
|
||||
|
||||
let mut cmd = Command::new("sh");
|
||||
cmd.arg(native.src_dir.join("configure")
|
||||
.to_str()
|
||||
|
@ -79,8 +70,6 @@ fn main() {
|
|||
.replace("C:\\", "/c/")
|
||||
.replace("\\", "/"))
|
||||
.current_dir(&native.out_dir)
|
||||
.env("CC", compiler.path())
|
||||
.env("EXTRA_CFLAGS", cflags.clone())
|
||||
// jemalloc generates Makefile deps using GCC's "-MM" flag. This means
|
||||
// that GCC will run the preprocessor, and only the preprocessor, over
|
||||
// jemalloc's source files. If we don't specify CPPFLAGS, then at least
|
||||
|
@ -89,9 +78,7 @@ fn main() {
|
|||
// passed to GCC, and then GCC won't define the
|
||||
// "__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4" macro that jemalloc needs to
|
||||
// select an atomic operation implementation.
|
||||
.env("CPPFLAGS", cflags.clone())
|
||||
.env("AR", &ar)
|
||||
.env("RANLIB", format!("{} s", ar.display()));
|
||||
.env("CPPFLAGS", env::var_os("CFLAGS").unwrap_or_default());
|
||||
|
||||
if target.contains("ios") {
|
||||
cmd.arg("--disable-tls");
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#![unstable(feature = "alloc_system",
|
||||
reason = "this library is unlikely to be stabilized in its current \
|
||||
form or name",
|
||||
issue = "27783")]
|
||||
issue = "32838")]
|
||||
#![feature(global_allocator)]
|
||||
#![feature(allocator_api)]
|
||||
#![feature(alloc)]
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
[package]
|
||||
authors = ["The Rust Project Developers"]
|
||||
name = "collections"
|
||||
version = "0.0.0"
|
||||
|
||||
[lib]
|
||||
name = "collections"
|
||||
path = "lib.rs"
|
||||
|
||||
[dependencies]
|
||||
alloc = { path = "../liballoc" }
|
||||
core = { path = "../libcore" }
|
|
@ -1,68 +0,0 @@
|
|||
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![allow(unused_attributes)]
|
||||
#![unstable(feature = "collections",
|
||||
reason = "this library is unlikely to be stabilized in its current \
|
||||
form or name",
|
||||
issue = "27783")]
|
||||
#![rustc_deprecated(since = "1.20.0",
|
||||
reason = "collections moved to `alloc`")]
|
||||
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
|
||||
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
|
||||
html_root_url = "https://doc.rust-lang.org/nightly/",
|
||||
issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/",
|
||||
test(no_crate_inject, attr(allow(unused_variables), deny(warnings))))]
|
||||
#![no_std]
|
||||
#![deny(warnings)]
|
||||
|
||||
#![feature(alloc)]
|
||||
#![feature(collections_range)]
|
||||
#![feature(macro_reexport)]
|
||||
#![feature(staged_api)]
|
||||
|
||||
//! Collection types
|
||||
//!
|
||||
//! See [`std::collections`](../std/collections/index.html) for a detailed
|
||||
//! discussion of collections in Rust.
|
||||
|
||||
#[macro_reexport(vec, format)]
|
||||
extern crate alloc;
|
||||
|
||||
pub use alloc::Bound;
|
||||
|
||||
pub use alloc::binary_heap;
|
||||
pub use alloc::borrow;
|
||||
pub use alloc::fmt;
|
||||
pub use alloc::linked_list;
|
||||
pub use alloc::range;
|
||||
pub use alloc::slice;
|
||||
pub use alloc::str;
|
||||
pub use alloc::string;
|
||||
pub use alloc::vec;
|
||||
pub use alloc::vec_deque;
|
||||
|
||||
pub use alloc::btree_map;
|
||||
pub use alloc::btree_set;
|
||||
|
||||
#[doc(no_inline)]
|
||||
pub use alloc::binary_heap::BinaryHeap;
|
||||
#[doc(no_inline)]
|
||||
pub use alloc::btree_map::BTreeMap;
|
||||
#[doc(no_inline)]
|
||||
pub use alloc::btree_set::BTreeSet;
|
||||
#[doc(no_inline)]
|
||||
pub use alloc::linked_list::LinkedList;
|
||||
#[doc(no_inline)]
|
||||
pub use alloc::vec_deque::VecDeque;
|
||||
#[doc(no_inline)]
|
||||
pub use alloc::string::String;
|
||||
#[doc(no_inline)]
|
||||
pub use alloc::vec::Vec;
|
|
@ -8,7 +8,7 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use fmt::{self, FlagV1};
|
||||
use fmt;
|
||||
|
||||
struct PadAdapter<'a, 'b: 'a> {
|
||||
fmt: &'a mut fmt::Formatter<'b>,
|
||||
|
@ -140,7 +140,7 @@ impl<'a, 'b: 'a> DebugStruct<'a, 'b> {
|
|||
}
|
||||
|
||||
fn is_pretty(&self) -> bool {
|
||||
self.fmt.flags() & (1 << (FlagV1::Alternate as usize)) != 0
|
||||
self.fmt.alternate()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -233,7 +233,7 @@ impl<'a, 'b: 'a> DebugTuple<'a, 'b> {
|
|||
}
|
||||
|
||||
fn is_pretty(&self) -> bool {
|
||||
self.fmt.flags() & (1 << (FlagV1::Alternate as usize)) != 0
|
||||
self.fmt.alternate()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -277,7 +277,7 @@ impl<'a, 'b: 'a> DebugInner<'a, 'b> {
|
|||
}
|
||||
|
||||
fn is_pretty(&self) -> bool {
|
||||
self.fmt.flags() & (1 << (FlagV1::Alternate as usize)) != 0
|
||||
self.fmt.alternate()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -519,6 +519,6 @@ impl<'a, 'b: 'a> DebugMap<'a, 'b> {
|
|||
}
|
||||
|
||||
fn is_pretty(&self) -> bool {
|
||||
self.fmt.flags() & (1 << (FlagV1::Alternate as usize)) != 0
|
||||
self.fmt.alternate()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -322,7 +322,6 @@ impl<'a> ArgumentV1<'a> {
|
|||
|
||||
// flags available in the v1 format of format_args
|
||||
#[derive(Copy, Clone)]
|
||||
#[allow(dead_code)] // SignMinus isn't currently used
|
||||
enum FlagV1 { SignPlus, SignMinus, Alternate, SignAwareZeroPad, }
|
||||
|
||||
impl<'a> Arguments<'a> {
|
||||
|
@ -427,7 +426,7 @@ impl<'a> Display for Arguments<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Format trait for the `?` character.
|
||||
/// `?` formatting.
|
||||
///
|
||||
/// `Debug` should format the output in a programmer-facing, debugging context.
|
||||
///
|
||||
|
@ -593,7 +592,7 @@ pub trait Display {
|
|||
fn fmt(&self, f: &mut Formatter) -> Result;
|
||||
}
|
||||
|
||||
/// Format trait for the `o` character.
|
||||
/// `o` formatting.
|
||||
///
|
||||
/// The `Octal` trait should format its output as a number in base-8.
|
||||
///
|
||||
|
@ -640,7 +639,7 @@ pub trait Octal {
|
|||
fn fmt(&self, f: &mut Formatter) -> Result;
|
||||
}
|
||||
|
||||
/// Format trait for the `b` character.
|
||||
/// `b` formatting.
|
||||
///
|
||||
/// The `Binary` trait should format its output as a number in binary.
|
||||
///
|
||||
|
@ -687,7 +686,7 @@ pub trait Binary {
|
|||
fn fmt(&self, f: &mut Formatter) -> Result;
|
||||
}
|
||||
|
||||
/// Format trait for the `x` character.
|
||||
/// `x` formatting.
|
||||
///
|
||||
/// The `LowerHex` trait should format its output as a number in hexadecimal, with `a` through `f`
|
||||
/// in lower case.
|
||||
|
@ -735,7 +734,7 @@ pub trait LowerHex {
|
|||
fn fmt(&self, f: &mut Formatter) -> Result;
|
||||
}
|
||||
|
||||
/// Format trait for the `X` character.
|
||||
/// `X` formatting.
|
||||
///
|
||||
/// The `UpperHex` trait should format its output as a number in hexadecimal, with `A` through `F`
|
||||
/// in upper case.
|
||||
|
@ -783,7 +782,7 @@ pub trait UpperHex {
|
|||
fn fmt(&self, f: &mut Formatter) -> Result;
|
||||
}
|
||||
|
||||
/// Format trait for the `p` character.
|
||||
/// `p` formatting.
|
||||
///
|
||||
/// The `Pointer` trait should format its output as a memory location. This is commonly presented
|
||||
/// as hexadecimal.
|
||||
|
@ -828,7 +827,7 @@ pub trait Pointer {
|
|||
fn fmt(&self, f: &mut Formatter) -> Result;
|
||||
}
|
||||
|
||||
/// Format trait for the `e` character.
|
||||
/// `e` formatting.
|
||||
///
|
||||
/// The `LowerExp` trait should format its output in scientific notation with a lower-case `e`.
|
||||
///
|
||||
|
@ -871,7 +870,7 @@ pub trait LowerExp {
|
|||
fn fmt(&self, f: &mut Formatter) -> Result;
|
||||
}
|
||||
|
||||
/// Format trait for the `E` character.
|
||||
/// `E` formatting.
|
||||
///
|
||||
/// The `UpperExp` trait should format its output in scientific notation with an upper-case `E`.
|
||||
///
|
||||
|
@ -1276,7 +1275,7 @@ impl<'a> Formatter<'a> {
|
|||
write(self.buf, fmt)
|
||||
}
|
||||
|
||||
/// Flags for formatting (packed version of rt::Flag)
|
||||
/// Flags for formatting
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn flags(&self) -> u32 { self.flags }
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ use mem;
|
|||
/// This is currently the default hashing function used by standard library
|
||||
/// (eg. `collections::HashMap` uses it by default).
|
||||
///
|
||||
/// See: https://131002.net/siphash/
|
||||
/// See: <https://131002.net/siphash>
|
||||
#[unstable(feature = "sip_hash_13", issue = "34767")]
|
||||
#[rustc_deprecated(since = "1.13.0",
|
||||
reason = "use `std::collections::hash_map::DefaultHasher` instead")]
|
||||
|
@ -33,7 +33,7 @@ pub struct SipHasher13 {
|
|||
|
||||
/// An implementation of SipHash 2-4.
|
||||
///
|
||||
/// See: https://131002.net/siphash/
|
||||
/// See: <https://131002.net/siphash/>
|
||||
#[unstable(feature = "sip_hash_13", issue = "34767")]
|
||||
#[rustc_deprecated(since = "1.13.0",
|
||||
reason = "use `std::collections::hash_map::DefaultHasher` instead")]
|
||||
|
@ -44,7 +44,7 @@ pub struct SipHasher24 {
|
|||
|
||||
/// An implementation of SipHash 2-4.
|
||||
///
|
||||
/// See: https://131002.net/siphash/
|
||||
/// See: <https://131002.net/siphash/>
|
||||
///
|
||||
/// SipHash is a general-purpose hashing function: it runs at a good
|
||||
/// speed (competitive with Spooky and City) and permits strong _keyed_
|
||||
|
@ -72,6 +72,7 @@ struct Hasher<S: Sip> {
|
|||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
#[repr(C)]
|
||||
struct State {
|
||||
// v0, v2 and v1, v3 show up in pairs in the algorithm,
|
||||
// and simd implementations of SipHash will use vectors
|
||||
|
|
|
@ -2059,14 +2059,23 @@ pub trait Iterator {
|
|||
let mut other = other.into_iter();
|
||||
|
||||
loop {
|
||||
match (self.next(), other.next()) {
|
||||
(None, None) => return Ordering::Equal,
|
||||
(None, _ ) => return Ordering::Less,
|
||||
(_ , None) => return Ordering::Greater,
|
||||
(Some(x), Some(y)) => match x.cmp(&y) {
|
||||
Ordering::Equal => (),
|
||||
non_eq => return non_eq,
|
||||
let x = match self.next() {
|
||||
None => if other.next().is_none() {
|
||||
return Ordering::Equal
|
||||
} else {
|
||||
return Ordering::Less
|
||||
},
|
||||
Some(val) => val,
|
||||
};
|
||||
|
||||
let y = match other.next() {
|
||||
None => return Ordering::Greater,
|
||||
Some(val) => val,
|
||||
};
|
||||
|
||||
match x.cmp(&y) {
|
||||
Ordering::Equal => (),
|
||||
non_eq => return non_eq,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2082,14 +2091,23 @@ pub trait Iterator {
|
|||
let mut other = other.into_iter();
|
||||
|
||||
loop {
|
||||
match (self.next(), other.next()) {
|
||||
(None, None) => return Some(Ordering::Equal),
|
||||
(None, _ ) => return Some(Ordering::Less),
|
||||
(_ , None) => return Some(Ordering::Greater),
|
||||
(Some(x), Some(y)) => match x.partial_cmp(&y) {
|
||||
Some(Ordering::Equal) => (),
|
||||
non_eq => return non_eq,
|
||||
let x = match self.next() {
|
||||
None => if other.next().is_none() {
|
||||
return Some(Ordering::Equal)
|
||||
} else {
|
||||
return Some(Ordering::Less)
|
||||
},
|
||||
Some(val) => val,
|
||||
};
|
||||
|
||||
let y = match other.next() {
|
||||
None => return Some(Ordering::Greater),
|
||||
Some(val) => val,
|
||||
};
|
||||
|
||||
match x.partial_cmp(&y) {
|
||||
Some(Ordering::Equal) => (),
|
||||
non_eq => return non_eq,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2105,11 +2123,17 @@ pub trait Iterator {
|
|||
let mut other = other.into_iter();
|
||||
|
||||
loop {
|
||||
match (self.next(), other.next()) {
|
||||
(None, None) => return true,
|
||||
(None, _) | (_, None) => return false,
|
||||
(Some(x), Some(y)) => if x != y { return false },
|
||||
}
|
||||
let x = match self.next() {
|
||||
None => return other.next().is_none(),
|
||||
Some(val) => val,
|
||||
};
|
||||
|
||||
let y = match other.next() {
|
||||
None => return false,
|
||||
Some(val) => val,
|
||||
};
|
||||
|
||||
if x != y { return false }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2124,11 +2148,17 @@ pub trait Iterator {
|
|||
let mut other = other.into_iter();
|
||||
|
||||
loop {
|
||||
match (self.next(), other.next()) {
|
||||
(None, None) => return false,
|
||||
(None, _) | (_, None) => return true,
|
||||
(Some(x), Some(y)) => if x.ne(&y) { return true },
|
||||
}
|
||||
let x = match self.next() {
|
||||
None => return other.next().is_some(),
|
||||
Some(val) => val,
|
||||
};
|
||||
|
||||
let y = match other.next() {
|
||||
None => return true,
|
||||
Some(val) => val,
|
||||
};
|
||||
|
||||
if x != y { return true }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2143,18 +2173,21 @@ pub trait Iterator {
|
|||
let mut other = other.into_iter();
|
||||
|
||||
loop {
|
||||
match (self.next(), other.next()) {
|
||||
(None, None) => return false,
|
||||
(None, _ ) => return true,
|
||||
(_ , None) => return false,
|
||||
(Some(x), Some(y)) => {
|
||||
match x.partial_cmp(&y) {
|
||||
Some(Ordering::Less) => return true,
|
||||
Some(Ordering::Equal) => {}
|
||||
Some(Ordering::Greater) => return false,
|
||||
None => return false,
|
||||
}
|
||||
},
|
||||
let x = match self.next() {
|
||||
None => return other.next().is_some(),
|
||||
Some(val) => val,
|
||||
};
|
||||
|
||||
let y = match other.next() {
|
||||
None => return false,
|
||||
Some(val) => val,
|
||||
};
|
||||
|
||||
match x.partial_cmp(&y) {
|
||||
Some(Ordering::Less) => return true,
|
||||
Some(Ordering::Equal) => (),
|
||||
Some(Ordering::Greater) => return false,
|
||||
None => return false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2170,18 +2203,21 @@ pub trait Iterator {
|
|||
let mut other = other.into_iter();
|
||||
|
||||
loop {
|
||||
match (self.next(), other.next()) {
|
||||
(None, None) => return true,
|
||||
(None, _ ) => return true,
|
||||
(_ , None) => return false,
|
||||
(Some(x), Some(y)) => {
|
||||
match x.partial_cmp(&y) {
|
||||
Some(Ordering::Less) => return true,
|
||||
Some(Ordering::Equal) => {}
|
||||
Some(Ordering::Greater) => return false,
|
||||
None => return false,
|
||||
}
|
||||
},
|
||||
let x = match self.next() {
|
||||
None => { other.next(); return true; },
|
||||
Some(val) => val,
|
||||
};
|
||||
|
||||
let y = match other.next() {
|
||||
None => return false,
|
||||
Some(val) => val,
|
||||
};
|
||||
|
||||
match x.partial_cmp(&y) {
|
||||
Some(Ordering::Less) => return true,
|
||||
Some(Ordering::Equal) => (),
|
||||
Some(Ordering::Greater) => return false,
|
||||
None => return false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2197,18 +2233,21 @@ pub trait Iterator {
|
|||
let mut other = other.into_iter();
|
||||
|
||||
loop {
|
||||
match (self.next(), other.next()) {
|
||||
(None, None) => return false,
|
||||
(None, _ ) => return false,
|
||||
(_ , None) => return true,
|
||||
(Some(x), Some(y)) => {
|
||||
match x.partial_cmp(&y) {
|
||||
Some(Ordering::Less) => return false,
|
||||
Some(Ordering::Equal) => {}
|
||||
Some(Ordering::Greater) => return true,
|
||||
None => return false,
|
||||
}
|
||||
}
|
||||
let x = match self.next() {
|
||||
None => { other.next(); return false; },
|
||||
Some(val) => val,
|
||||
};
|
||||
|
||||
let y = match other.next() {
|
||||
None => return true,
|
||||
Some(val) => val,
|
||||
};
|
||||
|
||||
match x.partial_cmp(&y) {
|
||||
Some(Ordering::Less) => return false,
|
||||
Some(Ordering::Equal) => (),
|
||||
Some(Ordering::Greater) => return true,
|
||||
None => return false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2224,18 +2263,21 @@ pub trait Iterator {
|
|||
let mut other = other.into_iter();
|
||||
|
||||
loop {
|
||||
match (self.next(), other.next()) {
|
||||
(None, None) => return true,
|
||||
(None, _ ) => return false,
|
||||
(_ , None) => return true,
|
||||
(Some(x), Some(y)) => {
|
||||
match x.partial_cmp(&y) {
|
||||
Some(Ordering::Less) => return false,
|
||||
Some(Ordering::Equal) => {}
|
||||
Some(Ordering::Greater) => return true,
|
||||
None => return false,
|
||||
}
|
||||
},
|
||||
let x = match self.next() {
|
||||
None => return other.next().is_none(),
|
||||
Some(val) => val,
|
||||
};
|
||||
|
||||
let y = match other.next() {
|
||||
None => return true,
|
||||
Some(val) => val,
|
||||
};
|
||||
|
||||
match x.partial_cmp(&y) {
|
||||
Some(Ordering::Less) => return false,
|
||||
Some(Ordering::Equal) => (),
|
||||
Some(Ordering::Greater) => return true,
|
||||
None => return false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -682,7 +682,7 @@ mod builtin {
|
|||
#[cfg(dox)]
|
||||
macro_rules! file { () => ({ /* compiler built-in */ }) }
|
||||
|
||||
/// A macro which stringifies its argument.
|
||||
/// A macro which stringifies its arguments.
|
||||
///
|
||||
/// For more information, see the documentation for [`std::stringify!`].
|
||||
///
|
||||
|
@ -690,7 +690,7 @@ mod builtin {
|
|||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[macro_export]
|
||||
#[cfg(dox)]
|
||||
macro_rules! stringify { ($t:tt) => ({ /* compiler built-in */ }) }
|
||||
macro_rules! stringify { ($($t:tt)*) => ({ /* compiler built-in */ }) }
|
||||
|
||||
/// Includes a utf8-encoded file as a string.
|
||||
///
|
||||
|
|
|
@ -429,9 +429,11 @@ pub fn align_of_val<T: ?Sized>(val: &T) -> usize {
|
|||
|
||||
/// Returns whether dropping values of type `T` matters.
|
||||
///
|
||||
/// This is purely an optimization hint, and may be implemented conservatively.
|
||||
/// For instance, always returning `true` would be a valid implementation of
|
||||
/// this function.
|
||||
/// This is purely an optimization hint, and may be implemented conservatively:
|
||||
/// it may return `true` for types that don't actually need to be dropped.
|
||||
/// As such always returning `true` would be a valid implementation of
|
||||
/// this function. However if this function actually returns `false`, then you
|
||||
/// can be certain dropping `T` has no side effect.
|
||||
///
|
||||
/// Low level implementations of things like collections, which need to manually
|
||||
/// drop their data, should use this function to avoid unnecessarily
|
||||
|
@ -836,7 +838,7 @@ pub unsafe fn transmute_copy<T, U>(src: &T) -> U {
|
|||
///
|
||||
/// See the `discriminant` function in this module for more information.
|
||||
#[stable(feature = "discriminant_value", since = "1.21.0")]
|
||||
pub struct Discriminant<T>(u64, PhantomData<*const T>);
|
||||
pub struct Discriminant<T>(u64, PhantomData<fn() -> T>);
|
||||
|
||||
// N.B. These trait implementations cannot be derived because we don't want any bounds on T.
|
||||
|
||||
|
|
|
@ -551,7 +551,7 @@ impl<T: ?Sized> *const T {
|
|||
///
|
||||
/// Most platforms fundamentally can't even construct such an allocation.
|
||||
/// For instance, no known 64-bit platform can ever serve a request
|
||||
/// for 2^63 bytes due to page-table limitations or splitting the address space.
|
||||
/// for 2<sup>63</sup> bytes due to page-table limitations or splitting the address space.
|
||||
/// However, some 32-bit and 16-bit platforms may successfully serve a request for
|
||||
/// more than `isize::MAX` bytes with things like Physical Address
|
||||
/// Extension. As such, memory acquired directly from allocators or memory
|
||||
|
@ -684,7 +684,7 @@ impl<T: ?Sized> *const T {
|
|||
///
|
||||
/// Most platforms fundamentally can't even construct such an allocation.
|
||||
/// For instance, no known 64-bit platform can ever serve a request
|
||||
/// for 2^63 bytes due to page-table limitations or splitting the address space.
|
||||
/// for 2<sup>63</sup> bytes due to page-table limitations or splitting the address space.
|
||||
/// However, some 32-bit and 16-bit platforms may successfully serve a request for
|
||||
/// more than `isize::MAX` bytes with things like Physical Address
|
||||
/// Extension. As such, memory acquired directly from allocators or memory
|
||||
|
@ -743,7 +743,7 @@ impl<T: ?Sized> *const T {
|
|||
///
|
||||
/// Most platforms fundamentally can't even construct such an allocation.
|
||||
/// For instance, no known 64-bit platform can ever serve a request
|
||||
/// for 2^63 bytes due to page-table limitations or splitting the address space.
|
||||
/// for 2<sup>63</sup> bytes due to page-table limitations or splitting the address space.
|
||||
/// However, some 32-bit and 16-bit platforms may successfully serve a request for
|
||||
/// more than `isize::MAX` bytes with things like Physical Address
|
||||
/// Extension. As such, memory acquired directly from allocators or memory
|
||||
|
@ -1182,7 +1182,7 @@ impl<T: ?Sized> *mut T {
|
|||
///
|
||||
/// Most platforms fundamentally can't even construct such an allocation.
|
||||
/// For instance, no known 64-bit platform can ever serve a request
|
||||
/// for 2^63 bytes due to page-table limitations or splitting the address space.
|
||||
/// for 2<sup>63</sup> bytes due to page-table limitations or splitting the address space.
|
||||
/// However, some 32-bit and 16-bit platforms may successfully serve a request for
|
||||
/// more than `isize::MAX` bytes with things like Physical Address
|
||||
/// Extension. As such, memory acquired directly from allocators or memory
|
||||
|
@ -1382,7 +1382,7 @@ impl<T: ?Sized> *mut T {
|
|||
///
|
||||
/// Most platforms fundamentally can't even construct such an allocation.
|
||||
/// For instance, no known 64-bit platform can ever serve a request
|
||||
/// for 2^63 bytes due to page-table limitations or splitting the address space.
|
||||
/// for 2<sup>63</sup> bytes due to page-table limitations or splitting the address space.
|
||||
/// However, some 32-bit and 16-bit platforms may successfully serve a request for
|
||||
/// more than `isize::MAX` bytes with things like Physical Address
|
||||
/// Extension. As such, memory acquired directly from allocators or memory
|
||||
|
@ -1441,7 +1441,7 @@ impl<T: ?Sized> *mut T {
|
|||
///
|
||||
/// Most platforms fundamentally can't even construct such an allocation.
|
||||
/// For instance, no known 64-bit platform can ever serve a request
|
||||
/// for 2^63 bytes due to page-table limitations or splitting the address space.
|
||||
/// for 2<sup>63</sup> bytes due to page-table limitations or splitting the address space.
|
||||
/// However, some 32-bit and 16-bit platforms may successfully serve a request for
|
||||
/// more than `isize::MAX` bytes with things like Physical Address
|
||||
/// Extension. As such, memory acquired directly from allocators or memory
|
||||
|
|
|
@ -1060,7 +1060,7 @@ unsafe impl<'a, A> TrustedLen for IterMut<'a, A> {}
|
|||
/// [`Result`]: enum.Result.html
|
||||
/// [`into_iter`]: ../iter/trait.IntoIterator.html#tymethod.into_iter
|
||||
/// [`IntoIterator`]: ../iter/trait.IntoIterator.html
|
||||
#[derive(Debug)]
|
||||
#[derive(Clone, Debug)]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct IntoIter<T> { inner: Option<T> }
|
||||
|
||||
|
|
|
@ -1405,16 +1405,6 @@ impl<'a> DoubleEndedIterator for LinesAny<'a> {
|
|||
#[allow(deprecated)]
|
||||
impl<'a> FusedIterator for LinesAny<'a> {}
|
||||
|
||||
/*
|
||||
Section: Comparing strings
|
||||
*/
|
||||
|
||||
/// Bytewise slice equality
|
||||
#[inline]
|
||||
fn eq_slice(a: &str, b: &str) -> bool {
|
||||
a.as_bytes() == b.as_bytes()
|
||||
}
|
||||
|
||||
/*
|
||||
Section: UTF-8 validation
|
||||
*/
|
||||
|
@ -1590,7 +1580,6 @@ mod traits {
|
|||
use cmp::Ordering;
|
||||
use ops;
|
||||
use slice::{self, SliceIndex};
|
||||
use str::eq_slice;
|
||||
|
||||
/// Implements ordering of strings.
|
||||
///
|
||||
|
@ -1611,7 +1600,7 @@ mod traits {
|
|||
impl PartialEq for str {
|
||||
#[inline]
|
||||
fn eq(&self, other: &str) -> bool {
|
||||
eq_slice(self, other)
|
||||
self.as_bytes() == other.as_bytes()
|
||||
}
|
||||
#[inline]
|
||||
fn ne(&self, other: &str) -> bool { !(*self).eq(other) }
|
||||
|
|
|
@ -119,7 +119,9 @@ pub fn hint_core_should_pause()
|
|||
|
||||
/// A boolean type which can be safely shared between threads.
|
||||
///
|
||||
/// This type has the same in-memory representation as a `bool`.
|
||||
/// This type has the same in-memory representation as a [`bool`].
|
||||
///
|
||||
/// [`bool`]: ../../../std/primitive.bool.html
|
||||
#[cfg(target_has_atomic = "8")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct AtomicBool {
|
||||
|
@ -246,11 +248,13 @@ impl AtomicBool {
|
|||
AtomicBool { v: UnsafeCell::new(v as u8) }
|
||||
}
|
||||
|
||||
/// Returns a mutable reference to the underlying `bool`.
|
||||
/// Returns a mutable reference to the underlying [`bool`].
|
||||
///
|
||||
/// This is safe because the mutable reference guarantees that no other threads are
|
||||
/// concurrently accessing the atomic data.
|
||||
///
|
||||
/// [`bool`]: ../../../std/primitive.bool.html
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
|
@ -369,7 +373,7 @@ impl AtomicBool {
|
|||
unsafe { atomic_swap(self.v.get(), val as u8, order) != 0 }
|
||||
}
|
||||
|
||||
/// Stores a value into the `bool` if the current value is the same as the `current` value.
|
||||
/// Stores a value into the [`bool`] if the current value is the same as the `current` value.
|
||||
///
|
||||
/// The return value is always the previous value. If it is equal to `current`, then the value
|
||||
/// was updated.
|
||||
|
@ -378,6 +382,7 @@ impl AtomicBool {
|
|||
/// ordering of this operation.
|
||||
///
|
||||
/// [`Ordering`]: enum.Ordering.html
|
||||
/// [`bool`]: ../../../std/primitive.bool.html
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
|
@ -401,7 +406,7 @@ impl AtomicBool {
|
|||
}
|
||||
}
|
||||
|
||||
/// Stores a value into the `bool` if the current value is the same as the `current` value.
|
||||
/// Stores a value into the [`bool`] if the current value is the same as the `current` value.
|
||||
///
|
||||
/// The return value is a result indicating whether the new value was written and containing
|
||||
/// the previous value. On success this value is guaranteed to be equal to `current`.
|
||||
|
@ -412,6 +417,7 @@ impl AtomicBool {
|
|||
/// operation fails. The failure ordering can't be [`Release`] or [`AcqRel`] and must
|
||||
/// be equivalent or weaker than the success ordering.
|
||||
///
|
||||
/// [`bool`]: ../../../std/primitive.bool.html
|
||||
/// [`Ordering`]: enum.Ordering.html
|
||||
/// [`Release`]: enum.Ordering.html#variant.Release
|
||||
/// [`AcqRel`]: enum.Ordering.html#variant.Release
|
||||
|
@ -452,7 +458,7 @@ impl AtomicBool {
|
|||
}
|
||||
}
|
||||
|
||||
/// Stores a value into the `bool` if the current value is the same as the `current` value.
|
||||
/// Stores a value into the [`bool`] if the current value is the same as the `current` value.
|
||||
///
|
||||
/// Unlike [`compare_exchange`], this function is allowed to spuriously fail even when the
|
||||
/// comparison succeeds, which can result in more efficient code on some platforms. The
|
||||
|
@ -465,6 +471,7 @@ impl AtomicBool {
|
|||
/// failure ordering can't be [`Release`] or [`AcqRel`] and must be equivalent or
|
||||
/// weaker than the success ordering.
|
||||
///
|
||||
/// [`bool`]: ../../../std/primitive.bool.html
|
||||
/// [`compare_exchange`]: #method.compare_exchange
|
||||
/// [`Ordering`]: enum.Ordering.html
|
||||
/// [`Release`]: enum.Ordering.html#variant.Release
|
||||
|
|
|
@ -243,24 +243,22 @@ fn test_siphash_2_4() {
|
|||
t += 1;
|
||||
}
|
||||
}
|
||||
#[test] #[cfg(target_arch = "arm")]
|
||||
|
||||
#[test]
|
||||
#[cfg(target_pointer_width = "32")]
|
||||
fn test_hash_usize() {
|
||||
let val = 0xdeadbeef_deadbeef_u64;
|
||||
assert!(hash(&(val as u64)) != hash(&(val as usize)));
|
||||
assert_eq!(hash(&(val as u32)), hash(&(val as usize)));
|
||||
}
|
||||
#[test] #[cfg(target_arch = "x86_64")]
|
||||
|
||||
#[test]
|
||||
#[cfg(target_pointer_width = "64")]
|
||||
fn test_hash_usize() {
|
||||
let val = 0xdeadbeef_deadbeef_u64;
|
||||
assert_eq!(hash(&(val as u64)), hash(&(val as usize)));
|
||||
assert!(hash(&(val as u32)) != hash(&(val as usize)));
|
||||
}
|
||||
#[test] #[cfg(target_arch = "x86")]
|
||||
fn test_hash_usize() {
|
||||
let val = 0xdeadbeef_deadbeef_u64;
|
||||
assert!(hash(&(val as u64)) != hash(&(val as usize)));
|
||||
assert_eq!(hash(&(val as u32)), hash(&(val as usize)));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_hash_idempotent() {
|
||||
|
|
|
@ -121,3 +121,19 @@ fn test_transmute() {
|
|||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[allow(dead_code)]
|
||||
fn test_discriminant_send_sync() {
|
||||
enum Regular {
|
||||
A,
|
||||
B(i32)
|
||||
}
|
||||
enum NotSendSync {
|
||||
A(*const i32)
|
||||
}
|
||||
|
||||
fn is_send_sync<T: Send + Sync>() { }
|
||||
|
||||
is_send_sync::<Discriminant<Regular>>();
|
||||
is_send_sync::<Discriminant<NotSendSync>>();
|
||||
}
|
||||
|
|
|
@ -8,11 +8,6 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// FIXME https://github.com/kripken/emscripten/issues/4563
|
||||
// NB we have to actually not compile this test to avoid
|
||||
// an undefined symbol error
|
||||
#![cfg(not(target_os = "emscripten"))]
|
||||
|
||||
use core::num::flt2dec::estimator::*;
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 44e4018e1a37716286ec98cb5b7dd7d33ecaf940
|
||||
Subproject commit 7e33065ce49759958c0d1c04fcadef961032a943
|
|
@ -488,7 +488,7 @@ impl Literal {
|
|||
pub fn string(string: &str) -> Literal {
|
||||
let mut escaped = String::new();
|
||||
for ch in string.chars() {
|
||||
escaped.extend(ch.escape_unicode());
|
||||
escaped.extend(ch.escape_debug());
|
||||
}
|
||||
Literal(token::Literal(token::Lit::Str_(Symbol::intern(&escaped)), None))
|
||||
}
|
||||
|
|
|
@ -15,4 +15,4 @@ doc = false
|
|||
core = { path = "../libcore" }
|
||||
|
||||
[build-dependencies]
|
||||
cc = "1.0"
|
||||
cc = "1.0.1"
|
||||
|
|
|
@ -98,7 +98,7 @@ entire program, and each did a particular check of transformation.
|
|||
We are gradually replacing this pass-based code with an alternative
|
||||
setup based on on-demand **queries**. In the query-model, we work
|
||||
backwards, executing a *query* that expresses our ultimate goal (e.g.,
|
||||
"compiler this crate"). This query in turn may make other queries
|
||||
"compile this crate"). This query in turn may make other queries
|
||||
(e.g., "get me a list of all modules in the crate"). Those queries
|
||||
make other queries that ultimately bottom out in the base operations,
|
||||
like parsing the input, running the type-checker, and so forth. This
|
||||
|
@ -162,7 +162,7 @@ The compiler uses a number of...idiosyncratic abbreviations and
|
|||
things. This glossary attempts to list them and give you a few
|
||||
pointers for understanding them better.
|
||||
|
||||
- AST -- the **abstract syntax tree** produced the `syntax` crate; reflects user syntax
|
||||
- AST -- the **abstract syntax tree** produced by the `syntax` crate; reflects user syntax
|
||||
very closely.
|
||||
- codegen unit -- when we produce LLVM IR, we group the Rust code into a number of codegen
|
||||
units. Each of these units is processed by LLVM independently from one another,
|
||||
|
|
|
@ -65,7 +65,7 @@ use hir::map::DefPathHash;
|
|||
use hir::{HirId, ItemLocalId};
|
||||
|
||||
use ich::Fingerprint;
|
||||
use ty::{TyCtxt, Instance, InstanceDef, ParamEnvAnd, Ty};
|
||||
use ty::{TyCtxt, Instance, InstanceDef, ParamEnv, ParamEnvAnd, PolyTraitRef, Ty};
|
||||
use ty::subst::Substs;
|
||||
use rustc_data_structures::stable_hasher::{StableHasher, HashStable};
|
||||
use ich::StableHashingContext;
|
||||
|
@ -339,6 +339,25 @@ macro_rules! define_dep_nodes {
|
|||
Ok(DepNode::new_no_params(kind))
|
||||
}
|
||||
}
|
||||
|
||||
/// Used in testing
|
||||
pub fn has_label_string(label: &str) -> bool {
|
||||
match label {
|
||||
$(
|
||||
stringify!($variant) => true,
|
||||
)*
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Contains variant => str representations for constructing
|
||||
/// DepNode groups for tests.
|
||||
#[allow(dead_code, non_upper_case_globals)]
|
||||
pub mod label_strs {
|
||||
$(
|
||||
pub const $variant: &'static str = stringify!($variant);
|
||||
)*
|
||||
}
|
||||
);
|
||||
}
|
||||
|
@ -356,7 +375,7 @@ impl fmt::Debug for DepNode {
|
|||
::ty::tls::with_opt(|opt_tcx| {
|
||||
if let Some(tcx) = opt_tcx {
|
||||
if let Some(def_id) = self.extract_def_id(tcx) {
|
||||
write!(f, "{}", tcx.def_path(def_id).to_string(tcx))?;
|
||||
write!(f, "{}", tcx.def_path_debug_str(def_id))?;
|
||||
} else if let Some(ref s) = tcx.dep_graph.dep_node_debug_str(*self) {
|
||||
write!(f, "{}", s)?;
|
||||
} else {
|
||||
|
@ -457,6 +476,7 @@ define_dep_nodes!( <'tcx>
|
|||
[] TypeOfItem(DefId),
|
||||
[] GenericsOfItem(DefId),
|
||||
[] PredicatesOfItem(DefId),
|
||||
[] InferredOutlivesOf(DefId),
|
||||
[] SuperPredicatesOfItem(DefId),
|
||||
[] TraitDefOfItem(DefId),
|
||||
[] AdtDefOfItem(DefId),
|
||||
|
@ -480,12 +500,15 @@ define_dep_nodes!( <'tcx>
|
|||
[] InherentImpls(DefId),
|
||||
[] TypeckBodiesKrate,
|
||||
[] TypeckTables(DefId),
|
||||
[] UsedTraitImports(DefId),
|
||||
[] HasTypeckTables(DefId),
|
||||
[] ConstEval { param_env: ParamEnvAnd<'tcx, (DefId, &'tcx Substs<'tcx>)> },
|
||||
[] SymbolName(DefId),
|
||||
[] InstanceSymbolName { instance: Instance<'tcx> },
|
||||
[] SpecializationGraph(DefId),
|
||||
[] ObjectSafety(DefId),
|
||||
[] FulfillObligation { param_env: ParamEnv<'tcx>, trait_ref: PolyTraitRef<'tcx> },
|
||||
[] VtableMethods { trait_ref: PolyTraitRef<'tcx> },
|
||||
|
||||
[] IsCopy { param_env: ParamEnvAnd<'tcx, Ty<'tcx>> },
|
||||
[] IsSized { param_env: ParamEnvAnd<'tcx, Ty<'tcx>> },
|
||||
|
@ -532,6 +555,7 @@ define_dep_nodes!( <'tcx>
|
|||
[] LookupDeprecationEntry(DefId),
|
||||
[] ItemBodyNestedBodies(DefId),
|
||||
[] ConstIsRvaluePromotableToStatic(DefId),
|
||||
[] RvaluePromotableMap(DefId),
|
||||
[] ImplParent(DefId),
|
||||
[] TraitOfItem(DefId),
|
||||
[] IsExportedSymbol(DefId),
|
||||
|
@ -588,6 +612,14 @@ define_dep_nodes!( <'tcx>
|
|||
[] HasCloneClosures(CrateNum),
|
||||
[] HasCopyClosures(CrateNum),
|
||||
|
||||
// This query is not expected to have inputs -- as a result, it's
|
||||
// not a good candidate for "replay" because it's essentially a
|
||||
// pure function of its input (and hence the expectation is that
|
||||
// no caller would be green **apart** from just this
|
||||
// query). Making it anonymous avoids hashing the result, which
|
||||
// may save a bit of time.
|
||||
[anon] EraseRegionsTy { ty: Ty<'tcx> },
|
||||
|
||||
[] Freevars(DefId),
|
||||
[] MaybeUnusedTraitImport(DefId),
|
||||
[] MaybeUnusedExternCrates,
|
||||
|
@ -601,7 +633,7 @@ define_dep_nodes!( <'tcx>
|
|||
[] CodegenUnit(InternedString),
|
||||
[] CompileCodegenUnit(InternedString),
|
||||
[] OutputFilenames,
|
||||
|
||||
[anon] NormalizeTy,
|
||||
// We use this for most things when incr. comp. is turned off.
|
||||
[] Null,
|
||||
);
|
||||
|
@ -700,8 +732,8 @@ impl<'a, 'gcx: 'tcx + 'a, 'tcx: 'a> DepNodeParams<'a, 'gcx, 'tcx> for (DefId, De
|
|||
let (def_id_0, def_id_1) = *self;
|
||||
|
||||
format!("({}, {})",
|
||||
tcx.def_path(def_id_0).to_string(tcx),
|
||||
tcx.def_path(def_id_1).to_string(tcx))
|
||||
tcx.def_path_debug_str(def_id_0),
|
||||
tcx.def_path_debug_str(def_id_1))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@ use rustc_data_structures::stable_hasher::{HashStable, StableHasher,
|
|||
StableHashingContextProvider};
|
||||
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
|
||||
use rustc_data_structures::indexed_vec::{Idx, IndexVec};
|
||||
use session::config::OutputType;
|
||||
use std::cell::{Ref, RefCell};
|
||||
use std::env;
|
||||
use std::hash::Hash;
|
||||
|
@ -577,7 +576,7 @@ impl DepGraph {
|
|||
"DepGraph::try_mark_green() - Duplicate DepNodeColor \
|
||||
insertion for {:?}", dep_node);
|
||||
|
||||
debug!("try_mark_green({:?}) - END - successfully marked as green", dep_node.kind);
|
||||
debug!("try_mark_green({:?}) - END - successfully marked as green", dep_node);
|
||||
Some(dep_node_index)
|
||||
}
|
||||
|
||||
|
@ -647,7 +646,14 @@ impl DepGraph {
|
|||
pub struct WorkProduct {
|
||||
pub cgu_name: String,
|
||||
/// Saved files associated with this CGU
|
||||
pub saved_files: Vec<(OutputType, String)>,
|
||||
pub saved_files: Vec<(WorkProductFileKind, String)>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, RustcEncodable, RustcDecodable)]
|
||||
pub enum WorkProductFileKind {
|
||||
Object,
|
||||
Bytecode,
|
||||
BytecodeCompressed,
|
||||
}
|
||||
|
||||
pub(super) struct CurrentDepGraph {
|
||||
|
|
|
@ -19,8 +19,9 @@ mod safe;
|
|||
mod serialized;
|
||||
|
||||
pub use self::dep_tracking_map::{DepTrackingMap, DepTrackingMapConfig};
|
||||
pub use self::dep_node::{DepNode, DepKind, DepConstructor, WorkProductId};
|
||||
pub use self::dep_node::{DepNode, DepKind, DepConstructor, WorkProductId, label_strs};
|
||||
pub use self::graph::{DepGraph, WorkProduct, DepNodeIndex, DepNodeColor};
|
||||
pub use self::graph::WorkProductFileKind;
|
||||
pub use self::prev::PreviousDepGraph;
|
||||
pub use self::query::DepGraphQuery;
|
||||
pub use self::safe::AssertDepGraphSafe;
|
||||
|
|
|
@ -57,7 +57,7 @@ carry around references into the HIR, but rather to carry around
|
|||
*identifier numbers* (or just "ids"). Right now, you will find four
|
||||
sorts of identifiers in active use:
|
||||
|
||||
- `DefId`, which primarily name "definitions" or top-level items.
|
||||
- `DefId`, which primarily names "definitions" or top-level items.
|
||||
- You can think of a `DefId` as being shorthand for a very explicit
|
||||
and complete path, like `std::collections::HashMap`. However,
|
||||
these paths are able to name things that are not nameable in
|
||||
|
@ -114,6 +114,6 @@ A **body** represents some kind of executable code, such as the body
|
|||
of a function/closure or the definition of a constant. Bodies are
|
||||
associated with an **owner**, which is typically some kind of item
|
||||
(e.g., a `fn()` or `const`), but could also be a closure expression
|
||||
(e.g., `|x, y| x + y`). You can use the HIR map to find find the body
|
||||
(e.g., `|x, y| x + y`). You can use the HIR map to find the body
|
||||
associated with a given def-id (`maybe_body_owned_by()`) or to find
|
||||
the owner of a body (`body_owner_def_id()`).
|
||||
|
|
|
@ -197,12 +197,12 @@ pub struct DefId {
|
|||
|
||||
impl fmt::Debug for DefId {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "DefId {{ krate: {:?}, node: {:?}",
|
||||
write!(f, "DefId {{ krate: {:?}, index: {:?}",
|
||||
self.krate, self.index)?;
|
||||
|
||||
ty::tls::with_opt(|opt_tcx| {
|
||||
if let Some(tcx) = opt_tcx {
|
||||
write!(f, " => {}", tcx.def_path(*self).to_string(tcx))?;
|
||||
write!(f, " => {}", tcx.def_path_debug_str(*self))?;
|
||||
}
|
||||
Ok(())
|
||||
})?;
|
||||
|
|
|
@ -780,9 +780,7 @@ pub fn walk_fn_kind<'v, V: Visitor<'v>>(visitor: &mut V, function_kind: FnKind<'
|
|||
FnKind::ItemFn(_, generics, ..) => {
|
||||
visitor.visit_generics(generics);
|
||||
}
|
||||
FnKind::Method(_, sig, ..) => {
|
||||
visitor.visit_generics(&sig.generics);
|
||||
}
|
||||
FnKind::Method(..) |
|
||||
FnKind::Closure(_) => {}
|
||||
}
|
||||
}
|
||||
|
@ -802,6 +800,7 @@ pub fn walk_fn<'v, V: Visitor<'v>>(visitor: &mut V,
|
|||
pub fn walk_trait_item<'v, V: Visitor<'v>>(visitor: &mut V, trait_item: &'v TraitItem) {
|
||||
visitor.visit_name(trait_item.span, trait_item.name);
|
||||
walk_list!(visitor, visit_attribute, &trait_item.attrs);
|
||||
visitor.visit_generics(&trait_item.generics);
|
||||
match trait_item.node {
|
||||
TraitItemKind::Const(ref ty, default) => {
|
||||
visitor.visit_id(trait_item.id);
|
||||
|
@ -810,7 +809,6 @@ pub fn walk_trait_item<'v, V: Visitor<'v>>(visitor: &mut V, trait_item: &'v Trai
|
|||
}
|
||||
TraitItemKind::Method(ref sig, TraitMethod::Required(ref names)) => {
|
||||
visitor.visit_id(trait_item.id);
|
||||
visitor.visit_generics(&sig.generics);
|
||||
visitor.visit_fn_decl(&sig.decl);
|
||||
for name in names {
|
||||
visitor.visit_name(name.span, name.node);
|
||||
|
@ -852,6 +850,7 @@ pub fn walk_impl_item<'v, V: Visitor<'v>>(visitor: &mut V, impl_item: &'v ImplIt
|
|||
ref vis,
|
||||
ref defaultness,
|
||||
ref attrs,
|
||||
ref generics,
|
||||
ref node,
|
||||
span
|
||||
} = *impl_item;
|
||||
|
@ -860,6 +859,7 @@ pub fn walk_impl_item<'v, V: Visitor<'v>>(visitor: &mut V, impl_item: &'v ImplIt
|
|||
visitor.visit_vis(vis);
|
||||
visitor.visit_defaultness(defaultness);
|
||||
walk_list!(visitor, visit_attribute, attrs);
|
||||
visitor.visit_generics(generics);
|
||||
match *node {
|
||||
ImplItemKind::Const(ref ty, body) => {
|
||||
visitor.visit_id(impl_item.id);
|
||||
|
|
|
@ -41,7 +41,7 @@ use super::intravisit::Visitor;
|
|||
/// - Example: Lifetime resolution, which wants to bring lifetimes declared on the
|
||||
/// impl into scope while visiting the impl-items, and then back out again.
|
||||
/// - How: Implement `intravisit::Visitor` and override the
|
||||
/// `visit_nested_map()` methods to return
|
||||
/// `nested_visit_map()` methods to return
|
||||
/// `NestedVisitorMap::All`. Walk your crate with
|
||||
/// `intravisit::walk_crate()` invoked on `tcx.hir.krate()`.
|
||||
/// - Pro: Visitor methods for any kind of HIR node, not just item-like things.
|
||||
|
|
|
@ -673,6 +673,7 @@ impl<'a> LoweringContext<'a> {
|
|||
unsafety: self.lower_unsafety(f.unsafety),
|
||||
abi: f.abi,
|
||||
decl: self.lower_fn_decl(&f.decl),
|
||||
arg_names: self.lower_fn_args_to_names(&f.decl),
|
||||
}))
|
||||
}
|
||||
TyKind::Never => hir::TyNever,
|
||||
|
@ -704,7 +705,7 @@ impl<'a> LoweringContext<'a> {
|
|||
let expr = self.lower_body(None, |this| this.lower_expr(expr));
|
||||
hir::TyTypeof(expr)
|
||||
}
|
||||
TyKind::TraitObject(ref bounds) => {
|
||||
TyKind::TraitObject(ref bounds, ..) => {
|
||||
let mut lifetime_bound = None;
|
||||
let bounds = bounds.iter().filter_map(|bound| {
|
||||
match *bound {
|
||||
|
@ -1538,6 +1539,7 @@ impl<'a> LoweringContext<'a> {
|
|||
hir_id,
|
||||
name: this.lower_ident(i.ident),
|
||||
attrs: this.lower_attrs(&i.attrs),
|
||||
generics: this.lower_generics(&i.generics),
|
||||
node: match i.node {
|
||||
TraitItemKind::Const(ref ty, ref default) => {
|
||||
hir::TraitItemKind::Const(this.lower_ty(ty),
|
||||
|
@ -1602,6 +1604,7 @@ impl<'a> LoweringContext<'a> {
|
|||
hir_id,
|
||||
name: this.lower_ident(i.ident),
|
||||
attrs: this.lower_attrs(&i.attrs),
|
||||
generics: this.lower_generics(&i.generics),
|
||||
vis: this.lower_visibility(&i.vis, None),
|
||||
defaultness: this.lower_defaultness(i.defaultness, true /* [1] */),
|
||||
node: match i.node {
|
||||
|
@ -1728,7 +1731,6 @@ impl<'a> LoweringContext<'a> {
|
|||
|
||||
fn lower_method_sig(&mut self, sig: &MethodSig) -> hir::MethodSig {
|
||||
hir::MethodSig {
|
||||
generics: self.lower_generics(&sig.generics),
|
||||
abi: sig.abi,
|
||||
unsafety: self.lower_unsafety(sig.unsafety),
|
||||
constness: self.lower_constness(sig.constness),
|
||||
|
@ -2546,7 +2548,7 @@ impl<'a> LoweringContext<'a> {
|
|||
};
|
||||
|
||||
// Err(err) => #[allow(unreachable_code)]
|
||||
// return Carrier::from_error(From::from(err)),
|
||||
// return Try::from_error(From::from(err)),
|
||||
let err_arm = {
|
||||
let err_ident = self.str_to_ident("err");
|
||||
let err_local = self.pat_ident(e.span, err_ident);
|
||||
|
@ -2665,7 +2667,7 @@ impl<'a> LoweringContext<'a> {
|
|||
-> hir::Visibility {
|
||||
match *v {
|
||||
Visibility::Public => hir::Public,
|
||||
Visibility::Crate(_) => hir::Visibility::Crate,
|
||||
Visibility::Crate(..) => hir::Visibility::Crate,
|
||||
Visibility::Restricted { ref path, id } => {
|
||||
hir::Visibility::Restricted {
|
||||
path: P(self.lower_path(id, path, ParamMode::Explicit, true)),
|
||||
|
|
|
@ -27,7 +27,6 @@ use std::hash::Hash;
|
|||
use syntax::ast;
|
||||
use syntax::ext::hygiene::Mark;
|
||||
use syntax::symbol::{Symbol, InternedString};
|
||||
use ty::TyCtxt;
|
||||
use util::nodemap::NodeMap;
|
||||
|
||||
/// The DefPathTable maps DefIndexes to DefKeys and vice versa.
|
||||
|
@ -296,26 +295,6 @@ impl DefPath {
|
|||
DefPath { data: data, krate: krate }
|
||||
}
|
||||
|
||||
pub fn to_string(&self, tcx: TyCtxt) -> String {
|
||||
let mut s = String::with_capacity(self.data.len() * 16);
|
||||
|
||||
s.push_str(&tcx.original_crate_name(self.krate).as_str());
|
||||
s.push_str("/");
|
||||
// Don't print the whole crate disambiguator. That's just annoying in
|
||||
// debug output.
|
||||
s.push_str(&tcx.crate_disambiguator(self.krate).as_str()[..7]);
|
||||
|
||||
for component in &self.data {
|
||||
write!(s,
|
||||
"::{}[{}]",
|
||||
component.data.as_interned_str(),
|
||||
component.disambiguator)
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
s
|
||||
}
|
||||
|
||||
/// Returns a string representation of the DefPath without
|
||||
/// the crate-prefix. This method is useful if you don't have
|
||||
/// a TyCtxt available.
|
||||
|
|
|
@ -1295,7 +1295,6 @@ pub struct MethodSig {
|
|||
pub constness: Constness,
|
||||
pub abi: Abi,
|
||||
pub decl: P<FnDecl>,
|
||||
pub generics: Generics,
|
||||
}
|
||||
|
||||
// The bodies for items are stored "out of line", in a separate
|
||||
|
@ -1316,6 +1315,7 @@ pub struct TraitItem {
|
|||
pub name: Name,
|
||||
pub hir_id: HirId,
|
||||
pub attrs: HirVec<Attribute>,
|
||||
pub generics: Generics,
|
||||
pub node: TraitItemKind,
|
||||
pub span: Span,
|
||||
}
|
||||
|
@ -1360,6 +1360,7 @@ pub struct ImplItem {
|
|||
pub vis: Visibility,
|
||||
pub defaultness: Defaultness,
|
||||
pub attrs: HirVec<Attribute>,
|
||||
pub generics: Generics,
|
||||
pub node: ImplItemKind,
|
||||
pub span: Span,
|
||||
}
|
||||
|
@ -1418,6 +1419,7 @@ pub struct BareFnTy {
|
|||
pub abi: Abi,
|
||||
pub lifetimes: HirVec<LifetimeDef>,
|
||||
pub decl: P<FnDecl>,
|
||||
pub arg_names: HirVec<Spanned<Name>>,
|
||||
}
|
||||
|
||||
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
|
||||
|
|
|
@ -399,7 +399,8 @@ impl<'a> State<'a> {
|
|||
},
|
||||
span: syntax_pos::DUMMY_SP,
|
||||
};
|
||||
self.print_ty_fn(f.abi, f.unsafety, &f.decl, None, &generics)?;
|
||||
self.print_ty_fn(f.abi, f.unsafety, &f.decl, None, &generics,
|
||||
&f.arg_names[..])?;
|
||||
}
|
||||
hir::TyPath(ref qpath) => {
|
||||
self.print_qpath(qpath, false)?
|
||||
|
@ -879,6 +880,7 @@ impl<'a> State<'a> {
|
|||
pub fn print_method_sig(&mut self,
|
||||
name: ast::Name,
|
||||
m: &hir::MethodSig,
|
||||
generics: &hir::Generics,
|
||||
vis: &hir::Visibility,
|
||||
arg_names: &[Spanned<ast::Name>],
|
||||
body_id: Option<hir::BodyId>)
|
||||
|
@ -888,7 +890,7 @@ impl<'a> State<'a> {
|
|||
m.constness,
|
||||
m.abi,
|
||||
Some(name),
|
||||
&m.generics,
|
||||
generics,
|
||||
vis,
|
||||
arg_names,
|
||||
body_id)
|
||||
|
@ -904,12 +906,14 @@ impl<'a> State<'a> {
|
|||
self.print_associated_const(ti.name, &ty, default, &hir::Inherited)?;
|
||||
}
|
||||
hir::TraitItemKind::Method(ref sig, hir::TraitMethod::Required(ref arg_names)) => {
|
||||
self.print_method_sig(ti.name, sig, &hir::Inherited, arg_names, None)?;
|
||||
self.print_method_sig(ti.name, sig, &ti.generics, &hir::Inherited, arg_names,
|
||||
None)?;
|
||||
self.s.word(";")?;
|
||||
}
|
||||
hir::TraitItemKind::Method(ref sig, hir::TraitMethod::Provided(body)) => {
|
||||
self.head("")?;
|
||||
self.print_method_sig(ti.name, sig, &hir::Inherited, &[], Some(body))?;
|
||||
self.print_method_sig(ti.name, sig, &ti.generics, &hir::Inherited, &[],
|
||||
Some(body))?;
|
||||
self.nbsp()?;
|
||||
self.end()?; // need to close a box
|
||||
self.end()?; // need to close a box
|
||||
|
@ -937,7 +941,7 @@ impl<'a> State<'a> {
|
|||
}
|
||||
hir::ImplItemKind::Method(ref sig, body) => {
|
||||
self.head("")?;
|
||||
self.print_method_sig(ii.name, sig, &ii.vis, &[], Some(body))?;
|
||||
self.print_method_sig(ii.name, sig, &ii.generics, &ii.vis, &[], Some(body))?;
|
||||
self.nbsp()?;
|
||||
self.end()?; // need to close a box
|
||||
self.end()?; // need to close a box
|
||||
|
@ -2140,7 +2144,8 @@ impl<'a> State<'a> {
|
|||
unsafety: hir::Unsafety,
|
||||
decl: &hir::FnDecl,
|
||||
name: Option<ast::Name>,
|
||||
generics: &hir::Generics)
|
||||
generics: &hir::Generics,
|
||||
arg_names: &[Spanned<ast::Name>])
|
||||
-> io::Result<()> {
|
||||
self.ibox(indent_unit)?;
|
||||
if !generics.lifetimes.is_empty() || !generics.ty_params.is_empty() {
|
||||
|
@ -2163,7 +2168,7 @@ impl<'a> State<'a> {
|
|||
name,
|
||||
&generics,
|
||||
&hir::Inherited,
|
||||
&[],
|
||||
arg_names,
|
||||
None)?;
|
||||
self.end()
|
||||
}
|
||||
|
|
|
@ -9,8 +9,6 @@
|
|||
// except according to those terms.
|
||||
|
||||
use rustc_data_structures::stable_hasher;
|
||||
use std::mem;
|
||||
use std::slice;
|
||||
|
||||
#[derive(Eq, PartialEq, Ord, PartialOrd, Hash, Debug, Clone, Copy, RustcEncodable, RustcDecodable)]
|
||||
pub struct Fingerprint(u64, u64);
|
||||
|
@ -54,16 +52,9 @@ impl ::std::fmt::Display for Fingerprint {
|
|||
}
|
||||
|
||||
impl stable_hasher::StableHasherResult for Fingerprint {
|
||||
fn finish(mut hasher: stable_hasher::StableHasher<Self>) -> Self {
|
||||
let hash_bytes: &[u8] = hasher.finalize();
|
||||
|
||||
assert!(hash_bytes.len() >= mem::size_of::<u64>() * 2);
|
||||
let hash_bytes: &[u64] = unsafe {
|
||||
slice::from_raw_parts(hash_bytes.as_ptr() as *const u64, 2)
|
||||
};
|
||||
|
||||
// The bytes returned bytes the Blake2B hasher are always little-endian.
|
||||
Fingerprint(u64::from_le(hash_bytes[0]), u64::from_le(hash_bytes[1]))
|
||||
fn finish(hasher: stable_hasher::StableHasher<Self>) -> Self {
|
||||
let (_0, _1) = hasher.finalize();
|
||||
Fingerprint(_0, _1)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue