Commit Graph

53326 Commits

Author SHA1 Message Date
Alex Crichton
8d65591cf2 rustbuild: Tighten dependencies of build scripts
Ensure that `rerun-if-changed` is printed for all build scripts to ensure that
they've all got the right list of dependencies.
2016-05-10 23:41:19 -07:00
bors
c7ab8840c8 Auto merge of #33425 - eddyb:rift, r=nikomatsakis
Split the type context into a global and a local (inference-only) one.

After this change, each `InferCtxt` creates its own local type interner for types with inference by-products.
Most of the code which handles both a global and a local interner uses `'gcx` and `'tcx` for them.
A reference to the type context in that situation (e.g. `infcx.tcx`) is `TyCtxt<'a, 'gcx, 'tcx>`.
The global type context which used to be `&'a TyCtxt<'tcx>` is now `TyCtxt<'a, 'tcx, 'tcx>`.

In order to minimize the number of extra lifetime parameters, many functions became methods.
Where possible (some inherent impls), lifetime parameters were added on the impl, not each method.

As inference by-products no longer escape their inference contexts, memory usage is lower.
Example of `-Z time-passes` excerpt for `librustc`, stage1 (~100MB gains):
Before "rustc: Split local type contexts interners from the global one.":
```
time: 0.395; rss: 335MB item-types checking
time: 15.392; rss: 472MB        item-bodies checking
time: 0.000; rss: 472MB drop-impl checking
time: 1.140; rss: 478MB const checking
time: 0.139; rss: 478MB privacy checking
time: 0.024; rss: 478MB stability index
time: 0.072; rss: 478MB intrinsic checking
time: 0.038; rss: 478MB effect checking
time: 0.255; rss: 478MB match checking
time: 0.128; rss: 484MB liveness checking
time: 1.372; rss: 484MB rvalue checking
time: 1.404; rss: 597MB MIR dump
time: 0.809; rss: 599MB MIR passes
```
After:
```
time: 0.467; rss: 337MB item-types checking
time: 17.443; rss: 395MB        item-bodies checking
time: 0.000; rss: 395MB drop-impl checking
time: 1.423; rss: 401MB const checking
time: 0.141; rss: 401MB privacy checking
time: 0.024; rss: 401MB stability index
time: 0.116; rss: 401MB intrinsic checking
time: 0.038; rss: 401MB effect checking
time: 0.382; rss: 401MB match checking
time: 0.132; rss: 407MB liveness checking
time: 1.678; rss: 407MB rvalue checking
time: 1.614; rss: 503MB MIR dump
time: 0.957; rss: 512MB MIR passes
```

**NOTE**: Functions changed to methods weren't re-indented to keep this PR easier to review.
Once approved, the changes will be mechanically performed.
However, indentation changes of function arguments are there - and I believe there's a way to hide whitespace-only changes in diffs on GitHub.
2016-05-10 23:40:09 -07:00
ggomez
7a9f4c22ff Add E0500 error explanation 2016-05-11 08:03:34 +02:00
Eduard Burtescu
42eb7032fa Fixup indentation after methodification. 2016-05-11 08:48:12 +03:00
bors
80ec1b9f10 Auto merge of #33512 - birkenfeld:issue-25944, r=sanxiyn
rustdoc: remove artificial indentation of doctest code

The indentation makes the examples look nicer when printed (when is this done?), but breaks tests using multi-line string literals.

