]> git.lizzy.rs Git - rust.git/commitdiff
auto merge of #13791 : lifthrasiir/rust/mod-inner-span, r=huonw
authorbors <bors@rust-lang.org>
Mon, 28 Apr 2014 12:21:46 +0000 (05:21 -0700)
committerbors <bors@rust-lang.org>
Mon, 28 Apr 2014 12:21:46 +0000 (05:21 -0700)
This PR is primarily motivated by (and fixes) #12926.

We currently only have a span for the individual item itself and not for the referred contents. This normally does not cause a problem since both are located in the same file; it *is* possible that the contained statement or item is located in the other file (the syntax extension can do that), but even in that case the syntax extension should be located in the same file as the item. The module item (i.e. `mod foo;`) is the only exception here, and thus warrants a special treatment.

Rustdoc would now 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'd prefer module contents over module item. There are alternative strategies, but as noted above we will have some corner cases if we don't record the contents span explicitly.

1  2 
src/librustc/front/test.rs
src/librustdoc/clean.rs
src/librustdoc/visit_ast.rs
src/libsyntax/ast.rs
src/libsyntax/ext/build.rs
src/libsyntax/fold.rs
src/libsyntax/parse/parser.rs

Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge