Commit Graph

120465 Commits

Author SHA1 Message Date
bors
c60b675e28 Auto merge of #72000 - cuviper:dist-llvm, r=Mark-Simulacrum
Move the target libLLVM to llvm-tools-preview

For running the compiler, we usually only need LLVM from `$sysroot/lib`,
which rustup will make available with `LD_LIBRARY_PATH`. We've also been
shipping LLVM in the `$target/lib` directory, which bloats the download
and installed size. The only times we do need the latter are for the
RPATH of `llvm-tools-preview` binaries, and for linking `rustc-dev`
libraries. We'll move it to the `llvm-tools-preview` component directly,
and `rustc-dev` will have an implicit dependency on it.

Here are the dist sizes that I got before and after this change:

    llvm-tools-1.45.0-dev-x86_64-unknown-linux-gnu.tar.gz     1.3M   24M
    llvm-tools-1.45.0-dev-x86_64-unknown-linux-gnu.tar.xz     748K   17M
    rustc-1.45.0-dev-x86_64-unknown-linux-gnu.tar.gz          83M    61M
    rustc-1.45.0-dev-x86_64-unknown-linux-gnu.tar.xz          56M    41M

The installed size should reduce by exactly one `libLLVM.so` (~70-80M),
unless you also install `llvm-tools`, and then it should be identical.

Resolves #70838.
2020-05-22 04:52:38 +00:00
bors
458a3e7629 Auto merge of #71956 - ecstatic-morse:remove-requires-storage-analysis, r=tmandry
Clean up logic around live locals in generator analysis

Resolves #69902. Requires #71893.

I've found it difficult to make changes in the logic around live locals in `generator/transform.rs`. It uses a custom dataflow analysis, `MaybeRequiresStorage`, that AFAICT computes whether a local is either initialized or borrowed. That analysis is using `before` effects, which we should try to avoid if possible because they are harder to reason about than ones only using the unprefixed effects. @pnkfelix has suggested removing "before" effects entirely to simplify the dataflow framework, which I might pursue someday.

This PR replaces `MaybeRequiresStorage` with a combination of the existing `MaybeBorrowedLocals` and a new `MaybeInitializedLocals`. `MaybeInitializedLocals` is just `MaybeInitializedPlaces` with a coarser resolution: it works on whole locals instead of move paths. As a result, I was able to simplify the logic in `compute_storage_conflicts` and `locals_live_across_suspend_points`.

This is not exactly equivalent to the old logic; some generators are now smaller than before. I believe this was because the old logic was too conservative, but I'm not as familiar with the constraints as the original implementers were, so I could be wrong. For example, I don't see a reason the size of the `mixed_sizes` future couldn't be 5K. It went from 7K to 6K in this PR.

r? @jonas-schievink @tmandry
2020-05-22 01:32:42 +00:00
bors
d9417b3851 Auto merge of #72433 - RalfJung:rollup-srft8nx, r=RalfJung
Rollup of 7 pull requests

Successful merges:

 - #72055 (Intern predicates)
 - #72149 (Don't `type_of` on trait assoc ty without default)
 - #72347 (Make intra-link resolve links for both trait and impl items)
 - #72350 (Improve documentation of `slice::from_raw_parts`)
 - #72382 (Show default values for debug-assertions & debug-assertions-std)
 - #72421 (Fix anchor display when hovering impl)
 - #72425 (fix discriminant_value sign extension)

Failed merges:

r? @ghost
2020-05-21 22:14:26 +00:00
Ralf Jung
74b5c50214
Rollup merge of #72425 - RalfJung:discr-sign-ext, r=nikomatsakis
fix discriminant_value sign extension

Fixes a regression introduced in https://github.com/rust-lang/rust/pull/70705
r? @nikomatsakis Cc @lcnr @oli-obk
2020-05-21 21:10:47 +02:00
Ralf Jung
fc729d0c60
Rollup merge of #72421 - GuillaumeGomez:fix-impl-hover-anchor, r=kinnison
Fix anchor display when hovering impl

A little gif for the fixed behaviour:

