rust/src/test/compile-fail/vec-add.rs
Brian Anderson 569467eb0d Merge remote-tracking branch 'Dretch/prettydocs'
Conflicts:
	src/compiletest/errors.rs
	src/libsyntax/parse/attr.rs
	src/libsyntax/parse/comments.rs
	src/test/compile-fail/ambig_impl_unify.rs
	src/test/compile-fail/assign-super.rs
	src/test/compile-fail/bad-for-loop.rs
	src/test/compile-fail/bad-var-env-capture-in-block-arg.rs
	src/test/compile-fail/block-arg-as-stmt-with-value.rs
	src/test/compile-fail/borrowck-assign-comp-idx.rs
	src/test/compile-fail/borrowck-lend-flow.rs
	src/test/compile-fail/borrowck-loan-blocks-move-cc.rs
	src/test/compile-fail/borrowck-loan-blocks-mut-uniq.rs
	src/test/compile-fail/borrowck-loan-rcvr.rs
	src/test/compile-fail/borrowck-loan-vec-content.rs
	src/test/compile-fail/borrowck-mut-vec-as-imm-slice-bad.rs
	src/test/compile-fail/cap-clause-with-stack-closure.rs
	src/test/compile-fail/do1.rs
	src/test/compile-fail/do2.rs
	src/test/compile-fail/empty-vec-trailing-comma.rs
	src/test/compile-fail/evec-subtyping.rs
	src/test/compile-fail/issue-1896.rs
	src/test/compile-fail/issue-2149.rs
	src/test/compile-fail/issue-2150.rs
	src/test/compile-fail/issue-2487-b.rs
	src/test/compile-fail/kindck-implicit-close-over-mut-var.rs
	src/test/compile-fail/liveness-issue-2163.rs
	src/test/compile-fail/liveness-use-in-index-lvalue.rs
	src/test/compile-fail/no-reuse-move-arc.rs
	src/test/compile-fail/no-send-res-ports.rs
	src/test/compile-fail/non-const.rs
	src/test/compile-fail/pure-higher-order.rs
	src/test/compile-fail/pure-loop-body.rs
	src/test/compile-fail/regions-addr-of-upvar-self.rs
	src/test/compile-fail/regions-escape-loop-via-vec.rs
	src/test/compile-fail/regions-scoping.rs
	src/test/compile-fail/seq-args.rs
	src/test/compile-fail/tstate-unsat-in-called-fn-expr.rs
	src/test/compile-fail/tstate-unsat-in-fn-expr.rs
	src/test/compile-fail/vec-add.rs
	src/test/compile-fail/vec-concat-bug.rs
	src/test/compile-fail/vector-no-ann.rs
2012-07-02 15:23:41 -07:00

106 lines
2.5 KiB
Rust

// xfail-test
// FIXME (Issue #2711): + should allow immutable or mutable vectors on
// the right hand side in all cases. We are getting compiler errors
// about this now, so I'm xfailing the test for now. -eholk
fn add(i: ~[int], m: ~[mut int], c: ~[const int]) {
// Check that:
// (1) vectors of any two mutabilities can be added
// (2) result has mutability of lhs
add(i + ~[3],
m + ~[3],
~[3]);
add(i + ~[mut 3],
m + ~[mut 3],
~[mut 3]);
add(i + i,
m + i,
i);
add(i + m,
m + m,
m);
add(i + c,
m + c,
c);
add(m + ~[3], //~ ERROR mismatched types
m + ~[3],
m + ~[3]);
add(i + ~[3],
i + ~[3], //~ ERROR mismatched types
i + ~[3]);
add(c + ~[3], //~ ERROR mismatched types
//~^ ERROR binary operation + cannot be applied
c + ~[3], //~ ERROR binary operation + cannot be applied
//~^ mismatched types
~[3]);
add(m + ~[mut 3], //~ ERROR mismatched types
m + ~[mut 3],
m + ~[mut 3]);
add(i + ~[mut 3],
i + ~[mut 3], //~ ERROR mismatched types
i + ~[mut 3]);
add(c + ~[mut 3], //~ ERROR binary operation + cannot be applied
//~^ mismatched types
c + ~[mut 3], //~ ERROR binary operation + cannot be applied
//~^ mismatched types
~[mut 3]);
add(m + i, //~ ERROR mismatched types
m + i,
m + i);
add(i + i,
i + i, //~ ERROR mismatched types
i + i);
add(c + i, //~ ERROR binary operation + cannot be applied
//~^ ERROR mismatched types
c + i, //~ ERROR binary operation + cannot be applied
//~^ ERROR mismatched types
i);
add(m + m, //~ ERROR mismatched types
m + m,
m + m);
add(i + m,
i + m, //~ ERROR mismatched types
i + m);
add(c + m, //~ ERROR binary operation + cannot be applied
//~^ ERROR mismatched types
c + m, //~ ERROR binary operation + cannot be applied
//~^ ERROR mismatched types
m);
add(m + c, //~ ERROR mismatched types
m + c,
m + c);
add(i + c,
i + c, //~ ERROR mismatched types
i + c);
add(c + c, //~ ERROR binary operation + cannot be applied
//~^ ERROR mismatched types
c + c, //~ ERROR binary operation + cannot be applied
//~^ ERROR mismatched types
c);
}
fn main() {
}