Skip to content

[STUBGEN][RUST] Skip crate-provided types and add a custom constructor example - #755

Merged
tlopex merged 2 commits into
apache:mainfrom
Seven-Streams:main-dev/2026-09-06/stubgen_prefix_crate_types
Sep 6, 2026
Merged

[STUBGEN][RUST] Skip crate-provided types and add a custom constructor example#755
tlopex merged 2 commits into
apache:mainfrom
Seven-Streams:main-dev/2026-09-06/stubgen_prefix_crate_types

Conversation

@Seven-Streams

Copy link
Copy Markdown
Contributor

Summary

prefix: ffi could generate a non-generic Array that shadowed the crate's
Array<T>, causing E0107. Prefix expansion and --init now use
Generator.is_builtin to skip runtime-provided types. Rust shares _provider's
type-key rule; Python continues to use BUILTIN_TYPE_KEYS.

examples/rust_stubgen combines the demand-driven layout from #752 with a
hand-written IntPair::new(a, b) that derives kind from its operands.
custom-new renames the generated allocator to from_complete_fields, and
STUB_INIT OFF keeps regeneration in place. Linux CI builds and runs the example
and checks for stale generated bindings.

Testing

  • Stubgen tests: 109 passed, including ffi.Array regression coverage.
  • ruff, ty, and yamllint: passed.
  • Example builds and runs; regeneration leaves bindings unchanged and --check passes.
  • Verified duplicate-new errors, restoration of deleted blocks, and generation
    of blocks for new types.

Signed-off-by: yuchuan <yuchuan.7streams@gmail.com>
Signed-off-by: yuchuan <yuchuan.7streams@gmail.com>
@tlopex
tlopex marked this pull request as ready for review September 6, 2026 15:51
@tlopex
tlopex merged commit 85e72e7 into apache:main Sep 6, 2026
9 checks passed
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