aboutsummaryrefslogtreecommitdiff
path: root/crates/parser/src/grammar/type_params.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-12-16 17:08:03 +0000
committerGitHub <[email protected]>2020-12-16 17:08:03 +0000
commit067067a6c11bb5afda98f5af14bfdec4744e7812 (patch)
tree1c0b6c4c78ee040ebdf818dada804fce311382a6 /crates/parser/src/grammar/type_params.rs
parent63bbdb31e5148c804bbf940963c9c8f3481ad258 (diff)
parentdd496223f50232fe98312ee8edc89eb4b5ee3d85 (diff)
Merge #6896
6896: Node-ify lifetimes r=jonas-schievink a=Veykril Let's see if this passes the tests 🤞 Depends on https://github.com/rust-analyzer/ungrammar/pull/15 Co-authored-by: Jonas Schievink <[email protected]> Co-authored-by: Jonas Schievink <[email protected]> Co-authored-by: Lukas Wirth <[email protected]>
Diffstat (limited to 'crates/parser/src/grammar/type_params.rs')
-rw-r--r--crates/parser/src/grammar/type_params.rs18
1 files changed, 9 insertions, 9 deletions
diff --git a/crates/parser/src/grammar/type_params.rs b/crates/parser/src/grammar/type_params.rs
index bc7d8d724..9c3f7c28a 100644
--- a/crates/parser/src/grammar/type_params.rs
+++ b/crates/parser/src/grammar/type_params.rs
@@ -23,7 +23,7 @@ fn generic_param_list(p: &mut Parser) {
23 attributes::outer_attrs(p); 23 attributes::outer_attrs(p);
24 24
25 match p.current() { 25 match p.current() {
26 LIFETIME => lifetime_param(p, m), 26 LIFETIME_IDENT => lifetime_param(p, m),
27 IDENT => type_param(p, m), 27 IDENT => type_param(p, m),
28 CONST_KW => const_param(p, m), 28 CONST_KW => const_param(p, m),
29 _ => { 29 _ => {
@@ -40,8 +40,8 @@ fn generic_param_list(p: &mut Parser) {
40} 40}
41 41
42fn lifetime_param(p: &mut Parser, m: Marker) { 42fn lifetime_param(p: &mut Parser, m: Marker) {
43 assert!(p.at(LIFETIME)); 43 assert!(p.at(LIFETIME_IDENT));
44 p.bump(LIFETIME); 44 lifetime(p);
45 if p.at(T![:]) { 45 if p.at(T![:]) {
46 lifetime_bounds(p); 46 lifetime_bounds(p);
47 } 47 }
@@ -84,8 +84,8 @@ pub(super) fn bounds(p: &mut Parser) {
84fn lifetime_bounds(p: &mut Parser) { 84fn lifetime_bounds(p: &mut Parser) {
85 assert!(p.at(T![:])); 85 assert!(p.at(T![:]));
86 p.bump(T![:]); 86 p.bump(T![:]);
87 while p.at(LIFETIME) { 87 while p.at(LIFETIME_IDENT) {
88 p.bump(LIFETIME); 88 lifetime(p);
89 if !p.eat(T![+]) { 89 if !p.eat(T![+]) {
90 break; 90 break;
91 } 91 }
@@ -112,7 +112,7 @@ fn type_bound(p: &mut Parser) -> bool {
112 let has_paren = p.eat(T!['(']); 112 let has_paren = p.eat(T!['(']);
113 p.eat(T![?]); 113 p.eat(T![?]);
114 match p.current() { 114 match p.current() {
115 LIFETIME => p.bump(LIFETIME), 115 LIFETIME_IDENT => lifetime(p),
116 T![for] => types::for_type(p), 116 T![for] => types::for_type(p),
117 _ if paths::is_use_path_start(p) => types::path_type_(p, false), 117 _ if paths::is_use_path_start(p) => types::path_type_(p, false),
118 _ => { 118 _ => {
@@ -162,7 +162,7 @@ pub(super) fn opt_where_clause(p: &mut Parser) {
162 162
163fn is_where_predicate(p: &mut Parser) -> bool { 163fn is_where_predicate(p: &mut Parser) -> bool {
164 match p.current() { 164 match p.current() {
165 LIFETIME => true, 165 LIFETIME_IDENT => true,
166 T![impl] => false, 166 T![impl] => false,
167 token => types::TYPE_FIRST.contains(token), 167 token => types::TYPE_FIRST.contains(token),
168 } 168 }
@@ -175,8 +175,8 @@ fn is_where_clause_end(p: &mut Parser) -> bool {
175fn where_predicate(p: &mut Parser) { 175fn where_predicate(p: &mut Parser) {
176 let m = p.start(); 176 let m = p.start();
177 match p.current() { 177 match p.current() {
178 LIFETIME => { 178 LIFETIME_IDENT => {
179 p.bump(LIFETIME); 179 lifetime(p);
180 if p.at(T![:]) { 180 if p.at(T![:]) {
181 bounds(p); 181 bounds(p);
182 } else { 182 } else {