flatbuffers
flatbuffers copied to clipboard
Name clash in generated Rust code (regression in 2.0.0)
trafficstars
The following worked fine in 0.12:
union stage {LS_IN_PRE_LB, LS_OUT_PRE_LB}
table __Table_stage {
v: stage;
}
table Flow {
stage: stage; // NOTE: field name shadows union name, which is valid `.fbs` syntax
}
but in 2.0.0, I get the following error:
error[E0530]: function parameters cannot shadow tuple structs
--> src/flatbuf_generated.rs:3658:31
|
42 | pub struct stage(pub u8);
| ------------------------- the tuple struct `stage` is defined here
...
3658 | pub fn add_stage(&mut self, stage: flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>) {
| ^^^^^ cannot be named the same as a tuple struct
Looking into it, union stage used to compile into a Rust enum in 0.12, but in 2.0 it is a tuple struct, which is not allowed to name-clash with a function argument.
This issue is stale because it has been open 6 months with no activity. Please comment or this will be closed in 14 days.