Factor out foldable better to reduce code duplication.  There is now a "double
dispatch" pattern that lets you easily write new folders and then apply them to
various structures, reusing the "folding" effort.
Added functions pop_char and shift_char to StrBuf struct along with appropriate unit tests, using the same test case as push_char.

Changed StrBuf.shift_byte() that it no longer reallocates the buffer by just calling Vec.shift();

Added warning to shift_char()'s docs about it having to copy the whole buffer, as per the docs for
Vec.shift().
auto merge of #14158 : nikomatsakis/rust/issue-5527-refactor-foldable, r=pcwalton

Factor out foldable better to reduce code duplication. 

r? @pcwalton (probably want to let travis run...)
auto merge of #14052 : dylanbraithwaite/rust/char-fns-for-strbuf, r=alexcrichton

Added functions pop_char and shift_char to StrBuf along with unit tests, using the same test cases as push_char.
Use CreateProcessW instead of CreateProcessA

Changed libnative to use CreateProcessW instead of CreateProcessA.  In
addition, the lpEnvironment parameter now uses Unicode.

Added a helper function os::win32::as_mut_utf16_p, which does basically
the same thing as os::win32::as_utf16_p except the pointer is mutable.
Fix make_command_line to handle Unicode correctly

Previously, make_command_line iterates over each u8 in the string and
then appends them as chars, so any non-ASCII string will get horribly
mangled by this function.  This fix should allow Unicode arguments to
work correctly in native::io::process::spawn.
Use Get/FreeEnvironmentStringsW instead of Get/FreeEnvironmentStringsA

Changed libstd to use Get/FreeEnvironmentStringsW instead of
Get/FreeEnvironmentStringsA to support Unicode environment variables.
Test Unicode support of process spawning

Added a run-pass test to ensure that processes can be correctly spawned
using non-ASCII arguments, working directory, and environment variables.
It also tests Unicode support of os::env_as_bytes.

An additional assertion was added to the test for make_command_line to
verify it handles Unicode correctly.
auto merge of #14075 : Rufflewind/rust/patch-3, r=alexcrichton

- Use Unicode-aware versions of `CreateProcess` (Fixes #13815) and `Get/FreeEnvironmentStrings`.
    - Includes a helper function `os::win32::as_mut_utf16_p`, which does the same thing as `os::win32::as_utf16_p` except the pointer is mutable.
    - Fixed `make_command_line` to handle Unicode correctly.
- Tests for the above.