]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agoRollup merge of #68733 - cata0309:patch-1, r=Dylan-DPC
Mazdak Farrokhzad [Sun, 2 Feb 2020 13:15:48 +0000 (14:15 +0100)]
Rollup merge of #68733 - cata0309:patch-1, r=Dylan-DPC

Update option.rs

I updated the example of the `expect` examples so they won't contain depressing sentences any more !

4 years agoAuto merge of #68737 - Centril:fix-68710, r=petrochenkov
bors [Sun, 2 Feb 2020 09:19:40 +0000 (09:19 +0000)]
Auto merge of #68737 - Centril:fix-68710, r=petrochenkov

pretty: print attrs in struct expr

Fixes https://github.com/rust-lang/rust/issues/68710 by printing the attributes on struct expression fields.

r? @petrochenkov
cc @dtolnay

4 years agopretty: print attrs in struct expr
Mazdak Farrokhzad [Sat, 1 Feb 2020 17:45:03 +0000 (18:45 +0100)]
pretty: print attrs in struct expr

4 years agoAuto merge of #68754 - JohnTitor:clippy-up, r=JohnTitor
bors [Sun, 2 Feb 2020 06:09:00 +0000 (06:09 +0000)]
Auto merge of #68754 - JohnTitor:clippy-up, r=JohnTitor

Update Clippy

Fixes #68745

r? @ghost

4 years agoAuto merge of #68672 - jonas-schievink:dedup-witness, r=Zoxc
bors [Sun, 2 Feb 2020 03:02:41 +0000 (03:02 +0000)]
Auto merge of #68672 - jonas-schievink:dedup-witness, r=Zoxc

Deduplicate types in the generator witness

For the `await-call-tree` benchmark this often reduces the types inside the witness from 12 to 2.

4 years agoUpdate Clippy
Yuki Okushi [Sat, 1 Feb 2020 23:38:28 +0000 (08:38 +0900)]
Update Clippy

4 years agoAuto merge of #68752 - JohnTitor:rollup-zz3u4xl, r=JohnTitor
bors [Sat, 1 Feb 2020 23:31:51 +0000 (23:31 +0000)]
Auto merge of #68752 - JohnTitor:rollup-zz3u4xl, r=JohnTitor

Rollup of 7 pull requests

Successful merges:

 - #68460 (Use BufWriter for emitting MIR)
 - #68681 (Suggest path separator for single-colon typos)
 - #68688 ([docs] remind bug reporters to update nightly)
 - #68704 (Ignore `build` dir formatting)
 - #68727 (Remove a comment about pretty printer in formatting tests)
 - #68736 (Remove `Alloc` in favor of `AllocRef`)
 - #68740 (Do not suggest things named underscore)

Failed merges:

r? @ghost

4 years agoRollup merge of #68740 - JohnTitor:do-not-sugg-underscore, r=Centril
Yuki Okushi [Sat, 1 Feb 2020 23:30:21 +0000 (08:30 +0900)]
Rollup merge of #68740 - JohnTitor:do-not-sugg-underscore, r=Centril

Do not suggest things named underscore

Fixes #68719

r? @estebank

4 years agoRollup merge of #68736 - TimDiekmann:remove-alloc, r=Amanieu
Yuki Okushi [Sat, 1 Feb 2020 23:30:19 +0000 (08:30 +0900)]
Rollup merge of #68736 - TimDiekmann:remove-alloc, r=Amanieu

Remove `Alloc` in favor of `AllocRef`

`AllocRef` was reexported as `Alloc` in #68529  in order to not break toolstate in the week before the next stable release.

r? @Amanieu

4 years agoRollup merge of #68727 - xfix:remove-comment-about-pretty-printer-in-format-tests...
Yuki Okushi [Sat, 1 Feb 2020 23:30:18 +0000 (08:30 +0900)]
Rollup merge of #68727 - xfix:remove-comment-about-pretty-printer-in-format-tests, r=jonas-schievink

Remove a comment about pretty printer in formatting tests

rustc is now using rustfmt, not the old formatter.

4 years agoRollup merge of #68704 - jonas-schievink:ignore-build-fmt, r=Mark-Simulacrum
Yuki Okushi [Sat, 1 Feb 2020 23:30:16 +0000 (08:30 +0900)]
Rollup merge of #68704 - jonas-schievink:ignore-build-fmt, r=Mark-Simulacrum

Ignore `build` dir formatting

