]> git.lizzy.rs Git - rust.git/commit - src/tools/clippy
Auto merge of #69432 - petrochenkov:alldeps, r=eddyb
authorbors <bors@rust-lang.org>
Mon, 2 Mar 2020 00:07:06 +0000 (00:07 +0000)
committerbors <bors@rust-lang.org>
Mon, 2 Mar 2020 00:07:06 +0000 (00:07 +0000)
commit9dc8dad14fc31f49254d299457e34d00721c4a73
tree956e0bd709e733d7693932cc6e0fc01a4e253874
parent1cf090e8d1916987dc02385ad552be57e4815b4b
parent487c378fc670e1305454b83f7bf33164c9ec379b
Auto merge of #69432 - petrochenkov:alldeps, r=eddyb

rustc_metadata: Load metadata for indirect macro-only dependencies

Imagine this dependency chain between crates
```
Executable crate -> Library crate -> Macro crate
```
where "Library crate" uses the macros from "Macro crate" for some code generation, but doesn't reexport them any further.

Currently, when compiling "Executable crate" we don't even load metadata for it, because why would we want to load any metadata from "Macro crate" if it already did all its code generation job when compiling "Library crate".
Right?

Wrong!
Hygiene data and spans (https://github.com/rust-lang/rust/issues/68686, https://github.com/rust-lang/rust/pull/68941) from "Macro crate" still may need to be decoded from "Executable crate".
So we'll have to load them properly.

Questions:
- How this will affect compile times for larger crate trees in practice? How to measure it?
Hygiene/span encoding/decoding will necessarily slow down compilation because right now we just don't do some work that we should do, but this introduces a whole new way to slow down things. E.g. loading metadata for `syn` (and its dependencies) when compiling your executable if one of its library dependencies uses it.
- We are currently detecting whether a crate reexports macros from "Macro crate" or not, could we similarly detect whether a crate "reexports spans" and keep it unloaded if it doesn't?
Or at least "reexports important spans" affecting hygiene, we can probably lose spans that only affect diagnostics.
src/librustc/middle/cstore.rs
src/librustc_metadata/creader.rs
src/librustc_metadata/rmeta/decoder/cstore_impl.rs
src/librustc_resolve/imports.rs