auto merge of #4908 : bstrie/rust/rimov3, r=pcwalton
This patch finishes removing inner vector mutability from the vast majority of the compiler. Exceptions: * core::dvec: ideally this entire type will be able to be replaced by `~[]`, but Niko asked me to hold off on removing Dvecs until he makes some fixes to borrowed pointers. * liveness: liveness.rs is an impenetrable neutron star of deprecated semantics. * compile-fail: I'm not sure if a lot of these tests are testing inner mutability or mutability in general. I figure that RIMOVing this folder should wait until this syntax is removed from the parser. I also took this chance to remove many of the inner-mutability-related functions from core::vec, or as many uses of those functions as possible where still necessary. consume_mut and append_mut have been axed. cast_to_mut and cast_from_mut are still needed in a few places.
This commit is contained in:
commit
d5bf3b85d1
22 changed files with 96 additions and 123 deletions
|
|
@ -14,9 +14,9 @@ extern mod std;
|
|||
fn fannkuch(n: int) -> int {
|
||||
fn perm1init(i: uint) -> int { return i as int; }
|
||||
|
||||
let perm = vec::cast_to_mut(vec::from_elem(n as uint, 0));
|
||||
let perm1 = vec::cast_to_mut(vec::from_fn(n as uint, |i| perm1init(i)));
|
||||
let count = vec::cast_to_mut(vec::from_elem(n as uint, 0));
|
||||
let mut perm = vec::from_elem(n as uint, 0);
|
||||
let mut perm1 = vec::from_fn(n as uint, |i| perm1init(i));
|
||||
let mut count = vec::from_elem(n as uint, 0);
|
||||
let mut f = 0;
|
||||
let mut i = 0;
|
||||
let mut k = 0;
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ fn main() {
|
|||
// initialize each sequence sorter
|
||||
let sizes = ~[1,2,3,4,6,12,18];
|
||||
let streams = vec::map(sizes, |_sz| Some(stream()));
|
||||
let streams = vec::cast_to_mut(move streams);
|
||||
let mut streams = move streams;
|
||||
let mut from_child = ~[];
|
||||
let to_child = vec::mapi(sizes, |ii, sz| {
|
||||
let sz = *sz;
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ fn eval_At_times_u(u: &[const float], Au: &mut [float]) {
|
|||
}
|
||||
|
||||
fn eval_AtA_times_u(u: &[const float], AtAu: &mut [float]) {
|
||||
let v = vec::cast_to_mut(vec::from_elem(vec::len(u), 0.0));
|
||||
let mut v = vec::from_elem(vec::len(u), 0.0);
|
||||
eval_A_times_u(u, v);
|
||||
eval_At_times_u(v, AtAu);
|
||||
}
|
||||
|
|
@ -62,8 +62,8 @@ fn main() {
|
|||
|
||||
let N = uint::from_str(args[1]).get();
|
||||
|
||||
let u = vec::cast_to_mut(vec::from_elem(N, 1.0));
|
||||
let v = vec::cast_to_mut(vec::from_elem(N, 0.0));
|
||||
let mut u = vec::from_elem(N, 1.0);
|
||||
let mut v = vec::from_elem(N, 0.0);
|
||||
let mut i = 0u;
|
||||
while i < 10u {
|
||||
eval_AtA_times_u(u, v);
|
||||
|
|
|
|||
|
|
@ -33,8 +33,8 @@ fn main() {
|
|||
{
|
||||
let mut res = foo(x);
|
||||
|
||||
let mut v = ~[mut];
|
||||
v = move ~[mut (move res)] + v; //~ ERROR does not fulfill `Copy`
|
||||
let mut v = ~[];
|
||||
v = move ~[(move res)] + v; //~ instantiating a type parameter with an incompatible type `foo`, which does not fulfill `Copy`
|
||||
assert (v.len() == 2);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@
|
|||
// except according to those terms.
|
||||
|
||||
pub fn main() {
|
||||
// Once cast_to_mut is removed, pick a better function to import
|
||||
// for this test!
|
||||
use vec::cast_to_mut;
|
||||
log(debug, vec::len(cast_to_mut(~[1, 2])));
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue