aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorLukas Wirth <[email protected]>2020-12-15 18:23:51 +0000
committerLukas Wirth <[email protected]>2020-12-16 13:16:09 +0000
commitdd496223f50232fe98312ee8edc89eb4b5ee3d85 (patch)
tree4d50c04ca78f9458ab536ff1edee76eba6ab1957 /crates
parentd34611633b3b2404188b9e12b08c5def589808c2 (diff)
Node-ify lifetimes
Diffstat (limited to 'crates')
-rw-r--r--crates/assists/src/handlers/generate_impl.rs2
-rw-r--r--crates/assists/src/handlers/generate_new.rs2
-rw-r--r--crates/assists/src/handlers/introduce_named_lifetime.rs21
-rw-r--r--crates/hir/src/semantics.rs17
-rw-r--r--crates/hir_def/src/body/lower.rs24
-rw-r--r--crates/hir_def/src/generics.rs9
-rw-r--r--crates/hir_def/src/item_tree/lower.rs4
-rw-r--r--crates/hir_def/src/path/lower.rs4
-rw-r--r--crates/hir_def/src/type_ref.rs10
-rw-r--r--crates/hir_expand/src/name.rs5
-rw-r--r--crates/ide/src/extend_selection.rs2
-rw-r--r--crates/mbe/src/mbe_expander/matcher.rs2
-rw-r--r--crates/mbe/src/subtree_source.rs8
-rw-r--r--crates/mbe/src/syntax_bridge.rs4
-rw-r--r--crates/parser/src/grammar.rs7
-rw-r--r--crates/parser/src/grammar/expressions/atom.rs16
-rw-r--r--crates/parser/src/grammar/items/traits.rs10
-rw-r--r--crates/parser/src/grammar/params.rs13
-rw-r--r--crates/parser/src/grammar/type_args.rs4
-rw-r--r--crates/parser/src/grammar/type_params.rs18
-rw-r--r--crates/parser/src/grammar/types.rs4
-rw-r--r--crates/parser/src/syntax_kind/generated.rs5
-rw-r--r--crates/syntax/src/ast.rs2
-rw-r--r--crates/syntax/src/ast/generated/nodes.rs62
-rw-r--r--crates/syntax/src/ast/node_ext.rs12
-rw-r--r--crates/syntax/src/parsing/lexer.rs4
-rw-r--r--crates/syntax/test_data/lexer/err/0057_lifetime_starts_with_a_number.rs (renamed from crates/syntax/test_data/lexer/err/0057_lifetime_strarts_with_a_number.rs)0
-rw-r--r--crates/syntax/test_data/lexer/err/0057_lifetime_starts_with_a_number.txt (renamed from crates/syntax/test_data/lexer/err/0057_lifetime_strarts_with_a_number.txt)4
-rw-r--r--crates/syntax/test_data/lexer/ok/0007_lifetimes.txt8
-rw-r--r--crates/syntax/test_data/parser/err/0024_many_type_parens.rast22
-rw-r--r--crates/syntax/test_data/parser/err/0027_incomplere_where_for.rast3
-rw-r--r--crates/syntax/test_data/parser/err/0043_weird_blocks.rast3
-rw-r--r--crates/syntax/test_data/parser/err/0044_unexpected_for_type.rast45
-rw-r--r--crates/syntax/test_data/parser/err/0046_ambiguous_trait_object.rast9
-rw-r--r--crates/syntax/test_data/parser/inline/err/0002_misplaced_label_err.rast3
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0003_where_pred_for.rast6
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0006_self_param.rast6
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0007_type_param_bounds.rast3
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0015_continue_expr.rast3
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0028_impl_trait_type.rast6
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0033_reference_type;.rast3
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0034_break_expr.rast6
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0039_type_arg.rast3
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0045_param_list_opt_patterns.rast3
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0048_path_type_with_bounds.rast6
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0056_where_clause.rast18
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0065_dyn_trait_type.rast6
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0081_for_type.rast15
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0109_label.rast9
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0122_generic_lifetime_type_attribute.rast6
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0161_labeled_block.rast3
-rw-r--r--crates/syntax/test_data/parser/ok/0018_struct_type_params.rast51
-rw-r--r--crates/syntax/test_data/parser/ok/0020_type_param_bounds.rast42
-rw-r--r--crates/syntax/test_data/parser/ok/0032_where_for.rast6
-rw-r--r--crates/syntax/test_data/parser/ok/0033_label_break.rast21
-rw-r--r--crates/syntax/test_data/parser/ok/0035_weird_exprs.rast19
-rw-r--r--crates/syntax/test_data/parser/ok/0051_parameter_attrs.rast18
-rw-r--r--crates/syntax/test_data/parser/ok/0067_where_for_pred.rast45
-rw-r--r--crates/syntax/test_data/parser/ok/0069_multi_trait_object.rast9
59 files changed, 413 insertions, 268 deletions
diff --git a/crates/assists/src/handlers/generate_impl.rs b/crates/assists/src/handlers/generate_impl.rs
index 114974465..960af5ab3 100644
--- a/crates/assists/src/handlers/generate_impl.rs
+++ b/crates/assists/src/handlers/generate_impl.rs
@@ -53,7 +53,7 @@ pub(crate) fn generate_impl(acc: &mut Assists, ctx: &AssistContext) -> Option<()
53 if let Some(type_params) = type_params { 53 if let Some(type_params) = type_params {
54 let lifetime_params = type_params 54 let lifetime_params = type_params
55 .lifetime_params() 55 .lifetime_params()
56 .filter_map(|it| it.lifetime_token()) 56 .filter_map(|it| it.lifetime())
57 .map(|it| it.text().clone()); 57 .map(|it| it.text().clone());
58 let type_params = type_params 58 let type_params = type_params
59 .type_params() 59 .type_params()
diff --git a/crates/assists/src/handlers/generate_new.rs b/crates/assists/src/handlers/generate_new.rs
index 7db10f276..c5fec4e0a 100644
--- a/crates/assists/src/handlers/generate_new.rs
+++ b/crates/assists/src/handlers/generate_new.rs
@@ -99,7 +99,7 @@ fn generate_impl_text(strukt: &ast::Struct, code: &str) -> String {
99 if let Some(type_params) = type_params { 99 if let Some(type_params) = type_params {
100 let lifetime_params = type_params 100 let lifetime_params = type_params
101 .lifetime_params() 101 .lifetime_params()
102 .filter_map(|it| it.lifetime_token()) 102 .filter_map(|it| it.lifetime())
103 .map(|it| it.text().clone()); 103 .map(|it| it.text().clone());
104 let type_params = 104 let type_params =
105 type_params.type_params().filter_map(|it| it.name()).map(|it| it.text().clone()); 105 type_params.type_params().filter_map(|it| it.name()).map(|it| it.text().clone());
diff --git a/crates/assists/src/handlers/introduce_named_lifetime.rs b/crates/assists/src/handlers/introduce_named_lifetime.rs
index 4cc8dae65..ab8fe3ea9 100644
--- a/crates/assists/src/handlers/introduce_named_lifetime.rs
+++ b/crates/assists/src/handlers/introduce_named_lifetime.rs
@@ -1,7 +1,7 @@
1use rustc_hash::FxHashSet; 1use rustc_hash::FxHashSet;
2use syntax::{ 2use syntax::{
3 ast::{self, GenericParamsOwner, NameOwner}, 3 ast::{self, GenericParamsOwner, NameOwner},
4 AstNode, SyntaxKind, TextRange, TextSize, 4 AstNode, TextRange, TextSize,
5}; 5};
6 6
7use crate::{assist_context::AssistBuilder, AssistContext, AssistId, AssistKind, Assists}; 7use crate::{assist_context::AssistBuilder, AssistContext, AssistId, AssistKind, Assists};
@@ -35,13 +35,12 @@ static ASSIST_LABEL: &str = "Introduce named lifetime";
35// FIXME: How can we handle renaming any one of multiple anonymous lifetimes? 35// FIXME: How can we handle renaming any one of multiple anonymous lifetimes?
36// FIXME: should also add support for the case fun(f: &Foo) -> &<|>Foo 36// FIXME: should also add support for the case fun(f: &Foo) -> &<|>Foo
37pub(crate) fn introduce_named_lifetime(acc: &mut Assists, ctx: &AssistContext) -> Option<()> { 37pub(crate) fn introduce_named_lifetime(acc: &mut Assists, ctx: &AssistContext) -> Option<()> {
38 let lifetime_token = ctx 38 let lifetime =
39 .find_token_syntax_at_offset(SyntaxKind::LIFETIME) 39 ctx.find_node_at_offset::<ast::Lifetime>().filter(|lifetime| lifetime.text() == "'_")?;
40 .filter(|lifetime| lifetime.text() == "'_")?; 40 if let Some(fn_def) = lifetime.syntax().ancestors().find_map(ast::Fn::cast) {
41 if let Some(fn_def) = lifetime_token.ancestors().find_map(ast::Fn::cast) { 41 generate_fn_def_assist(acc, &fn_def, lifetime.lifetime_ident_token()?.text_range())
42 generate_fn_def_assist(acc, &fn_def, lifetime_token.text_range()) 42 } else if let Some(impl_def) = lifetime.syntax().ancestors().find_map(ast::Impl::cast) {
43 } else if let Some(impl_def) = lifetime_token.ancestors().find_map(ast::Impl::cast) { 43 generate_impl_def_assist(acc, &impl_def, lifetime.lifetime_ident_token()?.text_range())
44 generate_impl_def_assist(acc, &impl_def, lifetime_token.text_range())
45 } else { 44 } else {
46 None 45 None
47 } 46 }
@@ -58,7 +57,7 @@ fn generate_fn_def_assist(
58 let end_of_fn_ident = fn_def.name()?.ident_token()?.text_range().end(); 57 let end_of_fn_ident = fn_def.name()?.ident_token()?.text_range().end();
59 let self_param = 58 let self_param =
60 // use the self if it's a reference and has no explicit lifetime 59 // use the self if it's a reference and has no explicit lifetime
61 param_list.self_param().filter(|p| p.lifetime_token().is_none() && p.amp_token().is_some()); 60 param_list.self_param().filter(|p| p.lifetime().is_none() && p.amp_token().is_some());
62 // compute the location which implicitly has the same lifetime as the anonymous lifetime 61 // compute the location which implicitly has the same lifetime as the anonymous lifetime
63 let loc_needing_lifetime = if let Some(self_param) = self_param { 62 let loc_needing_lifetime = if let Some(self_param) = self_param {
64 // if we have a self reference, use that 63 // if we have a self reference, use that
@@ -68,9 +67,7 @@ fn generate_fn_def_assist(
68 let fn_params_without_lifetime: Vec<_> = param_list 67 let fn_params_without_lifetime: Vec<_> = param_list
69 .params() 68 .params()
70 .filter_map(|param| match param.ty() { 69 .filter_map(|param| match param.ty() {
71 Some(ast::Type::RefType(ascribed_type)) 70 Some(ast::Type::RefType(ascribed_type)) if ascribed_type.lifetime().is_none() => {
72 if ascribed_type.lifetime_token() == None =>
73 {
74 Some(ascribed_type.amp_token()?.text_range().end()) 71 Some(ascribed_type.amp_token()?.text_range().end())
75 } 72 }
76 _ => None, 73 _ => None,
diff --git a/crates/hir/src/semantics.rs b/crates/hir/src/semantics.rs
index 5959ac4ca..ee2074602 100644
--- a/crates/hir/src/semantics.rs
+++ b/crates/hir/src/semantics.rs
@@ -178,9 +178,8 @@ impl<'db, DB: HirDatabase> Semantics<'db, DB> {
178 self.imp.descend_node_at_offset(node, offset).find_map(N::cast) 178 self.imp.descend_node_at_offset(node, offset).find_map(N::cast)
179 } 179 }
180 180
181 // FIXME: Replace the SyntaxToken with a typed ast Node/Token 181 pub fn resolve_lifetime_param(&self, lifetime: &ast::Lifetime) -> Option<LifetimeParam> {
182 pub fn resolve_lifetime_param(&self, lifetime_token: &SyntaxToken) -> Option<LifetimeParam> { 182 self.imp.resolve_lifetime_param(lifetime)
183 self.imp.resolve_lifetime_param(lifetime_token)
184 } 183 }
185 184
186 pub fn type_of_expr(&self, expr: &ast::Expr) -> Option<Type> { 185 pub fn type_of_expr(&self, expr: &ast::Expr) -> Option<Type> {
@@ -402,13 +401,9 @@ impl<'db> SemanticsImpl<'db> {
402 .kmerge_by(|node1, node2| node1.text_range().len() < node2.text_range().len()) 401 .kmerge_by(|node1, node2| node1.text_range().len() < node2.text_range().len())
403 } 402 }
404 403
405 // FIXME: Replace the SyntaxToken with a typed ast Node/Token 404 fn resolve_lifetime_param(&self, lifetime: &ast::Lifetime) -> Option<LifetimeParam> {
406 fn resolve_lifetime_param(&self, lifetime_token: &SyntaxToken) -> Option<LifetimeParam> { 405 let text = lifetime.text();
407 if lifetime_token.kind() != syntax::SyntaxKind::LIFETIME { 406 let lifetime_param = lifetime.syntax().ancestors().find_map(|syn| {
408 return None;
409 }
410 let lifetime_text = lifetime_token.text();
411 let lifetime_param = lifetime_token.parent().ancestors().find_map(|syn| {
412 let gpl = match_ast! { 407 let gpl = match_ast! {
413 match syn { 408 match syn {
414 ast::Fn(it) => it.generic_param_list()?, 409 ast::Fn(it) => it.generic_param_list()?,
@@ -424,7 +419,7 @@ impl<'db> SemanticsImpl<'db> {
424 } 419 }
425 }; 420 };
426 gpl.lifetime_params() 421 gpl.lifetime_params()
427 .find(|tp| tp.lifetime_token().as_ref().map(|lt| lt.text()) == Some(lifetime_text)) 422 .find(|tp| tp.lifetime().as_ref().map(|lt| lt.text()) == Some(text))
428 })?; 423 })?;
429 let src = self.find_file(lifetime_param.syntax().clone()).with_value(lifetime_param); 424 let src = self.find_file(lifetime_param.syntax().clone()).with_value(lifetime_param);
430 ToDef::to_def(self, src) 425 ToDef::to_def(self, src)
diff --git a/crates/hir_def/src/body/lower.rs b/crates/hir_def/src/body/lower.rs
index 23e2fd764..3b3d74987 100644
--- a/crates/hir_def/src/body/lower.rs
+++ b/crates/hir_def/src/body/lower.rs
@@ -233,8 +233,7 @@ impl ExprCollector<'_> {
233 let res = self.collect_block(block); 233 let res = self.collect_block(block);
234 match &mut self.body.exprs[res] { 234 match &mut self.body.exprs[res] {
235 Expr::Block { label: block_label, .. } => { 235 Expr::Block { label: block_label, .. } => {
236 *block_label = 236 *block_label = label.lifetime().map(|t| Name::new_lifetime(&t))
237 label.lifetime_token().map(|t| Name::new_lifetime(&t))
238 } 237 }
239 _ => unreachable!(), 238 _ => unreachable!(),
240 } 239 }
@@ -254,10 +253,7 @@ impl ExprCollector<'_> {
254 self.alloc_expr( 253 self.alloc_expr(
255 Expr::Loop { 254 Expr::Loop {
256 body, 255 body,
257 label: e 256 label: e.label().and_then(|l| l.lifetime()).map(|l| Name::new_lifetime(&l)),
258 .label()
259 .and_then(|l| l.lifetime_token())
260 .map(|l| Name::new_lifetime(&l)),
261 }, 257 },
262 syntax_ptr, 258 syntax_ptr,
263 ) 259 )
@@ -288,7 +284,7 @@ impl ExprCollector<'_> {
288 body: match_expr, 284 body: match_expr,
289 label: e 285 label: e
290 .label() 286 .label()
291 .and_then(|l| l.lifetime_token()) 287 .and_then(|l| l.lifetime())
292 .map(|l| Name::new_lifetime(&l)), 288 .map(|l| Name::new_lifetime(&l)),
293 }, 289 },
294 syntax_ptr, 290 syntax_ptr,
@@ -301,10 +297,7 @@ impl ExprCollector<'_> {
301 Expr::While { 297 Expr::While {
302 condition, 298 condition,
303 body, 299 body,
304 label: e 300 label: e.label().and_then(|l| l.lifetime()).map(|l| Name::new_lifetime(&l)),
305 .label()
306 .and_then(|l| l.lifetime_token())
307 .map(|l| Name::new_lifetime(&l)),
308 }, 301 },
309 syntax_ptr, 302 syntax_ptr,
310 ) 303 )
@@ -318,10 +311,7 @@ impl ExprCollector<'_> {
318 iterable, 311 iterable,
319 pat, 312 pat,
320 body, 313 body,
321 label: e 314 label: e.label().and_then(|l| l.lifetime()).map(|l| Name::new_lifetime(&l)),
322 .label()
323 .and_then(|l| l.lifetime_token())
324 .map(|l| Name::new_lifetime(&l)),
325 }, 315 },
326 syntax_ptr, 316 syntax_ptr,
327 ) 317 )
@@ -380,13 +370,13 @@ impl ExprCollector<'_> {
380 self.alloc_expr(path, syntax_ptr) 370 self.alloc_expr(path, syntax_ptr)
381 } 371 }
382 ast::Expr::ContinueExpr(e) => self.alloc_expr( 372 ast::Expr::ContinueExpr(e) => self.alloc_expr(
383 Expr::Continue { label: e.lifetime_token().map(|l| Name::new_lifetime(&l)) }, 373 Expr::Continue { label: e.lifetime().map(|l| Name::new_lifetime(&l)) },
384 syntax_ptr, 374 syntax_ptr,
385 ), 375 ),
386 ast::Expr::BreakExpr(e) => { 376 ast::Expr::BreakExpr(e) => {
387 let expr = e.expr().map(|e| self.collect_expr(e)); 377 let expr = e.expr().map(|e| self.collect_expr(e));
388 self.alloc_expr( 378 self.alloc_expr(
389 Expr::Break { expr, label: e.lifetime_token().map(|l| Name::new_lifetime(&l)) }, 379 Expr::Break { expr, label: e.lifetime().map(|l| Name::new_lifetime(&l)) },
390 syntax_ptr, 380 syntax_ptr,
391 ) 381 )
392 } 382 }
diff --git a/crates/hir_def/src/generics.rs b/crates/hir_def/src/generics.rs
index 81912a454..bc0125f0b 100644
--- a/crates/hir_def/src/generics.rs
+++ b/crates/hir_def/src/generics.rs
@@ -260,9 +260,8 @@ impl GenericParams {
260 self.fill_bounds(&lower_ctx, &type_param, Either::Left(type_ref)); 260 self.fill_bounds(&lower_ctx, &type_param, Either::Left(type_ref));
261 } 261 }
262 for lifetime_param in params.lifetime_params() { 262 for lifetime_param in params.lifetime_params() {
263 let name = lifetime_param 263 let name =
264 .lifetime_token() 264 lifetime_param.lifetime().map_or_else(Name::missing, |lt| Name::new_lifetime(&lt));
265 .map_or_else(Name::missing, |tok| Name::new_lifetime(&tok));
266 let param = LifetimeParamData { name: name.clone() }; 265 let param = LifetimeParamData { name: name.clone() };
267 let param_id = self.lifetimes.alloc(param); 266 let param_id = self.lifetimes.alloc(param);
268 sm.lifetime_params.insert(param_id, lifetime_param.clone()); 267 sm.lifetime_params.insert(param_id, lifetime_param.clone());
@@ -275,8 +274,8 @@ impl GenericParams {
275 for pred in where_clause.predicates() { 274 for pred in where_clause.predicates() {
276 let target = if let Some(type_ref) = pred.ty() { 275 let target = if let Some(type_ref) = pred.ty() {
277 Either::Left(TypeRef::from_ast(lower_ctx, type_ref)) 276 Either::Left(TypeRef::from_ast(lower_ctx, type_ref))
278 } else if let Some(lifetime_tok) = pred.lifetime_token() { 277 } else if let Some(lifetime) = pred.lifetime() {
279 Either::Right(LifetimeRef::from_token(lifetime_tok)) 278 Either::Right(LifetimeRef::new(&lifetime))
280 } else { 279 } else {
281 continue; 280 continue;
282 }; 281 };
diff --git a/crates/hir_def/src/item_tree/lower.rs b/crates/hir_def/src/item_tree/lower.rs
index 1dc06a211..dd3409762 100644
--- a/crates/hir_def/src/item_tree/lower.rs
+++ b/crates/hir_def/src/item_tree/lower.rs
@@ -300,12 +300,12 @@ impl Ctx {
300 ast::SelfParamKind::Owned => self_type, 300 ast::SelfParamKind::Owned => self_type,
301 ast::SelfParamKind::Ref => TypeRef::Reference( 301 ast::SelfParamKind::Ref => TypeRef::Reference(
302 Box::new(self_type), 302 Box::new(self_type),
303 self_param.lifetime_token().map(LifetimeRef::from_token), 303 self_param.lifetime().as_ref().map(LifetimeRef::new),
304 Mutability::Shared, 304 Mutability::Shared,
305 ), 305 ),
306 ast::SelfParamKind::MutRef => TypeRef::Reference( 306 ast::SelfParamKind::MutRef => TypeRef::Reference(
307 Box::new(self_type), 307 Box::new(self_type),
308 self_param.lifetime_token().map(LifetimeRef::from_token), 308 self_param.lifetime().as_ref().map(LifetimeRef::new),
309 Mutability::Mut, 309 Mutability::Mut,
310 ), 310 ),
311 } 311 }
diff --git a/crates/hir_def/src/path/lower.rs b/crates/hir_def/src/path/lower.rs
index 609925012..8a01e6eea 100644
--- a/crates/hir_def/src/path/lower.rs
+++ b/crates/hir_def/src/path/lower.rs
@@ -169,8 +169,8 @@ pub(super) fn lower_generic_args(
169 } 169 }
170 } 170 }
171 ast::GenericArg::LifetimeArg(lifetime_arg) => { 171 ast::GenericArg::LifetimeArg(lifetime_arg) => {
172 if let Some(lifetime) = lifetime_arg.lifetime_token() { 172 if let Some(lifetime) = lifetime_arg.lifetime() {
173 let lifetime_ref = LifetimeRef::from_token(lifetime); 173 let lifetime_ref = LifetimeRef::new(&lifetime);
174 args.push(GenericArg::Lifetime(lifetime_ref)) 174 args.push(GenericArg::Lifetime(lifetime_ref))
175 } 175 }
176 } 176 }
diff --git a/crates/hir_def/src/type_ref.rs b/crates/hir_def/src/type_ref.rs
index 347ceabb9..ae93d0d10 100644
--- a/crates/hir_def/src/type_ref.rs
+++ b/crates/hir_def/src/type_ref.rs
@@ -1,7 +1,7 @@
1//! HIR for references to types. Paths in these are not yet resolved. They can 1//! HIR for references to types. Paths in these are not yet resolved. They can
2//! be directly created from an ast::TypeRef, without further queries. 2//! be directly created from an ast::TypeRef, without further queries.
3use hir_expand::name::Name; 3use hir_expand::name::Name;
4use syntax::{ast, SyntaxToken}; 4use syntax::ast;
5 5
6use crate::{body::LowerCtx, path::Path}; 6use crate::{body::LowerCtx, path::Path};
7 7
@@ -80,8 +80,8 @@ impl LifetimeRef {
80 LifetimeRef { name } 80 LifetimeRef { name }
81 } 81 }
82 82
83 pub(crate) fn from_token(token: SyntaxToken) -> Self { 83 pub(crate) fn new(lifetime: &ast::Lifetime) -> Self {
84 LifetimeRef { name: Name::new_lifetime(&token) } 84 LifetimeRef { name: Name::new_lifetime(lifetime) }
85 } 85 }
86 86
87 pub fn missing() -> LifetimeRef { 87 pub fn missing() -> LifetimeRef {
@@ -127,7 +127,7 @@ impl TypeRef {
127 } 127 }
128 ast::Type::RefType(inner) => { 128 ast::Type::RefType(inner) => {
129 let inner_ty = TypeRef::from_ast_opt(&ctx, inner.ty()); 129 let inner_ty = TypeRef::from_ast_opt(&ctx, inner.ty());
130 let lifetime = inner.lifetime_token().map(|t| LifetimeRef::from_token(t)); 130 let lifetime = inner.lifetime().map(|lt| LifetimeRef::new(&lt));
131 let mutability = Mutability::from_mutable(inner.mut_token().is_some()); 131 let mutability = Mutability::from_mutable(inner.mut_token().is_some());
132 TypeRef::Reference(Box::new(inner_ty), lifetime, mutability) 132 TypeRef::Reference(Box::new(inner_ty), lifetime, mutability)
133 } 133 }
@@ -259,7 +259,7 @@ impl TypeBound {
259 } 259 }
260 ast::TypeBoundKind::ForType(_) => TypeBound::Error, // FIXME ForType 260 ast::TypeBoundKind::ForType(_) => TypeBound::Error, // FIXME ForType
261 ast::TypeBoundKind::Lifetime(lifetime) => { 261 ast::TypeBoundKind::Lifetime(lifetime) => {
262 TypeBound::Lifetime(LifetimeRef::from_token(lifetime)) 262 TypeBound::Lifetime(LifetimeRef::new(&lifetime))
263 } 263 }
264 } 264 }
265 } 265 }
diff --git a/crates/hir_expand/src/name.rs b/crates/hir_expand/src/name.rs
index 69d8e6803..7fb4caea3 100644
--- a/crates/hir_expand/src/name.rs
+++ b/crates/hir_expand/src/name.rs
@@ -37,9 +37,8 @@ impl Name {
37 Name(Repr::TupleField(idx)) 37 Name(Repr::TupleField(idx))
38 } 38 }
39 39
40 pub fn new_lifetime(lt: &syntax::SyntaxToken) -> Name { 40 pub fn new_lifetime(lt: &ast::Lifetime) -> Name {
41 assert_eq!(lt.kind(), syntax::SyntaxKind::LIFETIME); 41 Self::new_text(lt.text().clone())
42 Name(Repr::Text(lt.text().clone()))
43 } 42 }
44 43
45 /// Shortcut to create inline plain text name 44 /// Shortcut to create inline plain text name
diff --git a/crates/ide/src/extend_selection.rs b/crates/ide/src/extend_selection.rs
index 0971f7701..6f3022dfd 100644
--- a/crates/ide/src/extend_selection.rs
+++ b/crates/ide/src/extend_selection.rs
@@ -237,7 +237,7 @@ fn pick_best(l: SyntaxToken, r: SyntaxToken) -> SyntaxToken {
237 fn priority(n: &SyntaxToken) -> usize { 237 fn priority(n: &SyntaxToken) -> usize {
238 match n.kind() { 238 match n.kind() {
239 WHITESPACE => 0, 239 WHITESPACE => 0,
240 IDENT | T![self] | T![super] | T![crate] | LIFETIME => 2, 240 IDENT | T![self] | T![super] | T![crate] | LIFETIME_IDENT => 2,
241 _ => 1, 241 _ => 1,
242 } 242 }
243 } 243 }
diff --git a/crates/mbe/src/mbe_expander/matcher.rs b/crates/mbe/src/mbe_expander/matcher.rs
index 93ee77908..7aeef7be5 100644
--- a/crates/mbe/src/mbe_expander/matcher.rs
+++ b/crates/mbe/src/mbe_expander/matcher.rs
@@ -295,7 +295,7 @@ impl<'a> TtIter<'a> {
295 295
296 impl<'a> TreeSink for OffsetTokenSink<'a> { 296 impl<'a> TreeSink for OffsetTokenSink<'a> {
297 fn token(&mut self, kind: SyntaxKind, mut n_tokens: u8) { 297 fn token(&mut self, kind: SyntaxKind, mut n_tokens: u8) {
298 if kind == SyntaxKind::LIFETIME { 298 if kind == SyntaxKind::LIFETIME_IDENT {
299 n_tokens = 2; 299 n_tokens = 2;
300 } 300 }
301 for _ in 0..n_tokens { 301 for _ in 0..n_tokens {
diff --git a/crates/mbe/src/subtree_source.rs b/crates/mbe/src/subtree_source.rs
index ccc56c479..d10d4b70e 100644
--- a/crates/mbe/src/subtree_source.rs
+++ b/crates/mbe/src/subtree_source.rs
@@ -84,7 +84,11 @@ impl<'a> SubtreeTokenSource<'a> {
84 } 84 }
85 85
86 if let Some((curr, text)) = is_lifetime(cursor) { 86 if let Some((curr, text)) = is_lifetime(cursor) {
87 cached.push(Some(TtToken { kind: LIFETIME, is_joint_to_next: false, text })); 87 cached.push(Some(TtToken {
88 kind: LIFETIME_IDENT,
89 is_joint_to_next: false,
90 text,
91 }));
88 self.cached_cursor.set(curr); 92 self.cached_cursor.set(curr);
89 continue; 93 continue;
90 } 94 }
@@ -172,7 +176,7 @@ fn convert_ident(ident: &tt::Ident) -> TtToken {
172 let kind = match ident.text.as_ref() { 176 let kind = match ident.text.as_ref() {
173 "true" => T![true], 177 "true" => T![true],
174 "false" => T![false], 178 "false" => T![false],
175 i if i.starts_with('\'') => LIFETIME, 179 i if i.starts_with('\'') => LIFETIME_IDENT,
176 _ => SyntaxKind::from_keyword(ident.text.as_str()).unwrap_or(IDENT), 180 _ => SyntaxKind::from_keyword(ident.text.as_str()).unwrap_or(IDENT),
177 }; 181 };
178 182
diff --git a/crates/mbe/src/syntax_bridge.rs b/crates/mbe/src/syntax_bridge.rs
index d987b2500..265c0d63d 100644
--- a/crates/mbe/src/syntax_bridge.rs
+++ b/crates/mbe/src/syntax_bridge.rs
@@ -380,7 +380,7 @@ trait TokenConvertor {
380 IDENT => make_leaf!(Ident), 380 IDENT => make_leaf!(Ident),
381 k if k.is_keyword() => make_leaf!(Ident), 381 k if k.is_keyword() => make_leaf!(Ident),
382 k if k.is_literal() => make_leaf!(Literal), 382 k if k.is_literal() => make_leaf!(Literal),
383 LIFETIME => { 383 LIFETIME_IDENT => {
384 let char_unit = TextSize::of('\''); 384 let char_unit = TextSize::of('\'');
385 let r = TextRange::at(range.start(), char_unit); 385 let r = TextRange::at(range.start(), char_unit);
386 let apostrophe = tt::Leaf::from(tt::Punct { 386 let apostrophe = tt::Leaf::from(tt::Punct {
@@ -620,7 +620,7 @@ impl<'a> TreeSink for TtTreeSink<'a> {
620 self.cursor = self.cursor.bump_subtree(); 620 self.cursor = self.cursor.bump_subtree();
621 return; 621 return;
622 } 622 }
623 if kind == LIFETIME { 623 if kind == LIFETIME_IDENT {
624 n_tokens = 2; 624 n_tokens = 2;
625 } 625 }
626 626
diff --git a/crates/parser/src/grammar.rs b/crates/parser/src/grammar.rs
index 116b991a8..23039eba4 100644
--- a/crates/parser/src/grammar.rs
+++ b/crates/parser/src/grammar.rs
@@ -283,6 +283,13 @@ fn name_ref_or_index(p: &mut Parser) {
283 m.complete(p, NAME_REF); 283 m.complete(p, NAME_REF);
284} 284}
285 285
286fn lifetime(p: &mut Parser) {
287 assert!(p.at(LIFETIME_IDENT));
288 let m = p.start();
289 p.bump(LIFETIME_IDENT);
290 m.complete(p, LIFETIME);
291}
292
286fn error_block(p: &mut Parser, message: &str) { 293fn error_block(p: &mut Parser, message: &str) {
287 assert!(p.at(T!['{'])); 294 assert!(p.at(T!['{']));
288 let m = p.start(); 295 let m = p.start();
diff --git a/crates/parser/src/grammar/expressions/atom.rs b/crates/parser/src/grammar/expressions/atom.rs
index 31f42f161..18b63feb7 100644
--- a/crates/parser/src/grammar/expressions/atom.rs
+++ b/crates/parser/src/grammar/expressions/atom.rs
@@ -48,7 +48,7 @@ pub(super) const ATOM_EXPR_FIRST: TokenSet =
48 T![try], 48 T![try],
49 T![loop], 49 T![loop],
50 T![for], 50 T![for],
51 LIFETIME, 51 LIFETIME_IDENT,
52 ])); 52 ]));
53 53
54const EXPR_RECOVERY_SET: TokenSet = TokenSet::new(&[LET_KW, R_DOLLAR]); 54const EXPR_RECOVERY_SET: TokenSet = TokenSet::new(&[LET_KW, R_DOLLAR]);
@@ -75,7 +75,7 @@ pub(super) fn atom_expr(p: &mut Parser, r: Restrictions) -> Option<(CompletedMar
75 T![for] => for_expr(p, None), 75 T![for] => for_expr(p, None),
76 T![while] => while_expr(p, None), 76 T![while] => while_expr(p, None),
77 T![try] => try_block_expr(p, None), 77 T![try] => try_block_expr(p, None),
78 LIFETIME if la == T![:] => { 78 LIFETIME_IDENT if la == T![:] => {
79 let m = p.start(); 79 let m = p.start();
80 label(p); 80 label(p);
81 match p.current() { 81 match p.current() {
@@ -275,9 +275,9 @@ fn if_expr(p: &mut Parser) -> CompletedMarker {
275// 'c: for x in () {} 275// 'c: for x in () {}
276// } 276// }
277fn label(p: &mut Parser) { 277fn label(p: &mut Parser) {
278 assert!(p.at(LIFETIME) && p.nth(1) == T![:]); 278 assert!(p.at(LIFETIME_IDENT) && p.nth(1) == T![:]);
279 let m = p.start(); 279 let m = p.start();
280 p.bump(LIFETIME); 280 lifetime(p);
281 p.bump_any(); 281 p.bump_any();
282 m.complete(p, LABEL); 282 m.complete(p, LABEL);
283} 283}
@@ -501,7 +501,9 @@ fn continue_expr(p: &mut Parser) -> CompletedMarker {
501 assert!(p.at(T![continue])); 501 assert!(p.at(T![continue]));
502 let m = p.start(); 502 let m = p.start();
503 p.bump(T![continue]); 503 p.bump(T![continue]);
504 p.eat(LIFETIME); 504 if p.at(LIFETIME_IDENT) {
505 lifetime(p);
506 }
505 m.complete(p, CONTINUE_EXPR) 507 m.complete(p, CONTINUE_EXPR)
506} 508}
507 509
@@ -518,7 +520,9 @@ fn break_expr(p: &mut Parser, r: Restrictions) -> CompletedMarker {
518 assert!(p.at(T![break])); 520 assert!(p.at(T![break]));
519 let m = p.start(); 521 let m = p.start();
520 p.bump(T![break]); 522 p.bump(T![break]);
521 p.eat(LIFETIME); 523 if p.at(LIFETIME_IDENT) {
524 lifetime(p);
525 }
522 // test break_ambiguity 526 // test break_ambiguity
523 // fn foo(){ 527 // fn foo(){
524 // if break {} 528 // if break {}
diff --git a/crates/parser/src/grammar/items/traits.rs b/crates/parser/src/grammar/items/traits.rs
index 8394020da..ab9a12b4d 100644
--- a/crates/parser/src/grammar/items/traits.rs
+++ b/crates/parser/src/grammar/items/traits.rs
@@ -98,10 +98,10 @@ fn choose_type_params_over_qpath(p: &Parser) -> bool {
98 // `<` `>` - empty generic parameters 98 // `<` `>` - empty generic parameters
99 // `<` `#` - generic parameters with attributes 99 // `<` `#` - generic parameters with attributes
100 // `<` `const` - const generic parameters 100 // `<` `const` - const generic parameters
101 // `<` (LIFETIME|IDENT) `>` - single generic parameter 101 // `<` (LIFETIME_IDENT|IDENT) `>` - single generic parameter
102 // `<` (LIFETIME|IDENT) `,` - first generic parameter in a list 102 // `<` (LIFETIME_IDENT|IDENT) `,` - first generic parameter in a list
103 // `<` (LIFETIME|IDENT) `:` - generic parameter with bounds 103 // `<` (LIFETIME_IDENT|IDENT) `:` - generic parameter with bounds
104 // `<` (LIFETIME|IDENT) `=` - generic parameter with a default 104 // `<` (LIFETIME_IDENT|IDENT) `=` - generic parameter with a default
105 // The only truly ambiguous case is 105 // The only truly ambiguous case is
106 // `<` IDENT `>` `::` IDENT ... 106 // `<` IDENT `>` `::` IDENT ...
107 // we disambiguate it in favor of generics (`impl<T> ::absolute::Path<T> { ... }`) 107 // we disambiguate it in favor of generics (`impl<T> ::absolute::Path<T> { ... }`)
@@ -113,7 +113,7 @@ fn choose_type_params_over_qpath(p: &Parser) -> bool {
113 if p.nth(1) == T![#] || p.nth(1) == T![>] || p.nth(1) == CONST_KW { 113 if p.nth(1) == T![#] || p.nth(1) == T![>] || p.nth(1) == CONST_KW {
114 return true; 114 return true;
115 } 115 }
116 (p.nth(1) == LIFETIME || p.nth(1) == IDENT) 116 (p.nth(1) == LIFETIME_IDENT || p.nth(1) == IDENT)
117 && (p.nth(2) == T![>] || p.nth(2) == T![,] || p.nth(2) == T![:] || p.nth(2) == T![=]) 117 && (p.nth(2) == T![>] || p.nth(2) == T![,] || p.nth(2) == T![:] || p.nth(2) == T![=])
118} 118}
119 119
diff --git a/crates/parser/src/grammar/params.rs b/crates/parser/src/grammar/params.rs
index a665ffc13..3ee4e4fca 100644
--- a/crates/parser/src/grammar/params.rs
+++ b/crates/parser/src/grammar/params.rs
@@ -169,15 +169,20 @@ fn opt_self_param(p: &mut Parser) {
169 let la1 = p.nth(1); 169 let la1 = p.nth(1);
170 let la2 = p.nth(2); 170 let la2 = p.nth(2);
171 let la3 = p.nth(3); 171 let la3 = p.nth(3);
172 let n_toks = match (p.current(), la1, la2, la3) { 172 let mut n_toks = match (p.current(), la1, la2, la3) {
173 (T![&], T![self], _, _) => 2, 173 (T![&], T![self], _, _) => 2,
174 (T![&], T![mut], T![self], _) => 3, 174 (T![&], T![mut], T![self], _) => 3,
175 (T![&], LIFETIME, T![self], _) => 3, 175 (T![&], LIFETIME_IDENT, T![self], _) => 3,
176 (T![&], LIFETIME, T![mut], T![self]) => 4, 176 (T![&], LIFETIME_IDENT, T![mut], T![self]) => 4,
177 _ => return, 177 _ => return,
178 }; 178 };
179 m = p.start(); 179 m = p.start();
180 for _ in 0..n_toks { 180 p.bump_any();
181 if p.at(LIFETIME_IDENT) {
182 lifetime(p);
183 n_toks -= 1;
184 }
185 for _ in 1..n_toks {
181 p.bump_any(); 186 p.bump_any();
182 } 187 }
183 } 188 }
diff --git a/crates/parser/src/grammar/type_args.rs b/crates/parser/src/grammar/type_args.rs
index f2d34a749..a013c49b9 100644
--- a/crates/parser/src/grammar/type_args.rs
+++ b/crates/parser/src/grammar/type_args.rs
@@ -30,8 +30,8 @@ pub(super) fn opt_generic_arg_list(p: &mut Parser, colon_colon_required: bool) {
30fn generic_arg(p: &mut Parser) { 30fn generic_arg(p: &mut Parser) {
31 let m = p.start(); 31 let m = p.start();
32 match p.current() { 32 match p.current() {
33 LIFETIME => { 33 LIFETIME_IDENT => {
34 p.bump(LIFETIME); 34 lifetime(p);
35 m.complete(p, LIFETIME_ARG); 35 m.complete(p, LIFETIME_ARG);
36 } 36 }
37 // test associated_type_bounds 37 // test associated_type_bounds
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 {
diff --git a/crates/parser/src/grammar/types.rs b/crates/parser/src/grammar/types.rs
index 1ea130ac5..36a15eace 100644
--- a/crates/parser/src/grammar/types.rs
+++ b/crates/parser/src/grammar/types.rs
@@ -167,7 +167,9 @@ fn ref_type(p: &mut Parser) {
167 assert!(p.at(T![&])); 167 assert!(p.at(T![&]));
168 let m = p.start(); 168 let m = p.start();
169 p.bump(T![&]); 169 p.bump(T![&]);
170 p.eat(LIFETIME); 170 if p.at(LIFETIME_IDENT) {
171 lifetime(p);
172 }
171 p.eat(T![mut]); 173 p.eat(T![mut]);
172 type_no_bounds(p); 174 type_no_bounds(p);
173 m.complete(p, REF_TYPE); 175 m.complete(p, REF_TYPE);
diff --git a/crates/parser/src/syntax_kind/generated.rs b/crates/parser/src/syntax_kind/generated.rs
index 5d6ec17a4..980aa5979 100644
--- a/crates/parser/src/syntax_kind/generated.rs
+++ b/crates/parser/src/syntax_kind/generated.rs
@@ -116,7 +116,7 @@ pub enum SyntaxKind {
116 ERROR, 116 ERROR,
117 IDENT, 117 IDENT,
118 WHITESPACE, 118 WHITESPACE,
119 LIFETIME, 119 LIFETIME_IDENT,
120 COMMENT, 120 COMMENT,
121 SHEBANG, 121 SHEBANG,
122 L_DOLLAR, 122 L_DOLLAR,
@@ -237,6 +237,7 @@ pub enum SyntaxKind {
237 TYPE_PARAM, 237 TYPE_PARAM,
238 CONST_PARAM, 238 CONST_PARAM,
239 GENERIC_ARG_LIST, 239 GENERIC_ARG_LIST,
240 LIFETIME,
240 LIFETIME_ARG, 241 LIFETIME_ARG,
241 TYPE_ARG, 242 TYPE_ARG,
242 ASSOC_TYPE_ARG, 243 ASSOC_TYPE_ARG,
@@ -364,4 +365,4 @@ impl SyntaxKind {
364 } 365 }
365} 366}
366#[macro_export] 367#[macro_export]
367macro_rules ! T { [;] => { $ crate :: SyntaxKind :: SEMICOLON } ; [,] => { $ crate :: SyntaxKind :: COMMA } ; ['('] => { $ crate :: SyntaxKind :: L_PAREN } ; [')'] => { $ crate :: SyntaxKind :: R_PAREN } ; ['{'] => { $ crate :: SyntaxKind :: L_CURLY } ; ['}'] => { $ crate :: SyntaxKind :: R_CURLY } ; ['['] => { $ crate :: SyntaxKind :: L_BRACK } ; [']'] => { $ crate :: SyntaxKind :: R_BRACK } ; [<] => { $ crate :: SyntaxKind :: L_ANGLE } ; [>] => { $ crate :: SyntaxKind :: R_ANGLE } ; [@] => { $ crate :: SyntaxKind :: AT } ; [#] => { $ crate :: SyntaxKind :: POUND } ; [~] => { $ crate :: SyntaxKind :: TILDE } ; [?] => { $ crate :: SyntaxKind :: QUESTION } ; [$] => { $ crate :: SyntaxKind :: DOLLAR } ; [&] => { $ crate :: SyntaxKind :: AMP } ; [|] => { $ crate :: SyntaxKind :: PIPE } ; [+] => { $ crate :: SyntaxKind :: PLUS } ; [*] => { $ crate :: SyntaxKind :: STAR } ; [/] => { $ crate :: SyntaxKind :: SLASH } ; [^] => { $ crate :: SyntaxKind :: CARET } ; [%] => { $ crate :: SyntaxKind :: PERCENT } ; [_] => { $ crate :: SyntaxKind :: UNDERSCORE } ; [.] => { $ crate :: SyntaxKind :: DOT } ; [..] => { $ crate :: SyntaxKind :: DOT2 } ; [...] => { $ crate :: SyntaxKind :: DOT3 } ; [..=] => { $ crate :: SyntaxKind :: DOT2EQ } ; [:] => { $ crate :: SyntaxKind :: COLON } ; [::] => { $ crate :: SyntaxKind :: COLON2 } ; [=] => { $ crate :: SyntaxKind :: EQ } ; [==] => { $ crate :: SyntaxKind :: EQ2 } ; [=>] => { $ crate :: SyntaxKind :: FAT_ARROW } ; [!] => { $ crate :: SyntaxKind :: BANG } ; [!=] => { $ crate :: SyntaxKind :: NEQ } ; [-] => { $ crate :: SyntaxKind :: MINUS } ; [->] => { $ crate :: SyntaxKind :: THIN_ARROW } ; [<=] => { $ crate :: SyntaxKind :: LTEQ } ; [>=] => { $ crate :: SyntaxKind :: GTEQ } ; [+=] => { $ crate :: SyntaxKind :: PLUSEQ } ; [-=] => { $ crate :: SyntaxKind :: MINUSEQ } ; [|=] => { $ crate :: SyntaxKind :: PIPEEQ } ; [&=] => { $ crate :: SyntaxKind :: AMPEQ } ; [^=] => { $ crate :: SyntaxKind :: CARETEQ } ; [/=] => { $ crate :: SyntaxKind :: SLASHEQ } ; [*=] => { $ crate :: SyntaxKind :: STAREQ } ; [%=] => { $ crate :: SyntaxKind :: PERCENTEQ } ; [&&] => { $ crate :: SyntaxKind :: AMP2 } ; [||] => { $ crate :: SyntaxKind :: PIPE2 } ; [<<] => { $ crate :: SyntaxKind :: SHL } ; [>>] => { $ crate :: SyntaxKind :: SHR } ; [<<=] => { $ crate :: SyntaxKind :: SHLEQ } ; [>>=] => { $ crate :: SyntaxKind :: SHREQ } ; [as] => { $ crate :: SyntaxKind :: AS_KW } ; [async] => { $ crate :: SyntaxKind :: ASYNC_KW } ; [await] => { $ crate :: SyntaxKind :: AWAIT_KW } ; [box] => { $ crate :: SyntaxKind :: BOX_KW } ; [break] => { $ crate :: SyntaxKind :: BREAK_KW } ; [const] => { $ crate :: SyntaxKind :: CONST_KW } ; [continue] => { $ crate :: SyntaxKind :: CONTINUE_KW } ; [crate] => { $ crate :: SyntaxKind :: CRATE_KW } ; [dyn] => { $ crate :: SyntaxKind :: DYN_KW } ; [else] => { $ crate :: SyntaxKind :: ELSE_KW } ; [enum] => { $ crate :: SyntaxKind :: ENUM_KW } ; [extern] => { $ crate :: SyntaxKind :: EXTERN_KW } ; [false] => { $ crate :: SyntaxKind :: FALSE_KW } ; [fn] => { $ crate :: SyntaxKind :: FN_KW } ; [for] => { $ crate :: SyntaxKind :: FOR_KW } ; [if] => { $ crate :: SyntaxKind :: IF_KW } ; [impl] => { $ crate :: SyntaxKind :: IMPL_KW } ; [in] => { $ crate :: SyntaxKind :: IN_KW } ; [let] => { $ crate :: SyntaxKind :: LET_KW } ; [loop] => { $ crate :: SyntaxKind :: LOOP_KW } ; [macro] => { $ crate :: SyntaxKind :: MACRO_KW } ; [match] => { $ crate :: SyntaxKind :: MATCH_KW } ; [mod] => { $ crate :: SyntaxKind :: MOD_KW } ; [move] => { $ crate :: SyntaxKind :: MOVE_KW } ; [mut] => { $ crate :: SyntaxKind :: MUT_KW } ; [pub] => { $ crate :: SyntaxKind :: PUB_KW } ; [ref] => { $ crate :: SyntaxKind :: REF_KW } ; [return] => { $ crate :: SyntaxKind :: RETURN_KW } ; [self] => { $ crate :: SyntaxKind :: SELF_KW } ; [static] => { $ crate :: SyntaxKind :: STATIC_KW } ; [struct] => { $ crate :: SyntaxKind :: STRUCT_KW } ; [super] => { $ crate :: SyntaxKind :: SUPER_KW } ; [trait] => { $ crate :: SyntaxKind :: TRAIT_KW } ; [true] => { $ crate :: SyntaxKind :: TRUE_KW } ; [try] => { $ crate :: SyntaxKind :: TRY_KW } ; [type] => { $ crate :: SyntaxKind :: TYPE_KW } ; [unsafe] => { $ crate :: SyntaxKind :: UNSAFE_KW } ; [use] => { $ crate :: SyntaxKind :: USE_KW } ; [where] => { $ crate :: SyntaxKind :: WHERE_KW } ; [while] => { $ crate :: SyntaxKind :: WHILE_KW } ; [auto] => { $ crate :: SyntaxKind :: AUTO_KW } ; [default] => { $ crate :: SyntaxKind :: DEFAULT_KW } ; [existential] => { $ crate :: SyntaxKind :: EXISTENTIAL_KW } ; [union] => { $ crate :: SyntaxKind :: UNION_KW } ; [raw] => { $ crate :: SyntaxKind :: RAW_KW } ; [macro_rules] => { $ crate :: SyntaxKind :: MACRO_RULES_KW } ; [lifetime] => { $ crate :: SyntaxKind :: LIFETIME } ; [ident] => { $ crate :: SyntaxKind :: IDENT } ; [shebang] => { $ crate :: SyntaxKind :: SHEBANG } ; } 368macro_rules ! T { [;] => { $ crate :: SyntaxKind :: SEMICOLON } ; [,] => { $ crate :: SyntaxKind :: COMMA } ; ['('] => { $ crate :: SyntaxKind :: L_PAREN } ; [')'] => { $ crate :: SyntaxKind :: R_PAREN } ; ['{'] => { $ crate :: SyntaxKind :: L_CURLY } ; ['}'] => { $ crate :: SyntaxKind :: R_CURLY } ; ['['] => { $ crate :: SyntaxKind :: L_BRACK } ; [']'] => { $ crate :: SyntaxKind :: R_BRACK } ; [<] => { $ crate :: SyntaxKind :: L_ANGLE } ; [>] => { $ crate :: SyntaxKind :: R_ANGLE } ; [@] => { $ crate :: SyntaxKind :: AT } ; [#] => { $ crate :: SyntaxKind :: POUND } ; [~] => { $ crate :: SyntaxKind :: TILDE } ; [?] => { $ crate :: SyntaxKind :: QUESTION } ; [$] => { $ crate :: SyntaxKind :: DOLLAR } ; [&] => { $ crate :: SyntaxKind :: AMP } ; [|] => { $ crate :: SyntaxKind :: PIPE } ; [+] => { $ crate :: SyntaxKind :: PLUS } ; [*] => { $ crate :: SyntaxKind :: STAR } ; [/] => { $ crate :: SyntaxKind :: SLASH } ; [^] => { $ crate :: SyntaxKind :: CARET } ; [%] => { $ crate :: SyntaxKind :: PERCENT } ; [_] => { $ crate :: SyntaxKind :: UNDERSCORE } ; [.] => { $ crate :: SyntaxKind :: DOT } ; [..] => { $ crate :: SyntaxKind :: DOT2 } ; [...] => { $ crate :: SyntaxKind :: DOT3 } ; [..=] => { $ crate :: SyntaxKind :: DOT2EQ } ; [:] => { $ crate :: SyntaxKind :: COLON } ; [::] => { $ crate :: SyntaxKind :: COLON2 } ; [=] => { $ crate :: SyntaxKind :: EQ } ; [==] => { $ crate :: SyntaxKind :: EQ2 } ; [=>] => { $ crate :: SyntaxKind :: FAT_ARROW } ; [!] => { $ crate :: SyntaxKind :: BANG } ; [!=] => { $ crate :: SyntaxKind :: NEQ } ; [-] => { $ crate :: SyntaxKind :: MINUS } ; [->] => { $ crate :: SyntaxKind :: THIN_ARROW } ; [<=] => { $ crate :: SyntaxKind :: LTEQ } ; [>=] => { $ crate :: SyntaxKind :: GTEQ } ; [+=] => { $ crate :: SyntaxKind :: PLUSEQ } ; [-=] => { $ crate :: SyntaxKind :: MINUSEQ } ; [|=] => { $ crate :: SyntaxKind :: PIPEEQ } ; [&=] => { $ crate :: SyntaxKind :: AMPEQ } ; [^=] => { $ crate :: SyntaxKind :: CARETEQ } ; [/=] => { $ crate :: SyntaxKind :: SLASHEQ } ; [*=] => { $ crate :: SyntaxKind :: STAREQ } ; [%=] => { $ crate :: SyntaxKind :: PERCENTEQ } ; [&&] => { $ crate :: SyntaxKind :: AMP2 } ; [||] => { $ crate :: SyntaxKind :: PIPE2 } ; [<<] => { $ crate :: SyntaxKind :: SHL } ; [>>] => { $ crate :: SyntaxKind :: SHR } ; [<<=] => { $ crate :: SyntaxKind :: SHLEQ } ; [>>=] => { $ crate :: SyntaxKind :: SHREQ } ; [as] => { $ crate :: SyntaxKind :: AS_KW } ; [async] => { $ crate :: SyntaxKind :: ASYNC_KW } ; [await] => { $ crate :: SyntaxKind :: AWAIT_KW } ; [box] => { $ crate :: SyntaxKind :: BOX_KW } ; [break] => { $ crate :: SyntaxKind :: BREAK_KW } ; [const] => { $ crate :: SyntaxKind :: CONST_KW } ; [continue] => { $ crate :: SyntaxKind :: CONTINUE_KW } ; [crate] => { $ crate :: SyntaxKind :: CRATE_KW } ; [dyn] => { $ crate :: SyntaxKind :: DYN_KW } ; [else] => { $ crate :: SyntaxKind :: ELSE_KW } ; [enum] => { $ crate :: SyntaxKind :: ENUM_KW } ; [extern] => { $ crate :: SyntaxKind :: EXTERN_KW } ; [false] => { $ crate :: SyntaxKind :: FALSE_KW } ; [fn] => { $ crate :: SyntaxKind :: FN_KW } ; [for] => { $ crate :: SyntaxKind :: FOR_KW } ; [if] => { $ crate :: SyntaxKind :: IF_KW } ; [impl] => { $ crate :: SyntaxKind :: IMPL_KW } ; [in] => { $ crate :: SyntaxKind :: IN_KW } ; [let] => { $ crate :: SyntaxKind :: LET_KW } ; [loop] => { $ crate :: SyntaxKind :: LOOP_KW } ; [macro] => { $ crate :: SyntaxKind :: MACRO_KW } ; [match] => { $ crate :: SyntaxKind :: MATCH_KW } ; [mod] => { $ crate :: SyntaxKind :: MOD_KW } ; [move] => { $ crate :: SyntaxKind :: MOVE_KW } ; [mut] => { $ crate :: SyntaxKind :: MUT_KW } ; [pub] => { $ crate :: SyntaxKind :: PUB_KW } ; [ref] => { $ crate :: SyntaxKind :: REF_KW } ; [return] => { $ crate :: SyntaxKind :: RETURN_KW } ; [self] => { $ crate :: SyntaxKind :: SELF_KW } ; [static] => { $ crate :: SyntaxKind :: STATIC_KW } ; [struct] => { $ crate :: SyntaxKind :: STRUCT_KW } ; [super] => { $ crate :: SyntaxKind :: SUPER_KW } ; [trait] => { $ crate :: SyntaxKind :: TRAIT_KW } ; [true] => { $ crate :: SyntaxKind :: TRUE_KW } ; [try] => { $ crate :: SyntaxKind :: TRY_KW } ; [type] => { $ crate :: SyntaxKind :: TYPE_KW } ; [unsafe] => { $ crate :: SyntaxKind :: UNSAFE_KW } ; [use] => { $ crate :: SyntaxKind :: USE_KW } ; [where] => { $ crate :: SyntaxKind :: WHERE_KW } ; [while] => { $ crate :: SyntaxKind :: WHILE_KW } ; [auto] => { $ crate :: SyntaxKind :: AUTO_KW } ; [default] => { $ crate :: SyntaxKind :: DEFAULT_KW } ; [existential] => { $ crate :: SyntaxKind :: EXISTENTIAL_KW } ; [union] => { $ crate :: SyntaxKind :: UNION_KW } ; [raw] => { $ crate :: SyntaxKind :: RAW_KW } ; [macro_rules] => { $ crate :: SyntaxKind :: MACRO_RULES_KW } ; [lifetime_ident] => { $ crate :: SyntaxKind :: LIFETIME_IDENT } ; [ident] => { $ crate :: SyntaxKind :: IDENT } ; [shebang] => { $ crate :: SyntaxKind :: SHEBANG } ; }
diff --git a/crates/syntax/src/ast.rs b/crates/syntax/src/ast.rs
index 70c568ea1..83de067d9 100644
--- a/crates/syntax/src/ast.rs
+++ b/crates/syntax/src/ast.rs
@@ -311,7 +311,7 @@ where
311 let pred = predicates.next().unwrap(); 311 let pred = predicates.next().unwrap();
312 let mut bounds = pred.type_bound_list().unwrap().bounds(); 312 let mut bounds = pred.type_bound_list().unwrap().bounds();
313 313
314 assert_eq!("'a", pred.lifetime_token().unwrap().text()); 314 assert_eq!("'a", pred.lifetime().unwrap().lifetime_ident_token().unwrap().text());
315 315
316 assert_bound("'b", bounds.next()); 316 assert_bound("'b", bounds.next());
317 assert_bound("'c", bounds.next()); 317 assert_bound("'c", bounds.next());
diff --git a/crates/syntax/src/ast/generated/nodes.rs b/crates/syntax/src/ast/generated/nodes.rs
index 6eae323f4..1588ba93e 100644
--- a/crates/syntax/src/ast/generated/nodes.rs
+++ b/crates/syntax/src/ast/generated/nodes.rs
@@ -20,6 +20,15 @@ impl NameRef {
20 pub fn ident_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![ident]) } 20 pub fn ident_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![ident]) }
21} 21}
22#[derive(Debug, Clone, PartialEq, Eq, Hash)] 22#[derive(Debug, Clone, PartialEq, Eq, Hash)]
23pub struct Lifetime {
24 pub(crate) syntax: SyntaxNode,
25}
26impl Lifetime {
27 pub fn lifetime_ident_token(&self) -> Option<SyntaxToken> {
28 support::token(&self.syntax, T![lifetime_ident])
29 }
30}
31#[derive(Debug, Clone, PartialEq, Eq, Hash)]
23pub struct Path { 32pub struct Path {
24 pub(crate) syntax: SyntaxNode, 33 pub(crate) syntax: SyntaxNode,
25} 34}
@@ -105,9 +114,7 @@ pub struct LifetimeArg {
105 pub(crate) syntax: SyntaxNode, 114 pub(crate) syntax: SyntaxNode,
106} 115}
107impl LifetimeArg { 116impl LifetimeArg {
108 pub fn lifetime_token(&self) -> Option<SyntaxToken> { 117 pub fn lifetime(&self) -> Option<Lifetime> { support::child(&self.syntax) }
109 support::token(&self.syntax, T![lifetime])
110 }
111} 118}
112#[derive(Debug, Clone, PartialEq, Eq, Hash)] 119#[derive(Debug, Clone, PartialEq, Eq, Hash)]
113pub struct ConstArg { 120pub struct ConstArg {
@@ -487,9 +494,7 @@ pub struct SelfParam {
487impl ast::AttrsOwner for SelfParam {} 494impl ast::AttrsOwner for SelfParam {}
488impl SelfParam { 495impl SelfParam {
489 pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) } 496 pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) }
490 pub fn lifetime_token(&self) -> Option<SyntaxToken> { 497 pub fn lifetime(&self) -> Option<Lifetime> { support::child(&self.syntax) }
491 support::token(&self.syntax, T![lifetime])
492 }
493 pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } 498 pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) }
494 pub fn self_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![self]) } 499 pub fn self_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![self]) }
495 pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } 500 pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) }
@@ -605,9 +610,7 @@ pub struct LifetimeParam {
605impl ast::AttrsOwner for LifetimeParam {} 610impl ast::AttrsOwner for LifetimeParam {}
606impl ast::TypeBoundsOwner for LifetimeParam {} 611impl ast::TypeBoundsOwner for LifetimeParam {}
607impl LifetimeParam { 612impl LifetimeParam {
608 pub fn lifetime_token(&self) -> Option<SyntaxToken> { 613 pub fn lifetime(&self) -> Option<Lifetime> { support::child(&self.syntax) }
609 support::token(&self.syntax, T![lifetime])
610 }
611} 614}
612#[derive(Debug, Clone, PartialEq, Eq, Hash)] 615#[derive(Debug, Clone, PartialEq, Eq, Hash)]
613pub struct TypeParam { 616pub struct TypeParam {
@@ -628,9 +631,7 @@ impl ast::TypeBoundsOwner for WherePred {}
628impl WherePred { 631impl WherePred {
629 pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) } 632 pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) }
630 pub fn generic_param_list(&self) -> Option<GenericParamList> { support::child(&self.syntax) } 633 pub fn generic_param_list(&self) -> Option<GenericParamList> { support::child(&self.syntax) }
631 pub fn lifetime_token(&self) -> Option<SyntaxToken> { 634 pub fn lifetime(&self) -> Option<Lifetime> { support::child(&self.syntax) }
632 support::token(&self.syntax, T![lifetime])
633 }
634 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } 635 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
635} 636}
636#[derive(Debug, Clone, PartialEq, Eq, Hash)] 637#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -706,9 +707,7 @@ pub struct BreakExpr {
706impl ast::AttrsOwner for BreakExpr {} 707impl ast::AttrsOwner for BreakExpr {}
707impl BreakExpr { 708impl BreakExpr {
708 pub fn break_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![break]) } 709 pub fn break_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![break]) }
709 pub fn lifetime_token(&self) -> Option<SyntaxToken> { 710 pub fn lifetime(&self) -> Option<Lifetime> { support::child(&self.syntax) }
710 support::token(&self.syntax, T![lifetime])
711 }
712 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } 711 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
713} 712}
714#[derive(Debug, Clone, PartialEq, Eq, Hash)] 713#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -752,9 +751,7 @@ impl ContinueExpr {
752 pub fn continue_token(&self) -> Option<SyntaxToken> { 751 pub fn continue_token(&self) -> Option<SyntaxToken> {
753 support::token(&self.syntax, T![continue]) 752 support::token(&self.syntax, T![continue])
754 } 753 }
755 pub fn lifetime_token(&self) -> Option<SyntaxToken> { 754 pub fn lifetime(&self) -> Option<Lifetime> { support::child(&self.syntax) }
756 support::token(&self.syntax, T![lifetime])
757 }
758} 755}
759#[derive(Debug, Clone, PartialEq, Eq, Hash)] 756#[derive(Debug, Clone, PartialEq, Eq, Hash)]
760pub struct EffectExpr { 757pub struct EffectExpr {
@@ -937,9 +934,8 @@ pub struct Label {
937 pub(crate) syntax: SyntaxNode, 934 pub(crate) syntax: SyntaxNode,
938} 935}
939impl Label { 936impl Label {
940 pub fn lifetime_token(&self) -> Option<SyntaxToken> { 937 pub fn lifetime(&self) -> Option<Lifetime> { support::child(&self.syntax) }
941 support::token(&self.syntax, T![lifetime]) 938 pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) }
942 }
943} 939}
944#[derive(Debug, Clone, PartialEq, Eq, Hash)] 940#[derive(Debug, Clone, PartialEq, Eq, Hash)]
945pub struct RecordExprFieldList { 941pub struct RecordExprFieldList {
@@ -1100,9 +1096,7 @@ pub struct RefType {
1100} 1096}
1101impl RefType { 1097impl RefType {
1102 pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) } 1098 pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) }
1103 pub fn lifetime_token(&self) -> Option<SyntaxToken> { 1099 pub fn lifetime(&self) -> Option<Lifetime> { support::child(&self.syntax) }
1104 support::token(&self.syntax, T![lifetime])
1105 }
1106 pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } 1100 pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) }
1107 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } 1101 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
1108} 1102}
@@ -1129,9 +1123,7 @@ pub struct TypeBound {
1129 pub(crate) syntax: SyntaxNode, 1123 pub(crate) syntax: SyntaxNode,
1130} 1124}
1131impl TypeBound { 1125impl TypeBound {
1132 pub fn lifetime_token(&self) -> Option<SyntaxToken> { 1126 pub fn lifetime(&self) -> Option<Lifetime> { support::child(&self.syntax) }
1133 support::token(&self.syntax, T![lifetime])
1134 }
1135 pub fn question_mark_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![?]) } 1127 pub fn question_mark_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![?]) }
1136 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } 1128 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
1137} 1129}
@@ -1438,6 +1430,17 @@ impl AstNode for NameRef {
1438 } 1430 }
1439 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1431 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1440} 1432}
1433impl AstNode for Lifetime {
1434 fn can_cast(kind: SyntaxKind) -> bool { kind == LIFETIME }
1435 fn cast(syntax: SyntaxNode) -> Option<Self> {
1436 if Self::can_cast(syntax.kind()) {
1437 Some(Self { syntax })
1438 } else {
1439 None
1440 }
1441 }
1442 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1443}
1441impl AstNode for Path { 1444impl AstNode for Path {
1442 fn can_cast(kind: SyntaxKind) -> bool { kind == PATH } 1445 fn can_cast(kind: SyntaxKind) -> bool { kind == PATH }
1443 fn cast(syntax: SyntaxNode) -> Option<Self> { 1446 fn cast(syntax: SyntaxNode) -> Option<Self> {
@@ -3524,6 +3527,11 @@ impl std::fmt::Display for NameRef {
3524 std::fmt::Display::fmt(self.syntax(), f) 3527 std::fmt::Display::fmt(self.syntax(), f)
3525 } 3528 }
3526} 3529}
3530impl std::fmt::Display for Lifetime {
3531 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3532 std::fmt::Display::fmt(self.syntax(), f)
3533 }
3534}
3527impl std::fmt::Display for Path { 3535impl std::fmt::Display for Path {
3528 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3536 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3529 std::fmt::Display::fmt(self.syntax(), f) 3537 std::fmt::Display::fmt(self.syntax(), f)
diff --git a/crates/syntax/src/ast/node_ext.rs b/crates/syntax/src/ast/node_ext.rs
index 40dec3c7f..c45cb514a 100644
--- a/crates/syntax/src/ast/node_ext.rs
+++ b/crates/syntax/src/ast/node_ext.rs
@@ -12,6 +12,12 @@ use crate::{
12 SmolStr, SyntaxElement, SyntaxToken, T, 12 SmolStr, SyntaxElement, SyntaxToken, T,
13}; 13};
14 14
15impl ast::Lifetime {
16 pub fn text(&self) -> &SmolStr {
17 text_of_first_token(self.syntax())
18 }
19}
20
15impl ast::Name { 21impl ast::Name {
16 pub fn text(&self) -> &SmolStr { 22 pub fn text(&self) -> &SmolStr {
17 text_of_first_token(self.syntax()) 23 text_of_first_token(self.syntax())
@@ -393,7 +399,7 @@ pub enum TypeBoundKind {
393 /// for<'a> ... 399 /// for<'a> ...
394 ForType(ast::ForType), 400 ForType(ast::ForType),
395 /// 'a 401 /// 'a
396 Lifetime(SyntaxToken), 402 Lifetime(ast::Lifetime),
397} 403}
398 404
399impl ast::TypeBound { 405impl ast::TypeBound {
@@ -402,7 +408,7 @@ impl ast::TypeBound {
402 TypeBoundKind::PathType(path_type) 408 TypeBoundKind::PathType(path_type)
403 } else if let Some(for_type) = support::children(self.syntax()).next() { 409 } else if let Some(for_type) = support::children(self.syntax()).next() {
404 TypeBoundKind::ForType(for_type) 410 TypeBoundKind::ForType(for_type)
405 } else if let Some(lifetime) = self.lifetime_token() { 411 } else if let Some(lifetime) = self.lifetime() {
406 TypeBoundKind::Lifetime(lifetime) 412 TypeBoundKind::Lifetime(lifetime)
407 } else { 413 } else {
408 unreachable!() 414 unreachable!()
@@ -440,7 +446,7 @@ impl ast::LifetimeParam {
440 .children_with_tokens() 446 .children_with_tokens()
441 .filter_map(|it| it.into_token()) 447 .filter_map(|it| it.into_token())
442 .skip_while(|x| x.kind() != T![:]) 448 .skip_while(|x| x.kind() != T![:])
443 .filter(|it| it.kind() == T![lifetime]) 449 .filter(|it| it.kind() == T![lifetime_ident])
444 } 450 }
445} 451}
446 452
diff --git a/crates/syntax/src/parsing/lexer.rs b/crates/syntax/src/parsing/lexer.rs
index 8afd7e53b..0cbba73c5 100644
--- a/crates/syntax/src/parsing/lexer.rs
+++ b/crates/syntax/src/parsing/lexer.rs
@@ -146,9 +146,9 @@ fn rustc_token_kind_to_syntax_kind(
146 rustc_lexer::TokenKind::RawIdent => IDENT, 146 rustc_lexer::TokenKind::RawIdent => IDENT,
147 rustc_lexer::TokenKind::Literal { kind, .. } => return match_literal_kind(&kind), 147 rustc_lexer::TokenKind::Literal { kind, .. } => return match_literal_kind(&kind),
148 148
149 rustc_lexer::TokenKind::Lifetime { starts_with_number: false } => LIFETIME, 149 rustc_lexer::TokenKind::Lifetime { starts_with_number: false } => LIFETIME_IDENT,
150 rustc_lexer::TokenKind::Lifetime { starts_with_number: true } => { 150 rustc_lexer::TokenKind::Lifetime { starts_with_number: true } => {
151 return (LIFETIME, Some("Lifetime name cannot start with a number")) 151 return (LIFETIME_IDENT, Some("Lifetime name cannot start with a number"))
152 } 152 }
153 153
154 rustc_lexer::TokenKind::Semi => T![;], 154 rustc_lexer::TokenKind::Semi => T![;],
diff --git a/crates/syntax/test_data/lexer/err/0057_lifetime_strarts_with_a_number.rs b/crates/syntax/test_data/lexer/err/0057_lifetime_starts_with_a_number.rs
index a7698a404..a7698a404 100644
--- a/crates/syntax/test_data/lexer/err/0057_lifetime_strarts_with_a_number.rs
+++ b/crates/syntax/test_data/lexer/err/0057_lifetime_starts_with_a_number.rs
diff --git a/crates/syntax/test_data/lexer/err/0057_lifetime_strarts_with_a_number.txt b/crates/syntax/test_data/lexer/err/0057_lifetime_starts_with_a_number.txt
index e138bcebc..11e0ae14a 100644
--- a/crates/syntax/test_data/lexer/err/0057_lifetime_strarts_with_a_number.txt
+++ b/crates/syntax/test_data/lexer/err/0057_lifetime_starts_with_a_number.txt
@@ -1,6 +1,6 @@
1LIFETIME 2 "\'1" 1LIFETIME_IDENT 2 "\'1"
2WHITESPACE 1 "\n" 2WHITESPACE 1 "\n"
3LIFETIME 10 "\'1lifetime" 3LIFETIME_IDENT 10 "\'1lifetime"
4WHITESPACE 1 "\n" 4WHITESPACE 1 "\n"
5> error0..2 token("\'1") msg(Lifetime name cannot start with a number) 5> error0..2 token("\'1") msg(Lifetime name cannot start with a number)
6> error3..13 token("\'1lifetime") msg(Lifetime name cannot start with a number) 6> error3..13 token("\'1lifetime") msg(Lifetime name cannot start with a number)
diff --git a/crates/syntax/test_data/lexer/ok/0007_lifetimes.txt b/crates/syntax/test_data/lexer/ok/0007_lifetimes.txt
index 005c29100..4d6625c3a 100644
--- a/crates/syntax/test_data/lexer/ok/0007_lifetimes.txt
+++ b/crates/syntax/test_data/lexer/ok/0007_lifetimes.txt
@@ -1,8 +1,8 @@
1LIFETIME 2 "\'a" 1LIFETIME_IDENT 2 "\'a"
2WHITESPACE 1 " " 2WHITESPACE 1 " "
3LIFETIME 4 "\'foo" 3LIFETIME_IDENT 4 "\'foo"
4WHITESPACE 1 " " 4WHITESPACE 1 " "
5LIFETIME 12 "\'foo_bar_baz" 5LIFETIME_IDENT 12 "\'foo_bar_baz"
6WHITESPACE 1 " " 6WHITESPACE 1 " "
7LIFETIME 2 "\'_" 7LIFETIME_IDENT 2 "\'_"
8WHITESPACE 1 "\n" 8WHITESPACE 1 "\n"
diff --git a/crates/syntax/test_data/parser/err/0024_many_type_parens.rast b/crates/syntax/test_data/parser/err/0024_many_type_parens.rast
index e3be6b22e..4c4ddf5ec 100644
--- a/crates/syntax/test_data/parser/err/0024_many_type_parens.rast
+++ b/crates/syntax/test_data/parser/err/0024_many_type_parens.rast
@@ -42,7 +42,8 @@ [email protected]
42 [email protected] 42 [email protected]
43 [email protected] "<" 43 [email protected] "<"
44 [email protected] 44 [email protected]
45 [email protected] "\'a" 45 [email protected]
46 [email protected] "\'a"
46 [email protected] ">" 47 [email protected] ">"
47 [email protected] " " 48 [email protected] " "
48 [email protected] 49 [email protected]
@@ -53,7 +54,8 @@ [email protected]
53 [email protected] 54 [email protected]
54 [email protected] "<" 55 [email protected] "<"
55 [email protected] 56 [email protected]
56 [email protected] "\'a" 57 [email protected]
58 [email protected] "\'a"
57 [email protected] ">" 59 [email protected] ">"
58 [email protected] ")" 60 [email protected] ")"
59 [email protected] ">" 61 [email protected] ">"
@@ -125,7 +127,8 @@ [email protected]
125 [email protected] 127 [email protected]
126 [email protected] "<" 128 [email protected] "<"
127 [email protected] 129 [email protected]
128 [email protected] "\'a" 130 [email protected]
131 [email protected] "\'a"
129 [email protected] ">" 132 [email protected] ">"
130 [email protected] " " 133 [email protected] " "
131 [email protected] 134 [email protected]
@@ -136,7 +139,8 @@ [email protected]
136 [email protected] 139 [email protected]
137 [email protected] "<" 140 [email protected] "<"
138 [email protected] 141 [email protected]
139 [email protected] "\'a" 142 [email protected]
143 [email protected] "\'a"
140 [email protected] ">" 144 [email protected] ">"
141 [email protected] ")" 145 [email protected] ")"
142 [email protected] 146 [email protected]
@@ -187,7 +191,7 @@ [email protected]
187 [email protected] 191 [email protected]
188 [email protected] "<" 192 [email protected] "<"
189 [email protected] 193 [email protected]
190 [email protected] "\'a" 194 LIFETIME_IDENT@155..157 "\'a"
191 [email protected] ">" 195 [email protected] ">"
192 [email protected] " " 196 [email protected] " "
193 [email protected] 197 [email protected]
@@ -201,7 +205,7 @@ [email protected]
201 [email protected] "Trait" 205 [email protected] "Trait"
202 [email protected] "<" 206 [email protected] "<"
203 [email protected] 207 [email protected]
204 [email protected] "\'a" 208 LIFETIME_IDENT@165..167 "\'a"
205 [email protected] ">" 209 [email protected] ">"
206 [email protected] 210 [email protected]
207 [email protected] ")" 211 [email protected] ")"
@@ -245,7 +249,8 @@ [email protected]
245 [email protected] 249 [email protected]
246 [email protected] "<" 250 [email protected] "<"
247 [email protected] 251 [email protected]
248 [email protected] "\'a" 252 [email protected]
253 [email protected] "\'a"
249 [email protected] ">" 254 [email protected] ">"
250 [email protected] " " 255 [email protected] " "
251 [email protected] 256 [email protected]
@@ -256,7 +261,8 @@ [email protected]
256 [email protected] 261 [email protected]
257 [email protected] "<" 262 [email protected] "<"
258 [email protected] 263 [email protected]
259 [email protected] "\'a" 264 [email protected]
265 [email protected] "\'a"
260 [email protected] ">" 266 [email protected] ">"
261 [email protected] ")" 267 [email protected] ")"
262 [email protected] " " 268 [email protected] " "
diff --git a/crates/syntax/test_data/parser/err/0027_incomplere_where_for.rast b/crates/syntax/test_data/parser/err/0027_incomplere_where_for.rast
index a8e42e6ea..c5215d6b1 100644
--- a/crates/syntax/test_data/parser/err/0027_incomplere_where_for.rast
+++ b/crates/syntax/test_data/parser/err/0027_incomplere_where_for.rast
@@ -16,7 +16,8 @@ [email protected]
16 [email protected] 16 [email protected]
17 [email protected] "<" 17 [email protected] "<"
18 [email protected] 18 [email protected]
19 [email protected] "\'a" 19 [email protected]
20 [email protected] "\'a"
20 [email protected] ">" 21 [email protected] ">"
21 [email protected] "\n" 22 [email protected] "\n"
22 [email protected] 23 [email protected]
diff --git a/crates/syntax/test_data/parser/err/0043_weird_blocks.rast b/crates/syntax/test_data/parser/err/0043_weird_blocks.rast
index df29017e7..e73bd1aea 100644
--- a/crates/syntax/test_data/parser/err/0043_weird_blocks.rast
+++ b/crates/syntax/test_data/parser/err/0043_weird_blocks.rast
@@ -54,7 +54,8 @@ [email protected]
54 [email protected] 54 [email protected]
55 [email protected] 55 [email protected]
56 [email protected] 56 [email protected]
57 [email protected] "\'label" 57 [email protected]
58 [email protected] "\'label"
58 [email protected] ":" 59 [email protected] ":"
59 [email protected] " " 60 [email protected] " "
60 [email protected] 61 [email protected]
diff --git a/crates/syntax/test_data/parser/err/0044_unexpected_for_type.rast b/crates/syntax/test_data/parser/err/0044_unexpected_for_type.rast
index 71aa86494..cc54185e5 100644
--- a/crates/syntax/test_data/parser/err/0044_unexpected_for_type.rast
+++ b/crates/syntax/test_data/parser/err/0044_unexpected_for_type.rast
@@ -12,12 +12,14 @@ [email protected]
12 [email protected] 12 [email protected]
13 [email protected] "<" 13 [email protected] "<"
14 [email protected] 14 [email protected]
15 [email protected] "\'a" 15 [email protected]
16 [email protected] "\'a"
16 [email protected] ">" 17 [email protected] ">"
17 [email protected] " " 18 [email protected] " "
18 [email protected] 19 [email protected]
19 [email protected] "&" 20 [email protected] "&"
20 [email protected] "\'a" 21 [email protected]
22 [email protected] "\'a"
21 [email protected] " " 23 [email protected] " "
22 [email protected] 24 [email protected]
23 [email protected] 25 [email protected]
@@ -39,14 +41,16 @@ [email protected]
39 [email protected] 41 [email protected]
40 [email protected] "<" 42 [email protected] "<"
41 [email protected] 43 [email protected]
42 [email protected] "\'a" 44 [email protected]
45 [email protected] "\'a"
43 [email protected] ">" 46 [email protected] ">"
44 [email protected] " " 47 [email protected] " "
45 [email protected] 48 [email protected]
46 [email protected] "(" 49 [email protected] "("
47 [email protected] 50 [email protected]
48 [email protected] "&" 51 [email protected] "&"
49 [email protected] "\'a" 52 [email protected]
53 [email protected] "\'a"
50 [email protected] " " 54 [email protected] " "
51 [email protected] 55 [email protected]
52 [email protected] 56 [email protected]
@@ -70,7 +74,8 @@ [email protected]
70 [email protected] 74 [email protected]
71 [email protected] "<" 75 [email protected] "<"
72 [email protected] 76 [email protected]
73 [email protected] "\'a" 77 [email protected]
78 [email protected] "\'a"
74 [email protected] ">" 79 [email protected] ">"
75 [email protected] " " 80 [email protected] " "
76 [email protected] 81 [email protected]
@@ -96,7 +101,8 @@ [email protected]
96 [email protected] 101 [email protected]
97 [email protected] "<" 102 [email protected] "<"
98 [email protected] 103 [email protected]
99 [email protected] "\'a" 104 [email protected]
105 [email protected] "\'a"
100 [email protected] ">" 106 [email protected] ">"
101 [email protected] " " 107 [email protected] " "
102 [email protected] 108 [email protected]
@@ -104,7 +110,8 @@ [email protected]
104 [email protected] 110 [email protected]
105 [email protected] "<" 111 [email protected] "<"
106 [email protected] 112 [email protected]
107 [email protected] "\'b" 113 [email protected]
114 [email protected] "\'b"
108 [email protected] ">" 115 [email protected] ">"
109 [email protected] " " 116 [email protected] " "
110 [email protected] 117 [email protected]
@@ -114,7 +121,8 @@ [email protected]
114 [email protected] 121 [email protected]
115 [email protected] 122 [email protected]
116 [email protected] "&" 123 [email protected] "&"
117 [email protected] "\'a" 124 [email protected]
125 [email protected] "\'a"
118 [email protected] " " 126 [email protected] " "
119 [email protected] 127 [email protected]
120 [email protected] 128 [email protected]
@@ -126,7 +134,8 @@ [email protected]
126 [email protected] 134 [email protected]
127 [email protected] 135 [email protected]
128 [email protected] "&" 136 [email protected] "&"
129 [email protected] "\'b" 137 [email protected]
138 [email protected] "\'b"
130 [email protected] " " 139 [email protected] " "
131 [email protected] 140 [email protected]
132 [email protected] 141 [email protected]
@@ -159,7 +168,8 @@ [email protected]
159 [email protected] 168 [email protected]
160 [email protected] "<" 169 [email protected] "<"
161 [email protected] 170 [email protected]
162 [email protected] "\'a" 171 [email protected]
172 [email protected] "\'a"
163 [email protected] ">" 173 [email protected] ">"
164 [email protected] " " 174 [email protected] " "
165 [email protected] 175 [email protected]
@@ -167,7 +177,8 @@ [email protected]
167 [email protected] 177 [email protected]
168 [email protected] "<" 178 [email protected] "<"
169 [email protected] 179 [email protected]
170 [email protected] "\'b" 180 [email protected]
181 [email protected] "\'b"
171 [email protected] ">" 182 [email protected] ">"
172 [email protected] " " 183 [email protected] " "
173 [email protected] 184 [email protected]
@@ -175,7 +186,8 @@ [email protected]
175 [email protected] 186 [email protected]
176 [email protected] "<" 187 [email protected] "<"
177 [email protected] 188 [email protected]
178 [email protected] "\'c" 189 [email protected]
190 [email protected] "\'c"
179 [email protected] ">" 191 [email protected] ">"
180 [email protected] " " 192 [email protected] " "
181 [email protected] 193 [email protected]
@@ -185,7 +197,8 @@ [email protected]
185 [email protected] 197 [email protected]
186 [email protected] 198 [email protected]
187 [email protected] "&" 199 [email protected] "&"
188 [email protected] "\'a" 200 [email protected]
201 [email protected] "\'a"
189 [email protected] " " 202 [email protected] " "
190 [email protected] 203 [email protected]
191 [email protected] 204 [email protected]
@@ -197,7 +210,8 @@ [email protected]
197 [email protected] 210 [email protected]
198 [email protected] 211 [email protected]
199 [email protected] "&" 212 [email protected] "&"
200 [email protected] "\'b" 213 [email protected]
214 [email protected] "\'b"
201 [email protected] " " 215 [email protected] " "
202 [email protected] 216 [email protected]
203 [email protected] 217 [email protected]
@@ -209,7 +223,8 @@ [email protected]
209 [email protected] 223 [email protected]
210 [email protected] 224 [email protected]
211 [email protected] "&" 225 [email protected] "&"
212 [email protected] "\'c" 226 [email protected]
227 [email protected] "\'c"
213 [email protected] " " 228 [email protected] " "
214 [email protected] 229 [email protected]
215 [email protected] 230 [email protected]
diff --git a/crates/syntax/test_data/parser/err/0046_ambiguous_trait_object.rast b/crates/syntax/test_data/parser/err/0046_ambiguous_trait_object.rast
index 592741cdb..7049f4734 100644
--- a/crates/syntax/test_data/parser/err/0046_ambiguous_trait_object.rast
+++ b/crates/syntax/test_data/parser/err/0046_ambiguous_trait_object.rast
@@ -7,14 +7,16 @@ [email protected]
7 [email protected] 7 [email protected]
8 [email protected] "<" 8 [email protected] "<"
9 [email protected] 9 [email protected]
10 [email protected] "\'a" 10 [email protected]
11 [email protected] "\'a"
11 [email protected] ">" 12 [email protected] ">"
12 [email protected] " " 13 [email protected] " "
13 [email protected] "=" 14 [email protected] "="
14 [email protected] " " 15 [email protected] " "
15 [email protected] 16 [email protected]
16 [email protected] "&" 17 [email protected] "&"
17 [email protected] "\'a" 18 [email protected]
19 [email protected] "\'a"
18 [email protected] " " 20 [email protected] " "
19 [email protected] 21 [email protected]
20 [email protected] "dyn" 22 [email protected] "dyn"
@@ -101,7 +103,8 @@ [email protected]
101 [email protected] "+" 103 [email protected] "+"
102 [email protected] " " 104 [email protected] " "
103 [email protected] 105 [email protected]
104 [email protected] "\'static" 106 [email protected]
107 [email protected] "\'static"
105 [email protected] ";" 108 [email protected] ";"
106 [email protected] "\n" 109 [email protected] "\n"
107 [email protected] 110 [email protected]
diff --git a/crates/syntax/test_data/parser/inline/err/0002_misplaced_label_err.rast b/crates/syntax/test_data/parser/inline/err/0002_misplaced_label_err.rast
index a4271fc87..0adf2cd5a 100644
--- a/crates/syntax/test_data/parser/inline/err/0002_misplaced_label_err.rast
+++ b/crates/syntax/test_data/parser/inline/err/0002_misplaced_label_err.rast
@@ -14,7 +14,8 @@ [email protected]
14 [email protected] 14 [email protected]
15 [email protected] 15 [email protected]
16 [email protected] 16 [email protected]
17 [email protected] "\'loop" 17 [email protected]
18 [email protected] "\'loop"
18 [email protected] ":" 19 [email protected] ":"
19 [email protected] " " 20 [email protected] " "
20 [email protected] 21 [email protected]
diff --git a/crates/syntax/test_data/parser/inline/ok/0003_where_pred_for.rast b/crates/syntax/test_data/parser/inline/ok/0003_where_pred_for.rast
index 62da7b887..6cdfd058b 100644
--- a/crates/syntax/test_data/parser/inline/ok/0003_where_pred_for.rast
+++ b/crates/syntax/test_data/parser/inline/ok/0003_where_pred_for.rast
@@ -22,7 +22,8 @@ [email protected]
22 [email protected] 22 [email protected]
23 [email protected] "<" 23 [email protected] "<"
24 [email protected] 24 [email protected]
25 [email protected] "\'a" 25 [email protected]
26 [email protected] "\'a"
26 [email protected] ">" 27 [email protected] ">"
27 [email protected] " " 28 [email protected] " "
28 [email protected] 29 [email protected]
@@ -44,7 +45,8 @@ [email protected]
44 [email protected] 45 [email protected]
45 [email protected] 46 [email protected]
46 [email protected] "&" 47 [email protected] "&"
47 [email protected] "\'a" 48 [email protected]
49 [email protected] "\'a"
48 [email protected] " " 50 [email protected] " "
49 [email protected] 51 [email protected]
50 [email protected] 52 [email protected]
diff --git a/crates/syntax/test_data/parser/inline/ok/0006_self_param.rast b/crates/syntax/test_data/parser/inline/ok/0006_self_param.rast
index d24ad7423..8048f5fad 100644
--- a/crates/syntax/test_data/parser/inline/ok/0006_self_param.rast
+++ b/crates/syntax/test_data/parser/inline/ok/0006_self_param.rast
@@ -52,7 +52,8 @@ [email protected]
52 [email protected] "(" 52 [email protected] "("
53 [email protected] 53 [email protected]
54 [email protected] "&" 54 [email protected] "&"
55 [email protected] "\'a" 55 [email protected]
56 [email protected] "\'a"
56 [email protected] " " 57 [email protected] " "
57 [email protected] "self" 58 [email protected] "self"
58 [email protected] "," 59 [email protected] ","
@@ -71,7 +72,8 @@ [email protected]
71 [email protected] "(" 72 [email protected] "("
72 [email protected] 73 [email protected]
73 [email protected] "&" 74 [email protected] "&"
74 [email protected] "\'a" 75 [email protected]
76 [email protected] "\'a"
75 [email protected] " " 77 [email protected] " "
76 [email protected] "mut" 78 [email protected] "mut"
77 [email protected] " " 79 [email protected] " "
diff --git a/crates/syntax/test_data/parser/inline/ok/0007_type_param_bounds.rast b/crates/syntax/test_data/parser/inline/ok/0007_type_param_bounds.rast
index e95688f56..075b438d2 100644
--- a/crates/syntax/test_data/parser/inline/ok/0007_type_param_bounds.rast
+++ b/crates/syntax/test_data/parser/inline/ok/0007_type_param_bounds.rast
@@ -13,7 +13,8 @@ [email protected]
13 [email protected] " " 13 [email protected] " "
14 [email protected] 14 [email protected]
15 [email protected] 15 [email protected]
16 [email protected] "\'a" 16 [email protected]
17 [email protected] "\'a"
17 [email protected] " " 18 [email protected] " "
18 [email protected] "+" 19 [email protected] "+"
19 [email protected] " " 20 [email protected] " "
diff --git a/crates/syntax/test_data/parser/inline/ok/0015_continue_expr.rast b/crates/syntax/test_data/parser/inline/ok/0015_continue_expr.rast
index 104e153ce..b9e92b57a 100644
--- a/crates/syntax/test_data/parser/inline/ok/0015_continue_expr.rast
+++ b/crates/syntax/test_data/parser/inline/ok/0015_continue_expr.rast
@@ -26,7 +26,8 @@ [email protected]
26 [email protected] 26 [email protected]
27 [email protected] "continue" 27 [email protected] "continue"
28 [email protected] " " 28 [email protected] " "
29 [email protected] "\'l" 29 [email protected]
30 [email protected] "\'l"
30 [email protected] ";" 31 [email protected] ";"
31 [email protected] "\n " 32 [email protected] "\n "
32 [email protected] "}" 33 [email protected] "}"
diff --git a/crates/syntax/test_data/parser/inline/ok/0028_impl_trait_type.rast b/crates/syntax/test_data/parser/inline/ok/0028_impl_trait_type.rast
index 32b2959bd..dad4362b7 100644
--- a/crates/syntax/test_data/parser/inline/ok/0028_impl_trait_type.rast
+++ b/crates/syntax/test_data/parser/inline/ok/0028_impl_trait_type.rast
@@ -31,13 +31,15 @@ [email protected]
31 [email protected] 31 [email protected]
32 [email protected] "<" 32 [email protected] "<"
33 [email protected] 33 [email protected]
34 [email protected] "\'a" 34 [email protected]
35 [email protected] "\'a"
35 [email protected] ">" 36 [email protected] ">"
36 [email protected] ">" 37 [email protected] ">"
37 [email protected] " " 38 [email protected] " "
38 [email protected] "+" 39 [email protected] "+"
39 [email protected] " " 40 [email protected] " "
40 [email protected] 41 [email protected]
41 [email protected] "\'a" 42 [email protected]
43 [email protected] "\'a"
42 [email protected] ";" 44 [email protected] ";"
43 [email protected] "\n" 45 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0033_reference_type;.rast b/crates/syntax/test_data/parser/inline/ok/0033_reference_type;.rast
index 974df9f9a..ac0299268 100644
--- a/crates/syntax/test_data/parser/inline/ok/0033_reference_type;.rast
+++ b/crates/syntax/test_data/parser/inline/ok/0033_reference_type;.rast
@@ -24,7 +24,8 @@ [email protected]
24 [email protected] " " 24 [email protected] " "
25 [email protected] 25 [email protected]
26 [email protected] "&" 26 [email protected] "&"
27 [email protected] "\'static" 27 [email protected]
28 [email protected] "\'static"
28 [email protected] " " 29 [email protected] " "
29 [email protected] 30 [email protected]
30 [email protected] "(" 31 [email protected] "("
diff --git a/crates/syntax/test_data/parser/inline/ok/0034_break_expr.rast b/crates/syntax/test_data/parser/inline/ok/0034_break_expr.rast
index f905def6f..828013d45 100644
--- a/crates/syntax/test_data/parser/inline/ok/0034_break_expr.rast
+++ b/crates/syntax/test_data/parser/inline/ok/0034_break_expr.rast
@@ -26,7 +26,8 @@ [email protected]
26 [email protected] 26 [email protected]
27 [email protected] "break" 27 [email protected] "break"
28 [email protected] " " 28 [email protected] " "
29 [email protected] "\'l" 29 [email protected]
30 [email protected] "\'l"
30 [email protected] ";" 31 [email protected] ";"
31 [email protected] "\n " 32 [email protected] "\n "
32 [email protected] 33 [email protected]
@@ -41,7 +42,8 @@ [email protected]
41 [email protected] 42 [email protected]
42 [email protected] "break" 43 [email protected] "break"
43 [email protected] " " 44 [email protected] " "
44 [email protected] "\'l" 45 [email protected]
46 [email protected] "\'l"
45 [email protected] " " 47 [email protected] " "
46 [email protected] 48 [email protected]
47 [email protected] "92" 49 [email protected] "92"
diff --git a/crates/syntax/test_data/parser/inline/ok/0039_type_arg.rast b/crates/syntax/test_data/parser/inline/ok/0039_type_arg.rast
index 69e98b9d6..51e881a8e 100644
--- a/crates/syntax/test_data/parser/inline/ok/0039_type_arg.rast
+++ b/crates/syntax/test_data/parser/inline/ok/0039_type_arg.rast
@@ -15,7 +15,8 @@ [email protected]
15 [email protected] 15 [email protected]
16 [email protected] "<" 16 [email protected] "<"
17 [email protected] 17 [email protected]
18 [email protected] "\'static" 18 [email protected]
19 [email protected] "\'static"
19 [email protected] "," 20 [email protected] ","
20 [email protected] " " 21 [email protected] " "
21 [email protected] 22 [email protected]
diff --git a/crates/syntax/test_data/parser/inline/ok/0045_param_list_opt_patterns.rast b/crates/syntax/test_data/parser/inline/ok/0045_param_list_opt_patterns.rast
index 6baea6e3c..b6f5a5689 100644
--- a/crates/syntax/test_data/parser/inline/ok/0045_param_list_opt_patterns.rast
+++ b/crates/syntax/test_data/parser/inline/ok/0045_param_list_opt_patterns.rast
@@ -33,7 +33,8 @@ [email protected]
33 [email protected] 33 [email protected]
34 [email protected] "<" 34 [email protected] "<"
35 [email protected] 35 [email protected]
36 [email protected] "\'a" 36 [email protected]
37 [email protected] "\'a"
37 [email protected] ">" 38 [email protected] ">"
38 [email protected] ")" 39 [email protected] ")"
39 [email protected] ">" 40 [email protected] ">"
diff --git a/crates/syntax/test_data/parser/inline/ok/0048_path_type_with_bounds.rast b/crates/syntax/test_data/parser/inline/ok/0048_path_type_with_bounds.rast
index 4d8404e7c..7df6e190a 100644
--- a/crates/syntax/test_data/parser/inline/ok/0048_path_type_with_bounds.rast
+++ b/crates/syntax/test_data/parser/inline/ok/0048_path_type_with_bounds.rast
@@ -31,7 +31,8 @@ [email protected]
31 [email protected] "+" 31 [email protected] "+"
32 [email protected] " " 32 [email protected] " "
33 [email protected] 33 [email protected]
34 [email protected] "\'f" 34 [email protected]
35 [email protected] "\'f"
35 [email protected] ">" 36 [email protected] ">"
36 [email protected] " " 37 [email protected] " "
37 [email protected] 38 [email protected]
@@ -72,7 +73,8 @@ [email protected]
72 [email protected] "+" 73 [email protected] "+"
73 [email protected] " " 74 [email protected] " "
74 [email protected] 75 [email protected]
75 [email protected] "\'f" 76 [email protected]
77 [email protected] "\'f"
76 [email protected] ">" 78 [email protected] ">"
77 [email protected] " " 79 [email protected] " "
78 [email protected] 80 [email protected]
diff --git a/crates/syntax/test_data/parser/inline/ok/0056_where_clause.rast b/crates/syntax/test_data/parser/inline/ok/0056_where_clause.rast
index 28129c50c..61dea413d 100644
--- a/crates/syntax/test_data/parser/inline/ok/0056_where_clause.rast
+++ b/crates/syntax/test_data/parser/inline/ok/0056_where_clause.rast
@@ -12,17 +12,20 @@ [email protected]
12 [email protected] "where" 12 [email protected] "where"
13 [email protected] "\n " 13 [email protected] "\n "
14 [email protected] 14 [email protected]
15 [email protected] "\'a" 15 [email protected]
16 [email protected] "\'a"
16 [email protected] ":" 17 [email protected] ":"
17 [email protected] " " 18 [email protected] " "
18 [email protected] 19 [email protected]
19 [email protected] 20 [email protected]
20 [email protected] "\'b" 21 [email protected]
22 [email protected] "\'b"
21 [email protected] " " 23 [email protected] " "
22 [email protected] "+" 24 [email protected] "+"
23 [email protected] " " 25 [email protected] " "
24 [email protected] 26 [email protected]
25 [email protected] "\'c" 27 [email protected]
28 [email protected] "\'c"
26 [email protected] "," 29 [email protected] ","
27 [email protected] "\n " 30 [email protected] "\n "
28 [email protected] 31 [email protected]
@@ -53,7 +56,8 @@ [email protected]
53 [email protected] "+" 56 [email protected] "+"
54 [email protected] " " 57 [email protected] " "
55 [email protected] 58 [email protected]
56 [email protected] "\'static" 59 [email protected]
60 [email protected] "\'static"
57 [email protected] "," 61 [email protected] ","
58 [email protected] "\n " 62 [email protected] "\n "
59 [email protected] 63 [email protected]
@@ -71,7 +75,8 @@ [email protected]
71 [email protected] " " 75 [email protected] " "
72 [email protected] 76 [email protected]
73 [email protected] 77 [email protected]
74 [email protected] "\'a" 78 [email protected]
79 [email protected] "\'a"
75 [email protected] "," 80 [email protected] ","
76 [email protected] "\n " 81 [email protected] "\n "
77 [email protected] 82 [email protected]
@@ -102,7 +107,8 @@ [email protected]
102 [email protected] " " 107 [email protected] " "
103 [email protected] 108 [email protected]
104 [email protected] 109 [email protected]
105 [email protected] "\'a" 110 [email protected]
111 [email protected] "\'a"
106 [email protected] "\n" 112 [email protected] "\n"
107 [email protected] 113 [email protected]
108 [email protected] "{" 114 [email protected] "{"
diff --git a/crates/syntax/test_data/parser/inline/ok/0065_dyn_trait_type.rast b/crates/syntax/test_data/parser/inline/ok/0065_dyn_trait_type.rast
index 3a7fcfe24..49d26cef4 100644
--- a/crates/syntax/test_data/parser/inline/ok/0065_dyn_trait_type.rast
+++ b/crates/syntax/test_data/parser/inline/ok/0065_dyn_trait_type.rast
@@ -31,13 +31,15 @@ [email protected]
31 [email protected] 31 [email protected]
32 [email protected] "<" 32 [email protected] "<"
33 [email protected] 33 [email protected]
34 [email protected] "\'a" 34 [email protected]
35 [email protected] "\'a"
35 [email protected] ">" 36 [email protected] ">"
36 [email protected] ">" 37 [email protected] ">"
37 [email protected] " " 38 [email protected] " "
38 [email protected] "+" 39 [email protected] "+"
39 [email protected] " " 40 [email protected] " "
40 [email protected] 41 [email protected]
41 [email protected] "\'a" 42 [email protected]
43 [email protected] "\'a"
42 [email protected] ";" 44 [email protected] ";"
43 [email protected] "\n" 45 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0081_for_type.rast b/crates/syntax/test_data/parser/inline/ok/0081_for_type.rast
index f319d5141..8c909b5af 100644
--- a/crates/syntax/test_data/parser/inline/ok/0081_for_type.rast
+++ b/crates/syntax/test_data/parser/inline/ok/0081_for_type.rast
@@ -12,7 +12,8 @@ [email protected]
12 [email protected] 12 [email protected]
13 [email protected] "<" 13 [email protected] "<"
14 [email protected] 14 [email protected]
15 [email protected] "\'a" 15 [email protected]
16 [email protected] "\'a"
16 [email protected] ">" 17 [email protected] ">"
17 [email protected] " " 18 [email protected] " "
18 [email protected] 19 [email protected]
@@ -42,7 +43,8 @@ [email protected]
42 [email protected] 43 [email protected]
43 [email protected] "<" 44 [email protected] "<"
44 [email protected] 45 [email protected]
45 [email protected] "\'a" 46 [email protected]
47 [email protected] "\'a"
46 [email protected] ">" 48 [email protected] ">"
47 [email protected] " " 49 [email protected] " "
48 [email protected] 50 [email protected]
@@ -59,7 +61,8 @@ [email protected]
59 [email protected] 61 [email protected]
60 [email protected] 62 [email protected]
61 [email protected] "&" 63 [email protected] "&"
62 [email protected] "\'a" 64 [email protected]
65 [email protected] "\'a"
63 [email protected] " " 66 [email protected] " "
64 [email protected] 67 [email protected]
65 [email protected] "(" 68 [email protected] "("
@@ -87,7 +90,8 @@ [email protected]
87 [email protected] 90 [email protected]
88 [email protected] "<" 91 [email protected] "<"
89 [email protected] 92 [email protected]
90 [email protected] "\'a" 93 [email protected]
94 [email protected] "\'a"
91 [email protected] ">" 95 [email protected] ">"
92 [email protected] " " 96 [email protected] " "
93 [email protected] 97 [email protected]
@@ -100,7 +104,8 @@ [email protected]
100 [email protected] 104 [email protected]
101 [email protected] 105 [email protected]
102 [email protected] "&" 106 [email protected] "&"
103 [email protected] "\'a" 107 [email protected]
108 [email protected] "\'a"
104 [email protected] " " 109 [email protected] " "
105 [email protected] 110 [email protected]
106 [email protected] 111 [email protected]
diff --git a/crates/syntax/test_data/parser/inline/ok/0109_label.rast b/crates/syntax/test_data/parser/inline/ok/0109_label.rast
index c9588025c..860dfe608 100644
--- a/crates/syntax/test_data/parser/inline/ok/0109_label.rast
+++ b/crates/syntax/test_data/parser/inline/ok/0109_label.rast
@@ -14,7 +14,8 @@ [email protected]
14 [email protected] 14 [email protected]
15 [email protected] 15 [email protected]
16 [email protected] 16 [email protected]
17 [email protected] "\'a" 17 [email protected]
18 [email protected] "\'a"
18 [email protected] ":" 19 [email protected] ":"
19 [email protected] " " 20 [email protected] " "
20 [email protected] "loop" 21 [email protected] "loop"
@@ -26,7 +27,8 @@ [email protected]
26 [email protected] 27 [email protected]
27 [email protected] 28 [email protected]
28 [email protected] 29 [email protected]
29 [email protected] "\'b" 30 [email protected]
31 [email protected] "\'b"
30 [email protected] ":" 32 [email protected] ":"
31 [email protected] " " 33 [email protected] " "
32 [email protected] "while" 34 [email protected] "while"
@@ -41,7 +43,8 @@ [email protected]
41 [email protected] "\n " 43 [email protected] "\n "
42 [email protected] 44 [email protected]
43 [email protected] 45 [email protected]
44 [email protected] "\'c" 46 [email protected]
47 [email protected] "\'c"
45 [email protected] ":" 48 [email protected] ":"
46 [email protected] " " 49 [email protected] " "
47 [email protected] "for" 50 [email protected] "for"
diff --git a/crates/syntax/test_data/parser/inline/ok/0122_generic_lifetime_type_attribute.rast b/crates/syntax/test_data/parser/inline/ok/0122_generic_lifetime_type_attribute.rast
index 570b95205..616aa984e 100644
--- a/crates/syntax/test_data/parser/inline/ok/0122_generic_lifetime_type_attribute.rast
+++ b/crates/syntax/test_data/parser/inline/ok/0122_generic_lifetime_type_attribute.rast
@@ -20,7 +20,8 @@ [email protected]
20 [email protected] ")" 20 [email protected] ")"
21 [email protected] "]" 21 [email protected] "]"
22 [email protected] " " 22 [email protected] " "
23 [email protected] "\'a" 23 [email protected]
24 [email protected] "\'a"
24 [email protected] "," 25 [email protected] ","
25 [email protected] " " 26 [email protected] " "
26 [email protected] 27 [email protected]
@@ -49,7 +50,8 @@ [email protected]
49 [email protected] " " 50 [email protected] " "
50 [email protected] 51 [email protected]
51 [email protected] "&" 52 [email protected] "&"
52 [email protected] "\'a" 53 [email protected]
54 [email protected] "\'a"
53 [email protected] " " 55 [email protected] " "
54 [email protected] 56 [email protected]
55 [email protected] 57 [email protected]
diff --git a/crates/syntax/test_data/parser/inline/ok/0161_labeled_block.rast b/crates/syntax/test_data/parser/inline/ok/0161_labeled_block.rast
index 9e9a5f9c5..c2dea1cc1 100644
--- a/crates/syntax/test_data/parser/inline/ok/0161_labeled_block.rast
+++ b/crates/syntax/test_data/parser/inline/ok/0161_labeled_block.rast
@@ -14,7 +14,8 @@ [email protected]
14 [email protected] 14 [email protected]
15 [email protected] 15 [email protected]
16 [email protected] 16 [email protected]
17 [email protected] "\'label" 17 [email protected]
18 [email protected] "\'label"
18 [email protected] ":" 19 [email protected] ":"
19 [email protected] " " 20 [email protected] " "
20 [email protected] 21 [email protected]
diff --git a/crates/syntax/test_data/parser/ok/0018_struct_type_params.rast b/crates/syntax/test_data/parser/ok/0018_struct_type_params.rast
index 630aa0708..83e17757b 100644
--- a/crates/syntax/test_data/parser/ok/0018_struct_type_params.rast
+++ b/crates/syntax/test_data/parser/ok/0018_struct_type_params.rast
@@ -80,7 +80,8 @@ [email protected]
80 [email protected] 80 [email protected]
81 [email protected] "<" 81 [email protected] "<"
82 [email protected] 82 [email protected]
83 [email protected] "\'a" 83 [email protected]
84 [email protected] "\'a"
84 [email protected] ">" 85 [email protected] ">"
85 [email protected] ";" 86 [email protected] ";"
86 [email protected] "\n" 87 [email protected] "\n"
@@ -92,7 +93,8 @@ [email protected]
92 [email protected] 93 [email protected]
93 [email protected] "<" 94 [email protected] "<"
94 [email protected] 95 [email protected]
95 [email protected] "\'a" 96 [email protected]
97 [email protected] "\'a"
96 [email protected] ":" 98 [email protected] ":"
97 [email protected] ">" 99 [email protected] ">"
98 [email protected] ";" 100 [email protected] ";"
@@ -105,10 +107,12 @@ [email protected]
105 [email protected] 107 [email protected]
106 [email protected] "<" 108 [email protected] "<"
107 [email protected] 109 [email protected]
108 [email protected] "\'a" 110 [email protected]
111 [email protected] "\'a"
109 [email protected] ":" 112 [email protected] ":"
110 [email protected] " " 113 [email protected] " "
111 [email protected] "\'b" 114 [email protected]
115 [email protected] "\'b"
112 [email protected] ">" 116 [email protected] ">"
113 [email protected] ";" 117 [email protected] ";"
114 [email protected] "\n" 118 [email protected] "\n"
@@ -120,10 +124,12 @@ [email protected]
120 [email protected] 124 [email protected]
121 [email protected] "<" 125 [email protected] "<"
122 [email protected] 126 [email protected]
123 [email protected] "\'a" 127 [email protected]
128 [email protected] "\'a"
124 [email protected] ":" 129 [email protected] ":"
125 [email protected] " " 130 [email protected] " "
126 [email protected] "\'b" 131 [email protected]
132 [email protected] "\'b"
127 [email protected] " " 133 [email protected] " "
128 [email protected] "+" 134 [email protected] "+"
129 [email protected] " " 135 [email protected] " "
@@ -138,14 +144,17 @@ [email protected]
138 [email protected] 144 [email protected]
139 [email protected] "<" 145 [email protected] "<"
140 [email protected] 146 [email protected]
141 [email protected] "\'a" 147 [email protected]
148 [email protected] "\'a"
142 [email protected] ":" 149 [email protected] ":"
143 [email protected] " " 150 [email protected] " "
144 [email protected] "\'b" 151 [email protected]
152 [email protected] "\'b"
145 [email protected] " " 153 [email protected] " "
146 [email protected] "+" 154 [email protected] "+"
147 [email protected] " " 155 [email protected] " "
148 [email protected] "\'c" 156 [email protected]
157 [email protected] "\'c"
149 [email protected] ">" 158 [email protected] ">"
150 [email protected] ";" 159 [email protected] ";"
151 [email protected] "\n" 160 [email protected] "\n"
@@ -157,7 +166,8 @@ [email protected]
157 [email protected] 166 [email protected]
158 [email protected] "<" 167 [email protected] "<"
159 [email protected] 168 [email protected]
160 [email protected] "\'a" 169 [email protected]
170 [email protected] "\'a"
161 [email protected] "," 171 [email protected] ","
162 [email protected] ">" 172 [email protected] ">"
163 [email protected] ";" 173 [email protected] ";"
@@ -170,11 +180,13 @@ [email protected]
170 [email protected] 180 [email protected]
171 [email protected] "<" 181 [email protected] "<"
172 [email protected] 182 [email protected]
173 [email protected] "\'a" 183 [email protected]
184 [email protected] "\'a"
174 [email protected] "," 185 [email protected] ","
175 [email protected] " " 186 [email protected] " "
176 [email protected] 187 [email protected]
177 [email protected] "\'b" 188 [email protected]
189 [email protected] "\'b"
178 [email protected] ">" 190 [email protected] ">"
179 [email protected] ";" 191 [email protected] ";"
180 [email protected] "\n" 192 [email protected] "\n"
@@ -186,18 +198,22 @@ [email protected]
186 [email protected] 198 [email protected]
187 [email protected] "<" 199 [email protected] "<"
188 [email protected] 200 [email protected]
189 [email protected] "\'a" 201 [email protected]
202 [email protected] "\'a"
190 [email protected] ":" 203 [email protected] ":"
191 [email protected] " " 204 [email protected] " "
192 [email protected] "\'b" 205 [email protected]
206 [email protected] "\'b"
193 [email protected] "+" 207 [email protected] "+"
194 [email protected] "," 208 [email protected] ","
195 [email protected] " " 209 [email protected] " "
196 [email protected] 210 [email protected]
197 [email protected] "\'b" 211 [email protected]
212 [email protected] "\'b"
198 [email protected] ":" 213 [email protected] ":"
199 [email protected] " " 214 [email protected] " "
200 [email protected] "\'c" 215 [email protected]
216 [email protected] "\'c"
201 [email protected] "," 217 [email protected] ","
202 [email protected] ">" 218 [email protected] ">"
203 [email protected] ";" 219 [email protected] ";"
@@ -241,7 +257,8 @@ [email protected]
241 [email protected] 257 [email protected]
242 [email protected] "<" 258 [email protected] "<"
243 [email protected] 259 [email protected]
244 [email protected] "\'a" 260 [email protected]
261 [email protected] "\'a"
245 [email protected] "," 262 [email protected] ","
246 [email protected] " " 263 [email protected] " "
247 [email protected] 264 [email protected]
diff --git a/crates/syntax/test_data/parser/ok/0020_type_param_bounds.rast b/crates/syntax/test_data/parser/ok/0020_type_param_bounds.rast
index 9bdc50e1e..0612a71de 100644
--- a/crates/syntax/test_data/parser/ok/0020_type_param_bounds.rast
+++ b/crates/syntax/test_data/parser/ok/0020_type_param_bounds.rast
@@ -41,7 +41,8 @@ [email protected]
41 [email protected] " " 41 [email protected] " "
42 [email protected] 42 [email protected]
43 [email protected] 43 [email protected]
44 [email protected] "\'a" 44 [email protected]
45 [email protected] "\'a"
45 [email protected] ">" 46 [email protected] ">"
46 [email protected] ";" 47 [email protected] ";"
47 [email protected] "\n" 48 [email protected] "\n"
@@ -59,7 +60,8 @@ [email protected]
59 [email protected] " " 60 [email protected] " "
60 [email protected] 61 [email protected]
61 [email protected] 62 [email protected]
62 [email protected] "\'a" 63 [email protected]
64 [email protected] "\'a"
63 [email protected] " " 65 [email protected] " "
64 [email protected] "+" 66 [email protected] "+"
65 [email protected] " " 67 [email protected] " "
@@ -80,12 +82,14 @@ [email protected]
80 [email protected] " " 82 [email protected] " "
81 [email protected] 83 [email protected]
82 [email protected] 84 [email protected]
83 [email protected] "\'a" 85 [email protected]
86 [email protected] "\'a"
84 [email protected] " " 87 [email protected] " "
85 [email protected] "+" 88 [email protected] "+"
86 [email protected] " " 89 [email protected] " "
87 [email protected] 90 [email protected]
88 [email protected] "\'d" 91 [email protected]
92 [email protected] "\'d"
89 [email protected] " " 93 [email protected] " "
90 [email protected] ">" 94 [email protected] ">"
91 [email protected] ";" 95 [email protected] ";"
@@ -104,12 +108,14 @@ [email protected]
104 [email protected] " " 108 [email protected] " "
105 [email protected] 109 [email protected]
106 [email protected] 110 [email protected]
107 [email protected] "\'a" 111 [email protected]
112 [email protected] "\'a"
108 [email protected] " " 113 [email protected] " "
109 [email protected] "+" 114 [email protected] "+"
110 [email protected] " " 115 [email protected] " "
111 [email protected] 116 [email protected]
112 [email protected] "\'d" 117 [email protected]
118 [email protected] "\'d"
113 [email protected] " " 119 [email protected] " "
114 [email protected] "+" 120 [email protected] "+"
115 [email protected] " " 121 [email protected] " "
@@ -190,7 +196,8 @@ [email protected]
190 [email protected] "+" 196 [email protected] "+"
191 [email protected] " " 197 [email protected] " "
192 [email protected] 198 [email protected]
193 [email protected] "\'a" 199 [email protected]
200 [email protected] "\'a"
194 [email protected] ">" 201 [email protected] ">"
195 [email protected] ";" 202 [email protected] ";"
196 [email protected] "\n" 203 [email protected] "\n"
@@ -225,21 +232,26 @@ [email protected]
225 [email protected] 232 [email protected]
226 [email protected] "<" 233 [email protected] "<"
227 [email protected] 234 [email protected]
228 [email protected] "\'a" 235 [email protected]
236 [email protected] "\'a"
229 [email protected] ":" 237 [email protected] ":"
230 [email protected] " " 238 [email protected] " "
231 [email protected] "\'d" 239 [email protected]
240 [email protected] "\'d"
232 [email protected] "," 241 [email protected] ","
233 [email protected] " " 242 [email protected] " "
234 [email protected] 243 [email protected]
235 [email protected] "\'d" 244 [email protected]
245 [email protected] "\'d"
236 [email protected] ":" 246 [email protected] ":"
237 [email protected] " " 247 [email protected] " "
238 [email protected] "\'a" 248 [email protected]
249 [email protected] "\'a"
239 [email protected] " " 250 [email protected] " "
240 [email protected] "+" 251 [email protected] "+"
241 [email protected] " " 252 [email protected] " "
242 [email protected] "\'b" 253 [email protected]
254 [email protected] "\'b"
243 [email protected] "," 255 [email protected] ","
244 [email protected] " " 256 [email protected] " "
245 [email protected] 257 [email protected]
@@ -249,12 +261,14 @@ [email protected]
249 [email protected] " " 261 [email protected] " "
250 [email protected] 262 [email protected]
251 [email protected] 263 [email protected]
252 [email protected] "\'a" 264 [email protected]
265 [email protected] "\'a"
253 [email protected] " " 266 [email protected] " "
254 [email protected] "+" 267 [email protected] "+"
255 [email protected] " " 268 [email protected] " "
256 [email protected] 269 [email protected]
257 [email protected] "\'d" 270 [email protected]
271 [email protected] "\'d"
258 [email protected] " " 272 [email protected] " "
259 [email protected] "+" 273 [email protected] "+"
260 [email protected] " " 274 [email protected] " "
diff --git a/crates/syntax/test_data/parser/ok/0032_where_for.rast b/crates/syntax/test_data/parser/ok/0032_where_for.rast
index d59548f21..0cb2eca33 100644
--- a/crates/syntax/test_data/parser/ok/0032_where_for.rast
+++ b/crates/syntax/test_data/parser/ok/0032_where_for.rast
@@ -41,7 +41,8 @@ [email protected]
41 [email protected] 41 [email protected]
42 [email protected] "<" 42 [email protected] "<"
43 [email protected] 43 [email protected]
44 [email protected] "\'de" 44 [email protected]
45 [email protected] "\'de"
45 [email protected] ">" 46 [email protected] ">"
46 [email protected] " " 47 [email protected] " "
47 [email protected] 48 [email protected]
@@ -52,7 +53,8 @@ [email protected]
52 [email protected] 53 [email protected]
53 [email protected] "<" 54 [email protected] "<"
54 [email protected] 55 [email protected]
55 [email protected] "\'de" 56 [email protected]
57 [email protected] "\'de"
56 [email protected] ">" 58 [email protected] ">"
57 [email protected] " " 59 [email protected] " "
58 [email protected] "+" 60 [email protected] "+"
diff --git a/crates/syntax/test_data/parser/ok/0033_label_break.rast b/crates/syntax/test_data/parser/ok/0033_label_break.rast
index 88800ca7a..487e073ba 100644
--- a/crates/syntax/test_data/parser/ok/0033_label_break.rast
+++ b/crates/syntax/test_data/parser/ok/0033_label_break.rast
@@ -16,7 +16,8 @@ [email protected]
16 [email protected] 16 [email protected]
17 [email protected] 17 [email protected]
18 [email protected] 18 [email protected]
19 [email protected] "\'empty_block" 19 [email protected]
20 [email protected] "\'empty_block"
20 [email protected] ":" 21 [email protected] ":"
21 [email protected] " " 22 [email protected] " "
22 [email protected] 23 [email protected]
@@ -26,7 +27,8 @@ [email protected]
26 [email protected] 27 [email protected]
27 [email protected] 28 [email protected]
28 [email protected] 29 [email protected]
29 [email protected] "\'block" 30 [email protected]
31 [email protected] "\'block"
30 [email protected] ":" 32 [email protected] ":"
31 [email protected] " " 33 [email protected] " "
32 [email protected] 34 [email protected]
@@ -66,7 +68,8 @@ [email protected]
66 [email protected] 68 [email protected]
67 [email protected] "break" 69 [email protected] "break"
68 [email protected] " " 70 [email protected] " "
69 [email protected] "\'block" 71 [email protected]
72 [email protected] "\'block"
70 [email protected] ";" 73 [email protected] ";"
71 [email protected] "\n " 74 [email protected] "\n "
72 [email protected] "}" 75 [email protected] "}"
@@ -105,7 +108,8 @@ [email protected]
105 [email protected] 108 [email protected]
106 [email protected] "break" 109 [email protected] "break"
107 [email protected] " " 110 [email protected] " "
108 [email protected] "\'block" 111 [email protected]
112 [email protected] "\'block"
109 [email protected] ";" 113 [email protected] ";"
110 [email protected] "\n " 114 [email protected] "\n "
111 [email protected] "}" 115 [email protected] "}"
@@ -135,7 +139,8 @@ [email protected]
135 [email protected] " " 139 [email protected] " "
136 [email protected] 140 [email protected]
137 [email protected] 141 [email protected]
138 [email protected] "\'block" 142 [email protected]
143 [email protected] "\'block"
139 [email protected] ":" 144 [email protected] ":"
140 [email protected] " " 145 [email protected] " "
141 [email protected] 146 [email protected]
@@ -165,7 +170,8 @@ [email protected]
165 [email protected] 170 [email protected]
166 [email protected] "break" 171 [email protected] "break"
167 [email protected] " " 172 [email protected] " "
168 [email protected] "\'block" 173 [email protected]
174 [email protected] "\'block"
169 [email protected] " " 175 [email protected] " "
170 [email protected] 176 [email protected]
171 [email protected] "1" 177 [email protected] "1"
@@ -197,7 +203,8 @@ [email protected]
197 [email protected] 203 [email protected]
198 [email protected] "break" 204 [email protected] "break"
199 [email protected] " " 205 [email protected] " "
200 [email protected] "\'block" 206 [email protected]
207 [email protected] "\'block"
201 [email protected] " " 208 [email protected] " "
202 [email protected] 209 [email protected]
203 [email protected] "2" 210 [email protected] "2"
diff --git a/crates/syntax/test_data/parser/ok/0035_weird_exprs.rast b/crates/syntax/test_data/parser/ok/0035_weird_exprs.rast
index 7c61b5006..46b192dc1 100644
--- a/crates/syntax/test_data/parser/ok/0035_weird_exprs.rast
+++ b/crates/syntax/test_data/parser/ok/0035_weird_exprs.rast
@@ -1373,14 +1373,14 @@ [email protected]
1373 [email protected] " " 1373 [email protected] " "
1374 [email protected] "u8" 1374 [email protected] "u8"
1375 [email protected] "<" 1375 [email protected] "<"
1376 [email protected] "\'u8" 1376 LIFETIME_IDENT@2380..2383 "\'u8"
1377 [email protected] ":" 1377 [email protected] ":"
1378 [email protected] " " 1378 [email protected] " "
1379 [email protected] "\'u8" 1379 LIFETIME_IDENT@2385..2388 "\'u8"
1380 [email protected] " " 1380 [email protected] " "
1381 [email protected] "+" 1381 [email protected] "+"
1382 [email protected] " " 1382 [email protected] " "
1383 [email protected] "\'u8" 1383 LIFETIME_IDENT@2391..2394 "\'u8"
1384 [email protected] ">" 1384 [email protected] ">"
1385 [email protected] 1385 [email protected]
1386 [email protected] "(" 1386 [email protected] "("
@@ -1388,7 +1388,7 @@ [email protected]
1388 [email protected] ":" 1388 [email protected] ":"
1389 [email protected] " " 1389 [email protected] " "
1390 [email protected] "&" 1390 [email protected] "&"
1391 [email protected] "\'u8" 1391 LIFETIME_IDENT@2401..2404 "\'u8"
1392 [email protected] " " 1392 [email protected] " "
1393 [email protected] "u8" 1393 [email protected] "u8"
1394 [email protected] ")" 1394 [email protected] ")"
@@ -1397,7 +1397,7 @@ [email protected]
1397 [email protected] ">" 1397 [email protected] ">"
1398 [email protected] " " 1398 [email protected] " "
1399 [email protected] "&" 1399 [email protected] "&"
1400 [email protected] "\'u8" 1400 LIFETIME_IDENT@2413..2416 "\'u8"
1401 [email protected] " " 1401 [email protected] " "
1402 [email protected] "u8" 1402 [email protected] "u8"
1403 [email protected] " " 1403 [email protected] " "
@@ -1568,7 +1568,8 @@ [email protected]
1568 [email protected] 1568 [email protected]
1569 [email protected] "<" 1569 [email protected] "<"
1570 [email protected] 1570 [email protected]
1571 [email protected] "\'union" 1571 [email protected]
1572 [email protected] "\'union"
1572 [email protected] ">" 1573 [email protected] ">"
1573 [email protected] " " 1574 [email protected] " "
1574 [email protected] 1575 [email protected]
@@ -1581,7 +1582,8 @@ [email protected]
1581 [email protected] " " 1582 [email protected] " "
1582 [email protected] 1583 [email protected]
1583 [email protected] "&" 1584 [email protected] "&"
1584 [email protected] "\'union" 1585 [email protected]
1586 [email protected] "\'union"
1585 [email protected] " " 1587 [email protected] " "
1586 [email protected] 1588 [email protected]
1587 [email protected] 1589 [email protected]
@@ -1591,7 +1593,8 @@ [email protected]
1591 [email protected] 1593 [email protected]
1592 [email protected] "<" 1594 [email protected] "<"
1593 [email protected] 1595 [email protected]
1594 [email protected] "\'union" 1596 [email protected]
1597 [email protected] "\'union"
1595 [email protected] ">" 1598 [email protected] ">"
1596 [email protected] "," 1599 [email protected] ","
1597 [email protected] " " 1600 [email protected] " "
diff --git a/crates/syntax/test_data/parser/ok/0051_parameter_attrs.rast b/crates/syntax/test_data/parser/ok/0051_parameter_attrs.rast
index d4f05f279..8974f9e40 100644
--- a/crates/syntax/test_data/parser/ok/0051_parameter_attrs.rast
+++ b/crates/syntax/test_data/parser/ok/0051_parameter_attrs.rast
@@ -175,7 +175,8 @@ [email protected]
175 [email protected] 175 [email protected]
176 [email protected] "<" 176 [email protected] "<"
177 [email protected] 177 [email protected]
178 [email protected] "\'a" 178 [email protected]
179 [email protected] "\'a"
179 [email protected] ">" 180 [email protected] ">"
180 [email protected] ")" 181 [email protected] ")"
181 [email protected] ">" 182 [email protected] ">"
@@ -344,7 +345,8 @@ [email protected]
344 [email protected] 345 [email protected]
345 [email protected] "<" 346 [email protected] "<"
346 [email protected] 347 [email protected]
347 [email protected] "\'a" 348 [email protected]
349 [email protected] "\'a"
348 [email protected] ">" 350 [email protected] ">"
349 [email protected] 351 [email protected]
350 [email protected] "(" 352 [email protected] "("
@@ -376,7 +378,8 @@ [email protected]
376 [email protected] 378 [email protected]
377 [email protected] "<" 379 [email protected] "<"
378 [email protected] 380 [email protected]
379 [email protected] "\'a" 381 [email protected]
382 [email protected] "\'a"
380 [email protected] ">" 383 [email protected] ">"
381 [email protected] 384 [email protected]
382 [email protected] "(" 385 [email protected] "("
@@ -391,7 +394,8 @@ [email protected]
391 [email protected] " " 394 [email protected] " "
392 [email protected] 395 [email protected]
393 [email protected] "&" 396 [email protected] "&"
394 [email protected] "\'a" 397 [email protected]
398 [email protected] "\'a"
395 [email protected] " " 399 [email protected] " "
396 [email protected] "self" 400 [email protected] "self"
397 [email protected] ")" 401 [email protected] ")"
@@ -408,7 +412,8 @@ [email protected]
408 [email protected] 412 [email protected]
409 [email protected] "<" 413 [email protected] "<"
410 [email protected] 414 [email protected]
411 [email protected] "\'a" 415 [email protected]
416 [email protected] "\'a"
412 [email protected] ">" 417 [email protected] ">"
413 [email protected] 418 [email protected]
414 [email protected] "(" 419 [email protected] "("
@@ -423,7 +428,8 @@ [email protected]
423 [email protected] " " 428 [email protected] " "
424 [email protected] 429 [email protected]
425 [email protected] "&" 430 [email protected] "&"
426 [email protected] "\'a" 431 [email protected]
432 [email protected] "\'a"
427 [email protected] " " 433 [email protected] " "
428 [email protected] "mut" 434 [email protected] "mut"
429 [email protected] " " 435 [email protected] " "
diff --git a/crates/syntax/test_data/parser/ok/0067_where_for_pred.rast b/crates/syntax/test_data/parser/ok/0067_where_for_pred.rast
index 8f8639a37..325e9e655 100644
--- a/crates/syntax/test_data/parser/ok/0067_where_for_pred.rast
+++ b/crates/syntax/test_data/parser/ok/0067_where_for_pred.rast
@@ -22,7 +22,8 @@ [email protected]
22 [email protected] 22 [email protected]
23 [email protected] "<" 23 [email protected] "<"
24 [email protected] 24 [email protected]
25 [email protected] "\'a" 25 [email protected]
26 [email protected] "\'a"
26 [email protected] ">" 27 [email protected] ">"
27 [email protected] " " 28 [email protected] " "
28 [email protected] 29 [email protected]
@@ -44,7 +45,8 @@ [email protected]
44 [email protected] 45 [email protected]
45 [email protected] 46 [email protected]
46 [email protected] "&" 47 [email protected] "&"
47 [email protected] "\'a" 48 [email protected]
49 [email protected] "\'a"
48 [email protected] " " 50 [email protected] " "
49 [email protected] 51 [email protected]
50 [email protected] 52 [email protected]
@@ -82,12 +84,14 @@ [email protected]
82 [email protected] 84 [email protected]
83 [email protected] "<" 85 [email protected] "<"
84 [email protected] 86 [email protected]
85 [email protected] "\'a" 87 [email protected]
88 [email protected] "\'a"
86 [email protected] ">" 89 [email protected] ">"
87 [email protected] " " 90 [email protected] " "
88 [email protected] 91 [email protected]
89 [email protected] "&" 92 [email protected] "&"
90 [email protected] "\'a" 93 [email protected]
94 [email protected] "\'a"
91 [email protected] " " 95 [email protected] " "
92 [email protected] 96 [email protected]
93 [email protected] 97 [email protected]
@@ -133,14 +137,16 @@ [email protected]
133 [email protected] 137 [email protected]
134 [email protected] "<" 138 [email protected] "<"
135 [email protected] 139 [email protected]
136 [email protected] "\'a" 140 [email protected]
141 [email protected] "\'a"
137 [email protected] ">" 142 [email protected] ">"
138 [email protected] " " 143 [email protected] " "
139 [email protected] 144 [email protected]
140 [email protected] "(" 145 [email protected] "("
141 [email protected] 146 [email protected]
142 [email protected] "&" 147 [email protected] "&"
143 [email protected] "\'a" 148 [email protected]
149 [email protected] "\'a"
144 [email protected] " " 150 [email protected] " "
145 [email protected] 151 [email protected]
146 [email protected] 152 [email protected]
@@ -162,7 +168,8 @@ [email protected]
162 [email protected] 168 [email protected]
163 [email protected] 169 [email protected]
164 [email protected] "&" 170 [email protected] "&"
165 [email protected] "\'a" 171 [email protected]
172 [email protected] "\'a"
166 [email protected] " " 173 [email protected] " "
167 [email protected] 174 [email protected]
168 [email protected] 175 [email protected]
@@ -200,14 +207,16 @@ [email protected]
200 [email protected] 207 [email protected]
201 [email protected] "<" 208 [email protected] "<"
202 [email protected] 209 [email protected]
203 [email protected] "\'a" 210 [email protected]
211 [email protected] "\'a"
204 [email protected] ">" 212 [email protected] ">"
205 [email protected] " " 213 [email protected] " "
206 [email protected] 214 [email protected]
207 [email protected] "[" 215 [email protected] "["
208 [email protected] 216 [email protected]
209 [email protected] "&" 217 [email protected] "&"
210 [email protected] "\'a" 218 [email protected]
219 [email protected] "\'a"
211 [email protected] " " 220 [email protected] " "
212 [email protected] 221 [email protected]
213 [email protected] 222 [email protected]
@@ -267,7 +276,8 @@ [email protected]
267 [email protected] 276 [email protected]
268 [email protected] "<" 277 [email protected] "<"
269 [email protected] 278 [email protected]
270 [email protected] "\'a" 279 [email protected]
280 [email protected] "\'a"
271 [email protected] ">" 281 [email protected] ">"
272 [email protected] " " 282 [email protected] " "
273 [email protected] 283 [email protected]
@@ -277,7 +287,8 @@ [email protected]
277 [email protected] "<" 287 [email protected] "<"
278 [email protected] 288 [email protected]
279 [email protected] "&" 289 [email protected] "&"
280 [email protected] "\'a" 290 [email protected]
291 [email protected] "\'a"
281 [email protected] " " 292 [email protected] " "
282 [email protected] 293 [email protected]
283 [email protected] 294 [email protected]
@@ -336,7 +347,8 @@ [email protected]
336 [email protected] 347 [email protected]
337 [email protected] "<" 348 [email protected] "<"
338 [email protected] 349 [email protected]
339 [email protected] "\'a" 350 [email protected]
351 [email protected] "\'a"
340 [email protected] ">" 352 [email protected] ">"
341 [email protected] " " 353 [email protected] " "
342 [email protected] 354 [email protected]
@@ -344,7 +356,8 @@ [email protected]
344 [email protected] 356 [email protected]
345 [email protected] "<" 357 [email protected] "<"
346 [email protected] 358 [email protected]
347 [email protected] "\'b" 359 [email protected]
360 [email protected] "\'b"
348 [email protected] ">" 361 [email protected] ">"
349 [email protected] " " 362 [email protected] " "
350 [email protected] 363 [email protected]
@@ -354,7 +367,8 @@ [email protected]
354 [email protected] 367 [email protected]
355 [email protected] 368 [email protected]
356 [email protected] "&" 369 [email protected] "&"
357 [email protected] "\'a" 370 [email protected]
371 [email protected] "\'a"
358 [email protected] " " 372 [email protected] " "
359 [email protected] 373 [email protected]
360 [email protected] 374 [email protected]
@@ -366,7 +380,8 @@ [email protected]
366 [email protected] 380 [email protected]
367 [email protected] 381 [email protected]
368 [email protected] "&" 382 [email protected] "&"
369 [email protected] "\'b" 383 [email protected]
384 [email protected] "\'b"
370 [email protected] " " 385 [email protected] " "
371 [email protected] 386 [email protected]
372 [email protected] 387 [email protected]
diff --git a/crates/syntax/test_data/parser/ok/0069_multi_trait_object.rast b/crates/syntax/test_data/parser/ok/0069_multi_trait_object.rast
index 0cd868a83..8d3e187ae 100644
--- a/crates/syntax/test_data/parser/ok/0069_multi_trait_object.rast
+++ b/crates/syntax/test_data/parser/ok/0069_multi_trait_object.rast
@@ -7,14 +7,16 @@ [email protected]
7 [email protected] 7 [email protected]
8 [email protected] "<" 8 [email protected] "<"
9 [email protected] 9 [email protected]
10 [email protected] "\'a" 10 [email protected]
11 [email protected] "\'a"
11 [email protected] ">" 12 [email protected] ">"
12 [email protected] " " 13 [email protected] " "
13 [email protected] "=" 14 [email protected] "="
14 [email protected] " " 15 [email protected] " "
15 [email protected] 16 [email protected]
16 [email protected] "&" 17 [email protected] "&"
17 [email protected] "\'a" 18 [email protected]
19 [email protected] "\'a"
18 [email protected] " " 20 [email protected] " "
19 [email protected] 21 [email protected]
20 [email protected] "(" 22 [email protected] "("
@@ -109,7 +111,8 @@ [email protected]
109 [email protected] "+" 111 [email protected] "+"
110 [email protected] " " 112 [email protected] " "
111 [email protected] 113 [email protected]
112 [email protected] "\'static" 114 [email protected]
115 [email protected] "\'static"
113 [email protected] ")" 116 [email protected] ")"
114 [email protected] ";" 117 [email protected] ";"
115 [email protected] "\n" 118 [email protected] "\n"