Skip to content

Commit e5356d0

Browse files
committed
Update tests
1 parent 503ea51 commit e5356d0

12 files changed

Lines changed: 22 additions & 33 deletions

tests/unit/out/refcount/empty_main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use std::rc::{Rc, Weak};
99

1010
pub fn main() {
1111
let argv: Vec<Value<Vec<u8>>> = ::std::env::args()
12-
.map(|x| Rc::new(RefCell::new(x.bytes().collect())))
12+
.map(|x| Rc::new(RefCell::new(x.as_bytes().to_vec())))
1313
.collect();
1414
let mut argv: Value<Vec<Ptr<u8>>> = Rc::new(RefCell::new(
1515
argv.iter()

tests/unit/out/refcount/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use std::rc::{Rc, Weak};
99

1010
pub fn main() {
1111
let argv: Vec<Value<Vec<u8>>> = ::std::env::args()
12-
.map(|x| Rc::new(RefCell::new(x.bytes().collect())))
12+
.map(|x| Rc::new(RefCell::new(x.as_bytes().to_vec())))
1313
.collect();
1414
let mut argv: Value<Vec<Ptr<u8>>> = Rc::new(RefCell::new(
1515
argv.iter()

tests/unit/out/refcount/stdcopy_ostream.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,7 @@ fn main_0() -> i32 {
2424
{
2525
(*ofs.borrow_mut()).write_all(
2626
(str.as_pointer() as Ptr<u8>)
27-
.reinterpret_cast::<u8>()
28-
.slice_until(
29-
&(str.as_pointer() as Ptr<u8>)
30-
.to_last()
31-
.reinterpret_cast::<u8>(),
32-
)
27+
.slice_until(&(str.as_pointer() as Ptr<u8>).to_last())
3328
.as_slice(),
3429
);
3530
(*ofs.borrow_mut()).try_clone().unwrap()

tests/unit/out/unsafe/cstring.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write};
77
use std::os::fd::{AsFd, FromRawFd, IntoRawFd};
88
use std::rc::Rc;
99
pub unsafe fn test_memcpy_0() {
10-
let src: [libc::c_char; 6] = unsafe { ::std::mem::transmute(*b"hello\0") };
10+
let src: [libc::c_char; 6] = std::mem::transmute(*b"hello\0");
1111
let mut dst: [libc::c_char; 6] = [
1212
(0 as libc::c_char),
1313
(0 as libc::c_char),

tests/unit/out/unsafe/stdcopy_ostream.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ unsafe fn main_0() -> i32 {
1616
let s = c"Hello, world!\n".as_ptr();
1717
std::slice::from_raw_parts(s, (0..).take_while(|&i| *s.add(i) != 0).count() + 1).to_vec()
1818
};
19-
let file: [libc::c_char; 25] = unsafe { ::std::mem::transmute(*b"test_stdcopy_ostream.txt\0") };
19+
let file: [libc::c_char; 25] = std::mem::transmute(*b"test_stdcopy_ostream.txt\0");
2020
let mut ofs: ::std::fs::File =
2121
::std::fs::File::create(::std::ffi::CStr::from_ptr(file.as_ptr()).to_str().unwrap())
2222
.unwrap();

tests/unit/out/unsafe/string_h.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use std::io::{Read, Seek, Write};
77
use std::os::fd::{AsFd, FromRawFd, IntoRawFd};
88
use std::rc::Rc;
99
pub unsafe fn test_memcpy_0() {
10-
let src: [libc::c_char; 6] = unsafe { ::std::mem::transmute(*b"hello\0") };
10+
let src: [libc::c_char; 6] = std::mem::transmute(*b"hello\0");
1111
let mut dst: [libc::c_char; 6] = [
1212
(0 as libc::c_char),
1313
(0 as libc::c_char),

tests/unit/out/unsafe/string_literals.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,8 @@ unsafe fn main_0() -> i32 {
1717
let mut immutable_strings: [*const libc::c_char; 3] =
1818
[c"a".as_ptr(), c"b".as_ptr(), c"c".as_ptr()];
1919
let mut immutable_string: *const libc::c_char = c"hello".as_ptr();
20-
let mut mutable_string_arr: [libc::c_char; 9] =
21-
unsafe { ::std::mem::transmute(*b"papanasi\0") };
22-
let immutable_string_arr: [libc::c_char; 9] = unsafe { ::std::mem::transmute(*b"papanasi\0") };
20+
let mut mutable_string_arr: [libc::c_char; 9] = std::mem::transmute(*b"papanasi\0");
21+
let immutable_string_arr: [libc::c_char; 9] = std::mem::transmute(*b"papanasi\0");
2322
let mut immutable_empty: *const libc::c_char = c"".as_ptr();
2423
let mut mutable_empty_arr: [libc::c_char; 1] = [0 as libc::c_char; 1];
2524
let immutable_empty_arr: [libc::c_char; 1] = [0 as libc::c_char; 1];
@@ -31,7 +30,7 @@ unsafe fn main_0() -> i32 {
3130
(unsafe { foo_const_1(immutable_empty) });
3231
(unsafe { foo_const_1(immutable_empty_arr.as_ptr()) });
3332
let inited_through_init_list: [libc::c_char; 21] =
34-
unsafe { ::std::mem::transmute(*b"papanasi cu smantana\0") };
33+
std::mem::transmute(*b"papanasi cu smantana\0");
3534
(unsafe { foo_const_1(inited_through_init_list.as_ptr()) });
3635
return 0;
3736
}

tests/unit/out/unsafe/string_literals_c.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,8 @@ unsafe fn main_0() -> i32 {
2626
];
2727
let mut mutable_string: *mut libc::c_char = c"hello".as_ptr().cast_mut();
2828
let mut immutable_string: *const libc::c_char = (c"hello".as_ptr().cast_mut()).cast_const();
29-
let mut mutable_string_arr: [libc::c_char; 9] =
30-
unsafe { ::std::mem::transmute(*b"papanasi\0") };
31-
let immutable_string_arr: [libc::c_char; 9] = unsafe { ::std::mem::transmute(*b"papanasi\0") };
29+
let mut mutable_string_arr: [libc::c_char; 9] = std::mem::transmute(*b"papanasi\0");
30+
let immutable_string_arr: [libc::c_char; 9] = std::mem::transmute(*b"papanasi\0");
3231
let mut mutable_empty: *mut libc::c_char = c"".as_ptr().cast_mut();
3332
let mut immutable_empty: *const libc::c_char = (c"".as_ptr().cast_mut()).cast_const();
3433
let mut mutable_empty_arr: [libc::c_char; 1] = [0 as libc::c_char; 1];
@@ -47,7 +46,7 @@ unsafe fn main_0() -> i32 {
4746
(unsafe { foo_const_1((mutable_empty_arr.as_mut_ptr()).cast_const()) });
4847
(unsafe { foo_const_1(immutable_empty_arr.as_ptr()) });
4948
let inited_through_init_list: [libc::c_char; 21] =
50-
unsafe { ::std::mem::transmute(*b"papanasi cu smantana\0") };
49+
std::mem::transmute(*b"papanasi cu smantana\0");
5150
(unsafe { foo_const_1(inited_through_init_list.as_ptr()) });
5251
return 0;
5352
}

tests/unit/out/unsafe/string_literals_concat.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ unsafe fn main_0() -> i32 {
1616
assert!((((*joined.offset((0) as isize)) as i32) == (('a' as libc::c_char) as i32)));
1717
assert!((((*joined.offset((5) as isize)) as i32) == (('\n' as libc::c_char) as i32)));
1818
assert!((((*joined.offset((6) as isize)) as i32) == (('b' as libc::c_char) as i32)));
19-
let mut arr: [libc::c_char; 7] = unsafe { ::std::mem::transmute(*b"foobar\0") };
19+
let mut arr: [libc::c_char; 7] = std::mem::transmute(*b"foobar\0");
2020
assert!(((arr[(0) as usize] as i32) == (('f' as libc::c_char) as i32)));
2121
assert!(((arr[(3) as usize] as i32) == (('b' as libc::c_char) as i32)));
2222
assert!(((arr[(5) as usize] as i32) == (('r' as libc::c_char) as i32)));

tests/unit/out/unsafe/string_literals_concat_c.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ pub fn main() {
1212
}
1313
}
1414
unsafe fn main_0() -> i32 {
15-
let mut arr: [libc::c_char; 7] = unsafe { ::std::mem::transmute(*b"foobar\0") };
15+
let mut arr: [libc::c_char; 7] = std::mem::transmute(*b"foobar\0");
1616
assert!(((((arr[(0) as usize] as i32) == ('f' as i32)) as i32) != 0));
1717
assert!(((((arr[(3) as usize] as i32) == ('b' as i32)) as i32) != 0));
1818
assert!(((((arr[(5) as usize] as i32) == ('r' as i32)) as i32) != 0));

0 commit comments

Comments
 (0)