]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agoRollup merge of #65074 - Rantanen:json-byte-pos, r=matklad
Mazdak Farrokhzad [Fri, 25 Oct 2019 11:12:45 +0000 (13:12 +0200)]
Rollup merge of #65074 - Rantanen:json-byte-pos, r=matklad

Fix the start/end byte positions in the compiler JSON output

Track the changes made during normalization in the `SourceFile` and use this information to correct the `start_byte` and `end_byte` fields in the JSON output.

This should ensure the start/end byte fields can be used to index the original file, even if Rust normalized the source code for parsing purposes. Both CRLF to LF and BOM removal are handled with this one.

The rough plan was discussed with @matklad in rust-lang-nursery/rustfix#176 - although I ended up going with `u32` offset tracking so I wouldn't need to deal with `u32 + i32` arithmetics when applying the offset to the span byte positions.

Fixes #65029

4 years agoRollup merge of #64639 - davidtwco:rfc-2008-stabilization, r=Centril
Mazdak Farrokhzad [Fri, 25 Oct 2019 11:12:43 +0000 (13:12 +0200)]
Rollup merge of #64639 - davidtwco:rfc-2008-stabilization, r=Centril

Stabilize `#[non_exhaustive]` (RFC 2008)

Fixes #44109.

This pull request stabilizes the `#[non_exhaustive]` attribute, which is used to indicate that a type will have more fields / variants added in the future. It can be applied to `struct`s, `enum`s and `enum` variants. See https://github.com/rust-lang/rust/issues/44109#issuecomment-533356866 for the stabilization report.

r? @Centril

4 years agoRFC 2008: Stabilization
David Wood [Fri, 20 Sep 2019 20:09:39 +0000 (21:09 +0100)]
RFC 2008: Stabilization

This commit stabilizes RFC 2008 (#44109) by removing the feature gate.

Signed-off-by: David Wood <david@davidtw.co>
4 years agoAuto merge of #65764 - Manishearth:clippyup, r=Manishearth
bors [Fri, 25 Oct 2019 07:47:13 +0000 (07:47 +0000)]
Auto merge of #65764 - Manishearth:clippyup, r=Manishearth

Update clippy

Fixes #65754

r? @ghost

4 years agoAuto merge of #65793 - Centril:rollup-v40xke9, r=Centril
bors [Fri, 25 Oct 2019 04:24:40 +0000 (04:24 +0000)]
Auto merge of #65793 - Centril:rollup-v40xke9, r=Centril

Rollup of 9 pull requests

Successful merges:

 - #62959 (Add by-value iterator for arrays )
 - #65390 (Add long error explanation for E0576)
 - #65408 (reorder config.toml.example options and add one missing option)
 - #65414 (ignore uninhabited non-exhaustive variant fields)
 - #65666 (Deprecated proc_macro doesn't trigger warning on build library)
 - #65742 (Pre-expansion gate most of the things)
 - #65747 (Adjust the tracking issue for `untagged_unions`.)
 - #65763 (Changed APIT with explicit generic args span to specific arg spans)
 - #65775 (Fix more `ReEmpty` ICEs)

Failed merges:

 - #65519 (trait-based structural match implementation)

r? @ghost

4 years agoRollup merge of #65775 - matthewjasper:reempty, r=pnkfelix
Mazdak Farrokhzad [Fri, 25 Oct 2019 04:18:14 +0000 (06:18 +0200)]
Rollup merge of #65775 - matthewjasper:reempty, r=pnkfelix

Fix more `ReEmpty` ICEs

closes #65553

r? @pnkfelix

4 years agoRollup merge of #65763 - ObsidianMinor:diag/65642, r=varkor
Mazdak Farrokhzad [Fri, 25 Oct 2019 04:18:12 +0000 (06:18 +0200)]
Rollup merge of #65763 - ObsidianMinor:diag/65642, r=varkor

Changed APIT with explicit generic args span to specific arg spans

Fixes #65642.

4 years agoRollup merge of #65747 - Centril:union-issue-fix, r=varkor
Mazdak Farrokhzad [Fri, 25 Oct 2019 04:18:11 +0000 (06:18 +0200)]
Rollup merge of #65747 - Centril:union-issue-fix, r=varkor

Adjust the tracking issue for `untagged_unions`.

Makes https://github.com/rust-lang/rust/issues/55149 the new tracking issue for `untagged_unions`.
Closes https://github.com/rust-lang/rust/issues/32836 which is the old tracking issue.

r? @varkor

4 years agoRollup merge of #65742 - Centril:gate-pre-expansion-subset, r=davidtwco
Mazdak Farrokhzad [Fri, 25 Oct 2019 04:18:09 +0000 (06:18 +0200)]
Rollup merge of #65742 - Centril:gate-pre-expansion-subset, r=davidtwco

Pre-expansion gate most of the things

This is a subset of https://github.com/rust-lang/rust/pull/64672. A crater run has already been done and this PR implements conclusions according to https://github.com/rust-lang/rust/pull/64672#issuecomment-542703363.

r? @davidtwco
cc @petrochenkov

4 years agoRollup merge of #65666 - XiangQingW:proc_macro, r=petrochenkov
Mazdak Farrokhzad [Fri, 25 Oct 2019 04:18:08 +0000 (06:18 +0200)]
Rollup merge of #65666 - XiangQingW:proc_macro, r=petrochenkov

Deprecated proc_macro doesn't trigger warning on build library

Fix #65189

4 years agoRollup merge of #65414 - davidtwco:issue-65157-non-exhaustive-always-useful, r=varkor
Mazdak Farrokhzad [Fri, 25 Oct 2019 04:18:06 +0000 (06:18 +0200)]
Rollup merge of #65414 - davidtwco:issue-65157-non-exhaustive-always-useful, r=varkor

ignore uninhabited non-exhaustive variant fields

Fixes #65157.

This PR modifies the uninhabitedness checking so that the fields of
a non-exhaustive variant (which is not local) are ignored if they are
uninhabited. This is an improvement over the previous behaviour which
considered all non-local non-exhaustive variants useful because
unreachable patterns are now detected.

r? @arielb1
cc @varkor

4 years agoRollup merge of #65408 - guanqun:remove-rust-optimize, r=Mark-Simulacrum
Mazdak Farrokhzad [Fri, 25 Oct 2019 04:18:04 +0000 (06:18 +0200)]
Rollup merge of #65408 - guanqun:remove-rust-optimize, r=Mark-Simulacrum

reorder config.toml.example options and add one missing option

r? @Mark-Simulacrum

4 years agoRollup merge of #65390 - GuillaumeGomez:long-err-explanation-E0576, r=matthewjasper...
Mazdak Farrokhzad [Fri, 25 Oct 2019 04:18:02 +0000 (06:18 +0200)]
Rollup merge of #65390 - GuillaumeGomez:long-err-explanation-E0576, r=matthewjasper,kinnison

Add long error explanation for E0576

Part of #61137.

4 years agoRollup merge of #62959 - LukasKalbertodt:array-value-iter, r=scottmcm
Mazdak Farrokhzad [Fri, 25 Oct 2019 04:18:01 +0000 (06:18 +0200)]
Rollup merge of #62959 - LukasKalbertodt:array-value-iter, r=scottmcm

Add by-value iterator for arrays

This adds an iterator that can iterate over arrays by value, yielding all elements by value. However, **this PR does _not_ add a corresponding `IntoIterator` impl for arrays**. The `IntoIterator` impl needs some discussion about backwards-compatibility that should take place in a separate PR. With this patch, this code should work (but there is currently still a bug):

```rust
#![feature(array_value_iter)]
use std::array::IntoIter;

let arr = [1, 2, 3];
for x in IntoIter::new(arr) {
    println!("{}", x);
}
```

**TODO**:
- [x] Get initial feedback
- [x] Add tests
- [x] Figure out why stage1 produces weird bugs ([comment](https://github.com/rust-lang/rust/pull/62959#issuecomment-516016524))
- [x] Add UI tests as mentioned [here](https://github.com/rust-lang/rust/pull/62959#discussion_r307061894) (will do that soon-ish)
- [x] Fix [this new bug](https://github.com/rust-lang/rust/pull/62959#issuecomment-544732159)

**Notes for reviewers**
- Is the use of `MaybeUninit` correct here? I think it has to be used due to the `Clone` impl which has to fill the dead array elements with something, but cannot fill it with a correct instance.
- Are the unit tests sufficient?

CC #25725

4 years agoAuto merge of #65771 - Centril:rollup-upfsvrb, r=Centril
bors [Fri, 25 Oct 2019 00:40:55 +0000 (00:40 +0000)]
Auto merge of #65771 - Centril:rollup-upfsvrb, r=Centril

Rollup of 8 pull requests

Successful merges:

 - #65625 (Turn crate store into a resolver output)
 - #65627 (Forbid non-`structural_match` types in const generics)
 - #65710 (Update cargo)
 - #65729 (Update test cases for vxWorks)
 - #65746 (Tweak format string error to point at arguments always)
 - #65753 (Don't assert for different instance on impl trait alias)
 - #65755 (Avoid ICE when adjusting bad self ty)
 - #65766 (Update hashbrown to 0.6.2)

Failed merges:

r? @ghost

4 years agoFix more `ReEmpty` ICEs
Matthew Jasper [Sun, 20 Oct 2019 21:08:44 +0000 (22:08 +0100)]
Fix more `ReEmpty` ICEs

4 years agoRollup merge of #65766 - alexcrichton:less-inline-hashbrown, r=Mark-Simulacrum
Mazdak Farrokhzad [Thu, 24 Oct 2019 18:20:10 +0000 (20:20 +0200)]
Rollup merge of #65766 - alexcrichton:less-inline-hashbrown, r=Mark-Simulacrum

Update hashbrown to 0.6.2

Pulls in rust-lang/hashbrown#119 which should be a good improvement for
compile times of hashmap-heavy crates.

4 years agoRollup merge of #65755 - estebank:icicle, r=davidtwco
Mazdak Farrokhzad [Thu, 24 Oct 2019 18:20:08 +0000 (20:20 +0200)]
Rollup merge of #65755 - estebank:icicle, r=davidtwco

Avoid ICE when adjusting bad self ty

Fix #65611.

4 years agoRollup merge of #65753 - csmoe:derive_fold, r=Centril
Mazdak Farrokhzad [Thu, 24 Oct 2019 18:20:07 +0000 (20:20 +0200)]
Rollup merge of #65753 - csmoe:derive_fold, r=Centril

Don't assert for different instance on impl trait alias

Closes https://github.com/rust-lang/rust/issues/65679
r? @Centril @nikomatsakis

4 years agoRollup merge of #65746 - estebank:newcomer-format, r=Centril
Mazdak Farrokhzad [Thu, 24 Oct 2019 18:20:05 +0000 (20:20 +0200)]
Rollup merge of #65746 - estebank:newcomer-format, r=Centril

Tweak format string error to point at arguments always

Add secondary span labels with no text to make it clear when there's a
mismatch bewteen the positional arguments in a format string and the
arguments to the macro. This shouldn't affect experienced users, but it
should make it easier for newcomers to more clearly understand how
`format!()` and `println!()` are supposed to be used.

```
error: 2 positional arguments in format string, but there is 1 argument
 --> file8.rs:2:14
  |
2 |     format!("{} {}", 1);
  |              ^^ ^^   -
```

instead of

```
error: 2 positional arguments in format string, but there is 1 argument
 --> file8.rs:2:14
  |
2 |     format!("{} {}", 1);
  |              ^^ ^^
```

r? @Centril

4 years agoRollup merge of #65729 - Wind-River:master_003, r=alexcrichton
Mazdak Farrokhzad [Thu, 24 Oct 2019 18:20:04 +0000 (20:20 +0200)]
Rollup merge of #65729 - Wind-River:master_003, r=alexcrichton

Update test cases for vxWorks

4 years agoRollup merge of #65710 - ehuss:update-cargo, r=alexcrichton
Mazdak Farrokhzad [Thu, 24 Oct 2019 18:20:02 +0000 (20:20 +0200)]
Rollup merge of #65710 - ehuss:update-cargo, r=alexcrichton

Update cargo

6 commits in 3a9abe3f065554a7fbc59f440df2baba4a6e47ee..3ba5f27170db10af7a92f2b682e049397197b8fa
2019-10-15 15:55:35 +0000 to 2019-10-22 15:05:18 +0000
- Fix typo in `cargo install --profile` help (rust-lang/cargo#7532)
- Use stricter -Z flag parsing. (rust-lang/cargo#7531)
- Set timestamp on generated files in archive to now (rust-lang/cargo#7523)
- Support rustc's `-Z panic-abort-tests` in Cargo (rust-lang/cargo#7460)
- rustfmt for nightly changes. (rust-lang/cargo#7526)
- Allow --all-features in root of virtual workspace. (rust-lang/cargo#7525)

4 years agoRollup merge of #65627 - varkor:const-generics-forbid-non-structural_match, r=petroch...
Mazdak Farrokhzad [Thu, 24 Oct 2019 18:20:01 +0000 (20:20 +0200)]
Rollup merge of #65627 - varkor:const-generics-forbid-non-structural_match, r=petrochenkov

Forbid non-`structural_match` types in const generics

Fixes https://github.com/rust-lang/rust/issues/60286.

4 years agoRollup merge of #65625 - petrochenkov:cstore, r=Mark-Simulacrum,Zoxc
Mazdak Farrokhzad [Thu, 24 Oct 2019 18:19:59 +0000 (20:19 +0200)]
Rollup merge of #65625 - petrochenkov:cstore, r=Mark-Simulacrum,Zoxc

Turn crate store into a resolver output

Crate store (`CStore`) is a vector of data (`CrateMetadata`) associated with extern crates loaded during the current compilation session.

All crates are loaded in the resolver when resolving either paths pointing to extern prelude or `extern crate` items. (There are also a couple of crates like panic runtime that are loaded kind of like implicit `extern crate`s, but that also happens in resolve.)

The use of `CStore` from `rustc_plugin` (which is outside of the resolver) was unnecessary because legacy plugins are not added to the crate store and don't use `CrateNum`s.

So, `CStore` can be produced by the resolver instead of being kept in some really global data (`rustc_interface::Compiler`) like now.

As a result of crate store being more "local" we can now remove some locks and `Lrc`s.

4 years agorustc_interface: Remove `ExpansionResult` and some `Steal`s
Vadim Petrochenkov [Mon, 21 Oct 2019 20:32:51 +0000 (23:32 +0300)]
rustc_interface: Remove `ExpansionResult` and some `Steal`s

4 years agorustc_metadata: Minimize use of `Lrc` in crate store
Vadim Petrochenkov [Sun, 20 Oct 2019 11:06:48 +0000 (14:06 +0300)]
rustc_metadata: Minimize use of `Lrc` in crate store

Crate metadatas are still stored as `Lrc<CrateMetadata>` in `CStore` because crate store has to be cloneable due to `Resolver::clone_outputs`.

4 years agorustc_metadata: Remove `RwLock` from `CStore`
Vadim Petrochenkov [Sun, 20 Oct 2019 09:49:14 +0000 (12:49 +0300)]
rustc_metadata: Remove `RwLock` from `CStore`

4 years agoTurn crate store into a resolver output
Vadim Petrochenkov [Sun, 20 Oct 2019 00:28:36 +0000 (03:28 +0300)]
Turn crate store into a resolver output

4 years agorustc: Combine resolver outputs into a single struct
Vadim Petrochenkov [Sun, 20 Oct 2019 00:19:12 +0000 (03:19 +0300)]
rustc: Combine resolver outputs into a single struct

4 years agoresolve: Privatize all resolver fields
Vadim Petrochenkov [Sat, 19 Oct 2019 23:55:39 +0000 (02:55 +0300)]
resolve: Privatize all resolver fields

4 years agorustc: Add a convenience alias for `dyn MetadataLoader + Sync`
Vadim Petrochenkov [Thu, 17 Oct 2019 18:26:13 +0000 (21:26 +0300)]
rustc: Add a convenience alias for `dyn MetadataLoader + Sync`

4 years agorustc_metadata: Move some code around
Vadim Petrochenkov [Thu, 17 Oct 2019 16:08:06 +0000 (19:08 +0300)]
rustc_metadata: Move some code around

Plugin search doesn't need a crate loader, only crate locator

4 years agorustc_metadata: Remove unnecessary use of crate store in plugin loader
Vadim Petrochenkov [Wed, 16 Oct 2019 16:57:10 +0000 (19:57 +0300)]
rustc_metadata: Remove unnecessary use of crate store in plugin loader

4 years agorustc_driver: Remove unnecessary use of crate store
Vadim Petrochenkov [Wed, 16 Oct 2019 16:03:21 +0000 (19:03 +0300)]
rustc_driver: Remove unnecessary use of crate store

4 years agoDon't assert for different instance on impl trait alias
csmoe [Thu, 24 Oct 2019 06:25:23 +0000 (14:25 +0800)]
Don't assert for different instance on impl trait alias

4 years agoAuto merge of #65762 - mati865:msys2-bug, r=pietroalbini
bors [Thu, 24 Oct 2019 16:08:03 +0000 (16:08 +0000)]
Auto merge of #65762 - mati865:msys2-bug, r=pietroalbini

workaround msys2 bug

4 years agoworkaround msys2 bug
Mateusz Mikuła [Thu, 24 Oct 2019 14:47:56 +0000 (16:47 +0200)]
workaround msys2 bug

Co-Authored-By: Pietro Albini <pietro@pietroalbini.org>
4 years agoreorder TomlTarget struct's fields based on the order in config.toml.example
Guanqun Lu [Thu, 24 Oct 2019 15:54:31 +0000 (23:54 +0800)]
reorder TomlTarget struct's fields based on the order in config.toml.example

4 years agoreorder Rust struct's fields based on the order in config.toml.example
Guanqun Lu [Thu, 24 Oct 2019 15:53:45 +0000 (23:53 +0800)]
reorder Rust struct's fields based on the order in config.toml.example

4 years agoreorder Install struct's fields based on the order in config.toml.example
Guanqun Lu [Thu, 24 Oct 2019 15:51:02 +0000 (23:51 +0800)]
reorder Install struct's fields based on the order in config.toml.example

4 years agoreorder Build struct's fields based on the order in config.toml.example
Guanqun Lu [Thu, 24 Oct 2019 15:50:03 +0000 (23:50 +0800)]
reorder Build struct's fields based on the order in config.toml.example

4 years agoreorder Llvm struct's fields based on the order in config.toml.example
Guanqun Lu [Thu, 24 Oct 2019 15:46:05 +0000 (23:46 +0800)]
reorder Llvm struct's fields based on the order in config.toml.example

4 years agoadd the missing rust.musl-root option in config.toml.example
Guanqun Lu [Thu, 24 Oct 2019 15:43:06 +0000 (23:43 +0800)]
add the missing rust.musl-root option in config.toml.example

4 years agoadd a WARNING to rust.optimize option in config.toml.example
Guanqun Lu [Thu, 24 Oct 2019 15:41:48 +0000 (23:41 +0800)]
add a WARNING to rust.optimize option in config.toml.example

4 years agoUpdate clippy
Manish Goregaokar [Thu, 24 Oct 2019 15:06:40 +0000 (08:06 -0700)]
Update clippy

4 years agoUpdate hashbrown to 0.6.2
Alex Crichton [Thu, 24 Oct 2019 15:07:03 +0000 (08:07 -0700)]
Update hashbrown to 0.6.2

Pulls in rust-lang/hashbrown#119 which should be a good improvement for
compile times of hashmap-heavy crates.

4 years agoChanged APIT with explicit generic args span to specific arg spans
Sydney Acksman [Thu, 24 Oct 2019 14:46:19 +0000 (09:46 -0500)]
Changed APIT with explicit generic args span to specific arg spans

4 years agoAdd UI tests for `array::IntoIter` impls
Lukas Kalbertodt [Mon, 21 Oct 2019 11:47:02 +0000 (13:47 +0200)]
Add UI tests for `array::IntoIter` impls

This it to make sure traits are implemented for arrays with length 32
and below, while they are not implemented for >= 33.

4 years agoAdd unit tests for `array::IntoIter`
Lukas Kalbertodt [Fri, 26 Jul 2019 11:27:13 +0000 (13:27 +0200)]
Add unit tests for `array::IntoIter`

Many tests are based on tests by Josh Stone <cuviper@gmail.com>

4 years agoAdd `array::IntoIter` as a consuming/by-value array iterator
Lukas Kalbertodt [Wed, 24 Jul 2019 22:39:39 +0000 (00:39 +0200)]
Add `array::IntoIter` as a consuming/by-value array iterator

The iterator is implemented using const generics. It implements the
traits `Iterator`, `DoubleEndedIterator`, `ExactSizeIterator`,
`FusedIterator` and `TrustedLen`. It also contains a public method
`new` to create it from an array.

`IntoIterator` was not implemented for arrays yet, as there are still
some open questions regarding backwards compatibility. This commit
only adds the iterator impl and does not yet offer a convenient way
to obtain that iterator.

4 years agoAvoid ICE when adjusting bad self ty
Esteban Küber [Thu, 24 Oct 2019 07:37:32 +0000 (00:37 -0700)]
Avoid ICE when adjusting bad self ty

4 years agoAuto merge of #65474 - Mark-Simulacrum:rustc-dev-split, r=pietroalbini
bors [Thu, 24 Oct 2019 07:27:00 +0000 (07:27 +0000)]
Auto merge of #65474 - Mark-Simulacrum:rustc-dev-split, r=pietroalbini

Split the rustc target libraries into separate rustc-dev component

This is re-applies a squashed version of #64823 as well as including #65337 to fix bugs noted after merging the first PR.

The second PR is confirmed as fixing windows-gnu, and presumably also fixes other platforms, such as musl (i.e. #65335 should be fixed); `RUSTUP_DIST_SERVER=https://dev-static.rust-lang.org rustup toolchain install nightly-2019-10-16` can be installed to confirm that this is indeed the case.

4 years agoDeprecated proc_macro doesn't trigger warning on build library
wangxiangqing [Mon, 21 Oct 2019 16:08:14 +0000 (00:08 +0800)]
Deprecated proc_macro doesn't trigger warning on build library

Change-Id: Ib3a396e7334d209fe6c6ef425bbfc7b2ae471378

4 years agoAuto merge of #65733 - Centril:rollup-0zth66f, r=Centril
bors [Thu, 24 Oct 2019 03:38:57 +0000 (03:38 +0000)]
Auto merge of #65733 - Centril:rollup-0zth66f, r=Centril

Rollup of 12 pull requests

Successful merges:

 - #64178 (More Clippy fixes for alloc, core and std)
 - #65144 (Add Cow::is_borrowed and Cow::is_owned)
 - #65193 (Lockless LintStore)
 - #65479 (Add the `matches!( $expr, $pat ) -> bool` macro)
 - #65518 (Avoid ICE when checking `Destination` of `break` inside a closure)
 - #65583 (rustc_metadata: use a table for super_predicates, fn_sig, impl_trait_ref.)
 - #65641 (Derive `Rustc{En,De}codable` for `TokenStream`.)
 - #65648 (Eliminate `intersect_opt`.)
 - #65657 (Remove `InternedString`)
 - #65691 (Update E0659 error code long explanation to 2018 edition)
 - #65696 (Fix an issue with const inference variables sticking around under Chalk + NLL)
 - #65704 (relax ExactSizeIterator bound on write_bytes)

Failed merges:

r? @ghost

4 years agoTweak format string error to point at arguments always
Esteban Küber [Thu, 24 Oct 2019 00:32:33 +0000 (17:32 -0700)]
Tweak format string error to point at arguments always

Add secondary span labels with no text to make it clear when there's a
mismatch bewteen the positional arguments in a format string and the
arguments to the macro. This shouldn't affect experienced users, but it
should make it easier for newcomers to more clearly understand how
`format!()` and `println!()` are supposed to be used.

```
error: 2 positional arguments in format string, but there is 1 argument
 --> file8.rs:2:14
  |
2 |     format!("{} {}", 1);
  |              ^^ ^^   -
```

instead of

```
error: 2 positional arguments in format string, but there is 1 argument
 --> file8.rs:2:14
  |
2 |     format!("{} {}", 1);
  |              ^^ ^^
```

4 years agoAdjust the tracking issue for `untagged_unions`.
Mazdak Farrokhzad [Thu, 24 Oct 2019 00:24:14 +0000 (02:24 +0200)]
Adjust the tracking issue for `untagged_unions`.
Also elaborate on some feature gates in `active.rs`.

4 years agopre-expansion gate type_ascription
Mazdak Farrokhzad [Sat, 21 Sep 2019 22:19:02 +0000 (00:19 +0200)]
pre-expansion gate type_ascription

4 years agopre-expansion gate box_syntax
Mazdak Farrokhzad [Sat, 21 Sep 2019 22:06:51 +0000 (00:06 +0200)]
pre-expansion gate box_syntax

4 years agopre-expansion gate label_break_value
Mazdak Farrokhzad [Sat, 21 Sep 2019 21:54:05 +0000 (23:54 +0200)]
pre-expansion gate label_break_value

4 years agodedup GAT gate checks
Mazdak Farrokhzad [Sat, 21 Sep 2019 21:39:15 +0000 (23:39 +0200)]
dedup GAT gate checks

4 years agopre-expansion gate try_blocks
Mazdak Farrokhzad [Sat, 21 Sep 2019 21:09:17 +0000 (23:09 +0200)]
pre-expansion gate try_blocks

4 years agopre-expansion gate exclusive_range_pattern
Mazdak Farrokhzad [Sat, 21 Sep 2019 18:11:00 +0000 (20:11 +0200)]
pre-expansion gate exclusive_range_pattern

4 years agopre-expansion gate box_patterns
Mazdak Farrokhzad [Sat, 21 Sep 2019 17:49:54 +0000 (19:49 +0200)]
pre-expansion gate box_patterns

4 years agopre-expansion gate decl_macro
Mazdak Farrokhzad [Sat, 21 Sep 2019 17:18:41 +0000 (19:18 +0200)]
pre-expansion gate decl_macro

4 years agopre-expansion gate const_generics
Mazdak Farrokhzad [Sat, 21 Sep 2019 16:58:17 +0000 (18:58 +0200)]
pre-expansion gate const_generics

4 years agopre-expansion gate crate_visibility_modifier
Mazdak Farrokhzad [Sat, 21 Sep 2019 16:22:17 +0000 (18:22 +0200)]
pre-expansion gate crate_visibility_modifier

4 years agopre-expansion gate associated_type_bounds
Mazdak Farrokhzad [Sat, 21 Sep 2019 16:05:26 +0000 (18:05 +0200)]
pre-expansion gate associated_type_bounds

4 years agopre-expansion gate trait_alias.
Mazdak Farrokhzad [Sat, 21 Sep 2019 15:40:50 +0000 (17:40 +0200)]
pre-expansion gate trait_alias.

4 years agosyntax: reject `trait Foo: Bar = Baz;`.
Mazdak Farrokhzad [Sat, 21 Sep 2019 15:18:08 +0000 (17:18 +0200)]
syntax: reject `trait Foo: Bar = Baz;`.

Add test for rejecting `trait A: B1 = B2;`.
Also test rejection of `trait A: = B;`.

4 years agoignore uninhabited non-exhaustive variant fields
David Wood [Mon, 14 Oct 2019 17:55:32 +0000 (18:55 +0100)]
ignore uninhabited non-exhaustive variant fields

This commit modifies the uninhabitedness checking so that the fields of
a non-exhaustive variant (which is not local) are ignored if they are
uninhabited. This is an improvement over the previous behaviour which
considered all non-local non-exhaustive variants useful because
unreachable patterns are now detected.

Signed-off-by: David Wood <david@davidtw.co>
4 years agoRollup merge of #65704 - RalfJung:exact-size, r=oli-obk
Mazdak Farrokhzad [Wed, 23 Oct 2019 20:19:24 +0000 (22:19 +0200)]
Rollup merge of #65704 - RalfJung:exact-size, r=oli-obk

relax ExactSizeIterator bound on write_bytes

Too many iterators don't have that bound. Instead we do run-time checks.

r? @oli-obk

4 years agoRollup merge of #65696 - varkor:nll-chalk-const-generics-issue, r=eddyb
Mazdak Farrokhzad [Wed, 23 Oct 2019 20:19:22 +0000 (22:19 +0200)]
Rollup merge of #65696 - varkor:nll-chalk-const-generics-issue, r=eddyb

Fix an issue with const inference variables sticking around under Chalk + NLL

Fixes https://github.com/rust-lang/rust/issues/65675.
Fixes https://github.com/rust-lang/rust/issues/62579.

r? @eddyb
cc @LukasKalbertodt @skinny121

4 years agoRollup merge of #65691 - GuillaumeGomez:2018-edition-E0659, r=Dylan-DPC
Mazdak Farrokhzad [Wed, 23 Oct 2019 20:19:21 +0000 (22:19 +0200)]
Rollup merge of #65691 - GuillaumeGomez:2018-edition-E0659, r=Dylan-DPC

Update E0659 error code long explanation to 2018 edition

Fixes #65571

r? @Centril

4 years agoRollup merge of #65657 - nnethercote:rm-InternedString-properly, r=eddyb
Mazdak Farrokhzad [Wed, 23 Oct 2019 20:19:19 +0000 (22:19 +0200)]
Rollup merge of #65657 - nnethercote:rm-InternedString-properly, r=eddyb

Remove `InternedString`

This PR removes `InternedString` by converting all occurrences to `Symbol`. There are a handful of places that need to use the symbol chars instead of the symbol index, e.g. for stable sorting; local conversions `LocalInternedString` is used in those places.

r? @eddyb

4 years agoRollup merge of #65648 - nnethercote:rm-intersect_opt, r=nikomatsakis
Mazdak Farrokhzad [Wed, 23 Oct 2019 20:19:17 +0000 (22:19 +0200)]
Rollup merge of #65648 - nnethercote:rm-intersect_opt, r=nikomatsakis

Eliminate `intersect_opt`.

Its fourth argument is always `Some(pred)`, so the pattern matching is
unnecessary. This commit inlines and removes it.

r? @nikomatsakis

4 years agoRollup merge of #65641 - nnethercote:derive-TokenStream-Encodable-Decodable, r=petroc...
Mazdak Farrokhzad [Wed, 23 Oct 2019 20:19:16 +0000 (22:19 +0200)]
Rollup merge of #65641 - nnethercote:derive-TokenStream-Encodable-Decodable, r=petrochenkov

Derive `Rustc{En,De}codable` for `TokenStream`.

`TokenStream` used to be a complex type, but it is now just a newtype
around a `Lrc<Vec<TreeAndJoint>>`. Currently it uses custom encoding
that discards the `IsJoint` and custom decoding that adds `NonJoint`
back in for every token tree. This requires building intermediate
`Vec<TokenTree>`s.

This commit makes `TokenStream` derive `Rustc{En,De}codable`. This
simplifies the code, and avoids the creation of the intermediate
vectors, saving up to 3% on various benchmarks. It also changes the AST
JSON output in one test.

r? @petrochenkov

4 years agoRollup merge of #65583 - eddyb:more-query-like-cross-crate-tables, r=michaelwoerister
Mazdak Farrokhzad [Wed, 23 Oct 2019 20:19:14 +0000 (22:19 +0200)]
Rollup merge of #65583 - eddyb:more-query-like-cross-crate-tables, r=michaelwoerister

rustc_metadata: use a table for super_predicates, fn_sig, impl_trait_ref.

This is an attempt at a part of #65407, i.e. moving parts of cross-crate "metadata" into tables that match queries more closely.

Three new tables should be enough to see some perf/metadata size changes.
(need to do something similar to https://github.com/rust-lang/rust/pull/59953#issuecomment-542521919)

There are other bits of data that could be made into tables, but they can be more compact so the impact would likely be not as bad, and they're also more work to set up.

4 years agoRollup merge of #65518 - estebank:i-want-to-break-free, r=eddyb
Mazdak Farrokhzad [Wed, 23 Oct 2019 20:19:13 +0000 (22:19 +0200)]
Rollup merge of #65518 - estebank:i-want-to-break-free, r=eddyb

Avoid ICE when checking `Destination` of `break` inside a closure

Fix #65383, fix #62480. This is a `[regression-from-stable-to-stable]` and a fairly small change to avoid the ICE by properly handling this case.

4 years agoRollup merge of #65479 - SimonSapin:matches, r=alexcrichton
Mazdak Farrokhzad [Wed, 23 Oct 2019 20:19:11 +0000 (22:19 +0200)]
Rollup merge of #65479 - SimonSapin:matches, r=alexcrichton

Add the `matches!( $expr, $pat ) -> bool` macro

# Motivation

This macro is:

* General-purpose (not domain-specific)
* Simple (the implementation is short)
* Very popular [on crates.io](https://crates.io/crates/matches) (currently 37th in all-time downloads)
* The two previous points combined make it number one in [left-pad index](https://twitter.com/bascule/status/1184523027888988160) score

As such, I feel it is a good candidate for inclusion in the standard library.

In fact I already felt that way five years ago: https://github.com/rust-lang/rust/pull/14685 (Although the proof of popularity was not as strong at the time.)

# API

<details>
<del>

Back then, the main concern was that this macro may not be quite universally-enough useful to belong in the prelude.

Therefore, this PR adds the macro such that using it requires one of:

```rust
use core::macros::matches;
use std::macros::matches;
```

</del>
</details>

Like arms of a `match` expression, the macro supports multiple patterns separated by `|` and optionally followed by `if` and a guard expression:

```rust
let foo = 'f';
assert!(matches!(foo, 'A'..='Z' | 'a'..='z'));

let bar = Some(4);
assert!(matches!(bar, Some(x) if x > 2));
```

<details>
<del>

# Implementation constraints

A combination of reasons make it tricky for a standard library macro not to be in the prelude.

Currently, all public `macro_rules` macros in the standard library macros end up “in the prelude” of every crate not through `use std::prelude::v1::*;` like for other kinds of items, but through `#[macro_use]` on `extern crate std;`. (Both are injected by `src/libsyntax_ext/standard_library_imports.rs`.)

`#[macro_use]` seems to import every macro that is available at the top-level of a crate, even if through a `pub use` re-export.

Therefore, for `matches!` not to be in the prelude, we need it to be inside of a module rather than at the root of `core` or `std`.

However, the only way to make a `macro_rules` macro public outside of the crate where it is defined appears to be `#[macro_export]`. This exports the macro at the root of the crate regardless of which module defines it. See [macro scoping](https://doc.rust-lang.org/reference/macros-by-example.html#scoping-exporting-and-importing) in the reference.

Therefore, the macro needs to be defined in a crate that is not `core` or `std`.

# Implementation

This PR adds a new `matches_macro` crate as a private implementation detail of the standard library. This crate is `#![no_core]` so that libcore can depend on it. It contains a `macro_rules` definition with `#[macro_export]`.

libcore and libstd each have a new public `macros` module that contains a `pub use` re-export of the macro. Both the module and the macro are unstable, for now.

The existing private `macros` modules are renamed `prelude_macros`, though their respective source remains in `macros.rs` files.

</del>
</details>

4 years agoRollup merge of #65193 - Mark-Simulacrum:lockless-lintstore, r=nikomatsakis
Mazdak Farrokhzad [Wed, 23 Oct 2019 20:19:10 +0000 (22:19 +0200)]
Rollup merge of #65193 - Mark-Simulacrum:lockless-lintstore, r=nikomatsakis

Lockless LintStore

This removes mutability from the lint store after registration. Each commit stands alone, for the most part, though they don't make sense out of sequence.

The intent here is to move LintStore to a more parallel-friendly architecture, although also just a cleaner one from an implementation perspective. Specifically, this has the following changes:
 * We no longer implicitly register lints when registering lint passes
    * For the most part this means that registration calls now likely want to call something like:
       `lint_store.register_lints(&Pass::get_lints())` as well as `register_*_pass`.
    * In theory this is a simplification as it's much easier for folks to just register lints and then have passes that implement whichever lint however they want, rather than necessarily tying passes to lints.
 * Lint passes still have a list of associated lints, but a followup PR could plausibly change that
   * This list must be known for a given pass type, not instance, i.e., `fn get_lints()` is the signature instead of `fn get_lints(&self)` as before.
 * We do not store pass objects, instead storing constructor functions. This means we always get new passes when running lints (this happens approximately once though for a given compiler session, so no behavior change is expected).
 * Registration API is _much_ simpler: generally all functions are just taking `Fn() -> PassObject` rather than several different `bool`s.

4 years agoRollup merge of #65144 - clarfon:moo, r=sfackler
Mazdak Farrokhzad [Wed, 23 Oct 2019 20:19:08 +0000 (22:19 +0200)]
Rollup merge of #65144 - clarfon:moo, r=sfackler

Add Cow::is_borrowed and Cow::is_owned

Implements #65143.

4 years agoRollup merge of #64178 - mati865:clippy, r=scottmcm
Mazdak Farrokhzad [Wed, 23 Oct 2019 20:19:07 +0000 (22:19 +0200)]
Rollup merge of #64178 - mati865:clippy, r=scottmcm

More Clippy fixes for alloc, core and std

Continuation of https://github.com/rust-lang/rust/pull/63805

4 years agoUI failures fix
Umesh Kalappa [Mon, 21 Oct 2019 06:48:05 +0000 (23:48 -0700)]
UI failures fix

4 years agoAccount for const generalisation in nll_relate
varkor [Wed, 23 Oct 2019 17:00:35 +0000 (18:00 +0100)]
Account for const generalisation in nll_relate

4 years agoAccount for const generalisation in combine
varkor [Wed, 23 Oct 2019 16:40:18 +0000 (17:40 +0100)]
Account for const generalisation in combine

4 years agoAdd regression test for #62579
varkor [Wed, 23 Oct 2019 16:09:56 +0000 (17:09 +0100)]
Add regression test for #62579

4 years agoDocument guard expressions in `matches!`
Simon Sapin [Wed, 23 Oct 2019 13:42:52 +0000 (15:42 +0200)]
Document guard expressions in `matches!`

4 years agoAdd tracking issue for the `matches!` macro
Simon Sapin [Wed, 23 Oct 2019 13:34:24 +0000 (15:34 +0200)]
Add tracking issue for the `matches!` macro

https://github.com/rust-lang/rust/issues/65721

4 years agoMove the `matches!` macro to the prelude
Simon Sapin [Wed, 23 Oct 2019 13:30:04 +0000 (15:30 +0200)]
Move the `matches!` macro to the prelude

4 years agoAdd `core::macros::matches!( $expr, $pat ) -> bool`
Simon Sapin [Wed, 16 Oct 2019 20:40:37 +0000 (22:40 +0200)]
Add `core::macros::matches!( $expr, $pat ) -> bool`

# Motivation

This macro is:

* General-purpose (not domain-specific)
* Simple (the implementation is short)
* Very popular [on crates.io](https://crates.io/crates/matches)
  (currently 37th in all-time downloads)
* The two previous points combined make it number one in
  [left-pad index](https://twitter.com/bascule/status/1184523027888988160)
  score

As such, I feel it is a good candidate for inclusion in the standard library.

In fact I already felt that way five years ago:
https://github.com/rust-lang/rust/pull/14685
(Although the proof of popularity was not as strong at the time.)

Back then, the main concern was that this macro may not be quite
universally-enough useful to belong in the prelude.

# API

Therefore, this PR adds the macro such that using it requires one of:

```
use core::macros::matches;
use std::macros::matches;
```

Like arms of a `match` expression,
the macro supports multiple patterns separated by `|`
and optionally followed by `if` and a guard expression:

```
let foo = 'f';
assert!(matches!(foo, 'A'..='Z' | 'a'..='z'));

let bar = Some(4);
assert!(matches!(bar, Some(x) if x > 2));
```

# Implementation constraints

A combination of reasons make it tricky
for a standard library macro not to be in the prelude.

Currently, all public `macro_rules` macros in the standard library macros
end up “in the prelude” of every crate not through `use std::prelude::v1::*;`
like for other kinds of items,
but through `#[macro_use]` on `extern crate std;`.
(Both are injected by `src/libsyntax_ext/standard_library_imports.rs`.)

`#[macro_use]` seems to import every macro that is available
at the top-level of a crate, even if through a `pub use` re-export.

Therefore, for `matches!` not to be in the prelude, we need it to be
inside of a module rather than at the root of `core` or `std`.

However, the only way to make a `macro_rules` macro public
outside of the crate where it is defined
appears to be `#[macro_export]`.
This exports the macro at the root of the crate
regardless of which module defines it.
See [macro scoping](
https://doc.rust-lang.org/reference/macros-by-example.html#scoping-exporting-and-importing)
in the reference.

Therefore, the macro needs to be defined in a crate
that is not `core` or `std`.

# Implementation

This PR adds a new `matches_macro` crate as a private implementation detail
of the standard library.
This crate is `#![no_core]` so that libcore can depend on it.
It contains a `macro_rules` definition with `#[macro_export]`.

libcore and libstd each have a new public `macros` module
that contains a `pub use` re-export of the macro.
Both the module and the macro are unstable, for now.

The existing private `macros` modules are renamed `prelude_macros`,
though their respective source remains in `macros.rs` files.

4 years agoAuto merge of #57545 - bovinebuddha:object_safe_for_dispatch, r=nikomatsakis
bors [Wed, 23 Oct 2019 13:34:27 +0000 (13:34 +0000)]
Auto merge of #57545 - bovinebuddha:object_safe_for_dispatch, r=nikomatsakis

Object safe for dispatch

cc #43561

4 years agoUpdate ui tests
Guillaume Gomez [Sun, 13 Oct 2019 20:07:11 +0000 (22:07 +0200)]
Update ui tests

4 years agoAdd long error explanation for E0576
Guillaume Gomez [Sun, 13 Oct 2019 20:07:02 +0000 (22:07 +0200)]
Add long error explanation for E0576

4 years agoAuto merge of #65716 - JohnTitor:rollup-fkcr85k, r=JohnTitor
bors [Wed, 23 Oct 2019 09:53:32 +0000 (09:53 +0000)]
Auto merge of #65716 - JohnTitor:rollup-fkcr85k, r=JohnTitor

Rollup of 14 pull requests

Successful merges:

 - #64145 (Target-feature documented as unsafe)
 - #65007 (Mention keyword closing policy)
 - #65417 (Add more coherence tests)
 - #65507 (Fix test style in unused parentheses lint test)
 - #65591 (Add long error explanation for E0588)
 - #65617 (Fix WASI sleep impl)
 - #65656 (Add option to disable keyboard shortcuts in docs)
 - #65678 (Add long error explanation for E0728)
 - #65681 (Code cleanups following up on #65576.)
 - #65686 (refactor and move `maybe_append` )
 - #65688 (Add some tests for fixed ICEs)
 - #65689 (bring back some Debug instances for Miri)
 - #65695 (self-profiling: Remove module names from some event-ids in codegen backend.)
 - #65706 (Add missing space in librustdoc)

Failed merges:

r? @ghost

4 years agoRollup merge of #65706 - popzxc:add-missing-space, r=Mark-Simulacrum
Yuki Okushi [Wed, 23 Oct 2019 08:14:47 +0000 (17:14 +0900)]
Rollup merge of #65706 - popzxc:add-missing-space, r=Mark-Simulacrum

Add missing space in librustdoc

It just hurts my eyes...

r? @Centril

4 years agoRollup merge of #65695 - michaelwoerister:fix-self-profiling-work-item-event-names...
Yuki Okushi [Wed, 23 Oct 2019 08:14:46 +0000 (17:14 +0900)]
Rollup merge of #65695 - michaelwoerister:fix-self-profiling-work-item-event-names, r=wesleywiser

self-profiling: Remove module names from some event-ids in codegen backend.

Event-IDs are not supposed to contain argument values. Event-IDs are the equivalent of function names. Proper support for parameters will be added to self-profiling down the line.

This PR fixes an oversight from https://github.com/rust-lang/rust/pull/64840.

r? @wesleywiser

4 years agoRollup merge of #65689 - RalfJung:miri-debug, r=Centril
Yuki Okushi [Wed, 23 Oct 2019 08:14:44 +0000 (17:14 +0900)]
Rollup merge of #65689 - RalfJung:miri-debug, r=Centril

bring back some Debug instances for Miri

These were erroneously removed in https://github.com/rust-lang/rust/pull/65647, but Miri needs them.

r? @Centril Cc @nnethercote @oli-obk

4 years agoRollup merge of #65688 - JohnTitor:add-some-tests, r=Dylan-DPC
Yuki Okushi [Wed, 23 Oct 2019 08:14:43 +0000 (17:14 +0900)]
Rollup merge of #65688 - JohnTitor:add-some-tests, r=Dylan-DPC

Add some tests for fixed ICEs

Fixes #41366 from 1.35.0
Fixes #51431 from 1.31.0-nightly (77af31408 2018-10-11) (on my local)
Fixes #52437 from nightly
Fixes #63496 from nightly

r? @Centril

4 years agoRollup merge of #65686 - yjhmelody:yjhmelody-patch-1, r=Centril
Yuki Okushi [Wed, 23 Oct 2019 08:14:42 +0000 (17:14 +0900)]
Rollup merge of #65686 - yjhmelody:yjhmelody-patch-1, r=Centril

refactor and move `maybe_append`

4 years agoRollup merge of #65681 - sunfishcode:followup, r=Centril
Yuki Okushi [Wed, 23 Oct 2019 08:14:40 +0000 (17:14 +0900)]
Rollup merge of #65681 - sunfishcode:followup, r=Centril

Code cleanups following up on #65576.

This makes a few code cleanups to follow up on the review comments in
https://github.com/rust-lang/rust/pull/65576.

r? @Centril