-
Notifications
You must be signed in to change notification settings - Fork 5
add ptr getter method #37
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
Conversation
Oh, a MSRV problem, and you suggested a tool that solves this I think... |
This is odd. Apparently, on older Rust compiler, I am leaking a private type. I just wonder why this is not an issue on newer versions of Rustc |
Okay, this has a caveat: The generated code now required the |
f83b0c6
to
5865604
Compare
5865604
to
cd716e4
Compare
Oh, is this because it's a pub function that returns a type that might not be pub? |
Maybe this API should be hidden behind an attribute, people can generate code that doesn't use rustversion if they prefer? I'm still confused why it was OK Maybe related to https://blog.rust-lang.org/2023/11/16/Rust-1.74.0.html? |
Lukas suggests: let vis = &input.vis;
...
quote! {
/// Retrieve the base pointer for this MMIO handle.
#[inline]
$vis const unsafe fn ptr(&self) -> *mut #ident {
self.ptr
}
} |
I see you already created an issue in rust-lang/rust#138982 which might explain this |
Well they say "yes, we changed how the errors are reported". So we probably need to control whether the function is public based on whether the return type is public. |
The suggestion by Lukas worked.. I think this might be the best fix. About the rustversion dependency: With this, |
Thank you! |
Oh, I think an unneded dependency slipped in |
I think I used this to verify the correctness of the pointer offset for a generic HAL API.