Commit Graph

106224 Commits

Author SHA1 Message Date
Matthew Jasper
30058df867 Update existing tests for or-patterns 2020-02-01 22:10:58 +00:00
Matthew Jasper
a20969c489 Implement general or-patterns in let statements 2020-02-01 22:10:43 +00:00
Matthew Jasper
5cc4352bc4 Implement general or-patterns in match expressions 2020-02-01 22:10:03 +00:00
Matthew Jasper
64eab7750b Don't create unnecessary block 2020-02-01 22:08:35 +00:00
Matthew Jasper
eecee76652 Generate prebinding blocks lazily 2020-02-01 22:08:35 +00:00
Matthew Jasper
425e494fce Remove or_patterns from INCOMPLETE_FEATURES 2020-02-01 22:07:11 +00:00
Yuki Okushi
9d8058fb42 Do not ICE in type-alias-impl-trait with save-analysis 2020-02-02 06:39:50 +09:00
Yuki Okushi
726568bd1b Do not suggest things named underscore 2020-02-02 04:55:37 +09:00
Rob Pilling
07ee472cd1 Avoid qualified path recovery when not followed by identifier 2020-02-01 19:38:52 +00:00
Rob Pilling
991d2ee282 Improve wording and docs for qualified path recovery 2020-02-01 19:38:52 +00:00
Rob Pilling
45fb7232ab Move colon-check to recover_colon_before_qpath_proj() 2020-02-01 19:29:08 +00:00
Wesley Wiser
f5f86be1d4 Add support for enabling the LLVM time-trace feature
I found this helpful while investigating an LLVM performance issue.
Passing `-Z llvm-time-trace` causes a `llvm_timings.json` file to be
created. This file can be inspected in either the Chrome Profiler tools
or with any other compatible tool like SpeedScope.

More information on the LLVM feature:

- https://aras-p.info/blog/2019/01/16/time-trace-timeline-flame-chart-profiler-for-Clang/

- https://reviews.llvm.org/rL357340
2020-02-01 14:19:17 -05:00
Rob Pilling
88d64a0931 Simplify span usage and avoid .eat() 2020-02-01 19:07:58 +00:00
Jonas Schievink
791123d2c4 Deduplicate generator interior types 2020-02-01 20:02:56 +01:00
bors
13db6501c7 Auto merge of #68133 - Centril:slimmer-syntax, r=petrochenkov
Slimmer syntax

High-level summary of changes:

- The `syntax::node_count` pass is moved into `rustc_ast_passes`. This works towards improving #65031 by making compiling `syntax` go faster.

- The `syntax::{GLOBALS, with_globals, ..}` business is consolidated into `syntax::attr` for cleaner code and future possible improvements.

- The pretty printer loses its dependency on `ParseSess`, opting to use `SourceMap` & friends directly instead.

- Some drive by cleanup of `syntax::attr::HasAttr` happens.

- Builtin attribute logic (`syntax::attr::builtin`) + `syntax::attr::allow_internal_unstable` is moved into a new `rustc_attr` crate. More logic from `syntax::attr` should be moved into that crate over time. This also means that `syntax` loses all mentions of `ParseSess`, which enables the next point.

- The pretty printer `syntax::print` is moved into a new crate `rustc_ast_pretty`.

- `rustc_session::node_id` is moved back as `syntax::node_id`. As a result, `syntax` gets to drop dependencies on `rustc_session` (and implicitly `rustc_target`), `rustc_error_codes`, and `rustc_errors`. Moreover `rustc_hir` gets to drop its dependency on `rustc_session` as well. At this point, these crates are mostly "pure data crates", which is approaching a desirable end state.

  - We should consider renaming `syntax` to `rustc_ast` now.
