about summary refs log tree commit diff
path: root/src/librustc_metadata/decoder.rs
AgeCommit message (Collapse)AuthorLines
2017-12-05Include non-`pub` `use` and `extern crate` items in the crate metadata for ↵Jeffrey Seyfried-4/+13
macros 2.0.
2017-11-28incr.comp.: Make MIR encoding fit for incr.comp. caching.Michael Woerister-0/+9
2017-11-18remove the `generator_sigs` map, query, and plumbingNiko Matsakis-17/+0
2017-11-18kill the `closure_kind` queryNiko Matsakis-7/+0
2017-11-16incr.comp.: Remove default serialization implementations for things in ↵Michael Woerister-0/+21
rustc::hir::def_id so that we get an ICE instead of silently doing the wrong thing.
2017-11-16incr.comp.: Remove some code duplication around TyDecoder by factoring ↵Michael Woerister-113/+2
things into a macro.
2017-11-13incr.comp.: Properly use ty::codec::decode_cnum() in rustc_metadata::decoder.Michael Woerister-6/+1
2017-11-13incr.comp.: Add position() method to TyEncoder.Michael Woerister-0/+7
2017-11-08incr.comp.: Provide session to some more decoding contexts.Michael Woerister-2/+16
2017-11-07incr.comp.: Always require Session when decoding Spans (as to avoid silently ↵Michael Woerister-12/+16
wrong results).
2017-11-05Auto merge of #45770 - spastorino:newtype_index, r=nikomatsakisbors-0/+1
Make last structs indexes definitions use newtype_index macro This PR makes the last two index structs not using newtype_index macro to use it and also fixes this https://github.com/rust-lang/rust/issues/45763 issue.
2017-11-04Auto merge of #45711 - tirr-c:unicode-span, r=estebankbors-1/+7
Display spans correctly when there are zero-width or wide characters Hopefully... * fixes #45211 * fixes #8706 --- Before: ``` error: invalid width `7` for integer literal --> unicode_2.rs:12:25 | 12 | let _ = ("a̐éö̲", 0u7); | ^^^ | = help: valid widths are 8, 16, 32, 64 and 128 error: invalid width `42` for integer literal --> unicode_2.rs:13:20 | 13 | let _ = ("아あ", 1i42); | ^^^^ | = help: valid widths are 8, 16, 32, 64 and 128 error: aborting due to 2 previous errors ``` After: ``` error: invalid width `7` for integer literal --> unicode_2.rs:12:25 | 12 | let _ = ("a̐éö̲", 0u7); | ^^^ | = help: valid widths are 8, 16, 32, 64 and 128 error: invalid width `42` for integer literal --> unicode_2.rs:13:20 | 13 | let _ = ("아あ", 1i42); | ^^^^ | = help: valid widths are 8, 16, 32, 64 and 128 error: aborting due to 2 previous errors ``` Spans might display incorrectly on the browser. r? @estebank
2017-11-04Make DefIndex use newtype_index macroSantiago Pastorino-0/+1
2017-11-03[Syntax Breaking] Rename DefaultImpl to AutoImplleonardo.yvens-5/+5
DefaultImpl is a highly confusing name for what we now call auto impls, as in `impl Send for ..`. The name auto impl is not formally decided but for sanity anything is better than `DefaultImpl` which refers neither to `default impl` nor to `impl Default`.
2017-11-03Display spans correctly when there are non-half-width charactersWonwoo Choi-1/+7
2017-11-01Auto merge of #45472 - michaelwoerister:incr-comp-caching-base, r=nikomatsakisbors-58/+64
incr.comp.: Implement compiler diagnostic persistence. This PR implements storing and loading diagnostics that the compiler generates and thus allows for emitting warnings during incremental compilation without actually re-evaluating the thing the warning originally came from. It also lays some groundwork for storing and loading type information and MIR in the incr. comp. cache. ~~It is still work in progress:~~ - ~~There's still some documentation to be added.~~ - ~~The way anonymous queries are handled might lead to duplicated emissions of warnings. Not sure if there is a better way or how frequent such duplication would be in practice.~~ Diagnostic message duplication is addressed separately in #45519. r? @nikomatsakis
2017-10-27Implement RFC 1861: Extern typesPaul Lietar-0/+1
2017-10-24incr.comp.: Factor some persistence functionality out of crate metadata code.Michael Woerister-58/+64
2017-09-18incr.comp.: Already hash HIR bodies during metadata export so they don't ↵Michael Woerister-8/+27
have to be hashed in downstream crates.
2017-09-18Fix issues uncovered by rebasing:Michael Woerister-1/+2
- Don't hash traits in scope as part of HIR hashing any more. - Some queries returned DefIndexes from other crates. - Provide a generic way of stably hashing maps (not used everywhere yet).
2017-09-17rustc: Mostly remove `ExportedSymbols`Alex Crichton-1/+2
This is a big map that ends up inside of a `CrateContext` during translation for all codegen units. This means that any change to the map may end up causing an incremental recompilation of a codegen unit! In order to reduce the amount of dependencies here between codegen units and the actual input crate this commit refactors dealing with exported symbols and such into various queries. The new queries are largely based on existing queries with filled out implementations for the local crate in addition to external crates, but the main idea is that while translating codegen untis no unit needs the entire set of exported symbols, instead they only need queries about particulare `DefId` instances every now and then. The linking stage, however, still generates a full list of all exported symbols from all crates, but that's going to always happen unconditionally anyway, so no news there!
2017-09-11rustc: introduce ty::Const { ConstVal, Ty }.Eduard-Mihai Burtescu-3/+3
2017-09-11rustc: intern ConstVal's in TyCtxt.Eduard-Mihai Burtescu-0/+15
2017-09-09rustc: Remove `DepGraph` handling from rustc_metadataAlex Crichton-49/+10
This should now be entirely tracked through queries, so no need to have a `DepGraph` in the `CStore` object any more!
2017-09-05rustc: Store InternedString in `DefPathData`Alex Crichton-8/+9
Previously a `Symbol` was stored there, but this ended up causing hash collisions in situations that otherwise shouldn't have a hash collision. Only the symbol's string value was hashed, but it was possible for distinct symbols to have the same string value, fooling various calcuations into thinking that these paths *didn't* need disambiguating data when in fact they did! By storing `InternedString` instead we're hopefully triggering all the exising logic to disambiguate paths with same-name `Symbol` but actually distinct locations.
2017-09-05rustc: Rename item_body query to extern_const_bodyAlex Crichton-4/+4
Should hopefully more accurately reflect what's happening! This commit also removes the cache in the cstore implementation as it's already cached through the query infrastructure.
2017-08-30Make fields of `Span` privateVadim Petrochenkov-2/+2
2017-08-25Merge remote-tracking branch 'origin/master' into genAlex Crichton-1/+1
2017-08-19Implement `From<&[T]>` and others for `Arc`/`Rc`Murarth-1/+1
Implements RFC 1845, adding implementations of: * `From<&[T]>` for `Rc<[T]>` * `From<&str>` for `Rc<str>` * `From<String>` for `Rc<str>` * `From<Box<T: ?Sized>>` for `Rc<T>` * `From<Vec<T>>` for `Rc<[T]>` * and likewise for `Arc<_>` Also removes now-obsolete internal methods `Rc::__from_array` and `Rc::__from_str`, replacing their use with `Rc::from`.
2017-08-16Merge remote-tracking branch 'origin/master' into genAlex Crichton-5/+5
2017-08-15use field init shorthand EVERYWHEREZack M. Davis-5/+5
Like #43008 (f668999), but _much more aggressive_.
2017-07-28Generator literal supportJohn Kåre Alsaker-0/+18
2017-07-05Merge remote-tracking branch 'origin/master' into proc_macro_apiAlex Crichton-7/+13
2017-06-27rustc: move the PolyFnSig out of TyFnDef.Eduard-Mihai Burtescu-4/+10
2017-06-27rustc: rename closure_type to fn_sig.Eduard-Mihai Burtescu-5/+5
2017-06-26Implement `quote!` and other `proc_macro` API.Jeffrey Seyfried-1/+1
2017-06-18Auto merge of #42593 - ibabushkin:on-demand-external-source, r=eddybbors-1/+3
Implement lazy loading of external crates' sources. Fixes #38875 Fixes #38875. This is a follow-up to #42507. When a (now correctly translated) span from an external crate is referenced in a error, warning or info message, we still don't have the source code being referenced. Since stuffing the source in the serialized metadata of an rlib is extremely wasteful, the following scheme has been implemented: * File maps now contain a source hash that gets serialized as well. * When a span is rendered in a message, the source hash in the corresponding file map(s) is used to try and load the source from the corresponding file on disk. If the file is not found or the hashes don't match, the failed attempt is recorded (and not retried). * The machinery fetching source lines from file maps is augmented to use the lazily loaded external source as a secondary fallback for file maps belonging to external crates. This required a small change to the expected stderr of one UI test (it now renders a span, where previously was none). Further work can be done based on this - some of the machinery previously used to hide external spans is possibly obsolete and the hashing code can be reused in different places as well. r? @eddyb
2017-06-13External spans: Added a test for #38875.Inokentiy Babushkin-1/+1
A bug has been discovered and fixed in the process.
2017-06-12Auto merge of #42537 - michaelwoerister:tcx-for-dep-node, r=nikomatsakisbors-4/+6
incr.comp.: Make DepNode `Copy` and valid across compilation sessions This PR moves `DepNode` to a representation that does not need retracing and thus simplifies comparing dep-graphs from different compilation sessions. The code also gets a lot simpler in many places, since we don't need the generic parameter on `DepNode` anymore. See https://github.com/rust-lang/rust/issues/42294 for details. ~~NOTE: Only the last commit of this is new, the rest is already reviewed in https://github.com/rust-lang/rust/pull/42504.~~ This PR is almost done but there are some things I still want to do: - [x] Add some module-level documentation to `dep_node.rs`, explaining especially what the `define_dep_nodes!()` macro is about. - [x] Do another pass over the dep-graph loading logic. I suspect that we can get rid of building the `edges` map and also use arrays instead of hash maps in some places. cc @rust-lang/compiler r? @nikomatsakis
2017-06-10Added source hashes to FileMapInokentiy Babushkin-0/+2
We can use these to perform lazy loading of source files belonging to external crates. That way we will be able to show the source code of external spans that have been translated.
2017-06-09incr.comp.: Uniformly represent DepNodes as (Kind, StableHash) pairs.Michael Woerister-4/+6
2017-06-09Auto merge of #42507 - ibabushkin:external-span-trans, r=eddybbors-8/+8
Fix translation of external spans Previously, I noticed that spans from external crates don't generate any output. This limitation is problematic if analysis is performed on one or more external crates, as is the case with [rust-semverver](https://github.com/ibabushkin/rust-semverver). This change should address this behaviour, with the potential drawback that a minor performance hit is to be expected, as spans from potentially large crates have to be translated now.
2017-06-07Fix translation of external spans.Inokentiy Babushkin-8/+8
2017-06-07Allocate DefIndices for global crate metadata.Michael Woerister-13/+6
This allows for treating global crate metadata the same as regular metadata with regard to incr. comp.
2017-05-31Make a newtype for DefPathHash so they are not confused with content hashesMichael Woerister-3/+2
2017-05-25Improve intercrate hygiene.Jeffrey Seyfried-6/+8
2017-05-18Use 128 instead of 64 bits for DefPath hashesMichael Woerister-1/+2
2017-05-17Auto merge of #41911 - michaelwoerister:querify_trait_def, r=nikomatsakisbors-19/+14
Remove interior mutability from TraitDef by turning fields into queries This PR gets rid of anything `std::cell` in `TraitDef` by - moving the global list of trait impls from `TraitDef` into a query, - moving the list of trait impls relevent for some self-type from `TraitDef` into a query - moving the specialization graph of trait impls into a query, and - moving `TraitDef::object_safety` into a query. I really like how querifying things not only helps with incremental compilation and on-demand, but also just plain makes the code cleaner `:)` There are also some smaller fixes in the PR. Commits can be reviewed separately. r? @eddyb or @nikomatsakis
2017-05-15Remove interior mutability from TraitDef by turning fields into queries.Michael Woerister-10/+5
2017-05-15ICH: Hash lists of local trait impls as part of the HIR.Michael Woerister-9/+9