Skip to content

Commit 8727b9c

Browse files
committed
Add #[cfg(not(test))] to some impls to work around #135100
1 parent 4d65cc8 commit 8727b9c

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 {
@@ -577,6 +592,7 @@ impl PartialOrd for ByteString {
577592
}
578593
}
579594

595+
#[cfg(not(test))] // https://github.com/rust-lang/rust/issues/135100
580596
#[unstable(feature = "bstr", issue = "134915")]
581597
impl ToOwned for ByteStr {
582598
type Owned = ByteString;
@@ -609,6 +625,7 @@ impl<'a> TryFrom<&'a ByteString> for &'a str {
609625

610626
// Additional impls for `ByteStr` that require types from `alloc`:
611627

628+
#[cfg(not(test))] // https://github.com/rust-lang/rust/issues/135100
612629
#[unstable(feature = "bstr", issue = "134915")]
613630
impl Clone for Box<ByteStr> {
614631
#[inline]
@@ -617,6 +634,7 @@ impl Clone for Box<ByteStr> {
617634
}
618635
}
619636

637+
#[cfg(not(test))] // https://github.com/rust-lang/rust/issues/135100
620638
#[unstable(feature = "bstr", issue = "134915")]
621639
impl<'a> From<&'a ByteStr> for Cow<'a, ByteStr> {
622640
#[inline]
@@ -625,6 +643,7 @@ impl<'a> From<&'a ByteStr> for Cow<'a, ByteStr> {
625643
}
626644
}
627645

646+
#[cfg(not(test))] // https://github.com/rust-lang/rust/issues/135100
628647
#[unstable(feature = "bstr", issue = "134915")]
629648
impl From<Box<[u8]>> for Box<ByteStr> {
630649
#[inline]
@@ -634,6 +653,7 @@ impl From<Box<[u8]>> for Box<ByteStr> {
634653
}
635654
}
636655

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

0 commit comments

Comments
 (0)