vim: Tweak how comment nesting works

Don't try to match line comments inside of a comment block. That makes
no sense and can highlight differently for people who override their
highlights.

Similarly, don't match a doc-comment inside of a comment block. It
shouldn't be highlighted differently unless it's actually a doc-comment
(and nested comments are obviously not doc comments).

Fixes #12307.
Cleaned up trans_fail functions, per eddyb request.
Add a test for #11552

Closes #11552
auto merge of #12641 : sfackler/rust/issue-11552, r=huonw

Closes #11552
auto merge of #12630 : alexcrichton/rust/flush-buffered, r=brson

Now that we can call `flush()` in destructors, I think that it's appropriate for stdout/stderr to return buffered writers by default.

This doesn't enable certain functionality like a buffered stdin does, but it's what you want 90% of the time for performance reasons.
Merge pull request #12308 from kballard/vim-nested-comments

vim: Tweak how comment nesting works

Reviewed-by: brson
rustdoc: syntax highlight macro definitions, colour $... substitutions.

Macro definitions are just their raw source code, and so should be
highlighted where possible. Also, $ident non-terminal substitutions are
special, and so are worth of a little special treatment.
Merge pull request #12636 from chromatic/fixup_trans_fail

Cleaned up trans_fail(), per eddyb request.

Reviewed-by: huonw
libstd: Add some functionality to `Vec<T>`
libsyntax: Mechanically change `~[T]` to `Vec<T>`
libsyntax: Fix errors arising from the automated `~[T]` conversion
librustc: Fix errors arising from the automated `~[T]` conversion
librustdoc: Fix errors arising from the automated `~[T]` conversion
libfourcc: Fix errors arising from the automated `~[T]` conversion
auto merge of #12645 : alexcrichton/rust/invalid-libraries, r=brson

When the metadata format changes, old libraries often cause librustc to abort
when reading their metadata. This should all change with the introduction of SVH
markers, but the loader for crates should gracefully handle libraries without
SVH markers still.

This commit adds support for tripping fewer assertions when loading libraries by
using maybe_get_doc when initially parsing metadata. It's still possible for
some libraries to fall through the cracks, but this should deal with a fairly
large number of them up front.
auto merge of #12647 : huonw/rust/rustdoc-highlight-macros, r=alexcrichton

Macro definitions are just their raw source code, and so should be
highlighted where possible. Also, $ident non-terminal substitutions are
special, and so are worthy of a little special treatment.
auto merge of #12637 : pcwalton/rust/devecing, r=alexcrichton

r? @alexcrichton
rustc: Support various flavors of linkages

It is often convenient to have forms of weak linkage or other various types of
linkage. Sadly, just using these flavors of linkage are not compatible with
Rust's typesystem and how it considers some pointers to be non-null.

As a compromise, this commit adds support for weak linkage to external symbols,
but it requires that this is only placed on extern statics of type `*T`.
Codegen-wise, we get translations like:

    // rust code
    extern {
        #[linkage = "extern_weak"]
        static foo: *i32;
    }

    // generated IR
    @foo = extern_weak global i32
    @_some_internal_symbol = internal global *i32 @foo

All references to the rust value of `foo` then reference `_some_internal_symbol`
instead of the symbol `_foo` itself. This allows us to guarantee that the
address of `foo` will never be null while the value may sometimes be null.

An example was implemented in `std::rt::thread` to determine if
`__pthread_get_minstack()` is available at runtime, and a test is checked in to
use it for a static value as well. Function pointers a little odd because you
still need to transmute the pointer value to a function pointer, but it's
thankfully better than not having this capability at all.