summary refs log tree commit diff
path: root/src/librustc_metadata/decoder.rs
AgeCommit message (Collapse)AuthorLines
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
2017-04-23rustc: make the const-eval cache polymorphic.Eduard-Mihai Burtescu-10/+9
2017-04-22cache attributes of items from foreign cratesAriel Ben-Yehuda-3/+18
this avoids parsing item attributes on each call to `item_attrs`, which takes off 33% (!) of translation time and 50% (!) of trans-item collection time.
2017-04-16rustc: use monomorphic const_eval for cross-crate enum discriminants.Eduard-Mihai Burtescu-19/+5
2017-04-16rustc_const_eval: move ConstEvalErr to the rustc crate.Eduard-Mihai Burtescu-1/+2
2017-04-12First attempt at global_asm! macroA.J. Gardner-0/+1
2017-04-07ICH: Centrally compute and cache DefPath hashes as part of DefPathTable.Michael Woerister-5/+8
2017-03-29Refactor how spans are combined in the parser.Jeffrey Seyfried-3/+3
2017-03-23convert `custom_coerce_unsized_kind` into a `coerce_unsized_info`Niko Matsakis-4/+4
This "on-demand" task both checks for errors and computes the custom unsized kind, if any. This task is only defined on impls of `CoerceUnsized`; invoking it on any other kind of impl results in a bug. This is just to avoid having an `Option`, could easily be changed.
2017-03-22Rollup merge of #40696 - cramertj:remove-unused-adt-def-code, r=petrochenkovCorey Farwell-10/+2
Remove unused adt-def insertion by constructor DefIndex It looks to me like ADT definitions weren't being looked up by constructor id, and a test run supports my theory. In any case, I'm not sure it would have worked in its current configuration. If I understand correctly, the `adt_def` map entry from constructor id -> adt def would only be present after a successful call to `queries::adt_def::get` with the proper ADT `DefIndex`. Trying to look up an adt_def by the constructor index prior to a successful lookup by ADT index would fail since `item.kind` would be `EntryKind::Fn` (for the constructor function) and so would trigger the `bug!`. r? @nikomatsakis
2017-03-21Remove unused adt-def insertion by constructor DefIndexTaylor Cramer-10/+2
2017-03-21Check for conflicts between macros 1.0 exports (`#[macro_export]`, ↵Jeffrey Seyfried-13/+6
`#[macro_reexport]`) and macros 2.0 exports (`pub use` macro re-exports and `pub macro` (once implemented) at the crate root.
2017-02-25rustc_const_eval: demand that the MIR qualify_consts ran on each evaluated body.Eduard-Mihai Burtescu-3/+14
2017-02-25rustc_typeck: rework coherence to be almost completely on-demand.Eduard-Mihai Burtescu-11/+10
2017-02-25rustc_typeck: hook up collect and item/body check to on-demand.Eduard-Mihai Burtescu-6/+9