Commit graph

81211 commits

Author SHA1 Message Date
bors cc224282de Auto merge of #52802 - kennytm:rollup, r=kennytm
Rollup of 11 pull requests

Successful merges:

 - #52702 (Suggest fix when encountering different mutability from impl to trait)
 - #52703 (Improve a few vectors - calculate capacity or build from iterators)
 - #52740 (Suggest underscore when using dashes in crate namet push fork)
 - #52759 (Impl Send & Sync for JoinHandle)
 - #52760 (rustc_metadata: test loading atoi instead of cos)
 - #52763 (Omit the vendor component in Fuchsia triple)
 - #52765 (Remove unused "-Zenable_nonzeroing_move_hints" flag)
 - #52769 (Incorporate a stray test)
 - #52777 (Fix doc comment for 'ptr::copy_to' method)
 - #52779 (revert accidental atty downgrade)
 - #52781 (Use a slice where a vector is not necessary)

Failed merges:

r? @ghost
2018-07-28 09:40:05 +00:00
kennytm 59f8422a17
Rollup merge of #52781 - ljedrz:avoid_vec_arguments, r=nikomatsakis
Use a slice where a vector is not necessary
2018-07-28 16:25:07 +08:00
kennytm f0efbc0d6b
Rollup merge of #52779 - RalfJung:atty, r=Mark-Simulacrum
revert accidental atty downgrade

This got accidentally downgraded by https://github.com/rust-lang/rust/pull/52488

Cc @nikomatsakis @pnkfelix
2018-07-28 16:25:06 +08:00
kennytm f22c03fb57
Rollup merge of #52777 - omni-viral:master, r=TimNN
Fix doc comment for 'ptr::copy_to' method

Fix error in doc comment for `ptr::copy_to` method.
2018-07-28 16:25:05 +08:00
kennytm 2c088cb03e
Rollup merge of #52769 - sinkuu:stray_test, r=alexcrichton
Incorporate a stray test

`liballoc/repeat-generic-slice.rs` doesn't seem to be tested (I think it was intended to be placed in `run-pass`). This PR incorporates the test into `liballoc/tests`.
2018-07-28 16:25:04 +08:00
kennytm c9347f7f49
Rollup merge of #52765 - sinkuu:remove_nonzeroing_move_opt, r=pnkfelix
Remove unused "-Zenable_nonzeroing_move_hints" flag

Removing a dead option which seems to be a remnant of the old drop-flag system.
2018-07-28 16:25:03 +08:00
kennytm 1fad057e2e
Rollup merge of #52763 - petrhosek:fuchsia-triple, r=alexcrichton
Omit the vendor component in Fuchsia triple

Previously, using unknown as the vendor value would lead to the same
result, but with the multiarch runtimes support in Clang, the target is
now used to locate the runtime libraries and so the format is important.
The denormalized format with omitted vendor component is the format we
use with Clang and should be using for Rust as well.
2018-07-28 16:25:02 +08:00
kennytm 42e92d9ee5
Rollup merge of #52760 - cuviper:test_loading_atoi, r=alexcrichton
rustc_metadata: test loading atoi instead of cos

Some platforms don't actually have `libm` already linked in the test
infrastructure, and then `dynamic_lib::tests::test_loading_cosine` would
fail to find the "cos" symbol.  Every platform running this test should
have `libc` and "atoi" though, so try to use that symbol instead.

Fixes #45410.
2018-07-28 16:25:01 +08:00
kennytm b326319f15
Rollup merge of #52759 - stjepang:impl-send-sync-for-joinhandle, r=TimNN
Impl Send & Sync for JoinHandle

This is just a cosmetic change - it slightly relaxes and clarifies the public API without effectively promising any new guarantees.

Currently we have [these auto trait implementations](https://doc.rust-lang.org/nightly/std/thread/struct.JoinHandle.html#synthetic-implementations):

```rust
impl<T: Send> Send for JoinHandle<T> {}
impl<T: Sync> Sync for JoinHandle<T> {}
```

Bound `T: Send` doesn't make much sense because `JoinHandle<T>` can be created only when `T: Send`. Note that [`JoinHandle::<T>::join`](https://doc.rust-lang.org/nightly/std/thread/struct.JoinHandle.html#method.join) doesn't require `T: Send` so why should the `Send` impl?

And the `Sync` impl doesn't need `T: Sync` because `JoinHandle<T>` cannot even share `T` - it can only send it to the thread that calls `join`.
2018-07-28 16:24:59 +08:00
kennytm b584c3227d
Rollup merge of #52740 - estebank:crate-name, r=petrochenkov
Suggest underscore when using dashes in crate namet push fork

Fix #48437.
2018-07-28 16:24:58 +08:00
kennytm 7da22148ec
Rollup merge of #52703 - ljedrz:vec_improvements, r=nikomatsakis
Improve a few vectors - calculate capacity or build from iterators

Collecting from iterators improves readability and tailoring vector capacities should be beneficial in terms of performance.
2018-07-28 16:24:57 +08:00
kennytm 80c798b982
Rollup merge of #52702 - csmoe:mut_diff, r=estebank
Suggest fix when encountering different mutability from impl to trait

Closes https://github.com/rust-lang/rust/issues/52412
r? @estebank
2018-07-28 16:24:55 +08:00
bors 0560747652 Auto merge of #52678 - matthewjasper:better-spans, r=nikomatsakis
[NLL] Use better spans in some errors

* Use the span of the discriminant and patterns for "fake" statements created to properly check matches. I plan to special case these soon, but this felt like a good first step
* Use the span of the statement, rather than the initialization, when reporting move errors for `let x = ...`, which avoids giving an unhelpful suggestion to use `&{ }`.

r? @nikomatsakis cc @pnkfelix
2018-07-28 07:42:13 +00:00
Esteban Küber 647d295fb2 review comments 2018-07-27 13:33:38 -07:00
bors 4f1e235744 Auto merge of #52336 - ishitatsuyuki:dyn-rollup, r=Mark-Simulacrum
Rollup of bare_trait_objects PRs

All deny attributes were moved into bootstrap so they can be disabled with a line of config.

Warnings for external tools are allowed and it's up to the tool's maintainer to keep it warnings free.

r? @Mark-Simulacrum
cc @ljedrz @kennytm
2018-07-27 20:27:40 +00:00
bors 43e6e2ef6a Auto merge of #52770 - pietroalbini:bump-bootstrap, r=Mark-Simulacrum
Bump bootstrap compiler

This PR bumps the bootstrap compiler to the latest beta, `beta-2017-07-27`. That should be the latest beta with relevant changes (the only nominated PR at the moment is a docs change).

r? @Mark-Simulacrum
2018-07-27 15:03:33 +00:00
ljedrz 1cca420435 Use slices where a vector is not necessary 2018-07-27 16:50:28 +02:00
Ralf Jung a171ed2164 revert accidental atty downgrade 2018-07-27 15:10:52 +02:00
bors b6cbc1e147 Auto merge of #52648 - davidtwco:issue-52533, r=nikomatsakis
[nll] improve the "fully elaborated type" case in region errors

Fixes #52533.

r? @nikomatsakis
2018-07-27 13:01:48 +00:00
Zakarum e25c3e2f16 Fix doc comment for 'ptr::copy_to' method 2018-07-27 15:26:57 +03:00
David Wood 2e4224a998
Region inference error messages no longer start with 'free region' 2018-07-27 13:14:56 +02:00
bors 6998b369fa Auto merge of #52733 - pnkfelix:issue-51348-make-temp-for-each-candidate-in-arm, r=nikomatsakis
[NLL] make temp for each candidate in `match` arm

In NLL, `ref mut` patterns leverage the two-phase borrow infrastructure to allow the shared borrows within a guard before the "activation" of the mutable borrow when we begin execution of the match arm's body. (There is further discussion of this on PR #50783.)

To accommodate the restrictions we impose on two-phase borrows (namely that there is a one-to-one mapping between each activation and the original initialization), this PR is making separate temps for each candidate pattern. So in an arm like this:
```rust
PatA(_, ref mut ident) |
PatB(ref mut ident) |
PatC(_, _, ref mut ident) |
PatD(ref mut ident) if guard_stuff(ident) => ...
```

instead of 3 temps (two for the guard and one for the arm body), we now have 4 + 2 temps associated with `ident`: one for each candidate plus the actual temp that the guard uses directly, and then the sixth is the temp used in the arm body.

Fix #51348
2018-07-27 11:02:27 +00:00
David Wood f44807ae1e
Improved mechanism for naming regions in non-annotated types. 2018-07-27 13:00:56 +02:00
David Wood b377e7bbfb
Change label from closure to function where appropriate. 2018-07-27 12:48:47 +02:00
Pietro Albini 69e5222686
bump bootstrap compiler to beta-2018-07-27 2018-07-27 12:24:17 +02:00
David Wood 055aaaf765
Fixed missing whitespace on some elaborated types. 2018-07-27 12:05:05 +02:00
David Wood 5282d7d060
Update affected tests. 2018-07-27 12:05:01 +02:00
David Wood d4be95f0ff
Improved fully elaborated type generation to replace '_#2r-style regions. 2018-07-27 11:18:11 +02:00
David Wood 53dda8e915
Added fully elaborated type label for inferred arguments. 2018-07-27 11:18:11 +02:00
David Wood 41ce2e9dd2
Simplified closure handling to need no new cosntraint categories. 2018-07-27 11:18:07 +02:00
bors b18b9edf00 Auto merge of #52681 - pnkfelix:z-borrowck-migrate, r=nikomatsakis
Add `-Z borrowck=migrate`

This adds `-Z borrowck=migrate`, which represents the way we want to migrate to NLL under Rust versions to come. It also hooks this new mode into `--edition 2018`, which means we're officially turning NLL on in the 2018 edition.

The basic idea of `-Z borrowck=migrate` that there are cases where NLL is fixing old soundness bugs in the borrow-checker, but in order to avoid just breaking code by immediately rejecting the programs that hit those soundness bugs, we instead use the following strategy:

If your code is accepted by NLL, then we accept it.
If your code is rejected by both NLL and the old AST-borrowck, then we reject it.
If your code is rejected by NLL but accepted by the old AST-borrowck, then we emit the new NLL errors as **warnings**.

These warnings will be turned into hard errors in the future, and they say so in these diagnostics.

Fix #46908
2018-07-27 09:10:07 +00:00
Shotaro Yamada b326e71b79 Incorporate a stray test 2018-07-27 18:07:20 +09:00
Shotaro Yamada 3170956276 Remove unused option flag 2018-07-27 17:42:41 +09:00
Stjepan Glavina 688db1df80 Add stability attributes 2018-07-27 10:08:02 +02:00
bors 7c2aeb9d97 Auto merge of #52650 - oli-obk:associated_existential_types, r=nikomatsakis
Implement associated existential types

r? @nikomatsakis

no idea if these work with generic traits. I'm going home for the day 🤣
2018-07-27 07:16:12 +00:00
Petr Hosek e950d22fbf Omit the vendor component in Fuchsia triple
Previously, using unknown as the vendor value would lead to the same
result, but with the multiarch runtimes support in Clang, the target is
now used to locate the runtime libraries and so the format is important.
The denormalized format with omitted vendor component is the format we
use with Clang and should be using for Rust as well.
2018-07-26 23:52:00 -07:00
bors 3d0e93309d Auto merge of #52724 - alexcrichton:update-compiler-builtins, r=alexcrichton
Update the compiler-builtins submodule

Pull in a fix for japaric/libm#129
2018-07-27 03:24:16 +00:00
Josh Stone efa11da26a rustc_metadata: test loading atoi instead of cos
Some platforms don't actually have `libm` already linked in the test
infrastructure, and then `dynamic_lib::tests::test_loading_cosine` would
fail to find the "cos" symbol.  Every platform running this test should
have `libc` and "atoi" though, so try to use that symbol instead.

Fixes #45410.
2018-07-26 17:20:02 -07:00
Stjepan Glavina 89a81625f4 Impl Send & Sync for JoinHandle 2018-07-27 01:08:13 +02:00
bors 419e60ee9d Auto merge of #52673 - oli-obk:mutable_promoted, r=nagisa,cramertj,estebank
Try to fix an ICE

might fix #52671
2018-07-26 22:20:17 +00:00
Matthew Jasper b32caef1ad Use better spans for cannot-move errors 2018-07-26 22:06:12 +01:00
Matthew Jasper 71637c2937 Use better spans for dummy accesses used in matches 2018-07-26 22:06:12 +01:00
Felix S. Klock II 946264526c review feedback: no reason to clone just to make a singleton slice. 2018-07-26 22:48:56 +02:00
Esteban Küber a3bf27b1db Suggest underscore when using dashes in crate namet push fork 2018-07-26 13:12:42 -07:00
ljedrz acd38f656a Improve a few vectors - calculate capacity or build from iterators 2018-07-26 21:48:38 +02:00
bors 45b48b9b6d Auto merge of #52735 - Mark-Simulacrum:rollup, r=Mark-Simulacrum
Rollup of 16 pull requests

Successful merges:

 - #52558 (Add tests for ICEs which no longer repro)
 - #52610 (Clarify what a task is)
 - #52617 (Don't match on region kinds when reporting NLL errors)
 - #52635 (Fix #[linkage] propagation though generic functions)
 - #52647 (Suggest to take and ignore args while closure args count mismatching)
 - #52649 (Point spans to inner elements of format strings)
 - #52654 (Format linker args in a way that works for gcc and ld)
 - #52667 (update the stdsimd submodule)
 - #52674 (Impl Executor for Box<E: Executor>)
 - #52690 (ARM: expose `rclass` and `dsp` target features)
 - #52692 (Improve readability in a few sorts)
 - #52695 (Hide some lints which are not quite right the way they are reported to the user)
 - #52718 (State default capacity for BufReader/BufWriter)
 - #52721 (std::ops::Try impl for std::task::Poll)
 - #52723 (rustc: Register crates under their real names)
 - #52734 (sparc ABI issue - structure returning from function is returned in 64bit registers (with tests))

Failed merges:

 - #52678 ([NLL] Use better spans in some errors)

r? @ghost
2018-07-26 17:42:59 +00:00
bors bfbf8375d7 Auto merge of #52488 - nikomatsakis:nll-issue-48071-universe-and-sub, r=pnkfelix
introduce universes to NLL type check

This branch aims to fix #48071 and also advance chalk integration a bit at the same time. It re-implements the subtyping/type-equating check so that NLL doesn't "piggy back" on the subtyping code of the old type checker.

This new code uses the "universe-based" approach to handling higher-ranked lifetimes, which sidesteps some of the limitations of the current "leak-based" scheme. This avoids the ICE in #48071.

At the same time, I aim for this to potentially be a kind of optimization. This NLL code is (currently) not cached, but it also generates constraints without doing as much instantiation, substitution, and folding. Right now, though, it still piggy backs on the `relate_tys` trait, which is a bit unfortunate -- it means we are doing more hashing and things than we have to. I want to measure the see the perf. Refactoring that trait is something I'd prefer to leave for follow-up work.

r? @pnkfelix -- but I want to measure perf etc first
2018-07-26 15:23:50 +00:00
Mark Rousskov 995d7194c1
Rollup merge of #52734 - nagisa:sparcfix, r=oli-obk
sparc ABI issue - structure returning from function is returned in 64bit registers (with tests)

Fixes #52638

Supersedes #52730

cc @psumbera
2018-07-26 09:18:42 -06:00
Mark Rousskov d1e549c164
Rollup merge of #52723 - alexcrichton:fix-extern-rename-ice, r=estebank
rustc: Register crates under their real names

Whenever we register a crate into the crate store, make sure to use the real
name mentioned in the metadata instead of the name mentioned in the `extern
crate` statement, as the statement can be wrong!

Closes #51796
2018-07-26 09:18:41 -06:00
Mark Rousskov 858adfe21d
Rollup merge of #52721 - cramertj:try-poll, r=aturon
std::ops::Try impl for std::task::Poll

I originally left out the `Try` impl for `Poll` because I was curious if we needed it, and @MajorBreakfast and I had discussed the potential for it to introduce confusion about exactly what control-flow was happening at different points. However, after porting a pretty significant chunk of Fuchsia over to futures 0.3, I discovered that I was *constantly* having to do repetitive matching on `Poll<Result<...>>` or `Poll<Option<Result<...>>>` in order to propagate errors correctly. `try_poll` (propagate `Poll::Ready(Err(..))`s) helped in some places, but it was far more common to need some form of conversion between `Result`, `Poll<Result<...>>`, and `Poll<Option<Result<...>>>`. The `Try` trait conveniently provides all of these conversions in addition to a more concise syntax (`?`), so I'd like to experiment with using these instead.

cc @seanmonstar

r? @aturon

Note: this change means that far more futures 0.1 code can work without significant changes since it papers over the fact that `Result` is no longer at the top-level when using `Stream` and `Future` (since it's now `Poll<Result<...>>` or `Poll<Option<Result<...>>>` instead of `Result<Poll<..>>` and `Result<Poll<Option<...>>>`).
2018-07-26 09:18:40 -06:00