Skip to content

Commit cf17366

Browse files
bors[bot]matklad
andauthored
Merge #5642
5642: Grammar updates r=matklad a=matklad bors r+ Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2 parents 5af32ae + bff8dd0 commit cf17366

37 files changed

+150
-151
lines changed

Cargo.lock

Lines changed: 12 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/ra_assists/src/handlers/introduce_named_lifetime.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ fn generate_fn_def_assist(
6868
let fn_params_without_lifetime: Vec<_> = param_list
6969
.params()
7070
.filter_map(|param| match param.ty() {
71-
Some(ast::Type::ReferenceType(ascribed_type))
71+
Some(ast::Type::RefType(ascribed_type))
7272
if ascribed_type.lifetime_token() == None =>
7373
{
7474
Some(ascribed_type.amp_token()?.text_range().end())

crates/ra_hir_def/src/type_ref.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ impl TypeRef {
9494
.map(TypeRef::Path)
9595
.unwrap_or(TypeRef::Error)
9696
}
97-
ast::Type::PointerType(inner) => {
97+
ast::Type::PtrType(inner) => {
9898
let inner_ty = TypeRef::from_ast_opt(&ctx, inner.ty());
9999
let mutability = Mutability::from_mutable(inner.mut_token().is_some());
100100
TypeRef::RawPtr(Box::new(inner_ty), mutability)
@@ -105,13 +105,13 @@ impl TypeRef {
105105
ast::Type::SliceType(inner) => {
106106
TypeRef::Slice(Box::new(TypeRef::from_ast_opt(&ctx, inner.ty())))
107107
}
108-
ast::Type::ReferenceType(inner) => {
108+
ast::Type::RefType(inner) => {
109109
let inner_ty = TypeRef::from_ast_opt(&ctx, inner.ty());
110110
let mutability = Mutability::from_mutable(inner.mut_token().is_some());
111111
TypeRef::Reference(Box::new(inner_ty), mutability)
112112
}
113113
ast::Type::InferType(_inner) => TypeRef::Placeholder,
114-
ast::Type::FnPointerType(inner) => {
114+
ast::Type::FnPtrType(inner) => {
115115
let ret_ty = inner
116116
.ret_type()
117117
.and_then(|rt| rt.ty())

crates/ra_ide/src/references/rename.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ fn rename_to_self(
157157
}
158158
let first_param = params.params().next()?;
159159
let mutable = match first_param.ty() {
160-
Some(ast::Type::ReferenceType(rt)) => rt.mut_token().is_some(),
160+
Some(ast::Type::RefType(rt)) => rt.mut_token().is_some(),
161161
_ => return None, // not renaming other types
162162
};
163163

crates/ra_ide/src/syntax_highlighting.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ fn highlight_element(
546546
T![!] if element.parent().and_then(ast::MacroCall::cast).is_some() => {
547547
HighlightTag::Macro.into()
548548
}
549-
T![*] if element.parent().and_then(ast::PointerType::cast).is_some() => {
549+
T![*] if element.parent().and_then(ast::PtrType::cast).is_some() => {
550550
HighlightTag::Keyword.into()
551551
}
552552
T![*] if element.parent().and_then(ast::PrefixExpr::cast).is_some() => {

crates/ra_parser/src/grammar/types.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ fn pointer_type(p: &mut Parser) {
117117
};
118118

119119
type_no_bounds(p);
120-
m.complete(p, POINTER_TYPE);
120+
m.complete(p, PTR_TYPE);
121121
}
122122

123123
fn array_or_slice_type(p: &mut Parser) {
@@ -163,7 +163,7 @@ fn reference_type(p: &mut Parser) {
163163
p.eat(LIFETIME);
164164
p.eat(T![mut]);
165165
type_no_bounds(p);
166-
m.complete(p, REFERENCE_TYPE);
166+
m.complete(p, REF_TYPE);
167167
}
168168

169169
// test placeholder_type
@@ -201,7 +201,7 @@ fn fn_pointer_type(p: &mut Parser) {
201201
// test fn_pointer_type_with_ret
202202
// type F = fn() -> ();
203203
opt_fn_ret_type(p);
204-
m.complete(p, FN_POINTER_TYPE);
204+
m.complete(p, FN_PTR_TYPE);
205205
}
206206

207207
pub(super) fn for_binder(p: &mut Parser) {

crates/ra_parser/src/syntax_kind/generated.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,12 @@ pub enum SyntaxKind {
143143
TUPLE_TYPE,
144144
NEVER_TYPE,
145145
PATH_TYPE,
146-
POINTER_TYPE,
146+
PTR_TYPE,
147147
ARRAY_TYPE,
148148
SLICE_TYPE,
149-
REFERENCE_TYPE,
149+
REF_TYPE,
150150
INFER_TYPE,
151-
FN_POINTER_TYPE,
151+
FN_PTR_TYPE,
152152
FOR_TYPE,
153153
IMPL_TRAIT_TYPE,
154154
DYN_TRAIT_TYPE,

0 commit comments

Comments
 (0)