]>
git.proxmox.com Git - rustc.git/blob - 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.
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.
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
17 fn add(i
: ~[int
], mut m
: ~[int
]) {
20 // (1) vectors of any two mutabilities can be added
21 // (2) result has mutability of lhs
39 add(m
+ ~[3], //~ ERROR mismatched types
44 i
+ ~[3], //~ ERROR mismatched types
47 add(m
+ ~[3], //~ ERROR mismatched types
52 i
+ ~[3], //~ ERROR mismatched types
55 add(m
+ i
, //~ ERROR mismatched types
60 i
+ i
, //~ ERROR mismatched types
63 add(m
+ m
, //~ ERROR mismatched types
68 i
+ m
, //~ ERROR mismatched types