242242
243243#![ stable( feature = "rust1" , since = "1.0.0" ) ]
244244
245- #[ cfg( not( test) ) ]
245+ #[ cfg( all ( not( test) , not ( no_global_oom_handling ) ) ) ]
246246use crate :: boxed:: Box ;
247- #[ cfg( test) ]
247+ #[ cfg( all ( test, not ( no_global_oom_handling ) ) ) ]
248248use std:: boxed:: Box ;
249249
250250use core:: alloc:: helper:: { AllocInit , PrefixAllocator } ;
@@ -261,15 +261,14 @@ use core::iter;
261261use core:: marker:: { self , PhantomData , Unpin , Unsize } ;
262262use core:: mem;
263263use core:: ops:: { CoerceUnsized , Deref , DispatchFromDyn , Receiver } ;
264+ #[ cfg( not( no_global_oom_handling) ) ]
264265use core:: pin:: Pin ;
265266use core:: ptr:: { self , NonNull } ;
266267#[ cfg( not( no_global_oom_handling) ) ]
267268use core:: slice:: from_raw_parts_mut;
268269
269270#[ 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 } ;
273272use crate :: alloc:: { AllocError , Allocator , Global , Layout } ;
274273use crate :: borrow:: { Cow , ToOwned } ;
275274#[ cfg( not( no_global_oom_handling) ) ]
@@ -661,6 +660,7 @@ impl<T> Rc<T> {
661660 /// Constructs a new `Pin<Rc<T>>`. If `T` does not implement `Unpin`, then
662661 /// `value` will be pinned in memory and unable to be moved.
663662 #[ inline]
663+ #[ cfg( not( no_global_oom_handling) ) ]
664664 #[ stable( feature = "pin" , since = "1.33.0" ) ]
665665 pub fn pin ( value : T ) -> Pin < Rc < T > > {
666666 unsafe { Pin :: new_unchecked ( Rc :: new ( value) ) }
@@ -1552,6 +1552,7 @@ impl<T: ?Sized> Clone for Rc<T> {
15521552 }
15531553}
15541554
1555+ #[ cfg( not( no_global_oom_handling) ) ]
15551556#[ stable( feature = "rust1" , since = "1.0.0" ) ]
15561557impl < T : Default > Default for Rc < T > {
15571558 /// Creates a new `Rc<T>`, with the `Default` value for `T`.
@@ -1810,6 +1811,7 @@ impl<T: ?Sized> fmt::Pointer for Rc<T> {
18101811 }
18111812}
18121813
1814+ #[ cfg( not( no_global_oom_handling) ) ]
18131815#[ stable( feature = "from_for_ptrs" , since = "1.6.0" ) ]
18141816impl < T > From < T > for Rc < T > {
18151817 /// Converts a generic type `T` into a `Rc<T>`
0 commit comments