rustdoc: Prevent infinite recursion when inlining

Cyclic pub-use chains triggered infinite recursion, and this commit adds a hash
set to guard against cyclic recursion. This will cause one of the reexports to
render as a `pub use` instead of inlining the documentation.

Closes #16274
rustdoc: Don't try to inline the crate root

Fixes other test cases found in #16274
auto merge of #17492 : alexcrichton/rust/issue-16274, r=aturon

Details in the commits.