about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-01-21 19:22:25 +0000
committerbors <bors@rust-lang.org>2024-01-21 19:22:25 +0000
commitd410d4a2baf9e99b37b03dd42f06238b14374bf7 (patch)
tree06bc1b2ae89fbdd802d928388907f31943d7f62b
parent47b0f466f5442cd9d124c47421f490b5a2f29c52 (diff)
parent56077149df0f82a064837fe703d2ea7614783bf9 (diff)
downloadrust-d410d4a2baf9e99b37b03dd42f06238b14374bf7.tar.gz
rust-d410d4a2baf9e99b37b03dd42f06238b14374bf7.zip
Auto merge of #16412 - lnicola:sync-from-rust, r=lnicola
internal: Sync from downstream
-rw-r--r--crates/proc-macro-srv/proc-macro-test/build.rs18
1 files changed, 16 insertions, 2 deletions
diff --git a/crates/proc-macro-srv/proc-macro-test/build.rs b/crates/proc-macro-srv/proc-macro-test/build.rs
index 6cf2b5643e5..c9b605a8087 100644
--- a/crates/proc-macro-srv/proc-macro-test/build.rs
+++ b/crates/proc-macro-srv/proc-macro-test/build.rs
@@ -92,12 +92,26 @@ 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]));
                 }
             }