tests: inventory and verify source rejection twins

This commit is contained in:
dev committed 2026-10-08 18:01:58 +03:00
1 parent 09fbf8a5bc
commit e4aacef48c
28 files changed
+1092 -8

No files matched your search

@@ -0,0 +1,13 @@
// expect: reject E2002
// phase: 6
// spec: docs/spec/03-memory-model.md §24
// AIR twin: phase4/reject/arc_release_twice.air
module test.twins.arc_release_twice
fn main(heap: cap<mem.alloc>) -> void effects [mem.alloc] {
let i = island.create(1u64, heap) or trap;
let f = island.freeze(move i);
let a = arc.from_frozen(move f);
arc.release(move a);
arc.release(move a); // diagnostic here: arc.release
}
@@ -0,0 +1,12 @@
// expect: reject E4201
// phase: 6
// spec: docs/spec/04-concurrency-and-atomics.md
// AIR twin: phase5/reject/cmpxchg_failure_release.air
// The historical AIR filename says release; its rejected failure order is acq_rel.
module test.twins.cmpxchg_failure_acq_rel
fn main() -> void effects [atomic, atomic.weak] {
let c = atomic.new(1u64);
let (old, changed) = atomic.compare_exchange(ref c, 1u64, 2u64, acq_rel, acq_rel); // diagnostic here: let
let n = atomic.take(move c);
}
@@ -0,0 +1,9 @@
// expect: reject E4201
// phase: 6
// spec: docs/spec/04-concurrency-and-atomics.md
// AIR twin: phase5/reject/fence_relaxed.air
module test.twins.fence_relaxed
fn main() -> void effects [atomic, atomic.weak] {
atomic.fence(relaxed); // diagnostic here: atomic.fence
}
@@ -0,0 +1,16 @@
// expect: reject E5101
// phase: 6
// spec: docs/spec/08-verifier.md §3
// AIR twin: phase1/reject/frame_too_large.air
module test.twins.frame_too_large
fn unused() -> void effects [] { // diagnostic here: fn unused
var a: [u8; 409600] = zero;
var b: [u8; 409600] = zero;
var c: [u8; 409600] = zero;
ref av = a;
ref bv = b;
ref cv = c;
}
fn main() -> void effects [] {}
@@ -0,0 +1,11 @@
// expect: reject E3002
// phase: 6
// spec: docs/spec/03-memory-model.md §23
// AIR twin: phase4/reject/frozen_leak.air
module test.twins.frozen_leak
fn main(heap: cap<mem.alloc>) -> void effects [mem.alloc] {
let i = island.create(1u64, heap) or trap;
let f = island.freeze(move i);
return; // diagnostic here: return
}
@@ -0,0 +1,14 @@
// expect: reject E2001
// phase: 6
// spec: docs/spec/03-memory-model.md §23
// AIR twin: phase4/reject/island_use_after_freeze.air
module test.twins.island_use_after_freeze
fn main(heap: cap<mem.alloc>) -> void effects [mem.alloc] {
let i = island.create(1u64, heap) or trap;
let f = island.freeze(move i);
{
ref view = i; // diagnostic here: ref
}
frozen.release(move f);
}
@@ -0,0 +1,11 @@
// expect: reject E4201
// phase: 6
// spec: docs/spec/04-concurrency-and-atomics.md
// AIR twin: phase5/reject/load_release.air
module test.twins.load_release
fn main() -> void effects [atomic, atomic.weak] {
let c = atomic.new(1u64);
atomic.load(ref c, release); // diagnostic here: atomic.load
let n = atomic.take(move c);
}
@@ -0,0 +1,10 @@
// expect: reject E3002
// phase: 6
// spec: docs/spec/03-memory-model.md §8
// AIR twin: phase2/reject/region_leak.air
module test.twins.region_leak
fn main(heap: cap<mem.alloc>) -> void effects [mem.alloc] {
let r = region.create(heap) or trap;
return; // diagnostic here: return
}
@@ -0,0 +1,9 @@
// expect: reject E5101
// phase: 6
// spec: docs/spec/08-verifier.md §3
// AIR twin: phase1/reject/size_overflow.air
module test.twins.size_overflow
fn unused(data: [[u64; 4294967296]; 4294967296]) -> void effects [] {} // diagnostic here: fn unused
fn main() -> void effects [] {}
@@ -0,0 +1,11 @@
// expect: reject E4201
// phase: 6
// spec: docs/spec/04-concurrency-and-atomics.md
// AIR twin: phase5/reject/store_acquire.air
module test.twins.store_acquire
fn main() -> void effects [atomic, atomic.weak] {
let c = atomic.new(1u64);
atomic.store(ref c, 2u64, acquire); // diagnostic here: atomic.store
let n = atomic.take(move c);
}
@@ -0,0 +1,11 @@
// expect: reject E2101
// phase: 6
// spec: docs/spec/04-concurrency-and-atomics.md
// AIR twin: phase5/reject/take_while_borrowed.air
module test.twins.take_while_borrowed
fn main() -> void effects [atomic] {
let c = atomic.new(1u64);
ref view = c;
let n = atomic.take(move c); // diagnostic here: atomic.take
}
@@ -0,0 +1,9 @@
// expect: reject E5101
// phase: 6
// spec: docs/spec/08-verifier.md §3
// AIR twin: phase0/reject/too_many_params.air
module test.twins.too_many_params
fn unused(x0: u64, x1: u64, x2: u64, x3: u64, x4: u64, x5: u64, x6: u64, x7: u64, x8: u64, x9: u64, x10: u64, x11: u64, x12: u64, x13: u64, x14: u64, x15: u64, x16: u64, x17: u64, x18: u64, x19: u64, x20: u64, x21: u64, x22: u64, x23: u64, x24: u64, x25: u64, x26: u64, x27: u64, x28: u64, x29: u64, x30: u64, x31: u64, x32: u64, x33: u64, x34: u64, x35: u64, x36: u64, x37: u64, x38: u64, x39: u64, x40: u64, x41: u64, x42: u64, x43: u64, x44: u64, x45: u64, x46: u64, x47: u64, x48: u64, x49: u64, x50: u64, x51: u64, x52: u64, x53: u64, x54: u64, x55: u64, x56: u64, x57: u64, x58: u64, x59: u64, x60: u64, x61: u64, x62: u64, x63: u64, x64: u64) -> void effects [] {} // diagnostic here: fn unused
fn main() -> void effects [] {}
@@ -0,0 +1,9 @@
// expect: reject E5101
// phase: 6
// spec: docs/spec/08-verifier.md §3
// AIR twin: phase1/reject/value_too_large.air
module test.twins.value_too_large
fn unused(data: [u8; 1048577]) -> void effects [] {} // diagnostic here: fn unused
fn main() -> void effects [] {}