Skip to content

Commit 5946c12

Browse files
committed
Move is_raw_guess check in ty::print::pretty
1 parent 35bad3e commit 5946c12

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

compiler/rustc_hir/src/definitions.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use rustc_data_structures::fx::FxHashMap;
1313
use rustc_data_structures::stable_hasher::StableHasher;
1414
use rustc_index::vec::IndexVec;
1515
use rustc_span::hygiene::ExpnId;
16-
use rustc_span::symbol::{kw, sym, Ident, Symbol};
16+
use rustc_span::symbol::{kw, sym, Symbol};
1717

1818
use std::fmt::{self, Write};
1919
use std::hash::Hash;
@@ -159,9 +159,6 @@ impl DisambiguatedDefPathData {
159159
pub fn fmt_maybe_verbose(&self, writer: &mut impl Write, verbose: bool) -> fmt::Result {
160160
match self.data.name() {
161161
DefPathDataName::Named(name) => {
162-
if Ident::with_dummy_span(name).is_raw_guess() {
163-
writer.write_str("r#")?;
164-
}
165162
if verbose && self.disambiguator != 0 {
166163
write!(writer, "{}#{}", name, self.disambiguator)
167164
} else {

compiler/rustc_middle/src/ty/print/pretty.rs

+6
Original file line numberDiff line numberDiff line change
@@ -1504,6 +1504,12 @@ impl<F: fmt::Write> Printer<'tcx> for FmtPrinter<'_, 'tcx, F> {
15041504
write!(self, "::")?;
15051505
}
15061506

1507+
if let DefPathDataName::Named(name) = name {
1508+
if Ident::with_dummy_span(name).is_raw_guess() {
1509+
write!(self, "r#")?;
1510+
}
1511+
}
1512+
15071513
let verbose = self.tcx.sess.verbose();
15081514
disambiguated_data.fmt_maybe_verbose(&mut self, verbose)?;
15091515

0 commit comments

Comments
 (0)