Fixes Rust code generation for single file output when using namespaces (#8877)

* Adds tests for Rust single file mode

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

* Adds standalone include tests for Rust

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`).

* Declare alloc crate in every Rust namespace

When performing code generation within a single file, extern crate alloc needs to be delcared to bring alloc into scope within every inner namespace.

* Regenerates generated schemas
This commit is contained in:
Cameron Mulhern
2026-02-04 15:28:18 +00:00
committed by GitHub
parent ea0a73d168
commit 5b9de8b6c0
9 changed files with 994 additions and 26 deletions

View File

@@ -48,14 +48,6 @@ mod flexbuffers_tests;
mod more_defaults_test;
mod optional_scalars_test;
#[allow(dead_code, unused_imports, clippy::all)]
#[path = "../../include_test1/mod.rs"]
pub mod include_test1_generated;
#[allow(dead_code, unused_imports, clippy::all)]
#[path = "../../include_test2/mod.rs"]
pub mod include_test2_generated;
#[allow(dead_code, unused_imports, clippy::all)]
#[path = "../../namespace_test/mod.rs"]
pub mod namespace_test_generated;