Removed some unnecessary RefCells from resolve
Fixes ICE when using reexported unit-like structs

Fixes that unit-like structs cannot be used if they are reexported and
used in another crate. The compiler fails with an ICE, because unit-like
structs are exported as DefFn and the expression `UnitStruct` is
interpreted as function pointer instead of a call to the constructor.

To resolve this ambiguity tuple-like struct constructors are now exported
as CtorFn. When `rustc::metadata::decoder` finds a CtorFn it sets a new
flag `is_ctor` in DefFn to true.

Relevant changes are in `rustc::metadata::{encoder, decoder}` and in
`rustc::middle::ty`.

Closes #12660 and #16973.
libstd: Pass-through PATH in test_override_env

In some build environments (such as chrooted Nix builds), `env` can only
be found in the explicitly-provided PATH, not in default places such as
/bin or /usr/bin. So we need to pass-through PATH when spawning the
`env` sub-process.

Fixes #17617
Limit recursion depth for macro expansions, closes #17628
auto merge of #17653 : kaini/rust/master, r=alexcrichton

Fixes that unit-like structs cannot be used if they are re-exported and used in another crate. (ICE)
The relevant changes are in `rustc::metadata::{decoder, encoder}` and `rustc::middle::ty`.

A test case is included.

The problem is that the expressoin `UnitStruct` is an `ExprPath` to an `DefFn`, which is of expr kind `RvalueDatumExpr`, but for unit-struct ctors the expr kind should be `RvalueDpsExpr`. I fixed this (in a I guess clean way) by introducing `CtorFn` in the metadata and including a `is_ctor` flag in `DefFn`.
auto merge of #17654 : gereeter/rust/no-unnecessary-cell, r=alexcrichton

There is more that could be done, but this was the low hanging fruit.
auto merge of #17667 : wizeman/rust/fix-override-env, r=alexcrichton

In some build environments (such as chrooted Nix builds), `env` can only
be found in the explicitly-provided PATH, not in default places such as
/bin or /usr/bin. So we need to pass-through PATH when spawning the
`env` sub-process.

Fixes #17617
auto merge of #17678 : fhahn/rust/issue-17628-infinite-recursion, r=alexcrichton

This is a patch for #17628, thanks to @kmcallister for your helpful hints!
Part of #6993. Moved a bunch of uses of Ident to Name