Skip to content

Avoid boxed captured variables, and test for them - #217

Merged
christiangnrd merged 3 commits into
mainfrom
tb/closure-boxes
Oct 31, 2026
Merged

christiangnrd merged 3 commits into
mainfrom
tb/closure-boxes

Conversation

@maleadt

@maleadt maleadt commented Oct 27, 2026

Copy link
Copy Markdown
Collaborator

Test.detect_closure_boxes (Julia 1.14+) reports two methods whose lowered code allocates a Core.Box:

  • runtests: historical_durations/historical_failures were loaded separately on the --list path and the normal path, and captured, so the double assignment boxed them. The history is now loaded once, before the --list check.
  • _runtests: the local create_testset has keyword arguments, which boxes its binding. It captures nothing, so it is now a top-level function.

This also adds a closure boxes testsuite entry so new boxes get caught; it runs on the nightly CI job and is skipped before 1.14.

Comment thread src/ParallelTestRunner.jl Resolved
`historical_durations` and `historical_failures` were assigned on two
paths and captured, and the local `create_testset` has keyword
arguments, so both were stored in a `Core.Box` and lost their type. Load
the history once, and make `create_testset` a top-level function since
it captures nothing.
Use `Test.detect_closure_boxes`, available on Julia 1.14 and later.
@christiangnrd
christiangnrd merged commit f285ea0 into main Oct 31, 2026
18 checks passed
@christiangnrd
christiangnrd deleted the tb/closure-boxes branch October 31, 2026 18:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants