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
@ -411,8 +411,8 @@ impl CodeSuggestion {
|
||||
/// 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 @@ impl DiagCtxtInner {
|
||||
{
|
||||
let _ = write!(
|
||||
&mut out,
|
||||
"delayed span bug: {}\n{}\n",
|
||||
"delayed bug: {}\n{}\n",
|
||||
bug.inner
|
||||
.messages
|
||||
.iter()
|
||||
|
@ -806,7 +806,7 @@ pub const BUILTIN_ATTRIBUTES: &[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),
|
||||
|
@ -118,9 +118,9 @@ where
|
||||
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(());
|
||||
}
|
||||
}
|
||||
|
@ -191,7 +191,7 @@ impl CanonicalizeMode for CanonicalizeQueryResponse {
|
||||
//
|
||||
// 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()
|
||||
|
@ -194,16 +194,16 @@ impl<'tcx> Queries<'tcx> {
|
||||
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]`.
|
||||
|
@ -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 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]`.
|
||||
|
@ -82,8 +82,8 @@ impl<'tcx> 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 @@ impl<'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>,
|
||||
|
@ -55,7 +55,7 @@ pub trait TypeVisitableExt<'tcx>: TypeVisitable<TyCtxt<'tcx>> {
|
||||
}
|
||||
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())
|
||||
{
|
||||
|
@ -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 };
|
||||
}
|
||||
|
@ -655,6 +655,7 @@ symbols! {
|
||||
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 @@ symbols! {
|
||||
slice_patterns,
|
||||
slicing_syntax,
|
||||
soft,
|
||||
span_delayed_bug_from_inside_query,
|
||||
specialization,
|
||||
speed,
|
||||
spotlight,
|
||||
|
@ -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() {}
|
||||
*/
|
||||
|
||||
|
@ -650,7 +650,7 @@ pub const INERT_ATTRIBUTES: &[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),
|
||||
|
@ -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() {}
|
||||
|
@ -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() {}
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user