Skip to content

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

Merged
maleadt merged 2 commits into
mainfrom
tb/closure-boxes
Oct 28, 2026
Merged

maleadt merged 2 commits into
mainfrom
tb/closure-boxes

Conversation

@maleadt

@maleadt maleadt commented Oct 27, 2026

Copy link
Copy Markdown
Member

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

  • trim_pools!: empty was assigned both by the do block's result and inside the block. The outer variable is now named slabs.
  • profile_internally: the local seconds closure captured t_start, which is assigned inside a try. It is now Base.Fix2(relative_seconds, t_start).

This also adds a closure boxes testsuite entry covering oneAPI and its KernelAbstractions extension. It only runs on Julia 1.14+, so on CI only the nightly job (branch builds) runs it.

`trim_pools!` assigned `empty` both outside and inside its `do` block,
and `profile_internally` captured `t_start`, which is assigned inside a
`try`. Both were stored in a `Core.Box` and lost their type.
Use `Test.detect_closure_boxes`, available on Julia 1.14 and later.
@codecov

codecov Bot commented Oct 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.64%. Comparing base (a2b2df0) to head (8d04cd7).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #749      +/-   ##
==========================================
- Coverage   86.77%   86.64%   -0.14%     
==========================================
  Files          55       55              
  Lines        5065     5008      -57     
==========================================
- Hits         4395     4339      -56     
+ Misses        670      669       -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@maleadt
maleadt merged commit fb4657a into main Oct 28, 2026
5 checks passed
@maleadt
maleadt deleted the tb/closure-boxes branch October 28, 2026 20:42
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.

1 participant