Commit Graph

95395 Commits

Author SHA1 Message Date
Mazdak Farrokhzad
f0ab633e4d let_chains: Remove ast::ExprKind::{IfLet, WhileLet} from visitors and introduce ::Let. 2019-06-23 01:29:29 +02:00
Mazdak Farrokhzad
42accc99e6 let_chains: Remove ast::ExprKind::{IfLet, WhileLet} and introduce ::Let. 2019-06-23 01:29:29 +02:00
Aaron Hill
93aa60b4bf
Move run-pass test to run-pass/generator 2019-06-22 17:31:14 -04:00
Aaron Hill
8450289e65
Fix fallout from rebase 2019-06-22 17:30:56 -04:00
bors
de02101e6d Auto merge of #62040 - felixrabe:patch-3, r=dtolnay
Punctuation typo in ! docs
2019-06-22 20:45:34 +00:00
Aaron Hill
0fa945e184
Change how we compute yield_in_scope
Compound operators (e.g. 'a += b') have two different possible
evaluation orders. When the left-hand side is a primitive type, the
expression is evaluated right-to-left. However, when the left-hand side
is a non-primitive type, the expression is evaluated left-to-right.

This causes problems when we try to determine if a type is live across a
yield point. Since we need to perform this computation before typecheck
has run, we can't simply check the types of the operands.

