summary refs log tree commit diff
path: root/compiler/rustc_metadata/src/rmeta/decoder.rs
AgeCommit message (Collapse)AuthorLines
2022-01-06rustc_metadata: Split `fn get_implementations_for_trait` into two functionsVadim Petrochenkov-22/+22
2022-01-06rustc_metadata: Make `opt_item_ident` in decoder faster and stricterVadim Petrochenkov-33/+24
By avoiding formatting and allocations in the no-ident case, and by making the span mandatory if the ident exists. Use the optimized `opt_item_ident` to cleanup `fn each_child_of_item`
2022-01-06rustc_metadata: Make attribute decoding slightly faster and stricterVadim Petrochenkov-13/+15
Rename `CStore::item_attrs` -> `CStore::item_attrs_untracked` top follow conventions
2022-01-06rustc_middle: Add a method for getting a `SimplifiedType` definition/IDVadim Petrochenkov-3/+3
Import `SimplifiedType` more
2022-01-02Auto merge of #92034 - petrochenkov:nolinknores, r=joshtriplettbors-9/+1
Remove effect of `#[no_link]` attribute on name resolution Previously it hid all non-macro names from other crates. This has no relation to linking and can change name resolution behavior in some cases (e.g. glob conflicts), in addition to just producing the "unresolved name" errors. I can kind of understand the possible reasoning behind the current behavior - if you can use names from a `no_link` crates then you can use, for example, functions too, but whether it will actually work or produce link-time errors will depend on random factors like inliner behavior. (^^^ This is not the actual reason why the current behavior exist, I've looked through git history and it's mostly accidental.) I think this risk is ok for such an obscure attribute, and we don't need to specifically prevent use of non-macro items from such crates. (I'm not actually sure why would anyone use `#[no_link]` on a crate, even if it's macro only, if you aware of any use cases, please share. IIRC, at some point it was used for crates implementing custom derives - the now removed legacy ones, not the current proc macros.) Extracted from https://github.com/rust-lang/rust/pull/91795.
2022-01-01rustc_metadata: Use a query for collecting all traits in encoderVadim Petrochenkov-1/+2
2021-12-29Auto merge of #92244 - petrochenkov:alltraits, r=cjgillotbors-0/+4
rustc_metadata: Encode list of all crate's traits into metadata While working on https://github.com/rust-lang/rust/pull/88679 I noticed that rustdoc is casually doing something quite expensive, something that is used only for error reporting in rustc - collecting all traits from all crates in the dependency tree. This PR trades some minor extra time spent by metadata encoder in rustc for major gains for rustdoc (and for rustc runs with errors, which execute the `all_traits` query for better diagnostics).
2021-12-28rustc_metadata: Encode list of all crate's traits into metadataVadim Petrochenkov-0/+4
2021-12-28rustc_metadata: Merge items from `extern` blocks into their parent modulesVadim Petrochenkov-36/+5
during metadata encoding rather than during metadata decoding
2021-12-22rustc_metadata: Merge `get_ctor_def_id` and `get_ctor_kind`Vadim Petrochenkov-19/+17
Also avoid decoding the whole `ty::AssocItem` to get a `has_self` flag
2021-12-17Remove effect of `#[no_link]` attribute on name resolutionVadim Petrochenkov-9/+1
Previously it hid all non-macro names from other crates. This has no relation to linking and can change name resolution behavior in some cases (e.g. glob conflicts), in addition to just producing the "unresolved name" errors
2021-12-14Remove `in_band_lifetimes` from `rustc_metadata`Sylvan Bowdler-2/+2
2021-11-09Add `ty::Visibility::is_public()`inquisitivecrystal-1/+1
2021-10-28Remove `ModData` from rustc_metadataMatthew Jasper-2/+2
This avoids having to decode 2 `Lazy`s when decoding a modules exports.
2021-10-21Handle cross-crate module `ExpnId`s consistentlyMatthew Jasper-4/+5
- Always use the ExpnId serialized to `tables` - Use the Id for traits and enums from other crates in resolution.
2021-10-16Adopt let_else across the compilerest31-3/+1
This performs a substitution of code following the pattern: let <id> = if let <pat> = ... { identity } else { ... : ! }; To simplify it to: let <pat> = ... { identity } else { ... : ! }; By adopting the let_else feature.
2021-10-07Rollup merge of #89476 - cjgillot:expn-id, r=petrochenkovJubilee-4/+2
Correct decoding of foreign expansions during incr. comp. Fixes https://github.com/rust-lang/rust/issues/74946 The original issue was due to a wrong assertion in `expn_hash_to_expn_id`. The secondary issue was due to a mismatch between the encoding and decoding paths for expansions that are created after the TyCtxt is created.
2021-10-06Do not ICE if some foreign expansions were not encoded.Camille GILLOT-2/+0
The metadata encoder does not necessarily encode all expansions, only those which are referenced in other metadata fields.
2021-10-06Access Session while decoding expn_id.Camille GILLOT-2/+2
2021-10-06Introduce get_diagnostic_nameCameron Steffen-4/+12
2021-10-03Move rustc_middle::middle::cstore to rustc_session.Camille GILLOT-2/+3
2021-09-14rustc_metadata: Remove Metadata::raw_bytes() and use Metadata::blob() ↵Michael Woerister-7/+4
directly instead.
2021-09-14Rename DefPathHashMap in rustc_metadata so its name does not clash with ↵Michael Woerister-2/+2
DefPathHashMap in rustc_hir.
2021-09-14Make DefPathHash->DefId panic for if the mapping fails.Michael Woerister-1/+1
We only use this mapping for cases where we know that it must succeed. Letting it panic otherwise makes it harder to use the API in unsupported ways.
2021-09-14Store DefPathHash->DefIndex map in on-disk-hash-table format in crate metadata.Michael Woerister-57/+18
This encoding allows for random access without an expensive upfront decoding state which in turn allows simplifying the DefPathIndex lookup logic without regressing performance.
2021-09-14Allow taking an OwningRef of the crate metadata blob.Michael Woerister-17/+61
2021-09-12Rollup merge of #88709 - BoxyUwU:thir-abstract-const, r=lcnrManish Goregaokar-4/+5
generic_const_exprs: use thir for abstract consts instead of mir Changes `AbstractConst` building to use `thir` instead of `mir` so that there's less chance of consts unifying when they shouldn't because lowering to mir dropped information (see `abstract-consts-as-cast-5.rs` test) r? `@lcnr`
2021-09-12Rollup merge of #88677 - petrochenkov:exportid, r=davidtwcoManish Goregaokar-4/+1
rustc: Remove local variable IDs from `Export`s Local variables can never be exported.
2021-09-10rustc: Remove local variable IDs from `Export`sVadim Petrochenkov-4/+1
Local variables can never be exported.
2021-09-10Keep a parent LocalDefId in SpanData.Camille GILLOT-1/+2
2021-09-09rename mir -> thir around abstract constsEllen-4/+5
2021-08-28Treat macros as HIR itemsinquisitivecrystal-1/+7
2021-08-22Fix typos “an”→“a” and a few different ones that appeared in the ↵Frank Steffahn-1/+1
same search
2021-07-17Drop ExpnData::krate.Camille GILLOT-1/+1
2021-07-17Drop orig_id.Camille GILLOT-1/+1
2021-07-17Encode ExpnId using ExpnHash for incr. comp.Camille GILLOT-0/+38
2021-07-17Choose encoding format in caller code.Camille GILLOT-2/+7
2021-07-17Make the CrateNum part of the ExpnId.Camille GILLOT-1/+8
2021-07-15Simplify metadata decoding.Camille GILLOT-14/+4
2021-07-15Separate encoding paths.Camille GILLOT-28/+23
The two paths will be modified independently in the next few commits.
2021-07-13Auto merge of #87044 - cjgillot:expnhash, r=petrochenkovbors-2/+9
Cache expansion hash globally ... instead of computing it multiple times. Split from #86676 r? `@petrochenkov`
2021-07-13Cache expansion hash.Camille GILLOT-2/+9
2021-07-13Auto merge of #86857 - fee1-dead:add-attr, r=oli-obkbors-0/+4
Add #[default_method_body_is_const] `@rustbot` label F-const_trait_impl
2021-07-10rustc_expand: Remove redundant field from proc macro expander structuresVadim Petrochenkov-18/+11
This information is already available from `ExpnData`
2021-07-10Add impl_constness queryDeadbeef-0/+4
2021-07-06Revert "Revert "Merge CrateDisambiguator into StableCrateId""bjorn3-6/+2
This reverts commit 8176ab8bc18fdd7d3c2cf7f720c51166364c33a3.
2021-06-21Print more crate details in -ZlsJeremy Fitzhardinge-2/+15
Useful for debugging crate hash and resolution issues.
2021-06-09Encode CrateNum using the StableCrateId for incr. comp.Camille GILLOT-4/+4
2021-06-07Revert "Merge CrateDisambiguator into StableCrateId"bjorn3-2/+6
This reverts commit d0ec85d3fb6d322496cb8f4bc1c21e19f23284ad.
2021-06-03Restore the num_def_ids_untracked public function giving the total number of ↵Denis Merigoux-0/+4
exported symbols for each crate Restored underlying num_def_ids_method Update compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs Changed name to fit with naming convention Co-authored-by: bjorn3 <bjorn3@users.noreply.github.com> Update compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs Replace regular doc with Rustdoc comment Co-authored-by: Joshua Nelson <jyn514@gmail.com> Clarifies third-party use of num_def_ids_untracked