about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-07-31 14:31:16 +0000
committerbors <bors@rust-lang.org>2024-07-31 14:31:16 +0000
commitbba84aa8366c9e44082f0da471a80fcf249b0433 (patch)
tree57c584a06d6e723f296068dac4170c61c38c1e7e
parent9fb03f0f21e700b5470787bf76a3cf9a154472ec (diff)
parente8a90513de81c26eded9a18aacbed3c8c72b62af (diff)
downloadrust-bba84aa8366c9e44082f0da471a80fcf249b0433.tar.gz
rust-bba84aa8366c9e44082f0da471a80fcf249b0433.zip
Auto merge of #17750 - davidbarsky:david/remove-abspath-requirement-in-linked-projects, r=Veykril
fix: remove AbsPath requirement from linkedProjects

Should (fingers crossed!) fix https://github.com/rust-lang/rust-analyzer/issues/17664. I opened the `rustc` workspace with the [suggested configuration](https://github.com/rust-lang/rust/blob/e552c168c72c95dc28950a9aae8ed7030199aa0d/src/etc/rust_analyzer_settings.json) and I was able to successfully open some rustc crates (`rustc_incremental`) and have IDE functionality.

`@Veykril:` can you try these changes and let me know if it fixed rustc?
-rw-r--r--src/tools/rust-analyzer/crates/rust-analyzer/src/config.rs14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/tools/rust-analyzer/crates/rust-analyzer/src/config.rs b/src/tools/rust-analyzer/crates/rust-analyzer/src/config.rs
index 8743c4faff6..2b29be7fa28 100644
--- a/src/tools/rust-analyzer/crates/rust-analyzer/src/config.rs
+++ b/src/tools/rust-analyzer/crates/rust-analyzer/src/config.rs
@@ -1677,7 +1677,7 @@ impl Config {
         !self.linkedProjects(None).is_empty()
     }
 
-    pub fn linked_manifests(&self) -> impl Iterator<Item = &AbsPath> + '_ {
+    pub fn linked_manifests(&self) -> impl Iterator<Item = &Utf8Path> + '_ {
         self.linkedProjects(None).iter().filter_map(|it| match it {
             ManifestOrProjectJson::Manifest(p) => Some(&**p),
             // despite having a buildfile, using this variant as a manifest
@@ -2273,11 +2273,7 @@ mod single_or_array {
 #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
 #[serde(untagged)]
 enum ManifestOrProjectJson {
-    Manifest(
-        #[serde(serialize_with = "serialize_abs_pathbuf")]
-        #[serde(deserialize_with = "deserialize_abs_pathbuf")]
-        AbsPathBuf,
-    ),
+    Manifest(Utf8PathBuf),
     ProjectJson(ProjectJsonData),
     DiscoveredProjectJson {
         data: ProjectJsonData,
@@ -2306,10 +2302,12 @@ where
 }
 
 impl ManifestOrProjectJson {
-    fn manifest(&self) -> Option<&AbsPath> {
+    fn manifest(&self) -> Option<&Utf8Path> {
         match self {
             ManifestOrProjectJson::Manifest(manifest) => Some(manifest),
-            ManifestOrProjectJson::DiscoveredProjectJson { buildfile, .. } => Some(buildfile),
+            ManifestOrProjectJson::DiscoveredProjectJson { buildfile, .. } => {
+                Some(buildfile.as_ref())
+            }
             ManifestOrProjectJson::ProjectJson(_) => None,
         }
     }