Move from {{closure}}#0 syntax to {closure#0} for (def) path components
This commit is contained in:
parent
c6e4db620a
commit
f1878d19fa
93 changed files with 298 additions and 235 deletions
|
@ -1,5 +1,5 @@
|
|||
use rustc_hir::def_id::CrateNum;
|
||||
use rustc_hir::definitions::{DefPathData, DisambiguatedDefPathData};
|
||||
use rustc_hir::definitions::{DefPathData, DefPathDataName, DisambiguatedDefPathData};
|
||||
use rustc_middle::mir::interpret::Allocation;
|
||||
use rustc_middle::ty::{
|
||||
self,
|
||||
|
@ -134,7 +134,12 @@ impl<'tcx> Printer<'tcx> for AbsolutePathPrinter<'tcx> {
|
|||
|
||||
self.path.push_str("::");
|
||||
|
||||
self.path.push_str(&disambiguated_data.data.as_symbol().as_str());
|
||||
match disambiguated_data.data.get_name() {
|
||||
DefPathDataName::Named(name) => self.path.write_str(&name.as_str()).unwrap(),
|
||||
DefPathDataName::Anon { namespace } => {
|
||||
write!(self.path, "{{{{{}}}}}", namespace).unwrap()
|
||||
}
|
||||
}
|
||||
Ok(self)
|
||||
}
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ use std::collections::hash_map::Entry;
|
|||
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
|
||||
use rustc_hir::def::DefKind;
|
||||
use rustc_hir::def_id::{DefId, CRATE_DEF_INDEX, LOCAL_CRATE};
|
||||
use rustc_hir::definitions::DefPathDataName;
|
||||
use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags;
|
||||
use rustc_middle::middle::exported_symbols::SymbolExportLevel;
|
||||
use rustc_middle::mir::mono::{CodegenUnit, CodegenUnitNameBuilder, Linkage, Visibility};
|
||||
|
@ -354,7 +355,12 @@ fn compute_codegen_unit_name(
|
|||
*cache.entry((cgu_def_id, volatile)).or_insert_with(|| {
|
||||
let def_path = tcx.def_path(cgu_def_id);
|
||||
|
||||
let components = def_path.data.iter().map(|part| part.data.as_symbol());
|
||||
let components = def_path.data.iter().map(|part| match part.data.get_name() {
|
||||
DefPathDataName::Named(name) => name,
|
||||
DefPathDataName::Anon { namespace } => {
|
||||
Symbol::intern(&format!("{{{{{}}}}}", namespace))
|
||||
}
|
||||
});
|
||||
|
||||
let volatile_suffix = volatile.then_some("volatile");
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue