diff options
| author | bors <bors@rust-lang.org> | 2024-10-20 16:34:35 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-10-20 16:34:35 +0000 |
| commit | de977a5acf210f7d71ff83f4b8bc42c274ce4ed9 (patch) | |
| tree | 0a0c48eb9dd8db5f171db1c74d9c09e6891d878c /compiler/rustc_ty_utils | |
| parent | bfab34af4c5bfbcc9168064857bbec826a60a0b9 (diff) | |
| parent | a860657c0404dfe3297498176b21933836bd3358 (diff) | |
Auto merge of #131970 - matthiaskrgr:rollup-nr32ksd, r=matthiaskrgr
Rollup of 9 pull requests Successful merges: - #121560 (Allow `#[deny]` inside `#[forbid]` as a no-op) - #131365 (Fix missing rustfmt in msi installer #101993) - #131647 (Register `src/tools/unicode-table-generator` as a runnable tool) - #131843 (compiler: Error on layout of enums with invalid reprs) - #131926 (Align boolean option descriptions in `configure.py`) - #131961 (compiletest: tidy up how `tidy` and `tidy` (html version) are disambiguated) - #131962 (Make `llvm::set_section` take a `&CStr`) - #131964 (add latest crash tests) - #131965 (remove outdated comment) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_ty_utils')
| -rw-r--r-- | compiler/rustc_ty_utils/src/layout.rs | 10 | ||||
| -rw-r--r-- | compiler/rustc_ty_utils/src/layout/invariant.rs (renamed from compiler/rustc_ty_utils/src/layout_sanity_check.rs) | 2 | ||||
| -rw-r--r-- | compiler/rustc_ty_utils/src/lib.rs | 1 |
3 files changed, 9 insertions, 4 deletions
diff --git a/compiler/rustc_ty_utils/src/layout.rs b/compiler/rustc_ty_utils/src/layout.rs index afdfa2e80c1..38b292afe8d 100644 --- a/compiler/rustc_ty_utils/src/layout.rs +++ b/compiler/rustc_ty_utils/src/layout.rs @@ -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 }; @@ -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) } @@ -115,6 +116,11 @@ fn map_error<'tcx>( cx.tcx().dcx().delayed_bug(format!("computed layout of empty union: {ty:?}")); LayoutError::Unknown(ty) } + LayoutCalculatorError::ReprConflict => { + // packed enums are the only known trigger of this, but others might arise + cx.tcx().dcx().delayed_bug(format!("computed impossible repr (packed enum?): {ty:?}")); + LayoutError::Unknown(ty) + } }; error(cx, err) } diff --git a/compiler/rustc_ty_utils/src/layout_sanity_check.rs b/compiler/rustc_ty_utils/src/layout/invariant.rs index be0a7c5ee89..6cf114b74c1 100644 --- a/compiler/rustc_ty_utils/src/layout_sanity_check.rs +++ b/compiler/rustc_ty_utils/src/layout/invariant.rs @@ -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. diff --git a/compiler/rustc_ty_utils/src/lib.rs b/compiler/rustc_ty_utils/src/lib.rs index dc5303317a8..8be1611bb9a 100644 --- a/compiler/rustc_ty_utils/src/lib.rs +++ b/compiler/rustc_ty_utils/src/lib.rs @@ -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; |
