-
Notifications
You must be signed in to change notification settings - Fork 13.3k
docs: std::slice::from_raw_parts() does not mention that p must be non-null even for zero length slices #26552
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
Comments
Is there any API that accepts a null raw pointer? |
What about ptr::copy if the count is zero? |
@gankro transmute does :) println!("{:?}", unsafe {
::std::mem::transmute::<*const u8, Option<&u8>>(::std::ptr::null())
}); |
@nagisa I suppose I implicitly meant "explicitly accepts a pointer, and not some opaque T" |
steveklabnik
added a commit
to steveklabnik/rust
that referenced
this issue
Jul 8, 2015
Added a proper Unsafety header, as well as mentioning that the pointer shouldn't be null. Fixes rust-lang#26552
steveklabnik
added a commit
to steveklabnik/rust
that referenced
this issue
Jul 8, 2015
Added a proper Unsafety header, as well as mentioning that the pointer shouldn't be null. Fixes rust-lang#26552
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Link to the docs in question: https://doc.rust-lang.org/nightly/std/slice/fn.from_raw_parts.html
The text was updated successfully, but these errors were encountered: