Commit Graph

81169 Commits

Author SHA1 Message Date
Mikhail Modin
bb66d70b89 fix issues #51351 and #52133 2018-07-29 11:42:50 +01: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
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
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
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
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
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
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
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
Mark Rousskov
091a10e0eb
Rollup merge of #52718 - fintelia:patch-2, r=cramertj
State default capacity for BufReader/BufWriter

Addresses #52513
2018-07-26 09:18:39 -06:00
Mark Rousskov
cc7a826594
Rollup merge of #52695 - oli-obk:const_err_panic, r=petrochenkov
Hide some lints which are not quite right the way they are reported to the user

fixes #52603
2018-07-26 09:18:37 -06:00
Mark Rousskov
55fa4c7374
Rollup merge of #52692 - ljedrz:sort_improvements, r=petrochenkov
Improve readability in a few sorts

Use `sort_by_key` where possible.
2018-07-26 09:18:36 -06:00
Mark Rousskov
37835be2e3
Rollup merge of #52690 - paoloteti:rclass-dsp, r=alexcrichton
ARM: expose `rclass` and `dsp` target features

- `dsp`: the subtarget supports the DSP (saturating arith. and such)
         instructions
- `rclass`: target is a Cortex-R

Both features are useful to support ARM MCUs on `coresimd`.

Note: Cortex-R52 is the first Armv8-R with `neon` support.

r? @alexcrichton
cc @japaric
2018-07-26 09:18:35 -06:00
Mark Rousskov
7c09bab986
Rollup merge of #52674 - tinaun:patch-2, r=cramertj
Impl Executor for Box<E: Executor>

removes the need for the compatibility lib between futures 0.1 and 0.3 to use a wrapper type to implement Executor for Box<Executor>
2018-07-26 09:18:34 -06:00
Mark Rousskov
007177c445
Rollup merge of #52667 - japaric:stdsimd-up, r=alexcrichton
update the stdsimd submodule

to bring in the doc generation fix

r? @alexcrichton
cc @Mark-Simulacrum
2018-07-26 09:18:32 -06:00
Mark Rousskov
9f91195e2a
Rollup merge of #52654 - alecmocatta:master, r=alexcrichton
Format linker args in a way that works for gcc and ld

