]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoUpdate RLS and Rustfmt
Igor Matuszewski [Mon, 5 Oct 2020 19:40:20 +0000 (21:40 +0200)]
Update RLS and Rustfmt

3 years agoAuto merge of #77543 - Mark-Simulacrum:rsp-quoting, r=eddyb
bors [Mon, 5 Oct 2020 13:54:22 +0000 (13:54 +0000)]
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.

3 years agoInstruct lld that our @ files are posix-style, not Windows
Mark Rousskov [Sun, 4 Oct 2020 20:10:08 +0000 (16:10 -0400)]
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.

3 years agoAuto merge of #77549 - tmiasko:simplify-branch-same-fix, r=oli-obk
bors [Mon, 5 Oct 2020 11:41:59 +0000 (11:41 +0000)]
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.

3 years agoAuto merge of #77552 - ecstatic-morse:body-def-id, r=lcnr
bors [Mon, 5 Oct 2020 09:26:32 +0000 (09:26 +0000)]
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.

3 years agoAuto merge of #77557 - Dylan-DPC:rollup-aib9ptp, r=Dylan-DPC
bors [Mon, 5 Oct 2020 02:49:51 +0000 (02:49 +0000)]
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`

3 years agoAuto merge of #77466 - Aaron1011:reland-drop-tree, r=matthewjasper
bors [Mon, 5 Oct 2020 00:35:58 +0000 (00:35 +0000)]
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`

