- #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)
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.
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.
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> { () }
```
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.
Taylor Cramer [Thu, 14 Mar 2019 00:42:23 +0000 (17:42 -0700)]
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.
- #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)
bors [Sun, 31 Mar 2019 23:50:46 +0000 (23:50 +0000)]
Auto merge of #59507 - nnethercote:indent-with-SPACES, r=petrochenkov
Optimize indentation in the pretty printer.
Currently the pretty-printer calls `write!` for every space of
indentation. On some workloads the indentation level can exceed 100, and
a faster implementation reduces instruction counts by up to 7% on a few
workloads.
Currently the pretty-printer calls `write!` for every space of
indentation. On some workloads the indentation level can exceed 100, and
a faster implementation reduces instruction counts by up to 7% on a few
workloads.
bors [Sun, 31 Mar 2019 20:28:00 +0000 (20:28 +0000)]
Auto merge of #59577 - dlrobertson:fix_58881, r=nagisa
Fix LLVM IR generated for C-variadic arguments
It is possible to create malformed LLVM IR given variadic arguments that
are aggregate types. This occurs due to improper tracking of the current
argument in the functions list of arguments.
Dan Robertson [Wed, 27 Mar 2019 13:00:37 +0000 (13:00 +0000)]
Fix LLVM IR generated for C-variadic arguments
It is possible to create malformed LLVM IR given variadic arguments that
are aggregate types. This occurs due to improper tracking of the current
argument in the functions list of arguments.
Rollup merge of #59581 - jmcomets:stabilize-refcell_replace_swap, r=Centril
Stabilize refcell_replace_swap feature
Please be kind, this is my first time contributing. :smile:
I noticed #43570 only needs stabilizing (and I need it for a side project I'm working on), so I followed the [guide](https://rust-lang.github.io/rustc-guide/stabilization_guide.html#stabilization-pr) to move things forward.
Rollup merge of #59519 - eddyb:layout-variants-refactor, r=oli-obk
rustc_target: factor out common fields of non-Single Variants.
@tmandry and I were discussing ways to generalize the current variants/discriminant layout to allow more fields in the "`enum`" (or another multi-variant types, such as potentially generator state, in the future), shared by all variants, than just the tag/niche discriminant.
This refactor should make it easier to extend multi-variant layouts, as nothing is duplicating anymore between "tagged enums" and "niche-filling enums".
Esteban Küber [Sun, 31 Mar 2019 16:07:56 +0000 (09:07 -0700)]
Suggest using anonymous lifetime in `impl Trait` return without hacks
Fallback to `static_impl_trait` for nice error message by peeking at the
return type and the lifetime type. Point at the return type instead of
the return expr/stmt in NLL mode.
bors [Sat, 30 Mar 2019 22:15:05 +0000 (22:15 +0000)]
Auto merge of #59575 - Centril:rollup, r=Centril
Rollup of 3 pull requests
Successful merges:
- #59405 (doc: use correct body font URLs)
- #59562 (Changed reference style in dbg macro docs.)
- #59569 (Add book.toml with title to unstable-book doc)
Rollup merge of #59405 - benesch:docs-font, r=GuillaumeGomez
doc: use correct body font URLs
The CSS for the docs homepage (docs.rust-lang.org) was using the wrong
URL for the body font, resulting in the fallback serif font being used,
instead of the desired Source Serif Pro fonts.
(It's worth noting that the CSS for rustdoc's API generation got these URLs right.)