I've noticed that rustfmt tries to parse and check the formatting of code in `build` if `.git` is missing (which includes test artifacts and generated code). This should fix that.

4 years agoRollup merge of #68688 - jbr:remind-bug-reporters-to-update-if-on-nightly, r=centril
Yuki Okushi [Sat, 1 Feb 2020 23:30:15 +0000 (08:30 +0900)]
Rollup merge of #68688 - jbr:remind-bug-reporters-to-update-if-on-nightly, r=centril

[docs] remind bug reporters to update nightly

Hi and thanks for rust! Today I reported a bug in nightly that was already fixed, so I thought other potential bug reporters might appreciate a reminder to update before reporting.  I wasn't sure if this would apply for other channels as well.

4 years agoRollup merge of #68681 - bobrippling:fix-matched-angle-brackets, r=Centril
Yuki Okushi [Sat, 1 Feb 2020 23:30:11 +0000 (08:30 +0900)]
Rollup merge of #68681 - bobrippling:fix-matched-angle-brackets, r=Centril

Suggest path separator for single-colon typos

This commit adds guidance for when a user means to type a path, but ends
up typing a single colon, such as `<<Impl as T>:Ty>`.

This change seemed pertinent as the current error message is
particularly misleading, emitting `error: unmatched angle bracket`,
despite the angle bracket being matched later on, leaving the user to
track down the typo'd colon.

4 years agoRollup merge of #68460 - sinkuu:emit_mir_buffered, r=Mark-Simulacrum
Yuki Okushi [Sat, 1 Feb 2020 23:30:09 +0000 (08:30 +0900)]
Rollup merge of #68460 - sinkuu:emit_mir_buffered, r=Mark-Simulacrum

Use BufWriter for emitting MIR

I noticed that `--emit=mir` takes long time on a large crate. https://github.com/rust-lang/rust/pull/64344 seem to have fixed `-Zdump-mir`, but not `--emit=mir`.

4 years agoDo not suggest things named underscore
Yuki Okushi [Sat, 1 Feb 2020 19:40:55 +0000 (04:40 +0900)]
Do not suggest things named underscore

4 years agoAvoid qualified path recovery when not followed by identifier
Rob Pilling [Sat, 1 Feb 2020 19:24:51 +0000 (19:24 +0000)]
Avoid qualified path recovery when not followed by identifier

4 years agoImprove wording and docs for qualified path recovery
Rob Pilling [Sat, 1 Feb 2020 19:21:54 +0000 (19:21 +0000)]
Improve wording and docs for qualified path recovery

4 years agoMove colon-check to recover_colon_before_qpath_proj()
Rob Pilling [Sat, 1 Feb 2020 19:10:42 +0000 (19:10 +0000)]
Move colon-check to recover_colon_before_qpath_proj()

4 years agoSimplify span usage and avoid .eat()
Rob Pilling [Sat, 1 Feb 2020 19:06:15 +0000 (19:06 +0000)]
Simplify span usage and avoid .eat()

4 years agoDeduplicate generator interior types
Jonas Schievink [Fri, 31 Jan 2020 14:59:14 +0000 (15:59 +0100)]
Deduplicate generator interior types

4 years agoAuto merge of #68133 - Centril:slimmer-syntax, r=petrochenkov
bors [Sat, 1 Feb 2020 18:29:09 +0000 (18:29 +0000)]
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.

4 years agopretty: raise recursion_limit = 256
Mazdak Farrokhzad [Tue, 21 Jan 2020 23:42:29 +0000 (00:42 +0100)]
pretty: raise recursion_limit = 256

4 years agofix fallout in tests
Mazdak Farrokhzad [Sat, 18 Jan 2020 18:21:05 +0000 (19:21 +0100)]
fix fallout in tests

4 years agopretty: injected_crate_name -> has_injected_crate
Mazdak Farrokhzad [Sat, 18 Jan 2020 18:01:50 +0000 (19:01 +0100)]
pretty: injected_crate_name -> has_injected_crate

4 years agosyntax: reexport attr globals
Mazdak Farrokhzad [Sat, 18 Jan 2020 17:57:06 +0000 (18:57 +0100)]
syntax: reexport attr globals

4 years agoremove rustc_ast_pretty dep from rustc
Mazdak Farrokhzad [Fri, 17 Jan 2020 13:48:38 +0000 (14:48 +0100)]
remove rustc_ast_pretty dep from rustc

4 years agopacify the parallel compiler
Mazdak Farrokhzad [Fri, 17 Jan 2020 13:42:27 +0000 (14:42 +0100)]
pacify the parallel compiler

