summary refs log tree commit diff
path: root/src/librustc_metadata/encoder.rs
AgeCommit message (Collapse)AuthorLines
2017-09-12Auto merge of #44275 - eddyb:deferred-ctfe, r=nikomatsakisbors-3/+10
Evaluate fixed-length array length expressions lazily. This is in preparation for polymorphic array lengths (aka `[T; T::A]`) and const generics. We need deferred const-evaluation to break cycles when array types show up in positions which require knowing the array type to typeck the array length, e.g. the array type is in a `where` clause. The final step - actually passing bounds in scope to array length expressions from the parent - is not done because it still produces cycles when *normalizing* `ParamEnv`s, and @nikomatsakis' in-progress lazy normalization work is needed to deal with that uniformly. However, the changes here are still useful to unlock work on const generics, which @EpicatSupercell manifested interest in, and I might be mentoring them for that, but we need this baseline first. r? @nikomatsakis cc @oli-obk
2017-09-11Auto merge of #44435 - alexcrichton:in-scope, r=michaelwoeristerbors-2/+1
rustc: Remove HirId from queries This'll allow us to reconstruct query parameters purely from the `DepNode` they're associated with. Closes #44414
2017-09-11rustc: Remove HirId from queriesAlex Crichton-2/+1
This'll allow us to reconstruct query parameters purely from the `DepNode` they're associated with. Some queries could move straight to `HirId` but others that don't always have a correspondance between `HirId` and `DefId` moved to two-level maps where the query operates over a `DefIndex`, returning a map, which is then keyed off `ItemLocalId`. Closes #44414
2017-09-11rustc: evaluate fixed-length array length expressions lazily.Eduard-Mihai Burtescu-3/+10
2017-09-09rustc: Remove `DepGraph` handling from rustc_metadataAlex Crichton-5/+5
This should now be entirely tracked through queries, so no need to have a `DepGraph` in the `CStore` object any more!
2017-09-07rustc: Remove `CrateStore::crates` as a methodAlex Crichton-1/+1
This commit moves the `crates` method to a query and then migrates all callers to use a query instead of the now-renamed `crates_untracked` method where possible. Closes #41417
2017-09-05rustc: Migrate lang items to a queryAlex Crichton-3/+4
This commit moves the calculation of the `LanguageItems` structure into a query rather than being calculated before the `TyCtxt` exists, with the eventual end goal of removing some `CrateStore` methods.
2017-09-05rustc: Flag some CrateStore methods as "untracked"Alex Crichton-3/+2
The main use of `CrateStore` *before* the `TyCtxt` is created is during resolution, but we want to be sure that any methods used before resolution are not used after the `TyCtxt` is created. This commit starts moving the methods used by resolve to all be named `{name}_untracked` where the rest of the compiler uses just `{name}` as a query. During this transition a number of new queries were added to account for post-resolve usage of these methods.
2017-09-05rustc: Remove a number of mutable fields in cstoreAlex Crichton-2/+2
This commit started by moving methods from `CrateStore` to queries, but it ended up necessitating some deeper refactorings to move more items in general to queries. Before this commit the *resolver* would walk over the AST and process foreign modules (`extern { .. }` blocks) and collect `#[link]` annotations. It would then also process the command line `-l` directives and such. This information was then stored as precalculated lists in the `CrateStore` object for iterating over later. After this, commit, however, this pass no longer happens during resolution but now instead happens through queries. A query for the linked libraries of a crate will crawl the crate for `extern` blocks and then process the linkage annotations at that time.
2017-09-05rustc: Move original_crate_name to a queryAlex Crichton-1/+1
2017-09-05rustc: Move crate_hash to a queryAlex Crichton-1/+1
2017-09-02rustc_mir: actually "promote" constants' MIR to 'static by removing ↵Eduard-Mihai Burtescu-3/+3
StorageDead's.
2017-08-29rustc: Make the `export_map` of TyCtxt privateAlex Crichton-2/+3
This map, like `trait_map`, is calculated in resolve, but we want to be sure to track it for incremental compliation. Hide it behind a query to get more refactorings later.
2017-08-16Merge remote-tracking branch 'origin/master' into genAlex Crichton-29/+29
2017-08-15use field init shorthand EVERYWHEREZack M. Davis-29/+29
Like #43008 (f668999), but _much more aggressive_.
2017-08-11Merge remote-tracking branch 'origin/master' into genAlex Crichton-1/+1
2017-08-09Merge remote-tracking branch 'origin/master' into genAlex Crichton-5/+2
2017-08-08Encode proper spans in crate metadata.Inokentiy Babushkin-1/+1
The spans previously encoded only span the first token after the opening brace, up to the closing brace of inline `mod` declarations. Thus, when examining exports from an external crate, the spans don't include the header of inline `mod` declarations.
2017-07-31async-llvm(18): Instantiate OngoingCrateTranslation before starting translation.Michael Woerister-5/+2
2017-07-28Generator literal supportJohn Kåre Alsaker-4/+14
2017-07-06Auto merge of #42727 - alexcrichton:allocators-new, r=eddybbors-0/+5
rustc: Implement the #[global_allocator] attribute This PR is an implementation of [RFC 1974] which specifies a new method of defining a global allocator for a program. This obsoletes the old `#![allocator]` attribute and also removes support for it. [RFC 1974]: https://github.com/rust-lang/rfcs/pull/1974 The new `#[global_allocator]` attribute solves many issues encountered with the `#![allocator]` attribute such as composition and restrictions on the crate graph itself. The compiler now has much more control over the ABI of the allocator and how it's implemented, allowing much more freedom in terms of how this feature is implemented. cc #27389
2017-07-05rustc: Implement the #[global_allocator] attributeAlex Crichton-0/+5
This PR is an implementation of [RFC 1974] which specifies a new method of defining a global allocator for a program. This obsoletes the old `#![allocator]` attribute and also removes support for it. [RFC 1974]: https://github.com/rust-lang/rfcs/pull/197 The new `#[global_allocator]` attribute solves many issues encountered with the `#![allocator]` attribute such as composition and restrictions on the crate graph itself. The compiler now has much more control over the ABI of the allocator and how it's implemented, allowing much more freedom in terms of how this feature is implemented. cc #27389
2017-07-05Merge remote-tracking branch 'origin/master' into proc_macro_apiAlex Crichton-8/+46
2017-06-27rustc_typeck: support functions in variance computation.Eduard-Mihai Burtescu-6/+25
2017-06-27rustc: move the PolyFnSig out of TyFnDef.Eduard-Mihai Burtescu-1/+20
2017-06-27rustc: rename closure_type to fn_sig.Eduard-Mihai Burtescu-1/+1
2017-06-26Implement `quote!` and other `proc_macro` API.Jeffrey Seyfried-3/+4
2017-06-07Allocate DefIndices for global crate metadata.Michael Woerister-16/+24
This allows for treating global crate metadata the same as regular metadata with regard to incr. comp.
2017-05-28Auto merge of #42175 - michaelwoerister:filemap-hashing-fix-1, r=nikomatsakisbors-18/+4
incr.comp.: Track expanded spans instead of FileMaps. This PR removes explicit tracking of FileMaps in response to #42101. The reasoning behind being able to just *not* track access to FileMaps is similar to why we don't track access to the `DefId->DefPath` map: 1. One can only get ahold of a `Span` value by accessing the HIR (for local things) or a `metadata::schema::Entry` (for things from external crates). 2. For both of these things we compute a hash that incorporates the *expanded spans*, that is, what we hash is in the (FileMap independent) format `filename:line:col`. 3. Consequently, everything that emits a span should already be tracked via its dependency to something that has the span included in its hash and changes would be detected via that hash. One caveat here is that we have to be conservative when exporting things in metadata. A crate can be built without debuginfo and would thus by default not incorporate most spans into the metadata hashes. However, a downstream crate can make an inline copy of things in the upstream crate and span changes in the upstream crate would then go undetected, even if the downstream uses them (e.g. by emitting debuginfo for an inlined function). For this reason, we always incorporate spans into metadata hashes for now (there might be more efficient ways to handle this safely when red-green tracking is implemented). r? @nikomatsakis
2017-05-25Hygienize `librustc_resolve`.Jeffrey Seyfried-0/+1
2017-05-23incr.comp.: Track expanded spans instead of FileMaps.Michael Woerister-18/+4
2017-05-15Fix instability in GlobalMetadata::Impls ICH.Michael Woerister-7/+21
2017-05-08incr.comp.: Hash more pieces of crate metadata to detect changes there.Michael Woerister-433/+494
2017-05-05change various uses of `item_variances` to `variances_of`Niko Matsakis-3/+3
2017-05-02rename from `item_mir` to `optimized_mir`Niko Matsakis-11/+11
2017-05-02introduce `mir_keys()`Niko Matsakis-1/+6
Each MIR key is a DefId that has MIR associated with it
2017-04-28Auto merge of #41368 - nikomatsakis:incr-comp-dep-tracking-map, r=eddybbors-8/+8
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/+30
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 `inherited_impls` map directlyNiko Matsakis-8/+8
2017-04-27Auto merge of #37860 - giannicic:defaultimpl, r=nagisabors-1/+3
#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/+30
reproducible builds.
2017-04-24rustc: use tcx.at(span) to set the location of a query.Eduard-Mihai Burtescu-3/+3
2017-04-24rustc: expose the common DUMMY_SP query case as tcx methods.Eduard-Mihai Burtescu-2/+2
2017-04-24rustc: rename some of the queries to match tcx methods.Eduard-Mihai Burtescu-18/+18
2017-04-24support `default impl` for specializationGianni Ciccarelli-1/+3
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-16rustc: use monomorphic const_eval for cross-crate enum discriminants.Eduard-Mihai Burtescu-9/+37
2017-04-14Rollup merge of #40702 - mrhota:global_asm, r=nagisaCorey Farwell-0/+2
Implement global_asm!() (RFC 1548) This is a first attempt. ~~One (potential) problem I haven't solved is how to handle multiple usages of `global_asm!` in a module/crate. It looks like `LLVMSetModuleInlineAsm` overwrites module asm, and `LLVMAppendModuleInlineAsm` is not provided in LLVM C headers 😦~~ I can provide more detail as needed, but honestly, there's not a lot going on here. r? @eddyb CC @Amanieu @jackpot51 Tracking issue: #35119
2017-04-13use `tcx.crate_name(LOCAL_CRATE)` rather than `LinkMeta::crate_name`Niko Matsakis-2/+2
2017-04-12First attempt at global_asm! macroA.J. Gardner-0/+2
2017-04-12ICH: Replace old, transitive metadata hashing with direct hashing approach.Michael Woerister-11/+37
Instead of collecting all potential inputs to some metadata entry and hashing those, we directly hash the values we are storing in metadata. This is more accurate and doesn't suffer from quadratic blow-up when many entries have the same dependencies.