3 years agoRollup merge of #77514 - scottmcm:less-once-chain-once, r=estebank
Dylan DPC [Mon, 5 Oct 2020 00:29:42 +0000 (02:29 +0200)]
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](https://github.com/rust-lang/rust/blob/25c8c53dd994acb3f4f7c02fe6bb46076393f8b0/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)
```

3 years agoRollup merge of #77512 - ecstatic-morse:const-checking-allow-abort, r=RalfJung
Dylan DPC [Mon, 5 Oct 2020 00:29:40 +0000 (02:29 +0200)]
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

3 years agoRollup merge of #77471 - ssomers:btree_cleanup_3, r=Mark-Simulacrum
Dylan DPC [Mon, 5 Oct 2020 00:29:38 +0000 (02:29 +0200)]
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

3 years agoRollup merge of #77439 - varkor:min_const_generics-tests, r=lcnr,estebank
Dylan DPC [Mon, 5 Oct 2020 00:29:36 +0000 (02:29 +0200)]
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

3 years agoRollup merge of #77426 - tamird:sockaddr-scope-id, r=dtolnay
Dylan DPC [Mon, 5 Oct 2020 00:29:35 +0000 (02:29 +0200)]
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

3 years agoRollup merge of #77407 - pietroalbini:less-build-manifest, r=Mark-Simulacrum
Dylan DPC [Mon, 5 Oct 2020 00:29:33 +0000 (02:29 +0200)]
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.

3 years agoRollup merge of #77395 - ssomers:btree_love_the_leaf_edge_comments, r=Mark-Simulacrum
Dylan DPC [Mon, 5 Oct 2020 00:29:31 +0000 (02:29 +0200)]
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

3 years agoRollup merge of #77219 - mightyiam:issue_77100, r=jyn514
Dylan DPC [Mon, 5 Oct 2020 00:29:29 +0000 (02:29 +0200)]
Rollup merge of #77219 - mightyiam:issue_77100, r=jyn514

core::global_allocator docs link to std::alloc::GlobalAlloc

Closes #77100

3 years agoRollup merge of #76329 - GuillaumeGomez:doc-alias-crate-level, r=matthewjasper
Dylan DPC [Mon, 5 Oct 2020 00:29:27 +0000 (02:29 +0200)]
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

3 years agoRollup merge of #75928 - JulianKnodt:non_utf8, r=estebank
Dylan DPC [Mon, 5 Oct 2020 00:29:25 +0000 (02:29 +0200)]
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

3 years agoRollup merge of #75853 - LeSeulArtichaut:core-intra-docs-3, r=jyn514
Dylan DPC [Mon, 5 Oct 2020 00:29:23 +0000 (02:29 +0200)]
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

3 years agoRemove `DefId` from `MirBorrowckCtxt`
Dylan MacKenzie [Mon, 5 Oct 2020 00:23:02 +0000 (17:23 -0700)]
Remove `DefId` from `MirBorrowckCtxt`

3 years agonll: solve
Dylan MacKenzie [Mon, 5 Oct 2020 00:22:40 +0000 (17:22 -0700)]
nll: solve

3 years agoReplace `(Body, WithOptConstParam)` with `Body` where possible
Dylan MacKenzie [Sun, 4 Oct 2020 23:59:19 +0000 (16:59 -0700)]
Replace `(Body, WithOptConstParam)` with `Body` where possible

3 years agoclippy: `(Body, DefId)` -> `Body`
Dylan MacKenzie [Sun, 4 Oct 2020 22:23:20 +0000 (15:23 -0700)]
clippy: `(Body, DefId)` -> `Body`

3 years agoReplace `(Body, DefId)` with `Body` where possible
Dylan MacKenzie [Sun, 4 Oct 2020 22:22:23 +0000 (15:22 -0700)]
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`.

3 years agoAuto merge of #77023 - HeroicKatora:len-missed-optimization, r=Mark-Simulacrum
bors [Sun, 4 Oct 2020 21:08:06 +0000 (21:08 +0000)]
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
3 years agoUse more intra-doc-links in `core::fmt`
LeSeulArtichaut [Sun, 23 Aug 2020 22:16:19 +0000 (00:16 +0200)]
Use more intra-doc-links in `core::fmt`

3 years agoBut whatever
ecstatic-morse [Sun, 4 Oct 2020 20:25:45 +0000 (13:25 -0700)]
But whatever

3 years agoAdd comment to `Abort` match arm
ecstatic-morse [Sun, 4 Oct 2020 20:02:54 +0000 (13:02 -0700)]
Add comment to `Abort` match arm

Co-authored-by: Ralf Jung <post@ralfj.de>
3 years agoBless more test output
Aaron Hill [Sun, 4 Oct 2020 11:57:53 +0000 (07:57 -0400)]
Bless more test output

3 years agoAssume slice len is bounded by allocation size
Andreas Molzer [Sun, 20 Sep 2020 15:22:17 +0000 (17:22 +0200)]
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

3 years agoAuto merge of #77430 - ecstatic-morse:mir-source-in-body, r=lcnr
bors [Sun, 4 Oct 2020 18:24:02 +0000 (18:24 +0000)]
Auto merge of #77430 - ecstatic-morse:mir-source-in-body, r=lcnr

Store a `MirSource` inside every `Body`

Resolves #77427.

r? `@ghost`

3 years agoHACK: Overwrite the MIR's source with the correct const param
Dylan MacKenzie [Fri, 2 Oct 2020 01:47:36 +0000 (18:47 -0700)]
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.

3 years agoRemember the `MirSource` for each `Body`
Dylan MacKenzie [Sun, 4 Oct 2020 18:01:38 +0000 (11:01 -0700)]
Remember the `MirSource` for each `Body`

3 years agoMove `MirSource` to `rustc_middle`
Dylan MacKenzie [Sun, 4 Oct 2020 18:01:13 +0000 (11:01 -0700)]
Move `MirSource` to `rustc_middle`

3 years agoMiscellaneous import formatting
Dylan MacKenzie [Sun, 4 Oct 2020 17:59:11 +0000 (10:59 -0700)]
Miscellaneous import formatting

3 years agoDiscuss cleanup blocks and `span_bug` on `Abort`
Dylan MacKenzie [Sun, 4 Oct 2020 17:39:12 +0000 (10:39 -0700)]
Discuss cleanup blocks and `span_bug` on `Abort`

3 years agoAuto merge of #77527 - jonas-schievink:rollup-szgq5he, r=jonas-schievink
bors [Sun, 4 Oct 2020 13:49:36 +0000 (13:49 +0000)]
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`

3 years agoRollup merge of #77525 - tmiasko:nrvo-2, r=jonas-schievink
Jonas Schievink [Sun, 4 Oct 2020 13:45:50 +0000 (15:45 +0200)]
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.

3 years agoRollup merge of #77521 - bjorn3:target_feature_whitelist, r=lcnr
Jonas Schievink [Sun, 4 Oct 2020 13:45:48 +0000 (15:45 +0200)]
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.

3 years agoRollup merge of #77518 - camelid:rustdoc-use-correct-link-font, r=GuillaumeGomez
Jonas Schievink [Sun, 4 Oct 2020 13:45:46 +0000 (15:45 +0200)]
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.

3 years agoRollup merge of #77513 - jyn514:refactor-doc-fragments, r=GuillaumeGomez
Jonas Schievink [Sun, 4 Oct 2020 13:45:44 +0000 (15:45 +0200)]
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

3 years agoRollup merge of #77504 - Amanieu:select_simd_bitmask, r=ecstatic-morse
Jonas Schievink [Sun, 4 Oct 2020 13:45:43 +0000 (15:45 +0200)]
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

3 years agoRollup merge of #77445 - ssomers:btree_cleanup_7, r=Mark-Simulacrum
Jonas Schievink [Sun, 4 Oct 2020 13:45:41 +0000 (15:45 +0200)]
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

3 years agoRollup merge of #77368 - est31:apfloat_fix, r=varkor
Jonas Schievink [Sun, 4 Oct 2020 13:45:39 +0000 (15:45 +0200)]
Rollup merge of #77368 - est31:apfloat_fix, r=varkor

Backport LLVM apfloat commit to rustc_apfloat

Backports LLVM commit: https://github.com/llvm/llvm-project/commit/e34bd1e0b03d20a506ada156d87e1b3a96d82fa2

Fixes #69532

3 years agoRollup merge of #77072 - sharnoff:hash-docs, r=LukasKalbertodt
Jonas Schievink [Sun, 4 Oct 2020 13:45:33 +0000 (15:45 +0200)]
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).

3 years agoInclude scope id in SocketAddrV6::Display
Tamir Duberstein [Thu, 1 Oct 2020 20:40:05 +0000 (20:40 +0000)]
Include scope id in SocketAddrV6::Display

3 years agoApply suggestions from review
Aaron Hill [Sat, 3 Oct 2020 15:49:05 +0000 (11:49 -0400)]
Apply suggestions from review

Co-authored-by: matthewjasper <20113453+matthewjasper@users.noreply.github.com>
3 years agoBless mir-opt tests
Aaron Hill [Fri, 2 Oct 2020 20:11:24 +0000 (16:11 -0400)]
Bless mir-opt tests

3 years agoFix broken link
Aaron Hill [Fri, 2 Oct 2020 21:24:54 +0000 (17:24 -0400)]
Fix broken link

3 years agoAdd regression test for issue #72470
Aaron Hill [Fri, 2 Oct 2020 20:30:36 +0000 (16:30 -0400)]
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.

3 years agoFix rebase fallout
Aaron Hill [Fri, 2 Oct 2020 19:40:24 +0000 (15:40 -0400)]
Fix rebase fallout

3 years agoAddress review comments
Matthew Jasper [Fri, 8 May 2020 19:00:32 +0000 (20:00 +0100)]
Address review comments

3 years agoAdd some more comments
Matthew Jasper [Sat, 29 Feb 2020 17:48:09 +0000 (17:48 +0000)]
Add some more comments

3 years agoReduce the number of drop-flag assignments in unwind paths
Matthew Jasper [Sun, 17 Nov 2019 11:30:48 +0000 (11:30 +0000)]
Reduce the number of drop-flag assignments in unwind paths

3 years agoDefer creating drop trees in MIR lowering until leaving that scope
Matthew Jasper [Sat, 16 Nov 2019 13:23:31 +0000 (13:23 +0000)]
Defer creating drop trees in MIR lowering until leaving that scope

3 years agoAuto merge of #76610 - hch12907:master, r=LukasKalbertodt
bors [Sun, 4 Oct 2020 11:48:50 +0000 (11:48 +0000)]
Auto merge of #76610 - hch12907:master, r=LukasKalbertodt

Implement as_ne_bytes() for integers and floats

This is related to issue #64464.

I am pretty sure that these functions are actually const-ify-able, and technically as_bits() can also be implemented for floats, but I might need some comments on both.

3 years agoEnforce crate level attributes checks
Guillaume Gomez [Sat, 3 Oct 2020 18:45:39 +0000 (20:45 +0200)]
Enforce crate level attributes checks

3 years agoMove target feature whitelist from cg_llvm to cg_ssa
bjorn3 [Sun, 4 Oct 2020 09:12:56 +0000 (11:12 +0200)]
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.

3 years agoAuto merge of #76448 - haraldh:default_alloc_error_handler_reduced, r=Amanieu
bors [Sun, 4 Oct 2020 08:56:05 +0000 (08:56 +0000)]
Auto merge of #76448 - haraldh:default_alloc_error_handler_reduced, r=Amanieu

Implement Make `handle_alloc_error` default to panic (for no_std + liballoc)

Related: https://github.com/rust-lang/rust/issues/66741

Guarded with `#![feature(default_alloc_error_handler)]` a default
`alloc_error_handler` is called, if a custom allocator is used and no
other custom `#[alloc_error_handler]` is defined.

3 years agoAuto merge of #77380 - fusion-engineering-forks:unbox-the-mutex, r=dtolnay
bors [Sun, 4 Oct 2020 06:48:17 +0000 (06:48 +0000)]
Auto merge of #77380 - fusion-engineering-forks:unbox-the-mutex, r=dtolnay

Unbox mutexes and condvars on some platforms

Both mutexes and condition variables contained a Box containing the actual os-specific object. This was done because moving these objects may cause undefined behaviour on some platforms.

However, this is not needed on Windows[1], Wasm[2], cloudabi[2], and 'unsupported'[3], were the box was only needlessly making them less efficient.

This change gets rid of the box on those platforms.

On those platforms, `Condvar` can no longer verify it is only used with one `Mutex`, as mutexes no longer have a stable address. This was addressed and considered acceptable in #76932.

[1]\: https://docs.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-initializesrwlock
[2]\: These are just a single atomic integer together with futex wait/wake calls/instructions.
[3]\: The `unsupported` platform doesn't support multiple threads at all.

3 years agoAuto merge of #77517 - JohnTitor:rollup-msbd49e, r=JohnTitor
bors [Sun, 4 Oct 2020 04:33:28 +0000 (04:33 +0000)]
Auto merge of #77517 - JohnTitor:rollup-msbd49e, r=JohnTitor

Rollup of 11 pull requests

Successful merges:

 - #75143 (Use `tracing` spans to trace the entire MIR interp stack)
 - #75699 (Uplift drop-bounds lint from clippy)
 - #76768 (Test and reject out-of-bounds shuffle vectors)
 - #77190 (updated p! macro to accept literals)
 - #77388 (Add some regression tests)
 - #77419 (Create E0777 error code for invalid argument in derive)
 - #77447 (BTreeMap: document DrainFilterInner better)
 - #77468 (Fix test name)
 - #77469 (Improve rustdoc error for failed intra-doc link resolution)
 - #77473 (Make --all-targets in x.py check opt-in)
 - #77508 (Fix capitalization in blog post name)

Failed merges:

r? `@ghost`

3 years agoOnly use Fira Sans for the first `td` in item lists
Camelid [Sun, 4 Oct 2020 02:52:35 +0000 (19:52 -0700)]
Only use Fira Sans for the first `td` in item lists

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.

3 years agoRollup merge of #77508 - camelid:patch-8, r=jonas-schievink
Yuki Okushi [Sun, 4 Oct 2020 02:45:11 +0000 (11:45 +0900)]
Rollup merge of #77508 - camelid:patch-8, r=jonas-schievink

Fix capitalization in blog post name

3 years agoRollup merge of #77473 - Mark-Simulacrum:check-limited, r=ecstatic-morse
Yuki Okushi [Sun, 4 Oct 2020 02:45:10 +0000 (11:45 +0900)]
Rollup merge of #77473 - Mark-Simulacrum:check-limited, r=ecstatic-morse

Make --all-targets in x.py check opt-in

In particular due to #76822, making this the default is currently suboptimal.

r? @ecstatic-morse

3 years agoRollup merge of #77469 - camelid:rustdoc-better-failed-res-error, r=jyn514
Yuki Okushi [Sun, 4 Oct 2020 02:45:08 +0000 (11:45 +0900)]
Rollup merge of #77469 - camelid:rustdoc-better-failed-res-error, r=jyn514

Improve rustdoc error for failed intra-doc link resolution

The previous error was confusing since it made it sound like you can't
link to items that are defined outside the current module.

Also suggested importing the item.

r? @jyn514

3 years agoRollup merge of #77468 - camelid:fix-test-name, r=Dylan-DPC
Yuki Okushi [Sun, 4 Oct 2020 02:45:06 +0000 (11:45 +0900)]
Rollup merge of #77468 - camelid:fix-test-name, r=Dylan-DPC

Fix test name

Remove trailing `-`.

3 years agoRollup merge of #77447 - ssomers:btree_cleanup_8, r=Mark-Simulacrum
Yuki Okushi [Sun, 4 Oct 2020 02:45:04 +0000 (11:45 +0900)]
Rollup merge of #77447 - ssomers:btree_cleanup_8, r=Mark-Simulacrum

BTreeMap: document DrainFilterInner better

r? @Mark-Simulacrum

3 years agoRollup merge of #77419 - GuillaumeGomez:create-e0777, r=jyn514
Yuki Okushi [Sun, 4 Oct 2020 02:45:03 +0000 (11:45 +0900)]
Rollup merge of #77419 - GuillaumeGomez:create-e0777, r=jyn514

Create E0777 error code for invalid argument in derive

The second commit is to fix a nit reported by @jyn514 [here](https://github.com/rust-lang/rust/pull/76406/files#r485186592).

3 years agoRollup merge of #77388 - JohnTitor:add-tests, r=Dylan-DPC
Yuki Okushi [Sun, 4 Oct 2020 02:45:01 +0000 (11:45 +0900)]
Rollup merge of #77388 - JohnTitor:add-tests, r=Dylan-DPC

Add some regression tests

Closes #66501
Closes #68951
Closes #72565
Closes #74244
Closes #75299

The first issue is fixed in 1.43.0, other issues are fixed in the recent nightly.

3 years agoRollup merge of #77190 - jakevossen5:master, r=eddyb
Yuki Okushi [Sun, 4 Oct 2020 02:44:59 +0000 (11:44 +0900)]
Rollup merge of #77190 - jakevossen5:master, r=eddyb

updated p! macro to accept literals

Closes #70948

Huge thanks @eddyb for helping me out!

3 years agoRollup merge of #76768 - workingjubilee:reject-oob-shuffles, r=ralfjung
Yuki Okushi [Sun, 4 Oct 2020 02:44:57 +0000 (11:44 +0900)]
Rollup merge of #76768 - workingjubilee:reject-oob-shuffles, r=ralfjung

Test and reject out-of-bounds shuffle vectors

Fixes #73542.

3 years agoRollup merge of #75699 - notriddle:drop-bounds-lint, r=petrochenkov
Yuki Okushi [Sun, 4 Oct 2020 02:44:55 +0000 (11:44 +0900)]
Rollup merge of #75699 - notriddle:drop-bounds-lint, r=petrochenkov

Uplift drop-bounds lint from clippy

Bounds on `T: Drop` do nothing, so they should warn.

3 years agoRollup merge of #75143 - oli-obk:tracing, r=RalfJung
Yuki Okushi [Sun, 4 Oct 2020 02:44:49 +0000 (11:44 +0900)]
Rollup merge of #75143 - oli-obk:tracing, r=RalfJung

Use `tracing` spans to trace the entire MIR interp stack

r? @RalfJung

While being very verbose, this allows really good tracking of what's going on. While I considered schemes like the previous indenter that we had (which we could get by using the `tracing-tree` crate), this will break down horribly with things like multithreaded rustc. Instead, we can now use `RUSTC_LOG` to restrict the things being traced. You could specify a filter in a way that only shows the logging of a specific frame.

![screenshot of command line output of the new formatting](https://user-images.githubusercontent.com/332036/89291343-aa40de00-d65a-11ea-9f6c-ea06c1806327.png)

If we lower the span's level to `debug`, then in `info` level logging we'd not see the frames, but in `debug` level we would see them. The filtering rules in `tracing` are super powerful, but  I'm not sure if we can specify a filter so we do see `debug` level events, but *not* the `frame` spans. The documentation at https://docs.rs/tracing-subscriber/0.2.10/tracing_subscriber/struct.EnvFilter.html makes me think that we can only turn on things, not turn off things at a more precise level.

cc @hawkw

3 years agoAuto merge of #76017 - JulianKnodt:fmt_fast, r=nagisa
bors [Sun, 4 Oct 2020 02:24:20 +0000 (02:24 +0000)]
Auto merge of #76017 - JulianKnodt:fmt_fast, r=nagisa

Use less divisions in display u128/i128

This PR is an absolute mess, and I need to test if it improves the speed of fmt::Display for u128/i128, but I think it's correct.
It hopefully is more efficient by cutting u128 into at most 2 u64s, and also chunks by 1e16 instead of just 1e4.

Also I specialized the implementations for uints to always be non-false because it bothered me that it was checked at all

Do not merge until I benchmark it and also clean up the god awful mess of spaghetti.
Based on prior work in #44583

cc: `@Dylan-DPC`

Due to work on `itoa` and suggestion in original issue:
r? `@dtolnay`

3 years agoBackport another LLVM commit to rustc_apfloat
est31 [Sat, 3 Oct 2020 20:01:22 +0000 (22:01 +0200)]
Backport another LLVM commit to rustc_apfloat

Backports LLVM commit:

    [APFloat] convert SNaN to QNaN in convert() and raise Invalid signal

https://github.com/llvm/llvm-project/commit/149f5b573c79eac0c519ada4d2f7c50e17796cdf

SNaN to QNaN conversion also matches what my Intel x86_64 hardware does.

3 years agoAdd regression test for SimplifyBranchSame miscompilation
Tomasz Miąsko [Sun, 4 Oct 2020 00:00:00 +0000 (00:00 +0000)]
Add regression test for SimplifyBranchSame miscompilation

3 years agoEnable RenameReturnPlace MIR optimization on mir-opt-level >= 2
Tomasz Miąsko [Sun, 4 Oct 2020 00:00:00 +0000 (00:00 +0000)]
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.

3 years agoFix miscompile in SimplifyBranchSame
Simon Vandel Sillesen [Sun, 4 Oct 2020 00:00:00 +0000 (00:00 +0000)]
Fix miscompile in SimplifyBranchSame

3 years agoReplace some once(x).chain(once(y)) with [x, y] IntoIter
Scott McMurray [Sat, 3 Oct 2020 23:51:43 +0000 (16:51 -0700)]
Replace some once(x).chain(once(y)) with [x, y] IntoIter

Now that we have by-value array iterators...

3 years agoEnsure that the const-eval engine handles `#[unwind(aborts)]`
Dylan MacKenzie [Sat, 3 Oct 2020 22:09:43 +0000 (15:09 -0700)]
Ensure that the const-eval engine handles `#[unwind(aborts)]`

3 years agoChange DocFragments from enum variant fields to structs with a nested enum
Joshua Nelson [Sat, 3 Oct 2020 23:15:27 +0000 (19:15 -0400)]
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

3 years agoBTreeMap/Set: complete the compile-time test cases
Stein Somers [Fri, 2 Oct 2020 09:47:03 +0000 (11:47 +0200)]
BTreeMap/Set: complete the compile-time test cases

3 years agoAuto merge of #77434 - jonas-schievink:ret-in-reg-2-electric-boogalo, r=nagisa
bors [Sat, 3 Oct 2020 22:13:01 +0000 (22:13 +0000)]
Auto merge of #77434 - jonas-schievink:ret-in-reg-2-electric-boogalo, r=nagisa

Returns values up to 2*usize by value

Addresses https://github.com/rust-lang/rust/pull/76986#discussion_r498306837 and https://github.com/rust-lang/rust/pull/76986#issuecomment-696415287 by doing the optimization on all targets.

This matches what we do for functions returning `&[T]` and other fat pointers, so it should be Harmless™

3 years agoAdd check-pass test for `#[unwind(aborts)]` on a `const fn`
Dylan MacKenzie [Sat, 3 Oct 2020 21:48:01 +0000 (14:48 -0700)]
Add check-pass test for `#[unwind(aborts)]` on a `const fn`

3 years agoAllow `Abort` terminators in a const-context
Dylan MacKenzie [Sat, 3 Oct 2020 21:38:01 +0000 (14:38 -0700)]
Allow `Abort` terminators in a const-context

These appear along the cleanup path inside functions with
`#[unwind(aborts)]`. We don't const-check the cleanup path anyways,
since const-eval already has "abort-on-panic" semantics and there's
often drops that would otherwise be forbidden, so the check wasn't
really preventing anything anyways.

3 years agoFix capitalization in blog post name
Camelid [Sat, 3 Oct 2020 20:30:37 +0000 (13:30 -0700)]
Fix capitalization in blog post name

3 years agoSupport vectors with fewer than 8 elements for simd_select_bitmask
Amanieu d'Antras [Sat, 3 Oct 2020 15:13:06 +0000 (16:13 +0100)]
Support vectors with fewer than 8 elements for simd_select_bitmask

3 years agoStrenghten tests for crate-level attributes check
Guillaume Gomez [Tue, 29 Sep 2020 19:29:42 +0000 (21:29 +0200)]
Strenghten tests for crate-level attributes check

3 years agoRun attributes check at crate level
Guillaume Gomez [Mon, 21 Sep 2020 14:37:37 +0000 (16:37 +0200)]
Run attributes check at crate level

3 years agoEnsure that the error isn't displayed more than once
Guillaume Gomez [Fri, 11 Sep 2020 13:25:55 +0000 (15:25 +0200)]
Ensure that the error isn't displayed more than once

3 years agoAdd test for #[doc(alias = "...")] at crate level
Guillaume Gomez [Fri, 4 Sep 2020 15:13:08 +0000 (17:13 +0200)]
Add test for #[doc(alias = "...")] at crate level

3 years agoPrevent #[doc(alias = "...")] at crate level
Guillaume Gomez [Fri, 4 Sep 2020 15:12:53 +0000 (17:12 +0200)]
Prevent #[doc(alias = "...")] at crate level

3 years agoFlatten arrows with further comment
Jubilee Young [Sat, 3 Oct 2020 19:14:22 +0000 (12:14 -0700)]
Flatten arrows with further comment

3 years agofixed going over 100 chars in line
Jake Vossen [Sat, 3 Oct 2020 19:12:08 +0000 (13:12 -0600)]
fixed going over 100 chars in line

3 years agoAuto merge of #77500 - RalfJung:miri, r=RalfJung
bors [Sat, 3 Oct 2020 18:36:32 +0000 (18:36 +0000)]
Auto merge of #77500 - RalfJung:miri, r=RalfJung

update Miri

Fixes https://github.com/rust-lang/rust/issues/77406
r? `@ghost` Cc `@rust-lang/miri`

3 years agoAdd `const_generics` test for `impl-trait-with-const-arguments`
varkor [Sat, 3 Oct 2020 17:48:56 +0000 (18:48 +0100)]
Add `const_generics` test for `impl-trait-with-const-arguments`

3 years agoupdate Miri
Ralf Jung [Sat, 3 Oct 2020 17:47:58 +0000 (19:47 +0200)]
update Miri

3 years agoMove tests
varkor [Sat, 3 Oct 2020 17:01:11 +0000 (18:01 +0100)]
Move tests

3 years agoAdd quotes around command in CHANGELOG
ecstatic-morse [Sat, 3 Oct 2020 16:29:50 +0000 (09:29 -0700)]
Add quotes around command in CHANGELOG

3 years agoAdd tests for `const_generics`
varkor [Sat, 3 Oct 2020 16:00:18 +0000 (17:00 +0100)]
Add tests for `const_generics`

3 years agoAuto merge of #74160 - CAD97:weak-as-unsized-ptr, r=RalfJung
bors [Sat, 3 Oct 2020 14:18:26 +0000 (14:18 +0000)]
Auto merge of #74160 - CAD97:weak-as-unsized-ptr, r=RalfJung

Allow Weak::as_ptr and friends for unsized T

Relaxes `impl<T> Weak<T>` to `impl<T: ?Sized> Weak<T>` for the methods `rc::Weak::as_ptr`, `into_raw`, and `from_raw`.

Follow-up to #73845, which did most of the impl work to make these functions work for `T: ?Sized`.

We still have to adjust the implementation of `Weak::from_raw` here, however, because I missed a use of `ptr.is_null()` previously. This check was necessary when `into`/`from_raw` were first implemented, as `into_raw` returned `ptr::null()` for dangling weak. However, we now just (wrapping) offset dangling weaks' pointers the same as nondangling weak, so the null check is no longer necessary (or even hit). (I can submit just 17a928f as a separate PR if desired.)

As a nice side effect, moves the `fn is_dangling` definition closer to `Weak::new`, which creates the dangling weak.

This technically stabilizes that "something like `align_of_val_raw`" is possible to do. However, I believe the part of the functionality required by these methods here -- specifically, getting the alignment of a pointee from a pointer where it may be dangling iff the pointee is `Sized` -- is uncontroversial enough to stabilize these methods without a way to implement them on stable Rust.

r? `@RalfJung,` who reviewed #73845.

ATTN: This changes (relaxes) the (input) generic bounds on stable fn!