added Default impls

reorganised attrs

removed OsStr impls

added backticks
This commit is contained in:
Billy Sheppard 2024-05-03 00:10:40 +00:00 committed by Zachary S
parent ecbe3fd550
commit 5c6326ad79
3 changed files with 64 additions and 0 deletions

View File

@ -910,6 +910,28 @@ fn from(s: &CStr) -> Rc<CStr> {
}
}
#[cfg(not(no_global_oom_handling))]
#[stable(feature = "more_rc_default_impls", since = "CURRENT_RUSTC_VERSION")]
impl Default for Arc<CStr> {
/// Creates an empty CStr inside an Arc
#[inline]
fn default() -> Self {
let c_str: &CStr = Default::default();
Arc::from(c_str)
}
}
#[cfg(not(no_global_oom_handling))]
#[stable(feature = "more_rc_default_impls", since = "CURRENT_RUSTC_VERSION")]
impl Default for Rc<CStr> {
/// Creates an empty CStr inside an Rc
#[inline]
fn default() -> Self {
let c_str: &CStr = Default::default();
Rc::from(c_str)
}
}
#[cfg(not(test))]
#[stable(feature = "default_box_extra", since = "1.17.0")]
impl Default for Box<CStr> {

View File

@ -2224,6 +2224,27 @@ fn default() -> Rc<T> {
}
}
#[cfg(not(no_global_oom_handling))]
#[stable(feature = "more_rc_default_impls", since = "CURRENT_RUSTC_VERSION")]
impl Default for Rc<str> {
/// Creates an empty str inside an Rc
#[inline]
fn default() -> Self {
Rc::from("")
}
}
#[cfg(not(no_global_oom_handling))]
#[stable(feature = "more_rc_default_impls", since = "CURRENT_RUSTC_VERSION")]
impl<T> Default for Rc<[T]> {
/// Creates an empty `[T]` inside an Rc
#[inline]
fn default() -> Self {
let arr: [T; 0] = [];
Rc::from(arr)
}
}
#[stable(feature = "rust1", since = "1.0.0")]
trait RcEqIdent<T: ?Sized + PartialEq, A: Allocator> {
fn eq(&self, other: &Rc<T, A>) -> bool;

View File

@ -3300,6 +3300,27 @@ fn default() -> Arc<T> {
}
}
#[cfg(not(no_global_oom_handling))]
#[stable(feature = "more_rc_default_impls", since = "CURRENT_RUSTC_VERSION")]
impl Default for Arc<str> {
/// Creates an empty str inside an Arc
#[inline]
fn default() -> Self {
Arc::from("")
}
}
#[cfg(not(no_global_oom_handling))]
#[stable(feature = "more_rc_default_impls", since = "CURRENT_RUSTC_VERSION")]
impl<T> Default for Arc<[T]> {
/// Creates an empty `[T]` inside an Arc
#[inline]
fn default() -> Self {
let arr: [T; 0] = [];
Arc::from(arr)
}
}
#[stable(feature = "rust1", since = "1.0.0")]
impl<T: ?Sized + Hash, A: Allocator> Hash for Arc<T, A> {
fn hash<H: Hasher>(&self, state: &mut H) {