Skip to content

Commit

Permalink
compiler: pre-move code for fixing enum layout ICEs
Browse files Browse the repository at this point in the history
  • Loading branch information
workingjubilee committed Oct 20, 2024
1 parent d68c327 commit 68d1fd9
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 4 deletions.
5 changes: 3 additions & 2 deletions compiler/rustc_ty_utils/src/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ use {rustc_abi as abi, rustc_hir as hir};
use crate::errors::{
MultipleArrayFieldsSimdType, NonPrimitiveSimdType, OversizedSimdType, ZeroLengthSimdType,
};
use crate::layout_sanity_check::sanity_check_layout;

mod invariant;

pub(crate) fn provide(providers: &mut Providers) {
*providers = Providers { layout_of, ..*providers };
Expand Down Expand Up @@ -79,7 +80,7 @@ fn layout_of<'tcx>(
record_layout_for_printing(&cx, layout);
}

sanity_check_layout(&cx, &layout);
invariant::partially_check_layout(&cx, &layout);

Ok(layout)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use rustc_middle::ty::layout::{HasTyCtxt, LayoutCx, TyAndLayout};
use rustc_target::abi::*;

/// Enforce some basic invariants on layouts.
pub(super) fn sanity_check_layout<'tcx>(cx: &LayoutCx<'tcx>, layout: &TyAndLayout<'tcx>) {
pub(super) fn partially_check_layout<'tcx>(cx: &LayoutCx<'tcx>, layout: &TyAndLayout<'tcx>) {
let tcx = cx.tcx();

// Type-level uninhabitedness should always imply ABI uninhabitedness.
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_ty_utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ mod errors;
mod implied_bounds;
mod instance;
mod layout;
mod layout_sanity_check;
mod needs_drop;
mod opaque_types;
mod representability;
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 68d1fd9

Please sign in to comment.