Commit Graph

2810 Commits

Author SHA1 Message Date
Matthias Krüger
17a8c1017f don't clone copy types 2020-12-29 19:40:03 +01:00
LingMan
7a41532ef9 More uses of the matches! macro 2020-12-29 17:18:52 +01:00
Ralf Jung
51cec58040 fix a comment 2020-12-29 16:32:38 +01:00
Aaron Hill
530a629635
Remove pretty-print/reparse hack, and add derive-specific hack 2020-12-29 09:36:42 -05:00
bors
e2a2592885 Auto merge of #79084 - simonvandel:instcombine-perf, r=oli-obk
Small perf changes for InstCombine
2020-12-29 06:21:18 +00:00
LingMan
3dae414cb6 Use Option::map_or instead of open coding it 2020-12-29 04:27:37 +01:00
Tomasz Miąsko
5718cc2f9b Make forget intrinsic safe 2020-12-29 00:00:00 +00:00
Ralf Jung
4a90a58c34 make more matches exhaustive 2020-12-28 23:29:16 +01:00
Camelid
8d5dc8c2f0
Add missing commas to rustc_ast_pretty::pp docs 2020-12-28 14:23:20 -08:00
Simon Vandel Sillesen
0010fc8fec use exhaustive pattern match to prevent future bugs 2020-12-28 23:19:35 +01:00
Ralf Jung
c177e68015 merge two match'es for more exhaustiveness 2020-12-28 22:44:04 +01:00
Ralf Jung
122e91c4fb promotion: factor some common code into validate_ref 2020-12-28 22:09:08 +01:00
Mara Bos
8b43932ae2
Rollup merge of #80403 - 0xflotus:patch-1, r=jyn514
fix: small typo error in chalk/mod.rs
2020-12-28 19:09:27 +00:00
Mara Bos
803b37597e
Rollup merge of #80402 - camelid:inferty-docs, r=matthewjasper
Document `InferTy` & co.

I finally figured out what `TyVid` means! The name is quite opaque, so I
decided to document it and related types.

I don't know that much about `InferTy` & co., but I was able to *infer*
( :) ) from the names and what I know generally about type inference to
add some basic documentation.
2020-12-28 19:09:25 +00:00
bors
2987785df3 Auto merge of #80439 - Dylan-DPC:rollup-rdxcvon, r=Dylan-DPC
Rollup of 11 pull requests

Successful merges:

 - #79662 (Move some more code out of CodegenBackend::{codegen_crate,link})
 - #79815 (Update RELEASES.md for 1.49.0)
 - #80284 (Suggest fn ptr rather than fn item and suggest to use `Fn` trait bounds rather than the unique closure type in E0121)
 - #80331 (Add more comments to trait queries)
 - #80344 (use matches!() macro in more places)
 - #80353 (BTreeMap: test split_off (and append) more thoroughly)
 - #80362 (Document rustc_macros on nightly-rustc)
 - #80399 (Remove FIXME in rustc_privacy)
 - #80408 (Sync rustc_codegen_cranelift)
 - #80411 (rustc_span: Remove `Symbol::with`)
 - #80434 (bootstrap: put the component name in the tarball temp dir path)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2020-12-28 15:57:50 +00:00
Dylan DPC
80934aba15
Rollup merge of #80411 - petrochenkov:nosymwith, r=matthewjasper
rustc_span: Remove `Symbol::with`

A subset of https://github.com/rust-lang/rust/pull/79425 that is a pure refactoring.
2020-12-28 14:13:21 +01:00
Dylan DPC
55b52ee339
Rollup merge of #80408 - bjorn3:sync_cg_clif-2020-12-27, r=bjorn3
Sync rustc_codegen_cranelift

The highlight of this sync are two JIT mode improvements. The first is that it is now possible to use JIT mode when using `-Zcodegen-backend` instead of the custom driver using `-Cllvm-args=mode=jit`. The second one is a new JIT mode that lazily compiles functions when they are called the first time: https://github.com/bjorn3/rustc_codegen_cranelift/pull/1120

