mk: Simplify how prepare.mk, install.mk, and dist.mk deal with stages

The only stage that can be installed from is 2 everywhere but windows,
3 on windows.

Closes #12799
std: Make atomics immutable. #11583

In Rust, the strongest guarantee that `&mut` provides is that the memory
pointed to is *not aliased*, whereas `&`'s guarantees are much weaker:
that the value can be aliased, and may be mutated under proper precautions
(interior mutability).

Our atomics though use `&mut` for mutation even while creating multiple
aliases, so this changes them to use 'interior mutability', mutating
through immutable references.
std: Make the generic atomics take unsafe pointers

These mutate values behind references that are Freeze, which is not
allowed.
std: Make the generic atomics in `sync::atomics` private

I'm not comfortable exposing public functions that purport to do
atomic operations on arbitrary T.
std: Remove AtomicU64

Support for this is less universal than for word-size things;
it has no users; i'd rather play it safe.
std: Update atomic documentation to remove 'mut'

It's all no longer necessary
syntax: make OptVec immutable.

This is the first step to replacing OptVec with a new representation:
remove all mutability. Any mutations have to go via `Vec` and then make
to `OptVec`.

Many of the uses of OptVec are unnecessary now that Vec has no-alloc
emptiness (and have been converted to Vec): the only ones that really
need it are the AST and sty's (and so on) where there are a *lot* of
instances of them, and they're (mostly) immutable.
std: Rename {push,read}_bytes to {push,read}_exact

These methods can be mistaken for general "read some bytes" utilities when
they're actually only meant for reading an exact number of bytes. By renaming
them it's much clearer about what they're doing without having to read the
documentation.

Closes #12892
Remove RefCell::{with, with_mut}

These are superfluous now that we have fixed rvalue lifetimes and Deref.
std: Implement Clone/TotalEq for ProcessExit

It's useful for structures which use deriving(Clone, TotalEq), even though it's
implicitly copyable.

Closes #13047
Clean up marker types and Unsafe initialization
syntax: add the OwnedSlice vector wrapper.

This is a stand-in until we have a saner `~[T]` type (i.e. a proper
owned slice). It's a library version of what `~[T]` will be, i.e. an
owned pointer and a length.
rustdoc: Fix file locking on windows

If the dwShareMode parameter is 0 on windows, it "prevents other processes from
opening a file or device if they request delete, read, or write access", which
is the opposite of what we want! This changes the 0 parameter to something which
will allow multiple processes to open the file and then lock it.
rustc: Switch defaults from libgreen to libnative

The compiler will no longer inject libgreen as the default runtime for rust
programs, this commit switches it over to libnative by default. Now that
libnative has baked for some time, it is ready enough to start getting more
serious usage as the default runtime for rustc generated binaries.

We've found that there isn't really a correct decision in choosing a 1:1 or M:N
runtime as a default for all applications, but it seems that a larger number of
programs today would work more reasonable with a native default rather than a
green default.

With this commit come a number of bugfixes:

* The main native task is now named "<main>"
* The main native task has the stack bounds set up properly
* #[no_uv] was renamed to #[no_start]
* The core-run-destroy test was rewritten for both libnative and libgreen and
  one of the tests was modified to be more robust.
* The process-detach test was locked to libgreen because it uses signal handling
rand: Rewrite OsRng in Rust for windows

This removes even more rust_builtin.c code, and allows us to more gracefully
handle errors (not a process panic, but a task failure).
rand: Fix a bug acquiring a context on windows

The details can be found in the comment I wrote on the block in question, but
the gist of it is that our usage of the TIB for a stack limit was causing
CryptAcquireContext to fail, so we temporarily get around it by setting the
stack limit to 0.
auto merge of #13024 : brson/rust/issue-12799, r=thestinger

The only stage that can be installed from is 2 everywhere but windows,
3 on windows.

Lightly tested. Not actually tested on Windows, but I did confirm that a *similar* change fixed the problem on Windows.

Closes #12799
Migrate all users of opt_vec to owned_slice, delete opt_vec.

syntax::opt_vec is now entirely unused, and so can go.
auto merge of #13043 : alexcrichton/rust/fix-rustdoc-windows, r=brson

If the dwShareMode parameter is 0 on windows, it "prevents other processes from
opening a file or device if they request delete, read, or write access", which
is the opposite of what we want! This changes the 0 parameter to something which
will allow multiple processes to open the file and then lock it.
auto merge of #12833 : alexcrichton/rust/libnative, r=brson

The compiler will no longer inject libgreen as the default runtime for rust
programs, this commit switches it over to libnative by default. Now that
libnative has baked for some time, it is ready enough to start getting more
serious usage as the default runtime for rustc generated binaries.

We've found that there isn't really a correct decision in choosing a 1:1 or M:N
runtime as a default for all applications, but it seems that a larger number of
programs today would work more reasonably with a native default rather than a
green default.

With this commit come a number of bugfixes:

* The main native task is now named `<main>`
* The main native task has the stack bounds set up properly
* #[no_uv] was renamed to #[no_start]
* The core-run-destroy test was rewritten for both libnative and libgreen and
  one of the tests was modified to be more robust.
* The process-detach test was locked to libgreen because it uses signal handling