]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc/ty/item_path.rs
Various minor/cosmetic improvements to code
[rust.git] / src / librustc / ty / item_path.rs
index d44ba03084159ebe6a320e1e41d8f75a77f6b421..a39eb004fd7864bd711cd998955921968616d35d 100644 (file)
@@ -14,7 +14,6 @@
 use middle::cstore::{ExternCrate, ExternCrateSource};
 use syntax::ast;
 use syntax::symbol::{keywords, LocalInternedString, Symbol};
-use syntax_pos::edition::Edition;
 
 use std::cell::Cell;
 use std::fmt::Debug;
@@ -84,7 +83,7 @@ pub fn item_path_str(self, def_id: DefId) -> String {
 
     /// Returns a string identifying this local node-id.
     pub fn node_path_str(self, id: ast::NodeId) -> String {
-        self.item_path_str(self.hir.local_def_id(id))
+        self.item_path_str(self.hir().local_def_id(id))
     }
 
     /// Returns a string identifying this def-id. This string is
@@ -140,7 +139,7 @@ pub fn push_krate_path<T>(self, buffer: &mut T, cnum: CrateNum, pushed_prelude_c
                         debug!("push_krate_path: name={:?}", name);
                         buffer.push(&name);
                     }
-                } else if self.sess.edition() == Edition::Edition2018 && !pushed_prelude_crate {
+                } else if self.sess.rust_2018() && !pushed_prelude_crate {
                     SHOULD_PREFIX_WITH_CRATE.with(|flag| {
                         // We only add the `crate::` keyword where appropriate. In particular,
                         // when we've not previously pushed a prelude crate to this path.
@@ -318,7 +317,7 @@ pub fn push_item_path<T>(self, buffer: &mut T, def_id: DefId, pushed_prelude_cra
 
             // Unclear if there is any value in distinguishing these.
             // Probably eventually (and maybe we would even want
-            // finer-grained distinctions, e.g. between enum/struct).
+            // finer-grained distinctions, e.g., between enum/struct).
             data @ DefPathData::Misc |
             data @ DefPathData::TypeNs(..) |
             data @ DefPathData::Trait(..) |
@@ -465,8 +464,8 @@ fn push_impl_path_fallback<T>(
         // only occur very early in the compiler pipeline.
         let parent_def_id = self.parent_def_id(impl_def_id).unwrap();
         self.push_item_path(buffer, parent_def_id, pushed_prelude_crate);
-        let node_id = self.hir.as_local_node_id(impl_def_id).unwrap();
-        let item = self.hir.expect_item(node_id);
+        let node_id = self.hir().as_local_node_id(impl_def_id).unwrap();
+        let item = self.hir().expect_item(node_id);
         let span_str = self.sess.source_map().span_to_string(item.span);
         buffer.push(&format!("<impl at {}>", span_str));
     }
@@ -515,6 +514,7 @@ pub fn characteristic_def_id_of_type(ty: Ty<'_>) -> Option<DefId> {
         ty::Str |
         ty::FnPtr(_) |
         ty::Projection(_) |
+        ty::Placeholder(..) |
         ty::UnnormalizedProjection(..) |
         ty::Param(_) |
         ty::Opaque(..) |