Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions library/core/src/io/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,7 @@ impl fmt::Display for Error {
#[stable(feature = "rust1", since = "1.0.0")]
impl error::Error for Error {
#[allow(deprecated)]
#[inline]
fn cause(&self) -> Option<&dyn error::Error> {
match self.repr.data() {
ErrorData::Os(..) => None,
Expand All @@ -543,6 +544,7 @@ impl error::Error for Error {
}
}

#[inline]
fn source(&self) -> Option<&(dyn error::Error + 'static)> {
match self.repr.data() {
ErrorData::Os(..) => None,
Expand Down Expand Up @@ -605,6 +607,7 @@ impl fmt::Debug for Custom {

#[unstable(feature = "core_io_internals", reason = "exposed only for libstd", issue = "none")]
impl Drop for Custom {
#[inline]
fn drop(&mut self) {
// SAFETY: `Custom::from_raw` ensures this call is safe.
unsafe {
Expand All @@ -631,19 +634,22 @@ impl Custom {
}

#[unstable(feature = "core_io_internals", reason = "exposed only for libstd", issue = "none")]
#[inline]
pub fn into_raw(self) -> crate::ptr::NonNull<dyn error::Error + Send + Sync> {
let ptr = self.error;
core::mem::forget(self);
ptr
}

#[inline]
fn error_ref(&self) -> &(dyn error::Error + Send + Sync + 'static) {
// SAFETY:
// `from_raw` ensures `error` is a valid pointer up to a static lifetime
// and is owned by `self`
unsafe { self.error.as_ref() }
}

#[inline]
fn error_mut(&mut self) -> &mut (dyn error::Error + Send + Sync + 'static) {
// SAFETY:
// `from_raw` ensures `error` is a valid pointer up to a static lifetime
Expand All @@ -668,6 +674,7 @@ unsafe impl Sync for CustomOwner {}

#[unstable(feature = "core_io_internals", reason = "exposed only for libstd", issue = "none")]
impl Drop for CustomOwner {
#[inline]
fn drop(&mut self) {
// SAFETY: `CustomOwner::from_raw` ensures this call is safe.
unsafe {
Expand All @@ -687,6 +694,7 @@ impl CustomOwner {
}

#[unstable(feature = "core_io_internals", reason = "exposed only for libstd", issue = "none")]
#[inline]
pub fn into_raw(self) -> crate::ptr::NonNull<Custom> {
let ptr = self.0;
core::mem::forget(self);
Expand Down
1 change: 1 addition & 0 deletions library/core/src/io/error/os_functions_atomic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ use crate::sync::atomic;
static OS_FUNCTIONS: atomic::AtomicPtr<OsFunctions> =
atomic::AtomicPtr::new(OsFunctions::DEFAULT as *const _ as *mut _);

#[inline]
fn get_os_functions() -> &'static OsFunctions {
// SAFETY:
// * `OS_FUNCTIONS` is initially a pointer to `OsFunctions::DEFAULT`, which is valid for a static lifetime.
Expand Down
1 change: 1 addition & 0 deletions library/core/src/io/error/repr_bitpacked.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ unsafe impl Send for Repr {}
unsafe impl Sync for Repr {}

impl Repr {
#[inline]
pub(super) fn new_custom(b: CustomOwner) -> Self {
let p = b.into_raw().as_ptr().cast::<u8>();
// Should only be possible if an allocator handed out a pointer with
Expand Down
2 changes: 2 additions & 0 deletions library/core/src/io/io_slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ impl<'a> IoSliceMut<'a> {
/// assert_eq!(&data, b"Abcdef");
/// ```
#[unstable(feature = "io_slice_as_bytes", issue = "132818")]
#[inline]
pub const fn into_slice(self) -> &'a mut [u8] {
self.0.into_slice()
}
Expand Down Expand Up @@ -323,6 +324,7 @@ impl<'a> IoSlice<'a> {
/// assert_eq!(io_slice.as_slice(), b"def");
/// ```
#[unstable(feature = "io_slice_as_bytes", issue = "132818")]
#[inline]
pub const fn as_slice(self) -> &'a [u8] {
self.0.as_slice()
}
Expand Down
1 change: 1 addition & 0 deletions library/core/src/net/ip_addr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2480,6 +2480,7 @@ macro_rules! bitop_impls {

$(#[$attr])*
const impl $BitOpAssign<&'_ $ty> for $ty {
#[inline]
fn $bitop_assign(&mut self, rhs: &'_ $ty) {
self.$bitop_assign(*rhs);
}
Expand Down
Loading