spec: accept RFC 0009 and integrate unsafe boundaries
- spec 13 §6-§8: unsafe operations (assume, borrow.index.unchecked), contagious unsafe effect, trusted boundary with obligation, E6001, unsafe report, profiles as policy - spec 05 §9.3: trusted is the one discharging boundary; spec 07 §8.10 trusted syntax; 07a, 08 stage order and assume facts - T0009, E6001 reasons; feature unsafe published
This commit is contained in:
1 parent
17ddb98597
commit
c510a37cf9
9 files changed
+105
-7
No files matched your search
@@ -45,6 +45,7 @@ Declaring `features [capabilities, effects, ownership]` grants no authority. It
|
||||
| `resources` | published | 2 | `capabilities`, `effects`, `ownership` | linear resources `file<read>`, `file<write>`, `file<append>`, `listener`, `stream`; built-in `io_error`; I/O intrinsics (spec 06 §6–§7, `reference/intrinsics.md`) |
|
||||
| `sync` | reserved | 3 | `ownership` | `Mutex<T>`, `RwLock<T>`, linear guards |
|
||||
| `tasks` | reserved | 3 | `ownership` | structured task scopes, spawn/join/cancel, `Send`/`Share` |
|
||||
| `unsafe` | published | 2 | `arrays`, `effects`, `ownership` | `assume`, `borrow.index.unchecked`, the `trusted` boundary, the effect `unsafe` (spec 13 §6–§8) |
|
||||
|
||||
`capabilities` depends on `effects` so that every module that can perform an external operation is also effect-checked.
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@ variant = ident [ "(" [ type { "," type } ] ")" ] ;
|
||||
|
||||
function = "fn" global "(" [ param_list ] ")" "->" type [ "from" local ] NL (* from: feature ownership *)
|
||||
"effects" "[" [ path_list ] "]" NL
|
||||
[ "trusted" string NL ] (* feature unsafe *)
|
||||
block { block } ;
|
||||
param_list = param { "," param } ;
|
||||
param = local ":" type ;
|
||||
@@ -81,7 +82,9 @@ arrays_op = "array.splat" type local
|
||||
| "slice.sub" local "," local "," local
|
||||
| "slice.split" local "," local
|
||||
| "slice.copy" local "," local
|
||||
| "guard" local ;
|
||||
| "guard" local
|
||||
| "assume" local (* feature unsafe *)
|
||||
| "borrow.index.unchecked" local "," local ; (* feature unsafe *)
|
||||
|
||||
arith_op = ( "add" | "sub" | "mul" ) "." ( "checked" | "wrap" ) "." int_type
|
||||
| ( "div" | "rem" ) ".checked." int_type
|
||||
@@ -121,3 +124,4 @@ name_char = letter | digit | "_" ;
|
||||
int_lit = [ "-" ] ( dec_digits | "0x" hex_digits | "0b" bin_digits ) ;
|
||||
(* "_" may separate digits; it carries no meaning. *)
|
||||
version_lit = digit { digit } "." digit { digit } ;
|
||||
string = '"' { string_char | '\\"' | '\\\\' | '\\n' } '"' ; (* not empty; only in `trusted` *)
|
||||
@@ -73,7 +73,7 @@ Draft registry. Codes are stable once released in a tagged compiler version.
|
||||
|
||||
| Code | Kind | Meaning |
|
||||
|---|---|---|
|
||||
| E6001 | unsafe.required | Operation requires explicit unsafe boundary |
|
||||
| E6001 | unsafe.required | Operation requires explicit unsafe boundary; field `reason`: `outside_boundary`, `trusted_declares_unsafe` |
|
||||
| E6101 | abi.unaligned_reference | Normal reference requested from insufficiently aligned storage |
|
||||
|
||||
## T0xxx — Runtime traps
|
||||
@@ -90,3 +90,4 @@ Reported in trap records (spec 01 §6), not by the verifier.
|
||||
| T0006 | trap.cast_out_of_range | Checked cast value not representable in target type |
|
||||
| T0007 | trap.call_depth | Call depth limit (1 024 frames) exceeded |
|
||||
| T0008 | trap.out_of_bounds | Runtime bounds check failed |
|
||||
| T0009 | trap.unsafe_precondition | Unsafe precondition violated (detected) |
|
||||
Reference in new issue
Block a user