rustc_monomorphize/
errors.rs

1use rustc_macros::{Diagnostic, LintDiagnostic};
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,
                                crate::fluent_generated::monomorphize_recursion_limit);
                        ;
                        diag.arg("instance", __binding_1);
                        diag.arg("def_path_str", __binding_3);
                        diag.span(__binding_0);
                        diag.span_note(__binding_2,
                            crate::fluent_generated::_subdiag::note);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
6#[diag(monomorphize_recursion_limit)]
7pub(crate) struct RecursionLimit<'tcx> {
8    #[primary_span]
9    pub span: Span,
10    pub instance: Instance<'tcx>,
11    #[note]
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,
                                crate::fluent_generated::monomorphize_no_optimized_mir);
                        ;
                        diag.arg("crate_name", __binding_1);
                        diag.arg("instance", __binding_2);
                        diag.span_note(__binding_0,
                            crate::fluent_generated::_subdiag::note);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
17#[diag(monomorphize_no_optimized_mir)]
18pub(crate) struct NoOptimizedMir {
19    #[note]
20    pub span: Span,
21    pub crate_name: Symbol,
22    pub instance: String,
23}
24
25#[derive(const _: () =
    {
        impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
            LargeAssignmentsLint {
            #[track_caller]
            fn decorate_lint<'__b>(self,
                diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
                match self {
                    LargeAssignmentsLint {
                        span: __binding_0, size: __binding_1, limit: __binding_2 }
                        => {
                        diag.primary_message(crate::fluent_generated::monomorphize_large_assignments);
                        diag.note(crate::fluent_generated::_subdiag::note);
                        ;
                        diag.arg("size", __binding_1);
                        diag.arg("limit", __binding_2);
                        diag.span_label(__binding_0,
                            crate::fluent_generated::_subdiag::label);
                        diag
                    }
                };
            }
        }
    };LintDiagnostic)]
26#[diag(monomorphize_large_assignments)]
27#[note]
28pub(crate) struct LargeAssignmentsLint {
29    #[label]
30    pub span: Span,
31    pub size: u64,
32    pub limit: u64,
33}
34
35#[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,
                                crate::fluent_generated::monomorphize_symbol_already_defined);
                        ;
                        diag.arg("symbol", __binding_1);
                        if let Some(__binding_0) = __binding_0 {
                            diag.span(__binding_0);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
36#[diag(monomorphize_symbol_already_defined)]
37pub(crate) struct SymbolAlreadyDefined {
38    #[primary_span]
39    pub span: Option<Span>,
40    pub symbol: String,
41}
42
43#[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,
                                crate::fluent_generated::monomorphize_couldnt_dump_mono_stats);
                        ;
                        diag.arg("error", __binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
44#[diag(monomorphize_couldnt_dump_mono_stats)]
45pub(crate) struct CouldntDumpMonoStats {
46    pub error: String,
47}
48
49#[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,
                                crate::fluent_generated::monomorphize_encountered_error_while_instantiating);
                        ;
                        diag.arg("kind", __binding_1);
                        diag.arg("instance", __binding_2);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
50#[diag(monomorphize_encountered_error_while_instantiating)]
51pub(crate) struct EncounteredErrorWhileInstantiating<'tcx> {
52    #[primary_span]
53    pub span: Span,
54    pub kind: &'static str,
55    pub instance: Instance<'tcx>,
56}
57
58#[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,
                                crate::fluent_generated::monomorphize_encountered_error_while_instantiating_global_asm);
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
59#[diag(monomorphize_encountered_error_while_instantiating_global_asm)]
60pub(crate) struct EncounteredErrorWhileInstantiatingGlobalAsm {
61    #[primary_span]
62    pub span: Span,
63}
64
65#[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,
                                crate::fluent_generated::monomorphize_start_not_found);
                        diag.help(crate::fluent_generated::_subdiag::help);
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
66#[diag(monomorphize_start_not_found)]
67#[help]
68pub(crate) struct StartNotFound;
69
70#[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,
                        ty: __binding_2,
                        is_call: __binding_3,
                        is_scalable: __binding_4 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                crate::fluent_generated::monomorphize_abi_error_disabled_vector_type);
                        diag.help(crate::fluent_generated::_subdiag::help);
                        ;
                        diag.arg("required_feature", __binding_1);
                        diag.arg("ty", __binding_2);
                        diag.arg("is_call", __binding_3);
                        diag.arg("is_scalable", __binding_4);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            crate::fluent_generated::_subdiag::label);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
71#[diag(monomorphize_abi_error_disabled_vector_type)]
72#[help]
73pub(crate) struct AbiErrorDisabledVectorType<'a> {
74    #[primary_span]
75    #[label]
76    pub span: Span,
77    pub required_feature: &'a str,
78    pub ty: Ty<'a>,
79    /// Whether this is a problem at a call site or at a declaration.
80    pub is_call: bool,
81    /// Whether this is a problem with a fixed length vector or a scalable vector
82    pub is_scalable: bool,
83}
84
85#[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,
                                crate::fluent_generated::monomorphize_abi_error_unsupported_unsized_parameter);
                        diag.help(crate::fluent_generated::_subdiag::help);
                        ;
                        diag.arg("ty", __binding_1);
                        diag.arg("is_call", __binding_2);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            crate::fluent_generated::_subdiag::label);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
86#[diag(monomorphize_abi_error_unsupported_unsized_parameter)]
87#[help]
88pub(crate) struct AbiErrorUnsupportedUnsizedParameter<'a> {
89    #[primary_span]
90    #[label]
91    pub span: Span,
92    pub ty: Ty<'a>,
93    /// Whether this is a problem at a call site or at a declaration.
94    pub is_call: bool,
95}
96
97#[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,
                                crate::fluent_generated::monomorphize_abi_error_unsupported_vector_type);
                        ;
                        diag.arg("ty", __binding_1);
                        diag.arg("is_call", __binding_2);
                        diag.span(__binding_0);
                        diag.span_label(__binding_0,
                            crate::fluent_generated::_subdiag::label);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
98#[diag(monomorphize_abi_error_unsupported_vector_type)]
99pub(crate) struct AbiErrorUnsupportedVectorType<'a> {
100    #[primary_span]
101    #[label]
102    pub span: Span,
103    pub ty: Ty<'a>,
104    /// Whether this is a problem at a call site or at a declaration.
105    pub is_call: bool,
106}
107
108#[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,
                                crate::fluent_generated::monomorphize_abi_required_target_feature);
                        diag.help(crate::fluent_generated::_subdiag::help);
                        ;
                        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,
                            crate::fluent_generated::_subdiag::label);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
109#[diag(monomorphize_abi_required_target_feature)]
110#[help]
111pub(crate) struct AbiRequiredTargetFeature<'a> {
112    #[primary_span]
113    #[label]
114    pub span: Span,
115    pub required_feature: &'a str,
116    pub abi: &'a str,
117    /// Whether this is a problem at a call site or at a declaration.
118    pub is_call: bool,
119}
120
121#[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,
                                crate::fluent_generated::monomorphize_static_initializer_cyclic);
                        diag.note(crate::fluent_generated::_subdiag::note);
                        ;
                        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,
                                crate::fluent_generated::_subdiag::label);
                        }
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
122#[diag(monomorphize_static_initializer_cyclic)]
123#[note]
124pub(crate) struct StaticInitializerCyclic<'a> {
125    #[primary_span]
126    pub span: Span,
127    #[label]
128    pub labels: Vec<Span>,
129    pub head: &'a str,
130    pub target: &'a str,
131}