Skip to content

Commit 537ccbe

Browse files
committed
Update existing tests
1 parent 1dd8216 commit 537ccbe

13 files changed

Lines changed: 28 additions & 28 deletions

tests/ub/out/refcount/dangling-prvalue-as-lvalue.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ fn main_0() -> i32 {
1717
let v: Value<Vec<i32>> = Rc::new(RefCell::new(vec![1, 2]));
1818
let b: Ptr<i32> = ({
1919
let _a: Ptr<i32> = (v.as_pointer() as Ptr<i32>);
20-
Rc::new(foo_0)(_a)
20+
foo_0(_a)
2121
});
2222
(*v.borrow_mut()).clear();
2323
return (b.read());

tests/ub/out/refcount/ub1.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ pub fn main() {
1616
std::process::exit(main_0());
1717
}
1818
fn main_0() -> i32 {
19-
let x: Ptr<i32> = ({ Rc::new(dangling_0)() });
19+
let x: Ptr<i32> = ({ dangling_0() });
2020
return (x.read());
2121
}

tests/ub/out/unsafe/dangling-prvalue-as-lvalue.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ unsafe fn main_0() -> i32 {
1919
let mut v: Vec<i32> = vec![1, 2];
2020
let b: *const i32 = (unsafe {
2121
let _a: *const i32 = &(*v.as_mut_ptr()) as *const i32;
22-
Rc::new(|a0| unsafe { foo_0(a0) })(_a)
22+
foo_0(_a)
2323
});
2424
v.clear();
2525
return (*b);

tests/ub/out/unsafe/ub1.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ pub fn main() {
1818
}
1919
}
2020
unsafe fn main_0() -> i32 {
21-
let x: *mut i32 = (unsafe { Rc::new(|| unsafe { dangling_0() })() });
21+
let x: *mut i32 = (unsafe { dangling_0() });
2222
return (*x);
2323
}

tests/unit/out/refcount/complex_function.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -133,11 +133,11 @@ fn main_0() -> i32 {
133133
let r1: Ptr<i32> = x1.as_pointer();
134134
let r2: Ptr<i32> = ({
135135
let _x: Ptr<i32> = x1.as_pointer();
136-
Rc::new(bar_2)(_x)
136+
bar_2(_x)
137137
});
138138
let r3: Ptr<i32> = ({
139139
let _x: Ptr<i32> = (r1).clone();
140-
Rc::new(bar_2)(_x)
140+
bar_2(_x)
141141
});
142142
let __rhs = (*x1.borrow());
143143
{
@@ -403,7 +403,7 @@ fn main_0() -> i32 {
403403
.deref())
404404
.v
405405
.as_pointer());
406-
Rc::new(ptr_1)(_x)
406+
ptr_1(_x)
407407
})
408408
.clone();
409409
let __tmp = __ptr.read() + 1;
@@ -436,7 +436,7 @@ fn main_0() -> i32 {
436436
.deref())
437437
.v
438438
.as_pointer());
439-
Rc::new(ptr_1)(_x)
439+
ptr_1(_x)
440440
});
441441
let ptr3: Value<Ptr<i32>> = Rc::new(RefCell::new(
442442
({
@@ -450,7 +450,7 @@ fn main_0() -> i32 {
450450
.deref())
451451
.v
452452
.as_pointer());
453-
Rc::new(ptr_1)(_x)
453+
ptr_1(_x)
454454
}),
455455
));
456456
let vptr: Value<i32> = Rc::new(RefCell::new(
@@ -481,7 +481,7 @@ fn main_0() -> i32 {
481481
.deref())
482482
.v
483483
.as_pointer();
484-
Rc::new(bar_2)(_x)
484+
bar_2(_x)
485485
}),
486486
));
487487
({
@@ -495,7 +495,7 @@ fn main_0() -> i32 {
495495
.deref())
496496
.v
497497
.as_pointer();
498-
Rc::new(bar_2)(_x)
498+
bar_2(_x)
499499
})
500500
.with_mut(|__v| __v.postfix_inc());
501501
return (((({

tests/unit/out/refcount/no_direct_callee.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ use std::rc::{Rc, Weak};
1010
pub fn test1_0() -> bool {
1111
return false;
1212
}
13-
pub fn test_1(fn_: Rc<dyn Fn() -> bool>) -> i32 {
14-
let fn_: Value<Rc<dyn Fn() -> bool>> = Rc::new(RefCell::new(fn_));
15-
if !({ (*fn_.borrow())() }) {
13+
pub fn test_1(fn_: FnPtr<fn() -> bool>) -> i32 {
14+
let fn_: Value<FnPtr<fn() -> bool>> = Rc::new(RefCell::new(fn_));
15+
if !({ (*(*fn_.borrow()))() }) {
1616
return 1;
1717
}
1818
return 0;
@@ -22,7 +22,7 @@ pub fn main() {
2222
}
2323
fn main_0() -> i32 {
2424
return ({
25-
let _fn: Rc<dyn Fn() -> bool> = Rc::new(test1_0);
25+
let _fn: FnPtr<fn() -> bool> = fn_ptr!(test1_0, fn() -> bool);
2626
test_1(_fn)
2727
});
2828
}

tests/unit/out/refcount/printfs.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ fn main_0() -> i32 {
4444
.to_c_string_iterator()
4545
.chain(std::iter::once(0))
4646
.collect::<Vec<u8>>();
47-
Rc::new(fn_0)(_v)
47+
fn_0(_v)
4848
})
4949
))
5050
.as_pointer() as Ptr<u8>)
@@ -53,7 +53,7 @@ fn main_0() -> i32 {
5353
"{}",
5454
(({
5555
let _v: Ptr<Vec<u8>> = s.as_pointer();
56-
Rc::new(fn2_1)(_v)
56+
fn2_1(_v)
5757
})
5858
.to_strong()
5959
.as_pointer() as Ptr<u8>)

tests/unit/out/refcount/prvalue-as-lvalue.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ fn main_0() -> i32 {
1818
let pa: Value<Ptr<i32>> = Rc::new(RefCell::new((a.as_pointer())));
1919
let b: Ptr<i32> = ({
2020
let _a: Ptr<i32> = (*pa.borrow()).clone();
21-
Rc::new(foo_0)(_a)
21+
foo_0(_a)
2222
});
2323
return (b.read());
2424
}

tests/unit/out/refcount/ref_calls.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ fn main_0() -> i32 {
2727
));
2828
let z: Ptr<i32> = ({
2929
let _x: Ptr<i32> = x.as_pointer();
30-
Rc::new(foo_1)(_x)
30+
foo_1(_x)
3131
});
3232
return {
3333
let _lhs = {

tests/unit/out/unsafe/complex_function.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,11 @@ unsafe fn main_0() -> i32 {
9090
let r1: *mut i32 = &mut x1 as *mut i32;
9191
let r2: *mut i32 = (unsafe {
9292
let _x: *mut i32 = &mut x1 as *mut i32;
93-
Rc::new(|a0| unsafe { bar_2(a0) })(_x)
93+
bar_2(_x)
9494
});
9595
let r3: *mut i32 = (unsafe {
9696
let _x: *mut i32 = r1;
97-
Rc::new(|a0| unsafe { bar_2(a0) })(_x)
97+
bar_2(_x)
9898
});
9999
(*r2) += x1;
100100
(*r3) += (*r1);
@@ -230,12 +230,12 @@ unsafe fn main_0() -> i32 {
230230
let mut pref: *mut i32 = (unsafe {
231231
let _x: *mut i32 =
232232
&mut (*(unsafe { (*(unsafe { (*(unsafe { d.get() })).get() })).get() })).v as *mut i32;
233-
Rc::new(|a0| unsafe { bar_2(a0) })(_x)
233+
bar_2(_x)
234234
});
235235
(*(unsafe {
236236
let _x: *mut i32 =
237237
&mut (*(unsafe { (*(unsafe { (*(unsafe { d.get() })).get() })).get() })).v as *mut i32;
238-
Rc::new(|a0| unsafe { bar_2(a0) })(_x)
238+
bar_2(_x)
239239
}))
240240
.postfix_inc();
241241
return (((*(unsafe {

0 commit comments

Comments
 (0)