Forbid unnecessary visibility on view items

For `use` statements, this means disallowing qualifiers when in functions and
disallowing `priv` outside of functions.

For `extern mod` statements, this means disallowing everything everywhere. It
may have been envisioned for `pub extern mod foo` to be a thing, but it
currently doesn't do anything (resolve doesn't pick it up), so better to err on
the side of forwards-compatibility and forbid it entirely for now.

Closes #9957
rustc: Clean up error reporting

This commit re-works how the monitor() function works and how it both receives
and transmits errors. There are a few cases in which the compiler can abort:

1. A normal compiler error. In this case, the compiler raises a FatalError as
   the failure value of the task. If this happens, then the monitor task does
   nothing. It ignores all stderr output of the child task and it also
   suppresses the failure message of the main task itself. This means that on a
   normal compiler error just the error message itself is printed.

2. A normal internal compiler error. These are invoked from sess.span_bug() and
   friends. In these cases, they follow the same path (raising a FatalError),
   but they will also print an ICE message which has a URL to go report a bug.

3. An actual compiler bug. This happens whenever anything calls fail!() instead
   of going through the session itself. In this case, we print out stuff about
   RUST_LOG=2 and we by default capture all stderr and print via warn!() so it's
   only printed out with the RUST_LOG var set.
Disallow implementation of cross-crate priv traits

Turns out we were just forgetting to encode the privacy for trais, and
everything without privacy defaults to public!

Closes #11593
Add a test for closed issue #9259

This must have been fixed in some recent trans refactor/rewrite, hurray!

Closes #9259
Added benchmark for pow and pow_with_uint
Replace old pow_with_uint with the new pow func

There was an old and barely used implementation of pow, which expected
both parameters to be uint and required more traits to be implemented.
Since a new implementation for `pow` landed, I'm proposing to remove
this old impl in favor of the new one.

The benchmark shows that the new implementation is faster than the one
being removed:

test num::bench::bench_pow_function               ..bench:      9429 ns/iter (+/- 2055)
test num::bench::bench_pow_with_uint_function     ...bench:     28476 ns/iter (+/- 2202)
auto merge of #11606 : alexcrichton/rust/issue-9259, r=brson

This must have been fixed in some recent trans refactor/rewrite, hurray!

Closes #9259
Consistent formatting for args and attrs
auto merge of #11607 : alexcrichton/rust/issue-9957, r=cmr

For `use` statements, this means disallowing qualifiers when in functions and
disallowing `priv` outside of functions.

For `extern mod` statements, this means disallowing everything everywhere. It
may have been envisioned for `pub extern mod foo` to be a thing, but it
currently doesn't do anything (resolve doesn't pick it up), so better to err on
the side of forwards-compatibility and forbid it entirely for now.

Closes #9957
auto merge of #11620 : alexcrichton/rust/rustc-silent, r=brson

This commit re-works how the monitor() function works and how it both receives
and transmits errors. There are a few cases in which the compiler can abort:

1. A normal compiler error. In this case, the compiler raises a FatalError as
   the failure value of the task. If this happens, then the monitor task does
   nothing. It ignores all stderr output of the child task and it also
   suppresses the failure message of the main task itself. This means that on a
   normal compiler error just the error message itself is printed.

2. A normal internal compiler error. These are invoked from sess.span_bug() and
   friends. In these cases, they follow the same path (raising a FatalError),
   but they will also print an ICE message which has a URL to go report a bug.

3. An actual compiler bug. This happens whenever anything calls fail!() instead
   of going through the session itself. In this case, we print out stuff about
   RUST_LOG=2 and we by default capture all stderr and print via warn!() so it's
   only printed out with the RUST_LOG var set.
xfail more external syntax extension tests on android
auto merge of #11632 : brson/rust/issue-11602, r=huonw
syntax: convert ast_map to use a SmallIntMap.

NodeIds are sequential integers starting at zero, so we can achieve some
memory savings by just storing the items all in a line in a vector.

The occupancy for typical crates seems to be 75-80%, so we're already
more efficient than a HashMap (maximum occupancy 75%), not even counting
the extra book-keeping that HashMap does.
Pass the correct --target flag when type checking pretty-printed code in tests

This makes pretty print tests that have aux crates work correctly on Android.
Without they generate errors ICEs about incorrect node ids. Not sure why.
auto merge of #11311 : hdima/rust/vim-syntax-spell-check, r=cmr

Add `@Spell` clusters to Vim syntax highlighting file to do spell checking only inside comments and strings
rustc: remove the explicit count from the lang_item macro.

We can use a secondary macro to calculate the count from the information
we're already having to pass to the lang items macro.
auto merge of #11567 : divtxt/rust/master, r=cmr

I found the boxes diagram in the tutorial misleading about how the enum worked.

The current diagram makes it seem that there is a separate Cons struct when there is only one type of struct for the  List type, and Nil is drawn almost as if it's not consuming memory.

I'm aware of the optimization that happens for this enum which takes advantage of the fact that pointer cannot be null but this is an implementation detail and not the only one that applies here.  I can add a note below the diagram mentioning this if you like.
auto merge of #11615 : adwhit/rust/master, r=cmr

This is my first patch so feedback appreciated!

Bug when initialising `bitv:Bitv::new(int,bool)` when `bool=true`. It created a `Bitv` with underlying representation `!0u` rather than the actual desired bit layout ( e.g. `11111111` instead of `00001111`). This works OK because a size attribute is included which keeps access to legal bounds.  However when using `BitvSet::from_bitv(Bitv)`, we then find that `bitvset.contains(i)` can return true when `i` should not in fact be in the set.

```
let bs = BitvSet::from_bitv(Bitv::new(100, true));
assert!(!bs.contains(&127)) //fails
```

The fix is to create the correct representation by treating various cases separately and using a bitshift `(1<<nbits) - 1` to generate correct number of `1`s where necessary.
Avoid unused variable warning in quote_*!

The provided span isn't used in all cases (namely primitives).
auto merge of #11616 : huonw/rust/ast_map, r=pnkfelix

NodeIds are sequential integers starting at zero, so we can achieve some
memory savings by just storing the items all in a line in a vector.

The occupancy for typical crates seems to be 75-80%, so we're already
more efficient than a HashMap (maximum occupancy 75%), not even counting
the extra book-keeping that HashMap does.