Commit Graph

128822 Commits

Author SHA1 Message Date
Dylan MacKenzie
29e5e6e766 Use MIR dump interface for dataflow 2020-10-05 10:14:40 -07:00
bors
f317a93d4d Auto merge of #77543 - Mark-Simulacrum:rsp-quoting, r=eddyb
Force posix-style quoting on lld, independent of host platform

This just blindly applies the logic from `@eddyb's` comment here: https://github.com/rust-lang/rust/issues/76466#issuecomment-699024973

Hopefully, this fixed #76466 -- I cannot test this though.
2020-10-05 13:54:22 +00:00
Mark Rousskov
e8325b0f40 Instruct lld that our @ files are posix-style, not Windows
An upstream LLVM change changed behavior here to respect the host system quoting
rules; previously the posix-style format was always used for @files.
2020-10-05 08:01:44 -04:00
bors
d890e64dff Auto merge of #77549 - tmiasko:simplify-branch-same-fix, r=oli-obk
Fix miscompile in SimplifyBranchSame

Cherry-picked from #77486, but with a different test case that used to be compiled incorrectly on both master & beta branches.
2020-10-05 11:41:59 +00:00
bors
62bfcfd8a3 Auto merge of #77552 - ecstatic-morse:body-def-id, r=lcnr
Replace `(Body, DefId)` with `Body` where possible

Follow-up to #77430.

I `grep`-ed for parameter lists in which a `Body` appeared within a few lines of a `DefId`, so it's possible that I missed some cases, but this should be pretty complete. Most of these changes were mechanical, but there's a few places where I started calling things "caller" and "callee" when multiple `DefId`s were in-scope at once. Also, we should probably have a helper function on `Body` that returns a `LocalDefId`. I can do that in this PR or in a follow-up.
2020-10-05 09:26:32 +00:00
bors
efbaa41306 Auto merge of #77557 - Dylan-DPC:rollup-aib9ptp, r=Dylan-DPC
Rollup of 11 pull requests

Successful merges:

 - #75853 (Use more intra-doc-links in `core::fmt`)
 - #75928 (Remove trait_selection error message in specific case)
 - #76329 (Add check for doc alias attribute at crate level)
 - #77219 (core::global_allocator docs link to std::alloc::GlobalAlloc)
 - #77395 (BTreeMap: admit the existence of leaf edges in comments)
 - #77407 (Improve build-manifest to work with the improved promote-release)
 - #77426 (Include scope id in SocketAddrV6::Display)
 - #77439 (Fix missing diagnostic span for `impl Trait` with const generics, and add various tests for `min_const_generics` and `const_generics`)
 - #77471 (BTreeMap: refactoring around edges, missed spots)
 - #77512 (Allow `Abort` terminators in all const-contexts)
 - #77514 (Replace some once(x).chain(once(y)) with [x, y] IntoIter)

Failed merges:

r? `@ghost`
2020-10-05 02:49:51 +00:00
bors
ced813fec0 Auto merge of #77466 - Aaron1011:reland-drop-tree, r=matthewjasper
Re-land PR #71840 (Rework MIR drop tree lowering)

PR https://github.com/rust-lang/rust/pull/71840 was reverted in https://github.com/rust-lang/rust/pull/72989 to fix an LLVM error (https://github.com/rust-lang/rust/issues/72470). That LLVM error no longer occurs with the recent upgrade to LLVM 11 (https://github.com/rust-lang/rust/pull/73526), so let's try re-landing this PR.

I've cherry-picked the commits from the original PR (with the exception of the commit blessing test output), making as few modifications as possible. I addressed the rebase fallout in separate commits on top of those.

r? `@matthewjasper`
2020-10-05 00:35:58 +00:00
Dylan DPC
9dbc9ed870
Rollup merge of #77514 - scottmcm:less-once-chain-once, r=estebank
Replace some once(x).chain(once(y)) with [x, y] IntoIter

Now that we have by-value array iterators that are [already used](25c8c53dd9/compiler/rustc_hir/src/def.rs (L305-L307))...

For example,
```diff
-        once(self.type_ns).chain(once(self.value_ns)).chain(once(self.macro_ns)).filter_map(|it| it)
+        IntoIter::new([self.type_ns, self.value_ns, self.macro_ns]).filter_map(|it| it)
```
2020-10-05 02:29:42 +02:00
Dylan DPC
5fbb41108a
Rollup merge of #77512 - ecstatic-morse:const-checking-allow-abort, r=RalfJung
Allow `Abort` terminators in all const-contexts

We never unwind during const-eval, so we basically have these semantics already. Also I just figured out that these only appear along the cleanup path, which doesn't get const-checked. In other words, this doesn't actually change behavior: the `check-pass` test I added compiles just fine on nightly.

r? @RalfJung
cc @rust-lang/wg-const-eval
2020-10-05 02:29:40 +02:00
Dylan DPC
23b1e3d772
Rollup merge of #77471 - ssomers:btree_cleanup_3, r=Mark-Simulacrum
BTreeMap: refactoring around edges, missed spots

Tweaks from #77244 (and more) that are really inconsistencies in #77005.

r? @Mark-Simulacrum
2020-10-05 02:29:38 +02:00
Dylan DPC
e032bb7c65
Rollup merge of #77439 - varkor:min_const_generics-tests, r=lcnr,estebank
Fix missing diagnostic span for `impl Trait` with const generics, and add various tests for `min_const_generics` and `const_generics`

Closes https://github.com/rust-lang/rust/issues/61410.

Adds `min_const_generics` tests for:
- https://github.com/rust-lang/rust/issues/73727
- https://github.com/rust-lang/rust/issues/72293
- https://github.com/rust-lang/rust/issues/67375
- https://github.com/rust-lang/rust/issues/75153
- https://github.com/rust-lang/rust/issues/71922
- https://github.com/rust-lang/rust/issues/69913
- https://github.com/rust-lang/rust/issues/67945
- https://github.com/rust-lang/rust/issues/69239

Adds `const_generics` tests for:
- https://github.com/rust-lang/rust/issues/67375
- https://github.com/rust-lang/rust/issues/75153
- https://github.com/rust-lang/rust/issues/71922
- https://github.com/rust-lang/rust/issues/69913
- https://github.com/rust-lang/rust/issues/67945
- https://github.com/rust-lang/rust/issues/69239

(I only added separate `min_const_generics` and `const_generics` tests if they were handled differently by the two features.)

We need to figure out how to deduplicate when `const_generics` is stabilised, but we can discuss that later. For now, we should be checking neither feature breaks, so require regression tests for both. I've given them identical names when I've added both, which should make it easier to spot them later.

r? @lcnr
2020-10-05 02:29:36 +02:00
Dylan DPC
f1afed541e
Rollup merge of #77426 - tamird:sockaddr-scope-id, r=dtolnay
Include scope id in SocketAddrV6::Display

r? @tmandry

I couldn't find any unit tests for these functions.

cc @ghanan94 @brunowonka
2020-10-05 02:29:35 +02:00
Dylan DPC
fffeaa7b83
Rollup merge of #77407 - pietroalbini:less-build-manifest, r=Mark-Simulacrum
Improve build-manifest to work with the improved promote-release

This PR makes some changes to build-manifest to have it work better with the other improvements I'm making to [promote-release](https://github.com/rust-lang/promote-release).

A new way to invoke the tool was added: `./x.py run src/tools/build-manifest`. The new invocation disables the generation of `.sha256` files and the generation of GPG signatures, as those steps are not tied to the Rust version we're building the manifest of: handling them in `promote-release` will improve the maintenability of our release process. Invocations through the old command (`./x.py dist hash-and-sign`) are referred inside the source code as "legacy". The new invocation also enables internal parallelism, disabled on legacy to avoid overloading our old server.

Improvements were also made on how the checksums included in the manifest are generated:

* The manifest is first generated with placeholder checksums, and then a function walks through the manifes and calculates only the needed hashes. Before this PR, all the hashes were calculated beforehand, including the hashes of unused files.
* Calculating the hashes is now done in parallel with rayon, to better utilize all the available disk bandwidth.
* The `sha2` crate is now used instead of the `sha256sum` CLI tool: this avoids the overhead of calling another process, but more importantly enables hardware acceleration whenever available (the `sha256sum` CLI tool doesn't support it at all).

r? @Mark-Simulacrum
This PR is best reviewed commit-by-commit.
2020-10-05 02:29:33 +02:00
Dylan DPC
fe087ece94
Rollup merge of #77395 - ssomers:btree_love_the_leaf_edge_comments, r=Mark-Simulacrum
BTreeMap: admit the existence of leaf edges in comments

The btree code is ambiguous about leaf edges (i.e., edges within leaf nodes). Iteration relies on them heavily, but some of the comments suggest there are no leaf edges (extracted from #77025)

r? @Mark-Simulacrum
2020-10-05 02:29:31 +02:00
Dylan DPC
583269d8c5
Rollup merge of #77219 - mightyiam:issue_77100, r=jyn514
core::global_allocator docs link to std::alloc::GlobalAlloc

Closes #77100
2020-10-05 02:29:29 +02:00
Dylan DPC
e6e7ccc28d
Rollup merge of #76329 - GuillaumeGomez:doc-alias-crate-level, r=matthewjasper
Add check for doc alias attribute at crate level

Fixes #76298, #64734, #69365.

r? @ollie27
2020-10-05 02:29:27 +02:00
Dylan DPC
5fa978fa1b
Rollup merge of #75928 - JulianKnodt:non_utf8, r=estebank
Remove trait_selection error message in specific case

In the case that a trait is not implemented for an ADT with type errors, cancel the error.

Fixes #75627
2020-10-05 02:29:25 +02:00
Dylan DPC
6c9e85726c
Rollup merge of #75853 - LeSeulArtichaut:core-intra-docs-3, r=jyn514
Use more intra-doc-links in `core::fmt`

This is a follow-up to #75819, which encountered some broken links due to #75176, so this PR contains the links that are blocked on #75176.

r? @jyn514
2020-10-05 02:29:23 +02:00
Dylan MacKenzie
04a94abcb9 Remove DefId from MirBorrowckCtxt 2020-10-04 17:23:55 -07:00
Dylan MacKenzie
fff3b7596a nll: solve 2020-10-04 17:22:40 -07:00
Dylan MacKenzie
2e35cf973b Replace (Body, WithOptConstParam) with Body where possible 2020-10-04 16:59:51 -07:00
Dylan MacKenzie
52484c59e5 clippy: (Body, DefId) -> Body 2020-10-04 16:07:03 -07:00
Dylan MacKenzie
e72e43c730 Replace (Body, DefId) with Body where possible
A `Body` now contains its `MirSource`, which in turn contains the
`DefId` of the item associated with the `Body`.
2020-10-04 16:07:03 -07:00
bors
beb5ae474d Auto merge of #77023 - HeroicKatora:len-missed-optimization, r=Mark-Simulacrum
Hint the maximum length permitted by invariant of slices

One of the safety invariants of references, and in particular of references to slices, is that they may not cover more than `isize::MAX` bytes. The unsafe `from_raw_parts` constructors of slices explicitly requires the caller to guarantee this fact. Violating it would also be UB with regards to the semantics of generated llvm code.

This effectively bounds the length of a (non-ZST) slice from above by a compile time constant. But when the length is loaded from a function argument it appears llvm is not aware of this requirement. The additional value range assertions allow some further elision of code branches, including overflow checks, especially in the presence of artithmetic on the indices.

This may have a performance impact, adding more code to a common method but allowing more optimization. I'm not quite sure, is the Rust side of const-prop strong enough to elide the irrelevant match branches?

Fixes: #67186
2020-10-04 21:08:06 +00:00
LeSeulArtichaut
17d3c0a178 Use more intra-doc-links in core::fmt 2020-10-04 22:33:22 +02:00
ecstatic-morse
6ae1da3198
But whatever 2020-10-04 13:25:45 -07:00
ecstatic-morse
fe97990e23
Add comment to Abort match arm
Co-authored-by: Ralf Jung <post@ralfj.de>
2020-10-04 13:02:54 -07:00
Aaron Hill
ce8d75714b
Bless more test output 2020-10-04 14:53:32 -04:00
Andreas Molzer
e44784b875 Assume slice len is bounded by allocation size
Uses assume to check the length against a constant upper bound. The
inlined result then informs the optimizer of the sound value range.

This was tried with unreachable_unchecked before which introduces a
branch. This has the advantage of not being executed in sound code but
complicates basic blocks. It resulted in ~2% increased compile time in
some worst cases.

Add a codegen test for the assumption, testing the issue from #67186
2020-10-04 20:43:36 +02:00
bors
4ccf5f731b Auto merge of #77430 - ecstatic-morse:mir-source-in-body, r=lcnr
Store a `MirSource` inside every `Body`

Resolves #77427.

r? `@ghost`
2020-10-04 18:24:02 +00:00
Dylan MacKenzie
606655edc4 HACK: Overwrite the MIR's source with the correct const param
There's a cleaner way of doing this, but it involves passing
`WithOptConstParam` around in more places. We're going to try to explore
different approaches before committing to that.
2020-10-04 11:02:16 -07:00
Dylan MacKenzie
6f61e71648 Remember the MirSource for each Body 2020-10-04 11:01:38 -07:00
Dylan MacKenzie
938d8fd805 Move MirSource to rustc_middle 2020-10-04 11:01:13 -07:00
Dylan MacKenzie
141a977edf Miscellaneous import formatting 2020-10-04 10:59:55 -07:00
Dylan MacKenzie
25fdbaff44 Discuss cleanup blocks and span_bug on Abort 2020-10-04 10:41:08 -07:00
bors
a835b483fe Auto merge of #77527 - jonas-schievink:rollup-szgq5he, r=jonas-schievink
Rollup of 8 pull requests

Successful merges:

 - #77072 (Minor `hash_map` doc adjustments + item attribute orderings)
 - #77368 (Backport LLVM apfloat commit to rustc_apfloat)
 - #77445 (BTreeMap: complete the compile-time test_variance test case)
 - #77504 (Support vectors with fewer than 8 elements for simd_select_bitmask)
 - #77513 (Change DocFragments from enum variant fields to structs with a nested enum)
 - #77518 (Only use Fira Sans for the first `td` in item lists)
 - #77521 (Move target feature whitelist from cg_llvm to cg_ssa)
 - #77525 (Enable RenameReturnPlace MIR optimization on mir-opt-level >= 2)

Failed merges:

r? `@ghost`
2020-10-04 13:49:36 +00:00
Jonas Schievink
fa200cec88
Rollup merge of #77525 - tmiasko:nrvo-2, r=jonas-schievink
Enable RenameReturnPlace MIR optimization on mir-opt-level >= 2

The destination propagation as currently implemented does not supersede the NRVO, e.g., the destination propagation never applies if either local has an address taken, while NRVO might.

Additionally, the issue with failing assertions had been already resolved.

Continue running both optimizations at mir-opt-level >= 2.
2020-10-04 15:45:50 +02:00
Jonas Schievink
5889cf3146
Rollup merge of #77521 - bjorn3:target_feature_whitelist, r=lcnr
Move target feature whitelist from cg_llvm to cg_ssa

These target features have to be supported or at least emulated by alternative codegen backends anyway as they are used by common crates. By moving this list to cg_ssa, other codegen backends don't have to copy
this code.
2020-10-04 15:45:48 +02:00
Jonas Schievink
ec9b4d5e6c
Rollup merge of #77518 - camelid:rustdoc-use-correct-link-font, r=GuillaumeGomez
Only use Fira Sans for the first `td` in item lists

Fixes #77516.

Fixes an issue where links in the one-line version of an item's docs
would be in Fira Sans, while the rest would be in a serifed font.
2020-10-04 15:45:46 +02:00
Jonas Schievink
94bd3c9816
Rollup merge of #77513 - jyn514:refactor-doc-fragments, r=GuillaumeGomez
Change DocFragments from enum variant fields to structs with a nested enum

This makes the code a lot easier to work with. It also makes it easier
to add new fields without updating each variant and `match`
individually.

- Name the `Kind` variant after `DocFragmentKind` from `collapse_docs`
- Remove unneeded impls

Progress towards https://github.com/rust-lang/rust/issues/77254.
r? @GuillaumeGomez
2020-10-04 15:45:44 +02:00
Jonas Schievink
5bd9ce5cd4
Rollup merge of #77504 - Amanieu:select_simd_bitmask, r=ecstatic-morse
Support vectors with fewer than 8 elements for simd_select_bitmask

Resolves the issue raised here: https://github.com/rust-lang/stdarch/issues/310#issuecomment-693730094
2020-10-04 15:45:43 +02:00
Jonas Schievink
80953177ed
Rollup merge of #77445 - ssomers:btree_cleanup_7, r=Mark-Simulacrum
BTreeMap: complete the compile-time test_variance test case

Some of the items added to the new `test_sync` belonged in the old `test_variance` as well. And fixed inconsistent paths to nearby modules.
r? @Mark-Simulacrum
2020-10-04 15:45:41 +02:00
Jonas Schievink
9ea462fd70
Rollup merge of #77368 - est31:apfloat_fix, r=varkor
Backport LLVM apfloat commit to rustc_apfloat

Backports LLVM commit: e34bd1e0b0

Fixes #69532
2020-10-04 15:45:39 +02:00
Jonas Schievink
4ae7710e1d
Rollup merge of #77072 - sharnoff:hash-docs, r=LukasKalbertodt
Minor `hash_map` doc adjustments + item attribute orderings

This PR is really a couple visual changes glued together:
1. Some of the doc comments for items in `std::collections::hash_map` referenced the names of types without escaping their formatting (e.g. using "VacantEntry" instead of "`VacantEntry`") - the ones I could find were changed to the latter
2. The vast majority of pre-item attributes seem to place doc comments as the first attribute (instead of things like `#[feature(...)]`), so the few that had the other order were changed.
3. Also ordering related: the general trend seems to be that `#[feature]` attributes follow `#[inline]`, so I swapped the two lines in places where that ordering was reversed. This is primarily a change based on stylistic continuity and aesthetics - I'm not sure how important that actually is / should be.

I figured this would be pretty uncontroversial, but some of these might have been intentional for reasons I don't know about - if so, I'd be happy to remove the relevant changes. Of these, the final set of changes is probably the most unnecessary, so it also might be better to leave those out (in favor of reducing code churn).
2020-10-04 15:45:33 +02:00
Tamir Duberstein
4585c22818
Include scope id in SocketAddrV6::Display 2020-10-04 12:18:12 +00:00
Aaron Hill
eb94cdd85e
Apply suggestions from review
Co-authored-by: matthewjasper <20113453+matthewjasper@users.noreply.github.com>
2020-10-04 07:54:03 -04:00
Aaron Hill
33337bb855
Bless mir-opt tests 2020-10-04 07:54:02 -04:00
Aaron Hill
8478385ea4
Fix broken link 2020-10-04 07:54:02 -04:00
Aaron Hill
f23e9a1adf
Add regression test for issue #72470
This was fixed with the upgrade to LLVM 11 in #73526.
It seems extremely unlikey that this exact issue will ever reoccur,
since slight modifications to the code caused the crash to stop
happening. However, it can't hurt to have a test for it.
2020-10-04 07:54:02 -04:00
Aaron Hill
4c83eec008
Fix rebase fallout 2020-10-04 07:54:02 -04:00