Struct rustc::ty::TyS
[−]
[src]
pub struct TyS<'tcx> { pub sty: TypeVariants<'tcx>, pub flags: Cell<TypeFlags>, // some fields omitted }
rustc_private
)Fields
sty: TypeVariants<'tcx>
rustc_private
)flags: Cell<TypeFlags>
rustc_private
)Methods
impl<'a, 'gcx, 'tcx> TyS<'tcx>
[src]
fn adjust_for_autoderef<F>(&'tcx self,
tcx: TyCtxt<'a, 'gcx, 'tcx>,
expr_id: NodeId,
expr_span: Span,
autoderef: u32,
method_type: F)
-> Ty<'tcx> where F: FnMut(MethodCall) -> Option<Ty<'tcx>>
tcx: TyCtxt<'a, 'gcx, 'tcx>,
expr_id: NodeId,
expr_span: Span,
autoderef: u32,
method_type: F)
-> Ty<'tcx> where F: FnMut(MethodCall) -> Option<Ty<'tcx>>
rustc_private
)fn adjust_for_autoref(&'tcx self,
tcx: TyCtxt<'a, 'gcx, 'tcx>,
autoref: Option<AutoBorrow<'tcx>>)
-> Ty<'tcx>
tcx: TyCtxt<'a, 'gcx, 'tcx>,
autoref: Option<AutoBorrow<'tcx>>)
-> Ty<'tcx>
rustc_private
)impl<'a, 'gcx, 'lcx, 'tcx> TyS<'tcx>
[src]
fn sort_string(&self, tcx: TyCtxt<'a, 'gcx, 'lcx>) -> String
rustc_private
)impl<'a, 'gcx, 'tcx> TyS<'tcx>
[src]
fn uninhabited_from(&self,
visited: &mut FxHashMap<DefId, FxHashSet<&'tcx Substs<'tcx>>>,
tcx: TyCtxt<'a, 'gcx, 'tcx>)
-> DefIdForest
visited: &mut FxHashMap<DefId, FxHashSet<&'tcx Substs<'tcx>>>,
tcx: TyCtxt<'a, 'gcx, 'tcx>)
-> DefIdForest
rustc_private
)Calculate the forest of DefIds from which this type is visibly uninhabited.
impl<'a, 'tcx> TyS<'tcx>
[src]
fn moves_by_default(&'tcx self,
tcx: TyCtxt<'a, 'tcx, 'tcx>,
param_env: &ParameterEnvironment<'tcx>,
span: Span)
-> bool
tcx: TyCtxt<'a, 'tcx, 'tcx>,
param_env: &ParameterEnvironment<'tcx>,
span: Span)
-> bool
rustc_private
)fn is_sized(&'tcx self,
tcx: TyCtxt<'a, 'tcx, 'tcx>,
param_env: &ParameterEnvironment<'tcx>,
span: Span)
-> bool
tcx: TyCtxt<'a, 'tcx, 'tcx>,
param_env: &ParameterEnvironment<'tcx>,
span: Span)
-> bool
rustc_private
)fn layout<'lcx>(&'tcx self,
infcx: &InferCtxt<'a, 'tcx, 'lcx>)
-> Result<&'tcx Layout, LayoutError<'tcx>>
infcx: &InferCtxt<'a, 'tcx, 'lcx>)
-> Result<&'tcx Layout, LayoutError<'tcx>>
rustc_private
)fn is_representable(&'tcx self,
tcx: TyCtxt<'a, 'tcx, 'tcx>,
sp: Span)
-> Representability
tcx: TyCtxt<'a, 'tcx, 'tcx>,
sp: Span)
-> Representability
rustc_private
)Check whether a type is representable. This means it cannot contain unboxed structural recursion. This check is needed for structs and enums.
impl<'a, 'tcx> TyS<'tcx>
[src]
fn type_contents(&'tcx self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> TypeContents
rustc_private
)impl<'a, 'gcx, 'tcx> TyS<'tcx>
[src]
fn as_opt_param_ty(&self) -> Option<ParamTy>
rustc_private
)fn is_nil(&self) -> bool
rustc_private
)fn is_never(&self) -> bool
rustc_private
)fn is_defaulted_unit(&self) -> bool
rustc_private
)fn is_uninhabited_from(&self,
module: DefId,
tcx: TyCtxt<'a, 'gcx, 'tcx>)
-> bool
module: DefId,
tcx: TyCtxt<'a, 'gcx, 'tcx>)
-> bool
rustc_private
)Checks whether a type is visibly uninhabited from a particular module.
Example
enum Void {} mod a { pub mod b { pub struct SecretlyUninhabited { _priv: !, } } } mod c { pub struct AlsoSecretlyUninhabited { _priv: Void, } mod d { } } struct Foo { x: a::b::SecretlyUninhabited, y: c::AlsoSecretlyUninhabited, }
In this code, the type Foo
will only be visibly uninhabited inside the
modules b, c and d. This effects pattern-matching on Foo
or types that
contain Foo
.
Example
let foo_result: Result<T, Foo> = ... ; let Ok(t) = foo_result;
This code should only compile in modules where the uninhabitedness of Foo is visible.
fn is_primitive(&self) -> bool
rustc_private
)fn is_ty_var(&self) -> bool
rustc_private
)fn is_phantom_data(&self) -> bool
rustc_private
)fn is_bool(&self) -> bool
rustc_private
)fn is_param(&self, index: u32) -> bool
rustc_private
)fn is_self(&self) -> bool
rustc_private
)fn is_slice(&self) -> bool
rustc_private
)fn is_structural(&self) -> bool
rustc_private
)fn is_simd(&self) -> bool
rustc_private
)fn sequence_element_type(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Ty<'tcx>
rustc_private
)fn simd_type(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Ty<'tcx>
rustc_private
)fn simd_size(&self, _cx: TyCtxt) -> usize
rustc_private
)fn is_region_ptr(&self) -> bool
rustc_private
)fn is_mutable_pointer(&self) -> bool
rustc_private
)fn is_unsafe_ptr(&self) -> bool
rustc_private
)fn is_box(&self) -> bool
rustc_private
)fn boxed_ty(&self) -> Ty<'tcx>
rustc_private
)fn is_scalar(&self) -> bool
rustc_private
)fn is_floating_point(&self) -> bool
rustc_private
)Returns true if this type is a floating point type and false otherwise.
fn is_trait(&self) -> bool
rustc_private
)fn is_integral(&self) -> bool
rustc_private
)fn is_fresh(&self) -> bool
rustc_private
)fn is_uint(&self) -> bool
rustc_private
)fn is_char(&self) -> bool
rustc_private
)fn is_fp(&self) -> bool
rustc_private
)fn is_numeric(&self) -> bool
rustc_private
)fn is_signed(&self) -> bool
rustc_private
)fn is_machine(&self) -> bool
rustc_private
)fn has_concrete_skeleton(&self) -> bool
rustc_private
)fn builtin_deref(&self,
explicit: bool,
pref: LvaluePreference)
-> Option<TypeAndMut<'tcx>>
explicit: bool,
pref: LvaluePreference)
-> Option<TypeAndMut<'tcx>>
rustc_private
)fn builtin_index(&self) -> Option<Ty<'tcx>>
rustc_private
)fn fn_sig(&self) -> PolyFnSig<'tcx>
rustc_private
)fn fn_args(&self) -> Binder<&'tcx [Ty<'tcx>]>
rustc_private
)fn fn_ret(&self) -> Binder<Ty<'tcx>>
rustc_private
)fn is_fn(&self) -> bool
rustc_private
)fn ty_to_def_id(&self) -> Option<DefId>
rustc_private
)fn ty_adt_def(&self) -> Option<&'tcx AdtDef>
rustc_private
)fn regions(&self) -> Vec<&'tcx Region>
rustc_private
)Returns the regions directly referenced from this type (but
not types reachable from this type via walk_tys
). This
ignores late-bound regions binders.
impl<'tcx> TyS<'tcx>
[src]
fn walk(&'tcx self) -> TypeWalker<'tcx>
rustc_private
)Iterator that walks self
and any types reachable from
self
, in depth-first order. Note that just walks the types
that appear in self
, it does not descend into the fields of
structs or variants. For example:
isize => { isize }
Foo<Bar<isize>> => { Foo<Bar<isize>>, Bar<isize>, isize }
[isize] => { [isize], isize }
fn walk_shallow(&'tcx self) -> AccIntoIter<TypeWalkerArray<'tcx>>
rustc_private
)Iterator that walks the immediate children of self
. Hence
Foo<Bar<i32>, u32>
yields the sequence [Bar<i32>, u32]
(but not i32
, like walk
).
fn maybe_walk<F>(&'tcx self, f: F) where F: FnMut(Ty<'tcx>) -> bool
rustc_private
)Walks ty
and any types appearing within ty
, invoking the
callback f
on each type. If the callback returns false, then the
children of the current type are ignored.
Note: prefer ty.walk()
where possible.
Trait Implementations
impl<'tcx> PartialEq for TyS<'tcx>
[src]
fn eq(&self, other: &TyS<'tcx>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0
This method tests for !=
.
impl<'tcx> Eq for TyS<'tcx>
[src]
impl<'tcx> Hash for TyS<'tcx>
[src]
fn hash<H: Hasher>(&self, s: &mut H)
Feeds this value into the state given, updating the hasher as necessary.
fn hash_slice<H>(data: &[Self], state: &mut H) where H: Hasher
1.3.0
Feeds a slice of this type into the state provided.