Skip to content

Commit

Permalink
Unrolled build for rust-lang#121441
Browse files Browse the repository at this point in the history
Rollup merge of rust-lang#121441 - lcnr:typesystem-cleanup, r=compiler-errors

`DefId`  to `LocalDefId`
  • Loading branch information
rust-timer authored Feb 22, 2024
2 parents f62f490 + 7921ce3 commit cfe20f8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_hir_analysis/src/collect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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, _) => {
Expand Down
5 changes: 3 additions & 2 deletions compiler/rustc_middle/src/ty/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1471,15 +1471,16 @@ 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<Align> = None;
let mut min_pack: Option<Align> = None;

// 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
Expand Down

0 comments on commit cfe20f8

Please sign in to comment.