]> git.lizzy.rs Git - rust.git/commitdiff
Don't unify from mutable? to immutable
authorBrian Anderson <banderson@mozilla.com>
Mon, 17 Oct 2011 21:28:44 +0000 (14:28 -0700)
committerBrian Anderson <banderson@mozilla.com>
Mon, 17 Oct 2011 23:36:49 +0000 (16:36 -0700)
Immutable is supposed to be a subtype of mutable-huh.

src/comp/middle/ty.rs
src/lib/vec.rs

index fec7f4de06ad33bb06333dbd029ef6ca2af6951d..7f026d5215dc99937494f75838ee3e3124c20555 100644 (file)
@@ -1952,7 +1952,6 @@ fn unify_mut(expected: ast::mutability, actual: ast::mutability) ->
        option::t<ast::mutability> {
         if expected == actual { ret some(expected); }
         if expected == ast::maybe_mut { ret some(actual); }
-        if actual == ast::maybe_mut { ret some(expected); }
         ret none;
     }
     tag fn_common_res {
index 04e35e9e979b289ccb614fd0d5ecfa774fb86971..f329e40cb9889b67665073e9ebc04a4f94c66796 100644 (file)
@@ -5,7 +5,7 @@
 import ptr::addr_of;
 
 native "rust-intrinsic" mod rusti {
-    fn vec_len<T>(&&v: [T]) -> uint;
+    fn vec_len<T>(&&v: [mutable? T]) -> uint;
 }
 
 native "rust" mod rustrt {
@@ -86,7 +86,7 @@ fn from_mut<@T>(v: [mutable T]) -> [T] {
 fn head<@T>(v: [mutable? T]) : is_not_empty(v) -> T { ret v[0]; }
 
 /// Returns all but the first element of a vector
-fn tail<@T>(v: [mutable? T]) : is_not_empty(v) -> [mutable? T] {
+fn tail<@T>(v: [mutable? T]) : is_not_empty(v) -> [T] {
     ret slice(v, 1u, len(v));
 }