]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoAuto merge of #77502 - varkor:const-generics-suggest-enclosing-braces, r=petrochenkov
bors [Tue, 27 Oct 2020 09:25:54 +0000 (09:25 +0000)]
Auto merge of #77502 - varkor:const-generics-suggest-enclosing-braces, r=petrochenkov

Suggest that expressions that look like const generic arguments should be enclosed in brackets

I pulled out the changes for const expressions from https://github.com/rust-lang/rust/pull/71592 (without the trait object diagnostic changes) and made some small changes; the implementation is `@estebank's.`

We're also going to want to make some changes separately to account for trait objects (they result in poor diagnostics, as is evident from one of the test cases here), such as an adaption of https://github.com/rust-lang/rust/pull/72273.

Fixes https://github.com/rust-lang/rust/issues/70753.

r? `@petrochenkov`

3 years agoAuto merge of #77317 - varkor:break-diverging-value, r=nikomatsakis
bors [Tue, 27 Oct 2020 07:10:55 +0000 (07:10 +0000)]
Auto merge of #77317 - varkor:break-diverging-value, r=nikomatsakis

Fix control flow check for breaking with diverging values

Fixes https://github.com/rust-lang/rust/issues/77156.

3 years agoAuto merge of #78359 - ssomers:btree_cleanup_mem, r=Mark-Simulacrum
bors [Tue, 27 Oct 2020 04:01:52 +0000 (04:01 +0000)]
Auto merge of #78359 - ssomers:btree_cleanup_mem, r=Mark-Simulacrum

BTreeMap: move generic support functions out of navigate.rs

A preparatory step chipped off #78104, useful in general (if at all).

r? `@Mark-Simulacrum`

3 years agoSimplify slice splitting a bit
Nadrieril [Thu, 22 Oct 2020 09:45:24 +0000 (10:45 +0100)]
Simplify slice splitting a bit

3 years agoDeduplicate work between splitting and subtraction
Nadrieril [Tue, 27 Oct 2020 01:59:36 +0000 (01:59 +0000)]
Deduplicate work between splitting and subtraction

After splitting, subtraction becomes much simpler

3 years agoBe honest about being able to list constructors
Nadrieril [Tue, 20 Oct 2020 01:31:21 +0000 (02:31 +0100)]
Be honest about being able to list constructors

The test change is because we used to treat `&str` like other `&T`s, ie
as having a single constructor. That's not quite true though since we
consider `&str` constants as atomic instead of refs to `str` constants.

3 years agoSimplify specialize_constructor
Nadrieril [Tue, 27 Oct 2020 02:30:10 +0000 (02:30 +0000)]
Simplify specialize_constructor

Also removes the ugly caching that was introduced in #76918. It was
bolted on without deeper knowledge of the workings of the algorithm.
This commit manages to be more performant without any of the complexity.
It should be better on representative workloads too.

3 years agoFix bootstrap doctest failure
Nathan Whitaker [Tue, 27 Oct 2020 02:09:47 +0000 (22:09 -0400)]
Fix bootstrap doctest failure

3 years agoAuto merge of #78421 - JohnTitor:rollup-bq2d7fo, r=JohnTitor
bors [Tue, 27 Oct 2020 01:36:12 +0000 (01:36 +0000)]
Auto merge of #78421 - JohnTitor:rollup-bq2d7fo, r=JohnTitor

Rollup of 16 pull requests

Successful merges:

 - #76635 (Add [T]::as_chunks(_mut))
 - #77703 (add system-llvm-libunwind config option)
 - #78219 (Prefer to use `print_def_path`)
 - #78298 (Add test for bad NLL higher-ranked subtype)
 - #78332 (Update description for error E0308)
 - #78342 (Use check-pass in single-use-lifetime ui tests)
 - #78347 (Add lexicographical comparison doc)
 - #78348 (Make some functions private that don't have to be public)
 - #78349 (Use its own `TypeckResults` to avoid ICE)
 - #78375 (Use ? in core/std macros)
 - #78377 (Fix typo in debug statement)
 - #78388 (Add some regression tests)
 - #78394 (fix(docs): typo in BufWriter documentation)
 - #78396 (Add compiler support for LLVM's x86_64 ERMSB feature)
 - #78405 (Fix typo in lint description)
 - #78412 (Improve formatting of hash collections docs)

Failed merges:

r? `@ghost`

3 years agoUnify the paths through `is_useful`
Nadrieril [Tue, 20 Oct 2020 01:56:40 +0000 (02:56 +0100)]
Unify the paths through `is_useful`

