Skip to main content

AliasTerm

Type Alias AliasTerm 

Source
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>::GenericArgs

The 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>

Source

pub fn new_from_args( interner: I, kind: AliasTermKind<I>, args: I::GenericArgs, ) -> AliasTerm<I>

Source

pub fn new( interner: I, kind: AliasTermKind<I>, args: impl IntoIterator<Item: Into<I::GenericArg>>, ) -> AliasTerm<I>

Source

pub fn new_from_def_id( interner: I, def_id: I::DefId, args: I::GenericArgs, ) -> AliasTerm<I>

Source

pub fn expect_ty(self) -> AliasTy<I>

Source

pub fn expect_ct(self) -> UnevaluatedConst<I>

Source

pub fn to_term(self, interner: I) -> I::Term

Source

pub fn with_args(self, interner: I, args: I::GenericArgs) -> Self

Source

pub fn expect_projection_ty_def_id(self) -> I::TraitAssocTyId

Source

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.

Source

pub fn self_ty(self) -> I::Ty

Source

pub fn with_replaced_self_ty(self, interner: I, self_ty: I::Ty) -> Self

Source

pub fn expect_projection_def_id(self) -> I::TraitAssocTermId

Source

pub fn trait_def_id(self, interner: I) -> I::TraitId

Source

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.

Source

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.

Source

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.

Source

pub fn expect_inherent_def_id(self) -> I::InherentAssocTermId

Source

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 args
Source§

impl<I: Interner> AliasTerm<I>

The following methods work only with free term aliases.

Trait Implementations§

Source§

impl<I: Interner> Display for AliasTerm<I>

Source§

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

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

impl<I: Interner> From<Alias<I, AliasTyKind<I>>> for AliasTerm<I>

Source§

fn from(ty: AliasTy<I>) -> Self

Converts to this type from the input type.
Source§

impl<I: Interner> From<Alias<I, UnevaluatedConstKind<I>>> for AliasTerm<I>

Source§

fn from(ty: UnevaluatedConst<I>) -> Self

Converts to this type from the input type.
Source§

impl<I: Interner> Relate<I> for AliasTerm<I>

Source§

fn relate<R: TypeRelation<I>>( relation: &mut R, a: AliasTerm<I>, b: AliasTerm<I>, ) -> RelateResult<I, AliasTerm<I>>

Layout§

Note: Encountered an error during type layout; the type failed to be normalized.