@@ -51,12 +51,12 @@ pub struct System;
51
51
unsafe impl Alloc for System {
52
52
#[ inline]
53
53
unsafe fn alloc ( & mut self , layout : Layout ) -> Result < NonNull < Void > , AllocErr > {
54
- GlobalAlloc :: alloc ( self , layout) . into ( )
54
+ NonNull :: new ( GlobalAlloc :: alloc ( self , layout) ) . ok_or ( AllocErr )
55
55
}
56
56
57
57
#[ inline]
58
58
unsafe fn alloc_zeroed ( & mut self , layout : Layout ) -> Result < NonNull < Void > , AllocErr > {
59
- GlobalAlloc :: alloc_zeroed ( self , layout) . into ( )
59
+ NonNull :: new ( GlobalAlloc :: alloc_zeroed ( self , layout) ) . ok_or ( AllocErr )
60
60
}
61
61
62
62
#[ inline]
@@ -67,9 +67,9 @@ unsafe impl Alloc for System {
67
67
#[ inline]
68
68
unsafe fn realloc ( & mut self ,
69
69
ptr : NonNull < Void > ,
70
- old_layout : Layout ,
70
+ layout : Layout ,
71
71
new_size : usize ) -> Result < NonNull < Void > , AllocErr > {
72
- GlobalAlloc :: realloc ( self , ptr. as_ptr ( ) , old_layout , new_size) . into ( )
72
+ NonNull :: new ( GlobalAlloc :: realloc ( self , ptr. as_ptr ( ) , layout , new_size) ) . ok_or ( AllocErr )
73
73
}
74
74
75
75
#[ inline]
@@ -83,12 +83,12 @@ unsafe impl Alloc for System {
83
83
unsafe impl < ' a > Alloc for & ' a System {
84
84
#[ inline]
85
85
unsafe fn alloc ( & mut self , layout : Layout ) -> Result < NonNull < Void > , AllocErr > {
86
- GlobalAlloc :: alloc ( * self , layout) . into ( )
86
+ NonNull :: new ( GlobalAlloc :: alloc ( * self , layout) ) . ok_or ( AllocErr )
87
87
}
88
88
89
89
#[ inline]
90
90
unsafe fn alloc_zeroed ( & mut self , layout : Layout ) -> Result < NonNull < Void > , AllocErr > {
91
- GlobalAlloc :: alloc_zeroed ( * self , layout) . into ( )
91
+ NonNull :: new ( GlobalAlloc :: alloc_zeroed ( * self , layout) ) . ok_or ( AllocErr )
92
92
}
93
93
94
94
#[ inline]
@@ -99,9 +99,9 @@ unsafe impl<'a> Alloc for &'a System {
99
99
#[ inline]
100
100
unsafe fn realloc ( & mut self ,
101
101
ptr : NonNull < Void > ,
102
- old_layout : Layout ,
102
+ layout : Layout ,
103
103
new_size : usize ) -> Result < NonNull < Void > , AllocErr > {
104
- GlobalAlloc :: realloc ( * self , ptr. as_ptr ( ) , old_layout , new_size) . into ( )
104
+ NonNull :: new ( GlobalAlloc :: realloc ( * self , ptr. as_ptr ( ) , layout , new_size) ) . ok_or ( AllocErr )
105
105
}
106
106
107
107
#[ inline]
0 commit comments