std: add tests for the Vec<u8> Writer impl
std: add Reader impl for &[u8]
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.)
core: fix a doctest
auto merge of #18980 : erickt/rust/reader, r=erickt

This continues the work @thestinger started in #18885 (which hasn't landed yet, so wait for that to land before landing this one). Instead of adding more methods to `BufReader`, this just allows a `&[u8]` to be used directly as a `Reader`. It also adds an impl of `Writer` for `&mut [u8]`.
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()`.