From 8109ebb101ec19ffc8e003171bda8f7c53bb79e4 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 24 Jun 2019 12:35:07 +0300 Subject: Add SourceRoot::is_library, in preparation for salsa's durability --- crates/ra_db/src/input.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'crates/ra_db') diff --git a/crates/ra_db/src/input.rs b/crates/ra_db/src/input.rs index a5f4e489f..c103503bd 100644 --- a/crates/ra_db/src/input.rs +++ b/crates/ra_db/src/input.rs @@ -31,9 +31,23 @@ pub struct SourceRootId(pub u32); #[derive(Default, Clone, Debug, PartialEq, Eq)] pub struct SourceRoot { + /// Sysroot or crates.io library. + /// + /// Libraries are considered mostly immutable, this assumption is used to + /// optimize salsa's query structure + pub is_library: bool, pub files: FxHashMap, } +impl SourceRoot { + pub fn new() -> SourceRoot { + Default::default() + } + pub fn new_library() -> SourceRoot { + SourceRoot { is_library: true, ..SourceRoot::new() } + } +} + /// `CrateGraph` is a bit of information which turns a set of text files into a /// number of Rust crates. Each crate is defined by the `FileId` of its root module, /// the set of cfg flags (not yet implemented) and the set of dependencies. Note -- cgit v1.2.3