Pass multiple linker arguments rather than concatenate with commas (fixes #52634).

`-l library` -> `-llibrary` to work with apple's ld.

To build with apple's ld I'm currently also passing `-C link-args="-arch x86_64 -macosx_version_min 10.13.0"`. I'll try and understand the latter flag better before PRing that.

This PR currently works for me. Hopefully CI will pick up any grievous ramifications in other toolchains?

Thanks to @alexcrichton for the pointer to the relevant code!
2018-07-26 09:18:31 -06:00
Mark Rousskov
2aec4e882c
Rollup merge of #52649 - estebank:fmt-span, r=oli-obk
Point spans to inner elements of format strings

- Point at missing positional specifiers in string literal
```
error: invalid reference to positional arguments 3, 4 and 5 (there are 3 arguments)
  --> $DIR/ifmt-bad-arg.rs:34:38
   |
LL |     format!("{name} {value} {} {} {} {} {} {}", 0, name=1, value=2);
   |                                      ^^ ^^ ^^
   |
   = note: positional arguments are zero-based
```

- Point at named formatting specifier in string literal
```
error: there is no argument named `foo`
  --> $DIR/ifmt-bad-arg.rs:37:17
   |
LL |     format!("{} {foo} {} {bar} {}", 1, 2, 3);
   |                 ^^^^^
```

- Update label for formatting string in "multiple unused formatting arguments" to be more correct
```
error: multiple unused formatting arguments
  --> $DIR/ifmt-bad-arg.rs:42:17
   |
LL |     format!("", 1, 2);               //~ ERROR: multiple unused formatting arguments
   |             --  ^  ^
   |             |
   |             multiple missing formatting specifiers
```

- When using `printf` string formatting, provide a structured suggestion instead of a note
```
error: multiple unused formatting arguments
  --> $DIR/format-foreign.rs:12:30
   |
LL |     println!("%.*3$s %s!/n", "Hello,", "World", 4); //~ ERROR multiple unused formatting arguments
   |              --------------  ^^^^^^^^  ^^^^^^^  ^
   |              |
   |              multiple missing formatting specifiers
   |
   = note: printf formatting not supported; see the documentation for `std::fmt`
help: format specifiers in Rust are written using `{}`
   |
LL |     println!("{:.2$} {}!/n", "Hello,", "World", 4); //~ ERROR multiple unused formatting arguments
   |               ^^^^^^ ^^
```
2018-07-26 09:18:30 -06:00
Mark Rousskov
662fb069fd
Rollup merge of #52647 - csmoe:closure_arg_ignore, r=estebank
Suggest to take and ignore args while closure args count mismatching

Closes #52473
2018-07-26 09:18:29 -06:00
Mark Rousskov
c7555cedde
Rollup merge of #52635 - yodaldevoid:issue_18804, r=oli-obk
Fix #[linkage] propagation though generic functions

Fixes #18804

In the non-local branch of `get_static` (where the fix was implemented) `span_fatal` had to be replaced with `bug!` as we have no span in that case.
2018-07-26 09:18:27 -06:00
Mark Rousskov
2aeb76500e
Rollup merge of #52617 - matthewjasper:remove-unused-code, r=nikomatsakis
Don't match on region kinds when reporting NLL errors

First half (by number of tests affected) of the changes to "does not live long enough".

Now that lexical MIR borrowck is gone, region kinds are always ReVar, so matching on them to change errors does nothing.

Changes "borrowed value only lives until here" to "`x` is dropped here while still borrowed".

r? @pnkfelix  cc @nikomatsakis
2018-07-26 09:18:26 -06:00
Mark Rousskov
0127704c98
Rollup merge of #52610 - MajorBreakfast:task-terminology, r=cramertj
Clarify what a task is

Currently we call two distinct concepts "task":
1. The top-level future that is polled until completion
2. The lightweight "thread" that is responsible for polling the top-level future. What additional data beside the future is stored in this type varies between different `Executor` implementations.

I'd prefer to return to the old formulation by @alexcrichton:
```rust
/// A handle to a "task", which represents a single lightweight "thread" of
/// execution driving a future to completion.
pub struct Task {
```
Source: [`task_impl/mod.rs` in futures-rs 0.1](1328fc9e8a/src/task_impl/mod.rs (L49-L50))

I think that this change will make it much easier to explain everything.

r? @aturon
@cramertj
2018-07-26 09:18:25 -06:00
Mark Rousskov
e29f15bafd
Rollup merge of #52558 - wesleywiser:ice_melting, r=estebank
Add tests for ICEs which no longer repro

Adds tests for some ICEs which no longer repro and closes the associated issues.
2018-07-26 09:18:23 -06:00
Simonas Kazlauskas
cc2bd71269 Add a test for sparc64 ABI issue 2018-07-26 17:55:25 +03:00
Niko Matsakis
ce576ac259 fix sparse_matrix_iter unit test 2018-07-26 16:33:52 +03:00
Niko Matsakis
d376a6bc5d add type parameters to BitMatrix and SparseBitMatrix unit tests 2018-07-26 16:33:15 +03:00
Niko Matsakis
5c603e8752 convert tests of BitVector to use BitVector<usize> 2018-07-26 16:32:13 +03:00
Felix S. Klock II
a0ac188220 Regression test for the bug. 2018-07-26 15:15:19 +02:00
Felix S. Klock II
9f05f29e56 Incorporate edition flag testing into tests of -Z borrowck=migrate. 2018-07-26 14:59:00 +02:00
Felix S. Klock II
94a2972d3f compiletest: Add support for ignoring certain tests under --compare-mode=... 2018-07-26 14:51:36 +02:00
Felix S. Klock II
4b2e553dac integrate the edition code.
As a driveby change, I made `#![feature(nll)]` *always* take
precedence over `-Z borrowck`.  The main effect this had is that it
means tests with `#![feature(nll)]` will ignore uses of `-Z
borrowck=compare`. This affected only one test as far as I can tell,
and I think that test used `-Z borrowck=compare` only as a historical
accident.
2018-07-26 14:51:32 +02:00
Niko Matsakis
fe34c90458 patch up mir-opt tests 2018-07-26 15:12:04 +03:00
Felix S. Klock II
1a59dafe11 Bug fix: #![feature(nll)] takes precedence over -Z borrowck=migrate.
(Includes test illustrating desired behavior; compare its diagnostic
output to that of the file `borrowck-migreate-to-nll.rs`.)
2018-07-26 13:17:55 +02:00
Felix S. Klock II
f808405328 Test for -Z borrowck=migrate.
Note that this test is carefully crafted to *try* to not segfault
during its run.  Howver, it really is representing unsound code that
should be rejected after we manage to remove the AST-borrowck entirely
from the compiler.
2018-07-26 13:17:55 +02:00
Felix S. Klock II
91dc3e5b56 Add scary warnings to errors-downgraded-to-warnings in borrowck=migrate.
Also convert an ICE that became reachable code under borrowck=migrate
into a normally reported error (which is then downgraded to a
warning). This actually has a nice side benefit of providing a
somewhat more useful error message, at least in the particular case of
the example from issue #27282.
2018-07-26 13:17:55 +02:00
Felix S. Klock II
3460115157 Allow elaborate_drops to progress under errors that come up during borrowck=migrate. 2018-07-26 13:17:55 +02:00
Felix S. Klock II
ff2f9e0234 Add migrate to list of values for -Z borrowck=... 2018-07-26 13:17:55 +02:00