mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
Rollup merge of #153384 - safer-rust:main, r=oli-obk
Add missing safety doc for CString::from_vec_unchecked and async_drop_in_place Add missing safety documentation for two unsafe APIs: * `CString::from_vec_unchecked` – # Safety: the caller must ensure `v` contains no NUL bytes in its contents. * `async_drop_in_place` – # Safety: see [`ptr::drop_in_place`] for safety requirements.
This commit is contained in:
@@ -321,6 +321,10 @@ fn spec_new_impl(self) -> Result<CString, NulError> {
|
||||
/// assertion is made that `v` contains no 0 bytes, and it requires an
|
||||
/// actual byte vector, not anything that can be converted to one with Into.
|
||||
///
|
||||
/// # Safety
|
||||
///
|
||||
/// The caller must ensure `v` contains no nul bytes in its contents.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
|
||||
@@ -41,6 +41,15 @@ pub trait AsyncDrop {
|
||||
}
|
||||
|
||||
/// Async drop.
|
||||
///
|
||||
/// # Safety
|
||||
///
|
||||
/// The pointer `_to_drop` must be valid for both reads and writes,
|
||||
/// not only for the duration of this function call,
|
||||
/// but also until the returned future has completed.
|
||||
/// See [ptr::drop_in_place] for additional safety concerns.
|
||||
///
|
||||
/// [ptr::drop_in_place]: crate::ptr::drop_in_place()
|
||||
#[unstable(feature = "async_drop", issue = "126482")]
|
||||
#[lang = "async_drop_in_place"]
|
||||
pub async unsafe fn async_drop_in_place<T: ?Sized>(_to_drop: *mut T) {
|
||||
|
||||
Reference in New Issue
Block a user