Skip to content

Commit

Permalink
Add inline attr to private CString::into_inner
Browse files Browse the repository at this point in the history
  • Loading branch information
elichai committed May 26, 2021
1 parent cdbe288 commit 45099e6
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions library/std/src/ffi/c_str.rs
Expand Up @@ -672,6 +672,7 @@ impl CString {
}

/// Bypass "move out of struct which implements [`Drop`] trait" restriction.
#[inline]
fn into_inner(self) -> Box<[u8]> {
// Rationale: `mem::forget(self)` invalidates the previous call to `ptr::read(&self.inner)`
// so we use `ManuallyDrop` to ensure `self` is not dropped.
Expand Down

0 comments on commit 45099e6

Please sign in to comment.