about summary refs log tree commit diff
path: root/src/librustdoc/html
diff options
context:
space:
mode:
authorJubilee <46493976+workingjubilee@users.noreply.github.com>2023-10-28 01:07:38 -0700
committerGitHub <noreply@github.com>2023-10-28 01:07:38 -0700
commit1db8c9d6e20dfefda97fd994e09e7c3121fd2e45 (patch)
tree582976dc0da17d85b409f00ae6b7edb696114166 /src/librustdoc/html
parent87a564d271999dafcc9bcfdcca33fd5fa60b0e58 (diff)
parentb7debe34e6fb2d329e21739c97ce3d7161303af5 (diff)
downloadrust-1db8c9d6e20dfefda97fd994e09e7c3121fd2e45.tar.gz
rust-1db8c9d6e20dfefda97fd994e09e7c3121fd2e45.zip
Rollup merge of #117256 - dtolnay:currentversion, r=compiler-errors
Parse rustc version at compile time

This PR eliminates a couple awkward codepaths where it was not clear how the compiler should proceed if its own version number is incomprehensible.

https://github.com/rust-lang/rust/blob/dab715641e96a61a534587fda9de1128b75b34dc/src/tools/clippy/clippy_utils/src/qualify_min_const_fn.rs#L385

https://github.com/rust-lang/rust/blob/dab715641e96a61a534587fda9de1128b75b34dc/compiler/rustc_attr/src/builtin.rs#L630

We can guarantee that every compiled rustc comes with a working version number, so the ICE codepaths above shouldn't need to be written.
Diffstat (limited to 'src/librustdoc/html')
-rw-r--r--src/librustdoc/html/render/mod.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs
index d9086433608..0b6079b2933 100644
--- a/src/librustdoc/html/render/mod.rs
+++ b/src/librustdoc/html/render/mod.rs
@@ -48,13 +48,14 @@ use std::str;
 use std::string::ToString;
 
 use askama::Template;
-use rustc_attr::{ConstStability, Deprecation, Since, StabilityLevel, CURRENT_RUSTC_VERSION};
+use rustc_attr::{ConstStability, Deprecation, Since, StabilityLevel};
 use rustc_data_structures::captures::Captures;
 use rustc_data_structures::fx::{FxHashMap, FxHashSet};
 use rustc_hir::def_id::{DefId, DefIdSet};
 use rustc_hir::Mutability;
 use rustc_middle::middle::stability;
 use rustc_middle::ty::{self, TyCtxt};
+use rustc_session::RustcVersion;
 use rustc_span::{
     symbol::{sym, Symbol},
     BytePos, FileName, RealFileName,
@@ -979,7 +980,7 @@ fn render_stability_since_raw_with_extra(
 fn since_to_string(since: &Since) -> Option<String> {
     match since {
         Since::Version(since) => Some(since.to_string()),
-        Since::Current => Some(CURRENT_RUSTC_VERSION.to_owned()),
+        Since::Current => Some(RustcVersion::CURRENT.to_string()),
         Since::Err => None,
     }
 }