Commit Graph

91945 Commits

Author SHA1 Message Date
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
XAMPPRocky
75adc25b21
Update RELEASES.md 2019-04-02 10:09:48 +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
Jethro Beekman
0a1a475953 SGX target: Use linker option to avoid code CGU assignment kludge 2019-04-01 17:41:37 -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
Alex Crichton
32a76844c4 wasi: Implement error_string to get readable errors
This routes the `error_string` API to `strerror` in libc which should
have more human readable descriptions.
2019-04-01 13:15:31 -07: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
Alex Crichton
60f6cbd002 wasi: Use raw syscalls for stdio
I've since learned that the mapping between libc fds and wasi fds are
expected to be one-to-one, so we can use the raw syscalls for writing to
stdout/stderr and reading from stdin! This should help ensure that we
don't depend on a C library too unnecessarily.
2019-04-01 05:31:48 -07:00
Alex Crichton
382f9a7a3d wasi: Load arguments via syscalls
This commit switches the wasi target to loading CLI arguments via the
syscalls provided by wasi rather than through the argc/argv passed to
the main function. While serving the same purpose it's hoped that using
syscalls will make us a bit more portable (less reliance from libstd on
an external C library) as well as avoiding the need for a lock!
2019-04-01 05:29:53 -07:00
kenta7777
656d4c30e9 typo fix 2019-04-01 19:51:12 +09:00
Aaron Power
d6fa621211 Updated RELEASES.md for 1.34.0 2019-04-01 11:35:19 +02:00
Lukas Kalbertodt
d3d3049f3a
Forward formatter settings to bounds of Range<T> in fmt::Debug impl
Before this change, formatter settings were lost when printing a
`Range`. For example, printing a `Range<f32>` with `{:.2?}` would not
apply the precision modifier when printing the floats. Now the `Debug`
impls look a bit more verbose, but modifier are not lost.
2019-04-01 10:52:44 +02: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
Aaron Hill
aed7ec42b3
Add codegen test 2019-03-31 20:09:30 -04:00
Aaron Hill
e1837a0d1a
Fix inverted panic check 2019-03-31 20:09:30 -04:00
Aaron Hill
512069f8e5
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-03-31 20:09:29 -04:00
bors
eab3eb38df 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.
2019-03-31 23:50:46 +00:00
Pietro Albini
3c26f65c09
ci: print the appveyor agent version at the start of the build 2019-03-31 23:56:09 +02:00
Nicholas Nethercote
606f3158bf 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.
2019-04-01 07:55:25 +11:00
bors
e3428db7c2 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.

Fixes: #58881
2019-03-31 20:28:00 +00:00
O01eg
5bcc365a0f
Fix custom relative libdir.
Uses relative libdir to place libraries on all stages.
Adds verbose installation output.
2019-03-31 22:28:12 +03:00
Dan Robertson
a9d62be557
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.
2019-03-31 17:37:37 +00:00
bors
4fac5c98b2 Auto merge of #59590 - Centril:rollup, r=Centril
Rollup of 7 pull requests

Successful merges:

 - #58805 (Lint for redundant imports)
 - #59506 (Use platform dependent mcount function)
 - #59519 (rustc_target: factor out common fields of non-Single Variants.)
 - #59580 (Allow closure to unsafe fn coercion)
 - #59581 (Stabilize refcell_replace_swap feature)
 - #59583 (match match match match match)
 - #59587 (Remove #[doc(hidden)] from Error::type_id)

Failed merges:

r? @ghost
2019-03-31 17:21:14 +00:00
Mazdak Farrokhzad
34454451a1
Rollup merge of #59587 - XAMPPRocky:master, r=Centril
Remove #[doc(hidden)] from Error::type_id

Nominating this for beta so that `Error::type_id` has documentation in time for release.

cc @rust-lang/release @rust-lang/docs
2019-03-31 19:19:56 +02:00
Mazdak Farrokhzad
9eba66b35f
Rollup merge of #59583 - oberien:patch-1, r=Centril
match match match match match
2019-03-31 19:19:54 +02:00
Mazdak Farrokhzad
9d198db339
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. 😄

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.

I'm happy to amend things if needed, let me know!
2019-03-31 19:19:53 +02:00
Mazdak Farrokhzad
1909a0303a
Rollup merge of #59580 - taiki-e:coerce-closure, r=oli-obk
Allow closure to unsafe fn coercion

Closes #57883
2019-03-31 19:19:51 +02:00
Mazdak Farrokhzad
0171fe5598
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".

r? @oli-obk
2019-03-31 19:19:50 +02:00
Mazdak Farrokhzad
245a0afb52
Rollup merge of #59506 - JohnTitor:improve-mcount, r=nagisa
Use platform dependent mcount function

close #59097

This pull-request is based on #57244 and [here](https://github.com/llvm-mirror/clang/search?q=MCountName&unscoped_MCountName).

r? @nagisa
2019-03-31 19:19:48 +02:00
Mazdak Farrokhzad
dffdd8f728
Rollup merge of #58805 - fabric-and-ink:redundant_import, r=petrochenkov
Lint for redundant imports

Add lint for redundant imports. The changes are suggested by @petrochenkov.

Closes #10178.
2019-03-31 19:19:47 +02:00