Skip to content

refactor: store Env<'a> instead of the raw rustler::wrapper::NIF_ENV pointer - #86

Merged
rubas merged 1 commit into
mainfrom
refactor/store-env-not-nif-env
Sep 23, 2026
Merged

rubas merged 1 commit into
mainfrom
refactor/store-env-not-nif-env

Conversation

@rubas

@rubas rubas commented Sep 23, 2026

Copy link
Copy Markdown
Owner

Upstream draft PR rusterlium/rustler#768 deletes the rustler::wrapper module. ProgressEmitter and CancelGuard used it to keep a raw NIF_ENV pointer and rebuild an Env for each message or liveness check.

Both now hold the calling NIF's Env<'a> directly. The lifetime keeps them inside the NIF call, so the compiler now checks what the old comments promised.

This also deletes ffi_helpers::reconstruct_env. It was a safe function that returned an Env with any lifetime the caller picked, which is unsound.

No behavior change. The README section on unsafe no longer lists the env rebuild.

Checks run locally against FFmpeg 9.0.1: cargo clippy --all-targets -- -D warnings, cargo fmt --check, cargo test (17 passed), mix compile --warnings-as-errors, mix test --include integration (104 passed).

…pointer

ProgressEmitter and CancelGuard now borrow the calling NIF's Env<'a>
instead of a raw NIF_ENV pointer. This removes the last use of
rustler::wrapper, which rusterlium/rustler#768 deletes, and drops
ffi_helpers::reconstruct_env, a safe function that returned an Env with
an arbitrary lifetime. No behavior change.
@rubas
rubas merged commit 33937ab into main Sep 23, 2026
1 check passed
@rubas
rubas deleted the refactor/store-env-not-nif-env branch September 23, 2026 15:39
@rubas rubas mentioned this pull request Sep 23, 2026
3 of 4 tasks
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