4 years agosyntax::print -> new crate rustc_ast_pretty
Mazdak Farrokhzad [Sat, 11 Jan 2020 16:02:46 +0000 (17:02 +0100)]
syntax::print -> new crate rustc_ast_pretty

4 years ago1. move allow_internal_unstable to rustc_attr
Mazdak Farrokhzad [Sat, 11 Jan 2020 15:21:30 +0000 (16:21 +0100)]
1. move allow_internal_unstable to rustc_attr
2. as a result, drop rustc_errors dep from syntax

4 years ago1. move node_id to syntax
Mazdak Farrokhzad [Sat, 11 Jan 2020 14:03:15 +0000 (15:03 +0100)]
1. move node_id to syntax
2. invert rustc_session & syntax deps
3. drop rustc_session dep in rustc_hir

4 years agoMove builtin attribute logic to new rustc_attr crate.
Mazdak Farrokhzad [Sat, 11 Jan 2020 12:15:20 +0000 (13:15 +0100)]
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.

4 years agosyntax: simplify HasAttrs code
Mazdak Farrokhzad [Sat, 11 Jan 2020 11:33:11 +0000 (12:33 +0100)]
syntax: simplify HasAttrs code

4 years agopretty: remove ParseSess dependency
Mazdak Farrokhzad [Sat, 11 Jan 2020 09:33:18 +0000 (10:33 +0100)]
pretty: remove ParseSess dependency

4 years agosyntax: move GLOBALS to attr module
Mazdak Farrokhzad [Sat, 11 Jan 2020 08:59:14 +0000 (09:59 +0100)]
syntax: move GLOBALS to attr module

4 years ago{syntax -> rustc_ast_passes}::node_count
Mazdak Farrokhzad [Sat, 11 Jan 2020 08:48:57 +0000 (09:48 +0100)]
{syntax -> rustc_ast_passes}::node_count

4 years agoRemove `Alloc` in favor of `AllocRef`
Tim Diekmann [Sat, 1 Feb 2020 17:40:12 +0000 (18:40 +0100)]
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.

4 years agoUpdate option.rs
Marincia Catalin [Sat, 1 Feb 2020 17:05:50 +0000 (19:05 +0200)]
Update option.rs

I updated the example of the `expect` examples so they won't contain depressing sentences any more !

4 years agoAuto merge of #68180 - ajpaverd:cfguard-rust, r=nagisa
bors [Sat, 1 Feb 2020 15:02:58 +0000 (15:02 +0000)]
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): https://github.com/llvm/llvm-project/commit/d157a9bc8ba1085cc4808c6941412322a7fd884e
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.

4 years agoRemove a comment about pretty printer in formatting tests
Konrad Borowski [Sat, 1 Feb 2020 12:29:00 +0000 (13:29 +0100)]
Remove a comment about pretty printer in formatting tests

rustc is now using rustfmt, not the old formatter.

4 years agoAuto merge of #68698 - tmiasko:catch-panic, r=Amanieu
bors [Sat, 1 Feb 2020 11:41:05 +0000 (11:41 +0000)]
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.

4 years agoUse BufWriter
Shotaro Yamada [Wed, 22 Jan 2020 15:22:46 +0000 (00:22 +0900)]
Use BufWriter

4 years agoAuto merge of #68633 - JohnTitor:avoid-ice-in-diagnostics, r=estebank
bors [Fri, 31 Jan 2020 21:51:28 +0000 (21:51 +0000)]
Auto merge of #68633 - JohnTitor:avoid-ice-in-diagnostics, r=estebank

Avoid ICE in macro's diagnostics

Fixes #68629

r? @estebank

4 years agoAuto merge of #67073 - ssomers:btree_navigation, r=cuviper
bors [Fri, 31 Jan 2020 18:35:16 +0000 (18:35 +0000)]
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

4 years agoBundle and document 6 BTreeMap navigation algorithms
Stein Somers [Tue, 19 Nov 2019 12:55:55 +0000 (13:55 +0100)]
Bundle and document 6 BTreeMap navigation algorithms

4 years agoIgnore `build` dir formatting
Jonas Schievink [Fri, 31 Jan 2020 16:09:34 +0000 (17:09 +0100)]
Ignore `build` dir formatting

4 years agoAuto merge of #68080 - varkor:declared-here, r=petrochenkov
bors [Fri, 31 Jan 2020 15:13:51 +0000 (15:13 +0000)]
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

4 years agoAuto merge of #68663 - alexcrichton:update-jobserver, r=Dylan-DPC
bors [Fri, 31 Jan 2020 11:48:54 +0000 (11:48 +0000)]
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.

4 years agoAuto merge of #67340 - nnethercote:shrink-Nonterminal, r=petrochenkov
bors [Fri, 31 Jan 2020 06:33:36 +0000 (06:33 +0000)]
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

4 years agoAuto merge of #68685 - Dylan-DPC:rollup-rkbo05z, r=Dylan-DPC
bors [Fri, 31 Jan 2020 03:10:07 +0000 (03:10 +0000)]
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

4 years ago[docs] remind bug reporters to update nightly
Jacob Rothstein [Fri, 31 Jan 2020 01:25:58 +0000 (17:25 -0800)]
[docs] remind bug reporters to update nightly

4 years agoRollup merge of #68680 - ollie27:doc_alloc_playground, r=Centril
Dylan DPC [Fri, 31 Jan 2020 00:21:31 +0000 (01:21 +0100)]
Rollup merge of #68680 - ollie27:doc_alloc_playground, r=Centril

Add `#![doc(html_playground_url = ...)]` to alloc crate

This adds the Run button to code examples just like the core and std docs have.

4 years agoRollup merge of #68670 - euclio:invalid-issue, r=estebank
Dylan DPC [Fri, 31 Jan 2020 00:21:30 +0000 (01:21 +0100)]
Rollup merge of #68670 - euclio:invalid-issue, r=estebank

clarify "incorrect issue" error

Changes the message to be more precise, shrinks the span and adds a label specifying why the `issue` field is incorrect.

4 years agoRollup merge of #68669 - euclio:doc-comment-stmt, r=estebank
Dylan DPC [Fri, 31 Jan 2020 00:21:28 +0000 (01:21 +0100)]
Rollup merge of #68669 - euclio:doc-comment-stmt, r=estebank

suggest adding space in accidental doc comments

Fixes #67553.

r? @estebank

4 years agoRollup merge of #68660 - kubo39:patch-1, r=Dylan-DPC
Dylan DPC [Fri, 31 Jan 2020 00:21:27 +0000 (01:21 +0100)]
Rollup merge of #68660 - kubo39:patch-1, r=Dylan-DPC

Fix typo.

4 years agoRollup merge of #68638 - GuillaumeGomez:links-cmp-traits, r=Dylan-DPC
Dylan DPC [Fri, 31 Jan 2020 00:21:25 +0000 (01:21 +0100)]
Rollup merge of #68638 - GuillaumeGomez:links-cmp-traits, r=Dylan-DPC

Add missing links for cmp traits

r? @Dylan-DPC

4 years agoRollup merge of #68588 - Centril:check-unsafety-clean, r=Mark-Simulacrum
Dylan DPC [Fri, 31 Jan 2020 00:21:24 +0000 (01:21 +0100)]
Rollup merge of #68588 - Centril:check-unsafety-clean, r=Mark-Simulacrum

check_unsafety: more code reuse

r? oli-obk

4 years agoAuto merge of #67878 - Others:opt-3, r=Mark-Simulacrum
bors [Fri, 31 Jan 2020 00:03:55 +0000 (00:03 +0000)]
Auto merge of #67878 - Others:opt-3, r=Mark-Simulacrum

Change opt-level from 2 back to 3

In Cargo.toml, the opt-level for `release` and `bench` was overridden to be 2. This was to work around a problem with LLVM 7. However, rust no longer uses LLVM 7, so this is hopefully no longer needed?

I tried a little bit to replicate the original problem, and could not. I think running this through CI is the best way to smoke test this :) Even if things break dramatically, the comment should be updated to reflect that things are still broken with LLVM 9.

I'm just getting started playing with the compiler, so apologies if I've missed an obvious problem here.

fixes #52378

