flatbuffers
flatbuffers copied to clipboard
[rust] Unions named after reserved words result in code that won't compile
Using flatc with the attached schema definition Schema.fbs.txt
results in a bunch of misgenerated code:
error[E0599]: no method named `type__type` found for reference `&Schema_generated::Field<'a>` in the current scope
--> /Users/max/target/debug/build/schema-023e5b641b3ecce8/out/flatbuffers/Schema_generated.rs:3813:13
|
3813 | if self.type__type() == Type::Null {
| ^^^^^^^^^^ help: there is an associated function with a similar name: `type_`
error[E0599]: no method named `type__type` found for reference `&Schema_generated::Field<'a>` in the current scope
--> /Users/max/target/debug/build/schema-023e5b641b3ecce8/out/flatbuffers/Schema_generated.rs:3828:13
|
3828 | if self.type__type() == Type::Int {
| ^^^^^^^^^^ help: there is an associated function with a similar name: `type_`
error[E0599]: no method named `type__type` found for reference `&Schema_generated::Field<'a>` in the current scope
--> /Users/max/target/debug/build/schema-023e5b641b3ecce8/out/flatbuffers/Schema_generated.rs:3843:13
|
3843 | if self.type__type() == Type::FloatingPoint {
| ^^^^^^^^^^ help: there is an associated function with a similar name: `type_`
error[E0599]: no method named `type__type` found for reference `&Schema_generated::Field<'a>` in the current scope
--> /Users/max/target/debug/build/schema-023e5b641b3ecce8/out/flatbuffers/Schema_generated.rs:3858:13
|
3858 | if self.type__type() == Type::Binary {
| ^^^^^^^^^^ help: there is an associated function with a similar name: `type_`
error[E0599]: no method named `type__type` found for reference `&Schema_generated::Field<'a>` in the current scope
--> /Users/max/target/debug/build/schema-023e5b641b3ecce8/out/flatbuffers/Schema_generated.rs:3873:13
|
3873 | if self.type__type() == Type::Utf8 {
| ^^^^^^^^^^ help: there is an associated function with a similar name: `type_`
error[E0599]: no method named `type__type` found for reference `&Schema_generated::Field<'a>` in the current scope
--> /Users/max/target/debug/build/schema-023e5b641b3ecce8/out/flatbuffers/Schema_generated.rs:3888:13
|
3888 | if self.type__type() == Type::Bool {
| ^^^^^^^^^^ help: there is an associated function with a similar name: `type_`
...
This seems to be a regression of https://github.com/google/flatbuffers/pull/5592
@CasperN
I've added the failing case to a branch here: https://github.com/urbanlogiq/flatbuffers/tree/flatbuffers-7617