![hover-anchor](https://user-images.githubusercontent.com/3050060/82549808-cfdf4080-9b5d-11ea-9495-2b1d90b2a791.gif)

r? @kinnison
2020-05-21 21:10:45 +02:00
Ralf Jung
503a2fde94
Rollup merge of #72382 - tmiasko:config-toml-debug-assertions, r=nikomatsakis
Show default values for debug-assertions & debug-assertions-std
2020-05-21 21:10:43 +02:00
Ralf Jung
261505a0cf
Rollup merge of #72350 - danielhenrymantilla:doc_warn_against_adjacent_slice_concat, r=RalfJung
Improve documentation of `slice::from_raw_parts`

This is to provide a more explicit statement against a code pattern that
many people end up coming with, since the reason of it being unsound
comes from the badly known single-allocation validity rule.

Providing that very pattern as a counter-example could help mitigate that.

See also: https://internals.rust-lang.org/t/pre-rfc-add-join-seq-method-to-slices-and-strs/11936/13

r? @RalfJung
2020-05-21 21:10:41 +02:00
Ralf Jung
3d5f130aae
Rollup merge of #72347 - xliiv:72340-impl-for-default, r=GuillaumeGomez
Make intra-link resolve links for both trait and impl items

Closes #72340
2020-05-21 21:10:40 +02:00
Ralf Jung
dc65fd4f6a
Rollup merge of #72149 - estebank:icemation, r=eddyb
Don't `type_of` on trait assoc ty without default

Fix #72076.
2020-05-21 21:10:38 +02:00
Ralf Jung
22438fc22b
Rollup merge of #72055 - lcnr:predicate-kind, r=nikomatsakis
Intern predicates

Implements the first step of https://github.com/rust-lang/compiler-team/issues/285

Renames `ty::Predicate` to `ty::PredicateKind`, which is now interned.
To ease the transition, `ty::Predicate` is now a struct containing a reference
to `ty::PredicateKind`.

r? @ghost
2020-05-21 21:10:36 +02:00
bors
9310e3bd4f Auto merge of #71930 - Nadrieril:exhaustiveness-remove-tyerr, r=varkor
De-abuse TyKind::Error in exhaustiveness checking

Replaces https://github.com/rust-lang/rust/pull/71074. Context: https://github.com/rust-lang/rust/issues/70866.

In order to remove the use of `TyKind::Error`, I had to make sure we skip over those fields whose inhabitedness should not be observed. This is potentially error-prone however, since we must be careful not to mix filtered and unfiltered lists of patterns. I managed to hide away most of the filtering behind a new `Fields` struct, that I used everywhere relevant. I quite like the result; I think the twin concepts of `Constructor` and `Fields` make a good mental model.

As usual, I tried to separate commits that shuffle code around from commits that require more thought to review.

cc @varkor @Centril
2020-05-21 18:52:46 +00:00
Ralf Jung
67e075589b
Typo 2020-05-21 19:07:59 +02:00
Daniel Henry-Mantilla
a81e9a781b Improve documentation of slice::from_raw_parts
This is to provide a more explicit statement against a code pattern that
many people end up coming with, since the reason of it being unsound
comes from the badly known single-allocation validity rule.

Providing that very pattern as a counter-example could help mitigate that.

Co-authored-by: Ralf Jung <post@ralfj.de>
2020-05-21 18:38:41 +02:00
bors
148c125b1b Auto merge of #71718 - NeoRaider:ffi_const_pure, r=Amanieu
Experimentally add `ffi_const` and `ffi_pure` extern fn attributes

Add FFI function attributes corresponding to clang/gcc/... `const` and `pure`.

Rebased version of #58327 by @gnzlbg with the following changes:

- Switched back from the `c_ffi_const` and `c_ffi_pure` naming to `ffi_const` and `ffi_pure`, as I agree with https://github.com/rust-lang/rust/pull/58327#issuecomment-462718772 and this nicely aligns with `ffi_returns_twice`
- (Hopefully) took care of all of @hanna-kruppe's change requests in the original PR

r? @hanna-kruppe
2020-05-21 15:02:08 +00:00
Ralf Jung
94aa02855d fix discriminant sign extension 2020-05-21 16:49:11 +02:00
bors
06c9fef822 Auto merge of #72422 - RalfJung:rollup-u81z4mw, r=RalfJung
Rollup of 7 pull requests

Successful merges:

 - #71854 (Make `std::char` functions and constants associated to `char`.)
 - #72111 (rustc-book: Document `-Z strip=val` option)
 - #72272 (Fix going back in history to a search result page on firefox)
 - #72296 (Suggest installing VS Build Tools in more situations)
 - #72365 (Remove unused `StableHashingContext::node_to_hir_id` method)
 - #72371 (FIX - Char documentation for unexperienced users)
 - #72397 (llvm: Expose tiny code model to users)

Failed merges:

r? @ghost
2020-05-21 11:46:51 +00:00
Ralf Jung
e5a4550869
Rollup merge of #72397 - petrochenkov:tiny, r=Amanieu
llvm: Expose tiny code model to users

This model is relevant to embedded AArch64 targets and was added to LLVM relatively recently (https://reviews.llvm.org/D49673, mid 2018), so rustc frontend didn't provide access to it with `-C code-model`. The gcc analogue is [`-mcmodel=tiny`](https://gcc.gnu.org/onlinedocs/gcc/AArch64-Options.html).
(This is one of the options that are passed directly to LLVM without being interpreted by rustc.)

Follow up to https://github.com/rust-lang/rust/pull/72248.
2020-05-21 13:12:24 +02:00
Ralf Jung
0e887129ad
Rollup merge of #72371 - Elrendio:char_documentation, r=steveklabnik
FIX - Char documentation for unexperienced users

This is my first PR on rust and even if I've read [CONTRIBUTING.md](https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#pull-requests) I'm ensure everything is perfect. Sorry if I didn't follow the exact procedure.

**What it does:**
- Add an example in the char documentation

**Explanation**
Unexperienced users might not know that punctuation is `Case_Ignorable` and not `Uppercase` and `Lowercase` which mean that when checking if a string is uppercase one might be tempted to write:
```rust
my_string.chars().all(char::is_uppercase)
```

However this will return false for `"HELLO WORLD"` which is not intuitive. Since the function `is_case_ignorable` doesn't exists I believe the correct way to check is:
```rust
!my_string.chars().any(char::is_lowercase)
```

The aim of this example is to prevent unexperienced users to make an error which punctuation chars.
2020-05-21 13:12:22 +02:00
Ralf Jung
4f9fe914e2
Rollup merge of #72365 - marmeladema:remove-node_to_hir_id, r=ecstatic-morse
Remove unused `StableHashingContext::node_to_hir_id` method

cc #50928
2020-05-21 13:12:20 +02:00
Ralf Jung
85d712c115
Rollup merge of #72296 - ChrisDenton:msvc-link-check, r=petrochenkov
Suggest installing VS Build Tools in more situations

When MSVC's `link.exe` wasn't found but another `link.exe` was, the error message given can be [impenetrable](https://pastebin.com/MRMCr7HM) to many users. The usual suspect is GNU's `link` tool. In this case, inform the user that they may need to install VS build tools.

This only applies when Microsoft's link tool is expected.
2020-05-21 13:12:19 +02:00
Ralf Jung
e279bd5366
Rollup merge of #72272 - GuillaumeGomez:fix-back-on-page-with-search-behaviour, r=kinnison
Fix going back in history to a search result page on firefox

This bug was actually firefox not re-running JS script when you go back in history. To trigger it on the current docs:

 * Make a search
 * Pick an element (which isn't on the same page as the current element!)
 * Go back in history

Instead of having the search results, you'll see the normal doc page. You can find a small explanation about it [here](http://web.archive.org/web/20100428053932/http://www.firefoxanswer.com/firefox/672-firefoxanswer.html).

r? @kinnison

cc @ollie27
2020-05-21 13:12:17 +02:00
Ralf Jung
e2c05d1e9c
Rollup merge of #72111 - petrochenkov:docstrip, r=ehuss
rustc-book: Document `-Z strip=val` option

cc https://github.com/rust-lang/rust/issues/72110
2020-05-21 13:12:15 +02:00
Ralf Jung
25028adf21
Rollup merge of #71854 - eduardosm:assoc-char-funcs-and-consts, r=Amanieu
Make `std::char` functions and constants associated to `char`.

First step to fix https://github.com/rust-lang/rust/issues/71763.
2020-05-21 13:12:13 +02:00
Guillaume Gomez
20b499c60a Fix anchor display when hovering impl 2020-05-21 12:22:03 +02:00
bors
7f79e98c03 Auto merge of #72205 - ecstatic-morse:nrvo, r=oli-obk
Dumb NRVO

This is a very simple version of an NRVO pass, which scans backwards from the `return` terminator to see if there is an an assignment like `_0 = _1`. If a basic block with two or more predecessors is encountered during this scan without first seeing an assignment to the return place, we bail out. This avoids running a full "reaching definitions" dataflow analysis.

I wanted to see how much `rustc` would benefit from even a very limited version of this optimization. We should be able to use this as a point of comparison for more advanced versions that are based on live ranges.

r? @ghost
2020-05-21 07:16:44 +00:00
Dylan MacKenzie
f509862057 Bail out if new return place has different type than old 2020-05-20 23:09:07 -07:00
bors
963bf52829 Auto merge of #70705 - lcnr:generic_discriminant, r=nikomatsakis
Use `T`'s discriminant type in `mem::Discriminant<T>` instead of `u64`.

fixes #70509

Adds the lang-item `discriminant_kind`.
Updates the function signature of `intrinsics::discriminant_value`.
Adds the *probably permanently unstable* trait `DiscriminantKind`.
`mem::Discriminant` should now be smaller in some cases.

r? @ghost
2020-05-21 03:48:47 +00:00
Josh Stone
9c97b3cbf1 Move the target libLLVM to llvm-tools-preview
For running the compiler, we usually only need LLVM from `$sysroot/lib`,
which rustup will make available with `LD_LIBRARY_PATH`. We've also been
shipping LLVM in the `$target/lib` directory, which bloats the download
and installed size. The only times we do need the latter are for the
RPATH of `llvm-tools-preview` binaries, and for linking `rustc-dev`
libraries. We'll move it to the `llvm-tools-preview` component directly,
and `rustc-dev` will have an implicit dependency on it.

Here are the dist sizes that I got before and after this change:

    llvm-tools-1.45.0-dev-x86_64-unknown-linux-gnu.tar.gz     1.3M   24M
    llvm-tools-1.45.0-dev-x86_64-unknown-linux-gnu.tar.xz     748K   17M
    rustc-1.45.0-dev-x86_64-unknown-linux-gnu.tar.gz          83M    61M
    rustc-1.45.0-dev-x86_64-unknown-linux-gnu.tar.xz          56M    41M

The installed size should reduce by exactly one `libLLVM.so` (~70-80M),
unless you also install `llvm-tools`, and then it should be identical.
2020-05-20 16:28:28 -07:00
bors
82911b3bba Auto merge of #67759 - nikic:llvm-10, r=Mark-Simulacrum
Update to LLVM 10

LLVM 10 is going to be branched soon, so it's a good time to start finding all those tasty new miscompiles and performance regressions ;)

Status:

 * Preparation split off into #67900.
 * Optimization regressions:
   * [x] https://bugs.llvm.org/show_bug.cgi?id=44419 => https://reviews.llvm.org/D72048 has landed.
   * [x] https://bugs.llvm.org/show_bug.cgi?id=44423 => https://reviews.llvm.org/D72060 has landed.
   * [x] https://reviews.llvm.org/D72169 submitted.
   * [ ] https://bugs.llvm.org/show_bug.cgi?id=44461 reported. https://reviews.llvm.org/D72420 submitted, but unlikely eligible for LLVM 10.
 * Compile-time regressions:
   * [x] GlobalOpt regression identified. ~~fhahn proposed https://reviews.llvm.org/D72214.~~ fhahn has [reverted](192cce10f6) the patch.
   * [ ] Even with the revert, there are [large regressions](https://perf.rust-lang.org/compare.html?start=760ce94c69ca510d44087291c311296f6d9ccdf5&end=4e84f97d76e694bb9f59039f5bdeb6d8bca46d14).
 * Assertion failures / infinite loops:
   * [x] https://bugs.llvm.org/show_bug.cgi?id=44600 => https://reviews.llvm.org/D73135, https://reviews.llvm.org/D73854 and https://reviews.llvm.org/D73908 have landed and been cherry-picked to the 10.x branch.
   * [x] https://bugs.llvm.org/show_bug.cgi?id=44835 => https://reviews.llvm.org/D74278 has landed and been cherry-picked.
2020-05-20 22:49:57 +00:00
Vadim Petrochenkov
c7813ff7d2 llvm: Expose tiny code model to users 2020-05-20 23:10:48 +03:00
bors
0aa6751c19 Auto merge of #72378 - Dylan-DPC:rollup-m87bp2d, r=Dylan-DPC
Rollup of 6 pull requests

Successful merges:

 - #71863 (Suggest fixes and add error recovery for `use foo::self`)
 - #72139 (Make `fold` standalone.)
 - #72275 (Continue lowering for unsupported async generator instead of returning an error.)
 - #72361 (split_inclusive: add tracking issue number (72360))
 - #72364 (Remove unused dependencies)
 - #72366 (Adjust the zero check in `RawVec::grow`.)

Failed merges:

r? @ghost
2020-05-20 19:29:01 +00:00
Nikita Popov
b2bf0cdecb Set CMAKE_CXX_STANDARD when compiling LLD 2020-05-20 20:14:16 +02:00
Nikita Popov
9f128235b4 Update LLVM submodule 2020-05-20 20:14:16 +02:00
bors
8858a435f3 Auto merge of #72384 - mati865:ci-fix, r=pietroalbini
Workaround MSYS2/chocolatey issue again
2020-05-20 15:55:59 +00:00
Mateusz Mikuła
2d4d0dbaa7 Workaround MSYS2/chocolatey issue again 2020-05-20 17:40:58 +02:00
Tomasz Miąsko
6778c7a7c1 Show default values for debug-assertions & debug-assertions-std 2020-05-20 16:48:45 +02:00
Chris Denton
2fd504ce2f Suggest installing VS Build Tools in more situations
When MSVC's `link.exe` wasn't found but another `link.exe` was, the error message given can be impenetrable to many users. The usual suspect is GNU's `link` tool. In this case, inform the user that they may need to install VS build tools.

This only applies when Microsoft's link tool is expected. Not `lld-link` or other MSVC compatible linkers.
2020-05-20 15:04:11 +01:00
Bastian Kauschke
3dd830b70c ptr eq for Predicate 2020-05-20 15:44:34 +02:00
Bastian Kauschke
6544d7b6b1 change Predicate::kind to return a reference 2020-05-20 15:44:34 +02:00
Bastian Kauschke
57746f943b intern PredicateKind 2020-05-20 15:44:34 +02:00
Bastian Kauschke
f3164790bd introduce newtype'd Predicate<'tcx> 2020-05-20 15:44:34 +02:00
Niko Matsakis
034c25f33e make to_predicate take a tcx argument 2020-05-20 15:44:34 +02:00
Bastian Kauschke
cad8fe90fd rename Predicate to PredicateKind, introduce alias 2020-05-20 15:38:03 +02:00
Dylan DPC
51f80b7630
Rollup merge of #72366 - nnethercote:tiny-vecs-are-dumb-followup, r=Amanieu
Adjust the zero check in `RawVec::grow`.

This was supposed to land as part of #72227. (I wish `git push` would
abort when you have uncommited changes.)

r? @Amanieu
2020-05-20 14:21:13 +02:00
Dylan DPC
c93ddbf811
Rollup merge of #72364 - jsgf:remove-unused-deps, r=Mark-Simulacrum
Remove unused dependencies

Remove some unused dependencies found while while working on https://github.com/rust-lang/rust/pull/72342.
2020-05-20 14:21:11 +02:00
Dylan DPC
2bfbc057fe
Rollup merge of #72361 - golddranks:split_inclusive_add_tracking_issue, r=shepmaster
split_inclusive: add tracking issue number (72360)

Adds tracking issue number ( https://github.com/rust-lang/rust/issues/72360 ) to the unstable feature attributes.
2020-05-20 14:21:09 +02:00
Dylan DPC
68fd4e098c
Rollup merge of #72275 - marmeladema:fix-issue-71104-2, r=ecstatic-morse
Continue lowering for unsupported async generator instead of returning an error.

This way the hir is "valid" and we can remove one more call to
`opt_node_id_to_hir_id` but an error is still emitted.

This is another partial fix for #71104

r? @eddyb
2020-05-20 14:21:07 +02:00
Dylan DPC
5c52f9f916
Rollup merge of #72139 - nnethercote:standalone-fold, r=cuviper
Make `fold` standalone.

`fold` is currently implemented via `try_fold`, but implementing it
directly results in slightly less LLVM IR being generated, speeding up
compilation of some benchmarks.

r? @cuviper
2020-05-20 14:21:06 +02:00
Dylan DPC
14c439177b
Rollup merge of #71863 - mibac138:self-import, r=estebank
Suggest fixes and add error recovery for `use foo::self`

Fixes #63741.
I have implemented 2 suggestions on how to fix a `use foo::self` import, however I feel like showing them both might be too verbose.

Additionally, I have also implemented error recovery as [menitoned](https://github.com/rust-lang/rust/issues/63741#issuecomment-602391091) by @comex.

I believe r? @estebank deals with diagnostics.
2020-05-20 14:21:00 +02:00
Elrendio
f5b49572dd FIX - Char documentation for unexperienced users 2020-05-20 12:18:09 +02:00