Move is_raw_guess
check in ty::print::pretty
This commit is contained in:
parent
35bad3edbf
commit
5946c12476
@ -13,7 +13,7 @@ use rustc_data_structures::fx::FxHashMap;
|
|||||||
use rustc_data_structures::stable_hasher::StableHasher;
|
use rustc_data_structures::stable_hasher::StableHasher;
|
||||||
use rustc_index::vec::IndexVec;
|
use rustc_index::vec::IndexVec;
|
||||||
use rustc_span::hygiene::ExpnId;
|
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::fmt::{self, Write};
|
||||||
use std::hash::Hash;
|
use std::hash::Hash;
|
||||||
@ -159,9 +159,6 @@ impl DisambiguatedDefPathData {
|
|||||||
pub fn fmt_maybe_verbose(&self, writer: &mut impl Write, verbose: bool) -> fmt::Result {
|
pub fn fmt_maybe_verbose(&self, writer: &mut impl Write, verbose: bool) -> fmt::Result {
|
||||||
match self.data.name() {
|
match self.data.name() {
|
||||||
DefPathDataName::Named(name) => {
|
DefPathDataName::Named(name) => {
|
||||||
if Ident::with_dummy_span(name).is_raw_guess() {
|
|
||||||
writer.write_str("r#")?;
|
|
||||||
}
|
|
||||||
if verbose && self.disambiguator != 0 {
|
if verbose && self.disambiguator != 0 {
|
||||||
write!(writer, "{}#{}", name, self.disambiguator)
|
write!(writer, "{}#{}", name, self.disambiguator)
|
||||||
} else {
|
} else {
|
||||||
|
@ -1504,6 +1504,12 @@ impl<F: fmt::Write> Printer<'tcx> for FmtPrinter<'_, 'tcx, F> {
|
|||||||
write!(self, "::")?;
|
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();
|
let verbose = self.tcx.sess.verbose();
|
||||||
disambiguated_data.fmt_maybe_verbose(&mut self, verbose)?;
|
disambiguated_data.fmt_maybe_verbose(&mut self, verbose)?;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user