Rename HandlerInner::delay_span_bug
as HandlerInner::span_delayed_bug
.
Because the corresponding `Level` is `DelayedBug` and `span_delayed_bug` follows the pattern used everywhere else: `span_err`, `span_warning`, etc.
This commit is contained in:
parent
57d6f840b9
commit
5d1d384443
131 changed files with 309 additions and 278 deletions
|
@ -4,9 +4,10 @@
|
|||
///
|
||||
/// If you have a span available, you should use [`span_bug`] instead.
|
||||
///
|
||||
/// If the bug should only be emitted when compilation didn't fail, [`Session::delay_span_bug`] may be useful.
|
||||
/// If the bug should only be emitted when compilation didn't fail, [`Session::span_delayed_bug`]
|
||||
/// may be useful.
|
||||
///
|
||||
/// [`Session::delay_span_bug`]: rustc_session::Session::delay_span_bug
|
||||
/// [`Session::span_delayed_bug`]: rustc_session::Session::span_delayed_bug
|
||||
/// [`span_bug`]: crate::span_bug
|
||||
#[macro_export]
|
||||
macro_rules! bug {
|
||||
|
@ -23,9 +24,10 @@ macro_rules! bug {
|
|||
/// at the code the compiler was compiling when it ICEd. This is the preferred way to trigger
|
||||
/// ICEs.
|
||||
///
|
||||
/// If the bug should only be emitted when compilation didn't fail, [`Session::delay_span_bug`] may be useful.
|
||||
/// If the bug should only be emitted when compilation didn't fail, [`Session::span_delayed_bug`]
|
||||
/// may be useful.
|
||||
///
|
||||
/// [`Session::delay_span_bug`]: rustc_session::Session::delay_span_bug
|
||||
/// [`Session::span_delayed_bug`]: rustc_session::Session::span_delayed_bug
|
||||
#[macro_export]
|
||||
macro_rules! span_bug {
|
||||
($span:expr, $msg:expr) => ({ $crate::util::bug::span_bug_fmt($span, ::std::format_args!($msg)) });
|
||||
|
|
|
@ -566,7 +566,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||
|span, def_id| {
|
||||
// The API could be uncallable for other reasons, for example when a private module
|
||||
// was referenced.
|
||||
self.sess.delay_span_bug(span, format!("encountered unmarked API: {def_id:?}"));
|
||||
self.sess.span_delayed_bug(span, format!("encountered unmarked API: {def_id:?}"));
|
||||
},
|
||||
)
|
||||
}
|
||||
|
|
|
@ -315,7 +315,7 @@ impl<Prov: Provenance, Bytes: AllocBytes> Allocation<Prov, (), Bytes> {
|
|||
pub fn try_uninit<'tcx>(size: Size, align: Align) -> InterpResult<'tcx, Self> {
|
||||
Self::uninit_inner(size, align, || {
|
||||
ty::tls::with(|tcx| {
|
||||
tcx.sess.delay_span_bug(DUMMY_SP, "exhausted memory during interpretation")
|
||||
tcx.sess.span_delayed_bug(DUMMY_SP, "exhausted memory during interpretation")
|
||||
});
|
||||
InterpError::ResourceExhaustion(ResourceExhaustionInfo::MemoryExhausted).into()
|
||||
})
|
||||
|
|
|
@ -199,7 +199,7 @@ pub struct LitToConstInput<'tcx> {
|
|||
#[derive(Copy, Clone, Debug, Eq, PartialEq, HashStable)]
|
||||
pub enum LitToConstError {
|
||||
/// The literal's inferred type did not match the expected `ty` in the input.
|
||||
/// This is used for graceful error handling (`delay_span_bug`) in
|
||||
/// This is used for graceful error handling (`span_delayed_bug`) in
|
||||
/// type checking (`Const::from_anon_const`).
|
||||
TypeError,
|
||||
Reported(ErrorGuaranteed),
|
||||
|
|
|
@ -108,9 +108,9 @@ pub use plumbing::{IntoQueryParam, TyCtxtAt, TyCtxtEnsure, TyCtxtEnsureWithValue
|
|||
// Queries marked with `fatal_cycle` do not need the latter implementation,
|
||||
// as they will raise an fatal error on query cycles instead.
|
||||
rustc_queries! {
|
||||
/// This exists purely for testing the interactions between delay_span_bug and incremental.
|
||||
query trigger_delay_span_bug(key: DefId) -> () {
|
||||
desc { "triggering a delay span bug for testing incremental" }
|
||||
/// This exists purely for testing the interactions between span_delayed_bug and incremental.
|
||||
query trigger_span_delayed_bug(key: DefId) -> () {
|
||||
desc { "triggering a span delayed bug for testing incremental" }
|
||||
}
|
||||
|
||||
/// Collects the list of all tools registered using `#![register_tool]`.
|
||||
|
|
|
@ -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.sess.delay_span_bug(DUMMY_SP, format!(
|
||||
tcx.sess.span_delayed_bug(DUMMY_SP, format!(
|
||||
"Trying to feed an already recorded value for query {} key={key:?}:\n\
|
||||
old value: {old:?}\nnew value: {value:?}",
|
||||
stringify!($name),
|
||||
|
|
|
@ -481,7 +481,7 @@ impl<'tcx> AdtDef<'tcx> {
|
|||
ErrorHandled::Reported(..) => "enum discriminant evaluation failed",
|
||||
ErrorHandled::TooGeneric(..) => "enum discriminant depends on generics",
|
||||
};
|
||||
tcx.sess.delay_span_bug(tcx.def_span(expr_did), msg);
|
||||
tcx.sess.span_delayed_bug(tcx.def_span(expr_did), msg);
|
||||
None
|
||||
}
|
||||
}
|
||||
|
|
|
@ -144,7 +144,7 @@ impl<'tcx> Const<'tcx> {
|
|||
span: S,
|
||||
msg: &'static str,
|
||||
) -> Const<'tcx> {
|
||||
let reported = tcx.sess.delay_span_bug(span, msg);
|
||||
let reported = tcx.sess.span_delayed_bug(span, msg);
|
||||
Const::new_error(tcx, reported, ty)
|
||||
}
|
||||
|
||||
|
@ -208,7 +208,7 @@ impl<'tcx> Const<'tcx> {
|
|||
match tcx.at(expr.span).lit_to_const(lit_input) {
|
||||
Ok(c) => return Some(c),
|
||||
Err(e) => {
|
||||
tcx.sess.delay_span_bug(
|
||||
tcx.sess.span_delayed_bug(
|
||||
expr.span,
|
||||
format!("Const::from_anon_const: couldn't lit_to_const {e:?}"),
|
||||
);
|
||||
|
|
|
@ -714,8 +714,10 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||
{
|
||||
Bound::Included(a)
|
||||
} else {
|
||||
self.sess
|
||||
.delay_span_bug(attr.span, "invalid rustc_layout_scalar_valid_range attribute");
|
||||
self.sess.span_delayed_bug(
|
||||
attr.span,
|
||||
"invalid rustc_layout_scalar_valid_range attribute",
|
||||
);
|
||||
Bound::Unbounded
|
||||
}
|
||||
};
|
||||
|
|
|
@ -283,7 +283,7 @@ impl<'tcx> LayoutCalculator for LayoutCx<'tcx, TyCtxt<'tcx>> {
|
|||
type TargetDataLayoutRef = &'tcx TargetDataLayout;
|
||||
|
||||
fn delay_bug(&self, txt: String) {
|
||||
self.tcx.sess.delay_span_bug(DUMMY_SP, txt);
|
||||
self.tcx.sess.span_delayed_bug(DUMMY_SP, txt);
|
||||
}
|
||||
|
||||
fn current_data_layout(&self) -> Self::TargetDataLayoutRef {
|
||||
|
|
|
@ -1545,7 +1545,7 @@ impl<'tcx> Region<'tcx> {
|
|||
tcx.intern_region(ty::ReError(reported))
|
||||
}
|
||||
|
||||
/// Constructs a `RegionKind::ReError` region and registers a `delay_span_bug` to ensure it
|
||||
/// Constructs a `RegionKind::ReError` region and registers a `span_delayed_bug` to ensure it
|
||||
/// gets used.
|
||||
#[track_caller]
|
||||
pub fn new_error_misc(tcx: TyCtxt<'tcx>) -> Region<'tcx> {
|
||||
|
@ -1556,7 +1556,7 @@ impl<'tcx> Region<'tcx> {
|
|||
)
|
||||
}
|
||||
|
||||
/// Constructs a `RegionKind::ReError` region and registers a `delay_span_bug` with the given
|
||||
/// Constructs a `RegionKind::ReError` region and registers a `span_delayed_bug` with the given
|
||||
/// `msg` to ensure it gets used.
|
||||
#[track_caller]
|
||||
pub fn new_error_with_message<S: Into<MultiSpan>>(
|
||||
|
@ -1564,7 +1564,7 @@ impl<'tcx> Region<'tcx> {
|
|||
span: S,
|
||||
msg: &'static str,
|
||||
) -> Region<'tcx> {
|
||||
let reported = tcx.sess.delay_span_bug(span, msg);
|
||||
let reported = tcx.sess.span_delayed_bug(span, msg);
|
||||
Region::new_error(tcx, reported)
|
||||
}
|
||||
|
||||
|
@ -1997,13 +1997,13 @@ impl<'tcx> Ty<'tcx> {
|
|||
Ty::new(tcx, Error(reported))
|
||||
}
|
||||
|
||||
/// Constructs a `TyKind::Error` type and registers a `delay_span_bug` to ensure it gets used.
|
||||
/// Constructs a `TyKind::Error` type and registers a `span_delayed_bug` to ensure it gets used.
|
||||
#[track_caller]
|
||||
pub fn new_misc_error(tcx: TyCtxt<'tcx>) -> Ty<'tcx> {
|
||||
Ty::new_error_with_message(tcx, DUMMY_SP, "TyKind::Error constructed but no error reported")
|
||||
}
|
||||
|
||||
/// Constructs a `TyKind::Error` type and registers a `delay_span_bug` with the given `msg` to
|
||||
/// Constructs a `TyKind::Error` type and registers a `span_delayed_bug` with the given `msg` to
|
||||
/// ensure it gets used.
|
||||
#[track_caller]
|
||||
pub fn new_error_with_message<S: Into<MultiSpan>>(
|
||||
|
@ -2011,7 +2011,7 @@ impl<'tcx> Ty<'tcx> {
|
|||
span: S,
|
||||
msg: impl Into<String>,
|
||||
) -> Ty<'tcx> {
|
||||
let reported = tcx.sess.delay_span_bug(span, msg);
|
||||
let reported = tcx.sess.span_delayed_bug(span, msg);
|
||||
Ty::new(tcx, Error(reported))
|
||||
}
|
||||
|
||||
|
|
|
@ -391,7 +391,7 @@ impl<'tcx> TypeckResults<'tcx> {
|
|||
|
||||
pub fn extract_binding_mode(&self, s: &Session, id: HirId, sp: Span) -> Option<BindingMode> {
|
||||
self.pat_binding_modes().get(id).copied().or_else(|| {
|
||||
s.delay_span_bug(sp, "missing binding mode");
|
||||
s.span_delayed_bug(sp, "missing binding mode");
|
||||
None
|
||||
})
|
||||
}
|
||||
|
|
|
@ -361,7 +361,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||
|
||||
let Some(item_id) = self.associated_item_def_ids(impl_did).first() else {
|
||||
self.sess
|
||||
.delay_span_bug(self.def_span(impl_did), "Drop impl without drop function");
|
||||
.span_delayed_bug(self.def_span(impl_did), "Drop impl without drop function");
|
||||
return;
|
||||
};
|
||||
|
||||
|
|
|
@ -38,16 +38,16 @@ fn opt_span_bug_fmt<S: Into<MultiSpan>>(
|
|||
})
|
||||
}
|
||||
|
||||
/// A query to trigger a `delay_span_bug`. Clearly, if one has a `tcx` one can already trigger a
|
||||
/// `delay_span_bug`, so what is the point of this? It exists to help us test `delay_span_bug`'s
|
||||
/// A query to trigger a `span_delayed_bug`. Clearly, if one has a `tcx` one can already trigger a
|
||||
/// `span_delayed_bug`, so what is the point of this? It exists to help us test `span_delayed_bug`'s
|
||||
/// interactions with the query system and incremental.
|
||||
pub fn trigger_delay_span_bug(tcx: TyCtxt<'_>, key: rustc_hir::def_id::DefId) {
|
||||
tcx.sess.delay_span_bug(
|
||||
pub fn trigger_span_delayed_bug(tcx: TyCtxt<'_>, key: rustc_hir::def_id::DefId) {
|
||||
tcx.sess.span_delayed_bug(
|
||||
tcx.def_span(key),
|
||||
"delayed span bug triggered by #[rustc_error(delay_span_bug_from_inside_query)]",
|
||||
"delayed span bug triggered by #[rustc_error(span_delayed_bug_from_inside_query)]",
|
||||
);
|
||||
}
|
||||
|
||||
pub fn provide(providers: &mut crate::query::Providers) {
|
||||
*providers = crate::query::Providers { trigger_delay_span_bug, ..*providers };
|
||||
*providers = crate::query::Providers { trigger_span_delayed_bug, ..*providers };
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue