Skip to main content

rustc_monomorphize/
diagnostics.rs

1use rustc_macros::Diagnostic;
2use rustc_middle::ty::{Instance, Ty};
3use rustc_span::{Span, Symbol};
4
5#[derive(const _: () =
    {
        impl<'_sess, 'tcx, G> rustc_errors::Diagnostic<'_sess, G> for
            RecursionLimit<'tcx> 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 {
                    RecursionLimit {
                        span: __binding_0,
                        instance: __binding_1,
                        def_span: __binding_2,
                        def_path_str: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("reached the recursion limit while instantiating `{$instance}`")));
                        ;
                        diag.arg("instance", __binding_1);
                        diag.arg("def_path_str", __binding_3);
                        diag.span(__binding_0);
                        diag.span_note(__binding_2,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$def_path_str}` defined here")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
6#[diag("reached the recursion limit while instantiating `{$instance}`")]
7pub(crate) struct RecursionLimit<'tcx> {
8    #[primary_span]
9    pub span: Span,
10    pub instance: Instance<'tcx>,
11    #[note("`{$def_path_str}` defined here")]
12    pub def_span: Span,
13    pub def_path_str: String,
14}
15
16#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for NoOptimizedMir
            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 {
                    NoOptimizedMir {
                        span: __binding_0,
                        crate_name: __binding_1,
                        instance: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("missing optimized MIR for `{$instance}` in the crate `{$crate_name}`")));
                        ;
                        diag.arg("crate_name", __binding_1);
                        diag.arg("instance", __binding_2);
                        diag.span_note(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("missing optimized MIR for this item (was the crate `{$crate_name}` compiled with `--emit=metadata`?)")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
17#[diag("missing optimized MIR for `{$instance}` in the crate `{$crate_name}`")]
18pub(crate) struct NoOptimizedMir {
19    #[note(
20        "missing optimized MIR for this item (was the crate `{$crate_name}` compiled with `--emit=metadata`?)"
21    )]
22    pub span: Span,
23    pub crate_name: Symbol,
24    pub instance: String,
25}
26
27#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            LargeAssignmentsLint 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 {
                    LargeAssignmentsLint {
                        span: __binding_0, size: __binding_1, limit: __binding_2 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("moving {$size} bytes")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the current maximum size is {$limit}, but it can be customized with the move_size_limit attribute: `#![move_size_limit = \"...\"]`")));
                        ;
                        diag.arg("size", __binding_1);
                        diag.arg("limit", __binding_2);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("value moved from here")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
28#[diag("moving {$size} bytes")]
29#[note(
30    "the current maximum size is {$limit}, but it can be customized with the move_size_limit attribute: `#![move_size_limit = \"...\"]`"
31)]
32pub(crate) struct LargeAssignmentsLint {
33    #[label("value moved from here")]
34    pub span: Span,
35    pub size: u64,
36    pub limit: u64,
37}
38
39#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            SymbolAlreadyDefined 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 {
                    SymbolAlreadyDefined {
                        span: __binding_0, symbol: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("symbol `{$symbol}` is already defined")));
                        ;
                        diag.arg("symbol", __binding_1);
                        if let Some(__binding_0) = __binding_0 {
                            diag.span(__binding_0);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
40#[diag("symbol `{$symbol}` is already defined")]
41pub(crate) struct SymbolAlreadyDefined {
42    #[primary_span]
43    pub span: Option<Span>,
44    pub symbol: String,
45}
46
47#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            CouldntDumpMonoStats 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 {
                    CouldntDumpMonoStats { error: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unexpected error occurred while dumping monomorphization stats: {$error}")));
                        ;
                        diag.arg("error", __binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
48#[diag("unexpected error occurred while dumping monomorphization stats: {$error}")]
49pub(crate) struct CouldntDumpMonoStats {
50    pub error: String,
51}
52
53#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            OffloadManifestWriteError 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 {
                    OffloadManifestWriteError {
                        path: __binding_0, err: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("could not write offload monomorphization manifest to `{$path}`: {$err}")));
                        ;
                        diag.arg("path", __binding_0);
                        diag.arg("err", __binding_1);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
54#[diag("could not write offload monomorphization manifest to `{$path}`: {$err}")]
55pub(crate) struct OffloadManifestWriteError {
56    pub path: String,
57    pub err: String,
58}
59
60#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            OffloadManifestReadError 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 {
                    OffloadManifestReadError {
                        path: __binding_0, err: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("could not read offload monomorphization manifest from `{$path}`: {$err}")));
                        ;
                        diag.arg("path", __binding_0);
                        diag.arg("err", __binding_1);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
61#[diag("could not read offload monomorphization manifest from `{$path}`: {$err}")]
62pub(crate) struct OffloadManifestReadError {
63    pub path: String,
64    pub err: String,
65}
66
67#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            GenericKernelNotInstantiated 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 {
                    GenericKernelNotInstantiated {
                        span: __binding_0, def_path: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("generic offload kernel `{$def_path}` is not instantiated")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("with `-Zoffload=Device` (without a manifest), generic kernels are only discovered via monomorphization; if this kernel is called from host code, pass `-Zoffload=Device=<manifest>`, using the manifest written by `-Zoffload=HostMetadata=<manifest>`")));
                        ;
                        diag.arg("def_path", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
68#[diag("generic offload kernel `{$def_path}` is not instantiated")]
69#[help(
70    "with `-Zoffload=Device` (without a manifest), generic kernels are only discovered via \
71    monomorphization; if this kernel is called from host code, pass \
72    `-Zoffload=Device=<manifest>`, using the manifest written by `-Zoffload=HostMetadata=<manifest>`"
73)]
74pub(crate) struct GenericKernelNotInstantiated {
75    #[primary_span]
76    pub span: Span,
77    pub def_path: String,
78}
79
80#[derive(const _: () =
    {
        impl<'_sess, 'tcx, G> rustc_errors::Diagnostic<'_sess, G> for
            EncounteredErrorWhileInstantiating<'tcx> 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 {
                    EncounteredErrorWhileInstantiating {
                        span: __binding_0, kind: __binding_1, instance: __binding_2
                        } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the above error was encountered while instantiating `{$kind} {$instance}`")));
                        ;
                        diag.arg("kind", __binding_1);
                        diag.arg("instance", __binding_2);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
81#[diag("the above error was encountered while instantiating `{$kind} {$instance}`")]
82pub(crate) struct EncounteredErrorWhileInstantiating<'tcx> {
83    #[primary_span]
84    pub span: Span,
85    pub kind: &'static str,
86    pub instance: Instance<'tcx>,
87}
88
89#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            EncounteredErrorWhileInstantiatingGlobalAsm 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 {
                    EncounteredErrorWhileInstantiatingGlobalAsm {
                        span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the above error was encountered while instantiating `global_asm`")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
90#[diag("the above error was encountered while instantiating `global_asm`")]
91pub(crate) struct EncounteredErrorWhileInstantiatingGlobalAsm {
92    #[primary_span]
93    pub span: Span,
94}
95
96#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for StartNotFound
            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 {
                    StartNotFound => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("using `fn main` requires the standard library")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use `#![no_main]` to bypass the Rust generated entrypoint and declare a platform specific entrypoint yourself, usually with `#[no_mangle]`")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
97#[diag("using `fn main` requires the standard library")]
98#[help(
99    "use `#![no_main]` to bypass the Rust generated entrypoint and declare a platform specific entrypoint yourself, usually with `#[no_mangle]`"
100)]
101pub(crate) struct StartNotFound;
102
103#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            AbiErrorDisabledVectorType<'a> 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 {
                    AbiErrorDisabledVectorType {
                        span: __binding_0,
                        required_feature: __binding_1,
                        abi: __binding_2,
                        ty: __binding_3,
                        is_call: __binding_4,
                        is_scalable: __binding_5 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this function {$is_call ->\n        [true] call\n        *[false] definition\n    } requires the `{$required_feature}` target feature, which is not enabled{$is_call ->\n        [true] {\" \"}in the caller\n        *[false] {\"\"}\n    }")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the function has type `{$ty}` in its signature, which is passed in {$is_scalable ->\n        [true] scalable\n        *[false] SIMD\n    } vector registers under the \"{$abi}\" ABI")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider enabling the missing target feature globally (`-C target-feature=+{$required_feature}`) or locally (`#[target_feature(enable=\"{$required_feature}\")]`)")));
                        ;
                        diag.arg("required_feature", __binding_1);
                        diag.arg("abi", __binding_2);
                        diag.arg("ty", __binding_3);
                        diag.arg("is_call", __binding_4);
                        diag.arg("is_scalable", __binding_5);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("function {$is_call ->\n        [true] called\n        *[false] defined\n    } here")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
104#[diag(
105    "this function {$is_call ->
106        [true] call
107        *[false] definition
108    } requires the `{$required_feature}` target feature, which is not enabled{$is_call ->
109        [true] {\" \"}in the caller
110        *[false] {\"\"}
111    }"
112)]
113#[note(
114    "the function has type `{$ty}` in its signature, which is passed in {$is_scalable ->
115        [true] scalable
116        *[false] SIMD
117    } vector registers under the \"{$abi}\" ABI"
118)]
119#[help(
120    "consider enabling the missing target feature globally (`-C target-feature=+{$required_feature}`) or locally (`#[target_feature(enable=\"{$required_feature}\")]`)"
121)]
122pub(crate) struct AbiErrorDisabledVectorType<'a> {
123    #[primary_span]
124    #[label(
125        "function {$is_call ->
126        [true] called
127        *[false] defined
128    } here"
129    )]
130    pub span: Span,
131    pub required_feature: &'a str,
132    pub abi: String,
133    pub ty: Ty<'a>,
134    /// Whether this is a problem at a call site or at a declaration.
135    pub is_call: bool,
136    /// Whether this is a problem with a fixed length vector or a scalable vector
137    pub is_scalable: bool,
138}
139
140#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            AbiErrorUnsupportedUnsizedParameter<'a> 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 {
                    AbiErrorUnsupportedUnsizedParameter {
                        span: __binding_0, ty: __binding_1, is_call: __binding_2 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this function {$is_call ->\n        [true] call\n        *[false] definition\n    } uses unsized type `{$ty}` which is not supported with the chosen ABI")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("only rustic ABIs support unsized parameters")));
                        ;
                        diag.arg("ty", __binding_1);
                        diag.arg("is_call", __binding_2);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("function {$is_call ->\n            [true] called\n            *[false] defined\n        } here")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
141#[diag(
142    "this function {$is_call ->
143        [true] call
144        *[false] definition
145    } uses unsized type `{$ty}` which is not supported with the chosen ABI"
146)]
147#[help("only rustic ABIs support unsized parameters")]
148pub(crate) struct AbiErrorUnsupportedUnsizedParameter<'a> {
149    #[primary_span]
150    #[label(
151        "function {$is_call ->
152            [true] called
153            *[false] defined
154        } here"
155    )]
156    pub span: Span,
157    pub ty: Ty<'a>,
158    /// Whether this is a problem at a call site or at a declaration.
159    pub is_call: bool,
160}
161
162#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            AbiErrorUnsupportedVectorType<'a> 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 {
                    AbiErrorUnsupportedVectorType {
                        span: __binding_0, ty: __binding_1, is_call: __binding_2 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this function {$is_call ->\n        [true] call\n        *[false] definition\n    } uses SIMD vector type `{$ty}` which is not currently supported with the chosen ABI")));
                        ;
                        diag.arg("ty", __binding_1);
                        diag.arg("is_call", __binding_2);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("function {$is_call ->\n            [true] called\n            *[false] defined\n        } here")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
163#[diag(
164    "this function {$is_call ->
165        [true] call
166        *[false] definition
167    } uses SIMD vector type `{$ty}` which is not currently supported with the chosen ABI"
168)]
169pub(crate) struct AbiErrorUnsupportedVectorType<'a> {
170    #[primary_span]
171    #[label(
172        "function {$is_call ->
173            [true] called
174            *[false] defined
175        } here"
176    )]
177    pub span: Span,
178    pub ty: Ty<'a>,
179    /// Whether this is a problem at a call site or at a declaration.
180    pub is_call: bool,
181}
182
183#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            AbiRequiredTargetFeature<'a> 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 {
                    AbiRequiredTargetFeature {
                        span: __binding_0,
                        required_feature: __binding_1,
                        abi: __binding_2,
                        is_call: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this function {$is_call ->\n    [true] call\n    *[false] definition\n} uses ABI \"{$abi}\" which requires the `{$required_feature}` target feature, which is not enabled{$is_call ->\n    [true] {\" \"}in the caller\n    *[false] {\"\"}\n}")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider enabling it globally (`-C target-feature=+{$required_feature}`) or locally (`#[target_feature(enable=\"{$required_feature}\")]`)")));
                        ;
                        diag.arg("required_feature", __binding_1);
                        diag.arg("abi", __binding_2);
                        diag.arg("is_call", __binding_3);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("function {$is_call ->\n            [true] called\n            *[false] defined\n        } here")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
