-
Notifications
You must be signed in to change notification settings - Fork 12
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
Add repr(transparent)
to VolatileCell
#5
Comments
This was referenced Apr 22, 2019
Merged
@japaric This seems very useful to have. |
bors bot
added a commit
to rust-embedded/svd2rust
that referenced
this issue
Nov 19, 2020
480: Add repr(transparent) to Reg struct r=therealprof a=couchand To guarantee that the register has the proper layout so that the [cast](https://github.com/rust-embedded/svd2rust/blob/971814070cd7be848d3c6524734192903de66866/src/generate/peripheral.rs#L63) of an integer to a `*const RegisterBlock` is sound. Note that this is necessary but not sufficient. The underlying `VolatileCell` also currently uses the default repr. There is an open [issue](japaric/vcell#5) and [PR](https://github.com/japaric/vcell/pull/6/files) to address the concern. Co-authored-by: Andrew Dona-Couch <hi@andrewcou.ch>
What is the current state here? I was quite surprised, that There is already a PR for this: #6 |
Merged and published in |
jannic
added a commit
to jannic-dev-forks/rp2040-pac
that referenced
this issue
Aug 2, 2023
The depenency used to be on version 0.1.0, but the pac doesn't actually compile with that version: ``` error[E0599]: no method named `as_ptr` found for struct `vcell::VolatileCell` in the current scope --> src/generic.rs:101:23 | 101 | self.register.as_ptr() | ^^^^^^ method not found in `VolatileCell<<REG as RegisterSpec>::Ux>` ``` `as_ptr` was added in version 0.1.1 of vcell, but that version is marked as yanked for unknown reasons. (japaric/vcell#13) Version 0.1.2 would have been another option, but 0.1.3 contains a fix for japaric/vcell#5 which looks important.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
repr(tranparent)
guarantees the same layout and ABI as one single field for the struct with a single field. So, we can guaranteeVolatileCell<T>
layout and ABI asT
.This struct is already used in the code generated by svd2rust and it is ABI sensitive because it is used in structs with
repr(C)
.The text was updated successfully, but these errors were encountered: