Bevy: Add #[non_exhaustive] to public API structs

Created on 16 Aug 2020  路  2Comments  路  Source: bevyengine/bevy

https://doc.rust-lang.org/reference/attributes/type_system.html#the-non_exhaustive-attribute

That's a cool backward compat tool, but it also prevent users from using struct expressions
https://internals.rust-lang.org/t/pre-rfc-relaxed-non-exhaustive-structs/11977/16

enhancement

Most helpful comment

wgpu-rs was running into the same issue. I did a little bit of investigative work to see how difficult it would be to add support for #[non_exhaustive(pub)] to rustc. It didn't seem too hard, but the timeline involved was unfortunate.

All 2 comments

Yeah we rely pretty heavily on ..Default::default() to make the entity building api nice, so we can't lose that. Definitely worth looking into though.

wgpu-rs was running into the same issue. I did a little bit of investigative work to see how difficult it would be to add support for #[non_exhaustive(pub)] to rustc. It didn't seem too hard, but the timeline involved was unfortunate.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cart picture cart  路  80Comments

cart picture cart  路  18Comments

hollg picture hollg  路  13Comments

cart picture cart  路  22Comments

thefuntastic picture thefuntastic  路  23Comments