Tyler Mandry [Fri, 1 Nov 2019 18:20:12 +0000 (11:20 -0700)]
Rollup merge of #65857 - kinnison:kinnison/issue-55364, r=Manisheart,GuillaumeGomez
rustdoc: Resolve module-level doc references more locally
Module level docs should resolve intra-doc links as locally as
possible. As such, this commit alters the heuristic for finding
intra-doc links such that we attempt to resolve names mentioned
in *inner* documentation comments within the (sub-)module rather
that from the context of its parent.
I'm hoping that this fixes #55364 though right now I'm not sure it's the right fix.
Tyler Mandry [Fri, 1 Nov 2019 18:20:09 +0000 (11:20 -0700)]
Rollup merge of #65470 - traxys:fix_65401, r=michaelwoerister
Don't hide ICEs from previous incremental compiles
I think this fixes #65401, the compiler does not fail to ICE after the first compilation, tested on the last snippet of [this comment](https://github.com/rust-lang/rust/issues/63154#issuecomment-541592381).
I am not very sure of the fix as I don't understand much of the structure of the compiler.
Tyler Mandry [Fri, 1 Nov 2019 18:20:07 +0000 (11:20 -0700)]
Rollup merge of #65112 - jack-t:type-parens-lint, r=varkor
Add lint and tests for unnecessary parens around types
This is my first contribution to the Rust project, so I apologize if I'm not doing things the right way.
The PR fixes #64169. It adds a lint and tests for unnecessary parentheses around types. I've run `tidy` and `rustfmt` — I'm not totally sure it worked right, though — and I've tried to follow the instructions linked in the readme.
I tried to think through all the variants of `ast::TyKind` to find exceptions to this lint, and I could only find the one mentioned in the original issue, which concerns types with `dyn`. I'm not a Rust expert, thought, so I may well be missing something.
There's also a problem with getting this to build. The new lint catches several things in the, e.g., `core`. Because `x.py` seems to build with an equivalent of `-Werror`, what would have been warnings cause the build to break. I got it to build and the tests to pass with `--warnings warn` on my `x.py build` and `x.py test` commands.
bors [Fri, 1 Nov 2019 11:34:51 +0000 (11:34 +0000)]
Auto merge of #65718 - eddyb:codegen-var-debuginfo, r=nikomatsakis
rustc_codegen_ssa: introduce MIR VarDebugInfo, but only for codegen.
These are all the codegen changes necessary for #56231.
The refactors were performed locally to codegen, and in several steps, to ease reviewing and avoid introducing changes in behavior (as I'm not sure our debuginfo tests cover enough).
bors [Fri, 1 Nov 2019 06:35:40 +0000 (06:35 +0000)]
Auto merge of #65698 - msizanoen1:dual-proc-macro-hash, r=petrochenkov
Dual proc macro hash
This PR changes current `-Z dual-proc-macro` mechanism from resolving only by name to including the hash of the host crate inside the transistive dependency information to prevent name conflicts.
Fix partially #62558
bors [Fri, 1 Nov 2019 03:15:31 +0000 (03:15 +0000)]
Auto merge of #65459 - ecstatic-morse:graphviz-subgraph, r=estebank
Fix `-Zunpretty=mir-cfg` to render multiple items
`-Zunpretty=mir-cfg` outputs DOT to stdout for all items being compiled. However, it puts all of these items in separate `digraph`s, which means the result of redirecting that output to a file is not valid. Most dot renderers (I have tried `dot` and `xdot`) cannot render the output.
This PR checks to see if `write_mir_graphviz` will process multiple items, and writes them each as a `subgraph` in a single, top-level `digraph`. As a result, DOT can be viewed without manually editing the output file. The output is unchanged when printing a single item (e.g.`-Zunpretty=mir-cfg=item_name`).
Here's the output of `xdot` for a rust file containing three items:
![three-items](https://user-images.githubusercontent.com/29463364/66889712-4bf62200-ef98-11e9-83b5-60faa2a300dd.png)
The borders are a result of the nonstandard–but well-supported–[`cluster` prefix](https://graphviz.gitlab.io/_pages/doc/info/lang.html) (search for "Subgraphs and Clusters"). They will not appear if your renderer does not support this extension, but the graph will still render properly.
bors [Thu, 31 Oct 2019 15:15:53 +0000 (15:15 +0000)]
Auto merge of #65091 - sekineh:into-iter-sorted, r=KodrAus
Implement ordered/sorted iterators on BinaryHeap as per #59278
I've implemented the ordered version of iterator on BinaryHeap as per #59278.
# Added methods:
* `.into_iter_sorted()`
* like `.into_iter()`; but returns elements in heap order
* `.drain_sorted()`
* like `.drain()`; but returns elements in heap order
* It's a bit _lazy_; elements are removed on drop. (Edit: it’s similar to vec::Drain)
For `DrainSorted` struct, I implemented `Drop` trait following @scottmcm 's [suggestion](https://github.com/rust-lang/rust/issues/59278#issuecomment-537306925)
# ~TODO~ DONE
* ~I think I need to add more tests other than doctest.~
# **Notes:**
* we renamed `_ordered` to `_sorted`, because the latter is more common in rust libs. (as suggested by @KodrAus )
bors [Thu, 31 Oct 2019 11:51:42 +0000 (11:51 +0000)]
Auto merge of #63803 - GuillaumeGomez:stabilize-doctest, r=ollie27,QuietMisdreavus,Mark-Simulacrum
[rustdoc] stabilize cfg(doctest)
Fixes #62210.
Since we removed rustdoc from providing cfg(test) on test runs, it's been replaced by cfg(doctest). It'd be nice to have it in not too far in the future.
rustdoc: Resolve module-level doc references more locally
Module level docs should resolve intra-doc links as locally as
possible. As such, this commit alters the heuristic for finding
intra-doc links such that we attempt to resolve names mentioned
in *inner* documentation comments within the (sub-)module rather
that from the context of its parent.
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
msizanoen [Tue, 22 Oct 2019 08:47:07 +0000 (15:47 +0700)]
Implement dual proc macro hashing
This changes the mechanism of `-Z dual-proc-macro` to record the host
proc macro hash in the transistive dependency information and use it
during dependency resolution instead of resolving only by name.
bors [Thu, 31 Oct 2019 02:20:30 +0000 (02:20 +0000)]
Auto merge of #65990 - Centril:rollup-v843h4a, r=Centril
Rollup of 7 pull requests
Successful merges:
- #65274 (Upload toolstates.json to rust-lang-ci2)
- #65434 (Add long error explanation for E0577)
- #65850 (Update comments re type parameter hack in object safety)
- #65955 (ci: revert msys2 ca-certificates hack)
- #65959 (Fix an incorrect docstring for Immediate in librustc_mir/interpret.)
- #65979 (Switch CrateMetadata's source_map_import_info from RwLock to Once)
- #65981 (work around aggressive syntax feature gating)
Rollup merge of #65981 - RalfJung:check-your-gates, r=Centril
work around aggressive syntax feature gating
This works around https://github.com/rust-lang/rust/issues/65860; fixing `rustc +nightly lib.rs --test --edition 2018` for libcore and thus unblocking https://github.com/RalfJung/miri-test-libstd.
Rollup merge of #65955 - pietroalbini:master-revert-msys2-hack, r=Mark-Simulacrum
ci: revert msys2 ca-certificates hack
The hack was added because upstream msys2 broke the ca-certificates package, but since then it has been fixed. This reverts CI to use the upstream package.
Rollup merge of #65850 - mikeyhew:patch-1, r=nikomatsakis
Update comments re type parameter hack in object safety
To check if a method's receiver type is object safe, we create a new receiver type by substituting in a bogus type parameter (let's call it `U`) for `Self`, and checking that the unmodified receiver type implements `DispatchFromDyn<receiver type with Self = U>`. It would be better to use `dyn Trait` directly, and the only reason we don't is because it triggers another check that `Trait` is object safe, resulting in a query cycle. Once the feature `object_safe_for_dispatch` (tracking issue https://github.com/rust-lang/rust/issues/43561) is stabilized, this will no longer be the case, and we'll be able to use `dyn Trait` as the unsized `Self` type. I've updated the comments in object_safety.rs accordingly.
Rollup merge of #65274 - pietroalbini:ci-upload-toolstate, r=alexcrichton
Upload toolstates.json to rust-lang-ci2
This PR does two things:
* Following up with https://github.com/rust-lang/rust/pull/65202, it migrates deploying artifacts to CI in a script. Both uploading release artifacts and CPU stats were merged into the same script, designing it to be easily extended.
* Uploads the toolstate JSON to `rust-lang-ci2` along with the release artifacts, both for Linux and Windows. This is needed because @RalfJung wants to stop shipping MIRI when its tests are failing, and the toolstate repo doesn't have entries for each commit. Having the toolstate data (just for that specific commit) on `rust-lang-ci2` will simplify the code a lot.
Most importantly it contains https://github.com/rust-lang/rls/commit/d267b49c2f7914f5b4bc94916dc56d64b37adf3a which fixes the RLS build whenever Clippy is built successfully in Rust CI.
Pietro Albini [Wed, 30 Oct 2019 18:41:22 +0000 (19:41 +0100)]
ci: move toolstates.json to /tmp/toolstate/ and docker mount it
Before this commit toolstates.json was stored in /tmp and it wasn't
mounted outside the build container. That caused uploading the file in
the upload-artifacts task to fail, as the file was missing on the host.
Mounting /tmp/toolstates.json alone is not the best approach: if the
file is missing when the container is started the Docker engine will
create a *directory* named /tmp/toolstates.json.
The Docker issue could be solved by pre-creating an empty file named
/tmp/toolstates.json, but doing that could cause problems if bootstrap
fails to generate the file and the toolstate scripts receive an empty
JSON.
The approach I took in this commit is to instead mount a /tmp/toolstate
directory inside Docker, and create the toolstates.json file in it. That
also required a small bootstrap change to ensure the directory is
created if it's missing.
Most importantly it contains https://github.com/rust-lang/rls/commit/d267b49c2f7914f5b4bc94916dc56d64b37adf3a
which fixes the RLS build whenever Clippy is built successfully in Rust CI.
bors [Wed, 30 Oct 2019 13:34:57 +0000 (13:34 +0000)]
Auto merge of #65941 - ehuss:update-cargo-books, r=alexcrichton
Update cargo, books.
## cargo
8 commits in 3ba5f27170db10af7a92f2b682e049397197b8fa..5da4b4d47963868d9878480197581ccbbdaece74
2019-10-22 15:05:18 +0000 to 2019-10-28 21:53:41 +0000
- Add --filter-platform to `cargo metadata`. (rust-lang/cargo#7376)
- Fix `cargo fix` not showing colors. (rust-lang/cargo#7550)
- Rephrase --manifest-path section (rust-lang/cargo#7409)
- Add a note to discourage the use of -Zminimal-versions. (rust-lang/cargo#7549)
- Fix profile override warning in a workspace. (rust-lang/cargo#7536)
- Fix some tests failing on Windows nightly. (rust-lang/cargo#7534)
- Show better error message for Windows abnormal termination. (rust-lang/cargo#7535)
- Run `apt update` before `apt install` (rust-lang/cargo#7541)
## reference
8 commits in 5b9d2fcefadfc32fceafacfc0dd9441d9b57dd94..4b21b646669e0af49fae7cae301898dc4bfaa1f0
2019-10-03 22:39:10 +0200 to 2019-10-27 22:33:11 +0100
- Document `const_constructor` feature (rust-lang-nursery/reference#677)
- Add `non_exhaustive` to reference. (rust-lang-nursery/reference#609)
- Re-add rust-docs component for lintcheck (rust-lang-nursery/reference#702)
- group signed and unsigned integers in layout table (rust-lang-nursery/reference#700)
- Fix layout table rendering (rust-lang-nursery/reference#699)
- Add reference for attributes in function parameters (rust-lang-nursery/reference#657)
- Update now that proc macros can expand to macro_rules. (rust-lang-nursery/reference#694)
- Fix match in union example. (rust-lang-nursery/reference#684)
## book
8 commits in 9bb8b161963fcebc9d9ccd732ba26f42108016d5..28fa3d15b0bc67ea5e79eeff2198e4277fc61baf
2019-10-14 18:42:55 -0500 to 2019-10-29 07:16:09 -0500
- Update Ch19.1 on slice splitting (rust-lang/book#1999)
- fixed inconsistent terminology regarding enums (rust-lang/book#2022)
- Update ch15-03 code to match output. (rust-lang/book#2020)
- Fixes rust-lang/book#2039 (rust-lang/book#2040)
- Update ch15-03-drop.md (rust-lang/book#2049)
- unit type value is also a value (rust-lang/book#2061)
- Minor: remove an extraneous `.` (rust-lang/book#2059)
- Clarifications and consistent use of quotation marks (rust-lang/book#1992)
Pietro Albini [Wed, 30 Oct 2019 08:13:26 +0000 (09:13 +0100)]
ci: revert msys2 ca-certificates hack
The hack was added because upstream msys2 broke the ca-certificates
package, but since then it has been fixed. This reverts CI to use the
upstream package.
bors [Tue, 29 Oct 2019 19:12:01 +0000 (19:12 +0000)]
Auto merge of #65943 - tmandry:rollup-g20uvkh, r=tmandry
Rollup of 12 pull requests
Successful merges:
- #65405 (Create new error E0742 and add long error explanation)
- #65539 (resolve: Turn the "non-empty glob must import something" error into a lint)
- #65724 (ci: refactor pr tools job skipping)
- #65741 (Prevent help popup to disappear when clicking on it)
- #65832 (Re-enable Emscripten's exception handling support)
- #65843 (Enable dist for MIPS64 musl targets)
- #65898 (add basic HermitCore support within libtest)
- #65900 (proc_macro: clean up bridge::client::__run_expand{1,2} a bit.)
- #65906 (Update mdbook to 0.3.3)
- #65920 (Use rustc-workspace-hack for rustbook)
- #65930 (doc: use new feature gate for c_void type)
- #65936 (save-analysis: Account for async desugaring in async fn return types)
Tyler Mandry [Tue, 29 Oct 2019 19:01:49 +0000 (12:01 -0700)]
Rollup merge of #65936 - Xanewok:save-analysis-async, r=nikomatsakis
save-analysis: Account for async desugaring in async fn return types
Closes #65590
When visiting the return type of an async function we need to take into account its desugaring, since it introduces a new definition under which the return type is redefined.
Tyler Mandry [Tue, 29 Oct 2019 19:01:46 +0000 (12:01 -0700)]
Rollup merge of #65920 - smaeul:patch/workspace-hack, r=alexcrichton
Use rustc-workspace-hack for rustbook
As rustbook now depends transitively on openssl, it needs access to the
rustc-workspace-hack/all-static feature to pick up openssl-sys/vendored.
This fixes the rust build with `all-static = true` on systems where
openssl is not installed (e.g. when cross-compiling).
Tyler Mandry [Tue, 29 Oct 2019 19:01:43 +0000 (12:01 -0700)]
Rollup merge of #65900 - eddyb:proc-macro-cleanup, r=alexcrichton
proc_macro: clean up bridge::client::__run_expand{1,2} a bit.
See commit titles/diffs for more details.
The first commit is made possible by #53451 being fixed (almost a year ago).
The last commit should remove the need for `#[allow(improper_ctypes)]` in #65134.
Tyler Mandry [Tue, 29 Oct 2019 19:01:38 +0000 (12:01 -0700)]
Rollup merge of #65832 - tlively:emscripten-exception-handling, r=alexcrichton
Re-enable Emscripten's exception handling support
Passes LLVM codegen and Emscripten link-time flags for exception
handling if and only if the panic strategy is `unwind`. Sets the
default panic strategy for Emscripten targets to `unwind`. Re-enables
tests that depend on unwinding support for Emscripten, including
`should_panic` tests.
Tyler Mandry [Tue, 29 Oct 2019 19:01:35 +0000 (12:01 -0700)]
Rollup merge of #65724 - pietroalbini:ci-remove-template-parameter, r=alexcrichton
ci: refactor pr tools job skipping
We have a job in our CI (PR's x86_64-gnu-tools) that's supposed to run only when a submodule is changed in the PR, and it works by having a task at the start of the build that skips all the following tasks if the condition isn't met.
Before this commit that task was gated with template parameters, which is a unique feature of Azure Pipelines. To make our CI more generic this commit switches the gate to use a simple environment variable plus a condition, which should be supported on more CI providers.
This PR also extracts the skipping logic into a script.
Tyler Mandry [Tue, 29 Oct 2019 19:01:33 +0000 (12:01 -0700)]
Rollup merge of #65539 - traxys:fix_62334, r=petrochenkov
resolve: Turn the "non-empty glob must import something" error into a lint
This fixes #62334 by changing the error to a lint warning the glob. I changed the test but I'm very unsure of what I did as I do not know how to correctly check for the warning
Changes:
````
travis: temporarily disable rustfmt ci check until #4742 is resolved
rustup https://github.com/rust-lang/rust/pull/65792/
Fix ICE #4579
Add regression test for ICE #4579
Run update_lints for Unicode lint
Re-add false positive check
Add raw string regression test for useless_format lint
Re-factor useless_format lint
Update Unicode lint tests
[Backported] Rustup to https://github.com/rust-lang/rust/pull/59545
````
It seems that `eval_always` was mistakenly(?) added to `const_field` and then it ended up on `const_caller_location` (which is used much more often than `const_field` is).
Pietro Albini [Thu, 10 Oct 2019 15:32:50 +0000 (17:32 +0200)]
ci: upload toolstates.json to rust-lang-ci2
Uploading the toolstate data for each commit will help our release
tooling understand which components are failing, to possibly skip
shipping broken tools to users.
Pietro Albini [Wed, 23 Oct 2019 13:56:21 +0000 (15:56 +0200)]
ci: enable "run when submodule changes" with environment variables
We have a job in our CI (PR's x86_64-gnu-tools) that's supposed to run
only when a submodule is changed in the PR, and it works by having a
task at the start of the build that skips all the following tasks if the
condition isn't met.
Before this commit that task was gated with template parameters, which
is a unique feature of Azure Pipelines. To make our CI more generic this
commit switches the gate to use a simple environment variable plus a
condition, which should be supported on more CI providers.
bors [Tue, 29 Oct 2019 07:38:50 +0000 (07:38 +0000)]
Auto merge of #65435 - michaelwoerister:fix-issue-64153, r=alexcrichton
Fix #64153
This PR changes how the compiler detects if an object file from an upstream crate is a Rust object file or not. Instead of checking if the name starts with the crate name and ends with `.o` (which is not always the case, as described in #64153), it now just checks if the filename ends with `.rcgu.o`.
This fixes #64153. However, ideally we'd clean up the code around filename generation some more. Then this check could be made more robust.
bors [Tue, 29 Oct 2019 04:12:23 +0000 (04:12 +0000)]
Auto merge of #65919 - Centril:rollup-qrgwnt6, r=Centril
Rollup of 5 pull requests
Successful merges:
- #65294 (Lint ignored `#[inline]` on function prototypes)
- #65318 (Call out the types that are non local on E0117)
- #65531 (Update backtrace to 0.3.40)
- #65562 (Improve the "try using a variant of the expected type" hint.)
- #65809 (Add new EFIAPI ABI)
Samuel Holland [Sun, 6 Oct 2019 22:30:11 +0000 (17:30 -0500)]
Use rustc-workspace-hack for rustbook
As rustbook now depends transitively on openssl, it needs access to the
rustc-workspace-hack/all-static feature to pick up openssl-sys/vendored.
This fixes the rust build with `all-static = true` on systems where
openssl is not installed (e.g. when cross-compiling).
Rollup merge of #65809 - roblabla:eficall-abi, r=nagisa
Add new EFIAPI ABI
Fixes #54527
Adds a new ABI, "efiapi", which reflects the calling convention as specified by [the current spec UEFI spec](https://uefi.org/sites/default/files/resources/UEFI%20Spec%202_7_A%20Sept%206.pdf#G6.999903). When compiling for x86_64, we should select the `win64` ABI, while on all other architectures (Itanium, x86, ARM and ARM64 and RISC-V), we should select the `C` ABI.
Currently, this is done by just turning it into the C ABI everywhere except on x86_64, where it's turned into the win64 ABI. Should we prevent this ABI from being used on unsupported architectures, and if so, how would this be done?
- Adds a `unused_attribute` lint for `#[inline]` on function prototypes.
- As a consequence, foreign items, impl items and trait items now have their attributes checked, which could cause some code to no longer compile (it was previously erroneously ignored).
bors [Mon, 28 Oct 2019 20:59:36 +0000 (20:59 +0000)]
Auto merge of #65907 - Centril:rollup-9i8ev23, r=Centril
Rollup of 9 pull requests
Successful merges:
- #65563 (Add long error explanation for E0587)
- #65640 (Use heuristics to recover parsing of missing `;`)
- #65643 (Correct handling of type flags with `ConstValue::Placeholder`)
- #65825 (rustc: use IndexVec<DefIndex, T> instead of Vec<T>.)
- #65858 (suggest `const_in_array_repeat_expression` flag)
- #65877 (doc: introduce `once` in `iter::chain` document)
- #65887 (doc: mention `get(_mut)` in Vec)
- #65891 (self-profiling: Record something more useful for crate metadata generation event.)
- #65893 (Output previous stable error messaging when using stable build.)
Rollup merge of #65893 - jafern14:let-expr-stable-error-messaging, r=Centril
Output previous stable error messaging when using stable build.
Fixes #65254
As I had mentioned previously there I have the logic running right now however I'm not getting the exact same syntax highlighting as there was originally for this error.
I'm currently getting the following:
```
error: expected expression, found statement (`let`)
--> src/main.rs:2:14
|
2 | let x = (let y = 6);
| ^^^^^^^^^
|
= note: variable declaration using `let` is a statement
```
I'd like to get the following instead:
```
| let x = (let y = 6);
| ^^^
```
My current understanding is that the `span` being passed into `lower_expr_let` is coming from `lowering.rs`. I still don't know how the byte range is calculated for the erroneous syntax and need to look into it a bit more. In the meantime does anybody have any hints/tips regarding this??
Rollup merge of #65891 - michaelwoerister:sp-crate-metadata, r=wesleywiser
self-profiling: Record something more useful for crate metadata generation event.
Before this commit, we had an event that would only track the compression step
for proc-macros and Rust dylibs. After the commit we measure the time for
acutally generating the crate metadata bytes.