3 years agoRecompute `MissingConstructors` when needed
Nadrieril [Mon, 26 Oct 2020 18:41:31 +0000 (18:41 +0000)]
Recompute `MissingConstructors` when needed

This only happens in a slow (diagnostics) path, so the code clarity gain
is worth it.

3 years agoPass more things through `PatCtxt`
Nadrieril [Mon, 26 Oct 2020 18:13:30 +0000 (18:13 +0000)]
Pass more things through `PatCtxt`

This is even a perf improvement on the match-heavy benchmarks.

3 years agoLet MissingConstructors handle the subtleties of missing constructors
Nadrieril [Mon, 26 Oct 2020 17:35:59 +0000 (17:35 +0000)]
Let MissingConstructors handle the subtleties of missing constructors

3 years agoCache head constructor in PatStack
Nadrieril [Fri, 23 Oct 2020 21:49:26 +0000 (22:49 +0100)]
Cache head constructor in PatStack

Since the constructor is recomputed a lot, caching is worth it.

3 years agoUnify the two kinds of specialization by adding a Wildcard ctor
Nadrieril [Thu, 22 Oct 2020 11:02:17 +0000 (12:02 +0100)]
Unify the two kinds of specialization by adding a Wildcard ctor

3 years agoInline `specialize_one_pattern`
Nadrieril [Sun, 25 Oct 2020 23:03:15 +0000 (23:03 +0000)]
Inline `specialize_one_pattern`

3 years agoFactor out the two specialization steps
Nadrieril [Sun, 25 Oct 2020 22:51:50 +0000 (22:51 +0000)]
Factor out the two specialization steps

3 years agoClarify specialization into two steps
Nadrieril [Sun, 25 Oct 2020 22:42:43 +0000 (22:42 +0000)]
Clarify specialization into two steps

First is checking for constructor overlap, second is extracting the
resulting fields.

3 years agoUse pat_constructor to simplify specialize_one_pattern
Nadrieril [Mon, 19 Oct 2020 22:58:04 +0000 (23:58 +0100)]
Use pat_constructor to simplify specialize_one_pattern

3 years agoSplit `split_grouped_constructor` into smaller functions
Nadrieril [Sun, 25 Oct 2020 21:59:59 +0000 (21:59 +0000)]
Split `split_grouped_constructor` into smaller functions

3 years agoRollup merge of #78412 - camelid:cleanup-hash-docs, r=jonas-schievink
Yuki Okushi [Mon, 26 Oct 2020 23:45:30 +0000 (08:45 +0900)]
Rollup merge of #78412 - camelid:cleanup-hash-docs, r=jonas-schievink

Improve formatting of hash collections docs

3 years agoRollup merge of #78405 - notriddle:patch-3, r=lcnr
Yuki Okushi [Mon, 26 Oct 2020 23:45:27 +0000 (08:45 +0900)]
Rollup merge of #78405 - notriddle:patch-3, r=lcnr

Fix typo in lint description

3 years agoRollup merge of #78396 - josephlr:ermsb, r=petrochenkov
Yuki Okushi [Mon, 26 Oct 2020 23:45:24 +0000 (08:45 +0900)]
Rollup merge of #78396 - josephlr:ermsb, r=petrochenkov

Add compiler support for LLVM's x86_64 ERMSB feature

This change is needed for compiler-builtins to check for this feature
when implementing memcpy/memset. See:
  https://github.com/rust-lang/compiler-builtins/pull/365

Without this change, the following code compiles, but does nothing:
```rust
#[cfg(target_feature = "ermsb")]
pub unsafe fn ermsb_memcpy() { ... }
```

The change just does compile-time detection. I think that runtime
detection will have to come in a follow-up CL to std-detect.

Like all the CPU feature flags, this just references #44839

Signed-off-by: Joe Richey <joerichey@google.com>
3 years agoRollup merge of #78394 - rubik:master, r=m-ou-se
Yuki Okushi [Mon, 26 Oct 2020 23:45:20 +0000 (08:45 +0900)]
Rollup merge of #78394 - rubik:master, r=m-ou-se

fix(docs): typo in BufWriter documentation

This PR fixes a small typo in the BufWriter documentation. The current documentation looks like this:

