summary refs log tree commit diff
path: root/src/librustc_metadata/decoder.rs
AgeCommit message (Collapse)AuthorLines
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
2017-05-14Remove rustc_llvm dependency from rustc_metadataRobin Kruppe-5/+1
Move the code for loading metadata from rlibs and dylibs from rustc_metadata into rustc_trans, and introduce a trait to avoid introducing a direct dependency on rustc_trans. This means rustc_metadata is no longer rebuilt when LLVM changes.
2017-05-13rustc: stop interning CodeExtent, it's small enough.Eduard-Mihai Burtescu-7/+0
2017-05-09resolved merge conflictsachernyak-124/+112
2017-05-08incr.comp.: Hash more pieces of crate metadata to detect changes there.Michael Woerister-124/+112
2017-05-04moved metadata provider impls to decoderachernyak-3/+20
2017-05-02rename from `item_mir` to `optimized_mir`Niko Matsakis-4/+4
2017-05-02Rollup merge of #41662 - nikomatsakis:on-demandify-region-mapping, r=eddybCorey Farwell-2/+9
On demandify region mapping This is an adaptation of @cramertj's PR. I am sort of tempted to keep simplifying it, but also tempted to land it so and we can refactor more in follow-up PRs. As is, it does the following things: - makes the region-maps an on-demand query, per function `tcx.region_maps(def_id)` - interns code extents instead of of having them be integers - remove the "root region extent" and (to some extent) item extents; instead we use `Option<CodeExtent<'tcx>>` in a few places (no space inefficiency since `CodeExtent<'tcx>` is now a pointer). I'm not entirely happy with the way I have it setup though. Here are some of the changes I was considering (I'm not sure if they would work out well): 1. Removing `item_extents` entirely -- they are rarely used now, because most of the relevant places now accept an `Option<Region<'tcx>>` or an `Option<CodeExtent<'tcx>>`, but I think still used in a few places. 2. Merging `RegionMaps` into the typeck tables, instead of having it be its own query. 3. Change `CodeExtent<'tcx>` to store the parent pointer. This would mean that fewer places in the code actually *need* a `RegionMaps` anyhow, since most of them just want to be able to walk "up the tree". On the other hand, you wouldn't be able to intern a `CodeExtent<'tcx>` for some random node-id, you'd need to look it up in the table (since there'd be more information). Most of this code is semi-temporary -- I expect it to largely go away as we move to NLL -- so I'm also not *that* concerned with making it perfect. r? @eddyb
2017-05-01Queryify is_item_mir_availableTaylor Cramer-7/+2
2017-05-01Queryify const_is_rvalue_promotable_to_staticTaylor Cramer-5/+0
2017-05-01Queryify item_body_nested_bodiesTaylor Cramer-8/+1
2017-04-30intern CodeExtentsNiko Matsakis-2/+9
Make a `CodeExtent<'tcx>` be something allocated in an arena instead of an index into the `RegionMaps`.
2017-04-28Auto merge of #41368 - nikomatsakis:incr-comp-dep-tracking-map, r=eddybbors-1/+1
make *most* maps private Currently we access the `DepTrackingMap` fields directly rather than using the query accessors. This seems bad. This branch removes several such uses, but not all, and extends the macro so that queries can hide their maps (so we can prevent regressions). The extension to the macro is kind of ugly :/ but couldn't find a simple way to do it otherwise (I guess I could use a nested macro...). Anyway I figure it's only temporary. r? @eddyb
2017-04-28Auto merge of #41508 - michaelwoerister:generic-path-remapping, r=alexcrichtonbors-2/+2
Implement a file-path remapping feature in support of debuginfo and reproducible builds This PR adds the `-Zremap-path-prefix-from`/`-Zremap-path-prefix-to` commandline option pair and is a more general implementation of #41419. As opposed to the previous attempt, this implementation should enable reproducible builds regardless of the working directory of the compiler. This implementation of the feature is more general in the sense that the re-mapping will affect *all* paths the compiler emits, including the ones in error messages. r? @alexcrichton
2017-04-28do not access `associated_item` map directlyNiko Matsakis-1/+1
2017-04-27Auto merge of #37860 - giannicic:defaultimpl, r=nagisabors-0/+4
#37653 support `default impl` for specialization this commit implements the first step of the `default impl` feature: > all items in a `default impl` are (implicitly) `default` and hence > specializable. In order to test this feature I've copied all the tests provided for the `default` method implementation (in run-pass/specialization and compile-fail/specialization directories) and moved the `default` keyword from the item to the impl. See [referenced](https://github.com/rust-lang/rust/issues/37653) issue for further info r? @aturon
2017-04-26Implement a file-path remapping feature in support of debuginfo and ↵Michael Woerister-2/+2
reproducible builds.
2017-04-24rustc: rename some of the queries to match tcx methods.Eduard-Mihai Burtescu-1/+1
2017-04-24support `default impl` for specializationGianni Ciccarelli-0/+4
this commit implements the first step of the `default impl` feature: all items in a `default impl` are (implicitly) `default` and hence specializable. In order to test this feature I've copied all the tests provided for the `default` method implementation (in run-pass/specialization and compile-fail/specialization directories) and moved the `default` keyword from the item to the impl. See referenced issue for further info