Skip to content

Commit f0f251e

Browse files
committed
librustc: Always pass self ByRef.
1 parent b5ab101 commit f0f251e

File tree

3 files changed

+4
-13
lines changed

3 files changed

+4
-13
lines changed

src/librustc/middle/trans/inline.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use core::prelude::*;
1313
use metadata::csearch;
1414
use middle::astencode;
1515
use middle::trans::base::{get_insn_ctxt};
16-
use middle::trans::base::{impl_owned_self, impl_self, no_self};
16+
use middle::trans::base::{impl_self, no_self};
1717
use middle::trans::base::{trans_item, get_item_val, trans_fn};
1818
use middle::trans::common::*;
1919
use middle::ty;
@@ -109,7 +109,6 @@ pub fn maybe_instantiate_inline(ccx: @CrateContext, fn_id: ast::def_id,
109109
debug!("calling inline trans_fn with self_ty %s",
110110
ty_to_str(ccx.tcx, self_ty));
111111
match mth.explicit_self.node {
112-
ast::sty_value => impl_owned_self(self_ty),
113112
_ => impl_self(self_ty),
114113
}
115114
}

src/librustc/middle/trans/meth.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,6 @@ pub fn trans_method(ccx: @CrateContext,
130130
base_self_ty.repr(ccx.tcx),
131131
self_ty.repr(ccx.tcx));
132132
match method.explicit_self.node {
133-
ast::sty_value => {
134-
impl_owned_self(self_ty)
135-
}
136133
_ => {
137134
impl_self(self_ty)
138135
}

src/librustc/middle/typeck/check/method.rs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,7 +1035,9 @@ pub impl<'self> LookupContext<'self> {
10351035
let fty = ty::mk_bare_fn(tcx, ty::BareFnTy {sig: fn_sig, ..bare_fn_ty});
10361036
debug!("after replacing bound regions, fty=%s", self.ty_to_str(fty));
10371037

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

10401042
// before we only checked whether self_ty could be a subtype
10411043
// of rcvr_ty; now we actually make it so (this may cause
@@ -1302,10 +1304,3 @@ pub impl<'self> LookupContext<'self> {
13021304
self.tcx().sess.bug(s)
13031305
}
13041306
}
1305-
1306-
pub fn get_mode_from_explicit_self(explicit_self: ast::explicit_self_) -> SelfMode {
1307-
match explicit_self {
1308-
sty_value => ty::ByCopy,
1309-
_ => ty::ByRef,
1310-
}
1311-
}

0 commit comments

Comments
 (0)