@@ -895,9 +895,9 @@ mod prim_usize { }
895
895
/// A reference represents a borrow of some owned value. You can get one by using the `&` or `&mut`
896
896
/// operators on a value, or by using a `ref` or `ref mut` pattern.
897
897
///
898
- /// For those familiar with pointers, a reference is just a pointer that is assumed to not be null.
899
- /// In fact, `Option<&T>` has the same memory representation as a nullable pointer, and can be
900
- /// passed across FFI boundaries as such.
898
+ /// For those familiar with pointers, a reference is just a pointer that is assumed to be
899
+ /// aligned and not null. In fact, `Option<&T>` has the same memory representation as a
900
+ /// nullable but aligned pointer, and can be passed across FFI boundaries as such.
901
901
///
902
902
/// In most cases, references can be used much like the original value. Field access, method
903
903
/// calling, and indexing work the same (save for mutability rules, of course). In addition, the
@@ -1040,6 +1040,11 @@ mod prim_ref { }
1040
1040
/// [`FnMut`]: ops/trait.FnMut.html
1041
1041
/// [`FnOnce`]: ops/trait.FnOnce.html
1042
1042
///
1043
+ /// Function pointers are pointers that point to *code*, not data. They can be called
1044
+ /// just like functions. Like references, function pointers are assumed to not be null,
1045
+ /// so if you want to pass a function pointer over FFI and be able to accommodate null pointers,
1046
+ /// make your type `Option<fn()>` with your required signature.
1047
+ ///
1043
1048
/// Plain function pointers are obtained by casting either plain functions, or closures that don't
1044
1049
/// capture an environment:
1045
1050
///
@@ -1095,10 +1100,6 @@ mod prim_ref { }
1095
1100
///
1096
1101
/// These markers can be combined, so `unsafe extern "stdcall" fn()` is a valid type.
1097
1102
///
1098
- /// Like references in rust, function pointers are assumed to not be null, so if you want to pass a
1099
- /// function pointer over FFI and be able to accommodate null pointers, make your type
1100
- /// `Option<fn()>` with your required signature.
1101
- ///
1102
1103
/// Function pointers implement the following traits:
1103
1104
///
1104
1105
/// * [`Clone`]
0 commit comments