Skip to content

feat!: remove manual ownership overlay; package is @safe-only (v0.5.0) - #82

Merged
MilesCranmer merged 8 commits into
MilesCranmer:mainfrom
MilesCranmerBot:pr/v05-remove-manual-overlay
Aug 22, 2026
Merged

MilesCranmer merged 8 commits into
MilesCranmer:mainfrom
MilesCranmerBot:pr/v05-remove-manual-overlay

Conversation

@MilesCranmerBot

Copy link
Copy Markdown
Contributor

Summary

BREAKING (v0.5.0): removes the entire manual ownership API in favor of the automatic IR-based checker.

Removed: @own, @move, @ref, @ref_into, @take!, @take, @lifetime, @clone, @bc, @mut, @cc, @&, @spawn, Mutex, Owned, OwnedMut, Borrowed, BorrowedMut, LazyAccessor, and the associated error types.

The package is now: @safe, @unsafe, BorrowCheckError, and the Preferences.jl enable/disable system.

Rationale

  • The automatic layer is the package's differentiated workflow: drop-in borrow checking of unmodified code, validated against real packages (DynamicExpressions, DifferentiationInterface/ForwardDiff).
  • The overlay required restructuring every function around macros, and its guarantees evaporated on any plain assignment outside the macro system.
  • Two parallel ownership systems doubled documentation and test surface (~6.5k lines removed here) for an API with no known adopters.

The old API remains available on the v0.4.x release line and the v0.4 tag.

Notes

Test plan

BREAKING: removes the entire manual ownership API: @own, @Move, @ref,
@ref_into, @take!, @take, @Lifetime, @clone, @bc, @mut, @cc, @&,
@Spawn, Mutex, Owned/OwnedMut/Borrowed/BorrowedMut/LazyAccessor and
their error types. The package now consists solely of the automatic
IR-based checker: @safe, @unsafe, BorrowCheckError, and the
Preferences.jl enable/disable system.

Rationale: the automatic layer supersedes the manual overlay as the
package's core workflow (drop-in checking of unmodified code), while
the overlay required restructuring every function around macros whose
guarantees evaporated on any plain assignment outside the macro
system. The two ownership systems also doubled documentation and test
surface. The old API remains available on the v0.4.x release line.

Also drops the now-unused MacroTools dependency and stale
dispatch_doctor_mode test preference.

Co-authored-by: Miles Cranmer <miles.cranmer@gmail.com>
@MilesCranmerBot

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ec306f61ae

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/BorrowChecker.jl Outdated
Comment thread src/BorrowChecker.jl
MilesCranmerBot and others added 2 commits August 22, 2026 01:07
The auto checker (and its error type) only exists on Julia >= 1.12 with
Base.code_ircode_by_type; older versions get @safe/@unsafe stubs.
Importing and exporting BorrowCheckError unconditionally broke
precompilation on 1.10.

Co-authored-by: Miles Cranmer <miles.cranmer@gmail.com>
BorrowCheckError and disable_by_default! had no docstrings, so the
Documenter API page failed to render after the manual overlay removal.
Also qualifies the @safe docref with its defining module path.

Co-authored-by: Miles Cranmer <miles.cranmer@gmail.com>
@MilesCranmerBot

Copy link
Copy Markdown
Contributor Author

@codex review

Pushed e348430: docs build fixed after the removal (BorrowCheckError and disable_by_default! gained docstrings; the API page now references defining-module paths). Also guarded the BorrowCheckError export on Julia versions without the auto layer (1129af2), fixing the 1.10 precompile failure in the first CI run. Full suite: 221 pass / 2 broken (the two @test_broken markers that #79 resolves on main).

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e348430ab4

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread README.md
MilesCranmerBot and others added 5 commits August 22, 2026 03:08
Julia 1.13 removed get_indices(::Vector{Compiler.InferenceResult},
::Core.MethodInstance), which the reflection layer calls, so including
the auto checker on 1.13-rc produced runtime MethodErrors that hung the
nightly CI job to its 1h timeout. Restrict inclusion to 1.12.x and match
the test-runner capability check; 1.13 support needs a proper shim.

Co-authored-by: Miles Cranmer <miles.cranmer@gmail.com>
Co-authored-by: Miles Cranmer <miles.cranmer@gmail.com>
README, the stub docstrings, and the BORROWCHECKER_ONLY_AUTO error now
state that the IR checker requires Julia 1.12.x and that 1.13+ falls
back to warn-and-pass-through stubs until support lands.

Co-authored-by: Miles Cranmer <miles.cranmer@gmail.com>
Co-authored-by: Miles Cranmer <miles.cranmer@gmail.com>
Co-authored-by: Miles Cranmer <miles.cranmer@gmail.com>
@MilesCranmer
MilesCranmer merged commit 6900ec6 into MilesCranmer:main Aug 22, 2026
6 checks passed
MilesCranmerBot added a commit to MilesCranmerBot/BorrowChecker.jl that referenced this pull request Aug 23, 2026
The @unsafe documentation section landed on master via MilesCranmer#82's README
rewrite; the remaining diff was against the removed manual-overlay
README and is stale.
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