In addition this includes a few small runtime performance improvements and various fixes for rustc changes that didn't cause compilation to fail.

r? ``@ghost``

``@rustbot`` label +A-codegen +A-cranelift +T-compiler
2020-12-28 14:13:19 +01:00
Dylan DPC
70b1a29b80
Rollup merge of #80399 - jyn514:hir-id-cleanup, r=marmeladema
Remove FIXME in rustc_privacy

#71104 has been fixed.

r? ``@marmeladema`` if you have time, otherwise ``@petrochenkov``
2020-12-28 14:13:17 +01:00
Dylan DPC
c51172f38a
Rollup merge of #80344 - matthiaskrgr:matches, r=Dylan-DPC
use matches!() macro in more places
2020-12-28 14:13:12 +01:00
Dylan DPC
3f8c979c4b
Rollup merge of #80331 - jyn514:docs, r=varkor
Add more comments to trait queries

This also adds back a comment that was mistakenly removed in
ac9dfc3e77.
2020-12-28 14:13:10 +01:00
Dylan DPC
12ac312351
Rollup merge of #80284 - ThePuzzlemaker:issue-80179-fix, r=varkor
Suggest fn ptr rather than fn item and suggest to use `Fn` trait bounds rather than the unique closure type in E0121

Previously, using `_` as a return type in a function that returned a function/closure would provide a diagnostic that would cause a papercut. For example:
```rust
fn f() -> i32 { 0 }
fn fn_ptr() -> _ { f }
fn closure() -> _ { || 0 }
```
would result in this diagnostic:
```rust
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
 --> <anon>:2:16
  |
2 | fn fn_ptr() -> _ { f }
  |                ^
  |                |
  |                not allowed in type signatures
  |                help: replace with the correct return type: `fn() -> i32 {f}`

error[E0121]: the type placeholder `_` is not allowed within types on item signatures
 --> <anon>:3:17
  |
3 | fn closure() -> _ { || 0 }
  |                 ^
  |                 |
  |                 not allowed in type signatures
  |                 help: replace with the correct return type: `[closure@<anon>:3:21: 3:25]`

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0121`.
```
As can be seen, it was suggested to use the function definition return type `fn() -> i32 { f }` which is not valid syntax as a return type. Additionally, closures cause a papercut as unique closure types (notated in this case as `[closure@<anon>:3:21: 3:25]`) are not valid syntax either.

Instead, this PR implements this version of the diagnostic (this example is for the same code featured above):
```rust
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
 --> <anon>:2:16
  |
2 | fn fn_ptr() -> _ { f }
  |                ^
  |                |
  |                not allowed in type signatures
  |                help: replace with the correct return type: `fn() -> i32`

error[E0121]: the type placeholder `_` is not allowed within types on item signatures
 --> <anon>:3:17
  |
3 | fn closure() -> _ { || 0 }
  |                 ^ not allowed in type signatures
  |
  = help: consider using an `Fn`, `FnMut`, or `FnOnce` trait bound
  = note: for more information on `Fn` traits and closure types, see https://doc.rust-lang.org/book/ch13-01-closures.html

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0121`.
```
As can be seen in this diagnostic, the papercut for returning a function item is fixed by suggesting the usage of a function pointer as the return type. As for closures, it's suggested to use an `Fn`, `FnMut`, or `FnOnce` trait bound (with further reading on closures and `Fn` traits in *The Book* for beginners). I did not implement a suggestion to use `impl Fn() -> i32` syntax as that was out-of-scope for my abilities at the moment, therefore someone in the future may want to implement that. Also, it's possible to use either `impl Trait` syntax, generics, or generics with a `where` clause, and some users may not want to use `impl Trait` syntax for their own reasons.

This PR fixes #80179.
2020-12-28 14:13:08 +01:00
Dylan DPC
98d80bda01
Rollup merge of #79662 - bjorn3:move_more_code_out_of_codegen_backend, r=oli-obk
Move some more code out of CodegenBackend::{codegen_crate,link}

