Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 41 pull requests #57058

Closed
wants to merge 125 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
125 commits
Select commit Hold shift + click to select a range
5f34316
simplify deprecation and stability rendering
euclio Dec 14, 2018
1bdd6ca
retrieve ty info from place_ty
csmoe Dec 15, 2018
7f9883d
Add unstable VecDeque::rotate_{left|right}
scottmcm Dec 15, 2018
9ca2902
update test
csmoe Dec 15, 2018
c4fa1d2
stop treating trait objects from #[fundamental] traits as fundamental
arielb1 Dec 15, 2018
0815531
Add a note about why the unsafe is sound
scottmcm Dec 16, 2018
bf4a984
Reduce search-index.js size
GuillaumeGomez Dec 16, 2018
fba23d0
Disable field reordering for repr(int).
emilio Dec 16, 2018
d84bdba
Add test to check order of repr(int) enum fields
petertodd Dec 8, 2018
bbce189
rustc: Update Clang used to build LLVM on LInux
alexcrichton Dec 16, 2018
37c3561
describe index with accurate _
csmoe Dec 17, 2018
e38e954
Simplify MIR generation for logical ops
sinkuu Dec 17, 2018
3e7a4ca
Remove a wrong multiplier on relocation offset computation
oli-obk Dec 17, 2018
e7e17f9
static eval: Do not ICE on layout size overflow
dlrobertson Dec 17, 2018
6130fc8
Add --progress to git submodule commands
Dec 17, 2018
e36b628
rename div_euc -> div_euclid, and mod_euc -> rem_euclid
ubsan Dec 18, 2018
82e55c1
deny intra-doc link resolution failures in libstd
euclio Dec 18, 2018
de39aea
fix tests
ubsan Dec 18, 2018
50eb5f6
Explain the math
oli-obk Dec 18, 2018
f731445
Mark tuple structs as live if their constructors are used
oli-obk Dec 18, 2018
fe91892
Update Pin API to match the one proposed for stabilization
cramertj Dec 18, 2018
987a5e4
Stabilize Pin
cramertj Dec 18, 2018
80059df
Pin stabilization: fix doctests
cramertj Dec 18, 2018
9229488
Rename Box/Arc/Rc::pinned to ::pin
cramertj Dec 18, 2018
46a4ff6
Fix Unpin docs link
cramertj Dec 18, 2018
3d8a066
Replace current crate's searchIndex when regenerating
GuillaumeGomez Dec 18, 2018
00bd306
Extend documentation for mem uninit to discuss partial allocation of …
Firstyear Dec 19, 2018
0829d0c
Updates based on comment
Firstyear Dec 19, 2018
3773ae2
FIXME(45827) remove comment since errors are reported
nivkner Dec 17, 2018
cf329d5
FIXME(49821) remove fixme since a tip about let binding is given
nivkner Dec 17, 2018
7092fca
FIXME(44217) remove fixme because the allocator logic was removed, bu…
nivkner Dec 17, 2018
cc568e7
FIXME(49824) remove fixme because there is no free region error anymore
nivkner Dec 17, 2018
e06b81e
FIXME(21232) update fixme to point to the open issue about accepting …
nivkner Dec 17, 2018
aedbe9a
FIXME(31702) remove fixme, move auxiliaries to the right place and fi…
nivkner Dec 17, 2018
b1db8f8
FIXME(45992) remove fixme since the lint is being tested
nivkner Dec 18, 2018
5d7fad3
FIXME(47184) update fixmes to point to issues specific to them
nivkner Dec 18, 2018
8680824
FIXME(2665) remove fixme since the c files are included by the testsuite
nivkner Dec 18, 2018
1aaad19
FIXME(RFC1868) point the fixme to the tracking issue
nivkner Dec 18, 2018
897c182
FIXME(52456) remove fixme and combine all extern items in one block
nivkner Dec 18, 2018
d88d319
FIXME(53451) remove fixme and unnecessary pubs
nivkner Dec 18, 2018
cbe9abb
Add more VecDeque::rotate_{left|right} tests
scottmcm Dec 19, 2018
957a9c7
Revert "FIXME(53451) remove fixme and unnecessary pubs"
nivkner Dec 19, 2018
b2d8040
Fix tidy error
Firstyear Dec 19, 2018
202904b
make basic CTFE tracing available on release builds
RalfJung Dec 19, 2018
885cf2a
Adding unwinding support for x86_64_fortanix_unknown_sgx target.
Dec 14, 2018
81a45e2
miri: allocation is infallible
RalfJung Dec 19, 2018
818ed69
dropck: simplify common patterns
ljedrz Dec 19, 2018
ae3f6b0
dropck: remove unnecessary call to cloned()
ljedrz Dec 19, 2018
7eb67c2
test: Ignore ui/target-feature-gate on powerpc and powerpc64(le)
glaubitz Dec 19, 2018
a153d48
test: Ignore ui/target-feature-gate on sparc and sparc64
glaubitz Dec 19, 2018
036ce5c
Fix compiletest `trim` deprecation warnings
phansch Dec 19, 2018
0e72c80
FIXME(9639) remove fixme and accept non-utf8 paths in compiletest
nivkner Dec 17, 2018
7894717
FIXME(9639) remove fixme and accept non-utf8 paths in librustdoc
nivkner Dec 19, 2018
90726e1
suggest similar lint names for unknown lints
euclio Dec 19, 2018
e7c5146
Remove `TokenStream::JointTree`.
nnethercote Dec 19, 2018
7b6cf6e
Stabilize Vec(Deque)::resize_with
scottmcm Dec 20, 2018
fb18dda
Add DoubleEndedIterator::nth_back
Dec 14, 2018
66bb34c
Update src/libcore/num/mod.rs
dtolnay Dec 20, 2018
455bc95
fix nits
ubsan Dec 20, 2018
405d8b0
Copyrite
oli-obk Dec 20, 2018
0b0a00c
new --static-root-path flag for controlling static file locations
QuietMisdreavus Dec 20, 2018
8dc8d7a
split extra_scripts to handle root_path shenanigans
QuietMisdreavus Dec 20, 2018
8d393bf
display rustc_private APIs as "Internal"
euclio Dec 13, 2018
49f5106
AST/HIR: Introduce `ExprKind::Err` for better error recovery in the f…
petrochenkov Dec 17, 2018
cc2b08d
Do not abort compilation if expansion produces errors
petrochenkov Dec 16, 2018
577427e
Get rid of `Block::recovered`
petrochenkov Dec 19, 2018
a053ae2
Fix `trace_macros` and `log_syntax`
petrochenkov Dec 20, 2018
db24d8e
Enable emission of alignment attrs for pointer params
nikic Dec 20, 2018
29f3d7b
Make sure feature gate errors are recoverable
petrochenkov Dec 20, 2018
4a6aa36
Address review comments and CI failures
petrochenkov Dec 20, 2018
edd08e0
Optimize away a move
Zoxc Dec 6, 2018
86e63ba
Remove QueryResult
Zoxc Dec 7, 2018
f8e508c
Fix a recently introduces regression
oli-obk Dec 17, 2018
b9d74fc
Also test projections
oli-obk Dec 17, 2018
3414be0
fix deprecation warnings in liballoc benches
RalfJung Dec 21, 2018
4f30a24
Inline tweaks
Zoxc Dec 5, 2018
6ed596e
Update tests to changes on master
oli-obk Dec 21, 2018
8c40aed
Fix feature gate to point to 1.32.0 for `path_from_str`
otavio Dec 21, 2018
87c8cdd
Stabilize #[repr(packed(N))]
cramertj Dec 21, 2018
e5e19d9
Remove unstable-book repr-packed entry
cramertj Dec 21, 2018
51e4c1f
Fixed typo in HashMap documentation
RyanMarcus Dec 21, 2018
34dc5c8
macro_literal_matcher was stabilized in 1.32; not 1.32.
Centril Dec 21, 2018
0203a1c
exhaustive_integer_patterns slipped 1.32; stabilized in 1.33.
Centril Dec 21, 2018
097d39d
Fix alignment for array indexing
nikic Dec 21, 2018
80c398b
Rollup merge of #56802 - clarcharr:nth_back, r=alexcrichton
Centril Dec 22, 2018
812576f
Rollup merge of #56824 - euclio:internal-apis, r=QuietMisdreavus
Centril Dec 22, 2018
8f2473e
Rollup merge of #56842 - scottmcm:vecdeque-rotate, r=alexcrichton
Centril Dec 22, 2018
e0fb972
Rollup merge of #56843 - csmoe:non-copy, r=davidtwco
Centril Dec 22, 2018
06b0f46
Rollup merge of #56862 - arielb1:fundamentally-clean, r=nikomatsakis
Centril Dec 22, 2018
0d26ce9
Rollup merge of #56869 - GuillaumeGomez:index-size-reduction, r=Quiet…
Centril Dec 22, 2018
ff6efb6
Rollup merge of #56887 - emilio:enum-field-reordering, r=eddyb
Centril Dec 22, 2018
c2ed5cc
Rollup merge of #56892 - alexcrichton:new-llvm, r=michaelwoerister
Centril Dec 22, 2018
e480450
Rollup merge of #56909 - dlrobertson:fix_56762, r=estebank
Centril Dec 22, 2018
88fbd9f
Rollup merge of #56914 - glaubitz:ignore-tests, r=alexcrichton
Centril Dec 22, 2018
3627261
Rollup merge of #56916 - oli-obk:static_mut_beta_regression, r=davidtwco
Centril Dec 22, 2018
95354fa
Rollup merge of #56917 - sinkuu:mir_build_logicop, r=davidtwco
Centril Dec 22, 2018
a4b32df
Rollup merge of #56919 - oli-obk:null_ref_array_tuple, r=RalfJung
Centril Dec 22, 2018
0f6ea43
Rollup merge of #56933 - clarcharr:xpy_progress, r=Mark-Simulacrum
Centril Dec 22, 2018
c85da26
Rollup merge of #56936 - ubsan:euclidean_div_rem, r=dtolnay
Centril Dec 22, 2018
10228bc
Rollup merge of #56939 - cramertj:pin-stabilization, r=alexcrichton
Centril Dec 22, 2018
ef6ce65
Rollup merge of #56941 - euclio:deny-libstd-resolution-failures, r=Qu…
Centril Dec 22, 2018
4481656
Rollup merge of #56953 - oli-obk:dead_const, r=petrochenkov
Centril Dec 22, 2018
6e267fb
Rollup merge of #56962 - nivkner:fixme_fixup4, r=pnkfelix
Centril Dec 22, 2018
4665a4b
Rollup merge of #56964 - nnethercote:TokenStream-IsJoint, r=petrochenkov
Centril Dec 22, 2018
e457c85
Rollup merge of #56967 - GuillaumeGomez:regen-search-index, r=QuietMi…
Centril Dec 22, 2018
0181d5b
Rollup merge of #56970 - Firstyear:mem_uninit_doc_ptr_drop, r=Manishe…
Centril Dec 22, 2018
8b0bcca
Rollup merge of #56973 - RalfJung:miri-trace, r=oli-obk
Centril Dec 22, 2018
bd12d8f
Rollup merge of #56979 - VardhanThigle:Vardhan/rust-sgx-unwind-suppor…
Centril Dec 22, 2018
132f477
Rollup merge of #56981 - RalfJung:miri-infallible-alloc, r=oli-obk
Centril Dec 22, 2018
f62dabd
Rollup merge of #56984 - ljedrz:dropck_outlives_tweaks, r=oli-obk
Centril Dec 22, 2018
4111c44
Rollup merge of #56989 - phansch:fix_compiletest_trim_deprecations, r…
Centril Dec 22, 2018
cdc8d46
Rollup merge of #56992 - euclio:unknown-lint-suggestion, r=oli-obk
Centril Dec 22, 2018
e36e427
Rollup merge of #56999 - petrochenkov:macrecov2, r=estebank
Centril Dec 22, 2018
edeae30
Rollup merge of #57002 - scottmcm:stabilize-resize_with, r=rkruppe
Centril Dec 22, 2018
06fa9cc
Rollup merge of #57011 - QuietMisdreavus:static-root-path, r=Guillaum…
Centril Dec 22, 2018
9ef6127
Rollup merge of #57021 - nikic:arg-pointer-align, r=nagisa
Centril Dec 22, 2018
f9eddb9
Rollup merge of #57027 - Zoxc:query-perf5, r=michaelwoerister
Centril Dec 22, 2018
d2ffa55
Rollup merge of #57031 - Zoxc:query-perf7, r=michaelwoerister
Centril Dec 22, 2018
7429dad
Rollup merge of #57032 - RalfJung:alloc-bench-deprecations, r=Centril
Centril Dec 22, 2018
bff1363
Rollup merge of #57034 - Zoxc:query-perf8, r=michaelwoerister
Centril Dec 22, 2018
87a0202
Rollup merge of #57040 - otavio:topic/adjust-path_from_str-feature-ga…
Centril Dec 22, 2018
70a3be6
Rollup merge of #57049 - cramertj:repr-packed, r=Centril
Centril Dec 22, 2018
3e7957d
Rollup merge of #57050 - RyanMarcus:master, r=zackmdavis
Centril Dec 22, 2018
0105a24
Rollup merge of #57052 - Centril:fix-eip-stable-version, r=varkor
Centril Dec 22, 2018
aefca41
Rollup merge of #57053 - nikic:fix-gep-align, r=nagisa
Centril Dec 22, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 27 additions & 21 deletions src/librustdoc/clean/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ impl Item {
classes.push("unstable");
}

