MCPcopy Create free account
hub / github.com/LPC4/Full-Stack / my_kernel_example_program

Function my_kernel_example_program

tests/integration/platform_stdlib.rs:583–600  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

581fn hosted_vec_copy_aliases_allocation() {
582 let (_, exit) = run_hll(
583 r#"
584alloc := import("alloc")
585vec := import("vec")
586owned := import("owned_string")
587arena := import("arena")
588pool := import("pool")
589
590main: () -> i32 {
591 v: vec.Vec<i64> = { .ptr = null, .len = 0, .capacity = 0 }
592 vec.Vec_init<i64>(&v)
593 pushed := vec.Vec_push<i64>(&v, 41)
594 match pushed {
595 Ok(len) -> {}
596 Err(error) -> { return 1 }
597 }
598
599 ; Copying the container copies its fields; both alias one allocation.
600 alias: vec.Vec<i64> = v
601 slot: i64* = vec.Vec_get<i64>(&alias, 0)
602 @slot = 42
603 original: i64* = vec.Vec_get<i64>(&v, 0)

Callers

nothing calls this directly

Calls 1

run_kernel_hllFunction · 0.70

Tested by

no test coverage detected