libstd: io::fs::File::stat() need not to take &mut self.

The same goes for sys::fs::FileDesc::fstat() on Windows.

Signed-off-by: NODA, Kai <nodakai@gmail.com>
libstd: explicitly disallow io::fs::File to open a directory.

On *BSD systems, we can open(2) a directory and directly read(2) from
it due to an old tradition.  We should avoid doing so by explicitly
calling fstat(2) to check the type of the opened file.

Opening a directory as a module file can't always be avoided.
Even when there's no "path" attribute trick involved, there can always
be a *directory* named "my_module.rs".

Fix #12460

Signed-off-by: NODA, Kai <nodakai@gmail.com>
Move various data structures out of typeck and into ty.
Move infer out of `middle::typeck` and into just `middle`.
Remove dependency on typeck from lint.
Remove dependence on typeck from ppaux.
Remove "dependence" on typeck from comment in substs.
Remove one dependence on typeck from const_eval.
Move `typeck` logically in the module tree out to the root and clamp
down on its exports. Remove some dead code that is revealed.
Modify libsyntax/diagnostics to not be so persnickety. The scheme
doesn't work in a multi-crate context. We'll need to come up with
something better.
Remove dependencies on driver from trans et al. by moving various
structs out from driver and into other places.
Move typeck into its own crate.
Separate the driver into its own crate that uses trans, typeck.
FIXME(#19497) -- Stop messing around and just give rustc 32MB of stack unconditionally. This is prompted by some sort of bug in trans that causes a stack overflow when the modules in trans are made private. (In particular, the overflow can also be avoided by making `controlflow` and `callee` public, but that seems strictly worse than just using more stack.)
Delete diagnostics tests because that model doesn't scale to multiple crates
auto merge of #19303 : nodakai/rust/libsyntax-reject-dirs, r=alexcrichton

On *BSD systems, we can `open(2)` a directory and directly `read(2)` from it due to an old tradition.  We should avoid doing so by explicitly calling `fstat(2)` to check the type of the opened file.

Opening a directory as a module file can't always be avoided.  Even when there's no "path" attribute trick involved, there can always be a *directory* named `my_module.rs`.

Incidentally, remove unnecessary mutability of `&self` from `io::fs::File::stat()`.
Fix various references in late-running tests and things
Remove crates from test list so that we don't waste time building them.
auto merge of #19362 : nikomatsakis/rust/crateification, r=nikomatsakis

This has the goal of further reducing peak memory usage and enabling more parallelism. This patch should allow trans/typeck to build in parallel. The plan is to proceed by moving as many additional passes as possible into distinct crates that lay alongside typeck/trans. Basically, the idea is that there is the `rustc` crate which defines the common data structures shared between passes. Individual passes then go into their own crates. Finally, the `rustc_driver` crate knits it all together.

cc @jakub-: One wrinkle is the diagnostics plugin. Currently, it assumes all diagnostics are defined and used within one crate in order to track what is used and what is duplicated. I had to disable this. We'll have to find an alternate strategy, but I wasn't sure what was best so decided to just disable the duplicate checking for now.
test: expose error bars and the extra stats test keeps track of