Rollup merge of #59309 - o01eg:verbose-copy-files, r=alexcrichton
Add messages for different verbosity levels. Output copy actions.
diff --git a/.travis.yml b/.travis.yml
index 7985b6c..7a8772d 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -12,20 +12,27 @@
depth: 2
submodules: false
+env:
+ global:
+ - CI_JOB_NAME=$TRAVIS_JOB_NAME
+
matrix:
fast_finish: true
include:
# Images used in testing PR and try-build should be run first.
- env: IMAGE=x86_64-gnu-llvm-6.0 RUST_BACKTRACE=1
+ name: x86_64-gnu-llvm-6.0
if: type = pull_request OR branch = auto
- env: IMAGE=dist-x86_64-linux DEPLOY=1
+ name: dist-x86_64-linux
if: branch = try OR branch = auto
# "alternate" deployments, these are "nightlies" but have LLVM assertions
# turned on, they're deployed to a different location primarily for
# additional testing.
- - env: IMAGE=dist-x86_64-linux DEPLOY_ALT=1 CI_JOB_NAME=dist-x86_64-linux-alt
+ - env: IMAGE=dist-x86_64-linux DEPLOY_ALT=1
+ name: dist-x86_64-linux-alt
if: branch = try OR branch = auto
- env: >
@@ -37,9 +44,9 @@
MACOSX_DEPLOYMENT_TARGET=10.7
NO_LLVM_ASSERTIONS=1
NO_DEBUG_ASSERTIONS=1
- CI_JOB_NAME=dist-x86_64-apple-alt
os: osx
osx_image: xcode9.3-moar
+ name: dist-x86_64-apple-alt
if: branch = auto
# macOS builders. These are placed near the beginning because they are very
@@ -60,9 +67,9 @@
MACOSX_STD_DEPLOYMENT_TARGET=10.7
NO_LLVM_ASSERTIONS=1
NO_DEBUG_ASSERTIONS=1
- CI_JOB_NAME=x86_64-apple
os: osx
osx_image: xcode9.3-moar
+ name: x86_64-apple
if: branch = auto
- env: >
@@ -74,9 +81,9 @@
MACOSX_STD_DEPLOYMENT_TARGET=10.7
NO_LLVM_ASSERTIONS=1
NO_DEBUG_ASSERTIONS=1
- CI_JOB_NAME=i686-apple
os: osx
osx_image: xcode9.3-moar
+ name: i686-apple
if: branch = auto
# OSX builders producing releases. These do not run the full test suite and
@@ -95,9 +102,9 @@
NO_LLVM_ASSERTIONS=1
NO_DEBUG_ASSERTIONS=1
DIST_REQUIRE_ALL_TOOLS=1
- CI_JOB_NAME=dist-i686-apple
os: osx
osx_image: xcode9.3-moar
+ name: dist-i686-apple
if: branch = auto
- env: >
@@ -110,81 +117,116 @@
NO_LLVM_ASSERTIONS=1
NO_DEBUG_ASSERTIONS=1
DIST_REQUIRE_ALL_TOOLS=1
- CI_JOB_NAME=dist-x86_64-apple
os: osx
osx_image: xcode9.3-moar
+ name: dist-x86_64-apple
if: branch = auto
# Linux builders, remaining docker images
- env: IMAGE=arm-android
+ name: arm-android
if: branch = auto
- env: IMAGE=armhf-gnu
+ name: armhf-gnu
if: branch = auto
- env: IMAGE=dist-various-1 DEPLOY=1
+ name: dist-various-1
if: branch = auto
- env: IMAGE=dist-various-2 DEPLOY=1
+ name: dist-various-2
if: branch = auto
- env: IMAGE=dist-aarch64-linux DEPLOY=1
+ name: dist-aarch64-linux
if: branch = auto
- env: IMAGE=dist-android DEPLOY=1
+ name: dist-android
if: branch = auto
- env: IMAGE=dist-arm-linux DEPLOY=1
+ name: dist-arm-linux
if: branch = auto
- env: IMAGE=dist-armhf-linux DEPLOY=1
+ name: dist-armhf-linux
if: branch = auto
- env: IMAGE=dist-armv7-linux DEPLOY=1
+ name: dist-armv7-linux
if: branch = auto
- env: IMAGE=dist-i586-gnu-i586-i686-musl DEPLOY=1
+ name: dist-i586-gnu-i586-i686-musl
if: branch = auto
- env: IMAGE=dist-i686-freebsd DEPLOY=1
+ name: dist-i686-freebsd
if: branch = auto
- env: IMAGE=dist-i686-linux DEPLOY=1
+ name: dist-i686-linux
if: branch = auto
- env: IMAGE=dist-mips-linux DEPLOY=1
+ name: dist-mips-linux
if: branch = auto
- env: IMAGE=dist-mips64-linux DEPLOY=1
+ name: dist-mips64-linux
if: branch = auto
- env: IMAGE=dist-mips64el-linux DEPLOY=1
+ name: dist-mips64el-linux
if: branch = auto
- env: IMAGE=dist-mipsel-linux DEPLOY=1
+ name: dist-mipsel-linux
if: branch = auto
- env: IMAGE=dist-powerpc-linux DEPLOY=1
+ name: dist-powerpc-linux
if: branch = auto
- env: IMAGE=dist-powerpc64-linux DEPLOY=1
+ name: dist-powerpc64-linux
if: branch = auto
- env: IMAGE=dist-powerpc64le-linux DEPLOY=1
+ name: dist-powerpc64le-linux
if: branch = auto
- env: IMAGE=dist-s390x-linux DEPLOY=1
+ name: dist-s390x-linux
if: branch = auto
- env: IMAGE=dist-x86_64-freebsd DEPLOY=1
+ name: dist-x86_64-freebsd
if: branch = auto
- env: IMAGE=dist-x86_64-musl DEPLOY=1
+ name: dist-x86_64-musl
if: branch = auto
- env: IMAGE=dist-x86_64-netbsd DEPLOY=1
+ name: dist-x86_64-netbsd
if: branch = auto
- env: IMAGE=asmjs
+ name: asmjs
if: branch = auto
- env: IMAGE=i686-gnu
+ name: i686-gnu
if: branch = auto
- env: IMAGE=i686-gnu-nopt
+ name: i686-gnu-nopt
if: branch = auto
- env: IMAGE=test-various
+ name: test-various
if: branch = auto
- env: IMAGE=x86_64-gnu
+ name: x86_64-gnu
if: branch = auto
- env: IMAGE=x86_64-gnu-full-bootstrap
+ name: x86_64-gnu-full-bootstrap
if: branch = auto
- env: IMAGE=x86_64-gnu-aux
+ name: x86_64-gnu-aux
if: branch = auto
- env: IMAGE=x86_64-gnu-tools
+ name: x86_64-gnu-tools
if: branch = auto OR (type = pull_request AND commit_message =~ /(?i:^update.*\b(rls|rustfmt|clippy|miri|cargo)\b)/)
- env: IMAGE=x86_64-gnu-debug
+ name: x86_64-gnu-debug
if: branch = auto
- env: IMAGE=x86_64-gnu-nopt
+ name: x86_64-gnu-nopt
if: branch = auto
- env: IMAGE=x86_64-gnu-distcheck
+ name: x86_64-gnu-distcheck
if: branch = auto
- env: IMAGE=mingw-check
+ name: mingw-check
if: type = pull_request OR branch = auto
- stage: publish toolstate
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index e785f03..fa40893 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -15,7 +15,7 @@
* [Helpful Links and Information](#helpful-links-and-information)
If you have questions, please make a post on [internals.rust-lang.org][internals] or
-hop on [#rust-internals][pound-rust-internals].
+hop on the [Rust Discord server][rust-discord], [Rust Zulip server][rust-zulip] or [#rust-internals][pound-rust-internals].
As a reminder, all contributors are expected to follow our [Code of Conduct][coc].
@@ -27,14 +27,17 @@
[pound-rust-internals]: https://chat.mibbit.com/?server=irc.mozilla.org&channel=%23rust-internals
[internals]: https://internals.rust-lang.org
+[rust-discord]: http://discord.gg/rust-lang
+[rust-zulip]: https://rust-lang.zulipchat.com
[coc]: https://www.rust-lang.org/conduct.html
+[rustc-guide]: https://rust-lang.github.io/rustc-guide/
[walkthrough]: https://rust-lang.github.io/rustc-guide/walkthrough.html
## Feature Requests
[feature-requests]: #feature-requests
To request a change to the way the Rust language works, please head over
-to the [RFCs repository](https://github.com/rust-lang/rfcs) and view the
+to the [RFCs repository](https://github.com/rust-lang/rfcs) and view the
[README](https://github.com/rust-lang/rfcs/blob/master/README.md)
for instructions.
@@ -129,28 +132,40 @@
before every push to make sure you never forget to make this check.
All pull requests are reviewed by another person. We have a bot,
-@rust-highfive, that will automatically assign a random person to review your
+[@rust-highfive][rust-highfive], that will automatically assign a random person to review your
request.
If you want to request that a specific person reviews your pull request,
-you can add an `r?` to the message. For example, Steve usually reviews
+you can add an `r?` to the message. For example, [Steve][steveklabnik] usually reviews
documentation changes. So if you were to make a documentation change, add
r? @steveklabnik
-to the end of the message, and @rust-highfive will assign @steveklabnik instead
+to the end of the message, and @rust-highfive will assign [@steveklabnik][steveklabnik] instead
of a random person. This is entirely optional.
After someone has reviewed your pull request, they will leave an annotation
on the pull request with an `r+`. It will look something like this:
- @bors: r+ 38fe8d2
+ @bors r+
-This tells @bors, our lovable integration bot, that your pull request has
-been approved. The PR then enters the [merge queue][merge-queue], where @bors
+This tells [@bors][bors], our lovable integration bot, that your pull request has
+been approved. The PR then enters the [merge queue][merge-queue], where [@bors][bors]
will run all the tests on every platform we support. If it all works out,
-@bors will merge your code into `master` and close the pull request.
+[@bors][bors] will merge your code into `master` and close the pull request.
+Depending on the scale of the change, you may see a slightly different form of `r+`:
+
+ @bors r+ rollup
+
+The additional `rollup` tells [@bors][bors] that this change is eligible for to be
+"rolled up". Changes that are rolled up are tested and merged at the same time, to
+speed the process up. Typically only small changes that are expected not to conflict
+with one another are rolled up.
+
+[rust-highfive]: https://github.com/rust-highfive
+[steveklabnik]: https://github.com/steveklabnik
+[bors]: https://github.com/bors
[merge-queue]: https://buildbot2.rust-lang.org/homu/queue/rust
Speaking of tests, Rust has a comprehensive test suite. More information about
@@ -190,7 +205,7 @@
[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
+internals of the compiler. This includes
[Clippy](https://github.com/rust-lang/rust-clippy),
[RLS](https://github.com/rust-lang/rls) and
[rustfmt](https://github.com/rust-lang/rustfmt). If these tools
@@ -292,18 +307,8 @@
Documentation improvements are very welcome. The source of `doc.rust-lang.org`
is located in `src/doc` in the tree, and standard API documentation is generated
-from the source code itself.
-
-Documentation pull requests function in the same way as other pull requests,
-though you may see a slightly different form of `r+`:
-
- @bors: r+ 38fe8d2 rollup
-
-That additional `rollup` tells @bors that this change is eligible for a 'rollup'.
-To save @bors some work, and to get small changes through more quickly, when
-@bors attempts to merge a commit that's rollup-eligible, it will also merge
-the other rollup-eligible patches too, and they'll get tested and merged at
-the same time.
+from the source code itself. Documentation pull requests function in the same way
+as other pull requests.
To find documentation-related issues, sort by the [T-doc label][tdoc].
@@ -428,7 +433,8 @@
* Although out of date, [Tom Lee's great blog article][tlgba] is very helpful
* [rustaceans.org][ro] is helpful, but mostly dedicated to IRC
* The [Rust Compiler Testing Docs][rctd]
-* For @bors, [this cheat sheet][cheatsheet] is helpful (Remember to replace `@homu` with `@bors` in the commands that you use.)
+* For [@bors][bors], [this cheat sheet][cheatsheet] is helpful
+(though you'll need to replace `@homu` with `@bors` in any commands)
* **Google!** ([search only in Rust Documentation][gsearchdocs] to find types, traits, etc. quickly)
* Don't be afraid to ask! The Rust community is friendly and helpful.
diff --git a/Cargo.lock b/Cargo.lock
index d32d075..ec1cda9 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -83,7 +83,7 @@
version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
"termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -95,7 +95,7 @@
dependencies = [
"backtrace-sys 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)",
"cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
- "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-demangle 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -107,7 +107,7 @@
dependencies = [
"cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)",
"compiler_builtins 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
- "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-std-workspace-core 1.0.0",
]
@@ -162,7 +162,7 @@
"filetime 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"getopts 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
- "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
"num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
"petgraph 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)",
"pretty_assertions 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -259,7 +259,7 @@
"jobserver 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
"libgit2-sys 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"miow 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -458,7 +458,7 @@
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -479,7 +479,7 @@
"filetime 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"getopts 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"miow 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -499,7 +499,7 @@
"diff 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
"filetime 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"getopts 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)",
- "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"miow 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -530,7 +530,7 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"core-foundation-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -657,7 +657,7 @@
dependencies = [
"curl-sys 0.4.15 (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.46 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
"openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"openssl-sys 0.9.40 (registry+https://github.com/rust-lang/crates.io-index)",
"schannel 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -671,7 +671,7 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)",
- "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
"libnghttp2-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"libz-sys 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)",
"openssl-sys 0.9.40 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -729,7 +729,7 @@
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -738,7 +738,7 @@
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
"redox_users 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -749,7 +749,7 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"compiler_builtins 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
- "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-std-workspace-core 1.0.0",
]
@@ -858,7 +858,7 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
- "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
"redox_syscall 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -873,7 +873,7 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"crc32fast 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
"libz-sys 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)",
"miniz-sys 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
"miniz_oxide_c_api 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -915,7 +915,7 @@
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -988,7 +988,7 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
- "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
"libgit2-sys 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1163,7 +1163,7 @@
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -1200,7 +1200,7 @@
dependencies = [
"cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)",
"fs_extra 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -1208,7 +1208,7 @@
version = "0.1.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -1256,7 +1256,7 @@
[[package]]
name = "libc"
-version = "0.2.46"
+version = "0.2.50"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"rustc-std-workspace-core 1.0.0",
@@ -1269,7 +1269,7 @@
dependencies = [
"cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)",
"curl-sys 0.4.15 (registry+https://github.com/rust-lang/crates.io-index)",
- "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
"libssh2-sys 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"libz-sys 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)",
"openssl-sys 0.9.40 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1282,7 +1282,7 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)",
- "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -1291,7 +1291,7 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)",
- "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
"libz-sys 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)",
"openssl-sys 0.9.40 (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1313,7 +1313,7 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)",
- "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
"vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -1379,7 +1379,7 @@
dependencies = [
"cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)",
"filetime 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
- "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -1480,7 +1480,7 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
- "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
"version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -1489,7 +1489,7 @@
version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -1512,7 +1512,7 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)",
- "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -1530,7 +1530,7 @@
dependencies = [
"cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)",
"crc 1.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
"miniz_oxide 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -1544,7 +1544,7 @@
"iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1569,7 +1569,7 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
"mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -1616,7 +1616,7 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
- "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -1662,7 +1662,7 @@
version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -1689,7 +1689,7 @@
"cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
"openssl-sys 0.9.40 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -1712,7 +1712,7 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)",
- "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
"openssl-src 111.1.0+1.1.1a (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
"vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1750,7 +1750,7 @@
dependencies = [
"compiler_builtins 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"core 0.0.0",
- "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -1760,7 +1760,7 @@
"alloc 0.0.0",
"compiler_builtins 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"core 0.0.0",
- "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
"unwind 0.0.0",
]
@@ -1778,7 +1778,7 @@
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -2027,7 +2027,7 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
- "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -2038,7 +2038,7 @@
dependencies = [
"cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
- "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
"rand_core 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -2050,7 +2050,7 @@
dependencies = [
"cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
- "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
"rand_chacha 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -2066,7 +2066,7 @@
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rand_core 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -2088,7 +2088,7 @@
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rand_core 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -2113,7 +2113,7 @@
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rand_core 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -2132,7 +2132,7 @@
dependencies = [
"crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
"num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -2515,7 +2515,7 @@
dependencies = [
"crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
"num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -2612,7 +2612,7 @@
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)",
"jobserver 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
- "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"memmap 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
"num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -3208,7 +3208,7 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"arc-swap 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
- "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -3235,7 +3235,7 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
- "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
"redox_syscall 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -3256,7 +3256,7 @@
"core 0.0.0",
"dlmalloc 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"fortanix-sgx-abi 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
"panic_abort 0.0.0",
"panic_unwind 0.0.0",
"profiler_builtins 0.0.0",
@@ -3407,7 +3407,7 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"filetime 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
- "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
"redox_syscall 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)",
"xattr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -3418,7 +3418,7 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
- "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"redox_syscall 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)",
"remove_dir_all 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -3466,7 +3466,7 @@
version = "1.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
"redox_syscall 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)",
"redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -3485,7 +3485,7 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"getopts 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)",
- "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
"term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -3519,7 +3519,7 @@
version = "0.1.40"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
"redox_syscall 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -3600,7 +3600,7 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)",
- "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
"mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)",
"mio-named-pipes 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -3632,7 +3632,7 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)",
- "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
"mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)",
"mio-uds 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)",
"signal-hook 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -3703,7 +3703,7 @@
"bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)",
"futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)",
"iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)",
"mio-uds 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -3819,7 +3819,7 @@
dependencies = [
"compiler_builtins 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"core 0.0.0",
- "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -3886,7 +3886,7 @@
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -3959,7 +3959,7 @@
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -4094,7 +4094,7 @@
"checksum lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "76f033c7ad61445c5b347c7382dd1237847eb1bce590fe50365dcb33d546be73"
"checksum lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a374c89b9db55895453a74c1e38861d9deec0b01b405a82516e9d5de4820dea1"
"checksum lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f"
-"checksum libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)" = "023a4cd09b2ff695f9734c1934145a315594b7986398496841c7031a5a1bbdbd"
+"checksum libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)" = "aab692d7759f5cd8c859e169db98ae5b52c924add2af5fbbca11d12fefb567c1"
"checksum libgit2-sys 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)" = "48441cb35dc255da8ae72825689a95368bf510659ae1ad55dc4aa88cb1789bf1"
"checksum libnghttp2-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d75d7966bda4730b722d1eab8e668df445368a24394bae9fc1e8dc0ab3dbe4f4"
"checksum libssh2-sys 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "126a1f4078368b163bfdee65fbab072af08a1b374a5551b21e87ade27b1fbf9d"
diff --git a/appveyor.yml b/appveyor.yml
index 2abf723..ab0a29d 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -10,34 +10,34 @@
matrix:
# 32/64 bit MSVC tests
- - MSYS_BITS: 64
+ - CI_JOB_NAME: x86_64-msvc
+ MSYS_BITS: 64
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-profiler
SCRIPT: python x.py test
- CI_JOB_NAME: x86_64-msvc
- - MSYS_BITS: 32
+ - CI_JOB_NAME: i686-msvc-1
+ MSYS_BITS: 32
RUST_CONFIGURE_ARGS: --build=i686-pc-windows-msvc
SCRIPT: make appveyor-subset-1
- CI_JOB_NAME: i686-msvc-1
- - MSYS_BITS: 32
+ - CI_JOB_NAME: i686-msvc-2
+ MSYS_BITS: 32
RUST_CONFIGURE_ARGS: --build=i686-pc-windows-msvc
SCRIPT: make appveyor-subset-2
- CI_JOB_NAME: i686-msvc-2
# MSVC aux tests
- - MSYS_BITS: 64
+ - CI_JOB_NAME: x86_64-msvc-aux
+ MSYS_BITS: 64
RUST_CHECK_TARGET: check-aux EXCLUDE_CARGO=1
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc
- CI_JOB_NAME: x86_64-msvc-aux
- - MSYS_BITS: 64
+ - CI_JOB_NAME: x86_64-msvc-cargo
+ MSYS_BITS: 64
SCRIPT: python x.py test src/tools/cargotest src/tools/cargo
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc
- CI_JOB_NAME: x86_64-msvc-cargo
# MSVC tools tests
- - MSYS_BITS: 64
+ - CI_JOB_NAME: x86_64-msvc-tools
+ MSYS_BITS: 64
SCRIPT: src/ci/docker/x86_64-gnu-tools/checktools.sh x.py /tmp/toolstates.json windows
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --save-toolstates=/tmp/toolstates.json --enable-test-miri
- CI_JOB_NAME: x86_64-msvc-tools
# 32/64-bit MinGW builds.
#
@@ -52,30 +52,31 @@
# bucket, but they cleraly didn't originate there! The downloads originally
# came from the mingw-w64 SourceForge download site. Unfortunately
# SourceForge is notoriously flaky, so we mirror it on our own infrastructure.
- - MSYS_BITS: 32
+ - CI_JOB_NAME: i686-mingw-1
+ MSYS_BITS: 32
RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu
SCRIPT: make appveyor-subset-1
MINGW_URL: https://s3-us-west-1.amazonaws.com/rust-lang-ci2/rust-ci-mirror
MINGW_ARCHIVE: i686-6.3.0-release-posix-dwarf-rt_v5-rev2.7z
MINGW_DIR: mingw32
- CI_JOB_NAME: i686-mingw-1
- - MSYS_BITS: 32
+ - CI_JOB_NAME: i686-mingw-2
+ MSYS_BITS: 32
RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu
SCRIPT: make appveyor-subset-2
MINGW_URL: https://s3-us-west-1.amazonaws.com/rust-lang-ci2/rust-ci-mirror
MINGW_ARCHIVE: i686-6.3.0-release-posix-dwarf-rt_v5-rev2.7z
MINGW_DIR: mingw32
- CI_JOB_NAME: i686-mingw-2
- - MSYS_BITS: 64
+ - CI_JOB_NAME: x86_64-mingw
+ MSYS_BITS: 64
SCRIPT: python x.py test
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-gnu
MINGW_URL: https://s3-us-west-1.amazonaws.com/rust-lang-ci2/rust-ci-mirror
MINGW_ARCHIVE: x86_64-6.3.0-release-posix-seh-rt_v5-rev2.7z
MINGW_DIR: mingw64
- CI_JOB_NAME: x86_64-mingw
# 32/64 bit MSVC and GNU deployment
- - RUST_CONFIGURE_ARGS: >
+ - CI_JOB_NAME: dist-x86_64-msvc
+ RUST_CONFIGURE_ARGS: >
--build=x86_64-pc-windows-msvc
--target=x86_64-pc-windows-msvc,aarch64-pc-windows-msvc
--enable-full-tools
@@ -83,8 +84,8 @@
SCRIPT: python x.py dist
DIST_REQUIRE_ALL_TOOLS: 1
DEPLOY: 1
- CI_JOB_NAME: dist-x86_64-msvc
- - RUST_CONFIGURE_ARGS: >
+ - CI_JOB_NAME: dist-i686-msvc
+ RUST_CONFIGURE_ARGS: >
--build=i686-pc-windows-msvc
--target=i586-pc-windows-msvc
--enable-full-tools
@@ -92,8 +93,8 @@
SCRIPT: python x.py dist
DIST_REQUIRE_ALL_TOOLS: 1
DEPLOY: 1
- CI_JOB_NAME: dist-i686-msvc
- - MSYS_BITS: 32
+ - CI_JOB_NAME: dist-i686-mingw
+ MSYS_BITS: 32
RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu --enable-full-tools
SCRIPT: python x.py dist
MINGW_URL: https://s3-us-west-1.amazonaws.com/rust-lang-ci2/rust-ci-mirror
@@ -101,8 +102,8 @@
MINGW_DIR: mingw32
DIST_REQUIRE_ALL_TOOLS: 1
DEPLOY: 1
- CI_JOB_NAME: dist-i686-mingw
- - MSYS_BITS: 64
+ - CI_JOB_NAME: dist-x86_64-mingw
+ MSYS_BITS: 64
SCRIPT: python x.py dist
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-gnu --enable-full-tools
MINGW_URL: https://s3-us-west-1.amazonaws.com/rust-lang-ci2/rust-ci-mirror
@@ -110,14 +111,13 @@
MINGW_DIR: mingw64
DIST_REQUIRE_ALL_TOOLS: 1
DEPLOY: 1
- CI_JOB_NAME: dist-x86_64-mingw
# "alternate" deployment, see .travis.yml for more info
- - MSYS_BITS: 64
+ - CI_JOB_NAME: dist-x86_64-msvc-alt
+ MSYS_BITS: 64
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-extended --enable-profiler
SCRIPT: python x.py dist
DEPLOY_ALT: 1
- CI_JOB_NAME: dist-x86_64-msvc-alt
matrix:
fast_finish: true
diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs
index 414033a..f93f3e7 100644
--- a/src/bootstrap/builder.rs
+++ b/src/bootstrap/builder.rs
@@ -374,6 +374,7 @@
test::MirOpt,
test::Codegen,
test::CodegenUnits,
+ test::Assembly,
test::Incremental,
test::Debuginfo,
test::UiFullDeps,
@@ -669,20 +670,19 @@
.map(|entry| entry.path())
}
- pub fn rustdoc(&self, host: Interned<String>) -> PathBuf {
- self.ensure(tool::Rustdoc { host })
+ pub fn rustdoc(&self, compiler: Compiler) -> PathBuf {
+ self.ensure(tool::Rustdoc { compiler })
}
- pub fn rustdoc_cmd(&self, host: Interned<String>) -> Command {
+ pub fn rustdoc_cmd(&self, compiler: Compiler) -> 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))
// Note that this is *not* the sysroot_libdir because rustdoc must be linked
// equivalently to rustc.
.env("RUSTDOC_LIBDIR", self.rustc_libdir(compiler))
.env("CFG_RELEASE_CHANNEL", &self.config.channel)
- .env("RUSTDOC_REAL", self.rustdoc(host))
+ .env("RUSTDOC_REAL", self.rustdoc(compiler))
.env("RUSTDOC_CRATE_VERSION", self.rust_version())
.env("RUSTC_BOOTSTRAP", "1");
@@ -690,7 +690,7 @@
cmd.env_remove("MAKEFLAGS");
cmd.env_remove("MFLAGS");
- if let Some(linker) = self.linker(host) {
+ if let Some(linker) = self.linker(compiler.host) {
cmd.env("RUSTC_TARGET_LINKER", linker);
}
cmd
@@ -752,7 +752,7 @@
// This is the intended out directory for compiler documentation.
my_out = self.compiler_doc_out(target);
}
- let rustdoc = self.rustdoc(compiler.host);
+ let rustdoc = self.rustdoc(compiler);
self.clear_if_dirty(&my_out, &rustdoc);
} else if cmd != "test" {
match mode {
@@ -909,7 +909,7 @@
.env(
"RUSTDOC_REAL",
if cmd == "doc" || cmd == "rustdoc" || (cmd == "test" && want_rustdoc) {
- self.rustdoc(compiler.host)
+ self.rustdoc(compiler)
} else {
PathBuf::from("/path/to/nowhere/rustdoc/not/required")
},
diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs
index 5dc3265..d982330 100644
--- a/src/bootstrap/dist.rs
+++ b/src/bootstrap/dist.rs
@@ -479,7 +479,7 @@
t!(fs::create_dir_all(image.join("bin")));
builder.cp_r(&src.join("bin"), &image.join("bin"));
- builder.install(&builder.rustdoc(compiler.host), &image.join("bin"), 0o755);
+ builder.install(&builder.rustdoc(compiler), &image.join("bin"), 0o755);
// Copy runtime DLLs needed by the compiler
if libdir != "bin" {
diff --git a/src/bootstrap/doc.rs b/src/bootstrap/doc.rs
index e0ad042..ae32928 100644
--- a/src/bootstrap/doc.rs
+++ b/src/bootstrap/doc.rs
@@ -335,7 +335,7 @@
let footer = builder.src.join("src/doc/footer.inc");
let version_info = out.join("version_info.html");
- let mut cmd = builder.rustdoc_cmd(compiler.host);
+ let mut cmd = builder.rustdoc_cmd(compiler);
let out = out.join("book");
@@ -415,7 +415,7 @@
}
let html = out.join(filename).with_extension("html");
- let rustdoc = builder.rustdoc(compiler.host);
+ let rustdoc = builder.rustdoc(compiler);
if up_to_date(&path, &html) &&
up_to_date(&footer, &html) &&
up_to_date(&favicon, &html) &&
@@ -425,7 +425,7 @@
continue
}
- let mut cmd = builder.rustdoc_cmd(compiler.host);
+ let mut cmd = builder.rustdoc_cmd(compiler);
cmd.arg("--html-after-content").arg(&footer)
.arg("--html-before-content").arg(&version_info)
.arg("--html-in-header").arg(&favicon)
@@ -824,7 +824,7 @@
builder.ensure(Rustc { stage, target });
// Build rustdoc.
- builder.ensure(tool::Rustdoc { host: compiler.host });
+ builder.ensure(tool::Rustdoc { compiler: compiler });
// Symlink compiler docs to the output directory of rustdoc documentation.
let out_dir = builder.stage_out(compiler, Mode::ToolRustc)
@@ -883,7 +883,11 @@
builder.info(&format!("Documenting error index ({})", target));
let out = builder.doc_out(target);
t!(fs::create_dir_all(&out));
- let mut index = builder.tool_cmd(Tool::ErrorIndex);
+ let compiler = builder.compiler(2, builder.config.build);
+ let mut index = tool::ErrorIndex::command(
+ builder,
+ compiler,
+ );
index.arg("html");
index.arg(out.join("error-index.html"));
diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs
index 8a9d99c..bbe1872 100644
--- a/src/bootstrap/test.rs
+++ b/src/bootstrap/test.rs
@@ -177,7 +177,7 @@
cmd.arg(&builder.initial_cargo)
.arg(&out_dir)
.env("RUSTC", builder.rustc(compiler))
- .env("RUSTDOC", builder.rustdoc(compiler.host)),
+ .env("RUSTDOC", builder.rustdoc(compiler)),
);
}
}
@@ -414,7 +414,6 @@
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub struct CompiletestTest {
- stage: u32,
host: Interned<String>,
}
@@ -427,16 +426,14 @@
fn make_run(run: RunConfig<'_>) {
run.builder.ensure(CompiletestTest {
- stage: run.builder.top_stage,
host: run.target,
});
}
/// Runs `cargo test` for compiletest.
fn run(self, builder: &Builder<'_>) {
- let stage = self.stage;
let host = self.host;
- let compiler = builder.compiler(stage, host);
+ let compiler = builder.compiler(0, host);
let mut cargo = tool::prepare_tool_cargo(builder,
compiler,
@@ -563,7 +560,7 @@
builder.sysroot_libdir(self.compiler, self.compiler.host),
)
.env("CFG_RELEASE_CHANNEL", &builder.config.channel)
- .env("RUSTDOC_REAL", builder.rustdoc(self.compiler.host))
+ .env("RUSTDOC_REAL", builder.rustdoc(self.compiler))
.env("RUSTDOC_CRATE_VERSION", builder.rust_version())
.env("RUSTC_BOOTSTRAP", "1");
if let Some(linker) = builder.linker(self.compiler.host) {
@@ -936,6 +933,12 @@
suite: "run-make-fulldeps"
});
+default_test!(Assembly {
+ path: "src/test/assembly",
+ mode: "assembly",
+ suite: "assembly"
+});
+
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
struct Compiletest {
compiler: Compiler,
@@ -1036,7 +1039,7 @@
|| mode == "js-doc-test"
{
cmd.arg("--rustdoc-path")
- .arg(builder.rustdoc(compiler.host));
+ .arg(builder.rustdoc(compiler));
}
cmd.arg("--src-base")
@@ -1458,7 +1461,10 @@
t!(fs::create_dir_all(&dir));
let output = dir.join("error-index.md");
- let mut tool = builder.tool_cmd(Tool::ErrorIndex);
+ let mut tool = tool::ErrorIndex::command(
+ builder,
+ builder.compiler(compiler.stage, builder.config.build),
+ );
tool.arg("markdown")
.arg(&output)
.env("CFG_BUILD", &builder.config.build)
@@ -1483,7 +1489,7 @@
}
builder.info(&format!("doc tests for: {}", markdown.display()));
- let mut cmd = builder.rustdoc_cmd(compiler.host);
+ let mut cmd = builder.rustdoc_cmd(compiler);
builder.add_rust_test_threads(&mut cmd);
cmd.arg("--test");
cmd.arg(markdown);
diff --git a/src/bootstrap/tool.rs b/src/bootstrap/tool.rs
index 865b1f8..35e0e24 100644
--- a/src/bootstrap/tool.rs
+++ b/src/bootstrap/tool.rs
@@ -251,9 +251,9 @@
cargo
}
-macro_rules! tool {
+macro_rules! bootstrap_tool {
($(
- $name:ident, $path:expr, $tool_name:expr, $mode:expr
+ $name:ident, $path:expr, $tool_name:expr
$(,llvm_tools = $llvm:expr)*
$(,is_external_tool = $external:expr)*
;
@@ -267,10 +267,7 @@
impl Tool {
pub fn get_mode(&self) -> Mode {
- let mode = match self {
- $(Tool::$name => $mode,)+
- };
- mode
+ Mode::ToolBootstrap
}
/// Whether this tool requires LLVM to run
@@ -283,27 +280,15 @@
impl<'a> Builder<'a> {
pub fn tool_exe(&self, tool: Tool) -> PathBuf {
- let stage = self.tool_default_stage(tool);
match tool {
$(Tool::$name =>
self.ensure($name {
- compiler: self.compiler(stage, self.config.build),
+ compiler: self.compiler(0, self.config.build),
target: self.config.build,
}),
)+
}
}
-
- pub fn tool_default_stage(&self, tool: Tool) -> u32 {
- // 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 if self.top_stage >= 2 => self.top_stage,
- _ => 0,
- }
- }
}
$(
@@ -322,7 +307,8 @@
fn make_run(run: RunConfig<'_>) {
run.builder.ensure($name {
- compiler: run.builder.compiler(run.builder.top_stage, run.builder.config.build),
+ // snapshot compiler
+ compiler: run.builder.compiler(0, run.builder.config.build),
target: run.target,
});
}
@@ -332,7 +318,7 @@
compiler: self.compiler,
target: self.target,
tool: $tool_name,
- mode: $mode,
+ mode: Mode::ToolBootstrap,
path: $path,
is_optional_tool: false,
source_type: if false $(|| $external)* {
@@ -348,22 +334,68 @@
}
}
-tool!(
- Rustbook, "src/tools/rustbook", "rustbook", Mode::ToolBootstrap;
- ErrorIndex, "src/tools/error_index_generator", "error_index_generator", Mode::ToolRustc;
- UnstableBookGen, "src/tools/unstable-book-gen", "unstable-book-gen", Mode::ToolBootstrap;
- Tidy, "src/tools/tidy", "tidy", Mode::ToolBootstrap;
- Linkchecker, "src/tools/linkchecker", "linkchecker", Mode::ToolBootstrap;
- CargoTest, "src/tools/cargotest", "cargotest", Mode::ToolBootstrap;
- Compiletest, "src/tools/compiletest", "compiletest", Mode::ToolBootstrap, llvm_tools = true;
- BuildManifest, "src/tools/build-manifest", "build-manifest", Mode::ToolBootstrap;
- RemoteTestClient, "src/tools/remote-test-client", "remote-test-client", Mode::ToolBootstrap;
- RustInstaller, "src/tools/rust-installer", "fabricate", Mode::ToolBootstrap,
- is_external_tool = true;
- RustdocTheme, "src/tools/rustdoc-themes", "rustdoc-themes", Mode::ToolBootstrap;
+bootstrap_tool!(
+ Rustbook, "src/tools/rustbook", "rustbook";
+ UnstableBookGen, "src/tools/unstable-book-gen", "unstable-book-gen";
+ Tidy, "src/tools/tidy", "tidy";
+ Linkchecker, "src/tools/linkchecker", "linkchecker";
+ CargoTest, "src/tools/cargotest", "cargotest";
+ Compiletest, "src/tools/compiletest", "compiletest", llvm_tools = true;
+ BuildManifest, "src/tools/build-manifest", "build-manifest";
+ RemoteTestClient, "src/tools/remote-test-client", "remote-test-client";
+ RustInstaller, "src/tools/rust-installer", "fabricate", is_external_tool = true;
+ RustdocTheme, "src/tools/rustdoc-themes", "rustdoc-themes";
);
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
+pub struct ErrorIndex {
+ pub compiler: Compiler,
+}
+
+impl ErrorIndex {
+ pub fn command(builder: &Builder<'_>, compiler: Compiler) -> Command {
+ let mut cmd = Command::new(builder.ensure(ErrorIndex {
+ compiler
+ }));
+ add_lib_path(
+ vec![PathBuf::from(&builder.sysroot_libdir(compiler, compiler.host))],
+ &mut cmd,
+ );
+ cmd
+ }
+}
+
+impl Step for ErrorIndex {
+ type Output = PathBuf;
+
+ fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
+ run.path("src/tools/error_index_generator")
+ }
+
+ fn make_run(run: RunConfig<'_>) {
+ // Compile the error-index in the same stage as rustdoc to avoid
+ // recompiling rustdoc twice if we can.
+ let stage = if run.builder.top_stage >= 2 { run.builder.top_stage } else { 0 };
+ run.builder.ensure(ErrorIndex {
+ compiler: run.builder.compiler(stage, run.builder.config.build),
+ });
+ }
+
+ fn run(self, builder: &Builder<'_>) -> PathBuf {
+ builder.ensure(ToolBuild {
+ compiler: self.compiler,
+ target: self.compiler.host,
+ tool: "error_index_generator",
+ mode: Mode::ToolRustc,
+ path: "src/tools/error_index_generator",
+ is_optional_tool: false,
+ source_type: SourceType::InTree,
+ extra_features: Vec::new(),
+ }).expect("expected to build -- essential tool")
+ }
+}
+
+#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct RemoteTestServer {
pub compiler: Compiler,
pub target: Interned<String>,
@@ -399,7 +431,9 @@
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct Rustdoc {
- pub host: Interned<String>,
+ /// This should only ever be 0 or 2.
+ /// We sometimes want to reference the "bootstrap" rustdoc, which is why this option is here.
+ pub compiler: Compiler,
}
impl Step for Rustdoc {
@@ -413,12 +447,12 @@
fn make_run(run: RunConfig<'_>) {
run.builder.ensure(Rustdoc {
- host: run.host,
+ compiler: run.builder.compiler(run.builder.top_stage, run.host),
});
}
fn run(self, builder: &Builder<'_>) -> PathBuf {
- let target_compiler = builder.compiler(builder.top_stage, self.host);
+ let target_compiler = self.compiler;
if target_compiler.stage == 0 {
if !target_compiler.is_snapshot(builder) {
panic!("rustdoc in stage 0 must be snapshot rustdoc");
@@ -626,7 +660,7 @@
/// `host`.
pub fn tool_cmd(&self, tool: Tool) -> Command {
let mut cmd = Command::new(self.tool_exe(tool));
- let compiler = self.compiler(self.tool_default_stage(tool), self.config.build);
+ let compiler = self.compiler(0, self.config.build);
self.prepare_tool_cmd(compiler, tool, &mut cmd);
cmd
}
@@ -638,7 +672,7 @@
fn prepare_tool_cmd(&self, compiler: Compiler, tool: Tool, cmd: &mut Command) {
let host = &compiler.host;
let mut lib_paths: Vec<PathBuf> = vec![
- if compiler.stage == 0 && tool != Tool::ErrorIndex {
+ if compiler.stage == 0 {
self.build.rustc_snapshot_libdir()
} else {
PathBuf::from(&self.sysroot_libdir(compiler, compiler.host))
diff --git a/src/ci/docker/disabled/dist-x86_64-redox/Dockerfile b/src/ci/docker/disabled/dist-x86_64-redox/Dockerfile
index f4c25f7..11a3acd 100644
--- a/src/ci/docker/disabled/dist-x86_64-redox/Dockerfile
+++ b/src/ci/docker/disabled/dist-x86_64-redox/Dockerfile
@@ -7,8 +7,8 @@
RUN sh /scripts/crosstool-ng.sh
WORKDIR /tmp
-COPY cross/install-x86_64-redox.sh /tmp/
-RUN ./install-x86_64-redox.sh
+COPY dist-various-1/install-x86_64-redox.sh /scripts/
+RUN sh /scripts/install-x86_64-redox.sh
COPY scripts/sccache.sh /scripts/
RUN sh /scripts/sccache.sh
diff --git a/src/ci/docker/dist-powerpc64-linux/build-powerpc64-toolchain.sh b/src/ci/docker/dist-powerpc64-linux/build-powerpc64-toolchain.sh
index f7aa2cd..fc53849 100755
--- a/src/ci/docker/dist-powerpc64-linux/build-powerpc64-toolchain.sh
+++ b/src/ci/docker/dist-powerpc64-linux/build-powerpc64-toolchain.sh
@@ -3,9 +3,29 @@
source shared.sh
+BINUTILS=2.32
+TARGET=powerpc64-unknown-linux-gnu
+PREFIX=/x-tools/$TARGET
+SYSROOT=$PREFIX/$TARGET/sysroot
+
mkdir build
cd build
cp ../powerpc64-linux-gnu.config .config
hide_output ct-ng build
cd ..
rm -rf build
+
+chmod -R u+w $PREFIX
+
+# Next, download and build newer binutils.
+mkdir binutils-$TARGET
+pushd binutils-$TARGET
+curl https://ftp.gnu.org/gnu/binutils/binutils-$BINUTILS.tar.bz2 | tar xjf -
+mkdir binutils-build
+cd binutils-build
+hide_output ../binutils-$BINUTILS/configure --target=$TARGET \
+ --prefix=$PREFIX --with-sysroot=$SYSROOT
+hide_output make -j10
+hide_output make install
+popd
+rm -rf binutils-$TARGET
diff --git a/src/ci/docker/dist-powerpc64le-linux/build-powerpc64le-toolchain.sh b/src/ci/docker/dist-powerpc64le-linux/build-powerpc64le-toolchain.sh
index a01803d..f866a24 100755
--- a/src/ci/docker/dist-powerpc64le-linux/build-powerpc64le-toolchain.sh
+++ b/src/ci/docker/dist-powerpc64le-linux/build-powerpc64le-toolchain.sh
@@ -4,7 +4,7 @@
source shared.sh
-BINUTILS=2.25.1
+BINUTILS=2.32
GCC=5.3.0
TARGET=powerpc64le-linux-gnu
SYSROOT=/usr/local/$TARGET/sysroot
diff --git a/src/ci/docker/dist-various-1/install-x86_64-redox.sh b/src/ci/docker/dist-various-1/install-x86_64-redox.sh
index c39be14..339042b 100755
--- a/src/ci/docker/dist-various-1/install-x86_64-redox.sh
+++ b/src/ci/docker/dist-various-1/install-x86_64-redox.sh
@@ -3,11 +3,5 @@
set -ex
-apt-get update
-apt-get install -y --no-install-recommends software-properties-common apt-transport-https
-
-apt-key adv --batch --yes --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys AA12E97F0881517F
-add-apt-repository -y 'deb https://static.redox-os.org/toolchain/apt /'
-
-apt-get update
-apt-get install -y x86-64-unknown-redox-gcc
+curl https://static.redox-os.org/toolchain/x86_64-unknown-redox/relibc-install.tar.gz | \
+tar --extract --gzip --directory /usr/local
diff --git a/src/ci/docker/run.sh b/src/ci/docker/run.sh
index b4426bb..ef15175 100755
--- a/src/ci/docker/run.sh
+++ b/src/ci/docker/run.sh
@@ -22,7 +22,18 @@
hash_key=/tmp/.docker-hash-key.txt
rm -f "${hash_key}"
echo $image >> $hash_key
- find $docker_dir -type f | sort | xargs cat >> $hash_key
+
+ cat "$docker_dir/$image/Dockerfile" >> $hash_key
+ # Look for all source files involves in the COPY command
+ copied_files=/tmp/.docker-copied-files.txt
+ rm -f "$copied_files"
+ for i in $(sed -n -e 's/^COPY \(.*\) .*$/\1/p' "$docker_dir/$image/Dockerfile"); do
+ # List the file names
+ find "$docker_dir/$i" -type f >> $copied_files
+ done
+ # Sort the file names and cat the content into the hash key
+ sort $copied_files | xargs cat >> $hash_key
+
docker --version >> $hash_key
cksum=$(sha512sum $hash_key | \
awk '{print $1}')
diff --git a/src/ci/docker/test-various/Dockerfile b/src/ci/docker/test-various/Dockerfile
index 60b431a..611a24a 100644
--- a/src/ci/docker/test-various/Dockerfile
+++ b/src/ci/docker/test-various/Dockerfile
@@ -53,7 +53,8 @@
ENV NVPTX_TARGETS=nvptx64-nvidia-cuda
ENV NVPTX_SCRIPT python2.7 /checkout/x.py test --target $NVPTX_TARGETS \
- src/test/run-make
+ src/test/run-make \
+ src/test/assembly
ENV MUSL_TARGETS=x86_64-unknown-linux-musl \
CC_x86_64_unknown_linux_musl=x86_64-linux-musl-gcc \
diff --git a/src/ci/docker/x86_64-gnu-tools/checktools.sh b/src/ci/docker/x86_64-gnu-tools/checktools.sh
index 3343716..97e6ee2 100755
--- a/src/ci/docker/x86_64-gnu-tools/checktools.sh
+++ b/src/ci/docker/x86_64-gnu-tools/checktools.sh
@@ -78,6 +78,7 @@
check_dispatch $1 beta clippy-driver src/tools/clippy
# these tools are not required for beta to successfully branch
check_dispatch $1 nightly miri src/tools/miri
+ check_dispatch $1 nightly embedded-book src/doc/embedded-book
}
# If this PR is intended to update one of these tools, do not let the build pass
diff --git a/src/libcore/ops/arith.rs b/src/libcore/ops/arith.rs
index c5e908d..28c9ff9 100644
--- a/src/libcore/ops/arith.rs
+++ b/src/libcore/ops/arith.rs
@@ -1,6 +1,6 @@
/// The addition operator `+`.
///
-/// Note that `RHS` is `Self` by default, but this is not mandatory. For
+/// Note that `Rhs` is `Self` by default, but this is not mandatory. For
/// example, [`std::time::SystemTime`] implements `Add<Duration>`, which permits
/// operations of the form `SystemTime = SystemTime + Duration`.
///
@@ -67,18 +67,18 @@
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_on_unimplemented(
on(
- all(_Self="{integer}", RHS="{float}"),
+ all(_Self="{integer}", Rhs="{float}"),
message="cannot add a float to an integer",
),
on(
- all(_Self="{float}", RHS="{integer}"),
+ all(_Self="{float}", Rhs="{integer}"),
message="cannot add an integer to a float",
),
- message="cannot add `{RHS}` to `{Self}`",
- label="no implementation for `{Self} + {RHS}`",
+ message="cannot add `{Rhs}` to `{Self}`",
+ label="no implementation for `{Self} + {Rhs}`",
)]
#[doc(alias = "+")]
-pub trait Add<RHS=Self> {
+pub trait Add<Rhs=Self> {
/// The resulting type after applying the `+` operator.
#[stable(feature = "rust1", since = "1.0.0")]
type Output;
@@ -86,7 +86,7 @@
/// Performs the `+` operation.
#[must_use]
#[stable(feature = "rust1", since = "1.0.0")]
- fn add(self, rhs: RHS) -> Self::Output;
+ fn add(self, rhs: Rhs) -> Self::Output;
}
macro_rules! add_impl {
@@ -108,7 +108,7 @@
/// The subtraction operator `-`.
///
-/// Note that `RHS` is `Self` by default, but this is not mandatory. For
+/// Note that `Rhs` is `Self` by default, but this is not mandatory. For
/// example, [`std::time::SystemTime`] implements `Sub<Duration>`, which permits
/// operations of the form `SystemTime = SystemTime - Duration`.
///
@@ -173,10 +173,10 @@
/// ```
#[lang = "sub"]
#[stable(feature = "rust1", since = "1.0.0")]
-#[rustc_on_unimplemented(message="cannot subtract `{RHS}` from `{Self}`",
- label="no implementation for `{Self} - {RHS}`")]
+#[rustc_on_unimplemented(message="cannot subtract `{Rhs}` from `{Self}`",
+ label="no implementation for `{Self} - {Rhs}`")]
#[doc(alias = "-")]
-pub trait Sub<RHS=Self> {
+pub trait Sub<Rhs=Self> {
/// The resulting type after applying the `-` operator.
#[stable(feature = "rust1", since = "1.0.0")]
type Output;
@@ -184,7 +184,7 @@
/// Performs the `-` operation.
#[must_use]
#[stable(feature = "rust1", since = "1.0.0")]
- fn sub(self, rhs: RHS) -> Self::Output;
+ fn sub(self, rhs: Rhs) -> Self::Output;
}
macro_rules! sub_impl {
@@ -206,7 +206,7 @@
/// The multiplication operator `*`.
///
-/// Note that `RHS` is `Self` by default, but this is not mandatory.
+/// Note that `Rhs` is `Self` by default, but this is not mandatory.
///
/// # Examples
///
@@ -293,10 +293,10 @@
/// ```
#[lang = "mul"]
#[stable(feature = "rust1", since = "1.0.0")]
-#[rustc_on_unimplemented(message="cannot multiply `{RHS}` to `{Self}`",
- label="no implementation for `{Self} * {RHS}`")]
+#[rustc_on_unimplemented(message="cannot multiply `{Rhs}` to `{Self}`",
+ label="no implementation for `{Self} * {Rhs}`")]
#[doc(alias = "*")]
-pub trait Mul<RHS=Self> {
+pub trait Mul<Rhs=Self> {
/// The resulting type after applying the `*` operator.
#[stable(feature = "rust1", since = "1.0.0")]
type Output;
@@ -304,7 +304,7 @@
/// Performs the `*` operation.
#[must_use]
#[stable(feature = "rust1", since = "1.0.0")]
- fn mul(self, rhs: RHS) -> Self::Output;
+ fn mul(self, rhs: Rhs) -> Self::Output;
}
macro_rules! mul_impl {
@@ -326,7 +326,7 @@
/// The division operator `/`.
///
-/// Note that `RHS` is `Self` by default, but this is not mandatory.
+/// Note that `Rhs` is `Self` by default, but this is not mandatory.
///
/// # Examples
///
@@ -417,10 +417,10 @@
/// ```
#[lang = "div"]
#[stable(feature = "rust1", since = "1.0.0")]
-#[rustc_on_unimplemented(message="cannot divide `{Self}` by `{RHS}`",
- label="no implementation for `{Self} / {RHS}`")]
+#[rustc_on_unimplemented(message="cannot divide `{Self}` by `{Rhs}`",
+ label="no implementation for `{Self} / {Rhs}`")]
#[doc(alias = "/")]
-pub trait Div<RHS=Self> {
+pub trait Div<Rhs=Self> {
/// The resulting type after applying the `/` operator.
#[stable(feature = "rust1", since = "1.0.0")]
type Output;
@@ -428,7 +428,7 @@
/// Performs the `/` operation.
#[must_use]
#[stable(feature = "rust1", since = "1.0.0")]
- fn div(self, rhs: RHS) -> Self::Output;
+ fn div(self, rhs: Rhs) -> Self::Output;
}
macro_rules! div_impl_integer {
@@ -467,7 +467,7 @@
/// The remainder operator `%`.
///
-/// Note that `RHS` is `Self` by default, but this is not mandatory.
+/// Note that `Rhs` is `Self` by default, but this is not mandatory.
///
/// # Examples
///
@@ -502,10 +502,10 @@
/// ```
#[lang = "rem"]
#[stable(feature = "rust1", since = "1.0.0")]
-#[rustc_on_unimplemented(message="cannot mod `{Self}` by `{RHS}`",
- label="no implementation for `{Self} % {RHS}`")]
+#[rustc_on_unimplemented(message="cannot mod `{Self}` by `{Rhs}`",
+ label="no implementation for `{Self} % {Rhs}`")]
#[doc(alias = "%")]
-pub trait Rem<RHS=Self> {
+pub trait Rem<Rhs=Self> {
/// The resulting type after applying the `%` operator.
#[stable(feature = "rust1", since = "1.0.0")]
type Output = Self;
@@ -513,7 +513,7 @@
/// Performs the `%` operation.
#[must_use]
#[stable(feature = "rust1", since = "1.0.0")]
- fn rem(self, rhs: RHS) -> Self::Output;
+ fn rem(self, rhs: Rhs) -> Self::Output;
}
macro_rules! rem_impl_integer {
diff --git a/src/libcore/ops/bit.rs b/src/libcore/ops/bit.rs
index c3615bd..a8f862f 100644
--- a/src/libcore/ops/bit.rs
+++ b/src/libcore/ops/bit.rs
@@ -59,7 +59,7 @@
/// The bitwise AND operator `&`.
///
-/// Note that `RHS` is `Self` by default, but this is not mandatory.
+/// Note that `Rhs` is `Self` by default, but this is not mandatory.
///
/// # Examples
///
@@ -112,9 +112,9 @@
#[lang = "bitand"]
#[doc(alias = "&")]
#[stable(feature = "rust1", since = "1.0.0")]
-#[rustc_on_unimplemented(message="no implementation for `{Self} & {RHS}`",
- label="no implementation for `{Self} & {RHS}`")]
-pub trait BitAnd<RHS=Self> {
+#[rustc_on_unimplemented(message="no implementation for `{Self} & {Rhs}`",
+ label="no implementation for `{Self} & {Rhs}`")]
+pub trait BitAnd<Rhs=Self> {
/// The resulting type after applying the `&` operator.
#[stable(feature = "rust1", since = "1.0.0")]
type Output;
@@ -122,7 +122,7 @@
/// Performs the `&` operation.
#[must_use]
#[stable(feature = "rust1", since = "1.0.0")]
- fn bitand(self, rhs: RHS) -> Self::Output;
+ fn bitand(self, rhs: Rhs) -> Self::Output;
}
macro_rules! bitand_impl {
@@ -143,7 +143,7 @@
/// The bitwise OR operator `|`.
///
-/// Note that `RHS` is `Self` by default, but this is not mandatory.
+/// Note that `Rhs` is `Self` by default, but this is not mandatory.
///
/// # Examples
///
@@ -196,9 +196,9 @@
#[lang = "bitor"]
#[doc(alias = "|")]
#[stable(feature = "rust1", since = "1.0.0")]
-#[rustc_on_unimplemented(message="no implementation for `{Self} | {RHS}`",
- label="no implementation for `{Self} | {RHS}`")]
-pub trait BitOr<RHS=Self> {
+#[rustc_on_unimplemented(message="no implementation for `{Self} | {Rhs}`",
+ label="no implementation for `{Self} | {Rhs}`")]
+pub trait BitOr<Rhs=Self> {
/// The resulting type after applying the `|` operator.
#[stable(feature = "rust1", since = "1.0.0")]
type Output;
@@ -206,7 +206,7 @@
/// Performs the `|` operation.
#[must_use]
#[stable(feature = "rust1", since = "1.0.0")]
- fn bitor(self, rhs: RHS) -> Self::Output;
+ fn bitor(self, rhs: Rhs) -> Self::Output;
}
macro_rules! bitor_impl {
@@ -227,7 +227,7 @@
/// The bitwise XOR operator `^`.
///
-/// Note that `RHS` is `Self` by default, but this is not mandatory.
+/// Note that `Rhs` is `Self` by default, but this is not mandatory.
///
/// # Examples
///
@@ -283,9 +283,9 @@
#[lang = "bitxor"]
#[doc(alias = "^")]
#[stable(feature = "rust1", since = "1.0.0")]
-#[rustc_on_unimplemented(message="no implementation for `{Self} ^ {RHS}`",
- label="no implementation for `{Self} ^ {RHS}`")]
-pub trait BitXor<RHS=Self> {
+#[rustc_on_unimplemented(message="no implementation for `{Self} ^ {Rhs}`",
+ label="no implementation for `{Self} ^ {Rhs}`")]
+pub trait BitXor<Rhs=Self> {
/// The resulting type after applying the `^` operator.
#[stable(feature = "rust1", since = "1.0.0")]
type Output;
@@ -293,7 +293,7 @@
/// Performs the `^` operation.
#[must_use]
#[stable(feature = "rust1", since = "1.0.0")]
- fn bitxor(self, rhs: RHS) -> Self::Output;
+ fn bitxor(self, rhs: Rhs) -> Self::Output;
}
macro_rules! bitxor_impl {
@@ -371,9 +371,9 @@
#[lang = "shl"]
#[doc(alias = "<<")]
#[stable(feature = "rust1", since = "1.0.0")]
-#[rustc_on_unimplemented(message="no implementation for `{Self} << {RHS}`",
- label="no implementation for `{Self} << {RHS}`")]
-pub trait Shl<RHS=Self> {
+#[rustc_on_unimplemented(message="no implementation for `{Self} << {Rhs}`",
+ label="no implementation for `{Self} << {Rhs}`")]
+pub trait Shl<Rhs=Self> {
/// The resulting type after applying the `<<` operator.
#[stable(feature = "rust1", since = "1.0.0")]
type Output;
@@ -381,7 +381,7 @@
/// Performs the `<<` operation.
#[must_use]
#[stable(feature = "rust1", since = "1.0.0")]
- fn shl(self, rhs: RHS) -> Self::Output;
+ fn shl(self, rhs: Rhs) -> Self::Output;
}
macro_rules! shl_impl {
@@ -480,9 +480,9 @@
#[lang = "shr"]
#[doc(alias = ">>")]
#[stable(feature = "rust1", since = "1.0.0")]
-#[rustc_on_unimplemented(message="no implementation for `{Self} >> {RHS}`",
- label="no implementation for `{Self} >> {RHS}`")]
-pub trait Shr<RHS=Self> {
+#[rustc_on_unimplemented(message="no implementation for `{Self} >> {Rhs}`",
+ label="no implementation for `{Self} >> {Rhs}`")]
+pub trait Shr<Rhs=Self> {
/// The resulting type after applying the `>>` operator.
#[stable(feature = "rust1", since = "1.0.0")]
type Output;
@@ -490,7 +490,7 @@
/// Performs the `>>` operation.
#[must_use]
#[stable(feature = "rust1", since = "1.0.0")]
- fn shr(self, rhs: RHS) -> Self::Output;
+ fn shr(self, rhs: Rhs) -> Self::Output;
}
macro_rules! shr_impl {
diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs
index 949fdd2..73c3b30 100644
--- a/src/librustc/hir/lowering.rs
+++ b/src/librustc/hir/lowering.rs
@@ -2672,7 +2672,7 @@
fn lower_variant_data(&mut self, vdata: &VariantData) -> hir::VariantData {
match *vdata {
- VariantData::Struct(ref fields, id) => {
+ VariantData::Struct(ref fields, id, recovered) => {
let LoweredNodeId { node_id: _, hir_id } = self.lower_node_id(id);
hir::VariantData::Struct(
@@ -2682,6 +2682,7 @@
.map(|f| self.lower_struct_field(f))
.collect(),
hir_id,
+ recovered,
)
},
VariantData::Tuple(ref fields, id) => {
diff --git a/src/librustc/hir/mod.rs b/src/librustc/hir/mod.rs
index 88ab58d..5edddb3 100644
--- a/src/librustc/hir/mod.rs
+++ b/src/librustc/hir/mod.rs
@@ -816,6 +816,9 @@
pub legacy: bool,
}
+/// A block of statements `{ .. }`, which may have a label (in this case the
+/// `targeted_by_break` field will be `true`) and may be `unsafe` by means of
+/// the `rules` being anything but `DefaultBlock`.
#[derive(Clone, RustcEncodable, RustcDecodable, Debug, HashStable)]
pub struct Block {
/// Statements in a block.
@@ -1178,6 +1181,7 @@
}
}
+/// The contents of a statement.
#[derive(Clone, RustcEncodable, RustcDecodable, HashStable)]
pub enum StmtKind {
/// A local (`let`) binding.
@@ -1208,21 +1212,28 @@
#[derive(Clone, RustcEncodable, RustcDecodable, Debug, HashStable)]
pub struct Local {
pub pat: P<Pat>,
+ /// Type annotation, if any (otherwise the type will be inferred).
pub ty: Option<P<Ty>>,
/// Initializer expression to set the value, if any.
pub init: Option<P<Expr>>,
pub hir_id: HirId,
pub span: Span,
pub attrs: ThinVec<Attribute>,
+ /// Can be `ForLoopDesugar` if the `let` statement is part of a `for` loop
+ /// desugaring. Otherwise will be `Normal`.
pub source: LocalSource,
}
-/// Represents a single arm of a `match` expression.
+/// Represents a single arm of a `match` expression, e.g.
+/// `<pats> (if <guard>) => <body>`.
#[derive(Clone, RustcEncodable, RustcDecodable, Debug, HashStable)]
pub struct Arm {
pub attrs: HirVec<Attribute>,
+ /// Multiple patterns can be combined with `|`
pub pats: HirVec<P<Pat>>,
+ /// Optional guard clause.
pub guard: Option<Guard>,
+ /// The expression the arm evaluates to if this arm matches.
pub body: P<Expr>,
}
@@ -2173,7 +2184,7 @@
/// Id of the whole struct lives in `Item`.
#[derive(Clone, RustcEncodable, RustcDecodable, Debug, HashStable)]
pub enum VariantData {
- Struct(HirVec<StructField>, HirId),
+ Struct(HirVec<StructField>, HirId, /* recovered */ bool),
Tuple(HirVec<StructField>, HirId),
Unit(HirId),
}
@@ -2187,7 +2198,7 @@
}
pub fn hir_id(&self) -> HirId {
match *self {
- VariantData::Struct(_, hir_id)
+ VariantData::Struct(_, hir_id, _)
| VariantData::Tuple(_, hir_id)
| VariantData::Unit(hir_id) => hir_id,
}
diff --git a/src/librustc/hir/print.rs b/src/librustc/hir/print.rs
index 54a21f2..bff4190 100644
--- a/src/librustc/hir/print.rs
+++ b/src/librustc/hir/print.rs
@@ -591,12 +591,12 @@
self.s.word(";")?;
self.end()?; // end the outer cbox
}
- hir::ItemKind::Fn(ref decl, header, ref typarams, body) => {
+ hir::ItemKind::Fn(ref decl, header, ref param_names, body) => {
self.head("")?;
self.print_fn(decl,
header,
Some(item.ident.name),
- typarams,
+ param_names,
&item.vis,
&[],
Some(body))?;
diff --git a/src/librustc/ty/mod.rs b/src/librustc/ty/mod.rs
index 298af1d..91b84b6 100644
--- a/src/librustc/ty/mod.rs
+++ b/src/librustc/ty/mod.rs
@@ -1811,6 +1811,7 @@
pub fields: Vec<FieldDef>,
pub ctor_kind: CtorKind,
flags: VariantFlags,
+ pub recovered: bool,
}
impl<'a, 'gcx, 'tcx> VariantDef {
@@ -1829,16 +1830,17 @@
///
/// If someone speeds up attribute loading to not be a performance concern, they can
/// remove this hack and use the constructor `DefId` everywhere.
- pub fn new(tcx: TyCtxt<'a, 'gcx, 'tcx>,
- did: DefId,
- ident: Ident,
- discr: VariantDiscr,
- fields: Vec<FieldDef>,
- adt_kind: AdtKind,
- ctor_kind: CtorKind,
- attribute_def_id: DefId)
- -> Self
- {
+ pub fn new(
+ tcx: TyCtxt<'a, 'gcx, 'tcx>,
+ did: DefId,
+ ident: Ident,
+ discr: VariantDiscr,
+ fields: Vec<FieldDef>,
+ adt_kind: AdtKind,
+ ctor_kind: CtorKind,
+ attribute_def_id: DefId,
+ recovered: bool,
+ ) -> Self {
debug!("VariantDef::new({:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?})", did, ident, discr,
fields, adt_kind, ctor_kind, attribute_def_id);
let mut flags = VariantFlags::NO_VARIANT_FLAGS;
@@ -1852,7 +1854,8 @@
discr,
fields,
ctor_kind,
- flags
+ flags,
+ recovered,
}
}
@@ -1868,7 +1871,8 @@
discr,
fields,
ctor_kind,
- flags
+ flags,
+ recovered
});
#[derive(Copy, Clone, Debug, PartialEq, Eq, RustcEncodable, RustcDecodable, HashStable)]
diff --git a/src/librustc_metadata/decoder.rs b/src/librustc_metadata/decoder.rs
index 6fe00a4..c608c03 100644
--- a/src/librustc_metadata/decoder.rs
+++ b/src/librustc_metadata/decoder.rs
@@ -576,7 +576,8 @@
}).collect(),
adt_kind,
data.ctor_kind,
- attribute_def_id
+ attribute_def_id,
+ false,
)
}
diff --git a/src/librustc_metadata/lib.rs b/src/librustc_metadata/lib.rs
index b4f6839..14416b5 100644
--- a/src/librustc_metadata/lib.rs
+++ b/src/librustc_metadata/lib.rs
@@ -1,6 +1,7 @@
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/")]
#![feature(box_patterns)]
+#![feature(drain_filter)]
#![feature(libc)]
#![feature(nll)]
#![feature(proc_macro_internals)]
diff --git a/src/librustc_metadata/native_libs.rs b/src/librustc_metadata/native_libs.rs
index 8078699..314c95a 100644
--- a/src/librustc_metadata/native_libs.rs
+++ b/src/librustc_metadata/native_libs.rs
@@ -199,34 +199,31 @@
}
// Update kind and, optionally, the name of all native libraries
- // (there may be more than one) with the specified name.
+ // (there may be more than one) with the specified name. If any
+ // library is mentioned more than once, keep the latest mention
+ // of it, so that any possible dependent libraries appear before
+ // it. (This ensures that the linker is able to see symbols from
+ // all possible dependent libraries before linking in the library
+ // in question.)
for &(ref name, ref new_name, kind) in &self.tcx.sess.opts.libs {
- let mut found = false;
- for lib in self.libs.iter_mut() {
- let lib_name = match lib.name {
- Some(n) => n,
- None => continue,
- };
- if lib_name == name as &str {
- let mut changed = false;
- if let Some(k) = kind {
- lib.kind = k;
- changed = true;
+ // If we've already added any native libraries with the same
+ // name, they will be pulled out into `existing`, so that we
+ // can move them to the end of the list below.
+ let mut existing = self.libs.drain_filter(|lib| {
+ if let Some(lib_name) = lib.name {
+ if lib_name == name as &str {
+ if let Some(k) = kind {
+ lib.kind = k;
+ }
+ if let &Some(ref new_name) = new_name {
+ lib.name = Some(Symbol::intern(new_name));
+ }
+ return true;
}
- if let &Some(ref new_name) = new_name {
- lib.name = Some(Symbol::intern(new_name));
- changed = true;
- }
- if !changed {
- let msg = format!("redundant linker flag specified for \
- library `{}`", name);
- self.tcx.sess.warn(&msg);
- }
-
- found = true;
}
- }
- if !found {
+ false
+ }).collect::<Vec<_>>();
+ if existing.is_empty() {
// Add if not found
let new_name = new_name.as_ref().map(|s| &**s); // &Option<String> -> Option<&str>
let lib = NativeLibrary {
@@ -237,6 +234,10 @@
wasm_import_module: None,
};
self.register_native_lib(None, lib);
+ } else {
+ // Move all existing libraries with the same name to the
+ // end of the command line.
+ self.libs.append(&mut existing);
}
}
}
diff --git a/src/librustc_mir/transform/generator.rs b/src/librustc_mir/transform/generator.rs
index 33645b5..b22258a 100644
--- a/src/librustc_mir/transform/generator.rs
+++ b/src/librustc_mir/transform/generator.rs
@@ -26,7 +26,7 @@
//! }
//!
//! This pass computes the meaning of the state field and the MIR locals which are live
-//! across a suspension point. There are however two hardcoded generator states:
+//! across a suspension point. There are however three hardcoded generator states:
//! 0 - Generator have not been resumed yet
//! 1 - Generator has returned / is completed
//! 2 - Generator has been poisoned
@@ -144,6 +144,13 @@
Local::new(1)
}
+/// Generator have not been resumed yet
+const UNRESUMED: u32 = 0;
+/// Generator has returned / is completed
+const RETURNED: u32 = 1;
+/// Generator has been poisoned
+const POISONED: u32 = 2;
+
struct SuspensionPoint {
state: u32,
resume: BasicBlock,
@@ -278,7 +285,7 @@
state
} else { // Return
- 1 // state for returned
+ RETURNED // state for returned
};
data.statements.push(self.set_state(state, source_info));
data.terminator.as_mut().unwrap().kind = TerminatorKind::Return;
@@ -590,8 +597,15 @@
let param_env = tcx.param_env(def_id);
let gen = self_arg();
- for block in mir.basic_blocks().indices() {
- let (target, unwind, source_info) = match mir.basic_blocks()[block].terminator() {
+ let mut elaborator = DropShimElaborator {
+ mir: mir,
+ patch: MirPatch::new(mir),
+ tcx,
+ param_env
+ };
+
+ for (block, block_data) in mir.basic_blocks().iter_enumerated() {
+ let (target, unwind, source_info) = match block_data.terminator() {
&Terminator {
source_info,
kind: TerminatorKind::Drop {
@@ -602,31 +616,22 @@
} if local == gen => (target, unwind, source_info),
_ => continue,
};
- let unwind = if let Some(unwind) = unwind {
- Unwind::To(unwind)
- } else {
+ let unwind = if block_data.is_cleanup {
Unwind::InCleanup
+ } else {
+ Unwind::To(unwind.unwrap_or_else(|| elaborator.patch.resume_block()))
};
- let patch = {
- let mut elaborator = DropShimElaborator {
- mir: &mir,
- patch: MirPatch::new(mir),
- tcx,
- param_env
- };
- elaborate_drop(
- &mut elaborator,
- source_info,
- &Place::Base(PlaceBase::Local(gen)),
- (),
- target,
- unwind,
- block
- );
- elaborator.patch
- };
- patch.apply(mir);
+ elaborate_drop(
+ &mut elaborator,
+ source_info,
+ &Place::Base(PlaceBase::Local(gen)),
+ (),
+ target,
+ unwind,
+ block,
+ );
}
+ elaborator.patch.apply(mir);
}
fn create_generator_drop_shim<'a, 'tcx>(
@@ -643,10 +648,10 @@
let mut cases = create_cases(&mut mir, transform, |point| point.drop);
- cases.insert(0, (0, drop_clean));
+ cases.insert(0, (UNRESUMED, drop_clean));
- // The returned state (1) and the poisoned state (2) falls through to
- // the default case which is just to return
+ // The returned state and the poisoned state fall through to the default
+ // case which is just to return
insert_switch(tcx, &mut mir, cases, &transform, TerminatorKind::Return);
@@ -762,7 +767,7 @@
for block in mir.basic_blocks_mut() {
let source_info = block.terminator().source_info;
if let &TerminatorKind::Resume = &block.terminator().kind {
- block.statements.push(transform.set_state(1, source_info));
+ block.statements.push(transform.set_state(POISONED, source_info));
}
}
@@ -773,12 +778,12 @@
GeneratorResumedAfterReturn,
};
- // Jump to the entry point on the 0 state
- cases.insert(0, (0, BasicBlock::new(0)));
- // Panic when resumed on the returned (1) state
- cases.insert(1, (1, insert_panic_block(tcx, mir, GeneratorResumedAfterReturn)));
- // Panic when resumed on the poisoned (2) state
- cases.insert(2, (2, insert_panic_block(tcx, mir, GeneratorResumedAfterPanic)));
+ // Jump to the entry point on the unresumed
+ cases.insert(0, (UNRESUMED, BasicBlock::new(0)));
+ // Panic when resumed on the returned state
+ cases.insert(1, (RETURNED, insert_panic_block(tcx, mir, GeneratorResumedAfterReturn)));
+ // Panic when resumed on the poisoned state
+ cases.insert(2, (POISONED, insert_panic_block(tcx, mir, GeneratorResumedAfterPanic)));
insert_switch(tcx, mir, cases, &transform, TerminatorKind::Unreachable);
@@ -942,7 +947,7 @@
mir.generator_layout = Some(layout);
// Insert `drop(generator_struct)` which is used to drop upvars for generators in
- // the unresumed (0) state.
+ // the unresumed state.
// This is expanded to a drop ladder in `elaborate_generator_drops`.
let drop_clean = insert_clean_drop(mir);
diff --git a/src/librustc_mir/util/pretty.rs b/src/librustc_mir/util/pretty.rs
index 4663f90..13bcdc2 100644
--- a/src/librustc_mir/util/pretty.rs
+++ b/src/librustc_mir/util/pretty.rs
@@ -317,9 +317,8 @@
let data = &mir[block];
// Basic block label at the top.
- let cleanup_text = if data.is_cleanup { " // cleanup" } else { "" };
- let lbl = format!("{}{:?}: {{", INDENT, block);
- writeln!(w, "{0:1$}{2}", lbl, ALIGN, cleanup_text)?;
+ let cleanup_text = if data.is_cleanup { " (cleanup)" } else { "" };
+ writeln!(w, "{}{:?}{}: {{", INDENT, block, cleanup_text)?;
// List of statements in the middle.
let mut current_location = Location {
diff --git a/src/librustc_save_analysis/dump_visitor.rs b/src/librustc_save_analysis/dump_visitor.rs
index 3fea515..01bb643 100644
--- a/src/librustc_save_analysis/dump_visitor.rs
+++ b/src/librustc_save_analysis/dump_visitor.rs
@@ -481,8 +481,8 @@
};
let (value, fields) = match item.node {
- ast::ItemKind::Struct(ast::VariantData::Struct(ref fields, _), _) |
- ast::ItemKind::Union(ast::VariantData::Struct(ref fields, _), _) => {
+ ast::ItemKind::Struct(ast::VariantData::Struct(ref fields, ..), _) |
+ ast::ItemKind::Union(ast::VariantData::Struct(ref fields, ..), _) => {
let include_priv_fields = !self.save_ctxt.config.pub_only;
let fields_str = fields
.iter()
@@ -560,7 +560,7 @@
let name_span = variant.node.ident.span;
match variant.node.data {
- ast::VariantData::Struct(ref fields, _) => {
+ ast::VariantData::Struct(ref fields, ..) => {
let fields_str = fields
.iter()
.enumerate()
diff --git a/src/librustc_save_analysis/sig.rs b/src/librustc_save_analysis/sig.rs
index 64a2c92..6e47ae6 100644
--- a/src/librustc_save_analysis/sig.rs
+++ b/src/librustc_save_analysis/sig.rs
@@ -703,7 +703,7 @@
fn make(&self, offset: usize, _parent_id: Option<NodeId>, scx: &SaveContext<'_, '_>) -> Result {
let mut text = self.ident.to_string();
match self.data {
- ast::VariantData::Struct(ref fields, id) => {
+ ast::VariantData::Struct(ref fields, id, r) => {
let name_def = SigElement {
id: id_from_node_id(id, scx),
start: offset,
@@ -712,12 +712,16 @@
text.push_str(" { ");
let mut defs = vec![name_def];
let mut refs = vec![];
- for f in fields {
- let field_sig = f.make(offset + text.len(), Some(id), scx)?;
- text.push_str(&field_sig.text);
- text.push_str(", ");
- defs.extend(field_sig.defs.into_iter());
- refs.extend(field_sig.refs.into_iter());
+ if r {
+ text.push_str("/* parse error */ ");
+ } else {
+ for f in fields {
+ let field_sig = f.make(offset + text.len(), Some(id), scx)?;
+ text.push_str(&field_sig.text);
+ text.push_str(", ");
+ defs.extend(field_sig.defs.into_iter());
+ refs.extend(field_sig.refs.into_iter());
+ }
}
text.push('}');
Ok(Signature { text, defs, refs })
diff --git a/src/librustc_typeck/check/_match.rs b/src/librustc_typeck/check/_match.rs
index c6b6639..c30b9d6 100644
--- a/src/librustc_typeck/check/_match.rs
+++ b/src/librustc_typeck/check/_match.rs
@@ -918,14 +918,16 @@
pat_ty
}
- fn check_struct_pat_fields(&self,
- adt_ty: Ty<'tcx>,
- pat_id: hir::HirId,
- span: Span,
- variant: &'tcx ty::VariantDef,
- fields: &'gcx [Spanned<hir::FieldPat>],
- etc: bool,
- def_bm: ty::BindingMode) -> bool {
+ fn check_struct_pat_fields(
+ &self,
+ adt_ty: Ty<'tcx>,
+ pat_id: hir::HirId,
+ span: Span,
+ variant: &'tcx ty::VariantDef,
+ fields: &'gcx [Spanned<hir::FieldPat>],
+ etc: bool,
+ def_bm: ty::BindingMode,
+ ) -> bool {
let tcx = self.tcx;
let (substs, adt) = match adt_ty.sty {
@@ -985,7 +987,7 @@
.map(|field| field.ident.modern())
.filter(|ident| !used_fields.contains_key(&ident))
.collect::<Vec<_>>();
- if inexistent_fields.len() > 0 {
+ if inexistent_fields.len() > 0 && !variant.recovered {
let (field_names, t, plural) = if inexistent_fields.len() == 1 {
(format!("a field named `{}`", inexistent_fields[0].1), "this", "")
} else {
diff --git a/src/librustc_typeck/check/callee.rs b/src/librustc_typeck/check/callee.rs
index 0a4c0eb..15ae396 100644
--- a/src/librustc_typeck/check/callee.rs
+++ b/src/librustc_typeck/check/callee.rs
@@ -2,7 +2,7 @@
use super::method::MethodCallee;
use super::{Expectation, FnCtxt, Needs, TupleArgumentsFlag};
-use errors::Applicability;
+use errors::{Applicability, DiagnosticBuilder};
use hir::def::Def;
use hir::def_id::{DefId, LOCAL_CRATE};
use rustc::ty::adjustment::{Adjust, Adjustment, AllowTwoPhase, AutoBorrow, AutoBorrowMutability};
@@ -232,6 +232,32 @@
None
}
+ /// Give appropriate suggestion when encountering `||{/* not callable */}()`, where the
+ /// likely intention is to call the closure, suggest `(||{})()`. (#55851)
+ fn identify_bad_closure_def_and_call(
+ &self,
+ err: &mut DiagnosticBuilder<'a>,
+ hir_id: hir::HirId,
+ callee_node: &hir::ExprKind,
+ callee_span: Span,
+ ) {
+ let hir_id = self.tcx.hir().get_parent_node_by_hir_id(hir_id);
+ let parent_node = self.tcx.hir().get_by_hir_id(hir_id);
+ if let (
+ hir::Node::Expr(hir::Expr { node: hir::ExprKind::Closure(_, _, _, sp, ..), .. }),
+ hir::ExprKind::Block(..),
+ ) = (parent_node, callee_node) {
+ let start = sp.shrink_to_lo();
+ let end = self.tcx.sess.source_map().next_point(callee_span);
+ err.multipart_suggestion(
+ "if you meant to create this closure and immediately call it, surround the \
+ closure with parenthesis",
+ vec![(start, "(".to_string()), (end, ")".to_string())],
+ Applicability::MaybeIncorrect,
+ );
+ }
+ }
+
fn confirm_builtin_call(
&self,
call_expr: &hir::Expr,
@@ -268,6 +294,13 @@
}
);
+ self.identify_bad_closure_def_and_call(
+ &mut err,
+ call_expr.hir_id,
+ &callee.node,
+ callee.span,
+ );
+
if let Some(ref path) = unit_variant {
err.span_suggestion(
call_expr.span,
diff --git a/src/librustc_typeck/check/method/suggest.rs b/src/librustc_typeck/check/method/suggest.rs
index b4a1a2d..f933e61 100644
--- a/src/librustc_typeck/check/method/suggest.rs
+++ b/src/librustc_typeck/check/method/suggest.rs
@@ -332,44 +332,61 @@
// If the method name is the name of a field with a function or closure type,
// give a helping note that it has to be called as `(x.f)(...)`.
if let SelfSource::MethodCall(expr) = source {
- for (ty, _) in self.autoderef(span, rcvr_ty) {
- if let ty::Adt(def, substs) = ty.sty {
- if !def.is_enum() {
+ let field_receiver = self
+ .autoderef(span, rcvr_ty)
+ .find_map(|(ty, _)| match ty.sty {
+ ty::Adt(def, substs) if !def.is_enum() => {
let variant = &def.non_enum_variant();
- if let Some(index) = self.tcx.find_field_index(item_name, variant) {
+ self.tcx.find_field_index(item_name, variant).map(|index| {
let field = &variant.fields[index];
- let snippet = tcx.sess.source_map().span_to_snippet(expr.span);
- let expr_string = match snippet {
- Ok(expr_string) => expr_string,
- _ => "s".into(), // Default to a generic placeholder for the
- // expression when we can't generate a
- // string snippet.
- };
-
let field_ty = field.ty(tcx, substs);
- let scope = self.tcx.hir().get_module_parent_by_hir_id(
- self.body_id);
- if field.vis.is_accessible_from(scope, self.tcx) {
- if self.is_fn_ty(&field_ty, span) {
- err.help(&format!("use `({0}.{1})(...)` if you \
- meant to call the function \
- stored in the `{1}` field",
- expr_string,
- item_name));
- } else {
- err.help(&format!("did you mean to write `{0}.{1}` \
- instead of `{0}.{1}(...)`?",
- expr_string,
- item_name));
- }
- err.span_label(span, "field, not a method");
- } else {
- err.span_label(span, "private field, not a method");
- }
- break;
- }
+ (field, field_ty)
+ })
+ }
+ _ => None,
+ });
+
+ if let Some((field, field_ty)) = field_receiver {
+ let scope = self.tcx.hir().get_module_parent_by_hir_id(self.body_id);
+ let is_accessible = field.vis.is_accessible_from(scope, self.tcx);
+
+ if is_accessible {
+ if self.is_fn_ty(&field_ty, span) {
+ let expr_span = expr.span.to(item_name.span);
+ err.multipart_suggestion(
+ &format!(
+ "to call the function stored in `{}`, \
+ surround the field access with parentheses",
+ item_name,
+ ),
+ vec![
+ (expr_span.shrink_to_lo(), '('.to_string()),
+ (expr_span.shrink_to_hi(), ')'.to_string()),
+ ],
+ Applicability::MachineApplicable,
+ );
+ } else {
+ let call_expr = self.tcx.hir().expect_expr_by_hir_id(
+ self.tcx.hir().get_parent_node_by_hir_id(expr.hir_id),
+ );
+
+ let span = call_expr.span.trim_start(item_name.span).unwrap();
+
+ err.span_suggestion(
+ span,
+ "remove the arguments",
+ String::new(),
+ Applicability::MaybeIncorrect,
+ );
}
}
+
+ let field_kind = if is_accessible {
+ "field"
+ } else {
+ "private field"
+ };
+ err.span_label(item_name.span, format!("{}, not a method", field_kind));
}
} else {
err.span_label(span, format!("{} not found in `{}`", item_kind, ty_str));
diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs
index ba6894b..ab0e4b0 100644
--- a/src/librustc_typeck/check/mod.rs
+++ b/src/librustc_typeck/check/mod.rs
@@ -3463,8 +3463,22 @@
// We won't diverge unless both branches do (or the condition does).
self.diverges.set(cond_diverges | then_diverges & else_diverges);
} else {
+ // If this `if` expr is the parent's function return expr, the cause of the type
+ // coercion is the return type, point at it. (#25228)
+ let ret_reason = self.maybe_get_coercion_reason(then_expr.hir_id, sp);
+
let else_cause = self.cause(sp, ObligationCauseCode::IfExpressionWithNoElse);
- coerce.coerce_forced_unit(self, &else_cause, &mut |_| (), true);
+ coerce.coerce_forced_unit(self, &else_cause, &mut |err| {
+ if let Some((sp, msg)) = &ret_reason {
+ err.span_label(*sp, msg.as_str());
+ } else if let ExprKind::Block(block, _) = &then_expr.node {
+ if let Some(expr) = &block.expr {
+ err.span_label(expr.span, "found here".to_string());
+ }
+ }
+ err.note("`if` expressions without `else` evaluate to `()`");
+ err.help("consider adding an `else` block that evaluates to the expected type");
+ }, ret_reason.is_none());
// If the condition is false we can't diverge.
self.diverges.set(cond_diverges);
@@ -3478,6 +3492,37 @@
}
}
+ fn maybe_get_coercion_reason(&self, hir_id: hir::HirId, sp: Span) -> Option<(Span, String)> {
+ let node = self.tcx.hir().get_by_hir_id(self.tcx.hir().get_parent_node_by_hir_id(
+ self.tcx.hir().get_parent_node_by_hir_id(hir_id),
+ ));
+ if let Node::Block(block) = node {
+ // check that the body's parent is an fn
+ let parent = self.tcx.hir().get_by_hir_id(
+ self.tcx.hir().get_parent_node_by_hir_id(
+ self.tcx.hir().get_parent_node_by_hir_id(block.hir_id),
+ ),
+ );
+ if let (Some(expr), Node::Item(hir::Item {
+ node: hir::ItemKind::Fn(..), ..
+ })) = (&block.expr, parent) {
+ // check that the `if` expr without `else` is the fn body's expr
+ if expr.span == sp {
+ return self.get_fn_decl(hir_id).map(|(fn_decl, _)| (
+ fn_decl.output.span(),
+ format!("expected `{}` because of this return type", fn_decl.output),
+ ));
+ }
+ }
+ }
+ if let Node::Local(hir::Local {
+ ty: Some(_), pat, ..
+ }) = node {
+ return Some((pat.span, "expected because of this assignment".to_string()));
+ }
+ None
+ }
+
// Check field access expressions
fn check_field(&self,
expr: &'gcx hir::Expr,
@@ -3689,12 +3734,17 @@
field, expr_t)
}
- fn report_unknown_field(&self,
- ty: Ty<'tcx>,
- variant: &'tcx ty::VariantDef,
- field: &hir::Field,
- skip_fields: &[hir::Field],
- kind_name: &str) {
+ fn report_unknown_field(
+ &self,
+ ty: Ty<'tcx>,
+ variant: &'tcx ty::VariantDef,
+ field: &hir::Field,
+ skip_fields: &[hir::Field],
+ kind_name: &str,
+ ) {
+ if variant.recovered {
+ return;
+ }
let mut err = self.type_error_struct_with_diag(
field.ident.span,
|actual| match ty.sty {
diff --git a/src/librustc_typeck/coherence/inherent_impls_overlap.rs b/src/librustc_typeck/coherence/inherent_impls_overlap.rs
index 832c172..d0156db 100644
--- a/src/librustc_typeck/coherence/inherent_impls_overlap.rs
+++ b/src/librustc_typeck/coherence/inherent_impls_overlap.rs
@@ -25,7 +25,7 @@
let name_and_namespace = |def_id| {
let item = self.tcx.associated_item(def_id);
- (item.ident, Namespace::from(item.kind))
+ (item.ident.modern(), Namespace::from(item.kind))
};
let impl_items1 = self.tcx.associated_item_def_ids(impl1);
diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs
index 10e9613..c0739db 100644
--- a/src/librustc_typeck/collect.rs
+++ b/src/librustc_typeck/collect.rs
@@ -598,6 +598,10 @@
}
})
.collect();
+ let recovered = match def {
+ hir::VariantData::Struct(_, _, r) => *r,
+ _ => false,
+ };
ty::VariantDef::new(tcx,
did,
ident,
@@ -605,7 +609,8 @@
fields,
adt_kind,
CtorKind::from_hir(def),
- attribute_def_id
+ attribute_def_id,
+ recovered,
)
}
diff --git a/src/librustdoc/clean/auto_trait.rs b/src/librustdoc/clean/auto_trait.rs
index 20fa600..adbe73b 100644
--- a/src/librustdoc/clean/auto_trait.rs
+++ b/src/librustdoc/clean/auto_trait.rs
@@ -435,7 +435,7 @@
let new_ty = match &poly_trait.trait_ {
&Type::ResolvedPath {
ref path,
- ref typarams,
+ ref param_names,
ref did,
ref is_generic,
} => {
@@ -444,7 +444,13 @@
.expect("segments were empty");
let (old_input, old_output) = match last_segment.args {
- GenericArgs::AngleBracketed { types, .. } => (types, None),
+ GenericArgs::AngleBracketed { args, .. } => {
+ let types = args.iter().filter_map(|arg| match arg {
+ GenericArg::Type(ty) => Some(ty.clone()),
+ _ => None,
+ }).collect();
+ (types, None)
+ }
GenericArgs::Parenthesized { inputs, output, .. } => {
(inputs, output)
}
@@ -469,7 +475,7 @@
Type::ResolvedPath {
path: new_path,
- typarams: typarams.clone(),
+ param_names: param_names.clone(),
did: did.clone(),
is_generic: *is_generic,
}
@@ -669,7 +675,7 @@
match **trait_ {
Type::ResolvedPath {
path: ref trait_path,
- ref typarams,
+ ref param_names,
ref did,
ref is_generic,
} => {
@@ -724,7 +730,7 @@
PolyTrait {
trait_: Type::ResolvedPath {
path: new_trait_path,
- typarams: typarams.clone(),
+ param_names: param_names.clone(),
did: did.clone(),
is_generic: *is_generic,
},
diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs
index c51c802..ba44817 100644
--- a/src/librustdoc/clean/mod.rs
+++ b/src/librustdoc/clean/mod.rs
@@ -17,11 +17,11 @@
use rustc::middle::lang_items;
use rustc::middle::stability;
use rustc::mir::interpret::{GlobalId, ConstValue};
-use rustc::hir::{self, GenericArg, HirVec};
+use rustc::hir::{self, HirVec};
use rustc::hir::def::{self, Def, CtorKind};
use rustc::hir::def_id::{CrateNum, DefId, CRATE_DEF_INDEX, LOCAL_CRATE};
use rustc::hir::map::DisambiguatedDefPathData;
-use rustc::ty::subst::{Kind, InternalSubsts, SubstsRef};
+use rustc::ty::subst::{Kind, InternalSubsts, SubstsRef, UnpackedKind};
use rustc::ty::{self, DefIdTree, TyCtxt, Region, RegionVid, Ty, AdtKind};
use rustc::ty::fold::TypeFolder;
use rustc::ty::layout::VariantIdx;
@@ -508,6 +508,18 @@
.as_ref()
.or_else(|| self.stability.as_ref().and_then(|s| s.deprecation.as_ref()))
}
+ pub fn is_default(&self) -> bool {
+ match self.inner {
+ ItemEnum::MethodItem(ref meth) => {
+ if let Some(defaultness) = meth.defaultness {
+ defaultness.has_value() && !defaultness.is_final()
+ } else {
+ false
+ }
+ }
+ _ => false,
+ }
+ }
}
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
@@ -1045,7 +1057,7 @@
GenericBound::TraitBound(PolyTrait {
trait_: ResolvedPath {
path,
- typarams: None,
+ param_names: None,
did,
is_generic: false,
},
@@ -1089,24 +1101,37 @@
}
}
-fn external_generic_args(cx: &DocContext<'_>, trait_did: Option<DefId>, has_self: bool,
- bindings: Vec<TypeBinding>, substs: SubstsRef<'_>) -> GenericArgs {
- let lifetimes = substs.regions().filter_map(|v| v.clean(cx)).collect();
- let types = substs.types().skip(has_self as usize).collect::<Vec<_>>();
+fn external_generic_args(
+ cx: &DocContext<'_>,
+ trait_did: Option<DefId>,
+ has_self: bool,
+ bindings: Vec<TypeBinding>,
+ substs: SubstsRef<'_>,
+) -> GenericArgs {
+ let mut skip_self = has_self;
+ let mut ty_sty = None;
+ let args: Vec<_> = substs.iter().filter_map(|kind| match kind.unpack() {
+ UnpackedKind::Lifetime(lt) => {
+ lt.clean(cx).and_then(|lt| Some(GenericArg::Lifetime(lt)))
+ }
+ UnpackedKind::Type(_) if skip_self => {
+ skip_self = false;
+ None
+ }
+ UnpackedKind::Type(ty) => {
+ ty_sty = Some(&ty.sty);
+ Some(GenericArg::Type(ty.clean(cx)))
+ }
+ UnpackedKind::Const(ct) => Some(GenericArg::Const(ct.clean(cx))),
+ }).collect();
match trait_did {
// Attempt to sugar an external path like Fn<(A, B,), C> to Fn(A, B) -> C
Some(did) if cx.tcx.lang_items().fn_trait_kind(did).is_some() => {
- assert_eq!(types.len(), 1);
- let inputs = match types[0].sty {
- ty::Tuple(ref tys) => tys.iter().map(|t| t.clean(cx)).collect(),
- _ => {
- return GenericArgs::AngleBracketed {
- lifetimes,
- types: types.clean(cx),
- bindings,
- }
- }
+ assert!(ty_sty.is_some());
+ let inputs = match ty_sty {
+ Some(ty::Tuple(ref tys)) => tys.iter().map(|t| t.clean(cx)).collect(),
+ _ => return GenericArgs::AngleBracketed { args, bindings },
};
let output = None;
// FIXME(#20299) return type comes from a projection now
@@ -1114,17 +1139,10 @@
// ty::Tuple(ref v) if v.is_empty() => None, // -> ()
// _ => Some(types[1].clean(cx))
// };
- GenericArgs::Parenthesized {
- inputs,
- output,
- }
+ GenericArgs::Parenthesized { inputs, output }
},
_ => {
- GenericArgs::AngleBracketed {
- lifetimes,
- types: types.clean(cx),
- bindings,
- }
+ GenericArgs::AngleBracketed { args, bindings }
}
}
}
@@ -1176,7 +1194,7 @@
PolyTrait {
trait_: ResolvedPath {
path,
- typarams: None,
+ param_names: None,
did: trait_ref.def_id,
is_generic: false,
},
@@ -1462,14 +1480,14 @@
}
}
-impl<'tcx> Clean<GenericParamDef> for ty::GenericParamDef {
+impl Clean<GenericParamDef> for ty::GenericParamDef {
fn clean(&self, cx: &DocContext<'_>) -> GenericParamDef {
let (name, kind) = match self.kind {
ty::GenericParamDefKind::Lifetime => {
(self.name.to_string(), GenericParamDefKind::Lifetime)
}
ty::GenericParamDefKind::Type { has_default, .. } => {
- cx.renderinfo.borrow_mut().external_typarams
+ cx.renderinfo.borrow_mut().external_param_names
.insert(self.def_id, self.name.clean(cx));
let default = if has_default {
Some(cx.tcx.type_of(self.def_id).clean(cx))
@@ -1484,7 +1502,10 @@
})
}
ty::GenericParamDefKind::Const { .. } => {
- unimplemented!() // FIXME(const_generics)
+ (self.name.clean(cx), GenericParamDefKind::Const {
+ did: self.def_id,
+ ty: cx.tcx.type_of(self.def_id).clean(cx),
+ })
}
};
@@ -1685,9 +1706,7 @@
.flat_map(|param| match param.kind {
ty::GenericParamDefKind::Lifetime => Some(param.clean(cx)),
ty::GenericParamDefKind::Type { .. } => None,
- ty::GenericParamDefKind::Const { .. } => {
- unimplemented!() // FIXME(const_generics)
- }
+ ty::GenericParamDefKind::Const { .. } => Some(param.clean(cx)),
}).chain(simplify::ty_params(stripped_typarams).into_iter())
.collect(),
where_predicates: simplify::where_clauses(cx, where_predicates),
@@ -1700,9 +1719,11 @@
pub generics: Generics,
pub decl: FnDecl,
pub header: hir::FnHeader,
+ pub defaultness: Option<hir::Defaultness>,
}
-impl<'a> Clean<Method> for (&'a hir::MethodSig, &'a hir::Generics, hir::BodyId) {
+impl<'a> Clean<Method> for (&'a hir::MethodSig, &'a hir::Generics, hir::BodyId,
+ Option<hir::Defaultness>) {
fn clean(&self, cx: &DocContext<'_>) -> Method {
let (generics, decl) = enter_impl_trait(cx, || {
(self.1.clean(cx), (&*self.0.decl, self.2).clean(cx))
@@ -1711,6 +1732,7 @@
decl,
generics,
header: self.0.header,
+ defaultness: self.3,
}
}
}
@@ -2016,7 +2038,7 @@
default.map(|e| print_const_expr(cx, e)))
}
hir::TraitItemKind::Method(ref sig, hir::TraitMethod::Provided(body)) => {
- MethodItem((sig, &self.generics, body).clean(cx))
+ MethodItem((sig, &self.generics, body, None).clean(cx))
}
hir::TraitItemKind::Method(ref sig, hir::TraitMethod::Required(ref names)) => {
let (generics, decl) = enter_impl_trait(cx, || {
@@ -2054,7 +2076,7 @@
Some(print_const_expr(cx, expr)))
}
hir::ImplItemKind::Method(ref sig, body) => {
- MethodItem((sig, &self.generics, body).clean(cx))
+ MethodItem((sig, &self.generics, body, Some(self.defaultness)).clean(cx))
}
hir::ImplItemKind::Type(ref ty) => TypedefItem(Typedef {
type_: ty.clean(cx),
@@ -2137,7 +2159,8 @@
abi: sig.abi(),
constness,
asyncness: hir::IsAsync::NotAsync,
- }
+ },
+ defaultness: Some(self.defaultness),
})
} else {
TyMethodItem(TyMethod {
@@ -2244,7 +2267,7 @@
/// Structs/enums/traits (most that'd be an `hir::TyKind::Path`).
ResolvedPath {
path: Path,
- typarams: Option<Vec<GenericBound>>,
+ param_names: Option<Vec<GenericBound>>,
did: DefId,
/// `true` if is a `T::Name` path for associated types.
is_generic: bool,
@@ -2365,12 +2388,15 @@
}
}
- pub fn generics(&self) -> Option<&[Type]> {
+ pub fn generics(&self) -> Option<Vec<Type>> {
match *self {
ResolvedPath { ref path, .. } => {
path.segments.last().and_then(|seg| {
- if let GenericArgs::AngleBracketed { ref types, .. } = seg.args {
- Some(&**types)
+ if let GenericArgs::AngleBracketed { ref args, .. } = seg.args {
+ Some(args.iter().filter_map(|arg| match arg {
+ GenericArg::Type(ty) => Some(ty.clone()),
+ _ => None,
+ }).collect())
} else {
None
}
@@ -2706,7 +2732,7 @@
}
TyKind::TraitObject(ref bounds, ref lifetime) => {
match bounds[0].clean(cx).trait_ {
- ResolvedPath { path, typarams: None, did, is_generic } => {
+ ResolvedPath { path, param_names: None, did, is_generic } => {
let mut bounds: Vec<self::GenericBound> = bounds[1..].iter().map(|bound| {
self::GenericBound::TraitBound(bound.clean(cx),
hir::TraitBoundModifier::None)
@@ -2714,7 +2740,7 @@
if !lifetime.is_elided() {
bounds.push(self::GenericBound::Outlives(lifetime.clean(cx)));
}
- ResolvedPath { path, typarams: Some(bounds), did, is_generic, }
+ ResolvedPath { path, param_names: Some(bounds), did, is_generic, }
}
_ => Infer // shouldn't happen
}
@@ -2781,7 +2807,7 @@
None, false, vec![], substs);
ResolvedPath {
path,
- typarams: None,
+ param_names: None,
did,
is_generic: false,
}
@@ -2792,7 +2818,7 @@
None, false, vec![], InternalSubsts::empty());
ResolvedPath {
path: path,
- typarams: None,
+ param_names: None,
did: did,
is_generic: false,
}
@@ -2813,8 +2839,8 @@
inline::record_extern_fqn(cx, did, TypeKind::Trait);
- let mut typarams = vec![];
- reg.clean(cx).map(|b| typarams.push(GenericBound::Outlives(b)));
+ let mut param_names = vec![];
+ reg.clean(cx).map(|b| param_names.push(GenericBound::Outlives(b)));
for did in dids {
let empty = cx.tcx.intern_substs(&[]);
let path = external_path(cx, &cx.tcx.item_name(did).as_str(),
@@ -2823,13 +2849,13 @@
let bound = GenericBound::TraitBound(PolyTrait {
trait_: ResolvedPath {
path,
- typarams: None,
+ param_names: None,
did,
is_generic: false,
},
generic_params: Vec::new(),
}, hir::TraitBoundModifier::None);
- typarams.push(bound);
+ param_names.push(bound);
}
let mut bindings = vec![];
@@ -2844,7 +2870,7 @@
false, bindings, substs);
ResolvedPath {
path,
- typarams: Some(typarams),
+ param_names: Some(param_names),
did,
is_generic: false,
}
@@ -2921,6 +2947,15 @@
}
}
+impl<'tcx> Clean<Constant> for ty::Const<'tcx> {
+ fn clean(&self, cx: &DocContext<'_>) -> Constant {
+ Constant {
+ type_: self.ty.clean(cx),
+ expr: format!("{:?}", self.val), // FIXME(const_generics)
+ }
+ }
+}
+
impl Clean<Item> for hir::StructField {
fn clean(&self, cx: &DocContext<'_>) -> Item {
let local_did = cx.tcx.hir().local_def_id_from_hir_id(self.hir_id);
@@ -3229,10 +3264,26 @@
}
#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Eq, Debug, Hash)]
+pub enum GenericArg {
+ Lifetime(Lifetime),
+ Type(Type),
+ Const(Constant),
+}
+
+impl fmt::Display for GenericArg {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ match self {
+ GenericArg::Lifetime(lt) => lt.fmt(f),
+ GenericArg::Type(ty) => ty.fmt(f),
+ GenericArg::Const(ct) => ct.fmt(f),
+ }
+ }
+}
+
+#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Eq, Debug, Hash)]
pub enum GenericArgs {
AngleBracketed {
- lifetimes: Vec<Lifetime>,
- types: Vec<Type>,
+ args: Vec<GenericArg>,
bindings: Vec<TypeBinding>,
},
Parenthesized {
@@ -3250,27 +3301,19 @@
output: if output != Type::Tuple(Vec::new()) { Some(output) } else { None }
}
} else {
- let (mut lifetimes, mut types) = (vec![], vec![]);
- let mut elided_lifetimes = true;
- for arg in &self.args {
- match arg {
- GenericArg::Lifetime(lt) => {
- if !lt.is_elided() {
- elided_lifetimes = false;
- }
- lifetimes.push(lt.clean(cx));
- }
- GenericArg::Type(ty) => {
- types.push(ty.clean(cx));
- }
- GenericArg::Const(..) => {
- unimplemented!() // FIXME(const_generics)
- }
- }
- }
+ let elide_lifetimes = self.args.iter().all(|arg| match arg {
+ hir::GenericArg::Lifetime(lt) => lt.is_elided(),
+ _ => true,
+ });
GenericArgs::AngleBracketed {
- lifetimes: if elided_lifetimes { vec![] } else { lifetimes },
- types,
+ args: self.args.iter().filter_map(|arg| match arg {
+ hir::GenericArg::Lifetime(lt) if !elide_lifetimes => {
+ Some(GenericArg::Lifetime(lt.clean(cx)))
+ }
+ hir::GenericArg::Lifetime(_) => None,
+ hir::GenericArg::Type(ty) => Some(GenericArg::Type(ty.clean(cx))),
+ hir::GenericArg::Const(ct) => Some(GenericArg::Const(ct.clean(cx))),
+ }).collect(),
bindings: self.bindings.clean(cx),
}
}
@@ -3294,8 +3337,8 @@
fn strip_type(ty: Type) -> Type {
match ty {
- Type::ResolvedPath { path, typarams, did, is_generic } => {
- Type::ResolvedPath { path: strip_path(&path), typarams, did, is_generic }
+ Type::ResolvedPath { path, param_names, did, is_generic } => {
+ Type::ResolvedPath { path: strip_path(&path), param_names, did, is_generic }
}
Type::Tuple(inner_tys) => {
Type::Tuple(inner_tys.iter().map(|t| strip_type(t.clone())).collect())
@@ -3322,9 +3365,8 @@
PathSegment {
name: s.name.clone(),
args: GenericArgs::AngleBracketed {
- lifetimes: Vec::new(),
- types: Vec::new(),
- bindings: Vec::new(),
+ args: vec![],
+ bindings: vec![],
}
}
}).collect();
@@ -3475,7 +3517,7 @@
}
}
-#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
+#[derive(Clone, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable, Debug)]
pub struct Constant {
pub type_: Type,
pub expr: String,
@@ -3955,7 +3997,7 @@
_ => false,
};
let did = register_def(&*cx, path.def);
- ResolvedPath { path: path, typarams: None, did: did, is_generic: is_generic }
+ ResolvedPath { path: path, param_names: None, did: did, is_generic: is_generic }
}
pub fn register_def(cx: &DocContext<'_>, def: Def) -> DefId {
@@ -4381,9 +4423,9 @@
match bound.clone() {
GenericBound::Outlives(l) => SimpleBound::Outlives(l),
GenericBound::TraitBound(t, mod_) => match t.trait_ {
- Type::ResolvedPath { path, typarams, .. } => {
+ Type::ResolvedPath { path, param_names, .. } => {
SimpleBound::TraitBound(path.segments,
- typarams
+ param_names
.map_or_else(|| Vec::new(), |v| v.iter()
.map(|p| SimpleBound::from(p.clone()))
.collect()),
diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs
index dca6458..1982a16 100644
--- a/src/librustdoc/core.rs
+++ b/src/librustdoc/core.rs
@@ -236,8 +236,16 @@
ty::GenericParamDefKind::Type { .. } => {
args.push(hir::GenericArg::Type(self.ty_param_to_ty(param.clone())));
}
- ty::GenericParamDefKind::Const { .. } => {
- unimplemented!() // FIXME(const_generics)
+ ty::GenericParamDefKind::Const => {
+ args.push(hir::GenericArg::Const(hir::ConstArg {
+ value: hir::AnonConst {
+ hir_id: hir::DUMMY_HIR_ID,
+ body: hir::BodyId {
+ hir_id: hir::DUMMY_HIR_ID,
+ }
+ },
+ span: DUMMY_SP,
+ }))
}
}
}
diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs
index d204a17..3d8af7c 100644
--- a/src/librustdoc/html/format.rs
+++ b/src/librustdoc/html/format.rs
@@ -45,6 +45,7 @@
/// Wrapper struct for emitting a comma-separated list of items
pub struct CommaSep<'a, T>(pub &'a [T]);
pub struct AbiSpace(pub Abi);
+pub struct DefaultSpace(pub bool);
/// Wrapper struct for properly emitting a function or method declaration.
pub struct Function<'a> {
@@ -259,6 +260,14 @@
}
}
+impl fmt::Display for clean::Constant {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ fmt::Display::fmt(&self.expr, f)?;
+ f.write_str(": ")?;
+ fmt::Display::fmt(&self.type_, f)
+ }
+}
+
impl fmt::Display for clean::PolyTrait {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
if !self.generic_params.is_empty() {
@@ -300,32 +309,23 @@
impl fmt::Display for clean::GenericArgs {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self {
- clean::GenericArgs::AngleBracketed {
- ref lifetimes, ref types, ref bindings
- } => {
- if !lifetimes.is_empty() || !types.is_empty() || !bindings.is_empty() {
+ clean::GenericArgs::AngleBracketed { ref args, ref bindings } => {
+ if !args.is_empty() || !bindings.is_empty() {
if f.alternate() {
f.write_str("<")?;
} else {
f.write_str("<")?;
}
let mut comma = false;
- for lifetime in lifetimes {
- if comma {
- f.write_str(", ")?;
- }
- comma = true;
- write!(f, "{}", *lifetime)?;
- }
- for ty in types {
+ for arg in args {
if comma {
f.write_str(", ")?;
}
comma = true;
if f.alternate() {
- write!(f, "{:#}", *ty)?;
+ write!(f, "{:#}", *arg)?;
} else {
- write!(f, "{}", *ty)?;
+ write!(f, "{}", *arg)?;
}
}
for binding in bindings {
@@ -521,8 +521,8 @@
/// Helper to render type parameters
fn tybounds(w: &mut fmt::Formatter<'_>,
- typarams: &Option<Vec<clean::GenericBound>>) -> fmt::Result {
- match *typarams {
+ param_names: &Option<Vec<clean::GenericBound>>) -> fmt::Result {
+ match *param_names {
Some(ref params) => {
for param in params {
write!(w, " + ")?;
@@ -559,13 +559,13 @@
clean::Generic(ref name) => {
f.write_str(name)
}
- clean::ResolvedPath{ did, ref typarams, ref path, is_generic } => {
- if typarams.is_some() {
+ clean::ResolvedPath{ did, ref param_names, ref path, is_generic } => {
+ if param_names.is_some() {
f.write_str("dyn ")?;
}
// Paths like T::Output and Self::Output should be rendered with all segments
resolved_path(f, did, path, is_generic, use_absolute)?;
- tybounds(f, typarams)
+ tybounds(f, param_names)
}
clean::Infer => write!(f, "_"),
clean::Primitive(prim) => primitive_link(f, prim, prim.as_str()),
@@ -663,7 +663,7 @@
}
}
}
- clean::ResolvedPath { typarams: Some(ref v), .. } if !v.is_empty() => {
+ clean::ResolvedPath { param_names: Some(ref v), .. } if !v.is_empty() => {
write!(f, "{}{}{}(", amp, lt, m)?;
fmt_type(&ty, f, use_absolute)?;
write!(f, ")")
@@ -717,7 +717,7 @@
// the ugliness comes from inlining across crates where
// everything comes in as a fully resolved QPath (hard to
// look at).
- box clean::ResolvedPath { did, ref typarams, .. } => {
+ box clean::ResolvedPath { did, ref param_names, .. } => {
match href(did) {
Some((ref url, _, ref path)) if !f.alternate() => {
write!(f,
@@ -731,8 +731,8 @@
_ => write!(f, "{}", name)?,
}
- // FIXME: `typarams` are not rendered, and this seems bad?
- drop(typarams);
+ // FIXME: `param_names` are not rendered, and this seems bad?
+ drop(param_names);
Ok(())
}
_ => {
@@ -771,7 +771,7 @@
fmt::Display::fmt(ty, f)?;
} else {
match *ty {
- clean::ResolvedPath { typarams: None, ref path, is_generic: false, .. } => {
+ clean::ResolvedPath { param_names: None, ref path, is_generic: false, .. } => {
let last = path.segments.last().unwrap();
fmt::Display::fmt(&last.name, f)?;
fmt::Display::fmt(&last.args, f)?;
@@ -1057,3 +1057,13 @@
}
}
}
+
+impl fmt::Display for DefaultSpace {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ if self.0 {
+ write!(f, "default ")
+ } else {
+ Ok(())
+ }
+ }
+}
diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs
index b3a816d..445ce06 100644
--- a/src/librustdoc/html/render.rs
+++ b/src/librustdoc/html/render.rs
@@ -61,7 +61,7 @@
use crate::fold::DocFolder;
use crate::html::escape::Escape;
use crate::html::format::{AsyncSpace, ConstnessSpace};
-use crate::html::format::{GenericBounds, WhereClause, href, AbiSpace};
+use crate::html::format::{GenericBounds, WhereClause, href, AbiSpace, DefaultSpace};
use crate::html::format::{VisSpace, Function, UnsafetySpace, MutableSpace};
use crate::html::format::fmt_impl_for_trait_page;
use crate::html::item_type::ItemType;
@@ -271,7 +271,7 @@
/// Mapping of typaram ids to the name of the type parameter. This is used
/// when pretty-printing a type (so pretty-printing doesn't have to
/// painfully maintain a context like this)
- pub typarams: FxHashMap<DefId, String>,
+ pub param_names: FxHashMap<DefId, String>,
/// Maps a type ID to all known implementations for that type. This is only
/// recognized for intra-crate `ResolvedPath` types, and is used to print
@@ -368,7 +368,7 @@
pub struct RenderInfo {
pub inlined: FxHashSet<DefId>,
pub external_paths: crate::core::ExternalPaths,
- pub external_typarams: FxHashMap<DefId, String>,
+ pub external_param_names: FxHashMap<DefId, String>,
pub exact_paths: FxHashMap<DefId, Vec<String>>,
pub access_levels: AccessLevels<DefId>,
pub deref_trait_did: Option<DefId>,
@@ -601,7 +601,7 @@
let RenderInfo {
inlined: _,
external_paths,
- external_typarams,
+ external_param_names,
exact_paths,
access_levels,
deref_trait_did,
@@ -635,7 +635,7 @@
deref_mut_trait_did,
owned_box_did,
masked_crates: mem::replace(&mut krate.masked_crates, Default::default()),
- typarams: external_typarams,
+ param_names: external_param_names,
aliases: Default::default(),
};
@@ -1751,7 +1751,7 @@
clean::GenericParamDefKind::Lifetime => {}
clean::GenericParamDefKind::Type { did, .. } |
clean::GenericParamDefKind::Const { did, .. } => {
- self.typarams.insert(did, param.name.clone());
+ self.param_names.insert(did, param.name.clone());
}
}
}
@@ -3429,11 +3429,12 @@
}
};
let mut header_len = format!(
- "{}{}{}{}{:#}fn {}{:#}",
+ "{}{}{}{}{}{:#}fn {}{:#}",
VisSpace(&meth.visibility),
ConstnessSpace(header.constness),
UnsafetySpace(header.unsafety),
AsyncSpace(header.asyncness),
+ DefaultSpace(meth.is_default()),
AbiSpace(header.abi),
name,
*g
@@ -3445,12 +3446,13 @@
(0, true)
};
render_attributes(w, meth)?;
- write!(w, "{}{}{}{}{}fn <a href='{href}' class='fnname'>{name}</a>\
+ write!(w, "{}{}{}{}{}{}fn <a href='{href}' class='fnname'>{name}</a>\
{generics}{decl}{where_clause}",
VisSpace(&meth.visibility),
ConstnessSpace(header.constness),
UnsafetySpace(header.unsafety),
AsyncSpace(header.asyncness),
+ DefaultSpace(meth.is_default()),
AbiSpace(header.abi),
href = href,
name = name,
diff --git a/src/libstd/io/buffered.rs b/src/libstd/io/buffered.rs
index a14c10d..4668e3e 100644
--- a/src/libstd/io/buffered.rs
+++ b/src/libstd/io/buffered.rs
@@ -193,6 +193,13 @@
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn into_inner(self) -> R { self.inner }
+
+ /// Invalidates all data in the internal buffer.
+ #[inline]
+ fn discard_buffer(&mut self) {
+ self.pos = 0;
+ self.cap = 0;
+ }
}
impl<R: Seek> BufReader<R> {
@@ -227,6 +234,7 @@
// (larger than our internal buffer), bypass our internal buffer
// entirely.
if self.pos == self.cap && buf.len() >= self.buf.len() {
+ self.discard_buffer();
return self.inner.read(buf);
}
let nread = {
@@ -240,6 +248,7 @@
fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> io::Result<usize> {
let total_len = bufs.iter().map(|b| b.len()).sum::<usize>();
if self.pos == self.cap && total_len >= self.buf.len() {
+ self.discard_buffer();
return self.inner.read_vectored(bufs);
}
let nread = {
@@ -325,14 +334,14 @@
} else {
// seek backwards by our remainder, and then by the offset
self.inner.seek(SeekFrom::Current(-remainder))?;
- self.pos = self.cap; // empty the buffer
+ self.discard_buffer();
result = self.inner.seek(SeekFrom::Current(n))?;
}
} else {
// Seeking with Start/End doesn't care about our buffer length.
result = self.inner.seek(pos)?;
}
- self.pos = self.cap; // empty the buffer
+ self.discard_buffer();
Ok(result)
}
}
@@ -1069,6 +1078,40 @@
}
#[test]
+ fn test_buffered_reader_invalidated_after_read() {
+ let inner: &[u8] = &[5, 6, 7, 0, 1, 2, 3, 4];
+ let mut reader = BufReader::with_capacity(3, io::Cursor::new(inner));
+
+ assert_eq!(reader.fill_buf().ok(), Some(&[5, 6, 7][..]));
+ reader.consume(3);
+
+ let mut buffer = [0, 0, 0, 0, 0];
+ assert_eq!(reader.read(&mut buffer).ok(), Some(5));
+ assert_eq!(buffer, [0, 1, 2, 3, 4]);
+
+ assert!(reader.seek_relative(-2).is_ok());
+ let mut buffer = [0, 0];
+ assert_eq!(reader.read(&mut buffer).ok(), Some(2));
+ assert_eq!(buffer, [3, 4]);
+ }
+
+ #[test]
+ fn test_buffered_reader_invalidated_after_seek() {
+ let inner: &[u8] = &[5, 6, 7, 0, 1, 2, 3, 4];
+ let mut reader = BufReader::with_capacity(3, io::Cursor::new(inner));
+
+ assert_eq!(reader.fill_buf().ok(), Some(&[5, 6, 7][..]));
+ reader.consume(3);
+
+ assert!(reader.seek(SeekFrom::Current(5)).is_ok());
+
+ assert!(reader.seek_relative(-2).is_ok());
+ let mut buffer = [0, 0];
+ assert_eq!(reader.read(&mut buffer).ok(), Some(2));
+ assert_eq!(buffer, [3, 4]);
+ }
+
+ #[test]
fn test_buffered_reader_seek_underflow() {
// gimmick reader that yields its position modulo 256 for each byte
struct PositionReader {
diff --git a/src/libstd/io/cursor.rs b/src/libstd/io/cursor.rs
index 873da08..247d45c 100644
--- a/src/libstd/io/cursor.rs
+++ b/src/libstd/io/cursor.rs
@@ -212,6 +212,14 @@
"invalid seek to a negative or overflowing position"))
}
}
+
+ fn stream_len(&mut self) -> io::Result<u64> {
+ Ok(self.inner.as_ref().len() as u64)
+ }
+
+ fn stream_position(&mut self) -> io::Result<u64> {
+ Ok(self.pos)
+ }
}
#[stable(feature = "rust1", since = "1.0.0")]
diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs
index 1a2152a..4c88fc8 100644
--- a/src/libstd/io/mod.rs
+++ b/src/libstd/io/mod.rs
@@ -1345,6 +1345,85 @@
/// [`SeekFrom::Start`]: enum.SeekFrom.html#variant.Start
#[stable(feature = "rust1", since = "1.0.0")]
fn seek(&mut self, pos: SeekFrom) -> Result<u64>;
+
+ /// Returns the length of this stream (in bytes).
+ ///
+ /// This method is implemented using up to three seek operations. If this
+ /// method returns successfully, the seek position is unchanged (i.e. the
+ /// position before calling this method is the same as afterwards).
+ /// However, if this method returns an error, the seek position is
+ /// unspecified.
+ ///
+ /// If you need to obtain the length of *many* streams and you don't care
+ /// about the seek position afterwards, you can reduce the number of seek
+ /// operations by simply calling `seek(SeekFrom::End(0))` and using its
+ /// return value (it is also the stream length).
+ ///
+ /// Note that length of a stream can change over time (for example, when
+ /// data is appended to a file). So calling this method multiple times does
+ /// not necessarily return the same length each time.
+ ///
+ ///
+ /// # Example
+ ///
+ /// ```no_run
+ /// #![feature(seek_convenience)]
+ /// use std::{
+ /// io::{self, Seek},
+ /// fs::File,
+ /// };
+ ///
+ /// fn main() -> io::Result<()> {
+ /// let mut f = File::open("foo.txt")?;
+ ///
+ /// let len = f.stream_len()?;
+ /// println!("The file is currently {} bytes long", len);
+ /// Ok(())
+ /// }
+ /// ```
+ #[unstable(feature = "seek_convenience", issue = "0")]
+ fn stream_len(&mut self) -> Result<u64> {
+ let old_pos = self.stream_position()?;
+ let len = self.seek(SeekFrom::End(0))?;
+
+ // Avoid seeking a third time when we were already at the end of the
+ // stream. The branch is usually way cheaper than a seek operation.
+ if old_pos != len {
+ self.seek(SeekFrom::Start(old_pos))?;
+ }
+
+ Ok(len)
+ }
+
+ /// Returns the current seek position from the start of the stream.
+ ///
+ /// This is equivalent to `self.seek(SeekFrom::Current(0))`.
+ ///
+ ///
+ /// # Example
+ ///
+ /// ```no_run
+ /// #![feature(seek_convenience)]
+ /// use std::{
+ /// io::{self, BufRead, BufReader, Seek},
+ /// fs::File,
+ /// };
+ ///
+ /// fn main() -> io::Result<()> {
+ /// let mut f = BufReader::new(File::open("foo.txt")?);
+ ///
+ /// let before = f.stream_position()?;
+ /// f.read_line(&mut String::new())?;
+ /// let after = f.stream_position()?;
+ ///
+ /// println!("The first line was {} bytes long", after - before);
+ /// Ok(())
+ /// }
+ /// ```
+ #[unstable(feature = "seek_convenience", issue = "0")]
+ fn stream_position(&mut self) -> Result<u64> {
+ self.seek(SeekFrom::Current(0))
+ }
}
/// Enumeration of possible methods to seek within an I/O object.
@@ -2173,8 +2252,7 @@
mod tests {
use crate::io::prelude::*;
use crate::io;
- use super::Cursor;
- use super::repeat;
+ use super::{Cursor, SeekFrom, repeat};
#[test]
#[cfg_attr(target_os = "emscripten", ignore)]
@@ -2396,4 +2474,50 @@
super::read_to_end(&mut lr, &mut vec)
});
}
+
+ #[test]
+ fn seek_len() -> io::Result<()> {
+ let mut c = Cursor::new(vec![0; 15]);
+ assert_eq!(c.stream_len()?, 15);
+
+ c.seek(SeekFrom::End(0))?;
+ let old_pos = c.stream_position()?;
+ assert_eq!(c.stream_len()?, 15);
+ assert_eq!(c.stream_position()?, old_pos);
+
+ c.seek(SeekFrom::Start(7))?;
+ c.seek(SeekFrom::Current(2))?;
+ let old_pos = c.stream_position()?;
+ assert_eq!(c.stream_len()?, 15);
+ assert_eq!(c.stream_position()?, old_pos);
+
+ Ok(())
+ }
+
+ #[test]
+ fn seek_position() -> io::Result<()> {
+ // All `asserts` are duplicated here to make sure the method does not
+ // change anything about the seek state.
+ let mut c = Cursor::new(vec![0; 15]);
+ assert_eq!(c.stream_position()?, 0);
+ assert_eq!(c.stream_position()?, 0);
+
+ c.seek(SeekFrom::End(0))?;
+ assert_eq!(c.stream_position()?, 15);
+ assert_eq!(c.stream_position()?, 15);
+
+
+ c.seek(SeekFrom::Start(7))?;
+ c.seek(SeekFrom::Current(2))?;
+ assert_eq!(c.stream_position()?, 9);
+ assert_eq!(c.stream_position()?, 9);
+
+ c.seek(SeekFrom::End(-3))?;
+ c.seek(SeekFrom::Current(1))?;
+ c.seek(SeekFrom::Current(-5))?;
+ assert_eq!(c.stream_position()?, 8);
+ assert_eq!(c.stream_position()?, 8);
+
+ Ok(())
+ }
}
diff --git a/src/libstd/net/udp.rs b/src/libstd/net/udp.rs
index edc9d66..b42a812 100644
--- a/src/libstd/net/udp.rs
+++ b/src/libstd/net/udp.rs
@@ -180,6 +180,37 @@
}
}
+ /// Returns the socket address of the remote peer this socket was connected to.
+ ///
+ /// # Examples
+ ///
+ /// ```no_run
+ /// #![feature(udp_peer_addr)]
+ /// use std::net::{Ipv4Addr, SocketAddr, SocketAddrV4, UdpSocket};
+ ///
+ /// let socket = UdpSocket::bind("127.0.0.1:34254").expect("couldn't bind to address");
+ /// socket.connect("192.168.0.1:41203").expect("couldn't connect to address");
+ /// assert_eq!(socket.peer_addr().unwrap(),
+ /// SocketAddr::V4(SocketAddrV4::new(Ipv4Addr::new(192, 168, 0, 1), 41203)));
+ /// ```
+ ///
+ /// If the socket isn't connected, it will return a [`NotConnected`] error.
+ ///
+ /// [`NotConnected`]: ../../std/io/enum.ErrorKind.html#variant.NotConnected
+ ///
+ /// ```no_run
+ /// #![feature(udp_peer_addr)]
+ /// use std::net::UdpSocket;
+ ///
+ /// let socket = UdpSocket::bind("127.0.0.1:34254").expect("couldn't bind to address");
+ /// assert_eq!(socket.peer_addr().unwrap_err().kind(),
+ /// ::std::io::ErrorKind::NotConnected);
+ /// ```
+ #[unstable(feature = "udp_peer_addr", issue = "59127")]
+ pub fn peer_addr(&self) -> io::Result<SocketAddr> {
+ self.0.peer_addr()
+ }
+
/// Returns the socket address that this socket was created from.
///
/// # Examples
@@ -865,7 +896,7 @@
}
#[test]
- fn socket_name_ip4() {
+ fn socket_name() {
each_ip(&mut |addr, _| {
let server = t!(UdpSocket::bind(&addr));
assert_eq!(addr, t!(server.local_addr()));
@@ -873,6 +904,16 @@
}
#[test]
+ fn socket_peer() {
+ each_ip(&mut |addr1, addr2| {
+ let server = t!(UdpSocket::bind(&addr1));
+ assert_eq!(server.peer_addr().unwrap_err().kind(), ErrorKind::NotConnected);
+ t!(server.connect(&addr2));
+ assert_eq!(addr2, t!(server.peer_addr()));
+ })
+ }
+
+ #[test]
fn udp_clone_smoke() {
each_ip(&mut |addr1, addr2| {
let sock1 = t!(UdpSocket::bind(&addr1));
diff --git a/src/libstd/sys/cloudabi/shims/net.rs b/src/libstd/sys/cloudabi/shims/net.rs
index 6d2a496..4364a13 100644
--- a/src/libstd/sys/cloudabi/shims/net.rs
+++ b/src/libstd/sys/cloudabi/shims/net.rs
@@ -159,6 +159,10 @@
unsupported()
}
+ pub fn peer_addr(&self) -> io::Result<SocketAddr> {
+ match self.0 {}
+ }
+
pub fn socket_addr(&self) -> io::Result<SocketAddr> {
match self.0 {}
}
diff --git a/src/libstd/sys/redox/net/udp.rs b/src/libstd/sys/redox/net/udp.rs
index b1a60b1..274123d 100644
--- a/src/libstd/sys/redox/net/udp.rs
+++ b/src/libstd/sys/redox/net/udp.rs
@@ -72,6 +72,11 @@
Ok(None)
}
+ pub fn peer_addr(&self) -> Result<SocketAddr> {
+ let path = self.0.path()?;
+ Ok(path_to_peer_addr(path.to_str().unwrap_or("")))
+ }
+
pub fn socket_addr(&self) -> Result<SocketAddr> {
let path = self.0.path()?;
Ok(path_to_local_addr(path.to_str().unwrap_or("")))
diff --git a/src/libstd/sys/sgx/net.rs b/src/libstd/sys/sgx/net.rs
index e167e91..81f33c1 100644
--- a/src/libstd/sys/sgx/net.rs
+++ b/src/libstd/sys/sgx/net.rs
@@ -249,6 +249,10 @@
unsupported()
}
+ pub fn peer_addr(&self) -> io::Result<SocketAddr> {
+ match self.0 {}
+ }
+
pub fn socket_addr(&self) -> io::Result<SocketAddr> {
match self.0 {}
}
diff --git a/src/libstd/sys/unix/l4re.rs b/src/libstd/sys/unix/l4re.rs
index b9e7253..b3dd1cf 100644
--- a/src/libstd/sys/unix/l4re.rs
+++ b/src/libstd/sys/unix/l4re.rs
@@ -292,6 +292,10 @@
pub fn into_socket(self) -> Socket { self.inner }
+ pub fn peer_addr(&self) -> io::Result<SocketAddr> {
+ unimpl!();
+ }
+
pub fn socket_addr(&self) -> io::Result<SocketAddr> {
unimpl!();
}
@@ -463,4 +467,3 @@
}
}
}
-
diff --git a/src/libstd/sys/unix/stack_overflow.rs b/src/libstd/sys/unix/stack_overflow.rs
index 8c60bdd..561279e8 100644
--- a/src/libstd/sys/unix/stack_overflow.rs
+++ b/src/libstd/sys/unix/stack_overflow.rs
@@ -140,6 +140,7 @@
#[cfg(any(target_os = "linux",
target_os = "macos",
target_os = "bitrig",
+ target_os = "freebsd",
target_os = "netbsd",
target_os = "openbsd",
target_os = "solaris"))]
@@ -147,8 +148,7 @@
libc::stack_t { ss_sp: get_stackp(), ss_flags: 0, ss_size: SIGSTKSZ }
}
- #[cfg(any(target_os = "freebsd",
- target_os = "dragonfly"))]
+ #[cfg(target_os = "dragonfly")]
unsafe fn get_stack() -> libc::stack_t {
libc::stack_t { ss_sp: get_stackp() as *mut i8, ss_flags: 0, ss_size: SIGSTKSZ }
}
diff --git a/src/libstd/sys/wasm/net.rs b/src/libstd/sys/wasm/net.rs
index a2ea2df..c85dd00 100644
--- a/src/libstd/sys/wasm/net.rs
+++ b/src/libstd/sys/wasm/net.rs
@@ -156,6 +156,10 @@
unsupported()
}
+ pub fn peer_addr(&self) -> io::Result<SocketAddr> {
+ match self.0 {}
+ }
+
pub fn socket_addr(&self) -> io::Result<SocketAddr> {
match self.0 {}
}
diff --git a/src/libstd/sys_common/net.rs b/src/libstd/sys_common/net.rs
index b9505aaa..b77bcee 100644
--- a/src/libstd/sys_common/net.rs
+++ b/src/libstd/sys_common/net.rs
@@ -472,6 +472,12 @@
pub fn into_socket(self) -> Socket { self.inner }
+ pub fn peer_addr(&self) -> io::Result<SocketAddr> {
+ sockname(|buf, len| unsafe {
+ c::getpeername(*self.inner.as_inner(), buf, len)
+ })
+ }
+
pub fn socket_addr(&self) -> io::Result<SocketAddr> {
sockname(|buf, len| unsafe {
c::getsockname(*self.inner.as_inner(), buf, len)
diff --git a/src/libstd/thread/mod.rs b/src/libstd/thread/mod.rs
index 08f0aa2..d856f9b 100644
--- a/src/libstd/thread/mod.rs
+++ b/src/libstd/thread/mod.rs
@@ -163,6 +163,7 @@
use crate::fmt;
use crate::io;
use crate::mem;
+use crate::num::NonZeroU64;
use crate::panic;
use crate::panicking;
use crate::str;
@@ -1036,7 +1037,7 @@
/// [`Thread`]: ../../std/thread/struct.Thread.html
#[stable(feature = "thread_id", since = "1.19.0")]
#[derive(Eq, PartialEq, Clone, Copy, Hash, Debug)]
-pub struct ThreadId(u64);
+pub struct ThreadId(NonZeroU64);
impl ThreadId {
// Generate a new unique thread ID.
@@ -1044,7 +1045,7 @@
// We never call `GUARD.init()`, so it is UB to attempt to
// acquire this mutex reentrantly!
static GUARD: mutex::Mutex = mutex::Mutex::new();
- static mut COUNTER: u64 = 0;
+ static mut COUNTER: u64 = 1;
unsafe {
let _guard = GUARD.lock();
@@ -1058,7 +1059,7 @@
let id = COUNTER;
COUNTER += 1;
- ThreadId(id)
+ ThreadId(NonZeroU64::new(id).unwrap())
}
}
}
@@ -1484,9 +1485,10 @@
mod tests {
use super::Builder;
use crate::any::Any;
+ use crate::mem;
use crate::sync::mpsc::{channel, Sender};
use crate::result;
- use crate::thread;
+ use crate::thread::{self, ThreadId};
use crate::time::Duration;
use crate::u32;
@@ -1717,6 +1719,11 @@
}
#[test]
+ fn test_size_of_option_thread_id() {
+ assert_eq!(mem::size_of::<Option<ThreadId>>(), mem::size_of::<ThreadId>());
+ }
+
+ #[test]
fn test_thread_id_equal() {
assert!(thread::current().id() == thread::current().id());
}
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs
index 1a0da73..2cbd2df 100644
--- a/src/libsyntax/ast.rs
+++ b/src/libsyntax/ast.rs
@@ -620,7 +620,7 @@
/// A struct or struct variant pattern (e.g., `Variant {x, y, ..}`).
/// The `bool` is `true` in the presence of a `..`.
- Struct(Path, Vec<Spanned<FieldPat>>, bool),
+ Struct(Path, Vec<Spanned<FieldPat>>, /* recovered */ bool),
/// A tuple struct/variant pattern (`Variant(x, y, .., z)`).
/// If the `..` pattern fragment is present, then `Option<usize>` denotes its position.
@@ -2133,7 +2133,7 @@
/// Struct variant.
///
/// E.g., `Bar { .. }` as in `enum Foo { Bar { .. } }`.
- Struct(Vec<StructField>, NodeId),
+ Struct(Vec<StructField>, NodeId, bool),
/// Tuple variant.
///
/// E.g., `Bar(..)` as in `enum Foo { Bar(..) }`.
@@ -2147,13 +2147,13 @@
impl VariantData {
pub fn fields(&self) -> &[StructField] {
match *self {
- VariantData::Struct(ref fields, _) | VariantData::Tuple(ref fields, _) => fields,
+ VariantData::Struct(ref fields, ..) | VariantData::Tuple(ref fields, _) => fields,
_ => &[],
}
}
pub fn id(&self) -> NodeId {
match *self {
- VariantData::Struct(_, id) | VariantData::Tuple(_, id) | VariantData::Unit(id) => id,
+ VariantData::Struct(_, id, _) | VariantData::Tuple(_, id) | VariantData::Unit(id) => id,
}
}
pub fn is_struct(&self) -> bool {
diff --git a/src/libsyntax/config.rs b/src/libsyntax/config.rs
index c300ffc..7159c94 100644
--- a/src/libsyntax/config.rs
+++ b/src/libsyntax/config.rs
@@ -225,7 +225,7 @@
fn configure_variant_data(&mut self, vdata: &mut ast::VariantData) {
match vdata {
- ast::VariantData::Struct(fields, _id) |
+ ast::VariantData::Struct(fields, _id, _) |
ast::VariantData::Tuple(fields, _id) =>
fields.flat_map_in_place(|field| self.configure(field)),
ast::VariantData::Unit(_id) => {}
diff --git a/src/libsyntax/mut_visit.rs b/src/libsyntax/mut_visit.rs
index 462346d..5bb1d8a 100644
--- a/src/libsyntax/mut_visit.rs
+++ b/src/libsyntax/mut_visit.rs
@@ -765,7 +765,7 @@
pub fn noop_visit_variant_data<T: MutVisitor>(vdata: &mut VariantData, vis: &mut T) {
match vdata {
- VariantData::Struct(fields, id) |
+ VariantData::Struct(fields, id, _) |
VariantData::Tuple(fields, id) => {
visit_vec(fields, |field| vis.visit_struct_field(field));
vis.visit_id(id);
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 3e00d94..648ee77 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -1524,7 +1524,7 @@
at_end: &mut bool,
mut attrs: Vec<Attribute>) -> PResult<'a, TraitItem> {
let lo = self.span;
-
+ self.eat_bad_pub();
let (name, node, generics) = if self.eat_keyword(keywords::Type) {
self.parse_trait_item_assoc_ty()?
} else if self.is_const_item() {
@@ -6837,14 +6837,16 @@
VariantData::Unit(ast::DUMMY_NODE_ID)
} else {
// If we see: `struct Foo<T> where T: Copy { ... }`
- VariantData::Struct(self.parse_record_struct_body()?, ast::DUMMY_NODE_ID)
+ let (fields, recovered) = self.parse_record_struct_body()?;
+ VariantData::Struct(fields, ast::DUMMY_NODE_ID, recovered)
}
// No `where` so: `struct Foo<T>;`
} else if self.eat(&token::Semi) {
VariantData::Unit(ast::DUMMY_NODE_ID)
// Record-style struct definition
} else if self.token == token::OpenDelim(token::Brace) {
- VariantData::Struct(self.parse_record_struct_body()?, ast::DUMMY_NODE_ID)
+ let (fields, recovered) = self.parse_record_struct_body()?;
+ VariantData::Struct(fields, ast::DUMMY_NODE_ID, recovered)
// Tuple-style struct definition with optional where-clause.
} else if self.token == token::OpenDelim(token::Paren) {
let body = VariantData::Tuple(self.parse_tuple_struct_body()?, ast::DUMMY_NODE_ID);
@@ -6872,9 +6874,11 @@
let vdata = if self.token.is_keyword(keywords::Where) {
generics.where_clause = self.parse_where_clause()?;
- VariantData::Struct(self.parse_record_struct_body()?, ast::DUMMY_NODE_ID)
+ let (fields, recovered) = self.parse_record_struct_body()?;
+ VariantData::Struct(fields, ast::DUMMY_NODE_ID, recovered)
} else if self.token == token::OpenDelim(token::Brace) {
- VariantData::Struct(self.parse_record_struct_body()?, ast::DUMMY_NODE_ID)
+ let (fields, recovered) = self.parse_record_struct_body()?;
+ VariantData::Struct(fields, ast::DUMMY_NODE_ID, recovered)
} else {
let token_str = self.this_token_descr();
let mut err = self.fatal(&format!(
@@ -6906,12 +6910,16 @@
}
}
- fn parse_record_struct_body(&mut self) -> PResult<'a, Vec<StructField>> {
+ fn parse_record_struct_body(
+ &mut self,
+ ) -> PResult<'a, (Vec<StructField>, /* recovered */ bool)> {
let mut fields = Vec::new();
+ let mut recovered = false;
if self.eat(&token::OpenDelim(token::Brace)) {
while self.token != token::CloseDelim(token::Brace) {
let field = self.parse_struct_decl_field().map_err(|e| {
self.recover_stmt();
+ recovered = true;
e
});
match field {
@@ -6930,7 +6938,7 @@
return Err(err);
}
- Ok(fields)
+ Ok((fields, recovered))
}
fn parse_tuple_struct_body(&mut self) -> PResult<'a, Vec<StructField>> {
@@ -7688,16 +7696,19 @@
let struct_def;
let mut disr_expr = None;
+ self.eat_bad_pub();
let ident = self.parse_ident()?;
if self.check(&token::OpenDelim(token::Brace)) {
// Parse a struct variant.
all_nullary = false;
- struct_def = VariantData::Struct(self.parse_record_struct_body()?,
- ast::DUMMY_NODE_ID);
+ let (fields, recovered) = self.parse_record_struct_body()?;
+ struct_def = VariantData::Struct(fields, ast::DUMMY_NODE_ID, recovered);
} else if self.check(&token::OpenDelim(token::Paren)) {
all_nullary = false;
- struct_def = VariantData::Tuple(self.parse_tuple_struct_body()?,
- ast::DUMMY_NODE_ID);
+ struct_def = VariantData::Tuple(
+ self.parse_tuple_struct_body()?,
+ ast::DUMMY_NODE_ID,
+ );
} else if self.eat(&token::Eq) {
disr_expr = Some(AnonConst {
id: ast::DUMMY_NODE_ID,
@@ -7719,11 +7730,25 @@
};
variants.push(respan(vlo.to(self.prev_span), vr));
- if !self.eat(&token::Comma) { break; }
+ if !self.eat(&token::Comma) {
+ if self.token.is_ident() && !self.token.is_reserved_ident() {
+ let sp = self.sess.source_map().next_point(self.prev_span);
+ let mut err = self.struct_span_err(sp, "missing comma");
+ err.span_suggestion_short(
+ sp,
+ "missing comma",
+ ",".to_owned(),
+ Applicability::MaybeIncorrect,
+ );
+ err.emit();
+ } else {
+ break;
+ }
+ }
}
self.expect(&token::CloseDelim(token::Brace))?;
if !any_disr.is_empty() && !all_nullary {
- let mut err =self.struct_span_err(
+ let mut err = self.struct_span_err(
any_disr.clone(),
"discriminator values can only be used with a field-less enum",
);
@@ -8608,6 +8633,21 @@
Applicability::MaybeIncorrect,
).emit();
}
+
+ /// Recover from `pub` keyword in places where it seems _reasonable_ but isn't valid.
+ fn eat_bad_pub(&mut self) {
+ if self.token.is_keyword(keywords::Pub) {
+ match self.parse_visibility(false) {
+ Ok(vis) => {
+ let mut err = self.diagnostic()
+ .struct_span_err(vis.span, "unnecessary visibility qualifier");
+ err.span_label(vis.span, "`pub` not permitted here");
+ err.emit();
+ }
+ Err(mut err) => err.emit(),
+ }
+ }
+ }
}
pub fn emit_unclosed_delims(unclosed_delims: &mut Vec<UnmatchedBrace>, handler: &errors::Handler) {
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs
index e04e127..07df14d 100644
--- a/src/libsyntax/print/pprust.rs
+++ b/src/libsyntax/print/pprust.rs
@@ -1263,13 +1263,13 @@
self.s.word(";")?;
self.end()?; // end the outer cbox
}
- ast::ItemKind::Fn(ref decl, header, ref typarams, ref body) => {
+ ast::ItemKind::Fn(ref decl, header, ref param_names, ref body) => {
self.head("")?;
self.print_fn(
decl,
header,
Some(item.ident),
- typarams,
+ param_names,
&item.vis
)?;
self.s.word(" ")?;
diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs
index 3fcba0f..cb0ce48 100644
--- a/src/libtest/lib.rs
+++ b/src/libtest/lib.rs
@@ -44,3 +44,28 @@
pub fn black_box<T>(dummy: T) -> T {
dummy
}
+
+#[cfg(test)]
+mod tests {
+ use crate::Bencher;
+ use libtest::stats::Stats;
+
+ #[bench]
+ pub fn sum_three_items(b: &mut Bencher) {
+ b.iter(|| {
+ [1e20f64, 1.5f64, -1e20f64].sum();
+ })
+ }
+
+ #[bench]
+ pub fn sum_many_f64(b: &mut Bencher) {
+ let nums = [-1e30f64, 1e60, 1e30, 1.0, -1e60];
+ let v = (0..500).map(|i| nums[i % 5]).collect::<Vec<_>>();
+ b.iter(|| {
+ v.sum();
+ })
+ }
+
+ #[bench]
+ pub fn no_iter(_: &mut Bencher) {}
+}
diff --git a/src/test/assembly/auxiliary/breakpoint-panic-handler.rs b/src/test/assembly/auxiliary/breakpoint-panic-handler.rs
new file mode 100644
index 0000000..d54c118
--- /dev/null
+++ b/src/test/assembly/auxiliary/breakpoint-panic-handler.rs
@@ -0,0 +1,8 @@
+#![feature(core_intrinsics)]
+#![no_std]
+
+#[panic_handler]
+unsafe fn breakpoint_panic_handler(_: &::core::panic::PanicInfo) -> ! {
+ core::intrinsics::breakpoint();
+ core::hint::unreachable_unchecked();
+}
diff --git a/src/test/run-make/nvptx-dylib-crate/dep.rs b/src/test/assembly/auxiliary/non-inline-dependency.rs
similarity index 100%
rename from src/test/run-make/nvptx-dylib-crate/dep.rs
rename to src/test/assembly/auxiliary/non-inline-dependency.rs
diff --git a/src/test/assembly/nvptx-arch-default.rs b/src/test/assembly/nvptx-arch-default.rs
new file mode 100644
index 0000000..7fe71c3
--- /dev/null
+++ b/src/test/assembly/nvptx-arch-default.rs
@@ -0,0 +1,12 @@
+// assembly-output: ptx-linker
+// compile-flags: --crate-type cdylib
+// only-nvptx64
+
+#![no_std]
+
+// aux-build: breakpoint-panic-handler.rs
+extern crate breakpoint_panic_handler;
+
+// Verify default target arch with ptx-linker.
+// CHECK: .target sm_30
+// CHECK: .address_size 64
diff --git a/src/test/assembly/nvptx-arch-emit-asm.rs b/src/test/assembly/nvptx-arch-emit-asm.rs
new file mode 100644
index 0000000..0ca1772
--- /dev/null
+++ b/src/test/assembly/nvptx-arch-emit-asm.rs
@@ -0,0 +1,9 @@
+// assembly-output: emit-asm
+// compile-flags: --crate-type rlib
+// only-nvptx64
+
+#![no_std]
+
+// Verify default arch without ptx-linker involved.
+// CHECK: .target sm_30
+// CHECK: .address_size 64
diff --git a/src/test/assembly/nvptx-arch-link-arg.rs b/src/test/assembly/nvptx-arch-link-arg.rs
new file mode 100644
index 0000000..f6b6e8c
--- /dev/null
+++ b/src/test/assembly/nvptx-arch-link-arg.rs
@@ -0,0 +1,12 @@
+// assembly-output: ptx-linker
+// compile-flags: --crate-type cdylib -C link-arg=--arch=sm_60
+// only-nvptx64
+
+#![no_std]
+
+// aux-build: breakpoint-panic-handler.rs
+extern crate breakpoint_panic_handler;
+
+// Verify target arch override via `link-arg`.
+// CHECK: .target sm_60
+// CHECK: .address_size 64
diff --git a/src/test/assembly/nvptx-arch-target-cpu.rs b/src/test/assembly/nvptx-arch-target-cpu.rs
new file mode 100644
index 0000000..08a7a19
--- /dev/null
+++ b/src/test/assembly/nvptx-arch-target-cpu.rs
@@ -0,0 +1,12 @@
+// assembly-output: ptx-linker
+// compile-flags: --crate-type cdylib -C target-cpu=sm_50
+// only-nvptx64
+
+#![no_std]
+
+// aux-build: breakpoint-panic-handler.rs
+extern crate breakpoint_panic_handler;
+
+// Verify target arch override via `target-cpu`.
+// CHECK: .target sm_50
+// CHECK: .address_size 64
diff --git a/src/test/assembly/nvptx-atomics.rs b/src/test/assembly/nvptx-atomics.rs
new file mode 100644
index 0000000..3bbd7b3
--- /dev/null
+++ b/src/test/assembly/nvptx-atomics.rs
@@ -0,0 +1,85 @@
+// assembly-output: ptx-linker
+// compile-flags: --crate-type cdylib
+// only-nvptx64
+
+#![feature(abi_ptx, core_intrinsics)]
+#![no_std]
+
+use core::intrinsics::*;
+
+// aux-build: breakpoint-panic-handler.rs
+extern crate breakpoint_panic_handler;
+
+// Currently, LLVM NVPTX backend can only emit atomic instructions with
+// `relaxed` (PTX default) ordering. But it's also useful to make sure
+// the backend won't fail with other orders. Apparently, the backend
+// doesn't support fences as well. As a workaround `llvm.nvvm.membar.*`
+// could work, and perhaps on the long run, all the atomic operations
+// should rather be provided by `core::arch::nvptx`.
+
+// Also, PTX ISA doesn't have atomic `load`, `store` and `nand`.
+
+// FIXME(denzp): add tests for `core::sync::atomic::*`.
+
+#[no_mangle]
+pub unsafe extern "ptx-kernel" fn atomics_kernel(a: *mut u32) {
+ // CHECK: atom.global.and.b32 %{{r[0-9]+}}, [%{{rd[0-9]+}}], 1;
+ // CHECK: atom.global.and.b32 %{{r[0-9]+}}, [%{{rd[0-9]+}}], 1;
+ atomic_and(a, 1);
+ atomic_and_relaxed(a, 1);
+
+ // CHECK: atom.global.cas.b32 %{{r[0-9]+}}, [%{{rd[0-9]+}}], 1, 2;
+ // CHECK: atom.global.cas.b32 %{{r[0-9]+}}, [%{{rd[0-9]+}}], 1, 2;
+ atomic_cxchg(a, 1, 2);
+ atomic_cxchg_relaxed(a, 1, 2);
+
+ // CHECK: atom.global.max.s32 %{{r[0-9]+}}, [%{{rd[0-9]+}}], 1;
+ // CHECK: atom.global.max.s32 %{{r[0-9]+}}, [%{{rd[0-9]+}}], 1;
+ atomic_max(a, 1);
+ atomic_max_relaxed(a, 1);
+
+ // CHECK: atom.global.min.s32 %{{r[0-9]+}}, [%{{rd[0-9]+}}], 1;
+ // CHECK: atom.global.min.s32 %{{r[0-9]+}}, [%{{rd[0-9]+}}], 1;
+ atomic_min(a, 1);
+ atomic_min_relaxed(a, 1);
+
+ // CHECK: atom.global.or.b32 %{{r[0-9]+}}, [%{{rd[0-9]+}}], 1;
+ // CHECK: atom.global.or.b32 %{{r[0-9]+}}, [%{{rd[0-9]+}}], 1;
+ atomic_or(a, 1);
+ atomic_or_relaxed(a, 1);
+
+ // CHECK: atom.global.max.u32 %{{r[0-9]+}}, [%{{rd[0-9]+}}], 1;
+ // CHECK: atom.global.max.u32 %{{r[0-9]+}}, [%{{rd[0-9]+}}], 1;
+ atomic_umax(a, 1);
+ atomic_umax_relaxed(a, 1);
+
+ // CHECK: atom.global.min.u32 %{{r[0-9]+}}, [%{{rd[0-9]+}}], 1;
+ // CHECK: atom.global.min.u32 %{{r[0-9]+}}, [%{{rd[0-9]+}}], 1;
+ atomic_umin(a, 1);
+ atomic_umin_relaxed(a, 1);
+
+ // CHECK: atom.global.add.u32 %{{r[0-9]+}}, [%{{rd[0-9]+}}], 1;
+ // CHECK: atom.global.add.u32 %{{r[0-9]+}}, [%{{rd[0-9]+}}], 1;
+ atomic_xadd(a, 1);
+ atomic_xadd_relaxed(a, 1);
+
+ // CHECK: atom.global.exch.b32 %{{r[0-9]+}}, [%{{rd[0-9]+}}], 1;
+ // CHECK: atom.global.exch.b32 %{{r[0-9]+}}, [%{{rd[0-9]+}}], 1;
+ atomic_xchg(a, 1);
+ atomic_xchg_relaxed(a, 1);
+
+ // CHECK: atom.global.xor.b32 %{{r[0-9]+}}, [%{{rd[0-9]+}}], 1;
+ // CHECK: atom.global.xor.b32 %{{r[0-9]+}}, [%{{rd[0-9]+}}], 1;
+ atomic_xor(a, 1);
+ atomic_xor_relaxed(a, 1);
+
+ // CHECK: mov.u32 %[[sub_0_arg:r[0-9]+]], 100;
+ // CHECK: neg.s32 temp, %[[sub_0_arg]];
+ // CHECK: atom.global.add.u32 %{{r[0-9]+}}, [%{{rd[0-9]+}}], temp;
+ atomic_xsub(a, 100);
+
+ // CHECK: mov.u32 %[[sub_1_arg:r[0-9]+]], 200;
+ // CHECK: neg.s32 temp, %[[sub_1_arg]];
+ // CHECK: atom.global.add.u32 %{{r[0-9]+}}, [%{{rd[0-9]+}}], temp;
+ atomic_xsub_relaxed(a, 200);
+}
diff --git a/src/test/assembly/nvptx-internalizing.rs b/src/test/assembly/nvptx-internalizing.rs
new file mode 100644
index 0000000..db82264
--- /dev/null
+++ b/src/test/assembly/nvptx-internalizing.rs
@@ -0,0 +1,27 @@
+// assembly-output: ptx-linker
+// compile-flags: --crate-type cdylib
+// only-nvptx64
+
+#![feature(abi_ptx)]
+#![no_std]
+
+// aux-build: breakpoint-panic-handler.rs
+extern crate breakpoint_panic_handler;
+
+// aux-build: non-inline-dependency.rs
+extern crate non_inline_dependency as dep;
+
+// Verify that no extra function declarations are present.
+// CHECK-NOT: .func
+
+// CHECK: .visible .entry top_kernel(
+#[no_mangle]
+pub unsafe extern "ptx-kernel" fn top_kernel(a: *const u32, b: *mut u32) {
+ // CHECK: add.s32 %{{r[0-9]+}}, %{{r[0-9]+}}, 5;
+ *b = *a + 5;
+}
+
+// Verify that no extra function definitions are here.
+// CHECK-NOT: .func
+// CHECK-NOT: .entry
+
diff --git a/src/test/assembly/nvptx-linking-binary.rs b/src/test/assembly/nvptx-linking-binary.rs
new file mode 100644
index 0000000..d88ed91
--- /dev/null
+++ b/src/test/assembly/nvptx-linking-binary.rs
@@ -0,0 +1,39 @@
+// assembly-output: ptx-linker
+// compile-flags: --crate-type bin
+// only-nvptx64
+
+#![feature(abi_ptx)]
+#![no_main]
+#![no_std]
+
+// aux-build: breakpoint-panic-handler.rs
+extern crate breakpoint_panic_handler;
+
+// aux-build: non-inline-dependency.rs
+extern crate non_inline_dependency as dep;
+
+// Make sure declarations are there.
+// CHECK: .func (.param .b32 func_retval0) wrapping_external_fn
+// CHECK: .func (.param .b32 func_retval0) panicking_external_fn
+
+// CHECK-LABEL: .visible .entry top_kernel(
+#[no_mangle]
+pub unsafe extern "ptx-kernel" fn top_kernel(a: *const u32, b: *mut u32) {
+ // CHECK: call.uni (retval0),
+ // CHECK-NEXT: wrapping_external_fn
+ // CHECK: ld.param.b32 %[[LHS:r[0-9]+]], [retval0+0];
+ let lhs = dep::wrapping_external_fn(*a);
+
+ // CHECK: call.uni (retval0),
+ // CHECK-NEXT: panicking_external_fn
+ // CHECK: ld.param.b32 %[[RHS:r[0-9]+]], [retval0+0];
+ let rhs = dep::panicking_external_fn(*a);
+
+ // CHECK: add.s32 %[[RES:r[0-9]+]], %[[RHS]], %[[LHS]];
+ // CHECK: st.global.u32 [%{{rd[0-9]+}}], %[[RES]];
+ *b = lhs + rhs;
+}
+
+// Verify that external function bodies are available.
+// CHECK: .func (.param .b32 func_retval0) wrapping_external_fn
+// CHECK: .func (.param .b32 func_retval0) panicking_external_fn
diff --git a/src/test/assembly/nvptx-linking-cdylib.rs b/src/test/assembly/nvptx-linking-cdylib.rs
new file mode 100644
index 0000000..1145f56
--- /dev/null
+++ b/src/test/assembly/nvptx-linking-cdylib.rs
@@ -0,0 +1,38 @@
+// assembly-output: ptx-linker
+// compile-flags: --crate-type cdylib
+// only-nvptx64
+
+#![feature(abi_ptx)]
+#![no_std]
+
+// aux-build: breakpoint-panic-handler.rs
+extern crate breakpoint_panic_handler;
+
+// aux-build: non-inline-dependency.rs
+extern crate non_inline_dependency as dep;
+
+// Make sure declarations are there.
+// CHECK: .func (.param .b32 func_retval0) wrapping_external_fn
+// CHECK: .func (.param .b32 func_retval0) panicking_external_fn
+
+// CHECK-LABEL: .visible .entry top_kernel(
+#[no_mangle]
+pub unsafe extern "ptx-kernel" fn top_kernel(a: *const u32, b: *mut u32) {
+ // CHECK: call.uni (retval0),
+ // CHECK-NEXT: wrapping_external_fn
+ // CHECK: ld.param.b32 %[[LHS:r[0-9]+]], [retval0+0];
+ let lhs = dep::wrapping_external_fn(*a);
+
+ // CHECK: call.uni (retval0),
+ // CHECK-NEXT: panicking_external_fn
+ // CHECK: ld.param.b32 %[[RHS:r[0-9]+]], [retval0+0];
+ let rhs = dep::panicking_external_fn(*a);
+
+ // CHECK: add.s32 %[[RES:r[0-9]+]], %[[RHS]], %[[LHS]];
+ // CHECK: st.global.u32 [%{{rd[0-9]+}}], %[[RES]];
+ *b = lhs + rhs;
+}
+
+// Verify that external function bodies are available.
+// CHECK: .func (.param .b32 func_retval0) wrapping_external_fn
+// CHECK: .func (.param .b32 func_retval0) panicking_external_fn
diff --git a/src/test/run-make/nvptx-emit-asm/kernel.rs b/src/test/assembly/nvptx-safe-naming.rs
similarity index 63%
rename from src/test/run-make/nvptx-emit-asm/kernel.rs
rename to src/test/assembly/nvptx-safe-naming.rs
index b71e18d..ab6f914 100644
--- a/src/test/run-make/nvptx-emit-asm/kernel.rs
+++ b/src/test/assembly/nvptx-safe-naming.rs
@@ -1,13 +1,15 @@
-#![no_std]
-#![deny(warnings)]
-#![feature(abi_ptx)]
+// assembly-output: ptx-linker
+// compile-flags: --crate-type cdylib
+// only-nvptx64
-// Verify the default CUDA arch.
-// CHECK: .target sm_30
-// CHECK: .address_size 64
+#![feature(abi_ptx)]
+#![no_std]
+
+// aux-build: breakpoint-panic-handler.rs
+extern crate breakpoint_panic_handler;
// Verify function name doesn't contain unacceaptable characters.
-// CHECK: .func (.param .b32 func_retval0) [[IMPL_FN:_ZN[a-zA-Z0-9$_]+square[a-zA-Z0-9$_]+]]
+// CHECK: .func (.param .b32 func_retval0) [[IMPL_FN:[a-zA-Z0-9$_]+square[a-zA-Z0-9$_]+]](
// CHECK-LABEL: .visible .entry top_kernel(
#[no_mangle]
@@ -33,9 +35,3 @@
}
}
}
-
-// Verify that external function bodies are available.
-// CHECK: .func (.param .b32 func_retval0) [[IMPL_FN]]
-// CHECK: {
-// CHECK: mul.lo.s32 %{{r[0-9]+}}, %{{r[0-9]+}}, %{{r[0-9]+}}
-// CHECK: }
diff --git a/src/test/mir-opt/basic_assignment.rs b/src/test/mir-opt/basic_assignment.rs
index 3ce43cc..c771013 100644
--- a/src/test/mir-opt/basic_assignment.rs
+++ b/src/test/mir-opt/basic_assignment.rs
@@ -48,7 +48,7 @@
// drop(_6) -> [return: bb6, unwind: bb4];
// }
// ...
-// bb5: {
+// bb5 (cleanup): {
// drop(_6) -> bb4;
// }
// END rustc.main.SimplifyCfg-initial.after.mir
diff --git a/src/test/mir-opt/box_expr.rs b/src/test/mir-opt/box_expr.rs
index ad5cf42..14d302f 100644
--- a/src/test/mir-opt/box_expr.rs
+++ b/src/test/mir-opt/box_expr.rs
@@ -38,7 +38,7 @@
// (*_2) = const S::new() -> [return: bb2, unwind: bb3];
// }
//
-// bb1: {
+// bb1 (cleanup): {
// resume;
// }
//
@@ -47,7 +47,7 @@
// drop(_2) -> bb4;
// }
//
-// bb3: {
+// bb3 (cleanup): {
// drop(_2) -> bb1;
// }
//
@@ -62,11 +62,11 @@
// drop(_4) -> [return: bb8, unwind: bb6];
// }
//
-// bb6: {
+// bb6 (cleanup): {
// drop(_1) -> bb1;
// }
//
-// bb7: {
+// bb7 (cleanup): {
// drop(_4) -> bb6;
// }
//
diff --git a/src/test/mir-opt/generator-drop-cleanup.rs b/src/test/mir-opt/generator-drop-cleanup.rs
new file mode 100644
index 0000000..48398691
--- /dev/null
+++ b/src/test/mir-opt/generator-drop-cleanup.rs
@@ -0,0 +1,43 @@
+#![feature(generators, generator_trait)]
+
+// Regression test for #58892, generator drop shims should not have blocks
+// spuriously marked as cleanup
+
+fn main() {
+ let gen = || {
+ yield;
+ };
+}
+
+// END RUST SOURCE
+
+// START rustc.main-{{closure}}.generator_drop.0.mir
+// bb0: {
+// switchInt(((*_1).0: u32)) -> [0u32: bb4, 3u32: bb7, otherwise: bb8];
+// }
+// bb1: {
+// goto -> bb5;
+// }
+// bb2: {
+// return;
+// }
+// bb3: {
+// return;
+// }
+// bb4: {
+// goto -> bb6;
+// }
+// bb5: {
+// goto -> bb2;
+// }
+// bb6: {
+// goto -> bb3;
+// }
+// bb7: {
+// StorageLive(_3);
+// goto -> bb1;
+// }
+// bb8: {
+// return;
+// }
+// END rustc.main-{{closure}}.generator_drop.0.mir
diff --git a/src/test/mir-opt/issue-38669.rs b/src/test/mir-opt/issue-38669.rs
index 618ee2f..047e623 100644
--- a/src/test/mir-opt/issue-38669.rs
+++ b/src/test/mir-opt/issue-38669.rs
@@ -18,7 +18,7 @@
// FakeRead(ForLet, _1);
// goto -> bb2;
// }
-// bb1: {
+// bb1 (cleanup): {
// resume;
// }
// bb2: {
diff --git a/src/test/mir-opt/issue-49232.rs b/src/test/mir-opt/issue-49232.rs
index 0f0401a..5f4f4ab 100644
--- a/src/test/mir-opt/issue-49232.rs
+++ b/src/test/mir-opt/issue-49232.rs
@@ -43,7 +43,7 @@
// FakeRead(ForMatchedPlace, _3);
// switchInt(_3) -> [false: bb9, otherwise: bb8];
// }
-// bb4: {
+// bb4 (cleanup): {
// resume;
// }
// bb5: {
diff --git a/src/test/mir-opt/loop_test.rs b/src/test/mir-opt/loop_test.rs
index e44743a..34891ee 100644
--- a/src/test/mir-opt/loop_test.rs
+++ b/src/test/mir-opt/loop_test.rs
@@ -18,7 +18,7 @@
// END RUST SOURCE
// START rustc.main.SimplifyCfg-qualify-consts.after.mir
// ...
-// bb1: { // The cleanup block
+// bb1 (cleanup): {
// resume;
// }
// ...
diff --git a/src/test/mir-opt/match_false_edges.rs b/src/test/mir-opt/match_false_edges.rs
index 9eeef85..0cbf048 100644
--- a/src/test/mir-opt/match_false_edges.rs
+++ b/src/test/mir-opt/match_false_edges.rs
@@ -47,7 +47,7 @@
// _3 = discriminant(_2);
// switchInt(move _3) -> [0isize: bb4, 1isize: bb2, otherwise: bb7];
// }
-// bb1: {
+// bb1 (cleanup): {
// resume;
// }
// bb2: {
@@ -116,7 +116,7 @@
// _3 = discriminant(_2);
// switchInt(move _3) -> [0isize: bb3, 1isize: bb2, otherwise: bb7];
// }
-// bb1: {
+// bb1 (cleanup): {
// resume;
// }
// bb2: {
@@ -185,7 +185,7 @@
// _3 = discriminant(_2);
// switchInt(move _3) -> [1isize: bb2, otherwise: bb3];
// }
-// bb1: {
+// bb1 (cleanup): {
// resume;
// }
// bb2: {
diff --git a/src/test/mir-opt/packed-struct-drop-aligned.rs b/src/test/mir-opt/packed-struct-drop-aligned.rs
index 01402f2..167a6eb 100644
--- a/src/test/mir-opt/packed-struct-drop-aligned.rs
+++ b/src/test/mir-opt/packed-struct-drop-aligned.rs
@@ -38,14 +38,14 @@
// _6 = move (_1.0: Aligned);
// drop(_6) -> [return: bb4, unwind: bb3];
// }
-// bb1: {
+// bb1 (cleanup): {
// resume;
// }
// bb2: {
// StorageDead(_1);
// return;
// }
-// bb3: {
+// bb3 (cleanup): {
// (_1.0: Aligned) = move _4;
// drop(_1) -> bb1;
// }
diff --git a/src/test/mir-opt/remove_fake_borrows.rs b/src/test/mir-opt/remove_fake_borrows.rs
index 48d1c99..1443484 100644
--- a/src/test/mir-opt/remove_fake_borrows.rs
+++ b/src/test/mir-opt/remove_fake_borrows.rs
@@ -63,7 +63,7 @@
// StorageDead(_8);
// return;
// }
-// bb10: {
+// bb10 (cleanup): {
// resume;
// }
// END rustc.match_guard.CleanupNonCodegenStatements.before.mir
@@ -114,7 +114,7 @@
// StorageDead(_8);
// return;
// }
-// bb10: {
+// bb10 (cleanup): {
// resume;
// }
// END rustc.match_guard.CleanupNonCodegenStatements.after.mir
diff --git a/src/test/mir-opt/unusual-item-types.rs b/src/test/mir-opt/unusual-item-types.rs
index ced3038..ef41373 100644
--- a/src/test/mir-opt/unusual-item-types.rs
+++ b/src/test/mir-opt/unusual-item-types.rs
@@ -29,7 +29,7 @@
// _0 = const 2i32;
// return;
// }
-// bb1: {
+// bb1 (cleanup): {
// resume;
// }
// END rustc.{{impl}}-ASSOCIATED_CONSTANT.mir_map.0.mir
@@ -39,7 +39,7 @@
// _0 = const 5isize;
// return;
// }
-// bb1: {
+// bb1 (cleanup): {
// resume;
// }
// END rustc.E-V-{{constant}}.mir_map.0.mir
@@ -51,16 +51,16 @@
// bb1: {
// return;
// }
-// bb2: {
+// bb2 (cleanup): {
// resume;
// }
// bb3: {
// goto -> bb1;
// }
-// bb4: {
+// bb4 (cleanup): {
// goto -> bb2;
// }
-// bb5: {
+// bb5 (cleanup): {
// drop(((*_1).0: alloc::raw_vec::RawVec<i32>)) -> bb4;
// }
// bb6: {
diff --git a/src/test/run-fail/generator-resume-after-panic.rs b/src/test/run-fail/generator-resume-after-panic.rs
new file mode 100644
index 0000000..910b490
--- /dev/null
+++ b/src/test/run-fail/generator-resume-after-panic.rs
@@ -0,0 +1,22 @@
+// error-pattern:generator resumed after panicking
+
+// Test that we get the correct message for resuming a panicked generator.
+
+#![feature(generators, generator_trait)]
+
+use std::{
+ ops::Generator,
+ pin::Pin,
+ panic,
+};
+
+fn main() {
+ let mut g = || {
+ panic!();
+ yield;
+ };
+ panic::catch_unwind(panic::AssertUnwindSafe(|| {
+ let x = Pin::new(&mut g).resume();
+ }));
+ Pin::new(&mut g).resume();
+}
diff --git a/src/test/run-make-fulldeps/redundant-libs/Makefile b/src/test/run-make-fulldeps/redundant-libs/Makefile
new file mode 100644
index 0000000..9486e07
--- /dev/null
+++ b/src/test/run-make-fulldeps/redundant-libs/Makefile
@@ -0,0 +1,27 @@
+-include ../tools.mk
+
+ifdef IS_WINDOWS
+all:
+else
+
+# rustc will remove one of the two redundant references to foo below. Depending
+# on which one gets removed, we'll get a linker error on SOME platforms (like
+# Linux). On these platforms, when a library is referenced, the linker will
+# only pull in the symbols needed _at that point in time_. If a later library
+# depends on additional symbols from the library, they will not have been pulled
+# in, and you'll get undefined symbols errors.
+#
+# So in this example, we need to ensure that rustc keeps the _later_ reference
+# to foo, and not the former one.
+RUSTC_FLAGS = \
+ -l static=bar \
+ -l foo \
+ -l static=baz \
+ -l foo \
+ -Z print-link-args
+
+all: $(call DYLIB,foo) $(call STATICLIB,bar) $(call STATICLIB,baz)
+ $(RUSTC) $(RUSTC_FLAGS) main.rs
+ $(call RUN,main)
+
+endif
diff --git a/src/test/run-make-fulldeps/redundant-libs/bar.c b/src/test/run-make-fulldeps/redundant-libs/bar.c
new file mode 100644
index 0000000..e425999
--- /dev/null
+++ b/src/test/run-make-fulldeps/redundant-libs/bar.c
@@ -0,0 +1 @@
+void bar() {}
diff --git a/src/test/run-make-fulldeps/redundant-libs/baz.c b/src/test/run-make-fulldeps/redundant-libs/baz.c
new file mode 100644
index 0000000..a4e2c2b
--- /dev/null
+++ b/src/test/run-make-fulldeps/redundant-libs/baz.c
@@ -0,0 +1,7 @@
+extern void foo1();
+extern void foo2();
+
+void baz() {
+ foo1();
+ foo2();
+}
diff --git a/src/test/run-make-fulldeps/redundant-libs/foo.c b/src/test/run-make-fulldeps/redundant-libs/foo.c
new file mode 100644
index 0000000..339ee86
--- /dev/null
+++ b/src/test/run-make-fulldeps/redundant-libs/foo.c
@@ -0,0 +1,2 @@
+void foo1() {}
+void foo2() {}
diff --git a/src/test/run-make-fulldeps/redundant-libs/main.rs b/src/test/run-make-fulldeps/redundant-libs/main.rs
new file mode 100644
index 0000000..90d185f
--- /dev/null
+++ b/src/test/run-make-fulldeps/redundant-libs/main.rs
@@ -0,0 +1,11 @@
+extern "C" {
+ fn bar();
+ fn baz();
+}
+
+fn main() {
+ unsafe {
+ bar();
+ baz();
+ }
+}
diff --git a/src/test/run-make/nvptx-binary-crate/Makefile b/src/test/run-make/nvptx-binary-crate/Makefile
deleted file mode 100644
index 2c211b5..0000000
--- a/src/test/run-make/nvptx-binary-crate/Makefile
+++ /dev/null
@@ -1,12 +0,0 @@
--include ../../run-make-fulldeps/tools.mk
-
-ifeq ($(TARGET),nvptx64-nvidia-cuda)
-all:
- $(RUSTC) main.rs --crate-type="bin" --target $(TARGET) -O -C link-arg=--arch=sm_60 -o $(TMPDIR)/main.link_arg.ptx
- $(RUSTC) main.rs --crate-type="bin" --target $(TARGET) -O -C target-cpu=sm_60 -o $(TMPDIR)/main.target_cpu.ptx
-
- FileCheck main.rs --input-file $(TMPDIR)/main.link_arg.ptx
- FileCheck main.rs --input-file $(TMPDIR)/main.target_cpu.ptx
-else
-all:
-endif
diff --git a/src/test/run-make/nvptx-binary-crate/main.rs b/src/test/run-make/nvptx-binary-crate/main.rs
deleted file mode 100644
index 826bc3a..0000000
--- a/src/test/run-make/nvptx-binary-crate/main.rs
+++ /dev/null
@@ -1,28 +0,0 @@
-#![no_std]
-#![no_main]
-#![deny(warnings)]
-#![feature(abi_ptx, core_intrinsics)]
-
-// Check the overriden CUDA arch.
-// CHECK: .target sm_60
-// CHECK: .address_size 64
-
-// Verify that no extra function declarations are present.
-// CHECK-NOT: .func
-
-// CHECK-LABEL: .visible .entry top_kernel(
-#[no_mangle]
-pub unsafe extern "ptx-kernel" fn top_kernel(a: *const u32, b: *mut u32) {
- // CHECK: add.s32 %{{r[0-9]+}}, %{{r[0-9]+}}, 5;
- *b = *a + 5;
-}
-
-// Verify that no extra function definitions are there.
-// CHECK-NOT: .func
-// CHECK-NOT: .entry
-
-#[panic_handler]
-unsafe fn breakpoint_panic_handler(_: &::core::panic::PanicInfo) -> ! {
- core::intrinsics::breakpoint();
- core::hint::unreachable_unchecked();
-}
diff --git a/src/test/run-make/nvptx-dylib-crate/Makefile b/src/test/run-make/nvptx-dylib-crate/Makefile
deleted file mode 100644
index 7284e9d..0000000
--- a/src/test/run-make/nvptx-dylib-crate/Makefile
+++ /dev/null
@@ -1,10 +0,0 @@
--include ../../run-make-fulldeps/tools.mk
-
-ifeq ($(TARGET),nvptx64-nvidia-cuda)
-all:
- $(RUSTC) dep.rs --crate-type="rlib" --target $(TARGET)
- $(RUSTC) kernel.rs --crate-type="cdylib" -O --target $(TARGET)
- FileCheck kernel.rs --input-file $(TMPDIR)/kernel.ptx
-else
-all:
-endif
diff --git a/src/test/run-make/nvptx-dylib-crate/kernel.rs b/src/test/run-make/nvptx-dylib-crate/kernel.rs
deleted file mode 100644
index 63fd6b0..0000000
--- a/src/test/run-make/nvptx-dylib-crate/kernel.rs
+++ /dev/null
@@ -1,59 +0,0 @@
-#![no_std]
-#![deny(warnings)]
-#![feature(abi_ptx, core_intrinsics)]
-
-extern crate dep;
-
-// Verify the default CUDA arch.
-// CHECK: .target sm_30
-// CHECK: .address_size 64
-
-// Make sure declarations are there.
-// CHECK: .func (.param .b32 func_retval0) wrapping_external_fn
-// CHECK: .func (.param .b32 func_retval0) panicking_external_fn
-// CHECK: .func [[PANIC_HANDLER:_ZN4core9panicking5panic[a-zA-Z0-9]+]]
-
-// CHECK-LABEL: .visible .entry top_kernel(
-#[no_mangle]
-pub unsafe extern "ptx-kernel" fn top_kernel(a: *const u32, b: *mut u32) {
- // CHECK: call.uni (retval0),
- // CHECK-NEXT: wrapping_external_fn
- // CHECK: ld.param.b32 %[[LHS:r[0-9]+]], [retval0+0];
- let lhs = dep::wrapping_external_fn(*a);
-
- // CHECK: call.uni (retval0),
- // CHECK-NEXT: panicking_external_fn
- // CHECK: ld.param.b32 %[[RHS:r[0-9]+]], [retval0+0];
- let rhs = dep::panicking_external_fn(*a);
-
- // CHECK: add.s32 %[[RES:r[0-9]+]], %[[RHS]], %[[LHS]];
- // CHECK: st.global.u32 [%{{rd[0-9]+}}], %[[RES]];
- *b = lhs + rhs;
-}
-
-// Verify that external function bodies are available.
-// CHECK-LABEL: .func (.param .b32 func_retval0) wrapping_external_fn
-// CHECK: {
-// CHECK: st.param.b32 [func_retval0+0], %{{r[0-9]+}};
-// CHECK: }
-
-// Also verify panic behavior.
-// CHECK-LABEL: .func (.param .b32 func_retval0) panicking_external_fn
-// CHECK: {
-// CHECK: %{{p[0-9]+}} bra [[PANIC_LABEL:[a-zA-Z0-9_]+]];
-// CHECK: [[PANIC_LABEL]]:
-// CHECK: call.uni
-// CHECK: [[PANIC_HANDLER]]
-// CHECK: }
-
-// Verify whether out dummy panic formatter has a correct body.
-// CHECK: .func [[PANIC_FMT:_ZN4core9panicking9panic_fmt[a-zA-Z0-9]+]]()
-// CHECK: {
-// CHECK: trap;
-// CHECK: }
-
-#[panic_handler]
-unsafe fn breakpoint_panic_handler(_: &::core::panic::PanicInfo) -> ! {
- core::intrinsics::breakpoint();
- core::hint::unreachable_unchecked();
-}
diff --git a/src/test/run-make/nvptx-emit-asm/Makefile b/src/test/run-make/nvptx-emit-asm/Makefile
deleted file mode 100644
index e036018..0000000
--- a/src/test/run-make/nvptx-emit-asm/Makefile
+++ /dev/null
@@ -1,9 +0,0 @@
--include ../../run-make-fulldeps/tools.mk
-
-ifeq ($(TARGET),nvptx64-nvidia-cuda)
-all:
- $(RUSTC) kernel.rs --crate-type="rlib" --emit asm,llvm-ir -O --target $(TARGET)
- FileCheck kernel.rs --input-file $(TMPDIR)/kernel.s
-else
-all:
-endif
diff --git a/src/test/rustdoc/default_trait_method.rs b/src/test/rustdoc/default_trait_method.rs
new file mode 100644
index 0000000..dfbd8f2
--- /dev/null
+++ b/src/test/rustdoc/default_trait_method.rs
@@ -0,0 +1,15 @@
+#![feature(specialization)]
+
+pub trait Item {
+ fn foo();
+ fn bar();
+}
+
+// @has default_trait_method/trait.Item.html
+// @has - '//*[@id="method.foo"]' 'default fn foo()'
+// @has - '//*[@id="method.bar"]' 'fn bar()'
+// @!has - '//*[@id="method.bar"]' 'default fn bar()'
+impl<T: ?Sized> Item for T {
+ default fn foo() {}
+ fn bar() {}
+}
diff --git a/src/test/ui/confuse-field-and-method/issue-18343.stderr b/src/test/ui/confuse-field-and-method/issue-18343.stderr
index 36112cd..03f9d99 100644
--- a/src/test/ui/confuse-field-and-method/issue-18343.stderr
+++ b/src/test/ui/confuse-field-and-method/issue-18343.stderr
@@ -6,8 +6,10 @@
...
LL | o.closure();
| ^^^^^^^ field, not a method
+help: to call the function stored in `closure`, surround the field access with parentheses
|
- = help: use `(o.closure)(...)` if you meant to call the function stored in the `closure` field
+LL | (o.closure)();
+ | ^ ^
error: aborting due to previous error
diff --git a/src/test/ui/confuse-field-and-method/issue-2392.stderr b/src/test/ui/confuse-field-and-method/issue-2392.stderr
index 456a4c1..2107318 100644
--- a/src/test/ui/confuse-field-and-method/issue-2392.stderr
+++ b/src/test/ui/confuse-field-and-method/issue-2392.stderr
@@ -6,8 +6,10 @@
...
LL | o_closure.closure();
| ^^^^^^^ field, not a method
+help: to call the function stored in `closure`, surround the field access with parentheses
|
- = help: use `(o_closure.closure)(...)` if you meant to call the function stored in the `closure` field
+LL | (o_closure.closure)();
+ | ^ ^
error[E0599]: no method named `not_closure` found for type `Obj<[closure@$DIR/issue-2392.rs:39:36: 39:41]>` in the current scope
--> $DIR/issue-2392.rs:42:15
@@ -16,9 +18,9 @@
| -------------------------------------- method `not_closure` not found for this
...
LL | o_closure.not_closure();
- | ^^^^^^^^^^^ field, not a method
- |
- = help: did you mean to write `o_closure.not_closure` instead of `o_closure.not_closure(...)`?
+ | ^^^^^^^^^^^-- help: remove the arguments
+ | |
+ | field, not a method
error[E0599]: no method named `closure` found for type `Obj<fn() -> u32 {func}>` in the current scope
--> $DIR/issue-2392.rs:46:12
@@ -28,8 +30,10 @@
...
LL | o_func.closure();
| ^^^^^^^ field, not a method
+help: to call the function stored in `closure`, surround the field access with parentheses
|
- = help: use `(o_func.closure)(...)` if you meant to call the function stored in the `closure` field
+LL | (o_func.closure)();
+ | ^ ^
error[E0599]: no method named `boxed_closure` found for type `BoxedObj` in the current scope
--> $DIR/issue-2392.rs:49:14
@@ -39,8 +43,10 @@
...
LL | boxed_fn.boxed_closure();
| ^^^^^^^^^^^^^ field, not a method
+help: to call the function stored in `boxed_closure`, surround the field access with parentheses
|
- = help: use `(boxed_fn.boxed_closure)(...)` if you meant to call the function stored in the `boxed_closure` field
+LL | (boxed_fn.boxed_closure)();
+ | ^ ^
error[E0599]: no method named `boxed_closure` found for type `BoxedObj` in the current scope
--> $DIR/issue-2392.rs:52:19
@@ -50,8 +56,10 @@
...
LL | boxed_closure.boxed_closure();
| ^^^^^^^^^^^^^ field, not a method
+help: to call the function stored in `boxed_closure`, surround the field access with parentheses
|
- = help: use `(boxed_closure.boxed_closure)(...)` if you meant to call the function stored in the `boxed_closure` field
+LL | (boxed_closure.boxed_closure)();
+ | ^ ^
error[E0599]: no method named `closure` found for type `Obj<fn() -> u32 {func}>` in the current scope
--> $DIR/issue-2392.rs:57:12
@@ -61,8 +69,10 @@
...
LL | w.wrap.closure();
| ^^^^^^^ field, not a method
+help: to call the function stored in `closure`, surround the field access with parentheses
|
- = help: use `(w.wrap.closure)(...)` if you meant to call the function stored in the `closure` field
+LL | (w.wrap.closure)();
+ | ^ ^
error[E0599]: no method named `not_closure` found for type `Obj<fn() -> u32 {func}>` in the current scope
--> $DIR/issue-2392.rs:59:12
@@ -71,9 +81,9 @@
| -------------------------------------- method `not_closure` not found for this
...
LL | w.wrap.not_closure();
- | ^^^^^^^^^^^ field, not a method
- |
- = help: did you mean to write `w.wrap.not_closure` instead of `w.wrap.not_closure(...)`?
+ | ^^^^^^^^^^^-- help: remove the arguments
+ | |
+ | field, not a method
error[E0599]: no method named `closure` found for type `Obj<std::boxed::Box<(dyn std::boxed::FnBox<(), Output = u32> + 'static)>>` in the current scope
--> $DIR/issue-2392.rs:62:24
@@ -83,8 +93,10 @@
...
LL | check_expression().closure();
| ^^^^^^^ field, not a method
+help: to call the function stored in `closure`, surround the field access with parentheses
|
- = help: use `(check_expression().closure)(...)` if you meant to call the function stored in the `closure` field
+LL | (check_expression().closure)();
+ | ^ ^
error[E0599]: no method named `f1` found for type `FuncContainer` in the current scope
--> $DIR/issue-2392.rs:68:31
@@ -94,8 +106,10 @@
...
LL | (*self.container).f1(1);
| ^^ field, not a method
+help: to call the function stored in `f1`, surround the field access with parentheses
|
- = help: use `((*self.container).f1)(...)` if you meant to call the function stored in the `f1` field
+LL | ((*self.container).f1)(1);
+ | ^ ^
error[E0599]: no method named `f2` found for type `FuncContainer` in the current scope
--> $DIR/issue-2392.rs:69:31
@@ -105,8 +119,10 @@
...
LL | (*self.container).f2(1);
| ^^ field, not a method
+help: to call the function stored in `f2`, surround the field access with parentheses
|
- = help: use `((*self.container).f2)(...)` if you meant to call the function stored in the `f2` field
+LL | ((*self.container).f2)(1);
+ | ^ ^
error[E0599]: no method named `f3` found for type `FuncContainer` in the current scope
--> $DIR/issue-2392.rs:70:31
@@ -116,8 +132,10 @@
...
LL | (*self.container).f3(1);
| ^^ field, not a method
+help: to call the function stored in `f3`, surround the field access with parentheses
|
- = help: use `((*self.container).f3)(...)` if you meant to call the function stored in the `f3` field
+LL | ((*self.container).f3)(1);
+ | ^ ^
error: aborting due to 11 previous errors
diff --git a/src/test/ui/confuse-field-and-method/issue-32128.stderr b/src/test/ui/confuse-field-and-method/issue-32128.stderr
index 902f606..fbabb3a 100644
--- a/src/test/ui/confuse-field-and-method/issue-32128.stderr
+++ b/src/test/ui/confuse-field-and-method/issue-32128.stderr
@@ -6,8 +6,10 @@
...
LL | demo.example(1);
| ^^^^^^^ field, not a method
+help: to call the function stored in `example`, surround the field access with parentheses
|
- = help: use `(demo.example)(...)` if you meant to call the function stored in the `example` field
+LL | (demo.example)(1);
+ | ^ ^
error: aborting due to previous error
diff --git a/src/test/ui/confuse-field-and-method/issue-33784.stderr b/src/test/ui/confuse-field-and-method/issue-33784.stderr
index cce961f..60f1a93 100644
--- a/src/test/ui/confuse-field-and-method/issue-33784.stderr
+++ b/src/test/ui/confuse-field-and-method/issue-33784.stderr
@@ -3,24 +3,30 @@
|
LL | p.closure();
| ^^^^^^^ field, not a method
+help: to call the function stored in `closure`, surround the field access with parentheses
|
- = help: use `(p.closure)(...)` if you meant to call the function stored in the `closure` field
+LL | (p.closure)();
+ | ^ ^
error[E0599]: no method named `fn_ptr` found for type `&&Obj<[closure@$DIR/issue-33784.rs:25:43: 25:48]>` in the current scope
--> $DIR/issue-33784.rs:29:7
|
LL | q.fn_ptr();
| ^^^^^^ field, not a method
+help: to call the function stored in `fn_ptr`, surround the field access with parentheses
|
- = help: use `(q.fn_ptr)(...)` if you meant to call the function stored in the `fn_ptr` field
+LL | (q.fn_ptr)();
+ | ^ ^
error[E0599]: no method named `c_fn_ptr` found for type `&D` in the current scope
--> $DIR/issue-33784.rs:32:7
|
LL | s.c_fn_ptr();
| ^^^^^^^^ field, not a method
+help: to call the function stored in `c_fn_ptr`, surround the field access with parentheses
|
- = help: use `(s.c_fn_ptr)(...)` if you meant to call the function stored in the `c_fn_ptr` field
+LL | (s.c_fn_ptr)();
+ | ^ ^
error: aborting due to 3 previous errors
diff --git a/src/test/ui/if/if-without-else-as-fn-expr.rs b/src/test/ui/if/if-without-else-as-fn-expr.rs
new file mode 100644
index 0000000..67e4445
--- /dev/null
+++ b/src/test/ui/if/if-without-else-as-fn-expr.rs
@@ -0,0 +1,25 @@
+fn foo(bar: usize) -> usize {
+ if bar % 5 == 0 {
+ return 3;
+ }
+ //~^^^ ERROR if may be missing an else clause
+}
+
+fn foo2(bar: usize) -> usize {
+ let x: usize = if bar % 5 == 0 {
+ return 3;
+ };
+ //~^^^ ERROR if may be missing an else clause
+ x
+}
+
+fn foo3(bar: usize) -> usize {
+ if bar % 5 == 0 {
+ 3
+ }
+ //~^^^ ERROR if may be missing an else clause
+}
+
+fn main() {
+ let _ = foo(1);
+}
diff --git a/src/test/ui/if/if-without-else-as-fn-expr.stderr b/src/test/ui/if/if-without-else-as-fn-expr.stderr
new file mode 100644
index 0000000..0ba7272
--- /dev/null
+++ b/src/test/ui/if/if-without-else-as-fn-expr.stderr
@@ -0,0 +1,49 @@
+error[E0317]: if may be missing an else clause
+ --> $DIR/if-without-else-as-fn-expr.rs:2:5
+ |
+LL | fn foo(bar: usize) -> usize {
+ | ----- expected `usize` because of this return type
+LL | / if bar % 5 == 0 {
+LL | | return 3;
+LL | | }
+ | |_____^ expected usize, found ()
+ |
+ = note: expected type `usize`
+ found type `()`
+ = note: `if` expressions without `else` evaluate to `()`
+ = help: consider adding an `else` block that evaluates to the expected type
+
+error[E0317]: if may be missing an else clause
+ --> $DIR/if-without-else-as-fn-expr.rs:9:20
+ |
+LL | let x: usize = if bar % 5 == 0 {
+ | _________-__________^
+ | | |
+ | | expected because of this assignment
+LL | | return 3;
+LL | | };
+ | |_____^ expected usize, found ()
+ |
+ = note: expected type `usize`
+ found type `()`
+ = note: `if` expressions without `else` evaluate to `()`
+ = help: consider adding an `else` block that evaluates to the expected type
+
+error[E0317]: if may be missing an else clause
+ --> $DIR/if-without-else-as-fn-expr.rs:17:5
+ |
+LL | fn foo3(bar: usize) -> usize {
+ | ----- expected `usize` because of this return type
+LL | / if bar % 5 == 0 {
+LL | | 3
+LL | | }
+ | |_____^ expected usize, found ()
+ |
+ = note: expected type `usize`
+ found type `()`
+ = note: `if` expressions without `else` evaluate to `()`
+ = help: consider adding an `else` block that evaluates to the expected type
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0317`.
diff --git a/src/test/ui/if/if-without-else-result.stderr b/src/test/ui/if/if-without-else-result.stderr
index 2134781..ddb013a 100644
--- a/src/test/ui/if/if-without-else-result.stderr
+++ b/src/test/ui/if/if-without-else-result.stderr
@@ -2,10 +2,15 @@
--> $DIR/if-without-else-result.rs:2:13
|
LL | let a = if true { true };
- | ^^^^^^^^^^^^^^^^ expected (), found bool
+ | ^^^^^^^^^^----^^
+ | | |
+ | | found here
+ | expected (), found bool
|
= note: expected type `()`
found type `bool`
+ = note: `if` expressions without `else` evaluate to `()`
+ = help: consider adding an `else` block that evaluates to the expected type
error: aborting due to previous error
diff --git a/src/test/ui/issues/issue-21950.stderr b/src/test/ui/issues/issue-21950.stderr
index 5f401d1..bda2e3c 100644
--- a/src/test/ui/issues/issue-21950.stderr
+++ b/src/test/ui/issues/issue-21950.stderr
@@ -1,8 +1,8 @@
-error[E0393]: the type parameter `RHS` must be explicitly specified
+error[E0393]: the type parameter `Rhs` must be explicitly specified
--> $DIR/issue-21950.rs:7:14
|
LL | &Add;
- | ^^^ missing reference to `RHS`
+ | ^^^ missing reference to `Rhs`
|
= note: because of the default `Self` reference, type parameters must be specified on object types
diff --git a/src/test/ui/issues/issue-22560.stderr b/src/test/ui/issues/issue-22560.stderr
index be4f3dd..694a4af 100644
--- a/src/test/ui/issues/issue-22560.stderr
+++ b/src/test/ui/issues/issue-22560.stderr
@@ -1,16 +1,16 @@
-error[E0393]: the type parameter `RHS` must be explicitly specified
+error[E0393]: the type parameter `Rhs` must be explicitly specified
--> $DIR/issue-22560.rs:5:13
|
LL | type Test = Add +
- | ^^^ missing reference to `RHS`
+ | ^^^ missing reference to `Rhs`
|
= note: because of the default `Self` reference, type parameters must be specified on object types
-error[E0393]: the type parameter `RHS` must be explicitly specified
+error[E0393]: the type parameter `Rhs` must be explicitly specified
--> $DIR/issue-22560.rs:8:13
|
LL | Sub;
- | ^^^ missing reference to `RHS`
+ | ^^^ missing reference to `Rhs`
|
= note: because of the default `Self` reference, type parameters must be specified on object types
diff --git a/src/test/ui/issues/issue-28433.rs b/src/test/ui/issues/issue-28433.rs
index a87ac63..2bbb32b 100644
--- a/src/test/ui/issues/issue-28433.rs
+++ b/src/test/ui/issues/issue-28433.rs
@@ -1,13 +1,14 @@
// compile-flags: -Z continue-parse-after-error
-enum bird {
- pub duck,
- //~^ ERROR: expected identifier, found keyword `pub`
- //~| ERROR: expected
- goose
+enum Bird {
+ pub Duck,
+ //~^ ERROR unnecessary visibility qualifier
+ Goose,
+ pub(crate) Dove
+ //~^ ERROR unnecessary visibility qualifier
}
fn main() {
- let y = bird::goose;
+ let y = Bird::Goose;
}
diff --git a/src/test/ui/issues/issue-28433.stderr b/src/test/ui/issues/issue-28433.stderr
index d3cba3a..cfdbf6c 100644
--- a/src/test/ui/issues/issue-28433.stderr
+++ b/src/test/ui/issues/issue-28433.stderr
@@ -1,18 +1,14 @@
-error: expected identifier, found keyword `pub`
+error: unnecessary visibility qualifier
--> $DIR/issue-28433.rs:4:5
|
-LL | pub duck,
- | ^^^ expected identifier, found keyword
-help: you can escape reserved keywords to use them as identifiers
- |
-LL | r#pub duck,
- | ^^^^^
+LL | pub Duck,
+ | ^^^ `pub` not permitted here
-error: expected one of `(`, `,`, `=`, `{`, or `}`, found `duck`
- --> $DIR/issue-28433.rs:4:9
+error: unnecessary visibility qualifier
+ --> $DIR/issue-28433.rs:7:5
|
-LL | pub duck,
- | ^^^^ expected one of `(`, `,`, `=`, `{`, or `}` here
+LL | pub(crate) Dove
+ | ^^^^^^^^^^ `pub` not permitted here
error: aborting due to 2 previous errors
diff --git a/src/test/ui/issues/issue-4201.stderr b/src/test/ui/issues/issue-4201.stderr
index d436c92..dd76fae 100644
--- a/src/test/ui/issues/issue-4201.stderr
+++ b/src/test/ui/issues/issue-4201.stderr
@@ -8,11 +8,14 @@
LL | |
LL | |
LL | | 1
+ | | - found here
LL | | };
| |_____^ expected (), found integer
|
= note: expected type `()`
found type `{integer}`
+ = note: `if` expressions without `else` evaluate to `()`
+ = help: consider adding an `else` block that evaluates to the expected type
error: aborting due to previous error
diff --git a/src/test/ui/issues/issue-50577.stderr b/src/test/ui/issues/issue-50577.stderr
index f26f5a9..0c3ba2e 100644
--- a/src/test/ui/issues/issue-50577.stderr
+++ b/src/test/ui/issues/issue-50577.stderr
@@ -2,10 +2,15 @@
--> $DIR/issue-50577.rs:3:16
|
LL | Drop = assert_eq!(1, 1)
- | ^^^^^^^^^^^^^^^^ expected (), found isize
+ | ^^^^^^^^^^^^^^^^
+ | |
+ | expected (), found isize
+ | found here
|
= note: expected type `()`
found type `isize`
+ = note: `if` expressions without `else` evaluate to `()`
+ = help: consider adding an `else` block that evaluates to the expected type
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
error: aborting due to previous error
diff --git a/src/test/ui/parser/recover-enum.rs b/src/test/ui/parser/recover-enum.rs
index 204ad85..da42da8 100644
--- a/src/test/ui/parser/recover-enum.rs
+++ b/src/test/ui/parser/recover-enum.rs
@@ -3,7 +3,11 @@
fn main() {
enum Test {
Very
- Bad //~ ERROR found `Bad`
- Stuff
+ //~^ ERROR missing comma
+ Bad(usize)
+ //~^ ERROR missing comma
+ Stuff { a: usize }
+ //~^ ERROR missing comma
+ Here
}
}
diff --git a/src/test/ui/parser/recover-enum.stderr b/src/test/ui/parser/recover-enum.stderr
index 8c3448d..10b4aba 100644
--- a/src/test/ui/parser/recover-enum.stderr
+++ b/src/test/ui/parser/recover-enum.stderr
@@ -1,10 +1,20 @@
-error: expected one of `(`, `,`, `=`, `{`, or `}`, found `Bad`
- --> $DIR/recover-enum.rs:6:9
+error: missing comma
+ --> $DIR/recover-enum.rs:5:13
|
LL | Very
- | - expected one of `(`, `,`, `=`, `{`, or `}` here
-LL | Bad
- | ^^^ unexpected token
+ | ^ help: missing comma
-error: aborting due to previous error
+error: missing comma
+ --> $DIR/recover-enum.rs:7:19
+ |
+LL | Bad(usize)
+ | ^ help: missing comma
+
+error: missing comma
+ --> $DIR/recover-enum.rs:9:27
+ |
+LL | Stuff { a: usize }
+ | ^ help: missing comma
+
+error: aborting due to 3 previous errors
diff --git a/src/test/ui/parser/recovered-struct-variant.rs b/src/test/ui/parser/recovered-struct-variant.rs
new file mode 100644
index 0000000..5b195dc
--- /dev/null
+++ b/src/test/ui/parser/recovered-struct-variant.rs
@@ -0,0 +1,13 @@
+enum Foo {
+ A { a, b: usize }
+ //~^ ERROR expected `:`, found `,`
+}
+
+fn main() {
+ // no complaints about non-existing fields
+ let f = Foo::A { a:3, b: 4};
+ match f {
+ // no complaints about non-existing fields
+ Foo::A {a, b} => {}
+ }
+}
diff --git a/src/test/ui/parser/recovered-struct-variant.stderr b/src/test/ui/parser/recovered-struct-variant.stderr
new file mode 100644
index 0000000..51aaf8b
--- /dev/null
+++ b/src/test/ui/parser/recovered-struct-variant.stderr
@@ -0,0 +1,8 @@
+error: expected `:`, found `,`
+ --> $DIR/recovered-struct-variant.rs:2:10
+ |
+LL | A { a, b: usize }
+ | ^ expected `:`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/parser/trait-pub-assoc-const.rs b/src/test/ui/parser/trait-pub-assoc-const.rs
index 3ee2dc1..219ffa3 100644
--- a/src/test/ui/parser/trait-pub-assoc-const.rs
+++ b/src/test/ui/parser/trait-pub-assoc-const.rs
@@ -1,6 +1,6 @@
trait Foo {
pub const Foo: u32;
- //~^ ERROR expected one of `async`, `const`, `extern`, `fn`, `type`, `unsafe`, or `}`, found
+ //~^ ERROR unnecessary visibility qualifier
}
fn main() {}
diff --git a/src/test/ui/parser/trait-pub-assoc-const.stderr b/src/test/ui/parser/trait-pub-assoc-const.stderr
index 8fc9ae4..817692c 100644
--- a/src/test/ui/parser/trait-pub-assoc-const.stderr
+++ b/src/test/ui/parser/trait-pub-assoc-const.stderr
@@ -1,10 +1,8 @@
-error: expected one of `async`, `const`, `extern`, `fn`, `type`, `unsafe`, or `}`, found `pub`
+error: unnecessary visibility qualifier
--> $DIR/trait-pub-assoc-const.rs:2:5
|
-LL | trait Foo {
- | - expected one of 7 possible tokens here
LL | pub const Foo: u32;
- | ^^^ unexpected token
+ | ^^^ `pub` not permitted here
error: aborting due to previous error
diff --git a/src/test/ui/parser/trait-pub-assoc-ty.rs b/src/test/ui/parser/trait-pub-assoc-ty.rs
index 042addf..a78dfbd 100644
--- a/src/test/ui/parser/trait-pub-assoc-ty.rs
+++ b/src/test/ui/parser/trait-pub-assoc-ty.rs
@@ -1,6 +1,6 @@
trait Foo {
pub type Foo;
- //~^ ERROR expected one of `async`, `const`, `extern`, `fn`, `type`, `unsafe`, or `}`, found
+ //~^ ERROR unnecessary visibility qualifier
}
fn main() {}
diff --git a/src/test/ui/parser/trait-pub-assoc-ty.stderr b/src/test/ui/parser/trait-pub-assoc-ty.stderr
index b8eab4e..400be6a 100644
--- a/src/test/ui/parser/trait-pub-assoc-ty.stderr
+++ b/src/test/ui/parser/trait-pub-assoc-ty.stderr
@@ -1,10 +1,8 @@
-error: expected one of `async`, `const`, `extern`, `fn`, `type`, `unsafe`, or `}`, found `pub`
+error: unnecessary visibility qualifier
--> $DIR/trait-pub-assoc-ty.rs:2:5
|
-LL | trait Foo {
- | - expected one of 7 possible tokens here
LL | pub type Foo;
- | ^^^ unexpected token
+ | ^^^ `pub` not permitted here
error: aborting due to previous error
diff --git a/src/test/ui/parser/trait-pub-method.rs b/src/test/ui/parser/trait-pub-method.rs
index 9675182..1f6ee02 100644
--- a/src/test/ui/parser/trait-pub-method.rs
+++ b/src/test/ui/parser/trait-pub-method.rs
@@ -1,6 +1,6 @@
trait Foo {
pub fn foo();
- //~^ ERROR expected one of `async`, `const`, `extern`, `fn`, `type`, `unsafe`, or `}`, found
+ //~^ ERROR unnecessary visibility qualifier
}
fn main() {}
diff --git a/src/test/ui/parser/trait-pub-method.stderr b/src/test/ui/parser/trait-pub-method.stderr
index d4db961..b3617a4 100644
--- a/src/test/ui/parser/trait-pub-method.stderr
+++ b/src/test/ui/parser/trait-pub-method.stderr
@@ -1,10 +1,8 @@
-error: expected one of `async`, `const`, `extern`, `fn`, `type`, `unsafe`, or `}`, found `pub`
+error: unnecessary visibility qualifier
--> $DIR/trait-pub-method.rs:2:5
|
-LL | trait Foo {
- | - expected one of 7 possible tokens here
LL | pub fn foo();
- | ^^^ unexpected token
+ | ^^^ `pub` not permitted here
error: aborting due to previous error
diff --git a/src/test/ui/specialization/specialization-overlap-hygiene.rs b/src/test/ui/specialization/specialization-overlap-hygiene.rs
new file mode 100644
index 0000000..93e7c83
--- /dev/null
+++ b/src/test/ui/specialization/specialization-overlap-hygiene.rs
@@ -0,0 +1,23 @@
+#![feature(decl_macro)]
+
+struct X;
+
+macro_rules! define_f_legacy { () => {
+ fn f() {}
+}}
+macro define_g_modern() {
+ fn g() {}
+}
+
+impl X {
+ fn f() {} //~ ERROR duplicate definitions with name `f`
+ fn g() {} // OK
+}
+impl X {
+ define_f_legacy!();
+}
+impl X {
+ define_g_modern!();
+}
+
+fn main() {}
diff --git a/src/test/ui/specialization/specialization-overlap-hygiene.stderr b/src/test/ui/specialization/specialization-overlap-hygiene.stderr
new file mode 100644
index 0000000..6adf16d
--- /dev/null
+++ b/src/test/ui/specialization/specialization-overlap-hygiene.stderr
@@ -0,0 +1,12 @@
+error[E0592]: duplicate definitions with name `f`
+ --> $DIR/specialization-overlap-hygiene.rs:13:4
+ |
+LL | fn f() {}
+ | --------- other definition for `f`
+...
+LL | fn f() {}
+ | ^^^^^^^^^ duplicate definitions for `f`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0592`.
diff --git a/src/test/ui/suggestions/suggest-on-bare-closure-call.rs b/src/test/ui/suggestions/suggest-on-bare-closure-call.rs
new file mode 100644
index 0000000..355708c
--- /dev/null
+++ b/src/test/ui/suggestions/suggest-on-bare-closure-call.rs
@@ -0,0 +1,4 @@
+fn main() {
+ let _ = ||{}();
+ //~^ ERROR expected function, found `()`
+}
diff --git a/src/test/ui/suggestions/suggest-on-bare-closure-call.stderr b/src/test/ui/suggestions/suggest-on-bare-closure-call.stderr
new file mode 100644
index 0000000..17001e3
--- /dev/null
+++ b/src/test/ui/suggestions/suggest-on-bare-closure-call.stderr
@@ -0,0 +1,15 @@
+error[E0618]: expected function, found `()`
+ --> $DIR/suggest-on-bare-closure-call.rs:2:15
+ |
+LL | let _ = ||{}();
+ | ^^--
+ | |
+ | call expression requires function
+help: if you meant to create this closure and immediately call it, surround the closure with parenthesis
+ |
+LL | let _ = (||{})();
+ | ^ ^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0618`.
diff --git a/src/tools/build-manifest/src/main.rs b/src/tools/build-manifest/src/main.rs
index 058f2df..3c360a8 100644
--- a/src/tools/build-manifest/src/main.rs
+++ b/src/tools/build-manifest/src/main.rs
@@ -10,7 +10,7 @@
use std::path::{PathBuf, Path};
use std::process::{Command, Stdio};
-static HOSTS: &'static [&'static str] = &[
+static HOSTS: &[&str] = &[
"aarch64-unknown-linux-gnu",
"arm-unknown-linux-gnueabi",
"arm-unknown-linux-gnueabihf",
@@ -40,7 +40,7 @@
"x86_64-unknown-netbsd",
];
-static TARGETS: &'static [&'static str] = &[
+static TARGETS: &[&str] = &[
"aarch64-apple-ios",
"aarch64-fuchsia",
"aarch64-linux-android",
@@ -124,7 +124,7 @@
"x86_64-unknown-redox",
];
-static DOCS_TARGETS: &'static [&'static str] = &[
+static DOCS_TARGETS: &[&str] = &[
"i686-apple-darwin",
"i686-pc-windows-gnu",
"i686-pc-windows-msvc",
@@ -135,7 +135,7 @@
"x86_64-unknown-linux-gnu",
];
-static MINGW: &'static [&'static str] = &[
+static MINGW: &[&str] = &[
"i686-pc-windows-gnu",
"x86_64-pc-windows-gnu",
];
@@ -162,7 +162,7 @@
to: String,
}
-#[derive(Serialize)]
+#[derive(Serialize, Default)]
struct Target {
available: bool,
url: Option<String>,
@@ -174,17 +174,7 @@
}
impl Target {
- fn unavailable() -> Target {
- Target {
- available: false,
- url: None,
- hash: None,
- xz_url: None,
- xz_hash: None,
- components: None,
- extensions: None,
- }
- }
+ fn unavailable() -> Self { Self::default() }
}
#[derive(Serialize)]
@@ -193,6 +183,12 @@
target: String,
}
+impl Component {
+ fn from_str(pkg: &str, target: &str) -> Self {
+ Self { pkg: pkg.to_string(), target: target.to_string() }
+ }
+}
+
macro_rules! t {
($e:expr) => (match $e {
Ok(e) => e,
@@ -310,6 +306,25 @@
}.build();
}
+enum PkgType { RustSrc, Cargo, Rls, Clippy, Rustfmt, LlvmTools, Lldb, Miri, Other }
+
+impl PkgType {
+ fn from_component(component: &str) -> Self {
+ use PkgType::*;
+ match component {
+ "rust-src" => RustSrc,
+ "cargo" => Cargo,
+ "rls" | "rls-preview" => Rls,
+ "clippy" | "clippy-preview" => Clippy,
+ "rustfmt" | "rustfmt-preview" => Rustfmt,
+ "llvm-tools" | "llvm-tools-preview" => LlvmTools,
+ "lldb" | "lldb-preview" => Lldb,
+ "miri" | "miri-preview" => Miri,
+ _ => Other,
+ }
+ }
+}
+
impl Builder {
fn build(&mut self) {
self.rust_version = self.version("rust", "x86_64-unknown-linux-gnu");
@@ -358,39 +373,57 @@
renames: BTreeMap::new(),
profiles: BTreeMap::new(),
};
+ self.add_packages_to(&mut manifest);
+ self.add_profiles_to(&mut manifest);
+ self.add_renames_to(&mut manifest);
+ manifest.pkg.insert("rust".to_string(), self.rust_package(&manifest));
+ manifest
+ }
- self.package("rustc", &mut manifest.pkg, HOSTS);
- self.package("cargo", &mut manifest.pkg, HOSTS);
- self.package("rust-mingw", &mut manifest.pkg, MINGW);
- self.package("rust-std", &mut manifest.pkg, TARGETS);
- self.package("rust-docs", &mut manifest.pkg, DOCS_TARGETS);
- self.package("rust-src", &mut manifest.pkg, &["*"]);
- self.package("rls-preview", &mut manifest.pkg, HOSTS);
- self.package("clippy-preview", &mut manifest.pkg, HOSTS);
- self.package("miri", &mut manifest.pkg, HOSTS);
- self.package("rustfmt-preview", &mut manifest.pkg, HOSTS);
- self.package("rust-analysis", &mut manifest.pkg, TARGETS);
- self.package("llvm-tools-preview", &mut manifest.pkg, TARGETS);
- self.package("lldb-preview", &mut manifest.pkg, TARGETS);
+ fn add_packages_to(&mut self, manifest: &mut Manifest) {
+ let mut package = |name, targets| self.package(name, &mut manifest.pkg, targets);
+ package("rustc", HOSTS);
+ package("cargo", HOSTS);
+ package("rust-mingw", MINGW);
+ package("rust-std", TARGETS);
+ package("rust-docs", DOCS_TARGETS);
+ package("rust-src", &["*"]);
+ package("rls-preview", HOSTS);
+ package("clippy-preview", HOSTS);
+ package("miri-preview", HOSTS);
+ package("rustfmt-preview", HOSTS);
+ package("rust-analysis", TARGETS);
+ package("llvm-tools-preview", TARGETS);
+ package("lldb-preview", TARGETS);
+ }
- self.profile("minimal",
- &mut manifest.profiles,
- &["rustc", "cargo", "rust-std", "rust-mingw"]);
- self.profile("default",
- &mut manifest.profiles,
- &["rustc", "cargo", "rust-std", "rust-mingw",
- "rust-docs", "rustfmt-preview", "clippy-preview"]);
- self.profile("complete",
- &mut manifest.profiles,
- &["rustc", "cargo", "rust-std", "rust-mingw",
- "rust-docs", "rustfmt-preview", "clippy-preview",
- "rls-preview", "rust-src", "llvm-tools-preview",
- "lldb-preview", "rust-analysis", "miri"]);
+ fn add_profiles_to(&mut self, manifest: &mut Manifest) {
+ let mut profile = |name, pkgs| self.profile(name, &mut manifest.profiles, pkgs);
+ profile("minimal", &["rustc", "cargo", "rust-std", "rust-mingw"]);
+ profile("default", &[
+ "rustc", "cargo", "rust-std", "rust-mingw",
+ "rust-docs", "rustfmt-preview", "clippy-preview"
+ ]);
+ profile("complete", &[
+ "rustc", "cargo", "rust-std", "rust-mingw",
+ "rust-docs", "rustfmt-preview", "clippy-preview",
+ "rls-preview", "rust-src", "llvm-tools-preview",
+ "lldb-preview", "rust-analysis", "miri-preview"
+ ]);
+ }
- manifest.renames.insert("rls".to_owned(), Rename { to: "rls-preview".to_owned() });
- manifest.renames.insert("rustfmt".to_owned(), Rename { to: "rustfmt-preview".to_owned() });
- manifest.renames.insert("clippy".to_owned(), Rename { to: "clippy-preview".to_owned() });
+ fn add_renames_to(&self, manifest: &mut Manifest) {
+ let mut rename = |from: &str, to: &str| manifest.renames.insert(
+ from.to_owned(),
+ Rename { to: to.to_owned() }
+ );
+ rename("rls", "rls-preview");
+ rename("rustfmt", "rustfmt-preview");
+ rename("clippy", "clippy-preview");
+ rename("miri", "miri-preview");
+ }
+ fn rust_package(&mut self, manifest: &Manifest) -> Package {
let mut pkg = Package {
version: self.cached_version("rust")
.as_ref()
@@ -400,90 +433,82 @@
target: BTreeMap::new(),
};
for host in HOSTS {
- let filename = self.filename("rust", host);
- let digest = match self.digests.remove(&filename) {
- Some(digest) => digest,
- None => {
- pkg.target.insert(host.to_string(), Target::unavailable());
- continue
- }
- };
- let xz_filename = filename.replace(".tar.gz", ".tar.xz");
- let xz_digest = self.digests.remove(&xz_filename);
- let mut components = Vec::new();
- let mut extensions = Vec::new();
-
- // rustc/rust-std/cargo/docs are all required, and so is rust-mingw
- // if it's available for the target.
- components.extend(vec![
- Component { pkg: "rustc".to_string(), target: host.to_string() },
- Component { pkg: "rust-std".to_string(), target: host.to_string() },
- Component { pkg: "cargo".to_string(), target: host.to_string() },
- Component { pkg: "rust-docs".to_string(), target: host.to_string() },
- ]);
- if host.contains("pc-windows-gnu") {
- components.push(Component {
- pkg: "rust-mingw".to_string(),
- target: host.to_string(),
- });
+ if let Some(target) = self.target_host_combination(host, &manifest) {
+ pkg.target.insert(host.to_string(), target);
+ } else {
+ pkg.target.insert(host.to_string(), Target::unavailable());
+ continue
}
-
- // Tools are always present in the manifest, but might be marked as unavailable if they
- // weren't built
- extensions.extend(vec![
- Component { pkg: "clippy-preview".to_string(), target: host.to_string() },
- Component { pkg: "miri".to_string(), target: host.to_string() },
- Component { pkg: "rls-preview".to_string(), target: host.to_string() },
- Component { pkg: "rustfmt-preview".to_string(), target: host.to_string() },
- Component { pkg: "llvm-tools-preview".to_string(), target: host.to_string() },
- Component { pkg: "lldb-preview".to_string(), target: host.to_string() },
- Component { pkg: "rust-analysis".to_string(), target: host.to_string() },
- ]);
-
- for target in TARGETS {
- if target != host {
- extensions.push(Component {
- pkg: "rust-std".to_string(),
- target: target.to_string(),
- });
- }
- }
- extensions.push(Component {
- pkg: "rust-src".to_string(),
- target: "*".to_string(),
- });
-
- // If the components/extensions don't actually exist for this
- // particular host/target combination then nix it entirely from our
- // lists.
- {
- let has_component = |c: &Component| {
- if c.target == "*" {
- return true
- }
- let pkg = match manifest.pkg.get(&c.pkg) {
- Some(p) => p,
- None => return false,
- };
- pkg.target.get(&c.target).is_some()
- };
- extensions.retain(&has_component);
- components.retain(&has_component);
- }
-
- pkg.target.insert(host.to_string(), Target {
- available: true,
- url: Some(self.url(&filename)),
- hash: Some(digest),
- xz_url: xz_digest.as_ref().map(|_| self.url(&xz_filename)),
- xz_hash: xz_digest,
- components: Some(components),
- extensions: Some(extensions),
- });
}
- manifest.pkg.insert("rust".to_string(), pkg);
+ pkg
+ }
- manifest
+ fn target_host_combination(&mut self, host: &str, manifest: &Manifest) -> Option<Target> {
+ let filename = self.filename("rust", host);
+ let digest = self.digests.remove(&filename)?;
+ let xz_filename = filename.replace(".tar.gz", ".tar.xz");
+ let xz_digest = self.digests.remove(&xz_filename);
+ let mut components = Vec::new();
+ let mut extensions = Vec::new();
+
+ let host_component = |pkg| Component::from_str(pkg, host);
+
+ // rustc/rust-std/cargo/docs are all required,
+ // and so is rust-mingw if it's available for the target.
+ components.extend(vec![
+ host_component("rustc"),
+ host_component("rust-std"),
+ host_component("cargo"),
+ host_component("rust-docs"),
+ ]);
+ if host.contains("pc-windows-gnu") {
+ components.push(host_component("rust-mingw"));
+ }
+
+ // Tools are always present in the manifest,
+ // but might be marked as unavailable if they weren't built.
+ extensions.extend(vec![
+ host_component("clippy-preview"),
+ host_component("miri-preview"),
+ host_component("rls-preview"),
+ host_component("rustfmt-preview"),
+ host_component("llvm-tools-preview"),
+ host_component("lldb-preview"),
+ host_component("rust-analysis"),
+ ]);
+
+ extensions.extend(
+ TARGETS.iter()
+ .filter(|&&target| target != host)
+ .map(|target| Component::from_str("rust-std", target))
+ );
+ extensions.push(Component::from_str("rust-src", "*"));
+
+ // If the components/extensions don't actually exist for this
+ // particular host/target combination then nix it entirely from our
+ // lists.
+ let has_component = |c: &Component| {
+ if c.target == "*" {
+ return true
+ }
+ let pkg = match manifest.pkg.get(&c.pkg) {
+ Some(p) => p,
+ None => return false,
+ };
+ pkg.target.get(&c.target).is_some()
+ };
+ extensions.retain(&has_component);
+ components.retain(&has_component);
+
+ Some(Target {
+ available: true,
+ url: Some(self.url(&filename)),
+ hash: Some(digest),
+ xz_url: xz_digest.as_ref().map(|_| self.url(&xz_filename)),
+ xz_hash: xz_digest,
+ components: Some(components),
+ extensions: Some(extensions),
+ })
}
fn profile(&mut self,
@@ -497,10 +522,11 @@
pkgname: &str,
dst: &mut BTreeMap<String, Package>,
targets: &[&str]) {
- let (version, is_present) = match *self.cached_version(pkgname) {
- Some(ref version) => (version.clone(), true),
- None => (String::new(), false),
- };
+ let (version, is_present) = self.cached_version(pkgname)
+ .as_ref()
+ .cloned()
+ .map(|version| (version, true))
+ .unwrap_or_default();
let targets = targets.iter().map(|name| {
if is_present {
@@ -524,15 +550,7 @@
} else {
// If the component is not present for this build add it anyway but mark it as
// unavailable -- this way rustup won't allow upgrades without --force
- (name.to_string(), Target {
- available: false,
- url: None,
- hash: None,
- xz_url: None,
- xz_hash: None,
- components: None,
- extensions: None,
- })
+ (name.to_string(), Target::unavailable())
}
}).collect();
@@ -551,89 +569,65 @@
}
fn filename(&self, component: &str, target: &str) -> String {
- if component == "rust-src" {
- format!("rust-src-{}.tar.gz", self.rust_release)
- } else if component == "cargo" {
- format!("cargo-{}-{}.tar.gz", self.cargo_release, target)
- } else if component == "rls" || component == "rls-preview" {
- format!("rls-{}-{}.tar.gz", self.rls_release, target)
- } else if component == "clippy" || component == "clippy-preview" {
- format!("clippy-{}-{}.tar.gz", self.clippy_release, target)
- } else if component == "rustfmt" || component == "rustfmt-preview" {
- format!("rustfmt-{}-{}.tar.gz", self.rustfmt_release, target)
- } else if component == "llvm-tools" || component == "llvm-tools-preview" {
- format!("llvm-tools-{}-{}.tar.gz", self.llvm_tools_release, target)
- } else if component == "lldb" || component == "lldb-preview" {
- format!("lldb-{}-{}.tar.gz", self.lldb_release, target)
- } else if component == "miri" || component == "miri-preview" {
- format!("miri-{}-{}.tar.gz", self.miri_release, target)
- } else {
- format!("{}-{}-{}.tar.gz", component, self.rust_release, target)
+ use PkgType::*;
+ match PkgType::from_component(component) {
+ RustSrc => format!("rust-src-{}.tar.gz", self.rust_release),
+ Cargo => format!("cargo-{}-{}.tar.gz", self.cargo_release, target),
+ Rls => format!("rls-{}-{}.tar.gz", self.rls_release, target),
+ Clippy => format!("clippy-{}-{}.tar.gz", self.clippy_release, target),
+ Rustfmt => format!("rustfmt-{}-{}.tar.gz", self.rustfmt_release, target),
+ LlvmTools => format!("llvm-tools-{}-{}.tar.gz", self.llvm_tools_release, target),
+ Lldb => format!("lldb-{}-{}.tar.gz", self.lldb_release, target),
+ Miri => format!("miri-{}-{}.tar.gz", self.miri_release, target),
+ Other => format!("{}-{}-{}.tar.gz", component, self.rust_release, target),
}
}
fn cached_version(&self, component: &str) -> &Option<String> {
- if component == "cargo" {
- &self.cargo_version
- } else if component == "rls" || component == "rls-preview" {
- &self.rls_version
- } else if component == "clippy" || component == "clippy-preview" {
- &self.clippy_version
- } else if component == "rustfmt" || component == "rustfmt-preview" {
- &self.rustfmt_version
- } else if component == "llvm-tools" || component == "llvm-tools-preview" {
- &self.llvm_tools_version
- } else if component == "lldb" || component == "lldb-preview" {
- &self.lldb_version
- } else if component == "miri" || component == "miri-preview" {
- &self.miri_version
- } else {
- &self.rust_version
+ use PkgType::*;
+ match PkgType::from_component(component) {
+ Cargo => &self.cargo_version,
+ Rls => &self.rls_version,
+ Clippy => &self.clippy_version,
+ Rustfmt => &self.rustfmt_version,
+ LlvmTools => &self.llvm_tools_version,
+ Lldb => &self.lldb_version,
+ Miri => &self.miri_version,
+ _ => &self.rust_version,
}
}
fn cached_git_commit_hash(&self, component: &str) -> &Option<String> {
- if component == "cargo" {
- &self.cargo_git_commit_hash
- } else if component == "rls" || component == "rls-preview" {
- &self.rls_git_commit_hash
- } else if component == "clippy" || component == "clippy-preview" {
- &self.clippy_git_commit_hash
- } else if component == "rustfmt" || component == "rustfmt-preview" {
- &self.rustfmt_git_commit_hash
- } else if component == "llvm-tools" || component == "llvm-tools-preview" {
- &self.llvm_tools_git_commit_hash
- } else if component == "lldb" || component == "lldb-preview" {
- &self.lldb_git_commit_hash
- } else if component == "miri" || component == "miri-preview" {
- &self.miri_git_commit_hash
- } else {
- &self.rust_git_commit_hash
+ use PkgType::*;
+ match PkgType::from_component(component) {
+ Cargo => &self.cargo_git_commit_hash,
+ Rls => &self.rls_git_commit_hash,
+ Clippy => &self.clippy_git_commit_hash,
+ Rustfmt => &self.rustfmt_git_commit_hash,
+ LlvmTools => &self.llvm_tools_git_commit_hash,
+ Lldb => &self.lldb_git_commit_hash,
+ Miri => &self.miri_git_commit_hash,
+ _ => &self.rust_git_commit_hash,
}
}
fn version(&self, component: &str, target: &str) -> Option<String> {
- let mut cmd = Command::new("tar");
- let filename = self.filename(component, target);
- cmd.arg("xf")
- .arg(self.input.join(&filename))
- .arg(format!("{}/version", filename.replace(".tar.gz", "")))
- .arg("-O");
- let output = t!(cmd.output());
- if output.status.success() {
- Some(String::from_utf8_lossy(&output.stdout).trim().to_string())
- } else {
- // Perhaps we didn't build this package.
- None
- }
+ self.untar(component, target, |filename| format!("{}/version", filename))
}
fn git_commit_hash(&self, component: &str, target: &str) -> Option<String> {
+ self.untar(component, target, |filename| format!("{}/git-commit-hash", filename))
+ }
+
+ fn untar<F>(&self, component: &str, target: &str, dir: F) -> Option<String>
+ where
+ F: FnOnce(String) -> String
+ {
let mut cmd = Command::new("tar");
let filename = self.filename(component, target);
cmd.arg("xf")
.arg(self.input.join(&filename))
- .arg(format!("{}/git-commit-hash", filename.replace(".tar.gz", "")))
+ .arg(dir(filename.replace(".tar.gz", "")))
.arg("-O");
let output = t!(cmd.output());
if output.status.success() {
diff --git a/src/tools/compiletest/src/common.rs b/src/tools/compiletest/src/common.rs
index f0991c8..80b8a8b 100644
--- a/src/tools/compiletest/src/common.rs
+++ b/src/tools/compiletest/src/common.rs
@@ -26,6 +26,7 @@
Ui,
JsDocTest,
MirOpt,
+ Assembly,
}
impl Mode {
@@ -62,6 +63,7 @@
"ui" => Ok(Ui),
"js-doc-test" => Ok(JsDocTest),
"mir-opt" => Ok(MirOpt),
+ "assembly" => Ok(Assembly),
_ => Err(()),
}
}
@@ -86,6 +88,7 @@
Ui => "ui",
JsDocTest => "js-doc-test",
MirOpt => "mir-opt",
+ Assembly => "assembly",
};
fmt::Display::fmt(s, f)
}
diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs
index c2c4a6b..7bf5670 100644
--- a/src/tools/compiletest/src/header.rs
+++ b/src/tools/compiletest/src/header.rs
@@ -335,6 +335,7 @@
pub failure_status: i32,
pub run_rustfix: bool,
pub rustfix_only_machine_applicable: bool,
+ pub assembly_output: Option<String>,
}
impl TestProps {
@@ -370,6 +371,7 @@
failure_status: -1,
run_rustfix: false,
rustfix_only_machine_applicable: false,
+ assembly_output: None,
}
}
@@ -517,6 +519,10 @@
self.rustfix_only_machine_applicable =
config.parse_rustfix_only_machine_applicable(ln);
}
+
+ if self.assembly_output.is_none() {
+ self.assembly_output = config.parse_assembly_output(ln);
+ }
});
if self.failure_status == -1 {
@@ -594,6 +600,7 @@
fn parse_aux_build(&self, line: &str) -> Option<String> {
self.parse_name_value_directive(line, "aux-build")
+ .map(|r| r.trim().to_string())
}
fn parse_compile_flags(&self, line: &str) -> Option<String> {
@@ -676,6 +683,11 @@
self.parse_name_directive(line, "skip-codegen")
}
+ fn parse_assembly_output(&self, line: &str) -> Option<String> {
+ self.parse_name_value_directive(line, "assembly-output")
+ .map(|r| r.trim().to_string())
+ }
+
fn parse_env(&self, line: &str, name: &str) -> Option<(String, String)> {
self.parse_name_value_directive(line, name).map(|nv| {
// nv is either FOO or FOO=BAR
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs
index 97bacb6..3e3499e 100644
--- a/src/tools/compiletest/src/runtest.rs
+++ b/src/tools/compiletest/src/runtest.rs
@@ -4,7 +4,7 @@
use crate::common::{Codegen, CodegenUnits, DebugInfoBoth, DebugInfoGdb, DebugInfoLldb, Rustdoc};
use crate::common::{CompileFail, Pretty, RunFail, RunPass, RunPassValgrind};
use crate::common::{Config, TestPaths};
-use crate::common::{Incremental, MirOpt, RunMake, Ui, JsDocTest};
+use crate::common::{Incremental, MirOpt, RunMake, Ui, JsDocTest, Assembly};
use diff;
use crate::errors::{self, Error, ErrorKind};
use filetime::FileTime;
@@ -275,6 +275,7 @@
RunMake => self.run_rmake_test(),
RunPass | Ui => self.run_ui_test(),
MirOpt => self.run_mir_opt_test(),
+ Assembly => self.run_assembly_test(),
JsDocTest => self.run_js_doc_test(),
}
}
@@ -1606,6 +1607,7 @@
|| self.config.target.contains("emscripten")
|| (self.config.target.contains("musl") && !aux_props.force_host)
|| self.config.target.contains("wasm32")
+ || self.config.target.contains("nvptx")
{
// We primarily compile all auxiliary libraries as dynamic libraries
// to avoid code size bloat and large binaries as much as possible
@@ -1805,7 +1807,7 @@
rustc.arg(dir_opt);
}
RunFail | RunPassValgrind | Pretty | DebugInfoBoth | DebugInfoGdb | DebugInfoLldb
- | Codegen | Rustdoc | RunMake | CodegenUnits | JsDocTest => {
+ | Codegen | Rustdoc | RunMake | CodegenUnits | JsDocTest | Assembly => {
// do not use JSON output
}
}
@@ -2100,12 +2102,37 @@
self.compose_and_run_compiler(rustc, None)
}
- fn check_ir_with_filecheck(&self) -> ProcRes {
- let irfile = self.output_base_name().with_extension("ll");
+ fn compile_test_and_save_assembly(&self) -> (ProcRes, PathBuf) {
+ // This works with both `--emit asm` (as default output name for the assembly)
+ // and `ptx-linker` because the latter can write output at requested location.
+ let output_path = self.output_base_name().with_extension("s");
+
+ let output_file = TargetLocation::ThisFile(output_path.clone());
+ let mut rustc = self.make_compile_args(&self.testpaths.file, output_file);
+
+ rustc.arg("-L").arg(self.aux_output_dir_name());
+
+ match self.props.assembly_output.as_ref().map(AsRef::as_ref) {
+ Some("emit-asm") => {
+ rustc.arg("--emit=asm");
+ }
+
+ Some("ptx-linker") => {
+ // No extra flags needed.
+ }
+
+ Some(_) => self.fatal("unknown 'assembly-output' header"),
+ None => self.fatal("missing 'assembly-output' header"),
+ }
+
+ (self.compose_and_run_compiler(rustc, None), output_path)
+ }
+
+ fn verify_with_filecheck(&self, output: &Path) -> ProcRes {
let mut filecheck = Command::new(self.config.llvm_filecheck.as_ref().unwrap());
filecheck
.arg("--input-file")
- .arg(irfile)
+ .arg(output)
.arg(&self.testpaths.file);
// It would be more appropriate to make most of the arguments configurable through
// a comment-attribute similar to `compile-flags`. For example, --check-prefixes is a very
@@ -2124,12 +2151,29 @@
self.fatal("missing --llvm-filecheck");
}
- let mut proc_res = self.compile_test_and_save_ir();
+ let proc_res = self.compile_test_and_save_ir();
if !proc_res.status.success() {
self.fatal_proc_rec("compilation failed!", &proc_res);
}
- proc_res = self.check_ir_with_filecheck();
+ let output_path = self.output_base_name().with_extension("ll");
+ let proc_res = self.verify_with_filecheck(&output_path);
+ if !proc_res.status.success() {
+ self.fatal_proc_rec("verification with 'FileCheck' failed", &proc_res);
+ }
+ }
+
+ fn run_assembly_test(&self) {
+ if self.config.llvm_filecheck.is_none() {
+ self.fatal("missing --llvm-filecheck");
+ }
+
+ let (proc_res, output_path) = self.compile_test_and_save_assembly();
+ if !proc_res.status.success() {
+ self.fatal_proc_rec("compilation failed!", &proc_res);
+ }
+
+ let proc_res = self.verify_with_filecheck(&output_path);
if !proc_res.status.success() {
self.fatal_proc_rec("verification with 'FileCheck' failed", &proc_res);
}
diff --git a/src/tools/compiletest/src/util.rs b/src/tools/compiletest/src/util.rs
index 3533dcd..50dce4b 100644
--- a/src/tools/compiletest/src/util.rs
+++ b/src/tools/compiletest/src/util.rs
@@ -41,7 +41,6 @@
("armv7", "arm"),
("armv7s", "arm"),
("asmjs", "asmjs"),
- ("cuda", "cuda"),
("hexagon", "hexagon"),
("i386", "x86"),
("i586", "x86"),
@@ -59,6 +58,7 @@
("mipsisa64r6", "mips64"),
("mipsisa64r6el", "mips64"),
("msp430", "msp430"),
+ ("nvptx64", "nvptx64"),
("powerpc", "powerpc"),
("powerpc64", "powerpc64"),
("powerpc64le", "powerpc64"),
@@ -166,7 +166,7 @@
fn test_get_arch() {
assert_eq!("x86_64", get_arch("x86_64-unknown-linux-gnu"));
assert_eq!("x86_64", get_arch("amd64"));
- assert_eq!("cuda", get_arch("nvptx64-nvidia-cuda"));
+ assert_eq!("nvptx64", get_arch("nvptx64-nvidia-cuda"));
}
#[test]
diff --git a/src/tools/publish_toolstate.py b/src/tools/publish_toolstate.py
index fb6132a..f2a585e 100755
--- a/src/tools/publish_toolstate.py
+++ b/src/tools/publish_toolstate.py
@@ -12,7 +12,7 @@
except ImportError:
import urllib.request as urllib2
-# List of people to ping when the status of a tool changed.
+# List of people to ping when the status of a tool or a book changed.
MAINTAINERS = {
'miri': '@oli-obk @RalfJung @eddyb',
'clippy-driver': '@Manishearth @llogiq @mcarton @oli-obk @phansch',
@@ -22,6 +22,10 @@
'nomicon': '@frewsxcv @Gankro',
'reference': '@steveklabnik @Havvy @matthewjasper @alercah',
'rust-by-example': '@steveklabnik @marioidival @projektir',
+ 'embedded-book': (
+ '@adamgreig @andre-richter @jamesmunns @korken89 '
+ '@ryankurte @thejpster @therealprof'
+ ),
}
REPOS = {
@@ -33,6 +37,7 @@
'nomicon': 'https://github.com/rust-lang-nursery/nomicon',
'reference': 'https://github.com/rust-lang-nursery/reference',
'rust-by-example': 'https://github.com/rust-lang/rust-by-example',
+ 'embedded-book': 'https://github.com/rust-embedded/book',
}
@@ -70,7 +75,7 @@
cc @{}, the PR reviewer, and @rust-lang/compiler -- nominating for prioritization.
- ''').format(relevant_pr_number, tool, REPOS[tool], relevant_pr_user, pr_reviewer),
+ ''').format(relevant_pr_number, tool, REPOS.get(tool), relevant_pr_user, pr_reviewer),
'title': '`{}` no longer builds after {}'.format(tool, relevant_pr_number),
'assignees': assignees,
'labels': ['T-compiler', 'I-nominated'],
@@ -137,7 +142,7 @@
if build_failed:
try:
issue(
- tool, MAINTAINERS.get(tool),
+ tool, MAINTAINERS.get(tool, ''),
relevant_pr_number, relevant_pr_user, pr_reviewer,
)
except IOError as e: