aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_parser
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-02-07 13:21:02 +0000
committerGitHub <[email protected]>2020-02-07 13:21:02 +0000
commit8337dcd9e277feac8e9cff621c752a3e86ba19e6 (patch)
treef9658afc43f76b864a7a6e49b6349d12283632c8 /crates/ra_parser
parent6d6a995e09c74a8b1075842fb3cd7232354389ae (diff)
parent73ec2ab184f6d8828ebcdca418a7ae83bb60b0bc (diff)
Merge #3047
3047: Update async unsafe fn ordering in parser r=matklad a=kiljacken As of rust-lang/rust#61319 the correct order for functions that are both unsafe and async is: `async unsafe fn` and not `unsafe async fn`. This commit updates the parser tests to reflect this, and corrects parsing behavior to accept the correct ordering. Fixes #3025 Co-authored-by: Emil Lauridsen <[email protected]>
Diffstat (limited to 'crates/ra_parser')
-rw-r--r--crates/ra_parser/src/grammar/items.rs18
1 files changed, 9 insertions, 9 deletions
diff --git a/crates/ra_parser/src/grammar/items.rs b/crates/ra_parser/src/grammar/items.rs
index 7263c4d69..54284c933 100644
--- a/crates/ra_parser/src/grammar/items.rs
+++ b/crates/ra_parser/src/grammar/items.rs
@@ -91,13 +91,6 @@ pub(super) fn maybe_item(p: &mut Parser, m: Marker, flavor: ItemFlavor) -> Resul
91 // modifiers 91 // modifiers
92 has_mods |= p.eat(T![const]); 92 has_mods |= p.eat(T![const]);
93 93
94 // test_err unsafe_block_in_mod
95 // fn foo(){} unsafe { } fn bar(){}
96 if p.at(T![unsafe]) && p.nth(1) != T!['{'] {
97 p.eat(T![unsafe]);
98 has_mods = true;
99 }
100
101 // test_err async_without_semicolon 94 // test_err async_without_semicolon
102 // fn foo() { let _ = async {} } 95 // fn foo() { let _ = async {} }
103 if p.at(T![async]) && p.nth(1) != T!['{'] && p.nth(1) != T![move] && p.nth(1) != T![|] { 96 if p.at(T![async]) && p.nth(1) != T!['{'] && p.nth(1) != T![move] && p.nth(1) != T![|] {
@@ -105,6 +98,13 @@ pub(super) fn maybe_item(p: &mut Parser, m: Marker, flavor: ItemFlavor) -> Resul
105 has_mods = true; 98 has_mods = true;
106 } 99 }
107 100
101 // test_err unsafe_block_in_mod
102 // fn foo(){} unsafe { } fn bar(){}
103 if p.at(T![unsafe]) && p.nth(1) != T!['{'] {
104 p.eat(T![unsafe]);
105 has_mods = true;
106 }
107
108 if p.at(T![extern]) { 108 if p.at(T![extern]) {
109 has_mods = true; 109 has_mods = true;
110 abi(p); 110 abi(p);
@@ -157,11 +157,11 @@ pub(super) fn maybe_item(p: &mut Parser, m: Marker, flavor: ItemFlavor) -> Resul
157 // unsafe fn foo() {} 157 // unsafe fn foo() {}
158 158
159 // test combined_fns 159 // test combined_fns
160 // unsafe async fn foo() {} 160 // async unsafe fn foo() {}
161 // const unsafe fn bar() {} 161 // const unsafe fn bar() {}
162 162
163 // test_err wrong_order_fns 163 // test_err wrong_order_fns
164 // async unsafe fn foo() {} 164 // unsafe async fn foo() {}
165 // unsafe const fn bar() {} 165 // unsafe const fn bar() {}
166 T![fn] => { 166 T![fn] => {
167 fn_def(p); 167 fn_def(p);