Skip to content

Commit 3f786bb

Browse files
committed
Arc the workspace root flycheck
1 parent 98fcc05 commit 3f786bb

File tree

1 file changed

+8
-8
lines changed
  • src/tools/rust-analyzer/crates/rust-analyzer/src

1 file changed

+8
-8
lines changed

src/tools/rust-analyzer/crates/rust-analyzer/src/flycheck.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Flycheck provides the functionality needed to run `cargo check` to provide
22
//! LSP diagnostics based on the output of the command.
33
4-
use std::{fmt, io, mem, process::Command, time::Duration};
4+
use std::{fmt, io, mem, process::Command, sync::Arc, time::Duration};
55

66
use cargo_metadata::PackageId;
77
use crossbeam_channel::{select_biased, unbounded, Receiver, Sender};
@@ -153,15 +153,15 @@ pub(crate) enum FlycheckMessage {
153153
/// Request adding a diagnostic with fixes included to a file
154154
AddDiagnostic {
155155
id: usize,
156-
workspace_root: AbsPathBuf,
156+
workspace_root: Arc<AbsPathBuf>,
157157
diagnostic: Diagnostic,
158158
package_id: Option<PackageId>,
159159
},
160160

161161
/// Request clearing all outdated diagnostics.
162162
ClearDiagnostics {
163163
id: usize,
164-
/// The pacakge whose diagnostics to clear, or if unspecified, all diagnostics.
164+
/// The package whose diagnostics to clear, or if unspecified, all diagnostics.
165165
package_id: Option<PackageId>,
166166
},
167167

@@ -219,7 +219,7 @@ struct FlycheckActor {
219219
manifest_path: Option<AbsPathBuf>,
220220
/// Either the workspace root of the workspace we are flychecking,
221221
/// or the project root of the project.
222-
root: AbsPathBuf,
222+
root: Arc<AbsPathBuf>,
223223
sysroot_root: Option<AbsPathBuf>,
224224
/// CargoHandle exists to wrap around the communication needed to be able to
225225
/// run `cargo check` without blocking. Currently the Rust standard library
@@ -261,7 +261,7 @@ impl FlycheckActor {
261261
sender,
262262
config,
263263
sysroot_root,
264-
root: workspace_root,
264+
root: Arc::new(workspace_root),
265265
manifest_path,
266266
command_handle: None,
267267
command_receiver: None,
@@ -431,7 +431,7 @@ impl FlycheckActor {
431431
cmd.env("RUSTUP_TOOLCHAIN", AsRef::<std::path::Path>::as_ref(sysroot_root));
432432
}
433433
cmd.arg(command);
434-
cmd.current_dir(&self.root);
434+
cmd.current_dir(&*self.root);
435435

436436
match package {
437437
Some(pkg) => cmd.arg("-p").arg(pkg),
@@ -473,11 +473,11 @@ impl FlycheckActor {
473473

474474
match invocation_strategy {
475475
InvocationStrategy::Once => {
476-
cmd.current_dir(&self.root);
476+
cmd.current_dir(&*self.root);
477477
}
478478
InvocationStrategy::PerWorkspace => {
479479
// FIXME: cmd.current_dir(&affected_workspace);
480-
cmd.current_dir(&self.root);
480+
cmd.current_dir(&*self.root);
481481
}
482482
}
483483

0 commit comments

Comments
 (0)