Skip to content

Commit

Permalink
rustdoc: mark ffi functions with unsafety icon
Browse files Browse the repository at this point in the history
  • Loading branch information
tspiteri committed Jan 30, 2017
1 parent 8921707 commit fe324ce
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 fe324ce

Please sign in to comment.