summary refs log tree commit diff
path: root/compiler/rustc_metadata/src/rmeta/decoder.rs
AgeCommit message (Collapse)AuthorLines
2020-12-08Account for gaps in def path table during decodingAaron Hill-3/+8
When encoding a proc-macro crate, there may be gaps in the table (since we only encode the crate root and proc-macro items). Account for this by checking if the entry is present, rather than using `unwrap()`
2020-12-03rustc_metadata: Remove some dead codeVadim Petrochenkov-17/+0
2020-12-01Auto merge of #74967 - Aaron1011:feature/incr-def-path-table, r=pnkfelixbors-0/+52
Implement lazy decoding of DefPathTable during incremental compilation PR https://github.com/rust-lang/rust/pull/75813 implemented lazy decoding of the `DefPathTable` from crate metadata. However, it requires decoding the entire `DefPathTable` when incremental compilation is active, so that we can map a decoded `DefPathHash` to a `DefId` from an arbitrary crate. This PR adds support for lazy decoding of dependency `DefPathTable`s when incremental compilation si active. When we load the incremental cache and dep graph, we need the ability to map a `DefPathHash` to a `DefId` in the current compilation session (if the corresponding definition still exists). This is accomplished by storing the old `DefId` (that is, the `DefId` from the previous compilation session) for each `DefPathHash` we need to remap. Since a `DefPathHash` includes the owning crate, the old crate is guaranteed to be the right one (if the definition still exists). We then use the old `DefIndex` as an initial guess, which we validate by comparing the expected and actual `DefPathHash`es. In most cases, foreign crates will be completely unchanged, which means that we our guess will be correct. If our guess is wrong, we fall back to decoding the entire `DefPathTable` for the foreign crate. This still represents an improvement over the status quo, since we can skip decoding the entire `DefPathTable` for other crates (where all of our guesses were correct).
2020-11-27Encode proc_macro directly.Camille GILLOT-62/+25
Encode proc_macro name directly. Do not store None values.
2020-11-25Lazy DefPath decoding for incremental compilationAaron Hill-0/+52
2020-11-18Improve error message when we try to get_type on something that does not ↵Hannah McLaughlin-1/+6
have a type
2020-11-13Eliminate some temporary vectors & Remove unnecessary mark_attr_usedDániel Buga-6/+11
2020-11-10Changed unwrap_or to unwrap_or_else in some places.Nicholas-Baron-8/+8
The discussion seems to have resolved that this lint is a bit "noisy" in that applying it in all places would result in a reduction in readability. A few of the trivial functions (like `Path::new`) are fine to leave outside of closures. The general rule seems to be that anything that is obviously an allocation (`Box`, `Vec`, `vec![]`) should be in a closure, even if it is a 0-sized allocation.
2020-10-27Cache foreign_modules queryRyan Levick-3/+5
2020-10-14Remove unused code from remaining compiler cratesest31-21/+0
2020-10-06Split bounds from predicatesMatthew Jasper-1/+14
2020-10-05Record `expansion_that_defined` into crate metadataAaron Hill-0/+4
Fixes #77523 Now that hygiene serialization is implemented, we also need to record `expansion_that_defined` so that we properly handle a foreign `SyntaxContext`.
2020-09-26Encode less metadata for proc-macro cratesAaron Hill-18/+38
Currently, we serialize the same crate metadata for proc-macro crates as we do for normal crates. This is quite wasteful - almost none of this metadata is ever used, and much of it can't even be deserialized (if it contains a foreign `CrateNum`). This PR changes metadata encoding to skip encoding the majority of crate metadata for proc-macro crates. Most of the `Lazy<[T]>` fields are left completetly empty, while the non-lazy fields are left as-is. Additionally, proc-macros now have a def span that does not include their body. This was done for normal functions in #75465, but was missed for proc-macros. As a result of this PR, we should only ever encode local `CrateNum`s when encoding proc-macro crates. I've added a specialized serialization impl for `CrateNum` to assert this.
2020-09-19wip emit errors during AbstractConst buildingBastian Kauschke-2/+3
2020-09-18support const_evaluatable_checked across crate boundariesBastian Kauschke-0/+19
2020-08-30mv compiler to compiler/mark-0/+1907