rustdoc: Remove a pointer that's no longer needed
This commit is contained in:
parent
fdea1c414c
commit
681e5beac4
9 changed files with 24 additions and 25 deletions
|
@ -31,8 +31,7 @@ type itemdoc = {
|
||||||
|
|
||||||
type moddoc = {
|
type moddoc = {
|
||||||
item: itemdoc,
|
item: itemdoc,
|
||||||
// This box exists to break the structural recursion
|
items: [itemtag]
|
||||||
items: ~[itemtag]
|
|
||||||
};
|
};
|
||||||
|
|
||||||
type nmoddoc = {
|
type nmoddoc = {
|
||||||
|
@ -112,7 +111,7 @@ type tydoc = {
|
||||||
impl util for moddoc {
|
impl util for moddoc {
|
||||||
|
|
||||||
fn mods() -> [moddoc] {
|
fn mods() -> [moddoc] {
|
||||||
vec::filter_map(*self.items) {|itemtag|
|
vec::filter_map(self.items) {|itemtag|
|
||||||
alt itemtag {
|
alt itemtag {
|
||||||
modtag(moddoc) { some(moddoc) }
|
modtag(moddoc) { some(moddoc) }
|
||||||
_ { none }
|
_ { none }
|
||||||
|
@ -121,7 +120,7 @@ impl util for moddoc {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn nmods() -> [nmoddoc] {
|
fn nmods() -> [nmoddoc] {
|
||||||
vec::filter_map(*self.items) {|itemtag|
|
vec::filter_map(self.items) {|itemtag|
|
||||||
alt itemtag {
|
alt itemtag {
|
||||||
nmodtag(nmoddoc) { some(nmoddoc) }
|
nmodtag(nmoddoc) { some(nmoddoc) }
|
||||||
_ { none }
|
_ { none }
|
||||||
|
@ -130,7 +129,7 @@ impl util for moddoc {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn fns() -> [fndoc] {
|
fn fns() -> [fndoc] {
|
||||||
vec::filter_map(*self.items) {|itemtag|
|
vec::filter_map(self.items) {|itemtag|
|
||||||
alt itemtag {
|
alt itemtag {
|
||||||
fntag(fndoc) { some(fndoc) }
|
fntag(fndoc) { some(fndoc) }
|
||||||
_ { none }
|
_ { none }
|
||||||
|
@ -139,7 +138,7 @@ impl util for moddoc {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn consts() -> [constdoc] {
|
fn consts() -> [constdoc] {
|
||||||
vec::filter_map(*self.items) {|itemtag|
|
vec::filter_map(self.items) {|itemtag|
|
||||||
alt itemtag {
|
alt itemtag {
|
||||||
consttag(constdoc) { some(constdoc) }
|
consttag(constdoc) { some(constdoc) }
|
||||||
_ { none }
|
_ { none }
|
||||||
|
@ -148,7 +147,7 @@ impl util for moddoc {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn enums() -> [enumdoc] {
|
fn enums() -> [enumdoc] {
|
||||||
vec::filter_map(*self.items) {|itemtag|
|
vec::filter_map(self.items) {|itemtag|
|
||||||
alt itemtag {
|
alt itemtag {
|
||||||
enumtag(enumdoc) { some(enumdoc) }
|
enumtag(enumdoc) { some(enumdoc) }
|
||||||
_ { none }
|
_ { none }
|
||||||
|
@ -157,7 +156,7 @@ impl util for moddoc {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn resources() -> [resdoc] {
|
fn resources() -> [resdoc] {
|
||||||
vec::filter_map(*self.items) {|itemtag|
|
vec::filter_map(self.items) {|itemtag|
|
||||||
alt itemtag {
|
alt itemtag {
|
||||||
restag(resdoc) { some(resdoc) }
|
restag(resdoc) { some(resdoc) }
|
||||||
_ { none }
|
_ { none }
|
||||||
|
@ -166,7 +165,7 @@ impl util for moddoc {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn ifaces() -> [ifacedoc] {
|
fn ifaces() -> [ifacedoc] {
|
||||||
vec::filter_map(*self.items) {|itemtag|
|
vec::filter_map(self.items) {|itemtag|
|
||||||
alt itemtag {
|
alt itemtag {
|
||||||
ifacetag(ifacedoc) { some(ifacedoc) }
|
ifacetag(ifacedoc) { some(ifacedoc) }
|
||||||
_ { none }
|
_ { none }
|
||||||
|
@ -175,7 +174,7 @@ impl util for moddoc {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn impls() -> [impldoc] {
|
fn impls() -> [impldoc] {
|
||||||
vec::filter_map(*self.items) {|itemtag|
|
vec::filter_map(self.items) {|itemtag|
|
||||||
alt itemtag {
|
alt itemtag {
|
||||||
impltag(impldoc) { some(impldoc) }
|
impltag(impldoc) { some(impldoc) }
|
||||||
_ { none }
|
_ { none }
|
||||||
|
@ -184,7 +183,7 @@ impl util for moddoc {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn types() -> [tydoc] {
|
fn types() -> [tydoc] {
|
||||||
vec::filter_map(*self.items) {|itemtag|
|
vec::filter_map(self.items) {|itemtag|
|
||||||
alt itemtag {
|
alt itemtag {
|
||||||
tytag(tydoc) { some(tydoc) }
|
tytag(tydoc) { some(tydoc) }
|
||||||
_ { none }
|
_ { none }
|
||||||
|
|
|
@ -49,7 +49,7 @@ fn moddoc_from_mod(
|
||||||
) -> doc::moddoc {
|
) -> doc::moddoc {
|
||||||
{
|
{
|
||||||
item: itemdoc,
|
item: itemdoc,
|
||||||
items: ~vec::filter_map(module.items) {|item|
|
items: vec::filter_map(module.items) {|item|
|
||||||
let itemdoc = mk_itemdoc(item.id, item.ident);
|
let itemdoc = mk_itemdoc(item.id, item.ident);
|
||||||
alt item.node {
|
alt item.node {
|
||||||
ast::item_mod(m) {
|
ast::item_mod(m) {
|
||||||
|
|
|
@ -141,7 +141,7 @@ fn default_seq_fold_mod<T>(
|
||||||
) -> doc::moddoc {
|
) -> doc::moddoc {
|
||||||
{
|
{
|
||||||
item: fold.fold_item(fold, doc.item),
|
item: fold.fold_item(fold, doc.item),
|
||||||
items: ~vec::map(*doc.items) {|itemtag|
|
items: vec::map(doc.items) {|itemtag|
|
||||||
fold_itemtag(fold, itemtag)
|
fold_itemtag(fold, itemtag)
|
||||||
}
|
}
|
||||||
with doc
|
with doc
|
||||||
|
@ -167,7 +167,7 @@ fn default_par_fold_mod<T:send>(
|
||||||
) -> doc::moddoc {
|
) -> doc::moddoc {
|
||||||
{
|
{
|
||||||
item: fold.fold_item(fold, doc.item),
|
item: fold.fold_item(fold, doc.item),
|
||||||
items: ~util::parmap(*doc.items) {|itemtag|
|
items: util::parmap(doc.items) {|itemtag|
|
||||||
fold_itemtag(fold, itemtag)
|
fold_itemtag(fold, itemtag)
|
||||||
}
|
}
|
||||||
with doc
|
with doc
|
||||||
|
|
|
@ -130,7 +130,7 @@ fn write_mod_contents(
|
||||||
write_brief(ctxt, doc.brief());
|
write_brief(ctxt, doc.brief());
|
||||||
write_desc(ctxt, doc.desc());
|
write_desc(ctxt, doc.desc());
|
||||||
|
|
||||||
for itemtag in *doc.items {
|
for itemtag in doc.items {
|
||||||
alt itemtag {
|
alt itemtag {
|
||||||
doc::modtag(moddoc) { write_mod(ctxt, moddoc) }
|
doc::modtag(moddoc) { write_mod(ctxt, moddoc) }
|
||||||
doc::nmodtag(_) { fail }
|
doc::nmodtag(_) { fail }
|
||||||
|
@ -229,7 +229,7 @@ fn should_correctly_indent_fn_signature() {
|
||||||
let doc = test::create_doc("fn a() { }");
|
let doc = test::create_doc("fn a() { }");
|
||||||
let doc = {
|
let doc = {
|
||||||
topmod: {
|
topmod: {
|
||||||
items: ~[doc::fntag({
|
items: [doc::fntag({
|
||||||
sig: some("line 1\nline 2")
|
sig: some("line 1\nline 2")
|
||||||
with doc.topmod.fns()[0]
|
with doc.topmod.fns()[0]
|
||||||
})]
|
})]
|
||||||
|
|
|
@ -36,7 +36,7 @@ fn fold_mod(
|
||||||
doc: doc::moddoc
|
doc: doc::moddoc
|
||||||
) -> doc::moddoc {
|
) -> doc::moddoc {
|
||||||
let doc = {
|
let doc = {
|
||||||
items: ~vec::filter_map(*doc.items) {|itemtag|
|
items: vec::filter_map(doc.items) {|itemtag|
|
||||||
alt itemtag {
|
alt itemtag {
|
||||||
doc::modtag(moddoc) {
|
doc::modtag(moddoc) {
|
||||||
let doc = fold.fold_mod(fold, moddoc);
|
let doc = fold.fold_mod(fold, moddoc);
|
||||||
|
@ -110,7 +110,7 @@ fn fold_mod(
|
||||||
fold.ctxt.have_docs =
|
fold.ctxt.have_docs =
|
||||||
doc.brief() != none
|
doc.brief() != none
|
||||||
|| doc.desc() != none
|
|| doc.desc() != none
|
||||||
|| vec::is_not_empty(*doc.items);
|
|| vec::is_not_empty(doc.items);
|
||||||
ret doc;
|
ret doc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ fn run(srv: astsrv::srv, doc: doc::cratedoc) -> doc::cratedoc {
|
||||||
fn fold_mod(fold: fold::fold<astsrv::srv>, doc: doc::moddoc) -> doc::moddoc {
|
fn fold_mod(fold: fold::fold<astsrv::srv>, doc: doc::moddoc) -> doc::moddoc {
|
||||||
let doc = fold::default_any_fold_mod(fold, doc);
|
let doc = fold::default_any_fold_mod(fold, doc);
|
||||||
{
|
{
|
||||||
items: ~exported_items(fold.ctxt, doc)
|
items: exported_items(fold.ctxt, doc)
|
||||||
with doc
|
with doc
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,7 @@ fn exported_items_from(
|
||||||
doc: doc::moddoc,
|
doc: doc::moddoc,
|
||||||
is_exported: fn(astsrv::srv, str) -> bool
|
is_exported: fn(astsrv::srv, str) -> bool
|
||||||
) -> [doc::itemtag] {
|
) -> [doc::itemtag] {
|
||||||
vec::filter_map(*doc.items) { |itemtag|
|
vec::filter_map(doc.items) { |itemtag|
|
||||||
let itemtag = alt itemtag {
|
let itemtag = alt itemtag {
|
||||||
doc::enumtag(enumdoc) {
|
doc::enumtag(enumdoc) {
|
||||||
// Also need to check variant exportedness
|
// Also need to check variant exportedness
|
||||||
|
|
|
@ -115,7 +115,7 @@ fn build_reexport_def_map(
|
||||||
fn fold_mod(fold: fold::fold<ctxt>, doc: doc::moddoc) -> doc::moddoc {
|
fn fold_mod(fold: fold::fold<ctxt>, doc: doc::moddoc) -> doc::moddoc {
|
||||||
let doc = fold::default_seq_fold_mod(fold, doc);
|
let doc = fold::default_seq_fold_mod(fold, doc);
|
||||||
|
|
||||||
for item in *doc.items {
|
for item in doc.items {
|
||||||
let def_id = ast_util::local_def(item.id());
|
let def_id = ast_util::local_def(item.id());
|
||||||
if fold.ctxt.def_set.contains_key(def_id) {
|
if fold.ctxt.def_set.contains_key(def_id) {
|
||||||
fold.ctxt.def_map.insert(def_id, item);
|
fold.ctxt.def_map.insert(def_id, item);
|
||||||
|
@ -201,7 +201,7 @@ fn merge_reexports(
|
||||||
#debug("merging into %?: %?", path, new_items);
|
#debug("merging into %?: %?", path, new_items);
|
||||||
|
|
||||||
{
|
{
|
||||||
items: ~(*doc.items + new_items)
|
items: (doc.items + new_items)
|
||||||
with doc
|
with doc
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@ fn test_run_passes() {
|
||||||
name: doc.topmod.name() + "two"
|
name: doc.topmod.name() + "two"
|
||||||
with doc.topmod.item
|
with doc.topmod.item
|
||||||
},
|
},
|
||||||
items: ~[]
|
items: []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,7 @@ fn test_run_passes() {
|
||||||
name: doc.topmod.name() + "three"
|
name: doc.topmod.name() + "three"
|
||||||
with doc.topmod.item
|
with doc.topmod.item
|
||||||
},
|
},
|
||||||
items: ~[]
|
items: []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ fn fold_mod(
|
||||||
) -> doc::moddoc {
|
) -> doc::moddoc {
|
||||||
let doc = fold::default_any_fold_mod(fold, doc);
|
let doc = fold::default_any_fold_mod(fold, doc);
|
||||||
{
|
{
|
||||||
items: ~sort::merge_sort(fold.ctxt, *doc.items)
|
items: sort::merge_sort(fold.ctxt, doc.items)
|
||||||
with doc
|
with doc
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue