about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbjorn3 <bjorn3@users.noreply.github.com>2021-06-10 10:19:58 +0200
committerbjorn3 <bjorn3@users.noreply.github.com>2021-06-10 11:18:59 +0200
commit84dd22969f79da4a417b4c424a7095522d4b83c5 (patch)
treee7e5f5fe01dcbf0dbc9e7862741185ec1ab28d8b
parentb7180ae39a5be0884c7be8afa61290cc1cf7451a (diff)
downloadrust-84dd22969f79da4a417b4c424a7095522d4b83c5.tar.gz
rust-84dd22969f79da4a417b4c424a7095522d4b83c5.zip
Include rustc and cranelift version in debuginfo
-rw-r--r--src/debuginfo/mod.rs8
-rw-r--r--src/lib.rs1
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;