diff --git a/src/librustc/middle/trans/inline.rs b/src/librustc/middle/trans/inline.rs index aa4bb775323c7..9fdcb6ad6aa37 100644 --- a/src/librustc/middle/trans/inline.rs +++ b/src/librustc/middle/trans/inline.rs @@ -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; @@ -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), } } diff --git a/src/librustc/middle/trans/meth.rs b/src/librustc/middle/trans/meth.rs index 381c257f6511c..8e7ceffde0bc1 100644 --- a/src/librustc/middle/trans/meth.rs +++ b/src/librustc/middle/trans/meth.rs @@ -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) } diff --git a/src/librustc/middle/typeck/check/method.rs b/src/librustc/middle/typeck/check/method.rs index 68deb900886fb..f5598359c9bb2 100644 --- a/src/librustc/middle/typeck/check/method.rs +++ b/src/librustc/middle/typeck/check/method.rs @@ -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 @@ -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, - } -} diff --git a/src/test/run-pass/issue-3559 b/src/test/run-pass/issue-3559 deleted file mode 100755 index 505b9b65512f2..0000000000000 Binary files a/src/test/run-pass/issue-3559 and /dev/null differ diff --git a/src/test/run-pass/issue-3702 b/src/test/run-pass/issue-3702 deleted file mode 100755 index 3f39ee314421b..0000000000000 Binary files a/src/test/run-pass/issue-3702 and /dev/null differ diff --git a/src/test/run-pass/issue-4016 b/src/test/run-pass/issue-4016 deleted file mode 100755 index ff979383c1020..0000000000000 Binary files a/src/test/run-pass/issue-4016 and /dev/null differ diff --git a/src/test/run-pass/issue-4092 b/src/test/run-pass/issue-4092 deleted file mode 100755 index 761b6ab468624..0000000000000 Binary files a/src/test/run-pass/issue-4092 and /dev/null differ diff --git a/src/test/run-pass/issue-5321-immediates-with-bare-self.rs b/src/test/run-pass/issue-5321-immediates-with-bare-self.rs new file mode 100644 index 0000000000000..ee2bfe4b1949c --- /dev/null +++ b/src/test/run-pass/issue-5321-immediates-with-bare-self.rs @@ -0,0 +1,25 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +trait Fooable { + fn yes(self); +} + +impl Fooable for uint { + fn yes(self) { + for self.times { + io::println("yes"); + } + } +} + +fn main() { + 2.yes(); +}