about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authormarmeladema <xademax@gmail.com>2020-09-24 10:23:01 +0100
committermarmeladema <xademax@gmail.com>2020-09-25 22:48:44 +0100
commit5946c12476b488dbc4555741321321a1cbd4d68c (patch)
tree26898ee263ef95ce010ff7dfcc39758c679f2c9e /compiler
parent35bad3edbfd99ecf8698ac917a2582109bac5503 (diff)
downloadrust-5946c12476b488dbc4555741321321a1cbd4d68c.tar.gz
rust-5946c12476b488dbc4555741321321a1cbd4d68c.zip
Move `is_raw_guess` check in `ty::print::pretty`
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_hir/src/definitions.rs5
-rw-r--r--compiler/rustc_middle/src/ty/print/pretty.rs6
2 files changed, 7 insertions, 4 deletions
diff --git a/compiler/rustc_hir/src/definitions.rs b/compiler/rustc_hir/src/definitions.rs
index 74c91f8a859..afefde07f92 100644
--- a/compiler/rustc_hir/src/definitions.rs
+++ b/compiler/rustc_hir/src/definitions.rs
@@ -13,7 +13,7 @@ use rustc_data_structures::fx::FxHashMap;
 use rustc_data_structures::stable_hasher::StableHasher;
 use rustc_index::vec::IndexVec;
 use rustc_span::hygiene::ExpnId;
-use rustc_span::symbol::{kw, sym, Ident, Symbol};
+use rustc_span::symbol::{kw, sym, Symbol};
 
 use std::fmt::{self, Write};
 use std::hash::Hash;
@@ -159,9 +159,6 @@ impl DisambiguatedDefPathData {
     pub fn fmt_maybe_verbose(&self, writer: &mut impl Write, verbose: bool) -> fmt::Result {
         match self.data.name() {
             DefPathDataName::Named(name) => {
-                if Ident::with_dummy_span(name).is_raw_guess() {
-                    writer.write_str("r#")?;
-                }
                 if verbose && self.disambiguator != 0 {
                     write!(writer, "{}#{}", name, self.disambiguator)
                 } else {
diff --git a/compiler/rustc_middle/src/ty/print/pretty.rs b/compiler/rustc_middle/src/ty/print/pretty.rs
index 0e1d5c8fee7..cfc4b062885 100644
--- a/compiler/rustc_middle/src/ty/print/pretty.rs
+++ b/compiler/rustc_middle/src/ty/print/pretty.rs
@@ -1504,6 +1504,12 @@ impl<F: fmt::Write> Printer<'tcx> for FmtPrinter<'_, 'tcx, F> {
                 write!(self, "::")?;
             }
 
+            if let DefPathDataName::Named(name) = name {
+                if Ident::with_dummy_span(name).is_raw_guess() {
+                    write!(self, "r#")?;
+                }
+            }
+
             let verbose = self.tcx.sess.verbose();
             disambiguated_data.fmt_maybe_verbose(&mut self, verbose)?;