Skip to content

Commit 60aa3a8

Browse files
author
Paolo Tranquilli
committed
Rust: fix workspace member aggregation when absolute path is a glob pattern
We were interpreting the absolute path of a workspace as a glob pattern, which doesn't work if the path has some special characters (e.g. `[` or `]`).
1 parent 4ae49cf commit 60aa3a8

27 files changed

+5
-3
lines changed

rust/extractor/src/rust_analyzer.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,10 @@ impl TomlReader {
173173
}
174174

175175
fn workspace_members_match(workspace_dir: &AbsPath, members: &[String], target: &AbsPath) -> bool {
176-
members.iter().any(|p| {
177-
glob::Pattern::new(workspace_dir.join(p).as_str()).is_ok_and(|p| p.matches(target.as_str()))
176+
target.strip_prefix(workspace_dir).is_some_and(|rel_path| {
177+
members
178+
.iter()
179+
.any(|p| glob::Pattern::new(p).is_ok_and(|p| p.matches(rel_path.as_str())))
178180
})
179181
}
180182

rust/ql/integration-tests/hello-workspace/rust-project.json renamed to rust/ql/integration-tests/hello-[workspace]/rust-project.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@
2121
"deps": []
2222
}
2323
]
24-
}
24+
}

0 commit comments

Comments
 (0)