rust/src/libsyntax
bors 12238b984a Auto merge of #33816 - nikomatsakis:projection-cache-2, r=arielb1
Projection cache and better warnings for #32330

This PR does three things:

- it lays the groundwork for the more precise subtyping rules discussed in #32330, but does not enable them;
- it issues warnings when the result of a leak-check or subtyping check relies on a late-bound region which will late become early-bound when #32330 is fixed;
- it introduces a cache for projection in the inference context.

I'm not 100% happy with the approach taken by the cache here, but it seems like a step in the right direction. It results in big wins on some test cases, but not as big as previous versions -- I think because it is caching the `Vec<Obligation>` (whereas before I just returned the normalized type with an empty vector). However, that change was needed to fix an ICE in @alexcrichton's future-rs module (I haven't fully tracked the cause of that ICE yet). Also, because trans/the collector use a fresh inference context for every call to `fulfill_obligation`, they don't profit nearly as much from this cache as they ought to.

Still, here are the results from the future-rs `retry.rs`:

```
06:26 <nmatsakis> time: 6.246; rss: 44MB  item-bodies checking
06:26 <nmatsakis> time: 54.783; rss: 63MB   translation item collection
06:26 <nmatsakis> time: 140.086; rss: 86MB    translation

06:26 <nmatsakis> time: 0.361; rss: 46MB  item-bodies checking
06:26 <nmatsakis> time: 5.299; rss: 63MB    translation item collection
06:26 <nmatsakis> time: 12.140; rss: 86MB translation
```

~~Another example is the example from #31849. For that, I get 34s to run item-bodies without any cache. The version of the cache included here takes 2s to run item-bodies type-checking. An alternative version which doesn't track nested obligations takes 0.2s, but that version ICEs on @alexcrichton's future-rs (and may well be incorrect, I've not fully convinced myself of that). So, a definite win, but I think there's definitely room for further progress.~~

Pushed a modified version which improves performance of the case from #31849:

```
lunch-box. time rustc --stage0 ~/tmp/issue-31849.rs  -Z no-trans
real    0m33.539s
user    0m32.932s
sys     0m0.570s
lunch-box. time rustc --stage2 ~/tmp/issue-31849.rs  -Z no-trans
real    0m0.195s
user    0m0.154s
sys     0m0.042s
```

Some sort of cache is also needed for unblocking further work on lazy normalization, since that will lean even more heavily on the cache, and will also require cycle detection.

r? @arielb1
2016-06-04 10:47:55 -07:00
..
diagnostics replace fileline_{help,note} with {help,note} 2016-05-02 11:49:23 -04:00
errors Back to single line between errors. Add header space to secondary files 2016-05-24 10:42:32 -04:00
ext Auto merge of #33816 - nikomatsakis:projection-cache-2, r=arielb1 2016-06-04 10:47:55 -07:00
parse Auto merge of #33900 - GuillaumeGomez:rollup, r=GuillaumeGomez 2016-05-27 03:56:19 -07:00
print Auto merge of #33934 - Byron:libsyntex-ring-buffer-size, r=pnkfelix 2016-05-29 03:02:46 -07:00
util Remove ExplicitSelf from AST 2016-05-25 21:55:04 +03:00
abi.rs [breaking-change] don't glob import/export syntax::abi enum variants 2016-02-11 12:34:48 +01:00
ast.rs Auto merge of #33794 - petrochenkov:sanity, r=nrc 2016-06-01 06:21:53 -07:00
attr.rs Add and use HasAttrs trait 2016-05-26 23:23:01 +00:00
Cargo.toml rustbuild: Fix dist for non-host targets 2016-04-01 10:18:36 -07:00
codemap.rs Auto merge of #33706 - jseyfried:refactor_cfg, r=nrc 2016-05-27 17:46:14 -07:00
config.rs Comment methods in CfgFolder 2016-05-27 23:57:02 +00:00
entry.rs [breaking-change] don't glob export ast::Item_ variants 2016-02-11 12:34:48 +01:00
feature_gate.rs Auto merge of #33794 - petrochenkov:sanity, r=nrc 2016-06-01 06:21:53 -07:00
fold.rs Rollup merge of #33644 - petrochenkov:selfast, r=nrc 2016-05-27 09:57:11 +05:30
lib.rs Nit: use Range::contains 2016-05-02 11:49:25 -04:00
ptr.rs Remove some old code from libsyntax 2016-04-24 21:04:09 +03:00
show_span.rs use structured errors 2015-12-30 14:27:59 +13:00
std_inject.rs syntax: Merge keywords and remaining special idents in one list 2016-04-24 20:59:44 +03:00
str.rs syntax: Copy unstable str::char_at into libsyntax 2015-04-21 10:23:53 -07:00
test.rs Auto merge of #33821 - sanxiyn:cfg-test, r=nikomatsakis 2016-05-28 10:24:01 -07:00
visit.rs Rollup merge of #33854 - petrochenkov:prefvis, r=eddyb 2016-05-28 19:52:16 +05:30