summary refs log tree commit diff
path: root/src/librustc_metadata/encoder.rs
AgeCommit message (Collapse)AuthorLines
2017-12-21Auto merge of #46922 - kennytm:rollup, r=kennytmbors-0/+7
Rollup of 14 pull requests - Successful merges: #46636, #46780, #46784, #46809, #46814, #46820, #46839, #46847, #46858, #46878, #46884, #46890, #46898, #46918 - Failed merges:
2017-12-21Add GenericParam, refactor Generics in ast, hir, rustdocJonas Platte-3/+3
The Generics now contain one Vec of an enum for the generic parameters, rather than two separate Vec's for lifetime and type parameters. Additionally, places that previously used Vec<LifetimeDef> now use Vec<GenericParam> instead.
2017-12-19incr.comp.: Precompute small hash for filenames to save some work.Michael Woerister-0/+7
2017-12-14add trait aliases to HIRAlex Burka-1/+3
2017-12-14Use PathBuf instead of String where applicableOliver Schneider-15/+17
2017-12-05Include non-`pub` `use` and `extern crate` items in the crate metadata for ↵Jeffrey Seyfried-3/+1
macros 2.0.
2017-12-01Auto merge of #46370 - michaelwoerister:rm-metadata-hashing, r=eddybbors-58/+10
incr.comp.: Remove ability to produce incr. comp. hashes during metadata export. This functionality has been superseded by on-import hashing, which can be less conservative and does not require extra infrastructure. r? @nikomatsakis
2017-11-29incr.comp.: Remove on-export crate metadata hashing.Michael Woerister-58/+10
2017-11-28incr.comp.: Make MIR encoding fit for incr.comp. caching.Michael Woerister-0/+9
2017-11-21Auto merge of #45879 - nikomatsakis:nll-kill-cyclic-closures, r=arielb1bors-13/+19
move closure kind, signature into `ClosureSubsts` Instead of using side-tables, store the closure-kind and signature in the substitutions themselves. This has two key effects: - It means that the closure's type changes as inference finds out more things, which is very nice. - As a result, it avoids the need for the `freshen_closure_like` code (though we still use it for generators). - It avoids cyclic closures calls. - These were never meant to be supported, precisely because they make a lot of the fancy inference that we do much more complicated. However, due to an oversight, it was previously possible -- if challenging -- to create a setup where a closure *directly* called itself (see e.g. #21410). We have to see what the effect of this change is, though. Needs a crater run. Marking as [WIP] until that has been assessed. r? @arielb1
2017-11-21Auto merge of #45701 - cramertj:impl-trait-this-time, r=eddybbors-1/+1
impl Trait Lifetime Handling This PR implements the updated strategy for handling `impl Trait` lifetimes, as described in [RFC 1951](https://github.com/rust-lang/rfcs/blob/master/text/1951-expand-impl-trait.md) (cc #42183). With this PR, the `impl Trait` desugaring works as follows: ```rust fn foo<T, 'a, 'b, 'c>(...) -> impl Foo<'a, 'b> { ... } // desugars to exists type MyFoo<ParentT, 'parent_a, 'parent_b, 'parent_c, 'a, 'b>: Foo<'a, 'b>; fn foo<T, 'a, 'b, 'c>(...) -> MyFoo<T, 'static, 'static, 'static, 'a, 'b> { ... } ``` All of the in-scope (parent) generics are listed as parent generics of the anonymous type, with parent regions being replaced by `'static`. Parent regions referenced in the `impl Trait` return type are duplicated into the anonymous type's generics and mapped appropriately. One case came up that wasn't specified in the RFC: it's possible to write a return type that contains multiple regions, neither of which outlives the other. In that case, it's not clear what the required lifetime of the output type should be, so we generate an error. There's one remaining FIXME in one of the tests: `-> impl Foo<'a, 'b> + 'c` should be able to outlive both `'a` and `'b`, but not `'c`. Currently, it can't outlive any of them. @nikomatsakis and I have discussed this, and there are some complex interactions here if we ever allow `impl<'a, 'b> SomeTrait for AnonType<'a, 'b> { ... }`, so the plan is to hold off on this until we've got a better idea of what the interactions are here. cc #34511. Fixes #44727.
2017-11-18remove the `generator_sigs` map, query, and plumbingNiko Matsakis-12/+19
2017-11-18kill the `closure_kind` queryNiko Matsakis-1/+0
2017-11-17Fix impl Trait Lifetime HandlingTaylor Cramer-1/+1
After this change, impl Trait existentials are desugared to a new `abstract type` definition paired with a set of lifetimes to apply. In-scope generics are included as parents of the `abstract type` generics. Parent regions are replaced with static, and parent regions referenced in the `impl Trait` type are duplicated at the end of the `abstract type`'s generics.
2017-11-17Auto merge of #46004 - michaelwoerister:cached-mir-wip-3, r=nikomatsakisbors-2/+29
incr.comp.: Implement query result cache and use it to cache type checking tables. This is a spike implementation of caching more than LLVM IR and object files when doing incremental compilation. At the moment, only the `typeck_tables_of` query is cached but MIR and borrow-check will follow shortly. The feature is activated by running with `-Zincremental-queries` in addition to `-Zincremental`, it is not yet active by default. r? @nikomatsakis
2017-11-16incr.comp.: Remove default serialization implementations for things in ↵Michael Woerister-2/+29
rustc::hir::def_id so that we get an ICE instead of silently doing the wrong thing.
2017-11-15Split hir::TyImplTrait, move checks to HIR loweringChristopher Vittal-1/+1
Replace hir::TyImplTrait with TyImplTraitUniversal and TyImplTraitExistential. Add an ImplTraitContext enum to rustc::hir::lowering to track the kind and allowedness of an impl Trait. Significantly alter lowering to thread ImplTraitContext and one other boolean parameter described below throughought much of lowering. The other parameter is for tracking if lowering a function is in a trait impl, as there is not enough information to otherwise know this information during lowering otherwise. This change also removes the checks from ast_ty_to_ty for impl trait allowedness as they are now all taking place in HIR lowering.
2017-11-04Auto merge of #45394 - davidtwco:rfc-2008, r=petrochenkovbors-1/+8
RFC 2008: Future-proofing enums/structs with #[non_exhaustive] attribute This work-in-progress pull request contains my changes to implement [RFC 2008](https://github.com/rust-lang/rfcs/pull/2008). The related tracking issue is #44109. As of writing, enum-related functionality is not included and there are some issues related to tuple/unit structs. Enum related tests are currently ignored. WIP PR requested by @nikomatsakis [in Gitter](https://gitter.im/rust-impl-period/WG-compiler-middle?at=59e90e6297cedeb0482ade3e).
2017-11-03Implemented RFC 2008 for enums (not including variants) and structs.David Wood-1/+8
2017-11-03Rename `trait_has_auto_impl` to `trait_is_auto`leonardo.yvens-1/+1
2017-11-03[Syntax Breaking] Rename DefaultImpl to AutoImplleonardo.yvens-4/+4
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-01Auto merge of #45472 - michaelwoerister:incr-comp-caching-base, r=nikomatsakisbors-50/+8
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-50/+8
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