about summary refs log tree commit diff
path: root/src/doc
diff options
context:
space:
mode:
authorAlex Burka <durka42+github@gmail.com>2016-06-13 15:05:22 -0400
committerAlex Burka <aburka@seas.upenn.edu>2016-07-27 13:58:51 -0400
commit48ce20653a470f2d4734fb0ee4a89905da23b15c (patch)
tree4d006b6532bb80224b97e3254e1f839c58ed62e0 /src/doc
parent032ea41e99b39f6af2aa26c0ba049d0d215d8ebb (diff)
downloadrust-48ce20653a470f2d4734fb0ee4a89905da23b15c.tar.gz
rust-48ce20653a470f2d4734fb0ee4a89905da23b15c.zip
generics-agnostic description
Diffstat (limited to 'src/doc')
-rw-r--r--src/doc/book/ffi.md14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/doc/book/ffi.md b/src/doc/book/ffi.md
index 873d078f053..590c23e8929 100644
--- a/src/doc/book/ffi.md
+++ b/src/doc/book/ffi.md
@@ -578,19 +578,17 @@ interfacing with C, pointers that might be `null` are often used, which would se
 require some messy `transmute`s and/or unsafe code to handle conversions to/from Rust types.
 However, the language provides a workaround.
 
-As a special case, an `enum` that contains exactly two variants, one of
-which contains no data and the other containing a single field, is eligible
-for the "nullable pointer optimization". When such an enum is instantiated
-with one of the non-nullable types listed above, it is represented as a single pointer,
-and the non-data variant is represented as the null pointer. This is called an
-"optimization", but unlike other optimizations it is guaranteed to apply to
+As a special case, an `enum` is eligible for the "nullable pointer optimization" if it
+contains exactly two variants, one of which contains no data and the other contains
+a single field of one of the non-nullable types listed above. This means it is represented
+as a single pointer, and the non-data variant is represented as the null pointer. This is
+called an "optimization", but unlike other optimizations it is guaranteed to apply to
 eligible types.
 
 The most common type that takes advantage of the nullable pointer optimization is `Option<T>`,
 where `None` corresponds to `null`. So `Option<extern "C" fn(c_int) -> c_int>` is a correct way
 to represent a nullable function pointer using the C ABI (corresponding to the C type
-`int (*)(int)`). (However, generics are not required to get the optimization. A simple
-`enum NullableIntRef { Int(Box<i32>), NotInt }` is also represented as a single pointer.)
+`int (*)(int)`).
 
 Here is an example: