]> git.lizzy.rs Git - rust.git/commitdiff
RIMOV, round 11
authorBen Striegel <ben.striegel@gmail.com>
Wed, 30 Jan 2013 03:34:16 +0000 (22:34 -0500)
committerBen Striegel <ben.striegel@gmail.com>
Thu, 31 Jan 2013 04:19:40 +0000 (23:19 -0500)
Last bit of mut removal, manually cleaning up outliers

doc/rust.md
doc/tutorial.md
src/libcore/vec.rs
src/libfuzzer/cycles.rs
src/test/compile-fail/regions-infer-invariance-due-to-mutability-2.rs

index e31441c7cd2a2026d7e5d021bbdc25b08e24cbed..9982f72ebe722171fd4697e1a72733af7c829e1d 100644 (file)
@@ -1716,15 +1716,12 @@ vec_elems : [expr [',' expr]*] | [expr ',' ".." expr]
 
 A [_vector_](#vector-types) _expression_ is written by enclosing zero or
 more comma-separated expressions of uniform type in square brackets.
-The keyword `mut` can be written after the opening bracket to
-indicate that the elements of the resulting vector may be mutated.
-When no mutability is specified, the vector is immutable.
 
 ~~~~
 [1, 2, 3, 4];
 ["a", "b", "c", "d"];
 [0, ..128];             // vector with 128 zeros
-[mut 0u8, 0u8, 0u8, 0u8];
+[0u8, 0u8, 0u8, 0u8];
 ~~~~
 
 ### Index expressions
@@ -1746,7 +1743,7 @@ task in a _failing state_.
 # do task::spawn_unlinked {
 
 ([1, 2, 3, 4])[0];
-([mut 'x', 'y'])[1] = 'z';
+(['x', 'y'])[1] = 'z';
 (["a", "b"])[10]; // fails
 
 # }
@@ -1909,8 +1906,8 @@ No allocation or destruction is entailed.
 An example of three different swap expressions:
 
 ~~~~~~~~
-# let mut x = &[mut 0];
-# let mut a = &[mut 0];
+# let mut x = &[0];
+# let mut a = &[0];
 # let i = 0;
 # let y = {mut z: 0};
 # let b = {mut c: 0};
@@ -2005,11 +2002,11 @@ the unary copy operator is typically only used to cause an argument to a functio
 An example of a copy expression:
 
 ~~~~
-fn mutate(vec: ~[mut int]) {
+fn mutate(vec: ~[int]) {
    vec[0] = 10;
 }
 
-let v = ~[mut 1,2,3];
+let v = ~[1,2,3];
 
 mutate(copy v);   // Pass a copy
 
index 6ccf13a8d4d98f399970ddfd2ec2b7323d61d3e6..dbafea444094331ebc3a94c8cccab4a16aa28e0d 100644 (file)
@@ -1795,7 +1795,7 @@ Generic `type`, `struct`, and `enum` declarations follow the same pattern:
 type Set<T> = HashMap<T, ()>;
 
 struct Stack<T> {
-    elements: ~[mut T]
+    elements: ~[T]
 }
 
 enum Option<T> {
index 30b3927d6f3dbf803a10ccb28c7abd796c11177a..52b62d10a2046947d94783025f33613086fb46f1 100644 (file)
@@ -280,8 +280,12 @@ pub fn reserve_at_least<T>(v: &mut ~[T], n: uint) {
 }
 
 /// Return a slice that points into another slice.
+<<<<<<< HEAD
 #[inline(always)]
 pub pure fn mut_view<T>(v: &r/[mut T], start: uint, end: uint) -> &r/[mut T] {
+=======
+pub pure fn mut_view<T>(v: &mut r/[T], start: uint, end: uint) -> &mut r/[T] {
+>>>>>>> RIMOV, round 11
     assert (start <= end);
     assert (end <= len(v));
     do as_mut_buf(v) |p, _len| {
@@ -2199,12 +2203,8 @@ pub mod bytes {
       * Copies `count` bytes from `src` to `dst`. The source and destination
       * may overlap.
       */
-<<<<<<< HEAD
     #[inline(always)]
-    pub fn copy_memory(dst: &[mut u8], src: &[const u8], count: uint) {
-=======
     pub fn copy_memory(dst: &mut [u8], src: &[const u8], count: uint) {
->>>>>>> RIMOV, round 5
         // Bound checks are done at vec::raw::copy_memory.
         unsafe { vec::raw::copy_memory(dst, src, count) }
     }
index ee1bfc294294ab6e6343743e129b57dd966f4992..a64700494c8975c7070242d0253674596f755033 100644 (file)
@@ -58,7 +58,7 @@ fn empty_pointy() -> @pointy {
         mut g : fn~()->(){},
 
         mut m : ~[],
-        mut n : ~[mut],
+        mut n : ~[],
         mut o : {x : 0, y : none}
     }
 }
index 523b48f2aff7e3fb7c77a848062b92d3d50b5010..4b637b0195c31c7bc5eac21eef4f7c64aace4547 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 struct invariant {
-    f: @[mut &int]
+    f: @mut [&int]
 }
 
 fn to_same_lifetime(bi: invariant/&r) {
@@ -25,4 +25,4 @@ fn to_longer_lifetime(bi: invariant/&r) -> invariant/&static {
 }
 
 fn main() {
-}
\ No newline at end of file
+}