about summary refs log tree commit diff
path: root/src/librustdoc/html/render
diff options
context:
space:
mode:
authorDavid Tolnay <dtolnay@gmail.com>2023-10-26 10:14:29 -0700
committerDavid Tolnay <dtolnay@gmail.com>2023-10-29 22:42:32 -0700
commit2fe7d17bd9aabe3948b8693c2a3d4841ce9fbd14 (patch)
treec8006b654e380b47fdea85fea88f84cb3e9b8d37 /src/librustdoc/html/render
parent5c7cf837395db7221bd1061eee230fd27f81e6ad (diff)
downloadrust-2fe7d17bd9aabe3948b8693c2a3d4841ce9fbd14.tar.gz
rust-2fe7d17bd9aabe3948b8693c2a3d4841ce9fbd14.zip
Store version of `deprecated` attribute in structured form
Diffstat (limited to 'src/librustdoc/html/render')
-rw-r--r--src/librustdoc/html/render/mod.rs13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs
index 7ab78e73ba7..e852d02b6ac 100644
--- a/src/librustdoc/html/render/mod.rs
+++ b/src/librustdoc/html/render/mod.rs
@@ -48,7 +48,7 @@ use std::str;
 use std::string::ToString;
 
 use askama::Template;
-use rustc_attr::{ConstStability, Deprecation, StabilityLevel, StableSince};
+use rustc_attr::{ConstStability, DeprecatedSince, Deprecation, StabilityLevel, StableSince};
 use rustc_data_structures::captures::Captures;
 use rustc_data_structures::fx::{FxHashMap, FxHashSet};
 use rustc_hir::def_id::{DefId, DefIdSet};
@@ -617,21 +617,18 @@ fn short_item_info(
 ) -> Vec<ShortItemInfo> {
     let mut extra_info = vec![];
 
-    if let Some(depr @ Deprecation { note, since, is_since_rustc_version: _, suggestion: _ }) =
-        item.deprecation(cx.tcx())
-    {
+    if let Some(depr @ Deprecation { note, since, suggestion: _ }) = item.deprecation(cx.tcx()) {
         // We display deprecation messages for #[deprecated], but only display
         // the future-deprecation messages for rustc versions.
         let mut message = if let Some(since) = since {
-            let since = since.as_str();
             if !stability::deprecation_in_effect(&depr) {
-                if since == "TBD" {
+                if let DeprecatedSince::Future = since {
                     String::from("Deprecating in a future Rust version")
                 } else {
-                    format!("Deprecating in {}", Escape(since))
+                    format!("Deprecating in {}", Escape(&since.to_string()))
                 }
             } else {
-                format!("Deprecated since {}", Escape(since))
+                format!("Deprecated since {}", Escape(&since.to_string()))
             }
         } else {
             String::from("Deprecated")