diff --git a/rust/nix-expr/src/eval_state.rs b/rust/nix-expr/src/eval_state.rs index 6a3718b..de5550f 100644 --- a/rust/nix-expr/src/eval_state.rs +++ b/rust/nix-expr/src/eval_state.rs @@ -483,17 +483,6 @@ impl Drop for ThreadRegistrationGuard { } } -/// Run a function while making sure that the current thread is registered with the GC. -pub fn gc_registering_current_thread(f: F) -> Result -where - F: FnOnce() -> R, -{ - let guard = gc_register_my_thread()?; - let r = f(); - drop(guard); - Ok(r) -} - fn gc_register_my_thread_do_it() -> Result<()> { unsafe { let mut sb: raw::GC_stack_base = raw::GC_stack_base { @@ -566,6 +555,17 @@ mod tests { test_init(); } + /// Run a function while making sure that the current thread is registered with the GC. + pub fn gc_registering_current_thread(f: F) -> Result + where + F: FnOnce() -> R, + { + let guard = gc_register_my_thread()?; + let r = f(); + drop(guard); + Ok(r) + } + #[test] fn eval_state_new_and_drop() { gc_registering_current_thread(|| {