Commit graph

91805 commits

Author SHA1 Message Date
bors
546cb21f58 Auto merge of #59657 - Centril:rollup-w5p98mc, r=Centril
Rollup of 4 pull requests

Successful merges:

 - #55448 (Add 'partition_at_index/_by/_by_key' for slices.)
 - #59186 (improve worst-case performance of BTreeSet intersection v3)
 - #59514 (Remove adt_def from projections and downcasts in MIR)
 - #59630 (Shrink `mir::Statement`.)

Failed merges:

r? @ghost
2019-04-03 05:30:20 +00:00
Mazdak Farrokhzad
d31d80b7d4
Rollup merge of #59630 - nnethercote:shrink-mir-Statement, r=pnkfelix
Shrink `mir::Statement`.

The `InlineAsm` variant is extremely rare, and `mir::Statement` often
contributes significantly to peak memory usage.
2019-04-03 04:36:14 +02:00
Mazdak Farrokhzad
a96e3883c1
Rollup merge of #59514 - tmandry:remove-adt-def-from-projection-elem, r=eddyb
Remove adt_def from projections and downcasts in MIR

As part of optimizing generator layouts in MIR, we'd like to allow downcasting generators to variants which do not have a corresponding `def_id`, since they are created by the compiler.

This refactor hopes to allow that, without regressing perf.

r? @eddyb
2019-04-03 04:36:12 +02:00
Mazdak Farrokhzad
9898182b47
Rollup merge of #59186 - ssomers:btreeset_intersection_revisited_again, r=KodrAus
improve worst-case performance of BTreeSet intersection v3

Variation of [#59078](https://github.com/rust-lang/rust/pull/59078) with `Intersection` remaining a struct

r? @scottmcm
2019-04-03 04:36:11 +02:00
Mazdak Farrokhzad
2f37c5a358
Rollup merge of #55448 - Mokosha:SortAtIndex, r=bluss
Add 'partition_at_index/_by/_by_key' for slices.

This is an analog to C++'s std::nth_element (a.k.a. quickselect).

Corresponds to tracking bug #55300.
2019-04-03 04:36:09 +02:00
Chris Gregory
76e82d6f52 Link to sync_all 2019-04-02 22:26:11 -04:00
Nicholas Nethercote
ff94feabc2 Tweak Span encoding.
Failing to fit `base` is more common than failing to fit `len`.
2019-04-03 10:03:34 +11:00
Nicholas Nethercote
d00d639c54 Shrink mir::Statement.
The `InlineAsm` variant is extremely rare, and `mir::Statement` often
contributes significantly to peak memory usage.
2019-04-03 09:09:59 +11:00
bors
7641873f59 Auto merge of #59638 - alexcrichton:less-assertions, r=pietroalbini
ci: Disable llvm/debug assertions on x86_64-mingw

Tracked at #59637 for re-enabling this commit disables assertions to
hopefully bring the runtime for this builder under control.
2019-04-02 21:40:20 +00:00
Tyler Mandry
4122d2221e Remove adt_def from PlaceTy and make it a struct 2019-04-02 12:02:17 -07:00
Tyler Mandry
ac29ca75e0 Replace adt_def with name in mir::ProjectionElem::Downcast 2019-04-02 12:02:17 -07:00
Alex Crichton
1334314709 ci: Disable llvm/debug assertions on x86_64-mingw
Tracked at #59637 for re-enabling this commit disables assertions to
hopefully bring the runtime for this builder under control.
2019-04-02 11:13:44 -07:00
bors
428943cc29 Auto merge of #59636 - Centril:rollup, r=Centril
Rollup of 4 pull requests

Successful merges:

 - #59166 (resolve: collect trait aliases along with traits)
 - #59341 (Fix custom relative libdir)
 - #59446 (Fix stack overflow when generating debuginfo for 'recursive' type)
 - #59529 (Added documentation on the remainder (Rem) operator for floating points.)

Failed merges:

r? @ghost
2019-04-02 16:26:10 +00:00
Mazdak Farrokhzad
21e2e98b8c
Rollup merge of #59529 - DevQps:improve-rem-docs, r=cuviper
Added documentation on the remainder (Rem) operator for floating points.

# Description

As has been explained in #57738 the remainder operator on floating points is not clear.
This PR requests adds some information on how the `Rem` / remainder operator on floating points works.

Note also that this description is for both `Rem<f32> for f32` and `Rem<f64> for f64` implementations.

Ps. I wasn't really sure on how to formulate things. So please suggest changes if you have better idea's!

closes #57738
2019-04-02 18:25:17 +02:00
Mazdak Farrokhzad
57a4f17b6e
Rollup merge of #59446 - Aaron1011:fix/debuginfo-overflow, r=oli-obk
Fix stack overflow when generating debuginfo for 'recursive' type

By using 'impl trait', it's possible to create a self-referential
type as follows:

fn foo() -> impl Copy { foo }

This is a function which returns itself.
Normally, the signature of this function would be impossible
to write - it would look like 'fn foo() -> fn() -> fn() ...'
e.g. a function which returns a function, which returns a function...

Using 'impl trait' allows us to avoid writing this infinitely long
type. While it's useless for practical purposes, it does compile and run

However, issues arise when we try to generate llvm debuginfo for such a
type. All 'impl trait' types (e.g. ty::Opaque) are resolved when we
generate debuginfo, which can lead to us recursing back to the original
'fn' type when we try to process its return type.

To resolve this, I've modified debuginfo generation to account for these
kinds of weird types. Unfortunately, there's no 'correct' debuginfo that
we can generate - 'impl trait' does not exist in debuginfo, and this
kind of recursive type is impossible to directly represent.

To ensure that we emit *something*, this commit emits dummy
debuginfo/type names whenever it encounters a self-reference. In
practice, this should never happen - it's just to ensure that we can
emit some kind of debuginfo, even if it's not particularly meaningful

Fixes #58463
2019-04-02 18:25:15 +02:00
Mazdak Farrokhzad
6bd01efcea
Rollup merge of #59341 - o01eg:use-custom-libdir, r=Mark-Simulacrum
Fix custom relative libdir

While working on #58947 I found out relative libdir ignored during setting LD_LIBRARY_PATH.
2019-04-02 18:25:14 +02:00
Mazdak Farrokhzad
a2f3f0cdb3
Rollup merge of #59166 - seanmonstar:trait-alias-import, r=alexreg
resolve: collect trait aliases along with traits

It seems trait aliases weren't being collected as `TraitCandidates` in resolve, this should change that. (I can't compile the full compiler locally, so relying on CI...)

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

