Skip to content

Support forwarding parameters in the Rust bindings - #3199

Closed
ksss wants to merge 1 commit into
ruby:masterfrom
ksss:rust-forwarding-param
Closed

ksss wants to merge 1 commit into
ruby:masterfrom
ksss:rust-forwarding-param

Conversation

@ksss

@ksss ksss commented Oct 6, 2026

Copy link
Copy Markdown
Collaborator

Problem

f9f223c ("Support forwarding parameters in method types") added rbs_types_function_forwarding_param_t and rbs_types_function_t.forwarding to the C AST, but the Rust crates were not updated. From a clean build, ruby-rbs fails:

  • E0425: rbs_types_function_forwarding_param_t not found (missing from the bindgen allowlist)
  • E0004: Node::FunctionForwardingParam is not handled in convert.rs

This stayed hidden because ruby-rbs-sys was not rebuilt after C header changes (see #3198).

Changes

  • ruby-rbs-sys: allowlist rbs_types_function_forwarding_param_t, rbs_parser_new_with_options and rbs_parser_options_t.
  • ruby-rbs: add ast::ForwardingParam (location only, like RBS::Types::Function::ForwardingParam) and FunctionType::forwarding, converted from the new node.
  • Add a crate-private ParseOptions / parse_with_options. The parser rejects (...) unless enable_forwarding_params is set, so the conversion could not be tested through parse. It is pub(crate) on purpose; whether to expose it publicly is left for a separate decision.

Verification

LC_ALL=en_US.UTF-8, in rust/:

  • cargo build, cargo test, cargo clippy --all-targets, cargo fmt --check all pass.
  • New test converts_forwarding_param checks def bar: (Integer, ...) -> void yields forwarding with a location spanning ..., and that (String) -> void yields None. Before the change, the same source fails with "forwarding parameter syntax is not enabled".

🤖 Generated with Claude Code

f9f223c added `rbs_types_function_forwarding_param_t` and the
`forwarding` field on `rbs_types_function_t` to the C AST, but the Rust
crates were not updated, so `ruby-rbs` failed to build from clean
(E0425 for the missing binding, E0004 for the unhandled
`Node::FunctionForwardingParam`). The breakage stayed hidden because
`ruby-rbs-sys` was not rebuilt after C header changes.

* Allow-list the forwarding param type and the parser options API in
  `ruby-rbs-sys`.
* Add `ast::ForwardingParam` and `FunctionType::forwarding`, converted
  from the new node.
* Add a crate-private `ParseOptions` / `parse_with_options` so the
  conversion can be tested; `(...)` is rejected by default.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@ksss

ksss commented Oct 6, 2026

Copy link
Copy Markdown
Collaborator Author

Closing: this was based on a wrong premise. CI vendors the C sources from the pinned tag in rust/rbs_version (v4.1.2) via rake rust:rbs:sync, and forwarding params are not in v4.1.2, so the Rust crates are not actually out of sync. They will be updated together with the next pin bump.

@ksss ksss closed this Oct 6, 2026
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