Enhance auto_encode to take number of struct fields

emit_struct and read_struct takes an additional len:uint parameter which tells
us how many fields the struct we are working on has.

This is required to implement an Encoder for the msgpack [1] serialization
format. To serialize a struct with msgpack you have to use arrays and the size
of the array has to be know before each of the elements are written out. JSON
as an example doesn't have this problem as it uses '[' and ']' delimiters for
arrays.

[1]: www.msgpack.org
Rename memcpy, memmove, memset to prevent any confusion with the C equivalents.

Closes #4203.
Make std::sync::semaphore() public
Factor out base::get_discrim_val from const translation
Allow consts' LLVM types to depend on their initializers.

Loosening the connection between the LLVM type and the Rust type
is necessary to use non-nullary enum constructors as const initializers,
because the const needs to be initialized with data of the actual type of
the variant in question, which is (generally) not the same as the u8
array in the `type_of` type.

Thus, referring to a const now requires casting the LLVM global to the
expected pointer type instead of using it as-is.
Allow consts to be non-nullary enum constructors
Omit needless zeroes for C-like variants of non-C-like enums
Add more tests for enum constants.

The tests have consts defined both before and after their uses in order
to prevent bugs that depend on the order in which they are translated.
Regression tests for passing enum-typed consts by reference.

If the PointerCast in trans_def_lvalue is removed, these cases cause
LLVM assertion failures.
doc: Fix spelling error in macro tutorial
add Option methods for swap_unwrap and map_consume
add Option map_consume_default method
avoid unwrap in Option::map_consume implementation
Inlining methods/functions in core.

Also inlining some functions which take functions as arguments.
add Option methods for in-place mutation
Merge pull request #4460 from pkgw/pr-tut-typo

doc: Fix spelling error in macro tutorial
Merge pull request #4467 from gifnksm/inlining-core

Inlining methods/functions in core.
Merge pull request #4465 from thestinger/option

improvements to option module
core: Align cmp::le() with the other implementations

Also add comments reminding that IEEE 754 requires unusual semantics for
comparison operators as applied to NaNs (x != x, if x = NaN), in case someone
in the future wants to get clever.
core: Use libc::readlink function properly

The specification of readlink() says it's not guaranteed that the
returned contents of the symbolic link is null-terminated.