]> git.lizzy.rs Git - rust.git/log
rust.git
5 years agoAuto merge of #61758 - Centril:rollup-ew2uxng, r=Centril
bors [Wed, 12 Jun 2019 04:57:35 +0000 (04:57 +0000)]
Auto merge of #61758 - Centril:rollup-ew2uxng, r=Centril

Rollup of 9 pull requests

Successful merges:

 - #60187 (Generator optimization: Overlap locals that never have storage live at the same time)
 - #61348 (Implement Clone::clone_from for Option and Result)
 - #61568 (Use Symbol, Span in libfmt_macros)
 - #61632 (ci: Collect CPU usage statistics on Azure)
 - #61654 (use pattern matching for slices destructuring)
 - #61671 (implement nth_back for Range(Inclusive))
 - #61688 (is_fp and is_floating_point do the same thing, remove the former)
 - #61705 (Pass cflags rather than cxxflags to LLVM as CMAKE_C_FLAGS)
 - #61734 (Migrate rust-by-example to MdBook2)

Failed merges:

r? @ghost

5 years agoRollup merge of #61734 - mati865:books, r=alexcrichton
Mazdak Farrokhzad [Wed, 12 Jun 2019 02:22:56 +0000 (04:22 +0200)]
Rollup merge of #61734 - mati865:books, r=alexcrichton

Migrate rust-by-example to MdBook2

5 years agoRollup merge of #61705 - petrhosek:llvm-cflags, r=alexcrichton
Mazdak Farrokhzad [Wed, 12 Jun 2019 02:22:55 +0000 (04:22 +0200)]
Rollup merge of #61705 - petrhosek:llvm-cflags, r=alexcrichton

Pass cflags rather than cxxflags to LLVM as CMAKE_C_FLAGS

We mistakenly pass cxxflags from the configuration to LLVM build as
CMAKE_C_FLAGS.

5 years agoRollup merge of #61688 - RalfJung:is-floating-point, r=cramertj
Mazdak Farrokhzad [Wed, 12 Jun 2019 02:22:53 +0000 (04:22 +0200)]
Rollup merge of #61688 - RalfJung:is-floating-point, r=cramertj

is_fp and is_floating_point do the same thing, remove the former

also consistently mark all these `is_*` methods for inlining

5 years agoRollup merge of #61671 - koalatux:nth-back-range, r=KodrAus
Mazdak Farrokhzad [Wed, 12 Jun 2019 02:22:51 +0000 (04:22 +0200)]
Rollup merge of #61671 - koalatux:nth-back-range, r=KodrAus

implement nth_back for Range(Inclusive)

This is part of  #54054.

5 years agoRollup merge of #61654 - Electron-libre:use_slice_patterns_in_rustc, r=oli-obk,Centril
Mazdak Farrokhzad [Wed, 12 Jun 2019 02:22:50 +0000 (04:22 +0200)]
Rollup merge of #61654 - Electron-libre:use_slice_patterns_in_rustc, r=oli-obk,Centril

use pattern matching for slices destructuring

refs #61542

Use slices pattern where it seems to make sense .

5 years agoRollup merge of #61632 - alexcrichton:azure-pipelines-cpu, r=pietroalbini
Mazdak Farrokhzad [Wed, 12 Jun 2019 02:22:48 +0000 (04:22 +0200)]
Rollup merge of #61632 - alexcrichton:azure-pipelines-cpu, r=pietroalbini

ci: Collect CPU usage statistics on Azure

This commit adds a script which we'll execute on Azure Pipelines which
is intended to run in the background and passively collect CPU usage
statistics for our builders. The intention here is that we can use this
information over time to diagnose issues with builders, see where we can
optimize our build, fix parallelism issues, etc. This might not end up
being too useful in the long run but it's data we've wanted to collect
for quite some time now, so here's a stab at it!

Comments about how this is intended to work can be found in the python
script used here to collect CPU usage statistics.

Closes #48828

5 years agoRollup merge of #61568 - Mark-Simulacrum:symbol-fmt-macros, r=estebank
Mazdak Farrokhzad [Wed, 12 Jun 2019 02:22:47 +0000 (04:22 +0200)]
Rollup merge of #61568 - Mark-Simulacrum:symbol-fmt-macros, r=estebank

Use Symbol, Span in libfmt_macros

I'm not super happy with this, personally, but I think it might be a decent start -- happy to take suggestions as to how to expand this or change things further.

r? @estebank

Fixes #60795

5 years agoRollup merge of #61348 - dronesforwork-forks:clone-from, r=KodrAus
Mazdak Farrokhzad [Wed, 12 Jun 2019 02:22:45 +0000 (04:22 +0200)]
Rollup merge of #61348 - dronesforwork-forks:clone-from, r=KodrAus

Implement Clone::clone_from for Option and Result

See https://github.com/rust-lang/rust/issues/28481

5 years agoRollup merge of #60187 - tmandry:generator-optimization, r=eddyb
Mazdak Farrokhzad [Wed, 12 Jun 2019 02:22:44 +0000 (04:22 +0200)]
Rollup merge of #60187 - tmandry:generator-optimization, r=eddyb

Generator optimization: Overlap locals that never have storage live at the same time

The specific goal of this optimization is to optimize async fns which use `await!`. Notably, `await!` has an enclosing scope around the futures it awaits ([definition](https://github.com/rust-lang/rust/blob/08bfe16129b0621bc90184f8704523d4929695ef/src/libstd/macros.rs#L365-L381)), which we rely on to implement the optimization.

More generally, the optimization allows overlapping the storage of some locals which are never storage-live at the same time. **We care about storage-liveness when computing the layout, because knowing a field is `StorageDead` is the only way to prove it will not be accessed, either directly or through a reference.**

To determine whether we can overlap two locals in the generator layout, we look at whether they might *both* be `StorageLive` at any point in the MIR. We use the `MaybeStorageLive` dataflow analysis for this. We iterate over every location in the MIR, and build a bitset for each local of the locals it might potentially conflict with.

Next, we assign every saved local to one or more variants. The variants correspond to suspension points, and we include the set of locals live across a given suspension point in the variant. (Note that we use liveness instead of storage-liveness here; this ensures that the local has actually been initialized in each variant it has been included in. If the local is not live across a suspension point, then it doesn't need to be included in that variant.). It's important to note that the variants are a "view" into our layout.

For the layout computation, we use a simplified approach.

1. Start with the set of locals assigned to only one variant. The rest are disqualified.
2. For each pair of locals which may conflict *and are not assigned to the same variant*, we pick one local to disqualify from overlapping.

Disqualified locals go into a non-overlapping "prefix" at the beginning of our layout. This means they always have space reserved for them. All the locals that are allowed to overlap in each variant are then laid out after this prefix, in the "overlap zone".

So, if A and B were disqualified, and X, Y, and Z were all eligible for overlap, our generator might look something like this:

You can think of a generator as an enum, where some fields are shared between variants. e.g.

```rust
enum Generator {
  Unresumed,
  Poisoned,
  Returned,
  Suspend0(A, B, X),
  Suspend1(B),
  Suspend2(A, Y, Z),
}
```

where every mention of `A` and `B` refer to the same field, which does not move when changing variants. Note that `A` and `B` would automatically be sent to the prefix in this example. Assuming that `X` is never `StorageLive` at the same time as either `Y` or `Z`, it would be allowed to overlap with them.

Note that if two locals (`Y` and `Z` in this case) are assigned to the same variant in our generator, their memory would never overlap in the layout. Thus they can both be eligible for the overlapping section, even if they are storage-live at the same time.

---

Depends on:
- [x] #59897 Multi-variant layouts for generators
- [x] #60840 Preserve local scopes in generator MIR
- [x] #61373 Emit StorageDead along unwind paths for generators

Before merging:

- [x] ~Wrap the types of all generator fields in `MaybeUninitialized` in layout::ty::field~ (opened #60889)
- [x] Make PR description more complete (e.g. explain why storage liveness is important and why we have to check every location)
- [x] Clean up TODO
- [x] Fix the layout code to enforce that the same field never moves around in the generator
- [x] Add tests for async/await
- [x] ~Reduce # bits we store by half, since the conflict relation is symmetric~ (note: decided not to do this, for simplicity)
- [x] Store liveness information for each yield point in our `GeneratorLayout`, that way we can emit more useful debuginfo AND tell miri which fields are definitely initialized for a given variant (see discussion at https://github.com/rust-lang/rust/pull/59897#issuecomment-489468627)

5 years agoAuto merge of #60187 - tmandry:generator-optimization, r=eddyb
bors [Wed, 12 Jun 2019 02:13:11 +0000 (02:13 +0000)]
Auto merge of #60187 - tmandry:generator-optimization, r=eddyb

Generator optimization: Overlap locals that never have storage live at the same time

The specific goal of this optimization is to optimize async fns which use `await!`. Notably, `await!` has an enclosing scope around the futures it awaits ([definition](https://github.com/rust-lang/rust/blob/08bfe16129b0621bc90184f8704523d4929695ef/src/libstd/macros.rs#L365-L381)), which we rely on to implement the optimization.

More generally, the optimization allows overlapping the storage of some locals which are never storage-live at the same time. **We care about storage-liveness when computing the layout, because knowing a field is `StorageDead` is the only way to prove it will not be accessed, either directly or through a reference.**

To determine whether we can overlap two locals in the generator layout, we look at whether they might *both* be `StorageLive` at any point in the MIR. We use the `MaybeStorageLive` dataflow analysis for this. We iterate over every location in the MIR, and build a bitset for each local of the locals it might potentially conflict with.

Next, we assign every saved local to one or more variants. The variants correspond to suspension points, and we include the set of locals live across a given suspension point in the variant. (Note that we use liveness instead of storage-liveness here; this ensures that the local has actually been initialized in each variant it has been included in. If the local is not live across a suspension point, then it doesn't need to be included in that variant.). It's important to note that the variants are a "view" into our layout.

For the layout computation, we use a simplified approach.

1. Start with the set of locals assigned to only one variant. The rest are disqualified.
2. For each pair of locals which may conflict *and are not assigned to the same variant*, we pick one local to disqualify from overlapping.

Disqualified locals go into a non-overlapping "prefix" at the beginning of our layout. This means they always have space reserved for them. All the locals that are allowed to overlap in each variant are then laid out after this prefix, in the "overlap zone".

So, if A and B were disqualified, and X, Y, and Z were all eligible for overlap, our generator might look something like this:

You can think of a generator as an enum, where some fields are shared between variants. e.g.

```rust
enum Generator {
  Unresumed,
  Poisoned,
  Returned,
  Suspend0(A, B, X),
  Suspend1(B),
  Suspend2(A, Y, Z),
}
```

where every mention of `A` and `B` refer to the same field, which does not move when changing variants. Note that `A` and `B` would automatically be sent to the prefix in this example. Assuming that `X` is never `StorageLive` at the same time as either `Y` or `Z`, it would be allowed to overlap with them.

Note that if two locals (`Y` and `Z` in this case) are assigned to the same variant in our generator, their memory would never overlap in the layout. Thus they can both be eligible for the overlapping section, even if they are storage-live at the same time.

---

Depends on:
- [x] #59897 Multi-variant layouts for generators
- [x] #60840 Preserve local scopes in generator MIR
- [x] #61373 Emit StorageDead along unwind paths for generators

Before merging:

- [x] ~Wrap the types of all generator fields in `MaybeUninitialized` in layout::ty::field~ (opened #60889)
- [x] Make PR description more complete (e.g. explain why storage liveness is important and why we have to check every location)
- [x] Clean up TODO
- [x] Fix the layout code to enforce that the same field never moves around in the generator
- [x] Add tests for async/await
- [x] ~Reduce # bits we store by half, since the conflict relation is symmetric~ (note: decided not to do this, for simplicity)
- [x] Store liveness information for each yield point in our `GeneratorLayout`, that way we can emit more useful debuginfo AND tell miri which fields are definitely initialized for a given variant (see discussion at https://github.com/rust-lang/rust/pull/59897#issuecomment-489468627)

5 years agoAuto merge of #61741 - Centril:rollup-fgro5kz, r=Centril
bors [Tue, 11 Jun 2019 23:29:20 +0000 (23:29 +0000)]
Auto merge of #61741 - Centril:rollup-fgro5kz, r=Centril

Rollup of 11 pull requests

Successful merges:

 - #61518 (Add loops to doc list of things not stable in const fn)
 - #61526 (move some tests into subfolders)
 - #61550 (Windows 10 SDK is also required now.)
 - #61606 (Remove some legacy proc macro flavors)
 - #61652 (Mention slice patterns in array)
 - #61686 (librustc_errors: Add some more documentation)
 - #61698 (typeck: Fix const generic in repeat param ICE.)
 - #61707 (Azure: retry failed awscli installs)
 - #61715 (make sure make_ascii_lowercase actually leaves upper-case non-ASCII characters alone)
 - #61724 (core: use memcmp optimization for 128 bit integer slices)
 - #61726 (Use `for_each` in `Iterator::partition`)

Failed merges:

r? @ghost

5 years agoMore review fixes
Tyler Mandry [Mon, 10 Jun 2019 22:54:00 +0000 (15:54 -0700)]
More review fixes

5 years agoAuto merge of #61735 - eddyb:must-use-life, r=oli-obk
bors [Tue, 11 Jun 2019 20:45:17 +0000 (20:45 +0000)]
Auto merge of #61735 - eddyb:must-use-life, r=oli-obk

Add deny(unused_lifetimes) to all the crates that have deny(internal).

@Zoxc brought up, regarding #61722, that we don't force the removal of unused lifetimes.
Turns out that it's not that bad to enable for compiler crates (I wonder why it's not `warn` by default?).

I would've liked to enable `single_use_lifetimes` as well, but https://github.com/rust-lang/rust/issues/53738 makes it unusable for now.

For the `rustfmt` commit, I used https://github.com/rust-lang/rustfmt/issues/1324#issuecomment-482109952, and manually filtered out some noise.

r? @oli-obk cc @rust-lang/compiler

5 years agois_fp and is_floating_point do the same thing, remove the former
Ralf Jung [Sun, 9 Jun 2019 10:53:47 +0000 (12:53 +0200)]
is_fp and is_floating_point do the same thing, remove the former

also consistently mark all these is_* methods for inlining

5 years agoRollup merge of #61726 - cuviper:partition-for_each, r=scottmcm
Mazdak Farrokhzad [Tue, 11 Jun 2019 15:14:12 +0000 (17:14 +0200)]
Rollup merge of #61726 - cuviper:partition-for_each, r=scottmcm

Use `for_each` in `Iterator::partition`

We already use this for `unzip`, but `partition` is not much different.

5 years agoRollup merge of #61724 - aschampion:128-bit-memcmp, r=sfackler
Mazdak Farrokhzad [Tue, 11 Jun 2019 15:14:11 +0000 (17:14 +0200)]
Rollup merge of #61724 - aschampion:128-bit-memcmp, r=sfackler

core: use memcmp optimization for 128 bit integer slices

All other sized integer slices do this. From #61665.

5 years agoRollup merge of #61715 - RalfJung:test-ascii-lowercase, r=varkor
Mazdak Farrokhzad [Tue, 11 Jun 2019 15:14:09 +0000 (17:14 +0200)]
Rollup merge of #61715 - RalfJung:test-ascii-lowercase, r=varkor

make sure make_ascii_lowercase actually leaves upper-case non-ASCII characters alone

Cc https://github.com/rust-lang/rust/pull/61677 @napen123

5 years agoRollup merge of #61707 - wesleywiser:awscli_retry, r=alexcrichton
Mazdak Farrokhzad [Tue, 11 Jun 2019 15:14:08 +0000 (17:14 +0200)]
Rollup merge of #61707 - wesleywiser:awscli_retry, r=alexcrichton

Azure: retry failed awscli installs

Fixes #61604

r? @pietroalbini

5 years agoRollup merge of #61698 - davidtwco:ice-const-generic-length, r=varkor
Mazdak Farrokhzad [Tue, 11 Jun 2019 15:14:04 +0000 (17:14 +0200)]
Rollup merge of #61698 - davidtwco:ice-const-generic-length, r=varkor

typeck: Fix const generic in repeat param ICE.

Fixes #61336. Turns out this wasn't related to #49147 after all.

r? @varkor

5 years agoRollup merge of #61686 - phansch:librustc_errors_docs, r=estebank
Mazdak Farrokhzad [Tue, 11 Jun 2019 15:14:03 +0000 (17:14 +0200)]
Rollup merge of #61686 - phansch:librustc_errors_docs, r=estebank

librustc_errors: Add some more documentation

r? @estebank

5 years agoRollup merge of #61652 - JohnTitor:docs-improve-array, r=Centril
Mazdak Farrokhzad [Tue, 11 Jun 2019 15:14:01 +0000 (17:14 +0200)]
Rollup merge of #61652 - JohnTitor:docs-improve-array, r=Centril

Mention slice patterns in array

Fixes #61650

r? @scottmcm

5 years agoRollup merge of #61606 - petrochenkov:legclean, r=pnkfelix
Mazdak Farrokhzad [Tue, 11 Jun 2019 15:13:59 +0000 (17:13 +0200)]
Rollup merge of #61606 - petrochenkov:legclean, r=pnkfelix

Remove some legacy proc macro flavors

Namely
- `IdentTT` (`foo! ident { ... }`). Can be replaced with `foo! { ident ... }` or something similar.
- `MultiDecorator`. Can be replaced by `MultiModifier` (aka `LegacyAttr` after renaming).
- `DeclMacro`. It was a less powerful duplicate of `NormalTT` (aka `LegacyBang` after renaming) and can be replaced by it.

Stuff like this slows down any attempts to refactor the expansion infra, so it's desirable to retire it already.
I'm not sure whether a lang team decision is necessary, but would be nice to land this sooner because I have some further work in this area scheduled.

The documentation commit (https://github.com/rust-lang/rust/commit/a9397fd0d5eede4bbc0ada94bf92657ca8084cb3) describes how the remaining variants are different from each other and shows that there's actually some system behind them.

The last commit renames variants of `SyntaxExtension` in more systematic way.
- `ProcMacro` -> `Bang`
- `NormalTT` -> `LegacyBang`
- `AttrProcMacro` -> `Attr`
- `MultiModifier` -> `LegacyAttr`
- `ProcMacroDerive` -> `Derive`
- `BuiltinDerive` -> `LegacyDerive`

All the `Legacy*` variants are AST-based, as opposed to "modern" token-based variants.

5 years agoRollup merge of #61550 - jacobsun:patch-1, r=alexcrichton
Mazdak Farrokhzad [Tue, 11 Jun 2019 15:13:58 +0000 (17:13 +0200)]
Rollup merge of #61550 - jacobsun:patch-1, r=alexcrichton

Windows 10 SDK is also required now.

5 years agoRollup merge of #61526 - lcnr:test_reorder, r=nikomatsakis
Mazdak Farrokhzad [Tue, 11 Jun 2019 15:13:56 +0000 (17:13 +0200)]
Rollup merge of #61526 - lcnr:test_reorder, r=nikomatsakis

move some tests into subfolders

This reduces the size of the test folders without making the moved tests harder to find.

Is this kind of change desired/worth the effort?

5 years agoRollup merge of #61518 - czipperz:const-fn-doc-disallow-loops, r=Centril
Mazdak Farrokhzad [Tue, 11 Jun 2019 15:13:54 +0000 (17:13 +0200)]
Rollup merge of #61518 - czipperz:const-fn-doc-disallow-loops, r=Centril

Add loops to doc list of things not stable in const fn

Closes #61508

5 years agoci: Collect CPU usage statistics on Azure
Alex Crichton [Fri, 7 Jun 2019 18:30:11 +0000 (11:30 -0700)]
ci: Collect CPU usage statistics on Azure

This commit adds a script which we'll execute on Azure Pipelines which
is intended to run in the background and passively collect CPU usage
statistics for our builders. The intention here is that we can use this
information over time to diagnose issues with builders, see where we can
optimize our build, fix parallelism issues, etc. This might not end up
being too useful in the long run but it's data we've wanted to collect
for quite some time now, so here's a stab at it!

Comments about how this is intended to work can be found in the python
script used here to collect CPU usage statistics.

Closes #48828

5 years agoRun `rustfmt --file-lines ...` for changes from previous commits.
Eduard-Mihai Burtescu [Tue, 11 Jun 2019 10:20:33 +0000 (13:20 +0300)]
Run `rustfmt --file-lines ...` for changes from previous commits.

5 years agoAdd deny(unused_lifetimes) to all the crates that have deny(internal).
Eduard-Mihai Burtescu [Tue, 11 Jun 2019 09:50:47 +0000 (12:50 +0300)]
Add deny(unused_lifetimes) to all the crates that have deny(internal).

5 years agorustdoc: deny(unused_lifetimes).
Eduard-Mihai Burtescu [Tue, 11 Jun 2019 09:50:17 +0000 (12:50 +0300)]
rustdoc: deny(unused_lifetimes).

5 years agorustc_codegen_*: deny(unused_lifetimes).
Eduard-Mihai Burtescu [Tue, 11 Jun 2019 09:49:10 +0000 (12:49 +0300)]
rustc_codegen_*: deny(unused_lifetimes).

5 years agorustc_borrowck: deny(unused_lifetimes).
Eduard-Mihai Burtescu [Tue, 11 Jun 2019 09:48:58 +0000 (12:48 +0300)]
rustc_borrowck: deny(unused_lifetimes).

5 years agorustc_traits: deny(unused_lifetimes).
Eduard-Mihai Burtescu [Tue, 11 Jun 2019 09:47:56 +0000 (12:47 +0300)]
rustc_traits: deny(unused_lifetimes).

5 years agorustc_mir: deny(unused_lifetimes).
Eduard-Mihai Burtescu [Tue, 11 Jun 2019 09:47:30 +0000 (12:47 +0300)]
rustc_mir: deny(unused_lifetimes).

5 years agorustc_lint: deny(unused_lifetimes).
Eduard-Mihai Burtescu [Tue, 11 Jun 2019 09:47:08 +0000 (12:47 +0300)]
rustc_lint: deny(unused_lifetimes).

5 years agorustc_incremental: deny(unused_lifetimes).
Eduard-Mihai Burtescu [Tue, 11 Jun 2019 09:46:49 +0000 (12:46 +0300)]
rustc_incremental: deny(unused_lifetimes).

5 years agorustc: deny(unused_lifetimes).
Eduard-Mihai Burtescu [Tue, 11 Jun 2019 09:21:38 +0000 (12:21 +0300)]
rustc: deny(unused_lifetimes).

5 years agosyntax_ext: deny(unused_lifetimes).
Eduard-Mihai Burtescu [Tue, 11 Jun 2019 09:21:12 +0000 (12:21 +0300)]
syntax_ext: deny(unused_lifetimes).

5 years agorustc_target: deny(unused_lifetimes).
Eduard-Mihai Burtescu [Tue, 11 Jun 2019 09:20:56 +0000 (12:20 +0300)]
rustc_target: deny(unused_lifetimes).

5 years agoAuto merge of #60463 - mjbshaw:transparent, r=varkor,rkruppe
bors [Tue, 11 Jun 2019 11:06:38 +0000 (11:06 +0000)]
Auto merge of #60463 - mjbshaw:transparent, r=varkor,rkruppe

Implement RFC 2645 (transparent enums and unions)

Tracking issue: #60405

5 years agoMigrate rust-by-example to MdBook2
Mateusz Mikuła [Tue, 11 Jun 2019 09:49:38 +0000 (11:49 +0200)]
Migrate rust-by-example to MdBook2

5 years agoAuto merge of #61673 - RalfJung:miri-no-hard-float, r=eddyb,oli-obk
bors [Tue, 11 Jun 2019 08:15:12 +0000 (08:15 +0000)]
Auto merge of #61673 - RalfJung:miri-no-hard-float, r=eddyb,oli-obk

Miri: convert to/from apfloat instead of host floats

Cc @oli-obk @eddyb

5 years agoAuto merge of #61492 - RalfJung:const-qualif-comments, r=eddyb
bors [Tue, 11 Jun 2019 05:24:41 +0000 (05:24 +0000)]
Auto merge of #61492 - RalfJung:const-qualif-comments, r=eddyb

Const qualification comments

I extracted some const-qualif knowledge from @eddyb. This is my attempt to turn that into comments.

Cc @oli-obk  @eddyb

5 years agoImplement RFC 2645 (transparent enums and unions)
Michael Bradshaw [Wed, 22 May 2019 14:31:09 +0000 (07:31 -0700)]
Implement RFC 2645 (transparent enums and unions)

Tracking issue: #60405

5 years agoAuto merge of #61052 - jsgf:emit-save-analysis-notifications, r=alexcrichton
bors [Tue, 11 Jun 2019 02:25:39 +0000 (02:25 +0000)]
Auto merge of #61052 - jsgf:emit-save-analysis-notifications, r=alexcrichton

Emit save analysis notifications

Addresses issue https://github.com/rust-lang/rust/issues/61047

5 years agoAuto merge of #60793 - Xanewok:raw-string-cleanup, r=petrochenkov
bors [Mon, 10 Jun 2019 23:32:12 +0000 (23:32 +0000)]
Auto merge of #60793 - Xanewok:raw-string-cleanup, r=petrochenkov

lexer: Disallow bare CR in raw byte strings

Handles bare CR ~but doesn't translate `\r\n` to `\n` yet in raw strings yet~ and translates CRLF to LF in raw strings.

As a side-note I think it'd be good to change the `unescape_` to return plain iterators to reduce some boilerplate (e.g. `has_error` could benefit from collecting `Result<T>` and aborting early on errors) but will do that separately, unless I missed something here that prevents it.

@matklad @petrochenkov thoughts?

5 years agoExtract generator_layout as a method
Tyler Mandry [Sat, 1 Jun 2019 04:59:37 +0000 (21:59 -0700)]
Extract generator_layout as a method

5 years agoExtract univariant_uninterned as method
Tyler Mandry [Sat, 1 Jun 2019 04:30:08 +0000 (21:30 -0700)]
Extract univariant_uninterned as method

5 years agoUse DataflowResultsConsumer and remove dataflow::for_each_location
Tyler Mandry [Sat, 1 Jun 2019 03:51:07 +0000 (20:51 -0700)]
Use DataflowResultsConsumer and remove dataflow::for_each_location

5 years agoUse BitMatrix for storage conflicts
Tyler Mandry [Fri, 31 May 2019 23:53:27 +0000 (16:53 -0700)]
Use BitMatrix for storage conflicts

5 years agoAdd more functionality to BitMatrix
Tyler Mandry [Fri, 31 May 2019 22:59:56 +0000 (15:59 -0700)]
Add more functionality to BitMatrix

5 years agoSmall review fixes
Tyler Mandry [Wed, 22 May 2019 23:36:36 +0000 (16:36 -0700)]
Small review fixes

5 years agoAdd test suite
Tyler Mandry [Fri, 10 May 2019 01:13:40 +0000 (18:13 -0700)]
Add test suite

5 years agoOnly include generator saved locals in the variants that need them
Tyler Mandry [Fri, 10 May 2019 01:07:30 +0000 (18:07 -0700)]
Only include generator saved locals in the variants that need them

5 years agoOverlap locals that never have storage live at the same time
Tyler Mandry [Wed, 8 May 2019 02:47:18 +0000 (19:47 -0700)]
Overlap locals that never have storage live at the same time

...and are only included in a single variant.

5 years agoCollect conflict information in GeneratorLayout
Tyler Mandry [Thu, 30 May 2019 21:27:12 +0000 (14:27 -0700)]
Collect conflict information in GeneratorLayout

5 years agoUse `for_each` in `Iterator::partition`
Josh Stone [Mon, 10 Jun 2019 21:06:56 +0000 (14:06 -0700)]
Use `for_each` in `Iterator::partition`

We already use this for `unzip`, but `partition` is not much different.

5 years agosyntax: Rename variants of `SyntaxExtension` for consistency
Vadim Petrochenkov [Thu, 6 Jun 2019 23:30:01 +0000 (02:30 +0300)]
syntax: Rename variants of `SyntaxExtension` for consistency

5 years agosyntax: Improve documentation of `SyntaxExtension`
Vadim Petrochenkov [Thu, 6 Jun 2019 22:59:27 +0000 (01:59 +0300)]
syntax: Improve documentation of `SyntaxExtension`

5 years agosyntax: Remove `SyntaxExtension::DeclMacro`
Vadim Petrochenkov [Thu, 6 Jun 2019 21:37:47 +0000 (00:37 +0300)]
syntax: Remove `SyntaxExtension::DeclMacro`

It's a less powerful duplicate of `SyntaxExtension::NormalTT`

5 years agosyntax: Use `MultiItemModifier` for built-in derives
Vadim Petrochenkov [Thu, 6 Jun 2019 20:21:44 +0000 (23:21 +0300)]
syntax: Use `MultiItemModifier` for built-in derives

5 years agosyntax: Remove `SyntaxExtension::MultiDecorator` and `MultiItemDecorator`
Vadim Petrochenkov [Thu, 6 Jun 2019 18:38:27 +0000 (21:38 +0300)]
syntax: Remove `SyntaxExtension::MultiDecorator` and `MultiItemDecorator`

5 years agoAuto merge of #61694 - Xanewok:update-rls, r=kennytm
bors [Mon, 10 Jun 2019 18:24:43 +0000 (18:24 +0000)]
Auto merge of #61694 - Xanewok:update-rls, r=kennytm

Update RLS

This includes https://github.com/rust-lang/rls/pull/1482 which should finally fix the spurious tests RLS in Rust CI (test-pass -> test-fail).

r? @oli-obk
cc @ehuss

5 years agosyntax: Remove `SyntaxExtension::IdentTT` and `IdentMacroExpander`
Vadim Petrochenkov [Thu, 6 Jun 2019 18:10:16 +0000 (21:10 +0300)]
syntax: Remove `SyntaxExtension::IdentTT` and `IdentMacroExpander`

5 years agocore: use memcmp optimization for 128 bit integer slices
Andrew Champion [Mon, 10 Jun 2019 17:08:05 +0000 (18:08 +0100)]
core: use memcmp optimization for 128 bit integer slices

5 years agoEmit artifact notifications for save-analysis output
Jeremy Fitzhardinge [Wed, 22 May 2019 17:37:33 +0000 (10:37 -0700)]
Emit artifact notifications for save-analysis output

Issue: https://github.com/rust-lang/rust/issues/61047

5 years agotypeck: Fix const generic in repeat param ICE.
David Wood [Sun, 9 Jun 2019 19:54:28 +0000 (20:54 +0100)]
typeck: Fix const generic in repeat param ICE.

This commit fixes an ICE that occured when a const generic was used in
a repeat expression. This was due to the code expecting the length of
the repeat expression to be const evaluatable to a constant, but a const
generic parameter is not (however, it can be made into a constant).

5 years agoDon't suggest using \r in raw strings
Igor Matuszewski [Mon, 10 Jun 2019 15:32:15 +0000 (17:32 +0200)]
Don't suggest using \r in raw strings

5 years agoAuto merge of #61716 - Centril:rollup-nxwf5ol, r=Centril
bors [Mon, 10 Jun 2019 11:15:07 +0000 (11:15 +0000)]
Auto merge of #61716 - Centril:rollup-nxwf5ol, r=Centril

Rollup of 5 pull requests

Successful merges:

 - #59600 (Replaced linear token counting macros with optimized implementation)
 - #61501 (get rid of real_intrinsics module)
 - #61570 (Fix issues with const argument inference)
 - #61683 (Haiku: the maximum stack size is 16 MB)
 - #61697 (submodules: update clippy from 71be6f62 to c0dbd34b)

Failed merges:

r? @ghost

5 years agoRollup merge of #61697 - matthiaskrgr:submodule_upd, r=Manishearth
Mazdak Farrokhzad [Mon, 10 Jun 2019 11:14:32 +0000 (13:14 +0200)]
Rollup merge of #61697 - matthiaskrgr:submodule_upd, r=Manishearth

submodules: update clippy from 71be6f62 to c0dbd34b

Changes:
````
travis: disable rls integration test.
rustup https://github.com/rust-lang/rust/pull/61669/
Add OUTER_EXPN_INFO lint
````

Should fix clippy toolstate

5 years agoRollup merge of #61683 - nielx:haiku-stack-limit, r=nagisa
Mazdak Farrokhzad [Mon, 10 Jun 2019 11:14:31 +0000 (13:14 +0200)]
Rollup merge of #61683 - nielx:haiku-stack-limit, r=nagisa

Haiku: the maximum stack size is 16 MB

This keeps the compiler from crashing every time it is invoked. No functional change on other platforms.

This patch is similar to the limitation that is in the [librustdoc/lib.rs](https://github.com/rust-lang/rust/blob/57e13e0325c1d41161a31de1f8520538ec2c575c/src/librustdoc/lib.rs#L89).

5 years agoRollup merge of #61570 - varkor:infer-const-arg, r=eddyb
Mazdak Farrokhzad [Mon, 10 Jun 2019 11:14:29 +0000 (13:14 +0200)]
Rollup merge of #61570 - varkor:infer-const-arg, r=eddyb

Fix issues with const argument inference

Fixes https://github.com/rust-lang/rust/issues/60724.
Fixes https://github.com/rust-lang/rust/issues/61346.

r? @eddyb

5 years agoRollup merge of #61501 - RalfJung:intrinsics, r=rkruppe
Mazdak Farrokhzad [Mon, 10 Jun 2019 11:14:28 +0000 (13:14 +0200)]
Rollup merge of #61501 - RalfJung:intrinsics, r=rkruppe

get rid of real_intrinsics module

instead import intrinsics locally in their wrapper functions.

(These functions are wrapper functions as a preparation to fixing https://github.com/rust-lang/rust/issues/53871.)

5 years agoRollup merge of #59600 - tobia:master, r=pnkfelix
Mazdak Farrokhzad [Mon, 10 Jun 2019 11:14:26 +0000 (13:14 +0200)]
Rollup merge of #59600 - tobia:master, r=pnkfelix

Replaced linear token counting macros with optimized implementation

There are currently two distinct token-counting macros in the source. Both implement the trivial algorithm, with linear complexity. They may or may not be adequate for their use case, but considering that other people are probably going to copy and paste them whenever they need a token-counting macro, I replaced them with an optimized implementation with logarithmic complexity.

5 years agocomments
Ralf Jung [Thu, 6 Jun 2019 10:52:01 +0000 (12:52 +0200)]
comments

5 years agoconst-correctness might be confusing for C++ people
Ralf Jung [Thu, 6 Jun 2019 10:50:05 +0000 (12:50 +0200)]
const-correctness might be confusing for C++ people

5 years agoavoid 'const-context' terminology
Ralf Jung [Thu, 6 Jun 2019 09:47:52 +0000 (11:47 +0200)]
avoid 'const-context' terminology

5 years agoreplace some mode comparisons by more readable function call, rename some Mode, and...
Ralf Jung [Mon, 3 Jun 2019 15:41:16 +0000 (17:41 +0200)]
replace some mode comparisons by more readable function call, rename some Mode, and more comments

5 years agosome more comments for const_qualif
Ralf Jung [Mon, 3 Jun 2019 15:34:41 +0000 (17:34 +0200)]
some more comments for const_qualif

5 years agomake sure to_ascii_lowercase actually leaves upper-case non-ASCII characters alone
Ralf Jung [Mon, 10 Jun 2019 10:42:43 +0000 (12:42 +0200)]
make sure to_ascii_lowercase actually leaves upper-case non-ASCII characters alone

5 years agoAddress review comments
Philipp Hansch [Mon, 10 Jun 2019 08:59:03 +0000 (10:59 +0200)]
Address review comments

Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
5 years agolibrustc_errors: Add some more documentation
Philipp Hansch [Sun, 9 Jun 2019 10:04:40 +0000 (12:04 +0200)]
librustc_errors: Add some more documentation

5 years agoAuto merge of #61506 - imbrem:mir_body_renaming, r=eddyb
bors [Mon, 10 Jun 2019 08:07:22 +0000 (08:07 +0000)]
Auto merge of #61506 - imbrem:mir_body_renaming, r=eddyb

Changed usages of `mir` in librustc::mir and librustc_mir to `body`

Work on part 2 of #60229

5 years agoHaiku: the maximum stack size is 16 MB
Niels Sascha Reedijk [Sun, 27 Jan 2019 08:25:25 +0000 (09:25 +0100)]
Haiku: the maximum stack size is 16 MB

When one tries to create a thread with a requested stack size larger
than 16 MB, the call will fail and the compiler will bail out. Therefore
we should limit the size of the thread stack to 16 MB on Haiku.

5 years agoAuto merge of #61608 - Aaron1011:feature/weird-expr-yield, r=Centril
bors [Mon, 10 Jun 2019 05:17:12 +0000 (05:17 +0000)]
Auto merge of #61608 - Aaron1011:feature/weird-expr-yield, r=Centril

Add nested 'yield' expression to weird expressions test

5 years agoAdd an example
Yuki Okushi [Mon, 10 Jun 2019 04:30:45 +0000 (13:30 +0900)]
Add an example

5 years agoAuto merge of #61706 - petrhosek:bootstrap-cp-r, r=Mark-Simulacrum
bors [Mon, 10 Jun 2019 02:35:29 +0000 (02:35 +0000)]
Auto merge of #61706 - petrhosek:bootstrap-cp-r, r=Mark-Simulacrum

Use Build::read_dir instead of fs::read_dir in Build::cp_r

Build::read_dir does better error handling when the directory doesn't
exist; it actually prints the name of the directory rather than just
printing the underlying error "No such file or directory" which on
its own isn't very useful.

5 years agoReword const fn conditional and loop error text
Chris Gregory [Mon, 10 Jun 2019 02:02:28 +0000 (19:02 -0700)]
Reword const fn conditional and loop error text

5 years agoAzure: retry failed awscli installs
Wesley Wiser [Mon, 10 Jun 2019 01:28:47 +0000 (21:28 -0400)]
Azure: retry failed awscli installs

Fixes #61604

5 years agoUse Build::read_dir instead of fs::read_dir in Build::cp_r
Petr Hosek [Sun, 9 Jun 2019 23:57:17 +0000 (16:57 -0700)]
Use Build::read_dir instead of fs::read_dir in Build::cp_r

Build::read_dir does better error handling when the directory doesn't
exist; it actually prints the name of the directory rather than just
printing the underlying error "No such file or directory" which on
its own isn't very useful.

5 years agoPass cflags rather than cxxflags to LLVM as CMAKE_C_FLAGS
Petr Hosek [Sun, 9 Jun 2019 23:53:46 +0000 (16:53 -0700)]
Pass cflags rather than cxxflags to LLVM as CMAKE_C_FLAGS

We mistakenly pass cxxflags from the configuration to LLVM build as
CMAKE_C_FLAGS.

5 years agoAuto merge of #61229 - Centril:stabilize-repr_align_enum, r=nagisa
bors [Sun, 9 Jun 2019 23:50:04 +0000 (23:50 +0000)]
Auto merge of #61229 - Centril:stabilize-repr_align_enum, r=nagisa

Stabilize #![feature(repr_align_enum)] in Rust 1.37.0

On an `enum` item, you may now write:

```rust
#[repr(align(X))]
enum Foo {
    // ...
}
```

This has equivalent effects to first defining:

```rust
#[repr(align(X))]
struct AlignX<T>(T);
```

and then using `AlignX<Foo>` in `Foo`'s stead.

r? @nagisa

5 years agoimplement nth_back for RangeInclusive
Adrian Friedli [Sun, 9 Jun 2019 20:45:11 +0000 (22:45 +0200)]
implement nth_back for RangeInclusive

5 years agoProperly point at the last opening brace
Mark Rousskov [Fri, 7 Jun 2019 01:31:24 +0000 (19:31 -0600)]
Properly point at the last opening brace

5 years agoAdd comment about raw strings to self.style
Mark Rousskov [Fri, 7 Jun 2019 00:38:34 +0000 (18:38 -0600)]
Add comment about raw strings to self.style

5 years agoIntroduce InnerSpan abstraction
Mark Rousskov [Tue, 4 Jun 2019 15:03:43 +0000 (09:03 -0600)]
Introduce InnerSpan abstraction

This should be used when trying to get at subsets of a larger span,
especially when the larger span is not available in the code attempting
to work with those subsets (especially common in the fmt_macros crate).

This is usually a good replacement for (BytePos, BytePos) and (usize,
usize) tuples.

This commit also removes from_inner_byte_pos, since it took usize
arguments, which is error prone.

5 years agoShift padding out of suggestions for format strings
Mark Rousskov [Thu, 6 Jun 2019 22:49:51 +0000 (16:49 -0600)]
Shift padding out of suggestions for format strings

5 years agoChanged usages of `mir` in librustc::mir and librustc_mir to `body`
Jad Ghalayini [Mon, 3 Jun 2019 22:26:48 +0000 (18:26 -0400)]
Changed usages of `mir` in librustc::mir and librustc_mir to `body`

5 years agoUse Symbol for named arguments in fmt_macros
Mark Rousskov [Tue, 4 Jun 2019 02:47:42 +0000 (20:47 -0600)]
Use Symbol for named arguments in fmt_macros

5 years agoInline raw method
Mark Rousskov [Tue, 4 Jun 2019 14:57:40 +0000 (08:57 -0600)]
Inline raw method