242
242
243
243
#![ stable( feature = "rust1" , since = "1.0.0" ) ]
244
244
245
- #[ cfg( not( test) ) ]
245
+ #[ cfg( all ( not( test) , not ( no_global_oom_handling ) ) ) ]
246
246
use crate :: boxed:: Box ;
247
- #[ cfg( test) ]
247
+ #[ cfg( all ( test, not ( no_global_oom_handling ) ) ) ]
248
248
use std:: boxed:: Box ;
249
249
250
250
use core:: alloc:: helper:: { AllocInit , PrefixAllocator } ;
@@ -261,15 +261,14 @@ use core::iter;
261
261
use core:: marker:: { self , PhantomData , Unpin , Unsize } ;
262
262
use core:: mem;
263
263
use core:: ops:: { CoerceUnsized , Deref , DispatchFromDyn , Receiver } ;
264
+ #[ cfg( not( no_global_oom_handling) ) ]
264
265
use core:: pin:: Pin ;
265
266
use core:: ptr:: { self , NonNull } ;
266
267
#[ cfg( not( no_global_oom_handling) ) ]
267
268
use core:: slice:: from_raw_parts_mut;
268
269
269
270
#[ cfg( not( no_global_oom_handling) ) ]
270
- use crate :: alloc:: handle_alloc_error;
271
- #[ cfg( not( no_global_oom_handling) ) ]
272
- use crate :: alloc:: { box_free, WriteCloneIntoRaw } ;
271
+ use crate :: alloc:: { handle_alloc_error, box_free, WriteCloneIntoRaw } ;
273
272
use crate :: alloc:: { AllocError , Allocator , Global , Layout } ;
274
273
use crate :: borrow:: { Cow , ToOwned } ;
275
274
#[ cfg( not( no_global_oom_handling) ) ]
@@ -661,6 +660,7 @@ impl<T> Rc<T> {
661
660
/// Constructs a new `Pin<Rc<T>>`. If `T` does not implement `Unpin`, then
662
661
/// `value` will be pinned in memory and unable to be moved.
663
662
#[ inline]
663
+ #[ cfg( not( no_global_oom_handling) ) ]
664
664
#[ stable( feature = "pin" , since = "1.33.0" ) ]
665
665
pub fn pin ( value : T ) -> Pin < Rc < T > > {
666
666
unsafe { Pin :: new_unchecked ( Rc :: new ( value) ) }
@@ -1552,6 +1552,7 @@ impl<T: ?Sized> Clone for Rc<T> {
1552
1552
}
1553
1553
}
1554
1554
1555
+ #[ cfg( not( no_global_oom_handling) ) ]
1555
1556
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1556
1557
impl < T : Default > Default for Rc < T > {
1557
1558
/// Creates a new `Rc<T>`, with the `Default` value for `T`.
@@ -1810,6 +1811,7 @@ impl<T: ?Sized> fmt::Pointer for Rc<T> {
1810
1811
}
1811
1812
}
1812
1813
1814
+ #[ cfg( not( no_global_oom_handling) ) ]
1813
1815
#[ stable( feature = "from_for_ptrs" , since = "1.6.0" ) ]
1814
1816
impl < T > From < T > for Rc < T > {
1815
1817
/// Converts a generic type `T` into a `Rc<T>`
0 commit comments