Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(rust-analyzer): use new pkgid spec to compare #120084

Merged
merged 1 commit into from
Jan 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,24 @@ fn main() {
panic!("proc-macro-test-impl failed to build");
}

// Old Package ID Spec
let repr = format!("{name} {version}");
// New Package Id Spec since rust-lang/cargo#13311
let pkgid = String::from_utf8(
Command::new(toolchain::cargo())
.current_dir(&staging_dir)
.args(["pkgid", name])
.output()
.unwrap().stdout,
)
.unwrap();
let pkgid = pkgid.trim();

let mut artifact_path = None;
for message in Message::parse_stream(output.stdout.as_slice()) {
if let Message::CompilerArtifact(artifact) = message.unwrap() {
if artifact.target.kind.contains(&"proc-macro".to_string()) {
let repr = format!("{name} {version}");
if artifact.package_id.repr.starts_with(&repr) {
if artifact.package_id.repr.starts_with(&repr) || artifact.package_id.repr == pkgid {
artifact_path = Some(PathBuf::from(&artifact.filenames[0]));
}
}
Expand Down
Loading