From 4a6e602c9419cc5ed464343b2373c7fe86fb89d6 Mon Sep 17 00:00:00 2001 From: Benjamin Bouvier Date: Thu, 11 Feb 2021 17:34:56 +0100 Subject: Allow automatically detect the rustc-src directory (fixes #3517). If the configured rustcSource is set to "discover", try to automatically detect a source from the sysroot rustc directory. --- crates/project_model/src/cargo_workspace.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'crates/project_model/src/cargo_workspace.rs') diff --git a/crates/project_model/src/cargo_workspace.rs b/crates/project_model/src/cargo_workspace.rs index f47898b9b..1d8d34a0b 100644 --- a/crates/project_model/src/cargo_workspace.rs +++ b/crates/project_model/src/cargo_workspace.rs @@ -44,6 +44,15 @@ impl ops::Index for CargoWorkspace { } } +/// Describes how to set the rustc source directory. +#[derive(Clone, Debug, PartialEq, Eq)] +pub enum RustcSource { + /// Explicit path for the rustc source directory. + Path(AbsPathBuf), + /// Try to automatically detect where the rustc source directory is. + Discover, +} + #[derive(Default, Clone, Debug, PartialEq, Eq)] pub struct CargoConfig { /// Do not activate the `default` feature. @@ -64,7 +73,7 @@ pub struct CargoConfig { pub no_sysroot: bool, /// rustc private crate source - pub rustc_source: Option, + pub rustc_source: Option, } pub type Package = Idx; -- cgit v1.2.3