Auto merge of #16412 - lnicola:sync-from-rust, r=lnicola

internal: Sync from downstream
This commit is contained in:
bors 2024-01-21 19:22:25 +00:00
commit d410d4a2ba

View file

@ -92,12 +92,26 @@ fn main() {
panic!("proc-macro-test-impl failed to build"); 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; let mut artifact_path = None;
for message in Message::parse_stream(output.stdout.as_slice()) { for message in Message::parse_stream(output.stdout.as_slice()) {
if let Message::CompilerArtifact(artifact) = message.unwrap() { if let Message::CompilerArtifact(artifact) = message.unwrap() {
if artifact.target.kind.contains(&"proc-macro".to_string()) { if artifact.target.kind.contains(&"proc-macro".to_string()) {
let repr = format!("{name} {version}"); if artifact.package_id.repr.starts_with(&repr) || artifact.package_id.repr == pkgid
if artifact.package_id.repr.starts_with(&repr) { {
artifact_path = Some(PathBuf::from(&artifact.filenames[0])); artifact_path = Some(PathBuf::from(&artifact.filenames[0]));
} }
} }