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

4 years agoRollup merge of #65678 - JohnTitor:add-e0728-explanation, r=GuilliaumeGomez
Yuki Okushi [Wed, 23 Oct 2019 08:14:39 +0000 (17:14 +0900)]
Rollup merge of #65678 - JohnTitor:add-e0728-explanation, r=GuilliaumeGomez

Add long error explanation for E0728

Part of #61137

r? @GuillaumeGomez

4 years agoRollup merge of #65656 - GuillaumeGomez:option-disable-shortcut, r=Dylan-DPC
Yuki Okushi [Wed, 23 Oct 2019 08:14:37 +0000 (17:14 +0900)]
Rollup merge of #65656 - GuillaumeGomez:option-disable-shortcut, r=Dylan-DPC

Add option to disable keyboard shortcuts in docs

Fixes #65211.

r? @Manishearth

4 years agoRollup merge of #65617 - newpavlov:patch-2, r=alexcrichton
Yuki Okushi [Wed, 23 Oct 2019 08:14:36 +0000 (17:14 +0900)]
Rollup merge of #65617 - newpavlov:patch-2, r=alexcrichton

Fix WASI sleep impl

Closes #65607

@sunfishcode
Is it fine to use 0 for the `identifier` field? What is this field used for?

4 years agoRollup merge of #65591 - GuillaumeGomez:long-err-explanation-E0588, r=Dylan-DPC
Yuki Okushi [Wed, 23 Oct 2019 08:14:34 +0000 (17:14 +0900)]
Rollup merge of #65591 - GuillaumeGomez:long-err-explanation-E0588, r=Dylan-DPC

Add long error explanation for E0588

Part of #61137.

r? @kinnison

4 years agoRollup merge of #65507 - polyedre:master, r=nikomatsakis
Yuki Okushi [Wed, 23 Oct 2019 08:14:33 +0000 (17:14 +0900)]
Rollup merge of #65507 - polyedre:master, r=nikomatsakis

Fix test style in unused parentheses lint test

I think this fixes #63237
I'm not sure if I had to add text after the `//~ ERROR` comments.
This is my first pull request, so I'm open to feedback.
This issues already received one pull request [here](https://github.com/rust-lang/rust/pull/63257) but it was marked as closed for inactivity.

r?  @nikomatsakis

4 years agoRollup merge of #65417 - weiznich:more_coherence_tests, r=nikomatsakis
Yuki Okushi [Wed, 23 Oct 2019 08:14:31 +0000 (17:14 +0900)]
Rollup merge of #65417 - weiznich:more_coherence_tests, r=nikomatsakis

Add more coherence tests

I've wrote the missing test cases listed in [this google doc](https://docs.google.com/spreadsheets/d/1WlroTEXE6qxxGvEOhICkUpqguYZP9YOZEvnmEtSNtM0/edit#gid=0)

> The other thing that might be useful is to rename the existing tests so they all fit the new naming scheme we were using.

I'm not entirely sure how to do this. If everything from the google sheet is covered could I just remove the remaining tests in `src/test/ui/coherence` or is there something in there that should remain?

cc #63599

r? @nikomatsakis

4 years agoRollup merge of #65007 - BO41:keywords, r=nikomatsakis
Yuki Okushi [Wed, 23 Oct 2019 08:14:29 +0000 (17:14 +0900)]
Rollup merge of #65007 - BO41:keywords, r=nikomatsakis

Mention keyword closing policy

closes #59233 / https://github.com/rust-lang/rust/issues/59233#issuecomment-478362693

rewording suggestions welcome

> Also in the referenced issue, the commit number of the new commit
> that could close that issue is not really informative. The PR number itself appeared in the issue
> is more informative and concise.

@lzutao what do you mean with that? Is this fixed by the new "May be fixed by #XXXXX"?

4 years agoRollup merge of #64145 - togiberlin:feature/target-features-doc, r=ehuss
Yuki Okushi [Wed, 23 Oct 2019 08:14:27 +0000 (17:14 +0900)]
Rollup merge of #64145 - togiberlin:feature/target-features-doc, r=ehuss

Target-feature documented as unsafe

@nikomatsakis asked me to help out on the docs on this issue: https://github.com/rust-lang/rust/issues/63597

The following docs have been modified
- ```rustc -C help``` text for `target-feature`
- RustC book:

## Preview of src/doc/rustc/src/targets/index.md
![Screenshot 2019-09-17 at 12 22 45](https://user-images.githubusercontent.com/13764830/65033746-f7826700-d945-11e9-9dd2-d8f9b08f45de.png)

## Preview of src/doc/rustc/src/targets/known-issues.md
![Screenshot 2019-09-17 at 12 22 25](https://user-images.githubusercontent.com/13764830/65033774-00733880-d946-11e9-9398-90f01f3938d5.png)

Fixes #63597

4 years agoAuto merge of #65713 - lzutao:clippy-up, r=Manishearth
bors [Wed, 23 Oct 2019 06:07:49 +0000 (06:07 +0000)]
Auto merge of #65713 - lzutao:clippy-up, r=Manishearth

Update clippy

Replaces #65690
cc  #65503
Closes #65683

4 years agoPublic some types for compiletest_rs
Lzu Tao [Wed, 23 Oct 2019 03:49:42 +0000 (03:49 +0000)]
Public some types for compiletest_rs

4 years agoupdate compiletest
Lzu Tao [Wed, 23 Oct 2019 02:46:10 +0000 (02:46 +0000)]
update compiletest

4 years agoAdd Cow::is_borrowed and Cow::is_owned
Clar Fon [Sat, 5 Oct 2019 22:23:37 +0000 (18:23 -0400)]
Add Cow::is_borrowed and Cow::is_owned

4 years agoAdd some documentation
Mark Rousskov [Tue, 22 Oct 2019 20:53:28 +0000 (16:53 -0400)]
Add some documentation

4 years agoRFC 2027: "first draft" of implementation
Mathias Blikstad [Tue, 8 Jan 2019 21:14:04 +0000 (22:14 +0100)]
RFC 2027: "first draft" of implementation

These are a squashed series of commits.

4 years agoUpdate Clippy
flip1995 [Tue, 22 Oct 2019 09:24:18 +0000 (11:24 +0200)]
Update Clippy

4 years agoReadd some PartialEq and Hash derives used by Clippy
flip1995 [Tue, 22 Oct 2019 09:15:12 +0000 (11:15 +0200)]
Readd some PartialEq and Hash derives used by Clippy

4 years agoApply clippy::single_match suggestion
Mateusz Mikuła [Thu, 5 Sep 2019 12:08:06 +0000 (14:08 +0200)]
Apply clippy::single_match suggestion

4 years agoApply clippy::while_let_on_iterator suggestions
Mateusz Mikuła [Thu, 5 Sep 2019 11:47:59 +0000 (13:47 +0200)]
Apply clippy::while_let_on_iterator suggestions

4 years agoApply clippy::redundant_pattern_matching suggestion
Mateusz Mikuła [Thu, 5 Sep 2019 11:38:00 +0000 (13:38 +0200)]
Apply clippy::redundant_pattern_matching suggestion

4 years agoApply clippy::needless_return suggestions
Mateusz Mikuła [Thu, 5 Sep 2019 11:30:30 +0000 (13:30 +0200)]
Apply clippy::needless_return suggestions

4 years agoAdd missing space in librustdoc
Igor Aleksanov [Tue, 22 Oct 2019 17:14:34 +0000 (20:14 +0300)]
Add missing space in librustdoc

4 years agoApply clippy::useless_let_if_seq suggestion
Mateusz Mikuła [Thu, 5 Sep 2019 10:23:56 +0000 (12:23 +0200)]
Apply clippy::useless_let_if_seq suggestion

4 years agoTarget-feature documented as unsafe. rustc book and rustc -C help have been modified.
togiberlin [Wed, 4 Sep 2019 12:53:47 +0000 (14:53 +0200)]
Target-feature documented as unsafe. rustc book and rustc -C help have been modified.

4 years agoAdd regression test for #65675
varkor [Tue, 22 Oct 2019 13:07:20 +0000 (14:07 +0100)]
Add regression test for #65675

4 years agoFix an issue with const inference variables sticking around under Chalk + NLL
varkor [Tue, 22 Oct 2019 13:00:19 +0000 (14:00 +0100)]
Fix an issue with const inference variables sticking around under Chalk + NLL

4 years agoAdd link to async/await
Yuki Okushi [Tue, 22 Oct 2019 12:10:51 +0000 (21:10 +0900)]
Add link to async/await

4 years agoAuto merge of #65503 - popzxc:refactor-libtest, r=wesleywiser
bors [Tue, 22 Oct 2019 12:01:41 +0000 (12:01 +0000)]
Auto merge of #65503 - popzxc:refactor-libtest, r=wesleywiser

Refactor libtest

## Short overview

`libtest` got refactored and splitted into smaller modules

## Description

`libtest` module is already pretty big and hard to understand. Everything is mixed up: CLI, console output, test execution, etc.

This PR splits `libtest` into smaller logically-consistent modules, makes big functions smaller and more readable, and adds more comments, so `libtest` will be easier to understand and maintain.

Although there are a lot of changes, all the refactoring is "soft", meaning that no public interfaces were affected and nothing should be broken.

Thus this PR (at least should be) completely backward-compatible.

r? @wesleywiser
cc @Centril

4 years agorustc_metadata: use a table for impl_trait_ref.
Eduard-Mihai Burtescu [Fri, 18 Oct 2019 22:10:58 +0000 (01:10 +0300)]
rustc_metadata: use a table for impl_trait_ref.

4 years agorustc_metadata: use a table for fn_sig.
Eduard-Mihai Burtescu [Fri, 18 Oct 2019 19:15:14 +0000 (22:15 +0300)]
rustc_metadata: use a table for fn_sig.

4 years agoself-profiling: Remove module names from some event-ids in codegen backend.
Michael Woerister [Tue, 22 Oct 2019 10:53:46 +0000 (12:53 +0200)]
self-profiling: Remove module names from some event-ids in codegen backend.

4 years agorustc_metadata: use a table for super_predicates.
Eduard-Mihai Burtescu [Fri, 18 Oct 2019 18:22:41 +0000 (21:22 +0300)]
rustc_metadata: use a table for super_predicates.

4 years agoUpdate error_codes.rs
Dylan DPC [Tue, 22 Oct 2019 10:07:07 +0000 (12:07 +0200)]
Update error_codes.rs

4 years agoAdd test for issue-63496
Yuki Okushi [Tue, 22 Oct 2019 08:01:49 +0000 (17:01 +0900)]
Add test for issue-63496

4 years agoUpdate E0659 error code long explanation to 2018 edition
Guillaume Gomez [Tue, 22 Oct 2019 09:52:05 +0000 (11:52 +0200)]
Update E0659 error code long explanation to 2018 edition

4 years agoadd comments
Ralf Jung [Tue, 22 Oct 2019 08:18:38 +0000 (10:18 +0200)]
add comments

4 years agobring back some Debug instances for Miri
Ralf Jung [Tue, 22 Oct 2019 08:15:56 +0000 (10:15 +0200)]
bring back some Debug instances for Miri

4 years agoAdd test for issue-52437
Yuki Okushi [Tue, 22 Oct 2019 08:01:32 +0000 (17:01 +0900)]
Add test for issue-52437

4 years agoAdd test for issue-51431
Yuki Okushi [Tue, 22 Oct 2019 08:01:06 +0000 (17:01 +0900)]
Add test for issue-51431

4 years agoAdd test for issue-41366
Yuki Okushi [Tue, 22 Oct 2019 08:00:47 +0000 (17:00 +0900)]
Add test for issue-41366

4 years agorefactor maybe_append
yjhmelody [Tue, 22 Oct 2019 04:25:14 +0000 (12:25 +0800)]
refactor maybe_append

4 years agoAuto merge of #65501 - alexcrichton:remove-emscripten-backend, r=Mark-Simulacrum
bors [Tue, 22 Oct 2019 04:09:28 +0000 (04:09 +0000)]
Auto merge of #65501 - alexcrichton:remove-emscripten-backend, r=Mark-Simulacrum

Remove `src/llvm-emscripten` submodule

With #65251 landed there's no need to build two LLVM backends and ship
them with rustc, every target we have now uses the same LLVM backend!

This removes the `src/llvm-emscripten` submodule and additionally
removes all support from rustbuild for building the emscripten LLVM
backend. Multiple codegen backend support is left in place for now, and
this is intended to be an easy 10-15 minute win on CI times by avoiding
having to build LLVM twice.

4 years agoCode cleanups following up on #65576.
Dan Gohman [Tue, 22 Oct 2019 00:29:40 +0000 (17:29 -0700)]
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.

4 years agoAuto merge of #65671 - Centril:rollup-00glhmb, r=Centril
bors [Tue, 22 Oct 2019 00:20:12 +0000 (00:20 +0000)]
Auto merge of #65671 - Centril:rollup-00glhmb, r=Centril

Rollup of 7 pull requests

Successful merges:

 - #62330 (Change untagged_unions to not allow union fields with drop)
 - #65092 (make is_power_of_two a const function)
 - #65621 (miri: add write_bytes method to Memory doing bounds-checks and supporting iterators)
 - #65647 (Remove unnecessary trait bounds and derivations)
 - #65653 (keep the root dir clean from debugging)
 - #65660 (Rename `ConstValue::Infer(InferConst::Canonical(..))` to `ConstValue::Bound(..)`)
 - #65663 (Fix typo from #65214)

Failed merges:

r? @ghost

4 years agoApply suggestions
Yuki Okushi [Tue, 22 Oct 2019 00:00:01 +0000 (09:00 +0900)]
Apply suggestions

4 years agoAdd long error explanation for E0728
Yuki Okushi [Mon, 21 Oct 2019 23:48:01 +0000 (08:48 +0900)]
Add long error explanation for E0728

4 years agoRemove `src/llvm-emscripten` submodule
Alex Crichton [Thu, 17 Oct 2019 14:04:39 +0000 (07:04 -0700)]
Remove `src/llvm-emscripten` submodule

With #65251 landed there's no need to build two LLVM backends and ship
them with rustc, every target we have now uses the same LLVM backend!

This removes the `src/llvm-emscripten` submodule and additionally
removes all support from rustbuild for building the emscripten LLVM
backend. Multiple codegen backend support is left in place for now, and
this is intended to be an easy 10-15 minute win on CI times by avoiding
having to build LLVM twice.

4 years agoRollup merge of #65663 - Amanieu:typo, r=varkor
Mazdak Farrokhzad [Mon, 21 Oct 2019 20:00:54 +0000 (22:00 +0200)]
Rollup merge of #65663 - Amanieu:typo, r=varkor

Fix typo from #65214

4 years agoRollup merge of #65660 - varkor:canonical-const-to-bound-const, r=eddyb
Mazdak Farrokhzad [Mon, 21 Oct 2019 20:00:53 +0000 (22:00 +0200)]
Rollup merge of #65660 - varkor:canonical-const-to-bound-const, r=eddyb

Rename `ConstValue::Infer(InferConst::Canonical(..))` to `ConstValue::Bound(..)`

It already has the right form, so this is just a renaming. Fixes https://github.com/rust-lang/rust/issues/65655.

r? @eddyb

4 years agoRollup merge of #65653 - RalfJung:gitignore, r=Mark-Simulacrum,Centril
Mazdak Farrokhzad [Mon, 21 Oct 2019 20:00:51 +0000 (22:00 +0200)]
Rollup merge of #65653 - RalfJung:gitignore, r=Mark-Simulacrum,Centril

keep the root dir clean from debugging

We landed this before with https://github.com/rust-lang/rust/pull/63307 but recently in https://github.com/rust-lang/rust/pull/65630 the IMO bad ignore crept back in.

If you regularly do graphviz-based debugging and you are fine leaving junk in the rustc root dir, please configure your local `.git/info/exclude`. But most people working on rustc don't work with graphciz all that often (I for once never did), and not everyone likes to have stray generated files in their source dirs.

Also Cc https://github.com/rust-lang/rust/pull/63373 https://github.com/rust-lang/rust/pull/53768 @ecstatic-morse @Mark-Simulacrum

4 years agoRollup merge of #65647 - nnethercote:rm-unnecessary-traits, r=Centril
Mazdak Farrokhzad [Mon, 21 Oct 2019 20:00:50 +0000 (22:00 +0200)]
Rollup merge of #65647 - nnethercote:rm-unnecessary-traits, r=Centril

Remove unnecessary trait bounds and derivations

This PR removes unnecessary trait bounds and derivations from many types.

r? @nikomatsakis

4 years agoRollup merge of #65621 - RalfJung:write_bytes, r=oli-obk
Mazdak Farrokhzad [Mon, 21 Oct 2019 20:00:49 +0000 (22:00 +0200)]
Rollup merge of #65621 - RalfJung:write_bytes, r=oli-obk

miri: add write_bytes method to Memory doing bounds-checks and supporting iterators

This lets us avoid some direct `Allocation` accesses in Miri.

4 years agoRollup merge of #65092 - tspiteri:const-is-pow2, r=oli-obk
Mazdak Farrokhzad [Mon, 21 Oct 2019 20:00:47 +0000 (22:00 +0200)]
Rollup merge of #65092 - tspiteri:const-is-pow2, r=oli-obk

make is_power_of_two a const function

This makes `is_power_of_two` a const function by using `&` instead of short-circuiting `&&`; Rust supports bitwise `&` for `bool` and short-circuiting is not required in the existing expression.

I don't think this needs a const-hack label as I don't find the changed code less readable, if anything I prefer that it is clearer that short circuiting is not used.

@oli-obk

4 years agoRollup merge of #62330 - SimonSapin:no-drop-in-union-fields, r=RalfJung
Mazdak Farrokhzad [Mon, 21 Oct 2019 20:00:45 +0000 (22:00 +0200)]
Rollup merge of #62330 - SimonSapin:no-drop-in-union-fields, r=RalfJung

Change untagged_unions to not allow union fields with drop

This is a rebase of #56440, massaged to solve merge conflicts and make the test suite pass.

Change untagged_unions to not allow union fields with drop

Union fields may now never have a type with attached destructor. This for example allows unions to use arbitrary field types only by wrapping them in `ManuallyDrop` (or similar).

The stable rule remains, that union fields must be `Copy`. We use the new rule for the `untagged_union` feature.

Tracking issue: https://github.com/rust-lang/rust/issues/55149

4 years agoRename `ConstValue::Infer(InferConst::Canonical(..))` to `ConstValue::Bound(..)`
varkor [Mon, 21 Oct 2019 10:22:45 +0000 (11:22 +0100)]
Rename `ConstValue::Infer(InferConst::Canonical(..))` to `ConstValue::Bound(..)`

4 years agoexpand comment
Ralf Jung [Mon, 21 Oct 2019 08:36:49 +0000 (10:36 +0200)]
expand comment

4 years agoAuto merge of #65661 - JohnTitor:rollup-68la1fq, r=JohnTitor
bors [Mon, 21 Oct 2019 15:50:37 +0000 (15:50 +0000)]
Auto merge of #65661 - JohnTitor:rollup-68la1fq, r=JohnTitor

Rollup of 5 pull requests

Successful merges:

 - #65544 (Added doc on keyword break)
 - #65620 (Correctly note code as Ok not error for E0573)
 - #65624 ([mir-opt] Improve SimplifyLocals pass so it can remove unused consts)
 - #65650 (use unwrap_or in lint code)
 - #65652 (Fix `canonicalize_const_var` leaking inference variables)

Failed merges:

r? @ghost

4 years agoimprove readability of is_power_of_two
Trevor Spiteri [Mon, 21 Oct 2019 13:35:54 +0000 (15:35 +0200)]
improve readability of is_power_of_two

4 years agoFix typo from #65214
Amanieu d'Antras [Mon, 21 Oct 2019 12:13:43 +0000 (13:13 +0100)]
Fix typo from #65214

4 years agoRollup merge of #65652 - skinny121:const_infer_leak, r=eddyb
Yuki Okushi [Mon, 21 Oct 2019 10:53:06 +0000 (19:53 +0900)]
Rollup merge of #65652 - skinny121:const_infer_leak, r=eddyb

Fix `canonicalize_const_var` leaking inference variables

Fixes #61338
Fixes #61516
Fixes #62536
Fixes #64087
Fixes #64863
Fixes #65623

I added regression tests for all these issues apart from #64863, which is very similar to #61338.

r? @varkor

4 years agoRollup merge of #65650 - guanqun:use-unwrap-or, r=eddyb
Yuki Okushi [Mon, 21 Oct 2019 10:53:05 +0000 (19:53 +0900)]
Rollup merge of #65650 - guanqun:use-unwrap-or, r=eddyb

use unwrap_or in lint code

4 years agoRollup merge of #65624 - wesleywiser:improve_simplify_locals, r=oli-obk
Yuki Okushi [Mon, 21 Oct 2019 10:53:04 +0000 (19:53 +0900)]
Rollup merge of #65624 - wesleywiser:improve_simplify_locals, r=oli-obk

[mir-opt] Improve SimplifyLocals pass so it can remove unused consts

The `ConstProp` can cause many locals to be initialized to a constant
value and then never read from. `ConstProp` can also evaluate ZSTs into
constant values. Previously, many of these would be removed by other
parts of the MIR optimization pipeline. However, evaluating ZSTs
(especially `()`) into constant values defeated those parts of the
optimizer and so in a2e3ed5, I added a
hack to `ConstProp` that skips evaluating ZSTs to avoid that regression.

This commit changes `SimplifyLocals` so that it doesn't consider writes
of const values to a local to be a use of that local. In doing so,
`SimplifyLocals` is able to remove otherwise unused locals left behind
by other optimization passes (`ConstProp` in particular).

r? @oli-obk

4 years agoRollup merge of #65620 - ryoqun:remove-unneeded-comment, r=varkor
Yuki Okushi [Mon, 21 Oct 2019 10:53:02 +0000 (19:53 +0900)]
Rollup merge of #65620 - ryoqun:remove-unneeded-comment, r=varkor

Correctly note code as Ok not error for E0573

Hi, this is my first pull request to the Rust project.

The fix is very small one just to fix an oversight in a comment.

Namely, [this documentation PR](https://github.com/rust-lang/rust/pull/65234) added a longer explanation for E0573. It illustrated the error using erroneous/corrected contrasting examples. But it accidentally forgot to remove `// error` from the corrected example.

Sadly, I found the error after the PR got merged. [As suggested by the original author](https://github.com/rust-lang/rust/pull/65234/files#r336518549) of the PR, I created an PR to fix this.

Part of #61137.

4 years agoRollup merge of #65544 - dorfsmay:doc_keyword_break, r=Dylan-DPC
Yuki Okushi [Mon, 21 Oct 2019 10:53:01 +0000 (19:53 +0900)]
Rollup merge of #65544 - dorfsmay:doc_keyword_break, r=Dylan-DPC

Added doc on keyword break

RE: #34601

4 years agoRemove many unnecessary trait derivations.
Nicholas Nethercote [Sun, 20 Oct 2019 04:54:53 +0000 (15:54 +1100)]
Remove many unnecessary trait derivations.

4 years agoAdd option to disable keyboard shortcuts in docs
Guillaume Gomez [Mon, 21 Oct 2019 09:36:52 +0000 (11:36 +0200)]
Add option to disable keyboard shortcuts in docs

4 years agoremove write_repeat; it is subsumed by the new write_bytes
Ralf Jung [Mon, 21 Oct 2019 09:08:37 +0000 (11:08 +0200)]
remove write_repeat; it is subsumed by the new write_bytes

4 years agopoints the user away from the Allocation type and towards the Memory type
Ralf Jung [Sun, 20 Oct 2019 12:57:21 +0000 (14:57 +0200)]
points the user away from the Allocation type and towards the Memory type

4 years agokeep the root dir clean from debugging
Ralf Jung [Mon, 21 Oct 2019 08:30:35 +0000 (10:30 +0200)]
keep the root dir clean from debugging

4 years agoReport even duplilcate errors in case the feature gat is not active
Oliver Scherer [Mon, 21 Oct 2019 08:12:09 +0000 (10:12 +0200)]
Report even duplilcate errors in case the feature gat is not active

4 years agoAuto merge of #65594 - RalfJung:miri, r=oli-obk
bors [Mon, 21 Oct 2019 07:50:52 +0000 (07:50 +0000)]
Auto merge of #65594 - RalfJung:miri, r=oli-obk

bump miri

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

4 years agoRemove `InternedString`.
Nicholas Nethercote [Mon, 21 Oct 2019 07:25:03 +0000 (18:25 +1100)]
Remove `InternedString`.

By using `LocalInternedString` instead for the few remaining uses.

4 years agoUse `Symbol` for codegen unit names.
Nicholas Nethercote [Mon, 21 Oct 2019 06:14:03 +0000 (17:14 +1100)]
Use `Symbol` for codegen unit names.

This is a straightforward replacement except for two places where we
have to convert to `LocalInternedString` to get a stable sort.

4 years agoChange `SymbolName::name` from `InternedString` to `Symbol`.
Nicholas Nethercote [Mon, 21 Oct 2019 04:53:37 +0000 (15:53 +1100)]
Change `SymbolName::name` from `InternedString` to `Symbol`.

This requires changing the `PartialOrd`/`Ord` implementations to look at
the chars rather than the symbol index.

4 years agoDon't silently do nothing on mis_use of `check_union_fields`
Oliver Scherer [Mon, 21 Oct 2019 07:08:05 +0000 (09:08 +0200)]
Don't silently do nothing on mis_use of `check_union_fields`