Rollup merge of #85963 - m-ou-se:constructor-type-name, r=yaahc
Show `::{{constructor}}` in std::any::type_name().
Fix #84666
Before:
```
[src/main.rs:6] type_name::<T>() = "playground::Velocity"
[src/main.rs:6] type_name::<T>() = "playground::Velocity"
```
After:
```
[src/main.rs:6] type_name::<T>() = "scratchpad::Velocity::{{constructor}}"
[src/main.rs:6] type_name::<T>() = "scratchpad::Velocity"
```
cc ``@scottmcm``
This commit is contained in:
@@ -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,
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user