]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc/ty/print/pretty.rs
rustc: collapse relevant DefPathData variants into TypeNs.
[rust.git] / src / librustc / ty / print / pretty.rs
index c9a4961a8e044cabfabbe53fb0ff850a0a6eb31e..c66610c98d5e36296c19b1e03343f451c112cdec 100644 (file)
@@ -355,11 +355,10 @@ fn try_print_visible_def_path(
             // the children of the visible parent (as was done when computing
             // `visible_parent_map`), looking for the specific child we currently have and then
             // have access to the re-exported name.
-            DefPathData::Module(ref mut name) |
             DefPathData::TypeNs(ref mut name) if Some(visible_parent) != actual_parent => {
                 let reexport = self.tcx().item_children(visible_parent)
                     .iter()
-                    .find(|child| child.def.def_id() == def_id)
+                    .find(|child| child.res.def_id() == def_id)
                     .map(|child| child.ident.as_interned_str());
                 if let Some(reexport) = reexport {
                     *name = reexport;
@@ -367,7 +366,7 @@ fn try_print_visible_def_path(
             }
             // Re-exported `extern crate` (#43189).
             DefPathData::CrateRoot => {
-                data = DefPathData::Module(
+                data = DefPathData::TypeNs(
                     self.tcx().original_crate_name(def_id.krate).as_interned_str(),
                 );
             }
@@ -592,7 +591,7 @@ fn pretty_print_type(
                         p!(
                             write("{}{}:",
                                     sep,
-                                    self.tcx().hir().name(freevar.var_id())),
+                                    self.tcx().hir().name_by_hir_id(freevar.var_id())),
                             print(upvar_ty));
                         sep = ", ";
                     }
@@ -635,7 +634,7 @@ fn pretty_print_type(
                         p!(
                             write("{}{}:",
                                     sep,
-                                    self.tcx().hir().name(freevar.var_id())),
+                                    self.tcx().hir().name_by_hir_id(freevar.var_id())),
                             print(upvar_ty));
                         sep = ", ";
                     }
@@ -701,7 +700,8 @@ fn pretty_print_dyn_existential(
                 if let ty::Tuple(ref args) = principal.substs.type_at(0).sty {
                     let mut projections = predicates.projection_bounds();
                     if let (Some(proj), None) = (projections.next(), projections.next()) {
-                        p!(pretty_fn_sig(args, false, proj.ty));
+                        let tys: Vec<_> = args.iter().map(|k| k.expect_ty()).collect();
+                        p!(pretty_fn_sig(&tys, false, proj.ty));
                         resugared = true;
                     }
                 }
@@ -711,7 +711,7 @@ fn pretty_print_dyn_existential(
             // in order to place the projections inside the `<...>`.
             if !resugared {
                 // Use a type that can't appear in defaults of type parameters.
-                let dummy_self = self.tcx().mk_infer(ty::FreshTy(0));
+                let dummy_self = self.tcx().mk_ty_infer(ty::FreshTy(0));
                 let principal = principal.with_self_ty(self.tcx(), dummy_self);
 
                 let args = self.generic_args_to_print(
@@ -859,7 +859,6 @@ impl TyCtxt<'_, '_, '_> {
     fn guess_def_namespace(self, def_id: DefId) -> Namespace {
         match self.def_key(def_id).disambiguated_data.data {
             DefPathData::ValueNs(..) |
-            DefPathData::EnumVariant(..) |
             DefPathData::Field(..) |
             DefPathData::AnonConst |
             DefPathData::ConstParam(..) |
@@ -1480,7 +1479,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
 
     ty::ExistentialTraitRef<'tcx> {
         // Use a type that can't appear in defaults of type parameters.
-        let dummy_self = cx.tcx().mk_infer(ty::FreshTy(0));
+        let dummy_self = cx.tcx().mk_ty_infer(ty::FreshTy(0));
         let trait_ref = self.with_self_ty(cx.tcx(), dummy_self);
         p!(print(trait_ref))
     }