Skip to content

Commit a54a2fc

Browse files
committed
Add #[cfg(not(test))] to some impls to work around #135100
1 parent b2132d0 commit a54a2fc

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

library/alloc/src/bstr.rs

+20
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,13 @@ use core::ops::{
99
Deref, DerefMut, DerefPure, Index, IndexMut, Range, RangeFrom, RangeFull, RangeInclusive,
1010
RangeTo, RangeToInclusive,
1111
};
12+
#[cfg(not(test))] // https://github.com/rust-lang/rust/issues/135100
1213
use core::str::FromStr;
1314
use core::{fmt, hash};
1415

16+
#[cfg(not(test))] // https://github.com/rust-lang/rust/issues/135100
1517
use crate::borrow::{Cow, ToOwned};
18+
#[cfg(not(test))] // https://github.com/rust-lang/rust/issues/135100
1619
use crate::boxed::Box;
1720
use crate::rc::Rc;
1821
use crate::string::String;
@@ -204,6 +207,7 @@ impl Default for ByteString {
204207
}
205208
}
206209

210+
#[cfg(not(test))] // https://github.com/rust-lang/rust/issues/135100
207211
#[unstable(feature = "bstr", issue = "134915")]
208212
impl<'a, const N: usize> From<&'a [u8; N]> for ByteString {
209213
#[inline]
@@ -212,6 +216,7 @@ impl<'a, const N: usize> From<&'a [u8; N]> for ByteString {
212216
}
213217
}
214218

219+
#[cfg(not(test))] // https://github.com/rust-lang/rust/issues/135100
215220
#[unstable(feature = "bstr", issue = "134915")]
216221
impl<const N: usize> From<[u8; N]> for ByteString {
217222
#[inline]
@@ -220,6 +225,7 @@ impl<const N: usize> From<[u8; N]> for ByteString {
220225
}
221226
}
222227

228+
#[cfg(not(test))] // https://github.com/rust-lang/rust/issues/135100
223229
#[unstable(feature = "bstr", issue = "134915")]
224230
impl<'a> From<&'a [u8]> for ByteString {
225231
#[inline]
@@ -244,6 +250,7 @@ impl From<ByteString> for Vec<u8> {
244250
}
245251
}
246252

253+
#[cfg(not(test))] // https://github.com/rust-lang/rust/issues/135100
247254
#[unstable(feature = "bstr", issue = "134915")]
248255
impl<'a> From<&'a str> for ByteString {
249256
#[inline]
@@ -260,6 +267,7 @@ impl From<String> for ByteString {
260267
}
261268
}
262269

270+
#[cfg(not(test))] // https://github.com/rust-lang/rust/issues/135100
263271
#[unstable(feature = "bstr", issue = "134915")]
264272
impl<'a> From<&'a ByteStr> for ByteString {
265273
#[inline]
@@ -268,6 +276,7 @@ impl<'a> From<&'a ByteStr> for ByteString {
268276
}
269277
}
270278

279+
#[cfg(not(test))] // https://github.com/rust-lang/rust/issues/135100
271280
#[unstable(feature = "bstr", issue = "134915")]
272281
impl<'a> From<ByteString> for Cow<'a, ByteStr> {
273282
#[inline]
@@ -276,6 +285,7 @@ impl<'a> From<ByteString> for Cow<'a, ByteStr> {
276285
}
277286
}
278287

288+
#[cfg(not(test))] // https://github.com/rust-lang/rust/issues/135100
279289
#[unstable(feature = "bstr", issue = "134915")]
280290
impl<'a> From<&'a ByteString> for Cow<'a, ByteStr> {
281291
#[inline]
@@ -344,6 +354,7 @@ impl FromIterator<ByteString> for ByteString {
344354
}
345355
}
346356

357+
#[cfg(not(test))] // https://github.com/rust-lang/rust/issues/135100
347358
#[unstable(feature = "bstr", issue = "134915")]
348359
impl FromStr for ByteString {
349360
type Err = core::convert::Infallible;
@@ -501,6 +512,7 @@ impl PartialEq for ByteString {
501512

502513
macro_rules! impl_partial_eq_ord_cow {
503514
($lhs:ty, $rhs:ty) => {
515+
#[cfg(not(test))] // https://github.com/rust-lang/rust/issues/135100
504516
#[allow(unused_lifetimes)]
505517
#[unstable(feature = "bstr", issue = "134915")]
506518
impl<'a> PartialEq<$rhs> for $lhs {
@@ -511,6 +523,7 @@ macro_rules! impl_partial_eq_ord_cow {
511523
}
512524
}
513525

526+
#[cfg(not(test))] // https://github.com/rust-lang/rust/issues/135100
514527
#[allow(unused_lifetimes)]
515528
#[unstable(feature = "bstr", issue = "134915")]
516529
impl<'a> PartialEq<$lhs> for $rhs {
@@ -521,6 +534,7 @@ macro_rules! impl_partial_eq_ord_cow {
521534
}
522535
}
523536

537+
#[cfg(not(test))] // https://github.com/rust-lang/rust/issues/135100
524538
#[allow(unused_lifetimes)]
525539
#[unstable(feature = "bstr", issue = "134915")]
526540
impl<'a> PartialOrd<$rhs> for $lhs {
@@ -531,6 +545,7 @@ macro_rules! impl_partial_eq_ord_cow {
531545
}
532546
}
533547

548+
#[cfg(not(test))] // https://github.com/rust-lang/rust/issues/135100
534549
#[allow(unused_lifetimes)]
535550
#[unstable(feature = "bstr", issue = "134915")]
536551
impl<'a> PartialOrd<$lhs> for $rhs {
@@ -573,6 +588,7 @@ impl PartialOrd for ByteString {
573588
}
574589
}
575590

591+
#[cfg(not(test))] // https://github.com/rust-lang/rust/issues/135100
576592
#[unstable(feature = "bstr", issue = "134915")]
577593
impl ToOwned for ByteStr {
578594
type Owned = ByteString;
@@ -605,6 +621,7 @@ impl<'a> TryFrom<&'a ByteString> for &'a str {
605621

606622
// Additional impls for `ByteStr` that require types from `alloc`:
607623

624+
#[cfg(not(test))] // https://github.com/rust-lang/rust/issues/135100
608625
#[unstable(feature = "bstr", issue = "134915")]
609626
impl Clone for Box<ByteStr> {
610627
#[inline]
@@ -613,6 +630,7 @@ impl Clone for Box<ByteStr> {
613630
}
614631
}
615632

633+
#[cfg(not(test))] // https://github.com/rust-lang/rust/issues/135100
616634
#[unstable(feature = "bstr", issue = "134915")]
617635
impl<'a> From<&'a ByteStr> for Cow<'a, ByteStr> {
618636
#[inline]
@@ -621,6 +639,7 @@ impl<'a> From<&'a ByteStr> for Cow<'a, ByteStr> {
621639
}
622640
}
623641

642+
#[cfg(not(test))] // https://github.com/rust-lang/rust/issues/135100
624643
#[unstable(feature = "bstr", issue = "134915")]
625644
impl From<Box<[u8]>> for Box<ByteStr> {
626645
#[inline]
@@ -630,6 +649,7 @@ impl From<Box<[u8]>> for Box<ByteStr> {
630649
}
631650
}
632651

652+
#[cfg(not(test))] // https://github.com/rust-lang/rust/issues/135100
633653
#[unstable(feature = "bstr", issue = "134915")]
634654
impl From<Box<ByteStr>> for Box<[u8]> {
635655
#[inline]

0 commit comments

Comments
 (0)