From 7921ce3dd3a7c68674594547953592e767b7ed49 Mon Sep 17 00:00:00 2001 From: lcnr Date: Thu, 22 Feb 2024 10:18:56 +0100 Subject: [PATCH] `DefId` to `LocalDefId` --- compiler/rustc_hir_analysis/src/collect.rs | 2 +- compiler/rustc_middle/src/ty/mod.rs | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/compiler/rustc_hir_analysis/src/collect.rs b/compiler/rustc_hir_analysis/src/collect.rs index 6a42fdb1079f4..642009dfa48a8 100644 --- a/compiler/rustc_hir_analysis/src/collect.rs +++ b/compiler/rustc_hir_analysis/src/collect.rs @@ -1027,7 +1027,7 @@ fn adt_def(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::AdtDef<'_> { let repr = if is_anonymous { tcx.adt_def(tcx.local_parent(def_id)).repr() } else { - tcx.repr_options_of_def(def_id.to_def_id()) + tcx.repr_options_of_def(def_id) }; let (kind, variants) = match &item.kind { ItemKind::Enum(def, _) => { diff --git a/compiler/rustc_middle/src/ty/mod.rs b/compiler/rustc_middle/src/ty/mod.rs index eea3624898c8c..9d1be40af4967 100644 --- a/compiler/rustc_middle/src/ty/mod.rs +++ b/compiler/rustc_middle/src/ty/mod.rs @@ -1471,7 +1471,7 @@ impl<'tcx> TyCtxt<'tcx> { .filter(move |item| item.kind == AssocKind::Fn && item.defaultness(self).has_value()) } - pub fn repr_options_of_def(self, did: DefId) -> ReprOptions { + pub fn repr_options_of_def(self, did: LocalDefId) -> ReprOptions { let mut flags = ReprFlags::empty(); let mut size = None; let mut max_align: Option = None; @@ -1479,7 +1479,8 @@ impl<'tcx> TyCtxt<'tcx> { // Generate a deterministically-derived seed from the item's path hash // to allow for cross-crate compilation to actually work - let mut field_shuffle_seed = self.def_path_hash(did).0.to_smaller_hash().as_u64(); + let mut field_shuffle_seed = + self.def_path_hash(did.to_def_id()).0.to_smaller_hash().as_u64(); // If the user defined a custom seed for layout randomization, xor the item's // path hash with the user defined seed, this will allowing determinism while