Files
wehub-resource-sync e7738de6d2
CI / Deep Native Runtime Cases (1/6) (push) Has been skipped
CI / Native Preflight (push) Failing after 1s
CI / Native Runtime Cases (1/2) (push) Failing after 0s
CI / Native Runtime Cases (2/2) (push) Failing after 1s
CI / Native Metadata Reports (push) Failing after 0s
CI / Native Direct Backend Artifacts (push) Failing after 0s
CI / Native Sanitizer Smoke (push) Failing after 1s
CI / Command Contract Snapshots (push) Failing after 1s
CI / Deep Conformance Suite (push) Has been skipped
CI / Graph Build Perf (push) Failing after 1s
CI / Deep Native Preflight (push) Has been skipped
CI / Deep Native Runtime Cases (2/6) (push) Has been skipped
CI / Deep Native Runtime Cases (3/6) (push) Has been skipped
CI / Conformance Suite (push) Failing after 1s
CI / Workspace Checks (push) Failing after 0s
CI / Deep Native Runtime Cases (5/6) (push) Has been skipped
CI / Deep Native Runtime Cases (6/6) (push) Has been skipped
CI / Deep Native Runtime Cases (4/6) (push) Has been skipped
CI / Deep Graph Build Perf (push) Has been skipped
chore: import upstream snapshot with attribution
2026-07-13 12:29:30 +08:00

56 lines
1.2 KiB
Plaintext

type Stats {
count: u32,
total: i64,
flag: Bool,
bytes: [8]u8,
}
type Box<T: Type> {
item: T,
extra: u32,
}
fn inner(s: mutref<Stats>) -> Void {
s.count = s.count + 1_u32
s.total = s.total + 10
}
fn fill(s: mutref<Stats>) -> usize {
return std.mem.copy(s.bytes, std.mem.span("zero"))
}
fn outer(s: mutref<Stats>) -> Void {
inner(s)
s.flag = true
}
fn bumpBox<T: Type>(b: mutref<Box<T>>) -> Void {
b.extra = b.extra + 1_u32
}
pub fn main(world: World) -> Void raises {
var st: Stats = Stats { count: 1_u32, total: 5, flag: false, bytes: [0_u8; 8] }
outer(&mut st)
let copied: usize = fill(&mut st)
if st.count == 2_u32 {
check world.out.write("nested count ok\n")
}
if st.total == 15 {
check world.out.write("nested total ok\n")
}
if st.flag {
check world.out.write("nested flag ok\n")
}
if copied == 4 {
check world.out.write("nested copy ok\n")
}
if st.bytes[1] == 101_u8 {
check world.out.write("nested bytes ok\n")
}
var bi: Box<i32> = Box { item: 5, extra: 1_u32 }
bumpBox<i32>(&mut bi)
if bi.extra == 2_u32 {
check world.out.write("generic mutref ok\n")
}
}