Fixes: #25944
2016-05-10 20:14:46 -07:00
Pavel Sountsov
ba04a52b96 Also rename the print_from_ast. 2016-05-10 19:21:44 -07:00
Eduard Burtescu
a1c170fc35 rustc: Split local type contexts interners from the global one. 2016-05-11 04:14:58 +03:00
Eduard Burtescu
31a07b0ce6 rustc_typeck: Generalize over 'tcx != 'gcx. 2016-05-11 04:14:58 +03:00
Eduard Burtescu
3a3013613a rustc: Remove the unnecessary ast_ty_to_ty_cache. 2016-05-11 04:14:58 +03:00
Eduard Burtescu
20652162ca rustc: More interning for data used in Ty<'tcx>. 2016-05-11 04:14:58 +03:00
Eduard Burtescu
8f72d8127f rustc: Generalize a minimum set of functions over 'tcx != 'gcx. 2016-05-11 04:14:58 +03:00
Eduard Burtescu
f0b2b3c441 rustc: Remove a redundant lifetime parameter from ExprUseVisitor. 2016-05-11 04:14:58 +03:00
Eduard Burtescu
12e56ea56b rustc: Wrap users of InferCtxt in an anonymous scope. 2016-05-11 04:14:58 +03:00
Eduard Burtescu
8a704f6dc7 rustc: Remove the TyCtxt field from ParameterEnvironment. 2016-05-11 04:14:58 +03:00
Eduard Burtescu
0053b442f8 rustc_typeck: Use Deref for FnCtxt, Inherited and InferCtxt fields and methods. 2016-05-11 04:14:58 +03:00
Eduard Burtescu
76affa5d6f rustc: Split 'tcx into 'gcx and 'tcx for InferCtxt and its users. 2016-05-11 04:14:58 +03:00
Eduard Burtescu
166dbc3273 rustc: Keep a reference to the interners in TyCtxt. 2016-05-11 04:14:58 +03:00
Eduard Burtescu
2fbbaf2f17 rustc: Use set recovery APIs in the TyCtxt interners. 2016-05-11 04:14:58 +03:00
Eduard Burtescu
513d392f7e rustc: Replace &'a TyCtxt<'tcx> with a TyCtxt<'a, 'tcx> wrapper. 2016-05-11 04:14:58 +03:00
Eduard Burtescu
8fc2c4652c regionck: Use methods on RegionCtxt instead of free functions. 2016-05-11 04:14:58 +03:00
Eduard Burtescu
f8ea24edc8 rustc: Avoid free functions taking &TyCtxt and &InferCtxt. 2016-05-11 04:14:58 +03:00
Eduard Burtescu
d7ee56e862 typeck: Turn everything operating on FnCtxt into a method. 2016-05-11 04:14:58 +03:00
Eduard Burtescu
ef2f5f6d8e typeck: Avoid passing &TyCtxt around where possible. 2016-05-11 04:14:58 +03:00
Eduard Burtescu
e387e6c7c8 typeck: merge CollectCtxt and collect::CollectCtxt. 2016-05-11 04:14:58 +03:00
Eduard Burtescu
8600a67782 mem_categorization: freely_aliasable doesn't need to take TyCtxt. 2016-05-11 04:14:58 +03:00
Eduard Burtescu
6e290998c3 infer: Turn normalize_associated_type into a method on TyCtxt. 2016-05-11 04:14:58 +03:00
Eduard Burtescu
0907c198c4 infer: Use methods for creating an InferCtxt. 2016-05-11 04:14:58 +03:00
Eduard Burtescu
b5122d5c4c rustc: Always refer to TyCtxt as tcx. 2016-05-11 04:14:58 +03:00
Cristian Oliveira
85e02429b2 Add error description for E0455
- Adding name attribute to the sample code - Fix description sentences
2016-05-10 20:16:29 -03:00
Guillaume Gomez
0619eeb739 Add default rule for Makefile and make it displays some help.
Add examples for "make help" command
2016-05-11 00:05:19 +02:00
Guillaume Gomez
0908d66882 Doc improvement on std::fmt module 2016-05-10 23:56:57 +02:00
bors
6dbb0e86ae Auto merge of #33319 - birkenfeld:issue31424, r=jseyfried
borrowck: do not suggest to change "&mut self" to "&mut mut self"

Matching the snippet string might not be the cleanest, but matching
the AST node instead seems to end in a lot of nested `if let`s, so I
don't know what's better.

Of course it's entirely possible that there is another API altogether
that I just don't know of?

Fixes #31424.
2016-05-10 14:36:46 -07:00
Guillaume Gomez
a5a2f2b951 Improve "since" tag placement 2016-05-10 21:01:10 +02:00
Eduard Burtescu
e5a91b7ba1 mir: don't attempt to promote Unpromotable constant temps. 2016-05-10 21:26:34 +03:00
bors
04308ceefa Auto merge of #33488 - eddyb:trans-fixes, r=Aatch
Fix several -Z orbit crater blockers.

