git.delta.rocks / jrsonnet / refs/commits / 07fd802e41da

difftreelog

fix overly force-happy lazy for-spec

pmnykmoxYaroslav Bolyukin2026-06-24parent: #ecbe9eb.patch.diff
in: master

2 files changed

modifiedcrates/jrsonnet-evaluator/src/evaluate/compspec.rsdiffbeforeafterboth
174 let cached_overs = cache_overs(&ctx, &comp.compspecs)?;174 let cached_overs = cache_overs(&ctx, &comp.compspecs)?;
175175
176 // Eager fast-path: when the comp has only `if` and `for { destruct: Full(_) }`176 // Eager fast-path: when the comp has only `if` and `for { destruct: Full(_) }`
177 // specs, allocate one Iter A-frame per for-spec and re-set the slot177 // specs, allocate one iter frame per for-spec and re-set the slot
178 // per iteration as long as the frame's refcount stays at 1.178 // per iteration as long as the frame's refcount stays at 1.
179 'eager: {179 'eager: {
180 if !comp.compspecs.iter().all(|c| {180 if !comp.compspecs.iter().all(|c| {
381 arr381 arr
382 };382 };
383 let inner_reserve = guaranteed_reserve.max(1) * arr.len() as usize;383 let inner_reserve = guaranteed_reserve.max(1) * arr.len() as usize;
384 for (i, item) in arr.iter().enumerate() {384 for (i, item) in arr.iter_lazy().enumerate() {
385 let item = item?;
386 let inner_ctx = ctx.pack_captures_sup_this(frame_shape).enter(|fill, ctx| {385 let inner_ctx = ctx.pack_captures_sup_this(frame_shape).enter(|fill, ctx| {
387 destruct(dst, fill, Thunk::evaluated(item), ctx);386 destruct(dst, fill, item, ctx);
388 });387 });
389 evaluate_compspecs(388 evaluate_compspecs(
390 inner_ctx,389 inner_ctx,
addedtests/suite/sjsonnet_issue_1029.jsonnetdiffbeforeafterboth

no changes