Correct merge failures
This commit is contained in:
parent
ce602c66b8
commit
979d3a54f9
@ -418,7 +418,7 @@ mod test {
|
||||
fn make_file(path : &Path, contents: &[~str]) {
|
||||
let file = io::file_writer(path, [io::Create, io::Truncate]).get();
|
||||
|
||||
for contents.iter().advance |&str| {
|
||||
for contents.iter().advance |str| {
|
||||
file.write_str(*str);
|
||||
file.write_char('\n');
|
||||
}
|
||||
|
@ -1586,7 +1586,7 @@ mod biguint_tests {
|
||||
let &(ref n, ref rs) = num_pair;
|
||||
for rs.iter().advance |str_pair| {
|
||||
let &(ref radix, ref str) = str_pair;
|
||||
assert_eq!(&n, &FromStrRadix::from_str_radix(*str, *radix).get());
|
||||
assert_eq!(n, &FromStrRadix::from_str_radix(*str, *radix).get());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -119,8 +119,8 @@ impl Terminal {
|
||||
pub fn reset(&self) {
|
||||
let mut vars = Variables::new();
|
||||
let s = do self.ti.strings.find_equiv(&("op"))
|
||||
.map_consume_default(Err(~"can't find terminfo capability `op`")) |&op| {
|
||||
expand(op, [], &mut vars)
|
||||
.map_consume_default(Err(~"can't find terminfo capability `op`")) |op| {
|
||||
expand(copy *op, [], &mut vars)
|
||||
};
|
||||
if s.is_ok() {
|
||||
self.out.write(s.unwrap());
|
||||
|
@ -617,7 +617,7 @@ impl GatherLoanCtxt {
|
||||
*/
|
||||
|
||||
let mc_ctxt = self.bccx.mc_ctxt();
|
||||
for decl.inputs.each |arg| {
|
||||
for decl.inputs.iter().advance |arg| {
|
||||
let arg_ty = ty::node_id_to_type(self.tcx(), arg.pat.id);
|
||||
|
||||
let arg_cmt = mc_ctxt.cat_rvalue(
|
||||
|
@ -190,15 +190,8 @@ enum UseMode {
|
||||
|
||||
pub fn compute_moves(tcx: ty::ctxt,
|
||||
method_map: method_map,
|
||||
<<<<<<< HEAD
|
||||
crate: &crate) -> MoveMaps
|
||||
{
|
||||
||||||| merged common ancestors
|
||||
crate: @crate) -> MoveMaps
|
||||
{
|
||||
=======
|
||||
crate: @crate) -> MoveMaps {
|
||||
>>>>>>> Modify borrow checker to visit irrefutable patterns that appear in
|
||||
let visitor = visit::mk_vt(@visit::Visitor {
|
||||
visit_fn: compute_modes_for_fn,
|
||||
visit_expr: compute_modes_for_expr,
|
||||
@ -248,7 +241,7 @@ fn compute_modes_for_fn(fk: &visit::fn_kind,
|
||||
id: node_id,
|
||||
(cx, v): (VisitContext,
|
||||
vt<VisitContext>)) {
|
||||
for decl.inputs.each |a| {
|
||||
for decl.inputs.iter().advance |a| {
|
||||
cx.use_pat(a.pat);
|
||||
}
|
||||
visit::visit_fn(fk, decl, body, span, id, (cx, v));
|
||||
@ -554,7 +547,7 @@ impl VisitContext {
|
||||
}
|
||||
|
||||
expr_fn_block(ref decl, ref body) => {
|
||||
for decl.inputs.each |a| {
|
||||
for decl.inputs.iter().advance |a| {
|
||||
self.use_pat(a.pat);
|
||||
}
|
||||
let cap_vars = self.compute_captures(expr.id);
|
||||
|
@ -1738,7 +1738,7 @@ pub fn store_local(bcx: block,
|
||||
* Generates code for a local variable declaration like
|
||||
* `let <pat>;` or `let <pat> = <opt_init_expr>`.
|
||||
*/
|
||||
let _icx = bcx.insn_ctxt("match::store_local");
|
||||
let _icx = push_ctxt("match::store_local");
|
||||
let mut bcx = bcx;
|
||||
|
||||
return match opt_init_expr {
|
||||
@ -1813,7 +1813,7 @@ pub fn store_arg(mut bcx: block,
|
||||
* if the argument type is `T`, then `llval` is a `T*`). In some
|
||||
* cases, this code may zero out the memory `llval` points at.
|
||||
*/
|
||||
let _icx = bcx.insn_ctxt("match::store_arg");
|
||||
let _icx = push_ctxt("match::store_arg");
|
||||
|
||||
// We always need to cleanup the argument as we exit the fn scope.
|
||||
// Note that we cannot do it before for fear of a fn like
|
||||
@ -1882,10 +1882,9 @@ fn bind_irrefutable_pat(bcx: block,
|
||||
* - binding_mode: is this for an argument or a local variable?
|
||||
*/
|
||||
|
||||
debug!("bind_irrefutable_pat(bcx=%s, pat=%s, val=%s, binding_mode=%?)",
|
||||
debug!("bind_irrefutable_pat(bcx=%s, pat=%s, binding_mode=%?)",
|
||||
bcx.to_str(),
|
||||
pat_to_str(pat, bcx.sess().intr()),
|
||||
val_str(bcx.ccx().tn, val),
|
||||
binding_mode);
|
||||
|
||||
if bcx.sess().asm_comments() {
|
||||
@ -1895,7 +1894,7 @@ fn bind_irrefutable_pat(bcx: block,
|
||||
|
||||
let _indenter = indenter();
|
||||
|
||||
let _icx = bcx.insn_ctxt("alt::bind_irrefutable_pat");
|
||||
let _icx = push_ctxt("alt::bind_irrefutable_pat");
|
||||
let mut bcx = bcx;
|
||||
let tcx = bcx.tcx();
|
||||
let ccx = bcx.ccx();
|
||||
|
@ -112,8 +112,8 @@ impl Drop for _InsnCtxt {
|
||||
fn drop(&self) {
|
||||
unsafe {
|
||||
do local_data::local_data_modify(task_local_insn_key) |c| {
|
||||
do c.map_consume |@ctx| {
|
||||
let mut ctx = ctx;
|
||||
do c.map_consume |ctx| {
|
||||
let mut ctx = copy *ctx;
|
||||
ctx.pop();
|
||||
@ctx
|
||||
}
|
||||
@ -126,8 +126,8 @@ pub fn push_ctxt(s: &'static str) -> _InsnCtxt {
|
||||
debug!("new InsnCtxt: %s", s);
|
||||
unsafe {
|
||||
do local_data::local_data_modify(task_local_insn_key) |c| {
|
||||
do c.map_consume |@ctx| {
|
||||
let mut ctx = ctx;
|
||||
do c.map_consume |ctx| {
|
||||
let mut ctx = copy *ctx;
|
||||
ctx.push(s);
|
||||
@ctx
|
||||
}
|
||||
@ -1438,54 +1438,6 @@ pub fn block_locals(b: &ast::blk, it: &fn(@ast::local)) {
|
||||
}
|
||||
}
|
||||
|
||||
<<<<<<< variant A
|
||||
pub fn alloc_local(cx: block, local: &ast::local) -> block {
|
||||
let _icx = push_ctxt("alloc_local");
|
||||
let t = node_id_type(cx, local.node.id);
|
||||
let simple_name = match local.node.pat.node {
|
||||
ast::pat_ident(_, ref pth, None) => Some(path_to_ident(pth)),
|
||||
_ => None
|
||||
};
|
||||
let val = alloc_ty(cx, t);
|
||||
if cx.sess().opts.debuginfo {
|
||||
for simple_name.iter().advance |name| {
|
||||
str::as_c_str(cx.ccx().sess.str_of(*name), |buf| {
|
||||
unsafe {
|
||||
llvm::LLVMSetValueName(val, buf)
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
cx.fcx.lllocals.insert(local.node.id, val);
|
||||
cx
|
||||
}
|
||||
|
||||
|
||||
>>>>>>> variant B
|
||||
####### Ancestor
|
||||
pub fn alloc_local(cx: block, local: @ast::local) -> block {
|
||||
let _icx = push_ctxt("alloc_local");
|
||||
let t = node_id_type(cx, local.node.id);
|
||||
let simple_name = match local.node.pat.node {
|
||||
ast::pat_ident(_, pth, None) => Some(path_to_ident(pth)),
|
||||
_ => None
|
||||
};
|
||||
let val = alloc_ty(cx, t);
|
||||
if cx.sess().opts.debuginfo {
|
||||
for simple_name.iter().advance |name| {
|
||||
str::as_c_str(cx.ccx().sess.str_of(*name), |buf| {
|
||||
unsafe {
|
||||
llvm::LLVMSetValueName(val, buf)
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
cx.fcx.lllocals.insert(local.node.id, val);
|
||||
cx
|
||||
}
|
||||
|
||||
|
||||
======= end
|
||||
pub fn with_cond(bcx: block, val: ValueRef, f: &fn(block) -> block) -> block {
|
||||
let _icx = push_ctxt("with_cond");
|
||||
let next_cx = base::sub_block(bcx, "next");
|
||||
@ -1763,7 +1715,7 @@ pub fn copy_args_to_allocas(fcx: fn_ctxt,
|
||||
let self_val = if slf.is_copy
|
||||
&& datum::appropriate_mode(bcx.tcx(), slf.t).is_by_value() {
|
||||
let tmp = BitCast(bcx, slf.v, type_of(bcx.ccx(), slf.t));
|
||||
let alloc = alloc_ty(bcx, slf.t);
|
||||
let alloc = alloc_ty(bcx, slf.t, "__self");
|
||||
Store(bcx, tmp, alloc);
|
||||
alloc
|
||||
} else {
|
||||
@ -3030,7 +2982,7 @@ pub fn trans_crate(sess: session::Session,
|
||||
}
|
||||
}
|
||||
if ccx.sess.count_llvm_insns() {
|
||||
for ccx.stats.llvm_insns.each |k, v| {
|
||||
for ccx.stats.llvm_insns.iter().advance |(k, v)| {
|
||||
io::println(fmt!("%-7u %s", *v, *k));
|
||||
}
|
||||
}
|
||||
|
@ -873,10 +873,10 @@ pub fn trans_arg_expr(bcx: block,
|
||||
// &arg_expr.id);
|
||||
debug!("by ref arg with type %s, storing to scratch",
|
||||
bcx.ty_to_str(arg_datum.ty));
|
||||
let scratch = scratch_datum(bcx, arg_datum.ty, false);
|
||||
let scratch = scratch_datum(bcx, arg_datum.ty,
|
||||
"__self", false);
|
||||
|
||||
arg_datum.store_to_datum(bcx,
|
||||
arg_expr.id,
|
||||
INIT,
|
||||
scratch);
|
||||
|
||||
@ -897,7 +897,6 @@ pub fn trans_arg_expr(bcx: block,
|
||||
"__arg", false);
|
||||
|
||||
arg_datum.store_to_datum(bcx,
|
||||
arg_expr.id,
|
||||
INIT,
|
||||
scratch);
|
||||
|
||||
|
@ -614,7 +614,8 @@ pub fn trans_trait_callee_from_llval(bcx: block,
|
||||
}
|
||||
|
||||
llself = PointerCast(bcx, llself, Type::opaque_box(ccx).ptr_to());
|
||||
let scratch = scratch_datum(bcx, ty::mk_opaque_box(bcx.tcx()), false);
|
||||
let scratch = scratch_datum(bcx, ty::mk_opaque_box(bcx.tcx()),
|
||||
"__trait_callee", false);
|
||||
Store(bcx, llself, scratch.val);
|
||||
scratch.add_clean(bcx);
|
||||
|
||||
|
@ -1276,7 +1276,7 @@ impl<T> OwnedVector<T> for ~[T] {
|
||||
ln => {
|
||||
let valptr = ptr::to_mut_unsafe_ptr(&mut self[ln - 1u]);
|
||||
unsafe {
|
||||
raw::set_len(v, ln - 1u);
|
||||
raw::set_len(self, ln - 1u);
|
||||
ptr::read_ptr(valptr)
|
||||
}
|
||||
}
|
||||
@ -1408,7 +1408,7 @@ impl<T> OwnedVector<T> for ~[T] {
|
||||
unsafe {
|
||||
// This loop is optimized out for non-drop types.
|
||||
for uint::range(newlen, oldlen) |i| {
|
||||
ptr::read_and_zero_ptr(ptr::mut_offset(p, i))
|
||||
ptr::read_and_zero_ptr(ptr::mut_offset(p, i));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1556,7 +1556,7 @@ impl<T:Eq> OwnedEqVector<T> for ~[T] {
|
||||
* Remove consecutive repeated elements from a vector; if the vector is
|
||||
* sorted, this removes all duplicates.
|
||||
*/
|
||||
pub fn dedup<T:Eq>(&mut self) {
|
||||
pub fn dedup(&mut self) {
|
||||
unsafe {
|
||||
// Although we have a mutable reference to `self`, we cannot make
|
||||
// *arbitrary* changes. There exists the possibility that this
|
||||
|
@ -1521,7 +1521,12 @@ pub fn print_path(s: @ps, path: &ast::Path, colons_before_params: bool) {
|
||||
print_path_(s, path, colons_before_params, &None)
|
||||
}
|
||||
|
||||
pub fn print_pat(s: @ps, pat: &ast::pat) {
|
||||
pub fn print_bounded_path(s: @ps, path: &ast::Path,
|
||||
bounds: &Option<OptVec<ast::TyParamBound>>) {
|
||||
print_path_(s, path, false, bounds)
|
||||
}
|
||||
|
||||
pub fn print_pat(s: @ps, pat: @ast::pat) {
|
||||
maybe_print_comment(s, pat.span.lo);
|
||||
let ann_node = node_pat(s, pat);
|
||||
(s.ann.pre)(ann_node);
|
||||
|
@ -1,6 +1,6 @@
|
||||
struct S {f:~str}
|
||||
impl Drop for S {
|
||||
fn finalize(&self) { println(self.f); }
|
||||
fn drop(&self) { println(self.f); }
|
||||
}
|
||||
|
||||
fn move_in_match() {
|
||||
|
@ -1,6 +1,6 @@
|
||||
struct S(~str);
|
||||
impl Drop for S {
|
||||
fn finalize(&self) { println(**self); }
|
||||
fn drop(&self) { println(**self); }
|
||||
}
|
||||
|
||||
fn move_in_match() {
|
||||
|
@ -163,8 +163,8 @@ pub fn main() {
|
||||
visit_ty::<i16>(vv);
|
||||
visit_ty::<~[int]>(vv);
|
||||
|
||||
for v.types.iter().advance |&s| {
|
||||
println(fmt!("type: %s", s));
|
||||
for v.types.iter().advance |s| {
|
||||
println(fmt!("type: %s", copy *s));
|
||||
}
|
||||
assert_eq!((*v.types).clone(), ~[~"bool", ~"int", ~"i8", ~"i16", ~"[", ~"int", ~"]"]);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user