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 a special case for CStr/CString in the improper_ctypes lint #120176
base: master
Are you sure you want to change the base?
Conversation
r? @cjgillot (rustbot has picked a reviewer for you, use r? to override) |
5868441
to
e607e99
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if there could be better suggestions that use binding.as_ptr()
instead of CStr::as_ptr
? I don't think it really matters though.
e607e99
to
f971408
Compare
|
f971408
to
ce02406
Compare
ce02406
to
7f67ee3
Compare
d80eb55
to
889a1fb
Compare
r? @cjgillot |
Could not assign reviewer from: |
☔ The latest upstream changes (presumably #122852) made this pull request unmergeable. Please resolve the merge conflicts. |
889a1fb
to
2ef3825
Compare
Some changes occurred in src/tools/cargo cc @ehuss |
Oops, didn't mean to touch all the submodules |
This comment has been minimized.
This comment has been minimized.
2ef3825
to
17ebcd2
Compare
This comment has been minimized.
This comment has been minimized.
Instead of saying to "consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct", we now tell users to "Use `*const ffi::c_char` instead, and pass the value from `CStr::as_ptr()`" when the type involved is a `CStr` or a `CString`. Inspired by a conversation on the #beginners Discord channel.
17ebcd2
to
4ea52f1
Compare
Instead of saying to "consider adding a
#[repr(C)]
or#[repr(transparent)]
attribute to this struct", we now tell users to "Use*const ffi::c_char
instead, and pass the value fromCStr::as_ptr()
" when the type involved is aCStr
or aCString
.Inspired by a conversation on the #beginners Discord channel.