1
Fork 0

Rollup merge of #139662 - nnethercote:tweak-DefPathData, r=compiler-errors

Tweak `DefPathData`

Some improvements in and around `DefPathData`, following on from #137977.

r? `@spastorino`
This commit is contained in:
Jacob Pratt 2025-04-11 21:21:01 +02:00 committed by GitHub
commit 2b54f9bfb1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 48 additions and 44 deletions

View file

@ -620,7 +620,7 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write {
// the children of the visible parent (as was done when computing
// `visible_parent_map`), looking for the specific child we currently have and then
// have access to the re-exported name.
DefPathData::TypeNs(Some(ref mut name)) if Some(visible_parent) != actual_parent => {
DefPathData::TypeNs(ref mut name) if Some(visible_parent) != actual_parent => {
// Item might be re-exported several times, but filter for the one
// that's public and whose identifier isn't `_`.
let reexport = self
@ -641,7 +641,7 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write {
}
// Re-exported `extern crate` (#43189).
DefPathData::CrateRoot => {
data = DefPathData::TypeNs(Some(self.tcx().crate_name(def_id.krate)));
data = DefPathData::TypeNs(self.tcx().crate_name(def_id.krate));
}
_ => {}
}

View file

@ -26,7 +26,7 @@ fn true_significant_drop_ty<'tcx>(
name_rev.push(tcx.crate_name(did.krate));
}
rustc_hir::definitions::DefPathData::TypeNs(symbol) => {
name_rev.push(symbol.unwrap());
name_rev.push(symbol);
}
_ => return None,
}