Struct rustc::middle::typeck::check::FnCtxtExperimental [-]  [+] [src]

pub struct FnCtxt<'a, 'tcx> {
    // some fields omitted
}

Methods

impl<'a, 'tcx> FnCtxt<'a, 'tcx>

fn infcx<'b>(&'b self) -> &'b InferCtxt<'a, 'tcx>

fn sess(&self) -> &Session

fn err_count_since_creation(&self) -> uint

impl<'a, 'tcx> FnCtxt<'a, 'tcx>

fn tag(&self) -> String

fn local_ty(&self, span: Span, nid: NodeId) -> Ty<'tcx>

fn default_diverging_type_variables_to_nil(&self)

fn write_ty(&self, node_id: NodeId, ty: Ty<'tcx>)

fn write_object_cast(&self, key: NodeId, trait_ref: Rc<TraitRef<'tcx>>)

fn write_substs(&self, node_id: NodeId, substs: ItemSubsts<'tcx>)

fn write_autoderef_adjustment(&self, node_id: NodeId, span: Span, derefs: uint)

fn write_adjustment(&self, node_id: NodeId, span: Span, adj: AutoAdjustment<'tcx>)

fn instantiate_type(&self, span: Span, def_id: DefId) -> TypeAndSubsts<'tcx>

Returns the type of def_id with all generics replaced by by fresh type/region variables. Also returns the substitution from the type parameters on def_id to the fresh variables. Registers any trait obligations specified on def_id at the same time.

Note that function is only intended to be used with types (notably, not impls). This is because it doesn't do any instantiation of late-bound regions.

fn write_nil(&self, node_id: NodeId)

fn write_error(&self, node_id: NodeId)

fn require_type_meets(&self, ty: Ty<'tcx>, span: Span, code: ObligationCauseCode<'tcx>, bound: BuiltinBound)

fn require_type_is_sized(&self, ty: Ty<'tcx>, span: Span, code: ObligationCauseCode<'tcx>)

fn require_expr_have_sized_type(&self, expr: &Expr, code: ObligationCauseCode<'tcx>)

fn register_obligation(&self, obligation: Obligation<'tcx>)

fn to_ty(&self, ast_t: &Ty) -> Ty<'tcx>

fn pat_to_string(&self, pat: &Pat) -> String

fn expr_ty(&self, ex: &Expr) -> Ty<'tcx>

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

Fetch type of expr after applying adjustments that have been recorded in the fcx.

fn adjust_expr_ty(&self, expr: &Expr, adjustment: Option<&AutoAdjustment<'tcx>>) -> Ty<'tcx>

Apply adjustment to the type of expr

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

fn item_substs<'a>(&'a self) -> Ref<'a, NodeMap<ItemSubsts<'tcx>>>

fn opt_node_ty_substs(&self, id: NodeId, f: |&ItemSubsts<'tcx>|)

fn mk_subty(&self, a_is_expected: bool, origin: TypeOrigin, sub: Ty<'tcx>, sup: Ty<'tcx>) -> Result<(), type_err<'tcx>>

fn can_mk_subty(&self, sub: Ty<'tcx>, sup: Ty<'tcx>) -> Result<(), type_err<'tcx>>

fn can_mk_eqty(&self, sub: Ty<'tcx>, sup: Ty<'tcx>) -> Result<(), type_err<'tcx>>

fn mk_assignty(&self, expr: &Expr, sub: Ty<'tcx>, sup: Ty<'tcx>) -> Result<(), type_err<'tcx>>

fn mk_eqty(&self, a_is_expected: bool, origin: TypeOrigin, sub: Ty<'tcx>, sup: Ty<'tcx>) -> Result<(), type_err<'tcx>>

fn mk_subr(&self, origin: SubregionOrigin<'tcx>, sub: Region, sup: Region)

fn type_error_message(&self, sp: Span, mk_msg: |String| -> String, actual_ty: Ty<'tcx>, err: Option<&type_err<'tcx>>)

fn report_mismatched_types(&self, sp: Span, e: Ty<'tcx>, a: Ty<'tcx>, err: &type_err<'tcx>)

fn register_region_obligation(&self, origin: SubregionOrigin<'tcx>, ty: Ty<'tcx>, r: Region)

Registers an obligation for checking later, during regionck, that the type ty must outlive the region r.

fn add_default_region_param_bounds(&self, substs: &Substs<'tcx>, expr: &Expr)

fn add_obligations_for_parameters(&self, cause: ObligationCause<'tcx>, substs: &Substs<'tcx>, generic_bounds: &GenericBounds<'tcx>)

Given a fully substituted set of bounds (generic_bounds), and the values with which each type/region parameter was instantiated (substs), creates and registers suitable trait/region obligations.

For example, if there is a function:

fn foo<'a,T:'a>(...)

and a reference:

let f = foo;

Then we will create a fresh region variable '$0 and a fresh type variable $1 for 'a and T. This routine will add a region obligation $1:'$0 and register it locally.

Trait Implementations

impl<'a, 'tcx> Typer<'tcx> for FnCtxt<'a, 'tcx>

fn tcx<'a>(&'a self) -> &'a ctxt<'tcx>

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

fn node_method_ty(&self, method_call: MethodCall) -> Option<Ty<'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_borrow(&self, upvar_id: UpvarId) -> UpvarBorrow

fn capture_mode(&self, closure_expr_id: NodeId) -> CaptureClause

fn unboxed_closures<'a>(&'a self) -> &'a RefCell<DefIdMap<UnboxedClosure<'tcx>>>

impl<'a, 'tcx> AstConv<'tcx> for FnCtxt<'a, 'tcx>

fn tcx<'a>(&'a self) -> &'a ctxt<'tcx>

fn get_item_ty(&self, id: DefId) -> Polytype<'tcx>

fn get_trait_def(&self, id: DefId) -> Rc<TraitDef<'tcx>>

fn ty_infer(&self, _span: Span) -> Ty<'tcx>

fn associated_types_of_trait_are_valid(&self, _: Ty, _: DefId) -> bool

fn associated_type_binding(&self, span: Span, _: Option<Ty<'tcx>>, _: DefId, _: DefId) -> Ty<'tcx>

Derived Implementations

impl<'a, 'tcx> Clone for FnCtxt<'a, 'tcx>

fn clone(&self) -> FnCtxt<'a, 'tcx>

fn clone_from(&mut self, source: &Self)