rustc: Remove a number of mutable fields in cstore

This commit started by moving methods from `CrateStore` to queries, but it ended
up necessitating some deeper refactorings to move more items in general to
queries.

Before this commit the *resolver* would walk over the AST and process foreign
modules (`extern { .. }` blocks) and collect `#[link]` annotations. It would
then also process the command line `-l` directives and such. This information
was then stored as precalculated lists in the `CrateStore` object for iterating
over later.

After this, commit, however, this pass no longer happens during resolution but
now instead happens through queries. A query for the linked libraries of a crate
will crawl the crate for `extern` blocks and then process the linkage
annotations at that time.
This commit is contained in:
Alex Crichton 2017-08-30 14:48:57 -07:00
parent 87ea0a19bf
commit 64a70342e6
19 changed files with 366 additions and 309 deletions

View file

@ -11,3 +11,5 @@
#[link(name = "")] //~ ERROR: given with empty name
extern {
}
fn main() {}

View file

@ -11,3 +11,5 @@
#[link(name="foo", kind="static-nobundle")]
//~^ ERROR: kind="static-nobundle" is feature gated
extern {}
fn main() {}