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

Make -Zemit-artifact-notifications also emit the artifact type #61014

Merged
merged 1 commit into from
May 23, 2019
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion src/librustc_codegen_ssa/back/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ pub fn link_binary<'a, B: ArchiveBuilder<'a>>(sess: &'a Session,
}
}
if sess.opts.debugging_opts.emit_artifact_notifications {
sess.parse_sess.span_diagnostic.emit_artifact_notification(&out_filename);
sess.parse_sess.span_diagnostic.emit_artifact_notification(&out_filename, "link");
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/librustc_errors/emitter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ pub trait Emitter {
/// Emit a notification that an artifact has been output.
/// This is currently only supported for the JSON format,
/// other formats can, and will, simply ignore it.
fn emit_artifact_notification(&mut self, _path: &Path) {}
fn emit_artifact_notification(&mut self, _path: &Path, _artifact_type: &str) {}

/// Checks if should show explanations about "rustc --explain"
fn should_show_explain(&self) -> bool {
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_errors/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -769,8 +769,8 @@ impl Handler {
}
}

pub fn emit_artifact_notification(&self, path: &Path) {
self.emitter.borrow_mut().emit_artifact_notification(path);
pub fn emit_artifact_notification(&self, path: &Path, artifact_type: &str) {
self.emitter.borrow_mut().emit_artifact_notification(path, artifact_type);
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/librustc_interface/passes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1052,7 +1052,8 @@ fn encode_and_write_metadata<'tcx>(
tcx.sess.fatal(&format!("failed to write {}: {}", out_filename.display(), e));
}
if tcx.sess.opts.debugging_opts.emit_artifact_notifications {
tcx.sess.parse_sess.span_diagnostic.emit_artifact_notification(&out_filename);
tcx.sess.parse_sess.span_diagnostic
.emit_artifact_notification(&out_filename, "metadata");
}
}

Expand Down
6 changes: 4 additions & 2 deletions src/libsyntax/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ impl Emitter for JsonEmitter {
}
}

fn emit_artifact_notification(&mut self, path: &Path) {
let data = ArtifactNotification { artifact: path };
fn emit_artifact_notification(&mut self, path: &Path, artifact_type: &str) {
let data = ArtifactNotification { artifact: path, emit: artifact_type };
let result = if self.pretty {
writeln!(&mut self.dst, "{}", as_pretty_json(&data))
} else {
Expand Down Expand Up @@ -185,6 +185,8 @@ struct DiagnosticCode {
struct ArtifactNotification<'a> {
/// The path of the artifact.
artifact: &'a Path,
/// What kind of artifact we're emitting.
emit: &'a str,
}

impl Diagnostic {
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/emit-artifact-notifications.nll.stderr
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"artifact":"$TEST_BUILD_DIR/emit-artifact-notifications.nll/libemit_artifact_notifications.rmeta"}
{"artifact":"$TEST_BUILD_DIR/emit-artifact-notifications.nll/libemit_artifact_notifications.rmeta","emit":"metadata"}
2 changes: 1 addition & 1 deletion src/test/ui/emit-artifact-notifications.stderr
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"artifact":"$TEST_BUILD_DIR/emit-artifact-notifications/libemit_artifact_notifications.rmeta"}
{"artifact":"$TEST_BUILD_DIR/emit-artifact-notifications/libemit_artifact_notifications.rmeta","emit":"metadata"}