Some fixes to improve the rustdoc story for foreign items

Encode foreign item attributes and stability levels and visit foreign
items in the stability visitor.

cc @Gankro