Skip to content

Remove a few uses of @-pointers for @ast::Expr and @mut Block in trans #9630

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 30, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/librustc/middle/check_match.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ pub fn check_arms(cx: &MatchCheckCtxt, arms: &[Arm]) {
for pat in arm.pats.iter() {

// Check that we do not match against a static NaN (#6804)
let pat_matches_nan: &fn(@Pat) -> bool = |p| {
let pat_matches_nan: &fn(&Pat) -> bool = |p| {
match cx.tcx.def_map.find(&p.id) {
Some(&DefStatic(did, false)) => {
let const_expr = lookup_const_by_id(cx.tcx, did).unwrap();
Expand Down Expand Up @@ -893,7 +893,7 @@ pub fn check_legality_of_move_bindings(cx: &MatchCheckCtxt,
}
}

let check_move: &fn(@Pat, Option<@Pat>) = |p, sub| {
let check_move: &fn(&Pat, Option<@Pat>) = |p, sub| {
// check legality of moving out of the enum

// x @ Foo(*) is legal, but x @ Foo(y) isn't.
Expand Down
12 changes: 6 additions & 6 deletions src/librustc/middle/dataflow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ impl<'self, O:DataFlowOperator> PropagationContext<'self, O> {
}

fn walk_expr(&mut self,
expr: @ast::Expr,
expr: &ast::Expr,
in_out: &mut [uint],
loop_scopes: &mut ~[LoopScope]) {
debug!("DataFlowContext::walk_expr(expr=%s, in_out=%s)",
Expand Down Expand Up @@ -744,7 +744,7 @@ impl<'self, O:DataFlowOperator> PropagationContext<'self, O> {
}

fn pop_scopes(&mut self,
from_expr: @ast::Expr,
from_expr: &ast::Expr,
to_scope: &mut LoopScope,
in_out: &mut [uint]) {
//! Whenever you have a `break` or a `loop` statement, flow
Expand Down Expand Up @@ -778,7 +778,7 @@ impl<'self, O:DataFlowOperator> PropagationContext<'self, O> {
}

fn break_from_to(&mut self,
from_expr: @ast::Expr,
from_expr: &ast::Expr,
to_scope: &mut LoopScope,
in_out: &mut [uint]) {
self.pop_scopes(from_expr, to_scope, in_out);
Expand Down Expand Up @@ -811,7 +811,7 @@ impl<'self, O:DataFlowOperator> PropagationContext<'self, O> {
fn walk_call(&mut self,
_callee_id: ast::NodeId,
call_id: ast::NodeId,
arg0: @ast::Expr,
arg0: &ast::Expr,
args: &[@ast::Expr],
in_out: &mut [uint],
loop_scopes: &mut ~[LoopScope]) {
Expand Down Expand Up @@ -865,7 +865,7 @@ impl<'self, O:DataFlowOperator> PropagationContext<'self, O> {
}

fn find_scope<'a>(&self,
expr: @ast::Expr,
expr: &ast::Expr,
label: Option<ast::Name>,
loop_scopes: &'a mut ~[LoopScope]) -> &'a mut LoopScope {
let index = match label {
Expand Down Expand Up @@ -899,7 +899,7 @@ impl<'self, O:DataFlowOperator> PropagationContext<'self, O> {
&mut loop_scopes[index]
}

fn is_method_call(&self, expr: @ast::Expr) -> bool {
fn is_method_call(&self, expr: &ast::Expr) -> bool {
self.dfcx.method_map.contains_key(&expr.id)
}

Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/resolve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5410,7 +5410,7 @@ impl Resolver {
}

pub fn enforce_default_binding_mode(&mut self,
pat: @Pat,
pat: &Pat,
pat_binding_mode: BindingMode,
descr: &str) {
match pat_binding_mode {
Expand Down
6 changes: 3 additions & 3 deletions src/librustc/middle/trans/_match.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1398,7 +1398,7 @@ fn insert_lllocals(bcx: @mut Block,
}

fn compile_guard(bcx: @mut Block,
guard_expr: @ast::Expr,
guard_expr: &ast::Expr,
data: &ArmData,
m: &[Match],
vals: &[ValueRef],
Expand Down Expand Up @@ -1826,7 +1826,7 @@ fn compile_submatch_continue(mut bcx: @mut Block,

pub fn trans_match(bcx: @mut Block,
match_expr: &ast::Expr,
discr_expr: @ast::Expr,
discr_expr: &ast::Expr,
arms: &[ast::Arm],
dest: Dest) -> @mut Block {
let _icx = push_ctxt("match::trans_match");
Expand Down Expand Up @@ -1876,7 +1876,7 @@ fn create_bindings_map(bcx: @mut Block, pat: @ast::Pat) -> BindingsMap {
}

fn trans_match_inner(scope_cx: @mut Block,
discr_expr: @ast::Expr,
discr_expr: &ast::Expr,
arms: &[ast::Arm],
dest: Dest) -> @mut Block {
let _icx = push_ctxt("match::trans_match_inner");
Expand Down
11 changes: 7 additions & 4 deletions src/librustc/middle/trans/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1407,7 +1407,10 @@ pub fn cleanup_and_leave(bcx: @mut Block,
}
match leave {
Some(target) => Br(bcx, target),
None => { Resume(bcx, Load(bcx, bcx.fcx.personality.unwrap())); }
None => {
let ll_load = Load(bcx, bcx.fcx.personality.unwrap());
Resume(bcx, ll_load);
}
}
}

Expand Down Expand Up @@ -2485,7 +2488,7 @@ pub fn item_path(ccx: &CrateContext, id: &ast::NodeId) -> path {
ty::item_path(ccx.tcx, ast_util::local_def(*id))
}

fn exported_name(ccx: @mut CrateContext, path: path, ty: ty::t, attrs: &[ast::Attribute]) -> ~str {
fn exported_name(ccx: &mut CrateContext, path: path, ty: ty::t, attrs: &[ast::Attribute]) -> ~str {
match attr::first_attr_value_str_by_name(attrs, "export_name") {
// Use provided name
Some(name) => name.to_owned(),
Expand Down Expand Up @@ -2979,7 +2982,7 @@ pub fn decl_crate_map(sess: session::Session, mapmeta: LinkMeta,
return map;
}

pub fn fill_crate_map(ccx: @mut CrateContext, map: ValueRef) {
pub fn fill_crate_map(ccx: &mut CrateContext, map: ValueRef) {
let mut subcrates: ~[ValueRef] = ~[];
let mut i = 1;
let cstore = ccx.sess.cstore;
Expand Down Expand Up @@ -3030,7 +3033,7 @@ pub fn crate_ctxt_to_encode_parms<'r>(cx: &'r CrateContext, ie: encoder::encode_
}
}

pub fn write_metadata(cx: &mut CrateContext, crate: &ast::Crate) {
pub fn write_metadata(cx: &CrateContext, crate: &ast::Crate) {
if !*cx.sess.building_library { return; }

let encode_inlined_item: encoder::encode_inlined_item =
Expand Down
Loading