rustc_type_ir::inherent

Trait Ty

Source
pub trait Ty<I: Interner<Ty = Self>>:
    Copy
    + Debug
    + Hash
    + Eq
    + Into<I::GenericArg>
    + Into<I::Term>
    + IntoKind<Kind = TyKind<I>>
    + TypeSuperVisitable<I>
    + TypeSuperFoldable<I>
    + Relate<I>
    + Flags {
Show 44 methods // Required methods fn new_unit(interner: I) -> Self; fn new_bool(interner: I) -> Self; fn new_u8(interner: I) -> Self; fn new_usize(interner: I) -> Self; fn new_infer(interner: I, var: InferTy) -> Self; fn new_var(interner: I, var: TyVid) -> Self; fn new_param(interner: I, param: I::ParamTy) -> Self; fn new_placeholder(interner: I, param: I::PlaceholderTy) -> Self; fn new_bound(interner: I, debruijn: DebruijnIndex, var: I::BoundTy) -> Self; fn new_anon_bound( interner: I, debruijn: DebruijnIndex, var: BoundVar, ) -> Self; fn new_alias(interner: I, kind: AliasTyKind, alias_ty: AliasTy<I>) -> Self; fn new_error(interner: I, guar: I::ErrorGuaranteed) -> Self; fn new_adt(interner: I, adt_def: I::AdtDef, args: I::GenericArgs) -> Self; fn new_foreign(interner: I, def_id: I::DefId) -> Self; fn new_dynamic( interner: I, preds: I::BoundExistentialPredicates, region: I::Region, kind: DynKind, ) -> Self; fn new_coroutine( interner: I, def_id: I::DefId, args: I::GenericArgs, ) -> Self; fn new_coroutine_closure( interner: I, def_id: I::DefId, args: I::GenericArgs, ) -> Self; fn new_closure(interner: I, def_id: I::DefId, args: I::GenericArgs) -> Self; fn new_coroutine_witness( interner: I, def_id: I::DefId, args: I::GenericArgs, ) -> Self; fn new_ptr(interner: I, ty: Self, mutbl: Mutability) -> Self; fn new_ref( interner: I, region: I::Region, ty: Self, mutbl: Mutability, ) -> Self; fn new_array_with_const_len(interner: I, ty: Self, len: I::Const) -> Self; fn new_slice(interner: I, ty: Self) -> Self; fn new_tup(interner: I, tys: &[I::Ty]) -> Self; fn new_tup_from_iter<It, T>(interner: I, iter: It) -> T::Output where It: Iterator<Item = T>, T: CollectAndApply<Self, Self>; fn new_fn_def(interner: I, def_id: I::DefId, args: I::GenericArgs) -> Self; fn new_fn_ptr(interner: I, sig: Binder<I, FnSig<I>>) -> Self; fn new_pat(interner: I, ty: Self, pat: I::Pat) -> Self; fn new_unsafe_binder(interner: I, ty: Binder<I, I::Ty>) -> Self; fn tuple_fields(self) -> I::Tys; fn to_opt_closure_kind(self) -> Option<ClosureKind>; fn from_closure_kind(interner: I, kind: ClosureKind) -> Self; fn from_coroutine_closure_kind(interner: I, kind: ClosureKind) -> Self; fn has_unsafe_fields(self) -> bool; fn discriminant_ty(self, interner: I) -> I::Ty; fn async_destructor_ty(self, interner: I) -> I::Ty; // Provided methods fn new_projection_from_args( interner: I, def_id: I::DefId, args: I::GenericArgs, ) -> Self { ... } fn new_projection( interner: I, def_id: I::DefId, args: impl IntoIterator<Item: Into<I::GenericArg>>, ) -> Self { ... } fn is_ty_var(self) -> bool { ... } fn is_floating_point(self) -> bool { ... } fn is_integral(self) -> bool { ... } fn is_fn_ptr(self) -> bool { ... } fn fn_sig(self, interner: I) -> Binder<I, FnSig<I>> { ... } fn is_known_rigid(self) -> bool { ... }
}

Required Methods§

Source

fn new_unit(interner: I) -> Self

