Skip to content

vec: take [mutable? T] instead of [T] #1132

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/lib/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -796,7 +796,7 @@ mod unsafe {
modifing its buffers, so it is up to the caller to ensure that
the vector is actually the specified size.
*/
unsafe fn set_len<T>(&v: [T], new_len: uint) {
unsafe fn set_len<T>(&v: [mutable? T], new_len: uint) {
let repr: **vec_repr = ::unsafe::reinterpret_cast(addr_of(v));
(**repr).fill = new_len * sys::size_of::<T>();
}
Expand All @@ -812,7 +812,7 @@ mod unsafe {
Modifying the vector may cause its buffer to be reallocated, which
would also make any pointers to it invalid.
*/
unsafe fn to_ptr<T>(v: [T]) -> *T {
unsafe fn to_ptr<T>(v: [mutable? T]) -> *T {
let repr: **vec_repr = ::unsafe::reinterpret_cast(addr_of(v));
ret ::unsafe::reinterpret_cast(addr_of((**repr).data));
}
Expand Down