r? @alexreg
2019-04-02 18:25:12 +02:00
bors
e008e4fde8 Auto merge of #59632 - Centril:rollup, r=Centril
Rollup of 8 pull requests

Successful merges:

 - #59262 (Remove duplicated code from Iterator::{ne, lt, le, gt, ge})
 - #59286 (Refactor async fn return type lowering)
 - #59444 (Implement useful steps_between for all integers)
 - #59452 (Speed up rustdoc run a bit)
 - #59533 (Support allocating iterators with arenas)
 - #59585 (Fixes for shallow borrows)
 - #59607 (Renames `EvalErrorKind` to `InterpError`)
 - #59613 (SGX target: convert a bunch of panics to aborts)

Failed merges:

 - #59630 (Shrink `mir::Statement`.)

r? @ghost
2019-04-02 13:06:12 +00:00
Mazdak Farrokhzad
d0d3466337
Rollup merge of #59613 - jethrogb:jb/waitqueue-wait-unwind, r=alexcrichton
SGX target: convert a bunch of panics to aborts

Fixes https://github.com/fortanix/rust-sgx/issues/86, https://github.com/fortanix/rust-sgx/issues/103 and in general protect preemptively against Iago attacks by aborting instead of unwinding in potentially unexpected situations.
2019-04-02 13:47:31 +02:00
Mazdak Farrokhzad
85a82ac334
Rollup merge of #59607 - kenta7777:renames-EvalErrorKind-to-InterpError, r=oli-obk
Renames `EvalErrorKind` to `InterpError`

This PR renames `EvalErrorKind` to `InterpError`.
This is related to #54395.
2019-04-02 13:47:30 +02:00
Mazdak Farrokhzad
69bc687f20
Rollup merge of #59585 - rust-lang:shallow-borrow-fixes, r=pnkfelix
Fixes for shallow borrows

* Don't promote these borrows if we're going to remove them before
  codegen
