Skip to main content

AliasTy

Type Alias AliasTy 

Source
pub type AliasTy<I> = Alias<I, AliasTyKind<I>>;

Aliased Type§

pub struct AliasTy<I> {
    pub kind: AliasTyKind<I>,
    pub args: <I as Interner>::GenericArgs,
    pub(crate) _use_alias_new_instead: (),
}

Fields§

§kind: AliasTyKind<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> AliasTy<I>

Source

pub fn new_from_args( interner: I, kind: AliasTyKind<I>, args: I::GenericArgs, ) -> AliasTy<I>

Source

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

Source

pub fn is_opaque(self) -> bool

Whether this alias type is an opaque.

Source

pub fn to_ty(self, interner: I) -> I::Ty

Source§

impl<I: Interner> AliasTy<I>

The following methods work only with (trait) associated type 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 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.

Trait Implementations§

Source§

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

Source§

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

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

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

Source§

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

Layout§

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