Skip to content

Conversation

@csmulhern
Copy link
Contributor

All existing tests only compile Rust code using --rust-module-root-file.

New include tests have been added for Rust using include_test1.fbs and include_test2.fbs, without -rust-module-root-file.

The imports for these tests have been moved to their own test file, as the existing intergration_test.rs file hides compilation issues from code generation due to symbols brought into scope outside of the generated code (e.g. extern crate alloc is declared in the root module). The importing of include_test code within other rust_usage_test integration test files has been removed, as it's not accomplishing anything.

Finally, this PR includes a fix for #8876. The core issue is exposed by these new tests. When performing code generation within a single file, extern crate alloc needs to be declared to bring alloc into scope within every inner namespace. Within code generation, we move extern crate alloc from being declared at the top of the file, to being declared within every namespace.

@github-actions github-actions bot added python c++ rust codegen Involving generating code from schema labels Dec 21, 2025
@jtdavis777 jtdavis777 added the Release An issue involving a release of flatbuffers label Dec 21, 2025
@jtdavis777
Copy link
Collaborator

@dbaileychess this impacts the latest release cut

jtdavis777
jtdavis777 previously approved these changes Dec 22, 2025
@jtdavis777 jtdavis777 added the ready-for-merge This PR has been approved by a maintainer and is ready for merge by a code owner label Dec 22, 2025
@jtdavis777 jtdavis777 linked an issue Dec 22, 2025 that may be closed by this pull request
All existing tests only compile Rust code using --rust-module-root-file.
The imports for these tests have been moved to their own file, as the existing intergration_test.rs file hides compilation issues from code generation due to symbols brought into scope outside of the generated code (e.g. `extern crate alloc`).
When performing code generation within a single file, extern crate alloc needs to be delcared to bring alloc into scope within every inner namespace.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ codegen Involving generating code from schema python ready-for-merge This PR has been approved by a maintainer and is ready for merge by a code owner Release An issue involving a release of flatbuffers rust

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rust compilation issue on new version

2 participants