Root values cleanup#554
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthrough
ChangesRoot value ownership migration
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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.
Inline comments:
In `@src/libexpr/include/nix/expr/root-value.hh`:
- Around line 11-16: Update the documentation comments for the RootValue class
to remove stale comparisons with the removed UniqueRootValue/copyable variant.
In both affected doc blocks, including the one near RootValue’s declaration and
the block around lines 29–33, delete the “Prefer this over RootValue” and
“RootValue/RootValue” comparison wording while retaining accurate description of
RootValue’s behavior and usage.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 6edc5bb3-5839-4ccd-9220-2c14f82fb045
📒 Files selected for processing (11)
src/libcmd/include/nix/cmd/installable-attr-path.hhsrc/libcmd/installable-attr-path.ccsrc/libexpr/eval-cache.ccsrc/libexpr/eval.ccsrc/libexpr/include/nix/expr/eval-cache.hhsrc/libexpr/include/nix/expr/eval.hhsrc/libexpr/include/nix/expr/get-drvs.hhsrc/libexpr/include/nix/expr/root-value.hhsrc/libexpr/json-to-value.ccsrc/libexpr/primops.ccsrc/libexpr/root-value.cc
| /** | ||
| * A move-only handle rooting a Value, i.e. keeping it and everything | ||
| * reachable from it alive across garbage collections. Prefer this | ||
| * over `RootValue` unless the handle must be copyable (e.g. when it's | ||
| * captured in a `std::function`-backed lambda). | ||
| */ |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Stale doc comments left over from the UniqueRootValue rename.
Both doc blocks reference the old two-type distinction that no longer exists:
- Line 14: "Prefer this over
RootValue…" — the documented class isRootValue, so this now advises preferring the type over itself. - Line 32: "Use
RootValue/RootValuerather than calling this directly." — the duplicated token was previouslyRootValue/UniqueRootValue.
Since the copyable variant was removed, drop the comparison wording.
📝 Suggested doc wording
/**
- * A move-only handle rooting a Value, i.e. keeping it and everything
- * reachable from it alive across garbage collections. Prefer this
- * over `RootValue` unless the handle must be copyable (e.g. when it's
- * captured in a `std::function`-backed lambda).
+ * A move-only handle rooting a Value, i.e. keeping it and everything
+ * reachable from it alive across garbage collections.
*/ /**
* Allocate a slot from the root value pool, i.e. a GC-visible
* `Value *` cell that keeps the value it points to alive across
- * garbage collections. Use `RootValue`/`RootValue` rather than
- * calling this directly.
+ * garbage collections. Use the `RootValue(Value *)` constructor
+ * rather than calling this directly.
*/Also applies to: 29-33
🤖 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 `@src/libexpr/include/nix/expr/root-value.hh` around lines 11 - 16, Update the
documentation comments for the RootValue class to remove stale comparisons with
the removed UniqueRootValue/copyable variant. In both affected doc blocks,
including the one near RootValue’s declaration and the block around lines 29–33,
delete the “Prefer this over RootValue” and “RootValue/RootValue” comparison
wording while retaining accurate description of RootValue’s behavior and usage.
1bf0965 to
d2a00e3
Compare
Motivation
Followup to #546. Get rid of the unused
RootValuetype and renameUniqueRootValuetoRootValue. This makes the upstream diff smaller.Context
Summary by CodeRabbit