diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-01-31 07:06:31 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-01-31 07:06:31 +0000 |
commit | 97ade899937dafcafa852177c85edb22ce0b80dc (patch) | |
tree | cf5f8bdc5647222c8300c3386c5c8d47283d5116 /crates/ra_syntax/src/grammar/items | |
parent | 777c79ce6bff0e70c8367f429f058f6d87ff3864 (diff) | |
parent | 00e6b5d26c82d5faff066c24418a0eb5741efcd1 (diff) |
Merge #692
692: [WIP] Correctly parse attributes r=matklad a=DJMcNab
Reference - https://doc.rust-lang.org/reference/attributes.html
This fixes/investigates inner attributes for:
- [x] `impl` blocks
- [x] `extern` blocks
- [x] `fn`s (fixes #689)
- [x] `mod`s (already supported)
- [x] 'block expressions' (the long text just describes all 'blocks' used as statements)
This also investigates/fixes outer attributes for:
- [ ] 'most statements' (see also: #685, https://doc.rust-lang.org/reference/expressions.html#expression-attributes)
- [x] Enum variants, Struct and Union fields (Fixed in #507)
- [ ] 'Match expression arms' (@matklad can you provide a test case which explains what this means?)
- [ ] 'Generic lifetime or type parameters'
- [ ] 'Elements of array expressions, tuple expressions, call expressions, tuple-style struct and enum variant expressions'
- [ ] 'The tail expression of block expressions'
Co-authored-by: DJMcNab <[email protected]>
Diffstat (limited to 'crates/ra_syntax/src/grammar/items')
-rw-r--r-- | crates/ra_syntax/src/grammar/items/traits.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/crates/ra_syntax/src/grammar/items/traits.rs b/crates/ra_syntax/src/grammar/items/traits.rs index 0a0621753..d5a8ccd98 100644 --- a/crates/ra_syntax/src/grammar/items/traits.rs +++ b/crates/ra_syntax/src/grammar/items/traits.rs | |||
@@ -78,6 +78,13 @@ pub(crate) fn impl_item_list(p: &mut Parser) { | |||
78 | assert!(p.at(L_CURLY)); | 78 | assert!(p.at(L_CURLY)); |
79 | let m = p.start(); | 79 | let m = p.start(); |
80 | p.bump(); | 80 | p.bump(); |
81 | // test impl_inner_attributes | ||
82 | // enum F{} | ||
83 | // impl F { | ||
84 | // //! This is a doc comment | ||
85 | // #![doc("This is also a doc comment")] | ||
86 | // } | ||
87 | attributes::inner_attributes(p); | ||
81 | 88 | ||
82 | while !p.at(EOF) && !p.at(R_CURLY) { | 89 | while !p.at(EOF) && !p.at(R_CURLY) { |
83 | if p.at(L_CURLY) { | 90 | if p.at(L_CURLY) { |