about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorJoshua Nelson <jnelson@cloudflare.com>2022-11-09 02:52:59 -0600
committerJoshua Nelson <jnelson@cloudflare.com>2022-11-09 02:54:51 -0600
commita68ec2205335e2c3de8ba56fb6a31b99f10c95a6 (patch)
tree240c87f61d31e116c19d2fa1a6b5ff2d0e8ed223 /src
parent7eef946fc0e0eff40e588eab77b09b287accbec3 (diff)
downloadrust-a68ec2205335e2c3de8ba56fb6a31b99f10c95a6.tar.gz
rust-a68ec2205335e2c3de8ba56fb6a31b99f10c95a6.zip
Fix `rustdoc --version` when used with download-rustc
Previously, rustdoc would unconditionally report the version that *rustc* was compiled with.
That showed things like `nightly-2022-10-30`, which wasn't right, since this was a `dev` build compiled from source.

Fix it by changing `rustc_driver::version` to a macro expanded at invocation time.
Diffstat (limited to 'src')
-rw-r--r--src/librustdoc/config.rs2
-rw-r--r--src/librustdoc/html/layout.rs2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/librustdoc/config.rs b/src/librustdoc/config.rs
index 9c08eac4edc..789dd398be5 100644
--- a/src/librustdoc/config.rs
+++ b/src/librustdoc/config.rs
@@ -326,7 +326,7 @@ impl Options {
             crate::usage("rustdoc");
             return Err(0);
         } else if matches.opt_present("version") {
-            rustc_driver::version("rustdoc", matches);
+            rustc_driver::version!("rustdoc", matches);
             return Err(0);
         }
 
diff --git a/src/librustdoc/html/layout.rs b/src/librustdoc/html/layout.rs
index 48c6abfca90..a60e7cb10fa 100644
--- a/src/librustdoc/html/layout.rs
+++ b/src/librustdoc/html/layout.rs
@@ -71,7 +71,7 @@ pub(crate) fn render<T: Print, S: Print>(
     let mut themes: Vec<String> = style_files.iter().map(|s| s.basename().unwrap()).collect();
     themes.sort();
 
-    let rustdoc_version = rustc_interface::util::version_str().unwrap_or("unknown version");
+    let rustdoc_version = rustc_interface::util::version_str!().unwrap_or("unknown version");
     let content = Buffer::html().to_display(t); // Note: This must happen before making the sidebar.
     let sidebar = Buffer::html().to_display(sidebar);
     PageLayout {