]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agoRollup merge of #70140 - Nemo157:result-flatten, r=Amanieu
Mazdak Farrokhzad [Sun, 29 Mar 2020 14:48:21 +0000 (16:48 +0200)]
Rollup merge of #70140 - Nemo157:result-flatten, r=Amanieu

Add Result<Result<T, E>, E>::flatten -> Result<T, E>

This PR makes this possible (modulo type inference):

```rust
assert_eq!(Ok(6), Ok(Ok(6)).flatten());
```

Tracking issue: #70142

<sub>largely cribbed directly from <https://github.com/rust-lang/rust/pull/60256></sub>

4 years agoAuto merge of #70525 - Centril:rollup-vj3esv3, r=Centril
bors [Sun, 29 Mar 2020 09:50:52 +0000 (09:50 +0000)]
Auto merge of #70525 - Centril:rollup-vj3esv3, r=Centril

Rollup of 3 pull requests

Successful merges:

 - #68692 (impl From<[T; N]> for Vec<T>)
 - #70101 (Add copy bound to atomic & numeric intrinsics)
 - #70506 (BTreeMap testing: introduce symbolic constants and use height consistently)

Failed merges:

r? @ghost

4 years agoRollup merge of #70506 - ssomers:btreemap_testing_consts, r=RalfJung
Mazdak Farrokhzad [Sun, 29 Mar 2020 09:50:13 +0000 (11:50 +0200)]
Rollup merge of #70506 - ssomers:btreemap_testing_consts, r=RalfJung

BTreeMap testing: introduce symbolic constants and use height consistently

Doesn't change what or how much is tested, except for some exact integer types, just for convenience and because `node::CAPACITY` is a usize.

r? @RalfJung

4 years agoRollup merge of #70101 - tmiasko:intrinsics-copy, r=eddyb
Mazdak Farrokhzad [Sun, 29 Mar 2020 09:50:12 +0000 (11:50 +0200)]
Rollup merge of #70101 - tmiasko:intrinsics-copy, r=eddyb

Add copy bound to atomic & numeric intrinsics

4 years agoRollup merge of #68692 - jyn514:vec-from-array, r=LukasKalbertodt
Mazdak Farrokhzad [Sun, 29 Mar 2020 09:50:10 +0000 (11:50 +0200)]
Rollup merge of #68692 - jyn514:vec-from-array, r=LukasKalbertodt

impl From<[T; N]> for Vec<T>

Closes https://github.com/rust-lang/rust/issues/67963

4 years agoAuto merge of #70370 - petrochenkov:nosmatch, r=Centril
bors [Sun, 29 Mar 2020 06:33:42 +0000 (06:33 +0000)]
Auto merge of #70370 - petrochenkov:nosmatch, r=Centril

Remove attribute `#[structural_match]` and any references to it

A small remaining part of https://github.com/rust-lang/rust/issues/63438.

4 years agoAuto merge of #70518 - Dylan-DPC:rollup-n2gkh3a, r=Dylan-DPC
bors [Sun, 29 Mar 2020 00:56:47 +0000 (00:56 +0000)]
Auto merge of #70518 - Dylan-DPC:rollup-n2gkh3a, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #69937 (ASCII methods on OsStr)
 - #70235 (Validate git setup before accessing functionality)
 - #70503 (rename Scalar::{ptr_null -> null_ptr} and add "machine_" prefix like elsewhere)
 - #70508 (Miri: use more specialized Scalar::from_ constructors where appropriate)
 - #70510 (fix TryEnterCriticalSection return type)

Failed merges:

r? @ghost

4 years agoRollup merge of #70510 - RalfJung:bool-vs-boolean, r=Mark-Simulacrum
Dylan DPC [Sun, 29 Mar 2020 00:32:23 +0000 (01:32 +0100)]
Rollup merge of #70510 - RalfJung:bool-vs-boolean, r=Mark-Simulacrum

fix TryEnterCriticalSection return type

Source: https://docs.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-tryentercriticalsection
Fixes https://github.com/rust-lang/rust/issues/70504

4 years agoRollup merge of #70508 - RalfJung:scalar-from, r=eddyb
Dylan DPC [Sun, 29 Mar 2020 00:32:22 +0000 (01:32 +0100)]
Rollup merge of #70508 - RalfJung:scalar-from, r=eddyb

Miri: use more specialized Scalar::from_ constructors where appropriate

4 years agoRollup merge of #70503 - RalfJung:null, r=varkor
Dylan DPC [Sun, 29 Mar 2020 00:32:21 +0000 (01:32 +0100)]
Rollup merge of #70503 - RalfJung:null, r=varkor

rename Scalar::{ptr_null -> null_ptr} and add "machine_" prefix like elsewhere

"NULL pointer" is just much more common terminology than "pointer-null".
Also I forgot two methods when renaming all the `Scalar` things to `(to|from)_machine_(u|i)size`.

4 years agoRollup merge of #70235 - dillona:70182-check-before-using-git, r=Mark-Simulacrum
Dylan DPC [Sun, 29 Mar 2020 00:32:19 +0000 (01:32 +0100)]
Rollup merge of #70235 - dillona:70182-check-before-using-git, r=Mark-Simulacrum

Validate git setup before accessing functionality

Closes #70182

4 years agoRollup merge of #69937 - TyPR124:osstr_ascii, r=dtolnay
Dylan DPC [Sun, 29 Mar 2020 00:32:17 +0000 (01:32 +0100)]
Rollup merge of #69937 - TyPR124:osstr_ascii, r=dtolnay

ASCII methods on OsStr

Would close #69566

I don't know enough about encodings to know if this is a valid change, however the comment on the issue suggests it could be.

This does two things:

1. Makes ASCII methods available on OsStr

2. Makes it possible to obtain a `&mut OsStr`. This is necessary to actually use `OsStr::make_ascii_*case` methods since they modify the underlying value. As far as I can tell, the only way to modify a `&mut OsStr` is via the methods I just added.

My original hope was to have these methods on `OsStrExt` for Windows, since the standard library already assumes `make_ascii_uppercase` is valid in Windows (see the change I made to windows/process.rs). If it is found these are not valid changes on non-Windows platforms, I can move the methods to the ext trait instead.

4 years agoadd tracking issue
TyPR124 [Sat, 28 Mar 2020 23:23:49 +0000 (19:23 -0400)]
add tracking issue

4 years agomove doc links for consistency
TyPR124 [Thu, 12 Mar 2020 16:40:57 +0000 (12:40 -0400)]
move doc links for consistency

4 years agoremove unnecessary comments
TyPR124 [Wed, 11 Mar 2020 20:15:16 +0000 (16:15 -0400)]
remove unnecessary comments

4 years agouse make_ascii_uppercase in windows/process.rs
TyPR124 [Wed, 11 Mar 2020 20:05:11 +0000 (16:05 -0400)]
use make_ascii_uppercase in windows/process.rs

4 years agoascii methods on osstr
TyPR124 [Wed, 11 Mar 2020 19:53:55 +0000 (15:53 -0400)]
ascii methods on osstr

4 years agoBTreeMap testing: introduce symbolic constants and refer to height consistently.
Stein Somers [Sat, 8 Feb 2020 10:52:14 +0000 (11:52 +0100)]
BTreeMap testing: introduce symbolic constants and refer to height consistently.

4 years agoAuto merge of #66938 - GuillaumeGomez:lint-for-no-crate-level-doc, r=Dylan-DPC
bors [Sat, 28 Mar 2020 20:11:01 +0000 (20:11 +0000)]
Auto merge of #66938 - GuillaumeGomez:lint-for-no-crate-level-doc, r=Dylan-DPC

Add lint when no doc is present at the crate-level

Follow-up of #66267.

r? @kinnison

4 years agofix TryEnterCriticalSection return type
Ralf Jung [Sat, 28 Mar 2020 20:10:11 +0000 (21:10 +0100)]
fix TryEnterCriticalSection return type

4 years agorefmt
Ralf Jung [Sat, 28 Mar 2020 18:51:54 +0000 (19:51 +0100)]
refmt

4 years agoget rid of useless back-and-forth cast
Ralf Jung [Sat, 28 Mar 2020 18:40:58 +0000 (19:40 +0100)]
get rid of useless back-and-forth cast

4 years agouse more specialized Scalar::from_ constructors where appropriate
Ralf Jung [Sat, 28 Mar 2020 18:29:46 +0000 (19:29 +0100)]
use more specialized Scalar::from_ constructors where appropriate

4 years agoAuto merge of #70499 - Dylan-DPC:rollup-f9je1l8, r=Dylan-DPC
bors [Sat, 28 Mar 2020 17:15:32 +0000 (17:15 +0000)]
Auto merge of #70499 - Dylan-DPC:rollup-f9je1l8, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #70418 (Add long error explanation for E0703)
 - #70448 (Create output dir in rustdoc markdown render)
 - #70486 (Shrink Unicode tables (even more))
 - #70493 (Fix rustdoc.css CSS tab-size property)
 - #70495 (Replace last mention of IRC with Discord)

Failed merges:

r? @ghost

4 years agouse machine_ prefix for target usize/isize
Ralf Jung [Sat, 28 Mar 2020 16:51:11 +0000 (17:51 +0100)]
use machine_ prefix for target usize/isize

4 years agorename Scalar::{ptr_null -> null_ptr}
Ralf Jung [Sat, 28 Mar 2020 15:57:33 +0000 (16:57 +0100)]
rename Scalar::{ptr_null -> null_ptr}

4 years agoRollup merge of #70495 - bkaestner:master, r=Mark-Simulacrum
Dylan DPC [Sat, 28 Mar 2020 14:22:03 +0000 (15:22 +0100)]
Rollup merge of #70495 - bkaestner:master, r=Mark-Simulacrum

Replace last mention of IRC with Discord

Mozilla's IRC service was shut down in March 2020. The official instant messaging variant has been Discord for a while, and most of the links were already replaced by #61524.

This was the last line that came up with `irc.mozilla.org` or any combination of "irc.*#[a-z]+" in a `git grep`:

    git grep -i -E "irc.*#[a-z]+"

As there is only one other link directly to Rust's discord, I used the same Markdown link `[rust-discord]` as in `bootstrap/README.md` to stay consistent. This might come in handy if the chat platform changes at a later point again.

4 years agoRollup merge of #70493 - 0xd4d:rustdoc-tab-size, r=GuillaumeGomez
Dylan DPC [Sat, 28 Mar 2020 14:22:01 +0000 (15:22 +0100)]
Rollup merge of #70493 - 0xd4d:rustdoc-tab-size, r=GuillaumeGomez

Fix rustdoc.css CSS tab-size property

This fixes the CSS tab size property names which are called `tab-size` / `-moz-tab-size` and not `tab-width`

