@@ -35,8 +35,14 @@ of `char` is _implementation-defined_.
35
35
36
36
The ` isize ` and ` usize ` types are pointer-sized signed and unsigned integers.
37
37
They have the same layout as the [ pointer types] for which the pointee is
38
- ` Sized ` , and are layout compatible with C's ` uintptr_t ` and ` intptr_t ` types,
39
- and are therefore at least 16-bit wide.
38
+ ` Sized ` , and are layout compatible with C's ` uintptr_t ` and ` intptr_t ` types.
39
+
40
+ > ** Note** : on all platforms that we currently support, ` usize ` /` isize ` are at
41
+ > least 16-bit wide. C99
42
+ > [ 7.18.2.4] ( https://port70.net/~nsz/c/c99/n1256.html#7.18.2.4 ) requires
43
+ > ` uintptr_t ` and ` intptr_t ` to be at least 16-bit wide. ` libcore ` relies on
44
+ > this to unconditionally provide impls of ` From<i16> ` /` From<u16> ` for
45
+ > ` isize ` /` usize ` .
40
46
41
47
> ** Note** : Rust's ` usize ` and C's ` unsigned ` types are ** not** equivalent. C's
42
48
> ` unsigned ` is at least as large as a short, allowed to have padding bits, etc.
@@ -60,23 +66,6 @@ and are therefore at least 16-bit wide.
60
66
> These limits have not gone through the RFC process and are not guaranteed to
61
67
> hold.
62
68
63
- <details ><summary ><b >Rationale</b ></summary >
64
-
65
- C99 [ 7.18.2.4] ( https://port70.net/~nsz/c/c99/n1256.html#7.18.2.4 ) "Limits of
66
- integer types capable of holding object pointers" provides the following minimum
67
- range of values that the pointer-holding integer types must support:
68
-
69
- * ` intptr_t ` : ` [INTPTR_MIN, INTPTR_MAX] = [-(2^15 - 1), 2^15 - 1] `
70
- * ` uintptr_t ` : ` [0, UINTPTR_MAX] = [0, 2^16 - 1] `
71
-
72
- That is, ` isize ` /` usize ` are at least 16-bit wide. ` libcore ` relies on
73
- this guarantee and unconditionally provides:
74
-
75
- * ` impl From<i16> for isize ` ,
76
- * ` impl From<u16> for usize ` .
77
-
78
- </details >
79
-
80
69
[ pointer types ] : ./pointers.md
81
70
82
71
## Fixed-width integer types
0 commit comments