diff options
Diffstat (limited to 'crates/hir_def/src/item_tree.rs')
-rw-r--r-- | crates/hir_def/src/item_tree.rs | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/crates/hir_def/src/item_tree.rs b/crates/hir_def/src/item_tree.rs index dd80cef23..c6d700977 100644 --- a/crates/hir_def/src/item_tree.rs +++ b/crates/hir_def/src/item_tree.rs | |||
@@ -24,7 +24,7 @@ use la_arena::{Arena, Idx, RawIdx}; | |||
24 | use profile::Count; | 24 | use profile::Count; |
25 | use rustc_hash::FxHashMap; | 25 | use rustc_hash::FxHashMap; |
26 | use smallvec::SmallVec; | 26 | use smallvec::SmallVec; |
27 | use syntax::{ast, match_ast, SmolStr, SyntaxKind}; | 27 | use syntax::{ast, match_ast, SyntaxKind}; |
28 | 28 | ||
29 | use crate::{ | 29 | use crate::{ |
30 | attr::{Attrs, RawAttrs}, | 30 | attr::{Attrs, RawAttrs}, |
@@ -556,15 +556,11 @@ pub struct Function { | |||
556 | pub name: Name, | 556 | pub name: Name, |
557 | pub visibility: RawVisibilityId, | 557 | pub visibility: RawVisibilityId, |
558 | pub generic_params: GenericParamsId, | 558 | pub generic_params: GenericParamsId, |
559 | pub has_self_param: bool, | 559 | pub abi: Option<Interned<str>>, |
560 | pub has_body: bool, | ||
561 | pub qualifier: FunctionQualifier, | ||
562 | /// Whether the function is located in an `extern` block (*not* whether it is an | ||
563 | /// `extern "abi" fn`). | ||
564 | pub is_in_extern_block: bool, | ||
565 | pub params: IdRange<Param>, | 560 | pub params: IdRange<Param>, |
566 | pub ret_type: Interned<TypeRef>, | 561 | pub ret_type: Interned<TypeRef>, |
567 | pub ast_id: FileAstId<ast::Fn>, | 562 | pub ast_id: FileAstId<ast::Fn>, |
563 | pub(crate) flags: FnFlags, | ||
568 | } | 564 | } |
569 | 565 | ||
570 | #[derive(Debug, Clone, Eq, PartialEq)] | 566 | #[derive(Debug, Clone, Eq, PartialEq)] |
@@ -573,13 +569,20 @@ pub enum Param { | |||
573 | Varargs, | 569 | Varargs, |
574 | } | 570 | } |
575 | 571 | ||
576 | #[derive(Debug, Clone, PartialEq, Eq)] | 572 | bitflags::bitflags! { |
577 | pub struct FunctionQualifier { | 573 | /// NOTE: Shared with `FunctionData` |
578 | pub is_default: bool, | 574 | pub(crate) struct FnFlags: u8 { |
579 | pub is_const: bool, | 575 | const HAS_SELF_PARAM = 1 << 0; |
580 | pub is_async: bool, | 576 | const HAS_BODY = 1 << 1; |
581 | pub is_unsafe: bool, | 577 | const IS_DEFAULT = 1 << 2; |
582 | pub abi: Option<SmolStr>, | 578 | const IS_CONST = 1 << 3; |
579 | const IS_ASYNC = 1 << 4; | ||
580 | const IS_UNSAFE = 1 << 5; | ||
581 | /// Whether the function is located in an `extern` block (*not* whether it is an | ||
582 | /// `extern "abi" fn`). | ||
583 | const IS_IN_EXTERN_BLOCK = 1 << 6; | ||
584 | const IS_VARARGS = 1 << 7; | ||
585 | } | ||
583 | } | 586 | } |
584 | 587 | ||
585 | #[derive(Debug, Clone, Eq, PartialEq)] | 588 | #[derive(Debug, Clone, Eq, PartialEq)] |