pub enum MacroCallKind {
FnLike {
ast_id: AstId<MacroCall>,
expand_to: ExpandTo,
eager: Option<Arc<EagerCallInfo>>,
},
Derive {
ast_id: AstId<Adt>,
derive_attr_index: AttrId,
derive_index: u32,
derive_macro_id: MacroCallId,
},
Attr {
ast_id: AstId<Item>,
attr_args: Option<Arc<Subtree>>,
invoc_attr_index: AttrId,
},
}
Variants§
FnLike
Fields
eager: Option<Arc<EagerCallInfo>>
Some if this is a macro call for an eager macro. Note that this is None
for the eager input macro file.
Derive
Fields
derive_attr_index: AttrId
Syntactical index of the invoking #[derive]
attribute.
Outer attributes are counted first, then inner attributes. This does not support out-of-line modules, which may have attributes spread across 2 files!
derive_macro_id: MacroCallId
The “parent” macro call. We will resolve the same token tree for all derive macros in the same derive attribute.
Attr
Implementations§
source§impl MacroCallKind
impl MacroCallKind
pub fn erased_ast_id(&self) -> ErasedFileAstId
sourcepub fn original_call_range_with_body(self, db: &dyn ExpandDatabase) -> FileRange
pub fn original_call_range_with_body(self, db: &dyn ExpandDatabase) -> FileRange
Returns the original file range that best describes the location of this macro call.
Unlike MacroCallKind::original_call_range
, this also spans the item of attributes and derives.
sourcepub fn original_call_range(self, db: &dyn ExpandDatabase) -> FileRange
pub fn original_call_range(self, db: &dyn ExpandDatabase) -> FileRange
Returns the original file range that best describes the location of this macro call.
Here we try to roughly match what rustc does to improve diagnostics: fn-like macros
get the whole ast::MacroCall
, attribute macros get the attribute’s range, and derives
get only the specific derive that is being referred to.
Trait Implementations§
source§impl Clone for MacroCallKind
impl Clone for MacroCallKind
source§fn clone(&self) -> MacroCallKind
fn clone(&self) -> MacroCallKind
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for MacroCallKind
impl Debug for MacroCallKind
source§impl Hash for MacroCallKind
impl Hash for MacroCallKind
source§impl PartialEq for MacroCallKind
impl PartialEq for MacroCallKind
impl Eq for MacroCallKind
impl StructuralPartialEq for MacroCallKind
Auto Trait Implementations§
impl Freeze for MacroCallKind
impl RefUnwindSafe for MacroCallKind
impl Send for MacroCallKind
impl Sync for MacroCallKind
impl Unpin for MacroCallKind
impl UnwindSafe for MacroCallKind
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more