Skip to content

Commit

Permalink
Rollup merge of rust-lang#39416 - tspiteri:ffi-unsafe-icon, r=brson
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
GuillaumeGomez authored Feb 2, 2017
2 parents 7bc3222 + fe324ce commit 9559c4d
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/librustdoc/html/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1806,12 +1806,13 @@ fn item_module(w: &mut fmt::Formatter, cx: &Context,
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, "
Expand Down

0 comments on commit 9559c4d

Please sign in to comment.