fix(monty): compile the JSON string cache on the declared 1.96 MSRV #1013
All Vouch review confidence checks passed
Residual risk 0.20 = Change Risk (0.46) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.46 · 456 lines diff across 5 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.366
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #1013"
general
weight: 0.35
rewitt94
Fixes #985.
Problem
CacheInner::entriesis aBox<[CacheEntry; CAPACITY]>(CAPACITY = 16_384).drop_alliterates it with a reference to theBoxitself:A
forloop callsIntoIterator::into_iteron the expression as written, withno auto-deref, so this needs
&mut Box<[T; N]>: IntoIterator. That impl does notexist on the rustc releases at or below the
rust-version = "1.96"declared inCargo.toml, and the loop fails to compile:Fix
Dereference the
Boxso the loop borrows the array, and[T; N]has implementedIntoIterator for &mut [T; N]since Rust 1.53:This is a one-line, source-compatible change. Behaviour is unchanged: the loop
still visits every one of the
CAPACITYslots and keeps the existingentry.take()/value.drop_with(heap)sequence, including thevalue.drop_with(heap)ordering guarantee that cached values must be droppedwhile the heap is still alive (it is called from
VM::drop()before teardown).I used
&mut *inner.entriesrather thaninner.entries.iter_mut()because theworkspace lints against the
pedanticgroup, which includesclippy::explicit_iter_loop— that attribute would fire on the.iter_mut()spelling.
Verification
cargo check -p monty --libpasses on rustc 1.99.0 both before and after, sothis is a strict addition and does not regress current toolchains.
difference between the two spellings is the deref:
clippy-driver --edition=2024 -W clippy::pedantic(with the same allows listedin the workspace
Cargo.toml) reports nothing on the new loop.No other source file is touched.
<!-- This is an auto-generated description by cubic. -->
---
Summary by cubic
Fixes the
montyJSON string cache so it builds on the declared 1.96 MSRV. The teardown loop indrop_alliterated&mut Box<[T; N]>, which only gained anIntoIteratorimpl on newer rustc and caused E0277; dereferencing the box borrows the array itself, which has supportedIntoIterator for &mut [T; N]since Rust 1.53. Behavior is unchanged: the loop still visits allCAPACITYslots and preserves theentry.take()/value.drop_with(heap)sequence so values are dropped before the heap is torn down. The deref spelling is used rather than.iter_mut()because the workspace'spedanticlint set would flag the latter.<sup>Written for commit da3cddea48b3f5995d51868b16b3a0a75b07e9f1. Summary will update on new commits.</sup>
<a href="https://cubic.dev/pr/pydantic/monty/pull/1013?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="View guided diff" src="https://www.cubic.dev/buttons/review-in-cubic-light.svg"></picture></a>
<!-- End of auto-generated description by cubic. -->