diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-01-04 12:54:23 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-01-10 07:33:07 +1100 |
| commit | 2ea7a37e1113febac8603729e33fdd94f2738807 (patch) | |
| tree | 06b41ca2baec6e8b67695ae1fbb716e115b4653b /compiler/rustc_ty_utils/src | |
| parent | 3c4f1d85af07f394da922f0bd9ff7c0a91e81f45 (diff) | |
| download | rust-2ea7a37e1113febac8603729e33fdd94f2738807.tar.gz rust-2ea7a37e1113febac8603729e33fdd94f2738807.zip | |
Add `DiagCtxt::delayed_bug`.
We have `span_delayed_bug` and often pass it a `DUMMY_SP`. This commit adds `delayed_bug`, which matches pairs like `err`/`span_err` and `warn`/`span_warn`.
Diffstat (limited to 'compiler/rustc_ty_utils/src')
| -rw-r--r-- | compiler/rustc_ty_utils/src/layout.rs | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/compiler/rustc_ty_utils/src/layout.rs b/compiler/rustc_ty_utils/src/layout.rs index db89fba2a89..b8351463c55 100644 --- a/compiler/rustc_ty_utils/src/layout.rs +++ b/compiler/rustc_ty_utils/src/layout.rs @@ -11,7 +11,6 @@ use rustc_middle::ty::print::with_no_trimmed_paths; use rustc_middle::ty::{self, AdtDef, EarlyBinder, GenericArgsRef, Ty, TyCtxt, TypeVisitableExt}; use rustc_session::{DataTypeKind, FieldInfo, FieldKind, SizeKind, VariantInfo}; use rustc_span::symbol::Symbol; -use rustc_span::DUMMY_SP; use rustc_target::abi::*; use std::fmt::Debug; @@ -91,7 +90,7 @@ fn univariant_uninterned<'tcx>( let dl = cx.data_layout(); let pack = repr.pack; if pack.is_some() && repr.align.is_some() { - cx.tcx.dcx().span_delayed_bug(DUMMY_SP, "struct cannot be packed and aligned"); + cx.tcx.dcx().delayed_bug("struct cannot be packed and aligned"); return Err(cx.tcx.arena.alloc(LayoutError::Unknown(ty))); } @@ -344,10 +343,7 @@ fn layout_of_uncached<'tcx>( ty::Adt(def, args) if def.repr().simd() => { if !def.is_struct() { // Should have yielded E0517 by now. - tcx.dcx().span_delayed_bug( - DUMMY_SP, - "#[repr(simd)] was applied to an ADT that is not a struct", - ); + tcx.dcx().delayed_bug("#[repr(simd)] was applied to an ADT that is not a struct"); return Err(error(cx, LayoutError::Unknown(ty))); } @@ -374,8 +370,7 @@ fn layout_of_uncached<'tcx>( // (should be caught by typeck) for fi in fields { if fi.ty(tcx, args) != f0_ty { - tcx.dcx().span_delayed_bug( - DUMMY_SP, + tcx.dcx().delayed_bug( "#[repr(simd)] was applied to an ADT with heterogeneous field type", ); return Err(error(cx, LayoutError::Unknown(ty))); |
