Rollup merge of #37250 - liigo:rustdoc-unsafe-fns, r=steveklabnik
rustdoc: mark unsafe fns in module page with superscript icons Note: I'v changed the mark style. Now use superscript ⚠(U+26A0) (the old one is '[Unsafe]' literal). Basically per https://botbot.me/mozilla/rust-docs/2016-10-19/?msg=75112017&page=1 ![unsafe-fn-icon](https://cloud.githubusercontent.com/assets/346530/19633650/7f6e1eea-99e6-11e6-8d09-31aec83e46a5.png) ![unsafe-fn](https://cloud.githubusercontent.com/assets/346530/19472050/39daded2-9558-11e6-9148-3cb12afd1c9a.png)
This commit is contained in:
commit
6c7b43375a
@ -1828,11 +1828,19 @@ fn cmp(i1: &clean::Item, i2: &clean::Item, idx1: usize, idx2: usize) -> Ordering
|
||||
} else {
|
||||
String::new()
|
||||
};
|
||||
|
||||
let mut unsafety_flag = "";
|
||||
if let clean::FunctionItem(ref func) = myitem.inner {
|
||||
if func.unsafety == hir::Unsafety::Unsafe {
|
||||
unsafety_flag = "<a title='unsafe function' href='#'><sup>⚠</sup></a>";
|
||||
}
|
||||
}
|
||||
|
||||
let doc_value = myitem.doc_value().unwrap_or("");
|
||||
write!(w, "
|
||||
<tr class='{stab} module-item'>
|
||||
<td><a class='{class}' href='{href}'
|
||||
title='{title}'>{name}</a></td>
|
||||
title='{title}'>{name}</a>{unsafety_flag}</td>
|
||||
<td class='docblock-short'>
|
||||
{stab_docs} {docs}
|
||||
</td>
|
||||
@ -1842,6 +1850,7 @@ fn cmp(i1: &clean::Item, i2: &clean::Item, idx1: usize, idx2: usize) -> Ordering
|
||||
docs = shorter(Some(&Markdown(doc_value).to_string())),
|
||||
class = myitem.type_(),
|
||||
stab = myitem.stability_class(),
|
||||
unsafety_flag = unsafety_flag,
|
||||
href = item_path(myitem.type_(), myitem.name.as_ref().unwrap()),
|
||||
title = full_path(cx, myitem))?;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user