Avoid ever constructing cyclic types in the first place, rather than detecting them in resolve. This simplifies logic elsewhere in the compiler. cc #5527
auto merge of #17157 : nikomatsakis/rust/occurs-check, r=pcwalton

Avoid ever constructing cyclic types in the first place, rather than detecting them in resolve. This simplifies logic elsewhere in the compiler, in particular on the trait reform branch.

r? @pnkfelix or @pcwalton 

cc #5527
Remove largely unused context from Visitor.
Track the visited AST's lifetime throughout Visitor.
syntax: add a custom owned smart pointer in ptr::P.
syntax: ast: replace Gc<T> (previously @T) with P<T>.
syntax: fold: use move semantics for efficient folding.
syntax: ast_map: use borrowed references into the AST.
syntax: fix fallout from using ptr::P.
syntax: tests: fix fallout from using ptr::P.
rustc: fix fallout from using ptr::P.
rustdoc: fix fallout from using ptr::P.
fourcc: fix fallout from using ptr::P.
hexfloat: fix fallout from using ptr::P.
regex_macros: fix fallout from using ptr::P.
syntax: implement in-place folding of P<T> and Vec<T>.
syntax: document the ptr module.