Skip to content

Commit 955a593

Browse files
joshtriplettgitbot
authored and
gitbot
committed
Add #[cfg(not(test))] to some impls to work around rust-lang#135100
1 parent 196b8e0 commit 955a593

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

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;
@@ -185,6 +188,7 @@ impl Default for ByteString {
185188
}
186189
}
187190

191+
#[cfg(not(test))] // https://github.com/rust-lang/rust/issues/135100
188192
#[unstable(feature = "bstr", issue = "134915")]
189193
impl<'a, const N: usize> From<&'a [u8; N]> for ByteString {
190194
#[inline]
@@ -193,6 +197,7 @@ impl<'a, const N: usize> From<&'a [u8; N]> for ByteString {
193197
}
194198
}
195199

200+
#[cfg(not(test))] // https://github.com/rust-lang/rust/issues/135100
196201
#[unstable(feature = "bstr", issue = "134915")]
197202
impl<const N: usize> From<[u8; N]> for ByteString {
198203
#[inline]
@@ -201,6 +206,7 @@ impl<const N: usize> From<[u8; N]> for ByteString {
201206
}
202207
}
203208

209+
#[cfg(not(test))] // https://github.com/rust-lang/rust/issues/135100
204210
#[unstable(feature = "bstr", issue = "134915")]
205211
impl<'a> From<&'a [u8]> for ByteString {
206212
#[inline]
@@ -225,6 +231,7 @@ impl From<ByteString> for Vec<u8> {
225231
}
226232
}
227233

234+
#[cfg(not(test))] // https://github.com/rust-lang/rust/issues/135100
228235
#[unstable(feature = "bstr", issue = "134915")]
229236
impl<'a> From<&'a str> for ByteString {
230237
#[inline]
@@ -241,6 +248,7 @@ impl From<String> for ByteString {
241248
}
242249
}
243250

251+
#[cfg(not(test))] // https://github.com/rust-lang/rust/issues/135100
244252
#[unstable(feature = "bstr", issue = "134915")]
245253
impl<'a> From<&'a ByteStr> for ByteString {
246254
#[inline]
@@ -249,6 +257,7 @@ impl<'a> From<&'a ByteStr> for ByteString {
249257
}
250258
}
251259

260+
#[cfg(not(test))] // https://github.com/rust-lang/rust/issues/135100
252261
#[unstable(feature = "bstr", issue = "134915")]
253262
impl<'a> From<ByteString> for Cow<'a, ByteStr> {
254263
#[inline]
@@ -257,6 +266,7 @@ impl<'a> From<ByteString> for Cow<'a, ByteStr> {
257266
}
258267
}
259268

269+
#[cfg(not(test))] // https://github.com/rust-lang/rust/issues/135100
260270
#[unstable(feature = "bstr", issue = "134915")]
261271
impl<'a> From<&'a ByteString> for Cow<'a, ByteStr> {
262272
#[inline]
@@ -325,6 +335,7 @@ impl FromIterator<ByteString> for ByteString {
325335
}
326336
}
327337

338+
#[cfg(not(test))] // https://github.com/rust-lang/rust/issues/135100
328339
#[unstable(feature = "bstr", issue = "134915")]
329340
impl FromStr for ByteString {
330341
type Err = core::convert::Infallible;
@@ -482,6 +493,7 @@ impl PartialEq for ByteString {
482493

483494
macro_rules! impl_partial_eq_ord_cow {
484495
($lhs:ty, $rhs:ty) => {
496+
#[cfg(not(test))] // https://github.com/rust-lang/rust/issues/135100
485497
#[allow(unused_lifetimes)]
486498
#[unstable(feature = "bstr", issue = "134915")]
487499
impl<'a> PartialEq<$rhs> for $lhs {
@@ -492,6 +504,7 @@ macro_rules! impl_partial_eq_ord_cow {
492504
}
493505
}
494506

507+
#[cfg(not(test))] // https://github.com/rust-lang/rust/issues/135100
495508
#[allow(unused_lifetimes)]
496509
#[unstable(feature = "bstr", issue = "134915")]
497510
impl<'a> PartialEq<$lhs> for $rhs {
@@ -502,6 +515,7 @@ macro_rules! impl_partial_eq_ord_cow {
502515
}
503516
}
504517

518+
#[cfg(not(test))] // https://github.com/rust-lang/rust/issues/135100
505519
#[allow(unused_lifetimes)]
506520
#[unstable(feature = "bstr", issue = "134915")]
507521
impl<'a> PartialOrd<$rhs> for $lhs {
@@ -512,6 +526,7 @@ macro_rules! impl_partial_eq_ord_cow {
512526
}
513527
}
514528

529+
#[cfg(not(test))] // https://github.com/rust-lang/rust/issues/135100
515530
#[allow(unused_lifetimes)]
516531
#[unstable(feature = "bstr", issue = "134915")]
517532
impl<'a> PartialOrd<$lhs> for $rhs {
@@ -562,6 +577,7 @@ impl PartialOrd for ByteString {
562577
}
563578
}
564579

580+
#[cfg(not(test))] // https://github.com/rust-lang/rust/issues/135100
565581
#[unstable(feature = "bstr", issue = "134915")]
566582
impl ToOwned for ByteStr {
567583
type Owned = ByteString;
@@ -594,6 +610,7 @@ impl<'a> TryFrom<&'a ByteString> for &'a str {
594610

595611
// Additional impls for `ByteStr` that require types from `alloc`:
596612

613+
#[cfg(not(test))] // https://github.com/rust-lang/rust/issues/135100
597614
#[unstable(feature = "bstr", issue = "134915")]
598615
impl Clone for Box<ByteStr> {
599616
#[inline]
@@ -602,6 +619,7 @@ impl Clone for Box<ByteStr> {
602619
}
603620
}
604621

622+
#[cfg(not(test))] // https://github.com/rust-lang/rust/issues/135100
605623
#[unstable(feature = "bstr", issue = "134915")]
606624
impl<'a> From<&'a ByteStr> for Cow<'a, ByteStr> {
607625
#[inline]
@@ -610,6 +628,7 @@ impl<'a> From<&'a ByteStr> for Cow<'a, ByteStr> {
610628
}
611629
}
612630

631+
#[cfg(not(test))] // https://github.com/rust-lang/rust/issues/135100
613632
#[unstable(feature = "bstr", issue = "134915")]
614633
impl From<Box<[u8]>> for Box<ByteStr> {
615634
#[inline]
@@ -619,6 +638,7 @@ impl From<Box<[u8]>> for Box<ByteStr> {
619638
}
620639
}
621640

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

0 commit comments

Comments
 (0)