rust/compiler/rustc_metadata/src
Aaron Hill b9653568a7
Encode less metadata for proc-macro crates
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-26 12:26:27 -04:00
..
dynamic_lib mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rmeta Encode less metadata for proc-macro crates 2020-09-26 12:26:27 -04:00
creader.rs mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
dependency_format.rs mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
dynamic_lib.rs mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
foreign_modules.rs mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
lib.rs /nightly/nightly-rustc 2020-09-23 21:51:56 +02:00
link_args.rs mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
locator.rs mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
native_libs.rs don't lazily evaulate some trivial values for Option::None replacements (clippy::unnecessary_lazy_evaluations) 2020-09-15 23:17:51 +02:00