diff options
| author | bors <bors@rust-lang.org> | 2014-04-28 05:21:46 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-04-28 05:21:46 -0700 |
| commit | a1ad41b93d133aa4f3bda71475f8e41d9dfe704d (patch) | |
| tree | a8cdfdaf2359e39d80de4045ca7f1143f7767b43 /src/libsyntax/fold.rs | |
| parent | 7a19a82d119ca51ed872ed207bed396cdf4a3283 (diff) | |
| parent | c8a29c4c595e76b71372a2e40d359ac1ddd8aec8 (diff) | |
| download | rust-a1ad41b93d133aa4f3bda71475f8e41d9dfe704d.tar.gz rust-a1ad41b93d133aa4f3bda71475f8e41d9dfe704d.zip | |
auto merge of #13791 : lifthrasiir/rust/mod-inner-span, r=huonw
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.
Diffstat (limited to 'src/libsyntax/fold.rs')
| -rw-r--r-- | src/libsyntax/fold.rs | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/libsyntax/fold.rs b/src/libsyntax/fold.rs index a4219d152a9..47ef23b82d2 100644 --- a/src/libsyntax/fold.rs +++ b/src/libsyntax/fold.rs @@ -652,6 +652,7 @@ pub fn noop_fold_type_method<T: Folder>(m: &TypeMethod, fld: &mut T) -> TypeMeth pub fn noop_fold_mod<T: Folder>(m: &Mod, folder: &mut T) -> Mod { ast::Mod { + inner: folder.new_span(m.inner), view_items: m.view_items .iter() .map(|x| folder.fold_view_item(x)).collect(), |
