convert a few tests from unsafe fns to fns with unsafe bodies
This commit is contained in:
parent
9f9deff7af
commit
70164739e8
@ -256,7 +256,7 @@ fn unsafe_from_bytes() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
unsafe fn str_from_cstr() {
|
||||
fn str_from_cstr() unsafe {
|
||||
let a = [65u8, 65u8, 65u8, 65u8, 65u8, 65u8, 65u8, 0u8];
|
||||
let b = vec::to_ptr(a);
|
||||
let c = str::str_from_cstr(b);
|
||||
@ -278,7 +278,7 @@ fn as_buf_small() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
unsafe fn as_buf2() {
|
||||
fn as_buf2() unsafe {
|
||||
let s = "hello";
|
||||
let sb = str::as_buf(s, {|b| b });
|
||||
let s_cstr = str::str_from_cstr(sb);
|
||||
|
@ -21,7 +21,7 @@ fn square_if_odd(&&n: uint) -> option::t<uint> {
|
||||
fn add(&&x: uint, &&y: uint) -> uint { ret x + y; }
|
||||
|
||||
#[test]
|
||||
unsafe fn test_unsafe_ptrs() {
|
||||
fn test_unsafe_ptrs() unsafe {
|
||||
// Test on-stack copy-from-buf.
|
||||
let a = [1, 2, 3];
|
||||
let ptr = vec::to_ptr(a);
|
||||
|
Loading…
x
Reference in New Issue
Block a user