Move from {{closure}}#0 syntax to {closure#0} for (def) path components

This commit is contained in:
marmeladema 2020-08-31 18:11:44 +01:00
parent c6e4db620a
commit f1878d19fa
93 changed files with 298 additions and 235 deletions

View file

@ -7,7 +7,8 @@ use crate::common::CodegenCx;
use crate::llvm;
use crate::llvm::debuginfo::DIScope;
use rustc_hir::def_id::DefId;
use rustc_hir::definitions::DefPathData;
use rustc_hir::definitions::{DefPathData, DefPathDataName};
use rustc_span::symbol::Symbol;
pub fn mangled_name_of_instance<'a, 'tcx>(
cx: &CodegenCx<'a, 'tcx>,
@ -29,7 +30,12 @@ pub fn item_namespace(cx: &CodegenCx<'ll, '_>, def_id: DefId) -> &'ll DIScope {
let namespace_name = match def_key.disambiguated_data.data {
DefPathData::CrateRoot => cx.tcx.crate_name(def_id.krate),
data => data.as_symbol(),
data => match data.get_name() {
DefPathDataName::Named(name) => name,
DefPathDataName::Anon { namespace } => {
Symbol::intern(&format!("{{{{{}}}}}", namespace))
}
},
};
let namespace_name = namespace_name.as_str();