Struct rustc::middle::typeck::check::regionck::Rcx[src]

pub struct Rcx<'a> {
    // some fields omitted
}

Methods

impl<'a> Rcx<'a>

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

fn set_repeating_scope(&mut self, scope: NodeId) -> NodeId

fn resolve_type(&self, unresolved_ty: t) -> t

Try to resolve the type for the given node, returning t_err if an error results. Note that we never care about the details of the error, the same error will be detected and reported in the writeback phase.

Note one important point: we do not attempt to resolve region variables here. This is because regionck is essentially adding constraints to those region variables and so may yet influence how they are resolved.

Consider this silly example:

fn borrow(x: &int) -> &int {x}
fn foo(x: @int) -> int {  // block: B
    let b = borrow(x);    // region: <R0>
    *b
}

Here, the region of b will be <R0>. <R0> is constrainted to be some subregion of the block B and some superregion of the call. If we forced it now, we'd choose the smaller region (the call). But that would make the *b illegal. Since we don't resolve, the type of b will be &<R0>.int and then *b will require that <R0> be bigger than the let and the *b expression, so we will effectively resolve <R0> to be the block B.

fn resolve_expr_type_adjusted(&mut self, expr: &Expr) -> t

Try to resolve the type for the given node.

Trait Implementations

impl<'fcx> Typer for Rcx<'fcx>

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

fn node_ty(&self, id: NodeId) -> McResult<t>

fn node_method_ty(&self, method_call: MethodCall) -> Option<t>

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

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

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

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

impl<'a> Visitor<()> for Rcx<'a>

fn visit_item(&mut self, i: &Item, _: ())

fn visit_expr(&mut self, ex: &Expr, _: ())

fn visit_arm(&mut self, a: &Arm, _: ())

fn visit_local(&mut self, l: &Local, _: ())

fn visit_block(&mut self, b: &Block, _: ())

fn visit_ident<E: Clone>(&mut self, _sp: Span, _ident: Ident, _e: E)

fn visit_mod<E: Clone>(&mut self, m: &Mod, _s: Span, _n: u32, e: E)

fn visit_view_item<E: Clone>(&mut self, i: &ViewItem, e: E)

fn visit_foreign_item<E: Clone>(&mut self, i: &ForeignItem, e: E)

fn visit_stmt<E: Clone>(&mut self, s: &Spanned<Stmt_>, e: E)

fn visit_pat<E: Clone>(&mut self, p: &Pat, e: E)

fn visit_decl<E: Clone>(&mut self, d: &Spanned<Decl_>, e: E)

fn visit_expr_post<E: Clone>(&mut self, _ex: &Expr, _e: E)

fn visit_ty<E: Clone>(&mut self, t: &Ty, e: E)

fn visit_generics<E: Clone>(&mut self, g: &Generics, e: E)

fn visit_fn<E: Clone>(&mut self, fk: &FnKind, fd: &FnDecl, b: &Block, s: Span, u32, e: E)

fn visit_ty_method<E: Clone>(&mut self, t: &TypeMethod, e: E)

fn visit_trait_method<E: Clone>(&mut self, t: &TraitMethod, e: E)

fn visit_struct_def<E: Clone>(&mut self, s: &StructDef, Ident, &Generics, u32, e: E)

fn visit_struct_field<E: Clone>(&mut self, s: &Spanned<StructField_>, e: E)

fn visit_variant<E: Clone>(&mut self, v: &Spanned<Variant_>, g: &Generics, e: E)

fn visit_opt_lifetime_ref<E: Clone>(&mut self, _span: Span, opt_lifetime: &Option<Lifetime>, env: E)

fn visit_lifetime_ref<E: Clone>(&mut self, _lifetime: &Lifetime, _e: E)

fn visit_lifetime_decl<E: Clone>(&mut self, _lifetime: &Lifetime, _e: E)

fn visit_explicit_self<E: Clone>(&mut self, es: &Spanned<ExplicitSelf_>, e: E)

fn visit_mac<E: Clone>(&mut self, macro: &Spanned<Mac_>, e: E)

fn visit_path<E: Clone>(&mut self, path: &Path, _id: u32, e: E)

fn visit_attribute<E: Clone>(&mut self, _attr: &Spanned<Attribute_>, _e: E)