95702 Commits

Author SHA1 Message Date
Dylan MacKenzie
07c5e2b310 Use a more efficient iteration order for forward dataflow
Currently, dataflow begins by visiting each block in order of ID
(`BasicBlock(0)`, `BasicBlock(1)`, etc.). This PR changes that initial
iteration to reverse post-order. This ensures that the effects of all
predecessors will be applied before a basic block is visited if the CFG
has no back-edges, and should result in less total iterations even when
back-edges exist. This should not change the results of dataflow
analysis.

The current ordering for basic blocks is pretty close to RPO
already--`BasicBlock(0)` is already the start block, so the gains from
this are pretty small, especially since we need to do an extra traversal
up front.

Note that some basic blocks are unreachable from the `START_BLOCK`
during dataflow. We add these blocks to the work queue as well to
preserve the original behavior.
2019-06-27 11:38:52 -07:00
Alex Crichton
2a375827ab std: Move a process test out of libstd
This commit moves a test out of libstd which is causing deadlocks on
musl on CI. Looks like the recent update in musl versions brings in some
internal updates to musl which makes `setgid` and `setuid` invalid to
call after a `fork` in a multithreaded program. The issue seen here is
that the child thread was attempting to grab a lock held by a
nonexistent thread, meaning that the child process simply deadlocked
causing the whole test to deadlock.

This commit moves the test to its own file with no threads which should
work.
2019-06-27 07:54:53 -07:00
bors
8ebd67e4ee Auto merge of #62136 - lzutao:clippy-up, r=oli-obk
submodules: Update clippy from 8c80b65f to e3cb40e4

r? @Manishearth
2019-06-27 14:30:33 +00:00
CrLF0710
8339211809 Added comment description. 2019-06-27 20:59:17 +08:00
Nathan Corbyn
88194200e5 Add suggestion for missing .await keyword 2019-06-27 13:56:55 +01:00
Igor Matuszewski
d79104bda1 Update RLS 2019-06-27 13:41:00 +02:00
Ralf Jung
fc918a395a rename InterpretCx -> InterpCx
That's more consistent with InterpResult and InterpError.
2019-06-27 13:23:34 +02:00
Alex Crichton
b6087492ed rustc: Retry SIGILL linker invocations
We've seen quite a few issues with spurious illegal instructions getting
executed on OSX on CI recently. For whatever reason `cc` itself is
executing an illegal instruction and we're not really getting any other
information about what's happening. Since we're already retrying the
linker when it segfaults, let's just continue to retry everything and
automatically reinvoke the linker when it fails with an illegal instruction.
2019-06-27 02:23:06 -07:00
bors
a6b5d229c1 Auto merge of #62147 - Centril:rollup-pigazoz, r=alexcrichton
[CI] Rollup of 5 pull requests

Successful merges:

 - #62140 (ci: Turn off PR builds on Travis)
 - #62141 (ci: Disable assertions in PR builds)
 - #62142 (ci: Switch official `try` builds to happen on Azure)
 - #62143 (ci: Publish toolstate changes from Azure)
 - #62145 (ci: Sync AppVeyor/Travis with Azure configuration)

Failed merges:

r? @ghost
2019-06-27 08:15:27 +00:00
Andy Russell
e991abd004
remove unused derives and variants 2019-06-26 21:15:13 -04:00
Jeremy Fitzhardinge
768d500157 save-analysis: use buffered writes
Otherwise it ends up writing the file byte at a time, which can be very slow for large outputs.
2019-06-26 17:22:39 -07:00
Christian Poveda
e1e95a8386 Use force_bits when casting from a pointer 2019-06-26 18:50:20 -05:00
Josh Stone
b533aff927 Use pointer::write_bytes for android sigemptyset 2019-06-26 16:27:54 -07:00
Josh Stone
3ba1f39fe7 Avoid mem::uninitialized() in std::sys::unix
For `libc` types that will be initialized in FFI calls, we can just use
`MaybeUninit` and then pass around raw pointers.

