core: str::as_slice is unneeded, yay! fixes std::net::tcp socket_buf test

i mistook an "unconstrained type" error, due to type-inference messup
because i didnt have return vals in some closure wired-up right, for being
due to not having a str as a str/& (a str will actually auto-coerce to a
str/&, so str::as_slice was erroneously added. my bad).
This commit is contained in:
Jeff Olson
2012-06-10 08:30:43 -07:00
committed by Brian Anderson
parent 942d3b527e
commit 708b5d986e
2 changed files with 5 additions and 18 deletions

View File

@@ -23,7 +23,6 @@ export
as_buf,
as_c_str,
unpack_slice,
as_slice,
// Adding things to and removing things from a string
push_char,
@@ -1621,16 +1620,6 @@ pure fn unpack_slice<T>(s: str/&, f: fn(*u8, uint) -> T) -> T {
}
}
pure fn as_slice<T>(s: str,
start: uint, end: uint,
f: fn(str/&) -> T) -> T unsafe {
assert (start <= end);
assert (end <= len(s));
let p = ptr::addr_of(s);
f(::unsafe::reinterpret_cast(
(ptr::offset(p, start), (end - start) * sys::size_of::<u8>())))
}
#[doc = "
Reserves capacity for exactly `n` bytes in the given string, not including
the null terminator.