Source

fn new_bool(interner: I) -> Self

Source

fn new_u8(interner: I) -> Self

Source

fn new_usize(interner: I) -> Self

Source

fn new_infer(interner: I, var: InferTy) -> Self

Source

fn new_var(interner: I, var: TyVid) -> Self

Source

fn new_param(interner: I, param: I::ParamTy) -> Self

Source

fn new_placeholder(interner: I, param: I::PlaceholderTy) -> Self

Source

fn new_bound(interner: I, debruijn: DebruijnIndex, var: I::BoundTy) -> Self

Source

fn new_anon_bound(interner: I, debruijn: DebruijnIndex, var: BoundVar) -> Self

Source

fn new_alias(interner: I, kind: AliasTyKind, alias_ty: AliasTy<I>) -> Self

Source

fn new_error(interner: I, guar: I::ErrorGuaranteed) -> Self

Source

fn new_adt(interner: I, adt_def: I::AdtDef, args: I::GenericArgs) -> Self

Source

fn new_foreign(interner: I, def_id: I::DefId) -> Self

Source

fn new_dynamic( interner: I, preds: I::BoundExistentialPredicates, region: I::Region, kind: DynKind, ) -> Self

Source

fn new_coroutine(interner: I, def_id: I::DefId, args: I::GenericArgs) -> Self

Source

fn new_coroutine_closure( interner: I, def_id: I::DefId, args: I::GenericArgs, ) -> Self

Source

fn new_closure(interner: I, def_id: I::DefId, args: I::GenericArgs) -> Self

Source

fn new_coroutine_witness( interner: I, def_id: I::DefId, args: I::GenericArgs, ) -> Self

Source

fn new_ptr(interner: I, ty: Self, mutbl: Mutability) -> Self

Source

fn new_ref(interner: I, region: I::Region, ty: Self, mutbl: Mutability) -> Self

Source

fn new_array_with_const_len(interner: I, ty: Self, len: I::Const) -> Self

Source

fn new_slice(interner: I, ty: Self) -> Self

Source

fn new_tup(interner: I, tys: &[I::Ty]) -> Self

Source

fn new_tup_from_iter<It, T>(interner: I, iter: It) -> T::Output
where It: Iterator<Item = T>, T: CollectAndApply<Self, Self>,

Source

fn new_fn_def(interner: I, def_id: I::DefId, args: I::GenericArgs) -> Self

Source

fn new_fn_ptr(interner: I, sig: Binder<I, FnSig<I>>) -> Self

Source

fn new_pat(interner: I, ty: Self, pat: I::Pat) -> Self

Source

fn new_unsafe_binder(interner: I, ty: Binder<I, I::Ty>) -> Self

Source

fn tuple_fields(self) -> I::Tys

Source

fn to_opt_closure_kind(self) -> Option<ClosureKind>

Source

fn from_closure_kind(interner: I, kind: ClosureKind) -> Self

Source

fn from_coroutine_closure_kind(interner: I, kind: ClosureKind) -> Self

Source

fn has_unsafe_fields(self) -> bool

Checks whether this type is an ADT that has unsafe fields.

Source

fn discriminant_ty(self, interner: I) -> I::Ty

Source

fn async_destructor_ty(self, interner: I) -> I::Ty

Provided Methods§

Source

fn new_projection_from_args( interner: I, def_id: I::DefId, args: I::GenericArgs, ) -> Self

Source

fn new_projection( interner: I, def_id: I::DefId, args: impl IntoIterator<Item: Into<I::GenericArg>>, ) -> Self

Source

fn is_ty_var(self) -> bool

Source

fn is_floating_point(self) -> bool

Source

fn is_integral(self) -> bool

Source

fn is_fn_ptr(self) -> bool

Source

fn fn_sig(self, interner: I) -> Binder<I, FnSig<I>>

Source

fn is_known_rigid(self) -> bool

Returns true when the outermost type cannot be further normalized, resolved, or instantiated. This includes all primitive types, but also things like ADTs and trait objects, since even if their arguments or nested types may be further simplified, the outermost ty::TyKind or type constructor remains the same.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§