]> git.lizzy.rs Git - rust.git/commit
Add scoped thread-local encoding and decoding contexts to cstore.
authorMichael Woerister <michaelwoerister@posteo.net>
Tue, 1 Dec 2015 15:07:15 +0000 (16:07 +0100)
committerMichael Woerister <michaelwoerister@posteo.net>
Wed, 9 Dec 2015 14:47:32 +0000 (09:47 -0500)
commitf65823e39cad10c956d57e5242152e0b41326844
tree0ea48365b489053686d8acb10b46eb5a9a5bc2f8
parentc212c0e1d1ff9f061c8149b4831e5fa1cb7e5b83
Add scoped thread-local encoding and decoding contexts to cstore.

With this commit, metadata encoding and decoding can make use of
thread-local encoding and decoding contexts. These allow implementers
of serialize::Encodable and Decodable to access information and
datastructures that would otherwise not be available to them. For
example, we can automatically translate def-id and span information
during decoding because the decoding context knows which crate the
data is decoded from. Or it allows to make ty::Ty decodable because
the context has access to the ty::ctxt that is needed for creating
ty::Ty instances.
12 files changed:
mk/crates.mk
src/librbml/lib.rs
src/librustc/lib.rs
src/librustc/middle/cstore.rs
src/librustc/middle/subst.rs
src/librustc/middle/ty/mod.rs
src/librustc_metadata/astencode.rs
src/librustc_metadata/decoder.rs
src/librustc_metadata/encoder.rs
src/librustc_metadata/lib.rs
src/librustc_metadata/tls_context.rs [new file with mode: 0644]
src/librustc_metadata/tydecode.rs