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_middle/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_middle/src')
| -rw-r--r-- | compiler/rustc_middle/src/mir/interpret/allocation.rs | 5 | ||||
| -rw-r--r-- | compiler/rustc_middle/src/query/plumbing.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_middle/src/ty/layout.rs | 2 |
3 files changed, 3 insertions, 6 deletions
diff --git a/compiler/rustc_middle/src/mir/interpret/allocation.rs b/compiler/rustc_middle/src/mir/interpret/allocation.rs index a92b85a716f..4047891d769 100644 --- a/compiler/rustc_middle/src/mir/interpret/allocation.rs +++ b/compiler/rustc_middle/src/mir/interpret/allocation.rs @@ -14,7 +14,6 @@ use either::{Left, Right}; use rustc_ast::Mutability; use rustc_data_structures::intern::Interned; -use rustc_span::DUMMY_SP; use rustc_target::abi::{Align, HasDataLayout, Size}; use super::{ @@ -314,9 +313,7 @@ impl<Prov: Provenance, Bytes: AllocBytes> Allocation<Prov, (), Bytes> { /// available to the compiler to do so. pub fn try_uninit<'tcx>(size: Size, align: Align) -> InterpResult<'tcx, Self> { Self::uninit_inner(size, align, || { - ty::tls::with(|tcx| { - tcx.dcx().span_delayed_bug(DUMMY_SP, "exhausted memory during interpretation") - }); + ty::tls::with(|tcx| tcx.dcx().delayed_bug("exhausted memory during interpretation")); InterpError::ResourceExhaustion(ResourceExhaustionInfo::MemoryExhausted).into() }) } diff --git a/compiler/rustc_middle/src/query/plumbing.rs b/compiler/rustc_middle/src/query/plumbing.rs index 414d4c8d949..a41d4f1ad58 100644 --- a/compiler/rustc_middle/src/query/plumbing.rs +++ b/compiler/rustc_middle/src/query/plumbing.rs @@ -551,7 +551,7 @@ macro_rules! define_feedable { // We have an inconsistency. This can happen if one of the two // results is tainted by errors. In this case, delay a bug to // ensure compilation is doomed, and keep the `old` value. - tcx.dcx().span_delayed_bug(DUMMY_SP, format!( + tcx.dcx().delayed_bug(format!( "Trying to feed an already recorded value for query {} key={key:?}:\n\ old value: {old:?}\nnew value: {value:?}", stringify!($name), diff --git a/compiler/rustc_middle/src/ty/layout.rs b/compiler/rustc_middle/src/ty/layout.rs index 5cc0ce87c9b..25473f52c03 100644 --- a/compiler/rustc_middle/src/ty/layout.rs +++ b/compiler/rustc_middle/src/ty/layout.rs @@ -284,7 +284,7 @@ impl<'tcx> LayoutCalculator for LayoutCx<'tcx, TyCtxt<'tcx>> { type TargetDataLayoutRef = &'tcx TargetDataLayout; fn delayed_bug(&self, txt: String) { - self.tcx.dcx().span_delayed_bug(DUMMY_SP, txt); + self.tcx.dcx().delayed_bug(txt); } fn current_data_layout(&self) -> Self::TargetDataLayoutRef { |
