flatbuffers icon indicating copy to clipboard operation
flatbuffers copied to clipboard

Consider removing 'size' and 'alignment' as Rust keywords

Open csmulhern opened this issue 2 years ago • 5 comments

size and alignment are considered "reserved words" for Namer purposes.

See: https://github.com/google/flatbuffers/blob/205285c35c164c0368c913b3f611cf8d672bc103/src/idl_gen_rust.cpp#L134-L135

This is because these identifiers are used in the flatbuffers::Push trait. See: https://docs.rs/flatbuffers/latest/flatbuffers/trait.Push.html#provided-methods.

Can we consider removing these identifiers as reserved keywords? size is an especially common field name. Usages of the respective Push methods (which I expect are rare) can always be done via universal function call syntax (i.e. Push::size(&value) instead of value.size()).

csmulhern avatar Oct 10 '23 01:10 csmulhern

That's a good idea, PRs welcome. (I am not actively maintaining FB-rust anymore, but I will review PRs)

CasperN avatar Oct 29 '23 15:10 CasperN

@CasperN please see #8139.

csmulhern avatar Oct 30 '23 16:10 csmulhern

This issue is stale because it has been open 6 months with no activity. Please comment or label not-stale, or this will be closed in 14 days.

github-actions[bot] avatar Apr 29 '24 20:04 github-actions[bot]

This is not stale. I need someone to review #8139.

csmulhern avatar Apr 29 '24 22:04 csmulhern

@dbaileychess, I see activity from you merging PRs. Can you figure out how to route this appropriately? I've had a PR out for 6 months.

csmulhern avatar Apr 29 '24 22:04 csmulhern