Tweak delayed bug mentions.

Now that we have both `delayed_bug` and `span_delayed_bug`, it makes
sense to use the generic term "delayed bug" more.
This commit is contained in:
Nicholas Nethercote 2024-02-12 15:26:59 +11:00
parent e0a0cc2971
commit d4b77f64e4
15 changed files with 34 additions and 34 deletions

View file

@ -411,8 +411,8 @@ fn push_trailing(
/// or `.span_bug` rather than a failed assertion, etc.
pub struct ExplicitBug;
/// Signifies that the compiler died with an explicit call to `.delay_*_bug`
/// rather than a failed assertion, etc.
/// Signifies that the compiler died due to a delayed bug rather than a failed
/// assertion, etc.
pub struct DelayedBugPanic;
/// A `DiagCtxt` deals with errors and other compiler output.
@ -1446,7 +1446,7 @@ fn flush_delayed(&mut self, kind: DelayedBugKind) {
{
let _ = write!(
&mut out,
"delayed span bug: {}\n{}\n",
"delayed bug: {}\n{}\n",
bug.inner
.messages
.iter()

View file

@ -806,7 +806,7 @@ pub struct BuiltinAttribute {
rustc_attr!(TEST, rustc_regions, Normal, template!(Word), WarnFollowing),
rustc_attr!(
TEST, rustc_error, Normal,
template!(Word, List: "span_delayed_bug_from_inside_query"), WarnFollowingWordOnly
template!(Word, List: "delayed_bug_from_inside_query"), WarnFollowingWordOnly
),
rustc_attr!(TEST, rustc_dump_user_args, Normal, template!(Word), WarnFollowing),
rustc_attr!(TEST, rustc_evaluate_where_clauses, Normal, template!(Word), WarnFollowing),

View file

@ -118,9 +118,9 @@ pub(super) fn enter_wf_checking_ctxt<'tcx, F>(
return Err(err);
} else {
// HACK(oli-obk): tests/ui/specialization/min_specialization/specialize_on_type_error.rs
// causes an error (span_delayed_bug) during normalization, without reporting an error,
// so we need to act as if no error happened, in order to let our callers continue and
// report an error later in check_impl_items_against_trait.
// causes an delayed bug during normalization, without reporting an error, so we need
// to act as if no error happened, in order to let our callers continue and report an
// error later in check_impl_items_against_trait.
return Ok(());
}
}

View file

@ -191,7 +191,7 @@ fn canonicalize_free_region<'tcx>(
//
// rust-lang/rust#57464: `impl Trait` can leak local
// scopes (in manner violating typeck). Therefore, use
// `span_delayed_bug` to allow type error over an ICE.
// `delayed_bug` to allow type error over an ICE.
canonicalizer
.tcx
.dcx()

View file

@ -194,16 +194,16 @@ fn check_for_rustc_errors_attr(tcx: TyCtxt<'_>) {
let Some((def_id, _)) = tcx.entry_fn(()) else { return };
for attr in tcx.get_attrs(def_id, sym::rustc_error) {
match attr.meta_item_list() {
// Check if there is a `#[rustc_error(span_delayed_bug_from_inside_query)]`.
// Check if there is a `#[rustc_error(delayed_bug_from_inside_query)]`.
Some(list)
if list.iter().any(|list_item| {
matches!(
list_item.ident().map(|i| i.name),
Some(sym::span_delayed_bug_from_inside_query)
Some(sym::delayed_bug_from_inside_query)
)
}) =>
{
tcx.ensure().trigger_span_delayed_bug(def_id);
tcx.ensure().trigger_delayed_bug(def_id);
}
// Bare `#[rustc_error]`.

View file

@ -108,9 +108,9 @@
// 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 span_delayed_bug and incremental.
query trigger_span_delayed_bug(key: DefId) {
desc { "triggering a span delayed bug for testing incremental" }
/// This exists purely for testing the interactions between delayed bugs and incremental.
query trigger_delayed_bug(key: DefId) {
desc { "triggering a delayed bug for testing incremental" }
}
/// Collects the list of all tools registered using `#![register_tool]`.

View file

@ -82,8 +82,8 @@ pub fn new_error(tcx: TyCtxt<'tcx>, reported: ErrorGuaranteed) -> Region<'tcx> {
tcx.intern_region(ty::ReError(reported))
}
/// Constructs a `RegionKind::ReError` region and registers a `span_delayed_bug` to ensure it
/// gets used.
/// Constructs a `RegionKind::ReError` region and registers a delayed bug to ensure it gets
/// used.
#[track_caller]
pub fn new_error_misc(tcx: TyCtxt<'tcx>) -> Region<'tcx> {
Region::new_error_with_message(
@ -93,8 +93,8 @@ pub fn new_error_misc(tcx: TyCtxt<'tcx>) -> Region<'tcx> {
)
}
/// Constructs a `RegionKind::ReError` region and registers a `span_delayed_bug` with the given
/// `msg` to ensure it gets used.
/// Constructs a `RegionKind::ReError` region and registers a delayed bug with the given `msg`
/// to ensure it gets used.
#[track_caller]
pub fn new_error_with_message<S: Into<MultiSpan>>(
tcx: TyCtxt<'tcx>,

View file

@ -55,7 +55,7 @@ fn references_error(&self) -> bool {
}
fn error_reported(&self) -> Result<(), ErrorGuaranteed> {
if self.references_error() {
// We must include lint errors and span delayed bugs here.
// We must include lint errors and delayed bugs here.
if let Some(reported) =
ty::tls::with(|tcx| tcx.dcx().has_errors_or_lint_errors_or_delayed_bugs())
{

View file

@ -38,16 +38,16 @@ fn opt_span_bug_fmt<S: Into<MultiSpan>>(
})
}
/// 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_span_delayed_bug(tcx: TyCtxt<'_>, key: rustc_hir::def_id::DefId) {
/// A query to trigger a delayed bug. Clearly, if one has a `tcx` one can already trigger a
/// delayed bug, so what is the point of this? It exists to help us test the interaction of delayed
/// bugs with the query system and incremental.
pub fn trigger_delayed_bug(tcx: TyCtxt<'_>, key: rustc_hir::def_id::DefId) {
tcx.dcx().span_delayed_bug(
tcx.def_span(key),
"delayed span bug triggered by #[rustc_error(span_delayed_bug_from_inside_query)]",
"delayed bug triggered by #[rustc_error(delayed_bug_from_inside_query)]",
);
}
pub fn provide(providers: &mut crate::query::Providers) {
*providers = crate::query::Providers { trigger_span_delayed_bug, ..*providers };
*providers = crate::query::Providers { trigger_delayed_bug, ..*providers };
}

View file

@ -655,6 +655,7 @@
default_method_body_is_const,
default_type_parameter_fallback,
default_type_params,
delayed_bug_from_inside_query,
deny,
deprecated,
deprecated_safe,
@ -1579,7 +1580,6 @@
slice_patterns,
slicing_syntax,
soft,
span_delayed_bug_from_inside_query,
specialization,
speed,
spotlight,

View file

@ -77,7 +77,7 @@ fn integration_test() {
// the repo basically just contains a span_delayed_bug that forces rustc/clippy to panic:
/*
#![feature(rustc_attrs)]
#[rustc_error(span_delayed_bug_from_inside_query)]
#[rustc_error(delayed_bug_from_inside_query)]
fn main() {}
*/

View file

@ -650,7 +650,7 @@ macro_rules! experimental {
rustc_attr!(TEST, rustc_regions, Normal, template!(Word), WarnFollowing),
rustc_attr!(
TEST, rustc_error, Normal,
template!(Word, List: "span_delayed_bug_from_inside_query"), WarnFollowingWordOnly
template!(Word, List: "delayed_bug_from_inside_query"), WarnFollowingWordOnly
),
rustc_attr!(TEST, rustc_dump_user_args, Normal, template!(Word), WarnFollowing),
rustc_attr!(TEST, rustc_evaluate_where_clauses, Normal, template!(Word), WarnFollowing),

View file

@ -1,8 +1,8 @@
// revisions: cfail1 cfail2
// should-ice
// error-pattern: delayed span bug triggered by #[rustc_error(span_delayed_bug_from_inside_query)]
// error-pattern: delayed bug triggered by #[rustc_error(delayed_bug_from_inside_query)]
#![feature(rustc_attrs)]
#[rustc_error(span_delayed_bug_from_inside_query)]
#[rustc_error(delayed_bug_from_inside_query)]
fn main() {}

View file

@ -1,12 +1,12 @@
// compile-flags: -Ztreat-err-as-bug -Zeagerly-emit-delayed-bugs
// failure-status: 101
// error-pattern: aborting due to `-Z treat-err-as-bug=1`
// error-pattern: [trigger_span_delayed_bug] triggering a span delayed bug for testing incremental
// error-pattern: [trigger_delayed_bug] triggering a delayed bug for testing incremental
// normalize-stderr-test "note: .*\n\n" -> ""
// normalize-stderr-test "thread 'rustc' panicked.*:\n.*\n" -> ""
// rustc-env:RUST_BACKTRACE=0
#![feature(rustc_attrs)]
#[rustc_error(span_delayed_bug_from_inside_query)]
#[rustc_error(delayed_bug_from_inside_query)]
fn main() {}

View file

@ -1,4 +1,4 @@
error: internal compiler error: delayed span bug triggered by #[rustc_error(span_delayed_bug_from_inside_query)]
error: internal compiler error: delayed bug triggered by #[rustc_error(delayed_bug_from_inside_query)]
--> $DIR/span_delayed_bug.rs:12:1
|
LL | fn main() {}
@ -7,5 +7,5 @@ LL | fn main() {}
error: the compiler unexpectedly panicked. this is a bug.
query stack during panic:
#0 [trigger_span_delayed_bug] triggering a span delayed bug for testing incremental
#0 [trigger_delayed_bug] triggering a delayed bug for testing incremental
end of query stack