[−][src]Struct rustc_mir_build::thir::cx::Cx

pub(crate) struct Cx<'a, 'tcx> {
    tcx: TyCtxt<'tcx>,
    infcx: &'a InferCtxt<'a, 'tcx>,
    pub(crate) root_lint_level: HirId,
    pub(crate) param_env: ParamEnv<'tcx>,
    pub(crate) identity_substs: &'tcx InternalSubsts<'tcx>,
    pub(crate) region_scope_tree: &'tcx ScopeTree,
    pub(crate) typeck_results: &'a TypeckResults<'tcx>,
    constness: Constness,
    body_owner: DefId,
    pub(crate) body_owner_kind: BodyOwnerKind,
    check_overflow: bool,
}

Fields

tcx: TyCtxt<'tcx>infcx: &'a InferCtxt<'a, 'tcx>root_lint_level: HirIdparam_env: ParamEnv<'tcx>identity_substs: &'tcx InternalSubsts<'tcx>

Identity InternalSubsts for use with const-evaluation.

region_scope_tree: &'tcx ScopeTreetypeck_results: &'a TypeckResults<'tcx>constness: Constness

This is Constness::Const if we are compiling a static, const, or the body of a const fn.

body_owner: DefId

The DefId of the owner of this body.

body_owner_kind: BodyOwnerKind

What kind of body is being compiled.

check_overflow: bool

Whether this constant/function needs overflow checks.

Implementations

impl<'a, 'tcx> Cx<'a, 'tcx>[src]

pub(crate) fn new(
    infcx: &'a InferCtxt<'a, 'tcx>,
    def: WithOptConstParam<LocalDefId>,
    src_id: HirId
) -> Cx<'a, 'tcx>
[src]

impl<'a, 'tcx> Cx<'a, 'tcx>[src]

pub(crate) fn mirror<M: Mirror<'tcx>>(&mut self, ast: M) -> M::Output[src]

Normalizes ast into the appropriate "mirror" type.

pub(crate) fn usize_ty(&mut self) -> Ty<'tcx>[src]

pub(crate) fn usize_literal(&mut self, value: u64) -> &'tcx Const<'tcx>[src]

pub(crate) fn bool_ty(&mut self) -> Ty<'tcx>[src]

pub(crate) fn unit_ty(&mut self) -> Ty<'tcx>[src]

pub(crate) fn true_literal(&mut self) -> &'tcx Const<'tcx>[src]

pub(crate) fn false_literal(&mut self) -> &'tcx Const<'tcx>[src]

pub(crate) fn const_eval_literal(
    &mut self,
    lit: &'tcx LitKind,
    ty: Ty<'tcx>,
    sp: Span,
    neg: bool
) -> &'tcx Const<'tcx>
[src]

pub(crate) fn pattern_from_hir(&mut self, p: &Pat<'_>) -> Pat<'tcx>[src]

pub(crate) fn trait_method(
    &mut self,
    trait_def_id: DefId,
    method_name: Symbol,
    self_ty: Ty<'tcx>,
    params: &[GenericArg<'tcx>]
) -> &'tcx Const<'tcx>
[src]

pub(crate) fn all_fields(
    &mut self,
    adt_def: &AdtDef,
    variant_index: VariantIdx
) -> Vec<Field>
[src]

pub(crate) fn needs_drop(&mut self, ty: Ty<'tcx>) -> bool[src]

pub(crate) fn infcx(&self) -> &'a InferCtxt<'a, 'tcx>[src]

pub(crate) fn tcx(&self) -> TyCtxt<'tcx>[src]

pub(crate) fn typeck_results(&self) -> &'a TypeckResults<'tcx>[src]

pub(crate) fn check_overflow(&self) -> bool[src]

pub(crate) fn type_is_copy_modulo_regions(
    &self,
    ty: Ty<'tcx>,
    span: Span
) -> bool
[src]

Trait Implementations

impl<'a, 'tcx> Clone for Cx<'a, 'tcx>[src]

impl<'tcx, '_> UserAnnotatedTyHelpers<'tcx> for Cx<'_, 'tcx>[src]

Auto Trait Implementations

impl<'a, 'tcx> !RefUnwindSafe for Cx<'a, 'tcx>

impl<'a, 'tcx> !Send for Cx<'a, 'tcx>

impl<'a, 'tcx> !Sync for Cx<'a, 'tcx>

impl<'a, 'tcx> Unpin for Cx<'a, 'tcx> where
    'tcx: 'a, 

impl<'a, 'tcx> !UnwindSafe for Cx<'a, 'tcx>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized, 
[src]

impl<T> Borrow<T> for T where
    T: ?Sized, 
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized, 
[src]

impl<'a, T> Captures<'a> for T where
    T: ?Sized, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone, 
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.