diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index 53869e042a81..dceb052e7960 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -1494,16 +1494,16 @@ impl<'a> fmt::Display for Item<'a> { item_module(fmt, self.cx, self.item, &m.items) } clean::FunctionItem(ref f) | clean::ForeignFunctionItem(ref f) => - item_function(fmt, self.item, f), + item_function(fmt, self.cx, self.item, f), clean::TraitItem(ref t) => item_trait(fmt, self.cx, self.item, t), - clean::StructItem(ref s) => item_struct(fmt, self.item, s), - clean::EnumItem(ref e) => item_enum(fmt, self.item, e), - clean::TypedefItem(ref t, _) => item_typedef(fmt, self.item, t), - clean::MacroItem(ref m) => item_macro(fmt, self.item, m), - clean::PrimitiveItem(ref p) => item_primitive(fmt, self.item, p), + clean::StructItem(ref s) => item_struct(fmt, self.cx, self.item, s), + clean::EnumItem(ref e) => item_enum(fmt, self.cx, self.item, e), + clean::TypedefItem(ref t, _) => item_typedef(fmt, self.cx, self.item, t), + clean::MacroItem(ref m) => item_macro(fmt, self.cx, self.item, m), + clean::PrimitiveItem(ref p) => item_primitive(fmt, self.cx, self.item, p), clean::StaticItem(ref i) | clean::ForeignStaticItem(ref i) => - item_static(fmt, self.item, i), - clean::ConstantItem(ref c) => item_constant(fmt, self.item, c), + item_static(fmt, self.cx, self.item, i), + clean::ConstantItem(ref c) => item_constant(fmt, self.cx, self.item, c), _ => Ok(()) } } @@ -1546,8 +1546,8 @@ fn plain_summary_line(s: Option<&str>) -> String { markdown::plain_summary_line(&line[..]) } -fn document(w: &mut fmt::Formatter, item: &clean::Item) -> fmt::Result { - if let Some(s) = short_stability(item, true) { +fn document(w: &mut fmt::Formatter, cx: &Context, item: &clean::Item) -> fmt::Result { + if let Some(s) = short_stability(item, cx, true) { try!(write!(w, "
{vis}const \
{name}: {typ}{init}",
@@ -1737,10 +1737,10 @@ fn item_constant(w: &mut fmt::Formatter, it: &clean::Item,
name = it.name.as_ref().unwrap(),
typ = c.type_,
init = Initializer(&c.expr)));
- document(w, it)
+ document(w, cx, it)
}
-fn item_static(w: &mut fmt::Formatter, it: &clean::Item,
+fn item_static(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
s: &clean::Static) -> fmt::Result {
try!(write!(w, "{vis}static {mutability}\
{name}: {typ}{init}",
@@ -1749,10 +1749,10 @@ fn item_static(w: &mut fmt::Formatter, it: &clean::Item,
name = it.name.as_ref().unwrap(),
typ = s.type_,
init = Initializer(&s.expr)));
- document(w, it)
+ document(w, cx, it)
}
-fn item_function(w: &mut fmt::Formatter, it: &clean::Item,
+fn item_function(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
f: &clean::Function) -> fmt::Result {
try!(write!(w, "{vis}{unsafety}{abi}{constness}fn \
{name}{generics}{decl}{where_clause}",
@@ -1764,7 +1764,7 @@ fn item_function(w: &mut fmt::Formatter, it: &clean::Item,
generics = f.generics,
where_clause = WhereClause(&f.generics),
decl = f.decl));
- document(w, it)
+ document(w, cx, it)
}
fn item_trait(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
@@ -1841,9 +1841,9 @@ fn item_trait(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
try!(write!(w, ""));
// Trait documentation
- try!(document(w, it));
+ try!(document(w, cx, it));
- fn trait_item(w: &mut fmt::Formatter, m: &clean::Item)
+ fn trait_item(w: &mut fmt::Formatter, cx: &Context, m: &clean::Item)
-> fmt::Result {
try!(write!(w, "",
ty = shortty(m),
@@ -1851,7 +1851,7 @@ fn item_trait(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
stab = m.stability_class()));
try!(render_assoc_item(w, m, AssocItemLink::Anchor));
try!(write!(w, ""));
try!(render_attributes(w, it));
@@ -2025,7 +2025,7 @@ fn item_struct(w: &mut fmt::Formatter, it: &clean::Item,
true));
try!(write!(w, ""));
- try!(document(w, it));
+ try!(document(w, cx, it));
let mut fields = s.fields.iter().filter(|f| {
match f.inner {
clean::StructFieldItem(clean::HiddenStructField) => false,
@@ -2042,16 +2042,16 @@ fn item_struct(w: &mut fmt::Formatter, it: &clean::Item,
{name}"));
try!(render_attributes(w, it));
@@ -2104,13 +2104,13 @@ fn item_enum(w: &mut fmt::Formatter, it: &clean::Item,
}
try!(write!(w, ""));
- try!(document(w, it));
+ try!(document(w, cx, it));
if !e.variants.is_empty() {
try!(write!(w, "{name} | ",
name = variant.name.as_ref().unwrap()));
- try!(document(w, variant));
+ try!(document(w, cx, variant));
match variant.inner {
clean::VariantItem(ref var) => {
match var.kind {
@@ -2132,7 +2132,7 @@ fn item_enum(w: &mut fmt::Formatter, it: &clean::Item,
{f} | ", v = variant.name.as_ref().unwrap(), f = field.name.as_ref().unwrap())); - try!(document(w, field)); + try!(document(w, cx, field)); try!(write!(w, " |
{}type {}{}{where_clause} = {type_};",
it.name.as_ref().unwrap(),
@@ -2449,7 +2451,7 @@ fn item_typedef(w: &mut fmt::Formatter, it: &clean::Item,
where_clause = WhereClause(&t.generics),
type_ = t.type_));
- document(w, it)
+ document(w, cx, it)
}
impl<'a> fmt::Display for Sidebar<'a> {
@@ -2520,19 +2522,19 @@ impl<'a> fmt::Display for Source<'a> {
}
}
-fn item_macro(w: &mut fmt::Formatter, it: &clean::Item,
+fn item_macro(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
t: &clean::Macro) -> fmt::Result {
try!(w.write_str(&highlight::highlight(&t.source,
Some("macro"),
None)));
- document(w, it)
+ document(w, cx, it)
}
-fn item_primitive(w: &mut fmt::Formatter,
+fn item_primitive(w: &mut fmt::Formatter, cx: &Context,
it: &clean::Item,
_p: &clean::PrimitiveType) -> fmt::Result {
- try!(document(w, it));
- render_assoc_items(w, it.def_id, AssocItemRender::All)
+ try!(document(w, cx, it));
+ render_assoc_items(w, cx, it.def_id, AssocItemRender::All)
}
fn get_basic_keywords() -> &'static str {