Rollup merge of #114772 - fee1-dead-contrib:typed-did, r=b-naber

Add `{Local}ModDefId` to more strongly type DefIds`

Based on #110862 by `@Nilstrieb`
This commit is contained in:
Guillaume Gomez
2023-08-15 14:29:45 +02:00
committed by GitHub
27 changed files with 324 additions and 100 deletions

View File

@@ -355,8 +355,8 @@ impl TyCtxt<'_> {
#[inline]
#[track_caller]
pub fn local_parent(self, id: LocalDefId) -> LocalDefId {
self.parent(id.to_def_id()).expect_local()
pub fn local_parent(self, id: impl Into<LocalDefId>) -> LocalDefId {
self.parent(id.into().to_def_id()).expect_local()
}
pub fn is_descendant_of(self, mut descendant: DefId, ancestor: DefId) -> bool {