+/// A quasi-deprecated helper used in rustdoc and save-analysis to get
+/// the type from a HIR node.
+pub fn hir_ty_to_ty<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, hir_ty: &hir::Ty) -> Ty<'tcx> {
+ // In case there are any projections etc, find the "environment"
+ // def-id that will be used to determine the traits/predicates in
+ // scope. This is derived from the enclosing item-like thing.
+ let env_node_id = tcx.hir.get_parent(hir_ty.id);
+ let env_def_id = tcx.hir.local_def_id(env_node_id);
+ let item_cx = self::collect::ItemCtxt::new(tcx, env_def_id);
+ item_cx.to_ty(hir_ty)
+}
+