diff --git a/src/rustdoc/gen.rs b/src/rustdoc/gen.rs index 6c42c476b2f..8a7d389865a 100644 --- a/src/rustdoc/gen.rs +++ b/src/rustdoc/gen.rs @@ -63,10 +63,17 @@ fn write_mod( ctxt: ctxt, moddoc: doc::moddoc ) { - write_header(ctxt, h2, #fmt("Module `%s`", moddoc.name)); + let fullpath = str::connect(moddoc.path + [moddoc.name], "::"); + write_header(ctxt, h2, #fmt("Module `%s`", fullpath)); write_mod_contents(ctxt, moddoc); } +#[test] +fn should_write_full_path_to_mod() { + let markdown = test::render("mod a { mod b { mod c { } } }"); + assert str::contains(markdown, "## Module `a::b::c`"); +} + fn write_mod_contents( ctxt: ctxt, doc: doc::moddoc @@ -238,6 +245,7 @@ mod test { fn render(source: str) -> str { let srv = astsrv::mk_srv_from_str(source); let doc = extract::from_srv(srv, ""); + let doc = path_pass::mk_pass()(srv, doc); let doc = attr_pass::mk_pass()(srv, doc); let doc = tystr_pass::mk_pass()(srv, doc); let markdown = write_markdown_str(doc);