diag: add factual related borrow and task locations
This commit is contained in:
1 parent
dbd9763713
commit
8ee0f4c2bf
27 files changed
+659
-18
No files matched your search
@@ -346,6 +346,8 @@ region.destroy → used -= every allocation of the region
|
||||
|
||||
- A region allocation `%p` is an owned borrow whose parent is the shared region borrow `%rb` and whose path is a fresh element unique to that allocation. Allocations are therefore disjoint from each other, and the exclusive borrow `mut<T>` of a fresh object does not conflict with the shared parent (this is the one place where an exclusive child of a shared borrow is permitted, because the storage is new).
|
||||
- `region.reset %r` and `region.destroy %r` are exclusive accesses to the region value. If a **live reference** into the region exists — any live borrow derived from `%r`, in particular a live borrow of an allocation — the instruction is `E2104` (`memory.region_generation`): reset or destroy would invalidate a live reference. Allocations whose borrows have all ended are not an obstacle; destroying them is what `reset` and `destroy` are for.
|
||||
|
||||
An identified E2104 conflict includes the selected reference's definition position (spec 10 §2), without changing generation or borrow rules.
|
||||
- Ending `%rb` while one of its allocations is live is `E2102`, so no allocation outlives the borrow it came from.
|
||||
- A function may return a region allocation with `from %rb` when `%rb` is a `ref<region>` parameter (spec 08 §11.3 applies unchanged: the root is the parameter). Frame-derived borrows still never escape (`E2108`).
|
||||
|
||||
|
||||
@@ -542,6 +542,7 @@ While `LOANED`:
|
||||
|
||||
- for the verifier it behaves as a live child borrow of the argument, owned by the task handle, with the argument's mode and path;
|
||||
- ending the argument borrow, or any ancestor of it, while the task is live is `E4302` (`task.borrow_escape`);
|
||||
an identified task includes its spawn position (spec 10 §2), retained through cancelled-join handle replacement without participating in loan/liveness checks;
|
||||
- an access or a new borrow that conflicts with a loan of a live task is `E4101` (`concurrency.possible_data_race`) rather than `E2101`, since the other party runs concurrently;
|
||||
- lending the same exclusive borrow, or overlapping exclusive borrows, to two live tasks is `E4101`; lending disjoint places (different fields, the halves of a `slice.split`, different region allocations) is accepted.
|
||||
|
||||
|
||||
@@ -175,6 +175,8 @@ Normative rules for frame storage and second-class borrows. Decision record: RFC
|
||||
|
||||
### 11.2 Places, overlap and access
|
||||
|
||||
Identified E2101 conflicts include the selected conflicting value's definition position (spec 10 §2); this metadata changes no overlap or transfer rule.
|
||||
|
||||
Every borrow has a **root** (a `local` or a lent parameter), a **path** from the root (field names, a slice range, or an element), a **mode** (`ref`/`mut`) and a **parent** (none for borrows taken directly from a local or a parameter).
|
||||
|
||||
- Two paths overlap unless they diverge at different fields of the same struct, at the two results of one `slice.split`, or at two different region allocations (spec 03 §20.2) (and descendants of each).
|
||||
|
||||
@@ -16,6 +16,15 @@ Every verifier/compiler error has:
|
||||
|
||||
Code-specific `reason` values MUST be registered and stable; consumers MUST NOT derive them from human messages. E7006 requires the categories in spec 15 §10 and `reference/error-codes.md`.
|
||||
|
||||
`related_locations` MAY provide ordered, non-binding factual context; the covered forms below MUST provide exactly one record for the already selected conflict. Other forms MUST NOT invent a value or task.
|
||||
|
||||
| Diagnostic field | Related `role` | Related `value` | Position |
|
||||
|---|---|---|---|
|
||||
| E2101/E2104 `conflicts_with` | `conflicting_borrow` | same as `conflicts_with` | that value's definition |
|
||||
| E4302 `task` | `task_spawn` | same as `task` | the task's creating spawn, retained through cancelled-join handle replacement |
|
||||
|
||||
A record MUST serialize `role`, `value`, then `file`, `line`, `col` when located (the primary position's conventions), then `air_line`, `air_col` for lowered AIR (spec 15 §10). `related_locations` MUST be omitted when empty and otherwise appended after existing envelope fields. Roles and identities MUST be factual; positions identify syntax, not execution order or a repair. Primary positions/fields, first-conflict selection, diagnostic order and duplicate suppression MUST remain unchanged; discarded duplicates MUST NOT contribute related records. No borrow, loan, acceptance rule or runtime behavior changes.
|
||||
|
||||
Example:
|
||||
|
||||
```json
|
||||
|
||||
@@ -423,6 +423,8 @@ Its diagnostics keep their AIR codes, reported at the source location.
|
||||
|
||||
Every E7006 MUST include a stable string `reason` from the [reason registry](../reference/error-codes.md#e7006-reasons), chosen directly by the rejecting rule, independently of `message`. `move_copy` denotes an explicit rejected move of a plain Copy value; borrows use `move_borrow`, and non-materializable operands use `invalid_move`. Permitted generic transfers MUST NOT emit these errors. Reason meanings MUST remain stable; extensions MAY add registered reasons. Consumers MUST tolerate new reasons. Codes, rejection rules, primary positions and existing fields are unchanged; `reason` is appended after existing code-specific fields. A historical or incomplete record without a reason is unknown, never evidence of `move_copy` or its absence.
|
||||
|
||||
Each related AIR position (spec 10 §2) MUST be mapped independently through the lowering map, including imported/specialized source files, retaining its original coordinates as `air_line`/`air_col`. If absent, the related source `file`/`line`/`col` MUST be omitted together; `role`, `value` and AIR coordinates remain. A guessed related source position MUST NOT be substituted. Primary fallback and duplicate selection remain unchanged.
|
||||
|
||||
## 11. Tooling
|
||||
|
||||
| Command | Does |
|
||||
|
||||
Reference in new issue
Block a user