Trait rustc::middle::mem_categorization::Typer [−] [src]

pub trait Typer<'tcx>: ClosureTyper<'tcx> {
    fn node_ty(&self, id: NodeId) -> McResult<Ty<'tcx>>;
    fn expr_ty_adjusted(&self, expr: &Expr) -> McResult<Ty<'tcx>>;
    fn type_moves_by_default(&self, span: Span, ty: Ty<'tcx>) -> bool;
    fn node_method_ty(&self, method_call: MethodCall) -> Option<Ty<'tcx>>;
    fn node_method_origin(&self, method_call: MethodCall) -> Option<MethodOrigin<'tcx>>;
    fn adjustments<'a>(&'a self) -> &'a RefCell<NodeMap<AutoAdjustment<'tcx>>>;
    fn is_method_call(&self, id: NodeId) -> bool;
    fn temporary_scope(&self, rvalue_id: NodeId) -> Option<CodeExtent>;
    fn upvar_capture(&self, upvar_id: UpvarId) -> Option<UpvarCapture>;
}
Unstable

The Typer trait provides the interface for the mem-categorization module to the results of the type check. It can be used to query the type assigned to an expression node, to inquire after adjustments, and so on.

This interface is needed because mem-categorization is used from two places: regionck and borrowck. regionck executes before type inference is complete, and hence derives types and so on from intermediate tables. This also implies that type errors can occur, and hence node_ty() and friends return a Result type -- any error will propagate back up through the mem-categorization routines.

In the borrow checker, in contrast, type checking is complete and we know that no errors have occurred, so we simply consult the tcx and we can be sure that only Ok results will occur.

Required Methods

fn node_ty(&self, id: NodeId) -> McResult<Ty<'tcx>>

Unstable

fn expr_ty_adjusted(&self, expr: &Expr) -> McResult<Ty<'tcx>>

Unstable

fn type_moves_by_default(&self, span: Span, ty: Ty<'tcx>) -> bool

Unstable

fn node_method_ty(&self, method_call: MethodCall) -> Option<Ty<'tcx>>

Unstable

fn node_method_origin(&self, method_call: MethodCall) -> Option<MethodOrigin<'tcx>>

Unstable

fn adjustments<'a>(&'a self) -> &'a RefCell<NodeMap<AutoAdjustment<'tcx>>>

Unstable

fn is_method_call(&self, id: NodeId) -> bool

Unstable

fn temporary_scope(&self, rvalue_id: NodeId) -> Option<CodeExtent>

Unstable

fn upvar_capture(&self, upvar_id: UpvarId) -> Option<UpvarCapture>

Unstable

Implementors