aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_parser/src
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2019-05-23 23:50:34 +0100
committerbors[bot] <bors[bot]@users.noreply.github.com>2019-05-23 23:50:34 +0100
commit8a9cc674212f2301c9b3283359f995366409bd0d (patch)
tree068d6bddab6b25398d03bcf8f74bcb5f2b9a592a /crates/ra_parser/src
parentde87fe293e88e2b8785e1d90371ec4f274139454 (diff)
parent0270b4bc577ba57f211d25bab161a607b9b94ec5 (diff)
Merge #1321
1321: Rustc r=matklad a=matklad Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_parser/src')
-rw-r--r--crates/ra_parser/src/grammar/items.rs4
-rw-r--r--crates/ra_parser/src/grammar/items/traits.rs4
-rw-r--r--crates/ra_parser/src/grammar/type_params.rs4
-rw-r--r--crates/ra_parser/src/grammar/types.rs4
4 files changed, 8 insertions, 8 deletions
diff --git a/crates/ra_parser/src/grammar/items.rs b/crates/ra_parser/src/grammar/items.rs
index 6728e395f..7718fbe6a 100644
--- a/crates/ra_parser/src/grammar/items.rs
+++ b/crates/ra_parser/src/grammar/items.rs
@@ -103,7 +103,7 @@ pub(super) fn maybe_item(p: &mut Parser, m: Marker, flavor: ItemFlavor) -> Resul
103 p.bump_remap(T![auto]); 103 p.bump_remap(T![auto]);
104 has_mods = true; 104 has_mods = true;
105 } 105 }
106 if p.at(IDENT) && p.at_contextual_kw("default") && p.nth(1) == T![impl ] { 106 if p.at(IDENT) && p.at_contextual_kw("default") && p.nth(1) == T![impl] {
107 p.bump_remap(T![default]); 107 p.bump_remap(T![default]);
108 has_mods = true; 108 has_mods = true;
109 } 109 }
@@ -161,7 +161,7 @@ pub(super) fn maybe_item(p: &mut Parser, m: Marker, flavor: ItemFlavor) -> Resul
161 161
162 // test unsafe_default_impl 162 // test unsafe_default_impl
163 // unsafe default impl Foo {} 163 // unsafe default impl Foo {}
164 T![impl ] => { 164 T![impl] => {
165 traits::impl_block(p); 165 traits::impl_block(p);
166 m.complete(p, IMPL_BLOCK); 166 m.complete(p, IMPL_BLOCK);
167 } 167 }
diff --git a/crates/ra_parser/src/grammar/items/traits.rs b/crates/ra_parser/src/grammar/items/traits.rs
index 09ab3bfd4..5fcacfbff 100644
--- a/crates/ra_parser/src/grammar/items/traits.rs
+++ b/crates/ra_parser/src/grammar/items/traits.rs
@@ -44,7 +44,7 @@ pub(crate) fn trait_item_list(p: &mut Parser) {
44// test impl_block 44// test impl_block
45// impl Foo {} 45// impl Foo {}
46pub(super) fn impl_block(p: &mut Parser) { 46pub(super) fn impl_block(p: &mut Parser) {
47 assert!(p.at(T![impl ])); 47 assert!(p.at(T![impl]));
48 p.bump(); 48 p.bump();
49 if choose_type_params_over_qpath(p) { 49 if choose_type_params_over_qpath(p) {
50 type_params::opt_type_param_list(p); 50 type_params::opt_type_param_list(p);
@@ -130,7 +130,7 @@ fn choose_type_params_over_qpath(p: &Parser) -> bool {
130// impl impl NotType {} 130// impl impl NotType {}
131// impl Trait2 for impl NotType {} 131// impl Trait2 for impl NotType {}
132pub(crate) fn impl_type(p: &mut Parser) { 132pub(crate) fn impl_type(p: &mut Parser) {
133 if p.at(T![impl ]) { 133 if p.at(T![impl]) {
134 p.error("expected trait or type"); 134 p.error("expected trait or type");
135 return; 135 return;
136 } 136 }
diff --git a/crates/ra_parser/src/grammar/type_params.rs b/crates/ra_parser/src/grammar/type_params.rs
index 4bbfed780..ef59b59d3 100644
--- a/crates/ra_parser/src/grammar/type_params.rs
+++ b/crates/ra_parser/src/grammar/type_params.rs
@@ -150,7 +150,7 @@ pub(super) fn opt_where_clause(p: &mut Parser) {
150fn is_where_predicate(p: &mut Parser) -> bool { 150fn is_where_predicate(p: &mut Parser) -> bool {
151 match p.current() { 151 match p.current() {
152 LIFETIME => true, 152 LIFETIME => true,
153 T![impl ] => false, 153 T![impl] => false,
154 token => types::TYPE_FIRST.contains(token), 154 token => types::TYPE_FIRST.contains(token),
155 } 155 }
156} 156}
@@ -170,7 +170,7 @@ fn where_predicate(p: &mut Parser) {
170 p.error("expected colon"); 170 p.error("expected colon");
171 } 171 }
172 } 172 }
173 T![impl ] => { 173 T![impl] => {
174 p.error("expected lifetime or type"); 174 p.error("expected lifetime or type");
175 } 175 }
176 _ => { 176 _ => {
diff --git a/crates/ra_parser/src/grammar/types.rs b/crates/ra_parser/src/grammar/types.rs
index 438e3ab0e..c0b722569 100644
--- a/crates/ra_parser/src/grammar/types.rs
+++ b/crates/ra_parser/src/grammar/types.rs
@@ -25,7 +25,7 @@ fn type_with_bounds_cond(p: &mut Parser, allow_bounds: bool) {
25 T![_] => placeholder_type(p), 25 T![_] => placeholder_type(p),
26 T![fn] | T![unsafe] | T![extern] => fn_pointer_type(p), 26 T![fn] | T![unsafe] | T![extern] => fn_pointer_type(p),
27 T![for] => for_type(p), 27 T![for] => for_type(p),
28 T![impl ] => impl_trait_type(p), 28 T![impl] => impl_trait_type(p),
29 T![dyn ] => dyn_trait_type(p), 29 T![dyn ] => dyn_trait_type(p),
30 // Some path types are not allowed to have bounds (no plus) 30 // Some path types are not allowed to have bounds (no plus)
31 T![<] => path_type_(p, allow_bounds), 31 T![<] => path_type_(p, allow_bounds),
@@ -221,7 +221,7 @@ pub(super) fn for_type(p: &mut Parser) {
221// test impl_trait_type 221// test impl_trait_type
222// type A = impl Iterator<Item=Foo<'a>> + 'a; 222// type A = impl Iterator<Item=Foo<'a>> + 'a;
223fn impl_trait_type(p: &mut Parser) { 223fn impl_trait_type(p: &mut Parser) {
224 assert!(p.at(T![impl ])); 224 assert!(p.at(T![impl]));
225 let m = p.start(); 225 let m = p.start();
226 p.bump(); 226 p.bump();
227 type_params::bounds_without_colon(p); 227 type_params::bounds_without_colon(p);