Skip to content

Commit 28fa3ec

Browse files
committed
Delete tests parts containing mutable char ptr into string literals
1 parent ad7e8ea commit 28fa3ec

3 files changed

Lines changed: 0 additions & 71 deletions

File tree

tests/unit/out/refcount/string_literals.rs

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -16,36 +16,21 @@ pub fn main() {
1616
std::process::exit(main_0());
1717
}
1818
fn main_0() -> i32 {
19-
let mutable_strings: Value<Box<[Ptr<u8>]>> = Rc::new(RefCell::new(Box::new([
20-
Ptr::from_string_literal("a"),
21-
Ptr::from_string_literal("b"),
22-
Ptr::from_string_literal("c"),
23-
])));
2419
let immutable_strings: Value<Box<[Ptr<u8>]>> = Rc::new(RefCell::new(Box::new([
2520
Ptr::from_string_literal("a"),
2621
Ptr::from_string_literal("b"),
2722
Ptr::from_string_literal("c"),
2823
])));
29-
let mutable_string: Value<Ptr<u8>> = Rc::new(RefCell::new(Ptr::from_string_literal("hello")));
3024
let immutable_string: Value<Ptr<u8>> = Rc::new(RefCell::new(Ptr::from_string_literal("hello")));
3125
let mutable_string_arr: Value<Box<[u8]>> =
3226
Rc::new(RefCell::new(Box::<[u8]>::from(b"papanasi\0".as_slice())));
3327
let immutable_string_arr: Value<Box<[u8]>> =
3428
Rc::new(RefCell::new(Box::<[u8]>::from(b"papanasi\0".as_slice())));
35-
let mutable_empty: Value<Ptr<u8>> = Rc::new(RefCell::new(Ptr::from_string_literal("")));
3629
let immutable_empty: Value<Ptr<u8>> = Rc::new(RefCell::new(Ptr::from_string_literal("")));
3730
let mutable_empty_arr: Value<Box<[u8]>> =
3831
Rc::new(RefCell::new(Box::<[u8]>::from(b"\0".as_slice())));
3932
let immutable_empty_arr: Value<Box<[u8]>> =
4033
Rc::new(RefCell::new(Box::<[u8]>::from(b"\0".as_slice())));
41-
({
42-
let _str: Ptr<u8> = Ptr::from_string_literal("world");
43-
foo_mut_0(_str)
44-
});
45-
({
46-
let _str: Ptr<u8> = (*mutable_string.borrow()).clone();
47-
foo_mut_0(_str)
48-
});
4934
({
5035
let _str: Ptr<u8> = (mutable_string_arr.as_pointer() as Ptr<u8>);
5136
foo_mut_0(_str)
@@ -54,18 +39,10 @@ fn main_0() -> i32 {
5439
let _str: Ptr<u8> = Ptr::from_string_literal("world");
5540
foo_const_1(_str)
5641
});
57-
({
58-
let _str: Ptr<u8> = (*mutable_string.borrow()).clone();
59-
foo_const_1(_str)
60-
});
6142
({
6243
let _str: Ptr<u8> = (*immutable_string.borrow()).clone();
6344
foo_const_1(_str)
6445
});
65-
({
66-
let _str: Ptr<u8> = (mutable_string_arr.as_pointer() as Ptr<u8>);
67-
foo_const_1(_str)
68-
});
6946
({
7047
let _str: Ptr<u8> = (immutable_string_arr.as_pointer() as Ptr<u8>);
7148
foo_const_1(_str)
@@ -74,18 +51,10 @@ fn main_0() -> i32 {
7451
let _str: Ptr<u8> = Ptr::from_string_literal("");
7552
foo_const_1(_str)
7653
});
77-
({
78-
let _str: Ptr<u8> = (*mutable_empty.borrow()).clone();
79-
foo_const_1(_str)
80-
});
8154
({
8255
let _str: Ptr<u8> = (*immutable_empty.borrow()).clone();
8356
foo_const_1(_str)
8457
});
85-
({
86-
let _str: Ptr<u8> = (mutable_empty_arr.as_pointer() as Ptr<u8>);
87-
foo_const_1(_str)
88-
});
8958
({
9059
let _str: Ptr<u8> = (immutable_empty_arr.as_pointer() as Ptr<u8>);
9160
foo_const_1(_str)

tests/unit/out/unsafe/string_literals.rs

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -14,28 +14,13 @@ pub fn main() {
1414
}
1515
}
1616
unsafe fn main_0() -> i32 {
17-
let mut mutable_strings: [*mut u8; 3] = [
18-
b"a\0".as_ptr().cast_mut(),
19-
b"b\0".as_ptr().cast_mut(),
20-
b"c\0".as_ptr().cast_mut(),
21-
];
2217
let mut immutable_strings: [*const u8; 3] = [b"a\0".as_ptr(), b"b\0".as_ptr(), b"c\0".as_ptr()];
23-
let mut mutable_string: *mut u8 = b"hello\0".as_ptr().cast_mut();
2418
let mut immutable_string: *const u8 = b"hello\0".as_ptr();
2519
let mut mutable_string_arr: [u8; 9] = *b"papanasi\0";
2620
let immutable_string_arr: [u8; 9] = *b"papanasi\0";
27-
let mut mutable_empty: *mut u8 = b"\0".as_ptr().cast_mut();
2821
let mut immutable_empty: *const u8 = b"\0".as_ptr();
2922
let mut mutable_empty_arr: [u8; 1] = *b"\0";
3023
let immutable_empty_arr: [u8; 1] = *b"\0";
31-
(unsafe {
32-
let _str: *mut u8 = b"world\0".as_ptr().cast_mut();
33-
foo_mut_0(_str)
34-
});
35-
(unsafe {
36-
let _str: *mut u8 = mutable_string;
37-
foo_mut_0(_str)
38-
});
3924
(unsafe {
4025
let _str: *mut u8 = mutable_string_arr.as_mut_ptr();
4126
foo_mut_0(_str)
@@ -44,18 +29,10 @@ unsafe fn main_0() -> i32 {
4429
let _str: *const u8 = b"world\0".as_ptr();
4530
foo_const_1(_str)
4631
});
47-
(unsafe {
48-
let _str: *const u8 = mutable_string.cast_const();
49-
foo_const_1(_str)
50-
});
5132
(unsafe {
5233
let _str: *const u8 = immutable_string;
5334
foo_const_1(_str)
5435
});
55-
(unsafe {
56-
let _str: *const u8 = mutable_string_arr.as_mut_ptr().cast_const();
57-
foo_const_1(_str)
58-
});
5936
(unsafe {
6037
let _str: *const u8 = immutable_string_arr.as_ptr();
6138
foo_const_1(_str)
@@ -64,18 +41,10 @@ unsafe fn main_0() -> i32 {
6441
let _str: *const u8 = b"\0".as_ptr();
6542
foo_const_1(_str)
6643
});
67-
(unsafe {
68-
let _str: *const u8 = mutable_empty.cast_const();
69-
foo_const_1(_str)
70-
});
7144
(unsafe {
7245
let _str: *const u8 = immutable_empty;
7346
foo_const_1(_str)
7447
});
75-
(unsafe {
76-
let _str: *const u8 = mutable_empty_arr.as_mut_ptr().cast_const();
77-
foo_const_1(_str)
78-
});
7948
(unsafe {
8049
let _str: *const u8 = immutable_empty_arr.as_ptr();
8150
foo_const_1(_str)

tests/unit/string_literals.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,25 @@ void foo_mut(char *str) {}
22
void foo_const(const char *str) {}
33

44
int main() {
5-
char *mutable_strings[] = {"a", "b", "c"};
65
const char *immutable_strings[] = {"a", "b", "c"};
76

8-
char *mutable_string = "hello";
97
const char *immutable_string = "hello";
108

119
char mutable_string_arr[] = "papanasi";
1210
const char immutable_string_arr[] = "papanasi";
1311

14-
char *mutable_empty = "";
1512
const char *immutable_empty = "";
1613
char mutable_empty_arr[] = "";
1714
const char immutable_empty_arr[] = "";
1815

19-
foo_mut("world");
20-
foo_mut(mutable_string);
2116
foo_mut(mutable_string_arr);
2217

2318
foo_const("world");
24-
foo_const(mutable_string);
2519
foo_const(immutable_string);
26-
foo_const(mutable_string_arr);
2720
foo_const(immutable_string_arr);
2821

2922
foo_const("");
30-
foo_const(mutable_empty);
3123
foo_const(immutable_empty);
32-
foo_const(mutable_empty_arr);
3324
foo_const(immutable_empty_arr);
3425
return 0;
3526
}

0 commit comments

Comments
 (0)