DeclData in rustc_resolve - Rust
Description: Data associated with any name declaration.

Skip to main content

## DeclData

# Struct DeclData

Source

    pub(crate) struct DeclData<'ra> {
        pub(crate) kind: DeclKind<'ra>,
        pub(crate) ambiguity: CmCell<Option<Interned<'ra, DeclData<'ra>>>>,
        pub(crate) warn_ambiguity: CmCell<bool>,
        pub(crate) expansion: LocalExpnId,
        pub(crate) span: Span,
        pub(crate) initial_vis: Visibility<DefId>,
        pub(crate) ambiguity_vis_max: CmCell<Option<Interned<'ra, DeclData<'ra>>>>,
        pub(crate) ambiguity_vis_min: CmCell<Option<Interned<'ra, DeclData<'ra>>>>,
        pub(crate) parent_module: Option<Module<'ra>>,
    }

Expand description

Data associated with any name declaration.

## Fields§

§`kind: DeclKind<'ra>`§`ambiguity: CmCell<Option<Interned<'ra, DeclData<'ra>>>>`§`warn_ambiguity: CmCell<bool>`

Produce a warning instead of an error when reporting ambiguities inside this binding. May apply to indirect ambiguities under imports, so `ambiguity.is_some()` is not required.

§`expansion: LocalExpnId`§`span: Span`§`initial_vis: Visibility<DefId>`§`ambiguity_vis_max: CmCell<Option<Interned<'ra, DeclData<'ra>>>>`

If the declaration refers to an ambiguous glob set, then this is the most visible declaration from the set, if its visibility is different from `initial_vis`.

§`ambiguity_vis_min: CmCell<Option<Interned<'ra, DeclData<'ra>>>>`

If the declaration refers to an ambiguous glob set, then this is the least visible declaration from the set, if its visibility is different from `initial_vis`.

§`parent_module: Option<Module<'ra>>`

## Implementations§

Source§

### impl<'ra> DeclData<'ra>

Source

#### pub(crate) fn vis(&self) -> Visibility<DefId>

Source

#### pub(crate) fn min_vis(&self) -> Visibility<DefId>

Source

#### pub(crate) fn res(&self) -> Res<NodeId>

Source

#### pub(crate) fn import_source(&self) -> Interned<'ra, DeclData<'ra>>

Source

#### pub(crate) fn descent_to_ambiguity( self: Interned<'ra, DeclData<'ra>>, ) -> Option<(Interned<'ra, DeclData<'ra>>, Interned<'ra, DeclData<'ra>>)>

Source

#### pub(crate) fn is_ambiguity_recursive(&self) -> bool

Source

#### pub(crate) fn warn_ambiguity_recursive(&self) -> bool

Source

#### pub(crate) fn is_possibly_imported_variant(&self) -> bool

Source

#### pub(crate) fn is_extern_crate(&self) -> bool

Source

#### pub(crate) fn is_import(&self) -> bool

Source

#### pub(crate) fn is_import_user_facing(&self) -> bool

The binding introduced by `#[macro_export] macro_rules` is a public import, but it might not be perceived as such by users, so treat it as a non-import in some diagnostics.

Source

#### pub(crate) fn is_glob_import(&self) -> bool

Source

#### pub(crate) fn is_assoc_item(&self) -> bool

Source

#### pub(crate) fn macro_kinds(&self) -> Option<MacroKinds>

Source

#### pub(crate) fn reexport_chain( self: Interned<'ra, DeclData<'ra>>, ) -> SmallVec<[Reexport; 2]>

Source

#### pub(crate) fn may_appear_after( &self, invoc_parent_expansion: LocalExpnId, decl: Interned<'_, DeclData<'_>>, ) -> bool

Source

#### pub(crate) fn determined(&self) -> bool

Returns whether this declaration may be shadowed or overwritten by something else later. FIXME: this function considers `unexpanded_invocations`, but not `single_imports`, so the declaration may not be as “determined” as we think. FIXME: relationship between this function and similar `NameResolution::determined_decl` is unclear.

## Trait Implementations§

Source§

### impl<'ra> Clone for DeclData<'ra>

Source§

#### fn clone(&self) -> DeclData<'ra>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

#### fn clone_from(&mut self, source: &Self)

Performs copy-assignment from `source`. Read more
Source§

### impl<'ra> Debug for DeclData<'ra>

Source§

#### fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

### impl Hash for DeclData<'_>

Source§

#### fn hash<H>(&self, _: &mut H)
where H: Hasher,

Feeds this value into the given `Hasher`. Read more
1.3.0 · Source§

#### fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given `Hasher`. Read more

## Auto Trait Implementations§

§

### impl<'ra> !DynSend for DeclData<'ra>

§

### impl<'ra> !DynSync for DeclData<'ra>

§

### impl<'ra> !Freeze for DeclData<'ra>

§

### impl<'ra> !RefUnwindSafe for DeclData<'ra>

§

### impl<'ra> !Send for DeclData<'ra>

§

### impl<'ra> !Sync for DeclData<'ra>

§

### impl<'ra> Unpin for DeclData<'ra>

§

### impl<'ra> UnsafeUnpin for DeclData<'ra>

§

### impl<'ra> !UnwindSafe for DeclData<'ra>

## Blanket Implementations§

Source§

### impl<T> Aligned for T

Source§

#### const ALIGN: Alignment

Alignment of `Self`.
Source§

### impl<T> Any for T
where T: 'static + ?Sized,

Source§

#### fn type_id(&self) -> TypeId

Gets the `TypeId` of `self`. Read more
Source§

### impl<T> Borrow<T> for T
where T: ?Sized,

Source§

#### fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

### impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

#### fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

### impl<T> CloneToUninit for T
where T: Clone,

Source§

#### unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (`clone_to_uninit`)
Performs copy-assignment from `self` to `dest`. Read more
Source§

### impl<T, R> CollectAndApply<T, R> for T

Source§

#### fn collect_and_apply<I, F>(iter: I, f: F) -> R
where I: Iterator<Item = T>, F: FnOnce(&[T]) -> R,

Equivalent to `f(&iter.collect::<Vec<_>>())`.

Source§

#### type Output = R

Source§

### impl<T> DynClone for T
where T: Clone,

Source§

#### fn __clone_box(&self, _: Private) -> *mut ()

Source§

### impl<T> From<T> for T

Source§

#### fn from(t: T) -> T

Returns the argument unchanged.

Source§

### impl<T> Instrument for T

Source§

#### fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided `Span`, returning an `Instrumented` wrapper. Read more
Source§

#### fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current `Span`, returning an `Instrumented` wrapper. Read more
Source§

### impl<T, U> Into<U> for T
where U: From<T>,

Source§

#### fn into(self) -> U

Calls `U::from(self)`.

That is, this conversion is whatever the implementation of `From<T> for U` chooses to do.

Source§

### impl<T> IntoEither for T

Source§

#### fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts `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 more
Source§

#### fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts `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
Source§

### impl<K> IntoQueryKey<K> for K

Source§

#### fn into_query_key(self) -> K

Argument conversion from `Self` to `K`. This should always be a very cheap conversion, e.g. `LocalDefId::to_def_id`.
Source§

### impl<T> MaybeResult<T> for T

Source§

#### type Error = !

Source§

#### fn from(_: Result<T, <T as MaybeResult<T>>::Error>) -> T

Source§

#### fn to_result(self) -> Result<T, <T as MaybeResult<T>>::Error>

Source§

### impl<T> Pointable for T

Source§

#### const ALIGN: usize

The alignment of pointer.
Source§

#### type Init = T

The type for initializers.
Source§

#### unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

#### unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

#### unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

#### unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

### impl<T> Same for T

Source§

#### type Output = T

Should always be `Self`
Source§

### impl<T> ToOwned for T
where T: Clone,

Source§

#### type Owned = T

The resulting type after obtaining ownership.
Source§

#### fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

#### fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

### impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

#### type Error = Infallible

The type returned in the event of a conversion error.
Source§

#### fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

### impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

#### type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

#### fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

### impl<I, T, U> Upcast<I, U> for T
where U: UpcastFrom<I, T>,

Source§

#### fn upcast(self, interner: I) -> U

Source§

### impl<I, T> UpcastFrom<I, T> for T

Source§

#### fn upcast_from(from: T, _tcx: I) -> T

Source§

### impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

#### fn vzip(self) -> V

Source§

### impl<T> WithSubscriber for T

Source§

#### fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided `Subscriber` to this type, returning a `WithDispatch` wrapper. Read more
Source§

#### fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default `Subscriber` to this type, returning a `WithDispatch` wrapper. Read more
Source§

### impl<T> ErasedDestructor for T
where T: 'static,

## Layout§

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain `repr(...)` attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.

Size: 80 bytes