Skip to content

Commit 4bb581c

Browse files
committed
Add #[cfg(not(test))] to some impls to work around #135100
1 parent 0af18ca commit 4bb581c

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

Diff for: 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;
@@ -202,6 +205,7 @@ impl Default for ByteString {
202205
}
203206
}
204207

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

217+
#[cfg(not(test))] // https://github.com/rust-lang/rust/issues/135100
213218
#[unstable(feature = "bstr", issue = "134915")]
214219
impl<const N: usize> From<[u8; N]> for ByteString {
215220
#[inline]
@@ -218,6 +223,7 @@ impl<const N: usize> From<[u8; N]> for ByteString {
218223
}
219224
}
220225

226+
#[cfg(not(test))] // https://github.com/rust-lang/rust/issues/135100
221227
#[unstable(feature = "bstr", issue = "134915")]
222228
impl<'a> From<&'a [u8]> for ByteString {
223229
#[inline]
@@ -242,6 +248,7 @@ impl From<ByteString> for Vec<u8> {
242248
}
243249
}
244250

251+
#[cfg(not(test))] // https://github.com/rust-lang/rust/issues/135100
245252
#[unstable(feature = "bstr", issue = "134915")]
246253
impl<'a> From<&'a str> for ByteString {
247254
#[inline]
@@ -258,6 +265,7 @@ impl From<String> for ByteString {
258265
}
259266
}
260267

268+
#[cfg(not(test))] // https://github.com/rust-lang/rust/issues/135100
261269
#[unstable(feature = "bstr", issue = "134915")]
262270
impl<'a> From<&'a ByteStr> for ByteString {
263271
#[inline]
@@ -266,6 +274,7 @@ impl<'a> From<&'a ByteStr> for ByteString {
266274
}
267275
}
268276

277+
#[cfg(not(test))] // https://github.com/rust-lang/rust/issues/135100
269278
#[unstable(feature = "bstr", issue = "134915")]
270279
impl<'a> From<ByteString> for Cow<'a, ByteStr> {
271280
#[inline]
@@ -274,6 +283,7 @@ impl<'a> From<ByteString> for Cow<'a, ByteStr> {
274283
}
275284
}
276285

286+
#[cfg(not(test))] // https://github.com/rust-lang/rust/issues/135100
277287
#[unstable(feature = "bstr", issue = "134915")]
278288
impl<'a> From<&'a ByteString> for Cow<'a, ByteStr> {
279289
#[inline]
@@ -342,6 +352,7 @@ impl FromIterator<ByteString> for ByteString {
342352
}
343353
}
344354

355+
#[cfg(not(test))] // https://github.com/rust-lang/rust/issues/135100
345356
#[unstable(feature = "bstr", issue = "134915")]
346357
impl FromStr for ByteString {
347358
type Err = core::convert::Infallible;
@@ -499,6 +510,7 @@ impl PartialEq for ByteString {
499510

500511
macro_rules! impl_partial_eq_ord_cow {
501512
($lhs:ty, $rhs:ty) => {
513+
#[cfg(not(test))] // https://github.com/rust-lang/rust/issues/135100
502514
#[allow(unused_lifetimes)]
503515
#[unstable(feature = "bstr", issue = "134915")]
504516
impl<'a> PartialEq<$rhs> for $lhs {
@@ -509,6 +521,7 @@ macro_rules! impl_partial_eq_ord_cow {
509521
}
510522
}
511523

524+
#[cfg(not(test))] // https://github.com/rust-lang/rust/issues/135100
512525
#[allow(unused_lifetimes)]
513526
#[unstable(feature = "bstr", issue = "134915")]
514527
impl<'a> PartialEq<$lhs> for $rhs {
@@ -519,6 +532,7 @@ macro_rules! impl_partial_eq_ord_cow {
519532
}
520533
}
521534

535+
#[cfg(not(test))] // https://github.com/rust-lang/rust/issues/135100
522536
#[allow(unused_lifetimes)]
523537
#[unstable(feature = "bstr", issue = "134915")]
524538
impl<'a> PartialOrd<$rhs> for $lhs {
@@ -529,6 +543,7 @@ macro_rules! impl_partial_eq_ord_cow {
529543
}
530544
}
531545

546+
#[cfg(not(test))] // https://github.com/rust-lang/rust/issues/135100
532547
#[allow(unused_lifetimes)]
533548
#[unstable(feature = "bstr", issue = "134915")]
534549
impl<'a> PartialOrd<$lhs> for $rhs {
@@ -571,6 +586,7 @@ impl PartialOrd for ByteString {
571586
}
572587
}
573588

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

604620
// Additional impls for `ByteStr` that require types from `alloc`:
605621

622+
#[cfg(not(test))] // https://github.com/rust-lang/rust/issues/135100
606623
#[unstable(feature = "bstr", issue = "134915")]
607624
impl Clone for Box<ByteStr> {
608625
#[inline]
@@ -611,6 +628,7 @@ impl Clone for Box<ByteStr> {
611628
}
612629
}
613630

631+
#[cfg(not(test))] // https://github.com/rust-lang/rust/issues/135100
614632
#[unstable(feature = "bstr", issue = "134915")]
615633
impl<'a> From<&'a ByteStr> for Cow<'a, ByteStr> {
616634
#[inline]
@@ -619,6 +637,7 @@ impl<'a> From<&'a ByteStr> for Cow<'a, ByteStr> {
619637
}
620638
}
621639

640+
#[cfg(not(test))] // https://github.com/rust-lang/rust/issues/135100
622641
#[unstable(feature = "bstr", issue = "134915")]
623642
impl From<Box<[u8]>> for Box<ByteStr> {
624643
#[inline]
@@ -628,6 +647,7 @@ impl From<Box<[u8]>> for Box<ByteStr> {
628647
}
629648
}
630649

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

0 commit comments

Comments
 (0)