Skip to content

Commit 68d1fd9

Browse files
compiler: pre-move code for fixing enum layout ICEs
1 parent d68c327 commit 68d1fd9

File tree

5 files changed

+4
-4
lines changed

5 files changed

+4
-4
lines changed

compiler/rustc_ty_utils/src/layout.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ use {rustc_abi as abi, rustc_hir as hir};
3030
use crate::errors::{
3131
MultipleArrayFieldsSimdType, NonPrimitiveSimdType, OversizedSimdType, ZeroLengthSimdType,
3232
};
33-
use crate::layout_sanity_check::sanity_check_layout;
33+
34+
mod invariant;
3435

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

82-
sanity_check_layout(&cx, &layout);
83+
invariant::partially_check_layout(&cx, &layout);
8384

8485
Ok(layout)
8586
}

compiler/rustc_ty_utils/src/layout_sanity_check.rs renamed to compiler/rustc_ty_utils/src/layout/invariant.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use rustc_middle::ty::layout::{HasTyCtxt, LayoutCx, TyAndLayout};
55
use rustc_target::abi::*;
66

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

1111
// Type-level uninhabitedness should always imply ABI uninhabitedness.

compiler/rustc_ty_utils/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ mod errors;
2929
mod implied_bounds;
3030
mod instance;
3131
mod layout;
32-
mod layout_sanity_check;
3332
mod needs_drop;
3433
mod opaque_types;
3534
mod representability;

0 commit comments

Comments
 (0)