Skip to main content

rustc_middle/
error.rs

1use std::io;
2use std::path::Path;
3
4use rustc_errors::codes::*;
5use rustc_macros::{Diagnostic, Subdiagnostic};
6use rustc_span::{Span, Symbol};
7
8use crate::ty::{Instance, Ty};
9
10#[derive(const _: () =
    {
        impl<'_sess, 'tcx, G> rustc_errors::Diagnostic<'_sess, G> for
            DropCheckOverflow<'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 {
                    DropCheckOverflow {
                        span: __binding_0, ty: __binding_1, overflow_ty: __binding_2
                        } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("overflow while adding drop-check rules for `{$ty}`")));
                        diag.code(E0320);
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("overflowed on `{$overflow_ty}`")));
                        ;
                        diag.arg("ty", __binding_1);
                        diag.arg("overflow_ty", __binding_2);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
11#[diag("overflow while adding drop-check rules for `{$ty}`", code = E0320)]
12#[note("overflowed on `{$overflow_ty}`")]
13pub(crate) struct DropCheckOverflow<'tcx> {
14    #[primary_span]
15    pub span: Span,
16    pub ty: Ty<'tcx>,
17    pub overflow_ty: Ty<'tcx>,
18}
19
20#[derive(const _: () =
    {
        impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
            FailedWritingFile<'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 {
                    FailedWritingFile { path: __binding_0, error: __binding_1 }
                        => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to write file {$path}: {$error}")));
                        ;
                        diag.arg("path", __binding_0);
                        diag.arg("error", __binding_1);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
21#[diag("failed to write file {$path}: {$error}")]
22pub(crate) struct FailedWritingFile<'a> {
23    pub path: &'a Path,
24    pub error: io::Error,
25}
26
27#[derive(const _: () =
    {
        impl<'_sess, 'tcx, G> rustc_errors::Diagnostic<'_sess, G> for
            OpaqueHiddenTypeMismatch<'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 {
                    OpaqueHiddenTypeMismatch {
                        self_ty: __binding_0,
                        other_ty: __binding_1,
                        other_span: __binding_2,
                        sub: __binding_3 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("concrete type differs from previous defining opaque type use")));
                        ;
                        diag.arg("self_ty", __binding_0);
                        diag.arg("other_ty", __binding_1);
                        diag.span(__binding_2);
                        diag.span_label(__binding_2,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("expected `{$self_ty}`, got `{$other_ty}`")));
                        diag.subdiagnostic(__binding_3);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
28#[diag("concrete type differs from previous defining opaque type use")]
29pub(crate) struct OpaqueHiddenTypeMismatch<'tcx> {
30    pub self_ty: Ty<'tcx>,
31    pub other_ty: Ty<'tcx>,
32    #[primary_span]
33    #[label("expected `{$self_ty}`, got `{$other_ty}`")]
34    pub other_span: Span,
35    #[subdiagnostic]
36    pub sub: TypeMismatchReason,
37}
38
39#[derive(const _: () =
    {
        impl rustc_errors::Subdiagnostic for TypeMismatchReason {
            fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
                where __G: rustc_errors::EmissionGuarantee {
                match self {
                    TypeMismatchReason::ConflictType { span: __binding_0 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this expression supplies two conflicting concrete types for the same opaque type")),
                                &sub_args);
                        diag.span_label(__binding_0, __message);
                    }
                    TypeMismatchReason::PreviousUse { span: __binding_0 } => {
                        let mut sub_args = rustc_errors::DiagArgMap::default();
                        let __message =
                            rustc_errors::format_diag_message(&rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("previous use here")),
                                &sub_args);
                        diag.span_note(__binding_0, __message);
                    }
                }
            }
        }
    };Subdiagnostic)]
40pub(crate) enum TypeMismatchReason {
41    #[label("this expression supplies two conflicting concrete types for the same opaque type")]
42    ConflictType {
43        #[primary_span]
44        span: Span,
45    },
46    #[note("previous use here")]
47    PreviousUse {
48        #[primary_span]
49        span: Span,
50    },
51}
52
53#[derive(const _: () =
    {
        impl<'_sess, 'tcx, G> rustc_errors::Diagnostic<'_sess, G> for
            RecursionLimitReached<'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 {
                    RecursionLimitReached {
                        span: __binding_0,
                        ty: __binding_1,
                        suggested_limit: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("reached the recursion limit finding the struct tail for `{$ty}`")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider increasing the recursion limit by adding a `#![recursion_limit = \"{$suggested_limit}\"]`")));
                        ;
                        diag.arg("ty", __binding_1);
                        diag.arg("suggested_limit", __binding_2);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
54#[diag("reached the recursion limit finding the struct tail for `{$ty}`")]
55#[help(
56    "consider increasing the recursion limit by adding a `#![recursion_limit = \"{$suggested_limit}\"]`"
57)]
58pub(crate) struct RecursionLimitReached<'tcx> {
59    #[primary_span]
60    pub span: Span,
61    pub ty: Ty<'tcx>,
62    pub suggested_limit: rustc_data_structures::Limit,
63}
64
65#[derive(const _: () =
    {
        impl<'_sess, 'tcx, G> rustc_errors::Diagnostic<'_sess, G> for
            RecursionLimitReachedSizeSkeleton<'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 {
                    RecursionLimitReachedSizeSkeleton {
                        span: __binding_0,
                        ty: __binding_1,
                        suggested_limit: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("reached the recursion limit while computing the size of `{$ty}`")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider increasing the recursion limit by adding a `#![recursion_limit = \"{$suggested_limit}\"]`")));
                        ;
                        diag.arg("ty", __binding_1);
                        diag.arg("suggested_limit", __binding_2);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
66#[diag("reached the recursion limit while computing the size of `{$ty}`")]
67#[help(
68    "consider increasing the recursion limit by adding a `#![recursion_limit = \"{$suggested_limit}\"]`"
69)]
70pub(crate) struct RecursionLimitReachedSizeSkeleton<'tcx> {
71    #[primary_span]
72    pub span: Span,
73    pub ty: Ty<'tcx>,
74    pub suggested_limit: rustc_data_structures::Limit,
75}
76
77#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            ConstEvalNonIntError 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 {
                    ConstEvalNonIntError { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("constant evaluation of enum discriminant resulted in non-integer")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
78#[diag("constant evaluation of enum discriminant resulted in non-integer")]
79pub(crate) struct ConstEvalNonIntError {
80    #[primary_span]
81    pub span: Span,
82}
83
84#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            StrictCoherenceNeedsNegativeCoherence 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 {
                    StrictCoherenceNeedsNegativeCoherence {
                        span: __binding_0, attr_span: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("to use `strict_coherence` on this trait, the `with_negative_coherence` feature must be enabled")));
                        ;
                        diag.span(__binding_0);
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("due to this attribute")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
85#[diag(
86    "to use `strict_coherence` on this trait, the `with_negative_coherence` feature must be enabled"
87)]
88pub(crate) struct StrictCoherenceNeedsNegativeCoherence {
89    #[primary_span]
90    pub span: Span,
91    #[label("due to this attribute")]
92    pub attr_span: Span,
93}
94
95#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            RequiresLangItem 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 {
                    RequiresLangItem { span: __binding_0, name: __binding_1 } =>
                        {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("requires `{$name}` lang_item")));
                        ;
                        diag.arg("name", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
96#[diag("requires `{$name}` lang_item")]
97pub(crate) struct RequiresLangItem {
98    #[primary_span]
99    pub span: Span,
100    pub name: Symbol,
101}
102
103#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            ConstNotUsedTraitAlias 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 {
                    ConstNotUsedTraitAlias { ct: __binding_0, span: __binding_1
                        } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("const parameter `{$ct}` is part of concrete type but not used in parameter list for the `impl Trait` type alias")));
                        ;
                        diag.arg("ct", __binding_0);
                        diag.span(__binding_1);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
104#[diag(
105    "const parameter `{$ct}` is part of concrete type but not used in parameter list for the `impl Trait` type alias"
106)]
107pub(super) struct ConstNotUsedTraitAlias {
108    pub ct: String,
109    #[primary_span]
110    pub span: Span,
111}
112
113#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            ErroneousConstant 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 {
                    ErroneousConstant { span: __binding_0 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("erroneous constant encountered")));
                        ;
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
114#[diag("erroneous constant encountered")]
115pub(crate) struct ErroneousConstant {
116    #[primary_span]
117    pub span: Span,
118}
119
120#[derive(const _: () =
    {
        impl<'_sess, 'tcx, G> rustc_errors::Diagnostic<'_sess, G> for
            TypeLengthLimit<'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 {
                    TypeLengthLimit {
                        span: __binding_0,
                        instance: __binding_1,
                        type_length: __binding_2 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("reached the type-length limit while instantiating `{$instance}`")));
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider adding a `#![type_length_limit=\"{$type_length}\"]` attribute to your crate")));
                        ;
                        diag.arg("instance", __binding_1);
                        diag.arg("type_length", __binding_2);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
121#[diag("reached the type-length limit while instantiating `{$instance}`")]
122#[help("consider adding a `#![type_length_limit=\"{$type_length}\"]` attribute to your crate")]
123pub(crate) struct TypeLengthLimit<'tcx> {
124    #[primary_span]
125    pub span: Span,
126    pub instance: Instance<'tcx>,
127    pub type_length: usize,
128}
129
130#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            MaxNumNodesInValtree 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 {
                    MaxNumNodesInValtree {
                        span: __binding_0, global_const_id: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("maximum number of nodes exceeded in constant {$global_const_id}")));
                        ;
                        diag.arg("global_const_id", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
131#[diag("maximum number of nodes exceeded in constant {$global_const_id}")]
132pub(crate) struct MaxNumNodesInValtree {
133    #[primary_span]
134    pub span: Span,
135    pub global_const_id: String,
136}
137
138#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            InvalidConstInValtree 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 {
                    InvalidConstInValtree {
                        span: __binding_0, global_const_id: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("constant {$global_const_id} cannot be used as pattern")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("constants that reference mutable or external memory or that contain dangling references cannot be used as patterns")));
                        ;
                        diag.arg("global_const_id", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
139#[diag("constant {$global_const_id} cannot be used as pattern")]
140#[note(
141    "constants that reference mutable or external memory or that contain dangling references cannot be used as patterns"
142)]
143pub(crate) struct InvalidConstInValtree {
144    #[primary_span]
145    pub span: Span,
146    pub global_const_id: String,
147}
148
149#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            CyclicConstInValtree 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 {
                    CyclicConstInValtree {
                        span: __binding_0, global_const_id: __binding_1 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("constant {$global_const_id} cannot be used as pattern")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("constants whose type references itself cannot be used as patterns")));
                        ;
                        diag.arg("global_const_id", __binding_1);
                        diag.span(__binding_0);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
150#[diag("constant {$global_const_id} cannot be used as pattern")]
151#[note("constants whose type references itself cannot be used as patterns")]
152pub(crate) struct CyclicConstInValtree {
153    #[primary_span]
154    pub span: Span,
155    pub global_const_id: String,
156}
157
158#[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,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("internal compiler error: reentrant incremental verify failure, suppressing message")));
                        ;
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
159#[diag("internal compiler error: reentrant incremental verify failure, suppressing message")]
160pub(crate) struct Reentrant;
161
162#[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,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("internal compiler error: encountered incremental compilation error with {$dep_node}")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("please follow the instructions below to create a bug report with the provided information")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("for incremental compilation bugs, having a reproduction is vital")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("an ideal reproduction consists of the code before and some patch that then triggers the bug when applied and compiled again")));
                        diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("as a workaround, you can {$run_cmd} to allow your project to compile")));
                        ;
                        diag.arg("run_cmd", __binding_0);
                        diag.arg("dep_node", __binding_1);
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
163#[diag("internal compiler error: encountered incremental compilation error with {$dep_node}")]
164#[note("please follow the instructions below to create a bug report with the provided information")]
165#[note("for incremental compilation bugs, having a reproduction is vital")]
166#[note(
167    "an ideal reproduction consists of the code before and some patch that then triggers the bug when applied and compiled again"
168)]
169#[note("as a workaround, you can {$run_cmd} to allow your project to compile")]
170pub(crate) struct IncrementCompilation {
171    pub run_cmd: String,
172    pub dep_node: String,
173}
174
175#[derive(const _: () =
    {
        impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
            DuplicateEiiImpls 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 {
                    DuplicateEiiImpls {
                        name: __binding_0,
                        first_span: __binding_1,
                        first_crate: __binding_2,
                        second_span: __binding_3,
                        second_crate: __binding_4,
                        additional_crates: __binding_5,
                        num_additional_crates: __binding_6,
                        additional_crate_names: __binding_7,
                        help: __binding_8 } => {
                        let mut diag =
                            rustc_errors::Diag::new(dcx, level,
                                rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("multiple implementations of `#[{$name}]`")));
                        ;
                        diag.arg("name", __binding_0);
                        diag.arg("first_crate", __binding_2);
                        diag.arg("second_crate", __binding_4);
                        diag.arg("num_additional_crates", __binding_6);
                        diag.arg("additional_crate_names", __binding_7);
                        diag.span(__binding_1);
                        diag.span_label(__binding_1,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("first implemented here in crate `{$first_crate}`")));
                        diag.span_label(__binding_3,
                            rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("also implemented here in crate `{$second_crate}`")));
                        if let Some(__binding_5) = __binding_5 {
                            diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("in addition to these two, { $num_additional_crates ->\n        [one] another implementation was found in crate {$additional_crate_names}\n        *[other] more implementations were also found in the following crates: {$additional_crate_names}\n    }")));
                        }
                        diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("an \"externally implementable item\" can only have a single implementation in the final artifact. When multiple implementations are found, also in different crates, they conflict")));
                        diag
                    }
                }
            }
        }
    };Diagnostic)]
176#[diag("multiple implementations of `#[{$name}]`")]
177pub struct DuplicateEiiImpls {
178    pub name: Symbol,
179
180    #[primary_span]
181    #[label("first implemented here in crate `{$first_crate}`")]
182    pub first_span: Span,
183    pub first_crate: Symbol,
184
185    #[label("also implemented here in crate `{$second_crate}`")]
186    pub second_span: Span,
187    pub second_crate: Symbol,
188
189    #[note("in addition to these two, { $num_additional_crates ->
190        [one] another implementation was found in crate {$additional_crate_names}
191        *[other] more implementations were also found in the following crates: {$additional_crate_names}
192    }")]
193    pub additional_crates: Option<()>,
194
195    pub num_additional_crates: usize,
196    pub additional_crate_names: String,
197
198    #[help(
199        "an \"externally implementable item\" can only have a single implementation in the final artifact. When multiple implementations are found, also in different crates, they conflict"
200    )]
201    pub help: (),
202}