diff options
Diffstat (limited to 'crates/ra_db')
-rw-r--r-- | crates/ra_db/src/input.rs | 14 |
1 files changed, 14 insertions, 0 deletions
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); | |||
31 | 31 | ||
32 | #[derive(Default, Clone, Debug, PartialEq, Eq)] | 32 | #[derive(Default, Clone, Debug, PartialEq, Eq)] |
33 | pub struct SourceRoot { | 33 | pub struct SourceRoot { |
34 | /// Sysroot or crates.io library. | ||
35 | /// | ||
36 | /// Libraries are considered mostly immutable, this assumption is used to | ||
37 | /// optimize salsa's query structure | ||
38 | pub is_library: bool, | ||
34 | pub files: FxHashMap<RelativePathBuf, FileId>, | 39 | pub files: FxHashMap<RelativePathBuf, FileId>, |
35 | } | 40 | } |
36 | 41 | ||
42 | impl SourceRoot { | ||
43 | pub fn new() -> SourceRoot { | ||
44 | Default::default() | ||
45 | } | ||
46 | pub fn new_library() -> SourceRoot { | ||
47 | SourceRoot { is_library: true, ..SourceRoot::new() } | ||
48 | } | ||
49 | } | ||
50 | |||
37 | /// `CrateGraph` is a bit of information which turns a set of text files into a | 51 | /// `CrateGraph` is a bit of information which turns a set of text files into a |
38 | /// number of Rust crates. Each crate is defined by the `FileId` of its root module, | 52 | /// number of Rust crates. Each crate is defined by the `FileId` of its root module, |
39 | /// the set of cfg flags (not yet implemented) and the set of dependencies. Note | 53 | /// the set of cfg flags (not yet implemented) and the set of dependencies. Note |