Fixes 3 of the issues found by @nikomatsakis' crater run with `-Z orbit` forced on:
https://gist.github.com/nikomatsakis/6688c30a0e5d3fed07cc1ebd4efb1412

Two of the regressions seemed to be fixed by #33130 and the remaining two are timeouts.
2016-05-10 10:40:02 -07:00
Ms2ger
e919f25180 Delay wrapping Definitions into a RefCell around LocalCrateReader. 2016-05-10 19:36:08 +02:00
Niko Matsakis
de0906fe12 fix DFS for region error reporting
This was causing terrible error reports, because the algorithm was
incorrectly identifying the constraints.
2016-05-10 12:22:20 -04:00
Pavel Sountsov
a75fc0d23c Make the dep-info-no-analysis regex more robust on Windows. 2016-05-10 08:22:55 -07:00
Pavel Sountsov
64cca3ab2d Rename after_ast to after_hir_lowering. 2016-05-10 08:22:55 -07:00
Pavel Sountsov
105aa8c30f Fix funky formatting. 2016-05-10 08:21:00 -07:00
Pavel Sountsov
f16eac928a Make --emit dep-info work correctly with -Z no-analysis again.
Previously, it would attempt to resolve some external crates that weren't
necessary for dep-info output.

Fixes #33231.
2016-05-10 08:21:00 -07:00
Ms2ger
8d3531d3db Correct typo in LocalCrateReader::definitions. 2016-05-10 15:36:56 +02:00
Ms2ger
9ac468b841 Store a reference rather than a RefCell in LocalCrateReader. 2016-05-10 15:34:25 +02:00
Georg Brandl
fef827672d borrowck: do not suggest to change "&mut self" to "&mut mut self"
Matching the snippet string might not be the cleanest, but matching
the AST node instead seems to end in a lot of nested `if let`s...

Fixes #31424.
2016-05-10 14:57:44 +02:00
bors
d6588097d4 Auto merge of #33471 - birkenfeld:issue-33464, r=jseyfried
resolve: do not modify span of non-importable name

This span modification is probably leftover from a time when import spans were assigned differently.

With this change, error spans for the following are properly reported:

```
use abc::one_el;
use abc::{a, bbb, cccccc};
use a_very_long_name::{el, el2};
```

before (spans only):
```
x.rs:3 use abc::one_el;
           ^~~
x.rs:4 use abc::{a, bbb, cccccc};
                 ^~~
x.rs:4 use abc::{a, bbb, cccccc};
                    ^~~
x.rs:4 use abc::{a, bbb, cccccc};
                         ^~~
(internal compiler error: unprintable span)
(internal compiler error: unprintable span)
```

after:
```
x.rs:3 use abc::one_el;
           ^~~~~~~~~~~
x.rs:4 use abc::{a, bbb, cccccc};
                 ^
x.rs:4 use abc::{a, bbb, cccccc};
                    ^~~
x.rs:4 use abc::{a, bbb, cccccc};
                         ^~~~~~
x.rs:5 use a_very_long_name::{el, el2};
                              ^~
x.rs:5 use a_very_long_name::{el, el2};
                                  ^~~
```

Fixes: #33464
2016-05-10 05:22:17 -07:00
bors
3585321d1e Auto merge of #33337 - birkenfeld:issue-27842, r=jseyfried
typeck: show a note about tuple indexing for erroneous tup[i]

Fixes: #27842
2016-05-10 03:06:05 -07:00
Stefan Schindler
66404f34d2 Simplify text 2016-05-10 11:06:30 +02:00
Jeffrey Seyfried
33978b0728 Refactor hir::lowering API 2016-05-10 07:54:52 +00:00
Jeffrey Seyfried
3927ff4fec Make the remaining functions in hir::lowering methods of LoweringContext 2016-05-10 07:54:49 +00:00
bors
1939b76903 Auto merge of #33473 - michaelwoerister:split-cratecontext, r=nikomatsakis
Preparatory refactorings for collector-driven trans.

This is a set of refactorings that allows to do translation item collection and partitioning before LocalCrateContext instances or LLVM modules are generated. As a consequence we can now create LocalCrateContexts already with knowledge of the codegen unit it will be used for. This is a preparation step for driving trans by the results of codegen unit partitioning.
2016-05-09 23:50:10 -07:00