Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions rules/array/tgt_refcount.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ fn f1<T1>(a0: Ptr<T1>) -> Ptr<T1> {
a0
}

fn f2<T1, const T2: usize>(a0: Ptr<T1>) -> usize {
T2
}

fn f3<T1>(a0: Ptr<T1>) -> Ptr<T1> {
a0
}
Expand All @@ -35,6 +39,10 @@ fn f5<T1: MoveAssign, const T2: usize>(a0: Ptr<T1>, a1: Ptr<T1>) {
}
}

fn f6<T1: Clone + ByteRepr, const T2: usize>(a0: Ptr<T1>) -> Box<[T1]> {
(0..T2).map(|__i| a0.read_at(__i)).collect()
}

fn f7<T1: CopyAssign, const T2: usize>(a0: Ptr<T1>, a1: Ptr<T1>) {
for __i in 0..T2 {
T1::copy_assign(&a0.offset(__i), a1.offset(__i));
Expand Down
1 change: 1 addition & 0 deletions tests/unit/inline_container_fields.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ int main() {
assert(moves == 3 && copies == 0 && cb[1].v == 5 && ca[1].v == -1);
std::array<Counted, 3> cc(cb);
assert(copies == 3 && cc[1].v == 5 && cb[1].v == 5);
assert(cc.size() == 3);
cc[2].v = 8;
cb = cc;
assert(copy_assigns == 3 && move_assigns == 0 && cb[2].v == 8);
Expand Down
5 changes: 4 additions & 1 deletion tests/unit/out/refcount/inline_container_fields.rs
Original file line number Diff line number Diff line change
Expand Up @@ -366,13 +366,16 @@ fn main_0() -> i32 {
&& ({ (*ca.borrow())[1_usize].v } == -1_i32)
})
);
let cc: Value<Box<[Counted]>> = Rc::new(RefCell::new((*cb.borrow()).clone()));
let cc: Value<Box<[Counted]>> = Rc::new(RefCell::new(
(0..3).map(|__i| cb.decay().read_at(__i)).collect(),
));
assert!(
({
((copies_2.with(|rc| *rc.borrow()) == 3) && ({ (*cc.borrow())[1_usize].v } == 5))
&& ({ (*cb.borrow())[1_usize].v } == 5)
})
);
assert!((3 == 3_usize));
(*cc.borrow_mut())[2_usize].v = 8;
for __i in 0..3 {
&cb.decay().offset(__i).copy_assign(cc.decay().offset(__i));
Expand Down
1 change: 1 addition & 0 deletions tests/unit/out/unsafe/inline_container_fields.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ unsafe fn main_0() -> i32 {
&& ((cc[(1_usize)].v) == (5)))
&& ((cb[(1_usize)].v) == (5))
);
assert!(((3) == (3_usize)));
cc[(2_usize)].v = 8;
for __i in 0..3 {
(*&mut cb[__i]).copy_assign(&cc[__i]);
Expand Down
Loading