Old issue https://github.com/rust-lang/rust/issues/49155 and related PR https://github.com/rust-lang/rust/pull/50947

tab-size: https://developer.mozilla.org/en-US/docs/Web/CSS/tab-size

4 years agoRollup merge of #70486 - Mark-Simulacrum:unicode-shrink, r=dtolnay
Dylan DPC [Sat, 28 Mar 2020 14:22:00 +0000 (15:22 +0100)]
Rollup merge of #70486 - Mark-Simulacrum:unicode-shrink, r=dtolnay

Shrink Unicode tables (even more)

This shrinks the Unicode tables further, building upon the wins in #68232 (the previous counts differ due to an interim Unicode version update, see #69929.

The new data structure is slower by around 3x, on the benchmark of looking up every Unicode scalar value in each data set sequentially in every data set included. Note that for ASCII, the exposed functions on `char` optimize with direct branches, so ASCII will retain the same performance regardless of internal optimizations (or the reverse). Also, note that the size reduction due to the skip list (from where the performance losses come) is around 40%, and, as a result, I believe the performance loss is acceptable, as the routines are still quite fast. Anywhere where this is hot, should probably be using a custom data structure anyway (e.g., a raw bitset) or something optimized for frequently seen values, etc.

This PR updates both the bitset data structure, and introduces a new data structure similar to a skip list. For more details, see the [main.rs] of the table generator, which describes both. The commits mostly work individually and document size wins.

As before, this is tested on all valid chars to have the same results as nightly (and the canonical Unicode data sets), happily, no bugs were found.

[main.rs]: https://github.com/rust-lang/rust/blob/fb4a715e18b/src/tools/unicode-table-generator/src/main.rs

Set             | Previous |  New  |  % of old  | Codepoints | Ranges |
----------------|---------:|------:|-----------:|-----------:|-------:|
Alphabetic      |     3055 |  1599 |        52% |     132875 |    695 |
Case Ignorable  |     2136 |   949 |        44% |       2413 |    410 |
Cased           |      934 |   359 |        38% |       4286 |    141 |
Cc              |       43 |     9 |        20% |         65 |      2 |
Grapheme Extend |     1774 |   813 |        46% |       1979 |    344 |
Lowercase       |      985 |   867 |        88% |       2344 |    652 |
N               |     1266 |   419 |        33% |       1781 |    133 |
Uppercase       |      934 |   777 |        83% |       1911 |    643 |
White_Space     |      140 |    37 |        26% |         25 |     10 |
----------------|----------|-------|------------|------------|--------|
Total           |    11267 |  5829 |        51% |     -      |   -    |

4 years agoRollup merge of #70448 - TimotheeGerber:rustdoc-create-output-dir, r=GuillaumeGomez
Dylan DPC [Sat, 28 Mar 2020 14:21:58 +0000 (15:21 +0100)]
Rollup merge of #70448 - TimotheeGerber:rustdoc-create-output-dir, r=GuillaumeGomez

Create output dir in rustdoc markdown render

`rustdoc` command on a standalone markdown document fails because the output directory (which default to `doc/`) is not created, even when specified with the `--output` argument.

This PR adds the creation of the output directory before the file creation to avoid an unexpected error which is unclear.

I am not sure about the returned error code. I did not find a table explaining them. So I simply put the same error code that is returned when `File::create` fails because they are both related to file-system errors.

Resolve #70431

4 years agoRollup merge of #70418 - PankajChaudhary5:master, r=Dylan-DPC
Dylan DPC [Sat, 28 Mar 2020 14:21:57 +0000 (15:21 +0100)]
Rollup merge of #70418 - PankajChaudhary5:master, r=Dylan-DPC

Add long error explanation for E0703

Add long explanation for the E0703 error code
Part of #61137

r? @GuillaumeGomez

4 years agoAuto merge of #70485 - matthiaskrgr:submodule_upd, r=Dylan-DPC
bors [Sat, 28 Mar 2020 14:15:27 +0000 (14:15 +0000)]
Auto merge of #70485 - matthiaskrgr:submodule_upd, r=Dylan-DPC

submodules: update clippy from 1ff81c1b to 70b93aab

Changes:
````
remove redundant import
rustup https://github.com/rust-lang/rust/pull/68404
rustup https://github.com/rust-lang/rust/pull/69644
rustup https://github.com/rust-lang/rust/pull/70344
Move verbose_file_reads to restriction
move redundant_pub_crate to nursery
readme: explain how to run only a single lint on a codebase
Remove dependency on `matches` crate
Move useless_transmute to nursery
nursery group -> style
Update for PR feedback
Auto merge of #5314 - ehuss:remove-git2, r=flip1995
Lint for `pub(crate)` items that are not crate visible due to the visibility of the module that contains them
````

Fixes #70456

4 years agoReplace last mention of IRC with Discord
Benjamin Kästner [Sat, 28 Mar 2020 11:23:42 +0000 (12:23 +0100)]
Replace last mention of IRC with Discord

Mozilla's IRC service was shut down in March 2020. The official
instant messaging variant has been Discord for a while, and most of
the links were already replaced by #61524.

This was the last line that came up with `irc.mozilla.org` or any
combination of "irc.*#[a-z]+" in a `git grep`:

    git grep -i -E "irc.*#[a-z]+"

As there is only one other link directly to Rust's discord, I used the
same Markdown link `[rust-discord]` as in `bootstrap/README.md` to
stay consistent. This might come in handy if the chat platform changes
at a later point again.

As an aside: for those interested in the use of IRC, Mozilla's [wiki]
still offers a lot of in-depth knowledge.

 [wiki]: https://wiki.mozilla.org/IRC

4 years agoAuto merge of #70261 - Centril:angle-args-partition, r=varkor
bors [Sat, 28 Mar 2020 11:13:09 +0000 (11:13 +0000)]
Auto merge of #70261 - Centril:angle-args-partition, r=varkor

Move arg/constraint partition check to validation & improve recovery

- In the first commit, we move the check rejecting e.g., `<'a, Item = u8, String>` from the parser into AST validation.
- We then use this to improve the code for parsing generic arguments.
- And we add recovery for e.g., `<Item = >` (missing), `<Item = 42>` (constant), and `<Item = 'a>` (lifetime).

This is also preparatory work for supporting https://github.com/rust-lang/rust/issues/70256.

r? @varkor

4 years agoFix rustdoc.css CSS tab-size property
0xd4d [Sat, 28 Mar 2020 10:49:12 +0000 (11:49 +0100)]
Fix rustdoc.css CSS tab-size property

4 years agoAuto merge of #70095 - jsgf:link-native, r=nagisa
bors [Sat, 28 Mar 2020 08:16:47 +0000 (08:16 +0000)]
Auto merge of #70095 - jsgf:link-native, r=nagisa

Implement -Zlink-native-libraries

This implements a flag `-Zlink-native-libraries=yes/no`. If set to true/yes, or unspecified, then
native libraries referenced via `#[link]` attributes will be put on the linker line (ie, unchanged
behaviour).

If `-Zlink-native-libraries=no` is specified then rustc will not add the native libraries to the link
line. The assumption is that the outer build system driving the build already knows about the native
libraries and will specify them to the linker directly (for example via `-Clink-arg=`).

Addresses issue #70093

4 years agoAuto merge of #70483 - Centril:rollup-slli4yf, r=Centril
bors [Sat, 28 Mar 2020 00:36:57 +0000 (00:36 +0000)]
Auto merge of #70483 - Centril:rollup-slli4yf, r=Centril

Rollup of 5 pull requests

Successful merges:

 - #70345 (Remove `no_integrated_as` mode.)
 - #70434 (suggest `;` on expr `mac!()` which is good as stmt `mac!()`)
 - #70457 (non-exhastive diagnostic: add note re. scrutinee type)
 - #70478 (Refactor type_of for constants)
 - #70480 (clarify hir_id <-> node_id method names)

Failed merges:

r? @ghost

4 years agoUpdate the documentation comment
Mark Rousskov [Fri, 27 Mar 2020 22:13:22 +0000 (18:13 -0400)]
Update the documentation comment

4 years agoRemove separate encoding for a single nonzero-mapping byte
Mark Rousskov [Fri, 27 Mar 2020 22:01:14 +0000 (18:01 -0400)]
Remove separate encoding for a single nonzero-mapping byte

In practice, for the two data sets that still use the bitset encoding (uppercase
and lowercase) this is not a significant win, so just drop it entirely. It costs
us about 5 bytes, and the complexity is nontrivial.

4 years agoAdd skip list based implementation for smaller encoding
Mark Rousskov [Thu, 26 Mar 2020 01:00:01 +0000 (21:00 -0400)]
Add skip list based implementation for smaller encoding

This arranges for the sparser sets (everything except lower and uppercase) to be
encoded in a significantly smaller context. However, it is also a performance
trade-off (roughly 3x slower than the bitset encoding). The 40% size reduction
is deemed to be sufficiently important to merit this performance loss,
particularly as it is unlikely that this code is hot anywhere (and if it is,
paying the memory cost for a bitset that directly represents the data seems
worthwhile).

Alphabetic     : 1599 bytes     (- 937 bytes)
Case_Ignorable : 949 bytes      (- 822 bytes)
Cased          : 359 bytes      (- 429 bytes)
Cc             : 9 bytes        (-  15 bytes)
Grapheme_Extend: 813 bytes      (- 675 bytes)
Lowercase      : 863 bytes
N              : 419 bytes      (- 619 bytes)
Uppercase      : 776 bytes
White_Space    : 37 bytes       (-  46 bytes)
Total table sizes: 5824 bytes   (-3543 bytes)

4 years agosubmodules: update clippy from 1ff81c1b to 70b93aab
Matthias Krüger [Fri, 27 Mar 2020 22:42:25 +0000 (23:42 +0100)]
submodules: update clippy from 1ff81c1b to 70b93aab

Changes:
````
remove redundant import
rustup https://github.com/rust-lang/rust/pull/68404
rustup https://github.com/rust-lang/rust/pull/69644
rustup https://github.com/rust-lang/rust/pull/70344
Move verbose_file_reads to restriction
move redundant_pub_crate to nursery
readme: explain how to run only a single lint on a codebase
Remove dependency on `matches` crate
Move useless_transmute to nursery
nursery group -> style
Update for PR feedback
Auto merge of #5314 - ehuss:remove-git2, r=flip1995
Lint for `pub(crate)` items that are not crate visible due to the visibility of the module that contains them
````

Fixes #70456

4 years agoRollup merge of #70480 - lcnr:appayupyup, r=eddyb
Mazdak Farrokhzad [Fri, 27 Mar 2020 21:39:42 +0000 (22:39 +0100)]
Rollup merge of #70480 - lcnr:appayupyup, r=eddyb