For `sun_path_offset()`, which really wants `offset_of`, all callers
have a real `sockaddr_un` available, so we can use that reference.
2019-06-26 15:03:15 -07:00
Yuki Okushi
742e851aaa Update miri 2019-06-27 04:45:12 +09:00
Julien Cretin
e053eede87 Remove outdated question_mark_macro_sep lint 2019-06-26 20:34:12 +02:00
Alex Crichton
6772ebc274 ci: Disable x86_64-msvc-tools builder
While we figure out what's wrong let's continue to land PRs
2019-06-26 11:13:08 -07:00
Eric Huss
7e62050b23 Update books 2019-06-26 10:57:00 -07:00
Taylor Cramer
72ca844ca7 Add regression test for MIR drop generation in async loops
Fixes #61986.
2019-06-26 10:40:06 -07:00
Mark Mansi
182ce772ef remove old fixme 2019-06-26 11:21:59 -05:00
Nathan Corbyn
5cb841d72e Don't ICE on item in .await expression 2019-06-26 15:49:10 +01:00
Mazdak Farrokhzad
93077f3f39 Hash force_pass_mode when config.mode == Pretty. 2019-06-26 14:32:23 +02:00
Igor Matuszewski
ad62b4203c Fix clippy::precedence 2019-06-26 14:14:27 +02:00
Igor Matuszewski
1af1f6277e Fix clippy::print_with_newline 2019-06-26 14:11:58 +02:00
Igor Matuszewski
33f58baf6e Fix clippy::redundant_closure 2019-06-26 14:11:58 +02:00
Igor Matuszewski
6c93b47c01 Fix clippy::cast_losless 2019-06-26 14:11:58 +02:00
Igor Matuszewski
12806b7050 Fix clippy::redundant_field_names 2019-06-26 13:59:58 +02:00
John Kåre Alsaker
8465daf982 Check for local types in writeback with debug assertions 2019-06-26 13:04:06 +02:00
John Kåre Alsaker
c9325181d6 Don't use lift to detect local types 2019-06-26 13:04:05 +02:00
Mazdak Farrokhzad
cd93888351
Rollup merge of #62145 - alexcrichton:sync-azure, r=pietroalbini
ci: Sync AppVeyor/Travis with Azure configuration

Manually make sure that we do the same thing across all the services,
uncovering one spot where we needed to pass one more configure flag on
Azure but otherwise we're good to go!
2019-06-26 11:33:46 +02:00
Mazdak Farrokhzad
7acf40029b
Rollup merge of #62143 - alexcrichton:toolstate, r=pietroalbini
ci: Publish toolstate changes from Azure

This commit moves toolstate publishing from Travis to Azure. We've been
testing on azure for some time now and this works by deleting the Travis
config and updating the credentials used on Azure.
2019-06-26 11:33:44 +02:00
Mazdak Farrokhzad
c09cf0f5f0
Rollup merge of #62142 - alexcrichton:azure-try, r=pietroalbini
ci: Switch official `try` builds to happen on Azure

This commit switches the `try` builers to officially happen on Azure
Pipelines instead of Travis where they're currently run. This also cuts
back the number of builders to just the two we run on Travis, leaving
expansion as a possible future extension.
2019-06-26 11:33:43 +02:00
Mazdak Farrokhzad
00efd13439
Rollup merge of #62141 - alexcrichton:less-assertions, r=pietroalbini
ci: Disable assertions in PR builds

The PR builder on Azure currently takes 2.5h which is a bit long, so
this commit disables debug assertions and llvm assertions in an attempt
to speed up that builder and have PR builds come back a bit more
quickly. Other builders continue to enable debug assertions and test the
compiler there.
2019-06-26 11:33:42 +02:00
Mazdak Farrokhzad
b863efbfa1
Rollup merge of #62140 - alexcrichton:less-pr-builds, r=pietroalbini
ci: Turn off PR builds on Travis

This commit turns off PR builds happening on Travis, instead entirely
relying on Azure for PR builds to succeed.
2019-06-26 11:33:41 +02:00
Alex Crichton
db4f2367ee ci: Sync AppVeyor/Travis with Azure configuration
Manually make sure that we do the same thing across all the services,
uncovering one spot where we needed to pass one more configure flag on
Azure but otherwise we're good to go!
2019-06-26 02:18:55 -07:00
Alex Crichton
f78f37204e ci: Publish toolstate changes from Azure
This commit moves toolstate publishing from Travis to Azure. We've been
testing on azure for some time now and this works by deleting the Travis
config and updating the credentials used on Azure.
2019-06-26 01:58:25 -07:00
Alex Crichton
f6adc3945e ci: Switch official try builds to happen on Azure
This commit switches the `try` builers to officially happen on Azure
Pipelines instead of Travis where they're currently run. This also cuts
back the number of builders to just the two we run on Travis, leaving
expansion as a possible future extension.
2019-06-26 01:54:26 -07:00
Alex Crichton
07efcf25c1 ci: Disable assertions in PR builds
The PR builder on Azure currently takes 2.5h which is a bit long, so
this commit disables debug assertions and llvm assertions in an attempt
to speed up that builder and have PR builds come back a bit more
quickly. Other builders continue to enable debug assertions and test the
compiler there.
2019-06-26 01:38:08 -07:00
Alex Crichton
b5b4e59b47 ci: Turn of PR builds on Travis
This commit turns off PR builds happening on Travis, instead entirely
relying on Azure for PR builds to succeed.
2019-06-26 01:35:51 -07:00
bors
d3e2cec292 Auto merge of #61872 - matthewjasper:refactor-mir-drop-gen, r=nikomatsakis
Clean up MIR drop generation

