Skip to content

Commit

Permalink
Take &Pat in visit_pat
Browse files Browse the repository at this point in the history
  • Loading branch information
sanxiyn committed Nov 25, 2013
1 parent eb5cbfe commit 9028330
Show file tree
Hide file tree
Showing 12 changed files with 19 additions and 19 deletions.
4 changes: 2 additions & 2 deletions src/librustc/middle/borrowck/check_loans.rs
Expand Up @@ -51,7 +51,7 @@ impl<'self> Visitor<()> for CheckLoanCtxt<'self> {
fn visit_block(&mut self, b:&ast::Block, _:()) {
check_loans_in_block(self, b);
}
fn visit_pat(&mut self, p:@ast::Pat, _:()) {
fn visit_pat(&mut self, p:&ast::Pat, _:()) {
check_loans_in_pat(self, p);
}
fn visit_fn(&mut self, fk:&visit::fn_kind, fd:&ast::fn_decl,
Expand Down Expand Up @@ -847,7 +847,7 @@ fn check_loans_in_expr<'a>(this: &mut CheckLoanCtxt<'a>,
}

fn check_loans_in_pat<'a>(this: &mut CheckLoanCtxt<'a>,
pat: @ast::Pat)
pat: &ast::Pat)
{
this.check_for_conflicting_loans(pat.id);
this.check_move_out_from_id(pat.id, pat.span);
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/middle/borrowck/gather_loans/mod.rs
Expand Up @@ -87,7 +87,7 @@ impl<'self> visit::Visitor<()> for GatherLoanCtxt<'self> {
fn visit_stmt(&mut self, s:@Stmt, _:()) {
add_stmt_to_map(self, s);
}
fn visit_pat(&mut self, p:@Pat, _:()) {
fn visit_pat(&mut self, p:&Pat, _:()) {
add_pat_to_id_range(self, p);
}
fn visit_local(&mut self, l:@Local, _:()) {
Expand Down Expand Up @@ -119,7 +119,7 @@ pub fn gather_loans(bccx: &BorrowckCtxt,
}

fn add_pat_to_id_range(this: &mut GatherLoanCtxt,
p: @ast::Pat) {
p: &ast::Pat) {
// NB: This visitor function just adds the pat ids into the id
// range. We gather loans that occur in patterns using the
// `gather_pat()` method below. Eventually these two should be
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/middle/check_const.rs
Expand Up @@ -33,7 +33,7 @@ impl Visitor<bool> for CheckCrateVisitor {
fn visit_item(&mut self, i:@item, env:bool) {
check_item(self, self.sess, self.ast_map, self.def_map, i, env);
}
fn visit_pat(&mut self, p:@Pat, env:bool) {
fn visit_pat(&mut self, p:&Pat, env:bool) {
check_pat(self, p, env);
}
fn visit_expr(&mut self, ex:@Expr, env:bool) {
Expand Down Expand Up @@ -81,7 +81,7 @@ pub fn check_item(v: &mut CheckCrateVisitor,
}
}

pub fn check_pat(v: &mut CheckCrateVisitor, p: @Pat, _is_const: bool) {
pub fn check_pat(v: &mut CheckCrateVisitor, p: &Pat, _is_const: bool) {
fn is_str(e: @Expr) -> bool {
match e.node {
ExprVstore(
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/middle/lint.rs
Expand Up @@ -900,7 +900,7 @@ fn check_unsafe_block(cx: &Context, e: &ast::Expr) {
}
}

fn check_unused_mut_pat(cx: &Context, p: @ast::Pat) {
fn check_unused_mut_pat(cx: &Context, p: &ast::Pat) {
match p.node {
ast::PatIdent(ast::BindByValue(ast::MutMutable),
ref path, _) if pat_util::pat_is_binding(cx.tcx.def_map, p)=> {
Expand Down Expand Up @@ -1119,7 +1119,7 @@ impl<'self> Visitor<()> for Context<'self> {
}
}

fn visit_pat(&mut self, p: @ast::Pat, _: ()) {
fn visit_pat(&mut self, p: &ast::Pat, _: ()) {
check_pat_non_uppercase_statics(self, p);
check_unused_mut_pat(self, p);

Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/privacy.rs
Expand Up @@ -739,7 +739,7 @@ impl<'self> Visitor<()> for PrivacyVisitor<'self> {
}
}

fn visit_pat(&mut self, pattern: @ast::Pat, _: ()) {
fn visit_pat(&mut self, pattern: &ast::Pat, _: ()) {
match pattern.node {
ast::PatStruct(_, ref fields, _) => {
match ty::get(ty::pat_ty(self.tcx, pattern)).sty {
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/middle/region.rs
Expand Up @@ -340,7 +340,7 @@ fn resolve_arm(visitor: &mut RegionResolutionVisitor,
}

fn resolve_pat(visitor: &mut RegionResolutionVisitor,
pat: @ast::Pat,
pat: &ast::Pat,
cx: Context) {
assert_eq!(cx.var_parent, cx.parent);
parent_to_expr(visitor, cx, pat.id, pat.span);
Expand Down Expand Up @@ -480,7 +480,7 @@ impl Visitor<Context> for RegionResolutionVisitor {
fn visit_arm(&mut self, a:&Arm, cx:Context) {
resolve_arm(self, a, cx);
}
fn visit_pat(&mut self, p:@Pat, cx:Context) {
fn visit_pat(&mut self, p:&Pat, cx:Context) {
resolve_pat(self, p, cx);
}
fn visit_stmt(&mut self, s:@Stmt, cx:Context) {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/typeck/check/mod.rs
Expand Up @@ -375,7 +375,7 @@ impl Visitor<()> for GatherLocalsVisitor {

}
// Add pattern bindings.
fn visit_pat(&mut self, p:@ast::Pat, _:()) {
fn visit_pat(&mut self, p:&ast::Pat, _:()) {
match p.node {
ast::PatIdent(_, ref path, _)
if pat_util::pat_is_binding(self.fcx.ccx.tcx.def_map, p) => {
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/middle/typeck/check/writeback.rs
Expand Up @@ -278,7 +278,7 @@ fn visit_block(b: &ast::Block, wbcx: &mut WbCtxt) {
visit::walk_block(wbcx, b, ());
}

fn visit_pat(p: @ast::Pat, wbcx: &mut WbCtxt) {
fn visit_pat(p: &ast::Pat, wbcx: &mut WbCtxt) {
if !wbcx.success {
return;
}
Expand Down Expand Up @@ -323,7 +323,7 @@ impl Visitor<()> for WbCtxt {
fn visit_stmt(&mut self, s:@ast::Stmt, _:()) { visit_stmt(s, self); }
fn visit_expr(&mut self, ex:@ast::Expr, _:()) { visit_expr(ex, self); }
fn visit_block(&mut self, b:&ast::Block, _:()) { visit_block(b, self); }
fn visit_pat(&mut self, p:@ast::Pat, _:()) { visit_pat(p, self); }
fn visit_pat(&mut self, p:&ast::Pat, _:()) { visit_pat(p, self); }
fn visit_local(&mut self, l:@ast::Local, _:()) { visit_local(l, self); }
}

Expand Down
4 changes: 2 additions & 2 deletions src/libsyntax/ast_map.rs
Expand Up @@ -242,7 +242,7 @@ impl Ctx {
visit::walk_block(self, b, ());
}

fn map_pat(&mut self, pat: @Pat) {
fn map_pat(&mut self, pat: &Pat) {
match pat.node {
PatIdent(_, ref path, _) => {
// Note: this is at least *potentially* a pattern...
Expand Down Expand Up @@ -345,7 +345,7 @@ impl Visitor<()> for Ctx {
self.path.pop();
}

fn visit_pat(&mut self, pat: @Pat, _: ()) {
fn visit_pat(&mut self, pat: &Pat, _: ()) {
self.map_pat(pat);
visit::walk_pat(self, pat, ())
}
Expand Down
2 changes: 1 addition & 1 deletion src/libsyntax/ast_util.rs
Expand Up @@ -497,7 +497,7 @@ impl<'self, O: IdVisitingOperation> Visitor<()> for IdVisitor<'self, O> {
visit::walk_stmt(self, statement, env)
}

fn visit_pat(&mut self, pattern: @Pat, env: ()) {
fn visit_pat(&mut self, pattern: &Pat, env: ()) {
self.operation.visit_id(pattern.id);
visit::walk_pat(self, pattern, env)
}
Expand Down
2 changes: 1 addition & 1 deletion src/libsyntax/ext/expand.rs
Expand Up @@ -612,7 +612,7 @@ struct NewNameFinderContext {
}

impl Visitor<()> for NewNameFinderContext {
fn visit_pat(&mut self, pattern: @ast::Pat, _: ()) {
fn visit_pat(&mut self, pattern: &ast::Pat, _: ()) {
match *pattern {
// we found a pat_ident!
ast::Pat {
Expand Down
2 changes: 1 addition & 1 deletion src/libsyntax/visit.rs
Expand Up @@ -78,7 +78,7 @@ pub trait Visitor<E:Clone> {
fn visit_block(&mut self, b:&Block, e:E) { walk_block(self, b, e) }
fn visit_stmt(&mut self, s:@Stmt, e:E) { walk_stmt(self, s, e) }
fn visit_arm(&mut self, a:&Arm, e:E) { walk_arm(self, a, e) }
fn visit_pat(&mut self, p:@Pat, e:E) { walk_pat(self, p, e) }
fn visit_pat(&mut self, p:&Pat, e:E) { walk_pat(self, p, e) }
fn visit_decl(&mut self, d:@Decl, e:E) { walk_decl(self, d, e) }
fn visit_expr(&mut self, ex:@Expr, e:E) { walk_expr(self, ex, e) }
fn visit_expr_post(&mut self, _ex:@Expr, _e:E) { }
Expand Down

5 comments on commit 9028330

@bors
Copy link
Contributor

@bors bors commented on 9028330 Nov 25, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from cmr
at sanxiyn@9028330

@bors
Copy link
Contributor

@bors bors commented on 9028330 Nov 25, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging sanxiyn/rust/pat = 9028330 into auto

@bors
Copy link
Contributor

@bors bors commented on 9028330 Nov 25, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sanxiyn/rust/pat = 9028330 merged ok, testing candidate = 6fe6a6f

@bors
Copy link
Contributor

@bors bors commented on 9028330 Nov 25, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on 9028330 Nov 25, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = 6fe6a6f

Please sign in to comment.