@@ -494,6 +494,8 @@ pub unsafe trait GlobalAlloc {
494
494
/// Clients wishing to abort computation in response to an
495
495
/// allocation error are encouraged to call the [`oom`] function,
496
496
/// rather than directly invoking `panic!` or similar.
497
+ ///
498
+ /// [`oom`]: ../../alloc/alloc/fn.oom.html
497
499
#[ stable( feature = "global_alloc" , since = "1.28.0" ) ]
498
500
unsafe fn alloc ( & self , layout : Layout ) -> * mut u8 ;
499
501
@@ -529,6 +531,8 @@ pub unsafe trait GlobalAlloc {
529
531
/// Clients wishing to abort computation in response to an
530
532
/// allocation error are encouraged to call the [`oom`] function,
531
533
/// rather than directly invoking `panic!` or similar.
534
+ ///
535
+ /// [`oom`]: ../../alloc/alloc/fn.oom.html
532
536
#[ stable( feature = "global_alloc" , since = "1.28.0" ) ]
533
537
unsafe fn alloc_zeroed ( & self , layout : Layout ) -> * mut u8 {
534
538
let size = layout. size ( ) ;
@@ -587,6 +591,8 @@ pub unsafe trait GlobalAlloc {
587
591
/// Clients wishing to abort computation in response to a
588
592
/// reallocation error are encouraged to call the [`oom`] function,
589
593
/// rather than directly invoking `panic!` or similar.
594
+ ///
595
+ /// [`oom`]: ../../alloc/alloc/fn.oom.html
590
596
#[ stable( feature = "global_alloc" , since = "1.28.0" ) ]
591
597
unsafe fn realloc ( & self , ptr : * mut u8 , layout : Layout , new_size : usize ) -> * mut u8 {
592
598
let new_layout = Layout :: from_size_align_unchecked ( new_size, layout. align ( ) ) ;
@@ -727,8 +733,10 @@ pub unsafe trait Alloc {
727
733
/// library that aborts on memory exhaustion.)
728
734
///
729
735
/// Clients wishing to abort computation in response to an
730
- /// allocation error are encouraged to call the `oom` function,
736
+ /// allocation error are encouraged to call the [ `oom`] function,
731
737
/// rather than directly invoking `panic!` or similar.
738
+ ///
739
+ /// [`oom`]: ../../alloc/alloc/fn.oom.html
732
740
unsafe fn alloc ( & mut self , layout : Layout ) -> Result < NonNull < u8 > , AllocErr > ;
733
741
734
742
/// Deallocate the memory referenced by `ptr`.
@@ -837,6 +845,8 @@ pub unsafe trait Alloc {
837
845
/// Clients wishing to abort computation in response to a
838
846
/// reallocation error are encouraged to call the [`oom`] function,
839
847
/// rather than directly invoking `panic!` or similar.
848
+ ///
849
+ /// [`oom`]: ../../alloc/alloc/fn.oom.html
840
850
unsafe fn realloc ( & mut self ,
841
851
ptr : NonNull < u8 > ,
842
852
layout : Layout ,
@@ -881,6 +891,8 @@ pub unsafe trait Alloc {
881
891
/// Clients wishing to abort computation in response to an
882
892
/// allocation error are encouraged to call the [`oom`] function,
883
893
/// rather than directly invoking `panic!` or similar.
894
+ ///
895
+ /// [`oom`]: ../../alloc/alloc/fn.oom.html
884
896
unsafe fn alloc_zeroed ( & mut self , layout : Layout ) -> Result < NonNull < u8 > , AllocErr > {
885
897
let size = layout. size ( ) ;
886
898
let p = self . alloc ( layout) ;
@@ -907,6 +919,8 @@ pub unsafe trait Alloc {
907
919
/// Clients wishing to abort computation in response to an
908
920
/// allocation error are encouraged to call the [`oom`] function,
909
921
/// rather than directly invoking `panic!` or similar.
922
+ ///
923
+ /// [`oom`]: ../../alloc/alloc/fn.oom.html
910
924
unsafe fn alloc_excess ( & mut self , layout : Layout ) -> Result < Excess , AllocErr > {
911
925
let usable_size = self . usable_size ( & layout) ;
912
926
self . alloc ( layout) . map ( |p| Excess ( p, usable_size. 1 ) )
@@ -929,6 +943,8 @@ pub unsafe trait Alloc {
929
943
/// Clients wishing to abort computation in response to a
930
944
/// reallocation error are encouraged to call the [`oom`] function,
931
945
/// rather than directly invoking `panic!` or similar.
946
+ ///
947
+ /// [`oom`]: ../../alloc/alloc/fn.oom.html
932
948
unsafe fn realloc_excess ( & mut self ,
933
949
ptr : NonNull < u8 > ,
934
950
layout : Layout ,
@@ -1076,6 +1092,8 @@ pub unsafe trait Alloc {
1076
1092
/// Clients wishing to abort computation in response to an
1077
1093
/// allocation error are encouraged to call the [`oom`] function,
1078
1094
/// rather than directly invoking `panic!` or similar.
1095
+ ///
1096
+ /// [`oom`]: ../../alloc/alloc/fn.oom.html
1079
1097
fn alloc_one < T > ( & mut self ) -> Result < NonNull < T > , AllocErr >
1080
1098
where Self : Sized
1081
1099
{
@@ -1143,6 +1161,8 @@ pub unsafe trait Alloc {
1143
1161
/// Clients wishing to abort computation in response to an
1144
1162
/// allocation error are encouraged to call the [`oom`] function,
1145
1163
/// rather than directly invoking `panic!` or similar.
1164
+ ///
1165
+ /// [`oom`]: ../../alloc/alloc/fn.oom.html
1146
1166
fn alloc_array < T > ( & mut self , n : usize ) -> Result < NonNull < T > , AllocErr >
1147
1167
where Self : Sized
1148
1168
{
@@ -1188,6 +1208,8 @@ pub unsafe trait Alloc {
1188
1208
/// Clients wishing to abort computation in response to a
1189
1209
/// reallocation error are encouraged to call the [`oom`] function,
1190
1210
/// rather than directly invoking `panic!` or similar.
1211
+ ///
1212
+ /// [`oom`]: ../../alloc/alloc/fn.oom.html
1191
1213
unsafe fn realloc_array < T > ( & mut self ,
1192
1214
ptr : NonNull < T > ,
1193
1215
n_old : usize ,
0 commit comments