FnFnBlock -> FkClosure

This commit is contained in:
Manish Goregaokar 2015-08-16 18:23:58 +05:30
parent 27db6e1e51
commit c03bf18b84
10 changed files with 14 additions and 14 deletions

View File

@ -191,7 +191,7 @@ impl<'a> FnLikeNode<'a> {
visit::FkItemFn(p.ident, p.generics, p.unsafety, p.constness, p.abi, p.vis)
};
let closure = |_: ClosureParts| {
visit::FkFnBlock
visit::FkClosure
};
let method = |_, ident, sig: &'a ast::MethodSig, vis, _, _| {
visit::FkMethod(ident, sig, vis)

View File

@ -1006,7 +1006,7 @@ fn check_fn(cx: &mut MatchCheckCtxt,
sp: Span,
fn_id: NodeId) {
match kind {
visit::FkFnBlock => {}
visit::FkClosure => {}
_ => cx.param_env = ParameterEnvironment::for_item(cx.tcx, fn_id),
}

View File

@ -241,7 +241,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for IntrinsicCheckingVisitor<'a, 'tcx> {
visit::walk_fn(self, fk, fd, b, s);
self.param_envs.pop();
}
visit::FkFnBlock(..) => {
visit::FkClosure(..) => {
visit::walk_fn(self, fk, fd, b, s);
}
}

View File

@ -186,7 +186,7 @@ impl<'a, 'v> Visitor<'v> for LifetimeContext<'a> {
this.walk_fn(fk, fd, b, s)
})
}
visit::FkFnBlock(..) => {
visit::FkClosure(..) => {
self.walk_fn(fk, fd, b, s)
}
}
@ -484,7 +484,7 @@ impl<'a> LifetimeContext<'a> {
self.visit_generics(&sig.generics);
self.visit_explicit_self(&sig.explicit_self);
}
visit::FkFnBlock(..) => {
visit::FkClosure(..) => {
visit::walk_fn_decl(self, fd);
}
}

View File

@ -67,7 +67,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for BorrowckCtxt<'a, 'tcx> {
self.free_region_map = old_free_region_map;
}
visit::FkFnBlock => {
visit::FkClosure => {
borrowck_fn(self, fk, fd, b, s, id);
}
}

View File

@ -2133,7 +2133,7 @@ impl LintPass for UnconditionalRecursion {
cx.tcx.impl_or_trait_item(local_def(id)).as_opt_method()
}
// closures can't recur, so they don't matter.
visit::FkFnBlock => return
visit::FkClosure => return
};
// Walk through this function (say `f`) looking to see if

View File

@ -524,7 +524,7 @@ impl<'a, 'v, 'tcx> Visitor<'v> for Resolver<'a, 'tcx> {
self.visit_explicit_self(&sig.explicit_self);
MethodRibKind
}
visit::FkFnBlock(..) => ClosureRibKind(node_id)
visit::FkClosure(..) => ClosureRibKind(node_id)
};
self.resolve_function(rib_kind, declaration, block);
}

View File

@ -428,7 +428,7 @@ impl<'ccx, 'tcx, 'v> Visitor<'v> for CheckTypeWellFormedVisitor<'ccx, 'tcx> {
fk: visit::FnKind<'v>, fd: &'v ast::FnDecl,
b: &'v ast::Block, span: Span, id: ast::NodeId) {
match fk {
visit::FkFnBlock | visit::FkItemFn(..) => {}
visit::FkClosure | visit::FkItemFn(..) => {}
visit::FkMethod(..) => {
match self.tcx().impl_or_trait_item(local_def(id)) {
ty::ImplOrTraitItem::MethodTraitItem(ty_method) => {

View File

@ -444,7 +444,7 @@ impl<'a, 'v, O: IdVisitingOperation> Visitor<'v> for IdVisitor<'a, O> {
visit::FkMethod(_, sig, _) => {
self.visit_generics_helper(&sig.generics)
}
visit::FkFnBlock => {}
visit::FkClosure => {}
}
for argument in &function_declaration.inputs {

View File

@ -40,8 +40,8 @@ pub enum FnKind<'a> {
/// fn foo(&self)
FkMethod(Ident, &'a MethodSig, Option<Visibility>),
/// Closures (|x, y| {})
FkFnBlock,
/// |x, y| {}
FkClosure,
}
/// Each method of the Visitor trait is a hook to be potentially
@ -615,7 +615,7 @@ pub fn walk_fn<'v, V: Visitor<'v>>(visitor: &mut V,
visitor.visit_generics(&sig.generics);
visitor.visit_explicit_self(&sig.explicit_self);
}
FkFnBlock(..) => {}
FkClosure(..) => {}
}
visitor.visit_block(function_body)
@ -816,7 +816,7 @@ pub fn walk_expr<'v, V: Visitor<'v>>(visitor: &mut V, expression: &'v Expr) {
}
}
ExprClosure(_, ref function_declaration, ref body) => {
visitor.visit_fn(FkFnBlock,
visitor.visit_fn(FkClosure,
&**function_declaration,
&**body,
expression.span,