1
Fork 0

rustdoc: External module item links to the module contents. Fixes #12926.

the basic strategy is to distinguish `mod foo;` from `mod foo {...}`
by checking if the span for the module item and module contents is
in different files. if it's the case, we prefer module contents.

it is technically possible to fix #12926 without changing the AST,
probably by checking the individual items' span. this is not without
a problem though, since it is possible that some items inside
`mod foo {...}` may have originated from other file (e.g. `include!`).
therefore it is better to record both spans explicitly.
This commit is contained in:
Kang Seonghoon 2014-04-27 05:08:36 +09:00
parent dee21a67b8
commit c8a29c4c59
3 changed files with 24 additions and 4 deletions

View file

@ -19,7 +19,8 @@ use syntax::ast::{Ident, NodeId};
pub struct Module {
pub name: Option<Ident>,
pub attrs: Vec<ast::Attribute>,
pub where: Span,
pub where_outer: Span,
pub where_inner: Span,
pub structs: Vec<Struct>,
pub enums: Vec<Enum>,
pub fns: Vec<Function>,
@ -42,7 +43,8 @@ impl Module {
name : name,
id: 0,
vis: ast::Inherited,
where: syntax::codemap::DUMMY_SP,
where_outer: syntax::codemap::DUMMY_SP,
where_inner: syntax::codemap::DUMMY_SP,
attrs : Vec::new(),
structs : Vec::new(),
enums : Vec::new(),