]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc/hir/print.rs
Fix tests and assertions; add some comments
[rust.git] / src / librustc / hir / print.rs
index 69699d2e4acd35f9f5dd3e8fb2678f096730902d..e69d32ad1deafbddc9d8420276aeb19dddaf304f 100644 (file)
@@ -180,7 +180,7 @@ pub fn new(cm: &'a SourceMap,
         State {
             s: pp::mk_printer(out, default_columns),
             cm: Some(cm),
-            comments: comments.clone(),
+            comments,
             literals: literals.unwrap_or_default().into_iter().peekable(),
             cur_cmnt: 0,
             boxes: Vec::new(),
@@ -401,6 +401,7 @@ pub fn print_type(&mut self, ty: &hir::Ty) -> io::Result<()> {
                 self.print_ty_fn(f.abi, f.unsafety, &f.decl, None, &f.generic_params,
                                  &f.arg_names[..])?;
             }
+            hir::TyKind::Def(..) => {},
             hir::TyKind::Path(ref qpath) => {
                 self.print_qpath(qpath, false)?
             }
@@ -1632,6 +1633,17 @@ pub fn print_path(&mut self,
         Ok(())
     }
 
+    pub fn print_path_segment(&mut self, segment: &hir::PathSegment) -> io::Result<()> {
+        if segment.ident.name != keywords::CrateRoot.name() &&
+           segment.ident.name != keywords::DollarCrate.name() {
+           self.print_ident(segment.ident)?;
+           segment.with_generic_args(|generic_args| {
+               self.print_generic_args(generic_args, segment.infer_types, false)
+           })?;
+        }
+        Ok(())
+    }
+
     pub fn print_qpath(&mut self,
                        qpath: &hir::QPath,
                        colons_before_params: bool)