@@ -10,24 +10,24 @@ When calling this method, you have to ensure that *either* the pointer is null *
10
10
all of the following is true:
11
11
12
12
* The pointer must be [ valid] for reads for ` ptr.len() * size_of::<T>() ` many bytes,
13
- and it must be properly aligned. This means in particular:
13
+ and it must be properly aligned. This means in particular:
14
14
15
15
* The entire memory range of this slice must be contained within a single [ allocation] !
16
- Slices can never span across multiple allocations.
16
+ Slices can never span across multiple allocations.
17
17
18
18
* The pointer must be aligned even for zero-length slices. One
19
- reason for this is that enum layout optimizations may rely on references
20
- (including slices of any length) being aligned and non-null to distinguish
21
- them from other data. You can obtain a pointer that is usable as ` data `
22
- for zero-length slices using [ ` NonNull::dangling() ` ] .
19
+ reason for this is that enum layout optimizations may rely on references
20
+ (including slices of any length) being aligned and non-null to distinguish
21
+ them from other data. You can obtain a pointer that is usable as ` data `
22
+ for zero-length slices using [ ` NonNull::dangling() ` ] .
23
23
24
24
* The total size ` ptr.len() * size_of::<T>() ` of the slice must be no larger than ` isize::MAX ` .
25
- See the safety documentation of [ ` pointer::offset ` ] .
25
+ See the safety documentation of [ ` pointer::offset ` ] .
26
26
27
27
* You must enforce Rust's aliasing rules, since the returned lifetime ` 'a ` is
28
- arbitrarily chosen and does not necessarily reflect the actual lifetime of the data.
29
- In particular, while this reference exists, the memory the pointer points to must
30
- not get mutated (except inside ` UnsafeCell ` ).
28
+ arbitrarily chosen and does not necessarily reflect the actual lifetime of the data.
29
+ In particular, while this reference exists, the memory the pointer points to must
30
+ not get mutated (except inside ` UnsafeCell ` ).
31
31
32
32
This applies even if the result of this method is unused!
33
33
0 commit comments