* Correctly mark unreachable code
2019-04-02 13:47:28 +02:00
Mazdak Farrokhzad
274f80e4d4
Rollup merge of #59533 - Zoxc:arena-slices, r=michaelwoerister
Support allocating iterators with arenas

Split out from https://github.com/rust-lang/rust/pull/57173.

r? @michaelwoerister
2019-04-02 13:47:27 +02:00
Mazdak Farrokhzad
e655b91b7a
Rollup merge of #59452 - GuillaumeGomez:speedup-rustdoc, r=QuietMisdreavus
Speed up rustdoc run a bit

r? @QuietMisdreavus
2019-04-02 13:47:25 +02:00
Mazdak Farrokhzad
5e8998a98d
Rollup merge of #59444 - cuviper:steps_between, r=scottmcm
Implement useful steps_between for all integers

We can use `usize::try_from` to convert steps from any size of integer.
This enables a meaningful `size_hint()` for larger ranges, rather than
always just `(0, None)`. Now they return the true `(len, Some(len))`
when it fits, otherwise `(usize::MAX, None)` for overflow.
2019-04-02 13:47:24 +02:00
Mazdak Farrokhzad
d86a8f3563
Rollup merge of #59286 - cramertj:async-fn-ret-ty, r=varkor
Refactor async fn return type lowering

async fn now lowers directly to an existential type declaration
rather than reusing the `impl Trait` return type lowering.

As part of this, it lowers all argument-position elided lifetimes
using the in-band-lifetimes machinery, creating fresh parameter
names for each of them, using each lifetime parameter as a generic
argument to the generated existential type.

This doesn't currently successfully allow multiple
argument-position elided lifetimes since `existential type`
doesn't yet support multiple lifetimes where neither outlive
the other:
```rust
existential type Foo<'a, 'b>:; // error: ambiguous lifetime bound in `impl Trait`
fn foo<'a, 'b>(_: &'a u8, _: &'b u8) -> Foo<'a, 'b> { () }
```

This requires a separate fix.

Fix #59001
Fix #58885
Fix #55324
Fix #54974
Progress on #56238

r? @nikomatsakis
2019-04-02 13:47:22 +02:00
Mazdak Farrokhzad
c9d9df5830
Rollup merge of #59262 - timvermeulen:iterator_cmp_dedup, r=scottmcm
Remove duplicated code from Iterator::{ne, lt, le, gt, ge}

This PR delegates `Iterator::ne` to `Iterator::eq` and `Iterator::{lt, le, gt, ge}` to `Iterator::partial_cmp`.

