Skip to content

Instantly share code, notes, and snippets.

@davidtwco davidtwco/change.diff
Last active Mar 6, 2019

Embed
What would you like to do?
diff --git a/crates/ra_batch/src/lib.rs b/crates/ra_batch/src/lib.rs
index 2db03806..c6d10107 100644
--- a/crates/ra_batch/src/lib.rs
+++ b/crates/ra_batch/src/lib.rs
@@ -99,7 +99,7 @@ impl BatchDatabase {
let ws = ProjectWorkspace::discover(root.as_ref())?;
let mut roots = Vec::new();
roots.push(root.clone());
- ws.add_roots(&mut roots);
+ roots.extend(ws.to_roots());
let (mut vfs, roots) = Vfs::new(roots);
let mut load = |path: &Path| {
let vfs_file = vfs.load(path);
diff --git a/crates/ra_lsp_server/src/server_world.rs b/crates/ra_lsp_server/src/server_world.rs
index 4625a26a..7163568b 100644
--- a/crates/ra_lsp_server/src/server_world.rs
+++ b/crates/ra_lsp_server/src/server_world.rs
@@ -40,7 +40,7 @@ impl ServerWorldState {
let mut roots = Vec::new();
roots.push(root.clone());
for ws in workspaces.iter() {
- ws.add_roots(&mut roots);
+ roots.extend(ws.to_roots());
}
let (mut vfs, roots) = Vfs::new(roots);
let roots_to_scan = roots.len();
diff --git a/crates/ra_project_model/src/lib.rs b/crates/ra_project_model/src/lib.rs
index ded22244..c566ec0f 100644
--- a/crates/ra_project_model/src/lib.rs
+++ b/crates/ra_project_model/src/lib.rs
@@ -50,20 +50,25 @@ impl ProjectWorkspace {
}
}
- pub fn add_roots(&self, roots: &mut Vec<PathBuf>) {
+ pub fn to_roots(&self) -> Vec<PathBuf> {
match self {
ProjectWorkspace::Json { project } => {
+ let mut roots = Vec::with_capacity(project.roots.len());
for root in &project.roots {
roots.push(root.path.clone());
}
+ roots
}
ProjectWorkspace::Cargo { cargo, sysroot } => {
+ let mut roots =
+ Vec::with_capacity(cargo.packages().count() + sysroot.crates().count());
for pkg in cargo.packages() {
roots.push(pkg.root(&cargo).to_path_buf());
}
for krate in sysroot.crates() {
roots.push(krate.root_dir(&sysroot).to_path_buf())
}
+ roots
}
}
}
Compiling ra_batch v0.1.0 (/home/david/projects/rust/workdirs/rust-analyzer0/crates/ra_batch)
Compiling ra_lsp_server v0.1.0 (/home/david/projects/rust/workdirs/rust-analyzer0/crates/ra_lsp_server)
error[E0599]: no method named `set_crate_graph` found for type `BatchDatabase` in the current scope
--> crates/ra_batch/src/lib.rs:50:12
|
22 | pub struct BatchDatabase {
| ------------------------ method `set_crate_graph` not found for this
...
50 | db.set_crate_graph(Arc::new(crate_graph));
| ^^^^^^^^^^^^^^^
|
= note: the method `set_crate_graph` exists but the following trait bounds were not satisfied:
`BatchDatabase : ra_db::SourceDatabase`
= help: items from traits can only be used if the trait is implemented and in scope
= note: the following trait defines an item `set_crate_graph`, perhaps you need to implement it:
candidate #1: `ra_db::SourceDatabase`
error[E0599]: no method named `set_crate_graph` found for type `BatchDatabase` in the current scope
--> crates/ra_batch/src/lib.rs:50:12
|
22 | pub struct BatchDatabase {
| ------------------------ method `set_crate_graph` not found for this
...
50 | db.set_crate_graph(Arc::new(crate_graph));
| ^^^^^^^^^^^^^^^
|
= note: the method `set_crate_graph` exists but the following trait bounds were not satisfied:
`BatchDatabase : ra_db::SourceDatabase`
= help: items from traits can only be used if the trait is implemented and in scope
= note: the following trait defines an item `set_crate_graph`, perhaps you need to implement it:
candidate #1: `ra_db::SourceDatabase`
error[E0599]: no method named `set_file_text` found for type `BatchDatabase` in the current scope
--> crates/ra_batch/src/lib.rs:70:32
|
22 | pub struct BatchDatabase {
| ------------------------ method `set_file_text` not found for this
...
70 | db.set_file_text(file_id, text);
| ^^^^^^^^^^^^^
|
= note: the method `set_file_text` exists but the following trait bounds were not satisfied:
`BatchDatabase : ra_db::SourceDatabase`
= help: items from traits can only be used if the trait is implemented and in scope
= note: the following trait defines an item `set_file_text`, perhaps you need to implement it:
candidate #1: `ra_db::SourceDatabase`
error[E0599]: no method named `set_file_relative_path` found for type `BatchDatabase` in the current scope
--> crates/ra_batch/src/lib.rs:71:32
|
22 | pub struct BatchDatabase {
| ------------------------ method `set_file_relative_path` not found for this
...
71 | db.set_file_relative_path(file_id, path.clone());
| ^^^^^^^^^^^^^^^^^^^^^^
|
= note: the method `set_file_relative_path` exists but the following trait bounds were not satisfied:
`BatchDatabase : ra_db::SourceDatabase`
= help: items from traits can only be used if the trait is implemented and in scope
= note: the following trait defines an item `set_file_relative_path`, perhaps you need to implement it:
candidate #1: `ra_db::SourceDatabase`
error[E0599]: no method named `set_file_text` found for type `BatchDatabase` in the current scope
--> crates/ra_batch/src/lib.rs:70:32
|
22 | pub struct BatchDatabase {
| ------------------------ method `set_file_text` not found for this
...
70 | db.set_file_text(file_id, text);
| ^^^^^^^^^^^^^
|
= note: the method `set_file_text` exists but the following trait bounds were not satisfied:
`BatchDatabase : ra_db::SourceDatabase`
= help: items from traits can only be used if the trait is implemented and in scope
= note: the following trait defines an item `set_file_text`, perhaps you need to implement it:
candidate #1: `ra_db::SourceDatabase`
error[E0599]: no method named `set_file_source_root` found for type `BatchDatabase` in the current scope
--> crates/ra_batch/src/lib.rs:72:32
|
22 | pub struct BatchDatabase {
| ------------------------ method `set_file_source_root` not found for this
...
72 | db.set_file_source_root(file_id, source_root_id);
| ^^^^^^^^^^^^^^^^^^^^
|
= note: the method `set_file_source_root` exists but the following trait bounds were not satisfied:
`BatchDatabase : ra_db::SourceDatabase`
= help: items from traits can only be used if the trait is implemented and in scope
= note: the following trait defines an item `set_file_source_root`, perhaps you need to implement it:
candidate #1: `ra_db::SourceDatabase`
error[E0599]: no method named `set_file_relative_path` found for type `BatchDatabase` in the current scope
--> crates/ra_batch/src/lib.rs:71:32
|
22 | pub struct BatchDatabase {
| ------------------------ method `set_file_relative_path` not found for this
...
71 | db.set_file_relative_path(file_id, path.clone());
| ^^^^^^^^^^^^^^^^^^^^^^
|
= note: the method `set_file_relative_path` exists but the following trait bounds were not satisfied:
`BatchDatabase : ra_db::SourceDatabase`
= help: items from traits can only be used if the trait is implemented and in scope
= note: the following trait defines an item `set_file_relative_path`, perhaps you need to implement it:
candidate #1: `ra_db::SourceDatabase`
error[E0599]: no method named `set_file_source_root` found for type `BatchDatabase` in the current scope
--> crates/ra_batch/src/lib.rs:72:32
|
22 | pub struct BatchDatabase {
| ------------------------ method `set_file_source_root` not found for this
...
72 | db.set_file_source_root(file_id, source_root_id);
| ^^^^^^^^^^^^^^^^^^^^
|
= note: the method `set_file_source_root` exists but the following trait bounds were not satisfied:
`BatchDatabase : ra_db::SourceDatabase`
= help: items from traits can only be used if the trait is implemented and in scope
= note: the following trait defines an item `set_file_source_root`, perhaps you need to implement it:
candidate #1: `ra_db::SourceDatabase`
error[E0599]: no method named `set_source_root` found for type `BatchDatabase` in the current scope
--> crates/ra_batch/src/lib.rs:76:28
|
22 | pub struct BatchDatabase {
| ------------------------ method `set_source_root` not found for this
...
76 | db.set_source_root(source_root_id, Arc::new(source_root));
| ^^^^^^^^^^^^^^^
|
= note: the method `set_source_root` exists but the following trait bounds were not satisfied:
`BatchDatabase : ra_db::SourceDatabase`
= help: items from traits can only be used if the trait is implemented and in scope
= note: the following trait defines an item `set_source_root`, perhaps you need to implement it:
candidate #1: `ra_db::SourceDatabase`
error[E0599]: no method named `set_source_root` found for type `BatchDatabase` in the current scope
--> crates/ra_batch/src/lib.rs:76:28
|
22 | pub struct BatchDatabase {
| ------------------------ method `set_source_root` not found for this
...
76 | db.set_source_root(source_root_id, Arc::new(source_root));
| ^^^^^^^^^^^^^^^
|
= note: the method `set_source_root` exists but the following trait bounds were not satisfied:
`BatchDatabase : ra_db::SourceDatabase`
= help: items from traits can only be used if the trait is implemented and in scope
= note: the following trait defines an item `set_source_root`, perhaps you need to implement it:
candidate #1: `ra_db::SourceDatabase`
error: aborting due to 5 previous errors
For more information about this error, try `rustc --explain E0599`.
error: Could not compile `ra_batch`.
warning: build failed, waiting for other jobs to finish...
error: aborting due to 5 previous errors
For more information about this error, try `rustc --explain E0599`.
error: Could not compile `ra_batch`.
warning: build failed, waiting for other jobs to finish...
error: build failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.