diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-09-09 09:45:00 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2019-09-09 09:45:00 +0100 |
commit | 734a43e95afc97773c234956a95b78caed88f2a3 (patch) | |
tree | e7fd1ed3cd7cf00f36541c33c84ce4a2ac6559e5 /crates/ra_syntax/src/parsing/text_tree_sink.rs | |
parent | 1db08a54c20c244718e2378272c72ae5c6651f06 (diff) | |
parent | f3cbdb07c56fcfab1d65488836caafc1f395a0d1 (diff) |
Merge #1793
1793: Fix outer doc-comments of `macro_rules` r=matklad a=uHOOCCOOHu
Document comments of `macro_rules!` is currently parsed outside the `MACRO_CALL` node,
which makes `DocCommentsOwner::doc_comments()` always empty.
For the input:
```rust
/// Some docs
macro_rules! foo {
() => {};
}
```
Current parsing tree is:
```
SOURCE_FILE
COMMENT // <- This should be children of MACRO_CALL
WHITESPACE
MACRO_CALL
PATH
<...omitted...>
```
It should be:
```
SOURCE_FILE
MACRO_CALL
COMMENT
WHITESPACE
PATH
<...omitted...>
```
Co-authored-by: uHOOCCOOHu <[email protected]>
Diffstat (limited to 'crates/ra_syntax/src/parsing/text_tree_sink.rs')
-rw-r--r-- | crates/ra_syntax/src/parsing/text_tree_sink.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/crates/ra_syntax/src/parsing/text_tree_sink.rs b/crates/ra_syntax/src/parsing/text_tree_sink.rs index f59c559e9..be6e51780 100644 --- a/crates/ra_syntax/src/parsing/text_tree_sink.rs +++ b/crates/ra_syntax/src/parsing/text_tree_sink.rs | |||
@@ -144,8 +144,8 @@ fn n_attached_trivias<'a>( | |||
144 | trivias: impl Iterator<Item = (SyntaxKind, &'a str)>, | 144 | trivias: impl Iterator<Item = (SyntaxKind, &'a str)>, |
145 | ) -> usize { | 145 | ) -> usize { |
146 | match kind { | 146 | match kind { |
147 | CONST_DEF | TYPE_ALIAS_DEF | STRUCT_DEF | ENUM_DEF | ENUM_VARIANT | FN_DEF | TRAIT_DEF | 147 | MACRO_CALL | CONST_DEF | TYPE_ALIAS_DEF | STRUCT_DEF | ENUM_DEF | ENUM_VARIANT | FN_DEF |
148 | | MODULE | RECORD_FIELD_DEF => { | 148 | | TRAIT_DEF | MODULE | RECORD_FIELD_DEF => { |
149 | let mut res = 0; | 149 | let mut res = 0; |
150 | for (i, (kind, text)) in trivias.enumerate() { | 150 | for (i, (kind, text)) in trivias.enumerate() { |
151 | match kind { | 151 | match kind { |