clarify hir_id <-> node_id method names

resolves 2 FIXME.

r? @eddyb

4 years agoRollup merge of #70478 - lcnr:refactor-type_of, r=varkor
Mazdak Farrokhzad [Fri, 27 Mar 2020 21:39:41 +0000 (22:39 +0100)]
Rollup merge of #70478 - lcnr:refactor-type_of, r=varkor

Refactor type_of for constants

If I have to look at this function for a few hours I want it to at least look good.

r? @varkor

4 years agoRollup merge of #70457 - Centril:non-exhaustive-scrutinee-type, r=estebank
Mazdak Farrokhzad [Fri, 27 Mar 2020 21:39:39 +0000 (22:39 +0100)]
Rollup merge of #70457 - Centril:non-exhaustive-scrutinee-type, r=estebank

non-exhastive diagnostic: add note re. scrutinee type

This fixes https://github.com/rust-lang/rust/issues/67259 by adding a note:
```
    = note: the matched value is of type &[i32]
```
to non-exhaustive pattern matching errors.

r? @varkor @estebank

4 years agoRollup merge of #70434 - Centril:fix-34421, r=estebank
Mazdak Farrokhzad [Fri, 27 Mar 2020 21:39:38 +0000 (22:39 +0100)]
Rollup merge of #70434 - Centril:fix-34421, r=estebank

suggest `;` on expr `mac!()` which is good as stmt `mac!()`

Fixes https://github.com/rust-lang/rust/issues/34421 by implementing @jseyfried's suggestion in https://github.com/rust-lang/rust/issues/34421#issuecomment-301578683.

r? @petrochenkov

4 years agoRollup merge of #70345 - nnethercote:rm-no_integrated_as, r=alexcrichton
Mazdak Farrokhzad [Fri, 27 Mar 2020 21:39:37 +0000 (22:39 +0100)]
Rollup merge of #70345 - nnethercote:rm-no_integrated_as, r=alexcrichton

Remove `no_integrated_as` mode.

Specifically, remove both `-Z no_integrated_as` and
`TargetOptions::no_integrated_as`. The latter was only used for the
`msp430_none_elf` platform, for which it's no longer required.

r? @alexcrichton

4 years agoAuto merge of #70162 - cjgillot:split_query, r=Zoxc
bors [Fri, 27 Mar 2020 21:36:51 +0000 (21:36 +0000)]
Auto merge of #70162 - cjgillot:split_query, r=Zoxc

Move the query system to a dedicated crate

The query system `rustc::ty::query` is split out into the `rustc_query_system` crate.

Some commits are unformatted, to ease rebasing.

Based on #67761 and #69910.

r? @Zoxc

4 years agoadd the label back but make it shorter
Mazdak Farrokhzad [Fri, 27 Mar 2020 20:52:09 +0000 (21:52 +0100)]
add the label back but make it shorter

4 years agoImplement -Zlink-native-libraries
Jeremy Fitzhardinge [Wed, 18 Mar 2020 02:10:56 +0000 (19:10 -0700)]
Implement -Zlink-native-libraries

This implements a flag `-Zlink-native-libraries=yes/no`. If set to true/yes, or unspecified, then
native libraries referenced via `#[link]` attributes will be put on the linker line (ie, unchanged
behaviour).

If `-Zlink-native-libraries=no` is specified then rustc will not add the native libraries to the link
line. The assumption is that the outer build system driving the build already knows about the native
libraries and will specify them to the linker directly (for example via `-Clink-arg=`).

Addresses issue #70093

4 years agoAuto merge of #70474 - Dylan-DPC:rollup-0lsxmmk, r=Dylan-DPC
bors [Fri, 27 Mar 2020 16:09:48 +0000 (16:09 +0000)]
Auto merge of #70474 - Dylan-DPC:rollup-0lsxmmk, r=Dylan-DPC

Rollup of 4 pull requests

Successful merges:

 - #65222 (Proposal: `fold_self` and `try_fold_self` for Iterators)
 - #69887 (clean up E0404 explanation)
 - #70068 (use "gcc" instead of "cc" on *-sun-solaris systems when linking)
 - #70470 (Clean up E0463 explanation)

Failed merges:

r? @ghost

4 years agorefactor type_of for consts
Bastian Kauschke [Fri, 27 Mar 2020 15:44:40 +0000 (16:44 +0100)]
refactor type_of for consts

4 years agoclarify hir_id <-> node_id method names
Bastian Kauschke [Fri, 27 Mar 2020 15:43:20 +0000 (16:43 +0100)]
clarify hir_id <-> node_id method names

4 years agoRefactor changes
PankajChaudhary5 [Fri, 27 Mar 2020 14:30:49 +0000 (20:00 +0530)]
Refactor changes

4 years agoRollup merge of #70470 - GuillaumeGomez:cleanup-e0463, r=Dylan-DPC
Dylan DPC [Fri, 27 Mar 2020 14:09:59 +0000 (15:09 +0100)]
Rollup merge of #70470 - GuillaumeGomez:cleanup-e0463, r=Dylan-DPC

Clean up E0463 explanation

r? @Dylan-DPC

4 years agoRollup merge of #70068 - jclulow:illumos-gcc, r=cramertj
Dylan DPC [Fri, 27 Mar 2020 14:09:57 +0000 (15:09 +0100)]
Rollup merge of #70068 - jclulow:illumos-gcc, r=cramertj

use "gcc" instead of "cc" on *-sun-solaris systems when linking

On illumos and Solaris systems, Rust will use GCC as the link editor.
Rust does this by invoking "cc", which on many (Linux and perhaps BSD)
systems is generally either GCC or a GCC-compatible front-end.  On
historical Solaris systems, "cc" was often the Sun Studio compiler.
This history casts a long shadow, and as such, even most modern
illumos-based operating systems tend to install GCC as "gcc", without
also making it available as "cc".

We should invoke GCC as "gcc" on such systems to ensure we get the right
compiler driver.

4 years agoRollup merge of #69887 - GuillaumeGomez:cleanup-e0404, r=Dylan-DPC
Dylan DPC [Fri, 27 Mar 2020 14:09:54 +0000 (15:09 +0100)]
Rollup merge of #69887 - GuillaumeGomez:cleanup-e0404, r=Dylan-DPC

clean up E0404 explanation

r? @Dylan-DPC

4 years agoRollup merge of #65222 - Lucretiel:fold_self, r=kodrAus
Dylan DPC [Fri, 27 Mar 2020 14:09:48 +0000 (15:09 +0100)]
Rollup merge of #65222 - Lucretiel:fold_self, r=kodrAus

Proposal: `fold_self` and `try_fold_self` for Iterators

This pull request proposes & implements two new methods on Iterators: `fold_self` and `try_fold_self`. These are variants of `fold` and `try_fold` that use the first element in the iterator as the initial accumulator.

Let me know if a public feature like this requires an RFC, or if this pull request is sufficient as place for discussion.

4 years agoclean up E0404 explanation
Guillaume Gomez [Tue, 10 Mar 2020 11:54:17 +0000 (12:54 +0100)]
clean up E0404 explanation

4 years agoRefactor changes
PankajChaudhary5 [Fri, 27 Mar 2020 13:46:32 +0000 (19:16 +0530)]
Refactor changes

4 years agoAuto merge of #69916 - oli-obk:mir_bless, r=eddyb
bors [Fri, 27 Mar 2020 12:58:34 +0000 (12:58 +0000)]
Auto merge of #69916 - oli-obk:mir_bless, r=eddyb

Enable blessing of mir opt tests

cc @rust-lang/wg-mir-opt
cc @RalfJung

Long overdue, but now you can finally just add a

```rust
// EMIT_MIR rustc.function_name.MirPassName.before.mir
```

(or `after.mir` since most of the time you want to know the MIR after a pass). A `--bless` invocation will automatically create the files for you.

I suggest we do this for all mir opt tests that have all of the MIR in their source anyway

If you use `rustc.function.MirPass.diff` you only get the diff that the MIR pass causes on the MIR.

Fixes #67865

4 years agoClean up E0463 explanation
Guillaume Gomez [Fri, 27 Mar 2020 12:35:00 +0000 (13:35 +0100)]
Clean up E0463 explanation

4 years agoAuto merge of #70282 - ssomers:btreemap_gdb_pretty_print, r=Mark-Simulacrum
bors [Fri, 27 Mar 2020 09:54:02 +0000 (09:54 +0000)]
Auto merge of #70282 - ssomers:btreemap_gdb_pretty_print, r=Mark-Simulacrum

Test and fix gdb pretty printing more

Over time I had oversimplified the test case for #68098: it does not have an internal node to print so it did not test what it pretended to test. And then I also realized not spotting the same mistake reviewing #70111, and more likely to occur in the wild. Now, both test cases fail if you put back the flawed python code.

r? @Mark-Simulacrum

4 years agoaddress some review comments
Mazdak Farrokhzad [Fri, 27 Mar 2020 06:39:10 +0000 (07:39 +0100)]
address some review comments

4 years agoImplement HashStable directly.
Camille GILLOT [Fri, 27 Mar 2020 07:33:37 +0000 (08:33 +0100)]
Implement HashStable directly.

4 years agoCleanups.
Camille GILLOT [Fri, 27 Mar 2020 06:50:28 +0000 (07:50 +0100)]
Cleanups.

4 years agoMove QueryContext to the parent module.
Camille GILLOT [Fri, 27 Mar 2020 06:43:11 +0000 (07:43 +0100)]
Move QueryContext to the parent module.

4 years agoparse: improve recovery for assoc eq constraints.
Mazdak Farrokhzad [Sun, 22 Mar 2020 05:09:24 +0000 (06:09 +0100)]
parse: improve recovery for assoc eq constraints.

4 years agoextract parse_generic_arg
Mazdak Farrokhzad [Sun, 22 Mar 2020 04:12:51 +0000 (05:12 +0100)]
extract parse_generic_arg

4 years agoparse_angle_arg: parse constraints first
Mazdak Farrokhzad [Sun, 22 Mar 2020 04:01:38 +0000 (05:01 +0100)]
parse_angle_arg: parse constraints first

4 years agosplit parse_angle_args into loop / single step
Mazdak Farrokhzad [Sun, 22 Mar 2020 03:54:46 +0000 (04:54 +0100)]
split parse_angle_args into loop / single step

4 years agoparse: move constraint/arg restriction to ast_validation.
Mazdak Farrokhzad [Sun, 22 Mar 2020 03:40:05 +0000 (04:40 +0100)]
parse: move constraint/arg restriction to ast_validation.

4 years agoRemove the QueryGetter trait.
Camille GILLOT [Fri, 27 Mar 2020 06:35:32 +0000 (07:35 +0100)]
Remove the QueryGetter trait.

