Rollup merge of #81225 - CraftSpider:json-opt-docs, r=jyn514
Make 'docs' nullable in rustdoc-json output Matches the backing better, and makes it so there's a difference between 'empty docs' and 'no docs'.
This commit is contained in:
commit
1cc13b4f5a
@ -27,7 +27,7 @@ impl JsonRenderer<'_> {
|
||||
name: name.map(|sym| sym.to_string()),
|
||||
source: self.convert_span(source),
|
||||
visibility: self.convert_visibility(visibility),
|
||||
docs: attrs.collapsed_doc_value().unwrap_or_default(),
|
||||
docs: attrs.collapsed_doc_value(),
|
||||
links: attrs
|
||||
.links
|
||||
.into_iter()
|
||||
|
@ -241,7 +241,7 @@ impl<'tcx> FormatRenderer<'tcx> for JsonRenderer<'tcx> {
|
||||
)
|
||||
})
|
||||
.collect(),
|
||||
format_version: 1,
|
||||
format_version: 2,
|
||||
};
|
||||
let mut p = self.out_path.clone();
|
||||
p.push(output.index.get(&output.root).unwrap().name.clone().unwrap());
|
||||
|
@ -68,8 +68,9 @@ pub struct Item {
|
||||
/// By default all documented items are public, but you can tell rustdoc to output private items
|
||||
/// so this field is needed to differentiate.
|
||||
pub visibility: Visibility,
|
||||
/// The full markdown docstring of this item.
|
||||
pub docs: String,
|
||||
/// The full markdown docstring of this item. Absent if there is no documentation at all,
|
||||
/// Some("") if there is some documentation but it is empty (EG `#[doc = ""]`).
|
||||
pub docs: Option<String>,
|
||||
/// This mapping resolves [intra-doc links](https://github.com/rust-lang/rfcs/blob/master/text/1946-intra-rustdoc-links.md) from the docstring to their IDs
|
||||
pub links: FxHashMap<String, Id>,
|
||||
/// Stringified versions of the attributes on this item (e.g. `"#[inline]"`)
|
||||
|
Loading…
x
Reference in New Issue
Block a user