]> 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 e5803b7be4f63841d505e5e154e604ac87d66498..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(),
                 );
             }
@@ -712,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(
@@ -860,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(..) |
@@ -1481,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))
     }