mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 13:03:31 +00:00
Rename TypeAliasDef -> TypeAlias
This commit is contained in:
parent
1142112c70
commit
eb2f806344
65 changed files with 146 additions and 155 deletions
|
@ -119,7 +119,7 @@ fn add_missing_impl_members_inner(
|
||||||
let def_name = |item: &ast::AssocItem| -> Option<SmolStr> {
|
let def_name = |item: &ast::AssocItem| -> Option<SmolStr> {
|
||||||
match item {
|
match item {
|
||||||
ast::AssocItem::Fn(def) => def.name(),
|
ast::AssocItem::Fn(def) => def.name(),
|
||||||
ast::AssocItem::TypeAliasDef(def) => def.name(),
|
ast::AssocItem::TypeAlias(def) => def.name(),
|
||||||
ast::AssocItem::ConstDef(def) => def.name(),
|
ast::AssocItem::ConstDef(def) => def.name(),
|
||||||
ast::AssocItem::MacroCall(_) => None,
|
ast::AssocItem::MacroCall(_) => None,
|
||||||
}
|
}
|
||||||
|
@ -130,7 +130,7 @@ fn add_missing_impl_members_inner(
|
||||||
.iter()
|
.iter()
|
||||||
.map(|i| match i {
|
.map(|i| match i {
|
||||||
hir::AssocItem::Function(i) => ast::AssocItem::Fn(i.source(ctx.db()).value),
|
hir::AssocItem::Function(i) => ast::AssocItem::Fn(i.source(ctx.db()).value),
|
||||||
hir::AssocItem::TypeAlias(i) => ast::AssocItem::TypeAliasDef(i.source(ctx.db()).value),
|
hir::AssocItem::TypeAlias(i) => ast::AssocItem::TypeAlias(i.source(ctx.db()).value),
|
||||||
hir::AssocItem::Const(i) => ast::AssocItem::ConstDef(i.source(ctx.db()).value),
|
hir::AssocItem::Const(i) => ast::AssocItem::ConstDef(i.source(ctx.db()).value),
|
||||||
})
|
})
|
||||||
.filter(|t| def_name(&t).is_some())
|
.filter(|t| def_name(&t).is_some())
|
||||||
|
@ -159,9 +159,7 @@ fn add_missing_impl_members_inner(
|
||||||
.map(|it| ast_transform::apply(&*ast_transform, it))
|
.map(|it| ast_transform::apply(&*ast_transform, it))
|
||||||
.map(|it| match it {
|
.map(|it| match it {
|
||||||
ast::AssocItem::Fn(def) => ast::AssocItem::Fn(add_body(def)),
|
ast::AssocItem::Fn(def) => ast::AssocItem::Fn(add_body(def)),
|
||||||
ast::AssocItem::TypeAliasDef(def) => {
|
ast::AssocItem::TypeAlias(def) => ast::AssocItem::TypeAlias(def.remove_bounds()),
|
||||||
ast::AssocItem::TypeAliasDef(def.remove_bounds())
|
|
||||||
}
|
|
||||||
_ => it,
|
_ => it,
|
||||||
})
|
})
|
||||||
.map(|it| edit::remove_attrs_and_docs(&it));
|
.map(|it| edit::remove_attrs_and_docs(&it));
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
use ra_syntax::{
|
use ra_syntax::{
|
||||||
ast::{self, NameOwner, VisibilityOwner},
|
ast::{self, NameOwner, VisibilityOwner},
|
||||||
AstNode,
|
AstNode,
|
||||||
SyntaxKind::{
|
SyntaxKind::{CONST_DEF, ENUM_DEF, FN, MODULE, STATIC_DEF, STRUCT_DEF, TRAIT_DEF, VISIBILITY},
|
||||||
CONST_DEF, ENUM_DEF, FN, MODULE, STATIC_DEF, STRUCT_DEF, TRAIT_DEF, VISIBILITY,
|
|
||||||
},
|
|
||||||
T,
|
T,
|
||||||
};
|
};
|
||||||
use test_utils::mark;
|
use test_utils::mark;
|
||||||
|
|
|
@ -72,7 +72,7 @@ pub fn get_missing_assoc_items(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ast::AssocItem::TypeAliasDef(t) => {
|
ast::AssocItem::TypeAlias(t) => {
|
||||||
if let Some(n) = t.name() {
|
if let Some(n) = t.name() {
|
||||||
impl_type.insert(n.syntax().to_string());
|
impl_type.insert(n.syntax().to_string());
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,8 +105,8 @@ impl HasSource for Trait {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl HasSource for TypeAlias {
|
impl HasSource for TypeAlias {
|
||||||
type Ast = ast::TypeAliasDef;
|
type Ast = ast::TypeAlias;
|
||||||
fn source(self, db: &dyn HirDatabase) -> InFile<ast::TypeAliasDef> {
|
fn source(self, db: &dyn HirDatabase) -> InFile<ast::TypeAlias> {
|
||||||
self.id.lookup(db.upcast()).source(db.upcast())
|
self.id.lookup(db.upcast()).source(db.upcast())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -582,7 +582,7 @@ to_def_impls![
|
||||||
(crate::Union, ast::UnionDef, union_to_def),
|
(crate::Union, ast::UnionDef, union_to_def),
|
||||||
(crate::Trait, ast::TraitDef, trait_to_def),
|
(crate::Trait, ast::TraitDef, trait_to_def),
|
||||||
(crate::ImplDef, ast::ImplDef, impl_to_def),
|
(crate::ImplDef, ast::ImplDef, impl_to_def),
|
||||||
(crate::TypeAlias, ast::TypeAliasDef, type_alias_to_def),
|
(crate::TypeAlias, ast::TypeAlias, type_alias_to_def),
|
||||||
(crate::Const, ast::ConstDef, const_to_def),
|
(crate::Const, ast::ConstDef, const_to_def),
|
||||||
(crate::Static, ast::StaticDef, static_to_def),
|
(crate::Static, ast::StaticDef, static_to_def),
|
||||||
(crate::Function, ast::Fn, fn_to_def),
|
(crate::Function, ast::Fn, fn_to_def),
|
||||||
|
|
|
@ -89,10 +89,7 @@ impl SourceToDefCtx<'_, '_> {
|
||||||
pub(super) fn const_to_def(&mut self, src: InFile<ast::ConstDef>) -> Option<ConstId> {
|
pub(super) fn const_to_def(&mut self, src: InFile<ast::ConstDef>) -> Option<ConstId> {
|
||||||
self.to_def(src, keys::CONST)
|
self.to_def(src, keys::CONST)
|
||||||
}
|
}
|
||||||
pub(super) fn type_alias_to_def(
|
pub(super) fn type_alias_to_def(&mut self, src: InFile<ast::TypeAlias>) -> Option<TypeAliasId> {
|
||||||
&mut self,
|
|
||||||
src: InFile<ast::TypeAliasDef>,
|
|
||||||
) -> Option<TypeAliasId> {
|
|
||||||
self.to_def(src, keys::TYPE_ALIAS)
|
self.to_def(src, keys::TYPE_ALIAS)
|
||||||
}
|
}
|
||||||
pub(super) fn record_field_to_def(
|
pub(super) fn record_field_to_def(
|
||||||
|
@ -195,7 +192,7 @@ impl SourceToDefCtx<'_, '_> {
|
||||||
let def = self.const_to_def(container.with_value(it))?;
|
let def = self.const_to_def(container.with_value(it))?;
|
||||||
DefWithBodyId::from(def).into()
|
DefWithBodyId::from(def).into()
|
||||||
},
|
},
|
||||||
ast::TypeAliasDef(it) => {
|
ast::TypeAlias(it) => {
|
||||||
let def = self.type_alias_to_def(container.with_value(it))?;
|
let def = self.type_alias_to_def(container.with_value(it))?;
|
||||||
def.into()
|
def.into()
|
||||||
},
|
},
|
||||||
|
@ -217,7 +214,7 @@ impl SourceToDefCtx<'_, '_> {
|
||||||
ast::StructDef(it) => self.struct_to_def(container.with_value(it))?.into(),
|
ast::StructDef(it) => self.struct_to_def(container.with_value(it))?.into(),
|
||||||
ast::EnumDef(it) => self.enum_to_def(container.with_value(it))?.into(),
|
ast::EnumDef(it) => self.enum_to_def(container.with_value(it))?.into(),
|
||||||
ast::TraitDef(it) => self.trait_to_def(container.with_value(it))?.into(),
|
ast::TraitDef(it) => self.trait_to_def(container.with_value(it))?.into(),
|
||||||
ast::TypeAliasDef(it) => self.type_alias_to_def(container.with_value(it))?.into(),
|
ast::TypeAlias(it) => self.type_alias_to_def(container.with_value(it))?.into(),
|
||||||
ast::ImplDef(it) => self.impl_to_def(container.with_value(it))?.into(),
|
ast::ImplDef(it) => self.impl_to_def(container.with_value(it))?.into(),
|
||||||
_ => continue,
|
_ => continue,
|
||||||
}
|
}
|
||||||
|
|
|
@ -634,7 +634,7 @@ impl ExprCollector<'_> {
|
||||||
def.name(),
|
def.name(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
ast::Item::TypeAliasDef(def) => {
|
ast::Item::TypeAlias(def) => {
|
||||||
let id = self.find_inner_item(&def)?;
|
let id = self.find_inner_item(&def)?;
|
||||||
(
|
(
|
||||||
TypeAliasLoc { container: container.into(), id }.intern(self.db).into(),
|
TypeAliasLoc { container: container.into(), id }.intern(self.db).into(),
|
||||||
|
|
|
@ -421,7 +421,7 @@ mod_items! {
|
||||||
Static in statics -> ast::StaticDef,
|
Static in statics -> ast::StaticDef,
|
||||||
Trait in traits -> ast::TraitDef,
|
Trait in traits -> ast::TraitDef,
|
||||||
Impl in impls -> ast::ImplDef,
|
Impl in impls -> ast::ImplDef,
|
||||||
TypeAlias in type_aliases -> ast::TypeAliasDef,
|
TypeAlias in type_aliases -> ast::TypeAlias,
|
||||||
Mod in mods -> ast::Module,
|
Mod in mods -> ast::Module,
|
||||||
MacroCall in macro_calls -> ast::MacroCall,
|
MacroCall in macro_calls -> ast::MacroCall,
|
||||||
}
|
}
|
||||||
|
@ -592,7 +592,7 @@ pub struct TypeAlias {
|
||||||
pub bounds: Box<[TypeBound]>,
|
pub bounds: Box<[TypeBound]>,
|
||||||
pub generic_params: GenericParamsId,
|
pub generic_params: GenericParamsId,
|
||||||
pub type_ref: Option<TypeRef>,
|
pub type_ref: Option<TypeRef>,
|
||||||
pub ast_id: FileAstId<ast::TypeAliasDef>,
|
pub ast_id: FileAstId<ast::TypeAlias>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Eq, PartialEq)]
|
#[derive(Debug, Clone, Eq, PartialEq)]
|
||||||
|
|
|
@ -79,7 +79,7 @@ impl Ctx {
|
||||||
| ast::Item::UnionDef(_)
|
| ast::Item::UnionDef(_)
|
||||||
| ast::Item::EnumDef(_)
|
| ast::Item::EnumDef(_)
|
||||||
| ast::Item::Fn(_)
|
| ast::Item::Fn(_)
|
||||||
| ast::Item::TypeAliasDef(_)
|
| ast::Item::TypeAlias(_)
|
||||||
| ast::Item::ConstDef(_)
|
| ast::Item::ConstDef(_)
|
||||||
| ast::Item::StaticDef(_)
|
| ast::Item::StaticDef(_)
|
||||||
| ast::Item::MacroCall(_) => {
|
| ast::Item::MacroCall(_) => {
|
||||||
|
@ -104,7 +104,7 @@ impl Ctx {
|
||||||
ast::Item::UnionDef(ast) => self.lower_union(ast).map(Into::into),
|
ast::Item::UnionDef(ast) => self.lower_union(ast).map(Into::into),
|
||||||
ast::Item::EnumDef(ast) => self.lower_enum(ast).map(Into::into),
|
ast::Item::EnumDef(ast) => self.lower_enum(ast).map(Into::into),
|
||||||
ast::Item::Fn(ast) => self.lower_function(ast).map(Into::into),
|
ast::Item::Fn(ast) => self.lower_function(ast).map(Into::into),
|
||||||
ast::Item::TypeAliasDef(ast) => self.lower_type_alias(ast).map(Into::into),
|
ast::Item::TypeAlias(ast) => self.lower_type_alias(ast).map(Into::into),
|
||||||
ast::Item::StaticDef(ast) => self.lower_static(ast).map(Into::into),
|
ast::Item::StaticDef(ast) => self.lower_static(ast).map(Into::into),
|
||||||
ast::Item::ConstDef(ast) => Some(self.lower_const(ast).into()),
|
ast::Item::ConstDef(ast) => Some(self.lower_const(ast).into()),
|
||||||
ast::Item::Module(ast) => self.lower_module(ast).map(Into::into),
|
ast::Item::Module(ast) => self.lower_module(ast).map(Into::into),
|
||||||
|
@ -156,7 +156,7 @@ impl Ctx {
|
||||||
fn lower_assoc_item(&mut self, item: &ast::AssocItem) -> Option<AssocItem> {
|
fn lower_assoc_item(&mut self, item: &ast::AssocItem) -> Option<AssocItem> {
|
||||||
match item {
|
match item {
|
||||||
ast::AssocItem::Fn(ast) => self.lower_function(ast).map(Into::into),
|
ast::AssocItem::Fn(ast) => self.lower_function(ast).map(Into::into),
|
||||||
ast::AssocItem::TypeAliasDef(ast) => self.lower_type_alias(ast).map(Into::into),
|
ast::AssocItem::TypeAlias(ast) => self.lower_type_alias(ast).map(Into::into),
|
||||||
ast::AssocItem::ConstDef(ast) => Some(self.lower_const(ast).into()),
|
ast::AssocItem::ConstDef(ast) => Some(self.lower_const(ast).into()),
|
||||||
ast::AssocItem::MacroCall(ast) => self.lower_macro_call(ast).map(Into::into),
|
ast::AssocItem::MacroCall(ast) => self.lower_macro_call(ast).map(Into::into),
|
||||||
}
|
}
|
||||||
|
@ -348,7 +348,7 @@ impl Ctx {
|
||||||
|
|
||||||
fn lower_type_alias(
|
fn lower_type_alias(
|
||||||
&mut self,
|
&mut self,
|
||||||
type_alias: &ast::TypeAliasDef,
|
type_alias: &ast::TypeAlias,
|
||||||
) -> Option<FileItemTreeId<TypeAlias>> {
|
) -> Option<FileItemTreeId<TypeAlias>> {
|
||||||
let name = type_alias.name()?.as_name();
|
let name = type_alias.name()?.as_name();
|
||||||
let type_ref = type_alias.type_ref().map(|it| self.lower_type_ref(&it));
|
let type_ref = type_alias.type_ref().map(|it| self.lower_type_ref(&it));
|
||||||
|
|
|
@ -236,7 +236,7 @@ fn smoke() {
|
||||||
#[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("on_trait"))] }, input: None }]) }]
|
#[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("on_trait"))] }, input: None }]) }]
|
||||||
Trait { name: Name(Text("Tr")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(0), auto: false, items: [TypeAlias(Idx::<TypeAlias>(0)), Const(Idx::<Const>(0)), Function(Idx::<Function>(0)), Function(Idx::<Function>(1))], ast_id: FileAstId::<ra_syntax::ast::generated::nodes::TraitDef>(2) }
|
Trait { name: Name(Text("Tr")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(0), auto: false, items: [TypeAlias(Idx::<TypeAlias>(0)), Const(Idx::<Const>(0)), Function(Idx::<Function>(0)), Function(Idx::<Function>(1))], ast_id: FileAstId::<ra_syntax::ast::generated::nodes::TraitDef>(2) }
|
||||||
> #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("assoc_ty"))] }, input: None }]) }]
|
> #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("assoc_ty"))] }, input: None }]) }]
|
||||||
> TypeAlias { name: Name(Text("AssocTy")), visibility: RawVisibilityId("pub(self)"), bounds: [Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("Tr"))] }, generic_args: [Some(GenericArgs { args: [Type(Tuple([]))], has_self_type: false, bindings: [] })] })], generic_params: GenericParamsId(4294967295), type_ref: None, ast_id: FileAstId::<ra_syntax::ast::generated::nodes::TypeAliasDef>(8) }
|
> TypeAlias { name: Name(Text("AssocTy")), visibility: RawVisibilityId("pub(self)"), bounds: [Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("Tr"))] }, generic_args: [Some(GenericArgs { args: [Type(Tuple([]))], has_self_type: false, bindings: [] })] })], generic_params: GenericParamsId(4294967295), type_ref: None, ast_id: FileAstId::<ra_syntax::ast::generated::nodes::TypeAlias>(8) }
|
||||||
> #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("assoc_const"))] }, input: None }]) }]
|
> #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("assoc_const"))] }, input: None }]) }]
|
||||||
> Const { name: Some(Name(Text("CONST"))), visibility: RawVisibilityId("pub(self)"), type_ref: Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("u8"))] }, generic_args: [None] }), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::ConstDef>(9) }
|
> Const { name: Some(Name(Text("CONST"))), visibility: RawVisibilityId("pub(self)"), type_ref: Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("u8"))] }, generic_args: [None] }), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::ConstDef>(9) }
|
||||||
> #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("assoc_method"))] }, input: None }]) }]
|
> #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("assoc_method"))] }, input: None }]) }]
|
||||||
|
|
|
@ -17,7 +17,7 @@ pub type Key<K, V> = crate::dyn_map::Key<InFile<K>, V, AstPtrPolicy<K, V>>;
|
||||||
pub const FUNCTION: Key<ast::Fn, FunctionId> = Key::new();
|
pub const FUNCTION: Key<ast::Fn, FunctionId> = Key::new();
|
||||||
pub const CONST: Key<ast::ConstDef, ConstId> = Key::new();
|
pub const CONST: Key<ast::ConstDef, ConstId> = Key::new();
|
||||||
pub const STATIC: Key<ast::StaticDef, StaticId> = Key::new();
|
pub const STATIC: Key<ast::StaticDef, StaticId> = Key::new();
|
||||||
pub const TYPE_ALIAS: Key<ast::TypeAliasDef, TypeAliasId> = Key::new();
|
pub const TYPE_ALIAS: Key<ast::TypeAlias, TypeAliasId> = Key::new();
|
||||||
pub const IMPL: Key<ast::ImplDef, ImplId> = Key::new();
|
pub const IMPL: Key<ast::ImplDef, ImplId> = Key::new();
|
||||||
pub const TRAIT: Key<ast::TraitDef, TraitId> = Key::new();
|
pub const TRAIT: Key<ast::TraitDef, TraitId> = Key::new();
|
||||||
pub const STRUCT: Key<ast::StructDef, StructId> = Key::new();
|
pub const STRUCT: Key<ast::StructDef, StructId> = Key::new();
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
//!
|
//!
|
||||||
//! This module adds the completion items related to implementing associated
|
//! This module adds the completion items related to implementing associated
|
||||||
//! items within a `impl Trait for Struct` block. The current context node
|
//! items within a `impl Trait for Struct` block. The current context node
|
||||||
//! must be within either a `FN`, `TYPE_ALIAS_DEF`, or `CONST_DEF` node
|
//! must be within either a `FN`, `TYPE_ALIAS`, or `CONST_DEF` node
|
||||||
//! and an direct child of an `IMPL_DEF`.
|
//! and an direct child of an `IMPL_DEF`.
|
||||||
//!
|
//!
|
||||||
//! # Examples
|
//! # Examples
|
||||||
|
@ -75,7 +75,7 @@ pub(crate) fn complete_trait_impl(acc: &mut Completions, ctx: &CompletionContext
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SyntaxKind::TYPE_ALIAS_DEF => {
|
SyntaxKind::TYPE_ALIAS => {
|
||||||
for missing_fn in get_missing_assoc_items(&ctx.sema, &impl_def)
|
for missing_fn in get_missing_assoc_items(&ctx.sema, &impl_def)
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.filter_map(|item| match item {
|
.filter_map(|item| match item {
|
||||||
|
@ -107,7 +107,7 @@ pub(crate) fn complete_trait_impl(acc: &mut Completions, ctx: &CompletionContext
|
||||||
fn completion_match(ctx: &CompletionContext) -> Option<(SyntaxNode, ImplDef)> {
|
fn completion_match(ctx: &CompletionContext) -> Option<(SyntaxNode, ImplDef)> {
|
||||||
let (trigger, impl_def_offset) = ctx.token.ancestors().find_map(|p| match p.kind() {
|
let (trigger, impl_def_offset) = ctx.token.ancestors().find_map(|p| match p.kind() {
|
||||||
SyntaxKind::FN
|
SyntaxKind::FN
|
||||||
| SyntaxKind::TYPE_ALIAS_DEF
|
| SyntaxKind::TYPE_ALIAS
|
||||||
| SyntaxKind::CONST_DEF
|
| SyntaxKind::CONST_DEF
|
||||||
| SyntaxKind::BLOCK_EXPR => Some((p, 2)),
|
| SyntaxKind::BLOCK_EXPR => Some((p, 2)),
|
||||||
SyntaxKind::NAME_REF => Some((p, 5)),
|
SyntaxKind::NAME_REF => Some((p, 5)),
|
||||||
|
|
|
@ -65,7 +65,7 @@ pub(crate) fn const_label(node: &ast::ConstDef) -> String {
|
||||||
label.trim().to_owned()
|
label.trim().to_owned()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn type_label(node: &ast::TypeAliasDef) -> String {
|
pub(crate) fn type_label(node: &ast::TypeAlias) -> String {
|
||||||
let label: String = node
|
let label: String = node
|
||||||
.syntax()
|
.syntax()
|
||||||
.children_with_tokens()
|
.children_with_tokens()
|
||||||
|
|
|
@ -384,7 +384,7 @@ pub(crate) fn docs_from_symbol(db: &RootDatabase, symbol: &FileSymbol) -> Option
|
||||||
ast::EnumDef(it) => it.doc_comment_text(),
|
ast::EnumDef(it) => it.doc_comment_text(),
|
||||||
ast::TraitDef(it) => it.doc_comment_text(),
|
ast::TraitDef(it) => it.doc_comment_text(),
|
||||||
ast::Module(it) => it.doc_comment_text(),
|
ast::Module(it) => it.doc_comment_text(),
|
||||||
ast::TypeAliasDef(it) => it.doc_comment_text(),
|
ast::TypeAlias(it) => it.doc_comment_text(),
|
||||||
ast::ConstDef(it) => it.doc_comment_text(),
|
ast::ConstDef(it) => it.doc_comment_text(),
|
||||||
ast::StaticDef(it) => it.doc_comment_text(),
|
ast::StaticDef(it) => it.doc_comment_text(),
|
||||||
ast::RecordFieldDef(it) => it.doc_comment_text(),
|
ast::RecordFieldDef(it) => it.doc_comment_text(),
|
||||||
|
@ -409,7 +409,7 @@ pub(crate) fn description_from_symbol(db: &RootDatabase, symbol: &FileSymbol) ->
|
||||||
ast::EnumDef(it) => it.short_label(),
|
ast::EnumDef(it) => it.short_label(),
|
||||||
ast::TraitDef(it) => it.short_label(),
|
ast::TraitDef(it) => it.short_label(),
|
||||||
ast::Module(it) => it.short_label(),
|
ast::Module(it) => it.short_label(),
|
||||||
ast::TypeAliasDef(it) => it.short_label(),
|
ast::TypeAlias(it) => it.short_label(),
|
||||||
ast::ConstDef(it) => it.short_label(),
|
ast::ConstDef(it) => it.short_label(),
|
||||||
ast::StaticDef(it) => it.short_label(),
|
ast::StaticDef(it) => it.short_label(),
|
||||||
ast::RecordFieldDef(it) => it.short_label(),
|
ast::RecordFieldDef(it) => it.short_label(),
|
||||||
|
|
|
@ -47,7 +47,7 @@ impl ShortLabel for ast::Module {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ShortLabel for ast::TypeAliasDef {
|
impl ShortLabel for ast::TypeAlias {
|
||||||
fn short_label(&self) -> Option<String> {
|
fn short_label(&self) -> Option<String> {
|
||||||
short_label_from_node(self, "type ")
|
short_label_from_node(self, "type ")
|
||||||
}
|
}
|
||||||
|
|
|
@ -132,7 +132,7 @@ fn structure_node(node: &SyntaxNode) -> Option<StructureNode> {
|
||||||
ast::EnumVariant(it) => decl(it),
|
ast::EnumVariant(it) => decl(it),
|
||||||
ast::TraitDef(it) => decl(it),
|
ast::TraitDef(it) => decl(it),
|
||||||
ast::Module(it) => decl(it),
|
ast::Module(it) => decl(it),
|
||||||
ast::TypeAliasDef(it) => {
|
ast::TypeAlias(it) => {
|
||||||
let ty = it.type_ref();
|
let ty = it.type_ref();
|
||||||
decl_with_type_ref(it, ty)
|
decl_with_type_ref(it, ty)
|
||||||
},
|
},
|
||||||
|
@ -339,7 +339,7 @@ fn very_obsolete() {}
|
||||||
label: "T",
|
label: "T",
|
||||||
navigation_range: 186..187,
|
navigation_range: 186..187,
|
||||||
node_range: 181..193,
|
node_range: 181..193,
|
||||||
kind: TYPE_ALIAS_DEF,
|
kind: TYPE_ALIAS,
|
||||||
detail: Some(
|
detail: Some(
|
||||||
"()",
|
"()",
|
||||||
),
|
),
|
||||||
|
|
|
@ -709,7 +709,7 @@ fn highlight_name_by_syntax(name: ast::Name) -> Highlight {
|
||||||
ENUM_DEF => HighlightTag::Enum,
|
ENUM_DEF => HighlightTag::Enum,
|
||||||
UNION_DEF => HighlightTag::Union,
|
UNION_DEF => HighlightTag::Union,
|
||||||
TRAIT_DEF => HighlightTag::Trait,
|
TRAIT_DEF => HighlightTag::Trait,
|
||||||
TYPE_ALIAS_DEF => HighlightTag::TypeAlias,
|
TYPE_ALIAS => HighlightTag::TypeAlias,
|
||||||
TYPE_PARAM => HighlightTag::TypeParam,
|
TYPE_PARAM => HighlightTag::TypeParam,
|
||||||
RECORD_FIELD_DEF => HighlightTag::Field,
|
RECORD_FIELD_DEF => HighlightTag::Field,
|
||||||
MODULE => HighlightTag::Module,
|
MODULE => HighlightTag::Module,
|
||||||
|
|
|
@ -182,7 +182,7 @@ pub fn classify_name(sema: &Semantics<RootDatabase>, name: &ast::Name) -> Option
|
||||||
let def: hir::Const = sema.to_def(&it)?;
|
let def: hir::Const = sema.to_def(&it)?;
|
||||||
Some(NameClass::Definition(Definition::ModuleDef(def.into())))
|
Some(NameClass::Definition(Definition::ModuleDef(def.into())))
|
||||||
},
|
},
|
||||||
ast::TypeAliasDef(it) => {
|
ast::TypeAlias(it) => {
|
||||||
let def: hir::TypeAlias = sema.to_def(&it)?;
|
let def: hir::TypeAlias = sema.to_def(&it)?;
|
||||||
Some(NameClass::Definition(Definition::ModuleDef(def.into())))
|
Some(NameClass::Definition(Definition::ModuleDef(def.into())))
|
||||||
},
|
},
|
||||||
|
|
|
@ -344,7 +344,7 @@ impl Query {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_type(kind: SyntaxKind) -> bool {
|
fn is_type(kind: SyntaxKind) -> bool {
|
||||||
matches!(kind, STRUCT_DEF | ENUM_DEF | TRAIT_DEF | TYPE_ALIAS_DEF)
|
matches!(kind, STRUCT_DEF | ENUM_DEF | TRAIT_DEF | TYPE_ALIAS)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The actual data that is stored in the index. It should be as compact as
|
/// The actual data that is stored in the index. It should be as compact as
|
||||||
|
@ -402,7 +402,7 @@ fn to_symbol(node: &SyntaxNode) -> Option<(SmolStr, SyntaxNodePtr, TextRange)> {
|
||||||
ast::EnumDef(it) => decl(it),
|
ast::EnumDef(it) => decl(it),
|
||||||
ast::TraitDef(it) => decl(it),
|
ast::TraitDef(it) => decl(it),
|
||||||
ast::Module(it) => decl(it),
|
ast::Module(it) => decl(it),
|
||||||
ast::TypeAliasDef(it) => decl(it),
|
ast::TypeAlias(it) => decl(it),
|
||||||
ast::ConstDef(it) => decl(it),
|
ast::ConstDef(it) => decl(it),
|
||||||
ast::StaticDef(it) => decl(it),
|
ast::StaticDef(it) => decl(it),
|
||||||
ast::MacroCall(it) => {
|
ast::MacroCall(it) => {
|
||||||
|
|
|
@ -380,7 +380,7 @@ fn type_def(p: &mut Parser, m: Marker) {
|
||||||
types::type_(p);
|
types::type_(p);
|
||||||
}
|
}
|
||||||
p.expect(T![;]);
|
p.expect(T![;]);
|
||||||
m.complete(p, TYPE_ALIAS_DEF);
|
m.complete(p, TYPE_ALIAS);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn mod_item(p: &mut Parser, m: Marker) {
|
pub(crate) fn mod_item(p: &mut Parser, m: Marker) {
|
||||||
|
|
|
@ -135,7 +135,7 @@ pub enum SyntaxKind {
|
||||||
CONST_DEF,
|
CONST_DEF,
|
||||||
TRAIT_DEF,
|
TRAIT_DEF,
|
||||||
IMPL_DEF,
|
IMPL_DEF,
|
||||||
TYPE_ALIAS_DEF,
|
TYPE_ALIAS,
|
||||||
MACRO_CALL,
|
MACRO_CALL,
|
||||||
TOKEN_TREE,
|
TOKEN_TREE,
|
||||||
MACRO_DEF,
|
MACRO_DEF,
|
||||||
|
|
|
@ -192,9 +192,9 @@ impl ast::RecordFieldList {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ast::TypeAliasDef {
|
impl ast::TypeAlias {
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn remove_bounds(&self) -> ast::TypeAliasDef {
|
pub fn remove_bounds(&self) -> ast::TypeAlias {
|
||||||
let colon = match self.colon_token() {
|
let colon = match self.colon_token() {
|
||||||
Some(it) => it,
|
Some(it) => it,
|
||||||
None => return self.clone(),
|
None => return self.clone(),
|
||||||
|
|
|
@ -183,15 +183,15 @@ impl TraitDef {
|
||||||
pub fn assoc_item_list(&self) -> Option<AssocItemList> { support::child(&self.syntax) }
|
pub fn assoc_item_list(&self) -> Option<AssocItemList> { support::child(&self.syntax) }
|
||||||
}
|
}
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||||
pub struct TypeAliasDef {
|
pub struct TypeAlias {
|
||||||
pub(crate) syntax: SyntaxNode,
|
pub(crate) syntax: SyntaxNode,
|
||||||
}
|
}
|
||||||
impl ast::AttrsOwner for TypeAliasDef {}
|
impl ast::AttrsOwner for TypeAlias {}
|
||||||
impl ast::NameOwner for TypeAliasDef {}
|
impl ast::NameOwner for TypeAlias {}
|
||||||
impl ast::VisibilityOwner for TypeAliasDef {}
|
impl ast::VisibilityOwner for TypeAlias {}
|
||||||
impl ast::TypeParamsOwner for TypeAliasDef {}
|
impl ast::TypeParamsOwner for TypeAlias {}
|
||||||
impl ast::TypeBoundsOwner for TypeAliasDef {}
|
impl ast::TypeBoundsOwner for TypeAlias {}
|
||||||
impl TypeAliasDef {
|
impl TypeAlias {
|
||||||
pub fn default_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![default]) }
|
pub fn default_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![default]) }
|
||||||
pub fn type_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![type]) }
|
pub fn type_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![type]) }
|
||||||
pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) }
|
pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) }
|
||||||
|
@ -384,6 +384,13 @@ impl SelfParam {
|
||||||
pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) }
|
pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) }
|
||||||
}
|
}
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||||
|
pub struct TypeBoundList {
|
||||||
|
pub(crate) syntax: SyntaxNode,
|
||||||
|
}
|
||||||
|
impl TypeBoundList {
|
||||||
|
pub fn bounds(&self) -> AstChildren<TypeBound> { support::children(&self.syntax) }
|
||||||
|
}
|
||||||
|
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||||
pub struct RecordFieldDefList {
|
pub struct RecordFieldDefList {
|
||||||
pub(crate) syntax: SyntaxNode,
|
pub(crate) syntax: SyntaxNode,
|
||||||
}
|
}
|
||||||
|
@ -444,13 +451,6 @@ impl EnumVariant {
|
||||||
pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
|
pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
|
||||||
}
|
}
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||||
pub struct TypeBoundList {
|
|
||||||
pub(crate) syntax: SyntaxNode,
|
|
||||||
}
|
|
||||||
impl TypeBoundList {
|
|
||||||
pub fn bounds(&self) -> AstChildren<TypeBound> { support::children(&self.syntax) }
|
|
||||||
}
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
|
||||||
pub struct AssocItemList {
|
pub struct AssocItemList {
|
||||||
pub(crate) syntax: SyntaxNode,
|
pub(crate) syntax: SyntaxNode,
|
||||||
}
|
}
|
||||||
|
@ -1284,7 +1284,7 @@ pub enum Item {
|
||||||
StaticDef(StaticDef),
|
StaticDef(StaticDef),
|
||||||
StructDef(StructDef),
|
StructDef(StructDef),
|
||||||
TraitDef(TraitDef),
|
TraitDef(TraitDef),
|
||||||
TypeAliasDef(TypeAliasDef),
|
TypeAlias(TypeAlias),
|
||||||
UnionDef(UnionDef),
|
UnionDef(UnionDef),
|
||||||
Use(Use),
|
Use(Use),
|
||||||
}
|
}
|
||||||
|
@ -1365,7 +1365,7 @@ pub enum Expr {
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||||
pub enum AssocItem {
|
pub enum AssocItem {
|
||||||
Fn(Fn),
|
Fn(Fn),
|
||||||
TypeAliasDef(TypeAliasDef),
|
TypeAlias(TypeAlias),
|
||||||
ConstDef(ConstDef),
|
ConstDef(ConstDef),
|
||||||
MacroCall(MacroCall),
|
MacroCall(MacroCall),
|
||||||
}
|
}
|
||||||
|
@ -1543,8 +1543,8 @@ impl AstNode for TraitDef {
|
||||||
}
|
}
|
||||||
fn syntax(&self) -> &SyntaxNode { &self.syntax }
|
fn syntax(&self) -> &SyntaxNode { &self.syntax }
|
||||||
}
|
}
|
||||||
impl AstNode for TypeAliasDef {
|
impl AstNode for TypeAlias {
|
||||||
fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_ALIAS_DEF }
|
fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_ALIAS }
|
||||||
fn cast(syntax: SyntaxNode) -> Option<Self> {
|
fn cast(syntax: SyntaxNode) -> Option<Self> {
|
||||||
if Self::can_cast(syntax.kind()) {
|
if Self::can_cast(syntax.kind()) {
|
||||||
Some(Self { syntax })
|
Some(Self { syntax })
|
||||||
|
@ -1752,6 +1752,17 @@ impl AstNode for SelfParam {
|
||||||
}
|
}
|
||||||
fn syntax(&self) -> &SyntaxNode { &self.syntax }
|
fn syntax(&self) -> &SyntaxNode { &self.syntax }
|
||||||
}
|
}
|
||||||
|
impl AstNode for TypeBoundList {
|
||||||
|
fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_BOUND_LIST }
|
||||||
|
fn cast(syntax: SyntaxNode) -> Option<Self> {
|
||||||
|
if Self::can_cast(syntax.kind()) {
|
||||||
|
Some(Self { syntax })
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fn syntax(&self) -> &SyntaxNode { &self.syntax }
|
||||||
|
}
|
||||||
impl AstNode for RecordFieldDefList {
|
impl AstNode for RecordFieldDefList {
|
||||||
fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_DEF_LIST }
|
fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_DEF_LIST }
|
||||||
fn cast(syntax: SyntaxNode) -> Option<Self> {
|
fn cast(syntax: SyntaxNode) -> Option<Self> {
|
||||||
|
@ -1818,17 +1829,6 @@ impl AstNode for EnumVariant {
|
||||||
}
|
}
|
||||||
fn syntax(&self) -> &SyntaxNode { &self.syntax }
|
fn syntax(&self) -> &SyntaxNode { &self.syntax }
|
||||||
}
|
}
|
||||||
impl AstNode for TypeBoundList {
|
|
||||||
fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_BOUND_LIST }
|
|
||||||
fn cast(syntax: SyntaxNode) -> Option<Self> {
|
|
||||||
if Self::can_cast(syntax.kind()) {
|
|
||||||
Some(Self { syntax })
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fn syntax(&self) -> &SyntaxNode { &self.syntax }
|
|
||||||
}
|
|
||||||
impl AstNode for AssocItemList {
|
impl AstNode for AssocItemList {
|
||||||
fn can_cast(kind: SyntaxKind) -> bool { kind == ASSOC_ITEM_LIST }
|
fn can_cast(kind: SyntaxKind) -> bool { kind == ASSOC_ITEM_LIST }
|
||||||
fn cast(syntax: SyntaxNode) -> Option<Self> {
|
fn cast(syntax: SyntaxNode) -> Option<Self> {
|
||||||
|
@ -2808,8 +2808,8 @@ impl From<StructDef> for Item {
|
||||||
impl From<TraitDef> for Item {
|
impl From<TraitDef> for Item {
|
||||||
fn from(node: TraitDef) -> Item { Item::TraitDef(node) }
|
fn from(node: TraitDef) -> Item { Item::TraitDef(node) }
|
||||||
}
|
}
|
||||||
impl From<TypeAliasDef> for Item {
|
impl From<TypeAlias> for Item {
|
||||||
fn from(node: TypeAliasDef) -> Item { Item::TypeAliasDef(node) }
|
fn from(node: TypeAlias) -> Item { Item::TypeAlias(node) }
|
||||||
}
|
}
|
||||||
impl From<UnionDef> for Item {
|
impl From<UnionDef> for Item {
|
||||||
fn from(node: UnionDef) -> Item { Item::UnionDef(node) }
|
fn from(node: UnionDef) -> Item { Item::UnionDef(node) }
|
||||||
|
@ -2821,9 +2821,7 @@ impl AstNode for Item {
|
||||||
fn can_cast(kind: SyntaxKind) -> bool {
|
fn can_cast(kind: SyntaxKind) -> bool {
|
||||||
match kind {
|
match kind {
|
||||||
CONST_DEF | ENUM_DEF | EXTERN_BLOCK | EXTERN_CRATE | FN | IMPL_DEF | MACRO_CALL
|
CONST_DEF | ENUM_DEF | EXTERN_BLOCK | EXTERN_CRATE | FN | IMPL_DEF | MACRO_CALL
|
||||||
| MODULE | STATIC_DEF | STRUCT_DEF | TRAIT_DEF | TYPE_ALIAS_DEF | UNION_DEF | USE => {
|
| MODULE | STATIC_DEF | STRUCT_DEF | TRAIT_DEF | TYPE_ALIAS | UNION_DEF | USE => true,
|
||||||
true
|
|
||||||
}
|
|
||||||
_ => false,
|
_ => false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2840,7 +2838,7 @@ impl AstNode for Item {
|
||||||
STATIC_DEF => Item::StaticDef(StaticDef { syntax }),
|
STATIC_DEF => Item::StaticDef(StaticDef { syntax }),
|
||||||
STRUCT_DEF => Item::StructDef(StructDef { syntax }),
|
STRUCT_DEF => Item::StructDef(StructDef { syntax }),
|
||||||
TRAIT_DEF => Item::TraitDef(TraitDef { syntax }),
|
TRAIT_DEF => Item::TraitDef(TraitDef { syntax }),
|
||||||
TYPE_ALIAS_DEF => Item::TypeAliasDef(TypeAliasDef { syntax }),
|
TYPE_ALIAS => Item::TypeAlias(TypeAlias { syntax }),
|
||||||
UNION_DEF => Item::UnionDef(UnionDef { syntax }),
|
UNION_DEF => Item::UnionDef(UnionDef { syntax }),
|
||||||
USE => Item::Use(Use { syntax }),
|
USE => Item::Use(Use { syntax }),
|
||||||
_ => return None,
|
_ => return None,
|
||||||
|
@ -2860,7 +2858,7 @@ impl AstNode for Item {
|
||||||
Item::StaticDef(it) => &it.syntax,
|
Item::StaticDef(it) => &it.syntax,
|
||||||
Item::StructDef(it) => &it.syntax,
|
Item::StructDef(it) => &it.syntax,
|
||||||
Item::TraitDef(it) => &it.syntax,
|
Item::TraitDef(it) => &it.syntax,
|
||||||
Item::TypeAliasDef(it) => &it.syntax,
|
Item::TypeAlias(it) => &it.syntax,
|
||||||
Item::UnionDef(it) => &it.syntax,
|
Item::UnionDef(it) => &it.syntax,
|
||||||
Item::Use(it) => &it.syntax,
|
Item::Use(it) => &it.syntax,
|
||||||
}
|
}
|
||||||
|
@ -3258,8 +3256,8 @@ impl AstNode for Expr {
|
||||||
impl From<Fn> for AssocItem {
|
impl From<Fn> for AssocItem {
|
||||||
fn from(node: Fn) -> AssocItem { AssocItem::Fn(node) }
|
fn from(node: Fn) -> AssocItem { AssocItem::Fn(node) }
|
||||||
}
|
}
|
||||||
impl From<TypeAliasDef> for AssocItem {
|
impl From<TypeAlias> for AssocItem {
|
||||||
fn from(node: TypeAliasDef) -> AssocItem { AssocItem::TypeAliasDef(node) }
|
fn from(node: TypeAlias) -> AssocItem { AssocItem::TypeAlias(node) }
|
||||||
}
|
}
|
||||||
impl From<ConstDef> for AssocItem {
|
impl From<ConstDef> for AssocItem {
|
||||||
fn from(node: ConstDef) -> AssocItem { AssocItem::ConstDef(node) }
|
fn from(node: ConstDef) -> AssocItem { AssocItem::ConstDef(node) }
|
||||||
|
@ -3270,14 +3268,14 @@ impl From<MacroCall> for AssocItem {
|
||||||
impl AstNode for AssocItem {
|
impl AstNode for AssocItem {
|
||||||
fn can_cast(kind: SyntaxKind) -> bool {
|
fn can_cast(kind: SyntaxKind) -> bool {
|
||||||
match kind {
|
match kind {
|
||||||
FN | TYPE_ALIAS_DEF | CONST_DEF | MACRO_CALL => true,
|
FN | TYPE_ALIAS | CONST_DEF | MACRO_CALL => true,
|
||||||
_ => false,
|
_ => false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn cast(syntax: SyntaxNode) -> Option<Self> {
|
fn cast(syntax: SyntaxNode) -> Option<Self> {
|
||||||
let res = match syntax.kind() {
|
let res = match syntax.kind() {
|
||||||
FN => AssocItem::Fn(Fn { syntax }),
|
FN => AssocItem::Fn(Fn { syntax }),
|
||||||
TYPE_ALIAS_DEF => AssocItem::TypeAliasDef(TypeAliasDef { syntax }),
|
TYPE_ALIAS => AssocItem::TypeAlias(TypeAlias { syntax }),
|
||||||
CONST_DEF => AssocItem::ConstDef(ConstDef { syntax }),
|
CONST_DEF => AssocItem::ConstDef(ConstDef { syntax }),
|
||||||
MACRO_CALL => AssocItem::MacroCall(MacroCall { syntax }),
|
MACRO_CALL => AssocItem::MacroCall(MacroCall { syntax }),
|
||||||
_ => return None,
|
_ => return None,
|
||||||
|
@ -3287,7 +3285,7 @@ impl AstNode for AssocItem {
|
||||||
fn syntax(&self) -> &SyntaxNode {
|
fn syntax(&self) -> &SyntaxNode {
|
||||||
match self {
|
match self {
|
||||||
AssocItem::Fn(it) => &it.syntax,
|
AssocItem::Fn(it) => &it.syntax,
|
||||||
AssocItem::TypeAliasDef(it) => &it.syntax,
|
AssocItem::TypeAlias(it) => &it.syntax,
|
||||||
AssocItem::ConstDef(it) => &it.syntax,
|
AssocItem::ConstDef(it) => &it.syntax,
|
||||||
AssocItem::MacroCall(it) => &it.syntax,
|
AssocItem::MacroCall(it) => &it.syntax,
|
||||||
}
|
}
|
||||||
|
@ -3525,7 +3523,7 @@ impl std::fmt::Display for TraitDef {
|
||||||
std::fmt::Display::fmt(self.syntax(), f)
|
std::fmt::Display::fmt(self.syntax(), f)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl std::fmt::Display for TypeAliasDef {
|
impl std::fmt::Display for TypeAlias {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
std::fmt::Display::fmt(self.syntax(), f)
|
std::fmt::Display::fmt(self.syntax(), f)
|
||||||
}
|
}
|
||||||
|
@ -3620,6 +3618,11 @@ impl std::fmt::Display for SelfParam {
|
||||||
std::fmt::Display::fmt(self.syntax(), f)
|
std::fmt::Display::fmt(self.syntax(), f)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
impl std::fmt::Display for TypeBoundList {
|
||||||
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
|
std::fmt::Display::fmt(self.syntax(), f)
|
||||||
|
}
|
||||||
|
}
|
||||||
impl std::fmt::Display for RecordFieldDefList {
|
impl std::fmt::Display for RecordFieldDefList {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
std::fmt::Display::fmt(self.syntax(), f)
|
std::fmt::Display::fmt(self.syntax(), f)
|
||||||
|
@ -3650,11 +3653,6 @@ impl std::fmt::Display for EnumVariant {
|
||||||
std::fmt::Display::fmt(self.syntax(), f)
|
std::fmt::Display::fmt(self.syntax(), f)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl std::fmt::Display for TypeBoundList {
|
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
||||||
std::fmt::Display::fmt(self.syntax(), f)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl std::fmt::Display for AssocItemList {
|
impl std::fmt::Display for AssocItemList {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
std::fmt::Display::fmt(self.syntax(), f)
|
std::fmt::Display::fmt(self.syntax(), f)
|
||||||
|
|
|
@ -485,6 +485,6 @@ impl ast::DocCommentsOwner for ast::TraitDef {}
|
||||||
impl ast::DocCommentsOwner for ast::Module {}
|
impl ast::DocCommentsOwner for ast::Module {}
|
||||||
impl ast::DocCommentsOwner for ast::StaticDef {}
|
impl ast::DocCommentsOwner for ast::StaticDef {}
|
||||||
impl ast::DocCommentsOwner for ast::ConstDef {}
|
impl ast::DocCommentsOwner for ast::ConstDef {}
|
||||||
impl ast::DocCommentsOwner for ast::TypeAliasDef {}
|
impl ast::DocCommentsOwner for ast::TypeAlias {}
|
||||||
impl ast::DocCommentsOwner for ast::ImplDef {}
|
impl ast::DocCommentsOwner for ast::ImplDef {}
|
||||||
impl ast::DocCommentsOwner for ast::MacroCall {}
|
impl ast::DocCommentsOwner for ast::MacroCall {}
|
||||||
|
|
|
@ -146,7 +146,7 @@ fn n_attached_trivias<'a>(
|
||||||
trivias: impl Iterator<Item = (SyntaxKind, &'a str)>,
|
trivias: impl Iterator<Item = (SyntaxKind, &'a str)>,
|
||||||
) -> usize {
|
) -> usize {
|
||||||
match kind {
|
match kind {
|
||||||
MACRO_CALL | CONST_DEF | TYPE_ALIAS_DEF | STRUCT_DEF | ENUM_DEF | ENUM_VARIANT | FN
|
MACRO_CALL | CONST_DEF | TYPE_ALIAS | STRUCT_DEF | ENUM_DEF | ENUM_VARIANT | FN
|
||||||
| TRAIT_DEF | MODULE | RECORD_FIELD_DEF | STATIC_DEF => {
|
| TRAIT_DEF | MODULE | RECORD_FIELD_DEF | STATIC_DEF => {
|
||||||
let mut res = 0;
|
let mut res = 0;
|
||||||
let mut trivias = trivias.enumerate().peekable();
|
let mut trivias = trivias.enumerate().peekable();
|
||||||
|
|
|
@ -4,7 +4,7 @@ mod block;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
ast, match_ast, AstNode, SyntaxError,
|
ast, match_ast, AstNode, SyntaxError,
|
||||||
SyntaxKind::{BYTE, BYTE_STRING, CHAR, CONST_DEF, FN, INT_NUMBER, STRING, TYPE_ALIAS_DEF},
|
SyntaxKind::{BYTE, BYTE_STRING, CHAR, CONST_DEF, FN, INT_NUMBER, STRING, TYPE_ALIAS},
|
||||||
SyntaxNode, SyntaxToken, TextSize, T,
|
SyntaxNode, SyntaxToken, TextSize, T,
|
||||||
};
|
};
|
||||||
use rustc_lexer::unescape::{
|
use rustc_lexer::unescape::{
|
||||||
|
@ -200,7 +200,7 @@ fn validate_visibility(vis: ast::Visibility, errors: &mut Vec<SyntaxError>) {
|
||||||
None => return,
|
None => return,
|
||||||
};
|
};
|
||||||
match parent.kind() {
|
match parent.kind() {
|
||||||
FN | CONST_DEF | TYPE_ALIAS_DEF => (),
|
FN | CONST_DEF | TYPE_ALIAS => (),
|
||||||
_ => return,
|
_ => return,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ SOURCE_FILE@0..118
|
||||||
L_CURLY@49..50 "{"
|
L_CURLY@49..50 "{"
|
||||||
R_CURLY@50..51 "}"
|
R_CURLY@50..51 "}"
|
||||||
WHITESPACE@51..56 "\n "
|
WHITESPACE@51..56 "\n "
|
||||||
TYPE_ALIAS_DEF@56..81
|
TYPE_ALIAS@56..81
|
||||||
VISIBILITY@56..66
|
VISIBILITY@56..66
|
||||||
PUB_KW@56..59 "pub"
|
PUB_KW@56..59 "pub"
|
||||||
L_PAREN@59..60 "("
|
L_PAREN@59..60 "("
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
SOURCE_FILE@0..239
|
SOURCE_FILE@0..239
|
||||||
TYPE_ALIAS_DEF@0..30
|
TYPE_ALIAS@0..30
|
||||||
TYPE_KW@0..4 "type"
|
TYPE_KW@0..4 "type"
|
||||||
WHITESPACE@4..5 " "
|
WHITESPACE@4..5 " "
|
||||||
NAME@5..11
|
NAME@5..11
|
||||||
|
@ -26,7 +26,7 @@ SOURCE_FILE@0..239
|
||||||
IDENT@26..29 "u32"
|
IDENT@26..29 "u32"
|
||||||
SEMICOLON@29..30 ";"
|
SEMICOLON@29..30 ";"
|
||||||
WHITESPACE@30..31 "\n"
|
WHITESPACE@30..31 "\n"
|
||||||
TYPE_ALIAS_DEF@31..64
|
TYPE_ALIAS@31..64
|
||||||
TYPE_KW@31..35 "type"
|
TYPE_KW@31..35 "type"
|
||||||
WHITESPACE@35..36 " "
|
WHITESPACE@35..36 " "
|
||||||
NAME@36..42
|
NAME@36..42
|
||||||
|
@ -57,7 +57,7 @@ SOURCE_FILE@0..239
|
||||||
R_PAREN@62..63 ")"
|
R_PAREN@62..63 ")"
|
||||||
SEMICOLON@63..64 ";"
|
SEMICOLON@63..64 ";"
|
||||||
WHITESPACE@64..65 "\n"
|
WHITESPACE@64..65 "\n"
|
||||||
TYPE_ALIAS_DEF@65..95
|
TYPE_ALIAS@65..95
|
||||||
TYPE_KW@65..69 "type"
|
TYPE_KW@65..69 "type"
|
||||||
WHITESPACE@69..70 " "
|
WHITESPACE@69..70 " "
|
||||||
NAME@70..78
|
NAME@70..78
|
||||||
|
@ -83,7 +83,7 @@ SOURCE_FILE@0..239
|
||||||
R_BRACK@93..94 "]"
|
R_BRACK@93..94 "]"
|
||||||
SEMICOLON@94..95 ";"
|
SEMICOLON@94..95 ";"
|
||||||
WHITESPACE@95..96 "\n"
|
WHITESPACE@95..96 "\n"
|
||||||
TYPE_ALIAS_DEF@96..149
|
TYPE_ALIAS@96..149
|
||||||
TYPE_KW@96..100 "type"
|
TYPE_KW@96..100 "type"
|
||||||
WHITESPACE@100..101 " "
|
WHITESPACE@100..101 " "
|
||||||
NAME@101..109
|
NAME@101..109
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
SOURCE_FILE@0..18
|
SOURCE_FILE@0..18
|
||||||
TYPE_ALIAS_DEF@0..12
|
TYPE_ALIAS@0..12
|
||||||
TYPE_KW@0..4 "type"
|
TYPE_KW@0..4 "type"
|
||||||
WHITESPACE@4..5 " "
|
WHITESPACE@4..5 " "
|
||||||
NAME@5..6
|
NAME@5..6
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
SOURCE_FILE@0..14
|
SOURCE_FILE@0..14
|
||||||
TYPE_ALIAS_DEF@0..13
|
TYPE_ALIAS@0..13
|
||||||
TYPE_KW@0..4 "type"
|
TYPE_KW@0..4 "type"
|
||||||
WHITESPACE@4..5 " "
|
WHITESPACE@4..5 " "
|
||||||
NAME@5..6
|
NAME@5..6
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
SOURCE_FILE@0..20
|
SOURCE_FILE@0..20
|
||||||
TYPE_ALIAS_DEF@0..15
|
TYPE_ALIAS@0..15
|
||||||
TYPE_KW@0..4 "type"
|
TYPE_KW@0..4 "type"
|
||||||
WHITESPACE@4..5 " "
|
WHITESPACE@4..5 " "
|
||||||
NAME@5..6
|
NAME@5..6
|
||||||
|
|
|
@ -14,7 +14,7 @@ SOURCE_FILE@0..62
|
||||||
NAME_REF@14..21
|
NAME_REF@14..21
|
||||||
IDENT@14..21 "default"
|
IDENT@14..21 "default"
|
||||||
WHITESPACE@21..22 " "
|
WHITESPACE@21..22 " "
|
||||||
TYPE_ALIAS_DEF@22..35
|
TYPE_ALIAS@22..35
|
||||||
TYPE_KW@22..26 "type"
|
TYPE_KW@22..26 "type"
|
||||||
WHITESPACE@26..27 " "
|
WHITESPACE@26..27 " "
|
||||||
NAME@27..28
|
NAME@27..28
|
||||||
|
|
|
@ -11,7 +11,7 @@ SOURCE_FILE@0..83
|
||||||
ASSOC_ITEM_LIST@7..82
|
ASSOC_ITEM_LIST@7..82
|
||||||
L_CURLY@7..8 "{"
|
L_CURLY@7..8 "{"
|
||||||
WHITESPACE@8..13 "\n "
|
WHITESPACE@8..13 "\n "
|
||||||
TYPE_ALIAS_DEF@13..27
|
TYPE_ALIAS@13..27
|
||||||
TYPE_KW@13..17 "type"
|
TYPE_KW@13..17 "type"
|
||||||
WHITESPACE@17..18 " "
|
WHITESPACE@17..18 " "
|
||||||
NAME@18..19
|
NAME@18..19
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
SOURCE_FILE@0..39
|
SOURCE_FILE@0..39
|
||||||
TYPE_ALIAS_DEF@0..38
|
TYPE_ALIAS@0..38
|
||||||
TYPE_KW@0..4 "type"
|
TYPE_KW@0..4 "type"
|
||||||
WHITESPACE@4..5 " "
|
WHITESPACE@4..5 " "
|
||||||
NAME@5..6
|
NAME@5..6
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
SOURCE_FILE@0..31
|
SOURCE_FILE@0..31
|
||||||
TYPE_ALIAS_DEF@0..30
|
TYPE_ALIAS@0..30
|
||||||
TYPE_KW@0..4 "type"
|
TYPE_KW@0..4 "type"
|
||||||
WHITESPACE@4..5 " "
|
WHITESPACE@4..5 " "
|
||||||
NAME@5..8
|
NAME@5..8
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
SOURCE_FILE@0..36
|
SOURCE_FILE@0..36
|
||||||
TYPE_ALIAS_DEF@0..17
|
TYPE_ALIAS@0..17
|
||||||
TYPE_KW@0..4 "type"
|
TYPE_KW@0..4 "type"
|
||||||
WHITESPACE@4..5 " "
|
WHITESPACE@4..5 " "
|
||||||
NAME@5..6
|
NAME@5..6
|
||||||
|
@ -16,7 +16,7 @@ SOURCE_FILE@0..36
|
||||||
R_PAREN@15..16 ")"
|
R_PAREN@15..16 ")"
|
||||||
SEMICOLON@16..17 ";"
|
SEMICOLON@16..17 ";"
|
||||||
WHITESPACE@17..18 "\n"
|
WHITESPACE@17..18 "\n"
|
||||||
TYPE_ALIAS_DEF@18..35
|
TYPE_ALIAS@18..35
|
||||||
TYPE_KW@18..22 "type"
|
TYPE_KW@18..22 "type"
|
||||||
WHITESPACE@22..23 " "
|
WHITESPACE@22..23 " "
|
||||||
NAME@23..24
|
NAME@23..24
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
SOURCE_FILE@0..16
|
SOURCE_FILE@0..16
|
||||||
TYPE_ALIAS_DEF@0..15
|
TYPE_ALIAS@0..15
|
||||||
TYPE_KW@0..4 "type"
|
TYPE_KW@0..4 "type"
|
||||||
WHITESPACE@4..5 " "
|
WHITESPACE@4..5 " "
|
||||||
NAME@5..10
|
NAME@5..10
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
SOURCE_FILE@0..19
|
SOURCE_FILE@0..19
|
||||||
TYPE_ALIAS_DEF@0..18
|
TYPE_ALIAS@0..18
|
||||||
TYPE_KW@0..4 "type"
|
TYPE_KW@0..4 "type"
|
||||||
WHITESPACE@4..5 " "
|
WHITESPACE@4..5 " "
|
||||||
NAME@5..6
|
NAME@5..6
|
||||||
|
|
|
@ -11,7 +11,7 @@ SOURCE_FILE@0..89
|
||||||
ASSOC_ITEM_LIST@7..88
|
ASSOC_ITEM_LIST@7..88
|
||||||
L_CURLY@7..8 "{"
|
L_CURLY@7..8 "{"
|
||||||
WHITESPACE@8..13 "\n "
|
WHITESPACE@8..13 "\n "
|
||||||
TYPE_ALIAS_DEF@13..26
|
TYPE_ALIAS@13..26
|
||||||
TYPE_KW@13..17 "type"
|
TYPE_KW@13..17 "type"
|
||||||
WHITESPACE@17..18 " "
|
WHITESPACE@17..18 " "
|
||||||
NAME@18..19
|
NAME@18..19
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
SOURCE_FILE@0..22
|
SOURCE_FILE@0..22
|
||||||
TYPE_ALIAS_DEF@0..21
|
TYPE_ALIAS@0..21
|
||||||
TYPE_KW@0..4 "type"
|
TYPE_KW@0..4 "type"
|
||||||
WHITESPACE@4..5 " "
|
WHITESPACE@4..5 " "
|
||||||
NAME@5..16
|
NAME@5..16
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
SOURCE_FILE@0..15
|
SOURCE_FILE@0..15
|
||||||
TYPE_ALIAS_DEF@0..14
|
TYPE_ALIAS@0..14
|
||||||
TYPE_KW@0..4 "type"
|
TYPE_KW@0..4 "type"
|
||||||
WHITESPACE@4..5 " "
|
WHITESPACE@4..5 " "
|
||||||
NAME@5..6
|
NAME@5..6
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
SOURCE_FILE@0..43
|
SOURCE_FILE@0..43
|
||||||
TYPE_ALIAS_DEF@0..42
|
TYPE_ALIAS@0..42
|
||||||
TYPE_KW@0..4 "type"
|
TYPE_KW@0..4 "type"
|
||||||
WHITESPACE@4..5 " "
|
WHITESPACE@4..5 " "
|
||||||
NAME@5..6
|
NAME@5..6
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
SOURCE_FILE@0..113
|
SOURCE_FILE@0..113
|
||||||
TYPE_ALIAS_DEF@0..14
|
TYPE_ALIAS@0..14
|
||||||
TYPE_KW@0..4 "type"
|
TYPE_KW@0..4 "type"
|
||||||
WHITESPACE@4..5 " "
|
WHITESPACE@4..5 " "
|
||||||
NAME@5..6
|
NAME@5..6
|
||||||
|
@ -14,7 +14,7 @@ SOURCE_FILE@0..113
|
||||||
R_PAREN@12..13 ")"
|
R_PAREN@12..13 ")"
|
||||||
SEMICOLON@13..14 ";"
|
SEMICOLON@13..14 ";"
|
||||||
WHITESPACE@14..15 "\n"
|
WHITESPACE@14..15 "\n"
|
||||||
TYPE_ALIAS_DEF@15..36
|
TYPE_ALIAS@15..36
|
||||||
TYPE_KW@15..19 "type"
|
TYPE_KW@15..19 "type"
|
||||||
WHITESPACE@19..20 " "
|
WHITESPACE@19..20 " "
|
||||||
NAME@20..21
|
NAME@20..21
|
||||||
|
@ -31,7 +31,7 @@ SOURCE_FILE@0..113
|
||||||
R_PAREN@34..35 ")"
|
R_PAREN@34..35 ")"
|
||||||
SEMICOLON@35..36 ";"
|
SEMICOLON@35..36 ";"
|
||||||
WHITESPACE@36..37 "\n"
|
WHITESPACE@36..37 "\n"
|
||||||
TYPE_ALIAS_DEF@37..69
|
TYPE_ALIAS@37..69
|
||||||
TYPE_KW@37..41 "type"
|
TYPE_KW@37..41 "type"
|
||||||
WHITESPACE@41..42 " "
|
WHITESPACE@41..42 " "
|
||||||
NAME@42..43
|
NAME@42..43
|
||||||
|
@ -53,7 +53,7 @@ SOURCE_FILE@0..113
|
||||||
R_PAREN@67..68 ")"
|
R_PAREN@67..68 ")"
|
||||||
SEMICOLON@68..69 ";"
|
SEMICOLON@68..69 ";"
|
||||||
WHITESPACE@69..70 "\n"
|
WHITESPACE@69..70 "\n"
|
||||||
TYPE_ALIAS_DEF@70..112
|
TYPE_ALIAS@70..112
|
||||||
TYPE_KW@70..74 "type"
|
TYPE_KW@70..74 "type"
|
||||||
WHITESPACE@74..75 " "
|
WHITESPACE@74..75 " "
|
||||||
NAME@75..76
|
NAME@75..76
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
SOURCE_FILE@0..54
|
SOURCE_FILE@0..54
|
||||||
TYPE_ALIAS_DEF@0..13
|
TYPE_ALIAS@0..13
|
||||||
TYPE_KW@0..4 "type"
|
TYPE_KW@0..4 "type"
|
||||||
WHITESPACE@4..5 " "
|
WHITESPACE@4..5 " "
|
||||||
NAME@5..6
|
NAME@5..6
|
||||||
|
@ -14,7 +14,7 @@ SOURCE_FILE@0..54
|
||||||
R_PAREN@11..12 ")"
|
R_PAREN@11..12 ")"
|
||||||
SEMICOLON@12..13 ";"
|
SEMICOLON@12..13 ";"
|
||||||
WHITESPACE@13..14 "\n"
|
WHITESPACE@13..14 "\n"
|
||||||
TYPE_ALIAS_DEF@14..35
|
TYPE_ALIAS@14..35
|
||||||
TYPE_KW@14..18 "type"
|
TYPE_KW@14..18 "type"
|
||||||
WHITESPACE@18..19 " "
|
WHITESPACE@18..19 " "
|
||||||
NAME@19..20
|
NAME@19..20
|
||||||
|
@ -31,7 +31,7 @@ SOURCE_FILE@0..54
|
||||||
R_PAREN@33..34 ")"
|
R_PAREN@33..34 ")"
|
||||||
SEMICOLON@34..35 ";"
|
SEMICOLON@34..35 ";"
|
||||||
WHITESPACE@35..36 "\n"
|
WHITESPACE@35..36 "\n"
|
||||||
TYPE_ALIAS_DEF@36..53
|
TYPE_ALIAS@36..53
|
||||||
TYPE_KW@36..40 "type"
|
TYPE_KW@36..40 "type"
|
||||||
WHITESPACE@40..41 " "
|
WHITESPACE@40..41 " "
|
||||||
NAME@41..42
|
NAME@41..42
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
SOURCE_FILE@0..71
|
SOURCE_FILE@0..71
|
||||||
TYPE_ALIAS_DEF@0..26
|
TYPE_ALIAS@0..26
|
||||||
TYPE_KW@0..4 "type"
|
TYPE_KW@0..4 "type"
|
||||||
WHITESPACE@4..5 " "
|
WHITESPACE@4..5 " "
|
||||||
NAME@5..6
|
NAME@5..6
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
SOURCE_FILE@0..46
|
SOURCE_FILE@0..46
|
||||||
TYPE_ALIAS_DEF@0..45
|
TYPE_ALIAS@0..45
|
||||||
TYPE_KW@0..4 "type"
|
TYPE_KW@0..4 "type"
|
||||||
WHITESPACE@4..5 " "
|
WHITESPACE@4..5 " "
|
||||||
NAME@5..6
|
NAME@5..6
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
SOURCE_FILE@0..17
|
SOURCE_FILE@0..17
|
||||||
TYPE_ALIAS_DEF@0..16
|
TYPE_ALIAS@0..16
|
||||||
TYPE_KW@0..4 "type"
|
TYPE_KW@0..4 "type"
|
||||||
WHITESPACE@4..5 " "
|
WHITESPACE@4..5 " "
|
||||||
NAME@5..6
|
NAME@5..6
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
SOURCE_FILE@0..13
|
SOURCE_FILE@0..13
|
||||||
TYPE_ALIAS_DEF@0..12
|
TYPE_ALIAS@0..12
|
||||||
TYPE_KW@0..4 "type"
|
TYPE_KW@0..4 "type"
|
||||||
WHITESPACE@4..5 " "
|
WHITESPACE@4..5 " "
|
||||||
NAME@5..6
|
NAME@5..6
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
SOURCE_FILE@0..71
|
SOURCE_FILE@0..71
|
||||||
TYPE_ALIAS_DEF@0..13
|
TYPE_ALIAS@0..13
|
||||||
TYPE_KW@0..4 "type"
|
TYPE_KW@0..4 "type"
|
||||||
WHITESPACE@4..5 " "
|
WHITESPACE@4..5 " "
|
||||||
NAME@5..6
|
NAME@5..6
|
||||||
|
@ -14,7 +14,7 @@ SOURCE_FILE@0..71
|
||||||
IDENT@9..12 "Foo"
|
IDENT@9..12 "Foo"
|
||||||
SEMICOLON@12..13 ";"
|
SEMICOLON@12..13 ";"
|
||||||
WHITESPACE@13..14 "\n"
|
WHITESPACE@13..14 "\n"
|
||||||
TYPE_ALIAS_DEF@14..29
|
TYPE_ALIAS@14..29
|
||||||
TYPE_KW@14..18 "type"
|
TYPE_KW@14..18 "type"
|
||||||
WHITESPACE@18..19 " "
|
WHITESPACE@18..19 " "
|
||||||
NAME@19..20
|
NAME@19..20
|
||||||
|
@ -30,7 +30,7 @@ SOURCE_FILE@0..71
|
||||||
IDENT@25..28 "Foo"
|
IDENT@25..28 "Foo"
|
||||||
SEMICOLON@28..29 ";"
|
SEMICOLON@28..29 ";"
|
||||||
WHITESPACE@29..30 "\n"
|
WHITESPACE@29..30 "\n"
|
||||||
TYPE_ALIAS_DEF@30..49
|
TYPE_ALIAS@30..49
|
||||||
TYPE_KW@30..34 "type"
|
TYPE_KW@30..34 "type"
|
||||||
WHITESPACE@34..35 " "
|
WHITESPACE@34..35 " "
|
||||||
NAME@35..36
|
NAME@35..36
|
||||||
|
@ -49,7 +49,7 @@ SOURCE_FILE@0..71
|
||||||
IDENT@45..48 "Foo"
|
IDENT@45..48 "Foo"
|
||||||
SEMICOLON@48..49 ";"
|
SEMICOLON@48..49 ";"
|
||||||
WHITESPACE@49..50 "\n"
|
WHITESPACE@49..50 "\n"
|
||||||
TYPE_ALIAS_DEF@50..70
|
TYPE_ALIAS@50..70
|
||||||
TYPE_KW@50..54 "type"
|
TYPE_KW@50..54 "type"
|
||||||
WHITESPACE@54..55 " "
|
WHITESPACE@54..55 " "
|
||||||
NAME@55..56
|
NAME@55..56
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
SOURCE_FILE@0..42
|
SOURCE_FILE@0..42
|
||||||
TYPE_ALIAS_DEF@0..41
|
TYPE_ALIAS@0..41
|
||||||
TYPE_KW@0..4 "type"
|
TYPE_KW@0..4 "type"
|
||||||
WHITESPACE@4..5 " "
|
WHITESPACE@4..5 " "
|
||||||
NAME@5..6
|
NAME@5..6
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
SOURCE_FILE@0..21
|
SOURCE_FILE@0..21
|
||||||
TYPE_ALIAS_DEF@0..20
|
TYPE_ALIAS@0..20
|
||||||
TYPE_KW@0..4 "type"
|
TYPE_KW@0..4 "type"
|
||||||
WHITESPACE@4..5 " "
|
WHITESPACE@4..5 " "
|
||||||
NAME@5..11
|
NAME@5..11
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
SOURCE_FILE@0..16
|
SOURCE_FILE@0..16
|
||||||
TYPE_ALIAS_DEF@0..15
|
TYPE_ALIAS@0..15
|
||||||
TYPE_KW@0..4 "type"
|
TYPE_KW@0..4 "type"
|
||||||
WHITESPACE@4..5 " "
|
WHITESPACE@4..5 " "
|
||||||
NAME@5..8
|
NAME@5..8
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
SOURCE_FILE@0..121
|
SOURCE_FILE@0..121
|
||||||
TYPE_ALIAS_DEF@0..28
|
TYPE_ALIAS@0..28
|
||||||
TYPE_KW@0..4 "type"
|
TYPE_KW@0..4 "type"
|
||||||
WHITESPACE@4..5 " "
|
WHITESPACE@4..5 " "
|
||||||
NAME@5..6
|
NAME@5..6
|
||||||
|
@ -29,7 +29,7 @@ SOURCE_FILE@0..121
|
||||||
R_PAREN@26..27 ")"
|
R_PAREN@26..27 ")"
|
||||||
SEMICOLON@27..28 ";"
|
SEMICOLON@27..28 ";"
|
||||||
WHITESPACE@28..29 "\n"
|
WHITESPACE@28..29 "\n"
|
||||||
TYPE_ALIAS_DEF@29..81
|
TYPE_ALIAS@29..81
|
||||||
TYPE_KW@29..33 "type"
|
TYPE_KW@29..33 "type"
|
||||||
WHITESPACE@33..34 " "
|
WHITESPACE@33..34 " "
|
||||||
NAME@34..35
|
NAME@34..35
|
||||||
|
@ -74,7 +74,7 @@ SOURCE_FILE@0..121
|
||||||
R_PAREN@79..80 ")"
|
R_PAREN@79..80 ")"
|
||||||
SEMICOLON@80..81 ";"
|
SEMICOLON@80..81 ";"
|
||||||
WHITESPACE@81..82 "\n"
|
WHITESPACE@81..82 "\n"
|
||||||
TYPE_ALIAS_DEF@82..120
|
TYPE_ALIAS@82..120
|
||||||
TYPE_KW@82..86 "type"
|
TYPE_KW@82..86 "type"
|
||||||
WHITESPACE@86..87 " "
|
WHITESPACE@86..87 " "
|
||||||
NAME@87..90
|
NAME@87..90
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
SOURCE_FILE@0..16
|
SOURCE_FILE@0..16
|
||||||
TYPE_ALIAS_DEF@0..15
|
TYPE_ALIAS@0..15
|
||||||
TYPE_KW@0..4 "type"
|
TYPE_KW@0..4 "type"
|
||||||
WHITESPACE@4..5 " "
|
WHITESPACE@4..5 " "
|
||||||
NAME@5..6
|
NAME@5..6
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
SOURCE_FILE@0..21
|
SOURCE_FILE@0..21
|
||||||
TYPE_ALIAS_DEF@0..20
|
TYPE_ALIAS@0..20
|
||||||
TYPE_KW@0..4 "type"
|
TYPE_KW@0..4 "type"
|
||||||
WHITESPACE@4..5 " "
|
WHITESPACE@4..5 " "
|
||||||
NAME@5..6
|
NAME@5..6
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
SOURCE_FILE@0..29
|
SOURCE_FILE@0..29
|
||||||
TYPE_ALIAS_DEF@0..28
|
TYPE_ALIAS@0..28
|
||||||
TYPE_KW@0..4 "type"
|
TYPE_KW@0..4 "type"
|
||||||
WHITESPACE@4..5 " "
|
WHITESPACE@4..5 " "
|
||||||
NAME@5..6
|
NAME@5..6
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
SOURCE_FILE@0..41
|
SOURCE_FILE@0..41
|
||||||
TYPE_ALIAS_DEF@0..16
|
TYPE_ALIAS@0..16
|
||||||
TYPE_KW@0..4 "type"
|
TYPE_KW@0..4 "type"
|
||||||
WHITESPACE@4..5 " "
|
WHITESPACE@4..5 " "
|
||||||
NAME@5..6
|
NAME@5..6
|
||||||
|
@ -18,7 +18,7 @@ SOURCE_FILE@0..41
|
||||||
R_PAREN@14..15 ")"
|
R_PAREN@14..15 ")"
|
||||||
SEMICOLON@15..16 ";"
|
SEMICOLON@15..16 ";"
|
||||||
WHITESPACE@16..17 "\n"
|
WHITESPACE@16..17 "\n"
|
||||||
TYPE_ALIAS_DEF@17..40
|
TYPE_ALIAS@17..40
|
||||||
TYPE_KW@17..21 "type"
|
TYPE_KW@17..21 "type"
|
||||||
WHITESPACE@21..22 " "
|
WHITESPACE@21..22 " "
|
||||||
NAME@22..23
|
NAME@22..23
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
SOURCE_FILE@0..37
|
SOURCE_FILE@0..37
|
||||||
TYPE_ALIAS_DEF@0..36
|
TYPE_ALIAS@0..36
|
||||||
EXISTENTIAL_KW@0..11 "existential"
|
EXISTENTIAL_KW@0..11 "existential"
|
||||||
WHITESPACE@11..12 " "
|
WHITESPACE@11..12 " "
|
||||||
TYPE_KW@12..16 "type"
|
TYPE_KW@12..16 "type"
|
||||||
|
|
|
@ -19,7 +19,7 @@ SOURCE_FILE@0..69
|
||||||
ASSOC_ITEM_LIST@15..68
|
ASSOC_ITEM_LIST@15..68
|
||||||
L_CURLY@15..16 "{"
|
L_CURLY@15..16 "{"
|
||||||
WHITESPACE@16..21 "\n "
|
WHITESPACE@16..21 "\n "
|
||||||
TYPE_ALIAS_DEF@21..42
|
TYPE_ALIAS@21..42
|
||||||
DEFAULT_KW@21..28 "default"
|
DEFAULT_KW@21..28 "default"
|
||||||
WHITESPACE@28..29 " "
|
WHITESPACE@28..29 " "
|
||||||
TYPE_KW@29..33 "type"
|
TYPE_KW@29..33 "type"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
SOURCE_FILE@0..55
|
SOURCE_FILE@0..55
|
||||||
TYPE_ALIAS_DEF@0..24
|
TYPE_ALIAS@0..24
|
||||||
TYPE_KW@0..4 "type"
|
TYPE_KW@0..4 "type"
|
||||||
WHITESPACE@4..5 " "
|
WHITESPACE@4..5 " "
|
||||||
NAME@5..8
|
NAME@5..8
|
||||||
|
@ -25,7 +25,7 @@ SOURCE_FILE@0..55
|
||||||
R_PAREN@22..23 ")"
|
R_PAREN@22..23 ")"
|
||||||
SEMICOLON@23..24 ";"
|
SEMICOLON@23..24 ";"
|
||||||
WHITESPACE@24..25 "\n"
|
WHITESPACE@24..25 "\n"
|
||||||
TYPE_ALIAS_DEF@25..54
|
TYPE_ALIAS@25..54
|
||||||
TYPE_KW@25..29 "type"
|
TYPE_KW@25..29 "type"
|
||||||
WHITESPACE@29..30 " "
|
WHITESPACE@29..30 " "
|
||||||
NAME@30..33
|
NAME@30..33
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
SOURCE_FILE@0..23
|
SOURCE_FILE@0..23
|
||||||
TYPE_ALIAS_DEF@0..22
|
TYPE_ALIAS@0..22
|
||||||
TYPE_KW@0..4 "type"
|
TYPE_KW@0..4 "type"
|
||||||
WHITESPACE@4..5 " "
|
WHITESPACE@4..5 " "
|
||||||
NAME@5..8
|
NAME@5..8
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
SOURCE_FILE@0..49
|
SOURCE_FILE@0..49
|
||||||
TYPE_ALIAS_DEF@0..12
|
TYPE_ALIAS@0..12
|
||||||
TYPE_KW@0..4 "type"
|
TYPE_KW@0..4 "type"
|
||||||
WHITESPACE@4..5 " "
|
WHITESPACE@4..5 " "
|
||||||
NAME@5..6
|
NAME@5..6
|
||||||
|
|
|
@ -38,7 +38,7 @@ pub(crate) fn symbol_kind(syntax_kind: SyntaxKind) -> lsp_types::SymbolKind {
|
||||||
SyntaxKind::TRAIT_DEF => lsp_types::SymbolKind::Interface,
|
SyntaxKind::TRAIT_DEF => lsp_types::SymbolKind::Interface,
|
||||||
SyntaxKind::MACRO_CALL => lsp_types::SymbolKind::Function,
|
SyntaxKind::MACRO_CALL => lsp_types::SymbolKind::Function,
|
||||||
SyntaxKind::MODULE => lsp_types::SymbolKind::Module,
|
SyntaxKind::MODULE => lsp_types::SymbolKind::Module,
|
||||||
SyntaxKind::TYPE_ALIAS_DEF => lsp_types::SymbolKind::TypeParameter,
|
SyntaxKind::TYPE_ALIAS => lsp_types::SymbolKind::TypeParameter,
|
||||||
SyntaxKind::RECORD_FIELD_DEF => lsp_types::SymbolKind::Field,
|
SyntaxKind::RECORD_FIELD_DEF => lsp_types::SymbolKind::Field,
|
||||||
SyntaxKind::STATIC_DEF => lsp_types::SymbolKind::Constant,
|
SyntaxKind::STATIC_DEF => lsp_types::SymbolKind::Constant,
|
||||||
SyntaxKind::CONST_DEF => lsp_types::SymbolKind::Constant,
|
SyntaxKind::CONST_DEF => lsp_types::SymbolKind::Constant,
|
||||||
|
|
|
@ -105,7 +105,7 @@ pub(crate) const KINDS_SRC: KindsSrc = KindsSrc {
|
||||||
"CONST_DEF",
|
"CONST_DEF",
|
||||||
"TRAIT_DEF",
|
"TRAIT_DEF",
|
||||||
"IMPL_DEF",
|
"IMPL_DEF",
|
||||||
"TYPE_ALIAS_DEF",
|
"TYPE_ALIAS",
|
||||||
"MACRO_CALL",
|
"MACRO_CALL",
|
||||||
"TOKEN_TREE",
|
"TOKEN_TREE",
|
||||||
"MACRO_DEF",
|
"MACRO_DEF",
|
||||||
|
|
|
@ -15,7 +15,7 @@ Item =
|
||||||
| StaticDef
|
| StaticDef
|
||||||
| StructDef
|
| StructDef
|
||||||
| TraitDef
|
| TraitDef
|
||||||
| TypeAliasDef
|
| TypeAlias
|
||||||
| UnionDef
|
| UnionDef
|
||||||
| Use
|
| Use
|
||||||
|
|
||||||
|
@ -72,6 +72,10 @@ Param =
|
||||||
RetType =
|
RetType =
|
||||||
'->' TypeRef
|
'->' TypeRef
|
||||||
|
|
||||||
|
TypeAlias =
|
||||||
|
Attr* Visibility? 'default'? 'type' Name TypeParamList? (':' TypeBoundList?)? WhereClause?
|
||||||
|
'=' TypeRef ';'
|
||||||
|
|
||||||
StructDef =
|
StructDef =
|
||||||
Attr* Visibility? 'struct' Name TypeParamList? (
|
Attr* Visibility? 'struct' Name TypeParamList? (
|
||||||
WhereClause? (RecordFieldDefList | ';')
|
WhereClause? (RecordFieldDefList | ';')
|
||||||
|
@ -124,10 +128,6 @@ StaticDef =
|
||||||
Attr* Visibility? 'static'? 'mut'? 'static' Name ':' ascribed_type:TypeRef
|
Attr* Visibility? 'static'? 'mut'? 'static' Name ':' ascribed_type:TypeRef
|
||||||
'=' body:Expr ';'
|
'=' body:Expr ';'
|
||||||
|
|
||||||
TypeAliasDef =
|
|
||||||
Attr* Visibility? 'default'? 'type' Name TypeParamList? WhereClause? (':' TypeBoundList?)?
|
|
||||||
'=' TypeRef ';'
|
|
||||||
|
|
||||||
ImplDef =
|
ImplDef =
|
||||||
Attr* Visibility? 'const'? 'default'? 'unsafe'? 'impl' TypeParamList? '!'? 'for'
|
Attr* Visibility? 'const'? 'default'? 'unsafe'? 'impl' TypeParamList? '!'? 'for'
|
||||||
WhereClause?
|
WhereClause?
|
||||||
|
@ -474,7 +474,7 @@ TypeRef =
|
||||||
|
|
||||||
AssocItem =
|
AssocItem =
|
||||||
Fn
|
Fn
|
||||||
| TypeAliasDef
|
| TypeAlias
|
||||||
| ConstDef
|
| ConstDef
|
||||||
| MacroCall
|
| MacroCall
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue