Rollup merge of #39416 - tspiteri:ffi-unsafe-icon, r=brson

rustdoc: mark FFI functions with unsafety icon

Currently, in the list of functions, unsafe functions are marked with a superscript ⚠, but unsafe FFI functions are not. This patch treats unsafe FFI functions like other unsafe functions in this regard.
This commit is contained in:
Guillaume Gomez 2017-02-02 22:22:28 +01:00 committed by GitHub
commit 9559c4d823

View File

@ -1806,12 +1806,13 @@ fn cmp(i1: &clean::Item, i2: &clean::Item, idx1: usize, idx2: usize) -> Ordering
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 unsafety_flag = match myitem.inner {
clean::FunctionItem(ref func) | clean::ForeignFunctionItem(ref func)
if func.unsafety == hir::Unsafety::Unsafe => {
"<a title='unsafe function' href='#'><sup>⚠</sup></a>"
}
}
_ => "",
};
let doc_value = myitem.doc_value().unwrap_or("");
write!(w, "