cli: add explicit built-in error values
Add the error_values feature and error.const through specification, AIR, verification, interpretation and source lowering. Error values are Copy data with no allocation, effects or authority. Keep enum.make semantics frozen. Cover all registered tags, feature negotiation, payload/type errors and authority rejection in AIR/source; verify canonical and hosted CLI behavior. Record reference-bundle costs and the map preflight-validation prerequisite.
This commit is contained in:
1 parent
89c63c306b
commit
1eaf968f4f
56 files changed
+823
-4
No files matched your search
@@ -0,0 +1,20 @@
|
||||
// expect: run
|
||||
// result: 42
|
||||
// phase: 6
|
||||
// spec: docs/spec/05-effects-and-capabilities.md §14
|
||||
module test.errors
|
||||
fn v0() -> alloc_error effects [] { return alloc_error::budget_exceeded; }
|
||||
fn v1() -> alloc_error effects [] { return alloc_error::out_of_memory; }
|
||||
fn main() -> u64 effects [] {
|
||||
let e0 = v0();
|
||||
match e0 {
|
||||
alloc_error::budget_exceeded => {}
|
||||
alloc_error::out_of_memory => { trap; }
|
||||
}
|
||||
let e1 = v1();
|
||||
match e1 {
|
||||
alloc_error::budget_exceeded => { trap; }
|
||||
alloc_error::out_of_memory => {}
|
||||
}
|
||||
return 42u64;
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
// expect: run
|
||||
// result: 42
|
||||
// phase: 6
|
||||
// spec: docs/spec/05-effects-and-capabilities.md §14
|
||||
module test.errors
|
||||
fn v0() -> cap_error effects [] { return cap_error::invalid_restriction; }
|
||||
fn v1() -> cap_error effects [] { return cap_error::not_subset; }
|
||||
fn v2() -> cap_error effects [] { return cap_error::unsupported_restriction; }
|
||||
fn main() -> u64 effects [] {
|
||||
let e0 = v0();
|
||||
match e0 {
|
||||
cap_error::invalid_restriction => {}
|
||||
cap_error::not_subset => { trap; }
|
||||
cap_error::unsupported_restriction => { trap; }
|
||||
}
|
||||
let e1 = v1();
|
||||
match e1 {
|
||||
cap_error::invalid_restriction => { trap; }
|
||||
cap_error::not_subset => {}
|
||||
cap_error::unsupported_restriction => { trap; }
|
||||
}
|
||||
let e2 = v2();
|
||||
match e2 {
|
||||
cap_error::invalid_restriction => { trap; }
|
||||
cap_error::not_subset => { trap; }
|
||||
cap_error::unsupported_restriction => {}
|
||||
}
|
||||
return 42u64;
|
||||
}
|
||||
@@ -0,0 +1,200 @@
|
||||
// expect: run
|
||||
// result: 42
|
||||
// phase: 6
|
||||
// spec: docs/spec/05-effects-and-capabilities.md §14
|
||||
module test.errors
|
||||
fn v0() -> io_error effects [] { return io_error::not_found; }
|
||||
fn v1() -> io_error effects [] { return io_error::permission_denied; }
|
||||
fn v2() -> io_error effects [] { return io_error::already_exists; }
|
||||
fn v3() -> io_error effects [] { return io_error::invalid_input; }
|
||||
fn v4() -> io_error effects [] { return io_error::no_space; }
|
||||
fn v5() -> io_error effects [] { return io_error::broken_pipe; }
|
||||
fn v6() -> io_error effects [] { return io_error::connection_refused; }
|
||||
fn v7() -> io_error effects [] { return io_error::connection_reset; }
|
||||
fn v8() -> io_error effects [] { return io_error::address_in_use; }
|
||||
fn v9() -> io_error effects [] { return io_error::address_unavailable; }
|
||||
fn v10() -> io_error effects [] { return io_error::timed_out; }
|
||||
fn v11() -> io_error effects [] { return io_error::other; }
|
||||
fn main() -> u64 effects [] {
|
||||
let e0 = v0();
|
||||
match e0 {
|
||||
io_error::not_found => {}
|
||||
io_error::permission_denied => { trap; }
|
||||
io_error::already_exists => { trap; }
|
||||
io_error::invalid_input => { trap; }
|
||||
io_error::no_space => { trap; }
|
||||
io_error::broken_pipe => { trap; }
|
||||
io_error::connection_refused => { trap; }
|
||||
io_error::connection_reset => { trap; }
|
||||
io_error::address_in_use => { trap; }
|
||||
io_error::address_unavailable => { trap; }
|
||||
io_error::timed_out => { trap; }
|
||||
io_error::other => { trap; }
|
||||
}
|
||||
let e1 = v1();
|
||||
match e1 {
|
||||
io_error::not_found => { trap; }
|
||||
io_error::permission_denied => {}
|
||||
io_error::already_exists => { trap; }
|
||||
io_error::invalid_input => { trap; }
|
||||
io_error::no_space => { trap; }
|
||||
io_error::broken_pipe => { trap; }
|
||||
io_error::connection_refused => { trap; }
|
||||
io_error::connection_reset => { trap; }
|
||||
io_error::address_in_use => { trap; }
|
||||
io_error::address_unavailable => { trap; }
|
||||
io_error::timed_out => { trap; }
|
||||
io_error::other => { trap; }
|
||||
}
|
||||
let e2 = v2();
|
||||
match e2 {
|
||||
io_error::not_found => { trap; }
|
||||
io_error::permission_denied => { trap; }
|
||||
io_error::already_exists => {}
|
||||
io_error::invalid_input => { trap; }
|
||||
io_error::no_space => { trap; }
|
||||
io_error::broken_pipe => { trap; }
|
||||
io_error::connection_refused => { trap; }
|
||||
io_error::connection_reset => { trap; }
|
||||
io_error::address_in_use => { trap; }
|
||||
io_error::address_unavailable => { trap; }
|
||||
io_error::timed_out => { trap; }
|
||||
io_error::other => { trap; }
|
||||
}
|
||||
let e3 = v3();
|
||||
match e3 {
|
||||
io_error::not_found => { trap; }
|
||||
io_error::permission_denied => { trap; }
|
||||
io_error::already_exists => { trap; }
|
||||
io_error::invalid_input => {}
|
||||
io_error::no_space => { trap; }
|
||||
io_error::broken_pipe => { trap; }
|
||||
io_error::connection_refused => { trap; }
|
||||
io_error::connection_reset => { trap; }
|
||||
io_error::address_in_use => { trap; }
|
||||
io_error::address_unavailable => { trap; }
|
||||
io_error::timed_out => { trap; }
|
||||
io_error::other => { trap; }
|
||||
}
|
||||
let e4 = v4();
|
||||
match e4 {
|
||||
io_error::not_found => { trap; }
|
||||
io_error::permission_denied => { trap; }
|
||||
io_error::already_exists => { trap; }
|
||||
io_error::invalid_input => { trap; }
|
||||
io_error::no_space => {}
|
||||
io_error::broken_pipe => { trap; }
|
||||
io_error::connection_refused => { trap; }
|
||||
io_error::connection_reset => { trap; }
|
||||
io_error::address_in_use => { trap; }
|
||||
io_error::address_unavailable => { trap; }
|
||||
io_error::timed_out => { trap; }
|
||||
io_error::other => { trap; }
|
||||
}
|
||||
let e5 = v5();
|
||||
match e5 {
|
||||
io_error::not_found => { trap; }
|
||||
io_error::permission_denied => { trap; }
|
||||
io_error::already_exists => { trap; }
|
||||
io_error::invalid_input => { trap; }
|
||||
io_error::no_space => { trap; }
|
||||
io_error::broken_pipe => {}
|
||||
io_error::connection_refused => { trap; }
|
||||
io_error::connection_reset => { trap; }
|
||||
io_error::address_in_use => { trap; }
|
||||
io_error::address_unavailable => { trap; }
|
||||
io_error::timed_out => { trap; }
|
||||
io_error::other => { trap; }
|
||||
}
|
||||
let e6 = v6();
|
||||
match e6 {
|
||||
io_error::not_found => { trap; }
|
||||
io_error::permission_denied => { trap; }
|
||||
io_error::already_exists => { trap; }
|
||||
io_error::invalid_input => { trap; }
|
||||
io_error::no_space => { trap; }
|
||||
io_error::broken_pipe => { trap; }
|
||||
io_error::connection_refused => {}
|
||||
io_error::connection_reset => { trap; }
|
||||
io_error::address_in_use => { trap; }
|
||||
io_error::address_unavailable => { trap; }
|
||||
io_error::timed_out => { trap; }
|
||||
io_error::other => { trap; }
|
||||
}
|
||||
let e7 = v7();
|
||||
match e7 {
|
||||
io_error::not_found => { trap; }
|
||||
io_error::permission_denied => { trap; }
|
||||
io_error::already_exists => { trap; }
|
||||
io_error::invalid_input => { trap; }
|
||||
io_error::no_space => { trap; }
|
||||
io_error::broken_pipe => { trap; }
|
||||
io_error::connection_refused => { trap; }
|
||||
io_error::connection_reset => {}
|
||||
io_error::address_in_use => { trap; }
|
||||
io_error::address_unavailable => { trap; }
|
||||
io_error::timed_out => { trap; }
|
||||
io_error::other => { trap; }
|
||||
}
|
||||
let e8 = v8();
|
||||
match e8 {
|
||||
io_error::not_found => { trap; }
|
||||
io_error::permission_denied => { trap; }
|
||||
io_error::already_exists => { trap; }
|
||||
io_error::invalid_input => { trap; }
|
||||
io_error::no_space => { trap; }
|
||||
io_error::broken_pipe => { trap; }
|
||||
io_error::connection_refused => { trap; }
|
||||
io_error::connection_reset => { trap; }
|
||||
io_error::address_in_use => {}
|
||||
io_error::address_unavailable => { trap; }
|
||||
io_error::timed_out => { trap; }
|
||||
io_error::other => { trap; }
|
||||
}
|
||||
let e9 = v9();
|
||||
match e9 {
|
||||
io_error::not_found => { trap; }
|
||||
io_error::permission_denied => { trap; }
|
||||
io_error::already_exists => { trap; }
|
||||
io_error::invalid_input => { trap; }
|
||||
io_error::no_space => { trap; }
|
||||
io_error::broken_pipe => { trap; }
|
||||
io_error::connection_refused => { trap; }
|
||||
io_error::connection_reset => { trap; }
|
||||
io_error::address_in_use => { trap; }
|
||||
io_error::address_unavailable => {}
|
||||
io_error::timed_out => { trap; }
|
||||
io_error::other => { trap; }
|
||||
}
|
||||
let e10 = v10();
|
||||
match e10 {
|
||||
io_error::not_found => { trap; }
|
||||
io_error::permission_denied => { trap; }
|
||||
io_error::already_exists => { trap; }
|
||||
io_error::invalid_input => { trap; }
|
||||
io_error::no_space => { trap; }
|
||||
io_error::broken_pipe => { trap; }
|
||||
io_error::connection_refused => { trap; }
|
||||
io_error::connection_reset => { trap; }
|
||||
io_error::address_in_use => { trap; }
|
||||
io_error::address_unavailable => { trap; }
|
||||
io_error::timed_out => {}
|
||||
io_error::other => { trap; }
|
||||
}
|
||||
let e11 = v11();
|
||||
match e11 {
|
||||
io_error::not_found => { trap; }
|
||||
io_error::permission_denied => { trap; }
|
||||
io_error::already_exists => { trap; }
|
||||
io_error::invalid_input => { trap; }
|
||||
io_error::no_space => { trap; }
|
||||
io_error::broken_pipe => { trap; }
|
||||
io_error::connection_refused => { trap; }
|
||||
io_error::connection_reset => { trap; }
|
||||
io_error::address_in_use => { trap; }
|
||||
io_error::address_unavailable => { trap; }
|
||||
io_error::timed_out => { trap; }
|
||||
io_error::other => {}
|
||||
}
|
||||
return 42u64;
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// expect: reject E7005
|
||||
// phase: 6
|
||||
// spec: docs/spec/05-effects-and-capabilities.md §14
|
||||
module test.errors
|
||||
fn main() -> cap<mem.alloc> effects [] { return alloc_error::budget_exceeded; }
|
||||
@@ -0,0 +1,5 @@
|
||||
// expect: reject E7005
|
||||
// phase: 6
|
||||
// spec: docs/spec/05-effects-and-capabilities.md §14
|
||||
module test.errors
|
||||
fn main() -> alloc_error effects [] { return alloc_error::budget_exceeded(1u64); }
|
||||
@@ -0,0 +1,5 @@
|
||||
// expect: reject E7002
|
||||
// phase: 6
|
||||
// spec: docs/spec/05-effects-and-capabilities.md §14
|
||||
module test.errors
|
||||
fn main() -> alloc_error effects [] { return alloc_error::invalid; }
|
||||
@@ -0,0 +1,5 @@
|
||||
// expect: reject E7005
|
||||
// phase: 6
|
||||
// spec: docs/spec/05-effects-and-capabilities.md §14
|
||||
module test.errors
|
||||
fn main() -> io_error effects [] { return alloc_error::budget_exceeded; }
|
||||
Reference in new issue
Block a user