Display "Deprecation planned" in rustdoc for future rustc deprecations
This commit is contained in:
parent
87cd09b94c
commit
2a8a25be37
1 changed files with 22 additions and 9 deletions
|
@ -2817,7 +2817,17 @@ fn stability_tags(item: &clean::Item) -> String {
|
||||||
|
|
||||||
// The trailing space after each tag is to space it properly against the rest of the docs.
|
// The trailing space after each tag is to space it properly against the rest of the docs.
|
||||||
if item.deprecation().is_some() {
|
if item.deprecation().is_some() {
|
||||||
tags += &tag_html("deprecated", "Deprecated");
|
let mut message = "Deprecated";
|
||||||
|
if let Some(ref stab) = item.stability {
|
||||||
|
if let Some(ref depr) = stab.deprecation {
|
||||||
|
if let Some(ref since) = depr.since {
|
||||||
|
if !stability::deprecation_in_effect(&since) {
|
||||||
|
message = "Deprecation planned";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tags += &tag_html("deprecated", message);
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(stab) = item
|
if let Some(stab) = item
|
||||||
|
@ -2848,15 +2858,18 @@ fn short_stability(item: &clean::Item, cx: &Context) -> Vec<String> {
|
||||||
if let Some(Deprecation { note, .. }) = &item.deprecation() {
|
if let Some(Deprecation { note, .. }) = &item.deprecation() {
|
||||||
// We display deprecation messages for #[deprecated] and #[rustc_deprecated]
|
// We display deprecation messages for #[deprecated] and #[rustc_deprecated]
|
||||||
// but only display the future-deprecation messages for #[rustc_deprecated].
|
// but only display the future-deprecation messages for #[rustc_deprecated].
|
||||||
let mut message = if let Some(since) = item.stability.deprecation.since {
|
let mut message = String::from("Deprecated");
|
||||||
if stability::deprecation_in_effect(since) {
|
if let Some(ref stab) = item.stability {
|
||||||
format!("Deprecated since {}", Escape(since))
|
if let Some(ref depr) = stab.deprecation {
|
||||||
|
if let Some(ref since) = depr.since {
|
||||||
|
if stability::deprecation_in_effect(&since) {
|
||||||
|
message = format!("Deprecated since {}", Escape(&since));
|
||||||
} else {
|
} else {
|
||||||
format!("Deprecating in {}", Escape(since))
|
message = format!("Deprecating in {}", Escape(&since));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
String::from("Deprecated")
|
|
||||||
};
|
|
||||||
|
|
||||||
if let Some(note) = note {
|
if let Some(note) = note {
|
||||||
let mut ids = cx.id_map.borrow_mut();
|
let mut ids = cx.id_map.borrow_mut();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue