1use rustc_errors::codes::*;
2use rustc_hir::limit::Limit;
3use rustc_macros::{Diagnostic, Subdiagnostic};
4use rustc_span::{Span, Symbol};
5
6#[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for CycleStack {
fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
where __G: rustc_errors::EmissionGuarantee {
match self {
CycleStack { span: __binding_0, desc: __binding_1 } => {
diag.store_args();
diag.arg("desc", __binding_1);
let __message =
diag.eagerly_translate(crate::fluent_generated::query_system_cycle_stack_middle);
diag.span_note(__binding_0, __message);
diag.restore_args();
}
}
}
}
};Subdiagnostic)]
7#[note(query_system_cycle_stack_middle)]
8pub(crate) struct CycleStack {
9 #[primary_span]
10 pub span: Span,
11 pub desc: String,
12}
13
14#[derive(#[automatically_derived]
impl ::core::marker::Copy for HandleCycleError { }Copy, #[automatically_derived]
impl ::core::clone::Clone for HandleCycleError {
#[inline]
fn clone(&self) -> HandleCycleError { *self }
}Clone)]
15pub enum HandleCycleError {
16 Error,
17 Fatal,
18 DelayBug,
19 Stash,
20}
21
22#[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for StackCount {
fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
where __G: rustc_errors::EmissionGuarantee {
match self {
StackCount::Single => {
diag.store_args();
let __message =
diag.eagerly_translate(crate::fluent_generated::query_system_cycle_stack_single);
diag.note(__message);
diag.restore_args();
}
StackCount::Multiple => {
diag.store_args();
let __message =
diag.eagerly_translate(crate::fluent_generated::query_system_cycle_stack_multiple);
diag.note(__message);
diag.restore_args();
}
}
}
}
};Subdiagnostic)]
23pub(crate) enum StackCount {
24 #[note(query_system_cycle_stack_single)]
25 Single,
26 #[note(query_system_cycle_stack_multiple)]
27 Multiple,
28}
29
30#[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for Alias {
fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
where __G: rustc_errors::EmissionGuarantee {
match self {
Alias::Ty => {
diag.store_args();
let __message =
diag.eagerly_translate(crate::fluent_generated::query_system_cycle_recursive_ty_alias);
diag.note(__message);
let __message =
diag.eagerly_translate(crate::fluent_generated::query_system_cycle_recursive_ty_alias_help1);
diag.help(__message);
let __message =
diag.eagerly_translate(crate::fluent_generated::query_system_cycle_recursive_ty_alias_help2);
diag.help(__message);
diag.restore_args();
}
Alias::Trait => {
diag.store_args();
let __message =
diag.eagerly_translate(crate::fluent_generated::query_system_cycle_recursive_trait_alias);
diag.note(__message);
diag.restore_args();
}
}
}
}
};Subdiagnostic)]
31pub(crate) enum Alias {
32 #[note(query_system_cycle_recursive_ty_alias)]
33 #[help(query_system_cycle_recursive_ty_alias_help1)]
34 #[help(query_system_cycle_recursive_ty_alias_help2)]
35 Ty,
36 #[note(query_system_cycle_recursive_trait_alias)]
37 Trait,
38}
39
40#[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for CycleUsage {
fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
where __G: rustc_errors::EmissionGuarantee {
match self {
CycleUsage { span: __binding_0, usage: __binding_1 } => {
diag.store_args();
diag.arg("usage", __binding_1);
let __message =
diag.eagerly_translate(crate::fluent_generated::query_system_cycle_usage);
diag.span_note(__binding_0, __message);
diag.restore_args();
}
}
}
}
};Subdiagnostic)]
41#[note(query_system_cycle_usage)]
42pub(crate) struct CycleUsage {
43 #[primary_span]
44 pub span: Span,
45 pub usage: String,
46}
47
48#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for Cycle where
G: rustc_errors::EmissionGuarantee {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
match self {
Cycle {
span: __binding_0,
stack_bottom: __binding_1,
cycle_stack: __binding_2,
stack_count: __binding_3,
alias: __binding_4,
cycle_usage: __binding_5,
note_span: __binding_6 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
crate::fluent_generated::query_system_cycle);
diag.code(E0391);
;
diag.arg("stack_bottom", __binding_1);
diag.span(__binding_0);
for __binding_2 in __binding_2 {
diag.subdiagnostic(__binding_2);
}
diag.subdiagnostic(__binding_3);
if let Some(__binding_4) = __binding_4 {
diag.subdiagnostic(__binding_4);
}
if let Some(__binding_5) = __binding_5 {
diag.subdiagnostic(__binding_5);
}
diag.note(crate::fluent_generated::_subdiag::note);
diag
}
}
}
}
};Diagnostic)]
49#[diag(query_system_cycle, code = E0391)]
50pub(crate) struct Cycle {
51 #[primary_span]
52 pub span: Span,
53 pub stack_bottom: String,
54 #[subdiagnostic]
55 pub cycle_stack: Vec<CycleStack>,
56 #[subdiagnostic]
57 pub stack_count: StackCount,
58 #[subdiagnostic]
59 pub alias: Option<Alias>,
60 #[subdiagnostic]
61 pub cycle_usage: Option<CycleUsage>,
62 #[note]
63 pub note_span: (),
64}
65
66#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for Reentrant
where G: rustc_errors::EmissionGuarantee {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
match self {
Reentrant => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
crate::fluent_generated::query_system_reentrant);
;
diag
}
}
}
}
};Diagnostic)]
67#[diag(query_system_reentrant)]
68pub(crate) struct Reentrant;
69
70#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
IncrementCompilation where G: rustc_errors::EmissionGuarantee {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
match self {
IncrementCompilation {
run_cmd: __binding_0, dep_node: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
crate::fluent_generated::query_system_increment_compilation);
diag.note(crate::fluent_generated::query_system_increment_compilation_note1);
diag.note(crate::fluent_generated::query_system_increment_compilation_note2);
diag.note(crate::fluent_generated::query_system_increment_compilation_note3);
diag.note(crate::fluent_generated::query_system_increment_compilation_note4);
;
diag.arg("run_cmd", __binding_0);
diag.arg("dep_node", __binding_1);
diag
}
}
}
}
};Diagnostic)]
71#[diag(query_system_increment_compilation)]
72#[note(query_system_increment_compilation_note1)]
73#[note(query_system_increment_compilation_note2)]
74#[note(query_system_increment_compilation_note3)]
75#[note(query_system_increment_compilation_note4)]
76pub(crate) struct IncrementCompilation {
77 pub run_cmd: String,
78 pub dep_node: String,
79}
80
81#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for QueryOverflow
where G: rustc_errors::EmissionGuarantee {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
match self {
QueryOverflow {
span: __binding_0,
note: __binding_1,
suggested_limit: __binding_2,
crate_name: __binding_3 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
crate::fluent_generated::query_system_query_overflow);
diag.help(crate::fluent_generated::_subdiag::help);
;
diag.arg("suggested_limit", __binding_2);
diag.arg("crate_name", __binding_3);
diag.span(__binding_0);
diag.subdiagnostic(__binding_1);
diag
}
}
}
}
};Diagnostic)]
82#[help]
83#[diag(query_system_query_overflow)]
84pub struct QueryOverflow {
85 #[primary_span]
86 pub span: Span,
87 #[subdiagnostic]
88 pub note: QueryOverflowNote,
89 pub suggested_limit: Limit,
90 pub crate_name: Symbol,
91}
92
93#[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for QueryOverflowNote {
fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
where __G: rustc_errors::EmissionGuarantee {
match self {
QueryOverflowNote { desc: __binding_0, depth: __binding_1 }
=> {
diag.store_args();
diag.arg("desc", __binding_0);
diag.arg("depth", __binding_1);
let __message =
diag.eagerly_translate(crate::fluent_generated::query_system_overflow_note);
diag.note(__message);
diag.restore_args();
}
}
}
}
};Subdiagnostic)]
94#[note(query_system_overflow_note)]
95pub struct QueryOverflowNote {
96 pub desc: String,
97 pub depth: usize,
98}