Skip to content
Prev 61538 / 63424 Next

Breaking Change in Rcomplex Layout?

Hi Tomas,

Thanks for this explanation. As you can probably tell I'm not much of a C
person, so I didn't realise this change would be invisible to C users. I
suppose R's stability contract only applies to C, and therefore changes
that break other languages such as Rust are out of scope. You are right
that this error is confused by bindgen's inability to handle anonymous
types, but even without that it would be a breaking change in Rust because
code that accesses r or c must now access the struct variant of the union
and then access the struct field. Also, this code has to now be in an
unsafe block because of the potential to read from the wrong variant
<https://doc.rust-lang.org/reference/items/unions.html#reading-and-writing-union-fields>.
I guess we will have to handle this using some kind of compile-time
abstraction that handles this type differently depending on the R version
being used.

Cheers

On Tue, Apr 4, 2023 at 12:15?AM Tomas Kalibera <tomas.kalibera at gmail.com>
wrote: