pub struct DefId {
pub(crate) contents: HashConsed<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: HashConsed<DefIdContents>Implementations§
Source§impl DefId
impl DefId
Sourcepub fn as_real_def_id(&self) -> Option<RDefId>
pub fn as_real_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 real_rust_def_id(&self) -> RDefId
pub fn real_rust_def_id(&self) -> RDefId
The rustc def_id of this item. Panics if this is not a real rustc item.
Sourcepub fn as_real_or_promoted(&self) -> Option<RDefId>
pub fn as_real_or_promoted(&self) -> Option<RDefId>
The def_id of this item or its parent if this is a promoted constant.
pub fn promoted_id(&self) -> Option<PromotedId>
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 this hax DefId, if any.
pub fn is_local(&self) -> bool
pub fn is_typeck_child<'tcx>(&self, s: &impl BaseState<'tcx>) -> bool
fn make<'tcx, S: BaseState<'tcx>>(s: &S, def_id: RDefId) -> Self
pub fn make_synthetic<'tcx, S: BaseState<'tcx>>( s: &S, synthetic: SyntheticItem, ) -> Self
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.
pub fn make_assoc_item_impl<'tcx, S: BaseState<'tcx>>( s: &S, vitem: VirtualImplAssocItem, ) -> Self
Sourcepub fn make_anon_alloc<'tcx, S: BaseState<'tcx>>(
s: &S,
alloc_id: RAllocId,
) -> Self
pub fn make_anon_alloc<'tcx, S: BaseState<'tcx>>( s: &S, alloc_id: RAllocId, ) -> Self
The global standing for an anonymous allocation.
Source§impl DefId
impl DefId
fn crate_name_and_disambig<'tcx>( &self, s: &impl BaseState<'tcx>, ) -> (Symbol, u32)
pub fn crate_name<'tcx>(&self, s: &impl BaseState<'tcx>) -> Symbol
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 path_item<'tcx>(
&self,
s: &impl BaseState<'tcx>,
) -> DisambiguatedDefPathItem
pub fn path_item<'tcx>( &self, s: &impl BaseState<'tcx>, ) -> DisambiguatedDefPathItem
The PathItem corresponding to this item.
pub fn parent<'tcx>(&self, s: &impl BaseState<'tcx>) -> Option<DefId>
Source§impl DefId
impl DefId
pub fn can_have_generics<'tcx>(&self, s: &impl BaseState<'tcx>) -> bool
pub fn generics_of<'tcx>(&self, s: &impl BaseState<'tcx>) -> &'tcx Generics
pub fn identity_args<'tcx>( &self, s: &impl BaseState<'tcx>, ) -> GenericArgsRef<'tcx>
pub fn param_env<'tcx>(&self, s: &impl BaseState<'tcx>) -> ParamEnv<'tcx>
pub fn typing_env<'tcx>(&self, s: &impl BaseState<'tcx>) -> TypingEnv<'tcx>
pub fn required_predicates<'tcx, S: BaseState<'tcx>>( &self, s: &S, ) -> ItemPredicates<'tcx, Self>
pub fn type_of<'tcx, S: BaseState<'tcx>>( &self, s: &S, ) -> EarlyBinder<'tcx, Ty<'tcx>>
Trait Implementations§
impl Eq for DefId
Source§impl ItemId for DefId
impl ItemId for DefId
Source§fn from_rust_def_id<'tcx>(s: &Self::State<'tcx>, def_id: RDefId) -> Self
fn from_rust_def_id<'tcx>(s: &Self::State<'tcx>, def_id: RDefId) -> Self
Source§fn generics_of<'tcx>(&self, s: &Self::State<'tcx>) -> &'tcx Generics
fn generics_of<'tcx>(&self, s: &Self::State<'tcx>) -> &'tcx Generics
Source§fn param_env<'tcx>(&self, s: &Self::State<'tcx>) -> ParamEnv<'tcx>
fn param_env<'tcx>(&self, s: &Self::State<'tcx>) -> ParamEnv<'tcx>
Source§fn predicates_defined_on<'tcx>(
&self,
s: &Self::State<'tcx>,
direction: PredicateDirection,
) -> ItemPredicates<'tcx, Self>
fn predicates_defined_on<'tcx>( &self, s: &Self::State<'tcx>, direction: PredicateDirection, ) -> ItemPredicates<'tcx, Self>
Source§fn self_pred<'tcx>(&self, s: &Self::State<'tcx>) -> Option<PolyTraitRef<'tcx>>
fn self_pred<'tcx>(&self, s: &Self::State<'tcx>) -> Option<PolyTraitRef<'tcx>>
Source§fn as_identity_assoc_ty<'tcx>(&self, s: &Self::State<'tcx>) -> Option<Ty<'tcx>>
fn as_identity_assoc_ty<'tcx>(&self, s: &Self::State<'tcx>) -> Option<Ty<'tcx>>
Source§fn typeck_parent<'tcx>(&self, s: &Self::State<'tcx>) -> Option<Self>
fn typeck_parent<'tcx>(&self, s: &Self::State<'tcx>) -> Option<Self>
Source§fn parent_of_assoc<'tcx>(&self, s: &Self::State<'tcx>) -> Option<Self>
fn parent_of_assoc<'tcx>(&self, s: &Self::State<'tcx>) -> Option<Self>
Source§fn parent_for_clauses<'tcx>(&self, s: &Self::State<'tcx>) -> Option<Self>
fn parent_for_clauses<'tcx>(&self, s: &Self::State<'tcx>) -> Option<Self>
Source§fn takes_explicit_self_clause<'tcx>(&self, s: &Self::State<'tcx>) -> bool
fn takes_explicit_self_clause<'tcx>(&self, s: &Self::State<'tcx>) -> bool
Self: Trait clause or whether it is allowed to refer
to the ambiant one. Only relevant for associated items.Source§fn find_in_impl<'tcx>(
&self,
s: &Self::State<'tcx>,
trait_impl: &Self,
) -> Option<Self>
fn find_in_impl<'tcx>( &self, s: &Self::State<'tcx>, trait_impl: &Self, ) -> Option<Self>
impl StructuralPartialEq for DefId
Auto Trait Implementations§
impl DynSend for DefId
impl DynSync for DefId
impl Freeze for DefId
impl RefUnwindSafe for DefId
impl Send for DefId
impl Sync for DefId
impl Unpin for DefId
impl UnsafeUnpin 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,
impl<T> Dedup for T
§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> HashConsable for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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