-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
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
@bors r+ |
…illot Add a special case for CStr/CString in the improper_ctypes lint 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.
The job Click to see the possible cause of the failure (guessed by this bot)
|
💔 Test failed - checks-actions |
(sync) |
@Flying-Toast Can you update/fix the failing tests? |
Closing this as inactive. Feel free to reöpen this pr or create a new pr if you get the time to work on this. Thanks |
Add a special case for `CStr`/`CString` in the `improper_ctypes` lint Revives rust-lang#120176. Just needed to bless a test and fix an argument, but seemed reasonable to me otherwise. 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`. The suggestion is not made for `&mut CString` or `*mut CString`. r? `@cjgillot` (since you were the reviewer of the original PR rust-lang#120176, but feel free to reroll)
Add a special case for `CStr`/`CString` in the `improper_ctypes` lint Revives rust-lang#120176. Just needed to bless a test and fix an argument, but seemed reasonable to me otherwise. 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`. The suggestion is not made for `&mut CString` or `*mut CString`. r? ``@cjgillot`` (since you were the reviewer of the original PR rust-lang#120176, but feel free to reroll)
Add a special case for `CStr`/`CString` in the `improper_ctypes` lint Revives rust-lang#120176. Just needed to bless a test and fix an argument, but seemed reasonable to me otherwise. 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`. The suggestion is not made for `&mut CString` or `*mut CString`. r? ```@cjgillot``` (since you were the reviewer of the original PR rust-lang#120176, but feel free to reroll)
Add a special case for `CStr`/`CString` in the `improper_ctypes` lint Revives rust-lang#120176. Just needed to bless a test and fix an argument, but seemed reasonable to me otherwise. 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`. The suggestion is not made for `&mut CString` or `*mut CString`. r? ````@cjgillot```` (since you were the reviewer of the original PR rust-lang#120176, but feel free to reroll)
Add a special case for `CStr`/`CString` in the `improper_ctypes` lint Revives rust-lang#120176. Just needed to bless a test and fix an argument, but seemed reasonable to me otherwise. 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`. The suggestion is not made for `&mut CString` or `*mut CString`. r? `````@cjgillot````` (since you were the reviewer of the original PR rust-lang#120176, but feel free to reroll)
Add a special case for `CStr`/`CString` in the `improper_ctypes` lint Revives rust-lang#120176. Just needed to bless a test and fix an argument, but seemed reasonable to me otherwise. 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`. The suggestion is not made for `&mut CString` or `*mut CString`. r? ``````@cjgillot`````` (since you were the reviewer of the original PR rust-lang#120176, but feel free to reroll)
Rollup merge of rust-lang#128735 - jieyouxu:pr-120176-revive, r=cjgillot Add a special case for `CStr`/`CString` in the `improper_ctypes` lint Revives rust-lang#120176. Just needed to bless a test and fix an argument, but seemed reasonable to me otherwise. 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`. The suggestion is not made for `&mut CString` or `*mut CString`. r? ``````@cjgillot`````` (since you were the reviewer of the original PR rust-lang#120176, but feel free to reroll)
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.