Kind of a follow up to #77795
2020-12-28 14:12:59 +01:00
bors
76aca6659a Auto merge of #78454 - bugadani:cyclic, r=oli-obk
MIR Body: Cache result of `is_cyclic` call
2020-12-28 11:25:33 +00:00
Camelid
cdad0c80ef
Also show the displayed version of IntVar and FloatVar
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2020-12-27 11:05:40 -08:00
Vadim Petrochenkov
0ae998e122 rustc_span: Remove Symbol::with 2020-12-27 18:10:58 +03:00
bjorn3
52cf01c815 Merge commit 'dbee13661efa269cb4cd57bb4c6b99a19732b484' into sync_cg_clif-2020-12-27 2020-12-27 10:30:38 +01:00
0xflotus
cb177852c1
fix: small typo error in chalk/mod.rs 2020-12-27 03:22:23 +01:00
Camelid
6aea014fbf
Document InferTy & co. 2020-12-26 17:55:39 -08:00
Joshua Nelson
53da233aec Remove FIXME in rustc_privacy 2020-12-26 19:34:10 -05:00
Bastian Kauschke
18fa7789cd update error codes 2020-12-26 18:24:10 +01:00
Bastian Kauschke
06cc9c26da stabilize min_const_generics 2020-12-26 18:24:10 +01:00
Albin Hedman
1b77f8e6ea Constify intrinsics::copy[_nonoverlapping] 2020-12-26 02:22:29 +01:00
bors
931aa27922 Auto merge of #80246 - matthewjasper:projection-cycle-caching, r=Mark-Simulacrum
Prevent caching normalization results with a cycle