Oddly enough, this change actually simplifies the generated assembly [in some cases](https://rust.godbolt.org/z/riBtNe), although I don't understand assembly well enough to see if the longer assembly is doing something clever.

I also added two extremely simple benchmarks:
```
// before
test iter::bench_lt               ... bench:      98,404 ns/iter (+/- 21,008)
test iter::bench_partial_cmp      ... bench:      62,437 ns/iter (+/- 5,009)

// after
test iter::bench_lt               ... bench:      61,757 ns/iter (+/- 8,770)
test iter::bench_partial_cmp      ... bench:      62,151 ns/iter (+/- 13,753)
```

I have no idea why the current `lt`/`le`/`gt`/`ge` implementations don't seem to be compiled optimally, but simply having them call `partial_cmp` seems to be an improvement.

See #44729 for a previous discussion.
2019-04-02 13:47:21 +02:00
Chris Gregory
b6ebe1bd9e Document using sync_all 2019-04-01 22:34:57 -04:00
Taylor Cramer
749349fc9f Refactor async fn return type lowering
async fn now lowers directly to an existential type declaration
rather than reusing the `impl Trait` return type lowering.

As part of this, it lowers all argument-position elided lifetimes
using the in-band-lifetimes machinery, creating fresh parameter
names for each of them, using each lifetime parameter as a generic
argument to the generated existential type.

This doesn't currently successfully allow multiple
argument-position elided lifetimes since `existential type`
doesn't yet support multiple lifetimes where neither outlive
the other. This requires a separate fix.
2019-04-01 18:25:57 -07:00
Christian
a1c79056e5 Improved the example with numbers that can be exactly represented as floats and added a comment with the solution. 2019-04-01 22:49:14 +02:00
John Kåre Alsaker
59ff059cfc Add ensure_capacity and rename min to len 2019-04-01 22:35:13 +02:00
John Kåre Alsaker
e8b3aea4d6 Use set_len 2019-04-01 21:52:13 +02:00
John Kåre Alsaker
30e7e9c5f0 Support allocating iterators with arenas 2019-04-01 21:47:55 +02:00
Jethro Beekman
6d96c8979d SGX target: convert a bunch of panics to aborts 2019-04-01 12:24:46 -07:00
bors
f694222887 Auto merge of #59606 - Centril:rollup, r=Centril
Rollup of 7 pull requests

Successful merges:

 - #58507 (Add a -Z time option which prints only passes which runs once)
 - #58919 (Suggest using anonymous lifetime in `impl Trait` return)
 - #59041 (fixes rust-lang#56766)
 - #59586 (Fixed URL in cargotest::TEST_REPOS)
 - #59595 (Update rustc-guide submodule)
 - #59601 (Fix small typo)
 - #59603 (stabilize ptr::hash)

Failed merges:

r? @ghost
2019-04-01 18:37:28 +00:00
Sean McArthur
3ccd35cd70 resolve all in scope trait aliases, then elaborate their bounds 2019-04-01 11:23:40 -07:00
Aaron Hill
c13daeb036
Fix typo 2019-04-01 13:41:41 -04:00
kenta7777
3c8caaca7d renames EvalErrorKind to InterpError 2019-04-02 01:02:18 +09:00
Mazdak Farrokhzad
e9b9f33ecc
Rollup merge of #59603 - matklad:ptrhash, r=Centril
stabilize ptr::hash

closes #56286
2019-04-01 17:29:59 +02:00
Mazdak Farrokhzad
c5045e24d4
Rollup merge of #59601 - kenta7777:typo-fix, r=Centril
Fix small typo

This PR fixes a small typo in `eq()` comments.
2019-04-01 17:29:58 +02:00
Mazdak Farrokhzad
249cf42120
Rollup merge of #59595 - mark-i-m:update-rustc-guide, r=steveklabnik
Update rustc-guide submodule

Just keeping up with the head...

r? @steveklabnik
2019-04-01 17:29:56 +02:00
Mazdak Farrokhzad
1d4f0e71c6
Rollup merge of #59586 - XAMPPRocky:redirect, r=alexcrichton
Fixed URL in cargotest::TEST_REPOS
2019-04-01 17:29:55 +02:00
Mazdak Farrokhzad
d2fd3fe957
Rollup merge of #59041 - saleemjaffer:trait_doc_comment_better_error_msg, r=pnkfelix
fixes rust-lang#56766

fixes #56766
2019-04-01 17:29:53 +02:00
Mazdak Farrokhzad
0d01fbaeb8
Rollup merge of #58919 - estebank:impl-trait-return-lifetime, r=pnkfelix
Suggest using anonymous lifetime in `impl Trait` return

Fix #48467.

r? @nikomatsakis
2019-04-01 17:29:51 +02:00
Mazdak Farrokhzad
9f9529acd5
Rollup merge of #58507 - Zoxc:time-extended, r=michaelwoerister
Add a -Z time option which prints only passes which runs once

This ensures `-Z time-passes` fits on my screen =P

r? @michaelwoerister
2019-04-01 17:29:48 +02:00
bors
9ebf47851a Auto merge of #59593 - pietroalbini:appveyor-version, r=alexcrichton
Print the appveyor agent version at the start of the build

[AppVeyor support asked for this.](https://help.appveyor.com/discussions/problems/19657-successful-builds-failing-with-code-259#comment_47132359)

r? @alexcrichton
2019-04-01 15:24:15 +00:00
Aleksey Kladov
a240c59980 stabilize ptr::hash
closes #56286
2019-04-01 16:36:07 +03:00
kenta7777
656d4c30e9 typo fix 2019-04-01 19:51:12 +09:00
Aaron Hill
d2584e3b6a
Only track 'visited' state for function types 2019-03-31 22:53:27 -04:00
mark
abab4af7f9 update rustc-guide submodule 2019-03-31 19:36:00 -05:00
Aaron Hill
c4556a5a65
Fix typos 2019-03-31 20:09:30 -04:00