Rollup merge of #59347 - petrochenkov:nomake, r=davidtwco
Move one test from run-make-fulldeps to ui
The test was written when `--extern` without path didn't exist.
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/src/bootstrap/lib.rs b/src/bootstrap/lib.rs
index 976b30a..0c3daea 100644
--- a/src/bootstrap/lib.rs
+++ b/src/bootstrap/lib.rs
@@ -726,6 +726,17 @@
}
}
+ pub fn is_verbose_than(&self, level: usize) -> bool {
+ self.verbosity > level
+ }
+
+ /// Prints a message if this build is configured in more verbose mode than `level`.
+ fn verbose_than(&self, level: usize, msg: &str) {
+ if self.is_verbose_than(level) {
+ println!("{}", msg);
+ }
+ }
+
fn info(&self, msg: &str) {
if self.config.dry_run { return; }
println!("{}", msg);
@@ -1158,6 +1169,7 @@
/// Copies a file from `src` to `dst`
pub fn copy(&self, src: &Path, dst: &Path) {
if self.config.dry_run { return; }
+ self.verbose_than(1, &format!("Copy {:?} to {:?}", src, dst));
let _ = fs::remove_file(&dst);
let metadata = t!(src.symlink_metadata());
if metadata.file_type().is_symlink() {
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_resolve/error_reporting.rs b/src/librustc_resolve/error_reporting.rs
index cd771d9..828ffc6 100644
--- a/src/librustc_resolve/error_reporting.rs
+++ b/src/librustc_resolve/error_reporting.rs
@@ -293,13 +293,20 @@
(Def::Enum(..), PathSource::TupleStruct)
| (Def::Enum(..), PathSource::Expr(..)) => {
if let Some(variants) = self.collect_enum_variants(def) {
- err.note(&format!("did you mean to use one \
- of the following variants?\n{}",
- variants.iter()
- .map(|suggestion| path_names_to_string(suggestion))
- .map(|suggestion| format!("- `{}`", suggestion))
- .collect::<Vec<_>>()
- .join("\n")));
+ if !variants.is_empty() {
+ let msg = if variants.len() == 1 {
+ "try using the enum's variant"
+ } else {
+ "try using one of the enum's variants"
+ };
+
+ err.span_suggestions(
+ span,
+ msg,
+ variants.iter().map(path_names_to_string),
+ Applicability::MaybeIncorrect,
+ );
+ }
} else {
err.note("did you mean to use one of the enum's variants?");
}
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/astconv.rs b/src/librustc_typeck/astconv.rs
index df8b1bc..c65f344 100644
--- a/src/librustc_typeck/astconv.rs
+++ b/src/librustc_typeck/astconv.rs
@@ -1486,37 +1486,34 @@
segment.with_generic_args(|generic_args| {
let (mut err_for_lt, mut err_for_ty, mut err_for_ct) = (false, false, false);
for arg in &generic_args.args {
- let (mut span_err, span, kind) = match arg {
- // FIXME(varkor): unify E0109, E0110 and E0111.
+ let (span, kind) = match arg {
hir::GenericArg::Lifetime(lt) => {
if err_for_lt { continue }
err_for_lt = true;
has_err = true;
- (struct_span_err!(self.tcx().sess, lt.span, E0110,
- "lifetime arguments are not allowed on this entity"),
- lt.span,
- "lifetime")
+ (lt.span, "lifetime")
}
hir::GenericArg::Type(ty) => {
if err_for_ty { continue }
err_for_ty = true;
has_err = true;
- (struct_span_err!(self.tcx().sess, ty.span, E0109,
- "type arguments are not allowed on this entity"),
- ty.span,
- "type")
+ (ty.span, "type")
}
hir::GenericArg::Const(ct) => {
if err_for_ct { continue }
err_for_ct = true;
- (struct_span_err!(self.tcx().sess, ct.span, E0111,
- "const parameters are not allowed on this type"),
- ct.span,
- "const")
+ (ct.span, "const")
}
};
- span_err.span_label(span, format!("{} argument not allowed", kind))
- .emit();
+ let mut err = struct_span_err!(
+ self.tcx().sess,
+ span,
+ E0109,
+ "{} arguments are not allowed for this type",
+ kind,
+ );
+ err.span_label(span, format!("{} argument not allowed", kind));
+ err.emit();
if err_for_lt && err_for_ty && err_for_ct {
break;
}
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/librustc_typeck/diagnostics.rs b/src/librustc_typeck/diagnostics.rs
index 399cd6f..cde37fb 100644
--- a/src/librustc_typeck/diagnostics.rs
+++ b/src/librustc_typeck/diagnostics.rs
@@ -1290,45 +1290,34 @@
"##,
E0109: r##"
-You tried to give a type parameter to a type which doesn't need it. Erroneous
-code example:
+You tried to provide a generic argument to a type which doesn't need it.
+Erroneous code example:
```compile_fail,E0109
-type X = u32<i32>; // error: type arguments are not allowed on this entity
+type X = u32<i32>; // error: type arguments are not allowed for this type
+type Y = bool<'static>; // error: lifetime parameters are not allowed on
+ // this type
```
-Please check that you used the correct type and recheck its definition. Perhaps
-it doesn't need the type parameter.
+Check that you used the correct argument and that the definition is correct.
Example:
```
-type X = u32; // this compiles
+type X = u32; // ok!
+type Y = bool; // ok!
```
-Note that type parameters for enum-variant constructors go after the variant,
-not after the enum (`Option::None::<u32>`, not `Option::<u32>::None`).
+Note that generic arguments for enum variant constructors go after the variant,
+not after the enum. For example, you would write `Option::None::<u32>`,
+rather than `Option::<u32>::None`.
"##,
E0110: r##"
-You tried to give a lifetime parameter to a type which doesn't need it.
-Erroneous code example:
+#### Note: this error code is no longer emitted by the compiler.
-```compile_fail,E0110
-type X = u32<'static>; // error: lifetime parameters are not allowed on
- // this type
-```
-
-Please check that the correct type was used and recheck its definition; perhaps
-it doesn't need the lifetime parameter. Example:
-
-```
-type X = u32; // ok!
-```
-"##,
-
-E0111: r##"
-You tried to give a const parameter to a type which doesn't need it.
+You tried to provide a lifetime to a type which doesn't need it.
+See `E0109` for more details.
"##,
E0116: r##"
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 4819256..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;
@@ -1057,7 +1057,7 @@
GenericBound::TraitBound(PolyTrait {
trait_: ResolvedPath {
path,
- typarams: None,
+ param_names: None,
did,
is_generic: false,
},
@@ -1101,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
@@ -1126,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 }
}
}
}
@@ -1188,7 +1194,7 @@
PolyTrait {
trait_: ResolvedPath {
path,
- typarams: None,
+ param_names: None,
did: trait_ref.def_id,
is_generic: false,
},
@@ -1474,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))
@@ -1496,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),
+ })
}
};
@@ -1697,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),
@@ -2260,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,
@@ -2381,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
}
@@ -2722,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)
@@ -2730,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
}
@@ -2797,7 +2807,7 @@
None, false, vec![], substs);
ResolvedPath {
path,
- typarams: None,
+ param_names: None,
did,
is_generic: false,
}
@@ -2808,7 +2818,7 @@
None, false, vec![], InternalSubsts::empty());
ResolvedPath {
path: path,
- typarams: None,
+ param_names: None,
did: did,
is_generic: false,
}
@@ -2829,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(),
@@ -2839,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![];
@@ -2860,7 +2870,7 @@
false, bindings, substs);
ResolvedPath {
path,
- typarams: Some(typarams),
+ param_names: Some(param_names),
did,
is_generic: false,
}
@@ -2937,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);
@@ -3245,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 {
@@ -3266,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),
}
}
@@ -3310,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())
@@ -3338,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();
@@ -3491,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,
@@ -3971,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 {
@@ -4397,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 48baf27..3d8af7c 100644
--- a/src/librustdoc/html/format.rs
+++ b/src/librustdoc/html/format.rs
@@ -260,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() {
@@ -301,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 {
@@ -522,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, " + ")?;
@@ -560,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()),
@@ -664,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, ")")
@@ -718,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,
@@ -732,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(())
}
_ => {
@@ -772,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)?;
diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs
index a262a2f..445ce06 100644
--- a/src/librustdoc/html/render.rs
+++ b/src/librustdoc/html/render.rs
@@ -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());
}
}
}
diff --git a/src/libstd/f32.rs b/src/libstd/f32.rs
index 2fabe30..688d9c1 100644
--- a/src/libstd/f32.rs
+++ b/src/libstd/f32.rs
@@ -970,6 +970,7 @@
/// assert!((-3.0f32).clamp(-2.0f32, 1.0f32) == -2.0f32);
/// assert!((0.0f32).clamp(-2.0f32, 1.0f32) == 0.0f32);
/// assert!((2.0f32).clamp(-2.0f32, 1.0f32) == 1.0f32);
+ /// assert!((std::f32::NAN).clamp(-2.0f32, 1.0f32).is_nan());
/// ```
#[unstable(feature = "clamp", issue = "44095")]
#[inline]
@@ -1581,4 +1582,22 @@
assert_eq!(f32::from_bits(masked_nan1).to_bits(), masked_nan1);
assert_eq!(f32::from_bits(masked_nan2).to_bits(), masked_nan2);
}
+
+ #[test]
+ #[should_panic]
+ fn test_clamp_min_greater_than_max() {
+ 1.0f32.clamp(3.0, 1.0);
+ }
+
+ #[test]
+ #[should_panic]
+ fn test_clamp_min_is_nan() {
+ 1.0f32.clamp(NAN, 1.0);
+ }
+
+ #[test]
+ #[should_panic]
+ fn test_clamp_max_is_nan() {
+ 1.0f32.clamp(3.0, NAN);
+ }
}
diff --git a/src/libstd/f64.rs b/src/libstd/f64.rs
index a471117..b171e1c 100644
--- a/src/libstd/f64.rs
+++ b/src/libstd/f64.rs
@@ -892,6 +892,7 @@
/// assert!((-3.0f64).clamp(-2.0f64, 1.0f64) == -2.0f64);
/// assert!((0.0f64).clamp(-2.0f64, 1.0f64) == 0.0f64);
/// assert!((2.0f64).clamp(-2.0f64, 1.0f64) == 1.0f64);
+ /// assert!((std::f64::NAN).clamp(-2.0f64, 1.0f64).is_nan());
/// ```
#[unstable(feature = "clamp", issue = "44095")]
#[inline]
@@ -1522,4 +1523,22 @@
assert_eq!(f64::from_bits(masked_nan1).to_bits(), masked_nan1);
assert_eq!(f64::from_bits(masked_nan2).to_bits(), masked_nan2);
}
+
+ #[test]
+ #[should_panic]
+ fn test_clamp_min_greater_than_max() {
+ 1.0f64.clamp(3.0, 1.0);
+ }
+
+ #[test]
+ #[should_panic]
+ fn test_clamp_min_is_nan() {
+ 1.0f64.clamp(NAN, 1.0);
+ }
+
+ #[test]
+ #[should_panic]
+ fn test_clamp_max_is_nan() {
+ 1.0f64.clamp(3.0, NAN);
+ }
}
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/lexer/mod.rs b/src/libsyntax/parse/lexer/mod.rs
index bcd53db..cd4944d 100644
--- a/src/libsyntax/parse/lexer/mod.rs
+++ b/src/libsyntax/parse/lexer/mod.rs
@@ -968,9 +968,10 @@
} else {
let span = self.mk_sp(start, self.pos);
let mut suggestion = "\\u{".to_owned();
+ let msg = "incorrect unicode escape sequence";
let mut err = self.sess.span_diagnostic.struct_span_err(
span,
- "incorrect unicode escape sequence",
+ msg,
);
let mut i = 0;
while let (Some(ch), true) = (self.ch, i < 6) {
@@ -991,8 +992,8 @@
Applicability::MaybeIncorrect,
);
} else {
- err.span_help(
- span,
+ err.span_label(span, msg);
+ err.help(
"format of unicode escape sequences is `\\u{...}`",
);
}
@@ -1018,25 +1019,24 @@
}
c => {
let pos = self.pos;
- let mut err = self.struct_err_span_char(escaped_pos,
- pos,
- if ascii_only {
- "unknown byte escape"
- } else {
- "unknown character \
- escape"
- },
- c);
+ let msg = if ascii_only {
+ "unknown byte escape"
+ } else {
+ "unknown character escape"
+ };
+ let mut err = self.struct_err_span_char(escaped_pos, pos, msg, c);
+ err.span_label(self.mk_sp(escaped_pos, pos), msg);
if e == '\r' {
- err.span_help(self.mk_sp(escaped_pos, pos),
- "this is an isolated carriage return; consider \
- checking your editor and version control \
- settings");
+ err.help(
+ "this is an isolated carriage return; consider checking \
+ your editor and version control settings",
+ );
}
if (e == '{' || e == '}') && !ascii_only {
- err.span_help(self.mk_sp(escaped_pos, pos),
- "if used in a formatting string, curly braces \
- are escaped with `{{` and `}}`");
+ err.help(
+ "if used in a formatting string, curly braces are escaped \
+ with `{{` and `}}`",
+ );
}
err.emit();
false
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 3e00d94..5627ac3 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() {
@@ -4229,19 +4229,24 @@
fn parse_pat_list(&mut self) -> PResult<'a, (Vec<P<Pat>>, Option<usize>, bool)> {
let mut fields = Vec::new();
let mut ddpos = None;
+ let mut prev_dd_sp = None;
let mut trailing_comma = false;
loop {
if self.eat(&token::DotDot) {
if ddpos.is_none() {
ddpos = Some(fields.len());
+ prev_dd_sp = Some(self.prev_span);
} else {
// Emit a friendly error, ignore `..` and continue parsing
- self.struct_span_err(
+ let mut err = self.struct_span_err(
self.prev_span,
"`..` can only be used once per tuple or tuple struct pattern",
- )
- .span_label(self.prev_span, "can only be used once per pattern")
- .emit();
+ );
+ err.span_label(self.prev_span, "can only be used once per pattern");
+ if let Some(sp) = prev_dd_sp {
+ err.span_label(sp, "previously present here");
+ }
+ err.emit();
}
} else if !self.check(&token::CloseDelim(token::Paren)) {
fields.push(self.parse_pat(None)?);
@@ -6837,14 +6842,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 +6879,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 +6915,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 +6943,7 @@
return Err(err);
}
- Ok(fields)
+ Ok((fields, recovered))
}
fn parse_tuple_struct_body(&mut self) -> PResult<'a, Vec<StructField>> {
@@ -7688,16 +7701,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 +7735,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 +8638,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/compile-fail-fulldeps/auxiliary/lint_group_plugin_test.rs b/src/test/compile-fail-fulldeps/auxiliary/lint_group_plugin_test.rs
deleted file mode 100644
index 16630e2..0000000
--- a/src/test/compile-fail-fulldeps/auxiliary/lint_group_plugin_test.rs
+++ /dev/null
@@ -1,45 +0,0 @@
-// force-host
-
-#![feature(plugin_registrar)]
-#![feature(box_syntax, rustc_private)]
-
-// Load rustc as a plugin to get macros.
-#[macro_use]
-extern crate rustc;
-extern crate rustc_plugin;
-
-use rustc::hir;
-use rustc::lint::{LateContext, LintContext, LintPass, LateLintPass, LateLintPassObject, LintArray};
-use rustc_plugin::Registry;
-
-declare_lint!(TEST_LINT, Warn, "Warn about items named 'lintme'");
-
-declare_lint!(PLEASE_LINT, Warn, "Warn about items named 'pleaselintme'");
-
-struct Pass;
-
-impl LintPass for Pass {
- fn name(&self) -> &'static str {
- "Pass"
- }
-
- fn get_lints(&self) -> LintArray {
- lint_array!(TEST_LINT, PLEASE_LINT)
- }
-}
-
-impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
- fn check_item(&mut self, cx: &LateContext, it: &hir::Item) {
- match &*it.ident.as_str() {
- "lintme" => cx.span_lint(TEST_LINT, it.span, "item is named 'lintme'"),
- "pleaselintme" => cx.span_lint(PLEASE_LINT, it.span, "item is named 'pleaselintme'"),
- _ => {}
- }
- }
-}
-
-#[plugin_registrar]
-pub fn plugin_registrar(reg: &mut Registry) {
- reg.register_late_lint_pass(box Pass);
- reg.register_lint_group("lint_me", None, vec![TEST_LINT, PLEASE_LINT]);
-}
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/did_you_mean/issue-43871-enum-instead-of-variant.rs b/src/test/ui/did_you_mean/issue-43871-enum-instead-of-variant.rs
index f5dbab1..7d3aba36 100644
--- a/src/test/ui/did_you_mean/issue-43871-enum-instead-of-variant.rs
+++ b/src/test/ui/did_you_mean/issue-43871-enum-instead-of-variant.rs
@@ -1,5 +1,20 @@
enum Example { Ex(String), NotEx }
+enum Void {}
+
+enum ManyVariants {
+ One,
+ Two,
+ Three,
+ Four,
+ Five,
+ Six,
+ Seven,
+ Eight,
+ Nine,
+ Ten,
+}
+
fn result_test() {
let x = Option(1); //~ ERROR expected function, found enum
@@ -12,6 +27,10 @@
if let Example(_) = y { //~ ERROR expected tuple struct/variant, found enum
println!("It is OK.");
}
+
+ let y = Void(); //~ ERROR expected function, found enum
+
+ let z = ManyVariants(); //~ ERROR expected function, found enum
}
fn main() {}
diff --git a/src/test/ui/did_you_mean/issue-43871-enum-instead-of-variant.stderr b/src/test/ui/did_you_mean/issue-43871-enum-instead-of-variant.stderr
index 8a0d009..4210b4e 100644
--- a/src/test/ui/did_you_mean/issue-43871-enum-instead-of-variant.stderr
+++ b/src/test/ui/did_you_mean/issue-43871-enum-instead-of-variant.stderr
@@ -1,34 +1,63 @@
error[E0423]: expected function, found enum `Option`
- --> $DIR/issue-43871-enum-instead-of-variant.rs:4:13
+ --> $DIR/issue-43871-enum-instead-of-variant.rs:19:13
|
LL | let x = Option(1);
| ^^^^^^
+help: try using one of the enum's variants
|
- = note: did you mean to use one of the following variants?
- - `std::prelude::v1::Option::None`
- - `std::prelude::v1::Option::Some`
+LL | let x = std::prelude::v1::Option::None(1);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | let x = std::prelude::v1::Option::Some(1);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0532]: expected tuple struct/variant, found enum `Option`
- --> $DIR/issue-43871-enum-instead-of-variant.rs:6:12
+ --> $DIR/issue-43871-enum-instead-of-variant.rs:21:12
|
LL | if let Option(_) = x {
| ^^^^^^
+help: try using one of the enum's variants
|
- = note: did you mean to use one of the following variants?
- - `std::prelude::v1::Option::None`
- - `std::prelude::v1::Option::Some`
+LL | if let std::prelude::v1::Option::None(_) = x {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | if let std::prelude::v1::Option::Some(_) = x {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0532]: expected tuple struct/variant, found enum `Example`
- --> $DIR/issue-43871-enum-instead-of-variant.rs:12:12
+ --> $DIR/issue-43871-enum-instead-of-variant.rs:27:12
|
LL | if let Example(_) = y {
| ^^^^^^^
+help: try using one of the enum's variants
|
- = note: did you mean to use one of the following variants?
- - `Example::Ex`
- - `Example::NotEx`
+LL | if let Example::Ex(_) = y {
+ | ^^^^^^^^^^^
+LL | if let Example::NotEx(_) = y {
+ | ^^^^^^^^^^^^^^
-error: aborting due to 3 previous errors
+error[E0423]: expected function, found enum `Void`
+ --> $DIR/issue-43871-enum-instead-of-variant.rs:31:13
+ |
+LL | let y = Void();
+ | ^^^^
+
+error[E0423]: expected function, found enum `ManyVariants`
+ --> $DIR/issue-43871-enum-instead-of-variant.rs:33:13
+ |
+LL | let z = ManyVariants();
+ | ^^^^^^^^^^^^
+help: try using one of the enum's variants
+ |
+LL | let z = ManyVariants::Eight();
+ | ^^^^^^^^^^^^^^^^^^^
+LL | let z = ManyVariants::Five();
+ | ^^^^^^^^^^^^^^^^^^
+LL | let z = ManyVariants::Four();
+ | ^^^^^^^^^^^^^^^^^^
+LL | let z = ManyVariants::Nine();
+ | ^^^^^^^^^^^^^^^^^^
+and 6 other candidates
+
+error: aborting due to 5 previous errors
Some errors occurred: E0423, E0532.
For more information about an error, try `rustc --explain E0423`.
diff --git a/src/test/ui/enum-variant-generic-args.rs b/src/test/ui/enum-variant-generic-args.rs
index 6eddd70..dd1f5f3 100644
--- a/src/test/ui/enum-variant-generic-args.rs
+++ b/src/test/ui/enum-variant-generic-args.rs
@@ -9,27 +9,27 @@
Self::TSVariant(());
//~^ ERROR mismatched types [E0308]
Self::TSVariant::<()>(());
- //~^ ERROR type arguments are not allowed on this entity [E0109]
+ //~^ ERROR type arguments are not allowed for this type [E0109]
Self::<()>::TSVariant(());
- //~^ ERROR type arguments are not allowed on this entity [E0109]
+ //~^ ERROR type arguments are not allowed for this type [E0109]
//~^^ ERROR mismatched types [E0308]
Self::<()>::TSVariant::<()>(());
- //~^ ERROR type arguments are not allowed on this entity [E0109]
- //~^^ ERROR type arguments are not allowed on this entity [E0109]
+ //~^ ERROR type arguments are not allowed for this type [E0109]
+ //~^^ ERROR type arguments are not allowed for this type [E0109]
}
fn s_variant() {
Self::SVariant { v: () };
//~^ ERROR mismatched types [E0308]
Self::SVariant::<()> { v: () };
- //~^ ERROR type arguments are not allowed on this entity [E0109]
+ //~^ ERROR type arguments are not allowed for this type [E0109]
//~^^ ERROR mismatched types [E0308]
Self::<()>::SVariant { v: () };
- //~^ ERROR type arguments are not allowed on this entity [E0109]
+ //~^ ERROR type arguments are not allowed for this type [E0109]
//~^^ ERROR mismatched types [E0308]
Self::<()>::SVariant::<()> { v: () };
- //~^ ERROR type arguments are not allowed on this entity [E0109]
- //~^^ ERROR type arguments are not allowed on this entity [E0109]
+ //~^ ERROR type arguments are not allowed for this type [E0109]
+ //~^^ ERROR type arguments are not allowed for this type [E0109]
//~^^^ ERROR mismatched types [E0308]
}
}
@@ -38,36 +38,36 @@
// Tuple struct variant
Enum::<()>::TSVariant::<()>(());
- //~^ ERROR type arguments are not allowed on this entity [E0109]
+ //~^ ERROR type arguments are not allowed for this type [E0109]
Alias::TSVariant::<()>(());
- //~^ ERROR type arguments are not allowed on this entity [E0109]
+ //~^ ERROR type arguments are not allowed for this type [E0109]
Alias::<()>::TSVariant::<()>(());
- //~^ ERROR type arguments are not allowed on this entity [E0109]
+ //~^ ERROR type arguments are not allowed for this type [E0109]
AliasFixed::TSVariant::<()>(());
- //~^ ERROR type arguments are not allowed on this entity [E0109]
+ //~^ ERROR type arguments are not allowed for this type [E0109]
AliasFixed::<()>::TSVariant(());
//~^ ERROR wrong number of type arguments: expected 0, found 1 [E0107]
AliasFixed::<()>::TSVariant::<()>(());
- //~^ ERROR type arguments are not allowed on this entity [E0109]
+ //~^ ERROR type arguments are not allowed for this type [E0109]
//~^^ ERROR wrong number of type arguments: expected 0, found 1 [E0107]
// Struct variant
Enum::<()>::SVariant::<()> { v: () };
- //~^ ERROR type arguments are not allowed on this entity [E0109]
+ //~^ ERROR type arguments are not allowed for this type [E0109]
Alias::SVariant::<()> { v: () };
- //~^ ERROR type arguments are not allowed on this entity [E0109]
+ //~^ ERROR type arguments are not allowed for this type [E0109]
Alias::<()>::SVariant::<()> { v: () };
- //~^ ERROR type arguments are not allowed on this entity [E0109]
+ //~^ ERROR type arguments are not allowed for this type [E0109]
AliasFixed::SVariant::<()> { v: () };
- //~^ ERROR type arguments are not allowed on this entity [E0109]
+ //~^ ERROR type arguments are not allowed for this type [E0109]
AliasFixed::<()>::SVariant { v: () };
//~^ ERROR wrong number of type arguments: expected 0, found 1 [E0107]
AliasFixed::<()>::SVariant::<()> { v: () };
- //~^ ERROR type arguments are not allowed on this entity [E0109]
+ //~^ ERROR type arguments are not allowed for this type [E0109]
//~^^ ERROR wrong number of type arguments: expected 0, found 1 [E0107]
}
diff --git a/src/test/ui/enum-variant-generic-args.stderr b/src/test/ui/enum-variant-generic-args.stderr
index 4d3b576..09b9a4ee 100644
--- a/src/test/ui/enum-variant-generic-args.stderr
+++ b/src/test/ui/enum-variant-generic-args.stderr
@@ -7,13 +7,13 @@
= note: expected type `T`
found type `()`
-error[E0109]: type arguments are not allowed on this entity
+error[E0109]: type arguments are not allowed for this type
--> $DIR/enum-variant-generic-args.rs:11:27
|
LL | Self::TSVariant::<()>(());
| ^^ type argument not allowed
-error[E0109]: type arguments are not allowed on this entity
+error[E0109]: type arguments are not allowed for this type
--> $DIR/enum-variant-generic-args.rs:13:16
|
LL | Self::<()>::TSVariant(());
@@ -28,13 +28,13 @@
= note: expected type `T`
found type `()`
-error[E0109]: type arguments are not allowed on this entity
+error[E0109]: type arguments are not allowed for this type
--> $DIR/enum-variant-generic-args.rs:16:16
|
LL | Self::<()>::TSVariant::<()>(());
| ^^ type argument not allowed
-error[E0109]: type arguments are not allowed on this entity
+error[E0109]: type arguments are not allowed for this type
--> $DIR/enum-variant-generic-args.rs:16:33
|
LL | Self::<()>::TSVariant::<()>(());
@@ -49,7 +49,7 @@
= note: expected type `T`
found type `()`
-error[E0109]: type arguments are not allowed on this entity
+error[E0109]: type arguments are not allowed for this type
--> $DIR/enum-variant-generic-args.rs:24:26
|
LL | Self::SVariant::<()> { v: () };
@@ -64,7 +64,7 @@
= note: expected type `T`
found type `()`
-error[E0109]: type arguments are not allowed on this entity
+error[E0109]: type arguments are not allowed for this type
--> $DIR/enum-variant-generic-args.rs:27:16
|
LL | Self::<()>::SVariant { v: () };
@@ -79,13 +79,13 @@
= note: expected type `T`
found type `()`
-error[E0109]: type arguments are not allowed on this entity
+error[E0109]: type arguments are not allowed for this type
--> $DIR/enum-variant-generic-args.rs:30:16
|
LL | Self::<()>::SVariant::<()> { v: () };
| ^^ type argument not allowed
-error[E0109]: type arguments are not allowed on this entity
+error[E0109]: type arguments are not allowed for this type
--> $DIR/enum-variant-generic-args.rs:30:32
|
LL | Self::<()>::SVariant::<()> { v: () };
@@ -100,25 +100,25 @@
= note: expected type `T`
found type `()`
-error[E0109]: type arguments are not allowed on this entity
+error[E0109]: type arguments are not allowed for this type
--> $DIR/enum-variant-generic-args.rs:40:29
|
LL | Enum::<()>::TSVariant::<()>(());
| ^^ type argument not allowed
-error[E0109]: type arguments are not allowed on this entity
+error[E0109]: type arguments are not allowed for this type
--> $DIR/enum-variant-generic-args.rs:43:24
|
LL | Alias::TSVariant::<()>(());
| ^^ type argument not allowed
-error[E0109]: type arguments are not allowed on this entity
+error[E0109]: type arguments are not allowed for this type
--> $DIR/enum-variant-generic-args.rs:45:30
|
LL | Alias::<()>::TSVariant::<()>(());
| ^^ type argument not allowed
-error[E0109]: type arguments are not allowed on this entity
+error[E0109]: type arguments are not allowed for this type
--> $DIR/enum-variant-generic-args.rs:48:29
|
LL | AliasFixed::TSVariant::<()>(());
@@ -136,31 +136,31 @@
LL | AliasFixed::<()>::TSVariant::<()>(());
| ^^ unexpected type argument
-error[E0109]: type arguments are not allowed on this entity
+error[E0109]: type arguments are not allowed for this type
--> $DIR/enum-variant-generic-args.rs:52:35
|
LL | AliasFixed::<()>::TSVariant::<()>(());
| ^^ type argument not allowed
-error[E0109]: type arguments are not allowed on this entity
+error[E0109]: type arguments are not allowed for this type
--> $DIR/enum-variant-generic-args.rs:58:28
|
LL | Enum::<()>::SVariant::<()> { v: () };
| ^^ type argument not allowed
-error[E0109]: type arguments are not allowed on this entity
+error[E0109]: type arguments are not allowed for this type
--> $DIR/enum-variant-generic-args.rs:61:23
|
LL | Alias::SVariant::<()> { v: () };
| ^^ type argument not allowed
-error[E0109]: type arguments are not allowed on this entity
+error[E0109]: type arguments are not allowed for this type
--> $DIR/enum-variant-generic-args.rs:63:29
|
LL | Alias::<()>::SVariant::<()> { v: () };
| ^^ type argument not allowed
-error[E0109]: type arguments are not allowed on this entity
+error[E0109]: type arguments are not allowed for this type
--> $DIR/enum-variant-generic-args.rs:66:28
|
LL | AliasFixed::SVariant::<()> { v: () };
@@ -178,7 +178,7 @@
LL | AliasFixed::<()>::SVariant::<()> { v: () };
| ^^ unexpected type argument
-error[E0109]: type arguments are not allowed on this entity
+error[E0109]: type arguments are not allowed for this type
--> $DIR/enum-variant-generic-args.rs:70:34
|
LL | AliasFixed::<()>::SVariant::<()> { v: () };
diff --git a/src/test/ui/error-codes/E0109.stderr b/src/test/ui/error-codes/E0109.stderr
index a807f2d..577e286 100644
--- a/src/test/ui/error-codes/E0109.stderr
+++ b/src/test/ui/error-codes/E0109.stderr
@@ -1,4 +1,4 @@
-error[E0109]: type arguments are not allowed on this entity
+error[E0109]: type arguments are not allowed for this type
--> $DIR/E0109.rs:1:14
|
LL | type X = u32<i32>;
diff --git a/src/test/ui/error-codes/E0110.rs b/src/test/ui/error-codes/E0110.rs
index 764b62b..314c7f5 100644
--- a/src/test/ui/error-codes/E0110.rs
+++ b/src/test/ui/error-codes/E0110.rs
@@ -1,3 +1,3 @@
-type X = u32<'static>; //~ ERROR E0110
+type X = u32<'static>; //~ ERROR E0109
fn main() {}
diff --git a/src/test/ui/error-codes/E0110.stderr b/src/test/ui/error-codes/E0110.stderr
index 3bc4775..b022131 100644
--- a/src/test/ui/error-codes/E0110.stderr
+++ b/src/test/ui/error-codes/E0110.stderr
@@ -1,4 +1,4 @@
-error[E0110]: lifetime arguments are not allowed on this entity
+error[E0109]: lifetime arguments are not allowed for this type
--> $DIR/E0110.rs:1:14
|
LL | type X = u32<'static>;
@@ -6,4 +6,4 @@
error: aborting due to previous error
-For more information about this error, try `rustc --explain E0110`.
+For more information about this error, try `rustc --explain E0109`.
diff --git a/src/test/ui/glob-resolve1.stderr b/src/test/ui/glob-resolve1.stderr
index 01730c4..c252a6e 100644
--- a/src/test/ui/glob-resolve1.stderr
+++ b/src/test/ui/glob-resolve1.stderr
@@ -22,10 +22,7 @@
--> $DIR/glob-resolve1.rs:24:5
|
LL | B;
- | ^
- |
- = note: did you mean to use one of the following variants?
- - `B::B1`
+ | ^ help: try using the enum's variant: `B::B1`
error[E0425]: cannot find value `C` in this scope
--> $DIR/glob-resolve1.rs:25:5
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-22706.rs b/src/test/ui/issues/issue-22706.rs
index 413a0d9..28e8a72 100644
--- a/src/test/ui/issues/issue-22706.rs
+++ b/src/test/ui/issues/issue-22706.rs
@@ -1,3 +1,3 @@
fn is_copy<T: ::std::marker<i32>::Copy>() {}
-//~^ ERROR type arguments are not allowed on this entity [E0109]
+//~^ ERROR type arguments are not allowed for this type [E0109]
fn main() {}
diff --git a/src/test/ui/issues/issue-22706.stderr b/src/test/ui/issues/issue-22706.stderr
index a3cf716..c592939 100644
--- a/src/test/ui/issues/issue-22706.stderr
+++ b/src/test/ui/issues/issue-22706.stderr
@@ -1,4 +1,4 @@
-error[E0109]: type arguments are not allowed on this entity
+error[E0109]: type arguments are not allowed for this type
--> $DIR/issue-22706.rs:1:29
|
LL | fn is_copy<T: ::std::marker<i32>::Copy>() {}
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/mod-subitem-as-enum-variant.rs b/src/test/ui/mod-subitem-as-enum-variant.rs
index ec809d4..cd4459a 100644
--- a/src/test/ui/mod-subitem-as-enum-variant.rs
+++ b/src/test/ui/mod-subitem-as-enum-variant.rs
@@ -6,5 +6,5 @@
fn main() {
Mod::FakeVariant::<i32>(0);
Mod::<i32>::FakeVariant(0);
- //~^ ERROR type arguments are not allowed on this entity [E0109]
+ //~^ ERROR type arguments are not allowed for this type [E0109]
}
diff --git a/src/test/ui/mod-subitem-as-enum-variant.stderr b/src/test/ui/mod-subitem-as-enum-variant.stderr
index d62bad8..72eca58 100644
--- a/src/test/ui/mod-subitem-as-enum-variant.stderr
+++ b/src/test/ui/mod-subitem-as-enum-variant.stderr
@@ -1,4 +1,4 @@
-error[E0109]: type arguments are not allowed on this entity
+error[E0109]: type arguments are not allowed for this type
--> $DIR/mod-subitem-as-enum-variant.rs:8:11
|
LL | Mod::<i32>::FakeVariant(0);
diff --git a/src/test/ui/parser/byte-literals.stderr b/src/test/ui/parser/byte-literals.stderr
index 36cb017..4edeccf 100644
--- a/src/test/ui/parser/byte-literals.stderr
+++ b/src/test/ui/parser/byte-literals.stderr
@@ -2,13 +2,13 @@
--> $DIR/byte-literals.rs:6:21
|
LL | static FOO: u8 = b'/f';
- | ^
+ | ^ unknown byte escape
error: unknown byte escape: f
--> $DIR/byte-literals.rs:9:8
|
LL | b'/f';
- | ^
+ | ^ unknown byte escape
error: invalid character in numeric character escape: Z
--> $DIR/byte-literals.rs:10:10
diff --git a/src/test/ui/parser/byte-string-literals.stderr b/src/test/ui/parser/byte-string-literals.stderr
index 2e9b13b..45c1a94 100644
--- a/src/test/ui/parser/byte-string-literals.stderr
+++ b/src/test/ui/parser/byte-string-literals.stderr
@@ -2,13 +2,13 @@
--> $DIR/byte-string-literals.rs:6:32
|
LL | static FOO: &'static [u8] = b"/f";
- | ^
+ | ^ unknown byte escape
error: unknown byte escape: f
--> $DIR/byte-string-literals.rs:9:8
|
LL | b"/f";
- | ^
+ | ^ unknown byte escape
error: invalid character in numeric character escape: Z
--> $DIR/byte-string-literals.rs:10:10
diff --git a/src/test/ui/parser/issue-23620-invalid-escapes.stderr b/src/test/ui/parser/issue-23620-invalid-escapes.stderr
index f6e476a..669a6d2 100644
--- a/src/test/ui/parser/issue-23620-invalid-escapes.stderr
+++ b/src/test/ui/parser/issue-23620-invalid-escapes.stderr
@@ -14,13 +14,9 @@
--> $DIR/issue-23620-invalid-escapes.rs:10:15
|
LL | let _ = b'/u';
- | ^^
+ | ^^ incorrect unicode escape sequence
|
-help: format of unicode escape sequences is `/u{...}`
- --> $DIR/issue-23620-invalid-escapes.rs:10:15
- |
-LL | let _ = b'/u';
- | ^^
+ = help: format of unicode escape sequences is `/u{...}`
error: unicode escape sequences cannot be used as a byte or in a byte string
--> $DIR/issue-23620-invalid-escapes.rs:10:15
@@ -80,13 +76,9 @@
--> $DIR/issue-23620-invalid-escapes.rs:28:28
|
LL | let _ = b"/u{a4a4} /xf /u";
- | ^^
+ | ^^ incorrect unicode escape sequence
|
-help: format of unicode escape sequences is `/u{...}`
- --> $DIR/issue-23620-invalid-escapes.rs:28:28
- |
-LL | let _ = b"/u{a4a4} /xf /u";
- | ^^
+ = help: format of unicode escape sequences is `/u{...}`
error: unicode escape sequences cannot be used as a byte or in a byte string
--> $DIR/issue-23620-invalid-escapes.rs:28:28
@@ -110,13 +102,9 @@
--> $DIR/issue-23620-invalid-escapes.rs:34:18
|
LL | let _ = "/xf /u";
- | ^^
+ | ^^ incorrect unicode escape sequence
|
-help: format of unicode escape sequences is `/u{...}`
- --> $DIR/issue-23620-invalid-escapes.rs:34:18
- |
-LL | let _ = "/xf /u";
- | ^^
+ = help: format of unicode escape sequences is `/u{...}`
error: incorrect unicode escape sequence
--> $DIR/issue-23620-invalid-escapes.rs:39:14
diff --git a/src/test/ui/parser/lex-bad-char-literals-1.stderr b/src/test/ui/parser/lex-bad-char-literals-1.stderr
index 3c8550e..e6b7110 100644
--- a/src/test/ui/parser/lex-bad-char-literals-1.stderr
+++ b/src/test/ui/parser/lex-bad-char-literals-1.stderr
@@ -14,13 +14,13 @@
--> $DIR/lex-bad-char-literals-1.rs:11:7
|
LL | '/●'
- | ^
+ | ^ unknown character escape
error: unknown character escape: /u{25cf}
--> $DIR/lex-bad-char-literals-1.rs:15:7
|
LL | "/●"
- | ^
+ | ^ unknown character escape
error: aborting due to 4 previous errors
diff --git a/src/test/ui/parser/lex-bare-cr-string-literal-doc-comment.stderr b/src/test/ui/parser/lex-bare-cr-string-literal-doc-comment.stderr
index 19117bf..b4d538b 100644
--- a/src/test/ui/parser/lex-bare-cr-string-literal-doc-comment.stderr
+++ b/src/test/ui/parser/lex-bare-cr-string-literal-doc-comment.stderr
Binary files differ
diff --git a/src/test/ui/parser/pat-tuple-3.stderr b/src/test/ui/parser/pat-tuple-3.stderr
index 0ad7d27..c9f14bb 100644
--- a/src/test/ui/parser/pat-tuple-3.stderr
+++ b/src/test/ui/parser/pat-tuple-3.stderr
@@ -2,7 +2,9 @@
--> $DIR/pat-tuple-3.rs:3:19
|
LL | (.., pat, ..) => {}
- | ^^ can only be used once per pattern
+ | -- ^^ can only be used once per pattern
+ | |
+ | previously present here
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/trailing-carriage-return-in-string.stderr b/src/test/ui/parser/trailing-carriage-return-in-string.stderr
index 972e429..f70f8ac 100644
--- a/src/test/ui/parser/trailing-carriage-return-in-string.stderr
+++ b/src/test/ui/parser/trailing-carriage-return-in-string.stderr
Binary files differ
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/parser/wrong-escape-of-curly-braces.stderr b/src/test/ui/parser/wrong-escape-of-curly-braces.stderr
index 90debfc..346eba0 100644
--- a/src/test/ui/parser/wrong-escape-of-curly-braces.stderr
+++ b/src/test/ui/parser/wrong-escape-of-curly-braces.stderr
@@ -2,25 +2,17 @@
--> $DIR/wrong-escape-of-curly-braces.rs:3:17
|
LL | let bad = "/{it is wrong/}";
- | ^
+ | ^ unknown character escape
|
-help: if used in a formatting string, curly braces are escaped with `{{` and `}}`
- --> $DIR/wrong-escape-of-curly-braces.rs:3:17
- |
-LL | let bad = "/{it is wrong/}";
- | ^
+ = help: if used in a formatting string, curly braces are escaped with `{{` and `}}`
error: unknown character escape: }
--> $DIR/wrong-escape-of-curly-braces.rs:3:30
|
LL | let bad = "/{it is wrong/}";
- | ^
+ | ^ unknown character escape
|
-help: if used in a formatting string, curly braces are escaped with `{{` and `}}`
- --> $DIR/wrong-escape-of-curly-braces.rs:3:30
- |
-LL | let bad = "/{it is wrong/}";
- | ^
+ = help: if used in a formatting string, curly braces are escaped with `{{` and `}}`
error: aborting due to 2 previous errors
diff --git a/src/test/ui/prim-with-args.rs b/src/test/ui/prim-with-args.rs
index b5df0fb..e5beaca 100644
--- a/src/test/ui/prim-with-args.rs
+++ b/src/test/ui/prim-with-args.rs
@@ -1,27 +1,27 @@
fn main() {
-let x: isize<isize>; //~ ERROR type arguments are not allowed on this entity
-let x: i8<isize>; //~ ERROR type arguments are not allowed on this entity
-let x: i16<isize>; //~ ERROR type arguments are not allowed on this entity
-let x: i32<isize>; //~ ERROR type arguments are not allowed on this entity
-let x: i64<isize>; //~ ERROR type arguments are not allowed on this entity
-let x: usize<isize>; //~ ERROR type arguments are not allowed on this entity
-let x: u8<isize>; //~ ERROR type arguments are not allowed on this entity
-let x: u16<isize>; //~ ERROR type arguments are not allowed on this entity
-let x: u32<isize>; //~ ERROR type arguments are not allowed on this entity
-let x: u64<isize>; //~ ERROR type arguments are not allowed on this entity
-let x: char<isize>; //~ ERROR type arguments are not allowed on this entity
+let x: isize<isize>; //~ ERROR type arguments are not allowed for this type
+let x: i8<isize>; //~ ERROR type arguments are not allowed for this type
+let x: i16<isize>; //~ ERROR type arguments are not allowed for this type
+let x: i32<isize>; //~ ERROR type arguments are not allowed for this type
+let x: i64<isize>; //~ ERROR type arguments are not allowed for this type
+let x: usize<isize>; //~ ERROR type arguments are not allowed for this type
+let x: u8<isize>; //~ ERROR type arguments are not allowed for this type
+let x: u16<isize>; //~ ERROR type arguments are not allowed for this type
+let x: u32<isize>; //~ ERROR type arguments are not allowed for this type
+let x: u64<isize>; //~ ERROR type arguments are not allowed for this type
+let x: char<isize>; //~ ERROR type arguments are not allowed for this type
-let x: isize<'static>; //~ ERROR lifetime arguments are not allowed on this entity
-let x: i8<'static>; //~ ERROR lifetime arguments are not allowed on this entity
-let x: i16<'static>; //~ ERROR lifetime arguments are not allowed on this entity
-let x: i32<'static>; //~ ERROR lifetime arguments are not allowed on this entity
-let x: i64<'static>; //~ ERROR lifetime arguments are not allowed on this entity
-let x: usize<'static>; //~ ERROR lifetime arguments are not allowed on this entity
-let x: u8<'static>; //~ ERROR lifetime arguments are not allowed on this entity
-let x: u16<'static>; //~ ERROR lifetime arguments are not allowed on this entity
-let x: u32<'static>; //~ ERROR lifetime arguments are not allowed on this entity
-let x: u64<'static>; //~ ERROR lifetime arguments are not allowed on this entity
-let x: char<'static>; //~ ERROR lifetime arguments are not allowed on this entity
+let x: isize<'static>; //~ ERROR lifetime arguments are not allowed for this type
+let x: i8<'static>; //~ ERROR lifetime arguments are not allowed for this type
+let x: i16<'static>; //~ ERROR lifetime arguments are not allowed for this type
+let x: i32<'static>; //~ ERROR lifetime arguments are not allowed for this type
+let x: i64<'static>; //~ ERROR lifetime arguments are not allowed for this type
+let x: usize<'static>; //~ ERROR lifetime arguments are not allowed for this type
+let x: u8<'static>; //~ ERROR lifetime arguments are not allowed for this type
+let x: u16<'static>; //~ ERROR lifetime arguments are not allowed for this type
+let x: u32<'static>; //~ ERROR lifetime arguments are not allowed for this type
+let x: u64<'static>; //~ ERROR lifetime arguments are not allowed for this type
+let x: char<'static>; //~ ERROR lifetime arguments are not allowed for this type
}
diff --git a/src/test/ui/prim-with-args.stderr b/src/test/ui/prim-with-args.stderr
index 4535633..4bde981 100644
--- a/src/test/ui/prim-with-args.stderr
+++ b/src/test/ui/prim-with-args.stderr
@@ -1,130 +1,130 @@
-error[E0109]: type arguments are not allowed on this entity
+error[E0109]: type arguments are not allowed for this type
--> $DIR/prim-with-args.rs:3:14
|
LL | let x: isize<isize>;
| ^^^^^ type argument not allowed
-error[E0109]: type arguments are not allowed on this entity
+error[E0109]: type arguments are not allowed for this type
--> $DIR/prim-with-args.rs:4:11
|
LL | let x: i8<isize>;
| ^^^^^ type argument not allowed
-error[E0109]: type arguments are not allowed on this entity
+error[E0109]: type arguments are not allowed for this type
--> $DIR/prim-with-args.rs:5:12
|
LL | let x: i16<isize>;
| ^^^^^ type argument not allowed
-error[E0109]: type arguments are not allowed on this entity
+error[E0109]: type arguments are not allowed for this type
--> $DIR/prim-with-args.rs:6:12
|
LL | let x: i32<isize>;
| ^^^^^ type argument not allowed
-error[E0109]: type arguments are not allowed on this entity
+error[E0109]: type arguments are not allowed for this type
--> $DIR/prim-with-args.rs:7:12
|
LL | let x: i64<isize>;
| ^^^^^ type argument not allowed
-error[E0109]: type arguments are not allowed on this entity
+error[E0109]: type arguments are not allowed for this type
--> $DIR/prim-with-args.rs:8:14
|
LL | let x: usize<isize>;
| ^^^^^ type argument not allowed
-error[E0109]: type arguments are not allowed on this entity
+error[E0109]: type arguments are not allowed for this type
--> $DIR/prim-with-args.rs:9:11
|
LL | let x: u8<isize>;
| ^^^^^ type argument not allowed
-error[E0109]: type arguments are not allowed on this entity
+error[E0109]: type arguments are not allowed for this type
--> $DIR/prim-with-args.rs:10:12
|
LL | let x: u16<isize>;
| ^^^^^ type argument not allowed
-error[E0109]: type arguments are not allowed on this entity
+error[E0109]: type arguments are not allowed for this type
--> $DIR/prim-with-args.rs:11:12
|
LL | let x: u32<isize>;
| ^^^^^ type argument not allowed
-error[E0109]: type arguments are not allowed on this entity
+error[E0109]: type arguments are not allowed for this type
--> $DIR/prim-with-args.rs:12:12
|
LL | let x: u64<isize>;
| ^^^^^ type argument not allowed
-error[E0109]: type arguments are not allowed on this entity
+error[E0109]: type arguments are not allowed for this type
--> $DIR/prim-with-args.rs:13:13
|
LL | let x: char<isize>;
| ^^^^^ type argument not allowed
-error[E0110]: lifetime arguments are not allowed on this entity
+error[E0109]: lifetime arguments are not allowed for this type
--> $DIR/prim-with-args.rs:15:14
|
LL | let x: isize<'static>;
| ^^^^^^^ lifetime argument not allowed
-error[E0110]: lifetime arguments are not allowed on this entity
+error[E0109]: lifetime arguments are not allowed for this type
--> $DIR/prim-with-args.rs:16:11
|
LL | let x: i8<'static>;
| ^^^^^^^ lifetime argument not allowed
-error[E0110]: lifetime arguments are not allowed on this entity
+error[E0109]: lifetime arguments are not allowed for this type
--> $DIR/prim-with-args.rs:17:12
|
LL | let x: i16<'static>;
| ^^^^^^^ lifetime argument not allowed
-error[E0110]: lifetime arguments are not allowed on this entity
+error[E0109]: lifetime arguments are not allowed for this type
--> $DIR/prim-with-args.rs:18:12
|
LL | let x: i32<'static>;
| ^^^^^^^ lifetime argument not allowed
-error[E0110]: lifetime arguments are not allowed on this entity
+error[E0109]: lifetime arguments are not allowed for this type
--> $DIR/prim-with-args.rs:19:12
|
LL | let x: i64<'static>;
| ^^^^^^^ lifetime argument not allowed
-error[E0110]: lifetime arguments are not allowed on this entity
+error[E0109]: lifetime arguments are not allowed for this type
--> $DIR/prim-with-args.rs:20:14
|
LL | let x: usize<'static>;
| ^^^^^^^ lifetime argument not allowed
-error[E0110]: lifetime arguments are not allowed on this entity
+error[E0109]: lifetime arguments are not allowed for this type
--> $DIR/prim-with-args.rs:21:11
|
LL | let x: u8<'static>;
| ^^^^^^^ lifetime argument not allowed
-error[E0110]: lifetime arguments are not allowed on this entity
+error[E0109]: lifetime arguments are not allowed for this type
--> $DIR/prim-with-args.rs:22:12
|
LL | let x: u16<'static>;
| ^^^^^^^ lifetime argument not allowed
-error[E0110]: lifetime arguments are not allowed on this entity
+error[E0109]: lifetime arguments are not allowed for this type
--> $DIR/prim-with-args.rs:23:12
|
LL | let x: u32<'static>;
| ^^^^^^^ lifetime argument not allowed
-error[E0110]: lifetime arguments are not allowed on this entity
+error[E0109]: lifetime arguments are not allowed for this type
--> $DIR/prim-with-args.rs:24:12
|
LL | let x: u64<'static>;
| ^^^^^^^ lifetime argument not allowed
-error[E0110]: lifetime arguments are not allowed on this entity
+error[E0109]: lifetime arguments are not allowed for this type
--> $DIR/prim-with-args.rs:25:13
|
LL | let x: char<'static>;
@@ -132,5 +132,4 @@
error: aborting due to 22 previous errors
-Some errors occurred: E0109, E0110.
-For more information about an error, try `rustc --explain E0109`.
+For more information about this error, try `rustc --explain E0109`.
diff --git a/src/test/ui/qualified/qualified-path-params-2.rs b/src/test/ui/qualified/qualified-path-params-2.rs
index 8412983..ebdd749 100644
--- a/src/test/ui/qualified/qualified-path-params-2.rs
+++ b/src/test/ui/qualified/qualified-path-params-2.rs
@@ -16,7 +16,7 @@
}
type A = <S as Tr>::A::f<u8>;
-//~^ ERROR type arguments are not allowed on this entity
+//~^ ERROR type arguments are not allowed for this type
//~| ERROR ambiguous associated type
fn main() {}
diff --git a/src/test/ui/qualified/qualified-path-params-2.stderr b/src/test/ui/qualified/qualified-path-params-2.stderr
index 4e07384..2d14d6c 100644
--- a/src/test/ui/qualified/qualified-path-params-2.stderr
+++ b/src/test/ui/qualified/qualified-path-params-2.stderr
@@ -1,4 +1,4 @@
-error[E0109]: type arguments are not allowed on this entity
+error[E0109]: type arguments are not allowed for this type
--> $DIR/qualified-path-params-2.rs:18:26
|
LL | type A = <S as Tr>::A::f<u8>;
diff --git a/src/test/ui/resolve/privacy-enum-ctor.stderr b/src/test/ui/resolve/privacy-enum-ctor.stderr
index 01f0941..75d9c97 100644
--- a/src/test/ui/resolve/privacy-enum-ctor.stderr
+++ b/src/test/ui/resolve/privacy-enum-ctor.stderr
@@ -3,22 +3,32 @@
|
LL | n::Z;
| ^^^^
+help: try using one of the enum's variants
|
- = note: did you mean to use one of the following variants?
- - `m::Z::Fn`
- - `m::Z::Struct`
- - `m::Z::Unit`
+LL | m::Z::Fn;
+ | ^^^^^^^^
+LL | m::Z::Struct;
+ | ^^^^^^^^^^^^
+LL | m::Z::Unit;
+ | ^^^^^^^^^^
error[E0423]: expected value, found enum `Z`
--> $DIR/privacy-enum-ctor.rs:25:9
|
LL | Z;
- | ^ help: a function with a similar name exists: `f`
+ | ^
+help: a function with a similar name exists
|
- = note: did you mean to use one of the following variants?
- - `m::Z::Fn`
- - `m::Z::Struct`
- - `m::Z::Unit`
+LL | f;
+ | ^
+help: try using one of the enum's variants
+ |
+LL | m::Z::Fn;
+ | ^^^^^^^^
+LL | m::Z::Struct;
+ | ^^^^^^^^^^^^
+LL | m::Z::Unit;
+ | ^^^^^^^^^^
error[E0423]: expected value, found struct variant `Z::Struct`
--> $DIR/privacy-enum-ctor.rs:29:20
@@ -31,15 +41,18 @@
|
LL | let _: E = m::E;
| ^^^^
- |
- = note: did you mean to use one of the following variants?
- - `E::Fn`
- - `E::Struct`
- - `E::Unit`
help: a function with a similar name exists
|
LL | let _: E = m::f;
| ^
+help: try using one of the enum's variants
+ |
+LL | let _: E = E::Fn;
+ | ^^^^^
+LL | let _: E = E::Struct;
+ | ^^^^^^^^^
+LL | let _: E = E::Unit;
+ | ^^^^^^^
help: possible better candidates are found in other modules, you can import them into scope
|
LL | use std::f32::consts::E;
@@ -58,11 +71,14 @@
|
LL | let _: E = E;
| ^
+help: try using one of the enum's variants
|
- = note: did you mean to use one of the following variants?
- - `E::Fn`
- - `E::Struct`
- - `E::Unit`
+LL | let _: E = E::Fn;
+ | ^^^^^
+LL | let _: E = E::Struct;
+ | ^^^^^^^^^
+LL | let _: E = E::Unit;
+ | ^^^^^^^
help: possible better candidates are found in other modules, you can import them into scope
|
LL | use std::f32::consts::E;
@@ -95,11 +111,14 @@
|
LL | let _: Z = m::n::Z;
| ^^^^^^^
+help: try using one of the enum's variants
|
- = note: did you mean to use one of the following variants?
- - `m::Z::Fn`
- - `m::Z::Struct`
- - `m::Z::Unit`
+LL | let _: Z = m::Z::Fn;
+ | ^^^^^^^^
+LL | let _: Z = m::Z::Struct;
+ | ^^^^^^^^^^^^
+LL | let _: Z = m::Z::Unit;
+ | ^^^^^^^^^^
error[E0412]: cannot find type `Z` in this scope
--> $DIR/privacy-enum-ctor.rs:61:12
diff --git a/src/test/ui/rfc1598-generic-associated-types/collections.rs b/src/test/ui/rfc1598-generic-associated-types/collections.rs
index 5414bb4..ede6a3b 100644
--- a/src/test/ui/rfc1598-generic-associated-types/collections.rs
+++ b/src/test/ui/rfc1598-generic-associated-types/collections.rs
@@ -2,7 +2,7 @@
//~^ WARNING the feature `generic_associated_types` is incomplete
#![feature(associated_type_defaults)]
-// FIXME(#44265): "lifetime arguments are not allowed on this entity" errors will be addressed in a
+// FIXME(#44265): "lifetime arguments are not allowed for this type" errors will be addressed in a
// follow-up PR.
// A Collection trait and collection families. Based on
@@ -15,14 +15,14 @@
// Test associated type defaults with parameters
type Sibling<U>: Collection<U> =
<<Self as Collection<T>>::Family as CollectionFamily>::Member<U>;
- //~^ ERROR type arguments are not allowed on this entity [E0109]
+ //~^ ERROR type arguments are not allowed for this type [E0109]
fn empty() -> Self;
fn add(&mut self, value: T);
fn iterate<'iter>(&'iter self) -> Self::Iter<'iter>;
- //~^ ERROR lifetime arguments are not allowed on this entity [E0110]
+ //~^ ERROR lifetime arguments are not allowed for this type [E0109]
}
trait CollectionFamily {
@@ -48,13 +48,13 @@
}
fn iterate<'iter>(&'iter self) -> Self::Iter<'iter> {
- //~^ ERROR lifetime arguments are not allowed on this entity [E0110]
+ //~^ ERROR lifetime arguments are not allowed for this type [E0109]
self.iter()
}
}
fn floatify<C>(ints: &C) -> <<C as Collection<i32>>::Family as CollectionFamily>::Member<f32>
-//~^ ERROR type arguments are not allowed on this entity [E0109]
+//~^ ERROR type arguments are not allowed for this type [E0109]
where
C: Collection<i32>,
{
@@ -66,7 +66,7 @@
}
fn floatify_sibling<C>(ints: &C) -> <C as Collection<i32>>::Sibling<f32>
-//~^ ERROR type arguments are not allowed on this entity [E0109]
+//~^ ERROR type arguments are not allowed for this type [E0109]
where
C: Collection<i32>,
{
diff --git a/src/test/ui/rfc1598-generic-associated-types/collections.stderr b/src/test/ui/rfc1598-generic-associated-types/collections.stderr
index eeed04b..d0fe503 100644
--- a/src/test/ui/rfc1598-generic-associated-types/collections.stderr
+++ b/src/test/ui/rfc1598-generic-associated-types/collections.stderr
@@ -4,31 +4,31 @@
LL | #![feature(generic_associated_types)]
| ^^^^^^^^^^^^^^^^^^^^^^^^
-error[E0109]: type arguments are not allowed on this entity
+error[E0109]: type arguments are not allowed for this type
--> $DIR/collections.rs:56:90
|
LL | fn floatify<C>(ints: &C) -> <<C as Collection<i32>>::Family as CollectionFamily>::Member<f32>
| ^^^ type argument not allowed
-error[E0109]: type arguments are not allowed on this entity
+error[E0109]: type arguments are not allowed for this type
--> $DIR/collections.rs:68:69
|
LL | fn floatify_sibling<C>(ints: &C) -> <C as Collection<i32>>::Sibling<f32>
| ^^^ type argument not allowed
-error[E0109]: type arguments are not allowed on this entity
+error[E0109]: type arguments are not allowed for this type
--> $DIR/collections.rs:17:71
|
LL | <<Self as Collection<T>>::Family as CollectionFamily>::Member<U>;
| ^ type argument not allowed
-error[E0110]: lifetime arguments are not allowed on this entity
+error[E0109]: lifetime arguments are not allowed for this type
--> $DIR/collections.rs:24:50
|
LL | fn iterate<'iter>(&'iter self) -> Self::Iter<'iter>;
| ^^^^^ lifetime argument not allowed
-error[E0110]: lifetime arguments are not allowed on this entity
+error[E0109]: lifetime arguments are not allowed for this type
--> $DIR/collections.rs:50:50
|
LL | fn iterate<'iter>(&'iter self) -> Self::Iter<'iter> {
@@ -36,5 +36,4 @@
error: aborting due to 5 previous errors
-Some errors occurred: E0109, E0110.
-For more information about an error, try `rustc --explain E0109`.
+For more information about this error, try `rustc --explain E0109`.
diff --git a/src/test/ui/rfc1598-generic-associated-types/construct_with_other_type.rs b/src/test/ui/rfc1598-generic-associated-types/construct_with_other_type.rs
index d9c482e..3a459a4 100644
--- a/src/test/ui/rfc1598-generic-associated-types/construct_with_other_type.rs
+++ b/src/test/ui/rfc1598-generic-associated-types/construct_with_other_type.rs
@@ -3,7 +3,7 @@
use std::ops::Deref;
-// FIXME(#44265): "lifetime arguments are not allowed on this entity" errors will be addressed in a
+// FIXME(#44265): "lifetime arguments are not allowed for this type" errors will be addressed in a
// follow-up PR.
trait Foo {
@@ -15,15 +15,15 @@
// This weird type tests that we can use universal function call syntax to access the Item on
type Baa<'a>: Deref<Target = <Self::Quux<'a> as Foo>::Bar<'a, 'static>>;
- //~^ ERROR lifetime arguments are not allowed on this entity [E0110]
- //~| ERROR lifetime arguments are not allowed on this entity [E0110]
+ //~^ ERROR lifetime arguments are not allowed for this type [E0109]
+ //~| ERROR lifetime arguments are not allowed for this type [E0109]
}
impl<T> Baz for T where T: Foo {
type Quux<'a> = T;
type Baa<'a> = &'a <T as Foo>::Bar<'a, 'static>;
- //~^ ERROR lifetime arguments are not allowed on this entity [E0110]
+ //~^ ERROR lifetime arguments are not allowed for this type [E0109]
}
fn main() {}
diff --git a/src/test/ui/rfc1598-generic-associated-types/construct_with_other_type.stderr b/src/test/ui/rfc1598-generic-associated-types/construct_with_other_type.stderr
index fd6116d..b2dd523 100644
--- a/src/test/ui/rfc1598-generic-associated-types/construct_with_other_type.stderr
+++ b/src/test/ui/rfc1598-generic-associated-types/construct_with_other_type.stderr
@@ -4,19 +4,19 @@
LL | #![feature(generic_associated_types)]
| ^^^^^^^^^^^^^^^^^^^^^^^^
-error[E0110]: lifetime arguments are not allowed on this entity
+error[E0109]: lifetime arguments are not allowed for this type
--> $DIR/construct_with_other_type.rs:17:46
|
LL | type Baa<'a>: Deref<Target = <Self::Quux<'a> as Foo>::Bar<'a, 'static>>;
| ^^ lifetime argument not allowed
-error[E0110]: lifetime arguments are not allowed on this entity
+error[E0109]: lifetime arguments are not allowed for this type
--> $DIR/construct_with_other_type.rs:17:63
|
LL | type Baa<'a>: Deref<Target = <Self::Quux<'a> as Foo>::Bar<'a, 'static>>;
| ^^ lifetime argument not allowed
-error[E0110]: lifetime arguments are not allowed on this entity
+error[E0109]: lifetime arguments are not allowed for this type
--> $DIR/construct_with_other_type.rs:25:40
|
LL | type Baa<'a> = &'a <T as Foo>::Bar<'a, 'static>;
@@ -24,4 +24,4 @@
error: aborting due to 3 previous errors
-For more information about this error, try `rustc --explain E0110`.
+For more information about this error, try `rustc --explain E0109`.
diff --git a/src/test/ui/rfc1598-generic-associated-types/generic_associated_type_undeclared_lifetimes.rs b/src/test/ui/rfc1598-generic-associated-types/generic_associated_type_undeclared_lifetimes.rs
index 2e6d747..150899a 100644
--- a/src/test/ui/rfc1598-generic-associated-types/generic_associated_type_undeclared_lifetimes.rs
+++ b/src/test/ui/rfc1598-generic-associated-types/generic_associated_type_undeclared_lifetimes.rs
@@ -3,20 +3,20 @@
use std::ops::Deref;
-// FIXME(#44265): "lifetime arguments are not allowed on this entity" errors will be addressed in a
+// FIXME(#44265): "lifetime arguments are not allowed for this type" errors will be addressed in a
// follow-up PR.
trait Iterable {
type Item<'a>;
type Iter<'a>: Iterator<Item = Self::Item<'a>>
- //~^ ERROR lifetime arguments are not allowed on this entity [E0110]
+ //~^ ERROR lifetime arguments are not allowed for this type [E0109]
+ Deref<Target = Self::Item<'b>>;
//~^ ERROR undeclared lifetime
- //~| ERROR lifetime arguments are not allowed on this entity [E0110]
+ //~| ERROR lifetime arguments are not allowed for this type [E0109]
fn iter<'a>(&'a self) -> Self::Iter<'undeclared>;
//~^ ERROR undeclared lifetime
- //~| ERROR lifetime arguments are not allowed on this entity [E0110]
+ //~| ERROR lifetime arguments are not allowed for this type [E0109]
}
fn main() {}
diff --git a/src/test/ui/rfc1598-generic-associated-types/generic_associated_type_undeclared_lifetimes.stderr b/src/test/ui/rfc1598-generic-associated-types/generic_associated_type_undeclared_lifetimes.stderr
index 3cebab6..d65edc6 100644
--- a/src/test/ui/rfc1598-generic-associated-types/generic_associated_type_undeclared_lifetimes.stderr
+++ b/src/test/ui/rfc1598-generic-associated-types/generic_associated_type_undeclared_lifetimes.stderr
@@ -16,19 +16,19 @@
LL | fn iter<'a>(&'a self) -> Self::Iter<'undeclared>;
| ^^^^^^^^^^^ undeclared lifetime
-error[E0110]: lifetime arguments are not allowed on this entity
+error[E0109]: lifetime arguments are not allowed for this type
--> $DIR/generic_associated_type_undeclared_lifetimes.rs:11:47
|
LL | type Iter<'a>: Iterator<Item = Self::Item<'a>>
| ^^ lifetime argument not allowed
-error[E0110]: lifetime arguments are not allowed on this entity
+error[E0109]: lifetime arguments are not allowed for this type
--> $DIR/generic_associated_type_undeclared_lifetimes.rs:13:37
|
LL | + Deref<Target = Self::Item<'b>>;
| ^^ lifetime argument not allowed
-error[E0110]: lifetime arguments are not allowed on this entity
+error[E0109]: lifetime arguments are not allowed for this type
--> $DIR/generic_associated_type_undeclared_lifetimes.rs:17:41
|
LL | fn iter<'a>(&'a self) -> Self::Iter<'undeclared>;
@@ -36,5 +36,5 @@
error: aborting due to 5 previous errors
-Some errors occurred: E0110, E0261.
-For more information about an error, try `rustc --explain E0110`.
+Some errors occurred: E0109, E0261.
+For more information about an error, try `rustc --explain E0109`.
diff --git a/src/test/ui/rfc1598-generic-associated-types/iterable.rs b/src/test/ui/rfc1598-generic-associated-types/iterable.rs
index 6925850..29953b9 100644
--- a/src/test/ui/rfc1598-generic-associated-types/iterable.rs
+++ b/src/test/ui/rfc1598-generic-associated-types/iterable.rs
@@ -3,16 +3,16 @@
use std::ops::Deref;
-// FIXME(#44265): "lifetime arguments are not allowed on this entity" errors will be addressed in a
+// FIXME(#44265): "lifetime arguments are not allowed for this type" errors will be addressed in a
// follow-up PR.
trait Iterable {
type Item<'a>;
type Iter<'a>: Iterator<Item = Self::Item<'a>>;
- //~^ ERROR lifetime arguments are not allowed on this entity [E0110]
+ //~^ ERROR lifetime arguments are not allowed for this type [E0109]
fn iter<'a>(&'a self) -> Self::Iter<'a>;
- //~^ ERROR lifetime arguments are not allowed on this entity [E0110]
+ //~^ ERROR lifetime arguments are not allowed for this type [E0109]
}
// Impl for struct type
@@ -21,7 +21,7 @@
type Iter<'a> = std::slice::Iter<'a, T>;
fn iter<'a>(&'a self) -> Self::Iter<'a> {
- //~^ ERROR lifetime arguments are not allowed on this entity [E0110]
+ //~^ ERROR lifetime arguments are not allowed for this type [E0109]
self.iter()
}
}
@@ -32,18 +32,18 @@
type Iter<'a> = std::slice::Iter<'a, T>;
fn iter<'a>(&'a self) -> Self::Iter<'a> {
- //~^ ERROR lifetime arguments are not allowed on this entity [E0110]
+ //~^ ERROR lifetime arguments are not allowed for this type [E0109]
self.iter()
}
}
fn make_iter<'a, I: Iterable>(it: &'a I) -> I::Iter<'a> {
- //~^ ERROR lifetime arguments are not allowed on this entity [E0110]
+ //~^ ERROR lifetime arguments are not allowed for this type [E0109]
it.iter()
}
fn get_first<'a, I: Iterable>(it: &'a I) -> Option<I::Item<'a>> {
- //~^ ERROR lifetime arguments are not allowed on this entity [E0110]
+ //~^ ERROR lifetime arguments are not allowed for this type [E0109]
it.iter().next()
}
diff --git a/src/test/ui/rfc1598-generic-associated-types/iterable.stderr b/src/test/ui/rfc1598-generic-associated-types/iterable.stderr
index cc3ade6..6d5d0cc 100644
--- a/src/test/ui/rfc1598-generic-associated-types/iterable.stderr
+++ b/src/test/ui/rfc1598-generic-associated-types/iterable.stderr
@@ -4,37 +4,37 @@
LL | #![feature(generic_associated_types)]
| ^^^^^^^^^^^^^^^^^^^^^^^^
-error[E0110]: lifetime arguments are not allowed on this entity
+error[E0109]: lifetime arguments are not allowed for this type
--> $DIR/iterable.rs:11:47
|
LL | type Iter<'a>: Iterator<Item = Self::Item<'a>>;
| ^^ lifetime argument not allowed
-error[E0110]: lifetime arguments are not allowed on this entity
+error[E0109]: lifetime arguments are not allowed for this type
--> $DIR/iterable.rs:40:53
|
LL | fn make_iter<'a, I: Iterable>(it: &'a I) -> I::Iter<'a> {
| ^^ lifetime argument not allowed
-error[E0110]: lifetime arguments are not allowed on this entity
+error[E0109]: lifetime arguments are not allowed for this type
--> $DIR/iterable.rs:45:60
|
LL | fn get_first<'a, I: Iterable>(it: &'a I) -> Option<I::Item<'a>> {
| ^^ lifetime argument not allowed
-error[E0110]: lifetime arguments are not allowed on this entity
+error[E0109]: lifetime arguments are not allowed for this type
--> $DIR/iterable.rs:14:41
|
LL | fn iter<'a>(&'a self) -> Self::Iter<'a>;
| ^^ lifetime argument not allowed
-error[E0110]: lifetime arguments are not allowed on this entity
+error[E0109]: lifetime arguments are not allowed for this type
--> $DIR/iterable.rs:23:41
|
LL | fn iter<'a>(&'a self) -> Self::Iter<'a> {
| ^^ lifetime argument not allowed
-error[E0110]: lifetime arguments are not allowed on this entity
+error[E0109]: lifetime arguments are not allowed for this type
--> $DIR/iterable.rs:34:41
|
LL | fn iter<'a>(&'a self) -> Self::Iter<'a> {
@@ -42,4 +42,4 @@
error: aborting due to 6 previous errors
-For more information about this error, try `rustc --explain E0110`.
+For more information about this error, try `rustc --explain E0109`.
diff --git a/src/test/ui/rfc1598-generic-associated-types/parameter_number_and_kind.rs b/src/test/ui/rfc1598-generic-associated-types/parameter_number_and_kind.rs
index 851e331..aa3f4b1 100644
--- a/src/test/ui/rfc1598-generic-associated-types/parameter_number_and_kind.rs
+++ b/src/test/ui/rfc1598-generic-associated-types/parameter_number_and_kind.rs
@@ -2,7 +2,7 @@
//~^ WARNING the feature `generic_associated_types` is incomplete
#![feature(associated_type_defaults)]
-// FIXME(#44265): "lifetime arguments are not allowed on this entity" errors will be addressed in a
+// FIXME(#44265): "lifetime arguments are not allowed for this type" errors will be addressed in a
// follow-up PR.
// FIXME(#44265): Update expected errors once E110 is resolved, now does not get past `trait Foo`.
@@ -15,13 +15,13 @@
type E<'a, T>;
// Test parameters in default values
type FOk<T> = Self::E<'static, T>;
- //~^ ERROR type arguments are not allowed on this entity [E0109]
- //~| ERROR lifetime arguments are not allowed on this entity [E0110]
+ //~^ ERROR type arguments are not allowed for this type [E0109]
+ //~| ERROR lifetime arguments are not allowed for this type [E0109]
type FErr1 = Self::E<'static, 'static>; // Error
- //~^ ERROR lifetime arguments are not allowed on this entity [E0110]
+ //~^ ERROR lifetime arguments are not allowed for this type [E0109]
type FErr2<T> = Self::E<'static, T, u32>; // Error
- //~^ ERROR type arguments are not allowed on this entity [E0109]
- //~| ERROR lifetime arguments are not allowed on this entity [E0110]
+ //~^ ERROR type arguments are not allowed for this type [E0109]
+ //~| ERROR lifetime arguments are not allowed for this type [E0109]
}
struct Fooy;
diff --git a/src/test/ui/rfc1598-generic-associated-types/parameter_number_and_kind.stderr b/src/test/ui/rfc1598-generic-associated-types/parameter_number_and_kind.stderr
index 265b0fa..817d911 100644
--- a/src/test/ui/rfc1598-generic-associated-types/parameter_number_and_kind.stderr
+++ b/src/test/ui/rfc1598-generic-associated-types/parameter_number_and_kind.stderr
@@ -4,31 +4,31 @@
LL | #![feature(generic_associated_types)]
| ^^^^^^^^^^^^^^^^^^^^^^^^
-error[E0110]: lifetime arguments are not allowed on this entity
+error[E0109]: lifetime arguments are not allowed for this type
--> $DIR/parameter_number_and_kind.rs:17:27
|
LL | type FOk<T> = Self::E<'static, T>;
| ^^^^^^^ lifetime argument not allowed
-error[E0109]: type arguments are not allowed on this entity
+error[E0109]: type arguments are not allowed for this type
--> $DIR/parameter_number_and_kind.rs:17:36
|
LL | type FOk<T> = Self::E<'static, T>;
| ^ type argument not allowed
-error[E0110]: lifetime arguments are not allowed on this entity
+error[E0109]: lifetime arguments are not allowed for this type
--> $DIR/parameter_number_and_kind.rs:20:26
|
LL | type FErr1 = Self::E<'static, 'static>; // Error
| ^^^^^^^ lifetime argument not allowed
-error[E0110]: lifetime arguments are not allowed on this entity
+error[E0109]: lifetime arguments are not allowed for this type
--> $DIR/parameter_number_and_kind.rs:22:29
|
LL | type FErr2<T> = Self::E<'static, T, u32>; // Error
| ^^^^^^^ lifetime argument not allowed
-error[E0109]: type arguments are not allowed on this entity
+error[E0109]: type arguments are not allowed for this type
--> $DIR/parameter_number_and_kind.rs:22:38
|
LL | type FErr2<T> = Self::E<'static, T, u32>; // Error
@@ -36,5 +36,4 @@
error: aborting due to 5 previous errors
-Some errors occurred: E0109, E0110.
-For more information about an error, try `rustc --explain E0109`.
+For more information about this error, try `rustc --explain E0109`.
diff --git a/src/test/ui/rfc1598-generic-associated-types/pointer_family.rs b/src/test/ui/rfc1598-generic-associated-types/pointer_family.rs
index 2d188ae..edeeaba 100644
--- a/src/test/ui/rfc1598-generic-associated-types/pointer_family.rs
+++ b/src/test/ui/rfc1598-generic-associated-types/pointer_family.rs
@@ -10,7 +10,7 @@
trait PointerFamily {
type Pointer<T>: Deref<Target = T>;
fn new<T>(value: T) -> Self::Pointer<T>;
- //~^ ERROR type arguments are not allowed on this entity [E0109]
+ //~^ ERROR type arguments are not allowed for this type [E0109]
}
struct ArcFamily;
@@ -18,7 +18,7 @@
impl PointerFamily for ArcFamily {
type Pointer<T> = Arc<T>;
fn new<T>(value: T) -> Self::Pointer<T> {
- //~^ ERROR type arguments are not allowed on this entity [E0109]
+ //~^ ERROR type arguments are not allowed for this type [E0109]
Arc::new(value)
}
}
@@ -28,14 +28,14 @@
impl PointerFamily for RcFamily {
type Pointer<T> = Rc<T>;
fn new<T>(value: T) -> Self::Pointer<T> {
- //~^ ERROR type arguments are not allowed on this entity [E0109]
+ //~^ ERROR type arguments are not allowed for this type [E0109]
Rc::new(value)
}
}
struct Foo<P: PointerFamily> {
bar: P::Pointer<String>,
- //~^ ERROR type arguments are not allowed on this entity [E0109]
+ //~^ ERROR type arguments are not allowed for this type [E0109]
}
fn main() {}
diff --git a/src/test/ui/rfc1598-generic-associated-types/pointer_family.stderr b/src/test/ui/rfc1598-generic-associated-types/pointer_family.stderr
index 2b9eed2..0966f8f 100644
--- a/src/test/ui/rfc1598-generic-associated-types/pointer_family.stderr
+++ b/src/test/ui/rfc1598-generic-associated-types/pointer_family.stderr
@@ -4,25 +4,25 @@
LL | #![feature(generic_associated_types)]
| ^^^^^^^^^^^^^^^^^^^^^^^^
-error[E0109]: type arguments are not allowed on this entity
+error[E0109]: type arguments are not allowed for this type
--> $DIR/pointer_family.rs:37:21
|
LL | bar: P::Pointer<String>,
| ^^^^^^ type argument not allowed
-error[E0109]: type arguments are not allowed on this entity
+error[E0109]: type arguments are not allowed for this type
--> $DIR/pointer_family.rs:12:42
|
LL | fn new<T>(value: T) -> Self::Pointer<T>;
| ^ type argument not allowed
-error[E0109]: type arguments are not allowed on this entity
+error[E0109]: type arguments are not allowed for this type
--> $DIR/pointer_family.rs:20:42
|
LL | fn new<T>(value: T) -> Self::Pointer<T> {
| ^ type argument not allowed
-error[E0109]: type arguments are not allowed on this entity
+error[E0109]: type arguments are not allowed for this type
--> $DIR/pointer_family.rs:30:42
|
LL | fn new<T>(value: T) -> Self::Pointer<T> {
diff --git a/src/test/ui/rfc1598-generic-associated-types/streaming_iterator.rs b/src/test/ui/rfc1598-generic-associated-types/streaming_iterator.rs
index e018416..4e177fb 100644
--- a/src/test/ui/rfc1598-generic-associated-types/streaming_iterator.rs
+++ b/src/test/ui/rfc1598-generic-associated-types/streaming_iterator.rs
@@ -10,13 +10,13 @@
type Item<'a>;
// Applying the lifetime parameter `'a` to `Self::Item` inside the trait.
fn next<'a>(&'a self) -> Option<Self::Item<'a>>;
- //~^ ERROR lifetime arguments are not allowed on this entity [E0110]
+ //~^ ERROR lifetime arguments are not allowed for this type [E0109]
}
struct Foo<T: StreamingIterator> {
// Applying a concrete lifetime to the constructor outside the trait.
bar: <T as StreamingIterator>::Item<'static>,
- //~^ ERROR lifetime arguments are not allowed on this entity [E0110]
+ //~^ ERROR lifetime arguments are not allowed for this type [E0109]
}
// Users can bound parameters by the type constructed by that trait's associated type constructor
@@ -24,7 +24,7 @@
//FIXME(sunjay): This next line should parse and be valid
//fn foo<T: for<'a> StreamingIterator<Item<'a>=&'a [i32]>>(iter: T) { /* ... */ }
fn foo<T>(iter: T) where T: StreamingIterator, for<'a> T::Item<'a>: Display { /* ... */ }
-//~^ ERROR lifetime arguments are not allowed on this entity [E0110]
+//~^ ERROR lifetime arguments are not allowed for this type [E0109]
// Full example of enumerate iterator
@@ -36,9 +36,9 @@
impl<I: StreamingIterator> StreamingIterator for StreamEnumerate<I> {
type Item<'a> = (usize, I::Item<'a>);
- //~^ ERROR lifetime arguments are not allowed on this entity [E0110]
+ //~^ ERROR lifetime arguments are not allowed for this type [E0109]
fn next<'a>(&'a self) -> Option<Self::Item<'a>> {
- //~^ ERROR lifetime arguments are not allowed on this entity [E0110]
+ //~^ ERROR lifetime arguments are not allowed for this type [E0109]
match self.iter.next() {
None => None,
Some(val) => {
diff --git a/src/test/ui/rfc1598-generic-associated-types/streaming_iterator.stderr b/src/test/ui/rfc1598-generic-associated-types/streaming_iterator.stderr
index 5afbba5..5fc1e3d 100644
--- a/src/test/ui/rfc1598-generic-associated-types/streaming_iterator.stderr
+++ b/src/test/ui/rfc1598-generic-associated-types/streaming_iterator.stderr
@@ -4,31 +4,31 @@
LL | #![feature(generic_associated_types)]
| ^^^^^^^^^^^^^^^^^^^^^^^^
-error[E0110]: lifetime arguments are not allowed on this entity
+error[E0109]: lifetime arguments are not allowed for this type
--> $DIR/streaming_iterator.rs:18:41
|
LL | bar: <T as StreamingIterator>::Item<'static>,
| ^^^^^^^ lifetime argument not allowed
-error[E0110]: lifetime arguments are not allowed on this entity
+error[E0109]: lifetime arguments are not allowed for this type
--> $DIR/streaming_iterator.rs:26:64
|
LL | fn foo<T>(iter: T) where T: StreamingIterator, for<'a> T::Item<'a>: Display { /* ... */ }
| ^^ lifetime argument not allowed
-error[E0110]: lifetime arguments are not allowed on this entity
+error[E0109]: lifetime arguments are not allowed for this type
--> $DIR/streaming_iterator.rs:12:48
|
LL | fn next<'a>(&'a self) -> Option<Self::Item<'a>>;
| ^^ lifetime argument not allowed
-error[E0110]: lifetime arguments are not allowed on this entity
+error[E0109]: lifetime arguments are not allowed for this type
--> $DIR/streaming_iterator.rs:38:37
|
LL | type Item<'a> = (usize, I::Item<'a>);
| ^^ lifetime argument not allowed
-error[E0110]: lifetime arguments are not allowed on this entity
+error[E0109]: lifetime arguments are not allowed for this type
--> $DIR/streaming_iterator.rs:40:48
|
LL | fn next<'a>(&'a self) -> Option<Self::Item<'a>> {
@@ -36,4 +36,4 @@
error: aborting due to 5 previous errors
-For more information about this error, try `rustc --explain E0110`.
+For more information about this error, try `rustc --explain E0109`.
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/structs/struct-path-associated-type.rs b/src/test/ui/structs/struct-path-associated-type.rs
index 7c77085..15b37fa 100644
--- a/src/test/ui/structs/struct-path-associated-type.rs
+++ b/src/test/ui/structs/struct-path-associated-type.rs
@@ -13,7 +13,7 @@
//~^ ERROR expected struct, variant or union type, found associated type
let z = T::A::<u8> {};
//~^ ERROR expected struct, variant or union type, found associated type
- //~| ERROR type arguments are not allowed on this entity
+ //~| ERROR type arguments are not allowed for this type
match S {
T::A {} => {}
//~^ ERROR expected struct, variant or union type, found associated type
@@ -22,7 +22,7 @@
fn g<T: Tr<A = S>>() {
let s = T::A {}; // OK
- let z = T::A::<u8> {}; //~ ERROR type arguments are not allowed on this entity
+ let z = T::A::<u8> {}; //~ ERROR type arguments are not allowed for this type
match S {
T::A {} => {} // OK
}
@@ -31,7 +31,7 @@
fn main() {
let s = S::A {}; //~ ERROR ambiguous associated type
let z = S::A::<u8> {}; //~ ERROR ambiguous associated type
- //~^ ERROR type arguments are not allowed on this entity
+ //~^ ERROR type arguments are not allowed for this type
match S {
S::A {} => {} //~ ERROR ambiguous associated type
}
diff --git a/src/test/ui/structs/struct-path-associated-type.stderr b/src/test/ui/structs/struct-path-associated-type.stderr
index 0ca64ed..f054bd3 100644
--- a/src/test/ui/structs/struct-path-associated-type.stderr
+++ b/src/test/ui/structs/struct-path-associated-type.stderr
@@ -4,7 +4,7 @@
LL | let s = T::A {};
| ^^^^ not a struct
-error[E0109]: type arguments are not allowed on this entity
+error[E0109]: type arguments are not allowed for this type
--> $DIR/struct-path-associated-type.rs:14:20
|
LL | let z = T::A::<u8> {};
@@ -22,7 +22,7 @@
LL | T::A {} => {}
| ^^^^ not a struct
-error[E0109]: type arguments are not allowed on this entity
+error[E0109]: type arguments are not allowed for this type
--> $DIR/struct-path-associated-type.rs:25:20
|
LL | let z = T::A::<u8> {};
@@ -34,7 +34,7 @@
LL | let s = S::A {};
| ^^^^ help: use fully-qualified syntax: `<S as Trait>::A`
-error[E0109]: type arguments are not allowed on this entity
+error[E0109]: type arguments are not allowed for this type
--> $DIR/struct-path-associated-type.rs:33:20
|
LL | let z = S::A::<u8> {};
diff --git a/src/test/ui/structs/struct-path-self.rs b/src/test/ui/structs/struct-path-self.rs
index 51ed9e5..77880bf 100644
--- a/src/test/ui/structs/struct-path-self.rs
+++ b/src/test/ui/structs/struct-path-self.rs
@@ -6,7 +6,7 @@
//~^ ERROR expected struct, variant or union type, found Self
let z = Self::<u8> {};
//~^ ERROR expected struct, variant or union type, found Self
- //~| ERROR type arguments are not allowed on this entity
+ //~| ERROR type arguments are not allowed for this type
match s {
Self { .. } => {}
//~^ ERROR expected struct, variant or union type, found Self
@@ -17,7 +17,7 @@
impl Tr for S {
fn f() {
let s = Self {}; // OK
- let z = Self::<u8> {}; //~ ERROR type arguments are not allowed on this entity
+ let z = Self::<u8> {}; //~ ERROR type arguments are not allowed for this type
match s {
Self { .. } => {} // OK
}
@@ -27,7 +27,7 @@
impl S {
fn g() {
let s = Self {}; // OK
- let z = Self::<u8> {}; //~ ERROR type arguments are not allowed on this entity
+ let z = Self::<u8> {}; //~ ERROR type arguments are not allowed for this type
match s {
Self { .. } => {} // OK
}
diff --git a/src/test/ui/structs/struct-path-self.stderr b/src/test/ui/structs/struct-path-self.stderr
index 0fb02b9..d9e84ac 100644
--- a/src/test/ui/structs/struct-path-self.stderr
+++ b/src/test/ui/structs/struct-path-self.stderr
@@ -4,7 +4,7 @@
LL | let s = Self {};
| ^^^^ not a struct
-error[E0109]: type arguments are not allowed on this entity
+error[E0109]: type arguments are not allowed for this type
--> $DIR/struct-path-self.rs:7:24
|
LL | let z = Self::<u8> {};
@@ -22,13 +22,13 @@
LL | Self { .. } => {}
| ^^^^ not a struct
-error[E0109]: type arguments are not allowed on this entity
+error[E0109]: type arguments are not allowed for this type
--> $DIR/struct-path-self.rs:20:24
|
LL | let z = Self::<u8> {};
| ^^ type argument not allowed
-error[E0109]: type arguments are not allowed on this entity
+error[E0109]: type arguments are not allowed for this type
--> $DIR/struct-path-self.rs:30:24
|
LL | let z = Self::<u8> {};
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/test/ui/type-alias-enum-variants.rs b/src/test/ui/type-alias-enum-variants.rs
index 3ec200d..c5974e5 100644
--- a/src/test/ui/type-alias-enum-variants.rs
+++ b/src/test/ui/type-alias-enum-variants.rs
@@ -7,5 +7,5 @@
let _ = Option::None::<u8>; // OK (Lint in future!)
let _ = Alias::<u8>::None; // OK
let _ = Alias::None::<u8>; // Error
- //~^ type arguments are not allowed on this entity
+ //~^ type arguments are not allowed for this type
}
diff --git a/src/test/ui/type-alias-enum-variants.stderr b/src/test/ui/type-alias-enum-variants.stderr
index cf81f5b..55f250f 100644
--- a/src/test/ui/type-alias-enum-variants.stderr
+++ b/src/test/ui/type-alias-enum-variants.stderr
@@ -1,4 +1,4 @@
-error[E0109]: type arguments are not allowed on this entity
+error[E0109]: type arguments are not allowed for this type
--> $DIR/type-alias-enum-variants.rs:9:27
|
LL | let _ = Alias::None::<u8>; // Error
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() {