[GH-ISSUE #19] BEFORE_CALL rejects function-local use declarations and calls in closure-containing expressions #4

Open
opened 2026-11-02 15:32:20 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @sofia-gros on GitHub (Nov 1, 2026).
Original GitHub issue: https://github.com/horizon-rust/horizon-mixins/issues/19

I would like to extend an existing texture-preparation queue before the host consumes it, without duplicating its atlas allocation logic.

I reproduced two planning restrictions using horizon-mixins revision a2af5c0dd4.

The minimal test uses BEFORE_CALL with selector values.iter, ordinal = 0, require = 1, an empty helper function and no bindings.

Results:

  • A function containing a local “use std::vec::Vec;” and a plain values.iter() call is rejected with E_UNSUPPORTED_CONTROL_FLOW: “nested items in target functions are unsupported”.
  • Removing only the local use declaration makes that case pass planning.
  • Replacing the call with values.iter().map(|x| x + 1) is rejected both with and without the local use declaration. The diagnostic is E_UNSUPPORTED_CONTROL_FLOW: “closures, async, try/?, unsafe and const blocks are unsupported injection contexts”.

The selected call is values.iter, outside the closure body, although it belongs to the same expression. These are planner results; I am not claiming that a successful plan proves the transformed program is correct.

Could BEFORE_CALL support these cases when scope, evaluation order, borrowing and temporary lifetimes can be preserved? If this restriction is intentional, is there a supported way to add requests to a local queue before it is consumed?

The real target is Game::prepare_trims in Horizon revision b6c936f82b08798057161bdfa577e3aac53fb91e. The minimal tests above isolate the local-use and closure-expression cases from that function.

I am requesting safe support or guidance on an alternative, not removal of validation. I have not established that every alternative injection path is unavailable.

Originally created by @sofia-gros on GitHub (Nov 1, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon-mixins/issues/19 I would like to extend an existing texture-preparation queue before the host consumes it, without duplicating its atlas allocation logic. I reproduced two planning restrictions using horizon-mixins revision a2af5c0dd4117d51ecd70066ba7a00b4a2c10dab. The minimal test uses BEFORE_CALL with selector values.iter, ordinal = 0, require = 1, an empty helper function and no bindings. Results: - A function containing a local “use std::vec::Vec;” and a plain values.iter() call is rejected with E_UNSUPPORTED_CONTROL_FLOW: “nested items in target functions are unsupported”. - Removing only the local use declaration makes that case pass planning. - Replacing the call with values.iter().map(|x| x + 1) is rejected both with and without the local use declaration. The diagnostic is E_UNSUPPORTED_CONTROL_FLOW: “closures, async, try/?, unsafe and const blocks are unsupported injection contexts”. The selected call is values.iter, outside the closure body, although it belongs to the same expression. These are planner results; I am not claiming that a successful plan proves the transformed program is correct. Could BEFORE_CALL support these cases when scope, evaluation order, borrowing and temporary lifetimes can be preserved? If this restriction is intentional, is there a supported way to add requests to a local queue before it is consumed? The real target is [Game::prepare_trims](https://github.com/horizon-rust/horizon/blob/b6c936f82b08798057161bdfa577e3aac53fb91e/crates/horizon-client/src/game/armor_stands.rs#L200-L295) in Horizon revision b6c936f82b08798057161bdfa577e3aac53fb91e. The minimal tests above isolate the local-use and closure-expression cases from that function. I am requesting safe support or guidance on an alternative, not removal of validation. I have not established that every alternative injection path is unavailable.
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon-mixins#4
No description provided.