rustc: Never register syntax crates in CStore
When linking, all crates in the local CStore are used to link the final product. With #[phase(syntax)], crates want to be omitted from this linkage phase, and this was achieved by dumping the entire CStore after loading crates. This causes crates like the standard library to get loaded twice. This loading process is a fairly expensive operation when dealing with decompressing metadata. This commit alters the loading process to never register syntax crates in CStore. Instead, only phase(link) crates ever make their way into the map of crates. The CrateLoader trait was altered to return everything in one method instead of having separate methods for finding information.
This commit is contained in:
@@ -293,13 +293,12 @@ pub fn syntax_expander_table() -> SyntaxEnv {
|
||||
|
||||
pub struct MacroCrate {
|
||||
pub lib: Option<Path>,
|
||||
pub cnum: ast::CrateNum,
|
||||
pub macros: Vec<~str>,
|
||||
pub registrar_symbol: Option<~str>,
|
||||
}
|
||||
|
||||
pub trait CrateLoader {
|
||||
fn load_crate(&mut self, krate: &ast::ViewItem) -> MacroCrate;
|
||||
fn get_exported_macros(&mut self, crate_num: ast::CrateNum) -> Vec<~str> ;
|
||||
fn get_registrar_symbol(&mut self, crate_num: ast::CrateNum) -> Option<~str>;
|
||||
}
|
||||
|
||||
// One of these is made during expansion and incrementally updated as we go;
|
||||
|
||||
Reference in New Issue
Block a user