rust/src/librustc_typeck
bors 02eed2e9a5 Auto merge of #46004 - michaelwoerister:cached-mir-wip-3, r=nikomatsakis
incr.comp.: Implement query result cache and use it to cache type checking tables.

This is a spike implementation of caching more than LLVM IR and object files when doing incremental compilation. At the moment, only the `typeck_tables_of` query is cached but MIR and borrow-check will follow shortly. The feature is activated by running with `-Zincremental-queries` in addition to `-Zincremental`, it is not yet active by default.

r? @nikomatsakis
2017-11-17 10:12:21 +00:00
..
check Auto merge of #46004 - michaelwoerister:cached-mir-wip-3, r=nikomatsakis 2017-11-17 10:12:21 +00:00
coherence Auto merge of #44042 - LukasKalbertodt:ascii-methods-on-instrinsics, r=alexcrichton 2017-11-05 11:42:59 +00:00
outlives
variance
astconv.rs Add proper names to impl Trait parameters. 2017-11-15 15:46:01 -05:00
Cargo.toml
check_unused.rs
collect.rs Incorporate review feedback 2017-11-15 15:46:01 -05:00
constrained_type_params.rs
diagnostics.rs Renumber error to fix tidy 2017-11-15 15:46:01 -05:00
impl_wf_check.rs
lib.rs extract regionck_outlives into a separate helper function 2017-11-15 16:49:21 -05:00
namespace.rs
README.md

NB: This crate is part of the Rust compiler. For an overview of the compiler as a whole, see the README.md file found in librustc.

The rustc_typeck crate contains the source for "type collection" and "type checking", as well as a few other bits of related functionality. (It draws heavily on the type inferencing and trait solving code found in librustc.)

Type collection

Type "collection" is the process of converting the types found in the HIR (hir::Ty), which represent the syntactic things that the user wrote, into the internal representation used by the compiler (Ty<'tcx>) -- we also do similar conversions for where-clauses and other bits of the function signature.

To try and get a sense for the difference, consider this function:

struct Foo { }
fn foo(x: Foo, y: self::Foo) { .. }
//        ^^^     ^^^^^^^^^

Those two parameters x and y each have the same type: but they will have distinct hir::Ty nodes. Those nodes will have different spans, and of course they encode the path somewhat differently. But once they are "collected" into Ty<'tcx> nodes, they will be represented by the exact same internal type.

Collection is defined as a bundle of queries (e.g., type_of) for computing information about the various functions, traits, and other items in the crate being compiled. Note that each of these queries is concerned with interprocedural things -- for example, for a function definition, collection will figure out the type and signature of the function, but it will not visit the body of the function in any way, nor examine type annotations on local variables (that's the job of type checking).

For more details, see the collect module.

Type checking

TODO