aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-07-30 20:03:25 +0100
committerGitHub <[email protected]>2020-07-30 20:03:25 +0100
commit239dd506f68db0cbe4417b6e5c7f737d8ff8a159 (patch)
treedd3503a2be3a6699a6b111844dbcdc85b37e2425 /crates
parent134d3c3c5068abc5ed3e03fe5df2b524ea70753d (diff)
parentf95f425ae4199e814e6956be1d9bb59a14758c07 (diff)
Merge #5613
5613: Use ty to access most TypeRefs r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_assists/src/handlers/change_return_type_to_result.rs2
-rw-r--r--crates/ra_assists/src/handlers/generate_from_impl_for_enum.rs2
-rw-r--r--crates/ra_hir_def/src/adt.rs2
-rw-r--r--crates/ra_hir_def/src/body/lower.rs8
-rw-r--r--crates/ra_hir_def/src/item_tree/lower.rs6
-rw-r--r--crates/ra_hir_def/src/path/lower.rs2
-rw-r--r--crates/ra_hir_def/src/type_ref.rs14
-rw-r--r--crates/ra_ide/src/display.rs2
-rw-r--r--crates/ra_ide/src/file_structure.rs2
-rw-r--r--crates/ra_syntax/src/ast/generated/nodes.rs20
10 files changed, 29 insertions, 31 deletions
diff --git a/crates/ra_assists/src/handlers/change_return_type_to_result.rs b/crates/ra_assists/src/handlers/change_return_type_to_result.rs
index 12018fc6a..167e162d8 100644
--- a/crates/ra_assists/src/handlers/change_return_type_to_result.rs
+++ b/crates/ra_assists/src/handlers/change_return_type_to_result.rs
@@ -22,7 +22,7 @@ pub(crate) fn change_return_type_to_result(acc: &mut Assists, ctx: &AssistContex
22 // FIXME: extend to lambdas as well 22 // FIXME: extend to lambdas as well
23 let fn_def = ret_type.syntax().parent().and_then(ast::Fn::cast)?; 23 let fn_def = ret_type.syntax().parent().and_then(ast::Fn::cast)?;
24 24
25 let type_ref = &ret_type.type_ref()?; 25 let type_ref = &ret_type.ty()?;
26 let ret_type_str = type_ref.syntax().text().to_string(); 26 let ret_type_str = type_ref.syntax().text().to_string();
27 let first_part_ret_type = ret_type_str.splitn(2, '<').next(); 27 let first_part_ret_type = ret_type_str.splitn(2, '<').next();
28 if let Some(ret_type_first_part) = first_part_ret_type { 28 if let Some(ret_type_first_part) = first_part_ret_type {
diff --git a/crates/ra_assists/src/handlers/generate_from_impl_for_enum.rs b/crates/ra_assists/src/handlers/generate_from_impl_for_enum.rs
index 5b282a30a..9da23640a 100644
--- a/crates/ra_assists/src/handlers/generate_from_impl_for_enum.rs
+++ b/crates/ra_assists/src/handlers/generate_from_impl_for_enum.rs
@@ -32,7 +32,7 @@ pub(crate) fn generate_from_impl_for_enum(acc: &mut Assists, ctx: &AssistContext
32 if field_list.fields().count() != 1 { 32 if field_list.fields().count() != 1 {
33 return None; 33 return None;
34 } 34 }
35 let field_type = field_list.fields().next()?.type_ref()?; 35 let field_type = field_list.fields().next()?.ty()?;
36 let path = match field_type { 36 let path = match field_type {
37 ast::TypeRef::PathType(it) => it, 37 ast::TypeRef::PathType(it) => it,
38 _ => return None, 38 _ => return None,
diff --git a/crates/ra_hir_def/src/adt.rs b/crates/ra_hir_def/src/adt.rs
index f8523d03f..6cb56a1cd 100644
--- a/crates/ra_hir_def/src/adt.rs
+++ b/crates/ra_hir_def/src/adt.rs
@@ -234,7 +234,7 @@ fn lower_struct(
234 || Either::Left(fd.clone()), 234 || Either::Left(fd.clone()),
235 || FieldData { 235 || FieldData {
236 name: Name::new_tuple_field(i), 236 name: Name::new_tuple_field(i),
237 type_ref: TypeRef::from_ast_opt(&ctx, fd.type_ref()), 237 type_ref: TypeRef::from_ast_opt(&ctx, fd.ty()),
238 visibility: RawVisibility::from_ast(db, ast.with_value(fd.visibility())), 238 visibility: RawVisibility::from_ast(db, ast.with_value(fd.visibility())),
239 }, 239 },
240 ); 240 );
diff --git a/crates/ra_hir_def/src/body/lower.rs b/crates/ra_hir_def/src/body/lower.rs
index 288ca76c3..827ced4ad 100644
--- a/crates/ra_hir_def/src/body/lower.rs
+++ b/crates/ra_hir_def/src/body/lower.rs
@@ -432,7 +432,7 @@ impl ExprCollector<'_> {
432 } 432 }
433 ast::Expr::CastExpr(e) => { 433 ast::Expr::CastExpr(e) => {
434 let expr = self.collect_expr_opt(e.expr()); 434 let expr = self.collect_expr_opt(e.expr());
435 let type_ref = TypeRef::from_ast_opt(&self.ctx(), e.type_ref()); 435 let type_ref = TypeRef::from_ast_opt(&self.ctx(), e.ty());
436 self.alloc_expr(Expr::Cast { expr, type_ref }, syntax_ptr) 436 self.alloc_expr(Expr::Cast { expr, type_ref }, syntax_ptr)
437 } 437 }
438 ast::Expr::RefExpr(e) => { 438 ast::Expr::RefExpr(e) => {
@@ -471,10 +471,8 @@ impl ExprCollector<'_> {
471 arg_types.push(type_ref); 471 arg_types.push(type_ref);
472 } 472 }
473 } 473 }
474 let ret_type = e 474 let ret_type =
475 .ret_type() 475 e.ret_type().and_then(|r| r.ty()).map(|it| TypeRef::from_ast(&self.ctx(), it));
476 .and_then(|r| r.type_ref())
477 .map(|it| TypeRef::from_ast(&self.ctx(), it));
478 let body = self.collect_expr_opt(e.body()); 476 let body = self.collect_expr_opt(e.body());
479 self.alloc_expr(Expr::Lambda { args, arg_types, ret_type, body }, syntax_ptr) 477 self.alloc_expr(Expr::Lambda { args, arg_types, ret_type, body }, syntax_ptr)
480 } 478 }
diff --git a/crates/ra_hir_def/src/item_tree/lower.rs b/crates/ra_hir_def/src/item_tree/lower.rs
index f0ced1f79..feb31579e 100644
--- a/crates/ra_hir_def/src/item_tree/lower.rs
+++ b/crates/ra_hir_def/src/item_tree/lower.rs
@@ -228,7 +228,7 @@ impl Ctx {
228 fn lower_tuple_field(&mut self, idx: usize, field: &ast::TupleField) -> Field { 228 fn lower_tuple_field(&mut self, idx: usize, field: &ast::TupleField) -> Field {
229 let name = Name::new_tuple_field(idx); 229 let name = Name::new_tuple_field(idx);
230 let visibility = self.lower_visibility(field); 230 let visibility = self.lower_visibility(field);
231 let type_ref = self.lower_type_ref_opt(field.type_ref()); 231 let type_ref = self.lower_type_ref_opt(field.ty());
232 let res = Field { name, type_ref, visibility }; 232 let res = Field { name, type_ref, visibility };
233 res 233 res
234 } 234 }
@@ -317,7 +317,7 @@ impl Ctx {
317 } 317 }
318 } 318 }
319 319
320 let ret_type = match func.ret_type().and_then(|rt| rt.type_ref()) { 320 let ret_type = match func.ret_type().and_then(|rt| rt.ty()) {
321 Some(type_ref) => TypeRef::from_ast(&self.body_ctx, type_ref), 321 Some(type_ref) => TypeRef::from_ast(&self.body_ctx, type_ref),
322 _ => TypeRef::unit(), 322 _ => TypeRef::unit(),
323 }; 323 };
@@ -352,7 +352,7 @@ impl Ctx {
352 type_alias: &ast::TypeAlias, 352 type_alias: &ast::TypeAlias,
353 ) -> Option<FileItemTreeId<TypeAlias>> { 353 ) -> Option<FileItemTreeId<TypeAlias>> {
354 let name = type_alias.name()?.as_name(); 354 let name = type_alias.name()?.as_name();
355 let type_ref = type_alias.type_ref().map(|it| self.lower_type_ref(&it)); 355 let type_ref = type_alias.ty().map(|it| self.lower_type_ref(&it));
356 let visibility = self.lower_visibility(type_alias); 356 let visibility = self.lower_visibility(type_alias);
357 let bounds = self.lower_type_bounds(type_alias); 357 let bounds = self.lower_type_bounds(type_alias);
358 let generic_params = self.lower_generic_params(GenericsOwner::TypeAlias, type_alias); 358 let generic_params = self.lower_generic_params(GenericsOwner::TypeAlias, type_alias);
diff --git a/crates/ra_hir_def/src/path/lower.rs b/crates/ra_hir_def/src/path/lower.rs
index dfab15948..07d17916a 100644
--- a/crates/ra_hir_def/src/path/lower.rs
+++ b/crates/ra_hir_def/src/path/lower.rs
@@ -196,7 +196,7 @@ fn lower_generic_args_from_fn_path(
196 args.push(arg); 196 args.push(arg);
197 } 197 }
198 if let Some(ret_type) = ret_type { 198 if let Some(ret_type) = ret_type {
199 let type_ref = TypeRef::from_ast_opt(&ctx, ret_type.type_ref()); 199 let type_ref = TypeRef::from_ast_opt(&ctx, ret_type.ty());
200 bindings.push(AssociatedTypeBinding { 200 bindings.push(AssociatedTypeBinding {
201 name: name![Output], 201 name: name![Output],
202 type_ref: Some(type_ref), 202 type_ref: Some(type_ref),
diff --git a/crates/ra_hir_def/src/type_ref.rs b/crates/ra_hir_def/src/type_ref.rs
index 4059302df..a5dc10eac 100644
--- a/crates/ra_hir_def/src/type_ref.rs
+++ b/crates/ra_hir_def/src/type_ref.rs
@@ -82,7 +82,7 @@ impl TypeRef {
82 /// Converts an `ast::TypeRef` to a `hir::TypeRef`. 82 /// Converts an `ast::TypeRef` to a `hir::TypeRef`.
83 pub(crate) fn from_ast(ctx: &LowerCtx, node: ast::TypeRef) -> Self { 83 pub(crate) fn from_ast(ctx: &LowerCtx, node: ast::TypeRef) -> Self {
84 match node { 84 match node {
85 ast::TypeRef::ParenType(inner) => TypeRef::from_ast_opt(&ctx, inner.type_ref()), 85 ast::TypeRef::ParenType(inner) => TypeRef::from_ast_opt(&ctx, inner.ty()),
86 ast::TypeRef::TupleType(inner) => { 86 ast::TypeRef::TupleType(inner) => {
87 TypeRef::Tuple(inner.fields().map(|it| TypeRef::from_ast(ctx, it)).collect()) 87 TypeRef::Tuple(inner.fields().map(|it| TypeRef::from_ast(ctx, it)).collect())
88 } 88 }
@@ -96,18 +96,18 @@ impl TypeRef {
96 .unwrap_or(TypeRef::Error) 96 .unwrap_or(TypeRef::Error)
97 } 97 }
98 ast::TypeRef::PointerType(inner) => { 98 ast::TypeRef::PointerType(inner) => {
99 let inner_ty = TypeRef::from_ast_opt(&ctx, inner.type_ref()); 99 let inner_ty = TypeRef::from_ast_opt(&ctx, inner.ty());
100 let mutability = Mutability::from_mutable(inner.mut_token().is_some()); 100 let mutability = Mutability::from_mutable(inner.mut_token().is_some());
101 TypeRef::RawPtr(Box::new(inner_ty), mutability) 101 TypeRef::RawPtr(Box::new(inner_ty), mutability)
102 } 102 }
103 ast::TypeRef::ArrayType(inner) => { 103 ast::TypeRef::ArrayType(inner) => {
104 TypeRef::Array(Box::new(TypeRef::from_ast_opt(&ctx, inner.type_ref()))) 104 TypeRef::Array(Box::new(TypeRef::from_ast_opt(&ctx, inner.ty())))
105 } 105 }
106 ast::TypeRef::SliceType(inner) => { 106 ast::TypeRef::SliceType(inner) => {
107 TypeRef::Slice(Box::new(TypeRef::from_ast_opt(&ctx, inner.type_ref()))) 107 TypeRef::Slice(Box::new(TypeRef::from_ast_opt(&ctx, inner.ty())))
108 } 108 }
109 ast::TypeRef::ReferenceType(inner) => { 109 ast::TypeRef::ReferenceType(inner) => {
110 let inner_ty = TypeRef::from_ast_opt(&ctx, inner.type_ref()); 110 let inner_ty = TypeRef::from_ast_opt(&ctx, inner.ty());
111 let mutability = Mutability::from_mutable(inner.mut_token().is_some()); 111 let mutability = Mutability::from_mutable(inner.mut_token().is_some());
112 TypeRef::Reference(Box::new(inner_ty), mutability) 112 TypeRef::Reference(Box::new(inner_ty), mutability)
113 } 113 }
@@ -115,7 +115,7 @@ impl TypeRef {
115 ast::TypeRef::FnPointerType(inner) => { 115 ast::TypeRef::FnPointerType(inner) => {
116 let ret_ty = inner 116 let ret_ty = inner
117 .ret_type() 117 .ret_type()
118 .and_then(|rt| rt.type_ref()) 118 .and_then(|rt| rt.ty())
119 .map(|it| TypeRef::from_ast(ctx, it)) 119 .map(|it| TypeRef::from_ast(ctx, it))
120 .unwrap_or_else(|| TypeRef::Tuple(Vec::new())); 120 .unwrap_or_else(|| TypeRef::Tuple(Vec::new()));
121 let mut is_varargs = false; 121 let mut is_varargs = false;
@@ -132,7 +132,7 @@ impl TypeRef {
132 TypeRef::Fn(params, is_varargs) 132 TypeRef::Fn(params, is_varargs)
133 } 133 }
134 // for types are close enough for our purposes to the inner type for now... 134 // for types are close enough for our purposes to the inner type for now...
135 ast::TypeRef::ForType(inner) => TypeRef::from_ast_opt(&ctx, inner.type_ref()), 135 ast::TypeRef::ForType(inner) => TypeRef::from_ast_opt(&ctx, inner.ty()),
136 ast::TypeRef::ImplTraitType(inner) => { 136 ast::TypeRef::ImplTraitType(inner) => {
137 TypeRef::ImplTrait(type_bounds_from_ast(ctx, inner.type_bound_list())) 137 TypeRef::ImplTrait(type_bounds_from_ast(ctx, inner.type_bound_list()))
138 } 138 }
diff --git a/crates/ra_ide/src/display.rs b/crates/ra_ide/src/display.rs
index 3efca0649..fd42aa435 100644
--- a/crates/ra_ide/src/display.rs
+++ b/crates/ra_ide/src/display.rs
@@ -44,7 +44,7 @@ pub(crate) fn function_declaration(node: &ast::Fn) -> String {
44 format_to!(buf, "{}", param_list); 44 format_to!(buf, "{}", param_list);
45 } 45 }
46 if let Some(ret_type) = node.ret_type() { 46 if let Some(ret_type) = node.ret_type() {
47 if ret_type.type_ref().is_some() { 47 if ret_type.ty().is_some() {
48 format_to!(buf, " {}", ret_type); 48 format_to!(buf, " {}", ret_type);
49 } 49 }
50 } 50 }
diff --git a/crates/ra_ide/src/file_structure.rs b/crates/ra_ide/src/file_structure.rs
index 22cf8637a..91765140a 100644
--- a/crates/ra_ide/src/file_structure.rs
+++ b/crates/ra_ide/src/file_structure.rs
@@ -125,7 +125,7 @@ fn structure_node(node: &SyntaxNode) -> Option<StructureNode> {
125 ast::Variant(it) => decl(it), 125 ast::Variant(it) => decl(it),
126 ast::Trait(it) => decl(it), 126 ast::Trait(it) => decl(it),
127 ast::Module(it) => decl(it), 127 ast::Module(it) => decl(it),
128 ast::TypeAlias(it) => decl_with_type_ref(&it, it.type_ref()), 128 ast::TypeAlias(it) => decl_with_type_ref(&it, it.ty()),
129 ast::RecordField(it) => decl_with_type_ref(&it, it.ty()), 129 ast::RecordField(it) => decl_with_type_ref(&it, it.ty()),
130 ast::Const(it) => decl_with_type_ref(&it, it.ty()), 130 ast::Const(it) => decl_with_type_ref(&it, it.ty()),
131 ast::Static(it) => decl_with_type_ref(&it, it.ty()), 131 ast::Static(it) => decl_with_type_ref(&it, it.ty()),
diff --git a/crates/ra_syntax/src/ast/generated/nodes.rs b/crates/ra_syntax/src/ast/generated/nodes.rs
index 207826979..4306efe13 100644
--- a/crates/ra_syntax/src/ast/generated/nodes.rs
+++ b/crates/ra_syntax/src/ast/generated/nodes.rs
@@ -198,7 +198,7 @@ impl TypeAlias {
198 pub fn default_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![default]) } 198 pub fn default_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![default]) }
199 pub fn type_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![type]) } 199 pub fn type_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![type]) }
200 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } 200 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) }
201 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } 201 pub fn ty(&self) -> Option<TypeRef> { support::child(&self.syntax) }
202 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } 202 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
203} 203}
204#[derive(Debug, Clone, PartialEq, Eq, Hash)] 204#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -333,7 +333,7 @@ pub struct RetType {
333} 333}
334impl RetType { 334impl RetType {
335 pub fn thin_arrow_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![->]) } 335 pub fn thin_arrow_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![->]) }
336 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } 336 pub fn ty(&self) -> Option<TypeRef> { support::child(&self.syntax) }
337} 337}
338#[derive(Debug, Clone, PartialEq, Eq, Hash)] 338#[derive(Debug, Clone, PartialEq, Eq, Hash)]
339pub struct WhereClause { 339pub struct WhereClause {
@@ -425,7 +425,7 @@ pub struct TupleField {
425impl ast::AttrsOwner for TupleField {} 425impl ast::AttrsOwner for TupleField {}
426impl ast::VisibilityOwner for TupleField {} 426impl ast::VisibilityOwner for TupleField {}
427impl TupleField { 427impl TupleField {
428 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } 428 pub fn ty(&self) -> Option<TypeRef> { support::child(&self.syntax) }
429} 429}
430#[derive(Debug, Clone, PartialEq, Eq, Hash)] 430#[derive(Debug, Clone, PartialEq, Eq, Hash)]
431pub struct VariantList { 431pub struct VariantList {
@@ -525,7 +525,7 @@ pub struct ParenType {
525} 525}
526impl ParenType { 526impl ParenType {
527 pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } 527 pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) }
528 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } 528 pub fn ty(&self) -> Option<TypeRef> { support::child(&self.syntax) }
529 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } 529 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) }
530} 530}
531#[derive(Debug, Clone, PartialEq, Eq, Hash)] 531#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -559,7 +559,7 @@ impl PointerType {
559 pub fn star_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![*]) } 559 pub fn star_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![*]) }
560 pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } 560 pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) }
561 pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } 561 pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) }
562 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } 562 pub fn ty(&self) -> Option<TypeRef> { support::child(&self.syntax) }
563} 563}
564#[derive(Debug, Clone, PartialEq, Eq, Hash)] 564#[derive(Debug, Clone, PartialEq, Eq, Hash)]
565pub struct ArrayType { 565pub struct ArrayType {
@@ -567,7 +567,7 @@ pub struct ArrayType {
567} 567}
568impl ArrayType { 568impl ArrayType {
569 pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } 569 pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) }
570 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } 570 pub fn ty(&self) -> Option<TypeRef> { support::child(&self.syntax) }
571 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } 571 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
572 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } 572 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
573 pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } 573 pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) }
@@ -578,7 +578,7 @@ pub struct SliceType {
578} 578}
579impl SliceType { 579impl SliceType {
580 pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } 580 pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) }
581 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } 581 pub fn ty(&self) -> Option<TypeRef> { support::child(&self.syntax) }
582 pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } 582 pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) }
583} 583}
584#[derive(Debug, Clone, PartialEq, Eq, Hash)] 584#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -591,7 +591,7 @@ impl ReferenceType {
591 support::token(&self.syntax, T![lifetime]) 591 support::token(&self.syntax, T![lifetime])
592 } 592 }
593 pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } 593 pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) }
594 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } 594 pub fn ty(&self) -> Option<TypeRef> { support::child(&self.syntax) }
595} 595}
596#[derive(Debug, Clone, PartialEq, Eq, Hash)] 596#[derive(Debug, Clone, PartialEq, Eq, Hash)]
597pub struct PlaceholderType { 597pub struct PlaceholderType {
@@ -618,7 +618,7 @@ pub struct ForType {
618impl ForType { 618impl ForType {
619 pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) } 619 pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) }
620 pub fn generic_param_list(&self) -> Option<GenericParamList> { support::child(&self.syntax) } 620 pub fn generic_param_list(&self) -> Option<GenericParamList> { support::child(&self.syntax) }
621 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } 621 pub fn ty(&self) -> Option<TypeRef> { support::child(&self.syntax) }
622} 622}
623#[derive(Debug, Clone, PartialEq, Eq, Hash)] 623#[derive(Debug, Clone, PartialEq, Eq, Hash)]
624pub struct ImplTraitType { 624pub struct ImplTraitType {
@@ -882,7 +882,7 @@ impl ast::AttrsOwner for CastExpr {}
882impl CastExpr { 882impl CastExpr {
883 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } 883 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
884 pub fn as_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![as]) } 884 pub fn as_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![as]) }
885 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } 885 pub fn ty(&self) -> Option<TypeRef> { support::child(&self.syntax) }
886} 886}
887#[derive(Debug, Clone, PartialEq, Eq, Hash)] 887#[derive(Debug, Clone, PartialEq, Eq, Hash)]
888pub struct RefExpr { 888pub struct RefExpr {