fzyzcjy / flutter_rust_bridge

Flutter/Dart <-> Rust binding generator, feature-rich, but seamless and simple.

Home Page:https://fzyzcjy.github.io/flutter_rust_bridge/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Codegen panic with non-chrono DateTime

kjzl opened this issue · comments

Describe the bug

The codegen tool experiences a panic when interacting with a DateTime type that is not from the chrono crate. This issue is specifically observed when using the exif::DateTime from the kamadak-exif crate. The tool appears to expect generics when dealing with a type named 'DateTime'.

Steps to reproduce

/// Works as expected
pub fn get_chrono_dt() -> chrono::DateTime<chrono::Utc> {
    chrono::DateTime::default()
}

/// Codegen panics
pub fn get_exif_dt() -> exif::DateTime {
    exif::DateTime::from_ascii(b"2016:05:04 03:02:01").unwrap()
}

Logs

[2024-02-20T13:23:02.223Z DEBUG /home/kjzl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flutter_rust_bridge_codegen-2.0.0-dev.24/src/library/codegen/parser/source_graph/crates.rs:26] parse manifest_path="/home/kjzl/Desktop/dev-projects/frb_bug_report/rust/Cargo.toml"
[2024-02-20T13:23:02.310Z DEBUG /home/kjzl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flutter_rust_bridge_codegen-2.0.0-dev.24/src/library/codegen/parser/source_graph/module_parser.rs:31] parse START info=ModuleInfo { visibility: Public, file_path: "/home/kjzl/Desktop/dev-projects/frb_bug_report/rust/src/lib.rs", module_path: ["crate"] }
[2024-02-20T13:23:02.310Z DEBUG /home/kjzl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flutter_rust_bridge_codegen-2.0.0-dev.24/src/library/codegen/parser/source_graph/module_parser.rs:150] parse_syn_item_mod module_path=["crate", "api"]
[2024-02-20T13:23:02.310Z DEBUG /home/kjzl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flutter_rust_bridge_codegen-2.0.0-dev.24/src/library/codegen/parser/source_graph/module_parser.rs:202] parse_syn_item_mod_contentless module_path=["crate", "api"]
[2024-02-20T13:23:02.310Z DEBUG /home/kjzl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flutter_rust_bridge_codegen-2.0.0-dev.24/src/library/codegen/parser/source_graph/module_parser.rs:205] file_path_candidates "api" "/home/kjzl/Desktop/dev-projects/frb_bug_report/rust/src/lib.rs" ["/home/kjzl/Desktop/dev-projects/frb_bug_report/rust/src/api.rs", "/home/kjzl/Desktop/dev-projects/frb_bug_report/rust/src/api/mod.rs", "/home/kjzl/Desktop/dev-projects/frb_bug_report/rust/src/lib/api.rs", "/home/kjzl/Desktop/dev-projects/frb_bug_report/rust/src/lib/api/mod.rs"]
[2024-02-20T13:23:02.310Z DEBUG /home/kjzl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flutter_rust_bridge_codegen-2.0.0-dev.24/src/library/codegen/parser/reader.rs:22] read_rust_file rust_file_path="/home/kjzl/Desktop/dev-projects/frb_bug_report/rust/src/api/mod.rs" module=Some("api")
[2024-02-20T13:23:02.311Z DEBUG /home/kjzl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flutter_rust_bridge_codegen-2.0.0-dev.24/src/library/commands/cargo_expand.rs:27] CachedCargoExpand execute manifest_dir= rust_crate_dir="/home/kjzl/Desktop/dev-projects/frb_bug_report/rust"
[2024-02-20T13:23:02.311Z DEBUG /home/kjzl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flutter_rust_bridge_codegen-2.0.0-dev.24/src/library/codegen/parser/source_graph/module_parser.rs:216] Trying to parse "/home/kjzl/Desktop/dev-projects/frb_bug_report/rust/src/api/mod.rs"
[2024-02-20T13:23:02.311Z DEBUG /home/kjzl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flutter_rust_bridge_codegen-2.0.0-dev.24/src/library/codegen/parser/source_graph/module_parser.rs:31] parse START info=ModuleInfo { visibility: Public, file_path: "/home/kjzl/Desktop/dev-projects/frb_bug_report/rust/src/api/mod.rs", module_path: ["crate", "api"] }
[2024-02-20T13:23:02.311Z DEBUG /home/kjzl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flutter_rust_bridge_codegen-2.0.0-dev.24/src/library/codegen/parser/source_graph/module_parser.rs:150] parse_syn_item_mod module_path=["crate", "api", "simple"]
[2024-02-20T13:23:02.311Z DEBUG /home/kjzl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flutter_rust_bridge_codegen-2.0.0-dev.24/src/library/codegen/parser/source_graph/module_parser.rs:180] parse_syn_item_mod_contentful module_path=["crate", "api", "simple"]
[2024-02-20T13:23:02.311Z DEBUG /home/kjzl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flutter_rust_bridge_codegen-2.0.0-dev.24/src/library/codegen/parser/source_graph/module_parser.rs:31] parse START info=ModuleInfo { visibility: Public, file_path: "/home/kjzl/Desktop/dev-projects/frb_bug_report/rust/src/api/mod.rs", module_path: ["crate", "api", "simple"] }
[2024-02-20T13:23:02.311Z DEBUG /home/kjzl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flutter_rust_bridge_codegen-2.0.0-dev.24/src/library/codegen/parser/source_graph/module_parser.rs:77] parse END info=ModuleInfo { visibility: Public, file_path: "/home/kjzl/Desktop/dev-projects/frb_bug_report/rust/src/api/mod.rs", module_path: ["crate", "api", "simple"] }
[2024-02-20T13:23:02.311Z DEBUG /home/kjzl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flutter_rust_bridge_codegen-2.0.0-dev.24/src/library/codegen/parser/source_graph/module_parser.rs:77] parse END info=ModuleInfo { visibility: Public, file_path: "/home/kjzl/Desktop/dev-projects/frb_bug_report/rust/src/api/mod.rs", module_path: ["crate", "api"] }
[2024-02-20T13:23:02.311Z DEBUG /home/kjzl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flutter_rust_bridge_codegen-2.0.0-dev.24/src/library/codegen/parser/source_graph/module_parser.rs:150] parse_syn_item_mod module_path=["crate", "frb_generated"]
[2024-02-20T13:23:02.312Z DEBUG /home/kjzl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flutter_rust_bridge_codegen-2.0.0-dev.24/src/library/codegen/parser/source_graph/module_parser.rs:202] parse_syn_item_mod_contentless module_path=["crate", "frb_generated"]
[2024-02-20T13:23:02.312Z DEBUG /home/kjzl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flutter_rust_bridge_codegen-2.0.0-dev.24/src/library/codegen/parser/source_graph/module_parser.rs:205] file_path_candidates "frb_generated" "/home/kjzl/Desktop/dev-projects/frb_bug_report/rust/src/lib.rs" ["/home/kjzl/Desktop/dev-projects/frb_bug_report/rust/src/frb_generated.rs", "/home/kjzl/Desktop/dev-projects/frb_bug_report/rust/src/frb_generated/mod.rs", "/home/kjzl/Desktop/dev-projects/frb_bug_report/rust/src/lib/frb_generated.rs", "/home/kjzl/Desktop/dev-projects/frb_bug_report/rust/src/lib/frb_generated/mod.rs"]
[2024-02-20T13:23:02.312Z DEBUG /home/kjzl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flutter_rust_bridge_codegen-2.0.0-dev.24/src/library/codegen/parser/reader.rs:22] read_rust_file rust_file_path="/home/kjzl/Desktop/dev-projects/frb_bug_report/rust/src/frb_generated.rs" module=Some("frb_generated")
[2024-02-20T13:23:02.312Z DEBUG /home/kjzl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flutter_rust_bridge_codegen-2.0.0-dev.24/src/library/commands/cargo_expand.rs:27] CachedCargoExpand execute manifest_dir= rust_crate_dir="/home/kjzl/Desktop/dev-projects/frb_bug_report/rust"
[2024-02-20T13:23:02.312Z DEBUG /home/kjzl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flutter_rust_bridge_codegen-2.0.0-dev.24/src/library/codegen/parser/source_graph/module_parser.rs:216] Trying to parse "/home/kjzl/Desktop/dev-projects/frb_bug_report/rust/src/frb_generated.rs"
[2024-02-20T13:23:02.317Z DEBUG /home/kjzl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flutter_rust_bridge_codegen-2.0.0-dev.24/src/library/codegen/parser/source_graph/module_parser.rs:31] parse START info=ModuleInfo { visibility: Inherited, file_path: "/home/kjzl/Desktop/dev-projects/frb_bug_report/rust/src/frb_generated.rs", module_path: ["crate", "frb_generated"] }
[2024-02-20T13:23:02.317Z DEBUG /home/kjzl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flutter_rust_bridge_codegen-2.0.0-dev.24/src/library/codegen/parser/source_graph/module_parser.rs:101] parse_syn_item_struct_or_enum item_ident=Ident { sym: MoiArc, span: bytes(1991..1997) }
[2024-02-20T13:23:02.317Z DEBUG /home/kjzl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flutter_rust_bridge_codegen-2.0.0-dev.24/src/library/codegen/parser/source_graph/module_parser.rs:124] parse_syn_item_struct_or_enum item_type=ItemType { attrs: [], vis: Visibility::Inherited, type_token: Type, ident: Ident { sym: ObjectId, span: bytes(5817..5825) }, generics: Generics { lt_token: None, params: [], gt_token: None, where_clause: None }, eq_token: Eq, ty: Type::Path { qself: None, path: Path { leading_colon: None, segments: [PathSegment { ident: Ident { sym: usize, span: bytes(5828..5833) }, arguments: PathArguments::None }] } }, semi_token: Semi }
[2024-02-20T13:23:02.317Z DEBUG /home/kjzl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flutter_rust_bridge_codegen-2.0.0-dev.24/src/library/codegen/parser/source_graph/module_parser.rs:124] parse_syn_item_struct_or_enum item_type=ItemType { attrs: [], vis: Visibility::Public(Pub), type_token: Type, ident: Ident { sym: MoiArcPool, span: bytes(5848..5858) }, generics: Generics { lt_token: Some(Lt), params: [GenericParam::Type(TypeParam { attrs: [], ident: Ident { sym: T, span: bytes(5859..5860) }, colon_token: None, bounds: [], eq_token: None, default: None })], gt_token: Some(Gt), where_clause: None }, eq_token: Eq, ty: Type::Path { qself: None, path: Path { leading_colon: None, segments: [PathSegment { ident: Ident { sym: std, span: bytes(5864..5867) }, arguments: PathArguments::None }, PathSep, PathSegment { ident: Ident { sym: sync, span: bytes(5869..5873) }, arguments: PathArguments::None }, PathSep, PathSegment { ident: Ident { sym: RwLock, span: bytes(5875..5881) }, arguments: PathArguments::AngleBracketed { colon2_token: None, lt_token: Lt, args: [GenericArgument::Type(Type::Path { qself: None, path: Path { leading_colon: None, segments: [PathSegment { ident: Ident { sym: MoiArcPoolInner, span: bytes(5882..5897) }, arguments: PathArguments::AngleBracketed { colon2_token: None, lt_token: Lt, args: [GenericArgument::Type(Type::Path { qself: None, path: Path { leading_colon: None, segments: [PathSegment { ident: Ident { sym: T, span: bytes(5898..5899) }, arguments: PathArguments::None }] } })], gt_token: Gt } }] } })], gt_token: Gt } }] } }, semi_token: Semi }
[2024-02-20T13:23:02.317Z DEBUG /home/kjzl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flutter_rust_bridge_codegen-2.0.0-dev.24/src/library/codegen/parser/source_graph/module_parser.rs:101] parse_syn_item_struct_or_enum item_ident=Ident { sym: MoiArcPoolInner, span: bytes(5918..5933) }
[2024-02-20T13:23:02.317Z DEBUG /home/kjzl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flutter_rust_bridge_codegen-2.0.0-dev.24/src/library/codegen/parser/source_graph/module_parser.rs:101] parse_syn_item_struct_or_enum item_ident=Ident { sym: IdGenerator, span: bytes(6226..6237) }
[2024-02-20T13:23:02.317Z DEBUG /home/kjzl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flutter_rust_bridge_codegen-2.0.0-dev.24/src/library/codegen/parser/source_graph/module_parser.rs:101] parse_syn_item_struct_or_enum item_ident=Ident { sym: MoiArcPoolValue, span: bytes(6810..6825) }
[2024-02-20T13:23:02.317Z DEBUG /home/kjzl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flutter_rust_bridge_codegen-2.0.0-dev.24/src/library/codegen/parser/source_graph/module_parser.rs:124] parse_syn_item_struct_or_enum item_type=ItemType { attrs: [Attribute { pound_token: Pound, style: AttrStyle::Outer, bracket_token: Bracket, meta: Meta::NameValue { path: Path { leading_colon: None, segments: [PathSegment { ident: Ident { sym: doc, span: bytes(7234..7275) }, arguments: PathArguments::None }] }, eq_token: Eq, value: Expr::Lit { attrs: [], lit: Lit::Str { token: " Please refer to `RustOpaque` for doc." } } } }], vis: Visibility::Public(Pub), type_token: Type, ident: Ident { sym: RustOpaqueMoi, span: bytes(7289..7302) }, generics: Generics { lt_token: Some(Lt), params: [GenericParam::Type(TypeParam { attrs: [], ident: Ident { sym: T, span: bytes(7303..7304) }, colon_token: None, bounds: [], eq_token: None, default: None })], gt_token: Some(Gt), where_clause: None }, eq_token: Eq, ty: Type::Path { qself: None, path: Path { leading_colon: Some(PathSep), segments: [PathSegment { ident: Ident { sym: flutter_rust_bridge, span: bytes(7318..7337) }, arguments: PathArguments::None }, PathSep, PathSegment { ident: Ident { sym: for_generated, span: bytes(7339..7352) }, arguments: PathArguments::None }, PathSep, PathSegment { ident: Ident { sym: RustOpaqueBase, span: bytes(7354..7368) }, arguments: PathArguments::AngleBracketed { colon2_token: None, lt_token: Lt, args: [GenericArgument::Type(Type::Path { qself: None, path: Path { leading_colon: None, segments: [PathSegment { ident: Ident { sym: T, span: bytes(7369..7370) }, arguments: PathArguments::None }] } }), Comma, GenericArgument::Type(Type::Path { qself: None, path: Path { leading_colon: None, segments: [PathSegment { ident: Ident { sym: MoiArc, span: bytes(7372..7378) }, arguments: PathArguments::AngleBracketed { colon2_token: None, lt_token: Lt, args: [GenericArgument::Type(Type::Path { qself: None, path: Path { leading_colon: None, segments: [PathSegment { ident: Ident { sym: T, span: bytes(7379..7380) }, arguments: PathArguments::None }] } })], gt_token: Gt } }] } })], gt_token: Gt } }] } }, semi_token: Semi }
[2024-02-20T13:23:02.317Z DEBUG /home/kjzl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flutter_rust_bridge_codegen-2.0.0-dev.24/src/library/codegen/parser/source_graph/module_parser.rs:124] parse_syn_item_struct_or_enum item_type=ItemType { attrs: [Attribute { pound_token: Pound, style: AttrStyle::Outer, bracket_token: Bracket, meta: Meta::NameValue { path: Path { leading_colon: None, segments: [PathSegment { ident: Ident { sym: doc, span: bytes(7388..7500) }, arguments: PathArguments::None }] }, eq_token: Eq, value: Expr::Lit { attrs: [], lit: Lit::Str { token: " A wrapper to support [arbitrary Rust types](https://cjycode.com/flutter_rust_bridge/guides/types/arbitrary)." } } } }], vis: Visibility::Public(Pub), type_token: Type, ident: Ident { sym: RustOpaque, span: bytes(7514..7524) }, generics: Generics { lt_token: Some(Lt), params: [GenericParam::Type(TypeParam { attrs: [], ident: Ident { sym: T, span: bytes(7525..7526) }, colon_token: None, bounds: [], eq_token: None, default: None })], gt_token: Some(Gt), where_clause: None }, eq_token: Eq, ty: Type::Path { qself: None, path: Path { leading_colon: None, segments: [PathSegment { ident: Ident { sym: RustOpaqueMoi, span: bytes(7530..7543) }, arguments: PathArguments::AngleBracketed { colon2_token: None, lt_token: Lt, args: [GenericArgument::Type(Type::Path { qself: None, path: Path { leading_colon: None, segments: [PathSegment { ident: Ident { sym: T, span: bytes(7544..7545) }, arguments: PathArguments::None }] } })], gt_token: Gt } }] } }, semi_token: Semi }
[2024-02-20T13:23:02.317Z DEBUG /home/kjzl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flutter_rust_bridge_codegen-2.0.0-dev.24/src/library/codegen/parser/source_graph/module_parser.rs:124] parse_syn_item_struct_or_enum item_type=ItemType { attrs: [Attribute { pound_token: Pound, style: AttrStyle::Outer, bracket_token: Bracket, meta: Meta::NameValue { path: Path { leading_colon: None, segments: [PathSegment { ident: Ident { sym: doc, span: bytes(7602..7647) }, arguments: PathArguments::None }] }, eq_token: Eq, value: Expr::Lit { attrs: [], lit: Lit::Str { token: " Please refer to `RustAutoOpaque` for doc." } } } }], vis: Visibility::Public(Pub), type_token: Type, ident: Ident { sym: RustAutoOpaqueMoi, span: bytes(7661..7678) }, generics: Generics { lt_token: Some(Lt), params: [GenericParam::Type(TypeParam { attrs: [], ident: Ident { sym: T, span: bytes(7679..7680) }, colon_token: None, bounds: [], eq_token: None, default: None })], gt_token: Some(Gt), where_clause: None }, eq_token: Eq, ty: Type::Path { qself: None, path: Path { leading_colon: Some(PathSep), segments: [PathSegment { ident: Ident { sym: flutter_rust_bridge, span: bytes(7694..7713) }, arguments: PathArguments::None }, PathSep, PathSegment { ident: Ident { sym: for_generated, span: bytes(7715..7728) }, arguments: PathArguments::None }, PathSep, PathSegment { ident: Ident { sym: RustAutoOpaqueBase, span: bytes(7730..7748) }, arguments: PathArguments::AngleBracketed { colon2_token: None, lt_token: Lt, args: [GenericArgument::Type(Type::Path { qself: None, path: Path { leading_colon: None, segments: [PathSegment { ident: Ident { sym: T, span: bytes(7749..7750) }, arguments: PathArguments::None }] } }), Comma, GenericArgument::Type(Type::Path { qself: None, path: Path { leading_colon: None, segments: [PathSegment { ident: Ident { sym: MoiArc, span: bytes(7760..7766) }, arguments: PathArguments::AngleBracketed { colon2_token: None, lt_token: Lt, args: [GenericArgument::Type(Type::Path { qself: None, path: Path { leading_colon: Some(PathSep), segments: [PathSegment { ident: Ident { sym: flutter_rust_bridge, span: bytes(7769..7788) }, arguments: PathArguments::None }, PathSep, PathSegment { ident: Ident { sym: for_generated, span: bytes(7790..7803) }, arguments: PathArguments::None }, PathSep, PathSegment { ident: Ident { sym: rust_async, span: bytes(7805..7815) }, arguments: PathArguments::None }, PathSep, PathSegment { ident: Ident { sym: RwLock, span: bytes(7817..7823) }, arguments: PathArguments::AngleBracketed { colon2_token: None, lt_token: Lt, args: [GenericArgument::Type(Type::Path { qself: None, path: Path { leading_colon: None, segments: [PathSegment { ident: Ident { sym: T, span: bytes(7824..7825) }, arguments: PathArguments::None }] } })], gt_token: Gt } }] } })], gt_token: Gt } }] } })], gt_token: Gt } }] } }, semi_token: Semi }
[2024-02-20T13:23:02.318Z DEBUG /home/kjzl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flutter_rust_bridge_codegen-2.0.0-dev.24/src/library/codegen/parser/source_graph/module_parser.rs:124] parse_syn_item_struct_or_enum item_type=ItemType { attrs: [Attribute { pound_token: Pound, style: AttrStyle::Outer, bracket_token: Bracket, meta: Meta::NameValue { path: Path { leading_colon: None, segments: [PathSegment { ident: Ident { sym: doc, span: bytes(7834..7900) }, arguments: PathArguments::None }] }, eq_token: Eq, value: Expr::Lit { attrs: [], lit: Lit::Str { token: " Usually this is unneeded, and just write down arbitrary types." } } } }, Attribute { pound_token: Pound, style: AttrStyle::Outer, bracket_token: Bracket, meta: Meta::NameValue { path: Path { leading_colon: None, segments: [PathSegment { ident: Ident { sym: doc, span: bytes(7905..7985) }, arguments: PathArguments::None }] }, eq_token: Eq, value: Expr::Lit { attrs: [], lit: Lit::Str { token: " However, when you need arbitrary types at places that are not supported yet," } } } }, Attribute { pound_token: Pound, style: AttrStyle::Outer, bracket_token: Bracket, meta: Meta::NameValue { path: Path { leading_colon: None, segments: [PathSegment { ident: Ident { sym: doc, span: bytes(7990..8036) }, arguments: PathArguments::None }] }, eq_token: Eq, value: Expr::Lit { attrs: [], lit: Lit::Str { token: " use `RustOpaqueOpaque<YourArbitraryType>`." } } } }], vis: Visibility::Public(Pub), type_token: Type, ident: Ident { sym: RustAutoOpaque, span: bytes(8050..8064) }, generics: Generics { lt_token: Some(Lt), params: [GenericParam::Type(TypeParam { attrs: [], ident: Ident { sym: T, span: bytes(8065..8066) }, colon_token: None, bounds: [], eq_token: None, default: None })], gt_token: Some(Gt), where_clause: None }, eq_token: Eq, ty: Type::Path { qself: None, path: Path { leading_colon: None, segments: [PathSegment { ident: Ident { sym: RustAutoOpaqueMoi, span: bytes(8070..8087) }, arguments: PathArguments::AngleBracketed { colon2_token: None, lt_token: Lt, args: [GenericArgument::Type(Type::Path { qself: None, path: Path { leading_colon: None, segments: [PathSegment { ident: Ident { sym: T, span: bytes(8088..8089) }, arguments: PathArguments::None }] } })], gt_token: Gt } }] } }, semi_token: Semi }
[2024-02-20T13:23:02.318Z DEBUG /home/kjzl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flutter_rust_bridge_codegen-2.0.0-dev.24/src/library/codegen/parser/source_graph/module_parser.rs:101] parse_syn_item_struct_or_enum item_ident=Ident { sym: StreamSink, span: bytes(9745..9755) }
[2024-02-20T13:23:02.318Z DEBUG /home/kjzl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flutter_rust_bridge_codegen-2.0.0-dev.24/src/library/codegen/parser/source_graph/module_parser.rs:101] parse_syn_item_struct_or_enum item_ident=Ident { sym: FLUTTER_RUST_BRIDGE_HANDLER, span: bytes(11806..11833) }
[2024-02-20T13:23:02.318Z DEBUG /home/kjzl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flutter_rust_bridge_codegen-2.0.0-dev.24/src/library/codegen/parser/source_graph/module_parser.rs:101] parse_syn_item_struct_or_enum item_ident=Ident { sym: Local_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockExifDt, span: bytes(20369..20451) }
[2024-02-20T13:23:02.318Z DEBUG /home/kjzl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flutter_rust_bridge_codegen-2.0.0-dev.24/src/library/codegen/parser/source_graph/module_parser.rs:150] parse_syn_item_mod module_path=["crate", "frb_generated", "io"]
[2024-02-20T13:23:02.318Z DEBUG /home/kjzl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flutter_rust_bridge_codegen-2.0.0-dev.24/src/library/codegen/parser/source_graph/module_parser.rs:180] parse_syn_item_mod_contentful module_path=["crate", "frb_generated", "io"]
[2024-02-20T13:23:02.318Z DEBUG /home/kjzl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flutter_rust_bridge_codegen-2.0.0-dev.24/src/library/codegen/parser/source_graph/module_parser.rs:31] parse START info=ModuleInfo { visibility: Inherited, file_path: "/home/kjzl/Desktop/dev-projects/frb_bug_report/rust/src/frb_generated.rs", module_path: ["crate", "frb_generated", "io"] }
[2024-02-20T13:23:02.318Z DEBUG /home/kjzl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flutter_rust_bridge_codegen-2.0.0-dev.24/src/library/codegen/parser/source_graph/module_parser.rs:77] parse END info=ModuleInfo { visibility: Inherited, file_path: "/home/kjzl/Desktop/dev-projects/frb_bug_report/rust/src/frb_generated.rs", module_path: ["crate", "frb_generated", "io"] }
[2024-02-20T13:23:02.318Z DEBUG /home/kjzl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flutter_rust_bridge_codegen-2.0.0-dev.24/src/library/codegen/parser/source_graph/module_parser.rs:77] parse END info=ModuleInfo { visibility: Inherited, file_path: "/home/kjzl/Desktop/dev-projects/frb_bug_report/rust/src/frb_generated.rs", module_path: ["crate", "frb_generated"] }
[2024-02-20T13:23:02.318Z DEBUG /home/kjzl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flutter_rust_bridge_codegen-2.0.0-dev.24/src/library/codegen/parser/source_graph/module_parser.rs:77] parse END info=ModuleInfo { visibility: Public, file_path: "/home/kjzl/Desktop/dev-projects/frb_bug_report/rust/src/lib.rs", module_path: ["crate"] }
[2024-02-20T13:23:02.319Z DEBUG /home/kjzl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flutter_rust_bridge_codegen-2.0.0-dev.24/src/library/codegen/parser/function_parser/mod.rs:67] parse_function function name: Ident { sym: get_chrono_dt, span: bytes(46..59) }
[2024-02-20T13:23:02.319Z DEBUG /home/kjzl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flutter_rust_bridge_codegen-2.0.0-dev.24/src/library/codegen/parser/function_parser/mod.rs:67] parse_function function name: Ident { sym: get_exif_dt_aliased, span: bytes(223..242) }
[2024-02-20T13:23:02.319Z DEBUG /home/kjzl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flutter_rust_bridge_codegen-2.0.0-dev.24/src/library/codegen/parser/function_parser/mod.rs:67] parse_function function name: Ident { sym: get_exif_dt, span: bytes(373..384) }
[0.3s] Parse ⠐
  └── [0.2s] Run cargo expand  
  └── [0.1s] Parse source graph                                                                                                                                                   [2024-02-20T13:23:02.319Z ERROR /home/kjzl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flutter_rust_bridge_codegen-2.0.0-dev.24/src/library/utils/logs.rs:52] panicked at /home/kjzl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flutter_rust_bridge_codegen-2.0.0-dev.24/src/library/codegen/parser/type_parser/concrete.rs:79:38:
index out of bounds: the len is 0 but the index is 0
thread 'main' panicked at /home/kjzl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flutter_rust_bridge_codegen-2.0.0-dev.24/src/library/codegen/parser/type_parser/concrete.rs:79:38:
index out of bounds: the len is 0 but the index is 0
stack backtrace:
   0: rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::panicking::panic_bounds_check
   3: lib_flutter_rust_bridge_codegen::library::codegen::parser::type_parser::path::<impl lib_flutter_rust_bridge_codegen::library::codegen::parser::type_parser::TypeParserWithContext>::parse_type_path_core
   4: lib_flutter_rust_bridge_codegen::library::codegen::parser::type_parser::ty::<impl lib_flutter_rust_bridge_codegen::library::codegen::parser::type_parser::TypeParserWithContext>::parse_type
   5: lib_flutter_rust_bridge_codegen::library::codegen::parser::function_parser::output::<impl lib_flutter_rust_bridge_codegen::library::codegen::parser::function_parser::FunctionParser>::parse_fn_output
   6: lib_flutter_rust_bridge_codegen::library::codegen::parser::function_parser::FunctionParser::parse_function
   7: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::try_fold
   8: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
   9: core::iter::adapters::try_process
  10: lib_flutter_rust_bridge_codegen::library::codegen::generate_once
  11: lib_flutter_rust_bridge_codegen::library::codegen::controller::run
  12: lib_flutter_rust_bridge_codegen::library::codegen::generate
  13: flutter_rust_bridge_codegen::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Expected behavior

No response

Generated binding code

No response

OS

No response

Version of flutter_rust_bridge_codegen

2.0.0-dev.24

Flutter info

No response

Version of clang++

No response

Additional context

No response

Hi! Thanks for opening your first issue here! 😄

Yes, that looks like a bug. The problem is that, it is nontrivial to understand where a DateTime word comes from. For example:

  • use chrono::DateTime; fn f() -> DateTime {}
  • use exif::DateTime; fn f() -> DateTime {}
  • use x::Y as DateTime; fn f() -> DateTime {}
  • use chrono::*; fn f() -> DateTime {}
  • use exif::*; fn f() -> DateTime {}
  • use exif as chrono; fn f() -> chrono::DateTime {}
  • ...

However, for your specific case, it is reasonable to assume anything::DateTime is not a chrono datetime when anything != chrono. Feel free to PR, alternatively I will fix it in the next batch (hopefully within a week)!

A quick workaround before the real fix is that, use exif::DateTime as ExifDateTime to avoid name conflict.

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new issue.