]> git.proxmox.com Git - rustc.git/blob - src/test/compile-fail/vec-add.rs
Imported Upstream version 0.6
[rustc.git] / src / test / compile-fail / vec-add.rs
1 // Copyright 2012 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 // xfail-test
12
13 // FIXME (Issue #2711): + should allow immutable or mutable vectors on
14 // the right hand side in all cases. We are getting compiler errors
15 // about this now, so I'm xfailing the test for now. -eholk
16
17 fn add(i: ~[int], mut m: ~[int]) {
18
19 // Check that:
20 // (1) vectors of any two mutabilities can be added
21 // (2) result has mutability of lhs
22
23 add(i + ~[3],
24 m + ~[3],
25 ~[3]);
26
27 add(i + ~[3],
28 m + ~[3],
29 ~[3]);
30
31 add(i + i,
32 m + i,
33 i);
34
35 add(i + m,
36 m + m,
37 m);
38
39 add(m + ~[3], //~ ERROR mismatched types
40 m + ~[3],
41 m + ~[3]);
42
43 add(i + ~[3],
44 i + ~[3], //~ ERROR mismatched types
45 i + ~[3]);
46
47 add(m + ~[3], //~ ERROR mismatched types
48 m + ~[3],
49 m + ~[3]);
50
51 add(i + ~[3],
52 i + ~[3], //~ ERROR mismatched types
53 i + ~[3]);
54
55 add(m + i, //~ ERROR mismatched types
56 m + i,
57 m + i);
58
59 add(i + i,
60 i + i, //~ ERROR mismatched types
61 i + i);
62
63 add(m + m, //~ ERROR mismatched types
64 m + m,
65 m + m);
66
67 add(i + m,
68 i + m, //~ ERROR mismatched types
69 i + m);
70 }
71
72 fn main() {
73 }