![2020-10-26-111501_438x83_scrot](https://user-images.githubusercontent.com/238549/97160357-83d3a000-177c-11eb-8a35-3cdd3a7d89de.png)

The `<u8>` at the end is mangled by Markdown. This PR makes the `BufWriter` documentation like the `BufReader` one:

https://github.com/rust-lang/rust/blob/master/library/std/src/io/buffered/bufreader.rs#L16

I'm tagging Steve as per the Rustc dev guide.

r? @steveklabnik

3 years agoRollup merge of #78388 - camelid:regression-tests, r=lcnr
Yuki Okushi [Mon, 26 Oct 2020 23:45:17 +0000 (08:45 +0900)]
Rollup merge of #78388 - camelid:regression-tests, r=lcnr

Add some regression tests

Closes #75763.
Closes #76179.

3 years agoRollup merge of #78377 - LeSeulArtichaut:patch-docs, r=jonas-schievink
Yuki Okushi [Mon, 26 Oct 2020 23:45:14 +0000 (08:45 +0900)]
Rollup merge of #78377 - LeSeulArtichaut:patch-docs, r=jonas-schievink

Fix typo in debug statement

3 years agoRollup merge of #78375 - taiki-e:question-in-macros, r=kennytm
Yuki Okushi [Mon, 26 Oct 2020 23:45:10 +0000 (08:45 +0900)]
Rollup merge of #78375 - taiki-e:question-in-macros, r=kennytm

Use ? in core/std macros

3 years agoRollup merge of #78349 - JohnTitor:issue-75962, r=davidtwco
Yuki Okushi [Mon, 26 Oct 2020 23:45:07 +0000 (08:45 +0900)]
Rollup merge of #78349 - JohnTitor:issue-75962, r=davidtwco

Use its own `TypeckResults` to avoid ICE

Fixes #75962

3 years agoRollup merge of #78348 - jyn514:pub-crate, r=GuillaumeGomez
Yuki Okushi [Mon, 26 Oct 2020 23:45:04 +0000 (08:45 +0900)]
Rollup merge of #78348 - jyn514:pub-crate, r=GuillaumeGomez

Make some functions private that don't have to be public

r? @GuillaumeGomez

3 years agoRollup merge of #78347 - Rustin-Liu:rustin-patch-doc, r=kennytm
Yuki Okushi [Mon, 26 Oct 2020 23:45:01 +0000 (08:45 +0900)]
Rollup merge of #78347 - Rustin-Liu:rustin-patch-doc, r=kennytm

Add lexicographical comparison doc

close https://github.com/rust-lang/rust/issues/72255

3 years agoRollup merge of #78342 - oliviacrain:checkmate-pass, r=Mark-Simulacrum
Yuki Okushi [Mon, 26 Oct 2020 23:44:57 +0000 (08:44 +0900)]
Rollup merge of #78342 - oliviacrain:checkmate-pass, r=Mark-Simulacrum

Use check-pass in single-use-lifetime ui tests

Rationale: the `single_use_lifetimes` lint is used during late name resolution, which is within the scope of `check-pass` and does not require codegen or linking.

Helps remove some FIXMES associated with #62277. Additionally tidies touched test files.

3 years agoRollup merge of #78332 - PoignardAzur:doc_E0308, r=camelid
Yuki Okushi [Mon, 26 Oct 2020 23:44:54 +0000 (08:44 +0900)]
Rollup merge of #78332 - PoignardAzur:doc_E0308, r=camelid

Update description for error E0308

Fixes #76462

r? @camelid

3 years agoRollup merge of #78298 - Aaron1011:fix/nll-ranked-test, r=Mark-Simulacrum
Yuki Okushi [Mon, 26 Oct 2020 23:44:51 +0000 (08:44 +0900)]
Rollup merge of #78298 - Aaron1011:fix/nll-ranked-test, r=Mark-Simulacrum

Add test for bad NLL higher-ranked subtype

Fixes #57642

3 years agoRollup merge of #78219 - JohnTitor:print-def-path, r=estebank
Yuki Okushi [Mon, 26 Oct 2020 23:44:47 +0000 (08:44 +0900)]
Rollup merge of #78219 - JohnTitor:print-def-path, r=estebank

Prefer to use `print_def_path`

Follow-up of https://github.com/rust-lang/rust/pull/71310#discussion_r415438577

3 years agoRollup merge of #77703 - Keruspe:system-libunwind, r=Mark-Simulacrum
Yuki Okushi [Mon, 26 Oct 2020 23:44:44 +0000 (08:44 +0900)]
Rollup merge of #77703 - Keruspe:system-libunwind, r=Mark-Simulacrum

add system-llvm-libunwind config option

allows using the system-wide llvm-libunwind as the unwinder

Workaround for #76020

3 years agoRollup merge of #76635 - scottmcm:slice-as-chunks, r=LukasKalbertodt
Yuki Okushi [Mon, 26 Oct 2020 23:44:41 +0000 (08:44 +0900)]
Rollup merge of #76635 - scottmcm:slice-as-chunks, r=LukasKalbertodt

Add [T]::as_chunks(_mut)

Allows getting the slices directly, rather than just through an iterator as in `array_chunks(_mut)`.  The constructors for those iterators are then written in terms of these methods, so the iterator constructors no longer have any `unsafe` of their own.

Unstable, of course. #74985

3 years agoAuto merge of #77876 - tmiasko:simplify-locals, r=wesleywiser
bors [Mon, 26 Oct 2020 23:22:39 +0000 (23:22 +0000)]
Auto merge of #77876 - tmiasko:simplify-locals, r=wesleywiser

Remove unused set-discriminant statements and assignments regardless of rvalue

* Represent use counts with u32
* Unify use count visitors
* Change RemoveStatements visitor into a function
* Remove unused set-discriminant statements
* Use exhaustive match to clarify what is being optimized
* Remove unused assignments regardless of rvalue kind

3 years agoAddress review comments
Nathan Whitaker [Mon, 26 Oct 2020 23:19:06 +0000 (19:19 -0400)]
Address review comments

3 years agoImplement -Z function-sections=yes|no
Anthony Ramine [Mon, 26 Oct 2020 19:55:07 +0000 (20:55 +0100)]
Implement -Z function-sections=yes|no

This lets rustc users tweak whether all functions should be put in their own
TEXT section, using whatever default value the target defines if the flag
is missing.

3 years agoFix doctest
Nathan Whitaker [Tue, 22 Sep 2020 16:38:50 +0000 (12:38 -0400)]
Fix doctest

3 years agoRemove lint from clippy
Nathan Whitaker [Tue, 22 Sep 2020 16:23:22 +0000 (12:23 -0400)]
Remove lint from clippy

3 years agoWrite docs for lint / fix review nit
Nathan Whitaker [Tue, 22 Sep 2020 15:20:06 +0000 (11:20 -0400)]
Write docs for lint / fix review nit

3 years agoAddress review comments
Nathan Whitaker [Mon, 21 Sep 2020 20:32:28 +0000 (16:32 -0400)]
Address review comments

3 years agoChange to warn by default / fix typo
Nathan Whitaker [Sun, 23 Aug 2020 18:21:58 +0000 (14:21 -0400)]
Change to warn by default / fix typo

3 years agoTweak diagnostic
Nathan Whitaker [Tue, 18 Aug 2020 23:37:50 +0000 (19:37 -0400)]
Tweak diagnostic

3 years agoUpdate doctest
Nathan Whitaker [Tue, 18 Aug 2020 22:47:52 +0000 (18:47 -0400)]
Update doctest

3 years agoAddress review comments
Nathan Whitaker [Tue, 18 Aug 2020 21:02:23 +0000 (17:02 -0400)]
Address review comments

3 years agoAdd basic test
Nathan Whitaker [Tue, 18 Aug 2020 16:09:33 +0000 (12:09 -0400)]
Add basic test

3 years agoUplift temporary-cstring-as-ptr into rustc
Nathan Whitaker [Tue, 18 Aug 2020 15:25:21 +0000 (11:25 -0400)]
Uplift temporary-cstring-as-ptr into rustc

3 years agoSuggest expressions that look like const generic arguments should be enclosed in...
varkor [Sat, 3 Oct 2020 18:30:32 +0000 (19:30 +0100)]
Suggest expressions that look like const generic arguments should be enclosed in brackets

Co-Authored-By: Esteban Kuber <github@kuber.com.ar>
3 years agoIgnore threaded capture tests on WASM w/o threads
Sergio Benitez [Mon, 26 Oct 2020 20:36:33 +0000 (13:36 -0700)]
Ignore threaded capture tests on WASM w/o threads

3 years agoAuto merge of #77187 - TimDiekmann:box-alloc, r=Amanieu
bors [Mon, 26 Oct 2020 21:16:33 +0000 (21:16 +0000)]
Auto merge of #77187 - TimDiekmann:box-alloc, r=Amanieu

Support custom allocators in `Box`

r? `@Amanieu`

This pull request requires a crater run.

### Prior work:
- #71873
- #58457
- [`alloc-wg`](https://github.com/TimDiekmann/alloc-wg)-crate

Currently blocked on:
- ~#77118~
- ~https://github.com/rust-lang/chalk/issues/615 (#77515)~

3 years agoImprove formatting of hash collections docs
Camelid [Mon, 26 Oct 2020 21:05:06 +0000 (14:05 -0700)]
Improve formatting of hash collections docs

3 years agoAdd FIXME note to const generics test
Camelid [Mon, 26 Oct 2020 20:56:31 +0000 (13:56 -0700)]
Add FIXME note to const generics test

Co-authored-by: lcnr <bastian_kauschke@hotmail.de>
3 years agoAdd some regression tests
Camelid [Mon, 26 Oct 2020 05:01:37 +0000 (22:01 -0700)]
Add some regression tests

3 years agorustc_span: avoid hashing ExpnId tag when using cached hash
Tyson Nottingham [Mon, 21 Sep 2020 00:40:34 +0000 (17:40 -0700)]
rustc_span: avoid hashing ExpnId tag when using cached hash

3 years agoFix some outdated comments
Anthony Ramine [Mon, 26 Oct 2020 19:54:51 +0000 (20:54 +0100)]
Fix some outdated comments

3 years agobuild-manifest: add BUILD_MANIFEST_CHECKSUM_CACHE
Pietro Albini [Mon, 26 Oct 2020 19:16:33 +0000 (20:16 +0100)]
build-manifest: add BUILD_MANIFEST_CHECKSUM_CACHE

The checksum cache allows to reuse the calculated checksums between
build-manifest and promote-release, or between multiple invocations of
build-manifest.

3 years agoRemove tokens from foreign items in `TokenStripper`
Aaron Hill [Mon, 26 Oct 2020 19:06:54 +0000 (15:06 -0400)]
Remove tokens from foreign items in `TokenStripper`

Fixes #78398

I forgot to handle this case in #77255

3 years agobuild-manifest: refactor checksum generation into a struct
Pietro Albini [Mon, 26 Oct 2020 18:08:48 +0000 (19:08 +0100)]
build-manifest: refactor checksum generation into a struct

3 years agoAuto merge of #68965 - eddyb:mir-inline-scope, r=nagisa,oli-obk
bors [Mon, 26 Oct 2020 18:50:22 +0000 (18:50 +0000)]
Auto merge of #68965 - eddyb:mir-inline-scope, r=nagisa,oli-obk

 rustc_mir: track inlined callees in SourceScopeData.

We now record which MIR scopes are the roots of *other* (inlined) functions's scope trees, which allows us to generate the correct debuginfo in codegen, similar to what LLVM inlining generates.
This PR makes the `ui` test `backtrace-debuginfo` pass, if the MIR inliner is turned on by default.

Also, `#[track_caller]` is now correct in the face of MIR inlining (cc `@anp).`

Fixes #76997.

r? `@rust-lang/wg-mir-opt`

3 years agoFix typo in lint description
Michael Howell [Mon, 26 Oct 2020 18:46:11 +0000 (11:46 -0700)]
Fix typo in lint description

3 years agoAuto merge of #77975 - bjorn3:cg_clif_subtree3, r=Mark-Simulacrum
bors [Mon, 26 Oct 2020 16:31:38 +0000 (16:31 +0000)]
Auto merge of #77975 - bjorn3:cg_clif_subtree3, r=Mark-Simulacrum

Add cg_clif as optional codegen backend

Rustc_codegen_cranelift is an alternative codegen backend for rustc based on Cranelift. It has the potential to improve compilation times in debug mode. In my experience the compile time improvements over debug mode LLVM for a clean build are about 20-30% in most cases.

This PR adds cg_clif as optional codegen backend. By default it is only enabled for `./x.py check`. It can be enabled for `./x.py build` too by adding `cranelift` to the `rust.codegen-backends` array in `config.toml`.

MCP: https://github.com/rust-lang/compiler-team/issues/270

r? `@Mark-Simulacrum`

3 years agoSuggest calling await on method call and field access
Esteban Küber [Fri, 23 Oct 2020 17:54:34 +0000 (10:54 -0700)]
Suggest calling await on method call and field access

When encountering a failing method or field resolution on a `Future`,
look at the `Output` and try the same operation on it. If successful,
suggest calling `.await` on the `Future`.

This had already been introduced in #72784, but at some point they
stopped working.

3 years agoresolve: private fields in tuple struct ctor diag
David Wood [Mon, 26 Oct 2020 14:36:48 +0000 (14:36 +0000)]
resolve: private fields in tuple struct ctor diag

This commit improves the diagnostic emitted when a tuple struct is being
constructed which has private fields so that private fields are
labelled and the message is improved.

Signed-off-by: David Wood <david@davidtw.co>
3 years agoAdd lexicographical comparison doc
Rustin-Liu [Sun, 25 Oct 2020 09:46:45 +0000 (17:46 +0800)]
Add lexicographical comparison doc

Add links

Fix typo

Use `sequence`

Fix typo

Fix broken link

Fix broken link

Fix broken link

Fix broken links

Fix broken links

3 years agoAuto merge of #78395 - RalfJung:miri, r=RalfJung
bors [Mon, 26 Oct 2020 14:13:37 +0000 (14:13 +0000)]
Auto merge of #78395 - RalfJung:miri, r=RalfJung

update Miri

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

3 years agoIgnore long lines in test
oli [Mon, 26 Oct 2020 14:09:27 +0000 (14:09 +0000)]
Ignore long lines in test

3 years agodebug log `AbstractConst::new`
Bastian Kauschke [Mon, 26 Oct 2020 13:56:58 +0000 (14:56 +0100)]
debug log `AbstractConst::new`

3 years agoAdd an inlining debuginfo test
oli [Mon, 26 Oct 2020 13:18:12 +0000 (13:18 +0000)]
Add an inlining debuginfo test

3 years agoDeduplicate span and dbg_scope adjustment
oli [Mon, 26 Oct 2020 13:04:52 +0000 (13:04 +0000)]
Deduplicate span and dbg_scope adjustment

3 years agoPrefer `bug!` over `unwrap()`
oli [Mon, 26 Oct 2020 12:49:49 +0000 (12:49 +0000)]
Prefer `bug!` over `unwrap()`

3 years agoadd fixme
Bastian Kauschke [Mon, 26 Oct 2020 11:46:20 +0000 (12:46 +0100)]
add fixme

3 years agoAuto merge of #78196 - pietroalbini:shipped-files, r=Mark-Simulacrum
bors [Mon, 26 Oct 2020 11:56:59 +0000 (11:56 +0000)]
Auto merge of #78196 - pietroalbini:shipped-files, r=Mark-Simulacrum

Allow creating a list of files shipped in a release

This PR adds the `BUILD_MANIFEST_SHIPPED_FILES_PATH` environment variable to `build-manifest`, which writes a list of all the files referenced in the manifest to the path defined in the variable. The use for this is for `promote-release` to prune files unused files before publishing a release.

This PR **does not implement any pruning**, it just adds support for it to be implemented in the future on `promote-release`'s side.

r? `@Mark-Simulacrum`

3 years agoupdate Miri
Ralf Jung [Mon, 26 Oct 2020 11:44:41 +0000 (12:44 +0100)]
update Miri

3 years agoAdd compiler support for LLVM's x86 ERMSB feature
Joe Richey [Mon, 26 Oct 2020 10:46:54 +0000 (03:46 -0700)]
Add compiler support for LLVM's x86 ERMSB feature

This change is needed for compiler-builtins to check for this feature
when implementing memcpy/memset. See:
  https://github.com/rust-lang/compiler-builtins/pull/365

The change just does compile-time detection. I think that runtime
detection will have to come in a follow-up CL to std-detect.

Like all the CPU feature flags, this just references #44839

Signed-off-by: Joe Richey <joerichey@google.com>
3 years agofix(docs): typo in BufWriter documentation
Michele Lacchia [Mon, 26 Oct 2020 10:13:47 +0000 (11:13 +0100)]
fix(docs): typo in BufWriter documentation

3 years agosimplify-locals: Remove unused assignments regardless of rvalue kind
Tomasz Miąsko [Sat, 17 Oct 2020 00:00:00 +0000 (00:00 +0000)]
simplify-locals: Remove unused assignments regardless of rvalue kind

3 years agobuild-manifest: allow creating a list of files shipped in a release
Pietro Albini [Wed, 21 Oct 2020 17:29:07 +0000 (19:29 +0200)]
build-manifest: allow creating a list of files shipped in a release

3 years agosimplify-locals: Remove unused set-discriminant statements
Tomasz Miąsko [Sat, 17 Oct 2020 00:00:00 +0000 (00:00 +0000)]
simplify-locals: Remove unused set-discriminant statements

Update affected ui & incremental tests to use a user declared variable
bindings instead of temporaries. The former are preserved because of
debuginfo, the latter are not.

3 years agosimplify-locals: Change RemoveStatements visitor into a function
Tomasz Miąsko [Thu, 22 Oct 2020 00:00:00 +0000 (00:00 +0000)]
simplify-locals: Change RemoveStatements visitor into a function

No functionl changes intended.

3 years agosimplify-locals: Unify use count visitors
Tomasz Miąsko [Thu, 22 Oct 2020 00:00:00 +0000 (00:00 +0000)]
simplify-locals: Unify use count visitors

The simplify locals implementation uses two different visitors to update
the locals use counts. The DeclMarker calculates the initial use counts.
The StatementDeclMarker updates the use counts as statements are being
removed from the block.

Replace them with a single visitor that can operate in either mode,
ensuring consistency of behaviour.

Additionally use exhaustive match to clarify what is being optimized.

No functional changes intended.

3 years agosimplify-locals: Represent use counts with u32
Tomasz Miąsko [Mon, 12 Oct 2020 00:00:00 +0000 (00:00 +0000)]
simplify-locals: Represent use counts with u32

3 years agoAuto merge of #78324 - RalfJung:uninhabited-statics, r=oli-obk
bors [Mon, 26 Oct 2020 09:11:34 +0000 (09:11 +0000)]
Auto merge of #78324 - RalfJung:uninhabited-statics, r=oli-obk

ensure that statics are inhabited

Fixes https://github.com/rust-lang/rust/issues/74840

r? `@oli-obk`

3 years agoAdd 'compiler/rustc_codegen_cranelift/' from commit '793d26047f994e23415f8f6bb5686ff2...
bjorn3 [Mon, 26 Oct 2020 08:53:27 +0000 (09:53 +0100)]
Add 'compiler/rustc_codegen_cranelift/' from commit '793d26047f994e23415f8f6bb5686ff25d3dda92'

git-subtree-dir: compiler/rustc_codegen_cranelift
git-subtree-mainline: cf798c1ec65a5ec3491846777f9003fabb881b4a
git-subtree-split: 793d26047f994e23415f8f6bb5686ff25d3dda92

3 years agoAdd support for using cg_clif to bootstrap rustc
bjorn3 [Thu, 15 Oct 2020 12:23:43 +0000 (14:23 +0200)]
Add support for using cg_clif to bootstrap rustc

3 years agoRustup to rustc 1.49.0-nightly (4760b8fb8 2020-10-25)
bjorn3 [Mon, 26 Oct 2020 08:51:48 +0000 (09:51 +0100)]
Rustup to rustc 1.49.0-nightly (4760b8fb8 2020-10-25)

3 years agoBTreeMap: move generic functions out of navigate.rs
Stein Somers [Sun, 25 Oct 2020 15:10:10 +0000 (16:10 +0100)]
BTreeMap: move generic functions out of navigate.rs

3 years agoexplain why interning is not as trivial as it might seem
Ralf Jung [Sun, 25 Oct 2020 13:03:17 +0000 (14:03 +0100)]
explain why interning is not as trivial as it might seem

3 years agointerning cleanup: we no longer need to distinguish Const and ConstInner; we no longe...
Ralf Jung [Sun, 25 Oct 2020 10:12:19 +0000 (11:12 +0100)]
interning cleanup: we no longer need to distinguish Const and ConstInner; we no longer need the ignore_interior_mut_in_const hack

3 years agomove &mut-in-const check from interning to validation
Ralf Jung [Sun, 25 Oct 2020 09:22:56 +0000 (10:22 +0100)]
move &mut-in-const check from interning to validation

3 years agomove UnsafeCell-in-const check from interning to validation
Ralf Jung [Sat, 24 Oct 2020 18:49:17 +0000 (20:49 +0200)]
move UnsafeCell-in-const check from interning to validation

3 years agoensure we intern all promoteds as InternKind::Promoted
Ralf Jung [Sat, 24 Oct 2020 15:23:45 +0000 (17:23 +0200)]
ensure we intern all promoteds as InternKind::Promoted

3 years agoAuto merge of #75728 - nagisa:improve_align_offset_2, r=Mark-Simulacrum
bors [Mon, 26 Oct 2020 06:49:34 +0000 (06:49 +0000)]
Auto merge of #75728 - nagisa:improve_align_offset_2, r=Mark-Simulacrum

Optimise align_offset for stride=1 further

`stride == 1` case can be computed more efficiently through `-p (mod
a)`. That, then translates to a nice and short sequence of LLVM
instructions:

    %address = ptrtoint i8* %p to i64
    %negptr = sub i64 0, %address
    %offset = and i64 %negptr, %a_minus_one

And produces pretty much ideal code-gen when this function is used in
isolation.

Typical use of this function will, however, involve use of
the result to offset a pointer, i.e.

    %aligned = getelementptr inbounds i8, i8* %p, i64 %offset

This still looks very good, but LLVM does not really translate that to
what would be considered ideal machine code (on any target). For example
that's the codegen we obtain for an unknown alignment:

    ; x86_64
    dec     rsi
    mov     rax, rdi
    neg     rax
    and     rax, rsi
    add     rax, rdi

In particular negating a pointer is not something that’s going to be
optimised for in the design of CISC architectures like x86_64. They
are much better at offsetting pointers. And so we’d love to utilize this
ability and produce code that's more like this:

    ; x86_64
    lea     rax, [rsi + rdi - 1]
    neg     rsi
    and     rax, rsi

To achieve this we need to give LLVM an opportunity to apply its
various peep-hole optimisations that it does during DAG selection. In
particular, the `and` instruction appears to be a major inhibitor here.
We cannot, sadly, get rid of this load-bearing operation, but we can
reorder operations such that LLVM has more to work with around this
instruction.

One such ordering is proposed in #75579 and results in LLVM IR that
looks broadly like this:

    ; using add enables `lea` and similar CISCisms
    %offset_ptr = add i64 %address, %a_minus_one
    %mask = sub i64 0, %a
    %masked = and i64 %offset_ptr, %mask
    ; can be folded with `gepi` that may follow
    %offset = sub i64 %masked, %address

…and generates the intended x86_64 machine code.
One might also wonder how the increased amount of code would impact a
RISC target. Turns out not much:

    ; aarch64 previous                 ; aarch64 new
    sub     x8, x1, #1                 add     x8, x1, x0
    neg     x9, x0                     sub     x8, x8, #1
    and     x8, x9, x8                 neg     x9, x1
    add     x0, x0, x8                 and     x0, x8, x9

    (and similarly for ppc, sparc, mips, riscv, etc)

The only target that seems to do worse is… wasm32.

Onto actual measurements – the best way to evaluate snipets like these
is to use llvm-mca. Much like Aarch64 assembly would allow to suspect,
there isn’t any performance difference to be found. Both snippets
execute in same number of cycles for the CPUs I tried. On x86_64,
we get throughput improvement of >50%!

Fixes #75579

3 years agoAuto merge of #78387 - Dylan-DPC:rollup-ch0st6z, r=Dylan-DPC
bors [Mon, 26 Oct 2020 04:34:46 +0000 (04:34 +0000)]
Auto merge of #78387 - Dylan-DPC:rollup-ch0st6z, r=Dylan-DPC

Rollup of 10 pull requests

Successful merges:

 - #74477 (`#[deny(unsafe_op_in_unsafe_fn)]` in sys/wasm)
 - #77836 (transmute_copy: explain that alignment is handled correctly)
 - #78126 (Properly define va_arg and va_list for aarch64-apple-darwin)
 - #78137 (Initialize tracing subscriber in compiletest tool)
 - #78161 (Add issue template link to IRLO)
 - #78214 (Tweak match arm semicolon removal suggestion to account for futures)
 - #78247 (Fix #78192)
 - #78252 (Add codegen test for #45964)
 - #78268 (Do not try to report on closures to avoid ICE)
 - #78295 (Add some regression tests)

Failed merges:

r? `@ghost`

3 years agoRollup merge of #78295 - Alexendoo:ice-regression-tests, r=nagisa
Dylan DPC [Mon, 26 Oct 2020 02:09:13 +0000 (03:09 +0100)]
Rollup merge of #78295 - Alexendoo:ice-regression-tests, r=nagisa

Add some regression tests

Closes #56229
Closes #59494
Closes #70746
Closes #73229

3 years agoRollup merge of #78268 - JohnTitor:issue-78262, r=estebank
Dylan DPC [Mon, 26 Oct 2020 02:09:11 +0000 (03:09 +0100)]
Rollup merge of #78268 - JohnTitor:issue-78262, r=estebank

Do not try to report on closures to avoid ICE

Fixes #78262

3 years agoRollup merge of #78252 - bugadani:issue-45964, r=Mark-Simulacrum
Dylan DPC [Mon, 26 Oct 2020 02:09:09 +0000 (03:09 +0100)]
Rollup merge of #78252 - bugadani:issue-45964, r=Mark-Simulacrum

Add codegen test for #45964

Closes #45964

3 years agoRollup merge of #78247 - simonvandel:fix-78192, r=oli-obk
Dylan DPC [Mon, 26 Oct 2020 02:09:08 +0000 (03:09 +0100)]
Rollup merge of #78247 - simonvandel:fix-78192, r=oli-obk

Fix #78192

Check which places are marked dead.

Fixes #78192

3 years agoRollup merge of #78214 - estebank:match-semicolon, r=oli-obk
Dylan DPC [Mon, 26 Oct 2020 02:09:06 +0000 (03:09 +0100)]
Rollup merge of #78214 - estebank:match-semicolon, r=oli-obk

Tweak match arm semicolon removal suggestion to account for futures

* Tweak and extend "use `.await`" suggestions
* Suggest removal of semicolon on prior match arm
* Account for `impl Future` when suggesting semicolon removal
* Silence some errors when encountering `await foo()?` as can't be certain what the intent was

*Thanks to https://twitter.com/a_hoverbear/status/1318960787105353728 for pointing this out!*