Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion compiler/rustc_middle/src/ty/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,9 @@ impl TyCtxt<'_> {
}

pub fn is_descendant_of(self, mut descendant: DefId, ancestor: DefId) -> bool {
if descendant.krate != ancestor.krate {
// Def-ids from different crates are always unordered, and def-ids of parent nodes
// are always created before def-ids of child nodes.
if descendant.krate != ancestor.krate || descendant.index < ancestor.index {
return false;
}

Expand Down
Loading