if !s.deprecated_since.is_empty() {
if s.deprecation.is_some() {
classes.push("deprecated");
}

Expand All @@ -503,6 +503,15 @@ impl Item {
pub fn type_(&self) -> ItemType {
ItemType::from(self)
}

/// Returns the info in the item's `#[deprecated]` or `#[rustc_deprecated]` attributes.
///
/// If the item is not deprecated, returns `None`.
pub fn deprecation(&self) -> Option<&Deprecation> {
self.deprecation
.as_ref()
.or_else(|| self.stability.as_ref().and_then(|s| s.deprecation.as_ref()))
}
}

#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
Expand Down Expand Up @@ -3844,40 +3853,37 @@ impl Clean<Item> for doctree::ProcMacro {
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
pub struct Stability {
pub level: stability::StabilityLevel,
pub feature: String,
pub feature: Option<String>,
pub since: String,
pub deprecated_since: String,
pub deprecated_reason: String,
pub unstable_reason: String,
pub issue: Option<u32>
pub deprecation: Option<Deprecation>,
pub unstable_reason: Option<String>,
pub issue: Option<u32>,
}

#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
pub struct Deprecation {
pub since: String,
pub note: String,
pub since: Option<String>,
pub note: Option<String>,
}

impl Clean<Stability> for attr::Stability {
fn clean(&self, _: &DocContext) -> Stability {
Stability {
level: stability::StabilityLevel::from_attr_level(&self.level),
feature: self.feature.to_string(),
feature: Some(self.feature.to_string()).filter(|f| !f.is_empty()),
since: match self.level {
attr::Stable {ref since} => since.to_string(),
_ => String::new(),
},
deprecated_since: match self.rustc_depr {
Some(attr::RustcDeprecation {ref since, ..}) => since.to_string(),
_=> String::new(),
},
deprecated_reason: match self.rustc_depr {
Some(ref depr) => depr.reason.to_string(),
_ => String::new(),
},
deprecation: self.rustc_depr.as_ref().map(|d| {
Deprecation {
note: Some(d.reason.to_string()).filter(|r| !r.is_empty()),
since: Some(d.since.to_string()).filter(|d| !d.is_empty()),
}
}),
unstable_reason: match self.level {
attr::Unstable { reason: Some(ref reason), .. } => reason.to_string(),
_ => String::new(),
attr::Unstable { reason: Some(ref reason), .. } => Some(reason.to_string()),
_ => None,
},
issue: match self.level {
attr::Unstable {issue, ..} => Some(issue),
Expand All @@ -3896,8 +3902,8 @@ impl<'a> Clean<Stability> for &'a attr::Stability {
impl Clean<Deprecation> for attr::Deprecation {
fn clean(&self, _: &DocContext) -> Deprecation {
Deprecation {
since: self.since.as_ref().map_or(String::new(), |s| s.to_string()),
note: self.note.as_ref().map_or(String::new(), |s| s.to_string()),
since: self.since.map(|s| s.to_string()).filter(|s| !s.is_empty()),
note: self.note.map(|n| n.to_string()).filter(|n| !n.is_empty()),
}
}
}
Expand Down
200 changes: 105 additions & 95 deletions src/librustdoc/html/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ use rustc::hir;
use rustc::util::nodemap::{FxHashMap, FxHashSet};
use rustc_data_structures::flock;

use clean::{self, AttributesExt, GetDefId, SelfTy, Mutability};
use clean::{self, AttributesExt, Deprecation, GetDefId, SelfTy, Mutability};
use config::RenderOptions;
use doctree;
use fold::DocFolder;
Expand Down Expand Up @@ -2458,7 +2458,7 @@ fn document_full(w: &mut fmt::Formatter, item: &clean::Item,

fn document_stability(w: &mut fmt::Formatter, cx: &Context, item: &clean::Item,
is_hidden: bool) -> fmt::Result {
let stabilities = short_stability(item, cx, true);
let stabilities = short_stability(item, cx);
if !stabilities.is_empty() {
write!(w, "<div class='stability{}'>", if is_hidden { " hidden" } else { "" })?;
for stability in stabilities {
Expand Down Expand Up @@ -2651,18 +2651,6 @@ fn item_module(w: &mut fmt::Formatter, cx: &Context,
_ => {
if myitem.name.is_none() { continue }

let stabilities = short_stability(myitem, cx, false);

let stab_docs = if !stabilities.is_empty() {
stabilities.iter()
.map(|s| format!("[{}]", s))
.collect::<Vec<_>>()
.as_slice()
.join(" ")
} else {
String::new()
};

let unsafety_flag = match myitem.inner {
clean::FunctionItem(ref func) | clean::ForeignFunctionItem(ref func)
if func.header.unsafety == hir::Unsafety::Unsafe => {
Expand All @@ -2683,11 +2671,11 @@ fn item_module(w: &mut fmt::Formatter, cx: &Context,
<tr class='{stab}{add}module-item'>\
<td><a class=\"{class}\" href=\"{href}\" \
title='{title}'>{name}</a>{unsafety_flag}</td>\
<td class='docblock-short'>{stab_docs}{docs}\
<td class='docblock-short'>{stab_tags}{docs}\
</td>\
</tr>",
name = *myitem.name.as_ref().unwrap(),
stab_docs = stab_docs,
stab_tags = stability_tags(myitem),
docs = MarkdownSummaryLine(doc_value, &myitem.links()),
class = myitem.type_(),
add = add,
Expand All @@ -2714,101 +2702,123 @@ fn item_module(w: &mut fmt::Formatter, cx: &Context,
Ok(())
}

fn short_stability(item: &clean::Item, cx: &Context, show_reason: bool) -> Vec<String> {
/// Render the stability and deprecation tags that are displayed in the item's summary at the
/// module level.
fn stability_tags(item: &clean::Item) -> String {
let mut tags = String::new();

// The trailing space after each tag is to space it properly against the rest of the docs.
if item.deprecation().is_some() {
tags.push_str("[<div class='stab deprecated'>Deprecated</div>] ");
}

if let Some(stab) = item
.stability
.as_ref()
.filter(|s| s.level == stability::Unstable)
{
if stab.feature.as_ref().map(|s| &**s) == Some("rustc_private") {
tags.push_str("[<div class='stab internal'>Internal</div>] ");
} else {
tags.push_str("[<div class='stab unstable'>Experimental</div>] ");
}
}

if let Some(ref cfg) = item.attrs.cfg {
tags.push_str(&format!(
"[<div class='stab portability'>{}</div>] ",
cfg.render_short_html()
));
}

tags
}

/// Render the stability and/or deprecation warning that is displayed at the top of the item's
/// documentation.
fn short_stability(item: &clean::Item, cx: &Context) -> Vec<String> {
let mut stability = vec![];
let error_codes = ErrorCodes::from(UnstableFeatures::from_environment().is_nightly_build());

if let Some(stab) = item.stability.as_ref() {
let deprecated_reason = if show_reason && !stab.deprecated_reason.is_empty() {
format!(": {}", stab.deprecated_reason)
if let Some(Deprecation { since, note }) = &item.deprecation() {
let mut message = if let Some(since) = since {
if stability::deprecation_in_effect(since) {
format!("Deprecated since {}", Escape(since))
} else {
format!("Deprecating in {}", Escape(since))
}
} else {
String::new()
String::from("Deprecated")
};
if !stab.deprecated_since.is_empty() {
let since = if show_reason {
format!(" since {}", Escape(&stab.deprecated_since))
} else {
String::new()
};

if let Some(note) = note {
let mut ids = cx.id_map.borrow_mut();
let html = MarkdownHtml(&deprecated_reason, RefCell::new(&mut ids), error_codes);
let text = if stability::deprecation_in_effect(&stab.deprecated_since) {
format!("Deprecated{}{}", since, html)
let html = MarkdownHtml(&note, RefCell::new(&mut ids), error_codes);
message.push_str(&format!(": {}", html));
}
stability.push(format!("<div class='stab deprecated'>{}</div>", message));
}

if let Some(stab) = item
.stability
.as_ref()
.filter(|stab| stab.level == stability::Unstable)
{
let is_rustc_private = stab.feature.as_ref().map(|s| &**s) == Some("rustc_private");

let mut message = if is_rustc_private {
"<span class='emoji'>⚙️</span> This is an internal compiler API."
} else {
"<span class='emoji'>🔬</span> This is a nightly-only experimental API."
}
.to_owned();

if let Some(feature) = stab.feature.as_ref() {
let mut feature = format!("<code>{}</code>", Escape(&feature));
if let (Some(url), Some(issue)) = (&cx.shared.issue_tracker_base_url, stab.issue) {
feature.push_str(&format!(
"&nbsp;<a href=\"{url}{issue}\">#{issue}</a>",
url = url,
issue = issue
));
}

message.push_str(&format!(" ({})", feature));
}

if let Some(unstable_reason) = &stab.unstable_reason {
// Provide a more informative message than the compiler help.
let unstable_reason = if is_rustc_private {
"This crate is being loaded from the sysroot, a permanently unstable location \
for private compiler dependencies. It is not intended for general use. Prefer \
using a public version of this crate from \
[crates.io](https://crates.io) via [`Cargo.toml`]\
(https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html)."
} else {
format!("Deprecating in {}{}", Escape(&stab.deprecated_since), html)
unstable_reason
};
stability.push(format!("<div class='stab deprecated'>{}</div>", text))
};

if stab.level == stability::Unstable {
if show_reason {
let unstable_extra = match (!stab.feature.is_empty(),
&cx.shared.issue_tracker_base_url,
stab.issue) {
(true, &Some(ref tracker_url), Some(issue_no)) if issue_no > 0 =>
format!(" (<code>{} </code><a href=\"{}{}\">#{}</a>)",
Escape(&stab.feature), tracker_url, issue_no, issue_no),
(false, &Some(ref tracker_url), Some(issue_no)) if issue_no > 0 =>
format!(" (<a href=\"{}{}\">#{}</a>)", Escape(&tracker_url), issue_no,
issue_no),
(true, ..) =>
format!(" (<code>{}</code>)", Escape(&stab.feature)),
_ => String::new(),
};
if stab.unstable_reason.is_empty() {
stability.push(format!("<div class='stab unstable'>\
<span class=microscope>🔬</span> \
This is a nightly-only experimental API. {}\
</div>",
unstable_extra));
} else {
let mut ids = cx.id_map.borrow_mut();
let text = format!("<summary><span class=microscope>🔬</span> \
This is a nightly-only experimental API. {}\
</summary>{}",
unstable_extra,
MarkdownHtml(
&stab.unstable_reason,
RefCell::new(&mut ids),
error_codes));
stability.push(format!("<div class='stab unstable'><details>{}</details></div>",
text));
}
} else {
stability.push("<div class='stab unstable'>Experimental</div>".to_string())
}
};
} else if let Some(depr) = item.deprecation.as_ref() {
let note = if show_reason && !depr.note.is_empty() {
format!(": {}", depr.note)
} else {
String::new()
};
let since = if show_reason && !depr.since.is_empty() {
format!(" since {}", Escape(&depr.since))
} else {
String::new()
};
let mut ids = cx.id_map.borrow_mut();
message = format!(
"<details><summary>{}</summary>{}</details>",
message,
MarkdownHtml(&unstable_reason, RefCell::new(&mut ids), error_codes)
);
}

let mut ids = cx.id_map.borrow_mut();
let text = if stability::deprecation_in_effect(&depr.since) {
format!("Deprecated{}{}",
since,
MarkdownHtml(&note, RefCell::new(&mut ids), error_codes))
let class = if is_rustc_private {
"internal"
} else {
format!("Deprecating in {}{}",
Escape(&depr.since),
MarkdownHtml(&note, RefCell::new(&mut ids), error_codes))
"unstable"
};
stability.push(format!("<div class='stab deprecated'>{}</div>", text))
stability.push(format!("<div class='stab {}'>{}</div>", class, message));
}

if let Some(ref cfg) = item.attrs.cfg {
stability.push(format!("<div class='stab portability'>{}</div>", if show_reason {
stability.push(format!(
"<div class='stab portability'>{}</div>",
cfg.render_long_html()
} else {
cfg.render_short_html()
}));
));
}

stability
Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/html/static/rustdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,7 @@ body.blur > :not(#help) {
display: list-item;
}

.stab .microscope {
.stab .emoji {
font-size: 1.5em;
}

Expand Down
5 changes: 5 additions & 0 deletions src/librustdoc/html/static/themes/dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,10 @@ a {
color: #D2991D;
}

.stab.internal a {
color: #304FFE;
}

a.test-arrow {
color: #dedede;
}
Expand All @@ -199,6 +203,7 @@ a.test-arrow {
}

.stab.unstable { background: #FFF5D6; border-color: #FFC600; color: #404040; }
.stab.internal { background: #FFB9B3; border-color: #B71C1C; color: #404040; }
.stab.deprecated { background: #F3DFFF; border-color: #7F0087; color: #404040; }
.stab.portability { background: #C4ECFF; border-color: #7BA5DB; color: #404040; }

Expand Down
5 changes: 5 additions & 0 deletions src/librustdoc/html/static/themes/light.css
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,10 @@ a {
color: #3873AD;
}

.stab.internal a {
color: #304FFE;
}

a.test-arrow {
color: #f5f5f5;
}
Expand All @@ -200,6 +204,7 @@ a.test-arrow {
}

.stab.unstable { background: #FFF5D6; border-color: #FFC600; }
.stab.internal { background: #FFB9B3; border-color: #B71C1C; }
.stab.deprecated { background: #F3DFFF; border-color: #7F0087; }
.stab.portability { background: #C4ECFF; border-color: #7BA5DB; }

Expand Down
Loading