about summary refs log tree commit diff
path: root/src/librustc_metadata
AgeCommit message (Collapse)AuthorLines
2017-12-01Auto merge of #46370 - michaelwoerister:rm-metadata-hashing, r=eddybbors-185/+20
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-185/+20
2017-11-28incr.comp.: Make MIR encoding fit for incr.comp. caching.Michael Woerister-0/+18
2017-11-24Auto merge of #45946 - estebank:crate-conflict-diag, r=arielb1bors-84/+85
Use multiline text for crate conflict diagnostics After: ``` error[E0464]: multiple matching crates for `libc` --> /checkout/src/rustc/dlmalloc_shim/../../dlmalloc/src/linux.rs:1:1 | 1 | extern crate libc; | ^^^^^^^^^^^^^^^^^^ | = note: candidates: crate `libc`: /checkout/obj/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-658d35794c10b003.rlib crate `libc`: /checkout/obj/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-f32a17a3111b01aa.rlib ``` Before: ``` error[E0464]: multiple matching crates for `libc` --> /checkout/src/rustc/dlmalloc_shim/../../dlmalloc/src/linux.rs:1:1 | 1 | extern crate libc; | ^^^^^^^^^^^^^^^^^^ | = note: candidates: = note: path: /checkout/obj/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-658d35794c10b003.rlib = note: crate name: libc = note: path: /checkout/obj/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-f32a17a3111b01aa.rlib = note: crate name: libc ```
2017-11-22Use multiline text for crate conflict diagnosticsEsteban Küber-84/+85
2017-11-21Auto merge of #45879 - nikomatsakis:nll-kill-cyclic-closures, r=arielb1bors-43/+21
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-32/+20
2017-11-18kill the `closure_kind` queryNiko Matsakis-11/+1
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-118/+57
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-3/+51
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-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-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-12rustc_driver: base extern query providers on local ones.Eduard-Mihai Burtescu-3/+3
2017-11-08incr.comp.: Provide session to some more decoding contexts.Michael Woerister-8/+23
2017-11-07incr.comp.: Always require Session when decoding Spans (as to avoid silently ↵Michael Woerister-53/+60
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-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-14/+14
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-114/+72
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/+4
2017-10-24Introduce CrateDisambiguator newtype and fix testsIgor Matuszewski-10/+9
2017-10-24incr.comp.: Factor some persistence functionality out of crate metadata code.Michael Woerister-114/+72
2017-10-23Use 128 bit instead of Symbol for crate disambiguatorIgor Matuszewski-5/+8
2017-10-16convert constant promotion into a queryNiko Matsakis-2/+3
2017-09-23incr.comp.: Remove support for loading metadata fingerprints.Michael Woerister-3/+18
2017-09-20Fix ICEscalexm-0/+13
2017-09-18incr.comp.: Remove tcx from StableHashingContext.Michael Woerister-14/+14
2017-09-18incr.comp.: Already hash HIR bodies during metadata export so they don't ↵Michael Woerister-11/+51
have to be hashed in downstream crates.
2017-09-18Fix issues uncovered by rebasing:Michael Woerister-4/+8
- 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-17rustc: Calculate `ExportedSymbols` in a queryAlex Crichton-1/+1
This commit moves the definition of the `ExportedSymbols` structure to the `rustc` crate and then creates a query that'll be used to construct the `ExportedSymbols` set. This in turn uses the reachablity query exposed in the previous commit.
2017-09-14bring TyCtxt into scopeDouglas Campos-2/+2
2017-09-13Auto merge of #44420 - alexcrichton:private-cstore, r=michaelwoeristerbors-15/+1
rustc: Make `CrateStore` private to `TyCtxt` This commit makes the `CrateStore` object private to the `ty/context.rs` module and also absent on the `Session` itself. cc #44390 cc #44341 (initial commit pulled and rebased from here)
2017-09-12rustc: Make `CrateStore` private to `TyCtxt`Alex Crichton-15/+1
This commit removes the `cstore_untracked` method, making the `CrateStore` trait object entirely private to the `ty/context.rs` module.
2017-09-12Auto merge of #44133 - vorner:allocator-kind-autodetect, r=alexcrichtonbors-36/+63
Autodetect the type of allocator crate used Annotate the allocator crates (allocator_system, allocator_jemalloc) by the type of allocator they are. If one is requested as an exe allocator, detect its type by the flags. This has the effect that using this (de jure wrong) configuration in the target spec works instead of producing a really unhelpful and arcane linker error: "exe-allocation-crate": "alloc_system" Fixes #43524. There are two yet unsolved FIXME's, I'll be glad for some advice on what to do with them.
2017-09-12Remove the `cstore` reference from Session in order to prepare encapsulating ↵Michael Woerister-4/+4
CrateStore access in tcx.
2017-09-12Auto merge of #44275 - eddyb:deferred-ctfe, r=nikomatsakisbors-3/+25
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-3/+2
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-3/+2
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-11rustc: introduce ty::Const { ConstVal, Ty }.Eduard-Mihai Burtescu-3/+3