This commit calculates the most 'pessimistic' scenario - that is,
erring on the side of treating more types as live, rather than fewer.
This is perfectly safe - in fact, this initial liveness computation is
already overly conservative (e.g. issue #57478). The important thing is
that we compute a superset of the types that are actually live across
yield points. When we generate MIR, we'll determine which types actually
need to stay live across a given yield point, and which ones cam
actually be dropped.

Concretely, we force the computed HIR traversal index for
right-hand-side yield expression to be equal to the maximum index for
the left-hand side. This covers both possible execution orders:

* If the expression is evalauted right-to-left, our 'pessismitic' index
is unecessary, but safe. We visit the expressions in an
ExprKind::AssignOp from right to left, so it actually would have been
safe to do nothing. However, while increasing the index of a yield point
might cause the compiler to reject code that could actually compile, it
will never cause incorrect code to be accepted.
* If the expression is evaluated left-to-right, our 'pessimistic' index
correctly ensures that types in the left-hand-side are seen as occuring
before the yield - which is exactly what we want
2019-06-22 16:03:17 -04:00
Aaron Hill
9d0960a6f8
Fix HIR visit order
Fixes #61442

When rustc::middle::region::ScopeTree ccomputes its yield_in_scope
field, it relies on the HIR visitor order to properly compute which
types must be live across yield points. In order for the computed scopes
to agree with the generated MIR, we must ensure that expressions
evaluated before a yield point are visited before the 'yield'
expression.

However, the visitor order for ExprKind::AssignOp
was incorrect. The left-hand side of a compund assignment expression is
evaluated before the right-hand side, but the right-hand expression was
being visited before the left-hand expression. If the left-hand
expression caused a new type to be introduced (e.g. through a
deref-coercion), the new type would be incorrectly seen as occuring
*after* the yield point, instead of before. This leads to a mismatch
between the computed generator types and the MIR, since the MIR will
correctly see the type as being live across the yield point.

To fix this, we correct the visitor order for ExprKind::AssignOp
to reflect the actual evaulation order.
2019-06-22 16:00:48 -04:00
bors
d6884aedd5 Auto merge of #61874 - jonas-schievink:remove-rem-output-default, r=Centril
Remove the default type of `Rem::Output`

Associated type defaults are not yet stable, and `Rem` is the only trait that specifies a default. Let's see what breaks when it's removed.

cc https://github.com/rust-lang/rust/pull/61812#issuecomment-502394566
cc @Centril

@bors try
2019-06-22 17:59:05 +00:00
Dylan MacKenzie
c8cbd4fc78 Merge BitSetOperator and InitialFlow into one trait.
Since the value of `InitialFlow` defines the semantics of the `join`
operation, there's no reason to have seperate traits for each. We can
add a default impl of `join` which branches based on `BOTTOM_VALUE`.
This should get optimized away.
2019-06-22 10:18:19 -07:00
Dylan MacKenzie
c054186ec7 rustc_mir: don't pass on_entry when building transfer functions.
This commit makes `sets.on_entry` inaccessible in
`{before_,}{statement,terminator}_effect`. This field was meant to allow
implementors of `BitDenotation` to access the initial state for each
block (optionally with the effect of all previous statements applied via
`accumulates_intrablock_state`) while defining transfer functions.
However, the ability to set the initial value for the entry set of each
basic block (except for START_BLOCK) no longer exists. As a result, this
functionality is mostly useless, and when it *was* used it was used
erroneously (see #62007).

Since `on_entry` is now useless, we can also remove `BlockSets`, which
held the `gen`, `kill`, and `on_entry` bitvectors and replace it with a
`GenKill` struct. Variables of this type are called `trans` since they
represent a transfer function. `GenKill`s are stored contiguously in
`AllSets`, which reduces the number of bounds checks and may improve
cache performance: one is almost never accessed without the other.

Replacing `BlockSets` with `GenKill` allows us to define some new helper
functions which streamline dataflow iteration and the
dataflow-at-location APIs. Notably, `state_for_location` used a subtle
side-effect of the `kill`/`kill_all` setters to apply the transfer
function, and could be incorrect if a transfer function depended on
effects of previous statements in the block on `gen_set`.
2019-06-22 10:18:19 -07:00
Matthew Jasper
d0311e7154 Deny explicit_outlives_requirements in the compiler 2019-06-22 17:13:19 +01:00
bors
4a365a29d6 Auto merge of #61020 - HeroicKatora:master, r=matthewjasper
librustc_data_structures: Speedup union of sparse and dense hybrid set

This optimization speeds up the union of a hybrid bitset when that
switches it from a sparse representation to a dense bitset. It now
clones the dense bitset and integrate only the spare elements instead of
densifying the sparse bitset, initializing all elements, and then a
union on two dense bitset, touching all words a second time.

It's not completely certain if the added complexity is worth it but I would
like to hear some feedback in any case. Benchmark results from my machine:

```
Now:  bit_set::union_hybrid_sparse_to_dense ... bench:          72 ns/iter (+/- 5)
Previous: bit_set::union_hybrid_sparse_to_dense ... bench:          90 ns/iter (+/- 6)
```

This being the second iteration of trying to improve the speed, since I missed the return value in the first, and forgot to run the relevant tests. Oops.
2019-06-22 15:12:15 +00:00
Matthew Jasper
95a32157af Count all errors for track_errors 2019-06-22 15:36:24 +01:00
Matthew Jasper
30b6c59f24 Prefer to use has_errors to err_count 2019-06-22 15:36:24 +01:00
Mazdak Farrokhzad
e994d35e9b Lint empty 'derive()' as unused attribute. 2019-06-22 13:19:55 +02:00
CrLF0710
9a08e168bd
Fix one missing dyn.
It's in the documentation of `Unsize`.
2019-06-22 18:35:43 +08:00
bors
d4d5d67c1c Auto merge of #62024 - RalfJung:miri, r=oli-obk
update miri

r? @oli-obk
2019-06-22 10:31:43 +00:00
Ralf Jung
a1e954e82d update miri 2019-06-22 12:30:05 +02:00
Mazdak Farrokhzad
af710c9e79 Add test for linting on 'cfg_attr(,)'. 2019-06-22 12:12:26 +02:00
Mazdak Farrokhzad
02877ac09b Lint on 'cfg_attr(,).' 2019-06-22 12:11:01 +02:00
bors
305930cffe Auto merge of #62010 - ecstatic-morse:kill-borrows-of-proj, r=pnkfelix
Kill conflicting borrows of places with projections.

Resolves #62007.

Due to a bug, the previous version of this check did not actually kill all conflicting borrows unless the borrowed place had no projections. Specifically, `sets.on_entry` will always be empty when `statement_effect` is called. It does not contain the set of borrows which are live at this point in the program.

@pnkfelix describes why this was not caught before in #62007, and created an example where the current borrow checker failed unnecessarily. This PR adds their example as a test, but they will likely want to add some additional ones.

r? @pnkfelix
2019-06-22 05:12:11 +00:00
Mazdak Farrokhzad
a99a7b7f35 Remove FnBox. 2019-06-22 06:59:27 +02:00
bors
e562b24ae3 Auto merge of #62041 - Centril:rollup-95eeyx7, r=Centril
Rollup of 9 pull requests

Successful merges:

 - #60971 (Add DocFS layer to rustdoc)
 - #61146 (SliceConcatExt::connect defaults to calling join)
 - #61181 (Fix theme-checker failure)
 - #61267 (rustc-book: Update the rustc/clang compatibility table for xLTO.)
 - #61270 (Remove warnings about incr. comp. generating less debugging output.)
 - #61681 (Changed the error message to more clearly explain what is allowed)
 - #61984 (More NodeId pruning)
 - #62016 (Add test for issue-27697)
 - #62019 (Remove needless lifetimes)

Failed merges:

r? @ghost
2019-06-22 02:16:53 +00:00
Mazdak Farrokhzad
64e5818307
Rollup merge of #62019 - jeremystucki:refactoring, r=estebank
Remove needless lifetimes
2019-06-22 01:42:41 +02:00
Mazdak Farrokhzad
595f55cb8b
Rollup merge of #62016 - JohnTitor:add-test-for-issue-27697, r=alexcrichton
Add test for issue-27697

Closes #27697
2019-06-22 01:42:40 +02:00
Mazdak Farrokhzad
dc0ef823be
Rollup merge of #61984 - ljedrz:more_node_id_pruning, r=Zoxc
More NodeId pruning

Just another round of the `HirId`ification initiative.

r? @Zoxc
2019-06-22 01:42:38 +02:00
Mazdak Farrokhzad
9eb88f3b82
Rollup merge of #61681 - asfreitas:addSendTrait, r=estebank
Changed the error message to more clearly explain what is allowed

This is in regard to #61634. I changed the language to make it more clear what is allowed.
2019-06-22 01:42:37 +02:00
Mazdak Farrokhzad
c3c3a5e7e7
Rollup merge of #61270 - michaelwoerister:remove-incr-comp-warning, r=oli-obk
Remove warnings about incr. comp. generating less debugging output.

This PR removes the

> `-C save-temps` might not produce all requested temporary products when incremental compilation is enabled.`

warning and others similar to it.

I think these warnings have annoyed lots of people over the past ~3 years; while not helping a single one of them `:P`

r? @oli-obk
2019-06-22 01:42:35 +02:00
Mazdak Farrokhzad
653b44dbf7
Rollup merge of #61267 - michaelwoerister:update-xlto-table, r=alexcrichton
rustc-book: Update the rustc/clang compatibility table for xLTO.

Firefox is using these combinations successfully.
2019-06-22 01:42:33 +02:00
Mazdak Farrokhzad
18bb75477a
Rollup merge of #61181 - GuillaumeGomez:fix-theme-checker, r=kinnison
Fix theme-checker failure

Fixes #61145.

I didn't find a way to check it without strongly depending on the output... Is there a way to check if a program fails without checking its output?

r? @QuietMisdreavus
2019-06-22 01:42:31 +02:00
Mazdak Farrokhzad
3a8536edef
Rollup merge of #61146 - czipperz:SliceConcatExt-connect-default-to-join, r=sfackler
SliceConcatExt::connect defaults to calling join

It makes sense to default a deprecated method to the new one.  Precedence example is `Error::cause` defaults to calling `Error::source`.
2019-06-22 01:42:30 +02:00
Mazdak Farrokhzad
f2a0ce9c37
Rollup merge of #60971 - rbtcollins:docs-perf, r=rbtcollins,GuillaumeGomez
Add DocFS layer to rustdoc

* Move fs::create_dir_all calls into DocFS to provide a clean
  extension point if async extension there is needed.
* Convert callsites of create_dir_all to ensure_dir to reduce syscalls.
* Convert fs::write usage to DocFS.write
  (which also removes a lot of try_err! usage for easier reading)
* Convert File::create calls to use Vec buffers and then DocFS.write
  in order to both consistently reduce syscalls as well as make
  deferring to threads cleaner.
* Convert OpenOptions usage similarly - I could find no discussion on
  the use of create_new for that one output file vs all the other
  files render creates, if link redirection attacks are a concern
  DocFS will provide a good central point to introduce systematic
  create_new usage.
* DocFS::write defers to rayon for IO on Windows producing a modest
  speedup: before this patch on my development workstation:

$ time cargo +mystg1 doc -p winapi:0.3.7
 Documenting winapi v0.3.7
    Finished dev [unoptimized + debuginfo] target(s) in 6m 11s

real    6m11.734s
user    0m0.015s
sys     0m0.000s

Afterwards:
$ time cargo +mystg1 doc -p winapi:0.3.7
   Compiling winapi v0.3.7
 Documenting winapi v0.3.7
    Finished dev [unoptimized + debuginfo] target(s) in 49.53s

real    0m49.643s
user    0m0.000s
sys     0m0.015s

I haven't measured how much time is in the compilation logic vs in the
IO and outputting etc, but this takes it from frustating to tolerable
for me, at least for now.
2019-06-22 01:42:28 +02:00
bors
8d6f4b96df Auto merge of #62018 - Zoxc:vs2019, r=alexcrichton
Update LLVM to fix VS 2019 compilation

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

r? @alexcrichton
2019-06-21 23:28:13 +00:00
Felix Rabe
eceeedc7b0
Typo 2019-06-22 00:44:31 +02:00
Ralf Jung
02863a3554 do as tidy says 2019-06-21 20:47:42 +02:00
Ralf Jung
ecca52cac1 don't make PR author assignee; that break creating the issue when they are not a team member 2019-06-21 20:25:37 +02:00
Ralf Jung
e10012d037 show HTTP error body 2019-06-21 19:22:46 +02:00
bors
929b48ec98 Auto merge of #62027 - lzutao:clippy-update, r=oli-obk
submodules: Update clippy from 149a988 to 5a11ed7b

r? @oli-obk
2019-06-21 16:26:14 +00:00
Andrew
f4cd3c2054 adding in these files that didn't get added in previous commit 2019-06-22 00:18:15 +08:00
John Wrenn
ac98342e84 Implement arbitrary_enum_discriminant 2019-06-21 11:00:10 -04:00
Andrew
54acbd96f9 changed expected output in tests so it now passes with changed output 2019-06-21 22:12:07 +08:00
Ralf Jung
8ceab3218e fix long line 2019-06-21 14:07:20 +02:00
Marc-Antoine Perennou
870f13a0b3 rustbuild: only autodetect cxx for hosts
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
2019-06-21 14:02:05 +02:00
Lzu Tao
dfd430e0a5 submodules: Update clippy from 149a988 to 5a11ed7b 2019-06-21 11:54:50 +00:00
Ralf Jung
e02c655194 dump the JSON we are going to submit to GH to create the issue 2019-06-21 13:46:46 +02:00
Wesley Wiser
c686130a38 Fix nits 2019-06-21 07:46:27 -04:00
Ralf Jung
fb2f841867 give a bit more context in the error message 2019-06-21 13:40:57 +02:00
Ralf Jung
a8b2b1c7b3 publish_toolstate: don't use 'new' from inside the loop 2019-06-21 13:26:46 +02:00
Felix S. Klock II
f483269625 Add test checking our behavior for assigning over a ConstIndex projection. 2019-06-21 13:08:15 +02:00
Felix S. Klock II
3b8ef01030 Add test that our handling of projections hasn't gone too far:
overwriting one field should not allow reborrow of an unrelated field.
2019-06-21 12:52:54 +02:00