diff options
| author | Josh Triplett <josh@joshtriplett.org> | 2025-01-04 16:08:20 +0200 | 
|---|---|---|
| committer | Josh Triplett <josh@joshtriplett.org> | 2025-01-11 06:35:21 +0200 | 
| commit | fc34bea69db2294413b3ecea5edd1f12c70c0f8b (patch) | |
| tree | 75b31ef60c2edf77ba8cb403f14e50c1f1dd3263 | |
| parent | dcc352f341485c99d02bfd947362b925db0aa6ca (diff) | |
| download | rust-fc34bea69db2294413b3ecea5edd1f12c70c0f8b.tar.gz rust-fc34bea69db2294413b3ecea5edd1f12c70c0f8b.zip | |
Add `#[cfg(not(test))]` to some impls to work around https://github.com/rust-lang/rust/issues/135100
| -rw-r--r-- | library/alloc/src/bstr.rs | 20 | 
1 files changed, 20 insertions, 0 deletions
| diff --git a/library/alloc/src/bstr.rs b/library/alloc/src/bstr.rs index c27c6afb558..a447ab38d17 100644 --- a/library/alloc/src/bstr.rs +++ b/library/alloc/src/bstr.rs @@ -9,10 +9,13 @@ use core::ops::{ Deref, DerefMut, DerefPure, Index, IndexMut, Range, RangeFrom, RangeFull, RangeInclusive, RangeTo, RangeToInclusive, }; +#[cfg(not(test))] // https://github.com/rust-lang/rust/issues/135100 use core::str::FromStr; use core::{fmt, hash}; +#[cfg(not(test))] // https://github.com/rust-lang/rust/issues/135100 use crate::borrow::{Cow, ToOwned}; +#[cfg(not(test))] // https://github.com/rust-lang/rust/issues/135100 use crate::boxed::Box; use crate::rc::Rc; use crate::string::String; @@ -185,6 +188,7 @@ impl Default for ByteString { } } +#[cfg(not(test))] // https://github.com/rust-lang/rust/issues/135100 #[unstable(feature = "bstr", issue = "134915")] impl<'a, const N: usize> From<&'a [u8; N]> for ByteString { #[inline] @@ -193,6 +197,7 @@ impl<'a, const N: usize> From<&'a [u8; N]> for ByteString { } } +#[cfg(not(test))] // https://github.com/rust-lang/rust/issues/135100 #[unstable(feature = "bstr", issue = "134915")] impl<const N: usize> From<[u8; N]> for ByteString { #[inline] @@ -201,6 +206,7 @@ impl<const N: usize> From<[u8; N]> for ByteString { } } +#[cfg(not(test))] // https://github.com/rust-lang/rust/issues/135100 #[unstable(feature = "bstr", issue = "134915")] impl<'a> From<&'a [u8]> for ByteString { #[inline] @@ -225,6 +231,7 @@ impl From<ByteString> for Vec<u8> { } } +#[cfg(not(test))] // https://github.com/rust-lang/rust/issues/135100 #[unstable(feature = "bstr", issue = "134915")] impl<'a> From<&'a str> for ByteString { #[inline] @@ -241,6 +248,7 @@ impl From<String> for ByteString { } } +#[cfg(not(test))] // https://github.com/rust-lang/rust/issues/135100 #[unstable(feature = "bstr", issue = "134915")] impl<'a> From<&'a ByteStr> for ByteString { #[inline] @@ -249,6 +257,7 @@ impl<'a> From<&'a ByteStr> for ByteString { } } +#[cfg(not(test))] // https://github.com/rust-lang/rust/issues/135100 #[unstable(feature = "bstr", issue = "134915")] impl<'a> From<ByteString> for Cow<'a, ByteStr> { #[inline] @@ -257,6 +266,7 @@ impl<'a> From<ByteString> for Cow<'a, ByteStr> { } } +#[cfg(not(test))] // https://github.com/rust-lang/rust/issues/135100 #[unstable(feature = "bstr", issue = "134915")] impl<'a> From<&'a ByteString> for Cow<'a, ByteStr> { #[inline] @@ -325,6 +335,7 @@ impl FromIterator<ByteString> for ByteString { } } +#[cfg(not(test))] // https://github.com/rust-lang/rust/issues/135100 #[unstable(feature = "bstr", issue = "134915")] impl FromStr for ByteString { type Err = core::convert::Infallible; @@ -482,6 +493,7 @@ impl PartialEq for ByteString { macro_rules! impl_partial_eq_ord_cow { ($lhs:ty, $rhs:ty) => { + #[cfg(not(test))] // https://github.com/rust-lang/rust/issues/135100 #[allow(unused_lifetimes)] #[unstable(feature = "bstr", issue = "134915")] impl<'a> PartialEq<$rhs> for $lhs { @@ -492,6 +504,7 @@ macro_rules! impl_partial_eq_ord_cow { } } + #[cfg(not(test))] // https://github.com/rust-lang/rust/issues/135100 #[allow(unused_lifetimes)] #[unstable(feature = "bstr", issue = "134915")] impl<'a> PartialEq<$lhs> for $rhs { @@ -502,6 +515,7 @@ macro_rules! impl_partial_eq_ord_cow { } } + #[cfg(not(test))] // https://github.com/rust-lang/rust/issues/135100 #[allow(unused_lifetimes)] #[unstable(feature = "bstr", issue = "134915")] impl<'a> PartialOrd<$rhs> for $lhs { @@ -512,6 +526,7 @@ macro_rules! impl_partial_eq_ord_cow { } } + #[cfg(not(test))] // https://github.com/rust-lang/rust/issues/135100 #[allow(unused_lifetimes)] #[unstable(feature = "bstr", issue = "134915")] impl<'a> PartialOrd<$lhs> for $rhs { @@ -562,6 +577,7 @@ impl PartialOrd for ByteString { } } +#[cfg(not(test))] // https://github.com/rust-lang/rust/issues/135100 #[unstable(feature = "bstr", issue = "134915")] impl ToOwned for ByteStr { type Owned = ByteString; @@ -594,6 +610,7 @@ impl<'a> TryFrom<&'a ByteString> for &'a str { // Additional impls for `ByteStr` that require types from `alloc`: +#[cfg(not(test))] // https://github.com/rust-lang/rust/issues/135100 #[unstable(feature = "bstr", issue = "134915")] impl Clone for Box<ByteStr> { #[inline] @@ -602,6 +619,7 @@ impl Clone for Box<ByteStr> { } } +#[cfg(not(test))] // https://github.com/rust-lang/rust/issues/135100 #[unstable(feature = "bstr", issue = "134915")] impl<'a> From<&'a ByteStr> for Cow<'a, ByteStr> { #[inline] @@ -610,6 +628,7 @@ impl<'a> From<&'a ByteStr> for Cow<'a, ByteStr> { } } +#[cfg(not(test))] // https://github.com/rust-lang/rust/issues/135100 #[unstable(feature = "bstr", issue = "134915")] impl From<Box<[u8]>> for Box<ByteStr> { #[inline] @@ -619,6 +638,7 @@ impl From<Box<[u8]>> for Box<ByteStr> { } } +#[cfg(not(test))] // https://github.com/rust-lang/rust/issues/135100 #[unstable(feature = "bstr", issue = "134915")] impl From<Box<ByteStr>> for Box<[u8]> { #[inline] | 
