define Eq,TotalEq,Ord,TotalOrd for &mut T

Also Show, which is useful in assertions. Fixes #14074
Optimize common path of Once::doit

Optimize `Once::doit`: perform optimistic check that initializtion is
already completed.  `load` is much cheaper than `fetch_add` at least
on x86_64.

Verified with this test:

```
static mut o: one::Once = one::ONCE_INIT;
unsafe {
    loop {
        let start = time::precise_time_ns();
        let iters = 50000000u64;
        for _ in range(0, iters) {
            o.doit(|| { println!("once!"); });
        }
        let end = time::precise_time_ns();
        let ps_per_iter = 1000 * (end - start) / iters;
        println!("{} ps per iter", ps_per_iter);

        // confuse the optimizer
        o.doit(|| { println!("once!"); });
    }
}
```

Test executed on Mac, Intel Core i7 2GHz. Result is:
* 20ns per iteration without patch
*  4ns per iteration with this patch applied

Once.doit could be even faster (800ps per iteration), if `doit` function
was split into a pair of `doit`/`doit_slow`, and `doit` marked as
`#[inline]` like this:

```
#[inline(always)]
pub fn doit(&self, f: ||) {
    if self.cnt.load(atomics::SeqCst) < 0 {
        return
    }

    self.doit_slow(f);
}

fn doit_slow(&self, f: ||) { ... }
```
Reinstate HashMap.mangle().

This was removed when the Robin Hood hash map came along, but it is a
useful thing to have.

The comment is taken directly from what was there before (e.g. in 0.9)
but with appropriate language changes (like `StrBuf` instead of `~str`).
update valgrind headers
Added substring searching benchmarks.

test str::bench::bench_contains_bad_naive                   ... bench:      1309 ns/iter (+/- 36)
test str::bench::bench_contains_equal                       ... bench:       137 ns/iter (+/- 2)
test str::bench::bench_contains_short_long                  ... bench:      5473 ns/iter (+/- 14)
test str::bench::bench_contains_short_short                 ... bench:        57 ns/iter (+/- 6)
Print 'rustc' and 'rustdoc' as the command name for --version

Instead of just blindly printing arg[0], use a constant string.
Partial fix for #13582
Tidy up the HashMap.mangle example.
Rename HashMap.mangle to find_with_or_insert_with.

This also entails swapping the order of the find and insert callbacks so
that their order matches the order of the terms in the method name.
Use assertions in find_with_or_insert_with example

This lets us test it automatically and also makes it more obvious what
the expected result is.
Change str::from_utf8_owned() to return Result

This allows the original vector to be recovered in the event that it is
not valid UTF-8.

[breaking-change]
Change StrBuf::from_utf8() to return Result

This allows the original vector to be recovered in the event that it is
not UTF-8.

[breaking-change]
Switched to the two-way algorithm for string searching

test str::bench::bench_contains_bad_naive                   ... bench:       300 ns/iter (+/- 12)     from 1309 ns/iter (+/- 36)
test str::bench::bench_contains_equal                       ... bench:       154 ns/iter (+/- 7)      from  137 ns/iter (+/- 2)
test str::bench::bench_contains_short_long                  ... bench:      2998 ns/iter (+/- 74)     from 5473 ns/iter (+/- 14)
test str::bench::bench_contains_short_short                 ... bench:        65 ns/iter (+/- 2)      from   57 ns/iter (+/- 6)
auto merge of #14133 : db48x/rust/ord-for-mut-refs, r=alexcrichton

Also Show, which is useful in assertions. Fixes #14074
Add ToCStr impl for &Path and StrBuf

This is a stopgap until DST (#12938) lands.

Until DST lands, we cannot decompose &str into & and str, so we cannot
usefully take ToCStr arguments by reference (without forcing an
additional & around &str). So we are instead temporarily adding an
instance for &Path and StrBuf, so that we can take ToCStr as owned. When
DST lands, the &Path instance should be removed, the string instances
should be revisted, and arguments bound by ToCStr should be passed by
reference.

FIXMEs have been added accordingly.
Process::new etc should support non-utf8 commands/args

The existing APIs for spawning processes took strings for the command
and arguments, but the underlying system may not impose utf8 encoding,
so this is overly limiting.

The assumption we actually want to make is just that the command and
arguments are viewable as [u8] slices with no interior NULLs, i.e., as
CStrings. The ToCStr trait is a handy bound for types that meet this
requirement (such as &str and Path).

However, since the commands and arguments are often a mixture of
strings and paths, it would be inconvenient to take a slice with a
single T: ToCStr bound. So this patch revamps the process creation API
to instead use a builder-style interface, called `Command`, allowing
arguments to be added one at a time with differing ToCStr
implementations for each.

The initial cut of the builder API has some drawbacks that can be
addressed once issue #13851 (libstd as a facade) is closed. These are
detailed as FIXMEs.

Closes #11650.

[breaking-change]
Change dynamic_library::open_external to take ToCStr

`std::unstable::dynamic_library::open_external` currently takes a
`Path`, but because `Paths` produce normalized strings, this can
change the semantics of lookups in a given environment. This patch
generalizes the function to take a `ToCStr`-bounded type, which
includes both `Path`s and `str`s.

Closes #11650.
auto merge of #14162 : brson/rust/fixvercmd, r=brson

Instead of just blindly printing arg[0], use a constant string.

Partial fix for #13582
syntax::visit: pub `walk_explicit_self` so impls can call it as defaults do.

drive-by: added some doc.
Teach SVH computation to ignore more implementation artifacts.

In particular, this version of strict version hash (SVH) works much
like the deriving(Hash)-based implementation did, except that uses a
content-based hash that filters rustc implementation artifacts and
surface syntax artifacts.

Fix #14132.
Some basic acceptance tests for better SVH.