(possibly relevant is the [current update to LLVM 10](https://github.com/rust-lang/rust/pull/67759))

4 years agoRemove incorrect debug assertions from catch_unwind
Tomasz Miąsko [Fri, 31 Jan 2020 00:00:00 +0000 (00:00 +0000)]
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`.

4 years agoSuggest path separator for single-colon typos
Rob Pilling [Wed, 29 Jan 2020 20:34:28 +0000 (20:34 +0000)]
Suggest path separator for single-colon typos

This commit adds guidance for when a user means to type a path, but ends
up typing a single colon, such as `<<Impl as T>:Ty>`.

This change seemed pertinent as the current error message is
particularly misleading, emitting `error: unmatched angle bracket`,
despite the angle bracket being matched later on, leaving the user to
track down the typo'd colon.

4 years agoAdd `#![doc(html_playground_url = ...)]` to alloc crate
Oliver Middleton [Thu, 30 Jan 2020 21:14:39 +0000 (21:14 +0000)]
Add `#![doc(html_playground_url = ...)]` to alloc crate

This adds the Run button to code examples just like the core and std docs have.

4 years agoAuto merge of #66577 - WaffleLapkin:iter_take_while_map, r=mark-simulcrum
bors [Thu, 30 Jan 2020 20:58:57 +0000 (20:58 +0000)]
Auto merge of #66577 - WaffleLapkin:iter_take_while_map, r=mark-simulcrum

Add `Iterator::map_while`

In `Iterator` trait there is `*_map` version of [`filter`] — [`filter_map`], however, there is no `*_map` version of [`take_while`], that can also be useful.

### Use cases
In my code, I've found that I need to iterate through iterator of `Option`s, stopping on the first `None`. So I've written code like this:
```rust
let arr = [Some(4), Some(10), None, Some(3)];
let mut iter = arr.iter()
    .take_while(|x| x.is_some())
    .map(|x| x.unwrap());

assert_eq!(iter.next(), Some(4));
assert_eq!(iter.next(), Some(10));
assert_eq!(iter.next(), None);
assert_eq!(iter.next(), None);
```
Thit code
1) isn't clean
2) In theory, can generate bad bytecode (I'm actually **not** sure, but I think that `unwrap` would generate additional branches with `panic!`)

The same code, but with `map_while` (in the original PR message it was named "take_while_map"):
```rust
let arr = [Some(4), Some(10), None, Some(3)];
let mut iter = arr.iter().map_while(std::convert::identity);
```

Also, `map_while` can be useful when converting something (as in [examples]).

[`filter`]: https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.filter
[`filter_map`]: https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.filter_map
[`take_while`]: https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.take_while
[examples]: https://github.com/rust-lang/rust/compare/master...WaffleLapkin:iter_take_while_map?expand=1#diff-7e57917f962fe6ffdfba51e4955ad6acR1042

4 years agoChange opt-level from 2 back to 3
Gregor Peach [Sat, 4 Jan 2020 23:40:36 +0000 (15:40 -0800)]
Change opt-level from 2 back to 3

In Cargo.toml, the opt-level for `release` and `bench` was
overridden to be 2. This was to work around a problem with LLVM
7. However, rust no longer uses LLVM 7, so this is no longer
needed.

This creates a small compile time regression in MIR constant eval,
so I've added a #[inline(always)] on the `step` function used in
const eval

Also creates a binary size increase in wasm-stringify-ints-small,
so I've bumped the limit there.

4 years agoclarify "incorrect issue" error
Andy Russell [Wed, 22 Jan 2020 15:33:46 +0000 (10:33 -0500)]
clarify "incorrect issue" error

4 years agosuggest adding space in accidental doc comments
Andy Russell [Wed, 22 Jan 2020 16:24:32 +0000 (11:24 -0500)]
suggest adding space in accidental doc comments

4 years agoAdd missing links for cmp traits
Guillaume Gomez [Wed, 29 Jan 2020 12:32:37 +0000 (13:32 +0100)]
Add missing links for cmp traits

4 years agoAuto merge of #68661 - nnethercote:rm-unused-read_uleb128-param, r=Mark-Simulacrum
bors [Thu, 30 Jan 2020 12:24:30 +0000 (12:24 +0000)]
Auto merge of #68661 - nnethercote:rm-unused-read_uleb128-param, r=Mark-Simulacrum

Remove unused `read_uleb128` parameter.

4 years agoAuto merge of #68325 - faern:move-numeric-consts-to-associated-consts-step1, r=LukasK...
bors [Thu, 30 Jan 2020 08:55:07 +0000 (08:55 +0000)]
Auto merge of #68325 - faern:move-numeric-consts-to-associated-consts-step1, r=LukasKalbertodt

Move numeric consts to associated consts step1

A subset of #67913. Implements the first step of RFC https://github.com/rust-lang/rfcs/pull/2700

This PR adds the new constants as unstable constants and defines the old ones in terms of the new ones. Then fix a tiny bit of code that started having naming collisions because of the new assoc consts.

Removed a test that did not seem relevant any longer. Since doing just `u8::MIN` should now indeed be valid.

4 years agoChange Applicability to `HasPlaceholders`
Yuki Okushi [Thu, 30 Jan 2020 08:33:19 +0000 (17:33 +0900)]
Change Applicability to `HasPlaceholders`

4 years agoUpdate jobserver crate to 0.1.21
Alex Crichton [Thu, 30 Jan 2020 07:47:01 +0000 (23:47 -0800)]
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.

4 years agoRemove unused `read_uleb128` parameter.
Nicholas Nethercote [Thu, 30 Jan 2020 04:22:53 +0000 (15:22 +1100)]
Remove unused `read_uleb128` parameter.

4 years agoAuto merge of #68659 - Dylan-DPC:rollup-zo7zi9f, r=Dylan-DPC
bors [Thu, 30 Jan 2020 02:25:56 +0000 (02:25 +0000)]
Auto merge of #68659 - Dylan-DPC:rollup-zo7zi9f, r=Dylan-DPC

Rollup of 6 pull requests

Successful merges:

 - #66648 (Implement clone_from for BTreeMap and BTreeSet)
 - #68468 (BTreeMap: tag and explain unsafe internal functions or assert preconditions)
 - #68626 (Use termize instead of term_size)
 - #68640 (Document remaining undocumented `From` implementations for IPs)
 - #68651 (Document `From` implementation for NonZero nums)
 - #68655 (Fix revision annotations in borrowck-feature-nll-overrides-migrate)

Failed merges:

r? @ghost

4 years agoUpdate
Hiroki Noda [Thu, 30 Jan 2020 01:31:12 +0000 (10:31 +0900)]
Update

4 years agoFix typo.
Hiroki Noda [Thu, 30 Jan 2020 01:07:36 +0000 (10:07 +0900)]
Fix typo.

4 years agoRollup merge of #68655 - tmiasko:rev, r=Dylan-DPC
Dylan DPC [Thu, 30 Jan 2020 00:46:48 +0000 (01:46 +0100)]
Rollup merge of #68655 - tmiasko:rev, r=Dylan-DPC

Fix revision annotations in borrowck-feature-nll-overrides-migrate

4 years agoRollup merge of #68651 - LeSeulArtichaut:doc-from-nonzero, r=steveklabnik
Dylan DPC [Thu, 30 Jan 2020 00:46:46 +0000 (01:46 +0100)]
Rollup merge of #68651 - LeSeulArtichaut:doc-from-nonzero, r=steveklabnik

Document `From` implementation for NonZero nums

This is more of a nitpick than a real change in documentation. I did this for consistency with other documentation (namely Atomic integers).

Related to #51430

r? @steveklabnik

PS: I actually tested the code this time. My CPU died in the process, but I get to open a (hopefully 🤞) working PR

4 years agoRollup merge of #68640 - LeSeulArtichaut:doc-from-ip, r=steveklabnik
Dylan DPC [Thu, 30 Jan 2020 00:46:45 +0000 (01:46 +0100)]
Rollup merge of #68640 - LeSeulArtichaut:doc-from-ip, r=steveklabnik

Document remaining undocumented `From` implementations for IPs

Some `From` implementations were missing documentation. I added examples, I tried to be as close to existing examples as possible.

Related to #51430 (cc @skade)

r? @steveklabnik

4 years agoRollup merge of #68626 - Zoxc:termize, r=estebank
Dylan DPC [Thu, 30 Jan 2020 00:46:43 +0000 (01:46 +0100)]
Rollup merge of #68626 - Zoxc:termize, r=estebank

Use termize instead of term_size

`termize` is a fork of `term_size` which uses `winapi` 0.3 instead of 0.2. This is a step towards removing the `winapi` 0.2 dependency.

r? @Mark-Simulacrum

4 years agoRollup merge of #68468 - ssomers:btreemap_prefer_middle, r=Mark-Simulacrum
Dylan DPC [Thu, 30 Jan 2020 00:46:42 +0000 (01:46 +0100)]
Rollup merge of #68468 - ssomers:btreemap_prefer_middle, r=Mark-Simulacrum

BTreeMap: tag and explain unsafe internal functions or assert preconditions

#68418 concluded that it's not desirable to tag all internal functions with preconditions as being unsafe. This PR does it to some functions, documents why, and elsewhere enforces the preconditions with asserts.

4 years agoRollup merge of #66648 - crgl:btree-clone-from, r=Amanieu
Dylan DPC [Thu, 30 Jan 2020 00:46:38 +0000 (01:46 +0100)]
Rollup merge of #66648 - crgl:btree-clone-from, r=Amanieu

Implement clone_from for BTreeMap and BTreeSet

See #28481. This results in up to 90% speedups on simple data types when `self` and `other` are the same size, and is generally comparable or faster. Some concerns:

1. This implementation requires an `Ord` bound on the `Clone` implementation for `BTreeMap` and `BTreeSet`. Since these structs can only be created externally for keys with `Ord` implemented, this should be fine? If not, there's certainly a less safe way to do this.
2. Changing `next_unchecked` on `RangeMut` to return mutable key references allows for replacing the entire overlapping portion of both maps without changing the external interface in any way. However, if `clone_from` fails it can leave the `BTreeMap` in an invalid state, which might be unacceptable.

~This probably needs an FCP since it changes a trait bound, but (as far as I know?) that change cannot break any external code.~

4 years agoUse `P` for `NtMeta`.
Nicholas Nethercote [Fri, 13 Dec 2019 00:25:08 +0000 (11:25 +1100)]
Use `P` for `NtMeta`.

This commit reduces the size of `Nonterminal` from a 72 bytes to 40 bytes (on
x86-64).

4 years agoUse `P` for `NtTraitItem`, `NtImplItem`, and `NtForeignItem`.
Nicholas Nethercote [Thu, 12 Dec 2019 05:41:18 +0000 (16:41 +1100)]
Use `P` for `NtTraitItem`, `NtImplItem`, and `NtForeignItem`.

This commit reduces the size of `Nonterminal` from a whopping 240 bytes
to 72 bytes (on x86-64), which gets it below the `memcpy` threshold.

It also removes some impedance mismatches with `Annotatable`, which
already uses `P` for these variants.

4 years agoAuto merge of #67688 - cjgillot:passes, r=Zoxc
bors [Wed, 29 Jan 2020 23:09:58 +0000 (23:09 +0000)]
Auto merge of #67688 - cjgillot:passes, r=Zoxc

Move some code to librustc_passes.

Per instructions by @Zoxc, some code from `librustc::middle` is moved to `librustc_passes`.

cc #65031
r? @Zoxc

4 years agoFix revision annotations in borrowck-feature-nll-overrides-migrate
Tomasz Miąsko [Wed, 29 Jan 2020 00:00:00 +0000 (00:00 +0000)]
Fix revision annotations in borrowck-feature-nll-overrides-migrate

4 years agoMake Target::from_impl_item a free function.
Camille GILLOT [Mon, 27 Jan 2020 18:37:36 +0000 (19:37 +0100)]
Make Target::from_impl_item a free function.

4 years agoMove upvars query to librustc_passes.
Camille GILLOT [Wed, 1 Jan 2020 16:31:03 +0000 (17:31 +0100)]
Move upvars query to librustc_passes.

4 years agoMove upvars.rs to librustc_passes.
Camille GILLOT [Wed, 1 Jan 2020 16:28:12 +0000 (17:28 +0100)]
Move upvars.rs to librustc_passes.

4 years agoMove check_mod_attr query in librustc_passes.
Camille GILLOT [Wed, 1 Jan 2020 16:27:30 +0000 (17:27 +0100)]
Move check_mod_attr query in librustc_passes.

4 years agoMove check_attr.rs to librustc_passes.
Camille GILLOT [Wed, 1 Jan 2020 16:13:28 +0000 (17:13 +0100)]
Move check_attr.rs to librustc_passes.

4 years agoDocument `From` implementation for NonZero nums
LeSeulArtichaut [Wed, 29 Jan 2020 15:18:51 +0000 (16:18 +0100)]
Document `From` implementation for NonZero nums

4 years agoDocument remaining undocumented `From` implementations for IPs
LeSeulArtichaut [Wed, 29 Jan 2020 14:09:04 +0000 (15:09 +0100)]
Document remaining undocumented `From` implementations for IPs

4 years agoAuto merge of #68634 - JohnTitor:clippy-up, r=JohnTitor
bors [Wed, 29 Jan 2020 16:39:45 +0000 (16:39 +0000)]
Auto merge of #68634 - JohnTitor:clippy-up, r=JohnTitor

Update Clippy

Fixes #68631

r? @ghost

4 years agoAuto merge of #68635 - JohnTitor:rollup-jsc34ac, r=JohnTitor
bors [Wed, 29 Jan 2020 13:40:58 +0000 (13:40 +0000)]
Auto merge of #68635 - JohnTitor:rollup-jsc34ac, r=JohnTitor

Rollup of 7 pull requests

Successful merges:

 - #67722 (Minor: note how Any is an unsafe trait in SAFETY comments)
 - #68586 (Make conflicting_repr_hints a deny-by-default c-future-compat lint)
 - #68598 (Fix null synthetic_implementors error)
 - #68603 (Changelog: Demonstrate final build-override syntax)
 - #68609 (Set lld flavor for MSVC to link.exe)
 - #68611 (Correct ICE caused by macros generating invalid spans.)
 - #68627 (Document that write_all will not call write if given an empty buffer)

Failed merges:

r? @ghost

4 years agoBTreeMap: tag and explain unsafe internal functions or assert preconditions
Stein Somers [Wed, 22 Jan 2020 10:01:18 +0000 (11:01 +0100)]
BTreeMap: tag and explain unsafe internal functions or assert preconditions
Co-Authored-By: Mark Rousskov <mark.simulacrum@gmail.com>
4 years agoRollup merge of #68627 - joshtriplett:write-all-none, r=Dylan-DPC
Yuki Okushi [Wed, 29 Jan 2020 09:56:34 +0000 (18:56 +0900)]
Rollup merge of #68627 - joshtriplett:write-all-none, r=Dylan-DPC

Document that write_all will not call write if given an empty buffer

Some types of Write instances have a semantic meaning associated with
writing an empty buffer, such as sending an empty packet. This works
when calling `write` directly, and supplying an empty buffer. However,
calling `write_all` on an empty buffer will simply never call `write`,
because `write_all` assumes it has no work to do.

Document this behavior, to help prospective users of
datagram-packet-style Write instances.

4 years agoRollup merge of #68611 - MichaelBurge:master, r=estebank
Yuki Okushi [Wed, 29 Jan 2020 09:56:32 +0000 (18:56 +0900)]
Rollup merge of #68611 - MichaelBurge:master, r=estebank

Correct ICE caused by macros generating invalid spans.

Closes #68605

4 years agoRollup merge of #68609 - Zoxc:lld-msvc, r=alexcrichton
Yuki Okushi [Wed, 29 Jan 2020 09:56:31 +0000 (18:56 +0900)]
Rollup merge of #68609 - Zoxc:lld-msvc, r=alexcrichton

Set lld flavor for MSVC to link.exe

This enables linking with LLD on Windows with just `-C linker=rust-lld` instead of needing `-C linker=rust-lld -C linker-flavor=lld-link`.

4 years agoRollup merge of #68603 - kornelski:patch-1, r=pietroalbini
Yuki Okushi [Wed, 29 Jan 2020 09:56:29 +0000 (18:56 +0900)]
Rollup merge of #68603 - kornelski:patch-1, r=pietroalbini

Changelog: Demonstrate final build-override syntax

4 years agoRollup merge of #68598 - GuillaumeGomez:fix-null-synthetic_implementors, r=ollie27
Yuki Okushi [Wed, 29 Jan 2020 09:56:28 +0000 (18:56 +0900)]
Rollup merge of #68598 - GuillaumeGomez:fix-null-synthetic_implementors, r=ollie27

Fix null synthetic_implementors error

Fixes #68584.

r? @ollie27

cc @kinnison

4 years agoRollup merge of #68586 - Centril:repr-deny, r=pnkfelix
Yuki Okushi [Wed, 29 Jan 2020 09:56:26 +0000 (18:56 +0900)]
Rollup merge of #68586 - Centril:repr-deny, r=pnkfelix

Make conflicting_repr_hints a deny-by-default c-future-compat lint

Closes https://github.com/rust-lang/rust/issues/68428.
cc https://github.com/rust-lang/rust/issues/68585.

r? @petrochenkov @pnkfelix

4 years agoRollup merge of #67722 - petertodd:2019-improve-any-comment, r=Mark-Simulacrum
Yuki Okushi [Wed, 29 Jan 2020 09:56:22 +0000 (18:56 +0900)]
Rollup merge of #67722 - petertodd:2019-improve-any-comment, r=Mark-Simulacrum

Minor: note how Any is an unsafe trait in SAFETY comments

Motivation: helpful to people like myself reading the standard library source to better understand how to use Any, especially if we do go ahead with https://github.com/rust-lang/rust/pull/67562 and make it an unsafe trait.