diff --git a/src/sys/env/namespace.rs b/src/sys/env/namespace.rs index 9fe31820..6074a830 100644 --- a/src/sys/env/namespace.rs +++ b/src/sys/env/namespace.rs @@ -77,6 +77,7 @@ impl Env { /// # Safety /// See [remove_var]. #[cfg(all(not(feature = "safe_sys"), feature = "unsafe_thread"))] + #[cfg_attr(feature = "nightly_doc", doc(cfg(feature = "unsafe_thread")))] pub unsafe fn remove_var>(key: K) { unsafe { remove_var(key) } } @@ -87,6 +88,7 @@ impl Env { /// # Safety /// See [set_var]. #[cfg(all(not(feature = "safe_sys"), feature = "unsafe_thread"))] + #[cfg_attr(feature = "nightly_doc", doc(cfg(feature = "unsafe_thread")))] pub unsafe fn set_var, V: AsRef>(key: K, value: V) { unsafe { set_var(key, value) } } diff --git a/src/sys/mem/alloc/namespace.rs b/src/sys/mem/alloc/namespace.rs index ef4a09f6..9c2a5e23 100644 --- a/src/sys/mem/alloc/namespace.rs +++ b/src/sys/mem/alloc/namespace.rs @@ -29,8 +29,12 @@ impl Alloc { } } -#[cfg_attr(feature = "nightly_doc", doc(cfg(feature = "unsafe_layout")))] -#[cfg(all(not(feature = "safe_mem"), feature = "unsafe_layout"))] +/// # Unsafe methods +/// +/// ## Features +/// They depend on enabling any `unsafe*` feature, and not enabling `safe_mem`. +#[cfg_attr(feature = "nightly_doc", doc(cfg(unsafe··)))] +#[cfg(all(not(feature = "safe_mem"), unsafe··))] #[cfg_attr(feature = "nightly_doc", doc(cfg(feature = "alloc")))] #[cfg(feature = "alloc")] #[rustfmt::skip] diff --git a/src/sys/mem/namespace.rs b/src/sys/mem/namespace.rs index 8b0d005c..82b43164 100644 --- a/src/sys/mem/namespace.rs +++ b/src/sys/mem/namespace.rs @@ -126,9 +126,12 @@ impl Mem { } } -/// # Unsafe methods gated by `unsafe_layout` -#[cfg_attr(feature = "nightly_doc", doc(cfg(feature = "unsafe_layout")))] -#[cfg(all(not(feature = "safe_mem"), feature = "unsafe_layout"))] +/// # Unsafe methods +/// +/// ## Features +/// They depend on enabling any `unsafe*` feature, and not enabling `safe_mem`. +#[cfg_attr(feature = "nightly_doc", doc(cfg(unsafe··)))] +#[cfg(all(not(feature = "safe_mem"), unsafe··))] impl Mem { // NOTE: can't compile, errors with: error[E0512]: // cannot transmute between types of different sizes, or dependently-sized types diff --git a/src/sys/mem/ptr/namespace.rs b/src/sys/mem/ptr/namespace.rs index b981cf20..a9bd1dc1 100644 --- a/src/sys/mem/ptr/namespace.rs +++ b/src/sys/mem/ptr/namespace.rs @@ -230,10 +230,13 @@ impl Ptr { } } -/// # Unsafe methods gated by `unsafe_ptr` +/// # Unsafe methods +/// +/// ## Features +/// They depend on enabling any `unsafe*` feature, and not enabling `safe_mem`. #[rustfmt::skip] -#[cfg_attr(feature = "nightly_doc", doc(cfg(feature = "unsafe_ptr")))] -#[cfg(all(not(feature = "safe_mem"), feature = "unsafe_ptr"))] +#[cfg_attr(feature = "nightly_doc", doc(cfg(unsafe··)))] +#[cfg(all(not(feature = "safe_mem"), unsafe··))] impl Ptr { /// Copies `count * size_of::()` bytes from `src` to `dst`. Can overlap. /// diff --git a/src/sys/mem/slice/namespace.rs b/src/sys/mem/slice/namespace.rs index 76a398fb..9463db2c 100644 --- a/src/sys/mem/slice/namespace.rs +++ b/src/sys/mem/slice/namespace.rs @@ -50,8 +50,8 @@ impl Slice { /// See `core::slice::`[`from_raw_parts`] /// /// See also `Ptr::`[`slice_from_raw_parts`][crate::Ptr::slice_from_raw_parts]. - #[cfg_attr(feature = "nightly_doc", doc(cfg(feature = "unsafe_slice")))] - #[cfg(all(not(feature = "safe_mem"), feature = "unsafe_slice"))] + #[cfg_attr(feature = "nightly_doc", doc(cfg(unsafe··)))] + #[cfg(all(not(feature = "safe_mem"), unsafe··))] pub const unsafe fn from_raw_parts<'a>(data: *const T, len: usize) -> &'a [T] { // SAFETY: Caller must uphold the safety contract. unsafe { from_raw_parts(data, len) } @@ -63,8 +63,8 @@ impl Slice { /// See `core::slice::`[`from_raw_parts_mut`]. /// /// See also `Ptr::`[`slice_from_raw_parts_mut`][crate::Ptr::slice_from_raw_parts_mut]. - #[cfg_attr(feature = "nightly_doc", doc(cfg(feature = "unsafe_slice")))] - #[cfg(all(not(feature = "safe_mem"), feature = "unsafe_slice"))] + #[cfg_attr(feature = "nightly_doc", doc(cfg(unsafe··)))] + #[cfg(all(not(feature = "safe_mem"), unsafe··))] pub const unsafe fn from_raw_parts_mut<'a>(data: *mut T, len: usize) -> &'a mut [T] { // SAFETY: Caller must uphold the safety contract. unsafe { from_raw_parts_mut(data, len) } diff --git a/src/text/str/namespace.rs b/src/text/str/namespace.rs index 7d72f769..d1183ebd 100644 --- a/src/text/str/namespace.rs +++ b/src/text/str/namespace.rs @@ -9,10 +9,10 @@ use crate::{ iif, Ascii, InvalidUtf8, Slice, _core::str::{from_utf8, from_utf8_mut}, }; -#[allow(unused_imports, reason = "unsafe_str only")] +#[allow(unused_imports, reason = "unsafe")] #[cfg(feature = "alloc")] use crate::{Box, _dep::_alloc::str::from_boxed_utf8_unchecked}; -#[allow(unused_imports, reason = "unsafe_str only")] +#[allow(unused_imports, reason = "unsafe")] use crate::{ _core::str::{from_utf8_unchecked, from_utf8_unchecked_mut}, sf, unwrap, @@ -53,8 +53,8 @@ impl Str { /// # Safety /// The bytes passed in must be valid UTF-8. #[must_use] - #[cfg(all(not(feature = "safe_text"), feature = "unsafe_str"))] - #[cfg_attr(feature = "nightly_doc", doc(cfg(feature = "unsafe_str")))] + #[cfg(all(not(feature = "safe_text"), unsafe··))] + #[cfg_attr(feature = "nightly_doc", doc(cfg(unsafe··)))] pub const unsafe fn from_utf8_unchecked(v: &[u8]) -> &str { // SAFETY: Caller must uphold the safety contract. unsafe { from_utf8_unchecked(v) } @@ -67,8 +67,8 @@ impl Str { /// # Safety /// The bytes passed in must be valid UTF-8. #[must_use] - #[cfg(all(not(feature = "safe_text"), feature = "unsafe_str"))] - #[cfg_attr(feature = "nightly_doc", doc(cfg(feature = "unsafe_str")))] + #[cfg(all(not(feature = "safe_text"), unsafe··))] + #[cfg_attr(feature = "nightly_doc", doc(cfg(unsafe··)))] pub const unsafe fn from_utf8_unchecked_mut(v: &mut [u8]) -> &mut str { // SAFETY: Caller must uphold the safety contract. unsafe { from_utf8_unchecked_mut(v) } @@ -82,8 +82,8 @@ impl Str { /// The bytes passed in must be valid UTF-8. #[must_use] #[cfg(feature = "alloc")] - #[cfg(all(not(feature = "safe_text"), feature = "unsafe_str"))] - #[cfg_attr(feature = "nightly_doc", doc(cfg(all(feature = "alloc", feature = "unsafe_str"))))] + #[cfg(all(not(feature = "safe_text"), unsafe··))] + #[cfg_attr(feature = "nightly_doc", doc(cfg(all(feature = "alloc", unsafe··))))] pub unsafe fn from_boxed_utf8_unchecked(v: Box<[u8]>) -> Box { // SAFETY: Caller must uphold the safety contract. unsafe { from_boxed_utf8_unchecked(v) }