File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed
library/std/src/sys/pal/unix Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -92,7 +92,10 @@ cfg_if::cfg_if! {
92
92
} else if #[ cfg( target_os = "wasi" ) ] {
93
93
#[ inline]
94
94
unsafe fn aligned_malloc( layout: & Layout ) -> * mut u8 {
95
- // C11 aligned_alloc requires that the size be a multiple of the alignment.
95
+ // C18 allows the implementation to return null if the alignment is "not supported", and
96
+ // some implementations, like wasi, choose to not support the case where the size is not
97
+ // a multiple of the alignment. This potentially wastes a bunch of space, but there's
98
+ // not a lot we can do about it.
96
99
// Layout already checks that the size rounded up doesn't overflow isize::MAX.
97
100
let align = layout. align( ) ;
98
101
let size = layout. size( ) . next_multiple_of( align) ;
You can’t perform that action at this time.
0 commit comments