]> git.lizzy.rs Git - rust.git/log
rust.git
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 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 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 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 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 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 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.

4 years agoUpdate Clippy
Yuki Okushi [Wed, 29 Jan 2020 09:41:09 +0000 (18:41 +0900)]
Update Clippy

4 years agoAvoid ICE in macro's diagnostics
Yuki Okushi [Wed, 29 Jan 2020 09:02:58 +0000 (18:02 +0900)]
Avoid ICE in macro's diagnostics

4 years agoAuto merge of #68572 - tmiasko:sanitizer-use-after-scope, r=nikic
bors [Wed, 29 Jan 2020 07:44:36 +0000 (07:44 +0000)]
Auto merge of #68572 - tmiasko:sanitizer-use-after-scope, r=nikic

Detect use-after-scope bugs with AddressSanitizer

Enable use-after-scope checks by default when using AddressSanitizer.
They allow to detect incorrect use of stack objects after their scope
have already ended. The detection is based on LLVM lifetime intrinsics.

To facilitate the use of this functionality, the lifetime intrinsics are
now emitted regardless of optimization level if enabled sanitizer makes
use of them.

4 years agoAuto merge of #68512 - spastorino:local-is-copy, r=oli-obk
bors [Wed, 29 Jan 2020 04:36:50 +0000 (04:36 +0000)]
Auto merge of #68512 - spastorino:local-is-copy, r=oli-obk

Local is copy

r? @oli-obk

4 years agoMinor: note why we can rely on Any trait for safety
Peter Todd [Wed, 29 Jan 2020 01:53:45 +0000 (20:53 -0500)]
Minor: note why we can rely on Any trait for safety

4 years agoAuto merge of #68625 - JohnTitor:rollup-20pfcru, r=JohnTitor
bors [Wed, 29 Jan 2020 01:28:55 +0000 (01:28 +0000)]
Auto merge of #68625 - JohnTitor:rollup-20pfcru, r=JohnTitor

Rollup of 8 pull requests

Successful merges:

 - #68289 (Don't ICE on path-collision in dep-graph)
 - #68378 (Add BTreeMap::remove_entry)
 - #68553 (Fix run button positionning in case of scrolling)
 - #68556 (rustdoc: Fix re-exporting primitive types)
 - #68582 (Add E0727 long explanation)
 - #68592 (fix: typo in vec.rs)
 - #68619 (Fix a few spelling mistakes)
 - #68620 (Update links to WASI docs in time.rs module)

Failed merges:

r? @ghost

4 years agoDocument that write_all will not call write if given an empty buffer
Josh Triplett [Wed, 29 Jan 2020 01:22:38 +0000 (17:22 -0800)]
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 #68620 - kubkon:patch-1, r=Dylan-DPC
Yuki Okushi [Wed, 29 Jan 2020 00:34:54 +0000 (09:34 +0900)]
Rollup merge of #68620 - kubkon:patch-1, r=Dylan-DPC

Update links to WASI docs in time.rs module

Since the docs for the WASI API are now evolving in [WebAssembly/WASI] repo,
I thought it might be useful to update the links in the docs to point to that location
instead of using the outdated `CraneStation/wasmtime` destination.

[WebAssembly/WASI]: https://github.com/WebAssembly/WASI

r? @steveklabnik

cc @alexcrichton

4 years agoRollup merge of #68619 - gorilskij:master, r=varkor
Yuki Okushi [Wed, 29 Jan 2020 00:34:52 +0000 (09:34 +0900)]
Rollup merge of #68619 - gorilskij:master, r=varkor

Fix a few spelling mistakes

4 years agoRollup merge of #68592 - pdbrito:master, r=jonas-schievink
Yuki Okushi [Wed, 29 Jan 2020 00:34:51 +0000 (09:34 +0900)]
Rollup merge of #68592 - pdbrito:master, r=jonas-schievink

fix: typo in vec.rs

4 years agoRollup merge of #68582 - LeSeulArtichaut:code-explanations, r=Dylan-DPC
Yuki Okushi [Wed, 29 Jan 2020 00:34:49 +0000 (09:34 +0900)]
Rollup merge of #68582 - LeSeulArtichaut:code-explanations, r=Dylan-DPC

Add E0727 long explanation

Add long explanation for the `E0727` error code (async generators not yet supported).
Part of #61137

r? @GuillaumeGomez

4 years agoRollup merge of #68556 - ollie27:rustdoc_primitive_re-export, r=GuillaumeGomez
Yuki Okushi [Wed, 29 Jan 2020 00:34:48 +0000 (09:34 +0900)]
Rollup merge of #68556 - ollie27:rustdoc_primitive_re-export, r=GuillaumeGomez

rustdoc: Fix re-exporting primitive types

* Generate links to the primitive type docs for re-exports.
* Don't ICE on cross crate primitive type re-exports.
* Make primitive type re-exports show up cross crate.

Fixes #67646
Closes #67972

r? @GuillaumeGomez

4 years agoRollup merge of #68553 - GuillaumeGomez:fix-run-button-scroll-pos, r=kinnison
Yuki Okushi [Wed, 29 Jan 2020 00:34:47 +0000 (09:34 +0900)]
Rollup merge of #68553 - GuillaumeGomez:fix-run-button-scroll-pos, r=kinnison

Fix run button positionning in case of scrolling

Fixes #68337.

r? @kinnison

4 years agoRollup merge of #68378 - billyrieger:btreemap-remove-entry, r=KodrAus
Yuki Okushi [Wed, 29 Jan 2020 00:34:45 +0000 (09:34 +0900)]
Rollup merge of #68378 - billyrieger:btreemap-remove-entry, r=KodrAus

Add BTreeMap::remove_entry

Implements https://github.com/rust-lang/rust/issues/66714.

4 years agoRollup merge of #68289 - pnkfelix:issue-62649-dont-ice-on-path-collision-in-dep-graph...
Yuki Okushi [Wed, 29 Jan 2020 00:34:43 +0000 (09:34 +0900)]
Rollup merge of #68289 - pnkfelix:issue-62649-dont-ice-on-path-collision-in-dep-graph, r=michaelwoerister

Don't ICE on path-collision in dep-graph

Collisions in the dep-graph due to path-reuse are rare but can occur.

So, instead of ICE'ing, just fail to mark green in such cases (for `DepKind::{Hir, HirBody, CrateMetadata}`).

Fix #62649.

4 years agoUse termize instead of term_size
John Kåre Alsaker [Wed, 29 Jan 2020 00:13:48 +0000 (01:13 +0100)]
Use termize instead of term_size

4 years agoUpdate links to WASI docs in time.rs module
Jakub Konka [Tue, 28 Jan 2020 22:34:00 +0000 (23:34 +0100)]
Update links to WASI docs in time.rs module

Since the docs for the WASI API are now evolving in [WebAssembly/WASI] repo,
I thought it might be useful to update the links in the docs to point to that location
instead of using the outdated `CraneStation/wasmtime` destination.

[WebAssembly/WASI]: https://github.com/WebAssembly/WASI

4 years agoFix null synthetic_implementors error
Guillaume Gomez [Tue, 28 Jan 2020 12:48:08 +0000 (13:48 +0100)]
Fix null synthetic_implementors error

4 years agoFix a few spelling mistakes
gorilskij [Tue, 28 Jan 2020 22:06:58 +0000 (23:06 +0100)]
Fix a few spelling mistakes

4 years agoAuto merge of #68606 - jonas-schievink:normalize-fastpath, r=Zoxc
bors [Tue, 28 Jan 2020 20:26:24 +0000 (20:26 +0000)]
Auto merge of #68606 - jonas-schievink:normalize-fastpath, r=Zoxc

Add an early-exit to `QueryNormalizer::fold_ty`

Pulled out from https://github.com/rust-lang/rust/pull/68524, this results in a ~60-70% reduction in compile time for the await-call-tree benchmarks. This should unblock https://github.com/rust-lang/rust/issues/67982 as well.

r? @Zoxc

4 years agoAdd E0727 long explanation
LeSeulArtichaut [Mon, 27 Jan 2020 20:22:05 +0000 (21:22 +0100)]
Add E0727 long explanation

4 years agoCorrect ICE caused by macros generating invalid spans.
Michael Burge [Tue, 28 Jan 2020 18:57:03 +0000 (10:57 -0800)]
Correct ICE caused by macros generating invalid spans.

4 years agoFill tracking issue for `iter_map_while` feature
Waffle [Sat, 25 Jan 2020 18:23:22 +0000 (21:23 +0300)]
Fill tracking issue for `iter_map_while` feature

4 years agoAdd `Iterator::map_while` method and corresponding `MapWhile` adapter
Waffle [Fri, 24 Jan 2020 11:49:34 +0000 (14:49 +0300)]
Add `Iterator::map_while` method and corresponding `MapWhile` adapter

4 years agoReformat truncation section of clone_from
Charles Gleason [Tue, 28 Jan 2020 16:59:50 +0000 (11:59 -0500)]
Reformat truncation section of clone_from

4 years agoDemonstrate final build-override syntax
Kornel [Tue, 28 Jan 2020 15:53:21 +0000 (15:53 +0000)]
Demonstrate final build-override syntax

4 years agoSet lld flavor for MSVC to link.exe
John Kåre Alsaker [Tue, 28 Jan 2020 16:58:44 +0000 (17:58 +0100)]
Set lld flavor for MSVC to link.exe

4 years agoAdd private is_empty method to RangeMut
Charles Gleason [Tue, 28 Jan 2020 16:46:49 +0000 (11:46 -0500)]
Add private is_empty method to RangeMut

4 years agoInclude empty BTreeMap in clone_from tests
Charles Gleason [Tue, 28 Jan 2020 16:39:48 +0000 (11:39 -0500)]
Include empty BTreeMap in clone_from tests

4 years agoAdd an early-exit to `QueryNormalizer::fold_ty`
Jonas Schievink [Mon, 27 Jan 2020 23:52:21 +0000 (00:52 +0100)]
Add an early-exit to `QueryNormalizer::fold_ty`

4 years agoFormat safety comment as per tidy
Charles Gleason [Tue, 28 Jan 2020 16:27:31 +0000 (11:27 -0500)]
Format safety comment as per tidy

Co-Authored-By: Ashley Mannix <ashleymannix@live.com.au>
4 years agoAuto merge of #68533 - tmiasko:compiletest, r=nikomatsakis
bors [Tue, 28 Jan 2020 16:25:35 +0000 (16:25 +0000)]
Auto merge of #68533 - tmiasko:compiletest, r=nikomatsakis

compiletest: Unit tests for `EarlyProps` (+ small cleanup)

* Parse `EarlyProps` from a reader
* Add unit tests for `EarlyProps`
* Remove unused `llvm-cxxflags` option
* Remove unnecessary memory allocations in `iter_header`
* Update mode list displayed in `--help`

4 years agoFix some wrong dereferences after rebase
Santiago Pastorino [Tue, 28 Jan 2020 15:17:02 +0000 (12:17 -0300)]
Fix some wrong dereferences after rebase

4 years agoAdd support for Control Flow Guard on Windows.
Andrew Paverd [Mon, 13 Jan 2020 13:25:39 +0000 (13:25 +0000)]
Add support for Control Flow Guard on Windows.

This patch enables rustc to emit the required LLVM module flags to enable Control Flow Guard metadata (cfguard=1) or metadata and checks (cfguard=2). The LLVM module flags are ignored on unsupported targets and operating systems.

4 years agoRemove unneeded & on match pattern
Santiago Pastorino [Fri, 24 Jan 2020 16:27:01 +0000 (13:27 -0300)]
Remove unneeded & on match pattern

4 years ago./x.py fmt
Santiago Pastorino [Fri, 24 Jan 2020 15:50:13 +0000 (12:50 -0300)]
./x.py fmt

4 years agoPlace::ty_from takes local by value
Santiago Pastorino [Tue, 14 Jan 2020 05:21:42 +0000 (02:21 -0300)]
Place::ty_from takes local by value

4 years agoLocal field on PlaceRef and RootPlace is not a reference anymore
Santiago Pastorino [Tue, 14 Jan 2020 05:10:05 +0000 (02:10 -0300)]
Local field on PlaceRef and RootPlace is not a reference anymore

4 years agocodegen_place and related functions can take PlaceRef by value
Santiago Pastorino [Tue, 14 Jan 2020 04:51:59 +0000 (01:51 -0300)]
codegen_place and related functions can take PlaceRef by value

4 years agomake_integrate_local takes Local by value
Santiago Pastorino [Tue, 14 Jan 2020 04:26:11 +0000 (01:26 -0300)]
make_integrate_local takes Local by value

4 years agorecord_killed_borrows_for_local takes Local by value
Santiago Pastorino [Tue, 14 Jan 2020 04:23:51 +0000 (01:23 -0300)]
record_killed_borrows_for_local takes Local by value