aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_parser/src
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2019-04-23 13:23:40 +0100
committerbors[bot] <bors[bot]@users.noreply.github.com>2019-04-23 13:23:40 +0100
commite2835b46f6928eda21b7edb44f305f20473a3a98 (patch)
treee1cc915077e76d097ddd9bc6739ba7af8c05dd9f /crates/ra_parser/src
parent1705e5887d5c71cad846cb7e840b3c4e03942856 (diff)
parent6c913d8fa700c8ab58cf386dc958707a248f1379 (diff)
Merge #1197
1197: Add `...` parsing for fn pointer type r=matklad a=edwin0cheng This PR should fix #1188 Co-authored-by: Edwin Cheng <[email protected]>
Diffstat (limited to 'crates/ra_parser/src')
-rw-r--r--crates/ra_parser/src/grammar/params.rs4
-rw-r--r--crates/ra_parser/src/grammar/types.rs1
2 files changed, 3 insertions, 2 deletions
diff --git a/crates/ra_parser/src/grammar/params.rs b/crates/ra_parser/src/grammar/params.rs
index d027578b6..3d3bd4cc1 100644
--- a/crates/ra_parser/src/grammar/params.rs
+++ b/crates/ra_parser/src/grammar/params.rs
@@ -43,7 +43,7 @@ fn list_(p: &mut Parser, flavor: Flavor) {
43 if flavor.type_required() { 43 if flavor.type_required() {
44 opt_self_param(p); 44 opt_self_param(p);
45 } 45 }
46 while !p.at(EOF) && !p.at(ket) && !(flavor == Flavor::Normal && p.at(DOTDOTDOT)) { 46 while !p.at(EOF) && !p.at(ket) && !(flavor.type_required() && p.at(DOTDOTDOT)) {
47 if !p.at_ts(VALUE_PARAMETER_FIRST) { 47 if !p.at_ts(VALUE_PARAMETER_FIRST) {
48 p.error("expected value parameter"); 48 p.error("expected value parameter");
49 break; 49 break;
@@ -55,7 +55,7 @@ fn list_(p: &mut Parser, flavor: Flavor) {
55 } 55 }
56 // test param_list_vararg 56 // test param_list_vararg
57 // extern "C" { fn printf(format: *const i8, ...) -> i32; } 57 // extern "C" { fn printf(format: *const i8, ...) -> i32; }
58 if flavor == Flavor::Normal { 58 if flavor.type_required() {
59 p.eat(DOTDOTDOT); 59 p.eat(DOTDOTDOT);
60 } 60 }
61 p.expect(ket); 61 p.expect(ket);
diff --git a/crates/ra_parser/src/grammar/types.rs b/crates/ra_parser/src/grammar/types.rs
index a46da9b44..686c80f3c 100644
--- a/crates/ra_parser/src/grammar/types.rs
+++ b/crates/ra_parser/src/grammar/types.rs
@@ -166,6 +166,7 @@ fn placeholder_type(p: &mut Parser) {
166// type A = fn(); 166// type A = fn();
167// type B = unsafe fn(); 167// type B = unsafe fn();
168// type C = unsafe extern "C" fn(); 168// type C = unsafe extern "C" fn();
169// type D = extern "C" fn ( u8 , ... ) -> u8;
169fn fn_pointer_type(p: &mut Parser) { 170fn fn_pointer_type(p: &mut Parser) {
170 let m = p.start(); 171 let m = p.start();
171 p.eat(UNSAFE_KW); 172 p.eat(UNSAFE_KW);