Skip to content

fix(codegen): fail closed on discarded lowering errors#2152

Merged
slepp merged 1 commit into
mainfrom
fix/fail-closed-ok-question
Jun 22, 2026
Merged

fix(codegen): fail closed on discarded lowering errors#2152
slepp merged 1 commit into
mainfrom
fix/fail-closed-ok-question

Conversation

@slepp

@slepp slepp commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Summary

Silent .ok()? swallows in the lowering/codegen pipeline are removed. A classification error in the owned-aggregate value-class path now propagates: the type is excluded from the drop allow-set and a diagnostic is emitted, rather than silently resolving to "not an owned aggregate" and skipping drop synthesis. A spawn-state lowering error now guarantees a diagnostic instead of returning a bare None. The DWARF base-type and field-index sites—infallible by construction—use .expect() with an invariant note. One symbol-classifier site retains .ok()? with a // JUSTIFIED: comment: a malformed suffix is a benign non-match, not a swallowed error.

Verification

  • make test-hew-ratchet: pass — 0 expected failures / 0 actual failures; ratchet PASSED (load-bearing check for the drop/value-class surface)
  • make build: pass — all crates compiled
  • cargo fmt -p hew-mir -p hew-codegen-rs -- --check: pass
  • cargo clippy -p hew-mir -p hew-codegen-rs --all-targets: pass — zero warnings
  • ast-grep scan --rule rules/rust/fail-closed/ok-question-in-lowering.yml: 0 unannotated hits
  • Full ast-grep lint gate (scripts/ast-grep-lint.sh): pass — 0 error-severity matches
  • Preflight: ready-to-push

Out of scope

  • The two new defense-in-depth diagnostic branches (classification-error reason in the owned-aggregate value-class path; spawn-state NotYetImplemented fallback) do not yet have dedicated reject fixtures. These branches guard internal-invariant conditions that are not currently reachable from a known .hew construct; fixtures will be added when such a construct is identified.

@slepp slepp force-pushed the fix/fail-closed-ok-question branch from 899221b to 9190f33 Compare June 22, 2026 22:48
@slepp slepp merged commit 791fcb3 into main Jun 22, 2026
12 checks passed
@slepp slepp deleted the fix/fail-closed-ok-question branch June 22, 2026 23:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant