-
Notifications
You must be signed in to change notification settings - Fork 503
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
Bug: _Impl trait should use unsafe fn
if any of its parameters are pointers
#1506
Comments
Good feedback - thanks! Will add detection for this and use |
BTW, can this specific function accept a tuple as a return type instead? |
I'm not sure what you mean. Do you have an example? |
I mean, IWICBitmapSource_Impl::GetSize has two |
The challenge is figuring out whether it is appropriate just by looking at the metadata. |
Regarding the original issue/question, I think I need to finally look a little closer at how we delineate what is safe and unsafe in the Windows API. Right now, all WinRT APIs are safe and the rest are not. That is somewhat arbitrary, and I'd like to do something perhaps more in line with clippy's decision making here where it depends on the signature of a particular function. |
Could this be implemented as an attribute within the win32metadata? "This function is sound to call with any arguments/environment, requiring only the parameters satisfy the listed types" |
You could ask them. I doubt it would be simple to figure out though, given the large scope of APIs. I also think .NET has its own interpretation of safety here so it may be language specific. .NET seems to define a method as unsafe if any of its parameters include a pointer but doesn't account for value types that contain pointers. 🤷♂️ |
Which crate is this about?
windows
Crate version
0.32.0
Summary
Expected behavior
It should be an
unsafe fn
as the implementation is expected to dereference the pointer parameters.Actual behavior
Everything is just a safe
fn
.Additional comments
cargo clippy
is unsatisfied:The text was updated successfully, but these errors were encountered: