diff options
author | Benjamin Bouvier <[email protected]> | 2021-02-11 16:34:56 +0000 |
---|---|---|
committer | Benjamin Bouvier <[email protected]> | 2021-02-13 17:20:46 +0000 |
commit | 4a6e602c9419cc5ed464343b2373c7fe86fb89d6 (patch) | |
tree | ed4148a4ccb0a7e81cb897f611e66e40bf492488 /crates/project_model/src/cargo_workspace.rs | |
parent | 2967e783ac53e89f06a8f8bd1afc12433311fded (diff) |
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.
Diffstat (limited to 'crates/project_model/src/cargo_workspace.rs')
-rw-r--r-- | crates/project_model/src/cargo_workspace.rs | 11 |
1 files changed, 10 insertions, 1 deletions
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<Target> for CargoWorkspace { | |||
44 | } | 44 | } |
45 | } | 45 | } |
46 | 46 | ||
47 | /// Describes how to set the rustc source directory. | ||
48 | #[derive(Clone, Debug, PartialEq, Eq)] | ||
49 | pub enum RustcSource { | ||
50 | /// Explicit path for the rustc source directory. | ||
51 | Path(AbsPathBuf), | ||
52 | /// Try to automatically detect where the rustc source directory is. | ||
53 | Discover, | ||
54 | } | ||
55 | |||
47 | #[derive(Default, Clone, Debug, PartialEq, Eq)] | 56 | #[derive(Default, Clone, Debug, PartialEq, Eq)] |
48 | pub struct CargoConfig { | 57 | pub struct CargoConfig { |
49 | /// Do not activate the `default` feature. | 58 | /// Do not activate the `default` feature. |
@@ -64,7 +73,7 @@ pub struct CargoConfig { | |||
64 | pub no_sysroot: bool, | 73 | pub no_sysroot: bool, |
65 | 74 | ||
66 | /// rustc private crate source | 75 | /// rustc private crate source |
67 | pub rustc_source: Option<AbsPathBuf>, | 76 | pub rustc_source: Option<RustcSource>, |
68 | } | 77 | } |
69 | 78 | ||
70 | pub type Package = Idx<PackageData>; | 79 | pub type Package = Idx<PackageData>; |