Repository navigation
fix(hy-check): reject non-lowered map-slot borrow positions with HYB-E3104 (closes #1423) - #1441
Merged
limitlessprojects merged 1 commit intoOct 24, 2026
Conversation
Owner
|
Landed on main as a two-parent merge onto the post-#1432 tip (17d2962): your position gates + #1432's loan-preservation semantics, doc-comment conflict resolved in favor of both. Battery on the merged tree: workspace 1775/0, corpus tripwire clear, differential FULL 40+86; over-reach controls (plain-local Clean, well-documented diff — the |
Ljunqiang
pushed a commit
to Ljunqiang/Go-Hybrid
that referenced
this pull request
Oct 24, 2026
…ssion-35: limitlessprojects#1419/limitlessprojects#1432/limitlessprojects#1439/limitlessprojects#1441 — disjoint files, census still 126)
2 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of Changes
Closes #1423.
This PR fixes multiple soundness bypasses where non-lowered O8 map-slot borrow expressions (
&m[k]) bypassedHYB-E3104:compiler/crates/hy-check/src/addr_loan.rs:check_stmt_addr_of_loan_projections:Stmt::Local: Only passesallow_slot_loan = truewhenmatches!(l.kind, LocalKind::Define | LocalKind::Let) && l.ty.is_none() && l.names.len() == l.values.len().LocalKind::Varand type-ascribed declarations cannot lower slot loans and now correctly reject&m[k]withHYB-E3104.Stmt::Assign: Only passesallow_slot_loan = truewhen*op == AssignOp::Assign && targets.len() == values.len() && targets.iter().all(|t| matches!(&t.kind, PlaceKind::Ident(_))). Index and mixed assignments cannot lower slot loans and now reject&m[k]withHYB-E3104.mark_slot_loans_local&mark_slot_loans_assign:hy-emitlowering.walk_addr_of_loan_projections(Expr::StructLit):map_slot_borrow_spanon struct literal fields. Fields of typeanyor generic parameters that were not previously caught by A6 (HYB-E3103) now properly reject unlowered&m[k]withHYB-E3104(whileemit_map_slot_borrow_diagalready deduplicates against prior A6 diagnostics).Maintainer Scorecard & Verification
hy-emitO8 slot loan lowering conditions incompiler/crates/hy-emit/src/stmt.rs.compiler/crates/hy-check/tests/slot_loan_callarg_positions.rs: addednon_lowered_map_slot_borrow_positions_rejected_issue_1423verifying all 4 repro cases:vardeclaration (var p = &m["a"]) -> rejects withHYB-E3104.ptrs[0] = &m["a"]) -> rejects withHYB-E3104.q, arr[0] = &m["a"], 1) -> rejects withHYB-E3104.any-typed struct-literal field (box{p: &m["a"]}) -> rejects withHYB-E3104.cargo test -p hy-check: 100% pass across all tests.Payout / Bounty Address (Polygon/Base/Arbitrum/Ethereum USDC):
0xC345C07229307d4f1c7935aD2cAe48e390215808