aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-07-31 13:13:31 +0100
committerGitHub <[email protected]>2020-07-31 13:13:31 +0100
commiteccb5d52d3c4b82b6b61e231aa137b4aeb8c94ec (patch)
treea40a875cf0c364144d656f77b30b464f372f3667 /crates
parent8c802a3dbb5ea1dea8de17f59d0620e3a710474a (diff)
parenta6e45c6c69bf258118940941c12d057deb79e60c (diff)
Merge #5619
5619: Reame PlaceholderType -> InferType 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/add_explicit_type.rs2
-rw-r--r--crates/ra_hir_def/src/type_ref.rs2
-rw-r--r--crates/ra_parser/src/grammar/types.rs2
-rw-r--r--crates/ra_parser/src/syntax_kind/generated.rs2
-rw-r--r--crates/ra_syntax/src/ast/generated/nodes.rs22
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0023_placeholder_type.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0164_type_path_in_pattern.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0035_weird_exprs.rast4
8 files changed, 19 insertions, 19 deletions
diff --git a/crates/ra_assists/src/handlers/add_explicit_type.rs b/crates/ra_assists/src/handlers/add_explicit_type.rs
index e69f0a89b..d8b0af0f5 100644
--- a/crates/ra_assists/src/handlers/add_explicit_type.rs
+++ b/crates/ra_assists/src/handlers/add_explicit_type.rs
@@ -46,7 +46,7 @@ pub(crate) fn add_explicit_type(acc: &mut Assists, ctx: &AssistContext) -> Optio
46 // and it has no placeholders 46 // and it has no placeholders
47 let ascribed_ty = let_stmt.ty(); 47 let ascribed_ty = let_stmt.ty();
48 if let Some(ty) = &ascribed_ty { 48 if let Some(ty) = &ascribed_ty {
49 if ty.syntax().descendants().find_map(ast::PlaceholderType::cast).is_none() { 49 if ty.syntax().descendants().find_map(ast::InferType::cast).is_none() {
50 return None; 50 return None;
51 } 51 }
52 } 52 }
diff --git a/crates/ra_hir_def/src/type_ref.rs b/crates/ra_hir_def/src/type_ref.rs
index 9386b91cb..524c033b8 100644
--- a/crates/ra_hir_def/src/type_ref.rs
+++ b/crates/ra_hir_def/src/type_ref.rs
@@ -111,7 +111,7 @@ impl TypeRef {
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 }
114 ast::Type::PlaceholderType(_inner) => TypeRef::Placeholder, 114 ast::Type::InferType(_inner) => TypeRef::Placeholder,
115 ast::Type::FnPointerType(inner) => { 115 ast::Type::FnPointerType(inner) => {
116 let ret_ty = inner 116 let ret_ty = inner
117 .ret_type() 117 .ret_type()
diff --git a/crates/ra_parser/src/grammar/types.rs b/crates/ra_parser/src/grammar/types.rs
index 9e8e3bd97..e9a20fbf1 100644
--- a/crates/ra_parser/src/grammar/types.rs
+++ b/crates/ra_parser/src/grammar/types.rs
@@ -172,7 +172,7 @@ fn placeholder_type(p: &mut Parser) {
172 assert!(p.at(T![_])); 172 assert!(p.at(T![_]));
173 let m = p.start(); 173 let m = p.start();
174 p.bump(T![_]); 174 p.bump(T![_]);
175 m.complete(p, PLACEHOLDER_TYPE); 175 m.complete(p, INFER_TYPE);
176} 176}
177 177
178// test fn_pointer_type 178// test fn_pointer_type
diff --git a/crates/ra_parser/src/syntax_kind/generated.rs b/crates/ra_parser/src/syntax_kind/generated.rs
index be4da67bc..64ab18217 100644
--- a/crates/ra_parser/src/syntax_kind/generated.rs
+++ b/crates/ra_parser/src/syntax_kind/generated.rs
@@ -147,7 +147,7 @@ pub enum SyntaxKind {
147 ARRAY_TYPE, 147 ARRAY_TYPE,
148 SLICE_TYPE, 148 SLICE_TYPE,
149 REFERENCE_TYPE, 149 REFERENCE_TYPE,
150 PLACEHOLDER_TYPE, 150 INFER_TYPE,
151 FN_POINTER_TYPE, 151 FN_POINTER_TYPE,
152 FOR_TYPE, 152 FOR_TYPE,
153 IMPL_TRAIT_TYPE, 153 IMPL_TRAIT_TYPE,
diff --git a/crates/ra_syntax/src/ast/generated/nodes.rs b/crates/ra_syntax/src/ast/generated/nodes.rs
index 9cfd5d017..465cb3202 100644
--- a/crates/ra_syntax/src/ast/generated/nodes.rs
+++ b/crates/ra_syntax/src/ast/generated/nodes.rs
@@ -594,10 +594,10 @@ impl ReferenceType {
594 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } 594 pub fn ty(&self) -> Option<Type> { 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 InferType {
598 pub(crate) syntax: SyntaxNode, 598 pub(crate) syntax: SyntaxNode,
599} 599}
600impl PlaceholderType { 600impl InferType {
601 pub fn underscore_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![_]) } 601 pub fn underscore_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![_]) }
602} 602}
603#[derive(Debug, Clone, PartialEq, Eq, Hash)] 603#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -1291,7 +1291,7 @@ pub enum Type {
1291 ArrayType(ArrayType), 1291 ArrayType(ArrayType),
1292 SliceType(SliceType), 1292 SliceType(SliceType),
1293 ReferenceType(ReferenceType), 1293 ReferenceType(ReferenceType),
1294 PlaceholderType(PlaceholderType), 1294 InferType(InferType),
1295 FnPointerType(FnPointerType), 1295 FnPointerType(FnPointerType),
1296 ForType(ForType), 1296 ForType(ForType),
1297 ImplTraitType(ImplTraitType), 1297 ImplTraitType(ImplTraitType),
@@ -1988,8 +1988,8 @@ impl AstNode for ReferenceType {
1988 } 1988 }
1989 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1989 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1990} 1990}
1991impl AstNode for PlaceholderType { 1991impl AstNode for InferType {
1992 fn can_cast(kind: SyntaxKind) -> bool { kind == PLACEHOLDER_TYPE } 1992 fn can_cast(kind: SyntaxKind) -> bool { kind == INFER_TYPE }
1993 fn cast(syntax: SyntaxNode) -> Option<Self> { 1993 fn cast(syntax: SyntaxNode) -> Option<Self> {
1994 if Self::can_cast(syntax.kind()) { 1994 if Self::can_cast(syntax.kind()) {
1995 Some(Self { syntax }) 1995 Some(Self { syntax })
@@ -2871,8 +2871,8 @@ impl From<SliceType> for Type {
2871impl From<ReferenceType> for Type { 2871impl From<ReferenceType> for Type {
2872 fn from(node: ReferenceType) -> Type { Type::ReferenceType(node) } 2872 fn from(node: ReferenceType) -> Type { Type::ReferenceType(node) }
2873} 2873}
2874impl From<PlaceholderType> for Type { 2874impl From<InferType> for Type {
2875 fn from(node: PlaceholderType) -> Type { Type::PlaceholderType(node) } 2875 fn from(node: InferType) -> Type { Type::InferType(node) }
2876} 2876}
2877impl From<FnPointerType> for Type { 2877impl From<FnPointerType> for Type {
2878 fn from(node: FnPointerType) -> Type { Type::FnPointerType(node) } 2878 fn from(node: FnPointerType) -> Type { Type::FnPointerType(node) }
@@ -2890,7 +2890,7 @@ impl AstNode for Type {
2890 fn can_cast(kind: SyntaxKind) -> bool { 2890 fn can_cast(kind: SyntaxKind) -> bool {
2891 match kind { 2891 match kind {
2892 PAREN_TYPE | TUPLE_TYPE | NEVER_TYPE | PATH_TYPE | POINTER_TYPE | ARRAY_TYPE 2892 PAREN_TYPE | TUPLE_TYPE | NEVER_TYPE | PATH_TYPE | POINTER_TYPE | ARRAY_TYPE
2893 | SLICE_TYPE | REFERENCE_TYPE | PLACEHOLDER_TYPE | FN_POINTER_TYPE | FOR_TYPE 2893 | SLICE_TYPE | REFERENCE_TYPE | INFER_TYPE | FN_POINTER_TYPE | FOR_TYPE
2894 | IMPL_TRAIT_TYPE | DYN_TRAIT_TYPE => true, 2894 | IMPL_TRAIT_TYPE | DYN_TRAIT_TYPE => true,
2895 _ => false, 2895 _ => false,
2896 } 2896 }
@@ -2905,7 +2905,7 @@ impl AstNode for Type {
2905 ARRAY_TYPE => Type::ArrayType(ArrayType { syntax }), 2905 ARRAY_TYPE => Type::ArrayType(ArrayType { syntax }),
2906 SLICE_TYPE => Type::SliceType(SliceType { syntax }), 2906 SLICE_TYPE => Type::SliceType(SliceType { syntax }),
2907 REFERENCE_TYPE => Type::ReferenceType(ReferenceType { syntax }), 2907 REFERENCE_TYPE => Type::ReferenceType(ReferenceType { syntax }),
2908 PLACEHOLDER_TYPE => Type::PlaceholderType(PlaceholderType { syntax }), 2908 INFER_TYPE => Type::InferType(InferType { syntax }),
2909 FN_POINTER_TYPE => Type::FnPointerType(FnPointerType { syntax }), 2909 FN_POINTER_TYPE => Type::FnPointerType(FnPointerType { syntax }),
2910 FOR_TYPE => Type::ForType(ForType { syntax }), 2910 FOR_TYPE => Type::ForType(ForType { syntax }),
2911 IMPL_TRAIT_TYPE => Type::ImplTraitType(ImplTraitType { syntax }), 2911 IMPL_TRAIT_TYPE => Type::ImplTraitType(ImplTraitType { syntax }),
@@ -2924,7 +2924,7 @@ impl AstNode for Type {
2924 Type::ArrayType(it) => &it.syntax, 2924 Type::ArrayType(it) => &it.syntax,
2925 Type::SliceType(it) => &it.syntax, 2925 Type::SliceType(it) => &it.syntax,
2926 Type::ReferenceType(it) => &it.syntax, 2926 Type::ReferenceType(it) => &it.syntax,
2927 Type::PlaceholderType(it) => &it.syntax, 2927 Type::InferType(it) => &it.syntax,
2928 Type::FnPointerType(it) => &it.syntax, 2928 Type::FnPointerType(it) => &it.syntax,
2929 Type::ForType(it) => &it.syntax, 2929 Type::ForType(it) => &it.syntax,
2930 Type::ImplTraitType(it) => &it.syntax, 2930 Type::ImplTraitType(it) => &it.syntax,
@@ -3719,7 +3719,7 @@ impl std::fmt::Display for ReferenceType {
3719 std::fmt::Display::fmt(self.syntax(), f) 3719 std::fmt::Display::fmt(self.syntax(), f)
3720 } 3720 }
3721} 3721}
3722impl std::fmt::Display for PlaceholderType { 3722impl std::fmt::Display for InferType {
3723 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3723 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3724 std::fmt::Display::fmt(self.syntax(), f) 3724 std::fmt::Display::fmt(self.syntax(), f)
3725 } 3725 }
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0023_placeholder_type.rast b/crates/ra_syntax/test_data/parser/inline/ok/0023_placeholder_type.rast
index 57008e5fe..e4fe2b948 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0023_placeholder_type.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0023_placeholder_type.rast
@@ -7,7 +7,7 @@ [email protected]
7 [email protected] " " 7 [email protected] " "
8 [email protected] "=" 8 [email protected] "="
9 [email protected] " " 9 [email protected] " "
10 PLACEHOLDE[email protected] 10 INF[email protected]
11 [email protected] "_" 11 [email protected] "_"
12 [email protected] ";" 12 [email protected] ";"
13 [email protected] "\n" 13 [email protected] "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0164_type_path_in_pattern.rast b/crates/ra_syntax/test_data/parser/inline/ok/0164_type_path_in_pattern.rast
index f5e20b93d..f8910677b 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0164_type_path_in_pattern.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0164_type_path_in_pattern.rast
@@ -19,7 +19,7 @@ [email protected]
19 [email protected] 19 [email protected]
20 [email protected] 20 [email protected]
21 [email protected] "<" 21 [email protected] "<"
22 PLACEHOLDE[email protected] 22 INF[email protected]
23 [email protected] "_" 23 [email protected] "_"
24 [email protected] ">" 24 [email protected] ">"
25 [email protected] "::" 25 [email protected] "::"
diff --git a/crates/ra_syntax/test_data/parser/ok/0035_weird_exprs.rast b/crates/ra_syntax/test_data/parser/ok/0035_weird_exprs.rast
index b04a505ea..66cd5727a 100644
--- a/crates/ra_syntax/test_data/parser/ok/0035_weird_exprs.rast
+++ b/crates/ra_syntax/test_data/parser/ok/0035_weird_exprs.rast
@@ -1640,10 +1640,10 @@ [email protected]
1640 [email protected] ":" 1640 [email protected] ":"
1641 [email protected] 1641 [email protected]
1642 [email protected] "(" 1642 [email protected] "("
1643 PLACEHOLDE[email protected] 1643 INF[email protected]
1644 [email protected] "_" 1644 [email protected] "_"
1645 [email protected] "," 1645 [email protected] ","
1646 PLACEHOLDE[email protected] 1646 INF[email protected]
1647 [email protected] "_" 1647 [email protected] "_"
1648 [email protected] ")" 1648 [email protected] ")"
1649 [email protected] "," 1649 [email protected] ","