diff --git a/src/libcore/arc.rs b/src/libcore/arc.rs index 2fd03cdb7a12ba49c4a000dd088e406526dc0626..28f0726441055e8489c8ed713d10c188d9b0ea15 100644 --- a/src/libcore/arc.rs +++ b/src/libcore/arc.rs @@ -56,7 +56,7 @@ fn arc(-data: T) -> arc { * Access the underlying data in an atomically reference counted * wrapper. */ -fn get(rc: &a.arc) -> &a.T { +fn get(rc: &arc) -> &T { unsafe { let ptr: ~arc_data = unsafe::reinterpret_cast((*rc).data); // Cast us back into the correct region diff --git a/src/libcore/str.rs b/src/libcore/str.rs index 7e83e7aa0ee70d008f3a57eb18ab9d7ad77356a4..e9a6f4f16945a818e1cc6b0829e004a347925fe2 100644 --- a/src/libcore/str.rs +++ b/src/libcore/str.rs @@ -229,7 +229,7 @@ fn push_char(&s: ~str, ch: char) { } /// Convert a vector of chars to a string -pure fn from_chars(chs: &[const char]) -> ~str { +pure fn from_chars(chs: &[char]) -> ~str { let mut buf = ~""; unchecked { reserve(buf, chs.len()); @@ -283,14 +283,14 @@ fn push_str(&lhs: ~str, rhs: &str) { /// Concatenate a vector of strings -pure fn concat(v: &[const ~str]) -> ~str { +pure fn concat(v: &[~str]) -> ~str { let mut s: ~str = ~""; for vec::each(v) |ss| { unchecked { push_str(s, ss) }; } ret s; } /// Concatenate a vector of strings, placing a given separator between each -pure fn connect(v: &[const ~str], sep: ~str) -> ~str { +pure fn connect(v: &[~str], sep: ~str) -> ~str { let mut s = ~"", first = true; for vec::each(v) |ss| { if first { first = false; } else { unchecked { push_str(s, sep); } } @@ -1288,7 +1288,7 @@ fn is_alphanumeric(s: &str) -> bool { */ /// Determines if a vector of bytes contains valid UTF-8 -pure fn is_utf8(v: &[const u8]) -> bool { +pure fn is_utf8(v: &[u8]) -> bool { let mut i = 0u; let total = vec::len::(v); while i < total { @@ -1306,7 +1306,7 @@ fn is_alphanumeric(s: &str) -> bool { } /// Determines if a vector of `u16` contains valid UTF-16 -pure fn is_utf16(v: &[const u16]) -> bool { +pure fn is_utf16(v: &[u16]) -> bool { let len = vec::len(v); let mut i = 0u; while (i < len) { @@ -1349,7 +1349,7 @@ fn is_alphanumeric(s: &str) -> bool { ret u; } -pure fn utf16_chars(v: &[const u16], f: fn(char)) { +pure fn utf16_chars(v: &[u16], f: fn(char)) { let len = vec::len(v); let mut i = 0u; while (i < len && v[i] != 0u16) { @@ -1374,7 +1374,7 @@ fn is_alphanumeric(s: &str) -> bool { } -pure fn from_utf16(v: &[const u16]) -> ~str { +pure fn from_utf16(v: &[u16]) -> ~str { let mut buf = ~""; unchecked { reserve(buf, vec::len(v)); diff --git a/src/libcore/vec.rs b/src/libcore/vec.rs index e21fd1a20a3af41daa749a4de323d8c91649575f..c4e8ad6425cd709d0612e0a576b19678500d2f36 100644 --- a/src/libcore/vec.rs +++ b/src/libcore/vec.rs @@ -314,7 +314,7 @@ fn reserve_at_least(&v: ~[const T], n: uint) { } #[doc = "Return a slice that points into another slice."] -pure fn view(v: &a.[T], start: uint, end: uint) -> &a.[T] { +pure fn view(v: &[T], start: uint, end: uint) -> &[T] { assert (start <= end); assert (end <= len(v)); do unpack_slice(v) |p, _len| { @@ -1054,7 +1054,7 @@ fn reverse(v: ~[mut T]) { * Return true to continue, false to break. */ #[inline(always)] -pure fn each(v: &[const T], f: fn(T) -> bool) { +pure fn each(v: &[T], f: fn(T) -> bool) { do vec::unpack_slice(v) |p, n| { let mut n = n; let mut p = p; @@ -1074,7 +1074,7 @@ fn reverse(v: ~[mut T]) { * Return true to continue, false to break. */ #[inline(always)] -pure fn eachi(v: &[const T], f: fn(uint, T) -> bool) { +pure fn eachi(v: &[T], f: fn(uint, T) -> bool) { do vec::unpack_slice(v) |p, n| { let mut i = 0u; let mut p = p; @@ -1331,7 +1331,7 @@ impl extensions/& of copyable_vector for &[const T] { pure fn tail() -> ~[T] { tail(self) } } -trait immutable_vector/& { +trait immutable_vector { pure fn foldr(z: U, p: fn(T, U) -> U) -> U; pure fn iter(f: fn(T)); pure fn iteri(f: fn(uint, T)); @@ -1343,7 +1343,7 @@ trait immutable_vector/& { pure fn rposition_elem(x: T) -> option; pure fn map(f: fn(T) -> U) -> ~[U]; pure fn mapi(f: fn(uint, T) -> U) -> ~[U]; - fn map_r(f: fn(x: &self.T) -> U) -> ~[U]; + fn map_r(f: fn(x: &T) -> U) -> ~[U]; pure fn alli(f: fn(uint, T) -> bool) -> bool; pure fn flat_map(f: fn(T) -> ~[U]) -> ~[U]; pure fn filter_map(f: fn(T) -> option) -> ~[U]; @@ -1422,7 +1422,7 @@ impl extensions/& of immutable_vector for &[T] { } #[inline] - fn map_r(f: fn(x: &self.T) -> U) -> ~[U] { + fn map_r(f: fn(x: &T) -> U) -> ~[U] { let mut r = ~[]; let mut i = 0; while i < self.len() { @@ -1570,7 +1570,7 @@ unsafe fn to_ptr_slice(v: &[const T]) -> *T { #[inline(always)] unsafe fn form_slice(p: *T, len: uint, f: fn(&& &[T]) -> U) -> U { let pair = (p, len * sys::size_of::()); - let v : *(&blk.[T]) = + let v : *(&blk/[T]) = ::unsafe::reinterpret_cast(ptr::addr_of(pair)); f(*v) } @@ -1638,12 +1638,13 @@ fn hash(&&s: ~[u8]) -> uint { // // This cannot be used with iter-trait.rs because of the region pointer // required in the slice. -impl extensions/& of iter::base_iter for &[const A] { + +impl extensions/& of iter::base_iter for &[A] { fn each(blk: fn(A) -> bool) { each(self, blk) } fn size_hint() -> option { some(len(self)) } } -impl extensions/& of iter::extended_iter for &[const A] { +impl extensions/& of iter::extended_iter for &[A] { fn eachi(blk: fn(uint, A) -> bool) { iter::eachi(self, blk) } fn all(blk: fn(A) -> bool) -> bool { iter::all(self, blk) } fn any(blk: fn(A) -> bool) -> bool { iter::any(self, blk) } @@ -1663,7 +1664,7 @@ trait iter_trait_extensions { fn max() -> A; } -impl extensions/& of iter_trait_extensions for &[const A] { +impl extensions/& of iter_trait_extensions for &[A] { fn filter_to_vec(pred: fn(A) -> bool) -> ~[A] { iter::filter_to_vec(self, pred) } diff --git a/src/test/run-pass/assignability-iface.rs b/src/test/run-pass/assignability-iface.rs index f65b06fcfe0284cea0fc09a3e6ffac27ec0853f0..b0d0f3074d0edb1686375bb4cefe1ba9ef63970f 100644 --- a/src/test/run-pass/assignability-iface.rs +++ b/src/test/run-pass/assignability-iface.rs @@ -6,13 +6,13 @@ fn iterate(blk: fn(A) -> bool); } -impl vec of iterable for &[const A] { +impl vec of iterable for &[A] { fn iterate(f: fn(A) -> bool) { vec::each(self, f); } } -impl vec of iterable for ~[const A] { +impl vec of iterable for ~[A] { fn iterate(f: fn(A) -> bool) { vec::each(self, f); }