pub struct DefId {
pub(crate) contents: Node<DefIdContents>,
}Expand description
Reflects rustc_hir::def_id::DefId, augmented to also give ids to promoted constants (which
have their own ad-hoc numbering scheme in rustc for now).
Fields§
§contents: Node<DefIdContents>Implementations§
Source§impl DefId
impl DefId
Sourcepub fn as_rust_def_id(&self) -> Option<RDefId>
pub fn as_rust_def_id(&self) -> Option<RDefId>
The rustc def_id corresponding to this item, if there is one. Promoted constants don’t have a rustc def_id.
Sourcepub fn underlying_rust_def_id(&self) -> RDefId
pub fn underlying_rust_def_id(&self) -> RDefId
The def_id of this item or its parent if this is a promoted constant.
Sourcepub fn as_synthetic<'tcx>(
&self,
s: &impl BaseState<'tcx>,
) -> Option<SyntheticItem>
pub fn as_synthetic<'tcx>( &self, s: &impl BaseState<'tcx>, ) -> Option<SyntheticItem>
Returns the SyntheticItem encoded by a rustc DefId, if
any.
Note that this method relies on rustc indexes, which are session
specific. See Self documentation.
Sourcepub fn ancestry(&self) -> impl Iterator<Item = &Self>
pub fn ancestry(&self) -> impl Iterator<Item = &Self>
Iterate over this element and its parents.
Sourcepub fn path_item(&self) -> DisambiguatedDefPathItem
pub fn path_item(&self) -> DisambiguatedDefPathItem
The PathItem corresponding to this item.
Sourcepub fn make_promoted_child<'tcx, S: BaseState<'tcx>>(
&self,
s: &S,
promoted_id: PromotedId,
) -> Self
pub fn make_promoted_child<'tcx, S: BaseState<'tcx>>( &self, s: &S, promoted_id: PromotedId, ) -> Self
Construct a hax DefId for the nth promoted constant of the current item. That DefId has
no corresponding rustc DefId.
Source§impl DefId
impl DefId
pub fn promoted_id(&self) -> Option<PromotedId>
Source§impl DefId
impl DefId
Sourcepub fn def_span<'tcx>(&self, s: &impl BaseState<'tcx>) -> Span
pub fn def_span<'tcx>(&self, s: &impl BaseState<'tcx>) -> Span
Get the span of the definition of this item. This is the span used in diagnostics when referring to the item.
Sourcepub fn full_def<'tcx, S, Body>(&self, s: &S) -> Arc<FullDef<Body>>
pub fn full_def<'tcx, S, Body>(&self, s: &S) -> Arc<FullDef<Body>>
Get the full definition of this item.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for DefId
impl<'de> Deserialize<'de> for DefId
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl From<DefId> for Path
Available on non-crate feature extract_names_mode and crate feature rustc only.
impl From<DefId> for Path
extract_names_mode and crate feature rustc only.Source§impl JsonSchema for DefId
impl JsonSchema for DefId
Source§fn schema_name() -> String
fn schema_name() -> String
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
$ref keyword. Read moreSource§impl Ord for DefId
impl Ord for DefId
Source§impl PartialOrd for DefId
impl PartialOrd for DefId
Source§impl<'s, S: BaseState<'s>> SInto<S, DefId> for DefId
Available on non-crate feature extract_names_mode and crate feature rustc only.
impl<'s, S: BaseState<'s>> SInto<S, DefId> for DefId
extract_names_mode and crate feature rustc only.Source§impl<'tcx, S: BaseState<'tcx>> SInto<S, DefId> for LocalDefId
Available on non-crate feature extract_names_mode and crate feature rustc only.
impl<'tcx, S: BaseState<'tcx>> SInto<S, DefId> for LocalDefId
extract_names_mode and crate feature rustc only.Source§impl<'tcx, S: BaseState<'tcx>> SInto<S, DefId> for OwnerId
Available on crate feature rustc only.
impl<'tcx, S: BaseState<'tcx>> SInto<S, DefId> for OwnerId
rustc only.impl Eq for DefId
impl StructuralPartialEq for DefId
Auto Trait Implementations§
impl Freeze for DefId
impl RefUnwindSafe for DefId
impl Send for DefId
impl Sync for DefId
impl Unpin for DefId
impl UnwindSafe for DefId
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§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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