Open SilverMira opened 21 hours ago
Given a third party simple struct like this
// third_party pub struct MyStruct { pub r#type: u32 }
and a mirror to it within frb crate
pub use third_party::MyStruct; #[flutter_rust_bridge::frb(mirror(MyStruct))] pub struct _MyStruct { pub r#type: u32 }
The generated code to type check the mirror doesn't include the r#
r#
// frb_generated.rs // Section: static_checks #[allow(clippy::unnecessary_literal_unwrap)] const _: fn() = || { { let MyStruct = None::<crate::api::simple::TestMirror>.unwrap(); let _: u32 = MyStruct.type; ^^^^ } };
Since type is a keyword, rust won't compile unless it's prefixed with r# and will complain syntax error.
type
N/A
The generated static check should respect r# if any in the mirror definition
No response
Windows
flutter_rust_bridge_codegen
2.6.0
clang++
Looks like a bug, feel free to PR to fix it! Alternative I will work on it later, but since this has easy workaround (do not use r#keyword style) may not be within days.
r#keyword
Describe the bug
Given a third party simple struct like this
and a mirror to it within frb crate
The generated code to type check the mirror doesn't include the
r#
Since
type
is a keyword, rust won't compile unless it's prefixed withr#
and will complain syntax error.Steps to reproduce
N/A
Logs
Expected behavior
The generated static check should respect
r#
if any in the mirror definitionGenerated binding code
No response
OS
Windows
Version of
flutter_rust_bridge_codegen
2.6.0
Flutter info
No response
Version of
clang++
No response
Additional context
No response