Free discarded Option and Result payloads#8
Conversation
📝 WalkthroughWalkthroughChangesDiscarded bag cleanup
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant IgnoredStatement
participant Codegen
participant GeneratedC
IgnoredStatement->>Codegen: emit discarded Option/Result expression
Codegen->>Codegen: infer payload type and ownership
Codegen->>GeneratedC: emit recursive drop/free cleanup
GeneratedC-->>IgnoredStatement: complete discard without fallback expression use
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
.github/workflows/ci.yml (1)
293-296: 🔒 Security & Privacy | 🔵 Trivial | 💤 Low valueRestrict default GITHUB_TOKEN permissions.
The
asanjob uses default permissions. Following the principle of least privilege, explicitly set read-only permissions to improve workflow security.🔒️ Proposed fix to explicitly set job permissions
asan: name: ASan invalid memory access runs-on: ubuntu-latest + permissions: + contents: read steps:🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In @.github/workflows/ci.yml around lines 293 - 296, Update the asan job definition to explicitly configure its GITHUB_TOKEN permissions as read-only, using the workflow’s permissions syntax. Keep the existing job steps and behavior unchanged.Source: Linters/SAST tools
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In @.github/workflows/ci.yml:
- Around line 293-296: Update the asan job definition to explicitly configure
its GITHUB_TOKEN permissions as read-only, using the workflow’s permissions
syntax. Keep the existing job steps and behavior unchanged.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: c62c92a9-ae62-4314-b4d4-bba6b648ea20
📒 Files selected for processing (9)
.github/workflows/ci.ymlCHANGELOG.mddocs/ROADMAP.mddocs/SOUNDNESS.mddocs/STATUS.mddocs/howto/06-memory.mdexamples/testing/discarded_bag_borrow_test.mkoexamples/testing/discarded_bag_drop_test.mkosrc/codegen/mod.rs
|
CI is green except for a macOS timing failure in TestJoinTimeoutFlatten. The same test passed in this run under ASan, UBSan, TSan, GCC, claims, Ubuntu, and Windows, and passed on the upstream base run. I left the unrelated test unchanged; rerunning the failed job requires repository permission. |
Fresh
OptionandResultvalues now release their owned payloads when explicitly discarded. Cleanup covers strings, slices, maps, structs, nested bags, enum errors, and float results while preserving borrowed field and index values.Focused ASan and LSan tests cover both owned cleanup and borrowed-container safety.
Tested with
cargo test --bin mako(78 passed) and the focused ownership sanitizer suite.Summary by CodeRabbit
New Features
OptionandResultvalues now cleans up owned payloads, including nested arrays, maps, strings, and records.Documentation
Tests