aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_parser
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-06-04 18:51:03 +0100
committerGitHub <[email protected]>2020-06-04 18:51:03 +0100
commite66c7b3a453e7b7385f103ae7f1f3f7438bdb31b (patch)
tree4a71b164a5b2e97cf219d7cfcd926b9119b6f646 /crates/ra_parser
parentc19496f845a4adcd7e0f48f5dcb5b405bbc63dfc (diff)
parentc4fd46398132a409d7947141094d7301c0f0af73 (diff)
Merge #4737
4737: Parse default unsafe & default const r=matklad a=Avi-D-coder Closes: #4718 #4264 Co-authored-by: Avi Dessauer <[email protected]>
Diffstat (limited to 'crates/ra_parser')
-rw-r--r--crates/ra_parser/src/grammar/items.rs15
1 files changed, 14 insertions, 1 deletions
diff --git a/crates/ra_parser/src/grammar/items.rs b/crates/ra_parser/src/grammar/items.rs
index 67a924de5..9c14b954a 100644
--- a/crates/ra_parser/src/grammar/items.rs
+++ b/crates/ra_parser/src/grammar/items.rs
@@ -118,7 +118,17 @@ pub(super) fn maybe_item(p: &mut Parser, m: Marker, flavor: ItemFlavor) -> Resul
118 && p.at_contextual_kw("default") 118 && p.at_contextual_kw("default")
119 && (match p.nth(1) { 119 && (match p.nth(1) {
120 T![impl] => true, 120 T![impl] => true,
121 T![fn] | T![type] => { 121 T![unsafe] => {
122 // test default_unsafe_impl
123 // default unsafe impl Foo {}
124 if p.nth(2) == T![impl] {
125 p.bump_remap(T![default]);
126 p.bump(T![unsafe]);
127 has_mods = true;
128 }
129 false
130 }
131 T![fn] | T![type] | T![const] => {
122 if let ItemFlavor::Mod = flavor { 132 if let ItemFlavor::Mod = flavor {
123 true 133 true
124 } else { 134 } else {
@@ -198,6 +208,9 @@ pub(super) fn maybe_item(p: &mut Parser, m: Marker, flavor: ItemFlavor) -> Resul
198 // default type T = Bar; 208 // default type T = Bar;
199 // default fn foo() {} 209 // default fn foo() {}
200 // } 210 // }
211 T![const] => {
212 consts::const_def(p, m);
213 }
201 214
202 // test unsafe_default_impl 215 // test unsafe_default_impl
203 // unsafe default impl Foo {} 216 // unsafe default impl Foo {}