use rustc_hir::def_id::CrateNum;
-use rustc_hir::definitions::{DefPathData, DisambiguatedDefPathData};
+use rustc_hir::definitions::DisambiguatedDefPathData;
use rustc_middle::mir::interpret::Allocation;
use rustc_middle::ty::{
self,
}
fn path_crate(mut self, cnum: CrateNum) -> Result<Self::Path, Self::Error> {
- self.path.push_str(&self.tcx.original_crate_name(cnum).as_str());
+ self.path.push_str(&self.tcx.crate_name(cnum).as_str());
Ok(self)
}
) -> Result<Self::Path, Self::Error> {
self = print_prefix(self)?;
- // Skip `::{{constructor}}` on tuple/unit structs.
- if disambiguated_data.data == DefPathData::Ctor {
- return Ok(self);
- }
-
write!(self.path, "::{}", disambiguated_data.data).unwrap();
Ok(self)
/// Directly returns an `Allocation` containing an absolute path representation of the given type.
crate fn alloc_type_name<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> &'tcx Allocation {
let path = AbsolutePathPrinter { tcx, path: String::new() }.print_type(ty).unwrap().path;
- let alloc = Allocation::from_byte_aligned_bytes(path.into_bytes());
+ let alloc = Allocation::from_bytes_byte_aligned_immutable(path.into_bytes());
tcx.intern_const_alloc(alloc)
}