Skip to content

Commit

Permalink
librustc: Always pass self ByRef.
Browse files Browse the repository at this point in the history
  • Loading branch information
luqmana committed May 24, 2013
1 parent b5ab101 commit f0f251e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 13 deletions.
3 changes: 1 addition & 2 deletions src/librustc/middle/trans/inline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use core::prelude::*;
use metadata::csearch;
use middle::astencode;
use middle::trans::base::{get_insn_ctxt};
use middle::trans::base::{impl_owned_self, impl_self, no_self};
use middle::trans::base::{impl_self, no_self};
use middle::trans::base::{trans_item, get_item_val, trans_fn};
use middle::trans::common::*;
use middle::ty;
Expand Down Expand Up @@ -109,7 +109,6 @@ pub fn maybe_instantiate_inline(ccx: @CrateContext, fn_id: ast::def_id,
debug!("calling inline trans_fn with self_ty %s",
ty_to_str(ccx.tcx, self_ty));
match mth.explicit_self.node {
ast::sty_value => impl_owned_self(self_ty),
_ => impl_self(self_ty),
}
}
Expand Down
3 changes: 0 additions & 3 deletions src/librustc/middle/trans/meth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,6 @@ pub fn trans_method(ccx: @CrateContext,
base_self_ty.repr(ccx.tcx),
self_ty.repr(ccx.tcx));
match method.explicit_self.node {
ast::sty_value => {
impl_owned_self(self_ty)
}
_ => {
impl_self(self_ty)
}
Expand Down
11 changes: 3 additions & 8 deletions src/librustc/middle/typeck/check/method.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1035,7 +1035,9 @@ pub impl<'self> LookupContext<'self> {
let fty = ty::mk_bare_fn(tcx, ty::BareFnTy {sig: fn_sig, ..bare_fn_ty});
debug!("after replacing bound regions, fty=%s", self.ty_to_str(fty));

let self_mode = get_mode_from_explicit_self(candidate.method_ty.explicit_self);
// XXX: We always pass self by-ref since we stuff it in the environment slot.
// Eventually that should not be the case
let self_mode = ty::ByRef;

// before we only checked whether self_ty could be a subtype
// of rcvr_ty; now we actually make it so (this may cause
Expand Down Expand Up @@ -1302,10 +1304,3 @@ pub impl<'self> LookupContext<'self> {
self.tcx().sess.bug(s)
}
}

pub fn get_mode_from_explicit_self(explicit_self: ast::explicit_self_) -> SelfMode {
match explicit_self {
sty_value => ty::ByCopy,
_ => ty::ByRef,
}
}

0 comments on commit f0f251e

Please sign in to comment.