Skip to content

Commit 95e2404

Browse files
committed
Switch to -Zemit-artifact-notifications
This is the renamed version of `-Zemit-directives`.
1 parent 03a72aa commit 95e2404

File tree

2 files changed

+42
-9
lines changed

2 files changed

+42
-9
lines changed

src/cargo/core/compiler/mod.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -233,15 +233,15 @@ fn rustc<'a, 'cfg>(
233233
let extract_rendered_errors = if rmeta_produced {
234234
match cx.bcx.build_config.message_format {
235235
MessageFormat::Json => {
236-
rustc.arg("-Zemit-directives");
236+
rustc.arg("-Zemit-artifact-notifications");
237237
false
238238
}
239239
MessageFormat::Human => {
240240
rustc
241241
.arg("--error-format=json")
242242
.arg("--json-rendered=termcolor")
243243
.arg("-Zunstable-options")
244-
.arg("-Zemit-directives");
244+
.arg("-Zemit-artifact-notifications");
245245
true
246246
}
247247

@@ -1119,7 +1119,7 @@ fn on_stderr_line(
11191119
}
11201120

11211121
// In some modes of execution we will execute rustc with `-Z
1122-
// emit-directives` to look for metadata files being produced. When this
1122+
// emit-artifact-notifications` to look for metadata files being produced. When this
11231123
// happens we may be able to start subsequent compilations more quickly than
11241124
// waiting for an entire compile to finish, possibly using more parallelism
11251125
// available to complete a compilation session more quickly.
@@ -1128,16 +1128,16 @@ fn on_stderr_line(
11281128
// that a metadata file has been produced.
11291129
if look_for_metadata_directive {
11301130
#[derive(serde::Deserialize)]
1131-
struct CompilerDirective {
1132-
directive: String,
1131+
struct ArtifactNotification {
1132+
artifact: String,
11331133
}
1134-
if let Ok(directive) = serde_json::from_str::<CompilerDirective>(compiler_message.get()) {
1135-
log::trace!("found directive from rustc: `{}`", directive.directive);
1136-
if directive.directive.starts_with("metadata file written") {
1134+
if let Ok(artifact) = serde_json::from_str::<ArtifactNotification>(compiler_message.get()) {
1135+
log::trace!("found directive from rustc: `{}`", artifact.artifact);
1136+
if artifact.artifact.ends_with(".rmeta") {
11371137
log::debug!("looks like metadata finished early!");
11381138
state.rmeta_produced();
1139-
return Ok(())
11401139
}
1140+
return Ok(())
11411141
}
11421142
}
11431143

tests/testsuite/build.rs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4599,3 +4599,36 @@ fn tricky_pipelining() {
45994599
.env("CARGO_BUILD_PIPELINING", "true")
46004600
.run();
46014601
}
4602+
4603+
#[test]
4604+
fn pipelining_works() {
4605+
if !crate::support::is_nightly() {
4606+
return;
4607+
}
4608+
4609+
let foo = project()
4610+
.file(
4611+
"Cargo.toml",
4612+
r#"
4613+
[package]
4614+
name = "foo"
4615+
version = "0.1.0"
4616+
[dependencies]
4617+
bar = { path = "bar" }
4618+
"#,
4619+
)
4620+
.file("src/lib.rs", "extern crate bar;")
4621+
.file("bar/Cargo.toml", &basic_lib_manifest("bar"))
4622+
.file("bar/src/lib.rs", "")
4623+
.build();
4624+
4625+
foo.cargo("build")
4626+
.env("CARGO_BUILD_PIPELINING", "true")
4627+
.with_stdout("")
4628+
.with_stderr("\
4629+
[COMPILING] [..]
4630+
[COMPILING] [..]
4631+
[FINISHED] [..]
4632+
")
4633+
.run();
4634+
}

0 commit comments

Comments
 (0)