4 years agoAuto merge of #69470 - mati865:deps, r=Mark-Simulacrum
bors [Fri, 27 Mar 2020 06:31:49 +0000 (06:31 +0000)]
Auto merge of #69470 - mati865:deps, r=Mark-Simulacrum

Upgrade rustc and bootstrap dependencies

4 years agosuggest semi on expr mac!() good as stmt mac!().
Mazdak Farrokhzad [Thu, 26 Mar 2020 14:54:47 +0000 (15:54 +0100)]
suggest semi on expr mac!()  good as stmt mac!().

4 years agonon-exhastive diagnostic: add note re. scrutinee type
Mazdak Farrokhzad [Fri, 27 Mar 2020 05:44:30 +0000 (06:44 +0100)]
non-exhastive diagnostic: add note re. scrutinee type

4 years agofix suggested changes
PankajChaudhary5 [Fri, 27 Mar 2020 04:23:16 +0000 (09:53 +0530)]
fix suggested changes

4 years agoAuto merge of #68404 - Amanieu:llvm-asm, r=estebank
bors [Fri, 27 Mar 2020 03:27:09 +0000 (03:27 +0000)]
Auto merge of #68404 - Amanieu:llvm-asm, r=estebank

Rename asm! to llvm_asm!

As per https://github.com/rust-lang/rfcs/pull/2843, this PR renames `asm!` to `llvm_asm!`. It also renames the compiler's internal `InlineAsm` data structures to `LlvmInlineAsm` in preparation for the new `asm!` functionality specified in https://github.com/rust-lang/rfcs/pull/2850.

This PR doesn't actually deprecate `asm!` yet, it just makes it redirect to `llvm_asm!`. This is necessary because we first need to update the submodules (in particular stdarch) to use `llvm_asm!`.

4 years agoremove unused import
dylan_DPC [Fri, 27 Mar 2020 02:21:15 +0000 (03:21 +0100)]
remove unused import

4 years agosimplify test
dylan_DPC [Fri, 27 Mar 2020 01:45:56 +0000 (02:45 +0100)]
simplify test

4 years agoRemove `no_integrated_as` mode.
Nicholas Nethercote [Tue, 24 Mar 2020 03:06:47 +0000 (14:06 +1100)]
Remove `no_integrated_as` mode.

Specifically, remove both `-Z no_integrated_as` and
`TargetOptions::no_integrated_as`. The latter was only used for the
`msp430_none_elf` platform, for which it's no longer required.

4 years agoAuto merge of #70451 - Dylan-DPC:rollup-2g9oyht, r=Dylan-DPC
bors [Fri, 27 Mar 2020 00:25:26 +0000 (00:25 +0000)]
Auto merge of #70451 - Dylan-DPC:rollup-2g9oyht, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #69644 (Remove framework in `dataflow/mod.rs` in favor of "generic" one)
 - #69936 (Fix cycle error when emitting suggestion for mismatched `fn` type)
 - #70048 (Allow obtaining &mut OsStr)
 - #70344 (Decouple `rustc_hir::print` into `rustc_hir_pretty`)
 - #70435 (Add regression test for #66706)

Failed merges:

r? @ghost

4 years agoRollup merge of #70435 - Alexendoo:test-66706, r=Centril
Dylan DPC [Fri, 27 Mar 2020 00:23:55 +0000 (01:23 +0100)]
Rollup merge of #70435 - Alexendoo:test-66706, r=Centril

Add regression test for #66706

Adds the two cases that no longer ICE (https://github.com/rust-lang/rust/issues/66706#issuecomment-604098436)

4 years agoRollup merge of #70344 - Centril:hir-pretty, r=eddyb
Dylan DPC [Fri, 27 Mar 2020 00:23:53 +0000 (01:23 +0100)]
Rollup merge of #70344 - Centril:hir-pretty, r=eddyb

Decouple `rustc_hir::print` into `rustc_hir_pretty`

High level summary:
- The HIR pretty printer, `rustc_hir::print` is moved into a new crate `rustc_hir_pretty`.
- `rustc_ast_pretty` and `rustc_errors` are dropped as `rustc_hir` dependencies.
- The dependence on HIR pretty is generally reduced, leaving `rustc_save_analysis`, `rustdoc`, `rustc_metadata`, and `rustc_driver` as the remaining clients.

The main goal here is to reduce `rustc_hir`'s dependencies and its size such that it can start and finish earlier, thereby working towards https://github.com/rust-lang/rust/issues/65031.

r? @Zoxc

4 years agoRollup merge of #70048 - TyPR124:mutable_osstr, r=dtolnay
Dylan DPC [Fri, 27 Mar 2020 00:23:51 +0000 (01:23 +0100)]
Rollup merge of #70048 - TyPR124:mutable_osstr, r=dtolnay

Allow obtaining &mut OsStr

```rust
impl DerefMut for OsString {...}              // type Target = OsStr
impl IndexMut<RangeFull> for OsString {...}   // type Output = OsStr
```

---

This change is pulled out of #69937 per @dtolnay

This implements `DerefMut for OsString` to allow obtaining a `&mut OsStr`. This also implements `IndexMut for OsString`, which is used by `DerefMut`. This pattern is the same as is used by `Deref`.

This is necessary to for methods like `make_ascii_lowercase` which need to mutate the underlying value.

4 years agoRollup merge of #69936 - Aaron1011:fix/suggestion-cycle, r=varkor
Dylan DPC [Fri, 27 Mar 2020 00:23:49 +0000 (01:23 +0100)]
Rollup merge of #69936 - Aaron1011:fix/suggestion-cycle, r=varkor

Fix cycle error when emitting suggestion for mismatched `fn` type

Fixes #66667

Previously, we called `tcx.typeck_tables_of` when determining whether or
not to emit a suggestion for a type error. However, we might already be
type-checking the `DefId` we pass to `typeck_tables_of` (it could be
anywhere in the query stack).

Fortunately, we only need the function signature, not the entire
`TypeckTables`. By using `tcx.fn_sig`, we avoid the possibility of cycle
errors while retaining the ability to emit a suggestion.

4 years agoRollup merge of #69644 - ecstatic-morse:unified-dataflow-cleanup, r=eddyb
Dylan DPC [Fri, 27 Mar 2020 00:23:47 +0000 (01:23 +0100)]
Rollup merge of #69644 - ecstatic-morse:unified-dataflow-cleanup, r=eddyb

Remove framework in `dataflow/mod.rs` in favor of "generic" one

This is the culmination of the work described in rust-lang/compiler-team#202. All dataflow analyses (including the one in `clippy`) have been ported to use the framework in `dataflow/generic`, which can efficiently handle both gen/kill and generic problems. This PR moves the framework in `dataflow/generic` to `dataflow/framework`, and removes the gen/kill framework in `dataflow/mod.rs`.

More comprehensive documentation for the new framework is tracked in rust-lang/rustc-guide#564.

`clippy` will need to change the path it uses to import the dataflow analysis traits.

4 years agoMake `framework` a private module
Dylan MacKenzie [Mon, 2 Mar 2020 17:43:18 +0000 (09:43 -0800)]
Make `framework` a private module

4 years agoUpdate `framework` module docs
Dylan MacKenzie [Mon, 2 Mar 2020 17:40:58 +0000 (09:40 -0800)]
Update `framework` module docs

4 years agoMove `BottomValue` into `framework/mod.rs`
Dylan MacKenzie [Mon, 2 Mar 2020 17:32:12 +0000 (09:32 -0800)]
Move `BottomValue` into `framework/mod.rs`

4 years agoUpdate imports from `dataflow::generic` to `dataflow`
Dylan MacKenzie [Sat, 29 Feb 2020 06:02:20 +0000 (22:02 -0800)]
Update imports from `dataflow::generic` to `dataflow`

4 years agoUpdate use statements in `dataflow/mod.rs`
Dylan MacKenzie [Sat, 29 Feb 2020 05:55:41 +0000 (21:55 -0800)]
Update use statements in `dataflow/mod.rs`

4 years agoRename `dataflow::generic` to `dataflow::framework`
Dylan MacKenzie [Sat, 29 Feb 2020 05:49:33 +0000 (21:49 -0800)]
Rename `dataflow::generic` to `dataflow::framework`

4 years agoMove `MoveDataParamEnv` to beginning of module
Dylan MacKenzie [Sat, 29 Feb 2020 05:47:36 +0000 (21:47 -0800)]
Move `MoveDataParamEnv` to beginning of module

4 years agoRemove `BitDenotation` framework
Dylan MacKenzie [Sat, 29 Feb 2020 05:42:20 +0000 (21:42 -0800)]
Remove `BitDenotation` framework

4 years agoTest and fix gdb pretty printing again
Stein Somers [Sun, 22 Mar 2020 20:10:48 +0000 (20:10 +0000)]
Test and fix gdb pretty printing again

4 years agofix docs
dylan_DPC [Thu, 26 Mar 2020 22:18:37 +0000 (23:18 +0100)]
fix docs

4 years agoCreate output dir in rustdoc markdown render
Timothée Gerber [Thu, 26 Mar 2020 21:57:33 +0000 (22:57 +0100)]
Create output dir in rustdoc markdown render

4 years agoAuto merge of #70441 - Dylan-DPC:rollup-qv7h2ph, r=Dylan-DPC
bors [Thu, 26 Mar 2020 20:45:47 +0000 (20:45 +0000)]
Auto merge of #70441 - Dylan-DPC:rollup-qv7h2ph, r=Dylan-DPC

Rollup of 6 pull requests

Successful merges:

 - #70384 (Refactor object file handling)
 - #70397 (add 'fn write_u16s' to Memory)
 - #70413 (Fix incorrect pattern warning "unreachable pattern")
 - #70428 (`error_bad_item_kind`: add help text)
 - #70429 (Clean up E0459 explanation)
 - #70437 (Miri float->int casts: be explicit that this is saturating)

Failed merges:

r? @ghost

4 years agoRollup merge of #70437 - RalfJung:miri-saturate, r=hanna-kruppe
Dylan DPC [Thu, 26 Mar 2020 20:44:09 +0000 (21:44 +0100)]
Rollup merge of #70437 - RalfJung:miri-saturate, r=hanna-kruppe

Miri float->int casts: be explicit that this is saturating

r? @hanna-kruppe
Cc https://github.com/rust-lang/miri/issues/1264

4 years agoRollup merge of #70429 - GuillaumeGomez:cleanup-e0459, r=Dylan-DPC
Dylan DPC [Thu, 26 Mar 2020 20:44:08 +0000 (21:44 +0100)]
Rollup merge of #70429 - GuillaumeGomez:cleanup-e0459, r=Dylan-DPC

Clean up E0459 explanation

r? @Dylan-DPC