When normalizing a projection which results in a cycle, we would cache the result of `project_type` without the nested obligations (because they're not needed for inference). This would result in the nested obligations only being handled once in fulfill, which would avoid the cycle error. `get_paranoid_cache_value_obligation` used to add an obligation that resulted in a cycle in this case previously, but was removed by #73905.

This PR makes the projection cache not cache the value of a projection if it was ever normalized in a cycle (except in a snapshot that's rolled back).

Fixes #79714.

r? `@nikomatsakis`
2020-12-26 00:11:30 +00:00
pierwill
a8775d44e9 Edit rustc_span documentation
Various changes to the `rustc_span` docs, including the following:

- Additions to top-level docs
- Edits to the source_map module docs
- Edits to documentation for `Span` and `SpanData`
- Added intra-docs links
- Documentation for Levenshtein distances
- Fixed missing punctuation
2020-12-25 14:02:52 -08:00
bors
bb178237c5 Auto merge of #80235 - RalfJung:validate-promoteds, r=oli-obk
validate promoteds

Turn on const-value validation for promoteds. This is made possible now that https://github.com/rust-lang/rust/issues/67534 is resolved.

I don't think this is a breaking change. We don't promote any unsafe operation any more (since https://github.com/rust-lang/rust/pull/77526 landed). We *do* promote `const fn` calls under some circumstances (in `const`/`static` initializers), but union field access and similar operations are not allowed in `const fn`. So now is a perfect time to add this check. :D

r? `@oli-obk`
Fixes https://github.com/rust-lang/rust/issues/67465
2020-12-25 18:25:48 +00:00
bors
1832bdd7de Auto merge of #80296 - wesleywiser:revert_missing_fragment_specifier_hard_error, r=Mark-Simulacrum
Revert missing fragment specifier hard error

Closes #76605

Reopens #40107

r? `@Mark-Simulacrum`
2020-12-25 14:09:08 +00:00
bors
198ec340f6 Auto merge of #80187 - 0dvictor:nativelib, r=bjorn3
Exclude unnecessary info from CodegenResults

`foreign_module` and `wasm_import_module` are not needed for linking, and hence can be removed from CodegenResults.

Fixes #77857
2020-12-25 08:17:21 +00:00
bors
9a40539c38 Auto merge of #80364 - Dylan-DPC:rollup-0y96okz, r=Dylan-DPC
Rollup of 11 pull requests

Successful merges:

 - #79213 (Stabilize `core::slice::fill`)
 - #79999 (Refactored verbose print into a function)
 - #80160 (Implemented a compiler diagnostic for move async mistake)
 - #80274 (Rename rustc_middle::lint::LintSource)
 - #80280 (Add installation commands to `x` tool README)
 - #80319 (Fix elided lifetimes shown as `'_` on async functions)
 - #80327 (Updated the match with the matches macro)
 - #80330 (Fix typo in simplify_try.rs)
 - #80340 (Don't unnecessarily override attrs for Module)
 - #80342 (Fix typo)
 - #80352 (BTreeMap: make test cases more explicit on failure)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2020-12-25 05:23:24 +00:00
Dylan DPC
3cf289bd5f
Rollup merge of #80342 - pierwill:patch-1, r=lcnr
Fix typo
2020-12-25 03:39:49 +01:00
Dylan DPC
704f81e3cb
Rollup merge of #80330 - eltociear:patch-2, r=lcnr
Fix typo in simplify_try.rs

assigment -> assignment
2020-12-25 03:39:46 +01:00
Dylan DPC
2dab627d77
Rollup merge of #80327 - PankajChaudhary5:PankajChaudhary, r=GuillaumeGomez
Updated the match with the matches macro

r?````@GuillaumeGomez````
2020-12-25 03:39:43 +01:00
Dylan DPC
b295b8e67b
Rollup merge of #80274 - pierwill:lintlevelsource, r=petrochenkov
Rename rustc_middle::lint::LintSource

Rename [`rustc_middle::lint::LintSource`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/lint/enum.LintSource.html) to `rustc_middle::lint::LintLevelSource`.

This enum represents the source of a *lint level*, not a lint. This should improve code readability.

Update: Also documents `rustc_middle::lint::LevelSource` to clarify.
2020-12-25 03:39:36 +01:00
Dylan DPC
299c2fc695
Rollup merge of #80160 - diondokter:move_async_fix, r=davidtwco
Implemented a compiler diagnostic for move async mistake

Fixes #79694

First time contributing, so I hope I'm doing everything right.
(If not, please correct me!)

This code performs a check when a move capture clause is parsed. The check is to detect if the user has reversed the async move keywords and to provide a diagnostic with a suggestion to fix it.

Checked code:
```rust
fn main() {
    move async { };
}
```

Previous output:
```txt
PS C:\Repos\move_async_test> cargo build
   Compiling move_async_test v0.1.0 (C:\Repos\move_async_test)
error: expected one of `|` or `||`, found keyword `async`
 --> src\main.rs:2:10
  |
2 |     move async { };
  |          ^^^^^ expected one of `|` or `||`

error: aborting due to previous error

error: could not compile `move_async_test`
```

New output:
```txt
PS C:\Repos\move_async_test> cargo +dev build
   Compiling move_async_test v0.1.0 (C:\Repos\move_async_test)
error: the order of `move` and `async` is incorrect
 --> src\main.rs:2:13
  |
2 |     let _ = move async { };
  |             ^^^^^^^^^^
  |
help: try switching the order
  |
2 |     let _ = async move { };
  |             ^^^^^^^^^^

error: aborting due to previous error

error: could not compile `move_async_test`
```

Is there a file/module where these kind of things are tested?
Would love some feedback 😄
2020-12-25 03:39:35 +01:00
Dylan DPC
787b016957
Rollup merge of #79999 - hencrice:yenlinc/79799, r=oli-obk
Refactored verbose print into a function

Also handle Tuple and Array separately, which was not explicitly checked.

Fixes #79799.
2020-12-25 03:39:33 +01:00
bors
cae1f4ddf2 Auto merge of #79762 - Swatinem:remap-doctest-coverage, r=Swatinem
Remap instrument-coverage line numbers in doctests

This uses the `SourceMap::doctest_offset_line` method to re-map line
numbers from doctests. Remapping columns is not yet done, and rustdoc
still does not output the correct filename when running doctests in a
workspace.

Part of #79417 although I dont consider that fixed until both filenames
and columns are mapped correctly.

r? `@richkadel`

I might jump on zulip the comming days. Still need to figure out how to properly write tests for this, and deal with other doctest issues in the meantime.
2020-12-25 02:37:08 +00:00
Matthias Krüger
d12a358673 use matches!() macro in more places 2020-12-24 13:35:12 +01:00
Matthias Krüger
6e852cc4ce remove redundant clones (clippy::redundant_clone) 2020-12-24 12:59:22 +01:00
bors
2acf6ee6d2 Auto merge of #80295 - GuillaumeGomez:beautify-rework, r=petrochenkov
Rework beautify_doc_string so that it returns a Symbol instead of a String

This commit comes from https://github.com/rust-lang/rust/pull/80261, the goal here is to inspect the impact on performance of this change on its own.

The idea of rewriting `beautify_doc_string` is to not go through `String` if we don't need to update the doc comment to be able to keep the original `Symbol` and also to have better performance.

r? `@jyn514`
2020-12-24 11:30:24 +00:00
bors
c34c015fe2 Auto merge of #77692 - PankajChaudhary5:issue-76630, r=davidtwco
Added better error message for shared borrow treated as unique for purposes of lifetimes

Part of Issue #76630

r? `@jyn514`
2020-12-24 07:32:19 +00:00
bors
49b315123e Auto merge of #79589 - tgnottingham:shared_dep_graph, r=michaelwoerister
rustc_query_system: reduce dependency graph memory usage

This change implements, at a high level, two space optimizations to the dependency graph.

The first optimization is sharing graph data with the previous dependency graph. Whenever we intern a node, we know whether that node is new (not in the previous graph) or not, and if not, the color of the node in the previous graph.

Red and green nodes have their `DepNode` present in the previous graph, so for that piece of node data, we can just store the index of the node in the previous graph rather than duplicate the `DepNode`. Green nodes additionally have the the same result `Fingerprint`, so we can avoid duplicating that too. Finally, we distinguish between "light" and "dark" green nodes, where the latter are nodes that were marked green because all of their dependencies were marked green. These nodes can additionally share edges with the previous graph, because we know that their set of dependencies is the same (technically, light green and red nodes can have the same dependencies too, but we don't try to figure out whether or not that's the case).

Also, some effort is made to pack data tightly, and to avoid storing `DepNode`s as map keys more than once.

The second optimization is storing edges in a more compact representation, as in the `SerializedDepGraph`, that is, in a single vector, rather than one `EdgesVec` per node. An `EdgesVec` is a `SmallVec` with an inline buffer for 8 elements. Each `EdgesVec` is, at minimum, 40 bytes, and has a per-node overhead of up to 40 bytes. In the ideal case of exactly 8 edges, then 32 bytes are used for edges, and the overhead is 8 bytes. But most of the time, the overhead is higher.

In contrast, using a single vector to store all edges, and having each node specify its start and end elements as 4 byte indices into the vector has a constant overhead of 8 bytes--the best case scenario for the per-node `EdgesVec` approach.

The downside of this approach is that `EdgesVec`s built up during query execution have to be copied into the vector, whereas before, we could just take ownership over them. However, we mostly make up for this because the single vector representation enables a more efficient implementation of `DepGraph::serialize`.
2020-12-24 01:06:36 +00:00
pierwill
df94bfceb1
Fix typo 2020-12-23 13:08:15 -08:00
Yenlin Chen
ecba49c1bd Fixed formatting 2020-12-23 19:10:59 +00:00
Yenlin Chen
f459b0fea5 Addressed feedbacks
Also updated the mir-opt test output files.
2020-12-23 18:55:37 +00:00
Joshua Nelson
979d3ce6ea Add more comments to trait queries
This also adds back a comment that was mistakenly removed in
ac9dfc3e77.
2020-12-23 10:56:24 -05:00
Ikko Ashimine
87397080b6
Fix typo in simplify_try.rs
assigment -> assignment
2020-12-23 21:11:59 +09:00
PankajChaudhary5
c625d3183c Updated the match with the matches macro 2020-12-23 11:02:04 +05:30
Camelid
5b32ab671a Update and improve rustc_codegen_{llvm,ssa} docs
These docs were very out of date and misleading. They even said that
they codegen'd the *AST*!

For some reason, the `rustc_codegen_ssa::base` docs were exactly
identical to the `rustc_codegen_llvm::base` docs. They didn't really
make sense, because they had LLVM-specific information even though
`rustc_codegen_ssa` is supposed to be somewhat generic. So I removed
them as they were misleading.
2020-12-22 19:42:23 -08:00
Victor Ding
732afd41cf Exclude unnecessary info from CodegenResults
`foreign_module` and `wasm_import_module` are not needed for linking,
and hence can be removed from CodegenResults.
2020-12-23 12:51:10 +11:00
bors
89886e6936 Auto merge of #80314 - GuillaumeGomez:rollup-9rc48vx, r=GuillaumeGomez
Rollup of 17 pull requests

Successful merges:

 - #80136 (Add test for issue #74824)
 - #80203 (Edit rustc_middle::lint::LintSource docs)
 - #80204 (docs: Edit rustc_middle::ty::query::on_disk_cache)
 - #80219 (Fix labels for 'Library Tracking Issue' template)
 - #80222 (Fix rustc-std-workspace-core documentation)
 - #80223 (docs: Fix outdated crate reference)
 - #80225 (Add module-level docs to rustc_middle::ty)
 - #80241 (Fix typo)
 - #80248 (Remove `I-prioritize` from Zulip topic)
 - #80266 (Remove redundant test)
 - #80272 (rustc_span: Provide a reserved identifier check for a specific edition)
 - #80285 (Update books)
 - #80286 (docs: Edit rustc_middle::middle::privacy)
 - #80297 (Add some intra-doc links to compiler docs)
 - #80298 (Improve the code quality by using matches macro)
 - #80299 (Turn helper method into a closure)
 - #80302 (docs: Update rustc_middle::middle::region::ScopeTree)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2020-12-23 00:41:46 +00:00
Guillaume Gomez
67f8244975
Rollup merge of #80302 - pierwill:fix-80287, r=lcnr
docs: Update rustc_middle::middle::region::ScopeTree

Correct return type in docs for [`yield_in_source`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/middle/region/struct.ScopeTree.html#method.yield_in_scope) method.

Closes #80287.
2020-12-23 00:14:01 +01:00
Guillaume Gomez
f711f3ff5f
Rollup merge of #80299 - LingMan:helper, r=lcnr
Turn helper method into a closure

`replace_prefix` is currently implemented as a method but has no real relation
to the struct it is implemented on. Turn it into a closure and move it into the
only method from which it is called.

`@rustbot` modify labels +C-cleanup +T-compiler
r? `@lcnr`
2020-12-23 00:13:59 +01:00
Guillaume Gomez
5af144ece1
Rollup merge of #80298 - PankajChaudhary5:PankajChaudhary, r=GuillaumeGomez
Improve the code quality by using matches macro

Improved the code quality by using matches macro
r? `@GuillaumeGomez`
2020-12-23 00:13:56 +01:00
Guillaume Gomez
125156ca0f
Rollup merge of #80297 - jyn514:more-docs, r=bjorn3
Add some intra-doc links to compiler docs

r? `@pierwill`
2020-12-23 00:13:53 +01:00
Guillaume Gomez
174a9fad2f
Rollup merge of #80286 - pierwill:rustc-middle-privacy, r=petrochenkov
docs: Edit rustc_middle::middle::privacy

Add descriptions of `AccessLevel` and `AccessLevels`.

Add missing punctuation.
2020-12-23 00:13:52 +01:00
Guillaume Gomez
aa7cb4ff00
Rollup merge of #80272 - petrochenkov:kwed, r=oli-obk
rustc_span: Provide a reserved identifier check for a specific edition

while keeping edition evaluation lazy because it may be expensive.

Needed for https://github.com/rust-lang/rust/pull/80226.
2020-12-23 00:13:48 +01:00
Guillaume Gomez
558926142c
Rollup merge of #80241 - pierwill:patch-12, r=lcnr
Fix typo

Fix typo in rustc_middle::ty::inhabitedness::DefIdForest docs.
2020-12-23 00:13:43 +01:00
Guillaume Gomez
e116732b4b
Rollup merge of #80225 - pierwill:patch-11, r=lcnr
Add module-level docs to rustc_middle::ty

I thought it would be nice to point out `Ty` and `TyCtxt` on the module page, and link out to the [rustc-dev-guide chapter](https://rustc-dev-guide.rust-lang.org/ty.html).
2020-12-23 00:13:41 +01:00
Guillaume Gomez
f9f8446130
Rollup merge of #80223 - pierwill:patch-10, r=lcnr
docs: Fix outdated crate reference
2020-12-23 00:13:40 +01:00
Guillaume Gomez
8a35d3a08e
Rollup merge of #80204 - pierwill:pierwill-rustcmiddle-ondisk, r=varkor
docs: Edit rustc_middle::ty::query::on_disk_cache

Expand abbreviations for "incremental compliation".

Also added the word "to" to the description of CacheEncoder.
2020-12-23 00:13:34 +01:00
Guillaume Gomez
f84ec97485
Rollup merge of #80203 - pierwill:pierwill-rustcmiddle-lint, r=oli-obk
Edit rustc_middle::lint::LintSource docs

Edit punctuation in doc comment for [rustc_middle::lint::LintSource::CommandLine](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/lint/enum.LintSource.html#variant.CommandLine).
2020-12-23 00:13:33 +01:00
Tyson Nottingham
03eb75f759 rustc_query_system: avoid race condition when using edge_count 2020-12-22 14:12:57 -08:00
Tyson Nottingham
22ed75158b rustc_query_system: add more comments for dependency graph 2020-12-22 14:12:57 -08:00
Tyson Nottingham
d6b2aaed7d rustc_query_system: rename intern_node to intern_new_node 2020-12-22 14:12:57 -08:00
Tyson Nottingham
712fcae13a rustc_query_system: remove inline annotation from edge_count
This isn't called frequently enough to justify inlining.
2020-12-22 14:12:57 -08:00
Tyson Nottingham
4f76266295 rustc_query_system: minor cleanup
Remove effectively unused parameter and delete out of date comment.
2020-12-22 14:12:57 -08:00
Tyson Nottingham
dd1ab840d2 rustc_query_system: use more space-efficient edges representation
Use single vector of edges rather than per-node vector. There is a small
hit to instruction counts (< 0.5%), but the memory savings make up for it.
2020-12-22 14:12:57 -08:00
Tyson Nottingham
ea47269f5f rustc_query_system: share previous graph edges with current graph
Reduce memory consumption by sharing the previous dependency graph's
edges with the current graph when it is known to be valid to do so. It
is known to be valid whenever we mark a node green because all of its
dependencies were green. It is *not* known to be valid when we mark a
node green because we re-executed its query and its result was the same
as in the previous compilation session. In that case, the dependency set
might have changed (we don't try to determine whether or not it changed
and whether or not we can share).
2020-12-22 14:12:57 -08:00
Tyson Nottingham
f6d6b0c96d rustc_query_system: share previous graph data with current graph
Reduce memory consumption by taking advantage of red/green algorithm
properties to share the previous dependency graph's node data with the
current graph instead of storing node data redundantly. Red nodes can
share the `DepNode`, and green nodes can share the `DepNode` and
`Fingerprint`. Edges will be shared when possible in a later change.
2020-12-22 14:12:57 -08:00
bors
969b42d8c0 Auto merge of #80242 - Nadrieril:explain-and-factor-splitting, r=varkor
Clarify constructor splitting in exhaustiveness checking

I reworked the explanation of the algorithm completely to make it properly account for the various extensions we've added. This includes constructor splitting, which was previously not clearly included in the algorithm. This makes wildcards less magical; I added some detailed examples; and this distinguishes clearly between constructors that only make sense in patterns (like ranges) and those that make sense for values (like `Some`). This reformulation had been floating around in my mind for a while, and I'm quite happy with how it turned out. Let me know how you feel about it.
I also factored out all three cases of splitting (wildcards, ranges and slices) into dedicated structs to encapsulate the complicated bits.
I measured no perf impact but I don't trust my local measurements for refactors since https://github.com/rust-lang/rust/pull/79284.

r? `@varkor`
`@rustbot` modify labels: +A-exhaustiveness-checking
2020-12-22 21:51:04 +00:00
ThePuzzlemaker
4f6be466fd
Suggest fn ptr rather than fn item and suggest to use Fn trait bounds rather than the unique closure type in E0121
This is a squash of the titular commit along with these minor commits:
- Improve note
- Improve note pt2
2020-12-22 13:26:28 -06:00
bors
bb1fbbf844 Auto merge of #80177 - tgnottingham:foreign_defpathhash_registration, r=Aaron1011
rustc_query_system: explicitly register reused dep nodes

Register nodes that we've reused from the previous session explicitly
with `OnDiskCache`. Previously, we relied on this happening as a side
effect of accessing the nodes in the `PreviousDepGraph`. For the sake of
performance and avoiding unintended side effects, register explictily.
2020-12-22 19:02:28 +00:00
pierwill
f078f7cd64 docs: Update rustc_middle::middle::region::ScopeTree
This corrects the return type in docs for yield_in_source method.

Closes #80287.
2020-12-22 10:57:05 -08:00
PankajChaudhary5
57b5f8cbb9 Improve the code quality by using matches macro 2020-12-22 20:52:38 +05:30
Nadrieril
be23694622 Fix a comment 2020-12-22 15:20:24 +00:00
Nadrieril
85fdb34d3a Apply suggestions from code review
Co-authored-by: varkor <github@varkor.com>
2020-12-22 15:20:24 +00:00
Nadrieril
1c176d1150 Simplify field filtering 2020-12-22 15:20:23 +00:00
Nadrieril
53e03fb7c1 Make the special "missing patterns" constructor real 2020-12-22 15:20:23 +00:00
Nadrieril
2a541cea35 Completely rework the explanation of the algorithm 2020-12-22 15:20:23 +00:00
Nadrieril
43d445c8d1 Pass Matrix explicitly instead of via PatCtxt 2020-12-22 15:20:23 +00:00
Nadrieril
8b38b6859a Inline the constructor-specific split functions 2020-12-22 15:20:23 +00:00
Nadrieril
3141f2d78c Inline all_constructors 2020-12-22 15:20:23 +00:00
Nadrieril
bbb4ac0651 Rebrand MissingConstructors as SplitWildcard 2020-12-22 15:20:23 +00:00
Nadrieril
9d0c2ed913 Factor out SplitVarLenSlice used for slice splitting 2020-12-22 15:20:23 +00:00
Nadrieril
7948f91910 Run the annoying lint separately 2020-12-22 15:20:23 +00:00
Nadrieril
5a24b2c2c7 Factor out SplitIntRange used for integer range splitting 2020-12-22 15:20:23 +00:00
LingMan
ef75761fb1 Turn helper method into a closure
`replace_prefix` is currently implemented as a method but has no real relation
to the struct it is implemented on. Turn it into a closure and move it into the
only method from which it is called.
2020-12-22 16:18:34 +01:00
Guillaume Gomez
64afdedfb8 Rework beautify_doc_string so that it returns a Symbol instead of a String 2020-12-22 16:05:38 +01:00
Joshua Nelson
9cd992f394 Add some intra-doc links to compiler docs 2020-12-22 09:54:23 -05:00
Wesley Wiser
56154a1147 Add example to lint docs 2020-12-22 09:33:16 -05:00
Wesley Wiser
f1eb88b28a Revert "Promote missing_fragment_specifier to hard error"
This reverts commit 02eae432e7.
2020-12-22 09:33:16 -05:00