From 84dd22969f79da4a417b4c424a7095522d4b83c5 Mon Sep 17 00:00:00 2001 From: bjorn3 Date: Thu, 10 Jun 2021 10:19:58 +0200 Subject: [PATCH] Include rustc and cranelift version in debuginfo --- src/debuginfo/mod.rs | 8 +++++--- src/lib.rs | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/debuginfo/mod.rs b/src/debuginfo/mod.rs index 61e54a76f29..c67336eb3f2 100644 --- a/src/debuginfo/mod.rs +++ b/src/debuginfo/mod.rs @@ -61,9 +61,11 @@ impl<'tcx> DebugContext<'tcx> { let mut dwarf = DwarfUnit::new(encoding); - // FIXME: how to get version when building out of tree? - // Normally this would use option_env!("CFG_VERSION"). - let producer = format!("cg_clif (rustc {})", "unknown version"); + let producer = format!( + "cg_clif (rustc {}, cranelift {})", + rustc_interface::util::version_str().unwrap_or("unknown version"), + cranelift_codegen::VERSION, + ); let comp_dir = tcx.sess.working_dir.to_string_lossy(false).into_owned(); let (name, file_info) = match tcx.sess.local_crate_source_file.clone() { Some(path) => { diff --git a/src/lib.rs b/src/lib.rs index 904efed5bd9..cfc5902cbe3 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -14,6 +14,7 @@ extern crate rustc_fs_util; extern crate rustc_hir; extern crate rustc_incremental; extern crate rustc_index; +extern crate rustc_interface; extern crate rustc_session; extern crate rustc_span; extern crate rustc_target;