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

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

Methods

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

fn infcx(&'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: u32) -> &'tcx TyS<'tcx>

fn default_diverging_type_variables_to_nil(&self)

fn write_ty(&self, node_id: u32, ty: &'tcx TyS<'tcx>)

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

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

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

fn write_adjustment(&self, node_id: u32, 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: u32)

fn write_error(&self, node_id: u32)

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

fn require_type_is_sized(&self, ty: &'tcx TyS<'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) -> &'tcx TyS<'tcx>

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

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

fn expr_ty_adjusted(&self, expr: &Expr) -> &'tcx TyS<'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>>) -> &'tcx TyS<'tcx>

Apply adjustment to the type of expr

fn node_ty(&self, id: u32) -> &'tcx TyS<'tcx>

fn item_substs(&'a self) -> Ref<'a, HashMap<u32, ItemSubsts<'tcx>, FnvHasher>>

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

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

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

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

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

fn mk_eqty(&self, a_is_expected: bool, origin: TypeOrigin, sub: &'tcx TyS<'tcx>, sup: &'tcx TyS<'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: &'tcx TyS<'tcx>, err: Option<&type_err<'tcx>>)

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

fn register_region_obligation(&self, origin: SubregionOrigin<'tcx>, ty: &'tcx TyS<'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 self) -> &'a ctxt<'tcx>

fn node_ty(&self, id: u32) -> Result<&'tcx TyS<'tcx>, ()>

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

fn adjustments(&'a self) -> &'a RefCell<HashMap<u32, AutoAdjustment<'tcx>, FnvHasher>>

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

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

fn upvar_borrow(&self, upvar_id: UpvarId) -> UpvarBorrow

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

fn unboxed_closures(&'a self) -> &'a RefCell<HashMap<DefId, UnboxedClosure<'tcx>, FnvHasher>>

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

fn tcx(&'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) -> &'tcx TyS<'tcx>

fn associated_types_of_trait_are_valid(&self, &TyS, DefId) -> bool

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

Derived Implementations

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

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

fn clone_from(&mut self, &FnCtxt<'a, 'tcx>)