pub type AliasTerm<I> = Alias<I, AliasTermKind<I>>;Aliased Type§
pub struct AliasTerm<I> {
pub kind: AliasTermKind<I>,
pub args: <I as Interner>::GenericArgs,
pub(crate) _use_alias_new_instead: (),
}Fields§
§kind: AliasTermKind<I>§args: <I as Interner>::GenericArgsThe parameters of the associated, opaque, or constant alias.
For a projection, these are the generic parameters for the trait and the GAT parameters, if there are any.
For an inherent projection, they consist of the self type and the GAT parameters, if there are any.
For RPIT the generic parameters are for the generics of the function, while for TAIT it is used for the generic parameters of the alias.
_use_alias_new_instead: ()This field exists to prevent the creation of Alias without using the relevant constructor.
Implementations§
Source§impl<I: Interner> AliasTerm<I>
impl<I: Interner> AliasTerm<I>
pub fn new_from_args( interner: I, kind: AliasTermKind<I>, args: I::GenericArgs, ) -> AliasTerm<I>
pub fn new( interner: I, kind: AliasTermKind<I>, args: impl IntoIterator<Item: Into<I::GenericArg>>, ) -> AliasTerm<I>
pub fn new_from_def_id( interner: I, def_id: I::DefId, args: I::GenericArgs, ) -> AliasTerm<I>
pub fn expect_ty(self) -> AliasTy<I>
pub fn expect_ct(self) -> UnevaluatedConst<I>
pub fn to_term(self, interner: I) -> I::Term
pub fn with_args(self, interner: I, args: I::GenericArgs) -> Self
pub fn expect_projection_ty_def_id(self) -> I::TraitAssocTyId
pub fn expect_opaque_ty_def_id(self) -> I::OpaqueTyId
Source§impl<I: Interner> AliasTerm<I>
The following methods work only with (trait) associated term projections.
impl<I: Interner> AliasTerm<I>
The following methods work only with (trait) associated term projections.
pub fn self_ty(self) -> I::Ty
pub fn with_replaced_self_ty(self, interner: I, self_ty: I::Ty) -> Self
pub fn expect_projection_def_id(self) -> I::TraitAssocTermId
pub fn trait_def_id(self, interner: I) -> I::TraitId
Sourcepub fn trait_ref_and_own_args(
self,
interner: I,
) -> (TraitRef<I>, I::GenericArgsSlice)
pub fn trait_ref_and_own_args( self, interner: I, ) -> (TraitRef<I>, I::GenericArgsSlice)
Extracts the underlying trait reference and own args from this projection.
For example, if this is a projection of <T as StreamingIterator>::Item<'a>,
then this function would return a T: StreamingIterator trait reference and
['a] as the own args.
Sourcepub fn trait_ref(self, interner: I) -> TraitRef<I>
pub fn trait_ref(self, interner: I) -> TraitRef<I>
Extracts the underlying trait reference from this projection.
For example, if this is a projection of <T as Iterator>::Item,
then this function would return a T: Iterator trait reference.
WARNING: This will drop the args for generic associated types consider calling Self::trait_ref_and_own_args to get those as well.
Sourcepub fn own_args(self, interner: I) -> I::GenericArgsSlice
pub fn own_args(self, interner: I) -> I::GenericArgsSlice
Extract the own args from this projection.
For example, if this is a projection of <T as StreamingIterator>::Item<'a>,
then this function would return the slice ['a] as the own args.
Source§impl<I: Interner> AliasTerm<I>
The following methods work only with inherent associated term projections.
impl<I: Interner> AliasTerm<I>
The following methods work only with inherent associated term projections.
pub fn expect_inherent_def_id(self) -> I::InherentAssocTermId
Sourcepub fn rebase_inherent_args_onto_impl(
self,
impl_args: I::GenericArgs,
interner: I,
) -> I::GenericArgs
pub fn rebase_inherent_args_onto_impl( self, impl_args: I::GenericArgs, interner: I, ) -> I::GenericArgs
Transform the generic parameters to have the given impl args as the base and the GAT args on top of that.
Does the following transformation:
[Self, P_0...P_m] -> [I_0...I_n, P_0...P_m]
I_i impl args
P_j GAT argsSource§impl<I: Interner> AliasTerm<I>
The following methods work only with free term aliases.
impl<I: Interner> AliasTerm<I>
The following methods work only with free term aliases.
pub fn expect_free_def_id(self) -> I::FreeTermAliasId
Trait Implementations§
Layout§
Note: Encountered an error during type layout; the type failed to be normalized.