184#[diag("this function {$is_call ->
185    [true] call
186    *[false] definition
187} uses ABI \"{$abi}\" which requires the `{$required_feature}` target feature, which is not enabled{$is_call ->
188    [true] {\" \"}in the caller
189    *[false] {\"\"}
190}")]
191#[help(
192    "consider enabling it globally (`-C target-feature=+{$required_feature}`) or locally (`#[target_feature(enable=\"{$required_feature}\")]`)"
193)]
194pub(crate) struct AbiRequiredTargetFeature<'a> {
195    #[primary_span]
196    #[label(
197        "function {$is_call ->
198            [true] called
199            *[false] defined
200        } here"
201    )]
202    pub span: Span,
203    pub required_feature: &'a str,
204    pub abi: &'a str,
205    /// Whether this is a problem at a call site or at a declaration.
206    pub is_call: bool,
207}
208
209#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            StaticInitializerCyclic<'a> 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 {
                    StaticInitializerCyclic {
                        span: __binding_0,
                        labels: __binding_1,
                        head: __binding_2,
                        target: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("static initializer forms a cycle involving `{$head}`")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("cyclic static initializers are not supported for target `{$target}`")));
                        ;
                        diag.arg("head", __binding_2);
                        diag.arg("target", __binding_3);
                        diag.span(__binding_0);
                        for __binding_1 in __binding_1 {
                            diag.span_label(__binding_1,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("part of this cycle")));
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
210#[diag("static initializer forms a cycle involving `{$head}`")]
211#[note("cyclic static initializers are not supported for target `{$target}`")]
212pub(crate) struct StaticInitializerCyclic<'a> {
213    #[primary_span]
214    pub span: Span,
215    #[label("part of this cycle")]
216    pub labels: Vec<Span>,
217    pub head: &'a str,
218    pub target: &'a str,
219}