diff options
| author | Lukas Wirth <lukastw97@gmail.com> | 2024-12-20 13:07:27 +0100 |
|---|---|---|
| committer | Lukas Wirth <lukastw97@gmail.com> | 2024-12-20 14:09:11 +0100 |
| commit | 3f786bb7d7648810d6fe7f76eabe0fa8186f1dcb (patch) | |
| tree | 14df84b80a4b02ad5f6ca3a63286e472f2f4bd0a /src | |
| parent | 98fcc051838e6ddab75a5a549bea5f9c3a9d3557 (diff) | |
| download | rust-3f786bb7d7648810d6fe7f76eabe0fa8186f1dcb.tar.gz rust-3f786bb7d7648810d6fe7f76eabe0fa8186f1dcb.zip | |
Arc the workspace root flycheck
Diffstat (limited to 'src')
| -rw-r--r-- | src/tools/rust-analyzer/crates/rust-analyzer/src/flycheck.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/tools/rust-analyzer/crates/rust-analyzer/src/flycheck.rs b/src/tools/rust-analyzer/crates/rust-analyzer/src/flycheck.rs index 4373d0529fc..d178b8b1fdf 100644 --- a/src/tools/rust-analyzer/crates/rust-analyzer/src/flycheck.rs +++ b/src/tools/rust-analyzer/crates/rust-analyzer/src/flycheck.rs @@ -1,7 +1,7 @@ //! Flycheck provides the functionality needed to run `cargo check` to provide //! LSP diagnostics based on the output of the command. -use std::{fmt, io, mem, process::Command, time::Duration}; +use std::{fmt, io, mem, process::Command, sync::Arc, time::Duration}; use cargo_metadata::PackageId; use crossbeam_channel::{select_biased, unbounded, Receiver, Sender}; @@ -153,7 +153,7 @@ pub(crate) enum FlycheckMessage { /// Request adding a diagnostic with fixes included to a file AddDiagnostic { id: usize, - workspace_root: AbsPathBuf, + workspace_root: Arc<AbsPathBuf>, diagnostic: Diagnostic, package_id: Option<PackageId>, }, @@ -161,7 +161,7 @@ pub(crate) enum FlycheckMessage { /// Request clearing all outdated diagnostics. ClearDiagnostics { id: usize, - /// The pacakge whose diagnostics to clear, or if unspecified, all diagnostics. + /// The package whose diagnostics to clear, or if unspecified, all diagnostics. package_id: Option<PackageId>, }, @@ -219,7 +219,7 @@ struct FlycheckActor { manifest_path: Option<AbsPathBuf>, /// Either the workspace root of the workspace we are flychecking, /// or the project root of the project. - root: AbsPathBuf, + root: Arc<AbsPathBuf>, sysroot_root: Option<AbsPathBuf>, /// CargoHandle exists to wrap around the communication needed to be able to /// run `cargo check` without blocking. Currently the Rust standard library @@ -261,7 +261,7 @@ impl FlycheckActor { sender, config, sysroot_root, - root: workspace_root, + root: Arc::new(workspace_root), manifest_path, command_handle: None, command_receiver: None, @@ -431,7 +431,7 @@ impl FlycheckActor { cmd.env("RUSTUP_TOOLCHAIN", AsRef::<std::path::Path>::as_ref(sysroot_root)); } cmd.arg(command); - cmd.current_dir(&self.root); + cmd.current_dir(&*self.root); match package { Some(pkg) => cmd.arg("-p").arg(pkg), @@ -473,11 +473,11 @@ impl FlycheckActor { match invocation_strategy { InvocationStrategy::Once => { - cmd.current_dir(&self.root); + cmd.current_dir(&*self.root); } InvocationStrategy::PerWorkspace => { // FIXME: cmd.current_dir(&affected_workspace); - cmd.current_dir(&self.root); + cmd.current_dir(&*self.root); } } |
