about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/ty/print
diff options
context:
space:
mode:
authormarmeladema <xademax@gmail.com>2020-08-31 23:26:15 +0100
committermarmeladema <xademax@gmail.com>2020-09-25 22:46:15 +0100
commit2708ad8bb441fb500bbd2486779c215ffd57bcd2 (patch)
tree25b502c1ef735d9c9671f8135306afa90944a04f /compiler/rustc_middle/src/ty/print
parent9f50c49117684c2806c54e94ee6aff7d11ca724f (diff)
downloadrust-2708ad8bb441fb500bbd2486779c215ffd57bcd2.tar.gz
rust-2708ad8bb441fb500bbd2486779c215ffd57bcd2.zip
Fix pretty-printing of `DisambiguatedDefPathData`
Diffstat (limited to 'compiler/rustc_middle/src/ty/print')
-rw-r--r--compiler/rustc_middle/src/ty/print/pretty.rs19
1 files changed, 4 insertions, 15 deletions
diff --git a/compiler/rustc_middle/src/ty/print/pretty.rs b/compiler/rustc_middle/src/ty/print/pretty.rs
index 91986289099..7ec14d43892 100644
--- a/compiler/rustc_middle/src/ty/print/pretty.rs
+++ b/compiler/rustc_middle/src/ty/print/pretty.rs
@@ -1496,27 +1496,16 @@ impl<F: fmt::Write> Printer<'tcx> for FmtPrinter<'_, 'tcx, F> {
             return Ok(self);
         }
 
-        let name = match disambiguated_data.data.get_name() {
-            DefPathDataName::Named(name) => name,
-            DefPathDataName::Anon { namespace } => namespace,
-        };
-
         // FIXME(eddyb) `name` should never be empty, but it
         // currently is for `extern { ... }` "foreign modules".
-        if name != kw::Invalid {
+        let name = disambiguated_data.data.get_name();
+        if name != DefPathDataName::Named(kw::Invalid) {
             if !self.empty_path {
                 write!(self, "::")?;
             }
-            if Ident::with_dummy_span(name).is_raw_guess() {
-                write!(self, "r#")?;
-            }
 
-            match disambiguated_data.data.get_name() {
-                DefPathDataName::Named(name) => self.write_str(&name.as_str())?,
-                DefPathDataName::Anon { namespace } => {
-                    write!(self, "{{{}#{}}}", namespace, disambiguated_data.disambiguator)?
-                }
-            }
+            let verbose = self.tcx.sess.verbose();
+            disambiguated_data.fmt_maybe_verbose(&mut self, verbose)?;
 
             self.empty_path = false;
         }