-
Notifications
You must be signed in to change notification settings - Fork 743
pointer constness is applied to pointee #511
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thanks for the bug report! |
Note to whoever tackles this (including potentially myself): The fix for this seems straight-forward but isn't (removing The reason why it's not so trivial is that we lose constness info when finding an already resolved type, and the proper way to fix this is a proper |
I ported some code and was checking with
the code I wrote looks like this:
Note that in both cases( |
Yeah, there's more ongoing discussion to fix this in #534. |
It seems to be even worse for (externally defined?) arrays. extern RduinoSerial * const RDUINO_SERIAL_PORTS[6]; turns into: extern "C" {
#[link_name = "RDUINO_SERIAL_PORTS"]
pub static mut RDUINO_SERIAL_PORTS: [*const RduinoSerial; 6usize];
} The elements of the array should obviously not be mutable, but the objects that those elements point to, should be mutable. The constness on these bindings is completely in reverse. |
C header:
I run:
I expect:
I get (
c
is*const
instead of*mut
):Debug log:
The text was updated successfully, but these errors were encountered: