}
}
} else {
- // Cross-crate closure types should only be
- // visible in codegen bug reports, I imagine.
- p!(write("@{:?}", did));
+ p!(write("@{}", self.tcx().def_path_str(did)));
if substs.as_generator().is_valid() {
let upvar_tys = substs.as_generator().upvar_tys();
}
}
} else {
- // Cross-crate closure types should only be
- // visible in codegen bug reports, I imagine.
- p!(write("@{:?}", did));
+ p!(write("@{}", self.tcx().def_path_str(did)));
if substs.as_closure().is_valid() {
let upvar_tys = substs.as_closure().upvar_tys();
p!(write("::{:?}", promoted));
} else {
match self.tcx().def_kind(did) {
- Some(DefKind::Static)
- | Some(DefKind::Const)
- | Some(DefKind::AssocConst) => p!(print_value_path(did, substs)),
+ Some(DefKind::Static | DefKind::Const | DefKind::AssocConst) => {
+ p!(print_value_path(did, substs))
+ }
_ => {
if did.is_local() {
let span = self.tcx().def_span(did);
// may need to be marked as live.
fn should_explore(tcx: TyCtxt<'_>, hir_id: hir::HirId) -> bool {
match tcx.hir().find(hir_id) {
- Some(Node::Item(..))
- | Some(Node::ImplItem(..))
- | Some(Node::ForeignItem(..))
- | Some(Node::TraitItem(..))
- | Some(Node::Variant(..))
- | Some(Node::AnonConst(..))
- | Some(Node::Pat(..)) => true,
+ Some(
+ Node::Item(..)
+ | Node::ImplItem(..)
+ | Node::ForeignItem(..)
+ | Node::TraitItem(..)
+ | Node::Variant(..)
+ | Node::AnonConst(..)
+ | Node::Pat(..),
+ ) => true,
_ => false,
}
}
fn handle_res(&mut self, res: Res) {
match res {
- Res::Def(DefKind::Const, _)
- | Res::Def(DefKind::AssocConst, _)
- | Res::Def(DefKind::TyAlias, _) => {
+ Res::Def(DefKind::Const | DefKind::AssocConst | DefKind::TyAlias, _) => {
self.check_def_id(res.def_id());
}
_ if self.in_pat => {}
hir::ExprKind::Field(ref lhs, ..) => {
self.handle_field_access(&lhs, expr.hir_id);
}
- hir::ExprKind::Struct(_, ref fields, _) => {
+ hir::ExprKind::Struct(ref qpath, ref fields, _) => {
+ let res = self.tables.qpath_res(qpath, expr.hir_id);
+ self.handle_res(res);
if let ty::Adt(ref adt, _) = self.tables.expr_ty(expr).kind {
self.mark_as_used_if_union(adt, fields);
}