Commit Graph

100681 Commits

Author SHA1 Message Date
bors ea45150837 Auto merge of #59953 - eddyb:soa-metadata, r=michaelwoerister
rustc_metadata: replace Entry table with one table for each of its fields (AoS -> SoA).

In https://github.com/rust-lang/rust/pull/59789#issuecomment-481958212 I noticed that for many cross-crate queries (e.g. `predicates_of(def_id)`), we were deserializing the `rustc_metadata::schema::Entry` for `def_id` *only* to read one field (i.e. `predicates`).

But there are several such queries, and `Entry` is not particularly small (in terms of number of fields, the encoding itself is quite compact), so there is a large (and unnecessary) constant factor.

This PR replaces the (random-access) array¹ of `Entry` structures ("AoS"), with many separate arrays¹, one for each field that used to be in `Entry` ("SoA"), resulting in the ability to read individual fields separately, with negligible time overhead (in thoery), and some size overhead (as these arrays are not sparse).

In a way, the new approach is closer to incremental on-disk caches, which store each query's cached results separately, but it would take significantly more work to unify the two.

For stage1 `libcore`'s metadata blob, the size overhead is `8.44%`, and I have another commit (~~not initially included because I want to do perf runs with both~~ **EDIT**: added it now) that brings it down to `5.88%`.

¹(in the source, these arrays are called "tables", but perhaps they could use a better name)
2019-10-17 10:45:09 +00:00
bors a16dca337d Auto merge of #65251 - tlively:emscripten-upstream-upgrade, r=tlively
Upgrade Emscripten targets to use upstream LLVM backend

 - Compatible with Emscripten 1.38.46-upstream or later upstream.
 - Refactors the Emscripten target spec to share code with other wasm
   targets.
 - Replaces the old incorrect wasm32 C call ABI with the correct one,
   preserving the old one as wasm32_bindgen_compat for wasm-bindgen
   compatibility.
 - Updates the varargs ABI used by Emscripten and deletes the old one.
 - Removes the obsolete wasm32-experimental-emscripten target.
 - Uses EMCC_CFLAGS on CI to avoid the timeout problems with #63649.

r? @alexcrichton
2019-10-17 06:47:18 +00:00
Thomas Lively c0aa7cb2b5 Remove PR runs, enable wasm32 CI, and move asmjs to disabled 2019-10-16 21:18:34 -07:00
bors 7e498005a1 Auto merge of #65234 - GuillaumeGomez:long-err-explanation-E0573, r=kinnison
Add long error explanation for E0573

Part of #61137.
2019-10-17 02:04:49 +00:00
Thomas Lively 4b26d9c142 User should not change between emcc install and use 2019-10-16 17:06:48 -07:00
Thomas Lively 36808c251c Update test expectations 2019-10-16 17:06:48 -07:00
Thomas Lively b0b6e368c0 Update test and add -O1 to wasm32 Dockerfile 2019-10-16 17:06:48 -07:00
Thomas Lively a2264f6af5 Temporarily enable asmjs and wasm32 on PR CI 2019-10-16 17:06:48 -07:00
Thomas Lively 2bf59bea48 Upgrade Emscripten targets to use upstream LLVM backend
- Compatible with Emscripten 1.38.46-upstream or later upstream.
 - Refactors the Emscripten target spec to share code with other wasm
   targets.
 - Replaces the old incorrect wasm32 C call ABI with the correct one,
   preserving the old one as wasm32_bindgen_compat for wasm-bindgen
   compatibility.
 - Updates the varargs ABI used by Emscripten and deletes the old one.
 - Removes the obsolete wasm32-experimental-emscripten target.
 - Uses EMCC_CFLAGS on CI to avoid the timeout problems with #63649.
2019-10-16 17:06:48 -07:00
bors c8fa82c482 Auto merge of #63756 - Zoxc:sharded-dep-graph-1, r=nikomatsakis
Use more fine grained locks for the dep graph

Split out from https://github.com/rust-lang/rust/pull/61845.

r? @michaelwoerister cc @aturon
2019-10-16 20:49:27 +00:00
bors 0e8a4b441c Auto merge of #65445 - ehuss:update-cargo-books, r=alexcrichton
Update cargo, books

## nomicon

3 commits in 4374786f0b4bf0606b35d5c30a9681f342e5707b..5004ad30d69f93553ceef74439fea2159d1f769e
2019-09-17 18:33:21 +0200 to 2019-10-12 19:52:40 +0200
- further clarify C11 and C/C++11 terminology (rust-lang-nursery/nomicon#169)
- atomics: C11 -> C++20 (rust-lang-nursery/nomicon#168)
- use sound/unsound terminology

## cargo

12 commits in a429e8cc4614a46a86322a0777a477e2baa83f1c..3a9abe3f065554a7fbc59f440df2baba4a6e47ee
2019-10-04 17:36:12 +0000 to 2019-10-15 15:55:35 +0000
- Fix typo in git index initialization error path (rust-lang/cargo#7512)
- Reject feature flags in a virtual workspace. (rust-lang/cargo#7507)
- Rename `overrides` to `package` in profiles. (rust-lang/cargo#7504)
- Allow publishing with dev-dependencies without a version. (rust-lang/cargo#7333)
- Stabilize cache-messages (rust-lang/cargo#7450)
- don't lock the package cache when cleaning target dir. (rust-lang/cargo#7502)
- Document rustc wrapper (rust-lang/cargo#7499)
- Migrate towards exclusively using serde for `Config` (rust-lang/cargo#7456)
- Re-enable some MSVC tests. (rust-lang/cargo#7492)
- when -Z unstable-options not specified, don't validate --profile (rust-lang/cargo#7489)
- Improve error message for cyclic dependencies (rust-lang/cargo#7470)
- Some minor clippy fixes. (rust-lang/cargo#7484)

## book

7 commits in 04806c80be0f54b1290287e3f85e84bdfc0b6ec7..9bb8b161963fcebc9d9ccd732ba26f42108016d5
2019-10-01 20:20:22 -0400 to 2019-10-14 18:42:55 -0500
- Make a portion of text less ambiguous (rust-lang/book#2092)
- fix heading level (rust-lang/book#2117)
- Add missing "of" before `"duck typing"`. (rust-lang/book#1951)
- ch18-03: no need to debug print destructured int (rust-lang/book#1991)
- Subtle fix to introduce ? on Option in Chapter 9.2 (rust-lang/book#2047)
- make wording clearer (rust-lang/book#1976)
- Update the version of rand we use

## rust-by-example

5 commits in a6288e7407a6c4c19ea29de6d43f40c803883f21..0b111eaae36cc4b4997684be853882a59e2c7ca7
2019-10-01 10:09:14 -0300 to 2019-10-14 18:34:25 -0300
- Some fix to three files (rust-lang/rust-by-example#1280)
- Add reference to Generics (rust-lang/rust-by-example#1281)
- Confusing and long sentence (rust-lang/rust-by-example#1282)
- Explicit mention of slice range meaning (rust-lang/rust-by-example#1277)
- Updated aliasing for nll (rust-lang/rust-by-example#1276)
2019-10-16 16:48:44 +00:00
Eric Huss 5bb05a2c5e Update cargo, books 2019-10-16 06:43:44 -07:00
bors 53aca553ec Auto merge of #65172 - tanriol:explain_borrow-use-context-dominators, r=nagisa
use precalculated dominators in explain_borrow

This looks like the only place calculating dominators from the MIR body every time instead of using the ones stored on the `MirBorrowckCtxt`. For example, in rust-lang/rust#65131 a big generated function with a number of borrowck errors takes a few hours(!) recalculating the dominators while explaining the errors.

I don't know enough about this part of rustc codebase to know for sure that this change is correct, but no tests seem to fail as a result of this change in local testing.
2019-10-16 12:49:49 +00:00
Guillaume Gomez 7d357fbffd update ui tests 2019-10-16 13:56:14 +02:00
Guillaume Gomez e5d566c080 Add long error explanation for E0573 2019-10-16 13:56:14 +02:00
bors bfc58789a4 Auto merge of #65450 - Manishearth:clippyup, r=Manishearth
Update clippy

Fixes #65446.
r? @ghost
2019-10-16 05:08:00 +00:00
bors f54911c6f2 Auto merge of #65454 - tmandry:rollup-0k6jiik, r=tmandry
Rollup of 14 pull requests

Successful merges:

 - #64603 (Reducing spurious unused lifetime warnings.)
 - #64623 (Remove last uses of gensyms)
 - #65235 (don't assume we can *always* find a return type hint in async fn)
 - #65242 (Fix suggestion to constrain trait for method to be found)
 - #65265 (Cleanup librustc mir err codes)
 - #65293 (Optimize `try_expand_impl_trait_type`)
 - #65307 (Try fix incorrect "explicit lifetime name needed")
 - #65308 (Add long error explanation for E0574)
 - #65353 (save-analysis: Don't ICE when resolving qualified type paths in struct members)
 - #65389 (Return `false` from `needs_drop` for all zero-sized arrays.)
 - #65402 (Add troubleshooting section to PGO chapter in rustc book.)
 - #65425 (Optimize `BitIter`)
 - #65438 (Organize `never_type`  tests)
 - #65444 (Implement AsRef<[T]> for List<T>)

Failed merges:

 - #65390 (Add long error explanation for E0576)

r? @ghost
2019-10-15 23:09:33 +00:00
Tyler Mandry 3182f73e8d
Rollup merge of #65444 - spastorino:as-ref-for-list, r=Mark-Simulacrum
Implement AsRef<[T]> for List<T>

r? @Mark-Simulacrum
2019-10-15 16:08:00 -07:00
Tyler Mandry ef5420301d
Rollup merge of #65438 - Centril:almost, r=varkor
Organize `never_type`  tests

Extracted from https://github.com/rust-lang/rust/pull/65355.
This just moves some tests around to make things better categorized.

r? @varkor
2019-10-15 16:07:58 -07:00
Tyler Mandry 641607902e
Rollup merge of #65425 - nnethercote:optimize-BitIter, r=zackmdavis
Optimize `BitIter`

A minor speed improvement.
2019-10-15 16:07:57 -07:00
Tyler Mandry 2dac8b9176
Rollup merge of #65402 - michaelwoerister:pgo-troubleshooting-docs, r=alexcrichton
Add troubleshooting section to PGO chapter in rustc book.

- Adds a note about using `-pgo-warn-missing-function` in order to spot mistakes in PGO setup.
- Mentions cargo symbol name issue fixed in 1.39.

Nominating for backport.

r? @alexcrichton
2019-10-15 16:07:55 -07:00
Tyler Mandry bbcf66a4a1
Rollup merge of #65389 - ecstatic-morse:zero-sized-array-no-drop, r=eddyb
Return `false` from `needs_drop` for all zero-sized arrays.

Resolves #65348.

This changes the result of the `needs_drop` query from `true` to `false` for types such as `[Box<i32>; 0]`. I believe this change to be sound because a zero-sized array can never actually hold a value. This is an elegant way of resolving #65348 and #64945, but obviously it has much broader implications.
2019-10-15 16:07:53 -07:00
Tyler Mandry 820fb7ccbf
Rollup merge of #65353 - Xanewok:sa-empty-tables, r=nikomatsakis
save-analysis: Don't ICE when resolving qualified type paths in struct members

Previously, we failed since we use `qpath_res` via typeck tables - when using those we need to pass in a HirId that's local to the definition path the tables are rooted at (otherwise we risk frame of reference mismatch and an assertion against invalid lookup).

In this case we can't get typeck tables for struct definition because it has no body, however the struct member type node is rooted under the struct definition and so we can't really do anything about it in terms of traversal.

Instead, we try to "nest" the tables as always but change the default behaviour to use empty typeck tables rather than silently trying to use the current ones. This does work as we expect and for prior art, we use the same approach in the [privacy](7bc94cc3c2/src/librustc_privacy/lib.rs (L332-L341)) [pass](7bc94cc3c2/src/librustc_privacy/lib.rs (L1007-L1028)).

Fixes #64659.
Fixes #64821.

r? @nikomatsakis (since this changes the default behaviour introduced in d7d3f197f6)
2019-10-15 16:07:52 -07:00
Tyler Mandry 42b35968fb
Rollup merge of #65308 - GuillaumeGomez:long-err-explanation-E0574, r=matthewjasper
Add long error explanation for E0574

Part of #61137.
2019-10-15 16:07:50 -07:00
Tyler Mandry ff9b99dcd6
Rollup merge of #65307 - Phosphorus15:master, r=varkor
Try fix incorrect "explicit lifetime name needed"

This pr is trying to fixes #65285 .
2019-10-15 16:07:49 -07:00
Tyler Mandry a6ae7ae63f
Rollup merge of #65293 - tmandry:turbo-expander, r=matthewjasper
Optimize `try_expand_impl_trait_type`

A lot of time was being spent expanding some large `impl Future` types in fuchsia. This PR takes the number of types being visited in one expansion from >3 billion to about a thousand, and eliminates the compile time regression in https://github.com/rust-lang/rust/issues/65147 (in fact, compile times are better than they were before).

Thanks to @Mark-Simulacrum for helping identify the issue and to @matthewjasper for suggesting this change.

Fixes #65147.
r? @matthewjasper,@nikomatsakis
2019-10-15 16:07:47 -07:00
Tyler Mandry 8f09085bb0
Rollup merge of #65265 - GuillaumeGomez:cleanup-librustc_mir-err-codes, r=Mark-Simulacrum
Cleanup librustc mir err codes

Three things are done in this PR:

 * Sort error codes
 * Uncomment an error code long error explanation (they should **never** be commented)
 * Unify explanations
2019-10-15 16:07:46 -07:00
Tyler Mandry ef9d6ee8ad
Rollup merge of #65242 - estebank:contrain-trait-sugg, r=varkor
Fix suggestion to constrain trait for method to be found

Fix #65044.
2019-10-15 16:07:44 -07:00
Tyler Mandry bbf4eb3fc2
Rollup merge of #65235 - nikomatsakis:issue-65159-async-fn-return-ice, r=cramertj
don't assume we can *always* find a return type hint in async fn

In particular, we sometimes cannot if there is an earlier error.

Fixes #65159

r? @cramertj, who reviewed the original PR
2019-10-15 16:07:43 -07:00
Tyler Mandry af3d9e57e7
Rollup merge of #64623 - matthewjasper:underscore-imports, r=petrochenkov
Remove last uses of gensyms

Underscore bindings now use unique `SyntaxContext`s to avoid collisions. This was the last use of gensyms in the compiler, so this PR also removes them.

closes #49300
cc #60869

r? @petrochenkov
2019-10-15 16:07:41 -07:00
Tyler Mandry fcef4b1aef
Rollup merge of #64603 - gilescope:unused-lifetime-warning, r=matthewjasper
Reducing spurious unused lifetime warnings.

Fixes #61115, fixes #64493.
2019-10-15 16:07:39 -07:00
Manish Goregaokar 33543ed122 Update clippy 2019-10-15 13:52:34 -07:00
Matthew Jasper 4198df1f4b Remove some mentions of gensyms 2019-10-15 21:12:05 +01:00
Matthew Jasper 94967f23f7 Remove gensyms 2019-10-15 21:12:05 +01:00
Matthew Jasper 1a2597b64a Don't use `gensym_if_underscore` to resolve `_` bindings
Instead add a disambiguator to the keys used for distinguishing
resolutions.
2019-10-15 21:12:04 +01:00
Nicholas Nethercote 60851b08e5 Optimize `BitSet` iteration.
This commit removes an `Option` check in `BitIter::next()`, avoids
calling `trailing_zeros()` when it's not necessary, and avoids the need
for `enumerate()`. This gives a tiny (0.2%) instruction count win on a
couple of benchmarks.

The commit also adds some comments, which is good because this iteration
code is moderately complex.
2019-10-16 06:53:08 +11:00
Nicholas Nethercote 2918a7d5a9 Add `BitIter::new()`.
This factors out some duplicated code.
2019-10-16 06:19:41 +11:00
Santiago Pastorino fa3a4aeae5
Implement AsRef<[T]> for List<T> 2019-10-15 14:43:24 -03:00
Giles Cope d82c1c546d Avoid unused lifetime warning for lifetimes introduced when desugering async. 2019-10-15 18:05:13 +01:00
Eduard-Mihai Burtescu d89dddc920 rustc_metadata: address some review comments. 2019-10-15 18:23:51 +03:00
Eduard-Mihai Burtescu 34066d60c3 rustc_metadata: don't use more space than needed, for each Table. 2019-10-15 18:23:51 +03:00
Eduard-Mihai Burtescu ee747f645f rustc_metadata: replace Entry table with one table for each of its fields (AoS -> SoA). 2019-10-15 18:23:51 +03:00
Eduard-Mihai Burtescu 972b93b20e rustc_metadata: use decoder::Metadata instead of &[u8] for Lazy<Table<T>>::get. 2019-10-15 18:23:51 +03:00
Eduard-Mihai Burtescu cef4950280 rustc_metadata: generalize Table<T> to hold T, not Lazy<T>, elements. 2019-10-15 18:23:51 +03:00
Eduard-Mihai Burtescu 677f0df63b rustc_metadata: add a helper macro for recording into PerDefTable's. 2019-10-15 18:23:51 +03:00
Eduard-Mihai Burtescu 5d52a7e0d0 rustc_metadata: split tables into an usize-keyed Table and a DefIndex-keyed PerDefTable. 2019-10-15 18:23:51 +03:00
Eduard-Mihai Burtescu dd1264e90a rustc_metadata: replace Lazy<[Table<T>]> with Lazy<Table<T>>. 2019-10-15 18:23:51 +03:00
Eduard-Mihai Burtescu ffd18fc22c rustc_metadata: parametrize Table by element type. 2019-10-15 18:23:51 +03:00
Eduard-Mihai Burtescu f49274032b rustc_metadata: rename index::Index to table::Table. 2019-10-15 18:23:50 +03:00
Eduard-Mihai Burtescu 83b3c39218 rustc_metadata: use 0 in index::Index to indicate missing entries. 2019-10-15 18:23:50 +03:00