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:
parent
e0a0cc2971
commit
d4b77f64e4
15 changed files with 34 additions and 34 deletions
|
@ -411,8 +411,8 @@ impl CodeSuggestion {
|
||||||
/// or `.span_bug` rather than a failed assertion, etc.
|
/// or `.span_bug` rather than a failed assertion, etc.
|
||||||
pub struct ExplicitBug;
|
pub struct ExplicitBug;
|
||||||
|
|
||||||
/// Signifies that the compiler died with an explicit call to `.delay_*_bug`
|
/// Signifies that the compiler died due to a delayed bug rather than a failed
|
||||||
/// rather than a failed assertion, etc.
|
/// assertion, etc.
|
||||||
pub struct DelayedBugPanic;
|
pub struct DelayedBugPanic;
|
||||||
|
|
||||||
/// A `DiagCtxt` deals with errors and other compiler output.
|
/// A `DiagCtxt` deals with errors and other compiler output.
|
||||||
|
@ -1446,7 +1446,7 @@ impl DiagCtxtInner {
|
||||||
{
|
{
|
||||||
let _ = write!(
|
let _ = write!(
|
||||||
&mut out,
|
&mut out,
|
||||||
"delayed span bug: {}\n{}\n",
|
"delayed bug: {}\n{}\n",
|
||||||
bug.inner
|
bug.inner
|
||||||
.messages
|
.messages
|
||||||
.iter()
|
.iter()
|
||||||
|
|
|
@ -806,7 +806,7 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
|
||||||
rustc_attr!(TEST, rustc_regions, Normal, template!(Word), WarnFollowing),
|
rustc_attr!(TEST, rustc_regions, Normal, template!(Word), WarnFollowing),
|
||||||
rustc_attr!(
|
rustc_attr!(
|
||||||
TEST, rustc_error, Normal,
|
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_dump_user_args, Normal, template!(Word), WarnFollowing),
|
||||||
rustc_attr!(TEST, rustc_evaluate_where_clauses, Normal, template!(Word), WarnFollowing),
|
rustc_attr!(TEST, rustc_evaluate_where_clauses, Normal, template!(Word), WarnFollowing),
|
||||||
|
|
|
@ -118,9 +118,9 @@ where
|
||||||
return Err(err);
|
return Err(err);
|
||||||
} else {
|
} else {
|
||||||
// HACK(oli-obk): tests/ui/specialization/min_specialization/specialize_on_type_error.rs
|
// 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,
|
// causes an delayed bug during normalization, without reporting an error, so we need
|
||||||
// so we need to act as if no error happened, in order to let our callers continue and
|
// to act as if no error happened, in order to let our callers continue and report an
|
||||||
// report an error later in check_impl_items_against_trait.
|
// error later in check_impl_items_against_trait.
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -191,7 +191,7 @@ impl CanonicalizeMode for CanonicalizeQueryResponse {
|
||||||
//
|
//
|
||||||
// rust-lang/rust#57464: `impl Trait` can leak local
|
// rust-lang/rust#57464: `impl Trait` can leak local
|
||||||
// scopes (in manner violating typeck). Therefore, use
|
// 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
|
canonicalizer
|
||||||
.tcx
|
.tcx
|
||||||
.dcx()
|
.dcx()
|
||||||
|
|
|
@ -194,16 +194,16 @@ impl<'tcx> Queries<'tcx> {
|
||||||
let Some((def_id, _)) = tcx.entry_fn(()) else { return };
|
let Some((def_id, _)) = tcx.entry_fn(()) else { return };
|
||||||
for attr in tcx.get_attrs(def_id, sym::rustc_error) {
|
for attr in tcx.get_attrs(def_id, sym::rustc_error) {
|
||||||
match attr.meta_item_list() {
|
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)
|
Some(list)
|
||||||
if list.iter().any(|list_item| {
|
if list.iter().any(|list_item| {
|
||||||
matches!(
|
matches!(
|
||||||
list_item.ident().map(|i| i.name),
|
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]`.
|
// Bare `#[rustc_error]`.
|
||||||
|
|
|
@ -108,9 +108,9 @@ pub use plumbing::{IntoQueryParam, TyCtxtAt, TyCtxtEnsure, TyCtxtEnsureWithValue
|
||||||
// Queries marked with `fatal_cycle` do not need the latter implementation,
|
// Queries marked with `fatal_cycle` do not need the latter implementation,
|
||||||
// as they will raise an fatal error on query cycles instead.
|
// as they will raise an fatal error on query cycles instead.
|
||||||
rustc_queries! {
|
rustc_queries! {
|
||||||
/// This exists purely for testing the interactions between span_delayed_bug and incremental.
|
/// This exists purely for testing the interactions between delayed bugs and incremental.
|
||||||
query trigger_span_delayed_bug(key: DefId) {
|
query trigger_delayed_bug(key: DefId) {
|
||||||
desc { "triggering a span delayed bug for testing incremental" }
|
desc { "triggering a delayed bug for testing incremental" }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Collects the list of all tools registered using `#![register_tool]`.
|
/// Collects the list of all tools registered using `#![register_tool]`.
|
||||||
|
|
|
@ -82,8 +82,8 @@ impl<'tcx> Region<'tcx> {
|
||||||
tcx.intern_region(ty::ReError(reported))
|
tcx.intern_region(ty::ReError(reported))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Constructs a `RegionKind::ReError` region and registers a `span_delayed_bug` to ensure it
|
/// Constructs a `RegionKind::ReError` region and registers a delayed bug to ensure it gets
|
||||||
/// gets used.
|
/// used.
|
||||||
#[track_caller]
|
#[track_caller]
|
||||||
pub fn new_error_misc(tcx: TyCtxt<'tcx>) -> Region<'tcx> {
|
pub fn new_error_misc(tcx: TyCtxt<'tcx>) -> Region<'tcx> {
|
||||||
Region::new_error_with_message(
|
Region::new_error_with_message(
|
||||||
|
@ -93,8 +93,8 @@ impl<'tcx> Region<'tcx> {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Constructs a `RegionKind::ReError` region and registers a `span_delayed_bug` with the given
|
/// Constructs a `RegionKind::ReError` region and registers a delayed bug with the given `msg`
|
||||||
/// `msg` to ensure it gets used.
|
/// to ensure it gets used.
|
||||||
#[track_caller]
|
#[track_caller]
|
||||||
pub fn new_error_with_message<S: Into<MultiSpan>>(
|
pub fn new_error_with_message<S: Into<MultiSpan>>(
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
|
|
|
@ -55,7 +55,7 @@ pub trait TypeVisitableExt<'tcx>: TypeVisitable<TyCtxt<'tcx>> {
|
||||||
}
|
}
|
||||||
fn error_reported(&self) -> Result<(), ErrorGuaranteed> {
|
fn error_reported(&self) -> Result<(), ErrorGuaranteed> {
|
||||||
if self.references_error() {
|
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) =
|
if let Some(reported) =
|
||||||
ty::tls::with(|tcx| tcx.dcx().has_errors_or_lint_errors_or_delayed_bugs())
|
ty::tls::with(|tcx| tcx.dcx().has_errors_or_lint_errors_or_delayed_bugs())
|
||||||
{
|
{
|
||||||
|
|
|
@ -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
|
/// A query to trigger a 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
|
/// delayed bug, so what is the point of this? It exists to help us test the interaction of delayed
|
||||||
/// interactions with the query system and incremental.
|
/// bugs with the query system and incremental.
|
||||||
pub fn trigger_span_delayed_bug(tcx: TyCtxt<'_>, key: rustc_hir::def_id::DefId) {
|
pub fn trigger_delayed_bug(tcx: TyCtxt<'_>, key: rustc_hir::def_id::DefId) {
|
||||||
tcx.dcx().span_delayed_bug(
|
tcx.dcx().span_delayed_bug(
|
||||||
tcx.def_span(key),
|
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) {
|
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 };
|
||||||
}
|
}
|
||||||
|
|
|
@ -655,6 +655,7 @@ symbols! {
|
||||||
default_method_body_is_const,
|
default_method_body_is_const,
|
||||||
default_type_parameter_fallback,
|
default_type_parameter_fallback,
|
||||||
default_type_params,
|
default_type_params,
|
||||||
|
delayed_bug_from_inside_query,
|
||||||
deny,
|
deny,
|
||||||
deprecated,
|
deprecated,
|
||||||
deprecated_safe,
|
deprecated_safe,
|
||||||
|
@ -1579,7 +1580,6 @@ symbols! {
|
||||||
slice_patterns,
|
slice_patterns,
|
||||||
slicing_syntax,
|
slicing_syntax,
|
||||||
soft,
|
soft,
|
||||||
span_delayed_bug_from_inside_query,
|
|
||||||
specialization,
|
specialization,
|
||||||
speed,
|
speed,
|
||||||
spotlight,
|
spotlight,
|
||||||
|
|
|
@ -77,7 +77,7 @@ fn integration_test() {
|
||||||
// the repo basically just contains a span_delayed_bug that forces rustc/clippy to panic:
|
// the repo basically just contains a span_delayed_bug that forces rustc/clippy to panic:
|
||||||
/*
|
/*
|
||||||
#![feature(rustc_attrs)]
|
#![feature(rustc_attrs)]
|
||||||
#[rustc_error(span_delayed_bug_from_inside_query)]
|
#[rustc_error(delayed_bug_from_inside_query)]
|
||||||
fn main() {}
|
fn main() {}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
@ -650,7 +650,7 @@ pub const INERT_ATTRIBUTES: &[BuiltinAttribute] = &[
|
||||||
rustc_attr!(TEST, rustc_regions, Normal, template!(Word), WarnFollowing),
|
rustc_attr!(TEST, rustc_regions, Normal, template!(Word), WarnFollowing),
|
||||||
rustc_attr!(
|
rustc_attr!(
|
||||||
TEST, rustc_error, Normal,
|
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_dump_user_args, Normal, template!(Word), WarnFollowing),
|
||||||
rustc_attr!(TEST, rustc_evaluate_where_clauses, Normal, template!(Word), WarnFollowing),
|
rustc_attr!(TEST, rustc_evaluate_where_clauses, Normal, template!(Word), WarnFollowing),
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
// revisions: cfail1 cfail2
|
// revisions: cfail1 cfail2
|
||||||
// should-ice
|
// 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)]
|
#![feature(rustc_attrs)]
|
||||||
|
|
||||||
#[rustc_error(span_delayed_bug_from_inside_query)]
|
#[rustc_error(delayed_bug_from_inside_query)]
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
// compile-flags: -Ztreat-err-as-bug -Zeagerly-emit-delayed-bugs
|
// compile-flags: -Ztreat-err-as-bug -Zeagerly-emit-delayed-bugs
|
||||||
// failure-status: 101
|
// failure-status: 101
|
||||||
// error-pattern: aborting due to `-Z treat-err-as-bug=1`
|
// 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 "note: .*\n\n" -> ""
|
||||||
// normalize-stderr-test "thread 'rustc' panicked.*:\n.*\n" -> ""
|
// normalize-stderr-test "thread 'rustc' panicked.*:\n.*\n" -> ""
|
||||||
// rustc-env:RUST_BACKTRACE=0
|
// rustc-env:RUST_BACKTRACE=0
|
||||||
|
|
||||||
#![feature(rustc_attrs)]
|
#![feature(rustc_attrs)]
|
||||||
|
|
||||||
#[rustc_error(span_delayed_bug_from_inside_query)]
|
#[rustc_error(delayed_bug_from_inside_query)]
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
|
|
@ -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
|
--> $DIR/span_delayed_bug.rs:12:1
|
||||||
|
|
|
|
||||||
LL | fn main() {}
|
LL | fn main() {}
|
||||||
|
@ -7,5 +7,5 @@ LL | fn main() {}
|
||||||
error: the compiler unexpectedly panicked. this is a bug.
|
error: the compiler unexpectedly panicked. this is a bug.
|
||||||
|
|
||||||
query stack during panic:
|
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
|
end of query stack
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue