]> 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 08d46793d97bf60da9beb59ad3717b378deb98bb..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(),
@@ -1633,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)