2020-02-01 18:29:09 +00:00
Mazdak Farrokhzad
1a3141c86e pretty: raise recursion_limit = 256 2020-02-01 18:59:49 +01:00
Mazdak Farrokhzad
aef2df1aaa fix fallout in tests 2020-02-01 18:59:49 +01:00
Mazdak Farrokhzad
a0838462cf pretty: injected_crate_name -> has_injected_crate 2020-02-01 18:59:49 +01:00
Mazdak Farrokhzad
eadff06823 syntax: reexport attr globals 2020-02-01 18:59:49 +01:00
Mazdak Farrokhzad
f882b07977 remove rustc_ast_pretty dep from rustc 2020-02-01 18:59:49 +01:00
Mazdak Farrokhzad
154040097d pacify the parallel compiler 2020-02-01 18:59:49 +01:00
Mazdak Farrokhzad
e233331a51 syntax::print -> new crate rustc_ast_pretty 2020-02-01 18:59:49 +01:00
Mazdak Farrokhzad
98fd6a5c88 1. move allow_internal_unstable to rustc_attr
2. as a result, drop rustc_errors dep from syntax
2020-02-01 18:58:08 +01:00
Mazdak Farrokhzad
097d5e1c5e 1. move node_id to syntax
2. invert rustc_session & syntax deps
3. drop rustc_session dep in rustc_hir
2020-02-01 18:58:08 +01:00
Mazdak Farrokhzad
93a8283614 Move builtin attribute logic to new rustc_attr crate.
For now, this is all the crate contains, but more
attribute logic & types will be moved there over time.
2020-02-01 18:54:56 +01:00
Mazdak Farrokhzad
9be73dc63a syntax: simplify HasAttrs code 2020-02-01 18:54:55 +01:00
Mazdak Farrokhzad
64d0143c2c pretty: remove ParseSess dependency 2020-02-01 18:54:55 +01:00
Mazdak Farrokhzad
e03d1064f0 syntax: move GLOBALS to attr module 2020-02-01 18:54:55 +01:00
Mazdak Farrokhzad
50f0e2e9e6 {syntax -> rustc_ast_passes}::node_count 2020-02-01 18:54:55 +01:00
Tim Diekmann
8bbaeb7ff9
Remove Alloc in favor of AllocRef
`AllocRef` was reexported as `Alloc` in order to not break toolstate in the week before the next stable release.
2020-02-01 18:40:12 +01:00
Yuki Okushi
6f5a61b5fb Use next_point to avoid ICE 2020-02-02 02:39:53 +09:00
Marincia Catalin
2ce14b8a19
Update option.rs
I updated the example of the `expect` examples so they won't contain depressing sentences any more !
2020-02-01 19:05:50 +02:00
bors
64184a3288 Auto merge of #68180 - ajpaverd:cfguard-rust, r=nagisa
Add support for Control Flow Guard on Windows.

LLVM now supports Windows Control Flow Guard (CFG): d157a9bc8b
This patch adds support for rustc to emit the required LLVM module flags to enable CFG metadata (cfguard=1) or metadata and checks (cfguard=2). The LLVM module flags are ignored on unsupported targets and operating systems.
2020-02-01 15:02:58 +00:00
Konrad Borowski
cad0cfd9fd Remove a comment about pretty printer in formatting tests
rustc is now using rustfmt, not the old formatter.
2020-02-01 13:29:00 +01:00
bors
6c0b779b7b Auto merge of #68698 - tmiasko:catch-panic, r=Amanieu
Remove incorrect debug assertions from catch_unwind

Previously the debug assertions in the implementation of catch_unwind
used to verify consistency of the panic count by checking that the count
is zero just before leaving the function. This incorrectly assumed that
no panic was in progress when entering `catch_unwind`.

Fixes #68696.
2020-02-01 11:41:05 +00:00
Shotaro Yamada
482c761704 Use BufWriter 2020-02-01 19:26:45 +09:00
bors
cdd41ea5fc Auto merge of #68633 - JohnTitor:avoid-ice-in-diagnostics, r=estebank
Avoid ICE in macro's diagnostics

Fixes #68629

r? @estebank
2020-01-31 21:51:28 +00:00
hman523
346920c3c8 Fixed issue 68593 2020-01-31 13:41:07 -06:00
bors
cd1ef390e7 Auto merge of #67073 - ssomers:btree_navigation, r=cuviper
Bundle and document 6 BTreeMap navigation algorithms