* Don't assign twice to the destination of a `while` loop containing a `break` expression
* Use `as_temp` to evaluate statement expression
* Avoid consecutive `StorageLive`s for the condition of a `while` loop
* Unify `return`, `break` and `continue` handling, and move it to `scopes.rs`
* Make some of the `scopes.rs` internals private
* Don't use `Place`s that are always `Local`s in MIR drop generation

Closes #42371
Closes #61579
Closes #61731
Closes #61834
Closes #61910
Closes #62115
2019-06-26 04:42:34 +00:00
Lzu Tao
615347fbf0 submodules: Update clippy from 8c80b65f to e3cb40e4 2019-06-26 02:20:44 +00:00
bors
bdd4bda4d5 Auto merge of #62072 - eddyb:generator-memory-index, r=tmandry
rustc: correctly transform memory_index mappings for generators.

Fixes #61793, closes #62011 (previous attempt at fixing #61793).

During #60187, I made the mistake of suggesting that the (re-)computation of `memory_index` in `ty::layout`, after generator-specific logic split/recombined fields, be done off of the `offsets` of those fields (which needed to be computed anyway), as opposed to the `memory_index`.

`memory_index` maps each field to its in-memory order index, which ranges over the same `0..n` values as the fields themselves, making it a bijective mapping, and more specifically a permutation (indeed, it's the permutation resulting from field reordering optimizations).

Each field has an unique "memory index", meaning a sort based on them, even an unstable one, will not put them in the wrong order. But offsets don't have that property, because of ZSTs (which do not increase the offset), so sorting based on the offset of fields alone can (and did) result in wrong orders.

Instead of going back to sorting based on (slices/subsets of) `memory_index`, or special-casing ZSTs to make sorting based on offsets produce the right results (presumably), as #62011 does, I opted to drop sorting altogether and focus on `O(n)` operations involving *permutations*:
* a permutation is easily inverted (see the `invert_mapping` `fn`)
  * an `inverse_memory_index` was already employed in other parts of the `ty::layout` code (that is, a mapping from memory order to field indices)
  * inverting twice produces the original permutation, so you can invert, modify, and invert again, if it's easier to modify the inverse mapping than the direct one
* you can modify/remove elements in a permutation, as long as the result remains dense (i.e. using every integer in `0..len`, without gaps)
  * for splitting a `0..n` permutation into disjoint `0..x` and `x..n` ranges, you can pick the elements based on a `i < x` / `i >= x` predicate, and for the latter, also subtract `x` to compact the range to `0..n-x`
  * in the general case, for taking an arbitrary subset of the permutation, you need a renumbering from that subset to a dense `0..subset.len()` - but notably, this is still `O(n)`!
* you can merge permutations, as long as the result remains disjoint (i.e. each element is unique)
  * for concatenating two `0..n` and `0..m` permutations, you can renumber the elements in the latter to `n..n+m`
* some of these operations can be combined, and an inverse mapping (be it a permutation or not) can still be used instead of a forward one by changing the "domain" of the loop performing the operation

I wish I had a nicer / more mathematical description of the recombinations involved, but my focus was to fix the bug (in a way which preserves information more directly than sorting would), so I may have missed potential changes in the surrounding generator layout code, that would make this all more straight-forward.

r? @tmandry
2019-06-26 01:56:12 +00:00
Tyler Mandry
99694177f9 Add RequiresStorage pass to decide which locals to save in generators
This avoids reserving storage in generators for locals that are moved
out of (and not re-initialized) prior to yield points.
2019-06-25 17:46:26 -07:00
Tyler Mandry
4a8a552b49 Add DataflowResultsCursor 2019-06-25 17:30:38 -07:00
Tyler Mandry
7262e64f53 Make FlowAtLocation support borrowing flow data 2019-06-25 17:30:37 -07:00
Matthew Jasper
3131427784 Use Locals instead of Places in MIR drop generation 2019-06-25 22:41:22 +01:00
Matthew Jasper
b86e6755b9 Add StorageDead statements for while conditions 2019-06-25 22:41:22 +01:00
Matthew Jasper
be23bd47b7 Unify return, break and continue handling 2019-06-25 22:41:22 +01:00
Matthew Jasper
82a1a89d55 Avoid checking if references implement drop 2019-06-25 22:41:22 +01:00
Matthew Jasper
101a2f59b4 Use as_temp to evaluate statement expressions 2019-06-25 22:41:22 +01:00