]> git.lizzy.rs Git - rust.git/commitdiff
Auto merge of #46338 - michaelwoerister:lazy-diagnostics, r=nikomatsakis
authorbors <bors@rust-lang.org>
Fri, 1 Dec 2017 16:01:22 +0000 (16:01 +0000)
committerbors <bors@rust-lang.org>
Fri, 1 Dec 2017 16:01:22 +0000 (16:01 +0000)
incr.comp.: Load cached diagnostics lazily and allow more things in the cache.

This PR implements makes two changes:
1. Diagnostics are loaded lazily from the incr. comp. cache now. This turned out to be necessary for correctness because diagnostics contain `Span` values and deserializing those requires that the source file they point to is still around in the current compilation session. Obviously this isn't always the case. Loading them lazily allows for never touching diagnostics that are not valid anymore.
2. The compiler can now deal with there being no cache entry for a given query invocation. Before, all query results of a cacheable query were always expected to be present in the cache. Now, the compiler can fall back to re-computing the result if there is no cache entry found. This allows for caching things that we cannot force from dep-node (like the `symbol_name` query). In such a case we'll just have a "best effort" caching strategy.

~~This PR is based on https://github.com/rust-lang/rust/pull/46301 (=first 2 commits), so please don't merge until that has landed. The rest of the commits are ready for review though.~~

r? @nikomatsakis


Trivial merge