- Expose a function to step through trees, without necessarily extracting the KV pair, that helps future operations like drain/retain (as demonstrated in [this drain_filter implementation](https://github.com/ssomers/rust/compare/btree_navigation_v3...ssomers:btree_drain_filter?expand=1))
- ~~Also aligns the implementation of the 2 x 3 iterators already using such navigation:~~
  - ~~Delay the moment the K,V references are plucked from the tree, for the 4 iterators on immutable and owned maps, just for symmetry. The same had to be done to the two iterators for mutable maps in #58431.~~
  - ~~Always explicitly use ptr::read to derive two handles from one handle. While the existing implementations for immutable maps (i.e. Range::next_unchecked and Range::next_back_unchecked) rely on implicit copying. There's no change in unsafe tags because these two functions were already (erroneously? prophetically?) tagged unsafe. I don't know whether they should be tagged unsafe. I guess they should be for mutable and owned maps, because you can change the map through one handle and leave the other handle invalid.~~
  - Preserve the way two handles are (temporarily) derived from one handle: implementations for immutable maps (i.e. Range::next_unchecked and Range::next_back_unchecked) rely on copying (implicitly before, explicitly now) and the others do `ptr::read`.
  - ~~I think the functions that support iterators on immutable trees (i.e. `Range::next_unchecked` and `Range::next_back_unchecked`) are erroneously tagged unsafe since you can already create multiple instances of such ranges, thus obtain multiple handles into the same tree. I did not change that but removed unsafe from the functions underneath.~~

Tested with miri in liballoc/tests/btree, except those that should_panic.

cargo benchcmp the best of 3 samples of all btree benchmarks before and after this PR:
```
name                                           old1.txt ns/iter  new2.txt ns/iter  diff ns/iter  diff %  speedup
btree::map::find_rand_100                      17                17                           0   0.00%   x 1.00
btree::map::find_rand_10_000                   57                55                          -2  -3.51%   x 1.04
btree::map::find_seq_100                       17                17                           0   0.00%   x 1.00
btree::map::find_seq_10_000                    42                39                          -3  -7.14%   x 1.08
btree::map::first_and_last_0                   14                14                           0   0.00%   x 1.00
btree::map::first_and_last_100                 36                37                           1   2.78%   x 0.97
btree::map::first_and_last_10k                 52                52                           0   0.00%   x 1.00
btree::map::insert_rand_100                    34                34                           0   0.00%   x 1.00
btree::map::insert_rand_10_000                 34                34                           0   0.00%   x 1.00
btree::map::insert_seq_100                     46                46                           0   0.00%   x 1.00
btree::map::insert_seq_10_000                  90                89                          -1  -1.11%   x 1.01
btree::map::iter_1000                          2,811             2,771                      -40  -1.42%   x 1.01
btree::map::iter_100000                        360,635           355,995                 -4,640  -1.29%   x 1.01
btree::map::iter_20                            39                42                           3   7.69%   x 0.93
btree::map::iter_mut_1000                      2,662             2,864                      202   7.59%   x 0.93
btree::map::iter_mut_100000                    336,825           346,550                  9,725   2.89%   x 0.97
btree::map::iter_mut_20                        40                43                           3   7.50%   x 0.93
btree::set::build_and_clear                    4,184             3,994                     -190  -4.54%   x 1.05
btree::set::build_and_drop                     4,151             3,976                     -175  -4.22%   x 1.04
btree::set::build_and_into_iter                4,196             4,155                      -41  -0.98%   x 1.01
btree::set::build_and_pop_all                  5,176             5,241                       65   1.26%   x 0.99
btree::set::build_and_remove_all               6,868             6,903                       35   0.51%   x 0.99
btree::set::difference_random_100_vs_100       721               691                        -30  -4.16%   x 1.04
btree::set::difference_random_100_vs_10k       2,420             2,411                       -9  -0.37%   x 1.00
btree::set::difference_random_10k_vs_100       54,726            52,215                  -2,511  -4.59%   x 1.05
btree::set::difference_random_10k_vs_10k       164,384           170,256                  5,872   3.57%   x 0.97
btree::set::difference_staggered_100_vs_100    739               709                        -30  -4.06%   x 1.04
btree::set::difference_staggered_100_vs_10k    2,320             2,265                      -55  -2.37%   x 1.02
btree::set::difference_staggered_10k_vs_10k    68,020            70,246                   2,226   3.27%   x 0.97
btree::set::intersection_100_neg_vs_100_pos    23                24                           1   4.35%   x 0.96
btree::set::intersection_100_neg_vs_10k_pos    28                29                           1   3.57%   x 0.97
btree::set::intersection_100_pos_vs_100_neg    24                24                           0   0.00%   x 1.00
btree::set::intersection_100_pos_vs_10k_neg    28                28                           0   0.00%   x 1.00
btree::set::intersection_10k_neg_vs_100_pos    27                27                           0   0.00%   x 1.00
btree::set::intersection_10k_neg_vs_10k_pos    30                29                          -1  -3.33%   x 1.03
btree::set::intersection_10k_pos_vs_100_neg    27                28                           1   3.70%   x 0.96
btree::set::intersection_10k_pos_vs_10k_neg    29                29                           0   0.00%   x 1.00
btree::set::intersection_random_100_vs_100     592               572                        -20  -3.38%   x 1.03
btree::set::intersection_random_100_vs_10k     2,271             2,269                       -2  -0.09%   x 1.00
btree::set::intersection_random_10k_vs_100     2,301             2,333                       32   1.39%   x 0.99
btree::set::intersection_random_10k_vs_10k     147,879           150,148                  2,269   1.53%   x 0.98
btree::set::intersection_staggered_100_vs_100  622               632                         10   1.61%   x 0.98
btree::set::intersection_staggered_100_vs_10k  2,101             2,032                      -69  -3.28%   x 1.03
btree::set::intersection_staggered_10k_vs_10k  60,341            61,834                   1,493   2.47%   x 0.98
btree::set::is_subset_100_vs_100               417               426                          9   2.16%   x 0.98
btree::set::is_subset_100_vs_10k               1,281             1,324                       43   3.36%   x 0.97
btree::set::is_subset_10k_vs_100               2                 2                            0   0.00%   x 1.00
btree::set::is_subset_10k_vs_10k               41,054            41,612                     558   1.36%   x 0.99
```

r? cuviper
2020-01-31 18:35:16 +00:00
Mark Rousskov
31dcdc9e13 Drop cfg(bootstrap) code 2020-01-31 12:31:09 -05:00
Mark Rousskov
ff95473b5e Bump rustfmt and stage0 2020-01-31 12:31:09 -05:00
Mark Rousskov
b613b0cb36 Correctly reinstall rustfmt on channel change 2020-01-31 12:25:14 -05:00
Stein Somers
3cf724d0c1 Bundle and document 6 BTreeMap navigation algorithms 2020-01-31 17:37:17 +01:00
Jonas Schievink
08e85aa586 Ignore build dir formatting 2020-01-31 17:09:34 +01:00
bors
5371ddf8c6 Auto merge of #68080 - varkor:declared-here, r=petrochenkov
Address inconsistency in using "is" with "declared here"

"is" was generally used for NLL diagnostics, but not other diagnostics. Using "is" makes the diagnostics sound more natural and readable, so it seems sensible to commit to them throughout.

r? @Centril
2020-01-31 15:13:51 +00:00
Mark Rousskov
39e502744c Install robots.txt into rust-docs tarballs 2020-01-31 08:56:01 -05:00
bors
ecde10fc28 Auto merge of #68663 - alexcrichton:update-jobserver, r=Dylan-DPC
Update jobserver crate to 0.1.21

Brings in a fix for alexcrichton/jobserver-rs#23 which could cause Cargo
to unnecessarily hang in some situations.
2020-01-31 11:48:54 +00:00
bors
b1cb3c0909 Auto merge of #67340 - nnethercote:shrink-Nonterminal, r=petrochenkov
Shrink `Nonterminal`

These commits shrink `Nonterminal` from 240 bytes to 40 bytes. When building `serde_derive` they reduce the number of `memcpy` calls from 9.6M to 7.4M, and it's a tiny win on a few other benchmarks.

r? @petrochenkov
2020-01-31 06:33:36 +00:00
bors
266ecd6625 Auto merge of #68685 - Dylan-DPC:rollup-rkbo05z, r=Dylan-DPC
Rollup of 6 pull requests

Successful merges:

 - #68588 (check_unsafety: more code reuse)
 - #68638 (Add missing links for cmp traits)
 - #68660 (Fix typo.)
 - #68669 (suggest adding space in accidental doc comments)
 - #68670 (clarify "incorrect issue" error)
 - #68680 (Add `#![doc(html_playground_url = ...)]` to alloc crate)

Failed merges:

r? @ghost
2020-01-31 03:10:07 +00:00
Jacob Rothstein
2a79ed0b49
[docs] remind bug reporters to update nightly 2020-01-30 17:25:58 -08:00