]> git.proxmox.com Git - rustc.git/blobdiff - compiler/rustc_mir/src/interpret/intrinsics/type_name.rs
New upstream version 1.54.0+dfsg1
[rustc.git] / compiler / rustc_mir / src / interpret / intrinsics / type_name.rs
index ae5e78ee33f472ef04eec379c512cb5997154fea..a7012cd63f313059b270808ebea4cc8fe6d16c8d 100644 (file)
@@ -1,5 +1,5 @@
 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,
@@ -88,7 +88,7 @@ impl<'tcx> Printer<'tcx> for AbsolutePathPrinter<'tcx> {
     }
 
     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)
     }
 
@@ -127,11 +127,6 @@ impl<'tcx> Printer<'tcx> for AbsolutePathPrinter<'tcx> {
     ) -> 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)
@@ -197,6 +192,6 @@ impl Write for AbsolutePathPrinter<'_> {
 /// 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)
 }