Skip to content

Commit d6efbad

Browse files
committed
Mark c_vec functions as unsafe again
1 parent 270b508 commit d6efbad

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/libstd/c_vec.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ fn DtorRes(dtor: Option<@fn()>) -> DtorRes {
7878
* * base - A foreign pointer to a buffer
7979
* * len - The number of elements in the buffer
8080
*/
81-
pub fn CVec<T>(base: *mut T, len: uint) -> CVec<T> {
81+
pub unsafe fn CVec<T>(base: *mut T, len: uint) -> CVec<T> {
8282
return CVec{
8383
base: base,
8484
len: len,
@@ -97,7 +97,7 @@ pub fn CVec<T>(base: *mut T, len: uint) -> CVec<T> {
9797
* * dtor - A function to run when the value is destructed, useful
9898
* for freeing the buffer, etc.
9999
*/
100-
pub fn c_vec_with_dtor<T>(base: *mut T, len: uint, dtor: @fn())
100+
pub unsafe fn c_vec_with_dtor<T>(base: *mut T, len: uint, dtor: @fn())
101101
-> CVec<T> {
102102
return CVec{
103103
base: base,
@@ -138,7 +138,7 @@ pub fn set<T:Copy>(t: CVec<T>, ofs: uint, v: T) {
138138
pub fn len<T>(t: CVec<T>) -> uint { t.len }
139139

140140
/// Returns a pointer to the first element of the vector
141-
pub fn ptr<T>(t: CVec<T>) -> *mut T { t.base }
141+
pub unsafe fn ptr<T>(t: CVec<T>) -> *mut T { t.base }
142142

143143
#[cfg(test)]
144144
mod tests {
@@ -191,7 +191,7 @@ mod tests {
191191
#[test]
192192
fn test_and_I_mean_it() {
193193
let cv = malloc(16u as size_t);
194-
let p = ptr(cv);
194+
let p = unsafe { ptr(cv) };
195195

196196
set(cv, 0u, 32u8);
197197
set(cv, 1u, 33u8);

0 commit comments

Comments
 (0)