[FEAT][RUST]Add tvm_ffi::optional in Rust#630
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces Rust stub generation capabilities to tvm-ffi-stubgen, allowing the automatic creation of typed Rust bindings (including structs, builders, and methods) from C++ reflection metadata. It also adds a layout-mirror Optional type in Rust to support C++ ffi::Optional fields. The feedback highlights two key issues: first, the Optional type automatically infers as !Send and !Sync due to its UnsafeCell field, which should be fixed by manually implementing these traits when T is thread-safe; second, a potential ZeroDivisionError in the alignment calculation within the Python codegen should be prevented by ensuring the alignment value is at least 1.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
7092721 to
5b2ebc1
Compare
47230a0 to
8fb2a15
Compare
66d64af to
d27ac98
Compare
a82f443 to
f56180f
Compare
Signed-off-by: yuchuan <yuchuan.7streams@gmail.com>
f56180f to
cb5f5b0
Compare
This PR supports
ffi::optionalPod,ffi::optionalStrinRust. It keeps the same memory layout as C++'s ffi::optional.