Commit Graph

66145 Commits

Author SHA1 Message Date
Eduard-Mihai Burtescu
877ec94654 rustc_apfloat: introduce the base Float API. 2017-08-02 03:45:03 +03:00
bors
dd53dd5f9e Auto merge of #43529 - QuietMisdreavus:fn-docs, r=steveklabnik
add documentation for function pointers as a primitive

This PR adds a new kind of primitive to the standard library documentation: Function pointers. It's useful to be able to discuss them separately from closure-trait-objects, and to have something to point to when discussing function pointers as a *type* and not a *trait*.

Fixes #17104
2017-08-01 19:59:53 +00:00
bors
e772c28d2e Auto merge of #43506 - michaelwoerister:async-llvm, r=alexcrichton
Run translation and LLVM in parallel when compiling with multiple CGUs

This is still a work in progress but the bulk of the implementation is done, so I thought it would be good to get it in front of more eyes.

This PR makes the compiler start running LLVM while translation is still in progress, effectively allowing for more parallelism towards the end of the compilation pipeline. It also allows the main thread to switch between either translation or running LLVM, which allows to reduce peak memory usage since not all LLVM module have to be kept in memory until linking. This is especially good for incr. comp. but it works just as well when running with `-Ccodegen-units=N`.

In order to help tuning and debugging the work scheduler, the PR adds the `-Ztrans-time-graph` flag which spits out html files that show how work packages where scheduled:
![Building regex](https://user-images.githubusercontent.com/1825894/28679272-f6752bd8-72f2-11e7-8a6c-56207855ce95.png)
(red is translation, green is llvm)

One side effect here is that `-Ztime-passes` might show something not quite correct because trans and LLVM are not strictly separated anymore. I plan to have some special handling there that will try to produce useful output.

One open question is how to determine whether the trans-thread should switch to intermediate LLVM processing.

TODO:
- [x] Restore `-Z time-passes` output for LLVM.
- [x] Update documentation, esp. for work package scheduling.
- [x] Tune the scheduling algorithm.

cc @alexcrichton @rust-lang/compiler
2017-08-01 17:21:24 +00:00
QuietMisdreavus
71751db491 add documentation for function pointers as a primitive 2017-08-01 09:42:12 -05:00
bors
c2407516ff Auto merge of #43568 - arielb1:constant-recovery, r=eddyb
trans::mir::constant - fix assignment error recovery

trans::mir::constant - fix assignment error recovery

We used to not store anything when the RHS of an assignment returned an error, which caused ICEs downstream.

Fixes #43197.
2017-08-01 14:20:23 +00:00
Michael Woerister
6468cad977 async-llvm(29): Adapt run-make/llvm-phase test case to LLVM module not being available in memory. 2017-08-01 15:57:38 +02:00
Michael Woerister
b8d441350b async-llvm(28): Make some error messages more informative. 2017-08-01 14:43:55 +02:00
bors
0bf018c588 Auto merge of #43560 - QuietMisdreavus:ref-docs, r=steveklabnik
add docs for references as a primitive

Just like #43529 did for function pointers, here is a new primitive page for references.

This PR will pull in impls on references if it's a reference to a generic type parameter. Initially i was only able to pull in impls that were re-exported from another crate; crate-local impls got a different representation in the AST, and i had to change how types were resolved when cleaning it. (This is the change at the bottom of `librustdoc/clean/mod.rs`, in `resolve_type`.) I'm unsure the full ramifications of the change, but from what it looks like, it shouldn't impact anything major. Likewise, references to generic type parameters also get the `&'a [mut]` linked to the new page.

cc @rust-lang/docs: Is this sufficient information? The listing of trait impls kinda feels redundant (especially if we can get the automated impl listing sorted again), but i still think it's useful to point out that you can use these in a generic context.

Fixes #15654
2017-08-01 08:23:41 +00:00
bors
6e8452ee4f Auto merge of #43552 - petrochenkov:instab, r=jseyfried
resolve: Try to fix instability in import suggestions

cc https://github.com/rust-lang/rust/pull/42033

`lookup_import_candidates` walks module graph in DFS order and skips modules that were already visited (which is correct because there can be cycles).
However it means that if we visited `std::prelude::v1::Result::Ok` first, we will never visit `std::result::Result::Ok` because `Result` will be skipped as already visited (note: enums are also modules here), and otherwise, if we visited `std::result::Result::Ok` first, we will never get to `std::prelude::v1::Result::Ok`.
What child module of `std` (`prelude` or `result`) we will visit first, depends on randomized hashing, so we have instability in diagnostics.

With this patch modules' children are visited in stable order in `lookup_import_candidates`, this should fix the issue, but let's see what Travis will say.

r? @oli-obk
2017-08-01 06:05:34 +00:00
bors
df90a54662 Auto merge of #43533 - nrc:macro-save, r=jseyfried,
Three small fixes for save-analysis

First commit does some naive deduplication of macro uses. We end up with lots of duplication here because of the weird way we get this data (we extract a use for every span generated by a macro use).

Second commit is basically a typo fix.

Third commit is a bit interesting, it partially reverts a change from #40939 where temporary variables in format! (and thus println!) got a span with the primary pointing at the value stored into the temporary (e.g., `x` in `println!("...", x)`). If `format!` had a definition it should point at the temporary in the macro def, but since it is built-in, that is not possible (for now), so `DUMMY_SP` is the best we can do (using the span in the callee really breaks save-analysis because it thinks `x` is a definition as well as a reference).

There aren't a test for this stuff because: the deduplication is filtered by any of the users of save-analysis, so it is purely an efficiency change. I couldn't actually find an example for the second commit that we have any machinery to test, and the third commit is tested by the RLS, so there will be a test once I update the RLS version and and uncomment the previously failing tests).

r? @jseyfried
2017-08-01 03:52:14 +00:00
Nick Cameron
27b9182d5b review changes 2017-08-01 15:06:22 +12:00
bors
ebf74d99b0 Auto merge of #43547 - arielb1:no-borrow-no-check, r=nikomatsakis
borrowck: skip CFG construction when there is nothing to propagate

CFG construction takes a large amount of time and memory, especially for
large constants. If such a constant contains no actions on lvalues, it
can't have borrowck problems and can be ignored by it.

This removes the 4.9GB borrowck peak from #36799. It seems that HIR had
grown by 300MB and MIR had grown by 500MB from the last massif
collection and that remains to be investigated, but this at least shaves
the borrowck peak.

r? @nikomatsakis
2017-07-31 23:21:24 +00:00
bors
37c7d0ebb3 Auto merge of #43399 - tschottdorf:bndmode-pat-adjustments, r=nikomatsakis
default binding modes: add pat_binding_modes

This PR kicks off the implementation of the [default binding modes RFC][1] by
introducing the `pat_binding_modes` typeck table mentioned in the [mentoring
instructions][2].

It is a WIP because I wasn't able to avoid all uses of the binding modes as
not all call sites are close enough to the typeck tables. I added marker
comments to any line matching `BindByRef|BindByValue` so that reviewers
are aware of all of them.

I will look into changing the HIR (as suggested in [2]) to not carry a
`BindingMode` unless one was explicitly specified, but this PR is good for
a first round of comments.

The actual changes are quite small and CI will fail due to overlong lines
caused by the marker comments.

See #42640.

cc @nikomatsakis

[1]: https://github.com/rust-lang/rfcs/pull/2005
[2]: https://github.com/rust-lang/rust/issues/42640#issuecomment-313535089
2017-07-31 20:47:42 +00:00
Michael Woerister
b1e043e9e9 async-llvm(27): Move #[rustc_error] check to an earlier point in order to restore some test expections. 2017-07-31 18:51:39 +02:00
Niko Matsakis
8f67f1efaf add comments from arielb1 2017-07-31 18:13:49 +03:00
Ariel Ben-Yehuda
93db1f9923 trans::mir::constant - fix assignment error recovery
We used to not store anything when the RHS of an assignment returned an
error, which caused ICEs downstream.

Fixes #43197.
2017-07-31 18:09:02 +03:00
Ariel Ben-Yehuda
1057a728f5 fix -Z treat-err-as-bug 2017-07-31 18:09:02 +03:00
Michael Woerister
cacc31f8a3 async-llvm(26): Print error when failing to acquire Jobserver token. 2017-07-31 15:41:41 +02:00
Michael Woerister
a9a0ea921b async-llvm(25): Restore -Ztime-passes output for trans and LLVM. 2017-07-31 15:15:44 +02:00
Michael Woerister
bd36df84a5 async-llvm(24): Improve scheduling and documentation. 2017-07-31 15:15:44 +02:00
Michael Woerister
f5acc392e0 async-llvm(23): Let the main thread also do LLVM work in order to reduce memory pressure. 2017-07-31 15:15:44 +02:00
Michael Woerister
8819278523 async-llvm(22): mw invokes mad html skillz to produce graphical LLVM timing reports. 2017-07-31 15:15:44 +02:00
Michael Woerister
1480be3779 async-llvm(21): Re-use worker-ids in order to simulate persistent worker threads. 2017-07-31 15:15:09 +02:00
Michael Woerister
ab3bc584c0 async-llvm(20): Do some cleanup. 2017-07-31 15:15:09 +02:00
Michael Woerister
81b789fd87 async-llvm(19): Already start LLVM while still translating. 2017-07-31 15:15:09 +02:00
Michael Woerister
7e09d1e170 async-llvm(18): Instantiate OngoingCrateTranslation before starting translation. 2017-07-31 15:15:09 +02:00
Michael Woerister
e7d0fa340f async-llvm(17): Create MSVC __imp_ symbols immediately for each module. 2017-07-31 15:15:09 +02:00
Michael Woerister
0ad9eaa998 async-llvm(16): Inject allocator shim into LLVM module immediately if necessary. 2017-07-31 15:15:09 +02:00
Michael Woerister
943a5bdf35 async-llvm(15): Don't require number of codegen units upfront. 2017-07-31 15:15:09 +02:00
Michael Woerister
a1be65845c async-llvm(14): Move LTO/codegen-unit conflict check to beginning of compilation process. 2017-07-31 15:15:09 +02:00
Michael Woerister
b924ec1484 async-llvm(13): Submit LLVM work packages from base::trans_crate(). 2017-07-31 15:15:09 +02:00
Michael Woerister
397b2a800f async-llvm(12): Hide no_integrated_as logic in write::run_passes. 2017-07-31 15:15:09 +02:00
Michael Woerister
f3ce50558f async-llvm(11): Delay joining ongoing translation until right before linking. 2017-07-31 15:15:09 +02:00
Michael Woerister
28589ec3e4 async-llvm(10): Factor compile output files cleanup into separate functions. 2017-07-31 15:15:09 +02:00
Michael Woerister
ccb970be4c async-llvm(9): Move OngoingCrateTranslation into back::write. 2017-07-31 15:15:09 +02:00
Michael Woerister
645841ea44 async-llvm(8): Clean up resource management and drop LLVM modules ASAP. 2017-07-31 15:15:09 +02:00
Michael Woerister
4282dd87ea async-llvm(7): Clean up error handling a bit. 2017-07-31 15:15:09 +02:00
Michael Woerister
8f6894e177 async-llvm(6): Make the LLVM work coordinator get its work package through a channel instead of upfront. 2017-07-31 15:15:09 +02:00
Michael Woerister
b18a61a15b async-llvm(5): Do continuous error handling on main thread. 2017-07-31 15:15:09 +02:00
Michael Woerister
df6be33d84 async-llvm(4): Move work coordination to separate thread in order to free up the main thread for translation. 2017-07-31 15:15:09 +02:00
Michael Woerister
bac57cf654 async-llvm(3): Make write::CodegenContext Clone and Send. 2017-07-31 15:13:10 +02:00
Michael Woerister
29d4725b31 async-llvm(2): Decouple diagnostics emission from LLVM worker coordination. 2017-07-31 14:55:13 +02:00
Michael Woerister
c4adeceb37 async-llvm(1): Run LLVM already in trans_crate(). 2017-07-31 14:55:13 +02:00
Ariel Ben-Yehuda
83eb264273 borrowck: skip CFG construction when there is nothing to propagate
CFG construction takes a large amount of time and memory, especially for
large constants. If such a constant contains no actions on lvalues, it
can't have borrowck problems and can be ignored by it.

This removes the 4.9GB borrowck peak from #36799. It seems that HIR had
grown by 300MB and MIR had grown by 500MB from the last massif
collection and that remains to be investigated, but this at least shaves
the borrowck peak.
2017-07-31 15:17:30 +03:00
bors
2a6828e7f1 Auto merge of #43562 - alexcrichton:no-clean-rebuild, r=petrochenkov
rustbuild: Remove `--enable-llvm-clean-rebuild`

This was intended for bots back in the day where we'd persist caches of LLVM
builds across runs, but nowadays we don't do that on any of the bots so this
option is no longer necessary
2017-07-31 08:35:36 +00:00
bors
f6d7873e93 Auto merge of #43546 - nikomatsakis:issue-43132, r=arielb1
save subobligations in the projection cache

The projection cache explicitly chose not to "preserve" subobligations for projections, since the fulfillment context ought to have been doing so. But for the trait evaluation scheme that causes problems. This PR reproduces subobligations. This has the potential to slow down compilation, but minimal investigation suggests it does not do so.

One hesitation about this PR: I could not find a way to make a standalone test case for #43132 (but admittedly I did not try very hard).

Fixes #43132.

r? @arielb1
2017-07-31 04:58:10 +00:00
bors
2789db2720 Auto merge of #43519 - zackmdavis:long_diagnostics_ever_after, r=GuillaumeGomez
a couple more error explanations for posterity

E0436, E0595, and moving E0569 to where it belongs in the file rather than being bizarrely out of numerical order

r? @GuillaumeGomez
2017-07-31 01:00:13 +00:00
bors
15266f9a1b Auto merge of #43563 - tbu-:pr_from_str_radix_panic, r=alexcrichton
Document the `from_str_radix` panic

CC #42034
2017-07-30 22:39:23 +00:00
Tobias Bucher
bbb5311ad6 Document the from_str_radix panic
CC #42034
2017-07-30 23:20:54 +02:00
Alex Crichton
eb1c44b6ed rustbuild: Remove --enable-llvm-clean-rebuild
This was intended for bots back in the day where we'd persist caches of LLVM
builds across runs, but nowadays we don't do that on any of the bots so this
option is no longer necessary
2017-07-30 13:50:19 -07:00