update salsa

This commit is contained in:
Aleksey Kladov 2018-10-20 18:43:02 +03:00
parent 2ded93a78a
commit 73dd870da2
5 changed files with 14 additions and 14 deletions

6
Cargo.lock generated
View file

@ -620,7 +620,7 @@ dependencies = [
"rayon 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"relative-path 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", "relative-path 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"salsa 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "salsa 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"test_utils 0.1.0", "test_utils 0.1.0",
] ]
@ -845,7 +845,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "salsa" name = "salsa"
version = "0.5.0" version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"derive-new 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", "derive-new 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1361,7 +1361,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" "checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a"
"checksum ryu 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7153dd96dade874ab973e098cb62fcdbb89a03682e46b144fd09550998d4a4a7" "checksum ryu 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7153dd96dade874ab973e098cb62fcdbb89a03682e46b144fd09550998d4a4a7"
"checksum safemem 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8dca453248a96cb0749e36ccdfe2b0b4e54a61bfef89fb97ec621eb8e0a93dd9" "checksum safemem 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8dca453248a96cb0749e36ccdfe2b0b4e54a61bfef89fb97ec621eb8e0a93dd9"
"checksum salsa 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8301c563959d6d50fe0a34817f0d9ff08fe12eda7456e01e2bbde1588ea30602" "checksum salsa 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6c8f8b59428c040fbac0f6a2e698ae892e33d23d7519713ba8b243edb3082dad"
"checksum same-file 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "10f7794e2fda7f594866840e95f5c5962e886e228e68b6505885811a94dd728c" "checksum same-file 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "10f7794e2fda7f594866840e95f5c5962e886e228e68b6505885811a94dd728c"
"checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27" "checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27"
"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" "checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403"

View file

@ -15,7 +15,7 @@ fst = "0.3.1"
im = "12.0.0" im = "12.0.0"
ra_syntax = { path = "../ra_syntax" } ra_syntax = { path = "../ra_syntax" }
ra_editor = { path = "../ra_editor" } ra_editor = { path = "../ra_editor" }
salsa = "0.5.0" salsa = "0.6.0"
rustc-hash = "1.0" rustc-hash = "1.0"
[dev-dependencies] [dev-dependencies]

View file

@ -16,7 +16,7 @@ use std::{
#[derive(Default)] #[derive(Default)]
pub(crate) struct RootDatabase { pub(crate) struct RootDatabase {
runtime: salsa::runtime::Runtime<RootDatabase>, runtime: salsa::Runtime<RootDatabase>,
} }
impl fmt::Debug for RootDatabase { impl fmt::Debug for RootDatabase {
@ -26,7 +26,7 @@ impl fmt::Debug for RootDatabase {
} }
impl salsa::Database for RootDatabase { impl salsa::Database for RootDatabase {
fn salsa_runtime(&self) -> &salsa::runtime::Runtime<RootDatabase> { fn salsa_runtime(&self) -> &salsa::Runtime<RootDatabase> {
&self.runtime &self.runtime
} }
} }
@ -69,7 +69,7 @@ salsa::query_group! {
type FileTextQuery; type FileTextQuery;
storage input; storage input;
} }
fn file_set(key: ()) -> Arc<FileSet> { fn file_set() -> Arc<FileSet> {
type FileSetQuery; type FileSetQuery;
storage input; storage input;
} }

View file

@ -8,7 +8,7 @@ use std::sync::Arc;
salsa::query_group! { salsa::query_group! {
pub(crate) trait ModulesDatabase: SyntaxDatabase { pub(crate) trait ModulesDatabase: SyntaxDatabase {
fn module_tree(key: ()) -> Arc<ModuleTreeDescriptor> { fn module_tree() -> Arc<ModuleTreeDescriptor> {
type ModuleTreeQuery; type ModuleTreeQuery;
} }
fn module_descriptor(file_id: FileId) -> Arc<ModuleDescriptor> { fn module_descriptor(file_id: FileId) -> Arc<ModuleDescriptor> {
@ -22,8 +22,8 @@ fn module_descriptor(db: &impl ModulesDatabase, file_id: FileId) -> Arc<ModuleDe
Arc::new(ModuleDescriptor::new(file.ast())) Arc::new(ModuleDescriptor::new(file.ast()))
} }
fn module_tree(db: &impl ModulesDatabase, (): ()) -> Arc<ModuleTreeDescriptor> { fn module_tree(db: &impl ModulesDatabase) -> Arc<ModuleTreeDescriptor> {
let file_set = db.file_set(()); let file_set = db.file_set();
let mut files = Vec::new(); let mut files = Vec::new();
for &file_id in file_set.files.iter() { for &file_id in file_set.files.iter() {
let module_descr = db.module_descriptor(file_id); let module_descr = db.module_descriptor(file_id);

View file

@ -50,7 +50,7 @@ impl WritableSourceRoot {
} }
} }
} }
let file_set = self.db.file_set(()); let file_set = self.db.file_set();
let mut files: FxHashSet<FileId> = file_set.files.clone(); let mut files: FxHashSet<FileId> = file_set.files.clone();
for file_id in removed { for file_id in removed {
files.remove(&file_id); files.remove(&file_id);
@ -65,10 +65,10 @@ impl WritableSourceRoot {
impl SourceRoot for WritableSourceRoot { impl SourceRoot for WritableSourceRoot {
fn module_tree(&self) -> Arc<ModuleTreeDescriptor> { fn module_tree(&self) -> Arc<ModuleTreeDescriptor> {
self.db.module_tree(()) self.db.module_tree()
} }
fn contains(&self, file_id: FileId) -> bool { fn contains(&self, file_id: FileId) -> bool {
self.db.file_set(()).files.contains(&file_id) self.db.file_set().files.contains(&file_id)
} }
fn lines(&self, file_id: FileId) -> Arc<LineIndex> { fn lines(&self, file_id: FileId) -> Arc<LineIndex> {
self.db.file_lines(file_id) self.db.file_lines(file_id)
@ -78,7 +78,7 @@ impl SourceRoot for WritableSourceRoot {
} }
fn symbols<'a>(&'a self, acc: &mut Vec<Arc<SymbolIndex>>) { fn symbols<'a>(&'a self, acc: &mut Vec<Arc<SymbolIndex>>) {
let db = &self.db; let db = &self.db;
let symbols = db.file_set(()); let symbols = db.file_set();
let symbols = symbols let symbols = symbols
.files .files
.iter() .iter()