about summary refs log tree commit diff
path: root/src/librustc_metadata/rmeta
AgeCommit message (Collapse)AuthorLines
2020-08-30mv compiler to compiler/mark-5068/+0
2020-08-22rustc_metadata: Move some code around to merge impls of `CrateMetadataRef`Vadim Petrochenkov-53/+51
2020-08-22Do not forget capacity when collecting def path hashesVadim Petrochenkov-7/+6
2020-08-22Lazy decoding of DefPathTable from crate metadata (non-incremental case)Aaron Hill-32/+73
2020-08-18Auto merge of #75635 - Aaron1011:fix/incr-fn-param-names, r=eddybbors-5/+1
Don't use `dep_graph.with_ignore` when encoding fn param names The call to `with_ignore` was added years ago, and should no longer be necessary with the modern incremental query infrastructure. I also removed a related FIXME comment for issue #38501, which was closed months ago.
2020-08-17rust_ast::ast => rustc_astUjjwal Sharma-4/+4
2020-08-16Don't use `dep_graph.with_ignore` when encoding fn param namesAaron Hill-5/+1
The call to `with_ignore` was added years ago, and should no longer be necessary with the modern incremental query infrastructure. I also removed a related FIXME comment for issue #38501, which was closed months ago.
2020-08-15replaced log with tracingGurpreet Singh-3/+3
2020-08-14Rollup merge of #75448 - lcnr:rn-as_local_hir_id, r=davidtwcoTyler Mandry-10/+10
merge `as_local_hir_id` with `local_def_id_to_hir_id` `as_local_hir_id` was defined as just calling `local_def_id_to_hir_id` and I think that having two different ways to call the same method is somewhat confusing. Don't really care about which of these 2 methods we want to keep. Does this require an MCP, considering that these methods are fairly frequently used?
2020-08-14Rework `rustc_serialize`Matthew Jasper-261/+224
- Move the type parameter from `encode` and `decode` methods to the trait. - Remove `UseSpecialized(En|De)codable` traits. - Remove blanket impls for references. - Add `RefDecodable` trait to allow deserializing to arena-allocated references safely. - Remove ability to (de)serialize HIR. - Create proc-macros `(Ty)?(En|De)codable` to help implement these new traits.
2020-08-13merge `as_local_hir_id` with `local_def_id_to_hir_id`Bastian Kauschke-10/+10
2020-08-09Auto merge of #75278 - cuviper:indexmap, r=Mark-Simulacrumbors-17/+5
Upgrade indexmap and use it more First this upgrades `indexmap` to 1.5.1, which is now based on `hashbrown::raw::RawTable`. This means it shares a lot of the same performance characteristics for insert, lookup, etc., while keeping items in insertion order. Then across various rustc crates, this replaces a lot of `Vec`+`HashMap` pairs with a single `IndexMap` or `IndexSet`. Closes #60608. r? @eddyb
2020-08-09rustc_metadata: use IndexSet in EncodeContextJosh Stone-17/+5
2020-08-09Auto merge of #75137 - Aaron1011:fix/hygiene-skip-expndata, r=petrochenkovbors-0/+4
Don't serialize ExpnData for foreign crates When we encode an ExpnId into the crate metadata, we write out the CrateNum of the crate that 'owns' the corresponding `ExpnData`, which is later used to decode the `ExpnData` from its owning crate. However, we current serialize the `ExpnData` for all `ExpnIds` that we serialize, even if the `ExpnData` was already serialized into a foreign crate. This commit skips encoding this kind of `ExpnData`, which should hopefully speed up metadata encoding and reduce the total metadata size.
2020-08-09Add comment about the lack of `ExpnData` serialization for proc-macro cratesAaron Hill-0/+4
2020-08-08Auto merge of #74932 - nnethercote:rm-ast-session-globals, r=petrochenkovbors-12/+10
Remove `librustc_ast` session globals By moving the data onto `Session`. r? @petrochenkov
2020-08-08Eliminate the `SessionGlobals` from `librustc_ast`.Nicholas Nethercote-12/+10
By moving `{known,used}_attrs` from `SessionGlobals` to `Session`. This means they are accessed via the `Session`, rather than via TLS. A few `Attr` methods and `librustc_ast` functions are now methods of `Session`. All of this required passing a `Session` to lots of functions that didn't already have one. Some of these functions also had arguments removed, because those arguments could be accessed directly via the `Session` argument. `contains_feature_attr()` was dead, and is removed. Some functions were moved from `librustc_ast` elsewhere because they now need to access `Session`, which isn't available in that crate. - `entry_point_type()` --> `librustc_builtin_macros` - `global_allocator_spans()` --> `librustc_metadata` - `is_proc_macro_attr()` --> `Session`
2020-08-07fix clippy::unnecessary_mut_passed: function arg is not required to be mutableMatthias Krüger-1/+1
2020-08-06Record query name when profiling "metadata_decode_entry"Aaron Hill-1/+1
2020-08-06Auto merge of #75008 - eddyb:rmeta-indexed-trait-impls, r=nikomatsakisbors-12/+23
rustc_metadata: track the simplified Self type for every trait impl. For the `traits_impls_of` query, we index the impls by `fast_reject::SimplifiedType` (a "shallow type"), which allows some simple cases like `impl Trait<..> for Foo<..>` to be efficiently iterated over, by e.g. `for_each_relevant_impl`. This PR encodes the `fast_reject::SimplifiedType` cross-crate to avoid needing to deserialize the `Self` type of every `impl` in order to simplify it - the simplification itself should be cheap, but the deserialization is less so. We could go further from here and make loading the list of impls lazy, for a given simplified `Self` type, but that would have more complicated implications for performance, and this PR doesn't do anything in that regard. r? @nikomatsakis cc @Mark-Simulacrum
2020-08-04metadata: skip empty polymorphization bitsetDavid Wood-2/+5
This commit skips encoding empty polymorphization results - while polymorphization is disabled, this should be every polymorphization result; but when polymorphization is re-enabled, this would help with non-generic functions and those which do use all their parameters (most functions). Signed-off-by: David Wood <david@davidtw.co>
2020-08-04mir: use `FiniteBitSet<u32>` in polymorphizationDavid Wood-2/+2
This commit changes polymorphization to return a `FiniteBitSet<u32>` rather than a `FiniteBitSet<u64>` because most functions do not use anywhere near sixty-four generic parameters so keeping a `u64` around is unnecessary in most cases. Signed-off-by: David Wood <david@davidtw.co>
2020-08-02Rollup merge of #75059 - shengsheng:typos, r=Dylan-DPCManish Goregaokar-1/+1
fix typos Fix common misspellings with https://en.wikipedia.org/wiki/Wikipedia:Lists_of_common_misspellings/For_machines
2020-08-03Rollup merge of #75054 - cjgillot:rename-depkind, r=petrochenkovYuki Okushi-6/+6
Rename rustc_middle::cstore::DepKind to CrateDepKind It is ambiguous with DepGraph's own DepKind.
2020-08-02fix typosliuzhenyu-1/+1
2020-08-02Rename rustc_middle::cstore::DepKind to DependencyKind.Camille GILLOT-6/+6
2020-08-01rustc_metadata: track the simplified Self type for every trait impl.Eduard-Mihai Burtescu-12/+23
2020-07-28Cache non-exhaustive separately from attributesMark Rousskov-4/+9
2020-07-27mv std libs to library/mark-1/+33
2020-07-26Share serialization optimization between incr and metadataAaron Hill-114/+54
2020-07-26Add test for serializing hygiene *into* a proc-macro crateAaron Hill-4/+27
This is a very obscure corner case, and should never be hit in practice.
2020-07-26Hygiene serialization implementationAaron Hill-22/+228
2020-07-20index: introduce and use `FiniteBitSet`David Wood-3/+3
This commit introduces a `FiniteBitSet` type which replaces the manual bit manipulation which was being performed in polymorphization. Signed-off-by: David Wood <david@davidtw.co>
2020-07-20metadata: record `unused_generic_params`David Wood-0/+14
This commit records the results of `unused_generic_params` in crate metadata, hopefully improving performance. Signed-off-by: David Wood <david@davidtw.co>
2020-07-17Rename TypeckTables to TypeckResults.Valentin Lazureanu-2/+2
2020-07-15Auto merge of #74113 - lcnr:type-dependent-consts-2, r=eddybbors-2/+2
Support const args in type dependent paths (Take 2) once more, except it is sound this time :smiling_face_with_three_hearts: previously #71154 ----- ```rust #![feature(const_generics)] struct A; impl A { fn foo<const N: usize>(&self) -> usize { N } } struct B; impl B { fn foo<const N: usize>(&self) -> usize { 42 } } fn main() { let a = A; a.foo::<7>(); } ``` When calling `type_of` for generic const arguments, we now use the `TypeckTables` of the surrounding body to get the expected type. This alone causes cycle errors though, as we now have `typeck_tables_of(main)` -> `...` -> `type_of(main_ANON0 := 7)` -> `typeck_tables_of(main)` :zap: (see https://github.com/rust-lang/rust/issues/68400#issuecomment-611760290) To prevent this we must not call `type_of(const_arg)` during `typeck_tables_of`. This is achieved by calling `type_of(param_def_id)` instead. We have to somehow remember the `DefId` of the param through all of typeck, which is done using the struct `ty::WithOptConstParam<DefId>`, which replaces `DefId` where needed and contains an `Option<DefId>` to be able to store the const parameter in case it exists. Queries which are currently cached on disk are split into two variants: `query_name`(cached) and `query_name_(of|for)_const_arg`(not cached), with `query_name_of_const_arg` taking a pair `(did, param_did): (LocalDefId, DefId)`. For some queries a method `query_name_of_opt_const_arg` is added to `TyCtxt` which takes a `ty::WithOptConstParam` and either calls `query_name` or `query_name_of_const_arg` depending on the value of `const_param_did`. r? @eddyb @varkor
2020-07-15const generics work!Bastian Kauschke-1/+1
2020-07-15optimized_mirBastian Kauschke-1/+1
2020-07-15Change `SymbolName::name` to a `&str`.Nicholas Nethercote-3/+3
This eliminates a bunch of `Symbol::intern()` and `Symbol::as_str()` calls, which is good, because they require locking the interner. Note that the unsafety in `from_cycle_error()` is identical to the unsafety on other adjacent impls.
2020-07-10Avoid "whitelist"Tamir Duberstein-3/+0
Other terms are more inclusive and precise.
2020-07-05Use for<'tcx> fn pointers in Providers, instead of having Providers<'tcx>.Eduard-Mihai Burtescu-2/+2
2020-07-05Replace early-bound normalization hack with per-query key/value type aliases.Eduard-Mihai Burtescu-6/+3
2020-07-01Rollup merge of #73449 - ehuss:duplicate-lang-item, r=matthewjasperManish Goregaokar-0/+2
Provide more information on duplicate lang item error. This gives some notes on the location of the files where the lang items were loaded from. Some duplicate lang item errors can be a little confusing, and this might help in diagnosing what has happened. Here's an example when hitting a bug with Cargo's build-std: ``` error: duplicate lang item in crate `core` (which `rustc_std_workspace_core` depends on): `try`. | = note: the lang item is first defined in crate `core` (which `z10` depends on) = note: first definition in `core` loaded from /Users/eric/Proj/rust/cargo/scratch/z10/target/target/debug/deps/libcore-a764da499c7385f4.rmeta = note: second definition in `core` loaded from /Users/eric/Proj/rust/cargo/scratch/z10/target/target/debug/deps/libcore-5b082675aea34986.rmeta ```
2020-06-30Switch crate_extern_paths to a query, and tweak wording.Eric Huss-5/+2
2020-06-30Provide more information on duplicate lang item error.Eric Huss-0/+5
2020-06-29Serialize all foreign `SourceFile`s into proc-macro crate metadataAaron Hill-37/+94
Normally, we encode a `Span` that references a foreign `SourceFile` by encoding information about the foreign crate. When we decode this `Span`, we lookup the foreign crate in order to decode the `SourceFile`. However, this approach does not work for proc-macro crates. When we load a proc-macro crate, we do not deserialzie any of its dependencies (since a proc-macro crate can only export proc-macros). This means that we cannot serialize a reference to an upstream crate, since the associated metadata will not be available when we try to deserialize it. This commit modifies foreign span handling so that we treat all foreign `SourceFile`s as local `SourceFile`s when serializing a proc-macro. All `SourceFile`s will be stored into the metadata of a proc-macro crate, allowing us to cotinue to deserialize a proc-macro crate without needing to load any of its dependencies. Since the number of foreign `SourceFile`s that we load during a compilation session may be very large, we only serialize a `SourceFile` if we have also serialized a `Span` which requires it.
2020-06-26Make `fn_arg_names` return `Ident` instead of symbolAaron Hill-15/+9
Also, implement this query for the local crate, not just foreign crates.
2020-06-22Revert "Rollup merge of #72389 - Aaron1011:feature/move-fn-self-msg, ↵Aaron Hill-9/+15
r=nikomatsakis" This reverts commit 372cb9b69c76a042d0b9d4b48ff6084f64c84a2c, reversing changes made to 5c61a8dc34c3e2fc6d7f02cb288c350f0233f944.
2020-06-21Cache decoded predicate shorthandsMatthew Jasper-18/+34
2020-06-20Rollup merge of #72600 - Aaron1011:fix/anon-const-encoding, r=varkorRalf Jung-3/+8
Properly encode AnonConst into crate metadata Fixes #68104 Previous, we were encoding AnonConst as a regular Const, causing us to treat them differently after being deserialized in another compilation session.