cli: validate Copy content of source owning arrays
This commit is contained in:
1 parent
caf3b86e80
commit
cfbe01a16f
42 files changed
+608
-3
No files matched your search
@@ -0,0 +1,9 @@
|
||||
// expect: run
|
||||
// result: 42
|
||||
// grant: heap=mem.alloc:4096
|
||||
// phase: 6
|
||||
// spec: docs/spec/15-source-language.md §10; docs/spec/03-memory-model.md §25
|
||||
module test.own_array_content
|
||||
struct Plain { item: u64 }
|
||||
fn make<T: Copy>(value: T, heap: cap<mem.alloc>) -> own_array<T> effects [mem.alloc] { return own.array(2, move value, heap) or trap; }
|
||||
fn main(heap: cap<mem.alloc>) -> u64 effects [mem.alloc] { let values = make::<Plain>(Plain { item: 21u64 }, heap); let n = { ref items = values; items[0].item + items[1].item }; own.free(move values); return n; }
|
||||
Reference in new issue
Block a user