difftreelog
fix overly force-happy lazy for-spec
in: master
2 files changed
crates/jrsonnet-evaluator/src/evaluate/compspec.rsdiffbeforeafterboth174 let cached_overs = cache_overs(&ctx, &comp.compspecs)?;174 let cached_overs = cache_overs(&ctx, &comp.compspecs)?;175175176 // 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 slot178 // 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 arr382 };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,tests/suite/sjsonnet_issue_1029.jsonnetdiffbeforeafterbothno changes