Skip to content

Commit 99da8ef

Browse files
joshtriplettgitbot
authored and
gitbot
committed
Support no_rc, no_sync, and no_global_oom_handling
For now, apply `no_global_oom_handling` to all of library/alloc/src/bstr.rs . We can make it more fine-grained later.
1 parent 955a593 commit 99da8ef

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

alloc/src/bstr.rs

+9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
//! The `ByteStr` and `ByteString` types and trait implementations.
22
3+
// This could be more fine-grained.
4+
#![cfg(not(no_global_oom_handling))]
5+
36
use core::borrow::{Borrow, BorrowMut};
47
#[unstable(feature = "bstr", issue = "134915")]
58
pub use core::bstr::ByteStr;
@@ -17,8 +20,10 @@ use core::{fmt, hash};
1720
use crate::borrow::{Cow, ToOwned};
1821
#[cfg(not(test))] // https://github.com/rust-lang/rust/issues/135100
1922
use crate::boxed::Box;
23+
#[cfg(not(no_rc))]
2024
use crate::rc::Rc;
2125
use crate::string::String;
26+
#[cfg(all(not(no_rc), not(no_sync), target_has_atomic = "ptr"))]
2227
use crate::sync::Arc;
2328
use crate::vec::Vec;
2429

@@ -649,6 +654,7 @@ impl From<Box<ByteStr>> for Box<[u8]> {
649654
}
650655

651656
#[unstable(feature = "bstr", issue = "134915")]
657+
#[cfg(not(no_rc))]
652658
impl From<Rc<[u8]>> for Rc<ByteStr> {
653659
#[inline]
654660
fn from(s: Rc<[u8]>) -> Rc<ByteStr> {
@@ -658,6 +664,7 @@ impl From<Rc<[u8]>> for Rc<ByteStr> {
658664
}
659665

660666
#[unstable(feature = "bstr", issue = "134915")]
667+
#[cfg(not(no_rc))]
661668
impl From<Rc<ByteStr>> for Rc<[u8]> {
662669
#[inline]
663670
fn from(s: Rc<ByteStr>) -> Rc<[u8]> {
@@ -667,6 +674,7 @@ impl From<Rc<ByteStr>> for Rc<[u8]> {
667674
}
668675

669676
#[unstable(feature = "bstr", issue = "134915")]
677+
#[cfg(all(not(no_rc), not(no_sync), target_has_atomic = "ptr"))]
670678
impl From<Arc<[u8]>> for Arc<ByteStr> {
671679
#[inline]
672680
fn from(s: Arc<[u8]>) -> Arc<ByteStr> {
@@ -676,6 +684,7 @@ impl From<Arc<[u8]>> for Arc<ByteStr> {
676684
}
677685

678686
#[unstable(feature = "bstr", issue = "134915")]
687+
#[cfg(all(not(no_rc), not(no_sync), target_has_atomic = "ptr"))]
679688
impl From<Arc<ByteStr>> for Arc<[u8]> {
680689
#[inline]
681690
fn from(s: Arc<ByteStr>) -> Arc<[u8]> {

0 commit comments

Comments
 (0)