Skip to content

Commit b91c9f8

Browse files
committed
simplify typing rule for vector addition: use mutability of LHS
1 parent 79cbdba commit b91c9f8

File tree

6 files changed

+516
-15
lines changed

6 files changed

+516
-15
lines changed

src/libcore/os.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -849,7 +849,7 @@ mod tests {
849849
};
850850
assert (ostream as uint != 0u);
851851
let s = "hello";
852-
let mut buf = str::bytes(s) + [0 as u8];
852+
let mut buf = vec::to_mut(str::bytes(s) + [0 as u8]);
853853
vec::as_mut_buf(buf) {|b|
854854
assert (libc::fwrite(b as *c_void, 1u, str::len(s) + 1u, ostream) ==
855855
buf.len())};

src/libcore/str.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1658,7 +1658,7 @@ mod unsafe {
16581658
Does not verify that the vector contains valid UTF-8.
16591659
"]
16601660
unsafe fn from_bytes(v: [const u8]) -> str unsafe {
1661-
let mut vcopy: [u8] = v + [0u8];
1661+
let vcopy = v + [0u8];
16621662
let scopy: str = ::unsafe::reinterpret_cast(vcopy);
16631663
::unsafe::forget(vcopy);
16641664
ret scopy;

0 commit comments

Comments
 (0)