Plugin compatibility checking uses non-ABI-stable types
Describe the bug
When loading a plugin the loader and plugin assume that the zenoh_plugin_trait::Compatibility type is ABI-stable enough to pass between arbitrary versions to then verify if they are compatible.
This type is itself repr(C), but it contains repr(Rust) types:
https://github.com/eclipse-zenoh/zenoh/blob/2f955cc8749a8451d193eb4b4060e46e30165804/plugins/zenoh-plugin-trait/src/compatibility.rs#L57-L66
There's a few potentially unstable type layouts here and in sub-types:
&'static str: still undefined, it may be e.g.(len, ptr)or(ptr, len)Option<RustcVersion>/Option<PluginStructVersion>: both of these sub-structs, while beingrepr(C), contain multiple fields with niches, theOptiondiscriminant may be packed in different niches, or kept as a separate tag field. If stored as a tag field the byte value used may be different in different compilations.
To reproduce
Probably requires compiling with different compiler versions with different niche heuristics and/or -Zbuild-std/-Zrandomize-layout. I'm not certain there are existing compilers that have different enough behavior to trigger these problems, but they're at least allowed by the current specifications.
System info
irrelevant
Agree with you. This is confirmed here https://users.rust-lang.org/t/repr-c-on-nested-structs/110654 This should be fixed together with this task I suppose: https://github.com/eclipse-zenoh/zenoh/issues/1745